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: <20140825145341.GA3021@redhat.com>
Date:	Mon, 25 Aug 2014 16:53:41 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Manfred Spraul <manfred@...orfullife.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Hugh Dickins <hughd@...gle.com>,
	Cyrill Gorcunov <gorcunov@...nvz.org>,
	Davidlohr Bueso <davidlohr.bueso@...com>,
	Kees Cook <keescook@...omium.org>, Tejun Heo <tj@...nel.org>,
	Andrew Vagin <avagin@...nvz.org>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Serge Hallyn <serge.hallyn@...onical.com>,
	Pavel Emelyanov <xemul@...allels.com>,
	Vasiliy Kulikov <segoon@...nwall.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Michael Kerrisk <mtk.manpages@...il.com>,
	Julien Tinnes <jln@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] ipc/shm: fix the historical/wrong mm->start_stack
	check

On 08/24, Manfred Spraul wrote:
>
> On 08/23/2014 04:43 PM, Oleg Nesterov wrote:
>> The ->start_stack check in do_shmat() looks ugly and simply wrong.
>>
>> 1. ->start_stack is only valid right after exec(), the application
>>     can switch to another stack and even unmap this area.
>>
>> 2. The reason for this check is not clear at all. The application
>>     should know what it does. And why 4 pages? And why in fact it
>>     requires 5 pages?
>>
>> 3. This wrongly assumes that the stack can only grown down.
>>
>> Personally I think we should simply kill this check, but I did not
>> dare to do this. So the patch only fixes the 1st problem (mostly to
>> avoid the usage of mm->start_stack) and ignores VM_GROWSUP.
>>
>> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
> Acked-by: Manfred Spraul <manfred@...orfullife.com>

Thanks!

>> +		if (vma) {
>> +			if (vma->vm_flags & VM_GROWSDOWN)
>> +				end += PAGE_SIZE * 4; /* can't overflow */
> Why is an overflow impossible?

OOPS. I swear it was not possible until I simplified this patch ;)

In fact we do not really care because do_mmap_pgoff() will fail, but
this should be fixed anyway. Either we should not check the overflows
at all, or these checks should be consistent.

I'll send v2, thanks Manfred.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