opnsense-src/sys/vm
Mark Johnston 800da341bc thread: Simplify sanitizer integration with thread creation
fork() may allocate a new thread in one of two ways: from UMA, or cached
in a freed proc that was just allocated from UMA.  In either case, KASAN
and KMSAN need to initialize some state; in particular they need to
initialize the shadow mapping of the new thread's stack.

This is done differently between KASAN and KMSAN, which is confusing.
This patch improves things a bit:
- Add a new thread_recycle() function, which moves all kernel stack
  handling out of kern_fork.c, since it doesn't really belong there.
- Then, thread_alloc_stack() has only one local caller, so just inline
  it.
- Avoid redundant shadow stack initialization: thread_alloc()
  initializes the KMSAN shadow stack (via kmsan_thread_alloc()) even
  through vm_thread_new() already did that.
- Add kasan_thread_alloc(), for consistency with kmsan_thread_alloc().

No functional change intended.

Reviewed by:	khng
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44891
2024-04-22 11:46:59 -04:00
..
_vm_phys.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
_vm_radix.h radix_trie: have vm_radix use pctrie code 2023-09-12 02:42:38 -05:00
device_pager.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
memguard.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
memguard.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
phys_pager.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
pmap.h pmap: Convert boolean_t to bool. 2024-01-31 14:48:26 -08:00
redzone.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
redzone.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sg_pager.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
swap_pager.c swap_pager: Unbusy readahead pages after an I/O error 2024-04-08 09:02:48 -04:00
swap_pager.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
uma.h uma: Permit specifying max of cache line and some custom alignment 2023-11-02 09:30:03 -04:00
uma_align_mask.h uma: Make the cache alignment mask unsigned 2023-11-02 09:30:03 -04:00
uma_core.c uma: Improve memory modified after free panic messages 2023-11-09 19:46:26 -05:00
uma_dbg.c Fix build on powerpc after previous commit. 2023-11-09 21:21:47 -05:00
uma_dbg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
uma_int.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
vm.h vm: add macro to mark arguments used when NUMA is defined 2024-04-09 10:23:47 -04:00
vm_domainset.c Avoid waiting on physical allocations that can't possibly be satisfied 2023-12-23 23:01:40 -06:00
vm_domainset.h Avoid waiting on physical allocations that can't possibly be satisfied 2023-12-23 23:01:40 -06:00
vm_dumpset.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
vm_extern.h vm: improve kstack_object pindex calculation to avoid pindex holes 2024-04-10 17:37:20 +02:00
vm_fault.c sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
vm_glue.c thread: Simplify sanitizer integration with thread creation 2024-04-22 11:46:59 -04:00
vm_init.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
vm_kern.c Avoid waiting on physical allocations that can't possibly be satisfied 2023-12-23 23:01:40 -06:00
vm_kern.h vm: improve kstack_object pindex calculation to avoid pindex holes 2024-04-10 17:37:20 +02:00
vm_map.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
vm_map.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
vm_meter.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
vm_mmap.c Remove never implemented sbrk and sstk syscalls 2023-12-04 20:36:08 +00:00
vm_object.c sysctl vm.objects/vm.swap_objects: do not fill vnode info if jailed 2024-01-16 22:15:39 +02:00
vm_object.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
vm_page.c vm_page_reclaim_contig(): update comment to chase recent changes 2024-01-02 15:39:36 -06:00
vm_page.h vm: add macro to mark arguments used when NUMA is defined 2024-04-09 10:23:47 -04:00
vm_pageout.c sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
vm_pageout.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
vm_pagequeue.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
vm_pager.c sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
vm_pager.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
vm_param.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
vm_phys.c vm: add macro to mark arguments used when NUMA is defined 2024-04-09 10:23:47 -04:00
vm_phys.h vm: add macro to mark arguments used when NUMA is defined 2024-04-09 10:23:47 -04:00
vm_radix.c vm_radix: add a missing paren 2023-09-12 04:19:51 -05:00
vm_radix.h radix_trie: have vm_radix use pctrie code 2023-09-12 02:42:38 -05:00
vm_reserv.c vm_reserv_reclaim_contig: Return NULL not false 2024-04-10 08:50:16 -04:00
vm_reserv.h vm_reserv: Add vm_reserv_is_populated 2024-04-07 12:28:52 -05:00
vm_swapout.c vm: improve kstack_object pindex calculation to avoid pindex holes 2024-04-10 17:37:20 +02:00
vm_swapout_dummy.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
vm_unix.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
vnode_pager.c Add vnode_pager_clean_{a,}sync(9) 2024-01-11 18:44:53 +02:00
vnode_pager.h Add vnode_pager_clean_{a,}sync(9) 2024-01-11 18:44:53 +02:00