Revision tags: release/14.0.0 |
|
#
39024a89 |
| 25-Sep-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
syscalls: fix missing SIGSYS for several ENOSYS errors
In particular, when the syscall number is too large, or when syscall is dynamic. For that, add nosys_sysent structure to pass fake sysent to s
syscalls: fix missing SIGSYS for several ENOSYS errors
In particular, when the syscall number is too large, or when syscall is dynamic. For that, add nosys_sysent structure to pass fake sysent to syscall top code.
Reviewed by: dchagin, markj Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41976
show more ...
|
#
685dc743 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
Revision tags: release/13.2.0, release/12.4.0, release/13.1.0 |
|
#
706f4a81 |
| 17-Jan-2022 |
Mark Johnston <markj@FreeBSD.org> |
exec: Introduce the PROC_PS_STRINGS() macro
Rather than fetching the ps_strings address directly from a process' sysentvec, use this macro. With stack address randomization the ps_strings address i
exec: Introduce the PROC_PS_STRINGS() macro
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
show more ...
|
Revision tags: release/12.3.0 |
|
#
98c8b625 |
| 14-Nov-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
vdso for ia32 on amd64
Reviewed by: emaste Discussed with: jrtc27 Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 month Differential revision: https://reviews.freebsd.org/D32960
|
#
b0f71f1b |
| 10-Aug-2021 |
Mark Johnston <markj@FreeBSD.org> |
amd64: Add MD bits for KMSAN
Interrupt and exception handlers must call kmsan_intr_enter() prior to calling any C code. This is because the KMSAN runtime maintains some TLS in order to track initia
amd64: Add MD bits for KMSAN
Interrupt and exception handlers must call kmsan_intr_enter() prior to calling any C code. This is because the KMSAN runtime maintains some TLS in order to track initialization state of function parameters and return values across function calls. Then, to ensure that this state is kept consistent in the face of asynchronous kernel-mode excpeptions, the runtime uses a stack of TLS blocks, and kmsan_intr_enter() and kmsan_intr_leave() push and pop that stack, respectively.
Use these functions in amd64 interrupt and exception handlers. Note that handlers for user->kernel transitions need not be annotated.
Also ensure that trap frames pushed by the CPU and by handlers are marked as initialized before they are used.
Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31467
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 ...
|
Revision tags: release/13.0.0, release/12.2.0 |
|
#
1e2521ff |
| 27-Sep-2020 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Get rid of sa->narg. It serves no purpose; use sa->callp->sy_narg instead.
Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26458
|
Revision tags: release/11.4.0 |
|
#
59838c1a |
| 01-Apr-2020 |
John Baldwin <jhb@FreeBSD.org> |
Retire procfs-based process debugging.
Modern debuggers and process tracers use ptrace() rather than procfs for debugging. ptrace() has a supserset of functionality available via procfs and new deb
Retire procfs-based process debugging.
Modern debuggers and process tracers use ptrace() rather than procfs for debugging. ptrace() has a supserset of functionality available via procfs and new debugging features are only added to ptrace(). While the two debugging services share some fields in struct proc, they each use dedicated fields and separate code. This results in extra complexity to support a feature that hasn't been enabled in the default install for several years.
PR: 244939 (exp-run) Reviewed by: kib, mjg (earlier version) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D23837
show more ...
|
Revision tags: release/12.1.0 |
|
#
a63915c2 |
| 28-Jul-2019 |
Alan Somers <asomers@FreeBSD.org> |
MFHead @r350386
Sponsored by: The FreeBSD Foundation
|
#
c18ca749 |
| 15-Jul-2019 |
John Baldwin <jhb@FreeBSD.org> |
Don't pass error from syscallenter() to syscallret().
syscallret() doesn't use error anymore. Fix a few other places to permit removing the return value from syscallenter() entirely. - Remove a dup
Don't pass error from syscallenter() to syscallret().
syscallret() doesn't use error anymore. Fix a few other places to permit removing the return value from syscallenter() entirely. - Remove a duplicated assertion from arm's syscall(). - Use td_errno for amd64_syscall_ret_flush_l1d.
Reviewed by: kib MFC after: 1 month Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D2090
show more ...
|
Revision tags: release/11.3.0 |
|
#
628888f0 |
| 19-Dec-2018 |
Mateusz Guzik <mjg@FreeBSD.org> |
Remove iBCS2, part2: general kernel
Reviewed by: kib (previous version) Sponsored by: The FreeBSD Foundation
|
Revision tags: release/12.0.0 |
|
#
c6879c6c |
| 23-Oct-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r339015 through r339669.
|
#
2dec2b4a |
| 21-Oct-2018 |
Konstantin Belousov <kib@FreeBSD.org> |
amd64: flush L1 data cache on syscall return with an error.
The knob allows to select the flushing mode or turn it off/on. The idea, as well as the list of the ignored syscall errors, were taken fr
amd64: flush L1 data cache on syscall return with an error.
The knob allows to select the flushing mode or turn it off/on. The idea, as well as the list of the ignored syscall errors, were taken from https://www.openwall.com/lists/kernel-hardening/2018/10/11/10 .
I was not able to measure statistically significant difference between flush enabled vs disabled using syscall_timing getuid.
Reviewed by: bwidawsk Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D17536
show more ...
|
Revision tags: release/11.2.0 |
|
#
6469bdcd |
| 06-Apr-2018 |
Brooks Davis <brooks@FreeBSD.org> |
Move most of the contents of opt_compat.h to opt_global.h.
opt_compat.h is mentioned in nearly 180 files. In-progress network driver compabibility improvements may add over 100 more so this is close
Move most of the contents of opt_compat.h to opt_global.h.
opt_compat.h is mentioned in nearly 180 files. In-progress network driver compabibility improvements may add over 100 more so this is closer to "just about everywhere" than "only some files" per the guidance in sys/conf/options.
Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of sys/compat/linux/*.c. A fake _COMPAT_LINUX option ensure opt_compat.h is created on all architectures.
Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the set of compiled files.
Reviewed by: kib, cem, jhb, jtl Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14941
show more ...
|
#
2d7e563c |
| 05-Apr-2018 |
Konstantin Belousov <kib@FreeBSD.org> |
Fix ERESTART for lcall $7,$0 syscalls.
The lcall trampoline enters kernel by int $0x80, which sets up invalid length of the instruction for %rip rewind.
Reviewed by: bde Sponsored by: The FreeBSD F
Fix ERESTART for lcall $7,$0 syscalls.
The lcall trampoline enters kernel by int $0x80, which sets up invalid length of the instruction for %rip rewind.
Reviewed by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week
show more ...
|
#
a37d4032 |
| 24-Mar-2018 |
Konstantin Belousov <kib@FreeBSD.org> |
Improve the lcall $7,$0 syscall emulation on amd64.
Current code, which copies the potential syscall arguments into the current frame, puts an arbitrary limit on the number of syscall arguments. Ap
Improve the lcall $7,$0 syscall emulation on amd64.
Current code, which copies the potential syscall arguments into the current frame, puts an arbitrary limit on the number of syscall arguments. Apparently, mmap(2) and lseek(2) (?) require larger number. But there is an issue that stack is only need to be mapped to contain the number of arguments required by the syscall, so copying arbitrary large number of words from the stack is not completely safe.
Use different approach to convert lcall frame into int $0x80 frame in place, by doing the retl in kernel. This also allows to stop proceed vfork case specially, and stop making assumptions about %cs at the syscall time.
Also, improve comments with the formulations provided by bde.
Reviewed and tested by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week
show more ...
|
#
bd50262f |
| 17-Jan-2018 |
Konstantin Belousov <kib@FreeBSD.org> |
PTI for amd64.
The implementation of the Kernel Page Table Isolation (KPTI) for amd64, first version. It provides a workaround for the 'meltdown' vulnerability. PTI is turned off by default for now
PTI for amd64.
The implementation of the Kernel Page Table Isolation (KPTI) for amd64, first version. It provides a workaround for the 'meltdown' vulnerability. PTI is turned off by default for now, enable with the loader tunable vm.pmap.pti=1.
The pmap page table is split into kernel-mode table and user-mode table. Kernel-mode table is identical to the non-PTI table, while usermode table is obtained from kernel table by leaving userspace mappings intact, but only leaving the following parts of the kernel mapped:
kernel text (but not modules text) PCPU GDT/IDT/user LDT/task structures IST stacks for NMI and doublefault handlers.
Kernel switches to user page table before returning to usermode, and restores full kernel page table on the entry. Initial kernel-mode stack for PTI trampoline is allocated in PCPU, it is only 16 qwords. Kernel entry trampoline switches page tables. then the hardware trap frame is copied to the normal kstack, and execution continues.
IST stacks are kept mapped and no trampoline is needed for NMI/doublefault, but of course page table switch is performed.
On return to usermode, the trampoline is used again, iret frame is copied to the trampoline stack, page tables are switched and iretq is executed. The case of iretq faulting due to the invalid usermode context is tricky, since the frame for fault is appended to the trampoline frame. Besides copying the fault frame and original (corrupted) frame to kstack, the fault frame must be patched to make it look as if the fault occured on the kstack, see the comment in doret_iret detection code in trap().
Currently kernel pages which are mapped during trampoline operation are identical for all pmaps. They are registered using pmap_pti_add_kva(). Besides initial registrations done during boot, LDT and non-common TSS segments are registered if user requested their use. In principle, they can be installed into kernel page table per pmap with some work. Similarly, PCPU can be hidden from userspace mapping using trampoline PCPU page, but again I do not see much benefits besides complexity.
PDPE pages for the kernel half of the user page tables are pre-allocated during boot because we need to know pml4 entries which are copied to the top-level paging structure page, in advance on a new pmap creation. I enforce this to avoid iterating over the all existing pmaps if a new PDPE page is needed for PTI kernel mappings. The iteration is a known problematic operation on i386.
The need to flush hidden kernel translations on the switch to user mode make global tables (PG_G) meaningless and even harming, so PG_G use is disabled for PTI case. Our existing use of PCID is incompatible with PTI and is automatically disabled if PTI is enabled. PCID can be forced on only for developer's benefit.
MCE is known to be broken, it requires IST stack to operate completely correctly even for non-PTI case, and absolutely needs dedicated IST stack because MCE delivery while trampoline did not switched from PTI stack is fatal. The fix is pending.
Reviewed by: markj (partially) Tested by: pho (previous version) Discussed with: jeff, jhb Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
show more ...
|
#
937d37fc |
| 19-Nov-2017 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Merge ^/head r325842 through r325998.
|
#
df57947f |
| 18-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
spdx: initial adoption of licensing ID tags.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensou
spdx: initial adoption of licensing ID tags.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point.
Initially, only tag files that use BSD 4-Clause "Original" license.
RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133
show more ...
|
Revision tags: release/10.4.0, release/11.1.0 |
|
#
4198293b |
| 17-Jun-2017 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r319801 through r320041.
|
#
2d88da2f |
| 12-Jun-2017 |
Konstantin Belousov <kib@FreeBSD.org> |
Move struct syscall_args syscall arguments parameters container into struct thread.
For all architectures, the syscall trap handlers have to allocate the structure on the stack. The structure takes
Move struct syscall_args syscall arguments parameters container into struct thread.
For all architectures, the syscall trap handlers have to allocate the structure on the stack. The structure takes 88 bytes on 64bit arches which is not negligible. Also, it cannot be easily found by other code, which e.g. caused duplication of some members of the structure to struct thread already. The change removes td_dbg_sc_code and td_dbg_sc_nargs which were directly copied from syscall_args.
The structure is put into the copied on fork part of the struct thread to make the syscall arguments information correct in the child after fork.
This move will also allow several more uses shortly.
Reviewed by: jhb (previous version) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks X-Differential revision: https://reviews.freebsd.org/D11080
show more ...
|
Revision tags: release/11.0.1, release/11.0.0, release/10.3.0, release/10.2.0 |
|
#
98e0ffae |
| 27-May-2015 |
Simon J. Gerraty <sjg@FreeBSD.org> |
Merge sync of head
|
#
d899be7d |
| 19-Jan-2015 |
Glen Barber <gjb@FreeBSD.org> |
Reintegrate head: r274132-r277384
Sponsored by: The FreeBSD Foundation
|