Commit Graph

5256 Commits

Author SHA1 Message Date
ad
a72414e44c lwp_free(): pass curlwp to KERNEL_LOCK(), not 'l'. 2007-02-16 00:35:45 +00:00
ad
2b011d2fa7 sigswitch(): don't blat the kernel_lock count that sleepq_block() saved
earlier.
2007-02-16 00:35:20 +00:00
ad
087fdb9080 Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.
2007-02-15 20:32:47 +00:00
ad
d91014721f Add uvm_kick_scheduler() (MP safe) to replace wakeup(&proc0). 2007-02-15 20:21:13 +00:00
ad
10a11a26b3 - Add a mutex_wakeup() which clears the waiters flag and wakes all waiters.
Will be needed to fix a problem with mutexes on sparc.
- mutex_tryenter(): fix a false "locking against myself" error.
2007-02-15 15:49:27 +00:00
ad
9abeea588a Replace some uses of lockmgr() / simplelocks. 2007-02-15 15:40:50 +00:00
ad
dc5c8ac21f Restore proc::p_userret in a limited way for Linux compat. XXX 2007-02-15 15:13:10 +00:00
yamt
d972f83ff5 sigswitch: fix a deadlock. 2007-02-15 15:10:44 +00:00
ad
d5bb4b3485 Remove some pointless !__NetBSD__ cases. 2007-02-15 15:08:59 +00:00
yamt
b8060d4382 newlwp: ensure not to assign lid 0. 2007-02-15 15:08:42 +00:00
yamt
0844695f78 unwrap short lines. 2007-02-11 15:41:53 +00:00
yamt
f39831ee99 workqueue_exit: update a comment. 2007-02-11 15:37:20 +00:00
yamt
be27733fd7 use cv_signal rather than cv_broadcast where appropriate. 2007-02-11 15:36:35 +00:00
yamt
8721382dee remove a duplicated inclusion of sleepq.h. 2007-02-11 14:29:01 +00:00
ad
6bcf70b518 - Add/correct comments.
- Print correct function name when an assertion triggers.
2007-02-10 21:07:52 +00:00
hannken
9c928583f1 newlock2: syncer_lock is now a mutex. 2007-02-10 15:51:02 +00:00
yamt
997a2a3c4f remove function prototypes of sa_awaken. 2007-02-10 14:02:01 +00:00
ad
2a34c11ab8 Regen. 2007-02-10 11:32:58 +00:00
ad
b6ab00c330 A quick hack to get things building again: put back the SA system calls
with no arguments, and alias them to sys_nosys. To be revisited.
2007-02-10 11:32:21 +00:00
ad
8f4adbff6b Regen. 2007-02-10 10:25:44 +00:00
ad
f7c038012b Fix arguments to _lwp_park/unpark/unpark_all to match userland. 2007-02-10 10:24:44 +00:00
ad
36d73dc21a Remove unused file. 2007-02-10 10:18:32 +00:00
christos
1735b4d5c0 avoid using struct proc in the perfctrs case, where the variable might
not be used.
2007-02-10 02:55:18 +00:00
ad
b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
elad
5a6bb5eba2 remove empty line 2007-02-08 16:06:58 +00:00
elad
24d02b5648 style nit 2007-02-08 00:26:50 +00:00
rmind
ea2709ce49 PR/28458: shmat(2) shmaddr argument is not honored as intended.
Patch applied, thanks for Minoura Makoto.

Please note, that one should fail if cannot attach to shmaddr,
but not attach it to other place.

OK by uwe@
2007-02-07 18:45:36 +00:00
elad
01b9a124ad - Properly autocreate tables,
- Properly track number of used slots in the table,
- Track number of "assocs" per entry.
2007-02-07 09:38:04 +00:00
elad
3d8c2eee5f Add comment referring to kvm_proc.c. 2007-02-07 08:04:48 +00:00
elad
119d4b5acd PR/35253: YAMAMOTO Takashi: fileassoc hash size problem
fileassoc_table_add() was removed from the KPI and made internal. From now
fileassoc(9) will manage the optimal table size internally.

