linux/arch/x86/um/shared/sysdep
Johannes Berg d1d7f01f7c um: mark rodata read-only and implement _nofault accesses
Mark read-only data actually read-only (simple mprotect), and
to be able to test it also implement _nofault accesses. This
works by setting up a new "segv_continue" pointer in current,
and then when we hit a segfault we change the signal return
context so that we continue at that address. The code using
this sets it up so that it jumps to a label and then aborts
the access that way, returning -EFAULT.

It's possible to optimize the ___backtrack_faulted() thing by
using asm goto (compiler version dependent) and/or gcc's (not
sure if clang has it) &&label extension, but at least in one
attempt I made the && caused the compiler to not load -EFAULT
into the register in case of jumping to the &&label from the
fault handler. So leave it like this for now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Co-developed-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://patch.msgid.link/20250210160926.420133-2-benjamin@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-03-18 11:03:14 +01:00
..
archsetjmp.h um: Fix the -Wmissing-prototypes warning for get_thread_reg 2024-04-30 14:15:17 +02:00
archsetjmp_32.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
archsetjmp_64.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
faultinfo.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
faultinfo_32.h um: mark rodata read-only and implement _nofault accesses 2025-03-18 11:03:14 +01:00
faultinfo_64.h um: mark rodata read-only and implement _nofault accesses 2025-03-18 11:03:14 +01:00
kernel-offsets.h um: Fix -Wmissing-prototypes warnings for __warp_* and foo 2024-04-22 21:58:48 +02:00
mcontext.h
ptrace.h um: Remove unused user_context function 2025-01-10 13:49:57 +01:00
ptrace_32.h um: switch to regset API and depend on XSTATE 2024-10-23 12:13:16 +02:00
ptrace_64.h um: switch to regset API and depend on XSTATE 2024-10-23 12:13:16 +02:00
ptrace_user.h um: switch to regset API and depend on XSTATE 2024-10-23 12:13:16 +02:00
stub.h um: remove copy_context_skas0 2024-07-03 17:09:49 +02:00
stub_32.h um: make stub_exe _start() pure inline asm 2024-10-23 09:04:59 +02:00
stub_64.h um: make stub_exe _start() pure inline asm 2024-10-23 09:04:59 +02:00
syscalls.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
syscalls_32.h um: Cleanup syscall_handler_t cast in syscalls_32.h 2022-09-19 21:58:53 +02:00
syscalls_64.h um: Cleanup syscall_handler_t definition/cast, fix warning 2022-03-11 10:48:03 +01:00
tls.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00