[systemd-devel] [PATCH] smack: check smack cache after /sys mount

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Jul 16 12:40:30 PDT 2014


On Thu, Jul 17, 2014 at 01:29:38AM +0900, WaLyong Cho wrote:
> use_smack_cached is capability of smack. That is not changed on
> runtime. So that should be a cache for performance. But the cache is
> updated as wrong value(maybe 0) upon calling first mount_one. At this
> time, until v210 "/proc" will be tried. After v211 "/sys" will be
> tried. But both of first trial of mount_one "/sys" is NOT mounted
> yet. Because even if the first trial is "/sys", use_smack is called
> before mount by label_mkdir. So the cache will always have 0.
> To avoid, smack cache should be updated when only "/sys" is mounted
> and smack cache is have initial value.
> ---
Is this still an issue after http://cgit.freedesktop.org/systemd/systemd/commit/?id=d1d8e5d49f?


> -        if (use_smack_cached < 0)
> +        if (use_smack_cached < 0 &&
> +            path_is_mount_point("/sys", false) > 0)
>                  use_smack_cached = access("/sys/fs/smackfs/", F_OK) >= 0;

Like it was said before, if this check is done at any point before
it can return a valid result, *something* will be done wrong by systemd.
So the only option is to fix it or delay all callers to always have
a valid result.

Zbyszek


More information about the systemd-devel mailing list