Commit Graph

9266 Commits

Author SHA1 Message Date
christos
e56eaf6411 - preserve the error number returned from copyin.
- preserve the original pathname in ep_kname, because this is what gets passed
  to userland in exec_script.c
2015-09-12 17:04:57 +00:00
christos
c8bd35c1f3 On non absolute exec pathnames, prepend the working directory if
possible so that we can provide in most situations the absolute
pathname in the AUX vector so that $ORIGIN works. The following
are implementation issues:
    1. deep path execs still don't work (can't provide path to the AUX vector)
    2. the returned path is not normalized (cosmetic)
2015-09-11 01:23:37 +00:00
uebayasi
185d99e39a Build conf/param.c normally. 2015-09-03 01:09:38 +00:00
ozaki-r
13b8e486ae Fix building kernels w/o ether 2015-08-31 16:46:14 +00:00
ozaki-r
879526da38 Hook up lltable/llentry with the kernel (and rumpkernel)
It is built and initialized on bootup, but there is no user for now.

Most codes in in.c are imported from FreeBSD as well as lltable/llentry.
2015-08-31 08:02:44 +00:00
uebayasi
c692eec272 Use makeoptions_COPY_SYMTAB via opt_copy_symtab.h in sources. Remove a hack
to set -DCOPY_SYMTAB from sys/conf/Makefile.kern.inc.  Remove unnecessary
dependencies too.
2015-08-30 01:46:02 +00:00
maxv
dd1f161320 Don't decrement the number of offline cpus if we fail to shut down one.
ok christos@, via tech-kern@
2015-08-29 12:24:00 +00:00
mlelstv
cc9526659d when querying randomness sources from position 'start' then skip 'start'
entries and not one less.
2015-08-29 10:00:19 +00:00
knakahara
bb29ae9814 fix interrupt_* stubs. reported by skrll@n.o 2015-08-28 07:18:39 +00:00
uebayasi
144fbf59d9 Constify a little. 2015-08-27 02:43:20 +00:00
pooka
7cc60ed4d8 Move a bunch of sysctl nodes from init_sysctl (kitchen sink sysctl file)
to init_sysctl_base (only base kernel defs).  Main motivation was to
fix sysconf(_SC_NPROCESSORS) for Rumprun.  As reported by neeraj on irc,
it returned -1 before this fix, so we were doing imaginary computing.
2015-08-25 14:52:31 +00:00
pooka
21ff215384 hw nodes do not go under the kern tree, so add new init routine for them 2015-08-25 14:32:34 +00:00
gson
42b8d69040 In ttywait_timo(), break out of loop on all errors, not just
EWOULDBLOCK, as ttywait() did prior to 1.265.
2015-08-25 12:55:30 +00:00
pooka
d8e04c9094 to garnish, dust with _KERNEL_OPT 2015-08-24 22:50:32 +00:00
pooka
1c4a50f192 sprinkle _KERNEL_OPT 2015-08-24 22:21:26 +00:00
pooka
b00f3c3b11 regen 2015-08-24 16:07:10 +00:00
pooka
e037806b6d <sys/mount.h> is necessary only with !RUMP_CLIENT, so include it only
in that case.  Fixes build for Hurd (which does not provide <sys/mount.h>)

