NetBSD/sys/kern
elad b60c6b99ca Introduce a new flag we mark as TRUE when we load listeners, and change
the logic in kauth_authorize_action() to use it.

When we try to authorize a request and the flag is FALSE, it means a
kernel was compiled with no listeners (or we're in very early boot stages),
and we always allow the request because it's likely to be coming from the
kernel itself or from loading an LKM with the security model (later on).

Assert that if the "listeners have been loaded" flag is FALSE, there are
really no listeners for the scope we're authorizing on.

When the flag is TRUE (ie., listeners have been loaded) but they were
later removed, creating a scope with no listeners, the request will be
denied further down.

This allows us to have the security model compiled outside the NetBSD
kernel and later loaded as an LKM, without fearing an attack will just
remove listeners we loaded earlier to create a "fail open" situation.

Input from yamt@, thorpej@, gdt@, dan@.
Okay yamt@, thorpej@.
2006-09-15 14:28:04 +00:00
..
Make.tags.inc Skip computing tags on IP Filter while its compatibility #defines 2006-09-01 04:55:12 +00:00
Makefile merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
bufq_disksort.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
bufq_fcfs.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
bufq_priocscan.c use consistent order of function specifiers and type specifiers. 2006-05-22 12:42:01 +00:00
bufq_readprio.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
cnmagic.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
core_elf32.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
core_elf64.c
core_netbsd.c Sprinkle static. 2005-12-08 03:05:40 +00:00
exec_aout.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
exec_conf.c Make this compile under "no options COREDUMP". 2006-08-30 14:41:06 +00:00
exec_ecoff.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
exec_elf32.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
exec_elf64.c
exec_macho.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
exec_script.c at the request of elad, as veriexec.h has returned, revert the changes 2006-07-26 09:33:57 +00:00
exec_subr.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
genlintstub.awk Rewrite to support LINTSTUB in multiline comments. 2006-01-22 05:11:11 +00:00
init_main.c First take at security model abstraction. 2006-09-08 20:58:56 +00:00
init_sysctl.c Don't use KAUTH_RESULT_* where it's not applicable. 2006-09-13 10:07:42 +00:00
init_sysent.c Regen. (add __weak_alias(sys_ptrace, sys_nosys) when PTRACE is off) 2006-09-01 21:04:45 +00:00
kern_acct.c First take at security model abstraction. 2006-09-08 20:58:56 +00:00
kern_auth.c Introduce a new flag we mark as TRUE when we load listeners, and change 2006-09-15 14:28:04 +00:00
kern_clock.c Add missing initializers 2006-09-02 06:21:32 +00:00
kern_descrip.c add missing initializer 2006-09-02 06:22:45 +00:00
kern_drvctl.c ktrace-lwp merge fallout. 2005-12-15 22:01:17 +00:00
kern_event.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
kern_exec.c Single-thread updates to the process credential. 2006-07-30 21:58:11 +00:00
kern_exit.c 1) Complete Linux exit_group() emulation 2006-08-23 19:49:09 +00:00
kern_fileassoc.c * Correct hashing macro so it uses FHANDLE_SIZE() 2006-09-08 13:57:38 +00:00
kern_fork.c - Always make p->p_cred a private copy before modifying. 2006-07-17 15:29:06 +00:00
kern_kcont.c Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 19:12:23 +00:00
kern_ksyms.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
kern_kthread.c
kern_ktrace.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
kern_lkm.c Don't use KAUTH_RESULT_* where it's not applicable. 2006-09-13 10:07:42 +00:00
kern_lock.c Add lock_owner_onproc(). 2006-09-07 02:06:47 +00:00
kern_lwp.c sys__lwp_create: put newuc back to the pool on failure. 2006-08-14 14:11:21 +00:00
kern_malloc.c use ASSERT_SLEEPABLE where appropriate. 2006-07-21 10:08:41 +00:00
kern_malloc_debug.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
kern_microtime.c merge FreeBSD timecounters from branch simonb-timecounters 2006-06-07 22:33:33 +00:00
kern_ntptime.c Authorize ntp_adjtime() on the correct scope. 2006-09-09 11:52:56 +00:00
kern_pax.c Better implementation of PaX MPROTECT, after looking some more into the 2006-05-20 15:45:37 +00:00
kern_physio.c from Christian Ehrhardt: 2006-04-18 09:54:32 +00:00
kern_proc.c Single-thread updates to the process credential. 2006-07-30 21:58:11 +00:00
kern_prot.c First take at security model abstraction. 2006-09-08 20:58:56 +00:00
kern_ras.c Make it compile on archs without __HAVE_RAS. 2005-11-25 11:29:48 +00:00
kern_resource.c Don't use KAUTH_RESULT_* where it's not applicable. 2006-09-13 10:07:42 +00:00
kern_sa.c wrap long lines. 2006-06-26 10:21:59 +00:00
kern_securelevel.c Ensure creation of kern node. 2006-04-17 03:45:19 +00:00
kern_sig.c - fix initializer 2006-09-02 06:29:13 +00:00
kern_subr.c comment out impossible comparison 2006-09-02 06:30:53 +00:00
kern_synch.c make the bpendtsleep: label only active if KERN_SYNCH_BPENDTSLEEP_LABEL 2006-09-07 18:41:28 +00:00
kern_sysctl.c First take at security model abstraction. 2006-09-08 20:58:56 +00:00
kern_systrace.c add missing initializer 2006-09-02 06:35:49 +00:00
kern_tc.c Fix splclock()/splx() mismatch in previous. 2006-09-10 08:09:46 +00:00
kern_time.c First take at security model abstraction. 2006-09-08 20:58:56 +00:00
kern_timeout.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
kern_todr.c Comment nit (remove first person), from simon@. 2006-09-12 21:38:55 +00:00
kern_uuid.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
kern_verifiedexec.c Pretending to be Elad's keyboard: 2006-08-11 19:17:47 +00:00
kern_xxx.c First take at security model abstraction. 2006-09-08 20:58:56 +00:00
kgdb_stub.c Use ANSI function decls. 2005-12-07 05:53:24 +00:00
makesyscalls.sh protect sys/syscall.h properly against multiple inclusion and make the 2005-12-03 17:04:36 +00:00
subr_autoconf.c Initialize an uninitialized variable gcc 4 found 2006-05-14 05:26:59 +00:00
subr_blist.c blst_meta_fill: fix an assertion. PR/32580 from Nick Hudson. 2006-01-20 14:19:40 +00:00
subr_bufq.c - add ioctls to set/get disk bufq strategy. 2005-12-26 10:36:47 +00:00
subr_callback.c add a comment telling which structure members are zero-initialized, 2006-06-23 16:17:23 +00:00
subr_devsw.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
subr_disk.c Change iostat_alloc() to take the parent pointer and the name directly, so 2006-08-23 17:19:32 +00:00
subr_disk_mbr.c Always make partitions contiguous even if the mbr has gaps. From someone 2006-06-11 23:25:23 +00:00
subr_evcnt.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
subr_extent.c use ASSERT_SLEEPABLE where appropriate. 2006-07-21 10:08:41 +00:00
subr_iostat.c Change iostat_alloc() to take the parent pointer and the name directly, so 2006-08-23 17:19:32 +00:00
subr_kmem.c don't include sys/lock.h as it is no longer necessary. 2006-08-28 13:41:04 +00:00
subr_log.c add missing initializer 2006-09-03 06:24:21 +00:00
subr_once.c - tweak RUN_ONCE api to allow init_func returns an error. 2006-01-16 21:45:38 +00:00
subr_optstr.c Implement options string parsing of the form 'a=b c=d ...'. This will be 2006-02-03 11:04:46 +00:00
subr_pool.c avoid empty else statement 2006-09-03 06:25:19 +00:00
subr_prf.c Fix %X in kernel printf, from Arnaud Degroote in PR kern/34459. 2006-09-03 17:06:36 +00:00
subr_prof.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
subr_userconf.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
subr_vmem.c Use %zu for size_t 2006-08-21 09:05:22 +00:00
subr_workqueue.c Use for in a forever loop as per KNF. 2006-05-02 13:26:07 +00:00
subr_xxx.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
sys_generic.c use c99 initializers 2006-09-03 06:34:34 +00:00
sys_pipe.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
sys_pmc.c
sys_process.c process_domem exists for ktrace/ptrace/systrace 2006-09-01 21:05:33 +00:00
sys_socket.c integrate kauth. 2006-05-14 21:15:11 +00:00
syscalls.c Missed commit (Regen'ed). 2006-09-01 22:23:18 +00:00
syscalls.conf merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
syscalls.master Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt 2006-09-01 20:58:18 +00:00
sysv_ipc.c integrate kauth. 2006-05-14 21:15:11 +00:00
sysv_msg.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
sysv_sem.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
sysv_shm.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
tty.c Avoid NULL deref (this is called with lwp=NULL from ppp interrupt context) 2006-09-13 13:28:22 +00:00
tty_bsdpty.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
tty_conf.c - tweak RUN_ONCE api to allow init_func returns an error. 2006-01-16 21:45:38 +00:00
tty_ptm.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
tty_pty.c adjust resid in one more place. 2006-08-03 22:06:55 +00:00
tty_subr.c Use ANSI function decls, sprinkle static. 2005-12-08 03:09:04 +00:00
tty_tty.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
uipc_domain.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
uipc_mbuf.c use c99 initializers 2006-09-03 21:12:14 +00:00
uipc_mbuf2.c whitespace. 2006-03-15 11:10:41 +00:00
uipc_proto.c use c99 initializers 2006-09-03 21:12:14 +00:00
uipc_sem.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
uipc_socket.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
uipc_socket2.c Fix broken comments - there is no SO_ISCONNECTED or SO_ISCONFIRMING 2006-08-16 18:31:54 +00:00
uipc_syscalls.c Don't leave a dangling socket (no associated struct file) if 2006-08-22 13:39:48 +00:00
uipc_usrreq.c use c99 initializers 2006-09-03 21:12:14 +00:00
vfs_bio.c unexport getnewbuf. 2006-09-10 06:35:42 +00:00
vfs_cache.c make comment match logic in cache_lookup dvp unlock code 2006-09-10 05:51:33 +00:00
vfs_getcwd.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
vfs_hooks.c merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
vfs_init.c changes for making DIAGNOSTIC not change the kernel ABI: 2005-12-27 04:06:45 +00:00
vfs_lockf.c Fix all the -D*DEBUG* code that it was rotting away and did not even compile. 2006-08-17 17:11:27 +00:00
vfs_lookup.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
vfs_subr.c Add %'s to go with PRI format constants. 2006-08-24 01:08:00 +00:00
vfs_syscalls.c Don't use KAUTH_RESULT_* where it's not applicable. 2006-09-13 10:07:42 +00:00
vfs_vnops.c Fix typo. 2006-09-12 08:23:51 +00:00
vfs_xattr.c Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
vnode_if.c Fix alignement problems for fhandle_t, exposed by gcc4.1. 2006-07-13 12:00:24 +00:00
vnode_if.sh integrate kauth. 2006-05-14 21:15:11 +00:00
vnode_if.src integrate kauth. 2006-05-14 21:15:11 +00:00