[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMo8BfJOzPbiOz59kmFuD_4Hkxm50gEujyFYjW2ANqzZNviUGg@mail.gmail.com>
Date: Wed, 20 Mar 2024 13:31:22 -0700
From: Max Filippov <jcmvbkbc@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, Eric Biederman <ebiederm@...ssion.com>,
Kees Cook <keescook@...omium.org>, Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, Rich Felker <dalias@...c.org>,
stable@...r.kernel.org
Subject: Re: [PATCH] exec: fix linux_binprm::exec in transfer_args_to_stack()
On Wed, Mar 20, 2024 at 12:29 PM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Wed, Mar 20, 2024 at 11:26:07AM -0700, Max Filippov wrote:
> > In NUMMU kernel the value of linux_binprm::p is the offset inside the
> > temporary program arguments array maintained in separate pages in the
> > linux_binprm::page. linux_binprm::exec being a copy of linux_binprm::p
> > thus must be adjusted when that array is copied to the user stack.
> > Without that adjustment the value passed by the NOMMU kernel to the ELF
> > program in the AT_EXECFN entry of the aux array doesn't make any sense
> > and it may break programs that try to access memory pointed to by that
> > entry.
> >
> > Adjust linux_binprm::exec before the successful return from the
> > transfer_args_to_stack().
>
> Do you know which commit broke this, ie how far back should this be
> backported? Or has it always been broken?
>From reading the code I see that linux_binprm::p started being an offset
in the commit b6a2fea39318 ("mm: variable length argument support")
which is v2.6.22-3328-gb6a2fea39318 and filling in the AT_EXECFN
aux entry was added in the commit
5edc2a5123a7 ("binfmt_elf_fdpic: wire up AT_EXECFD, AT_EXECFN, AT_SECURE")
which is v2.6.27-4641-g5edc2a5123a7. I don't see any translation
of the linux_binprm::exec at that time so to me it looks like it's always
been broken.
--
Thanks.
-- Max
Powered by blists - more mailing lists