Commit Graph

4251 Commits

Author SHA1 Message Date
christos
df1b79805d don't declare syscall and syscall_intern. 2005-07-10 00:54:54 +00:00
thorpej
76fd10b45a Move VFS extended attribute support to its own file. 2005-07-09 01:05:23 +00:00
christos
ac0ee9b2c0 Allow F{G,S}OWN to succeed on a tty that has no session associated with it,
and it is not the controlling tty. This change allows us to use SIGIO on
a non-controlling tty (eg. debug ntpd with a refclock on a tty).
2005-07-07 00:01:32 +00:00
thorpej
f44b62c49d Collect vmcmd statistics. 2005-07-06 23:08:57 +00:00
christos
de124326cb Make copy{in,out}_proc work on all processes (including curproc) by
special-casing the curproc case. Use copy{in,out}_proc directly instead
of checking for curproc each time. Discussed with thorpej.
2005-07-06 22:30:42 +00:00
kleink
c6cc410a70 Addendum to previous: copyin_proc() must not be used on curproc. 2005-07-06 20:56:49 +00:00
kleink
e3c2a9c2f6 Use copyin_proc() to peek for trailing zeroes in sections, as we might be
running in a different context (i.e. a process tracing).
2005-07-06 20:31:33 +00:00
thorpej
d697722880 A few tweaks to magic symlinks:
- Add a @{var} syntax in addition to @var.  This allows for patterns like
  @{ostype}-@{osrelease}-@{machine_arch}.
- Add a @emul variable that expands to the process's emulation name
  (e.g. "netbsd", "netbsd32", "linux", etc.)
