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: <20140825150301.GB3021@redhat.com>
Date:	Mon, 25 Aug 2014 17:03:01 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Hugh Dickins <hughd@...gle.com>
Cc:	Cyrill Gorcunov <gorcunov@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Manfred Spraul <manfred@...orfullife.com>,
	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, Hugh Dickins wrote:
>
> On Sat, 23 Aug 2014, Oleg Nesterov wrote:
> > On 08/23, Cyrill Gorcunov wrote:
> > >
> > > On Sat, Aug 23, 2014 at 04:43:27PM +0200, 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>
> > > Reviewed-by: Cyrill Gorcunov <gorcunov@...il.com>
>
> Yes, much better to use find_vma than have this strange stray use
> of unreliable start_stack.
>
> Acked-by: Hugh Dickins <hughd@...gle.com>

Thanks!

> though like Manfred I didn't quite see how overflow was impossible
> on unfamiliar architectures.

And you can't see, because the comment is simply wrong, I'll send v2.

> > > I don't understand this check either, the comment above it says nothing
> > > but only commits what code is doing not explaining why.
> >
> > Yes, and this check predates the git history. I even looked into
> > git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git but this
> > change was added by the huge "v2.5.0.7 -> v2.5.0.8" update in 2002,
> > and obviously without any explanation (apart from "fix up proper shmat
> > semantics", but this connects SHM_REMAP itself).
>
> I'd say it comes earlier, from Christoph Rohland's 2.4.17-pre7's
> "Add missing checks on shmat()", though I didn't find more than that.
>
> We can all understand wanting to leave a gap below the growsdown stack,
> but of course could argue about growsup and 1 or 4 or 5 or whatever:

And it is not clear to me why the kernel should care at all,

> okay that we're all more interested in just removing that start_stack.

so perhaps v2 should simply remove it? Or do you think it would be safer
to not do this?

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