[SSSD] [PATCH] UTIL: Ignore insufficient permission for some proc files

Lukas Slebodnik lslebodn at redhat.com
Mon Mar 17 21:39:07 UTC 2014


On (17/03/14 22:16), Jakub Hrozek wrote:
>On Mon, Mar 17, 2014 at 01:32:39PM +0100, Lukas Slebodnik wrote:
>> On (17/03/14 08:05), Stephen Gallagher wrote:
>> >On 03/17/2014 04:02 AM, Lukas Slebodnik wrote:
>> >> ehlo,
>> >>
>> >> Attached patch fixes problem with find-uid test on altlinux. Alexey
>> >> Shabalin reported this in another thread.
>> >>
>> >
>> >
>> >I've seen that intermittently when building with systemd in Koji as
>> >well. I think there's a more fundamental problem here, and I'd
>> >recommend not just papering over it. It's likely either a systemd bug
>> >or a misunderstanding about how it interacts when building in a chroot.
>> >
>> proc fylesystem is not mount with option hidepid=1 on fedora.
>> maybe, you hit another bug.
>>
>> LS
>
>I was thinking about this on my way home and I wonder if we could wrap
>Lukas's change in an #ifdef either based on a define passed during build
>(-DSSS_PROC_HIDEPID) or automatically detected if possible. I agree with
>Stephen that we shouldn't hide any potential issues by simply skipping
>the EPERM error code.

I can reproduce failed test with "hidepid=1" only if I run find_uid-tests
as ordinary user. Test will pass if I run it as a root.

What kind of potential issues do you mean?

diff --git a/src/util/find_uid.c b/src/util/find_uid.c
index d34a4abd2c2bb4965ff49b9a750f387519544b0e..95991ebf2b14ff27a6a3740bfa048b5cfc631e94 100644
--- a/src/util/find_uid.c
+++ b/src/util/find_uid.c
@@ -223,6 +223,9 @@
static errno_t get_active_uid_linux(hash_table_t *table, uid_t search_uid)
         }

//snip

    while ((dirent = readdir(proc_dir)) != NULL) {
         if (only_numbers(dirent->d_name) != 0) continue;
         ret = name_to_pid(dirent->d_name, &pid);
         if (ret != EOK) {
             DEBUG(SSSDBG_CRIT_FAILURE, "name_to_pid failed.\n");
             goto done;
         }

         ret = get_uid_from_pid(pid, &uid);
         //Issue is logged in function get_uid_from_pid
         //DEBUG(SSSDBG_CRIT_FAILURE,
         //      "open failed [%d][%s].\n", error, strerror(error));

+        if (ret == EPERM) {
+            continue;
+        }

         if (ret != EOK) {
             DEBUG(1, ("get_uid_from_pid failed.\n"));
             goto done;


LS



More information about the sssd-devel mailing list