from rmh@gnu.org
2015-08-24 16:05:46 +00:00
christos
a220b03041 we don't need ioconf.h if we don't have the ksyms pseudo-device 2015-08-21 06:55:25 +00:00
christos
758039df2d If we don't have a pseudo-device, we don't need the attach function. 2015-08-21 06:50:56 +00:00
uebayasi
520a795665 Move dev/ definitions out of files.kern. 2015-08-21 02:18:18 +00:00
christos
9e1f6b1ae6 include ioconf.h instead of locally declaring the prototype of the attach
function
2015-08-20 09:45:45 +00:00
uebayasi
bf97b90378 Mark pseudo attach unused arg with __unused. 2015-08-20 08:27:09 +00:00
gson
2a8f000c61 When closing a tty, limit the amount of time spent waiting for the
output to drain to five seconds so that exiting processes with
buffered output for a serial port blocked by flow control or a pty
that is not being read do not hang indefinitely.  Should fix PRs
kern/12534 and kern/17171.  This is an updated version of the change
of tty.c 1.263.
2015-08-19 12:02:55 +00:00
hannken
215f039197 Redo Rev. 1.30: Change vfs_vnode_iterator_next() to skip reclaiming
vnodes (VI_XLOCK set) without waiting and change vflush() to wait for
these vnodes.
2015-08-19 08:40:02 +00:00
uebayasi
fa089ff763 Convert pseudo attach functions to take no arguments, as some functions
(pppattach(), putterattach(), etc.) already do.  This means that pseudo
attach function will be able to become a constructor.
2015-08-18 13:46:20 +00:00
knakahara
a604df282c Add kernel code to support intrctl(8). 2015-08-17 06:16:02 +00:00
mlelstv
5661eb436a Refactor disk address calculation from physical block numbers in
the journal into a function. Make that function work correctly with
sector sizes != DEV_BSIZE when compiled outside the kernel (i.e.
fsck_ffs).
Fixes PR bin/45933
2015-08-09 07:40:59 +00:00
mlelstv
23ac79bdb2 KASSERT that magic pointers NOCRED and FSCRED are not dereferenced. 2015-08-08 07:53:51 +00:00
maxv
6a1d6f071c revert; but still fix the comment 2015-08-08 06:24:40 +00:00
uebayasi
d3d021fcc6 o Don't include sys/sched.h. Scheduler-related operation is done by
sleepq(9) via SOBJ_SLEEPQ_SORTED.

o Include sys/lwp.h instead of sys/proc.h.
2015-08-07 06:22:12 +00:00
riastradh
c5389a31f5 KNF (Khange Not Functional) 2015-08-05 16:51:09 +00:00
riastradh
3aafbe4261 Terminate message with newline. 2015-08-05 16:37:27 +00:00
maxv
22674dbcd0 stupid comment, and make sure we are not executing a lib 2015-08-05 15:58:01 +00:00
maxv
b36a7fd23d Some changes, to reduce a bit my tech-kern@ patch:
- move the P_PAX_ flags out of #ifdef PAX_ASLR in pax.h
 - add a generic pax_flags_active() function
 - fix a comment in exec_elf.c; interp is not static
 - KNF for return
 - rename pax_aslr() to pax_aslr_mmap()
 - rename pax_segvguard_cb() to pax_segvguard_cleanup_cb()
2015-08-04 18:28:09 +00:00
maxv
8a3764c147 Remove uvm_extern.h and exec.h (unused). 2015-08-04 12:44:04 +00:00
maxv
bc1457cb8c Small changes:
- remove the per-page stuff. It has been disabled for 10 years, and it is
   not implemented properly.
 - typo in comment
 - use KASSERT
2015-08-04 11:42:08 +00:00
christos
6fe583ecd6 1. mask fflags so we don't tack on whateve oflags were passed from userland
2. honor O_CLOEXEC, so the children of daemons that use cloning devices, don't
   end up with the parents descriptors
fd_clone and in general the fd approach of 'allocate' > 'play with guts' >
'attach' should be converted to be more constructor like.
XXX: pullup-{6,7}
2015-08-03 04:55:15 +00:00
manu
3a71cbe970 Do not VFS_SYNC before VFS_UNMOUNT on force unmount
VFS_SYNC does not consider whether we are performing a force unmount or not,
and therefore it can wait for a while if the filesytstem is misbehaving.
Removing VFS_SYNC before VFS_UNMOUNT on forced unmount fixes the problem.

This should not cause harm as the VFS_SYNC seems just useless.
As noted by Chuck Silvers in
http://mail-index.netbsd.org/tech-kern/2015/07/13/msg019156.html
- Nothing seems to prevent vnodes from getting dirty again after VFS_SYNC call.
- Filesystems do flush data through vflush() in VFS_UNMOUNT anyway.

