Function to get all the user permissions
There is a Drupal function for that, user_permission_get_modules(), which returns an associative array, whose keys are the permissions and values are the modules that define those permissions.

If you only need the permissions without the module names, you can use array_keys:

$permissions = user_permission_get_modules();
$permissions = array_keys($permissions);