lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190212062236.GA26652@mail.hallyn.com>
Date:   Tue, 12 Feb 2019 00:22:36 -0600
From:   "Serge E. Hallyn" <serge@...lyn.com>
To:     "Eric W. Biederman" <ebiederm@...ssion.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Benjamin Gordon <bmgordon@...gle.com>,
        John Stultz <john.stultz@...aro.org>,
        Kees Cook <keescook@...omium.org>,
        "Serge E. Hallyn" <serge@...lyn.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Arjan van de Ven <arjan@...ux.intel.com>,
        Oren Laadan <orenl@...lrox.com>,
        Ruchi Kandoi <kandoiruchi@...gle.com>,
        Rom Lemarchand <romlem@...roid.com>,
        Todd Kjos <tkjos@...gle.com>, Colin Cross <ccross@...roid.com>,
        Nick Kralevich <nnk@...gle.com>,
        Dmitry Shmidt <dimitrysh@...gle.com>,
        Elliott Hughes <enh@...gle.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.20 282/352] fs/proc/base.c: use ns_capable instead of
 capable for timerslack_ns

On Mon, Feb 11, 2019 at 07:02:06PM -0600, Eric W. Biederman wrote:
> Greg Kroah-Hartman <gregkh@...uxfoundation.org> writes:
> 
> > 4.20-stable review patch.  If anyone has any objections, please let me
> > know.
> 
> No objection.  But I think of this as a feature addition rather than a
> fix for something.  As a feature that we now allow something we
> previously did not does this qualify for a backport to stable?

Hi,

I had the exact same thought when I saw this this morning, and was planning
on replying tonight.

> It is probably no more harmful in this instance than adding PCI IDs to a
> driver.  So I am not worried.  I am curious the current guidelines
> are.
> 
> In most cases a small relaxation of permissions like this requires a lot
> of bug fixing as typically code protected by capable(CAP_XXX) has been
> written and tested assuming a trusted root user.  Those bug fixes are
> many times too large for a stable backport.
> 
> Eric
> 
> 
> > ------------------
> >
> > [ Upstream commit 8da0b4f692c6d90b09c91f271517db746a22ff67 ]
> >
> > Access to timerslack_ns is controlled by a process having CAP_SYS_NICE
> > in its effective capability set, but the current check looks in the root
> > namespace instead of the process' user namespace.  Since a process is
> > allowed to do other activities controlled by CAP_SYS_NICE inside a
> > namespace, it should also be able to adjust timerslack_ns.
> >
> > Link: http://lkml.kernel.org/r/20181030180012.232896-1-bmgordon@google.com
> > Signed-off-by: Benjamin Gordon <bmgordon@...gle.com>
> > Acked-by: "Eric W. Biederman" <ebiederm@...ssion.com>
> > Cc: John Stultz <john.stultz@...aro.org>
> > Cc: "Eric W. Biederman" <ebiederm@...ssion.com>
> > Cc: Kees Cook <keescook@...omium.org>
> > Cc: "Serge E. Hallyn" <serge@...lyn.com>
> > Cc: Thomas Gleixner <tglx@...utronix.de>
> > Cc: Arjan van de Ven <arjan@...ux.intel.com>
> > Cc: Oren Laadan <orenl@...lrox.com>
> > Cc: Ruchi Kandoi <kandoiruchi@...gle.com>
> > Cc: Rom Lemarchand <romlem@...roid.com>
> > Cc: Todd Kjos <tkjos@...gle.com>
> > Cc: Colin Cross <ccross@...roid.com>
> > Cc: Nick Kralevich <nnk@...gle.com>
> > Cc: Dmitry Shmidt <dimitrysh@...gle.com>
> > Cc: Elliott Hughes <enh@...gle.com>
> > Cc: Alexey Dobriyan <adobriyan@...il.com>
> > Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> > Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
> > Signed-off-by: Sasha Levin <sashal@...nel.org>
> > ---
> >  fs/proc/base.c | 12 +++++++++---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/proc/base.c b/fs/proc/base.c
> > index ce3465479447..98525af0953e 100644
> > --- a/fs/proc/base.c
> > +++ b/fs/proc/base.c
> > @@ -2356,10 +2356,13 @@ static ssize_t timerslack_ns_write(struct file *file, const char __user *buf,
> >  		return -ESRCH;
> >  
> >  	if (p != current) {
> > -		if (!capable(CAP_SYS_NICE)) {
> > +		rcu_read_lock();
> > +		if (!ns_capable(__task_cred(p)->user_ns, CAP_SYS_NICE)) {
> > +			rcu_read_unlock();
> >  			count = -EPERM;
> >  			goto out;
> >  		}
> > +		rcu_read_unlock();
> >  
> >  		err = security_task_setscheduler(p);
> >  		if (err) {
> > @@ -2392,11 +2395,14 @@ static int timerslack_ns_show(struct seq_file *m, void *v)
> >  		return -ESRCH;
> >  
> >  	if (p != current) {
> > -
> > -		if (!capable(CAP_SYS_NICE)) {
> > +		rcu_read_lock();
> > +		if (!ns_capable(__task_cred(p)->user_ns, CAP_SYS_NICE)) {
> > +			rcu_read_unlock();
> >  			err = -EPERM;
> >  			goto out;
> >  		}
> > +		rcu_read_unlock();
> > +
> >  		err = security_task_getscheduler(p);
> >  		if (err)
> >  			goto out;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