linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	 linux-fsdevel@vger.kernel.org,
	Eric Biederman <ebiederm@xmission.com>,
	 Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	 Rich Felker <dalias@libc.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] exec: fix linux_binprm::exec in transfer_args_to_stack()
Date: Fri, 22 Mar 2024 09:39:43 -0700	[thread overview]
Message-ID: <CAMo8BfKhk8dk3-n7gx3edZKSZUhCa+GJf4XwFvXr6bYzcwsb-A@mail.gmail.com> (raw)
In-Reply-To: <202403212041.AEB471AC@keescook>

On Thu, Mar 21, 2024 at 8:48 PM Kees Cook <keescook@chromium.org> wrote:
> On Thu, Mar 21, 2024 at 12:52:16PM -0700, Max Filippov wrote:
> > On Thu, Mar 21, 2024 at 10:05 AM Kees Cook <keescook@chromium.org> wrote:
> > > What's the best way to test this? (Is there a qemu setup I can use to
> > > see the before/after of AT_EXECFN?)
> >
> > I put a readme with the steps to build such system here:
> >   http://jcmvbkbc.org/~dumb/tmp/202403211236/README
> > it uses a prebuilt rootfs image and a 6.8 kernel branch with two
> > patches on top of it: one adds a dts and a defconfig and the other
> > is this fix. The rootfs boots successfully with this fix, but panics
> > if this fix is removed.
>
> Does musl have something like the LD_SHOW_AUXV env variable. With glibc,
> I usually explore auxv like so:
>
> $ LD_SHOW_AUXV=1 uname -a | grep EXECFN
> AT_EXECFN:            /usr/bin/uname

I couldn't find anything like that in either musl or uClibc-ng.
So I updated the above rootfs and put the following program
into it as /bin/test-auxv:

#include <stdio.h>
#include <sys/auxv.h>

int main()
{
       unsigned long p = getauxval(AT_EXECFN);
       fprintf(stderr, "AT_EXECFN: 0x%lx\n", p);
       if (p)
               fprintf(stderr, "%s\n", (const char *)p);
       return 0;
}

While looking at it I also noticed that /proc/<pid>/auxv is empty
on NOMMU, looks like there will be yet another fix for that.

-- 
Thanks.
-- Max


  reply	other threads:[~2024-03-22 16:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 18:26 Max Filippov
2024-03-20 19:29 ` Matthew Wilcox
2024-03-20 20:31   ` Max Filippov
2024-03-21 17:05 ` Kees Cook
2024-03-21 19:52   ` Max Filippov
2024-03-22  3:48     ` Kees Cook
2024-03-22 16:39       ` Max Filippov [this message]
2024-03-22  3:18 ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMo8BfKhk8dk3-n7gx3edZKSZUhCa+GJf4XwFvXr6bYzcwsb-A@mail.gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=brauner@kernel.org \
    --cc=dalias@libc.org \
    --cc=ebiederm@xmission.com \
    --cc=jack@suse.cz \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=stable@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox