This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH] runtime: linux 3.14 porting: case when CONFIG_USER_NS not defined
- From: Victor Kamensky <victor dot kamensky at linaro dot org>
- To: systemtap at sourceware dot org
- Cc: dave dot long at linaro dot org, taras dot kondratiuk at linaro dot org, Victor Kamensky <victor dot kamensky at linaro dot org>
- Date: Mon, 7 Apr 2014 22:23:39 -0700
- Subject: [PATCH] runtime: linux 3.14 porting: case when CONFIG_USER_NS not defined
- Authentication-results: sourceware.org; auth=none
- References: <1396934619-12807-1-git-send-email-victor dot kamensky at linaro dot org>
Fix build problem for linux-3.14 case with config where
CONFIG_USER_NS is not defined. With CONFIG_UIDGID_STRICT_TYPE_CHECKS
removed (261000a56b6382f597bcb12000f55c9ff26a1efb) access to
kuid_t and kgid_t should happen through from_k?uid_munged call.
Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
---
runtime/linux/task_finder.c | 4 ++--
runtime/linux/task_finder2.c | 4 ++--
runtime/transport/control.c | 2 +-
runtime/transport/transport.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/runtime/linux/task_finder.c b/runtime/linux/task_finder.c
index 19258e5..ae2aa5f 100644
--- a/runtime/linux/task_finder.c
+++ b/runtime/linux/task_finder.c
@@ -846,7 +846,7 @@ __stp_utrace_attach_match_filename(struct task_struct *tsk,
#ifdef STAPCONF_TASK_UID
tsk_euid = tsk->euid;
#else
-#ifdef CONFIG_USER_NS
+#if defined(CONFIG_USER_NS) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
tsk_euid = from_kuid_munged(current_user_ns(), task_euid(tsk));
#else
tsk_euid = task_euid(tsk);
@@ -1646,7 +1646,7 @@ stap_start_task_finder(void)
#ifdef STAPCONF_TASK_UID
tsk_euid = tsk->euid;
#else
-#ifdef CONFIG_USER_NS
+#if defined(CONFIG_USER_NS) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
tsk_euid = from_kuid_munged(current_user_ns(), task_euid(tsk));
#else
tsk_euid = task_euid(tsk);
diff --git a/runtime/linux/task_finder2.c b/runtime/linux/task_finder2.c
index ef074c5..74ccfb1 100644
--- a/runtime/linux/task_finder2.c
+++ b/runtime/linux/task_finder2.c
@@ -807,7 +807,7 @@ __stp_utrace_attach_match_filename(struct task_struct *tsk,
#ifdef STAPCONF_TASK_UID
tsk_euid = tsk->euid;
#else
-#ifdef CONFIG_USER_NS
+#if defined(CONFIG_USER_NS) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
tsk_euid = from_kuid_munged(current_user_ns(), task_euid(tsk));
#else
tsk_euid = task_euid(tsk);
@@ -1697,7 +1697,7 @@ stap_start_task_finder(void)
#ifdef STAPCONF_TASK_UID
tsk_euid = tsk->euid;
#else
-#ifdef CONFIG_USER_NS
+#if defined(CONFIG_USER_NS) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
tsk_euid = from_kuid_munged(current_user_ns(), task_euid(tsk));
#else
tsk_euid = task_euid(tsk);
diff --git a/runtime/transport/control.c b/runtime/transport/control.c
index 2b84c34..9c07b47 100644
--- a/runtime/transport/control.c
+++ b/runtime/transport/control.c
@@ -35,7 +35,7 @@ static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, siz
#ifdef STAPCONF_TASK_UID
uid_t euid = current->euid;
#else
-#ifdef CONFIG_USER_NS
+#if defined(CONFIG_USER_NS) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
uid_t euid = from_kuid_munged(current_user_ns(), current_euid());
#else
uid_t euid = current_euid();
diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
index e4d4d8e..0ddf514 100644
--- a/runtime/transport/transport.c
+++ b/runtime/transport/transport.c
@@ -341,7 +341,7 @@ static int _stp_transport_init(void)
_stp_uid = current->uid;
_stp_gid = current->gid;
#else
-#ifdef CONFIG_USER_NS
+#if defined(CONFIG_USER_NS) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
_stp_uid = from_kuid_munged(current_user_ns(), current_uid());
_stp_gid = from_kgid_munged(current_user_ns(), current_gid());
#else
--
1.9.0