kdbus: Replace the code that reads the attr with check code 44/317944/1 accepted/tizen_unified accepted/tizen_unified_x accepted/tizen_unified_x_asan accepted/tizen/unified/20250113.094324 accepted/tizen/unified/x/20250113.143053 accepted/tizen/unified/x/asan/20250211.003308
authorUnsung Lee <unsung.lee@samsung.com>
Fri, 10 Jan 2025 02:23:33 +0000 (11:23 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Fri, 10 Jan 2025 04:50:58 +0000 (13:50 +0900)
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 <unsung.lee@samsung.com>
packaging/linux-tizen-modules-source.spec
tests/kdbus/kdbus-util.c

index b6a7d87cc3222d1e848b19c2851998f0213a2983..6a0ba7bb6f7f8f336811fec6aeeffe8ae95e8e61 100644 (file)
@@ -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
index d9fa167a5123363d63813cd4ed3b2b23c57e82ec..6dae7ae1d4c1bad46de97a1d9d014a9aa4f800fb 100644 (file)
@@ -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;
 }