From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933143AbcKBRS0 (ORCPT ); Wed, 2 Nov 2016 13:18:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53358 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932526AbcKBRSX (ORCPT ); Wed, 2 Nov 2016 13:18:23 -0400 Date: Wed, 2 Nov 2016 19:16:41 +0100 From: Oleg Nesterov To: Jann Horn Cc: Seth Forshee , "Eric W. Biederman" , Doug Ledford , Al Viro , Tejun Heo , Roland McGrath , linux-kernel@vger.kernel.org Subject: Re: [PATCH] signal: fix overflow_uid signal sender Message-ID: <20161102181640.GA1112@redhat.com> References: <1477929262-2531-1-git-send-email-jann@thejh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1477929262-2531-1-git-send-email-jann@thejh.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 02 Nov 2016 17:18:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.