Name: linux-tizen-modules-source
-Version: 7.5.1
+Version: 7.5.0
Release: 0
License: GPL-2.0+
Source0: %{name}-%{version}.tar.xz
Provides: linux-kernel-kdbus-tests
Provides: linux-kernel-logger-tests
BuildRequires: pkgconfig(libcap)
-BuildRequires: pkgconfig(cynara-creds-self)
-Requires: pkgconfig(cynara-creds-self)
%description -n linux-tizen-modules-tests
This package contains tests for Tizen-specific kernel modules.
CFLAGS += -I../../samples/kdbus/
CFLAGS += -std=gnu99 -Wno-error=shadow
CFLAGS += -DKBUILD_MODNAME=\"kdbus\" -D_GNU_SOURCE
-CFLAGS += `pkg-config --cflags cynara-creds-self`
LDFLAGS = -pthread -lcap -lm
-LDFLAGS += `pkg-config --libs cynara-creds-self`
.PHONY: all clean
void print_metadata_support(void)
{
bool no_meta_audit, no_meta_cgroups, no_meta_seclabel;
- bool security_enabled;
- int ret;
/*
* KDBUS_ATTACH_CGROUP, KDBUS_ATTACH_AUDIT and
*/
no_meta_audit = !config_auditsyscall_is_enabled();
no_meta_cgroups = !config_cgroups_is_enabled();
- ret = config_get_security_enabled_state(&security_enabled);
- if (ret < 0)
- no_meta_seclabel = true;
- else
- no_meta_seclabel = !security_enabled;
+ no_meta_seclabel = !config_security_is_enabled();
if (no_meta_audit | no_meta_cgroups | no_meta_seclabel)
print("# Starting tests without %s%s%s metadata support\n",
#include <sys/time.h>
#include <linux/unistd.h>
-#include <cynara-creds-self.h>
-
#ifndef __NR_memfd_create
#ifdef __x86_64__
#define __NR_memfd_create 319
/* maximum number of well-known names per connection */
#define KDBUS_CONN_MAX_NAMES 256
-#define SMACK_DISABLED_DEFAULT_SMACK_LABEL "User::Pkg::default_app_no_Smack_mode"
-
int kdbus_util_verbose = true;
wur int kdbus_sysfs_get_parameter_mask(const char *path, uint64_t *mask)
return (access("/proc/self/cgroup", F_OK) == 0);
}
-wur int config_get_security_enabled_state(bool *security_enabled)
+wur int config_security_is_enabled(void)
{
+ int fd;
int ret;
- char *label = NULL;
+ char buf[128];
- ret = cynara_creds_self_get_client(CLIENT_METHOD_DEFAULT, &label);
- if (ret != 0) {
- print("Failed to get self smack label by cynara_creds_self_get_client()\n");
- return ret;
- }
+ /* CONFIG_SECURITY is disabled */
+ if (access("/proc/self/attr/current", F_OK) != 0)
+ return 0;
- /**
- * cynara_creds_self_get_client() gives SMACK_DISABLED_DEFAULT_SMACK_LABEL as label
- * when smack is disabled.
+ /*
+ * Now only if read() fails with -EINVAL then we assume
+ * that SECLABEL and LSM are disabled
*/
- if (strncmp(label, SMACK_DISABLED_DEFAULT_SMACK_LABEL,
- sizeof(SMACK_DISABLED_DEFAULT_SMACK_LABEL)) == 0)
- *security_enabled = false;
+ 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
- *security_enabled = true;
+ ret = 1;
- free(label);
+ CLOSE(fd);
- return 0;
+ return ret;
}
wur int config_user_ns_is_enabled(void);
wur int config_auditsyscall_is_enabled(void);
wur int config_cgroups_is_enabled(void);
-wur int config_get_security_enabled_state(bool *security_enabled);
+wur int config_security_is_enabled(void);
\ No newline at end of file