Commit Graph

959 Commits

Author SHA1 Message Date
chs
939df36e55 add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default.  the changes
fall into two basic catagories:

 - pmap and trap-handler changes.  these are all MD:
   = alpha: we already track per-page execute permission with the (software)
	PG_EXEC bit, so just have the trap handler pay attention to it.
   = i386: use a new GDT segment for %cs for processes that have no
	executable mappings above a certain threshold (currently the
	bottom of the stack).  track per-page execute permission with
	the last unused PTE bit.
   = powerpc/ibm4xx: just use the hardware exec bit.
   = powerpc/oea: we already track per-page exec bits, but the hardware only
	implements non-exec mappings at the segment level.  so track the
	number of executable mappings in each segment and turn on the no-exec
	segment bit iff the count is 0.  adjust the trap handler to deal.
   = sparc (sun4m): fix our use of the hardware protection bits.
	fix the trap handler to recognize text faults.
   = sparc64: split the existing unified TSB into data and instruction TSBs,
	and only load TTEs into the appropriate TSB(s) for the permissions.
	fix the trap handler to check for execute permission.
   = not yet implemented: amd64, hppa, sh5

 - changes in all the emulations that put a signal trampoline on the stack.
   instead, we now put the trampoline into a uvm_aobj and map that into
   the process separately.

originally from openbsd, adapted for netbsd by me.
2003-08-24 17:52:28 +00:00
dsl
dc46f864d1 Hide prototype of linux_exec_setup_stack() inside #ifdef _KERNEL so
that sbin/sysctl will compile.
2003-08-21 15:08:25 +00:00
hannken
1a2d1be737 Fix syscall_vm86 argument:
struct trapframe -> struct trapframe *
2003-08-21 08:36:56 +00:00
christos
329946a58b remove the args from the macro. 2003-08-14 02:17:07 +00:00
jdolecek
c336185a31 regen - added wrapper for Linux ftruncate64() 2003-08-10 20:17:21 +00:00
jdolecek
94b152275c add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation

Problem found and patch supplied in PR kern/22360 by Ales Krenek

This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
2003-08-10 20:16:20 +00:00
jdolecek
64bb562b50 fix linux_sys_p{read|write}() to actually call correct syscall after
arg massage, i.e. sys_p{read|write} as appropriate; up to now, the functions
called sys_{read|write}() by mistake
2003-08-09 17:11:51 +00:00
christos
36e09d1a2c Explain a diagnostic message a bit better, and make it a debug only message. 2003-08-09 14:16:44 +00:00
christos
3b9c3c5aab - GC all the setup_stack functions
- add one for linux/i386
2003-08-08 18:57:01 +00:00
christos
6f1990af06 Conditionally declare function that is not used all the time. 2003-08-08 18:55:26 +00:00
agc
aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
jdolecek
d6ade97eb9 use copyout() instead of subyte() 2003-08-02 20:23:48 +00:00
jdolecek
e0fe42681d use copyin()/copyout() instead of fubyte()/subyte()
also nuke uvm_useracc() check, copyin()/copyout() do this atomically

XXX only compile-tested
2003-08-02 19:51:23 +00:00
jdolecek
16b74086ed replace fuword() with copyin(), and suword() with copyout() 2003-08-02 19:21:48 +00:00
jdolecek
a2d0517af5 More complete sendmsg(2) and recvmsg(2) emulation:
* translate MSG_* flags
* rewrite CMSG level/type to appropriate NetBSD value on input, and to Linux
  value on output
* handle different CMSG_DATA alignment for some archs

This fixes SCM_RIGHTS passing. Other SCM_* types are not supported -
the set is different on NetBSD and Linux. SCM_TIMESTAMP doesn't seem
to be actually implemented in Linux 2.5.15, so it's not supported
for Linux binaries either (for now).

PR: 21577 by Todd Vierling
2003-07-27 19:30:03 +00:00
mrg
05602c761d add a cast appease gcc3.3 2003-07-27 05:04:02 +00:00
jdolecek
21f695a1ae add LINUX_SO_PEERNAME, LINUX_SO_TIMESTAMP where it has been missing
fix value for LINUX_SO_DETACH_FILTER on couple places (unused anyway)