Input from and okay yamt@.
2007-02-06 01:09:48 +00:00
rillig
ff925d7fe2 typo. 2007-02-05 14:34:29 +00:00
yamt
f6217feae5 kmem_alloc: fix a null dereference reported by Chuck Silvers. 2007-02-05 11:53:46 +00:00
elad
9ac600139e Initialize pathname_t objects to NULL. 2007-02-04 20:33:02 +00:00
chs
0507747213 more fixes for the new vnode locking scheme:
- don't use SAVESTART in calls to relookup() from unionfs,
   just vref() the desired vnode when we need to.
 - fix locking and refcounting in the unionfs EEXIST error cases.
 - release any vnode locks before calling VFS_ROOT(), vfs_busy() is enough.
   this allows us to simplify union_root() and fix PR 3006.
 - union_lock() doesn't handle shared lock requests correctly,
   so convert them to exclusive instead.  fixes PR 34775.
 - in relookup(), avoid reusing "dp" for different purposes,
   the error handling wasn't right.  (actually just get rid of dp.)
   also, change relookup() to ignore LOCKLEAF and always return the
   vnode locked since the callers already expect this.
2007-02-04 15:03:20 +00:00
cbiere
89165435c8 Avoid unnecessary cast in bufq_disksort_init(). 2007-02-01 00:36:37 +00:00
elad
85f515764b Fix notify only logic for credentials scope. Thanks ad@! 2007-01-31 16:30:09 +00:00
ad
f8ab9664c4 ffree(): don't call kauth_cred_free() with a held simplelock. 2007-01-31 16:00:43 +00:00
elad
c439bcfe43 Add a new scope, the credentials scope, which is internal to the kauth(9)
implementation and meant to be used by security models to hook credential
related operations (init, fork, copy, free -- hooked in kauth_cred_alloc(),
kauth_proc_fork(), kauth_cred_clone(), and kauth_cred_free(), respectively)
and document it.

Add specificdata to credentials, and routines to register/deregister new
"keys", as well as set/get routines. This allows security models to add
their own private data to a kauth_cred_t.

The above two, combined, allow security models to control inheritance of
their own private data in credentials which is a requirement for doing
stuff like, I dunno, capabilities?
2007-01-31 10:08:23 +00:00
elad
8b125f4fa5 PR/35524: Brian de Alwis: panic from free in pathname_get
Patch applied, thanks for the report!
2007-01-31 08:29:20 +00:00
hannken
4d607243ba Change fstrans enum types to upper case.
No functional change.

From Antti Kantee <pooka@netbsd.org>
2007-01-29 15:42:50 +00:00
elad
87352b7746 Add a comment to indicate the reason for kauth_init() and secmodel_start()
being where they are. Suggested by and okay christos@.
2007-01-27 22:54:58 +00:00
elad
d7cf9c93bb Start the security model sooner.
As with previous commit, we want to allow the secmodel code to control
the credential inheritance, etc., so we need it started earlier (also
before proc0_init()).
2007-01-27 01:13:10 +00:00
elad
3238d589b2 No need to include acct.h, sysctl.h, and time.h. 2007-01-26 23:50:36 +00:00
elad
4ee02bdcac Initialize kauth(9) sooner.
Since we'll soon want to be able to control the inheritance of credentials,
kauth(9) needs to be ready for use much sooner -- at least before the call
to proc0_init().
2007-01-26 21:57:47 +00:00
elad
4f9ade2efc Add missing specificdata_key_delete() in fileassoc_deregister(). 2007-01-26 12:36:46 +00:00
elad
fe9f141d4d Fix tyop in comment: specifidata -> specificdata. 2007-01-25 13:58:40 +00:00
elad
73a4d95bb6 Update comment: device -> mount. No functional change. 2007-01-25 13:57:28 +00:00
elad
317687e988 Don't rely on KAUTH_PROCESS_CANSEE for environment just yet,
otherwise we're allowing anyone to read the environment unless
curtain is enabled.

