From b50e1cd22c61f8f3b32b249a203a1f053ef0fe4c Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Sat, 17 May 2014 16:15:01 -0400 Subject: [PATCH] linux/runtime.h: more CONFIG_USER_NS fallout Partially unrolling commit 7d35a948401, because on modern kernels (3.14+), the from_k?id_munged functions are defined as inlines, and should be used regardless of CONFIG_USER_NS etc. The buildrun.cxx exportedness test for from_kuid_munged would fail, triggering our runtime to use a do-nothing macro instead. Until a more programmatic way is found for those unidentified older kernels that have CONFIG_USER_NS but no from_k?id_munged inlines, for now a user will have to work around the build problem with % stap -DSTAP_FAKE_KID_MUNGED --- runtime/linux/runtime.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h index 569794571..cccff2dd5 100644 --- a/runtime/linux/runtime.h +++ b/runtime/linux/runtime.h @@ -97,11 +97,15 @@ static void _stp_exit(void); #ifdef STAPCONF_TASK_UID #define STP_CURRENT_EUID (current->euid) #else -#if defined(CONFIG_USER_NS) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) -#ifndef STAPCONF_FROM_KUID_MUNGED + +/* intending to catch old distros where from_k*id_munged didn't exist or weren't exported; + we lack a programmatic way of catching this right now. */ +#ifdef STAP_FAKE_KID_MUNGED #define from_kuid_munged(user_ns, uid) ((uid)) #define from_kgid_munged(user_ns, gid) ((gid)) -#endif /* !STAPCONF_FROM_KUID_MUNGED */ +#endif + +#if defined(CONFIG_USER_NS) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) #define STP_CURRENT_EUID (from_kuid_munged(current_user_ns(), task_euid(current))) #else #define STP_CURRENT_EUID (task_euid(current)) -- 2.43.5