As a consequence, the VFS_SYNC call in do_unmount() could probably be
completely removed. But since such a change is quite dangerous, we just
remove it in the case of forced unmounts, which are situations where
the risk of data loss is known to the operator.
2015-08-02 03:29:22 +00:00
maxv
cbb6f393d8 Small changes:
- rename pax_aslr_init() to pax_aslr_init_vm()
 - remove the PAX_ flags (unused)
 - fix a comment in pax.h
2015-07-31 07:37:17 +00:00
maxv
c0b150f033 Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
   specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
 - introduce pax_setup_elf_flags(), which takes as argument the PaX flag
   of the ELF PaX note section, and which sets the proc flag as
   appropriate. Also introduce a couple of other functions used for that
   purpose.
 - modify pax_aslr_active(), and all the other similar pieces of code, so
   that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
 - declare PAX_DPRINTF, makes it more readable
 - fix a typo in exec_elf.h
2015-07-30 15:28:18 +00:00
maxv
3478485fe5 Don't forget to unlock the LWP.
ok rmind@
2015-07-30 08:11:44 +00:00
christos
8d365aaee5 revert previous, will fix differently. 2015-07-28 19:46:42 +00:00
christos
b308d13cf7 fix build 2015-07-28 19:38:48 +00:00
maxv
40e89e3a3c Introduce POOL_REDZONE. 2015-07-28 12:32:44 +00:00
maxv
66b146ac99 Several changes and improvements in KMEM_GUARD:
- merge uvm_kmguard.{c,h} into subr_kmem.c. It is only user there, and
   makes it more consistent. Also, it allows us to enable KMEM_GUARD
   without enabling DEBUG.
 - rename uvm_kmguard_XXX to kmem_guard_XXX, for consistency
 - improve kmem_guard_alloc() so that it supports allocations bigger than
   PAGE_SIZE
 - remove the canary value, and use directly the kmem header as underflow
   pattern.
 - fix some comments

(The UAF fifo is disabled for the moment; we actually need to register
the va and its size, and add a weight support not to consume too much
memory.)
2015-07-27 09:24:28 +00:00
maxv
6647020bbc Unused inits (harmless).
Found by Brainy.
2015-07-24 13:02:52 +00:00
maxv
7ad874c499 typo (comment) 2015-07-24 12:29:55 +00:00
maxv
750cd9d76e Memory leak. Triggerable from an unprivileged user via COMPAT_43. 2015-07-22 14:18:08 +00:00
hannken
50c0a5b05d Operations getnewvnode() and ungetnewvnode() have been replaced with vcache.
- Remove now obsolete functions getnewvnode() and ungetnewvnode().
- Document vcache operations.

Welcome to 7.99.20
2015-07-12 08:11:27 +00:00
justin
7de47d8d6f Missing includes for some architectures 2015-07-07 13:07:10 +00:00
justin
034bfbdba3 Move hw.machine and hw.machine_arch sysctls to base so rump can use them
This allows uname(3) and uname(1) to work on rump kernels.
2015-07-07 12:38:02 +00:00
christos
171790237c Support PIOD_READ_AUXV so that gdb can handle PIE binaries. From OpenBSD. 2015-07-02 03:47:54 +00:00
christos
16b723da95 CID 1308958: Fix reversed arguments in copyin(9) 2015-06-29 15:44:45 +00:00
christos
876dffc92e Wait for the next character forever as kgdb wants. 2015-06-26 14:26:38 +00:00
hannken
4e19d4c756 Add a vfs_newvnode() method to deadfs and use it to create
anonymous device vnodes with bdevvp() and cdevvp().

Implement spec_inactive() and spec_reclaim() to handle these nodes.
2015-06-23 10:42:34 +00:00
hannken
142e4ca539 Use VFS_PROTOS() for deadfs. Rename dead_mount to dead_rootmount. 2015-06-23 10:41:59 +00:00
hannken
20184d2ffd Remove the test for mounted-on block devices in vclean() and
always close the vnode here.