From yamt@.
2007-01-22 15:11:52 +00:00
elad
a78693aa19 Kill KAUTH_PROCESS_RESOURCE and just replace it with two actions for
nice and rlimit.
2007-01-20 16:47:38 +00:00
hannken
1b9c6382e3 New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE.  This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).
2007-01-19 14:49:08 +00:00
elad
39714ce48b Oops - this should have gone in a long time ago.
Weak alias secmodel_start to a nop routine, for building without a secmodel
in the kernel.
2007-01-17 12:27:24 +00:00
elad
096a7f4744 Use KAUTH_ARG(). 2007-01-17 12:21:34 +00:00
dogcow
8f871f1a8d #include <sys/sa.h> to get sys_upcall_t def. 2007-01-16 20:12:40 +00:00
elad
f3cc348dad Introduce secmodel_register() and secmodel_deregister() (for now left
undocumented) and change logic in kauth_authorize_action() to only
allow an action if it wasn't explicitly allowed/denied and there are no
secmodels loaded.

Okay yamt@.
2007-01-16 11:51:22 +00:00
ad
d71c91cb2c Regen. 2007-01-16 05:29:54 +00:00
ad
606e323b3e Add sched_yield(). 2007-01-16 05:28:45 +00:00
ad
2ec3e26f21 Regen. 2007-01-16 01:32:52 +00:00
ad
b9b02583e6 Add prototypes for: _lwp_kill, _lwp_detach, _lwp_park, _lwp_unpark,
_lwp_unpark_all, sched_yield.
2007-01-16 01:30:45 +00:00
pooka
88f603fea0 TAILQ_INIT a mountpoint's vnode queue and always add vnodes to the
tail instead of an explicit check to add to the head for an empty
queue.  Apparently TAILQ_INSERT_HEAD happens to work for a
non-initialized head and does implicit initialization so that
TAILQ_INSERT_TAIL works after that.
2007-01-15 19:13:30 +00:00
elad
6df6f0ea65 Introduce kauth_proc_fork() to control credential inheritance. 2007-01-15 17:45:32 +00:00
elad
8ed50e44ae veriexec_file_delete() and veriexec_table_delete() now take 'struct lwp *'
too.
2007-01-11 16:24:47 +00:00
elad
4cc18ba6e8 Make 'veriexec_verbose' static. 2007-01-11 15:10:25 +00:00
enami
b840f8c9d7 Plug another memory leak in __sigtimedwait1() which is introduced
by rev. 1.208: free `waitset' and ksiginfo on success.
2007-01-10 07:58:27 +00:00
enami
93a9d5d355 Plug memory leak in __sigtimedwait1(): make sure to free `waitset'
on error return path.
2007-01-10 07:53:26 +00:00
elad
d2e4f7167b Remove advertising clause from all of my stuff. 2007-01-09 12:49:36 +00:00
pooka
38544312f7 update some comments for vnode locking smoergasbord change
amazing -- the description of VOP_LOOKUP is suddenly human-readable
2007-01-07 21:33:24 +00:00
pooka
fdac24081e Restore name caching behaviour accidentally removed in rev 1.73, using
variation suggested by yamt on tech-kern.

XXX: The exception is that this doesn't any longer prevent caching
of RENAME, which was implied in a weird weird way previously.  But
that's handled by the callers currently.
2007-01-07 20:43:59 +00:00
elad
cf9d4bd6af Update copyright/license, okay blymn@ few days ago. 2007-01-07 13:55:17 +00:00
christos
10fd1e8e3a one more cast. 2007-01-06 20:40:58 +00:00
christos
22f422dc10 register_t is unsigned on sparc/sparc64/sh5/powerpc. This produces warnings
on comparisons < 0, since they can never be true. All register_t's should
be made signed, and this commit should be reverted. For now cast to int,
since the syscall code is a small number and guaranteed to fit.
2007-01-06 20:38:15 +00:00
elad
ce903562f2 Use kauth(9). 2007-01-05 13:34:17 +00:00
elad
1e70d64818 Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 16:55:29 +00:00
wrstuden
264b840ad9 Fix issue noted by Ilja van Sprundel and disclosed at 23C3.
Make sure we always FILE_UNUSE the file. To make it easier, exit
via a new "out:" exit path that does so, setting error beforehand.

