Commit Graph

933 Commits

Author SHA1 Message Date
maxv
7eb4355d2e Reject non-regular files.
Patch from njoly@.
2014-10-30 16:45:28 +00:00
maxv
4202f47de3 Resource leak.
Found by my code scanner.

Tested by njoly@; ok njoly@ rmind@ on tech-kern@.
2014-10-19 17:33:58 +00:00
njoly
05d405dade Add support for more open flags that have a native equivalent
(O_NONBLOCK, O_DIRECT and O_NOFOLLOW).
Translate native EFTYPE error (missing on Linux) to expected ELOOP;
when opening symlinks with flag O_NOFOLLOW.
2014-06-25 16:38:53 +00:00
maxv
9cdb398e86 If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.

With the help of njoly@
2014-06-21 10:23:07 +00:00
njoly
88a8e0469e Cleanup pipe(2) flags, now that native handle them. 2014-06-01 13:42:12 +00:00
njoly
769728743d For utimes(2), use compat_50_sys_utimes() instead of local version. 2014-05-29 10:35:26 +00:00
njoly
bf70618478 Add a funtion that translate socket type value from Linux to NetBSD.
Use it for socket and socketpair syscalls.
2014-05-23 12:28:51 +00:00
njoly
1815fcdd2a Fix signed vs. unsigned comparison in getgroups16() syscall. Negative
gisetsize values now fail with EINVAL as expected.
2014-05-20 17:31:18 +00:00
njoly
9676d5d738 Simplify dup3 emulation to call dodup() directly instead of
sys_dup2()+fd_set_exclose(). While here, add some error conditions.
2014-05-18 09:30:00 +00:00
rmind
bc9504c95e Replace open-coded access (and boundary checking) of ifindex2ifnet with
if_byindex() function.
2014-05-17 21:26:20 +00:00
njoly
e9bb8eca6d Fix fadvise64 syscalls to use 64bit offset types. 2014-05-17 09:23:51 +00:00
martin
804dc5f91b Get rid of all sysc_init_field uses - initialize fields directly in C99
notation.
2014-05-16 12:22:32 +00:00
njoly
45d75a98a6 Fix c&p error for the length argument in fadvise64_64. 2014-05-06 18:17:22 +00:00
njoly
3388ddd03d linux_off_t -> off_t in pwrite() syscall args comment. 2014-05-06 13:21:50 +00:00
njoly
d63cac9fa8 Fix pread/pwrite syscalls which need a 64bit offset argument. 2014-05-04 10:08:53 +00:00
maxv
c1cf2f47fb A specially-crafted binary could easily control a kernel array index.
Add some checks to ensure that nothing will be read outside the allocated
area. Rewrite the code so that we don't need to allocate the whole section.

Spotted by several developers, patch from chs@/enami@
2014-04-15 17:29:00 +00:00
dholland
39aea57337 typos in comments 2014-03-23 06:03:38 +00:00
christos
54b7adb159 c99 initializers for struct execsw 2014-03-07 01:33:43 +00:00
pooka
4f6fb3bf35 Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
2014-02-25 18:30:08 +00:00
njoly
6e5d6d35f1 Fix wrong KASSERTs. Do not compare size vs. entries count. 2014-02-23 11:09:42 +00:00
maxv
c23f93773f Increase LINUX32_ELF_AUX_ENTRIES to avoid overrun in linux32/. Also,
add comments and KASSERTs to make sure people don't forget to increase
XX_AUX_ENTRIES's when adding vectors.

Reported by martin@ (CV), with suggestions from chs@.

ok martin@ chs@
2014-02-21 07:53:53 +00:00
maxv
f945d6d845 Fix uninitialized variable. Harmless: it does not change the behavior
at all.

