Commit Graph

4341 Commits

Author SHA1 Message Date
elad 2de72bfe34 Various fixes from blymn@ and myself.
Also, put genfs changes under #if 0, and don't do per-page fingerprints
until this is properly discussed, as requested by yamt@.
2005-10-07 18:07:46 +00:00
simonb 4beb6d8640 Add a hack to deal with MIPS relocatable shared-linker problem on
COMPAT_16 and earlier that results in a current shared linker running at
address 0 (and thus allows NULL pointer derefs to work).

As noted by Matthias Drochner, this "fix" just checks the first psection
and not the first loadable psection.  This isn't a problem with the
binutils up to now, but might be in the future.
2005-10-07 08:33:10 +00:00
yamt 2975f576b9 uninline scheduler hooks. 2005-10-06 07:02:13 +00:00
elad 314759431d Don't forget to unmap memory once we're done with it.
Pointed out by yamt@.
2005-10-05 16:21:46 +00:00
elad 4daa338c1a Don't use static variables here.
Pointed out by yamt@.
2005-10-05 15:59:31 +00:00
yamt d6d16da423 remove a redundant assignment in the previous. 2005-10-05 15:46:00 +00:00
elad 8fc0d7a9c3 Introduce per-page fingerprints in Veriexec.
This closes a hole pointed out by Thor Lancelot Simon on tech-kern ~3
years ago.

The problem was with running binaries from remote storage, where our
kernel (and Veriexec) has no control over any changes to files.

An attacker could, after the fingerprint has been verified and
program loaded to memory, inject malicious code into the backing
store on the remote storage, followed by a forced flush, causing
a page-in of the malicious data from backing store, bypassing
integrity checks.

Initial implementation by Brett Lymn.
2005-10-05 13:48:48 +00:00
mrg 8b78edeb42 fix a bug pointed out by der mouse on tech-kern: in F_GETOWN, use a
pointer to a temporary "int" variable to pass to fo_ioctl(TIOCGPGRP), not
a register_t pointer.  (how did F_GETOWN ever work on sparc64 before?)
2005-10-03 02:06:00 +00:00
chs 7c02feca68 avoid calling into the pool code while holding sched_lock
since both pool_get() and pool_put() can call wakeup().
instead, allocate the struct sadata_upcall before taking
sched_lock in mi_switch() and free it after releasing sched_lock.

