* [PATCH] fs/binfmt_elf: fix PT_LOAD p_align values for loaders
@ 2022-02-02 12:14 Mike Rapoport
2022-02-02 13:52 ` Rui Salvaterra
0 siblings, 1 reply; 2+ messages in thread
From: Mike Rapoport @ 2022-02-02 12:14 UTC (permalink / raw)
To: linux-fsdevel
Cc: Alexander Viro, Andrew Morton, Eric Biederman, H.J. Lu,
Kees Cook, Mike Rapoport, Mike Rapoport, Rui Salvaterra,
linux-kernel
From: Mike Rapoport <rppt@linux.ibm.com>
Rui Salvaterra reported that Aisleroit solitaire crashes with "Wrong
__data_start/_end pair" assertion from libgc after update to v5.17-rc1.
Bisection pointed to commit 9630f0d60fec ("fs/binfmt_elf: use PT_LOAD
p_align values for static PIE") that fixed handling of static PIEs, but
made the condition that guards load_bias calculation to exclude loader
binaries.
Restoring the check for presence of interpreter fixes the problem.
Fixes: 9630f0d60fec ("fs/binfmt_elf: use PT_LOAD p_align values for static PIE")
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
fs/binfmt_elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 605017eb9349..9e11e6f13e83 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1117,7 +1117,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
* without MAP_FIXED nor MAP_FIXED_NOREPLACE).
*/
alignment = maximum_alignment(elf_phdata, elf_ex->e_phnum);
- if (alignment > ELF_MIN_ALIGN) {
+ if (interpreter || alignment > ELF_MIN_ALIGN) {
load_bias = ELF_ET_DYN_BASE;
if (current->flags & PF_RANDOMIZE)
load_bias += arch_mmap_rnd();
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs/binfmt_elf: fix PT_LOAD p_align values for loaders
2022-02-02 12:14 [PATCH] fs/binfmt_elf: fix PT_LOAD p_align values for loaders Mike Rapoport
@ 2022-02-02 13:52 ` Rui Salvaterra
0 siblings, 0 replies; 2+ messages in thread
From: Rui Salvaterra @ 2022-02-02 13:52 UTC (permalink / raw)
To: Mike Rapoport
Cc: linux-fsdevel, Alexander Viro, Andrew Morton, Eric Biederman,
H.J. Lu, Kees Cook, Mike Rapoport, linux-kernel
Hi, Mike,
On Wed, 2 Feb 2022 at 12:14, Mike Rapoport <rppt@kernel.org> wrote:
>
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> Rui Salvaterra reported that Aisleroit solitaire crashes with "Wrong
> __data_start/_end pair" assertion from libgc after update to v5.17-rc1.
>
> Bisection pointed to commit 9630f0d60fec ("fs/binfmt_elf: use PT_LOAD
> p_align values for static PIE") that fixed handling of static PIEs, but
> made the condition that guards load_bias calculation to exclude loader
> binaries.
>
> Restoring the check for presence of interpreter fixes the problem.
>
> Fixes: 9630f0d60fec ("fs/binfmt_elf: use PT_LOAD p_align values for static PIE")
> Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> fs/binfmt_elf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index 605017eb9349..9e11e6f13e83 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -1117,7 +1117,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
> * without MAP_FIXED nor MAP_FIXED_NOREPLACE).
> */
> alignment = maximum_alignment(elf_phdata, elf_ex->e_phnum);
> - if (alignment > ELF_MIN_ALIGN) {
> + if (interpreter || alignment > ELF_MIN_ALIGN) {
> load_bias = ELF_ET_DYN_BASE;
> if (current->flags & PF_RANDOMIZE)
> load_bias += arch_mmap_rnd();
> --
> 2.34.1
>
The patch does fix the problem for me, and is thus
Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>
Thanks,
Rui
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-02 13:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 12:14 [PATCH] fs/binfmt_elf: fix PT_LOAD p_align values for loaders Mike Rapoport
2022-02-02 13:52 ` Rui Salvaterra
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.