public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.6.y 0/6] Backported patches to fix selftest tpdir2
@ 2025-04-02  8:26 Kang Wenlin
  2025-04-02  8:26 ` [PATCH 6.6.y 1/6] binfmt_elf: Support segments with 0 filesz and misaligned starts Kang Wenlin
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Kang Wenlin @ 2025-04-02  8:26 UTC (permalink / raw)
  To: gregkh, stable; +Cc: viro, brauner, ebiederm, keescook, akpm, wenlin.kang

From: Wenlin Kang <wenlin.kang@windriver.com>

The selftest tpdir2 terminated with a 'Segmentation fault' during loading. 

root@localhost:~# cd linux-kenel/tools/testing/selftests/arm64/abi && make
root@localhost:~/linux-kernel/tools/testing/selftests/arm64/abi# ./tpidr2
Segmentation fault

The cause of this is the __arch_clear_user() failure.

load_elf_binary() [fs/binfmt_elf.c]
  -> if (likely(elf_bss != elf_brk) && unlikely(padzero(elf_bes)))
    -> padzero()
      -> clear_user() [arch/arm64/include/asm/uaccess.h]
        -> __arch_clear_user() [arch/arm64/lib/clear_user.S]

For more details, please see:
https://lore.kernel.org/lkml/1d0342f3-0474-482b-b6db-81ca7820a462@t-8ch.de/T/


This issue has been fixed in the mainline. Here I have backported
the relevant commits for the linux-6.6.y branch and attached them.
With these patches, tpdir2 works as:

root@localhost:~/linux-kernel/tools/testing/selftests/arm64/abi# ./tpidr2
TAP version 13
1..5
ok 0 skipped, TPIDR2 not supported
ok 1 skipped, TPIDR2 not supported
ok 2 skipped, TPIDR2 not supported
ok 3 skipped, TPIDR2 not supported
ok 4 skipped, TPIDR2 not supported


This issue is resolved by the first patch. However, to ensure
functional completeness, all related patches were backported
according to the following link.

https://lore.kernel.org/all/20230929031716.it.155-kees@kernel.org/#t

Eric W. Biederman (1):
  binfmt_elf: Support segments with 0 filesz and misaligned starts

Kees Cook (5):
  binfmt_elf: elf_bss no longer used by load_elf_binary()
  binfmt_elf: Use elf_load() for interpreter
  binfmt_elf: Use elf_load() for library
  binfmt_elf: Only report padzero() errors when PROT_WRITE
  mm: Remove unused vm_brk()

 fs/binfmt_elf.c    | 215 ++++++++++++++++-----------------------------
 include/linux/mm.h |   3 +-
 mm/mmap.c          |   6 --
 mm/nommu.c         |   5 --
 4 files changed, 76 insertions(+), 153 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2025-04-08 14:40 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02  8:26 [PATCH 6.6.y 0/6] Backported patches to fix selftest tpdir2 Kang Wenlin
2025-04-02  8:26 ` [PATCH 6.6.y 1/6] binfmt_elf: Support segments with 0 filesz and misaligned starts Kang Wenlin
2025-04-02 21:25   ` Sasha Levin
2025-04-02  8:26 ` [PATCH 6.6.y 2/6] binfmt_elf: elf_bss no longer used by load_elf_binary() Kang Wenlin
2025-04-02 21:25   ` Sasha Levin
2025-04-02  8:26 ` [PATCH 6.6.y 3/6] binfmt_elf: Use elf_load() for interpreter Kang Wenlin
2025-04-02 21:25   ` Sasha Levin
2025-04-02  8:26 ` [PATCH 6.6.y 4/6] binfmt_elf: Use elf_load() for library Kang Wenlin
2025-04-02 21:25   ` Sasha Levin
2025-04-02  8:26 ` [PATCH 6.6.y 5/6] binfmt_elf: Only report padzero() errors when PROT_WRITE Kang Wenlin
2025-04-02 21:25   ` Sasha Levin
2025-04-02  8:26 ` [PATCH 6.6.y 6/6] mm: Remove unused vm_brk() Kang Wenlin
2025-04-02 21:25   ` Sasha Levin
2025-04-03 14:52 ` [PATCH 6.6.y 0/6] Backported patches to fix selftest tpdir2 Greg KH
2025-04-04  7:58   ` Kang Wenlin
2025-04-08  9:06     ` Greg KH
2025-04-08  9:50       ` Wenlin Kang
2025-04-08  9:55         ` Greg KH
2025-04-08 14:39           ` Kang Wenlin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox