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] [day] [month] [year] [list]
Message-ID: <87sgdixzi0.fsf@nanos.tec.linutronix.de>
Date:   Thu, 23 Jul 2020 13:05:43 +0200
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Christoph Hellwig <hch@....de>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        "H.J. Lu" <hjl.tools@...il.com>, x86@...nel.org,
        Christoph Hellwig <hch@....de>,
        Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH] x86/dumpstack: Dump user space code correctly again

Christoph Hellwig <hch@....de> writes:
> On Wed, Jul 22, 2020 at 07:54:15PM +0200, Thomas Gleixner wrote:
>> +	/*
>> +	 * Make sure userspace isn't trying to trick us into dumping kernel
>> +	 * memory by pointing the userspace instruction pointer at it.
>> +	 */
>> +	if (__chk_range_not_ok(src, nbytes, TASK_SIZE_MAX))
>> +		return -EINVAL;
>> +
>> +	return copy_from_user_nmi(buf, (void __user *)src, nbytes);
>
> copy_from_user_nmi already contains a:
>
> 	if (__range_not_ok(from, n, TASK_SIZE))
> 		return n;
>
> what is the reason it checks for TASK_SIZE vs TASK_SIZE_MAX, and why
> do we need both checks?

TBH, I just kept it because being lazy. But you are right, the check is
redundant and TASK_SIZE_MAX is inaccurate as it does not take compat
tasks into account. I'll rip that out.

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