HardenedBSD/sys/kern
Mark Johnston 8381e9f49e ithread: Improve synchronization in ithread_destroy()
Previously, to destroy an ithread we would set IT_DEAD in its flags, and
then wake it up if it wasn't already running.  After doing this,
intr_event_destroy() would free the intr_event structure.  However, it
did not wait for the ithread to exit, so it was possible for the ithread
to access the intr_event after it was freed.

This use-after-free happens readily when running the pf tests in
parallel, since they frequently create and destroy VNET jails, and pf
registers several VNET-local swi handlers.

Fix the race by modifying ithread_destroy() to wait until the ithread
has signaled that it is about to exit by setting ie->ie_thread = NULL.
Existing callers of intr_event_destroy() are allowed to sleep.

Reported by:	KASAN
Reviewed by:	kib, jhb
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D45492
2024-07-30 14:37:32 +00:00
..
bus_if.m
clock_if.m
cpufreq_if.m
device_if.m
firmw.S
genassym.sh
genoffset.c
genoffset.sh
imgact_aout.c
imgact_binmisc.c
imgact_elf32.c
imgact_elf64.c
imgact_elf.c
imgact_shell.c
init_main.c
init_sysent.c
kern_acct.c
kern_alq.c
kern_boottrace.c
kern_clock.c
kern_clocksource.c
kern_condvar.c sleepqueue: Remove kernel stack swapping support, part 10 2024-07-29 01:43:59 +00:00
kern_conf.c
kern_cons.c
kern_context.c
kern_cpu.c
kern_cpuset.c
kern_ctf.c
kern_descrip.c
kern_devctl.c
kern_dtrace.c
kern_dump.c
kern_environment.c
kern_et.c
kern_event.c
kern_exec.c
kern_exit.c
kern_fail.c
kern_ffclock.c
kern_fork.c
kern_hhook.c
kern_idle.c
kern_intr.c ithread: Improve synchronization in ithread_destroy() 2024-07-30 14:37:32 +00:00
kern_jail.c
kern_kcov.c
kern_khelp.c
kern_kthread.c
kern_ktr.c
kern_ktrace.c
kern_linker.c
kern_lock.c sleepqueue: Remove kernel stack swapping support, part 10 2024-07-29 01:43:59 +00:00
kern_lockf.c
kern_lockstat.c
kern_loginclass.c
kern_malloc.c
kern_mbuf.c
kern_membarrier.c
kern_mib.c
kern_module.c
kern_mtxpool.c
kern_mutex.c
kern_ntptime.c
kern_osd.c
kern_physio.c proc: Remove kernel stack swapping support, part 7 2024-07-29 01:43:49 +00:00
kern_pmc.c
kern_poll.c
kern_priv.c
kern_proc.c proc: Remove kernel stack swapping support, part 6 2024-07-29 01:43:18 +00:00
kern_procctl.c proc: Remove kernel stack swapping support, part 7 2024-07-29 01:43:49 +00:00
kern_prot.c
kern_racct.c proc: Remove kernel stack swapping support, part 6 2024-07-29 01:43:18 +00:00
kern_rangelock.c
kern_rctl.c
kern_resource.c
kern_rmlock.c
kern_rwlock.c
kern_sdt.c
kern_sema.c
kern_sendfile.c
kern_sharedpage.c
kern_shutdown.c
kern_sig.c proc: Remove kernel stack swapping support, part 9 2024-07-29 01:43:59 +00:00
kern_switch.c
kern_sx.c sleepqueue: Remove kernel stack swapping support, part 10 2024-07-29 01:43:59 +00:00
kern_synch.c sleepqueue: Remove kernel stack swapping support, part 10 2024-07-29 01:43:59 +00:00
kern_syscalls.c
kern_sysctl.c
kern_tc.c
kern_thr.c
kern_thread.c proc: Remove kernel stack swapping support, part 9 2024-07-29 01:43:59 +00:00
kern_time.c
kern_timeout.c
kern_tslog.c
kern_ubsan.c
kern_umtx.c
kern_uuid.c
kern_vnodedumper.c
kern_xxx.c
ksched.c
link_elf_obj.c
link_elf.c
linker_if.m
Make.tags.inc
Makefile
md4c.c
md5c.c
msi_if.m
p1003_1b.c
pic_if.m
posix4_mib.c
sched_4bsd.c thread: Remove kernel stack swapping support, part 4 2024-07-29 01:40:22 +00:00
sched_ule.c thread: Remove kernel stack swapping support, part 4 2024-07-29 01:40:22 +00:00
serdev_if.m
stack_protector.c
subr_acl_nfs4.c
subr_acl_posix1e.c
subr_asan.c
subr_atomic64.c
subr_autoconf.c
subr_blist.c
subr_boot.c
subr_bufring.c
subr_bus_dma.c
subr_bus.c
subr_busdma_bounce.c
subr_busdma_bufalloc.c
subr_capability.c
subr_clock.c
subr_clockcalib.c
subr_compressor.c
subr_counter.c
subr_coverage.c
subr_csan.c
subr_devmap.c
subr_devstat.c
subr_disk.c
subr_dummy_vdso_tc.c
subr_early.c
subr_epoch.c
subr_eventhandler.c
subr_fattime.c
subr_filter.c
subr_firmware.c proc: Remove kernel stack swapping support, part 7 2024-07-29 01:43:49 +00:00
subr_gtaskqueue.c
subr_hash.c
subr_hints.c
subr_intr.c
subr_kdb.c
subr_kobj.c
subr_lock.c
subr_log.c
subr_mchain.c
subr_memdesc.c
subr_module.c
subr_msan.c
subr_msgbuf.c
subr_param.c
subr_pcpu.c
subr_pctrie.c
subr_physmem.c
subr_pidctrl.c
subr_power.c
subr_prf.c
subr_prng.c
subr_prof.c
subr_rangeset.c
subr_rman.c
subr_rtc.c
subr_sbuf.c
subr_scanf.c
subr_sfbuf.c
subr_sglist.c
subr_sleepqueue.c sleepqueue: Remove kernel stack swapping support, part 10 2024-07-29 01:43:59 +00:00
subr_smp.c
subr_smr.c
subr_stack.c
subr_stats.c
subr_syscall.c
subr_taskqueue.c
subr_terminal.c
subr_trap.c
subr_turnstile.c
subr_uio.c
subr_unit.c
subr_vmem.c
subr_witness.c
sys_capability.c
sys_eventfd.c
sys_generic.c
sys_getrandom.c
sys_pipe.c
sys_procdesc.c
sys_process.c proc: Remove kernel stack swapping support, part 6 2024-07-29 01:43:18 +00:00
sys_socket.c
sys_timerfd.c
syscalls.c
syscalls.conf
syscalls.master
sysctl_security_jail_children.sh
systrace_args.c
sysv_ipc.c
sysv_msg.c
sysv_sem.c
sysv_shm.c
tty_compat.c
tty_info.c thread: Remove kernel stack swapping support, part 4 2024-07-29 01:40:22 +00:00
tty_inq.c
tty_outq.c
tty_pts.c
tty_tty.c
tty_ttydisc.c
tty.c
uipc_accf.c
uipc_debug.c
uipc_domain.c
uipc_ktls.c
uipc_mbuf2.c
uipc_mbuf.c
uipc_mbufhash.c
uipc_mqueue.c
uipc_sem.c
uipc_shm.c
uipc_sockbuf.c
uipc_socket.c
uipc_syscalls.c
uipc_usrreq.c
vfs_acl.c
vfs_aio.c
vfs_bio.c
vfs_cache.c
vfs_cluster.c
vfs_default.c
vfs_export.c
vfs_extattr.c
vfs_hash.c
vfs_init.c
vfs_lookup.c
vfs_mount.c
vfs_mountroot.c
vfs_subr.c
vfs_syscalls.c
vfs_vnops.c
vnode_if.src