Commit Graph

933 Commits

Author SHA1 Message Date
njoly
6d63d66929 Convert linux/linux32/netbsd32 clock_settime syscalls, to use the
common clock_settime1() function.
2010-03-29 15:34:07 +00:00
he
7a30544200 When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.

This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.

Thanks to pooka@ for the hints for traversing the VOP* layer.
2010-03-03 08:20:38 +00:00
matt
6a9e4e8eeb Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds).  Should result in no code differences.
2009-12-10 14:13:48 +00:00
pooka
70d4493c77 Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs.  User functionality remains the same.
2009-12-05 20:11:01 +00:00
dsl
ea4ea02d98 Add LINUX_SIOCGIFMTU and LINUX_IP_HDRINCL support.
Fixes part of PR/31358
The other parts are rather too intrusive to be fixed as in the PR.
2009-11-28 22:11:42 +00:00
njoly
675b20da1b Update personality(2) to match Linux definition where the argument is an
unsigned long.
2009-11-24 10:42:43 +00:00
njoly
87483a8bda Make compat linux/linux32 msgrcv_msgarg type member of type
long/netbsd32_long to match linux definition.
2009-11-18 15:19:24 +00:00
joerg
bf54b26c0c Make sure to never leak padding space before copyout or copyin
uninitialized fields by explicitly using memset in the conversion
routines.
2009-11-16 08:44:19 +00:00
joerg
e7123f329a Return the result of copyout. Reminded by Niolas Joly. 2009-11-13 22:39:35 +00:00
joerg
8277e92195 Provide SIOCGIFNAME. 2009-11-13 21:45:03 +00:00
rmind
1283950019 - selcommon/pollcommon: drop redundant l argument.
- Use cached curlwp->l_fd, instead of p->p_fd.
- Inline selscan/pollscan.
2009-11-11 09:48:50 +00:00
rmind
4c1098f541 do_sys_wait(): fix previous by checking for ru != NULL. Noticed by
Onno van der Linden.  Also, remove redundant arguments (seems that
was_zombie was not used since rev 1.177 ?).
2009-11-04 21:23:02 +00:00
rmind
554a0142dc Initialise struct emul members by name (it is readable now and one can search
them in the tree).
2009-10-25 01:14:03 +00:00
njoly
1e0366323b Use correct sched_setscheduler syscall 3rd argument type. 2009-09-03 17:15:17 +00:00
dholland
dbb9a41442 Another one that needs <sys/exec_aout.h>. 2009-08-28 01:39:03 +00:00
drochner
eec7391fde remove some "inline" from functions which are defined in a .c file
but used elsewhere -- gcc-4.4.1 doesn't like it and I doubt it
had any effect
2009-08-18 11:22:09 +00:00
christos
f73ec80b69 more debugging for mmap 2009-08-18 02:04:14 +00:00
matt
7bb407d6e3 Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for you.
2009-08-15 23:39:35 +00:00
haad
5200b9b492 Add enum uio_seg argument to do_sys_mknod and do_sys_mkdir so these functions
can be called from kernel, too.

Change needed for zfs device node creation, until we have propoer devfs.

