Commit Graph

1375 Commits

Author SHA1 Message Date
njoly 7cdbbcf80d Add LINUX_TMPFS_SUPER_MAGIC, and map it to our tmpfs.
This makes sem_open/sem_unlink (POSIX named semaphores) work under
NPTL emulation.
2008-05-28 12:01:10 +00:00
njoly e82000b55e Add IPC_64 support to msgctl, needed for amd64. 2008-05-21 11:15:57 +00:00
njoly 763d4d3608 Fix linux_sys_getres{uid,gid}16 arguments type in comment. 2008-05-20 15:48:24 +00:00
njoly 4c3e8d3656 Fix free() argument in linux_read_ldt. 2008-05-19 09:36:55 +00:00
jmcneill 9e5e643a12 Pull in machine/cpufunc.h for wrmsr definition. 2008-05-11 17:13:43 +00:00
njoly 88ca4016fd Restore sched_native2linux() KASSERTs, i accidentally disabled in a
previous commit.
2008-05-07 15:18:35 +00:00
jmcneill 473a55317b Wrap debug printfs in #ifdef DEBUG_LINUX (hi njoly!) 2008-05-05 02:29:31 +00:00
njoly 4c44d432ea Add SCHED_FIFO/SCHED_RR support to sched_get_priority_{min,max}. 2008-05-01 16:06:17 +00:00
ad 1498ad220e Make various bits of debug code compile again. 2008-04-30 14:07:13 +00:00
njoly 4490c7c69a In linux_get_sa(), make salen parameter unsigned.
Avoid kernel DIAGNOSTIC 0 bytes uvm mapping assertion, for negative
values.
2008-04-29 09:56:38 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad 284c2b9aef Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
2008-04-24 18:39:20 +00:00
njoly 436fa0ef05 Add IPC_64 support for semctl IPC_STAT/IPC_SET. 2008-04-24 16:42:54 +00:00
ad 6d70f903e6 Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
  be sent from a hardware interrupt handler. Signal activity must be
  deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
  and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
2008-04-24 15:35:27 +00:00
ad 15e29e981b Merge the socket locking patch:
- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.
2008-04-24 11:38:36 +00:00
ad bfb6f31431 Disable bitrotted linux ptrace interfaces, which are likely now a
security hole. Can be re-enabled at runtime. If you want to repair
them please look at the native implementation.
2008-04-23 14:18:50 +00:00
ad dd55791531 Regen. 2008-04-23 14:10:03 +00:00
ad 7cb840338e -SYCALL_MPSAFE 2008-04-23 14:07:49 +00:00
ad ce69e3e9c8 Fix locking. 2008-04-23 13:13:25 +00:00
ad d0466d413e Tweak locking. 2008-04-23 13:11:42 +00:00
ad bb0c94d223 Tweak previous. 2008-04-23 13:09:40 +00:00
ad 14f88acc9b Fix locking. 2008-04-23 13:02:32 +00:00
ad 1e216688e1 - Use cdev_tty().
- Tweak locking.
2008-04-23 12:55:16 +00:00
ad a87ccd221c Sprinkle locking. 2008-04-23 12:50:53 +00:00
njoly d8f896655c Add LINUX_IPC_64 support for LINUX_IPC_SET in shmctl. Required, at
least, for amd64 which use LINUX_IPC_FORCE64.
2008-04-21 22:57:06 +00:00
njoly f1bd64daf3 Rename LINUX_SHMCTL_FORCEIPC64 define to LINUX_IPC_FORCE64. 2008-04-21 22:38:18 +00:00
ad 08b44dd8b9 timer fixes for PR 37093:
- Fix serious concurrency problems, making the code MT and MP safe in
  the process.
- Don't allocate memory or inspect process state from hardclock().
2008-04-21 00:13:46 +00:00
njoly c007e33a3a Add compat linux32 sys_clock_{getres,gettime,settime} syscalls. 2008-04-17 17:47:23 +00:00
njoly 69614dfece Remove an obsolete comment about SHM_LOCK/SHM_UNLOCK being no-op. 2008-04-16 14:47:31 +00:00
njoly 3ce80f6407 Remove unneeded amd64 ifdef/endif. 2008-04-15 11:08:05 +00:00
njoly 26457ccc1d Under NPTL emulation, do not reparent all members of a thread group,
but only the processes that emulate threads (with LINUX_CLONE_THREAD
set).

This fix a problem for child processes that share address space with
the parent. At exit, the child will die silently, leaving the parent
waiting indefinitely for its end ...
2008-04-11 16:47:50 +00:00
njoly 112605d50a Cleanup unneeded LINUX_NPTL ifdef/endif. 2008-04-08 20:25:00 +00:00
njoly 2b6f0cc5e4 Regen for linux_sys_msync removal. 2008-04-04 12:43:00 +00:00
njoly dcde97da0e Cleanup. Kill linux_sys_msync and use sys___msync13 instead.
No functional changes expected.
2008-04-04 12:38:52 +00:00
ad 02141d72c7 - Remove uneeded splsoftnet().
- Use fd_getsock().
2008-03-26 20:08:22 +00:00
ad f12243c34d linux_get_sa: fix botched fd handling. 2008-03-23 19:35:54 +00:00
ad a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
elad 2a9368a7e7 In linux_sys_sched_getparam(), get the native policy too, so that we have
a better chance at properly converting the priority.

