From: Greg Ungerer <gerg@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arm@lists.infradead.org, linux-mm@kvack.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
keescook@chromium.org, ebiederm@xmission.com, brauner@kernel.org,
viro@zeniv.linux.org.uk
Subject: Re: [PATCH v2] fs: binfmt_elf_efpic: fix personality for ELF-FDPIC
Date: Mon, 18 Sep 2023 16:27:22 +1000 [thread overview]
Message-ID: <5573ef25-a35b-c189-874b-3cafba09b120@kernel.org> (raw)
In-Reply-To: <20230917122603.5466b1fc6d05ea9e9edee340@linux-foundation.org>
Hi Andrew,
On 18/9/23 05:26, Andrew Morton wrote:
> On Thu, 7 Sep 2023 11:18:08 +1000 Greg Ungerer <gerg@kernel.org> wrote:
>
>> The elf-fdpic loader hard sets the process personality to either
>> PER_LINUX_FDPIC for true elf-fdpic binaries or to PER_LINUX for
>> normal ELF binaries (in this case they would be constant displacement
>> compiled with -pie for example). The problem with that is that it
>> will lose any other bits that may be in the ELF header personality
>> (such as the "bug emulation" bits).
>>
>> On the ARM architecture the ADDR_LIMIT_32BIT flag is used to signify
>> a normal 32bit binary - as opposed to a legacy 26bit address binary.
>> This matters since start_thread() will set the ARM CPSR register as
>> required based on this flag. If the elf-fdpic loader loses this bit
>> the process will be mis-configured and crash out pretty quickly.
>>
>> Modify elf-fdpic loader personality setting so that it preserves the
>> upper three bytes by using the SET_PERSONALITY macro to set it. This
>> macro in the generic case sets PER_LINUX and preserves the upper bytes.
>> Architectures can override this for their specific use case, and ARM
>> does exactly this.
>>
>> The problem shows up quite easily running under qemu using the ARM
>> architecture, but not necessarily on all types of real ARM hardware.
>> If the underlying ARM processor does not support the legacy 26-bit
>> addressing mode then everything will work as expected.
>
> I'm thinking
>
> Fixes: 1bde925d23547 ("fs/binfmt_elf_fdpic.c: provide NOMMU loader for regular ELF binaries")
> Cc: <stable@vger.kernel.org>
Yes, that seems reasonable. It will apply easily, and legitimately fix this
specific issue going back to the original change.
Regards
Greg
prev parent reply other threads:[~2023-09-18 6:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 1:18 [PATCH v2] fs: binfmt_elf_efpic: fix personality for ELF-FDPIC Greg Ungerer
2023-09-17 19:26 ` Andrew Morton
2023-09-18 6:27 ` Greg Ungerer [this message]
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=5573ef25-a35b-c189-874b-3cafba09b120@kernel.org \
--to=gerg@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=ebiederm@xmission.com \
--cc=keescook@chromium.org \
--cc=linux-arm@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).