#
ba279bcd |
| 15-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Cleanup signal trampolines
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
linux(4): Cleanup signal trampolines
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
show more ...
|
#
0b5d5dc3 |
| 15-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Retire unneeded initialization
Both uc_flags and uc_link are zeroed above. On amd64 and i386 the uc_link field is not used at all. The UC_FP_XSTATE bit should be set in the uc_flags if OS
linux(4): Retire unneeded initialization
Both uc_flags and uc_link are zeroed above. On amd64 and i386 the uc_link field is not used at all. The UC_FP_XSTATE bit should be set in the uc_flags if OS xsave knob is turned on (and xsave is implemented).
MFC after: 2 weeks
show more ...
|
Revision tags: release/13.1.0 |
|
#
5a6a4fb2 |
| 08-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Implement vdso getcpu for x86.
This is modeled after f2395455 (by kib@).
MFC after: 2 weeks
|
#
d5dc757e |
| 31-Mar-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Add compat.linux32.emulate_i386 knob.
Historically 32-bit Linuxulator under amd64 emulated the real i386 behavior. Since 3d8dd983 the old i386 Linux world can't be used under amd64 Linuxul
linux(4): Add compat.linux32.emulate_i386 knob.
Historically 32-bit Linuxulator under amd64 emulated the real i386 behavior. Since 3d8dd983 the old i386 Linux world can't be used under amd64 Linuxulator as it don't know anything about amd64 machine (which is returned now by newuname() syscall). So, add a knob to allow to swith the behavior and use i386 Linux binaries on amd64. Set knob to the new behavior as I think this is common to the modern Linux distros.
Reviewed by: Pau Amma (doc), emaste Differential revision: https://reviews.freebsd.org/D34708 MFC after: 2 weeks
show more ...
|
#
6bea696a |
| 05-Feb-2022 |
John Baldwin <jhb@FreeBSD.org> |
linux_copyout_strings: Use PROC_PS_STRINGS().
Reviewed by: markj Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D34173
|
#
3fc21fdd |
| 17-Jan-2022 |
Mark Johnston <markj@FreeBSD.org> |
sysent: Add a sv_psstringssz field to struct sysentvec
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 t
sysent: Add a sv_psstringssz field to struct sysentvec
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
show more ...
|
#
f04a0960 |
| 31-Dec-2021 |
Mark Johnston <markj@FreeBSD.org> |
exec: Simplify sv_copyout_strings implementations a bit
Simplify control flow around handling of the execpath length and signal trampoline. Cache the sysentvec pointer in a local variable.
No func
exec: Simplify sv_copyout_strings implementations a bit
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
show more ...
|
Revision tags: release/12.3.0 |
|
#
a42d362b |
| 14-Sep-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
amd64: centralize definitions of CS_SECURE and EFL_SECURE
Requested by markj Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: http
amd64: centralize definitions of CS_SECURE and EFL_SECURE
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
show more ...
|
#
0a4b664a |
| 12-Aug-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Add struct clone_args for future clone3 system call.
In preparation for clone3 system call add struct clone_args and use it in clone implementation. Move all of clone related bits to the n
linux(4): Add struct clone_args for future clone3 system call.
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
show more ...
|
#
de8374df |
| 12-Aug-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
fork: Allow ABI to specify fork return values for child.
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
fork: Allow ABI to specify fork return values for child.
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
show more ...
|
#
cf8d74e3 |
| 20-Jul-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Allow musl brand to use FUTEX_REQUEUE op.
Initial patch from submitter was adapted by me to prevent unconditional FUTEX_REQUEUE use.
PR: 255947 Submitted by: Philippe Michaud-Boudreaul
linux(4): Allow musl brand to use FUTEX_REQUEUE op.
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
show more ...
|
#
ae8330b4 |
| 20-Jul-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Add arch name to the some printfs.
Reviewed by: emaste Differential revision: https://reviews.freebsd.org/D30904 MFC after: 2 weeks
|
#
09cffde9 |
| 20-Jul-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Fixup the vDSO initialization order.
The vDSO initialisation order should be as follows: - native abi init via exec_sysvec_init(); - vDSO symbols queued to the linux_vdso_syms list; - linu
linux(4): Fixup the vDSO initialization order.
The vDSO initialisation order should be as follows: - native abi init via exec_sysvec_init(); - vDSO symbols queued to the linux_vdso_syms list; - linux_vdso_install(); - linux_exec_sysvec_init();
As the exec_sysvec_init() called with SI_ORDER_ANY (last) at SI_SUB_EXEC order, move linux_vdso_install() and linux_exec_sysvec_init() to the SI_SUB_EXEC+1 order.
Reviewed by: trasz Differential Revision: https://reviews.freebsd.org/D30902 MFC after 2 weeks
show more ...
|
#
a543556c |
| 20-Jul-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Constify vdso install/deinstall.
In order to reduce diff between arches constify vdso install/deinstall functions like arm64.
Reviewed by: emaste Differential revision: https://reviews.f
linux(4): Constify vdso install/deinstall.
In order to reduce diff between arches constify vdso install/deinstall functions like arm64.
Reviewed by: emaste Differential revision: https://reviews.freebsd.org/D30901 MFC after: 2 weeks
show more ...
|
#
9931033b |
| 20-Jul-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4); Almost complete the vDSO.
The vDSO (virtual dynamic shared object) is a small shared library that the kernel maps R/O into the address space of all Linux processes on image activation. The
linux(4); Almost complete the vDSO.
The vDSO (virtual dynamic shared object) is a small shared library that the kernel maps R/O into the address space of all Linux processes on image activation. The vDSO is a fully formed ELF image, shared by all processes with the same ABI, has no process private data.
The primary purpose of the vDSO: - non-executable stack, signal trampolines not copied to the stack; - signal trampolines unwind, mandatory for the NPTL; - to avoid contex-switch overhead frequently used system calls can be implemented in the vDSO: for now gettimeofday, clock_gettime.
The first two have been implemented, so add the implementation of system calls.
System calls implemenation based on a native timekeeping code with some limitations: - ifunc can't be used, as vDSO r/o mapped to the process VA and rtld can't relocate symbols; - reading HPET memory is not implemented for now (TODO).
In case on any error vDSO system calls fallback to the kernel system calls. For unimplemented vDSO system calls added prototypes which call corresponding kernel system call.
Tested by: trasz (arm64) Differential revision: https://reviews.freebsd.org/D30900 MFC after: 2 weeks
show more ...
|
#
5fd9cd53 |
| 20-Jul-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Modify sv_onexec hook to return an error.
Temporary add stubs to the Linux emulation layer which calls the existing hook.
Reviewed by: kib Differential Revision: https://reviews.freebsd.
linux(4): Modify sv_onexec hook to return an error.
Temporary add stubs to the Linux emulation layer which calls the existing hook.
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D30911 MFC after: 2 weeks
show more ...
|
#
cf98bc28 |
| 10-Jul-2021 |
David Chisnall <theraven@FreeBSD.org> |
Pass the syscall number to capsicum permission-denied signals
The syscall number is stored in the same register as the syscall return on amd64 (and possibly other architectures) and so it is impossi
Pass the syscall number to capsicum permission-denied signals
The syscall number is stored in the same register as the syscall return on amd64 (and possibly other architectures) and so it is impossible to recover in the signal handler after the call has returned. This small tweak delivers it in the `si_value` field of the signal, which is sufficient to catch capability violations and emulate them with a call to a more-privileged process in the signal handler.
This reapplies 3a522ba1bc852c3d4660a4fa32e4a94999d09a47 with a fix for the static assertion failure on i386.
Approved by: markj (mentor)
Reviewed by: kib, bcr (manpages)
Differential Revision: https://reviews.freebsd.org/D29185
show more ...
|
#
d2b55828 |
| 10-Jul-2021 |
David Chisnall <theraven@FreeBSD.org> |
Revert "Pass the syscall number to capsicum permission-denied signals"
This broke the i386 build.
This reverts commit 3a522ba1bc852c3d4660a4fa32e4a94999d09a47.
|
#
3a522ba1 |
| 10-Jul-2021 |
David Chisnall <theraven@FreeBSD.org> |
Pass the syscall number to capsicum permission-denied signals
The syscall number is stored in the same register as the syscall return on amd64 (and possibly other architectures) and so it is impossi
Pass the syscall number to capsicum permission-denied signals
The syscall number is stored in the same register as the syscall return on amd64 (and possibly other architectures) and so it is impossible to recover in the signal handler after the call has returned. This small tweak delivers it in the `si_value` field of the signal, which is sufficient to catch capability violations and emulate them with a call to a more-privileged process in the signal handler.
Approved by: markj (mentor)
Reviewed by: kib, bcr (manpages)
Differential Revision: https://reviews.freebsd.org/D29185
show more ...
|
#
447636e4 |
| 30-Jun-2021 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
linux(4): implement coredump support
Implement dumping core for Linux binaries on amd64, for both 32- and 64-bit executables. Some bits are still missing.
This is based on a prototype by chuck@.
linux(4): implement coredump support
Implement dumping core for Linux binaries on amd64, for both 32- and 64-bit executables. Some bits are still missing.
This is based on a prototype by chuck@.
Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30019
show more ...
|
#
435754a5 |
| 29-Jun-2021 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Add infrastructure required for Linux coredump support
This adds `sv_elf_core_osabi`, `sv_elf_core_abi_vendor`, and `sv_elf_core_prepare_notes` fields to `struct sysentvec`, and modifies imgact_elf.
Add infrastructure required for Linux coredump support
This adds `sv_elf_core_osabi`, `sv_elf_core_abi_vendor`, and `sv_elf_core_prepare_notes` fields to `struct sysentvec`, and modifies imgact_elf.c to make use of them instead of hardcoding FreeBSD-specific values. It also updates all of the ABI definitions to preserve current behaviour.
This makes it possible to implement non-native ELF coredump support without unnecessary code duplication. It will be used for Linux coredumps.
Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30921
show more ...
|
#
4aae1334 |
| 25-Jun-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Make vDSO defines private.
Hide the vDSO defines to the linux32_sysvec as they are not intended to be used outside of it. Fix LINUX32_PS_STRINGS, use the size of struct linux32_ps_strings
linux(4): Make vDSO defines private.
Hide the vDSO defines to the linux32_sysvec as they are not intended to be used outside of it. Fix LINUX32_PS_STRINGS, use the size of struct linux32_ps_strings instead of a numeric constant.
MFC after: 2 weeks
show more ...
|
#
c1da89fe |
| 22-Jun-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Retire linux_kplatform.
Assuming we can't run on i486, i586 class cpu, retire linux_kplatform var and use hardcoded 'machine' value in linux_newuname().
I have added linux_kplatform for c
linux(4): Retire linux_kplatform.
Assuming we can't run on i486, i586 class cpu, retire linux_kplatform var and use hardcoded 'machine' value in linux_newuname().
I have added linux_kplatform for consistency with linux_platform which is placed in to vdso to avoid excess copyout it on stack for AT_PLATFORM at exec time.
This is the first stage of Linuxulator's vdso revision.
Reviewed by: trasz, imp Differential Revision: https://reviews.freebsd.org/D30774 MFC after: 2 weeks
show more ...
|
#
870e197d |
| 05-Jun-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
Add quirks for Linux ABI signals handling
Require queueing of the signals with default action, and disable dequeueing SIGCHLD on wait for live process.
Reported and tested by: dchagin Reviewed by:
Add quirks for Linux ABI signals handling
Require queueing of the signals with default action, and disable dequeueing SIGCHLD on wait for live process.
Reported and tested by: dchagin Reviewed by: dchagin, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30675
show more ...
|
Revision tags: release/13.0.0 |
|
#
598f6fb4 |
| 14-Jan-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
linuxolator: Add compat.linux.setid_allowed knob
PR: 21463 Reported by: kris Reviewed by: dchagin Tested by: trasz Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https
linuxolator: Add compat.linux.setid_allowed knob
PR: 21463 Reported by: kris Reviewed by: dchagin Tested by: trasz Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28154
show more ...
|