From: Max Filippov <jcmvbkbc@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Chris Zankel <chris@zankel.net>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
Eric Biederman <ebiederm@xmission.com>,
Kees Cook <keescook@chromium.org>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
Greg Ungerer <gerg@linux-m68k.org>,
Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH] fs: binfmt_elf_efpic: don't use missing interpreter's properties
Date: Mon, 5 Feb 2024 06:31:13 -0800 [thread overview]
Message-ID: <CAMo8BfL+j5XUit2b7UjmZfZJCGd-gyh3Aia4FhLAm7YHNm0Fdg@mail.gmail.com> (raw)
In-Reply-To: <20240118150637.660461-1-jcmvbkbc@gmail.com>
Ping?
On Thu, Jan 18, 2024 at 7:07 AM Max Filippov <jcmvbkbc@gmail.com> wrote:
>
> Static FDPIC executable may get an executable stack even when it has
> non-executable GNU_STACK segment. This happens when STACK segment has rw
> permissions, but does not specify stack size. In that case FDPIC loader
> uses permissions of the interpreter's stack, and for static executables
> with no interpreter it results in choosing the arch-default permissions
> for the stack.
>
> Fix that by using the interpreter's properties only when the interpreter
> is actually used.
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
> fs/binfmt_elf_fdpic.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> index be4e7ac3efbc..f6d72fe3998c 100644
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -322,7 +322,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm)
> else
> executable_stack = EXSTACK_DEFAULT;
>
> - if (stack_size == 0) {
> + if (stack_size == 0 && interp_params.flags & ELF_FDPIC_FLAG_PRESENT) {
> stack_size = interp_params.stack_size;
> if (interp_params.flags & ELF_FDPIC_FLAG_EXEC_STACK)
> executable_stack = EXSTACK_ENABLE_X;
> --
> 2.39.2
>
--
Thanks.
-- Max
next prev parent reply other threads:[~2024-02-05 14:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 15:06 Max Filippov
2024-02-05 14:31 ` Max Filippov [this message]
2024-02-05 16:15 ` 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=CAMo8BfL+j5XUit2b7UjmZfZJCGd-gyh3Aia4FhLAm7YHNm0Fdg@mail.gmail.com \
--to=jcmvbkbc@gmail.com \
--cc=brauner@kernel.org \
--cc=chris@zankel.net \
--cc=ebiederm@xmission.com \
--cc=geert@linux-m68k.org \
--cc=gerg@linux-m68k.org \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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