]> sourceware.org Git - glibc.git/commitdiff
Mitigation for "clone on sparc might fail with -EFAULT for no valid reason" (bz 31394)
authorMichael Karcher <Michael.Karcher@fu-berlin.de>
Sun, 28 Jul 2024 13:30:57 +0000 (15:30 +0200)
committerAndreas K. Hüttel <dilfridge@gentoo.org>
Mon, 29 Jul 2024 21:00:39 +0000 (23:00 +0200)
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/debian-glibc@lists.debian.org/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 <sourceware-bugzilla@mkarcher.dialup.fu-berlin.de>
Reviewed-by: DJ Delorie <dj@redhat.com>
sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
sysdeps/unix/sysv/linux/sparc/sparc64/clone.S

index 748d25fcfed597dc8ae671dcbbe81976976484b3..c9cf9bb055bc0c5cba57d14cbe27d44877e28dd3 100644 (file)
@@ -28,6 +28,9 @@
        .text
 ENTRY (__clone)
        save    %sp,-96,%sp
+       save    %sp,-96,%sp
+       flushw
+       restore
        cfi_def_cfa_register(%fp)
        cfi_window_save
        cfi_register(%o7, %i7)
index e5ff2cf1a042aeae95514823b2793366512adbea..370d51fda295232efaa985b244059b8adab060fb 100644 (file)
@@ -32,6 +32,9 @@
 
 ENTRY (__clone)
        save    %sp, -192, %sp
+       save    %sp, -192, %sp
+       flushw
+       restore
        cfi_def_cfa_register(%fp)
        cfi_window_save
        cfi_register(%o7, %i7)
This page took 0.040256 seconds and 5 git commands to generate.