Commit Graph

4825 Commits

Author SHA1 Message Date
christos 0b7fa73e66 fix a stray \n 2006-08-12 21:46:03 +00:00
christos adddcaa6ee Fix the dump printing too. 2006-08-12 20:27:35 +00:00
christos f7cf5ff3b4 Only print the partition letter if the device supports partitions. 2006-08-12 19:58:55 +00:00
christos ce0ef6cfc4 Pretending to be Elad's keyboard:
fileassoc.diff adds a fileassoc_table_run() routine that allows you to
pass a callback to be called with every entry on a given mount.

veriexec.diff adds some raw device access policies: if raw disk is
opened at strict level 1, all fingerprints on this disk will be
invalidated as a safety measure. level 2 will not allow opening disk
for raw writing if we monitor it, and prevent raw writes to memory.
level 3 will not allow opening any disk for raw writing.

both update all relevant documentation.

veriexec concept is okay blymn@.
2006-08-11 19:17:47 +00:00
pavel fd456db2e7 MCLAIM the correct mbuf. PR kern/34162. 2006-08-08 15:53:40 +00:00
yamt 56d02ae53a vfs_copyinfh_alloc: kludge for nfsv2 file handles. 2006-08-08 13:08:08 +00:00
bjh21 47ef6bac03 Using humanize_number() on clock speeds does more harm than good, and
precious little of either.  Go back to displaying them with all their digits.
2006-08-06 13:29:42 +00:00
bjh21 fc39059504 Clock frequencies tend to be big numbers -- use humanize_number() when
displaying them through printf.
2006-08-05 21:59:40 +00:00
yamt ac0b9042bb sys___fhstatvfs140: update a comment. 2006-08-04 17:07:32 +00:00
yamt 4977b4bbc0 some filehandle syscall related changes.
- remove the support of variable-sized filehandle from compat version of
  syscalls.  (strictly speaking, it breaks abi.  i don't think it's a problem
  because this feature is short-lived and there are no affected in-tree
  filesystems.)
- unify vfs_copyinfh_alloc and vfs_copyinfh_alloc_size.
- vfs_copyinfh_alloc_size: check fhsize strictly.
- reduce code duplication between compat and current syscalls.
2006-08-04 16:29:51 +00:00
yamt e99f3cca81 vfs_copyinfh_alloc_size: fix indent. 2006-08-04 13:31:51 +00:00
christos cf3258890d PR/34129: Andreas Gustafsson: Nonblocking write to pty can return 0
If we cannot write on the slave side, always return EWOULDBLOCK in the
non-blocking case, because we don't know that the buffer we started
writing is actually in a system call boundary.
2006-08-03 22:51:05 +00:00
christos 740d87bac5 adjust resid in one more place. 2006-08-03 22:06:55 +00:00
christos 75300d10c2 don't drop characters that we've copied in when we block. 2006-08-03 22:03:18 +00:00
martin b4cb63a646 Make filehandles opaque to userland 2006-07-31 16:34:42 +00:00
martin f956f13e21 Step 1 to make filehandles completely opaque to userland 2006-07-31 16:32:51 +00:00
ad a0c8510a86 Single-thread updates to the process credential. 2006-07-30 21:58:11 +00:00
elad 5446ee0ef6 ugh.. more stuff that's overdue and should not be in 4.0: remove the
sysctl(9) flags CTLFLAG_READONLY[12]. luckily they're not documented
so it's only half regression.

only two knobs used them; proc.curproc.corename (check added in the
existing handler; its CTLFLAG_ANYWRITE, yay) and net.inet.ip.forwsrcrt,
that got its own handler now too.
2006-07-30 17:38:19 +00:00
christos 3358c957a3 PR/34094: Jorge Acereda: Kernel option KSTACK_CHECK_MAGIC doesn't build 2006-07-27 00:04:08 +00:00
elad 14171f6143 make the sleepable assertion in #if 0 (with commented out LOCKDEBUG for
later) until we sort that stuff out.
2006-07-26 17:13:26 +00:00
elad ebdd7412b5 sync kpi with docs, remove old comments 2006-07-26 16:34:07 +00:00
elad 22e1a583a2 fix logic in veriexec_report() 2006-07-26 15:14:24 +00:00
dogcow c959b3c4bd at the request of elad, as veriexec.h has returned, revert the changes
from 2006-07-25.
2006-07-26 09:33:57 +00:00
dogcow cc44d2fe07 mechanically go through and
s,include "veriexec.h",include <sys/verified_exec.h>,
as the former has apparently gone away.
2006-07-25 00:23:06 +00:00
elad 05eb39fb84 replace magic numbers for strict levels (0-3) with defines. 2006-07-24 21:32:39 +00:00
elad 32e391d158 finally do things properly. veriexec_report() takes flags, not three ints. 2006-07-24 21:15:05 +00:00
elad 5d611badde some fixes:
- adapt to NVERIEXEC in init_sysctl.c.
  - we now need "veriexec.h" for NVERIEXEC.
  - "opt_verified_exec.h" -> "opt_veriexec.h", and include it only where
    it is needed.
