Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit e88f113

Browse files
Michael Karcherchiichen
authored andcommitted
Mitigation for "clone on sparc might fail with -EFAULT for no valid reason" (bz 31394)
It seems the kernel can not deal with uncommitted stack space in the area intended for the register window when executing the clone() system call. So create a nested frame (proxy for the kernel frame) and flush it from the processor to memory to force committing pages to the stack before invoking the system call. Bug: https://www.mail-archive.com/[email protected]/msg62592.html Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31394 See-also: https://lore.kernel.org/sparclinux/62f9be9d-a086-4134-9a9f-5df8822708af@mkarcher.dialup.fu-berlin.de/ Signed-off-by: Michael Karcher <[email protected]> Reviewed-by: DJ Delorie <[email protected]>
1 parent b2b17bf commit e88f113

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

sysdeps/unix/sysv/linux/sparc/sparc32/clone.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
.text
2929
ENTRY (__clone)
3030
save %sp,-96,%sp
31+
save %sp,-96,%sp
32+
flushw
33+
restore
3134
cfi_def_cfa_register(%fp)
3235
cfi_window_save
3336
cfi_register(%o7, %i7)

sysdeps/unix/sysv/linux/sparc/sparc64/clone.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232

3333
ENTRY (__clone)
3434
save %sp, -192, %sp
35+
save %sp, -192, %sp
36+
flushw
37+
restore
3538
cfi_def_cfa_register(%fp)
3639
cfi_window_save
3740
cfi_register(%o7, %i7)

0 commit comments

Comments
 (0)