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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1809221219270.1391@nanos.tec.linutronix.de>
Date:   Sat, 22 Sep 2018 12:20:48 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Peter Zijlstra <peterz@...radead.org>
cc:     Jiri Kosina <jikos@...nel.org>,
        "Schaufler, Casey" <casey.schaufler@...el.com>,
        Ingo Molnar <mingo@...hat.com>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        "Woodhouse, David" <dwmw@...zon.co.uk>,
        Andi Kleen <ak@...ux.intel.com>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH v6 0/3] Harden spectrev2 userspace-userspace protection

On Sat, 22 Sep 2018, Peter Zijlstra wrote:
> On Sat, Sep 22, 2018 at 11:53:14AM +0200, Thomas Gleixner wrote:
> > +bool ptrace_may_access_sched(struct task_struct *task, unsigned int mode)
> > +{
> > +	struct mm_struct *mm;
> > +	int res;
> > +
> > +	res = __ptrace_may_access_basic(task, mode);
> > +	if (res <= 0)
> > +		return !res;
> > +
> > +	rcu_read_lock();
> > +	res = __ptrace_may_access_cred(__task_cred(task), mode);
> >  	rcu_read_unlock();
> > +	if (res)
> > +		return false;
> > +
> > +	mm = task->mm;
> > +	if (mm && get_dumpable(mm) != SUID_DUMP_USER)
> > +		return false;
> > +	return true;
> > +}
> > +
> > +/* Returns 0 on success, -errno on denial. */
> > +static int __ptrace_may_access(struct task_struct *task, unsigned int mode)
> > +{
> > +	const struct cred *tcred;
> > +	struct mm_struct *mm;
> > +	int res;
> > +
> > +	res = __ptrace_may_access_basic(task, mode);
> > +	if (res <= 0)
> > +		return res;
> > +
> > +	rcu_read_lock();
> > +	tcred = __task_cred(task);
> > +	res = __ptrace_may_access_cred(tcred, mode);
> > +	if (res > 0)
> > +		res = ptrace_has_cap(tcred->user_ns, mode) ? 0 : -EPERM;
> >  	rcu_read_unlock();
> > +	if (res < 0)
> > +		return res;
> > +
> >  	mm = task->mm;
> > +	if (mm && (get_dumpable(mm) != SUID_DUMP_USER &&
> > +		   !ptrace_has_cap(mm->user_ns, mode)))
> > +		return -EPERM;
> >  
> >  	return security_ptrace_access_check(task, mode);
> >  }
> 
> This has some unfortunate duplication.
> 
> Lets go with it for now, but I'll see if I can do something about that
> later.

Yes, I know. I tried to make the duplication smaller, but all attempts
ended up being a convoluted mess. I'll try again after applying more
coffee.

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