g/c LINUX_SCM_TIMESTAMP definition for some archs, it will be defined
in generic linux_socket.h
2003-07-26 19:59:29 +00:00
christos
91e13193ee make credentials work on the i386 by passing the original msg structure.
(from Todd Vierling)
2003-07-23 19:10:29 +00:00
enami
5b4483be52 Actually move the prototype of native_to_linux_sigaltstack here. 2003-07-04 03:04:11 +00:00
christos
28f544c476 Regen. 2003-07-03 21:25:07 +00:00
christos
c23e21bca5 Implement linux_rt_sigreturn for real. Add a hack for more plausible siginfo.
The java segv handler still segv's again inside the signal handler, but our
sample test program now works [gets the proper ucontext].
2003-07-03 21:24:27 +00:00
christos
72af603189 make the converter of sigaltstack public. 2003-07-03 21:22:32 +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
thorpej
9f722af1c9 Adapt to ktrace/lwp changes. 2003-06-29 16:10:48 +00:00
thorpej
38271de3f4 Regen: adapt to linux mmap2 changes. 2003-06-29 16:08:36 +00:00
thorpej
8ab744356a Adapt to linux mmap2 changes. 2003-06-29 16:07:58 +00:00
simonb
2bda3187f5 Fix 'struct lwp *' lossage. 2003-06-29 15:14:11 +00:00
jdolecek
dc63267c8b properly FILE_USE/FILE_UNUSE descriptor in linux_sys_fcntl()
adresses PR kern/21628 by Wolfgang Solfrank
2003-06-29 14:51:28 +00:00
darrenr
257443876f 'struct proc *' -> 'struct lwp *' as required to get GENERIC for macppc built 2003-06-29 11:02:21 +00:00
enami
618a0ff610 Redo previous; struct proc *p is necessary if NSEQUENCER is non zero. 2003-06-29 05:26:25 +00:00
bouyer
63d28e64a6 Kill unused variable. 2003-06-28 22:52:53 +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
he
3686522ed1 Regenerate after adding include of linux_mmap.h. 2003-06-28 07:56:51 +00:00
he
c7ace1c552 Need to include linux_mmap.h to get size of struct linux_sys_mmap2_args. 2003-06-28 07:55:08 +00:00
christos
9d352b5c2c PR/21936: Todd Vierling: ioctl 'r' misinterpreted 2003-06-23 21:37:27 +00:00
christos
40e148ef6b PR/21948: Todd Vierling: Implement MAP_TRYFIXED for linux emulation. 2003-06-23 21:32:33 +00:00
christos
c9a5d7edc1 Regen. 2003-06-23 21:26:30 +00:00
christos
35637451db PR/21937: Todd Vierling: Proper support for mmap2 2003-06-23 21:25:56 +00:00
erh
2f3650202c Add copyright+license. 2003-06-23 17:29:25 +00:00
christos
5879a5dcf6 PR/21936: Todd Vierling: compat/linux: ioctl 'r' misinterpreted 2003-06-20 03:54:35 +00:00
thorpej
5051d1c544 Use PAGE_SIZE rather than NBPG. 2003-04-09 00:39:38 +00:00
jdolecek
1b18fee640 this info is now in doc/RESPONSIBLE 2003-04-06 10:13:07 +00:00
thorpej
d071d9a8d0 Use PAGE_SIZE rather than NBPG. 2003-04-01 15:02:05 +00:00
thorpej
d46b766d7d Use PAGE_SIZE rather than NBPG. 2003-04-01 14:45:09 +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
dsl
9be8ac5294 Alternative pid/proc allocater, removes all searches associated with pid
lookup and allocation, and any dependency on NPROC or MAXUSERS.
NO_PID changed to -1 (and renamed NO_PGID) to remove artificial limit
on PID_MAX.
As discussed on tech-kern.
2003-03-19 11:36:32 +00:00
dsl
dfdb668a2e Reimplement linux_sys_setresgid() in terms of do_setresgid() 2003-03-05 18:46:11 +00:00
dsl
eabc565aaf Use do_setresuid() to implement linux_sys_setresuid() 2003-03-05 18:44:46 +00:00
thorpej
5afa6838bf Do the syscall_plain/syscall_fancy dance on ARM. Shaves a fair number
of cycles off the syscall overhead.

Since all COMPAT_LINUX platforms now support __HAVE_SYSCALL_INTERN,
garbage-collect the LINUX_SYSCALL_FUNCTION stuff.
2003-03-01 04:36:38 +00:00
yamt
da8d9f98f5 make compat_linux struct file interlock friendly. 2003-02-27 16:04:15 +00:00