2006-07-24 16:37:28 +00:00
elad 93a2eaef51 prevent removal of monitored files as early as ids mode.
okay blymn@
2006-07-24 16:27:15 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
elad e2706baefd kill a VOP_GETATTR() we don't need for veriexec. 2006-07-22 10:40:49 +00:00
elad a92c1615a4 deprecate the VERIFIED_EXEC option; now we only need the pseudo-device to
enable it. while here, some config file tweaks.

tons of input from cube@ (thanks!) and okay blymn@.
2006-07-22 10:34:26 +00:00
elad 7e7591e119 if LOCKDEBUG, assert that we can sleep in kauth_authorize_action().
discussed with yamt@ on tech-kern.
2006-07-22 09:24:25 +00:00
yamt 13170f18a9 assert_sleepable: panic if curlwp == NULL. 2006-07-21 10:22:51 +00:00
yamt 696edc2b76 use ASSERT_SLEEPABLE where appropriate. 2006-07-21 10:08:41 +00:00
yamt 9862c5bef2 add ASSERT_SLEEPABLE() macro to assert we can sleep. 2006-07-21 10:07:29 +00:00
christos cb6bd87d8a PR/34043: mrt at notwork dot org: 3.99.22 kernel crashes at *_vptofh() called
from vfs_composefh_alloc() due to uninitialized "fidsize".
2006-07-20 16:18:14 +00:00
cube 2d03dc4c3e Fix an obvious overlook (struct fileassoc_hook is not defined in
fileassoc.h anymore).  I could say "please compile-test", but then, I'm not
doing it either for that commit.
2006-07-20 09:00:41 +00:00
ad fe65535924 Try again.. Move l_cred into the startzero section, and fix the define.
Doesn't change the layout of struct lwp.
2006-07-20 00:17:10 +00:00
ad 2b79369c7e - Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.
2006-07-19 21:11:37 +00:00
blymn 36c3e07ffa Add destination file vnode to rename checking. 2006-07-19 12:45:19 +00:00
elad 8ee43586ab move the fileassoc_delete_file() call above the VOP_REMOVE() one, yamt@
says vp might not be valid after it.
2006-07-17 19:05:36 +00:00
ad e7447d9340 - Always make p->p_cred a private copy before modifying.
- Share credentials among processes when forking.
2006-07-17 15:29:06 +00:00
ad 16fc727817 Just use proc0.p_cred where root credentials are needed, instead of
allocating a new kauth_cred_t.
2006-07-17 14:49:16 +00:00
ad 2af3d29e01 - Don't cast kauth_cred_t to (struct ucred *), just set pc_ucred = NULL.
- Fill ucred::cr_ref.
2006-07-17 14:47:02 +00:00
ad 55a5faa1ef - Only acquire cr_lock when changing cr_refcnt.
- When freeing, test the value of cr_refcnt from inside the lock perimiter.
- Change some uint16_t/uint32_t types to u_int.
- KASSERT(cr_refcnt > 0) in appropriate places.
- KASSERT(cr_refcnt == 1) when changing the credential.
2006-07-17 14:37:20 +00:00
elad d4410e6fde CURTAIN() -> KAUTH_GENERIC_CANSEE. 2006-07-16 20:21:42 +00:00
elad d9a7152c3e add KAUTH_GENERIC_CANSEE, which is like the KAUTH_PROCESS_CANSEE, only
for two kauth_cred_t rather than kauth_cred_t and struct proc *.

advise against using it in the man-page; it should be used only in cases
where we either don't have an object-specific op or when we can't easily
use one.
2006-07-16 20:10:11 +00:00
elad 9be7229906 expose less api; prompted by yamt@. 2006-07-16 19:37:55 +00:00
kardel e804524e26 fix another t{s,v}tohz() fallout (invalid remaining time)
now passes regression/sys/kern/sleeping
2006-07-16 19:23:11 +00:00
elad c6d34abf63 oops, forgot to commit that one. thanks Arnaud Lacombe. 2006-07-16 18:49:29 +00:00
elad 4f60437127 minor api cleanup, and remove useless VOP_GETATTR() calls. 2006-07-15 20:07:36 +00:00
elad a904c6895a update my email on the copyright to @netbsd.org 2006-07-15 16:48:51 +00:00
elad a890e27076 move veriexec_clear() from dev/verified_exec.c to kern/kern_verifiedexec.c 2006-07-15 16:43:35 +00:00
elad e3f6ad54bf dont use magic numbers. 2006-07-15 16:42:12 +00:00
elad 904a157292 some cleanup and fixes:
- fix possible panic and vfs refcnt issue
  - use log(9) instead of printf(9) where possible
  - indent
  - stop logging fsid/fileid
