Commit Graph

5199 Commits

Author SHA1 Message Date
christos fa4e9301e9 Add compatibility for pre MIDMAGIC a.out binaries (with COMPAT_NOMID)
Oldzmagic binaries need "sysctl -w vm.user_va0_disable=0"
2014-12-05 22:21:47 +00:00
maxv 66b8e71ac5 User-triggerable kmem_alloc(0).
Ok martin@ christos@

User
2014-12-05 17:26:21 +00:00
ozaki-r 1d0321acf8 Tweak ifconf variants
The tweaks make the code intention clear and make further changes easy.

No functional change.
2014-11-26 09:53:53 +00:00
njoly 854606c981 Do not define LINUX_EDEADLK more than once. 2014-11-22 15:47:42 +00:00
njoly cedf843908 Regen for ppoll signature fix 2014-11-22 13:20:35 +00:00
njoly cc18605e8e Fix ppoll signature (int ->u_int) 2014-11-22 13:18:45 +00:00
njoly aee571df11 Regen for ppoll(2) 2014-11-22 13:13:10 +00:00
njoly f43d462ab6 Add ppoll(2) for compat linux32. 2014-11-22 13:12:22 +00:00
ozaki-r 758341eedc Tweak linux_getifhwaddr
No functional change.
2014-11-21 06:03:04 +00:00
uebayasi 25e1f6dab9 Define compat modules (but without dependencies yet). 2014-11-17 01:01:57 +00:00
maxv be2f51b7f2 Do not uselessly include <sys/malloc.h>. 2014-11-09 18:23:28 +00:00
maxv 65896a5125 Do not uselessly include <sys/malloc.h>. 2014-11-09 18:08:06 +00:00
maxv eda7c7bbe4 Do not uselessly include <sys/malloc.h>. 2014-11-09 17:48:07 +00:00
maxv 7eb4355d2e Reject non-regular files.
Patch from njoly@.
2014-10-30 16:45:28 +00:00
christos ad831a394e fix multiple mistakes:
- error from copyout was ignored
- the wrong size was specified in copyin
- missing locking.
2014-10-27 19:10:21 +00:00
christos 1a3570e51c remove unused prototypes 2014-10-24 21:08:36 +00:00
christos 83b8cb7442 sync with the regular method; no functional diff 2014-10-24 21:07:55 +00:00
christos 3c3b014425 simplify 2014-10-20 11:58:01 +00:00
maxv 4ddff69ff4 Memory leak, triggerable from root only.
Found by my code scanner.

ok christos@
2014-10-20 06:56:38 +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
snj f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
maxv d1a6ffae94 I'm not sure reading from an unsanitized userland pointer is a good idea.
Some users might be tempted to give 0x01, in which case the kernel will
crash.
2014-10-10 16:29:56 +00:00
christos fcc36fa62d add tmpfs. 2014-10-05 20:17:28 +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
matt da793df06a #include <sys/condvar.h> 2014-09-19 17:25:33 +00:00
nakayama 599e52f863 Fix previous. There is no uap. 2014-09-05 22:37:09 +00:00
christos d1b744da0d make this compile again 2014-09-05 10:47:32 +00:00
matt 45b1ec740d Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
2014-09-05 09:20:59 +00:00
matt 9c398c311d Don't use private as a variable name since it's reserved in C++ 2014-09-05 05:26:26 +00:00
maxv 8db2bbfd52 Ensure nbytes > 0. Otherwise bad things may happen.
Compile-tested only.

ok christos@
2014-08-24 12:48:58 +00:00
maxv 5f2f7d8e15 Remove dead returns:
return VAR/func(XX);
	return VAR;

The latter is never reached. Sent on tech-kern@, no disagreement.
2014-08-21 06:40:35 +00:00
apb f498235332 Add COMPAT_70 to conf/files; add compat_70 to kern/syscalls.conf
and compat/netbsd32/syscalls.conf.
2014-08-16 17:24:28 +00:00
maxv 709fefda49 http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-2
#06-0x01: Empty compiler block

ok christos@
2014-08-14 17:29:30 +00:00
maxv 2c7a581fe9 Just return sys_open(). COMPAT_10 will be handled internally.
ok christos@
2014-07-31 12:35:33 +00:00
maxv b1a535f8de Remove ELF_ROUND and ELF_TRUNC (unused). Found by my code scanner. 2014-07-25 16:23:13 +00:00
dholland f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
maxv 5848af8e14 1) On 64bit systems, don't add the 32bit execsw[] to the global exec array.
exec_elf32 works on 32bit systems only, and will crash 32bit binaries on
   64bit systems.
2) Now that exec_elf32 is dormant, we can give the native ELF loaders the
   highest priority.

