Commit Graph

1714 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
christos
80b6fe5348 set error return on error (from max) 2014-09-26 20:32:52 +00:00
christos
b00a9731c2 fix leak 2014-09-21 16:58:42 +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
njoly
bf8fee7bf6 Add a few missing open(2) flags (LINUX_O_*). Fix alpha wrong values. 2014-06-25 16:30:42 +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
d7efe85816 Regen for munmap(2) signature. 2014-05-31 08:52:54 +00:00
njoly
72a681e433 Fix munmap(2) signature. 2014-05-31 08:51:19 +00:00
njoly
507b03fc31 Regen for utimes(2) change. 2014-05-29 10:36:31 +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
4e4bef8a08 Add missing specific LINUX_SOCK_NONBLOCK value for alpha. 2014-05-23 12:30:12 +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
30a02d27a2 Regen for getgroups/setgroups update. 2014-05-20 17:26:04 +00:00
njoly
1085071e9f Fix getgroups/setgroups signature. 2014-05-20 17:24:49 +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
00939bcb8e Regen for fadvise64 offset types changes. 2014-05-17 09:25:06 +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
e942f57595 Regen for mknod device argument type change. 2014-05-06 17:34:39 +00:00
njoly
c908bf86c3 Reduce diffs between archs; make mknod device argument unsigned. 2014-05-06 17:33:35 +00:00
njoly
3388ddd03d linux_off_t -> off_t in pwrite() syscall args comment. 2014-05-06 13:21:50 +00:00
njoly
7d21c20716 Regen for pread/pwrite 64bit offset argument. 2014-05-04 10:10:39 +00:00
njoly
d63cac9fa8 Fix pread/pwrite syscalls which need a 64bit offset argument. 2014-05-04 10:08:53 +00:00
maxv
8d404a3e9c There are two times the same branches.
} else if (addr == LUSR_OFF(__signal)) {
 			error = ENOTSUP;
		} else if (addr == LUSR_OFF(__signal)) {
			error = ENOTSUP;
		}

Just delete one of them. Spotted by my code scanner.

ok christos@
2014-04-15 17:53:09 +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
njoly
2dbac6d46c Regen. 2014-04-08 16:49:25 +00:00
njoly
903adfd827 Adjust read/write/readv/writev signature to match native versions. 2014-04-08 16:48:01 +00:00
njoly
52eb735051 Do not include bsd.kinc.mk in each arch Makefile, it's already pulled
by bsd.syscall.mk (from Makefile.inc).
2014-04-08 11:39:57 +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
a310936659 Use cprng_strong32 for LINUX_AT_RANDOM on amd64 too. 2014-02-23 12:01:51 +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
dsl
480bf53618 Add explicit #include <x86/fpu.h> instead of relying on pcb.h including it. 2014-02-19 21:23:01 +00:00
dsl
f122cefa4e Don't rely on pcb.h including x86/include/sysarch.h 2014-02-19 20:50:56 +00:00
njoly
f14253ab28 Regen. 2014-02-15 22:36:26 +00:00
njoly
40b4c3c92a Reduce diffs between archs, add mincore/madvise to m68k. 2014-02-15 22:35:08 +00:00
dsl
b9df3e93ac Remove all references to MDL_USEDFPU and deferred fpu initialisation.
The cost of zeroing the save area on exec is minimal.
This stops the FP registers of a random process being used the first
  time an lwp uses the fpu.
sendsig_siginfo() and get_mcontext() now unconditionally copy the FP
registers.
I'll remove the double-copy for signal handlers soon.
get_mcontext() might have been leaking kernel memory to userspace - and
  may still do so if i386_use_fxsave is false (short copies).
2014-02-15 10:11:14 +00:00
dsl
742d777c6d Move sys/arch/amd64/amd64/fpu.c and sys/arch/amd64/include/fpu.h
into sys/arch/x86 in preparation for using the same code for i386.
2014-02-11 20:17:16 +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
dsl
519a61193d Convert the amd64 build to use x86/cpu_extended_state.h so that the fpu
definitions match those of i386.
Mostly just structure and field renames, in addition:
1) process_xmm_to_s87() and process_s87_to_xmm() moved into
   x86/convert_xmm_s87.c so they can be used by amd64's netbsd32 code.
2) The linux signal code simplified to use a structure copy for ths fxsave
   data - it matches the hardware definition and won't change.
2014-02-07 22:40:22 +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