summaryrefslogtreecommitdiff
path: root/sys/amd64/linux/linux_sysvec.c
AgeCommit message (Collapse)Author
2025-10-14imgact: Mark brandinfo and note structures as constMark Johnston
No functional change intended. Reviewed by: olce, kib, emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D53062
2025-06-24sys: Add AT_HWCAP3 and AT_HWCAP4Andrew Turner
It is likely we will need these on arm64. Add them in preparation for flags in these to be added at some point in the future. Reviewed by: brooks, imp, kib Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D51005
2025-05-28amd64: add pcb_tlsbaseKonstantin Belousov
This is a value for TLS base that would be explicitly set by user. It is forced into the fsbase register on entry to signal handler, making TLS in the handler usable even if userspace uses segmentation. Reported and tested: Alex S <iwtcex@gmail.com> Tested by: pho Reviewed by: olce Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50482
2024-02-11amd64/linux*: mark brandlists as staticKonstantin Belousov
Sponsored by: The FreeBSD Foundation MFC after: 3 days
2023-10-03linux(4): Deorbit linux_nosysDmitry Chagin
Differential Revision: https://reviews.freebsd.org/D41901 MFC after: 1 week
2023-10-03linuxolator: fix nosys() to not send SIGSYSKonstantin Belousov
Reviewed by: dchagin, markj Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41976
2023-09-11linux(4): Cleanup includes under amd64/linuxDmitry Chagin
No functional changes. MFC after: 1 week
2023-08-18linux(4): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743Dmitry Chagin
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-07-28linux(4): Add elf_hwcap2 to x86Dmitry Chagin
On x86 Linux via AT_HWCAP2 the user controlled (by tunables) processor capabilities are exposed. Reviewed by: Differential Revision: https://reviews.freebsd.org/D41165 MFC after: 2 weeks
2023-06-09linux(4): Preserve fpu xsave state across signal delivery on amd64Dmitry Chagin
PR: 270247 Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D40444 MFC after: 2 weeks
2023-06-09linux(4): In preparation for xsave refactor fxsave code on amd64Dmitry Chagin
Due to fxsave area is os independent reimplement fxsave handmade code using copying of a whole area. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D40443 MFC after: 2 weeks
2023-06-06linux(4) rt_sendsig: Remove the use of caddr_tDmitry Chagin
Replace caddr_t by more appropriate char *. MFC after: 2 weeks
2023-05-29linux(4): Use pwd_altroot() to tell namei() about ABI root pathDmitry Chagin
PR: 72920 Differential Revision: https://reviews.freebsd.org/D40090 MFC after: 2 month
2023-05-28linux(4): Preserve %rcx (return address) like a Linux doDmitry Chagin
Perhaps, this does not makes much sense as destroyng %rcx declared by the x86_64 Linux syscall ABI. However,: a) if we get a signal while we are in the kernel, we should restore tf_rcx when preparing machine context for signal handlers. b) the Linux world is strange, someone can depend on %rcx value after syscall, something like go. Differential Revision: https://reviews.freebsd.org/D40155 MFC after: 1 month
2023-05-28linux(4): Simplify %r10 restoring on amd64Dmitry Chagin
Restore %r10 at system call entry to avoid doing this multiply times. Differential Revision: https://reviews.freebsd.org/D40154 MFC after: 1 month
2023-05-28linux(4): Add a comment explaining registers at syscall entry point on amd64Dmitry Chagin
Differential Revision: https://reviews.freebsd.org/D40153 MFC after: 1 month
2023-05-28linux(4): Drop a weird comment from linux_set_syscall_retval on amd64Dmitry Chagin
I agree, it would be great to avoid PCB_FULL_IRET, however we should follow Linux system call ABI. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40152 MFC after: 1 month
2023-04-22linux(4): Deduplicate linux_copyout_auxargs()Dmitry Chagin
Export default MINSIGSTKSZ value for the x86 until we do not preserve AVX registers in the signal context. Differential Revision: https://reviews.freebsd.org/D39644 MFC after: 1 month
2023-02-14linux(4): Cleanup includes under amd64/linuxDmitry Chagin
Cleanup unneeded includes, sort the rest according to style(9). No functional changes. MFC after: 2 weeks
2023-02-02linux(4): Remove stale comment that no longer applies.Dmitry Chagin
MFC after: 1 week
2023-02-02linux(4): Microoptimize rt_sendsig() on amd64.Dmitry Chagin
Drop proc lock earlier, before copying user stuff. Pointed out by: kib Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D38326 MFC after: 1 week
2023-02-02linux(4): Preserve fpu fxsave state across signal delivery on amd64.Dmitry Chagin
PR: 240768 Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D38302 MFC after: 1 week
2023-02-02linux(4): Deduplicate linux_trans_osrel().Dmitry Chagin
MFC after: 1 week
2023-02-02linux(4): Deduplicate linux_copyout_strings().Dmitry Chagin
It is still present in the 32-bit Linuxulator on amd64. MFC after: 1 week
2023-02-02linux(4): Deduplicate linux_fixup_elf().Dmitry Chagin
Use native routines to fixup initial process stack. On Arm64 linux_elf_fixup() is noop, as it do the stack fixup (room for argc) in the linux_copyout_strings(). MFC after: 1 week
2023-02-02linux(4): Microoptimize linux_elf.h for future use.Dmitry Chagin
In order to reduce code duplication move coredump support definitions into the appropriate header and hide private definitions. MFC after: 1 week
2022-10-28linux: populate sv_syscallnames in each sysentvecMitchell Horne
This allows the syscallname() function to give a usable result for Linux ABIs. Reported by: jrtc27 Reviewed by: jrtc27, markj, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37199
2022-07-18Rework how shared page related data is storedKornel Dulęba
Store the shared page address in struct vmspace. Also instead of storing absolute addresses of various shared page segments save their offsets with respect to the shared page address. This will be more useful when the shared page address is randomized. Approved by: mw(mentor) Sponsored by: Stormshield Obtained from: Semihalf Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D35393
2022-05-30linux(4): Properly build argument list for the signal handlerDmitry Chagin
Provide arguments 2 and 3 if signal handler installed with SA_SIGINFO. MFC after: 2 weeks
2022-05-30linux(4): Microoptimize rt_sendsig(), convert signal mask onceDmitry Chagin
On amd64 Linux saves the thread signal mask in both contexts, in the machine dependent and in the machine independent. Both contexts are user accessible. Convert the mask once, then copy it. MFC after: 2 weeks
2022-05-30linux(4): Avoid direct manipulation of td_sigmaskDmitry Chagin
Use kern_sigprocmask() instead of direct manipulation of td_sigmask to reschedule newly blocked signals. MFC after: 2 weeks
2022-05-23linux(4): Deduplicate bsd_to_linux_trapcode()Dmitry Chagin
As bsd_to_linux_trapcode() is common for x86 Linuxulators, move it under x86/linux. MFC after: 2 weeks
2022-05-23linux(4): Deduplicate translate_traps()Dmitry Chagin
As translate_traps() is common for x86 Linuxulators, move it under x86/linux. MFC after: 2 weeks
2022-05-20Retire sv_transtrapDmitry Chagin
Call translate_traps directly from sendsig(). MFC after: 2 weeks
2022-05-15linux(4): Better naming for ucontext field of struct rt_sigframeDmitry Chagin
To reduce sendsig code difference and to avoid confusing me, rename sf_sc to sf_uc to match the content. MFC after: 2 weeks
2022-05-15linux(4): Move sigframe definitions to separate headersDmitry Chagin
The signal trampoine-related definitions are used only in the MD part of code, wherefore moved from everywhere used linux.h to separate MD headers. MFC after: 2 weeks
2022-05-15linux(4): Cleanup signal trampolinesDmitry Chagin
This is the first stage of a signal trampolines refactoring. From trampolines retired emulation of the 'call' instruction, which is replaced by direct call of a signal handler. The signal handler address is in the register. The previous trampoline implemenatation used semi-Linux-way to call a signal handler via the 'jmp' instruction. Wherefore the trampoline emulated a 'call' instruction to into the stack the return address for signal handler's 'ret' instruction. Wherefore handmade DWARD annotations was used. While here rephrased and removed excessive comments. MFC after: 2 weeks
2022-05-08linux(4): Implement vdso getcpu for x86.Dmitry Chagin
This is modeled after f2395455 (by kib@). MFC after: 2 weeks
2022-01-17exec: Introduce the PROC_PS_STRINGS() macroMark Johnston
Rather than fetching the ps_strings address directly from a process' sysentvec, use this macro. With stack address randomization the ps_strings address is no longer fixed. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33704
2022-01-17sysent: Add a sv_psstringssz field to struct sysentvecMark Johnston
The size of the ps_strings structure varies between ABIs, so this is useful for computing the address of the ps_strings structure relative to the top of the stack when stack address randomization is enabled. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33704
2022-01-04linux(4): Reduce diffs between linux_rt_sendsig() and sendsig()Edward Tomasz Napierala
No functional changes (except for the uprintf). Discussed With: kib Sponsored By: EPSRC
2021-12-31exec: Simplify sv_copyout_strings implementations a bitMark Johnston
Simplify control flow around handling of the execpath length and signal trampoline. Cache the sysentvec pointer in a local variable. No functional change intended. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33703
2021-09-21amd64: consistently use uprintf() to report weird situations in sigreturnKonstantin Belousov
Reviewed by: jhb Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954
2021-09-21amd64: centralize definitions of CS_SECURE and EFL_SECUREKonstantin Belousov
Requested by markj Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954
2021-08-12linux(4): Remove the unnecessary spaces.Dmitry Chagin
MFC after: 2 weeks
2021-08-12linux(4): Add struct clone_args for future clone3 system call.Dmitry Chagin
In preparation for clone3 system call add struct clone_args and use it in clone implementation. Move all of clone related bits to the newly created linux_fork.h header. Differential revision: https://reviews.freebsd.org/D31474 MFC after: 2 weeks
2021-08-12fork: Allow ABI to specify fork return values for child.Dmitry Chagin
At least Linux x86 ABI's does not use carry bit and expects that the dx register is preserved. For this add a new sv_set_fork_retval hook and call it from cpu_fork(). Add a short comment about touching dx in x86_set_fork_retval(), for more details see phab comments from kib@ and imp@. Reviewed by: kib Differential revision: https://reviews.freebsd.org/D31472 MFC after: 2 weeks
2021-07-26linux: fix sigaltstack on amd64Edward Tomasz Napierala
To determine whether to use alternate signal stack or not, we need to use the native signal number, not the one translated with bsd_to_linux_signal(). In practical terms, this fixes golang. Reviewed By: dchagin Fixes: 135dd0cab51 Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D31298
2021-07-20linux(4): Allow musl brand to use FUTEX_REQUEUE op.Dmitry Chagin
Initial patch from submitter was adapted by me to prevent unconditional FUTEX_REQUEUE use. PR: 255947 Submitted by: Philippe Michaud-Boudreault Differential Revision: https://reviews.freebsd.org/D30332