Commit Graph

42 Commits

Author SHA1 Message Date
christos 31c81b28f5 Cloning cleanup:
1. make fileops const
2. add 2 new negative errno's to `officially' support the cloning hack:
    - EDUPFD (used to overload ENODEV)
    - EMOVEFD (used to overload ENXIO)
3. Created an fdclone() function to encapsulate the operations needed for
   EMOVEFD, and made all cloners use it.
4. Centralize the local noop/badop fileops functions to:
   fnullop_fcntl, fnullop_poll, fnullop_kqfilter, fbadop_stat
2004-11-30 04:25:43 +00:00
thorpej 29671d6616 Fix the fcntl entry points; cmd is a command, not the flags themselves.
Pointed out by Christos (he wrote the broken code originally, and I copied
it to another file later :-)
2004-11-28 07:44:05 +00:00
christos 19c4641ff8 (off_t)(long) is wrong when it comes to kernel addresses [because on a 32 bit
machine if the high bit is set they turn negative]. Make an intermediate cast
to unsigned long.
2004-05-26 16:28:05 +00:00
simonb b5d0e6bf06 Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.
2004-04-25 16:42:40 +00:00
provos 2e7c8ca97f check process flags, noted by Stefan Esser 2004-04-09 16:49:33 +00:00
cl f1bacc8b38 disable SA upcalls during "systrmsg" sleep
-> improves problem from PR bin/23429
2004-03-14 00:48:58 +00:00
mrg 23884e8622 clean up a little:
- delete ktrsyscall32()
- add a check #ifdef _LP64 to do the conversion if P_32 is set to the
standard ktrsyscall()
- add a couple of similar _LP64/P_32 checks to the systrace code.

this should get systrace working for 32 bit apps as well as complete
ktrace support for "trace_enter/trace_exit" using platforms such as amd64.

XXX: systrace isn't supported on sparc64 currently... (it doesn't use
trace_enter/trace_exit, or have it's own calls to systrace_xxx()...)
2004-01-16 05:03:02 +00:00
wiz 0aca09fbc0 Fix two typos. From Tom Cosgrove via jmc@openbsd. 2003-11-02 09:49:20 +00:00
simonb 6d85c5e0d5 Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.
2003-10-31 03:28:12 +00:00
simonb b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
jdolecek a034152027 move dupfd from struct proc to struct lwp - it's per-LWP, not per-process; we
use curlwp where the lwp is not directly available, i.e. in device open
routines

briefly discussed on tech-kern
2003-09-13 08:32:10 +00:00
cb 5f734a1850 fix a race condition between path resolution in userland
and the subsequent namei(): inform the kernel portion of
valid filenames and then disallow symlink lookups for
those filenames by means of a hook in namei().
with suggestions from provos@

also, add (currently unused) seqnr field to struct
systrace_replace, from provos@
2003-08-25 09:12:42 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
provos f858b1eac4 allow the kernel to free policies for users; kernel informs userland
which policy has been freed;  replacement is LRU
2003-06-03 05:24:00 +00:00
provos 14ea3a1c62 better performance for fast path; simplify for future lwp support. 2003-04-20 20:30:34 +00:00
provos cb0252af40 avoid a panic due to recent changes in kern_fork.c; prepare for lwp by
keeping messages independent of the process itself
2003-03-30 00:40:05 +00:00
dsl 60418b39b7 Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
2003-03-21 21:13:50 +00:00
provos 9a5e533a1a do not demand LLSLEEP in p_stat; this does not seem to happen with lwps;
todo: a proper fix that takes lwps into consideration
2003-02-16 20:24:47 +00:00
thorpej e0d8d366df Merge the nathanw_sa branch. 2003-01-18 10:06:22 +00:00
scw 0f91ed3dfa Quell uninitialised variable warnings. 2002-11-24 11:37:54 +00:00
fvdl d0e6437e6d Back out previous, it caused compile errors in kern_fork.c. ISSET
and friends should either be made first-class citizens and moved
to an include file (systm.h perhaps), or nuked completely, but
not be redefined in a lot of files.
2002-11-10 14:01:57 +00:00
jdolecek 0a0804119d move definitions of custom SET()/ISSET()/CLR() macros from
sys/systrace.h to kern/kern_systrace.c
2002-11-10 10:01:03 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
provos 61e8c76047 support for privilege elevation.
with privilege elevation no suid or sgid binaries are necessary any
longer.  Applications can be executed completely unprivileged. Systrace
raises the privileges for a single system call depending on the
configured policy.

Idea from discussions with Perry Metzger, Dug Song and Marcus Watts.
Approved by christos and thorpej.
2002-10-11 21:54:55 +00:00
provos a8909a2b8b new message to track uid/gid changes 2002-10-08 14:46:24 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
itojun 6e85b03958 reduce diff w/ openbsd 2002-08-28 03:40:54 +00:00
scw 41e5042829 Pointers must be cast to {,u}intptr_t before they can be cast to register_t,
at least on sh5, where sizeof(register_t) != sizeof(void *) in ILP32 mode.
2002-08-26 11:26:09 +00:00
itojun f3f3dd4992 cast register_t/size_t to u_long on printing.
From: Havard Eidnes <he@netbsd.org>
2002-08-08 14:43:40 +00:00
itojun f35b1daee4 remove debugging code leftover 2002-08-08 14:38:47 +00:00
itojun 4f0c9c76b6 sync up with latest openbsd systrace.
- avoid race conditions by having seqno in ioctl
- better uid/gid tracking
- "replace" policy to replace args
- less diffs, as many of local changes were fed back to openbsd already

due to the 1st item, it was impossible for us to provide backward-compatibility
(new kernel + old bin/systrace won't work).  upgrade both.
2002-07-30 16:29:28 +00:00
itojun 7f9bb4693b missing systrace_lock() around lock operation. sync w/openbsd, provos ok 2002-07-21 00:25:01 +00:00
itojun 09168838b3 comment clarification. from openbsd 2002-07-20 00:03:08 +00:00
itojun 9aa540391b add missing systrace_{un,}lock in systrace_poll. reported to provos.
don't use MALLOC() with variable size.  from openbsd.
2002-07-19 23:55:01 +00:00
christos 100356d547 remove __GNUC__ lossage. 2002-07-16 19:53:37 +00:00
thorpej 64a96a4664 Rename DTYPE_SYSTRACE to DTYPE_MISC. DTYPE_MISC can now be used by
any misc. pseudo-device which requires cloning semantics.
2002-07-16 16:40:55 +00:00
thorpej 11bb3d047b Avoid NULL pointer dereference. kern/17438, xs@kittenz.org. 2002-07-02 16:22:28 +00:00
thorpej f055878614 Fix using poll(2) on systrace descriptors. 2002-07-02 16:16:33 +00:00
christos c96f693db0 PR/17407: Jim Wise: Systrace does not work without procfs.
FIX: use process_domem as thorpej suggested.
2002-06-27 13:22:54 +00:00
thorpej 5cbb1e82f1 * Don't bother protecting the body of the source file with #ifdef SYSTRACE.
It's not even built if the option isn't present.
* Use cdev_decl() to generate prototypes for the devsw functions.
* Minor whitespace cleanup.
* Nuke the SYSTR_CLONE ioctl from orbit; instead, just clone it in
  systraceopen(), like we do with svr4_net.
2002-06-18 01:24:15 +00:00
christos acf2d4083d Niels Provos systrace work, ported to NetBSD by kittenz and reworked... 2002-06-17 16:22:50 +00:00