Commit Graph

395 Commits

Author SHA1 Message Date
jdolecek 02eb342b57 Make sure that the pointer to old parent process for ptraced children
gets reset properly when the old parent exits before the child. A flag
is set in old parent process when the child is reparented in ptrace(2).
If it's set when process is exiting, all running processes have their
'old parent process' pointer checked and reset if appropriate. Also
change to use 'struct proc *' pointer directly, rather than pid_t.
This fixes security/14444 by David Sainty.

Reviewed by Christos Zoulas.
2002-07-25 20:04:02 +00:00
thorpej 011d4d5f44 Add kernel support for having userland provide the signal trampoline:
* struct sigacts gets a new sigact_sigdesc structure, which has the
  sigaction and the trampoline/version.  Version 0 means "legacy kernel
  provided trampoline".  Other versions are coordinated with machine-
  dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
  the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
  trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions.  Instead,
  sendsig() looks up the handler by peeking in the sigacts for the
  process getting the signal (since it has to look in there for the
  trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
  its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later.  Kernel
version not bumped; we will ride the 1.6C bump made recently.
2002-07-04 23:32:02 +00:00
eeh 84c049f196 Match the Solaris siginfo layout for _LP64. 2002-06-19 17:33:01 +00:00
eeh 8da818b968 __LP64__ -> _LP64 2002-05-03 01:34:48 +00:00
manu 78583a4567 Always define SA_SIGINFO, and keep track of it in SVR4 emulation. This is
needed for IRIX signal delivery.
Approved by Christos.
2002-04-12 17:37:30 +00:00
christos ac29fb3782 make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
2002-03-31 22:22:43 +00:00
jdolecek bbee4277ca fd_revoke(): don't assume that f_type other DTYPE_VNODE and DTYPE_SOCKET
is automatically bogus, make the code return EINVAL for all non-vnode
descriptors
2002-03-24 15:32:51 +00:00
christos e88e90e3bf use 64 signals. 2002-03-20 17:50:07 +00:00
manu 1c1ef56eed Cosmetic change (lines longer than 80 car) 2002-03-18 17:18:28 +00:00
christos 381e6a7764 make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
2002-03-16 20:43:48 +00:00
tv aa7e03f796 Handle MAP_ANON (0x100 in Solaris8, not 0x1000) properly, by factoring out
the flags common to SVR4 and NetBSD, and mapping the rest manually.
2002-02-07 23:22:24 +00:00
jdolecek 2ff8a38d00 nuke the #include "opt_compat_irix.h", too 2001-12-02 00:46:03 +00:00
christos 8fc71f4259 include ioctl_compat.h unconditionally. 2001-11-28 13:46:06 +00:00
manu 2f3a7bf5f8 Need to include <sys/ioctl_compat.h> to build this with COMPAT_IRIX.
Maybe this is needed for COMPAT_SVR4 too, I'm not sure.
2001-11-28 12:02:59 +00:00
jdolecek bf65eb50af add appropriate cast to debug printf 2001-11-18 13:29:29 +00:00
lukem 2565646230 don't need <sys/types.h> when including <sys/param.h> 2001-11-15 09:47:59 +00:00
lukem dab6ef8b56 add RCSIDs (including regeneration of files as appropriate) 2001-11-13 02:07:52 +00:00
christos 50a347501a compile in the absense of SYSVSHM and SYSVSEM. pointed out by @@@. 2001-11-11 21:21:02 +00:00
jdolecek ef8abe0767 Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
2001-09-18 19:36:32 +00:00
wiz c52d355d71 "wierd" is weird. 2001-08-20 12:20:01 +00:00
christos 934898bc32 Adjust to the new copyargs() footprint. 2001-07-29 21:28:45 +00:00
jdolecek 26d45c1101 Back off the sendit()/recvit() change, some have problems with it 2001-06-25 20:46:11 +00:00
jdolecek 7f7c60e827 Add 'kernsa' parameter for sendit()/recvit(); if nonzero, msg->msg_name
is supposed to point directly to struct mbuf or struct sockaddr in kernel
space as appropriate, rather than being a pointer to memory in userland.

This is to be used by compat/* when emulation needs to wrap
send{to|msg}(2)/recv{from|msg}(2) and modify the passed struct
sockaddr.
2001-06-25 19:24:02 +00:00
christos 0f380fac15 Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
2001-06-18 02:00:48 +00:00
manu ff5ce5bd93 Removed obsoletes EMUL_NO_BSD_ASYNCIO_PIPE and EMUL_NO_SIGIO_ON_READ flags.
Async I/O OS specifities should now handled in OS specific code. Linux
has been done, but other emulation should be handled. See case LINUX_F_SETFL
in sys/compat/linux/common/linux_file.c:linux_sys_fcntl() for more details.

The data that has been collected yet:

                                  Net Free Open Linux SunOS AIX OSF1 Darwin
send SIGIO to write end of pipe     Y  N    N     N     N    N   Y     Y
send SIGIO to read end of pipe      Y  Y    N     N     N    ?   Y     ?
send SIGIO to write end of socket   Y  Y    Y     N     N    Y   Y     Y
send SIGIO to read end of socket    Y  Y    Y     Y     Y    ?   Y     ?
2001-06-16 22:05:36 +00:00
thorpej 80cc38a1af Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads.  What we do is stick descriptors in the table, but
mark them as "larval".  This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again.  When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
2001-06-14 20:32:41 +00:00
mrg 0b7f4cf1ba avoid trigraphs 2001-06-08 12:50:11 +00:00
mrg 6a89288a37 use _KERNEL_OPT. 2001-05-30 11:37:21 +00:00
manu 7e6929fe90 Changed EMUL_BSD_ASYNCIO_PIPE to EMUL_NO_BSD_ASYNCIO_PIPE, so that
the native emulation (NetBSD) does not have a flag.
2001-05-07 09:55:12 +00:00
ross 6b9d94cd8c Fix overflow errors in brk(2). 2001-05-06 04:32:08 +00:00
jdolecek bb8ceadfcc Adapt to struct fileops, soo_stat() changes.
Pointed out by Bernd Ernesti in private mail.
2001-04-07 17:37:09 +00:00
chs ac3bc537bd eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS			0
KERN_INVALID_ADDRESS		EFAULT
KERN_PROTECTION_FAILURE		EACCES
KERN_NO_SPACE			ENOMEM
KERN_INVALID_ARGUMENT		EINVAL
KERN_FAILURE			various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE		ENOMEM
KERN_NOT_RECEIVER		<unused>
KERN_NO_ACCESS			<unused>
KERN_PAGES_LOCKED		<unused>
2001-03-15 06:10:32 +00:00
eeh a72ee87980 Add support for 64-bit SVR4 (Solaris 8) binaries. 2001-02-21 23:53:00 +00:00
jdolecek 522f569810 make some more constant arrays 'const' 2001-02-21 21:39:52 +00:00
eeh fb46d1eed4 Export bits needed by COMPAT_SVR4_32. 2001-02-11 01:16:42 +00:00
eeh c2a7dae9d2 Fix getuid() and getgid() to work like the Solaris ones. 2001-02-11 01:14:25 +00:00
eeh 7fd4c88055 Fix getuid() and getgid() calls to return both e[ug]id and r[ug]id. 2001-02-11 01:13:01 +00:00
thorpej 00d798f276 getpid(2) is MP-safe. 2001-01-27 07:59:58 +00:00
thorpej 1b6a66420e Regen; add sy_flags. 2001-01-27 07:23:06 +00:00
jdolecek e9e91a0fb5 split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
2000-12-22 22:58:52 +00:00
mycroft f495cd9dc6 Introduce 2 new flags in types.h:
* __HAVE_SYSCALL_INTERN.  If this is defined, e_syscall is replaced by
  e_syscall_intern, which is called at key places in the kernel.  This can be
  used to set a MD syscall handler pointer.  This obsoletes and replaces the
  *_HAS_SEPARATED_SYSCALL flags.
* __HAVE_MINIMAL_EMUL.  If this is defined, certain (deprecated) elements in
  struct emul are omitted.
2000-12-11 05:28:59 +00:00
jdolecek 8f9b01eba1 prototype svr4_syscall() (only) in compat/svr4/svr4_exec.c 2000-12-09 12:44:26 +00:00
jdolecek a6ca890142 always fill in e_syscall in respective emul_*; if the emulation doesn't
have it's own separated *_syscall() function, use syscall()
2000-12-09 12:38:23 +00:00
mycroft 77b46f5749 Oops; missed a critical #include. 2000-12-09 06:25:03 +00:00
mycroft 95bdfed457 Add hook for a separate svr4_syscall(). 2000-12-09 06:20:17 +00:00
mycroft 51e3b887d7 Regen. 2000-12-09 06:19:40 +00:00
mycroft e2743f72a9 Round up the sysent table size. 2000-12-09 06:15:42 +00:00
mycroft f348afacb9 Regen. 2000-12-09 05:37:01 +00:00
mycroft 9682cf0b09 Add the %% separators. 2000-12-09 05:27:28 +00:00
jdolecek 2ff42428df put elf32 specific code from svr4_exec.c to separate file svr4_exec_elf32.c 2000-12-01 19:26:26 +00:00