ok rmind@ christos@
2014-02-11 16:00:13 +00:00
chs
e5a75de98e account for the 16 bytes of AT_RANDOM data in the stack setup. fixes PR 48518.
use cprng_strong32() instead of random().  add AT_RANDOM support for linux32.
2014-02-09 16:41:42 +00:00
njoly
5c3bf064f4 Add basic IPV6 level socket options support (IPV6_V6ONLY). 2014-01-27 19:19:15 +00:00
njoly
fa8c423a19 Add SO_SNDLOWAT, SO_RCVLOWAT and SO_ACCEPTCONN support for socket
options.
2014-01-27 13:23:33 +00:00
njoly
d71dfbd73b Update linux socket socket options (SO_*). Add common version to its
own file (linux_socket_generic.h); use it for all but alpha and mips.
2014-01-25 13:49:27 +00:00
njoly
bd88ba8ba1 Fix inverted pid/lid arguments in do_sched_{get,set}param calls. 2014-01-23 19:18:08 +00:00
njoly
283688165b Cleanup, and reduce diffs between arches. Make alpha use
linux_sys_{get,set}timeofday like others.
2014-01-13 10:33:03 +00:00
njoly
465ae6432a Add easy parts (TCOOFF/TCOON) of the TCXONC linux termios ioctl. 2013-12-27 16:58:50 +00:00
njoly
27180d99da Rename ipcall/socketcall specific defines to avoid conflict with
syscalls definitions. No functional changes.
2013-12-27 15:10:53 +00:00
njoly
87ffdd525a Add struct linux_stat64 definition for alpha, and enable syscalls that
use it.
2013-12-27 14:17:11 +00:00
njoly
b50661d98e CTASSERT that native to compat errno translation tables are kept in
sync with native errno list.

Remove extra entries (linux) which resulted in bad translated values,
and add missing ones (ibcs2, osf1 and svr4) which made some out of
bounds accesses.
2013-12-22 17:14:22 +00:00
njoly
b647d3d5d8 Cleanup compat linux errnos by adding generic errnos in a single file.
Use it for all arches except alpha and mips.
Add a few missing native to linux errno conversions.
2013-12-17 22:14:24 +00:00
njoly
7baf52cd9a Sprinkle a few more linux_umode_t where appropriate.
Reduce diffs between archs.
2013-12-08 15:55:10 +00:00
njoly
d16d72eb65 Add missing syscall argument fd in comment. 2013-12-08 14:59:43 +00:00
chs
42fa7e34f4 claim to be linux 3.11.6 (opensuse 13.1). 2013-11-18 01:36:49 +00:00
chs
29a841b371 implement the *at() syscalls.
bring the unimplemented syscall list up to date.
2013-11-18 01:32:52 +00:00
chs
2084516c98 implement AT_RANDOM. 2013-11-18 01:32:22 +00:00
slp
69abcb6960 On linux_sys_getdents, insert d_type at the end of each record.
Fixes PR kern/47806.
2013-11-10 12:07:52 +00:00
christos
c829de6452 remove unused variable 2013-10-17 21:08:16 +00:00
njoly
eb2a213af4 Add utimensat(2) for compat linux. 2013-09-24 13:27:49 +00:00
christos
721e82b55a exec modules need to be of the exec kind 2013-09-19 18:50:35 +00:00
njoly
9692d5cd1c Make alpha use linux_sys_utimes() just like other archs. 2013-09-15 12:58:34 +00:00
pooka
220050f663 Allow to build in envs without USRSTACK (namely, rump kernels on powerpc).
TODO: all of the m*() calls are by definition incompatible with rump
kernels; including them is no great damage, but they're not useful either.
2013-08-11 09:07:15 +00:00
njoly
00693d7bfc Do not make FUTEX_WAIT wait indefinitely for an invalid timeout
(tv_nsec = -1).
2013-07-18 17:31:02 +00:00
stacktic
a69c3c1394 Typo 2013-06-08 12:50:32 +00:00
christos
16ccb1669c handle timeouts like before. 2013-04-17 14:39:40 +00:00
christos
3d6e1ab522 Add some more futex gunk and explain why it does not work (yet).
Now skype aborts with a futex timeout, instead of a stack smash leading
to a SEGV.
2013-04-16 23:03:05 +00:00
christos
890d27ce13 alpha uses standard utimes. 2013-04-15 19:24:04 +00:00
pooka
801602f013 Fix COMPAT_LINUX32. 2013-04-09 08:00:20 +00:00