| #
59ddbef2
|
| 04-Sep-2025 |
Andrew Turner <andrew@FreeBSD.org> |
arm64: Add padding to struct mdproc
To allow for possible future use add reserved fields to struct mdproc.
Sponsored by: Arm Ltd
|
| #
4c6c27d3
|
| 08-Aug-2025 |
Andrew Turner <andrew@FreeBSD.org> |
arm64: Support TBI in userspace
To allow for Hardware-assisted AddressSanitizer (HWASAN) and future work to enable MTE we need to enable TBI in userspace. As address space that previously would have
arm64: Support TBI in userspace
To allow for Hardware-assisted AddressSanitizer (HWASAN) and future work to enable MTE we need to enable TBI in userspace. As address space that previously would have faulted will now not it could be considered an ABI change so only enable for processes with a late enough revision.
Relnotes: yes Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D51637
show more ...
|
| #
d7f930b8
|
| 24-Oct-2024 |
Andrew Turner <andrew@FreeBSD.org> |
arm64: Implement efi_rt_arch_call
This is a function that calls into the EFI Runtime Services, but can handle a fault. To support this add a handler in assembly that can restore the kernel state on
arm64: Implement efi_rt_arch_call
This is a function that calls into the EFI Runtime Services, but can handle a fault. To support this add a handler in assembly that can restore the kernel state on an exception and return a failure to the caller.
Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46817
show more ...
|
| #
29363fb4
|
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl s
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
| #
2ff63af9
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
|
| #
d5d97bed
|
| 25-Jul-2023 |
Mike Karels <karels@FreeBSD.org> |
arm64 lib32: prepare arm64 headers to redirect to arm
In order to compile lib32 libraries and other 32-bit code on arm64, <machine/foo.h> needs to be redirected to an arm header rather than arm64 wh
arm64 lib32: prepare arm64 headers to redirect to arm
In order to compile lib32 libraries and other 32-bit code on arm64, <machine/foo.h> needs to be redirected to an arm header rather than arm64 when building with -m32. Ifdef the arm64 headers that are installed in /usr/include/machine and used by user-level software (including references from /usr/include/*.h) so that if __arm__ is defined when including the arm64 version, <arm/foo.h> is included rather than using the rest of the file's contents. Some arm headers had no arm64 equivalent; headers were added just to do the redirection. These files use #error if __arm__ is not defined to guard against confusion. Also add an include/arm Makefile, and modify Makefiles as needed to install everything, including the arm files in /usr/include/arm. fenv.h comes from lib/msun/arm/fenv.h.
The new arm64 headers are: acle-compat.h cpuinfo.h sysreg.h
Reviewed by: jrtc27, imp Differential Revision: https://reviews.freebsd.org/D40944
show more ...
|
| #
6a9c2e63
|
| 24-Apr-2023 |
Andrew Turner <andrew@FreeBSD.org> |
Add padding for future use on arm64
Allow new features to be supported without changing the size of existing structures.
Reviewed by: kib Sponsored by: Arm Ltd Differential Revision: https://review
Add padding for future use on arm64
Allow new features to be supported without changing the size of existing structures.
Reviewed by: kib Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D39777
show more ...
|
| #
2555f175
|
| 31-Jan-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
Move kstack_contains() and GET_STACK_USAGE() to MD machine/stack.h
Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D38320
|
| #
85b7c566
|
| 08-Jul-2021 |
Andrew Turner <andrew@FreeBSD.org> |
Add arm64 pointer authentication support
Pointer authentication allows userspace to add instructions to insert a Pointer Authentication Code (PAC) into a register based on an address and modifier an
Add arm64 pointer authentication support
Pointer authentication allows userspace to add instructions to insert a Pointer Authentication Code (PAC) into a register based on an address and modifier and check if the PAC is correct. If the check fails it will either return an invalid address or fault to the kernel.
As many of these instructions are a NOP when disabled and in earlier revisions of the architecture this can be used, for example, to sign the return address before pushing it to the stack making Return-oriented programming (ROP) attack more difficult on hardware that supports them.
The kernel manages five 128 bit signing keys: 2 instruction keys, 2 data keys, and a generic key. The instructions then use one of these when signing the registers. Instructions that use the first four store the PAC in the register being signed, however the instructions that use the generic key store the PAC in a separate register.
Currently all userspace threads share all the keys within a process with a new set of userspace keys being generated when executing a new process. This means a forked child will share its keys with its parent until it calls an appropriate exec system call.
In the kernel we allow the use of one of the instruction keys, the ia key. This will be used to sign return addresses in function calls. Unlike userspace each kernel thread has its own randomly generated.
Thread0 has a static key as does the early code on secondary CPUs. This should be safe as there is minimal user interaction with these threads, however we could generate random keys when the Armv8.5 Random number generation instructions are present.
Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31261
show more ...
|
| #
54756652
|
| 08-Dec-2021 |
Brooks Davis <brooks@FreeBSD.org> |
Make struct syscall_args machine independent
After a round of cleanups in late 2020, all definitions are functionally identical.
This removes a rotted __aligned(8) on arm. It was added in b7112ead3
Make struct syscall_args machine independent
After a round of cleanups in late 2020, all definitions are functionally identical.
This removes a rotted __aligned(8) on arm. It was added in b7112ead32bc50ef9744099bdbb1cfbd6e906b2a and was intended to align the args member so that 64-bit types (off_t, etc) could be safely read on armeb compiled with clang. With the removal of armev, this is no longer needed (armv7 requires that 32-bit aligned reads of 64-bit values be supported and we enable such support on armv6). As further evidence this is unnecessary, cleanups to struct syscall_args have resulted in args being 32-bit aligned on 32-bit systems. The sole effect is to bloat the struct by 4 bytes.
Reviewed by: kib, jhb, imp Differential Revision: https://reviews.freebsd.org/D33308
show more ...
|
| #
b02908b0
|
| 30-Nov-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
arm64, powerpc: fix calculation of 'used' in GET_STACK_USAGE
We do not consider the space reserved for the pcb to be part of the total kstack size, so it should not be included in the calculation of
arm64, powerpc: fix calculation of 'used' in GET_STACK_USAGE
We do not consider the space reserved for the pcb to be part of the total kstack size, so it should not be included in the calculation of the used stack size.
MFC after: 1 week Sponsored by: The FreeBSD Foundation
show more ...
|
| #
ae92ace0
|
| 22-Nov-2021 |
Andrew Turner <andrew@FreeBSD.org> |
Per-thread stack canary on arm64
With the update to llvm 13 we are able to tell the compiler it can find the SSP canary relative to the register that holds the userspace stack pointer. As this is un
Per-thread stack canary on arm64
With the update to llvm 13 we are able to tell the compiler it can find the SSP canary relative to the register that holds the userspace stack pointer. As this is unused in most of the kernel it can be used here to point to a per-thread SSP canary.
As the kernel could be built with an old toolchain, e.g. when upgrading from 13, add a warning that the options was enabled but the compiler doesn't support it to both the build and kernel boot.
Discussed with: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33079
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 ...
|
| #
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
|
| #
50e3ab6b
|
| 03-Nov-2019 |
Alan Cox <alc@FreeBSD.org> |
Utilize ASIDs to reduce both the direct and indirect costs of context switching. The indirect costs being unnecessary TLB misses that are incurred when ASIDs are not used. In fact, currently, when
Utilize ASIDs to reduce both the direct and indirect costs of context switching. The indirect costs being unnecessary TLB misses that are incurred when ASIDs are not used. In fact, currently, when we perform a context switch on one processor, we issue a broadcast TLB invalidation that flushes the TLB contents on every processor.
Mark all user-space ("ttbr0") page table entries with the non-global flag so that they are cached in the TLB under their ASID.
Correct an error in pmap_pinit0(). The pointer to the root of the page table was being initialized to the root of the kernel-space page table rather than a user-space page table. However, the root of the page table that was being cached in process 0's md_l0addr field correctly pointed to a user-space page table. As long as ASIDs weren't being used, this was harmless, except that it led to some unnecessary page table switches in pmap_switch(). Specifically, other kernel processes besides process 0 would have their md_l0addr field set to the root of the kernel-space page table, and so pmap_switch() would actually change page tables when switching between process 0 and other kernel processes.
Implement a workaround for Cavium erratum 27456 affecting ThunderX machines. (I would like to thank andrew@ for providing the code to detect the affected machines.)
Address integer overflow in the definition of TCR_ASID_16.
Setup TCR according to the PARange and ASIDBits fields from ID_AA64MMFR0_EL1. Previously, TCR_ASID_16 was unconditionally set.
Modify build_l1_block_pagetable so that lower attributes, such as ATTR_nG, can be specified as a parameter.
Eliminate some unused code.
Earlier versions were tested to varying degrees by: andrew, emaste, markj
MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D21922
show more ...
|
| #
59ddbef2
|
| 04-Sep-2025 |
Andrew Turner <andrew@FreeBSD.org> |
arm64: Add padding to struct mdproc
To allow for possible future use add reserved fields to struct mdproc.
Sponsored by: Arm Ltd
|
| #
4c6c27d3
|
| 08-Aug-2025 |
Andrew Turner <andrew@FreeBSD.org> |
arm64: Support TBI in userspace
To allow for Hardware-assisted AddressSanitizer (HWASAN) and future work to enable MTE we need to enable TBI in userspace. As address space that previously would have
arm64: Support TBI in userspace
To allow for Hardware-assisted AddressSanitizer (HWASAN) and future work to enable MTE we need to enable TBI in userspace. As address space that previously would have faulted will now not it could be considered an ABI change so only enable for processes with a late enough revision.
Relnotes: yes Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D51637
show more ...
|
| #
d7f930b8
|
| 24-Oct-2024 |
Andrew Turner <andrew@FreeBSD.org> |
arm64: Implement efi_rt_arch_call
This is a function that calls into the EFI Runtime Services, but can handle a fault. To support this add a handler in assembly that can restore the kernel state on
arm64: Implement efi_rt_arch_call
This is a function that calls into the EFI Runtime Services, but can handle a fault. To support this add a handler in assembly that can restore the kernel state on an exception and return a failure to the caller.
Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46817
show more ...
|
| #
29363fb4
|
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl s
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
| #
2ff63af9
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
|
| #
d5d97bed
|
| 25-Jul-2023 |
Mike Karels <karels@FreeBSD.org> |
arm64 lib32: prepare arm64 headers to redirect to arm
In order to compile lib32 libraries and other 32-bit code on arm64, <machine/foo.h> needs to be redirected to an arm header rather than arm64 wh
arm64 lib32: prepare arm64 headers to redirect to arm
In order to compile lib32 libraries and other 32-bit code on arm64, <machine/foo.h> needs to be redirected to an arm header rather than arm64 when building with -m32. Ifdef the arm64 headers that are installed in /usr/include/machine and used by user-level software (including references from /usr/include/*.h) so that if __arm__ is defined when including the arm64 version, <arm/foo.h> is included rather than using the rest of the file's contents. Some arm headers had no arm64 equivalent; headers were added just to do the redirection. These files use #error if __arm__ is not defined to guard against confusion. Also add an include/arm Makefile, and modify Makefiles as needed to install everything, including the arm files in /usr/include/arm. fenv.h comes from lib/msun/arm/fenv.h.
The new arm64 headers are: acle-compat.h cpuinfo.h sysreg.h
Reviewed by: jrtc27, imp Differential Revision: https://reviews.freebsd.org/D40944
show more ...
|
| #
6a9c2e63
|
| 24-Apr-2023 |
Andrew Turner <andrew@FreeBSD.org> |
Add padding for future use on arm64
Allow new features to be supported without changing the size of existing structures.
Reviewed by: kib Sponsored by: Arm Ltd Differential Revision: https://review
Add padding for future use on arm64
Allow new features to be supported without changing the size of existing structures.
Reviewed by: kib Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D39777
show more ...
|
| #
2555f175
|
| 31-Jan-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
Move kstack_contains() and GET_STACK_USAGE() to MD machine/stack.h
Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D38320
|