Oked by ad@.
2009-08-09 22:49:00 +00:00
njoly
3d5d2c8f61 Make compat linux/linux32 getdents(2) fail with ENOTDIR instead of
EINVAL when file descriptor does not refer to a directory.
2009-07-22 15:49:29 +00:00
njoly
dd5f408241 Do reject unknown/invalid linux clockid. 2009-07-21 18:42:56 +00:00
dholland
effcf1af5c Convert 67 namei call sites to use namei_simple, in these functions:
check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
2009-06-29 05:08:15 +00:00
njoly
de2e7a9c8e sched_getaffinity(2) update:
- dynamically calculate the cpu mask size,
- return it upon success,
- fix generated cpu mask.
2009-06-23 13:18:59 +00:00
njoly
9edecd8c07 In linux_sys_sched_getaffinity(), do not leak memory on error. 2009-06-18 20:36:28 +00:00
njoly
f50c7f6eb2 Add a new linux_msghdr structure, as its size differs on 64bit archs.
Do the needed conversions in sendmsg/recvmsg syscalls, and adjust
their definitions accordingly.
2009-06-17 14:18:51 +00:00
njoly
cb90fdddc4 Add LINUX_CMSG_{SPACE,LEN} macros. Use then when calculating the
msg_controllen size, when converting the control message buffer from
native (previous version was missing the linux_cmsghdr size).
2009-06-16 23:17:02 +00:00
njoly
83618982c2 For linux cmsg header copyout, use the linux structure size, not the
native one.
2009-06-16 22:56:49 +00:00
njoly
405a83b592 Make compat linux sendmsg/recvmsg output msghdr and control messages
buffers with ktrace(1), just like the native functions.
2009-06-16 15:56:10 +00:00
njoly
198ddcca4b In sendmsg(2), do copy the msghdr structure before trying to use it. 2009-06-11 19:57:58 +00:00
njoly
a9b9e78076 Small rt_queueinfo(2) update, to require a linux_siginfo structure.
While here, cleanup ifdef out argument types.
2009-06-08 13:23:16 +00:00
njoly
5932e6a6cd Add the mask value returned by siggetmask. 2009-06-02 16:53:07 +00:00
njoly
7c47c56d95 Make nice(2) return EPERM on error, not EACCES (from sys_setpriority). 2009-06-02 13:00:23 +00:00
njoly
d22e6f64ab Add native to linux siginfo si_status translation, used on i386 and
amd64.
2009-05-29 14:19:12 +00:00
pooka
dfb36ab4e4 pad -> PAD 2009-05-15 16:59:07 +00:00
njoly
d3dabe1260 Add IPC_64 support for all semctl(2)/msgctl(2). Needed, at least on
i386 for Linux 2.6 emulation.
2009-04-23 17:40:57 +00:00
christos
2b1b4bc6ef Move the internal poll/select related API's to use timespec instead
of timeval (rides the uvm bump).
2009-03-29 19:21:19 +00:00
mrg
fcc023545e - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes.  this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS.  (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information.  (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897.  it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
2009-03-29 01:02:48 +00:00
cegger
9fca5da616 ansify function definitions 2009-03-15 15:55:51 +00:00
dsl
82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00
christos
7fd1fc871c fix robust_list pointer mess! 2009-03-14 20:18:27 +00:00
rmind
f54234d142 Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.

Fixes PR/40490.  Reviewed by <ad>.
2009-02-23 20:28:58 +00:00
njoly
dc871322e1 Do not protect native_to_linux_si_code() under LINUX_NPTL anymore, now
that linux si_code definitions are MI.
2009-02-18 14:43:22 +00:00
njoly
a1cf1f2eab Add IPC_64 support for all shmctl(2) commands, not only for STAT/SET.
This make it work on i386 under 2.6 emulation.
2009-02-18 14:30:43 +00:00
njoly
0ebed1143f Small personality(2) update.
- Allow querying current personality.
- Use symbolic names instead of magic values.
2009-01-19 13:31:40 +00:00
njoly
25a76c08aa Convert linux/linux32 wait(4) to use a compat50 rusage structure. 2009-01-17 22:28:52 +00:00
christos
461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
njoly
16cef148ad Restore expected FUTEX_WAIT behaviour with NULL timeout argument,
which was broken in my recent timespec cleanup/fix.
2009-01-08 12:46:23 +00:00
njoly
5affb2e50a Make sysctl(2) fails with ENOTDIR (instead of EINVAL) for invalid mib
vector length.
2009-01-05 09:33:19 +00:00
njoly
4f6a64a639 Restore struct sysctl padding member name, which was damaged during
__unused removal on arguments.
2009-01-05 09:18:27 +00:00
njoly
e85166daa8 Fix stime(2) inverted copyin arguments. 2008-12-29 22:21:49 +00:00
cegger
9b87d582bd kill MALLOC and FREE macros. 2008-12-17 20:51:31 +00:00
njoly
26a5edd122 Add some padding members to linux_msqid64_ds for 32-bit archs. This
fix msgctl(2) IPC_STAT|IPC_64 calls, at least, on i386.
2008-12-09 11:09:11 +00:00
ad
dc5f414733 PR port-amd64/40091 compat_linux32 module loading = panic due to missing syms 2008-12-03 12:51:11 +00:00
njoly
6709281d18 Move si_code definitions from MD to MI linux_siginfo.h, all archs
(except mips for 3 values) are identical.
While here, remove unused/unneeded LINUX__SI_CODE macro. Only the
lower 16-bits are used for userland si_code.
2008-11-23 23:48:48 +00:00
mrg
56585a9fd3 initialise a variable to avoid a GCC warning. 2008-11-23 00:15:13 +00:00
ad
1ab7ca8fdc PR port-amd64/39964 modules/compat_linux: missing symbols on amd64 2008-11-20 09:26:06 +00:00
ad
92ce8c6a3d Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
2008-11-19 18:35:57 +00:00
njoly
377975c175 futex(2) timeout argument cleanup/fix.
- Use `struct linux_timespec', converted to native structure.
- Ensure that provided values are correct.
- Replace timeval+tvtohz by tstohz.
2008-11-19 13:09:19 +00:00
njoly
d64736c6b8 noisy printf. 2008-11-18 15:25:13 +00:00
njoly
cf19223289 Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
2008-11-12 18:07:40 +00:00
ad
0efea177e3 Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
2008-11-12 12:35:50 +00:00
jmcneill
af9ee6c291 Only call release_futexes if LINUX_NPTL 2008-10-28 11:42:30 +00:00
jmcneill
e143becdb6 linux_sys_get_robust_list: copyout the entire struct, not the size of the
pointer to it.
2008-10-26 19:13:16 +00:00
christos
5dfa1e6b4a futex support fixes from FreeBSD via cube+pengo. 2008-10-26 16:38:22 +00:00
christos
f6382710ee Add preliminary tls support for i386. Does not work yet. From FreeBSD. 2008-10-25 23:38:28 +00:00
njoly
d05df800a8 Do not use native_to_linux_si_code() outside LINUX_NPTL; until i
figure a better way to handle it.
2008-10-21 21:52:29 +00:00
njoly
beff3f7516 Remove LINUX_SI_xxx from MI siginfo.h, that should not have been
committed. Rather add them to amd64 MD header.
Fix compilation failures on non x86 archs.
2008-10-21 20:24:15 +00:00
njoly
db06152637 tkill/tgkill syscalls cleanup.
- Make both syscalls set si_code to SI_LWP (which will be converted to
  Linux SI_TKILL value). Fix thread some cancellation under NPTL
  emulation.
- Merge code in a new linux_do_tkill() function that will do its own
  job, instead of calling linux_sys_kill().
- Do only alter single tasks, by rejecting non positive tid/tgid
  values.
2008-10-21 13:36:28 +00:00
njoly
d7732b5cc7 Add native to linux siginfo si_code translation, mostly for negative
values. Adjust amd64 and i386 accordingly, not sure about aother archs
i can't test.
2008-10-19 09:44:31 +00:00
njoly
ea7b260958 g/c amd64 ifndef/endif. 2008-10-17 20:21:34 +00:00
wrstuden
fc7511b00e Merge wrstuden-revivesa into HEAD. 2008-10-15 06:51:17 +00:00
njoly
1b1270d3b5 Compat linux/linux32 nice(2) fix. The syscall argument is an increment
to be added to the current nice value, not an absolute value to be
set.
2008-10-03 22:39:36 +00:00
plunky
fd7356a917 Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
2008-08-06 15:01:23 +00:00
njoly
a3adeaa5f9 Fix linux_sigismember/linux_sigaddset to work on amd64 (and other
64bits archs), by ensuring that bit shifts are done on correct type.
2008-07-30 16:05:26 +00:00
jmcneill
a9b5dcaa70 ioctl compatibility for v4l2 and drm 2008-07-19 23:01:52 +00:00
christos
aa389c698d Use more timespecs internally. From Alexander Shishkin and me.
Welcome to 4.99.70, 30 more to go for 100.
2008-07-15 16:18:08 +00:00
matthias
1b4ed9ea4e make LINUX_TCSBRK work. The code is mostly copied from
sys/compat/ibcs2/ibcs2_ioctl.c.
2008-07-04 10:13:52 +00:00
njoly
153124ee21 Fix SIOCGIFCONF ioctl for 64bit platforms. Add a new linux_ifreq
structure and linux_getifconf function (cleaned up version from
compat_ifconf).

While here, update linux_getifhwaddr to use the new structure.

Ok by christos.
2008-07-03 14:07:09 +00:00
chris
d890fb22e6 Fix warnings about type conversions by using linux_speed_t type on
linux_speeds[] rather than speed_t.

On Arm (and others) linux uses unsigned long, however, NetBSD uses
unsigned int.
2008-06-28 21:34:32 +00:00
ad
a00bd89dab Replace references to getsock/getvnode. 2008-06-24 11:18:14 +00:00
gmcgarry
035e707304 ioctl commands are defined unsigned long, so cast cmd to unsigned long before comparison. 2008-06-24 10:03:17 +00:00
njoly
72a97d4bed Do not return 0 for unsupported/unknown futex operations, but ENOSYS
instead. From Roman Divacky in private email.
2008-06-20 11:38:26 +00:00
njoly
d1a60f16f0 Fix futex locking. Move all locking to linux_sys_futex function, and
KASSERT that futex_{get,put,sleep,wake} are now called with lock held.
2008-06-20 11:31:40 +00:00
tsutsui
4482e41e15 Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t. 2008-06-18 12:24:17 +00:00
njoly
d0c76a36cb In linux_sys_sendto, do not unconditionnally set MSG_NAMEMBUF to
msg_flags; add it only if a target adress was provided and needs to be
converted.
2008-06-11 13:02:00 +00:00
njoly
f7cecd2466 Do set mbuf in all cases, even for salen value of 0; otherwise this
will make a panic later when trying to free memory from a random
adress.

XXX Need to revisit it later to avoid mbuf allocation in this case.
2008-06-09 21:17:58 +00:00
njoly
80639b2f02 Add missing cv_destroy in futex_sleep. 2008-06-05 10:58:16 +00:00
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
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
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
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
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
ad
77e0b2120f Patch up sysctl locking:
- Lock processes, credentials, filehead etc correctly.
- Acquire a read hold on sysctl_treelock if only doing a query.
- Don't wire down the output buffer. It doesn't work correctly and the code
  regularly does long term sleeps with it held - it's not worth it.
- Don't hold locks other than sysctl_lock while doing copyout().
- Drop sysctl_lock while doing copyout / allocating memory in a few places.
- Don't take kernel_lock for sysctl.
- Fix a number of bugs spotted along the way
2008-01-07 16:12:52 +00:00
njoly
a09fc3498a Fix readdir syscall retval to return 1 (instead of getdents number of
byte read) on success.
2007-12-26 13:48:53 +00:00
njoly
47bf9f4b4d Kill unneeded linux_sys_getpgid and use native sys_getpgid instead. 2007-12-24 14:17:17 +00:00
njoly
035a2e040b - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
  syscall.

ok by christos and dsl.
2007-12-21 22:26:20 +00:00
dsl
7e2790cf6f Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
    int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
2007-12-20 23:02:38 +00:00
pooka
db06a930e6 Remove cn_lwp from struct componentname. curlwp should be used
from on.  The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
2007-12-08 19:29:36 +00:00
dsl
28bae79b27 ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
2007-12-08 18:35:53 +00:00
dyoung
adde197943 Use IFADDR_EMPTY(). 2007-12-05 22:51:01 +00:00
dyoung
cabaa89d1f Don't open-code queue(3) macros (x = ifnet.tqh_first; y =
x.if_list.tqe_next).  Instead, use the macros themselves.

Use IFNET_FOREACH() and IFADDR_FOREACH().
2007-12-05 01:06:23 +00:00
dsl
f2af9174b9 Remove all the __P 2007-12-04 18:40:07 +00:00
pooka
61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +00:00
elad
abb7851f4d Refactor time modification checks and place them in the secmodel code.
okay christos@
2007-11-25 00:35:26 +00:00
njoly
6412bda281 Cleanup. Remove a few linux syscalls definitions, now identical to
native ones (with stackgap and ALT_CHECK_xxx removal). No functional
changes expected.
2007-11-16 12:51:54 +00:00
njoly
23e9f9fa6f Replace strncpy with strlcpy in compat linux and linux32 uname,
old_uname and oldold_uname syscalls to ensure that all *utsname fields
are always NUL terminated.
2007-11-08 21:07:23 +00:00
njoly
b32d95bfbf Remove remaining 64-bit compat linux syscalls linux_sys_xxx() (except
for ones without arguments), and replace them by their 32-bit
equivalent linux32_sys_xxxx().
2007-11-07 00:24:29 +00:00
rmind
6364fdeba5 - Replace lockmgr with mutex;
- Use condvars instead of tsleep/wakeup;
- Replace malloc with kmem;
- Use itimespecfix/tstohz;

Reviewed by <ad>.
2007-11-04 11:10:34 +00:00
njoly
a478f23b9e Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
2007-10-19 18:52:09 +00:00
ad
a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
dyoung
f59a11881a Constify: LLADDR() -> CLLADDR(). 2007-08-29 22:33:42 +00:00
dyoung
e6fc91327f Use satosdl(). 2007-08-26 22:33:25 +00:00