Fix suggested by Elad, hand-typed by me.
2007-01-03 23:20:58 +00:00
elad
2a32293a9f Make more things static. From halflife. 2007-01-03 18:32:11 +00:00
elad
a13160f423 Make mount(2) and unmount(2) use kauth(9) for security policy.
Okay yamt@.
2007-01-02 10:47:28 +00:00
elad
c6e8423fec Make kauth_deregister_scope() and kauth_unlisten_scope() free the
passed kauth_scope_t and kauth_listener_t objects, respectively.

Okay yamt@.
2007-01-01 23:33:03 +00:00
pooka
b73e147d2c in rename_files(), match pre-1.280 locking behaviour by unlocking
fromnd's dvp only in case the dvp != vp
2007-01-01 22:00:16 +00:00
elad
0b96cfb817 Add back MNT_NOEXEC propagation on new mounts by non-root users.
Mistakenly removed in revision 1.286.
2007-01-01 20:45:51 +00:00
elad
8a4dd2d69d #if 0 -> #ifdef notyet, and no need to forward declare internal
data-structures anymore.
2006-12-31 12:07:16 +00:00
elad
b6a8425161 Enforce exclusive MNT_GETARGS in mount_getargs(). 2006-12-31 10:05:52 +00:00
elad
c5c6251521 Avoid TOCTOU in Veriexec by introducing veriexec_openchk() to enforce
the policy and using a single namei() call in vn_open().
2006-12-30 15:26:55 +00:00
elad
8657d4ffbb Veriexec should not explicitly allow anything (raw disk access). 2006-12-29 11:34:14 +00:00
yamt
88bbf6ee26 mount_domount: revive code to enforce MNT_NOSUID and MNT_NODEV for usermount,
which was removed mistakenly by rev.1.286.  pointed by elad.
2006-12-28 14:33:41 +00:00
chs
7645d04974 fix two more problems in the recent changes to lookup():
- don't hold the parent directory vnode locked while traversing mount points.
   the fs that's mounted might be an NFS served by a userland process
   like the automounter, which might need to traverse the parent directory
   in order to complete the lookup.
 - in the ENAMETOOLONG case fixed in rev. 1.75, set ni_dvp to dp
   since we've logically moved on to using "dp" as the parent.
   the caller will then handle vput()ing it as normal.
   this fixes PR 35279.
