Commit Graph

5036 Commits

Author SHA1 Message Date
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
elad cbe2288b0c printf() -> log() for Veriexec messages. 2006-11-21 23:52:41 +00:00
elad 9a87be9622 compare pointer against null, not zero 2006-11-20 21:50:51 +00:00
ad 9f1efa611c selcommon(), pollcommon(): restore the correct signal mask on failure. 2006-11-20 15:16:22 +00:00
elad 2db3a96be7 Provide a standard authorization wrapper for the device scope. 2006-11-19 00:11:29 +00:00
yamt 9ef6d9f3e5 qc_reap, qc_destroy: simplify. 2006-11-18 07:51:54 +00:00
yamt c683b6561f vmem_destroy: don't forget to clean up qcache_t. 2006-11-18 07:51:34 +00:00
yamt 23213de881 vmem: share qcache_t if itemsperpage is same. 2006-11-18 07:51:06 +00:00
hannken e29b23b983 Add specificdata support to mount points.
Welcome to NetBSD 4.99.4

Approved by: Jason Thorpe <thorpej@netbsd.org>
2006-11-17 17:05:18 +00:00
reinoud ccc98bbca8 Export nestiobuf_iodone(). This allows nested iobufs to have a custom
call-back function that can then call the nestiobuf_iodone() to propagate.
2006-11-14 15:50:00 +00:00
christos b7cb52a381 for pt_syscall, send a signal to our parent, not out grandparent. Noted by
mrg and ad.
2006-11-13 02:52:08 +00:00
yamt ec585a4e4d protect bt_poolcache by splvm because it's shared among all arenas
including ones which can be used in interrupt context.
PR/35042 from Manuel Bouyer.
2006-11-12 22:28:17 +00:00
christos a62de02966 Add SSP support.
XXX: This is broken for me right now, because my kernel resets after fxp0
is probed, but it could be some bug in the driver/compiler.
2006-11-11 02:12:53 +00:00
yamt 1de5b4994d vmem_xalloc: plug memory leak on error. 2006-11-09 10:08:53 +00:00
drochner b1af2cb9b9 -SUS says that a successful call to setcontext(2) does not return. This
implies that _UC_CPU must be set in the context passed. Check for this
 and return EINVAL if not; this gives a cheap test for corrupted
 ucontexts eg on a signal handler stack which would go unnoticed otherwise.
-Don't ckeck for NULL ucontext pointers explicitely. This is an error,
 except in the swapcontext() case where it can be easily caught in
 userland.
2006-11-08 20:18:32 +00:00
jmmv c3429f8083 Pass a simple ELF header to ksyms_init_explicit with the minimum contents
required to initialize ksyms_hdr.  Otherwise LKMs do not work when using
ksyms_init_explicit instead of ksyms_init, as is the case of booting an
i386 kernel using Multiboot.
2006-11-06 13:35:35 +00:00
yamt 3aef238dc0 - define some macros and use them.
- fix an off-by-one in testcode.
2006-11-04 13:26:22 +00:00
yamt e1b6afe136 todo. 2006-11-04 13:25:52 +00:00
jmmv d4cb7c851a Fix matching of options with common prefixes (e.g. console and console_speed).
While here remove an useless assignment and bind a variable to a loop.
2006-11-04 11:37:12 +00:00
elad 9477ac30bc Add "@uid" keyword translation, to translate effective user-id of the
process.
2006-11-04 10:14:00 +00:00
elad fe9e2303fd Change KAUTH_SYSTEM_RAWIO to KAUTH_DEVICE_RAWIO_SPEC (moving the raw i/o
requests to the device scope) and add KAUTH_DEVICE_RAWIO_PASSTHRU.

Expose iskmemdev() through sys/conf.h.

okay yamt@
2006-11-04 09:30:00 +00:00