2006-07-15 16:33:16 +00:00
martin 631d071e84 FHANDLE_SIZE_MIN is an allowed value for the requested size (it happens
to be the old static size on 32bit archs, so the compat_30 code uses it)
2006-07-15 16:32:29 +00:00
yamt 73f44d02f7 do_setresuid, do_setresgid: use the suser privilege only when necessary. 2006-07-15 06:31:34 +00:00
yamt bfe8806772 kauth_cred_setgroups: fix an assertion. 2006-07-15 05:54:56 +00:00
kardel 7e5391a22a rename boottimebin to timebasebin as this
struct actually keeps the start of the UTC
time scale and not the boot time. the relationship
is: utc-time = up-time + timebase.
background: when doing an ACPI sleep the uptime
freezes and on wakeup the tc_setclock() leads to
a new timebasebin - this had no relationship with
a boottime as the structure was previously called.

discussed on tech-kern@
anomalies (moving boottime, uptime describing running time)
where discovered by Arnaud Lacombe.
2006-07-14 23:01:12 +00:00
kardel 97b1c42feb keep NetBSD boottime semantics:
- only set at boot
- only tracking delta of set-time operations
-> will keep boottime stable across ACPI sleeps
   uptime(1) will report the time since last boot
2006-07-14 22:44:28 +00:00
kardel 9a7410ffff reduce sleep time by slept time for retrys 2006-07-14 22:35:15 +00:00
kardel ac3f10a8d9 make inittimeleft() and gettimeleft() available (for e. g. kern_event.c) 2006-07-14 22:33:27 +00:00
elad 1c8d298b89 move security.setid_core.* to kern.coredump.setid.*, as requested by yamt@. 2006-07-14 21:55:19 +00:00
elad b5d09ef065 okay, since there was no way to divide this to two commits, here it goes..
introduce fileassoc(9), a kernel interface for associating meta-data with
files using in-kernel memory. this is very similar to what we had in
veriexec till now, only abstracted so it can be used more easily by more
consumers.

this also prompted the redesign of the interface, making it work on vnodes
and mounts and not directly on devices and inodes. internally, we still
use file-id but that's gonna change soon... the interface will remain
consistent.

as a result, veriexec went under some heavy changes to conform to the new
interface. since we no longer use device numbers to identify file-systems,
the veriexec sysctl stuff changed too: kern.veriexec.count.dev_N is now
kern.veriexec.tableN.* where 'N' is NOT the device number but rather a
way to distinguish several mounts.

also worth noting is the plugging of unmount/delete operations
wrt/fileassoc and veriexec.

tons of input from yamt@, wrstuden@, martin@, and christos@.
2006-07-14 18:41:40 +00:00
yamt a1c2fd0906 introduce filehandle size limits:
- FHANDLE_SIZE_MAX: refuse unreasonable size allocation, esp. when
  it's a user-specified value.

- FHANDLE_SIZE_MIN: pad small filehandles with zero for compatibility.
  XXX it might be better to push this into filesystem dependent code so that
  new filesystems can choose smaller handles.
2006-07-14 18:30:35 +00:00
yamt cf80fa09d3 - sys___getfh30:
- restructure code so that it doesn't try to allocate user-specified
	  unbound amount of memory.
	- don't ignore copyout failure in the case of E2BIG.
- rename vfs_copyinfh to vfs_copyinfh_alloc for consistency.
2006-07-14 18:29:40 +00:00
christos a2f707bc1b factor out common code. 2006-07-14 16:02:45 +00:00
yamt 2d1ef0388d - fix buffer overruns in fhopen and friends.
- share some code among them.
2006-07-14 15:59:29 +00:00
christos 199b3952c8 - rename sleepts to sleeptv since it is a timeval.
- don't initialize it needlessly.
- fix the poll code the same way the select code was fixed, so that it
  computes the remaining time to sleep properly.