Binaries will load faster now (system boot, compilation, etc.).

With the help of njloy@. Discussed a bit on tech-kern@, no disagreement.
2014-07-22 08:18:33 +00:00
maxv 7fe6b3efb2 netbsd32 should depend on exec_elf32, since it will use exec_elf32's functions.
This fixes
	# modload compat_netbsd32
when exec_elf32 is not loaded.

ok njoly@
2014-07-11 16:22:49 +00:00
rtr d575eb5454 * split PRU_PEERADDR and PRU_SOCKADDR function out of pr_generic()
usrreq switches and put into separate functions
  xxx_{peer,sock}addr(struct socket *, struct mbuf *).

    - KASSERT(solocked(so)) always in new functions even if request
      is not implemented

    - KASSERT(pcb != NULL) and KASSERT(nam) if the request is
      implemented and not for tcp.

* for tcp roll #ifdef KPROF and #ifdef DEBUG code from tcp_usrreq() into
  easier to cut & paste functions tcp_debug_capture() and
tcp_debug_trace()

    - functions provided by rmind
    - remaining use of PRU_{PEER,SOCK}ADDR #define to be removed in a
      future commit.

* rename netbt functions to permit consistency of pru function names
  (as has been done with other requests already split out).

    - l2cap_{peer,sock}addr()  -> l2cap_{peer,sock}_addr_pcb()
    - rfcomm_{peer,sock}addr() -> rfcomm_{peer,sock}_addr_pcb()
    - sco_{peer,sock}addr()    -> sco_{peer,sock}_addr_pcb()

* split/refactor do_sys_getsockname(lwp, fd, which, nam) into
  two functions do_sys_get{peer,sock}name(fd, nam).

    - move PRU_PEERADDR handling into do_sys_getpeername() from
      do_sys_getsockname()
    - have svr4_stream directly call do_sys_get{sock,peer}name()
      respectively instead of providing `which' & fix a DPRINTF string
      that incorrectly wrote "getpeername" when it meant "getsockname"
    - fix sys_getpeername() and sys_getsockname() to call
      do_sys_get{sock,peer}name() without `which' and `lwp' & adjust
      comments
    - bump kernel version for removal of lwp & which parameters from
      do_sys_getsockname()

note: future cleanup to remove struct mbuf * abuse in
xxx_{peer,sock}name()
still to come, not done in this commit since it is easier to do post
split.

patch reviewed by rmind

welcome to 6.99.47
2014-07-09 04:54:03 +00:00
rtr 0dedd9772f fix parameter types in pr_ioctl, called xx_control() functions and remove
abuse of pointer to struct mbuf type.

param2 changed to u_long type and uses parameter name 'cmd' (ioctl command)
param3 changed to void * type and uses parameter name 'data'
param4 changed to struct ifnet * and uses parameter name 'ifp'
param5 has been removed (formerly struct lwp *) and uses of 'l' have been
       replaced with curlwp from curproc(9).

callers have had (now unnecessary) casts to struct mbuf * removed, called
code has had (now unnecessary) casts to u_long, void * and struct ifnet *
respectively removed.

reviewed by rmind@
2014-07-01 05:49:18 +00:00
dholland 01e782f371 Revert the following changes:
src/sys/sys/quotactl.h 1.37
   src/sys/compat/netbsd32/netbsd32.h 1.101
   src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
   src/sys/kern/vfs_quotactl.c 1.39
   src/sys/kern/vfs_syscalls.c 1.483
   src/sys/ufs/lfs/ulfs_quota.c 1.11
   src/sys/ufs/ufs/ufs_quota.c 1.116
   src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.
2014-06-28 22:27:50 +00:00
maxv 973b0f16a2 Sync getfh() with the native implementation. It also fixes:
a) a return value
b) a vnode lock
c) a user-controlled memory allocation

ok christos@, on tech-kern
2014-06-28 11:39:15 +00:00
maxv 2ccd0cb073 Empy comment 2014-06-28 11:06:31 +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 dc0681e4c5 Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.
ok christos@
2014-06-24 14:33:57 +00:00
maxv a125a5eac2 Remove unused headers. 2014-06-24 12:17:40 +00:00
maxv b042e45033 Remove dead code. The kernel already checks for PT_INTERP sections, and puts
their content into "itp". There's no need for re-reading the whole binary and
trying to find this section again. Just use "itp".

DEBUG_FREEBSD_ELF is now unused, so remove its references in amd64/conf/ALL
and i386/conf/ALL.
2014-06-24 11:59:10 +00:00
christos 91d0cc5d6b simplify and clarify 2014-06-22 22:19:28 +00:00