2006-12-27 23:21:02 +00:00
alc
a4ba78e89b CID-4197,4198: ensure that `fp' is not NULL before calling FILE_UNUSE()
ok christos@
2006-12-27 18:45:30 +00:00
yamt
c3ad9e4929 remove now unused vnode::v_lease. 2006-12-27 12:22:14 +00:00
yamt
ccfd2c0df0 remove nqnfs. 2006-12-27 12:10:09 +00:00
elad
8764325d83 Refactor a bit the ptrace(2) code: first make the keep-kernel-stable
decisions, then have a kauth(9) call for security policy enforcement,
and only then proceed to processing each request.

Add a KAUTH_PROCESS_CANSEE call right after pfind(). This should really
be done differently, so mark it with XXX.
2006-12-27 10:02:46 +00:00
yamt
a8552e41ca mount_domount: don't forget to handle MNT_RDONLY.
PR/35327 from Christian Biere.
2006-12-27 08:55:35 +00:00
elad
74409752fc Fix copy/paste error: Veriexec's sysctl setup routine was named after
PaX's.
2006-12-26 19:31:33 +00:00
yamt
42489b9a68 - shorten the period to modify mnt_flag temporarily.
- desupport MNT_EXPORTED without MNT_UPDATE explicitly.
- fix a comment.
- unwrap short lines.
2006-12-26 12:39:01 +00:00
elad
504c71d9fe Make machdep scope architecture-agnostic by removing all arch-specific
requests and centralizing them all. The result is that some of these
are not used on some architectures, but the documentation was updated
to reflect that.
2006-12-26 10:43:43 +00:00
elad
8daca39031 Fix a comment. No functional change. 2006-12-26 08:55:32 +00:00
elad
ff39342b33 veriexec_lookup() should not return an internal data-structure, but rather
just a boolean value.
2006-12-26 07:50:40 +00:00
alc
9594e8adae CID-4284: check for 'kup != NULL' after kmem_zalloc() returns 2006-12-26 00:10:40 +00:00
elad
6be473ba20 Don't reference userspace pointers. 2006-12-25 22:03:42 +00:00
ad
9f07c24ec6 lockstat: improve reporting slightly, and fix a bug where the command
could spin while resorting lists.
2006-12-25 11:57:40 +00:00
elad
a44abdfff8 Properly handle flags in mount_domount(). 2006-12-25 08:11:52 +00:00
elad
97b434c554 Slash sys_mount() and add three helper functions: mount_update(),
mount_getargs(), and mount_domount() to handle three main things it can
do.

This makes the code more readable and removes the horrible goto mess
that was lurking there since forever... it also makes it easier to
implement a security policy for that code.
2006-12-24 12:43:17 +00:00
elad
1124b0b8bc PR/35278: YAMAMOTO Takashi: veriexec sometimes feeds user va to log(9)
Introduce the (intentionally undocumented) pathname_get(), pathname_path(),
and pathname_put(), to deal with allocating and copying of pathnames from
either kernel- or user-space.
2006-12-24 08:54:55 +00:00
elad
606687adb0 Use ndp->ni_cnd.cn_pnbuf, not epp->ep_ndp->ni_dirp, for the pathname
for Veriexec/PaX purposes.

(this is safe here because the nameiop is LOOKUP.)

Fixes part of PR/35278.
2006-12-23 17:23:51 +00:00
ad
384215762e lwp_update_creds(): acquire the kernel lock to avoid potential deadlock. 2006-12-23 08:39:47 +00:00
ad
d635d897fb Allocate space for scopes and listeners with kmem. Ok elad@. 2006-12-23 08:38:00 +00:00
yamt
e49bb7c765 - remove the fileassoc "tabledata" functionality. use mountspecific instead.
- make pax_segvguard_cb static.

tested and ok'ed by elad.
2006-12-23 08:35:43 +00:00
elad
b5a8324144 Use KAUTH_DEVICE_TTY_OPEN instead of comparing euid to zero. 2006-12-22 21:56:19 +00:00
ad
0ff4104d82 lwp::l_acflag is no longer useful. 2006-12-22 08:04:01 +00:00
yamt
8bf7662829 merge yamt-splraiseipl branch.
- finish implementing splraiseipl (and makeiplcookie).
	  http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
	- complete workqueue(9) and fix its ipl problem, which is reported
	  to cause audio skipping.
	- fix netbt (at least compilation problems) for some ports.
	- fix PR/33218.
2006-12-21 15:55:21 +00:00
elad
368ec17e69 Remove the third argument from check_exec() and just check for ep_flags
in the exec_package to know if we need to use VERIEXEC_DIRECT or
VERIEXEC_INDIRECT.

Suggested by and okay yamt@
2006-12-20 11:35:29 +00:00
christos
80b162af27 fix kernel panic with veriexec and raidframe. 2006-12-20 01:51:48 +00:00
elad
711e88f6f4 Split handling of unmount in Veriexec, where veriexec_unmountchk() will do
the permission check only, and the removal of the table/entries will be
done by fileassoc(9) after a successful unmount.

Prompted by and okay yamt@.
2006-12-18 06:43:12 +00:00
elad
238ad51d2d - moves 'nice' access semantics to secmodel code,
- makes sysctl_proc_find() just lookup the process,
- use KAUTH_PROCESS_CANSEE requests to determine if the caller is
  allowed to view the target process' corename, stop flags, and
  rlimits,
- use explicit kauth(9) calls with KAUTH_PROCESS_CORENAME,
  KAUTH_REQ_PROCESS_RESOURCE_NICE, KAUTH_REQ_PROCESS_RESOURCE_RLIMIT,
  and KAUTH_PROCESS_STOPFLAG when modifying the aforementioned.
- sync man-page and example skeleton secmodel with reality.

okay yamt@

this is a pullup candidate.
2006-12-14 11:45:08 +00:00
elad
aa4d8a2d6c PR/35252: YAMAMOTO Takashi: veriexec doesn't handle unmount
Call veriexec_table_delete() in the cases where we won't be failing the
unmount request.
2006-12-14 11:15:27 +00:00
yamt
4cfe5a1b41 - just associate fileassoc "table" to struct mount.
because the latter is always available during the lifetime of the former,
  there is little point to use another global list to keep track of them.
  it also allows to remove an #ifdef FILEASSOC.

- avoid some operations (memory allocation and VOP) in fileassoc_file_lookup,
  when fileassoc table is not used.

ok'ed by elad.
2006-12-14 09:24:54 +00:00
elad
52944a66d2 entry-type is uint8 2006-12-14 05:15:33 +00:00
christos
3e978579d3 add missing initializer. 2006-12-13 16:51:27 +00:00
yamt
24d0248e5f lookup: add more missing vput(). 2006-12-13 13:36:19 +00:00
chs
e53d6bd175 in lookup(), vput() the starting vnode in the case where
we return with both ni_dvp and ni_vp being NULL.
2006-12-13 06:36:35 +00:00
yamt
e4e829e9d1 make fileassoc_tables static. 2006-12-12 14:22:07 +00:00
yamt
b0a14e5934 - remove a static configuration, FILEASSOC_NHOOKS. do it dynamically instead.
- make fileassoc_t a pointer and remove FILEASSOC_INVAL.
- clean up kern_fileassoc.c.  unify duplicated code.
- unexport fileassoc_init using RUN_ONCE(9).
- plug memory leaks in fileassoc_file_delete and fileassoc_table_delete.
- always call callbacks, regardless of the value of the associated data.

ok'ed by elad.
2006-12-11 15:24:27 +00:00
chs
c398ae9734 a smorgasbord of improvements to vnode locking and path lookup:
- LOCKPARENT is no longer relevant for lookup(), relookup() or VOP_LOOKUP().
   these now always return the parent vnode locked.  namei() works as before.
   lookup() and various other paths no longer acquire vnode locks in the
   wrong order via vrele().  fixes PR 32535.
   as a nice side effect, path lookup is also up to 25% faster.
 - the above allows us to get rid of PDIRUNLOCK.
 - also get rid of WANTPARENT (just use LOCKPARENT and unlock it).
 - remove an assumption in layer_node_find() that all file systems implement
   a recursive VOP_LOCK() (unionfs doesn't).
 - require that all file systems supply vfs_vptofh and vfs_fhtovp routines.
   fill in eopnotsupp() for file systems that don't support being exported
   and remove the checks for NULL.  (layerfs calls these without checking.)
 - in union_lookup1(), don't change refcounts in the ISDOTDOT case, just
   adjust which vnode is locked.  fixes PR 33374.
 - apply fixes for ufs_rename() from ufs_vnops.c rev. 1.61 to ext2fs_rename().
2006-12-09 16:11:50 +00:00
chs
a8459c8cc1 in lockstatus(), report LK_EXCLOTHER if LK_WANT_EXCL or LK_WANT_UPGRADE
is set, since the thread that set either of those flags will be the next
one to get the lock.  fixes PR 35143.
2006-12-09 15:59:25 +00:00
yamt
4d5f3128d9 don't expose FILEASSOC_NHOOKS. 2006-12-08 13:23:22 +00:00
christos
3c71b5db0d - make so_linger unsigned short to double the range
- return 1 or 0 for the flag being set instead of the flag value
- check for range properly
2006-12-08 00:23:08 +00:00
ad
f45632428c iostat: avoid sleeping with a held simple_lock. 2006-12-07 20:23:38 +00:00
ad
ffa6c5cf99 sysctl_proc_corename(): do the second auth check against the correct
process.
2006-12-07 20:04:31 +00:00
christos
dbc497f58c simplify linger code. 2006-12-06 20:49:02 +00:00
christos
99f8337886 get the vmspace first before you try to use it. 2006-12-06 18:54:02 +00:00
yamt
a575dafacc use KSI_INIT rather than memset. no functional changes. 2006-12-06 10:02:22 +00:00
elad
97f57b38e7 PR/35021: Brian de Alwis: root cannot get/set rlimit information of user
processes through sysctl

Fix inverted logic in boolean assignment. This is why these tests should
not be done outside the secmodel code.

Thanks for the report.
2006-12-05 21:30:50 +00:00
elad
edad69123e PR/25741: ITOH Yasufumi: ras(9) sequence is not protected against ptrace(2)
Okay christos@
2006-12-04 18:50:19 +00:00
elad
432c309931 Change kauth(9) KPI for kauth_authorize_device_passthru() to add another
argument, u_long, serving as a bit-mask of generic requests for the
passthru request.

Discussed on tech-security@ and tech-kern@. Okay tls@.
2006-12-02 03:10:42 +00:00
pooka
24f932e907 regen for VOP_FOO_DESCOFFSET change in vnode_if.sh 2006-11-30 21:07:36 +00:00
pooka
d89a0720df Generate preprocessor macros for vop offsets in vfs op descs. And
use these symbols in the desc structures instead of magic numbers.
No functional change, except VOP_FOO_DESCOFFSET macros in vnode_if.h.

wrstuden ok
2006-11-30 21:06:29 +00:00
elad
7a71c77e81 More cleaning... split veriexec_delete() to veriexec_file_delete() to
handle a single entry and veriexec_table_delete() to handle an entire
table. veriexec_convert() now takes a struct vnode *, and made
veriexec_table_lookup() take struct mount * (that's entirely internal
now).

Tested on amd64, built successfully on amd64, i386, sparc, and sparc64.
2006-11-30 16:53:47 +00:00
elad
3cd8d27403 Return 'error' in veriexec_unmountchk(), not always 0. 2006-11-30 13:42:46 +00:00
elad
cc26e2da8f Make sure that memory freed as M_VERIEXEC was allocated with that type.
Pointed out by Jason Thorpe, thanks!
2006-11-30 01:42:21 +00:00
elad
0c67c581a5 Massive restructuring and cleanup of Veriexec, mainly in preparation
for work on some future functionality.

  - Veriexec data-structures are no longer exposed.

  - Thanks to using proplib for data passing now, the interface
    changes further to accomodate that.

    Introduce four new functions. First, veriexec_file_add(), to add
    a new file to be monitored by Veriexec, to replace both
    veriexec_load() and veriexec_hashadd(). veriexec_table_add(), to
    replace veriexec_newtable(), will be used to optimize hash table
    size (during preload), and finally, veriexec_convert(), to convert
    an internal entry to one userland can read.

  - Introduce veriexec_unmountchk(), to enforce Veriexec unmount
    policy. This cleans up a bit of code in kern/vfs_syscalls.c.

  - Rename veriexec_tblfind() with veriexec_table_lookup(), and make
    it static. More functions that became static: veriexec_fp_cmp(),
    veriexec_fp_calc().

  - veriexec_verify() no longer returns the entry as well, but just
    sets a boolean indicating whether an entry was found or not.

  - veriexec_purge() now takes a struct vnode *.

  - veriexec_add_fp_name() was merged into veriexec_add_fp_ops(), that
    changed its name to veriexec_fpops_add(). veriexec_find_ops() was
    also renamed to veriexec_fpops_lookup().

    Also on the fp-ops front, the three function types used to initialize,
    update, and finalize a hash context were renamed to
    veriexec_fpop_init_t, veriexec_fpop_update_t, and veriexec_fpop_final_t
    respectively.

  - Introduce a new malloc(9) type, M_VERIEXEC, and use it instead of
    M_TEMP, so we can tell exactly how much memory is used by Veriexec.

  - And, most importantly, whitespace and indentation nits.

Built successfuly for amd64, i386, sparc, and sparc64. Tested on amd64.
2006-11-30 01:09:47 +00:00
elad
646f2112d3 Make Veriexec use proplib(3) for kernel-userland data passing.
Obviously, this breaks the already unstable Veriexec ABI, but that's
it. Some cool additions are planned to be introduced, and this just
makes it so that NetBSD 4.0 users will be able to easily use them as
well.

This also removes the fingerprint type name limit, so relevant code
was adjusted.

Thoroughly tested (even uncovered a bug in proplib! thanks for fixing
that cube@!). Documentation updated.
2006-11-28 22:22:02 +00:00
ad
dfe7788c29 Avoid sleeping with a held simple_lock. 2006-11-28 20:35:16 +00:00
elad
233dc909a8 Kill process_checkioperm().
While here, adjust comments.
2006-11-28 17:58:10 +00:00
elad
8bb202af97 Move ktrace, ptrace, systrace, and procfs to use kauth(9).
First, remove process_checkioperm() calls from MD code. Similar checks
using kauth(9) routines (on the process scope, using appropriate action)
are done in the callers.

Add secmodel back-end to handle each subsystem.
2006-11-28 17:27:09 +00:00
elad
e0d8be4efc Move Veriexec's sysctl(9) setup routine and helper to kern_verifiedexec.c. 2006-11-27 17:45:36 +00:00
elad
21bc112176 Implement Veriexec's raw disk policy on-top of kauth(9)'s device scope,
using both the rawio_spec and passthru actions to detect raw disk
activity. Same for kernel memory policy.

Update documentation (no longer need to expose veriexec_rawchk()) and
remove all Veriexec-related bits from specfs.
2006-11-26 20:27:27 +00:00
elad
df07d5d652 I wanted to do this for so long: veriexec_init_fp_ops() -> veriexec_init(). 2006-11-26 16:22:36 +00:00
christos
df031f1edc PR/34837: Mindaguas: Add SysV SHM dynamic reallocation and locking to the
physical memory
2006-11-25 21:40:04 +00:00
scw
e07faf8a74 Replace the myriad copies of bounds_check_with_label() with a single MI
version.

Add disk_blocksize(9) so that disk drivers can record the physical
block size of a disk if it is different to DEV_BSIZE. Right now this
simply initialises dk_blkshift and dk_byteshift according to the
supplied block size. This information is used in the MI version of
bounds_check_with_label().
2006-11-25 11:59:55 +00:00
elad
7651cb0554 Put back break mistakenly removed in previous commit. 2006-11-24 01:13:11 +00:00
elad
f1e710a4d8 Document flaw in veriexec_rawchk(). This is what I added to the comment:
* XXX: This is bogus. There's an obvious race condition between the time
 * XXX: the disk is open for writing, in which an attacker can access a
 * XXX: monitored file to get its signature cached again, and when the raw
 * XXX: file is overwritten on disk.
 * XXX:
 * XXX: To solve this, we need something like the following:
 * XXX:         open raw disk:
 * XXX:           - raise refcount,
 * XXX:           - invalidate fingerprints,
 * XXX:           - mark all entries with "no cache" flag
 * XXX:
 * XXX:         veriexec_verify:
 * XXX:           - if "no cache", don't cache evaluation result
 * XXX:
 * XXX:         close raw disk:
 * XXX:           - lower refcount,
 * XXX:           - if refcount == 0, remove "no cache" flag from all entries
2006-11-23 13:11:29 +00:00
elad
a84fee7faf Initial implementation of PaX Segvguard (this is still work-in-progress,
it's just to get it out of my local tree).
2006-11-22 02:02:51 +00:00
elad
156f4ce7bb Make PaX MPROTECT use specificdata(9), freeing up two P_* flags.
While here, make more generic for upcoming PaX features.
2006-11-22 00:41:38 +00:00