2006-07-14 15:52:44 +00:00
yamt e221f55a3b sys___getfh30: fix a vnode lock botch in rev.1.244. 2006-07-14 14:28:58 +00:00
yamt 387e1097ba sys___getfh30: remove unnecessary casts. 2006-07-14 14:00:46 +00:00
pavel a360a47f63 regenerate again to have correct source RCS Id 2006-07-13 23:26:24 +00:00
martin edf136d748 fix typo 2006-07-13 21:51:50 +00:00
martin a3b5baed42 Fix alignement problems for fhandle_t, exposed by gcc4.1.
While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
2006-07-13 12:00:24 +00:00
blymn af4af92111 Fix behaviour of files with no signatures on exec. 2006-07-09 10:13:53 +00:00
kardel b36308b48b when adjusting the left over timeout value in selcommon()
do actually subtract the elapsed time instead of adding it.
2006-07-08 16:01:25 +00:00
kardel e472b9091e fix a bug reported by Steven M. Bellovin regarding oversleeping
select(2) timeouts. Introduced via timecounter branch from a
tvtohz() conversion.
The left over timeout was not decremented when re-starting
the sleep in select.
2006-07-08 12:16:09 +00:00
kardel d788cc37f6 report true clock resolution based on the frequency information
from the underlying counter in clock_getres(). For frequencies
above 1GHz report a resolution if 1 nsec.
2006-07-08 12:10:33 +00:00
yamt d9530c47ba add DEBUG code to detect modifications on free memory. 2006-07-08 06:01:53 +00:00
matt 34b5f92bac Don't define bpendtsleep on vax (gcc4 optimizer will duplicate the asm
that contains it result in a multiple symbol definition in gas).
2006-07-08 00:23:29 +00:00
drochner 8c61e0077d Request executable memory for LKM code/data areas. This fixes LKMs
on alpha (which were broken for more than a year appearently and noone
noticed). (The other archs didn't suffer because their pmap_kenter_pa()
doesn't support non-executable mappings.)
2006-07-05 14:31:00 +00:00
yamt d145ea66dc change KMEM_QUANTUM_SIZE from sizeof(void *) to (ALIGNBYTES + 1).
the latter is larger on eg. sparc.

noted by Christos Zoulas.
http://mail-index.NetBSD.org/port-sparc/2006/07/02/0001.html
2006-07-03 09:18:35 +00:00
christos 2f4b451441 Make sure we have at least PIPE_BUF bytes available in the socket send buffer.
Review and comment by yamt.
2006-07-03 02:34:39 +00:00
christos 5f5ceecc09 Revert previous change to bump the socket low watermark to sock_loan_thresh.
With sock_loan_thresh=4096, sb_lowat==sb_hiwat, and sowritable will never
be true (even if only a single byte is pending). Some programs (like screen)
expect select() to return that a socket is writable on a socket when there
is space to write to it. XXX: What is the right thing to do here?
2006-07-01 15:38:28 +00:00
kardel 6dc2fb00a7 L_CLR(time_adj) each round so adjtime() corrections don't
accumulate over time resulting in a constantly speeding/
slowing clock. found with wiz@ in a timecounter non NTP
kernel configuration.
2006-07-01 05:44:26 +00:00
kardel 596d823cde always call ntp initialisation for timecounter systems as
the ntp code degenerates to the adjtime implementation in the
non NTP case
2006-07-01 05:41:10 +00:00
mrg 1b7ff51599 regenerate. 2006-06-26 21:30:50 +00:00
mrg e2eb31d3a3 version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
2006-06-26 21:23:56 +00:00
yamt ffa1c23e58 fix VM_BESTFIT. 2006-06-26 10:23:20 +00:00
yamt 9595f19850 wrap long lines. 2006-06-26 10:21:59 +00:00
yamt a3b2d62857 sa_stackused, sa_setstackfree: share some common code. 2006-06-26 10:21:34 +00:00
yamt f374633f81 remove some unnecessary casts. 2006-06-25 08:13:28 +00:00
yamt 0fca5c447b move SA related pools to where they are used. make them static. 2006-06-25 08:12:54 +00:00
yamt 44c017beb2 sa_makeupcalls: don't leak kernel stack garbage to userland. 2006-06-25 08:12:10 +00:00
yamt 8308eb1f7a implement kmem_zalloc. 2006-06-25 08:10:04 +00:00
yamt 23fcb7c3d3 sa_makeupcalls: cleanup usage of sae_sacopyout. 2006-06-25 08:09:10 +00:00
yamt d038c11b60 sa_makeupcalls: simplify code and fix an sau leak on error. 2006-06-25 08:08:13 +00:00
yamt 5df39bb5be sa_makeupcalls: don't allocate big structures on stack. 2006-06-25 08:05:36 +00:00
yamt bc4977819f 1. implement solaris-like vmem. (still primitive, though)
2. implement solaris-like kmem_alloc/free api, using #1.
   (note: this implementation is backed by kernel_map, thus can't be
   used from interrupt context.)
2006-06-25 08:00:01 +00:00
yamt 6108244889 remove unused M_SA. 2006-06-25 07:46:39 +00:00