A forced unmount of a file system holding a mounted-on
block device will make this mounted-on file system unusable.
2015-06-23 10:40:36 +00:00
matt
9d9e6580c0 Make module_machine const char * 2015-06-22 16:35:13 +00:00
martin
4c145ea87f Make mqueue_get public, rearrange mq_open into a helper function that can
be called from compat code, adapt mqueue_create accordingly.
2015-06-20 14:41:54 +00:00
martin
c41d48b868 Make handle_modctl_load() usable from compat/netbsd32. 2015-06-19 14:23:59 +00:00
martin
5f7e4ad45b Make kill1 public (we'll need it from compat/netbsd32) 2015-06-19 10:18:19 +00:00
pooka
a3cfad0d94 regen 2015-06-18 15:19:50 +00:00
pooka
3de8e14458 +RUMP to __posix_{,f,l}chown. at least python wants them. 2015-06-18 15:16:12 +00:00
gson
873b1ca5ad Revert previous; it broke the lib/libc/ttyio/t_ttyio/ioctl test case. 2015-06-14 16:19:31 +00:00
dholland
aad8cec383 Typo in comment. 2015-06-12 19:18:30 +00:00
dholland
28bb489865 Use NOFOLLOW intead of <empty>. Purely cosmetic as NOFOLLOW is 0, but
it's supposed to be there for clarity.
2015-06-12 19:06:32 +00:00
gson
6b1c582456 When closing a tty, limit the amount of time spent waiting for the
output to drain to five seconds so that exiting processes with
buffered output for a serial port blocked by flow control do not
hang indefinitely.  Should fix PR kern/12534.  OK christos.
2015-06-12 17:28:53 +00:00
prlw1
4b3129d595 typo 2015-05-25 21:02:37 +00:00
rtr
d458601fe5 change nfs_boot_sendrecv to take sockaddr_in * instead of mbuf *
fixes m_serv (single mbuf leak) leak in kern/subr_tftproot.c
2015-05-21 02:04:22 +00:00
pooka
6e547c6725 Don't log kern.msgbuf* sysctls. it's rather pointless, nobody can
unload subr_log.c
2015-05-20 11:18:36 +00:00
pooka
f67bb039d4 group msgbuf sysctls with the msgbuf code
(init_sysctl.c -> subr_log.c)
2015-05-20 11:17:24 +00:00
matt
d0c9fc59d2 Change the ksyms ioctls to more compat_netbsd32 friendly. Use _IOWR ioctls
to avoid extra copyouts.  With these changes, netstat and vmstat work on
mips64eb with the normal N32 userland and a N64 kernel.
2015-05-20 02:45:20 +00:00
chs
f3abe35cbf in bounds_check_with_*, reject negative block numbers and avoid
a potential overflow in calculating the size of the request.
2015-05-14 17:31:24 +00:00
pgoyette
50b0fae6fd Regenerate 2015-05-13 02:13:08 +00:00
pgoyette
855a17b428 Update syscalls to point to the new module. (Regen of dependant
files to follow.)
2015-05-13 02:10:46 +00:00
pgoyette
75eb6c4280 Create a new sysv_ipc module to contain the SYSVSHM, SYSVSEM, and
SYSVMSG options.  Move associated variables out of param.c and into
the module's source file.
2015-05-13 02:06:25 +00:00
pgoyette
40997f1238 Another xxxfini() routine. 2015-05-13 01:23:10 +00:00
pgoyette
446e5f46eb More prep: add a xxxfini() routine to each subcomponent so we can
clean up after ourselves.  Mostly, this checks to make sure that
there are no active itmes, and then deallocates wired kernel virtual
memory.  For SYSVSEM, we also disestablish the exithook() so we
won't try to call it after destroying its memory pool!
2015-05-13 01:16:15 +00:00
pgoyette
748778c4ee More preparation for modularizing the SYSVxxx options. Here we
change the kern.ipc.sysvxxx sysctls into dynamic values, so each
sub-component of SYSVxxx can declare its own availability.
2015-05-13 01:00:16 +00:00
pgoyette
ae8c40588e In preparation for modularization of the SYSV* options, restore the
use of opt_sysv.h to get the -DSYSVxxx definitions.
2015-05-12 05:19:20 +00:00
rtr
a05061a0c1 mtod mbuf to sockaddr * for so_send(). 2015-05-10 18:55:22 +00:00
pgoyette
5608b80ca0 Regen for changes related to separation of compat_sysv syscalls into a
separate module.
2015-05-10 08:13:41 +00:00
pgoyette
ff00f0b594 Split the SYSV* compat code out into a separate compat_sysv module.
For monolithic kernels, both modules will be compiled as "built-ins",
while modular environments will be able to load the SYSVSEM, SYSVSHM,
and SYSVMSG code independant from the rest of compat.

This is a necessary precursor step to making the "STD" SYSV* code
into a separate module.

Tested in both monolithic and modular environments with no errors
seen.
2015-05-10 07:41:15 +00:00
rtr
d53103fc75 change sosend() to accept sockaddr * instead of mbuf * for nam.
bump to 7.99.16
2015-05-09 15:22:47 +00:00
pooka
3e29c19da0 fix to work for syscalls.conf without sysautoload
reported by Justin('s buildbot)
2015-05-09 10:57:04 +00:00
pgoyette
e7d73c5ce1 Regen again, this time without the extra word in the "generated from" line. 2015-05-09 06:06:14 +00:00
pgoyette
6d24076578 Remove extraneous word 'compat' on header line 2015-05-09 06:04:13 +00:00
pgoyette
bd1072bc60 Another regenerated file 2015-05-09 05:58:53 +00:00
pgoyette
718c347b7c Add new configuration variable to point at the list of auto-loadable
syscalls
2015-05-09 05:57:18 +00:00
pgoyette
6318a1352e Use the generated list of auto-loadable syscalls rather than our own
hard-coded list.
2015-05-09 05:56:36 +00:00
pgoyette
060ac9689e Regen from syscalls.master 2015-05-09 05:55:43 +00:00
pgoyette
98e18f463f Teach makesyscalls.sh how to auto-generate the list of syscalls that
can be resolved by module auto-load.

Update syscalls.master to identify the specific module that contains
the auto-loadable code for each syscall.
2015-05-09 05:51:26 +00:00
martin
2a3b2deb34 Backout previous, Nick has a fix for binutils. 2015-05-08 09:43:41 +00:00
martin
fe65851c65 On mips64, the size calculation for the symbol table is off by a few bytes
(probably a bfd bug or misconfiguration), so add a bit of slope here
untill we fix it.
2015-05-08 07:41:07 +00:00
hannken
e10a32f7f7 Remove miscfs/syncfs and
- move the syncer into kern/vfs_subr.c.

- change the syncer to process the mountlist and VFS_SYNC as appropriate.

- use an API for mount points similiar to the API for vnodes:
  - vfs_syncer_add_to_worklist(struct mount *mp) to add
  - vfs_syncer_remove_from_worklist(struct mount *mp) to remove a mount.

No objections on tech-kern@
2015-05-06 15:57:07 +00:00
mlelstv
c0ea84ad3c Always fixup zero sector size, even when other geometry values are invalid. 2015-05-05 22:09:24 +00:00
rtr
5f2c7f7738 flip (NULL == addr) to (addr == NULL) use in conditional from previous
commit.
2015-05-03 04:18:45 +00:00
rtr
f6bef303da compare mbuf * pointer to NULL instead of 0 2015-05-02 23:46:04 +00:00
rtr
c027610558 remove unnecessary check that nam != NULL before deref in soconnect()
(added in previous commit).

sockargs copyin() makes sure we don't get NULL here
2015-05-02 21:15:33 +00:00
rtr
487c8ce86e make soconnect() fail with EAFNOSUPPORT if the domain of the socket does
not match family received in the sockaddr.

* connect() now fails as documented in connect(2).
* atf test t_connect:connect_foreign_family now passes.
2015-05-02 20:10:26 +00:00