From: Unsung Lee Date: Fri, 10 Jan 2025 02:23:33 +0000 (+0900) Subject: kdbus: Replace the code that reads the attr with check code X-Git-Tag: accepted/tizen/unified/20250113.094324^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_unified_x_asan;p=platform%2Fkernel%2Flinux-tizen-modules-source.git kdbus: Replace the code that reads the attr with check code Replace the code that directly accesses and read /proc/self/attr/current with check code to /sys/fs/smackfs. This is because, direct accessing and reading to /proc/self/attr/current is invalid when SMACK is disabled. Change-Id: I4d74377c0e7cd0d55e8720e692e49bb36c3ecd6e Signed-off-by: Unsung Lee --- diff --git a/packaging/linux-tizen-modules-source.spec b/packaging/linux-tizen-modules-source.spec index b6a7d87..6a0ba7b 100644 --- a/packaging/linux-tizen-modules-source.spec +++ b/packaging/linux-tizen-modules-source.spec @@ -1,5 +1,5 @@ Name: linux-tizen-modules-source -Version: 7.5.0 +Version: 7.5.1 Release: 0 License: GPL-2.0+ Source0: %{name}-%{version}.tar.xz diff --git a/tests/kdbus/kdbus-util.c b/tests/kdbus/kdbus-util.c index d9fa167..6dae7ae 100644 --- a/tests/kdbus/kdbus-util.c +++ b/tests/kdbus/kdbus-util.c @@ -1825,29 +1825,9 @@ wur int config_cgroups_is_enabled(void) wur int config_security_is_enabled(void) { - int fd; - int ret; - char buf[128]; - - /* CONFIG_SECURITY is disabled */ - if (access("/proc/self/attr/current", F_OK) != 0) + /* When SMACK is disabled this directory does not exist */ + if (access("/sys/fs/smackfs", F_OK) != 0) return 0; - /* - * Now only if read() fails with -EINVAL then we assume - * that SECLABEL and LSM are disabled - */ - fd = open("/proc/self/attr/current", O_RDONLY|O_CLOEXEC); - if (fd < 0) - return 1; - - ret = read(fd, buf, sizeof(buf)); - if (ret == -1 && errno == EINVAL) - ret = 0; - else - ret = 1; - - CLOSE(fd); - - return ret; + return 1; }