Noted by & okay yamt@.
2008-02-29 14:29:06 +00:00
elad 67470a76a1 Factor out the guts of get/setparam so it can be used from the compat code.
Make the FreeBSD and Linux compat code convert the parameters to their
native representation and call the native routines.

Remove KAUTH_PROCESS_SCHEDULER_GET/SET.

Update documentation and examples.

XXX: For now, only the Linux compat code does the priority conversion
XXX: right.

Linux priority conversion code from yamt@, thanks!

Okay yamt@.
2008-02-28 16:09:18 +00:00
elad e99760e7e4 Fold KAUTH_REQ_PROCESS_SCHEDULER_* to KAUTH_PROCESS_SCHEDULER_*. In other
words, don't pass an action and a request, and just use a single action to
indicate what is the operation in question.

This is the first step in fixing PR/37986, which calls for policy/priority
checking in the secmodel code. Right now we're lacking room for another
parameter required to make a decision, and this change makes room for such.
2008-02-16 16:39:34 +00:00
he 301a1d2d21 Need to include <sys/fstypes.h> before <sys/vfs_syscalls.h> to get
fhandle_t defined, which is used in a function prototype in the latter.
2008-02-12 10:59:57 +00:00
ad d7f6ec471c Don't lock the socket to set/clear FNONBLOCK. Just set it atomically. 2008-02-06 21:57:53 +00:00
dsl 22774d7c0d Fix the linux32 emulations of fcntl() locking.
The 64bit linux emulation versions can't be used because the lock structure
alignment and field sizes all differ.
Since there need to be 4 different versions of the linux struct flock, and
amd64 kernel needs 3 of them compiled in, rather than replicating the same
code block twice more, move the body of the code into a few #defines
that can be expanded with the correct types in the linux[32]_sys_fcntl[64]()
functions.
Should fix problems running progams like skype running under linux32
emulation on amd64.
2008-02-02 21:54:01 +00:00
dsl 7e5ac7072d Extract the fcntl64() suppoort from linux_file64.c into linux_fcntl64.c
Unravel some of the knots that caused linux_file64.c to be compiled twice
for an amd64 kernel (once for linux and once for linux32) with different
parts being skipped each time.
2008-02-02 19:37:52 +00:00
njoly 4eecf433ec Make shmctl + {IPC,SHM}_STAT work an amd64, by forcing use of IPC_64.
Following the Linux kernel behaviour.
2008-01-28 14:31:35 +00:00
njoly ff7363568f Update struct linux_shmid64_ds for 64bits archs.
- shm_segsz should be of type size_t, not int.
- Disable padding fields used on 32bits archs.
2008-01-28 14:14:48 +00:00
njoly 29158b16e8 shmctl fixes.
- SHM_STAT take an index as input, and return the corresponding shmid.
- IPC_INFO and SHM_INFO returns the highest used index.
- SHM_INFO expected the total used pages (not bytes) in shm_tot field
  of struct shm_info.
2008-01-28 14:05:32 +00:00
elad c27d5f30b6 Tons of process scope changes.
- Add a KAUTH_PROCESS_SCHEDULER action, to handle scheduler related
    requests, and add specific requests for set/get scheduler policy and
    set/get scheduler parameters.

  - Add a KAUTH_PROCESS_KEVENT_FILTER action, to handle kevent(2) related
    requests.

  - Add a KAUTH_DEVICE_TTY_STI action to handle requests to TIOCSTI.

  - Add requests for the KAUTH_PROCESS_CANSEE action, indicating what
    process information is being looked at (entry itself, args, env,
    open files).

  - Add requests for the KAUTH_PROCESS_RLIMIT action indicating set/get.

  - Add requests for the KAUTH_PROCESS_CORENAME action indicating set/get.

  - Make bsd44 secmodel code handle the newly added rqeuests appropriately.

All of the above make it possible to issue finer-grained kauth(9) calls in
many places, removing some KAUTH_GENERIC_ISSUSER requests.

  - Remove the "CAN" from KAUTH_PROCESS_CAN{KTRACE,PROCFS,PTRACE,SIGNAL}.

Discussed with christos@ and yamt@.
2008-01-23 15:04:38 +00:00
njoly f5183fca22 Regen. 2008-01-15 22:40:14 +00:00
njoly 5cec0f492f compat linux (and linux32) uid16 functions cleanup and fixes.
- Move uid16 functions to their own file linux_uid16.c, included by
  needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
  bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
2008-01-15 22:38:34 +00:00