public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.1.y 0/7] Backported patches to fix selftest tpdir2
@ 2025-03-24  7:19 Kang Wenlin
  2025-03-24  7:19 ` [PATCH 6.1.y 1/7] binfmt_elf: replace IS_ERR() with IS_ERR_VALUE() Kang Wenlin
                   ` (7 more replies)
  0 siblings, 8 replies; 18+ messages in thread
From: Kang Wenlin @ 2025-03-24  7:19 UTC (permalink / raw)
  To: regkh, stable; +Cc: viro, ebiederm, keescook, akpm

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.1.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


The first patch is just for alignment to apply the follow patches.
This issue is resolved by the second 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

Bo Liu (1):
  binfmt_elf: replace IS_ERR() with IS_ERR_VALUE()

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    | 221 ++++++++++++++++-----------------------------
 include/linux/mm.h |   3 +-
 mm/mmap.c          |   6 --
 mm/nommu.c         |   5 -
 4 files changed, 79 insertions(+), 156 deletions(-)

-- 
2.39.2


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

end of thread, other threads:[~2025-04-02  3:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-24  7:19 [PATCH 6.1.y 0/7] Backported patches to fix selftest tpdir2 Kang Wenlin
2025-03-24  7:19 ` [PATCH 6.1.y 1/7] binfmt_elf: replace IS_ERR() with IS_ERR_VALUE() Kang Wenlin
2025-03-25 11:33   ` Sasha Levin
2025-03-24  7:19 ` [PATCH 6.1.y 2/7] binfmt_elf: Support segments with 0 filesz and misaligned starts Kang Wenlin
2025-03-25 11:38   ` Sasha Levin
2025-03-24  7:19 ` [PATCH 6.1.y 3/7] binfmt_elf: elf_bss no longer used by load_elf_binary() Kang Wenlin
2025-03-25 11:33   ` Sasha Levin
2025-03-24  7:19 ` [PATCH 6.1.y 4/7] binfmt_elf: Use elf_load() for interpreter Kang Wenlin
2025-03-25 11:33   ` Sasha Levin
2025-03-24  7:19 ` [PATCH 6.1.y 5/7] binfmt_elf: Use elf_load() for library Kang Wenlin
2025-03-25 11:38   ` Sasha Levin
2025-03-24  7:19 ` [PATCH 6.1.y 6/7] binfmt_elf: Only report padzero() errors when PROT_WRITE Kang Wenlin
2025-03-25 11:33   ` Sasha Levin
2025-04-01  9:58   ` Greg KH
2025-04-02  3:00     ` Wenlin Kang
2025-03-24  7:19 ` [PATCH 6.1.y 7/7] mm: Remove unused vm_brk() Kang Wenlin
2025-03-25 11:33   ` Sasha Levin
     [not found] ` <DS0PR11MB6325BD9BB3C4B176CADD0472E1AC2@DS0PR11MB6325.namprd11.prod.outlook.com>
2025-04-01  6:58   ` [PATCH 6.1.y 0/7] Backported patches to fix selftest tpdir2 gregkh

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