2005-07-06 18:53:00 +00:00
elad
ab856de1bc Use `const struct sysctlnode *veriexec_count_node' so it works with the
recent changes in sysctl(9).
2005-07-01 19:50:04 +00:00
drochner
0ca89e9c3a clean up duplication which was to support the old (not locator passing)
API for bus "submatch" functions
2005-06-28 18:37:34 +00:00
elad
1b7133edad From marius@openbsd:
Fix an issue when scripts are executed under systrace where the argv[0]
would be normalized, and hence break scripts that depend on how they were
called.
2005-06-27 17:11:20 +00:00
elad
8ebc2e9bee From marius@openbsd:
Add an exec message so that whenever a set-uid/gid process executes a new
image which we may control, the exec does not go by unnoticed.
2005-06-26 19:58:29 +00:00
riz
67399f088e Use %zx in a format string to print a size_t, not %lx, so a kernel
with KSYMS_DEBUG will compile.
2005-06-25 05:30:04 +00:00
christos
0064ddfe2b the magic number is not byte-swapped. 2005-06-25 02:22:57 +00:00
thorpej
73c9fbb0e6 Use ANSI function decls. Apply some static. 2005-06-23 23:15:12 +00:00
thorpej
2f6855b6ca Use ANSI function decls. 2005-06-23 18:46:17 +00:00
thorpej
6e4d6e6cdb Use ANSI decls, liberally apply static. 2005-06-23 18:44:44 +00:00
thorpej
e871a0392f Remove the last references to M_NAMEI; everything should be using PNBUF_*()
now (for a long time now).  Remove M_NAMEI, and bump the kernel version to
3.99.7 to reflect its removal.
2005-06-23 17:00:30 +00:00
thorpej
65412a2710 Implement expansion of special "magic" strings in symlinks into
system-specific values.  Submitted by Chris Demetriou in Nov 1995 (!)
in PR kern/1781, modified only slighly by me.

This is enabled on a per-mount basis with the MNT_MAGICLINKS mount
flag.  It can be enabled at mountroot() time by building the kernel
with the ROOTFS_MAGICLINKS option.

The following magic strings are supported by the implementation:

	@machine	value of MACHINE for the system
	@machine_arch	value of MACHINE_ARCH for the system
	@hostname	the system host name, as set with sethostname()
	@domainname	the system domain name, as set with setdomainname()
	@kernel_ident	the kernel config file name
	@osrelease	the releaes number of the OS
	@ostype		the name of the OS (always "NetBSD" for NetBSD)

Example usage:

	mkdir /arch/i386/bin
	mkdir /arch/sparc/bin
	ln -s /arch/@machine_arch/bin /bin
2005-06-23 00:30:28 +00:00
elad
6e7c7658ef Fix logic in verbose printing. 2005-06-22 21:50:27 +00:00
ws
9d78e0cf36 PR-30566: Poll must not return <sys/errno.h> values.
Start with those places I can easily test.
2005-06-21 14:01:11 +00:00
elad
0e4dfe1792 - Use more calls to veriexec_report() where possible.
- Change #ifdef VERIFIED_EXEC_VERBOSE to another verbose level, 2. Add
  sysctl(3) bits.

- Simplify access type conflict handling during load. This depends on
  the values of access type defines to be ordered from least to most
  'strict'.
2005-06-20 15:06:18 +00:00
atatat
df13e3579e Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone.  Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
2005-06-20 02:49:18 +00:00
elad
c3caa55d4d - Avoid pollution of struct vnode. Save the fingerprint evaluation status
in the veriexec table entry; the lookups are very cheap now. Suggested
  by Chuq.

- Handle non-regular (!VREG) files correctly).

- Remove (no longer needed) FINGERPRINT_NOENTRY.
2005-06-19 18:22:36 +00:00
thorpej
9616fa6458 Fix some locking issues:
- Make the locking rules for pr_rmpage() sane, and don't modify fields
  protected by the pool lock without actually holding it.
- Always defer freeing the pool page to the back-end allocator, to avoid
  invoking the pool_allocator with the pool locked (which would violate
  the pool_allocator -> pool locking order).
- Fix pool_reclaim() to not violate the pool_cache -> pool locking order
  by using a trylock.

Reviewed by Chuq Silvers.
2005-06-18 01:34:03 +00:00
atatat
efb4270746 Comment in new cp_id implementation was wrong since I abandoned
rewriting it in favor of some testing and then never got back to it.
It's better now.
2005-06-17 23:53:21 +00:00
elad
97d75abb70 Oops. Don't allow file delete even if it's not monitored if we're in
lockdown mode (strict level 3).
2005-06-17 22:39:08 +00:00
elad
ad7b01f7d0 More veriexec changes:
- Better organize strict level. Now we have 4 levels:
  - Level 0, learning mode: Warnings only about anything that might've
      resulted in 'access denied' or similar in a higher strict level.

  - Level 1, IDS mode:
    - Deny access on fingerprint mismatch.
    - Deny modification of veriexec tables.

  - Level 2, IPS mode:
    - All implications of strict level 1.
    - Deny write access to monitored files.
    - Prevent removal of monitored files.
    - Enforce access type - 'direct', 'indirect', or 'file'.

  - Level 3, lockdown mode:
    - All implications of strict level 2.
    - Prevent creation of new files.
    - Deny access to non-monitored files.

- Update sysctl(3) man-page with above. (date bumped too :)

- Remove FINGERPRINT_INDIRECT from possible fp_status values; it's no
  longer needed.

- Simplify veriexec_removechk() in light of new strict level policies.

- Eliminate use of 'securelevel'; veriexec now behaves according to
  its strict level only.
2005-06-17 17:46:18 +00:00
christos
dfa8191fb3 Add a new sysctl 'cp_id' that returns the array of cpu id values. Requested by
me, implemented by atatat.
2005-06-16 14:55:58 +00:00
yamt
91fa31b5d2 uipc_usrreq: plug mbuf leak. 2005-06-16 14:36:42 +00:00
elad
e62596b887 Set the veriexec table entry pointer to NULL in getnewvnode(). 2005-06-15 16:59:27 +00:00
elad
5b2713d417 Fix sysctl handling for raise-only variables. This affected the veriexec
node entirely. Reported by Nino Dehne.
2005-06-15 16:58:31 +00:00
elad
8863b29522 Sync reality with comments. This makes strict level 1 work as expected.
Reported by Nino Dehne.
2005-06-14 21:55:21 +00:00
elad
ab99f231f8 Correctly handle the case of executing a 'FILE' entry. 2005-06-13 22:46:56 +00:00
elad
1e323dd70c Fix potential NULL pointer access. 2005-06-13 21:09:49 +00:00
elad
49d0a3504e Cosmetic change.. 2005-06-13 20:52:13 +00:00
elad
cbb4bd85d4 Oops - forgot to remove it in previous commit. Checking the fingerprint
status is enough here.
2005-06-13 20:23:15 +00:00
elad
da15a5a10c More veriexec refactoring.
- Use u_char for the fingerprint status.
  - Add a pointer to the vnode's veriexec hash table entry in the vnode
    struct. This saves a lookup and will also used by planned features.
  - When removing a file from the tables, set the vnode fingerprint status
    to NOENTRY.
  - Add switch to do flag-specific handling in veriexec_verify(). At the
    moment this prevents execution of FILE entries in strict level 2, but
    it will also be used by planned features.
  - Use memset() instead of bzero().
  - Various cosmetic changes.
2005-06-13 20:17:54 +00:00
christos
51b633d452 Remove an extraneous TTY_UNLOCK. With a LOCKDEBUG kernel, sending FLUSHO
causes a locking assertion.
2005-06-11 22:42:24 +00:00
elad
6533bc4abd Work according to veriexec strict level, not securelevel. Also, use the
veriexec_report() routine when possible; and when opening a file for writing,
only invalidate the fingerprint - not always the data will be changed.
2005-06-11 16:04:59 +00:00
elad
9cafbe15bc Use the defined VERIEXEC_DIRECT instead of the (incorrect) 0 magic number. 2005-06-10 23:32:16 +00:00
matt
e1245a3c46 Rework the coredump code to have no explicit knownledge of how coredump
i/o is done.  Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o.  This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.
2005-06-10 05:10:12 +00:00
atatat
420d91208b Properly fix the constipated lossage wrt -Wcast-qual and the sysctl
code.  I know it's not the prettiest code, but it seems to work rather
well in spite of itself.
2005-06-09 02:19:59 +00:00
scw
50d7457a5f Thou shalt not allocate PAGE_SIZE automatic variables on the kernel stack. 2005-06-08 07:25:12 +00:00
jdc
e0dc2d1568 Revert previous ('_ncpus' is now 'ncpus' again).
MI variable names have precedence.
2005-06-06 19:56:46 +00:00
yamt
11bfc2d8e1 introduce a macro to initialize uvm_object and use it. 2005-06-06 12:09:19 +00:00
martin
71d020f371 Since we decided "const struct mbuf *" would not do the right thing (tm),
remove ~all const from mbuf pointers.
2005-06-06 06:06:50 +00:00
martin
36c7f61f8f Constify the source arg of m_copydata 2005-06-06 04:50:28 +00:00
thorpej
b1a8db7e02 Use ANSI function decls. 2005-06-05 23:47:48 +00:00
thorpej
30fe14b30e Re-arrange slighty, eliminate prototypes that are unnecessary when using
ANSI function decls with "static".
2005-06-05 23:10:25 +00:00