Commit Graph

5178 Commits

Author SHA1 Message Date
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
maxv
1fc63be65d Sync swapctl() with netbsd32. Return EINVAL when misc<0, and 0 when misc=0
or uvmexp.nswapdev=0.
2014-06-22 19:09:39 +00:00
rtr
d54d7ab24a * split PRU_CONTROL functionality out of xxx_userreq() switches and place
into separate xxx_ioctl() functions.
* place KASSERT(req != PRU_CONTROL) inside xxx_userreq() as it is now
  inappropriate for req = PRU_CONTROL in xxx_userreq().
* replace calls to pr_generic() with req = PRU_CONTROL with pr_ioctl().
* remove & fixup references to PRU_CONTROL xxx_userreq() function comments.
* fix various comments references for xxx_userreq() that mentioned
  PRU_CONTROL as xxx_userreq() no longer handles the request.

a further change will follow to fix parameter and naming inconsistencies
retained from original code.

Reviewed by rmind@
2014-06-22 08:10:18 +00:00
christos
a15da4b281 Avoid NULL dereference and fix sched param conversion (at least make it
do something). Pointed out by Maxime Villard
2014-06-21 23:12:10 +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
joerg
440506dd8d Rename stack gap arguments. 2014-06-13 10:42:26 +00:00
joerg
05ceadd7ef Regnerate 2014-06-13 10:37:22 +00:00
joerg
98fc8b37be delete -> remove 2014-06-13 10:37:02 +00:00
joerg
881138893f Rename argument like the native syscall. 2014-06-13 10:36:18 +00:00
joerg
ef53e37514 Don't t use a C++ keyword as field name. 2014-06-12 21:39:45 +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
c45e6d878d Regen for utimes(2). 2014-05-29 10:47:23 +00:00
njoly
f0bcde4b65 Add utimes(2) support. 2014-05-29 10:47:00 +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
dholland
39b82eecb9 Use accessor functions for the tty's table of control characters.
(at least from outside the core tty sources)

Move some xon/xoff code from net/ppp_tty.c to kern/tty.c.
2014-05-22 16:31:19 +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