public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cred: use correct cred accessor with regards to rcu read lock
@ 2012-05-17 21:31 Sasha Levin
  2012-05-17 22:54 ` Eric W. Biederman
  0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2012-05-17 21:31 UTC (permalink / raw)
  To: oleg, akpm, ebiederm; +Cc: linux-kernel, davej, Sasha Levin

Commit "userns: Convert setting and getting uid and gid system calls to use
kuid and kgid has modified the accessors in wait_task_continued() and
wait_task_stopped() to use __task_cred() instead of task_uid().

__task_cred() assumes that we're inside a rcu read lock, which is untrue
for these two functions.

Modify it to use task_uid() instead.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 kernel/exit.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index 6818cbb..7e54635 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1455,7 +1455,7 @@ static int wait_task_stopped(struct wait_opts *wo,
 	if (!unlikely(wo->wo_flags & WNOWAIT))
 		*p_code = 0;
 
-	uid = from_kuid_munged(current_user_ns(), __task_cred(p)->uid);
+	uid = from_kuid_munged(current_user_ns(), task_uid(p));
 unlock_sig:
 	spin_unlock_irq(&p->sighand->siglock);
 	if (!exit_code)
@@ -1528,7 +1528,7 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p)
 	}
 	if (!unlikely(wo->wo_flags & WNOWAIT))
 		p->signal->flags &= ~SIGNAL_STOP_CONTINUED;
-	uid = from_kuid_munged(current_user_ns(), __task_cred(p)->uid);
+	uid = from_kuid_munged(current_user_ns(), task_uid(p));
 	spin_unlock_irq(&p->sighand->siglock);
 
 	pid = task_pid_vnr(p);
-- 
1.7.8.6


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

* Re: [PATCH] cred: use correct cred accessor with regards to rcu read lock
  2012-05-17 21:31 [PATCH] cred: use correct cred accessor with regards to rcu read lock Sasha Levin
@ 2012-05-17 22:54 ` Eric W. Biederman
  0 siblings, 0 replies; 2+ messages in thread
From: Eric W. Biederman @ 2012-05-17 22:54 UTC (permalink / raw)
  To: Sasha Levin; +Cc: oleg, akpm, linux-kernel, davej

Sasha Levin <levinsasha928@gmail.com> writes:

> Commit "userns: Convert setting and getting uid and gid system calls to use
> kuid and kgid has modified the accessors in wait_task_continued() and
> wait_task_stopped() to use __task_cred() instead of task_uid().
>
> __task_cred() assumes that we're inside a rcu read lock, which is untrue
> for these two functions.
>
> Modify it to use task_uid() instead.

Thanks applied.

Eric


> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
>  kernel/exit.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/exit.c b/kernel/exit.c
> index 6818cbb..7e54635 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -1455,7 +1455,7 @@ static int wait_task_stopped(struct wait_opts *wo,
>  	if (!unlikely(wo->wo_flags & WNOWAIT))
>  		*p_code = 0;
>  
> -	uid = from_kuid_munged(current_user_ns(), __task_cred(p)->uid);
> +	uid = from_kuid_munged(current_user_ns(), task_uid(p));
>  unlock_sig:
>  	spin_unlock_irq(&p->sighand->siglock);
>  	if (!exit_code)
> @@ -1528,7 +1528,7 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p)
>  	}
>  	if (!unlikely(wo->wo_flags & WNOWAIT))
>  		p->signal->flags &= ~SIGNAL_STOP_CONTINUED;
> -	uid = from_kuid_munged(current_user_ns(), __task_cred(p)->uid);
> +	uid = from_kuid_munged(current_user_ns(), task_uid(p));
>  	spin_unlock_irq(&p->sighand->siglock);
>  
>  	pid = task_pid_vnr(p);

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

end of thread, other threads:[~2012-05-17 22:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-17 21:31 [PATCH] cred: use correct cred accessor with regards to rcu read lock Sasha Levin
2012-05-17 22:54 ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox