linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Jann Horn <jann@thejh.net>
Cc: Seth Forshee <seth.forshee@canonical.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Doug Ledford <dledford@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>, Tejun Heo <tj@kernel.org>,
	Roland McGrath <roland@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] signal: fix overflow_uid signal sender
Date: Wed, 2 Nov 2016 19:16:41 +0100	[thread overview]
Message-ID: <20161102181640.GA1112@redhat.com> (raw)
In-Reply-To: <1477929262-2531-1-git-send-email-jann@thejh.net>

On 10/31, Jann Horn wrote:
>
>  static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_struct *t)
>  {
> -	if (current_user_ns() == task_cred_xxx(t, user_ns))
> +	if (&init_user_ns == task_cred_xxx(t, user_ns))
>  		return;
>  
>  	if (SI_FROMKERNEL(info))
> @@ -959,7 +959,7 @@ static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_str
>  
>  	rcu_read_lock();
>  	info->si_uid = from_kuid_munged(task_cred_xxx(t, user_ns),
> -					make_kuid(current_user_ns(), info->si_uid));
> +					make_kuid(&init_user_ns, info->si_uid));
>  	rcu_read_unlock();
>  }
>  #else
> @@ -1027,7 +1027,8 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
>  			q->info.si_code = SI_USER;
>  			q->info.si_pid = task_tgid_nr_ns(current,
>  							task_active_pid_ns(t));
> -			q->info.si_uid = from_kuid_munged(current_user_ns(), current_uid());
> +			q->info.si_uid = from_kuid(&init_user_ns,
> +						   current_uid());

Looks good to me at first glance, but I think this needs an ack from Eric.

I have to admit that I forgot how uid_map/etc actually works, I can't
even recall if from_kuid(init_user_ns, xxx) == __kuid_val(xxx) or not,
although this doesn't really matter.

Oleg.

  reply	other threads:[~2016-11-02 17:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-31 15:54 [PATCH] signal: fix overflow_uid signal sender Jann Horn
2016-11-02 18:16 ` Oleg Nesterov [this message]
2016-11-02 17:24   ` Jann Horn
2016-11-02 18:29     ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161102181640.GA1112@redhat.com \
    --to=oleg@redhat.com \
    --cc=dledford@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=jann@thejh.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=seth.forshee@canonical.com \
    --cc=tj@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).