public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] runtime: linux 3.14 porting: case when CONFIG_USER_NS not defined
@ 2014-04-08  5:24 Victor Kamensky
  2014-04-08  5:24 ` Victor Kamensky
  2014-06-10 18:32 ` David Smith
  0 siblings, 2 replies; 3+ messages in thread
From: Victor Kamensky @ 2014-04-08  5:24 UTC (permalink / raw)
  To: systemtap; +Cc: dave.long, taras.kondratiuk, Victor Kamensky

Hi,

My systemtap tree is at a404e997732d88a148d822bab9ea413b01e5da41 and
I run it on ARMv7 3.14 based kernel. It looks like that there was
set of commits around kuid_t and kgid_t. However it does look it is
enough to cover all possible cases. In my case CONFIG_USER_NS is not 
set but kernel is 3.14 with CONFIG_UIDGID_STRICT_TYPE_CHECKS removal
commit present.

Pass 1: parsed user script and 100 library script(s) using 20524virt/16336res/1728shr/15264data kb, in 550usr/30sys/775real ms.
Pass 2: analyzed script: 5 probe(s), 8 function(s), 3 embed(s), 2 global(s) using 21996virt/18572res/2624shr/16736data kb, in 1270usr/960sys/2640real ms.
Pass 3: translated to C into "/tmp/stapKpOeoW/stap_ab952db703452530b1d473c8f05f8f6d_6448_src.c" using 21996virt/18800res/2852shr/16736data kb, in 50usr/280sys/324real ms.
In file included from /home/root/systemtap/systemtap-20140405/share/systemtap/runtime/linux/task_finder.c:17:0,
                 from /home/root/systemtap/systemtap-20140405/share/systemtap/runtime/linux/runtime.h:206,
                 from /home/root/systemtap/systemtap-20140405/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stapKpOeoW/stap_ab952db703452530b1d473c8f05f8f6d_6448_src.c:24:
/home/root/systemtap/systemtap-20140405/share/systemtap/runtime/linux/task_finder2.c: In function '__stp_utrace_attach_match_filename':
/home/root/systemtap/systemtap-20140405/share/systemtap/runtime/linux/task_finder2.c:813:11: error: incompatible types when assigning to type 'uid_t' from type 'kuid_t'
  tsk_euid = task_euid(tsk);
           ^
/home/root/systemtap/systemtap-20140405/share/systemtap/runtime/linux/task_finder2.c: In function 'stap_start_task_finder':
/home/root/systemtap/systemtap-20140405/share/systemtap/runtime/linux/task_finder2.c:1703:12: error: incompatible types when assigning to type 'uid_t' from type 'kuid_t'
   tsk_euid = task_euid(tsk);
            ^

I.e code goes into !CONFIG_USER_NS part but it does not
work on 3.14 kernel.

Proposed fix by adding kernel version check along with check for
CONFIG_USER_NS.

Note it was working for me when I defined CONFIG_USER_NS kernel,
I used it as workaround, but I decided to address this case that 
I orignally run into. If case was already addressed please ignore.

Victor Kamensky (1):
  runtime: linux 3.14 porting: case when CONFIG_USER_NS not defined

 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(-)

-- 
1.9.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] runtime: linux 3.14 porting: case when CONFIG_USER_NS not defined
  2014-04-08  5:24 [PATCH] runtime: linux 3.14 porting: case when CONFIG_USER_NS not defined Victor Kamensky
@ 2014-04-08  5:24 ` Victor Kamensky
  2014-06-10 18:32 ` David Smith
  1 sibling, 0 replies; 3+ messages in thread
From: Victor Kamensky @ 2014-04-08  5:24 UTC (permalink / raw)
  To: systemtap; +Cc: dave.long, taras.kondratiuk, Victor Kamensky

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] runtime: linux 3.14 porting: case when CONFIG_USER_NS not defined
  2014-04-08  5:24 [PATCH] runtime: linux 3.14 porting: case when CONFIG_USER_NS not defined Victor Kamensky
  2014-04-08  5:24 ` Victor Kamensky
@ 2014-06-10 18:32 ` David Smith
  1 sibling, 0 replies; 3+ messages in thread
From: David Smith @ 2014-06-10 18:32 UTC (permalink / raw)
  To: Victor Kamensky, systemtap; +Cc: dave.long, taras.kondratiuk

On 04/08/2014 12:23 AM, Victor Kamensky wrote:
> Hi,
> 
> My systemtap tree is at a404e997732d88a148d822bab9ea413b01e5da41 and
> I run it on ARMv7 3.14 based kernel. It looks like that there was
> set of commits around kuid_t and kgid_t. However it does look it is
> enough to cover all possible cases. In my case CONFIG_USER_NS is not 
> set but kernel is 3.14 with CONFIG_UIDGID_STRICT_TYPE_CHECKS removal
> commit present.

Sorry for the long delay in responding here. I think your problem here
is similar to PR16960, which I fixed in commit ca89d28.

Let me know if you are still having problems in this area.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-10 18:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-08  5:24 [PATCH] runtime: linux 3.14 porting: case when CONFIG_USER_NS not defined Victor Kamensky
2014-04-08  5:24 ` Victor Kamensky
2014-06-10 18:32 ` David Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).