opnsense-src/sys/kern
David Chisnall cf98bc28d3 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 3a522ba1bc 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
2021-07-16 18:06:44 +01:00
..
bus_if.m newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf 2021-06-22 20:52:06 -06:00
capabilities.conf Add aio_writev and aio_readv 2021-01-02 19:57:58 -07:00
clock_if.m
cpufreq_if.m
device_if.m
firmw.S Use a template assembly file for firmware object files. 2020-12-17 20:31:17 +00:00
genassym.sh
genoffset.c Merge td_epochnest with td_no_sleeping. 2019-10-29 17:28:25 +00:00
genoffset.sh
imgact_aout.c Do not call FreeBSD-ABI specific code for all ABIs 2021-07-07 14:12:07 +03:00
imgact_binmisc.c imgact_binmisc: limit the extent of match on incoming entries 2020-11-08 04:24:29 +00:00
imgact_elf.c Eliminate p_elf_machine from struct proc. 2021-06-29 20:18:29 +03:00
imgact_elf32.c
imgact_elf64.c
imgact_shell.c
init_main.c Stop arming kqueue timers on knote owner suspend or terminate 2021-04-09 23:43:51 +03:00
init_sysent.c regen syscall files after d51198d63b63 2021-05-13 14:09:58 -04:00
kern_acct.c accounting: explicitly mark the exiting thread as doing accounting 2021-05-22 15:16:08 +03:00
kern_alq.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_clock.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_clocksource.c
kern_condvar.c Use sleepq_signal(SLEEPQ_DROP) in cv_signal(). 2021-07-09 20:57:58 -04:00
kern_conf.c Fix handling of D_GIANTOK 2021-06-07 16:45:50 -04:00
kern_cons.c Remove sysctl_kern_consmute() 2020-10-05 15:54:19 +00:00
kern_context.c
kern_cpu.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_cpuset.c domainset: Define additional global policies 2021-04-14 13:03:33 -04:00
kern_ctf.c vfs: drop the mostly unused flags argument from VOP_UNLOCK 2020-01-03 22:29:58 +00:00
kern_descrip.c fd: use PROC_WAIT_UNLOCKED when clearing p_fd/p_pd 2021-05-29 22:04:09 +00:00
kern_dtrace.c dtrace: stop using eventhandlers for the part compiled into the kernel 2020-11-23 18:27:21 +00:00
kern_dump.c Always use 64-bit physical addresses for dump_avail[] in minidumps 2020-12-03 17:12:31 +00:00
kern_environment.c Move kernel env global variables, etc to sys/kenv.h 2020-10-07 06:16:37 +00:00
kern_et.c Remove NO_EVENTTIMERS support 2020-11-19 02:50:48 +00:00
kern_event.c kqueue: replace kq_ncallouts loop with atomic_fetchadd 2021-06-02 15:14:58 +00:00
kern_exec.c Do not call FreeBSD-ABI specific code for all ABIs 2021-07-07 14:12:07 +03:00
kern_exit.c Do not call FreeBSD-ABI specific code for all ABIs 2021-07-07 14:12:07 +03:00
kern_fail.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_ffclock.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
kern_fork.c procctl(2): add PROC_NO_NEW_PRIVS_CTL, PROC_NO_NEW_PRIVS_STATUS 2021-07-01 09:42:07 +01:00
kern_hhook.c Remove duplicated empty lines from kern/*.c 2020-01-30 20:05:05 +00:00
kern_idle.c
kern_intr.c Use the word "LinuxKPI" instead of "Linux compatibility", to not confuse with 2021-03-10 12:35:16 +01:00
kern_jail.c kern: ether_gen_addr: randomize on default hostuuid, too 2021-06-01 22:59:21 -05:00
kern_kcov.c Generalize bus_space(9) and atomic(9) sanitizer interceptors 2021-03-22 22:21:53 -04:00
kern_khelp.c
kern_kthread.c Set TDP_KTHREAD before calling cpu_fork() and cpu_copy_thread(). 2021-03-12 09:48:20 -08:00
kern_ktr.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_ktrace.c ktrace: Fix an inverted comparison added in commit f3851b235 2021-06-01 09:15:35 -04:00
kern_linker.c kern linker: do not allow more than one kldload and kldunload syscalls simultaneously 2021-05-31 18:09:22 +03:00
kern_lock.c lockprof: pass lock type as an argument instead of reading the spin flag 2021-05-23 17:55:27 +00:00
kern_lockf.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_lockstat.c Add lockmgr(9) probes to the lockstat DTrace provider. 2019-08-21 23:43:58 +00:00
kern_loginclass.c Drop "All rights reserved" from all my stuff. This includes 2020-10-28 13:46:11 +00:00
kern_malloc.c malloc: Pass the allocation size to malloc_large() by value 2021-07-13 17:47:02 -04:00
kern_mbuf.c mbuf: replace all direct uma_zfree(zone_mbuf) calls with m_free_raw 2021-07-07 11:05:46 +00:00
kern_mib.c jail: Consistently handle the pr_allow bitmask 2020-12-26 20:25:02 -08:00
kern_module.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_mtxpool.c Remove duplicated empty lines from kern/*.c 2020-01-30 20:05:05 +00:00
kern_mutex.c lockprof: pass lock type as an argument instead of reading the spin flag 2021-05-23 17:55:27 +00:00
kern_ntptime.c Add kern_ntp_adjtime(9). 2020-12-04 18:56:44 +00:00
kern_osd.c
kern_physio.c Minor style tidy: if( -> if ( 2021-04-18 11:19:15 -06:00
kern_pmc.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
kern_poll.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
kern_priv.c jail: Consistently handle the pr_allow bitmask 2020-12-26 20:25:02 -08:00
kern_proc.c ktrace: pack all ktrace parameters into allocated structure ktr_io_params 2021-05-22 15:16:08 +03:00
kern_procctl.c procctl(PROC_ASLR_STATUS): fix vmspace leak 2021-07-15 03:02:50 +03:00
kern_prot.c kern: fail getgroup and setgroup with negative int 2021-06-02 13:22:57 -06:00
kern_racct.c Use atomic loads/stores when updating td->td_state 2021-02-18 14:02:48 +00:00
kern_rangelock.c rangelock: add rangelock_cookie_assert 2019-09-15 02:59:53 +00:00
kern_rctl.c rctl(4): support throttling resource usage to 0 2021-01-11 15:36:57 -08:00
kern_resource.c vm_map_protect: allow to set prot and max_prot in one go. 2021-01-13 01:35:22 +02:00
kern_rmlock.c rmlock(9): add an RM_DUPOK flag 2021-04-12 11:42:21 -03:00
kern_rwlock.c lockprof: pass lock type as an argument instead of reading the spin flag 2021-05-23 17:55:27 +00:00
kern_sdt.c
kern_sema.c
kern_sendfile.c Fix handling of errors from pru_send(PRUS_NOTREADY) 2021-05-21 17:45:19 -04:00
kern_sharedpage.c random(4) FenestrasX: Push root seed version to arc4random(3) 2020-10-10 21:52:00 +00:00
kern_shutdown.c Add an option for entering KDB on recursive panics 2020-11-19 18:03:40 +00:00
kern_sig.c Add a knob to not drop signal with default ignored or ignored actions 2021-06-16 02:00:19 +03:00
kern_switch.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
kern_sx.c lockprof: pass lock type as an argument instead of reading the spin flag 2021-05-23 17:55:27 +00:00
kern_synch.c Allow sleepq_signal() to drop the lock. 2021-06-25 14:12:21 -04:00
kern_syscalls.c Move syscall_thread_{enter,exit}() into the slow path. This is only 2020-11-08 15:54:59 +00:00
kern_sysctl.c sysctl_handle_string: do not malloc when SYSCTL_IN cannot fault 2021-04-19 21:32:01 +03:00
kern_tc.c kern: clarify boot time 2021-05-05 12:32:13 -06:00
kern_thr.c Provide ABI modules hooks for process exec/exit and thread exit. 2020-11-23 17:29:25 +00:00
kern_thread.c Pass the syscall number to capsicum permission-denied signals 2021-07-16 18:06:44 +01:00
kern_time.c posix timers: Check for overflow when converting to ns 2021-05-13 08:34:03 -04:00
kern_timeout.c callout: Make cc_cpu local to kern_timeout.c 2021-07-15 22:41:10 -04:00
kern_tslog.c kern_tslog: Include tslog data from loader 2021-06-20 20:09:47 -07:00
kern_ubsan.c Remove duplicated empty lines from kern/*.c 2020-01-30 20:05:05 +00:00
kern_umtx.c umtx: convert umtxq_lock to a macro 2021-05-22 21:01:05 +00:00
kern_uuid.c validate_uuid: absorb the rest of parse_uuid with a flags arg 2020-04-15 18:39:12 +00:00
kern_xxx.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
ksched.c
link_elf.c vm_map_protect: allow to set prot and max_prot in one go. 2021-01-13 01:35:22 +02:00
link_elf_obj.c link_elf_obj: Add a case missing from 5e6989ba4f 2021-03-16 15:01:41 -04:00
linker_if.m
Make.tags.inc Remove a couple of harmless stray references to nandfs. 2019-06-25 16:39:25 +00:00
Makefile sys/kern sysent: re-add dependency on capabilities.conf 2020-02-12 19:06:34 +00:00
makesyscalls.sh makesyscalls.sh: improve the 'this is going away' message 2020-07-28 01:05:40 +00:00
md4c.c
md5c.c
msi_if.m o Add iommu de-initialization method for MSI interface. 2020-10-24 20:09:27 +00:00
p1003_1b.c
pic_if.m
posix4_mib.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
sched_4bsd.c lockprof: pass lock type as an argument instead of reading the spin flag 2021-05-23 17:55:27 +00:00
sched_ule.c Correcting comment about "sched_interact_score". 2021-06-02 21:50:57 -06:00
serdev_if.m
stack_protector.c Revert r346292 (permit_nonrandom_stackcookies) 2019-05-13 23:37:44 +00:00
subr_acl_nfs4.c Drop "All rights reserved" from all my stuff. This includes 2020-10-28 13:46:11 +00:00
subr_acl_posix1e.c vfs: remove the obsolete privused argument from vaccess 2020-08-05 09:27:03 +00:00
subr_asan.c KASAN: Implement __asan_unregister_globals() 2021-07-09 20:38:50 -04:00
subr_atomic64.c emulated atomic64: disable interrupts as the lock mechanism on !SMP 2020-01-03 18:29:20 +00:00
subr_autoconf.c config_intrhook: provide config_intrhook_drain 2021-03-11 09:45:10 -07:00
subr_blist.c blist: Correct the node count computed in blist_create() 2021-07-13 17:47:27 -04:00
subr_boot.c When parsing command line stuff, treat tabs and spaces the same. 2019-04-18 22:52:12 +00:00
subr_bufring.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_bus.c newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf 2021-06-22 20:52:06 -06:00
subr_bus_dma.c crypto: Add a new type of crypto buffer for a single mbuf. 2021-05-25 16:59:18 -07:00
subr_busdma_bufalloc.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_capability.c Remove unused SYSINIT macros for capability rights. 2020-03-26 15:02:37 +00:00
subr_clock.c Remove duplicated empty lines from kern/*.c 2020-01-30 20:05:05 +00:00
subr_compressor.c clamp kernel dump compression level when using gzip 2020-02-20 23:53:48 +00:00
subr_counter.c Rationalize per-cpu zones. 2020-11-05 15:08:56 +00:00
subr_coverage.c Generalize bus_space(9) and atomic(9) sanitizer interceptors 2021-03-22 22:21:53 -04:00
subr_csan.c Generalize sanitizer interceptors for memory and string routines 2021-03-24 19:46:22 -04:00
subr_devmap.c ddb: fix show devmap output on 32-bit arm 2021-02-18 11:53:14 -04:00
subr_devstat.c Speed up geom_stats_resync in the presence of many devices 2021-03-02 18:33:45 -07:00
subr_disk.c Enable bioq 'car limit' added at r335066 at 128 bios. 2020-10-26 04:04:06 +00:00
subr_dummy_vdso_tc.c
subr_early.c
subr_epoch.c The old thread priority must be stored as part of the EPOCH(9) tracker. 2021-05-23 10:53:25 +02:00
subr_eventhandler.c Include ktr.h in more compilation units 2019-05-21 20:38:48 +00:00
subr_fattime.c Remove duplicated empty lines from kern/*.c 2020-01-30 20:05:05 +00:00
subr_filter.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_firmware.c firmware(9): extend firmware_get() by a "no warn" flag. 2021-01-27 13:51:26 +00:00
subr_gtaskqueue.c Import kernel WireGuard support 2020-11-29 19:38:03 +00:00
subr_hash.c
subr_hints.c Move kernel env global variables, etc to sys/kenv.h 2020-10-07 06:16:37 +00:00
subr_intr.c intrng: remove now redundant shadow variable. 2021-07-08 08:46:41 +02:00
subr_kdb.c sysctl: improve debug.kdb.panic_str description 2021-01-09 11:10:42 -07:00
subr_kobj.c newbus: Optimize/Simplify kobj_class_compile_common a little 2021-04-21 15:37:24 -06:00
subr_lock.c lockprof: move panic check after inspecting the state 2021-05-23 17:55:27 +00:00
subr_log.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_mchain.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_module.c sysctl debug.dump_modinfo should recognize font module 2021-01-08 09:24:49 +02:00
subr_msgbuf.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_param.c Move mips and arm to 1000Hz by default. 2021-06-16 20:00:14 -06:00
subr_pcpu.c Add more per-cpu zones. 2020-11-09 00:34:23 +00:00
subr_pctrie.c Use SMR to provide safe unlocked lookup for pctries from SMR zones 2020-07-24 17:32:10 +00:00
subr_physmem.c Add support for hw.physmem tunable for ARM/ARM64/RISC-V platforms 2020-12-03 05:39:27 +00:00
subr_pidctrl.c
subr_power.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_prf.c kvprintf(9): add missing FALLTHROUGH 2021-01-22 00:18:40 +01:00
subr_prng.c Add prng(9) API 2020-08-13 20:48:14 +00:00
subr_prof.c x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
subr_rangeset.c Implement rangesets. 2019-02-20 09:38:19 +00:00
subr_rman.c rman: Remove an outdated comment that no longer applies 2021-07-05 16:15:03 +01:00
subr_rtc.c Address whitespace nits in subr_rtc.c 2020-09-28 17:19:57 +00:00
subr_sbuf.c sbuf_uionew(): sbuf_new() takes int as length 2021-04-14 10:23:20 +03:00
subr_scanf.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_sfbuf.c
subr_sglist.c sglist: Add sglist_append_single_mbuf(). 2021-05-25 16:59:18 -07:00
subr_sleepqueue.c Allow sleepq_signal() to drop the lock. 2021-06-25 14:12:21 -04:00
subr_smp.c quisce_cpus(): add special handling for PDROP 2021-05-31 18:09:22 +03:00
subr_smr.c Use COUNTER_U64_DEFINE_EARLY() in places where it simplifies things. 2020-03-06 19:10:00 +00:00
subr_stack.c kern.tty_info_kstacks: add a compact format 2020-07-06 16:33:28 +00:00
subr_stats.c stats(3): Improve t-digest merging of samples which result in mu adjustment underflow. 2021-04-02 13:17:53 +11:00
subr_syscall.c Pass the syscall number to capsicum permission-denied signals 2021-07-16 18:06:44 +01:00
subr_taskqueue.c Add flag to struct task to mark the task as requiring network epoch. 2020-02-11 18:48:07 +00:00
subr_terminal.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_trap.c tcp: HPTS performance enhancements 2021-07-07 07:22:35 -04:00
subr_turnstile.c Use atomic loads/stores when updating td->td_state 2021-02-18 14:02:48 +00:00
subr_uio.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_unit.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
subr_vmem.c vmem: Revert r364744 2020-12-01 16:06:31 +00:00
subr_witness.c Remove more remnants of sio(4) 2021-04-07 14:33:02 -04:00
sys_capability.c Enter a write sequence when updating rights. 2020-03-19 15:39:45 +00:00
sys_eventfd.c Fix copyright, remove "all rights reserved". 2021-06-08 08:18:00 +03:00
sys_generic.c Split kern_poll() on two counterparts. 2021-06-10 15:11:25 +03:00
sys_getrandom.c Fix a typo in r356667 comment 2020-01-12 23:52:16 +00:00
sys_pipe.c pipe: Avoid calling selrecord() on a closing pipe 2021-04-28 10:43:29 -04:00
sys_procdesc.c procdesc: convert the zone to a malloc type 2020-11-09 00:05:21 +00:00
sys_process.c sys_process.c: extract ptrace_unsuspend() 2021-05-25 18:22:27 +03:00
sys_socket.c Re-enable network ioctls in capability mode 2021-04-23 09:22:49 -04:00
syscalls.c Reserve gaps in syscall numbers for local use 2021-01-26 18:27:45 +00:00
syscalls.master kern: fail getgroup and setgroup with negative int 2021-06-02 13:22:57 -06:00
systrace_args.c regen after tweaks to getgroups and setgroups 2021-06-02 13:24:50 -06:00
sysv_ipc.c sysv: get rid of fork/exit hooks if the code is compiled in 2019-05-04 19:05:30 +00:00
sysv_msg.c jail: Change the locking around pr_ref and pr_uref 2021-02-21 10:55:44 -08:00
sysv_sem.c jail: Change the locking around pr_ref and pr_uref 2021-02-21 10:55:44 -08:00
sysv_shm.c jail: Change the locking around pr_ref and pr_uref 2021-02-21 10:55:44 -08:00
tty.c ttydev_write: prevent stops while terminal is busied 2021-05-18 20:52:03 +03:00
tty_compat.c
tty_info.c kern.tty_info_kstacks: set compact format as default 2020-07-06 16:34:15 +00:00
tty_inq.c
tty_outq.c Minor style cleanup 2021-04-18 11:14:17 -06:00
tty_pts.c tty_pts: don't rely on tty header pollution for sys/mutex.h 2019-11-29 03:56:01 +00:00
tty_tty.c Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
tty_ttydisc.c Implement FLUSHO 2020-08-27 05:11:15 +00:00
uipc_accf.c Consistently use the SOLISTENING() macro 2021-06-14 17:32:27 -04:00
uipc_debug.c
uipc_domain.c - Move global network epoch definition to epoch.h, as more different 2020-01-15 03:34:21 +00:00
uipc_ktls.c ktls: fix NOINET build 2021-07-07 10:40:02 -04:00
uipc_mbuf.c mbuf: add m_get_raw and m_gethdr_raw 2021-07-07 11:05:46 +00:00
uipc_mbuf2.c m_pulldown(): Change an if () panic() into a KASSERT(). 2019-11-06 22:40:19 +00:00
uipc_mbufhash.c Implement mbuf hashing routines for IP over infiniband, IPoIB. 2020-10-22 09:17:56 +00:00
uipc_mqueue.c jail: Change the locking around pr_ref and pr_uref 2021-02-21 10:55:44 -08:00
uipc_sem.c Convert remaining cap_rights_init users to cap_rights_init_one 2021-01-12 13:16:10 +00:00
uipc_shm.c Constify vm_pager-related virtual tables. 2021-05-07 17:08:03 +03:00
uipc_sockbuf.c Consistently use the SOCKBUF_MTX() and SOCK_MTX() macros 2021-06-14 17:32:32 -04:00
uipc_socket.c Consistently use the SOCKBUF_MTX() and SOCK_MTX() macros 2021-06-14 17:32:32 -04:00
uipc_syscalls.c Consistently use the SOLISTENING() macro 2021-06-14 17:32:27 -04:00
uipc_usrreq.c Consistently use the SOLISTENING() macro 2021-06-14 17:32:27 -04:00
vfs_acl.c vfs: fix trivial whitespace issues which don't interefere with blame 2020-07-10 09:01:36 +00:00
vfs_aio.c lio_listio: Don't post a completion notification if none was requested 2021-07-15 22:41:10 -04:00
vfs_bio.c amd64: Implement a KASAN shadow map 2021-04-13 17:42:20 -04:00
vfs_cache.c cache: add cache_enter_time_flags 2021-07-12 07:03:14 +02:00
vfs_cluster.c Minor style tidy: if( -> if ( 2021-04-18 11:19:15 -06:00
vfs_default.c VFS_QUOTACTL(9): allow implementation to indicate busy state changes 2021-05-30 14:53:47 -07:00
vfs_export.c kern: clean up empty lines in .c and .h files 2020-09-01 22:12:32 +00:00
vfs_extattr.c vfs_extattr: Allow extattr names up to the full max 2020-05-14 03:01:23 +00:00
vfs_hash.c vfs: avoid exposing partially constructed vnodes 2020-09-05 00:26:03 +00:00
vfs_init.c VFS_QUOTACTL(9): allow implementation to indicate busy state changes 2021-05-30 14:53:47 -07:00
vfs_lookup.c vfs: use the sentinel trick in locked lookup path parsing 2021-05-29 22:04:09 +00:00
vfs_mount.c Add a generic mechanism for preventing forced unmount 2021-06-05 18:20:36 -07:00
vfs_mountroot.c Minor style tidy: if( -> if ( 2021-04-18 11:19:15 -06:00
vfs_subr.c Add a generic mechanism for preventing forced unmount 2021-06-05 18:20:36 -07:00
vfs_syscalls.c namei: add NDPREINIT() macro 2021-06-23 23:46:15 +03:00
vfs_vnops.c vfs: fix MNT_SYNCHRONOUS check in vn_write 2021-06-02 13:42:02 +00:00
vnode_if.src Add VOP_VPUT_PAIR() with trivial default implementation. 2021-02-12 03:02:20 +02:00