clean up some modularity warts by adding a callback to
struct sadata_upcall for freeing sa_arg.
2005-10-02 17:51:27 +00:00
chs 9c47d944e4 optimize pool_caches similarly to how I optimized pools before:
split the single list of pool cache groups into three lists:
completely full, partially full, and completely empty.
use LIST instead of TAILQ where appropriate.
2005-10-02 17:29:31 +00:00
jdolecek 05a8b02adf log when traced process is orphaned
PR: 17388 by Greg A. Woods
2005-10-01 21:07:38 +00:00
yamt 163be2ac64 change_utimes: use nanotime(9) rather than time(9). 2005-10-01 06:13:42 +00:00
yamt f615d37667 simplify lwp exit code. 2005-10-01 06:12:44 +00:00
christos 2cbe95f3ac Regen. 2005-09-26 03:04:46 +00:00
christos 65a3ca6215 some of the extattr syscalls return ssize_t not int. 2005-09-26 03:02:19 +00:00
jmmv 3955cf65f9 Add some COMPAT_30 code to let old mountd binaries work after the NFS
exports rototill.
2005-09-25 21:57:40 +00:00
isaki ff87e380de Correct typo in a comment. ok'ed by wiz@. 2005-09-25 12:50:14 +00:00
jmmv 2a3e5eeb7c Apply the NFS exports list rototill patch:
- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
  function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
  file sys/nfs/nfs_export.c.  The former was becoming large and its code
  is always compiled, regardless of the build options.  Using the latter,
  the code is only compiled in when NFSSERVER is enabled.  While doing this,
  also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
  path and a set of export entries.  At the moment it can only clear the
  exports list or append entries, one by one, but it is done in a way that
  allows setting the whole set of entries atomically in the future (see the
  comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
  that it becomes file system agnostic.  In fact, all this whole thing was
  done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
  exports initialization; done internally by the kernel when initializing
  the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
  subsystems can run arbitrary code upon receipt of specific VFS events.
  At the moment, this only provides support for unmount and is used to
  destroy NFS exports lists from the file systems being unmounted, though it
  has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
2005-09-23 12:10:31 +00:00
yamt a0093a4cf5 uninline vn_start_write and vn_finished_write as they are big enough. 2005-09-20 09:49:01 +00:00
christos 238c109f03 move compat code to the compat tree. 2005-09-13 01:45:14 +00:00
christos 291ee3d215 Introduced nanotime() which is going to be used by some fs code yet to
be committed. This should really be an MD routine and microtime should
be implemented from it, not the opposite (which is what we have now).
2005-09-12 16:21:31 +00:00
christos 74051a244a PR/27185: Christian Biere: kqueue: EOF on pipe gains no EVFILT_READ event
Set the PIPE_EOF flag before we wakeup() our peer. While here GC unused
argument from pipeselwakeup() and call it even when fp == NULL.
2005-09-11 17:55:26 +00:00
drochner 241cff4694 make use of the locator information: print "?" if a locator is
at its default value, and accept "?" in the "change" command
2005-09-08 14:58:14 +00:00
christos a531e09eeb Revert incomplete (and possibly incorrect) sys_sa_preempt implementation
that I committed accidentally with the 64 bit inode changes.
2005-09-07 23:31:06 +00:00
elad d1e2d78dee Use ``l'' and not ``curlwp''. Thanks to Peter Postma for catching this. 2005-09-07 18:06:04 +00:00
elad fb3e9eee95 Implement curtain for AF_LOCAL PCB lists. 2005-09-07 17:38:44 +00:00
elad bc433a82fb Implement curtain in KERN_{PROC,PROC2,FILE,FILE2,PROC_ARGS}.
While I'm here, disable curtain by default.
2005-09-07 17:30:07 +00:00
elad ec14f2d11e Introduce ``security.curtain'', new node for security features and
settings, and new variable for controlling access to objects based
on user-id.
2005-09-07 16:26:15 +00:00
rpaulo f305bcafe3 Implement kern.hardclock_ticks. 2005-09-06 02:36:17 +00:00
yamt af9e3184f8 prevent sa_setconcurrency before sa_enable, rather than crashing.
(savp_lwp is still null at that point.)

noted by skrueger at meinberlikomm.de.
2005-09-05 21:52:38 +00:00
martin 6dd6a3eb59 In adjust_rights() Use CMSG_SPACE() to calculate the number of
filedescriptors passed in this message - the counterpart in
unp_externalize does this as well.

Note that CMSG_SPACE(0) does not make sense, since it does not invoke
the alignment magic - so use CMSG_SPACE(sizeof(int)) and adjust the
calculated total later.

This fixes the postfix conection cache for 64bit platforms. Previously
the number of passed filed descriptors (nfds) would have been
calculeted too high, causing the fdrelease() of uninitialized junk.
2005-09-03 22:48:35 +00:00
martin f435538d40 minor knf tweak 2005-09-03 19:44:20 +00:00
rillig aede7f6775 Made the code of the grsortu function smaller and simpler. Ok'ed by
christos.
2005-09-02 20:51:53 +00:00
elad b0e6e3b381 Sync comments with 64-bit inode changes. 2005-09-02 14:16:50 +00:00
jmmv b077bb7f72 Honor the user's umask while creating local sockets. Several other systems
do already this (such as FreeBSD, OpenBSD and Linux), so it will improve
portability of some third-party programs.  No objections in tech-kern@.
2005-08-30 15:03:04 +00:00
jmmv 0562a5484c Make all creation operations (mkdir, create, mknod and symlink) consistent
by changing the symlink one to set vap's vatype to VLNK.  All the other three
already set vatype to the correct type.  Note that, however, in the mkdir
case (and now symlink too) this is not strictly necessary.
2005-08-30 09:37:41 +00:00
drochner a45a6c9839 in mapply(), call config_match() instead duplicating its code 2005-08-29 19:13:48 +00:00
reinoud f4a3f04cb2 Create functions ioctl_copyin() and ioctl_copyout(). They are meant to be
used in ioctl routines to do the right thing when the FKIOCTL flag is
passed to the IOCTL routine indicating its a in-kernel VOP_IOCTL call and
indirect addresses provided in the arguments are to be seen as kernel
adresses rather than userland adresses.

A simple substitution and prepending of the `flags' passed on to the ioctl
handler is enough to DTRT.
2005-08-28 20:58:14 +00:00
yamt 9020ca379a protect p_nrlwps by sched_lock. no objection on tech-kern@. PR/29652. 2005-08-28 14:57:18 +00:00
drochner f557755d9f nuke locdesc_t from orbit 2005-08-26 14:20:40 +00:00
drochner 90c378642f now that we have information about default locator values
we can implement an universal submatch() function covering all
the standard cases:
if (<configured> != <wildcard> && <configured> != <real>)
	then fail
else
	ask device match function
2005-08-25 22:17:19 +00:00
drochner fa3cb84d62 replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
2005-08-25 18:35:38 +00:00
drochner 6036af9fc4 Replace the "locnames", attached to cfdata, which was solely good for
userconf, by more complete information (including default values) about
interface attributes, attached to the drivers which provide them.
2005-08-25 15:06:28 +00:00
simonb fbcb9c4760 Fix a tyop in a comment. 2005-08-24 16:00:54 +00:00
christos 62ea392e41 in setgroups(), sort -u the gid_t array to make sure that comparisons are
consistent.
2005-08-23 07:58:58 +00:00
rillig 20f0c3a484 Bugfix: In crcmp, compare n group IDs instead of only n bytes.
Added a big FIXME because two group lists containing the same entries,
but ordered differently, still compare as unequal. The same holds if one
group list contains an entry twice while the other does not. ok'ed by
christos.
2005-08-22 15:10:50 +00:00
yamt ebfab35576 old_sysctl: fix null dereference when oldlenp == NULL. 2005-08-21 13:14:54 +00:00
yamt 6f645a09cb introduce a variant of disk_attach/detach, for pseudo disks
which is opened by user before being attached.
2005-08-20 12:00:01 +00:00
christos b33f6da979 more 64 bit inode lossage. 2005-08-19 16:58:29 +00:00
elad 5f794fb20d Introduce veriexec_renamechk().
Rename policy:
  - Strict levels 0, 1: Log renames of monitored files.
  - Strict level 2: Prevent renames of monitored files.
  - Strict level 3: Prevent renames.
2005-08-19 12:30:02 +00:00