Commit Graph

7838 Commits

Author SHA1 Message Date
hannken 3e2f3eaf50 Return EINVAL when trying to create a device node with "rdev == VNOVAL".
Fixes PR #45111 "tmpfs panic with mknod(2)".
2011-07-03 15:25:09 +00:00
mrg 2624874e7c avoid some uninitialised variable warnings from GCC.
at least the puffs one seems valid, but i'm not 100% sure.
2011-07-03 08:57:43 +00:00
bouyer 1f1772a97c Fix kern/45093 as discussed on tech-kern@:
http://mail-index.netbsd.org/tech-kern/2011/06/17/msg010734.html

The cause of the problem is that the so_pendfree is processed with
the softnet_lock held at one point, and processing the list
calls sodoloanfree() which may kpause(). As the thread sleeps with
softnet_lock held, it ultimately cause a deadlock (see the PR or tech-kern
thread for details).
Although it should be possible to call sodopendfree() after releasing
the socket lock, it's not so easy to know where he socket lock is held and
where it's not, so we may hit the issue again later.
Add a kernel thread to handle the so_pendfree list, and wake up this
thread when adding mbufs to this list. Get rid of the various sodopendfree()
calls, hopefully fixing definitively the problem.
2011-07-02 17:53:50 +00:00
dyoung a256291c3f Don't cast a pointer void * before passing to memset(), that's not
necessary.  Use NULL instead of (type *)0.  This patch produces no
change in the generated assembly.
2011-06-30 22:38:50 +00:00
wiz 4cbd24b23f dependant -> dependent 2011-06-30 20:09:15 +00:00
manu 1bb66616d8 Fix bug introduced in previous commuit: Do not vrele() a vnode we did not
obtained.
2011-06-29 08:01:14 +00:00
matt 2699f92cdb Add the new ci to cpu_infos *before* calling routines which may want to
cpu_lookup.
2011-06-29 06:22:21 +00:00
manu 1a36241e4f Improve a bit listxattr(2). It attemps to list both system and user
extended attributes, and it faled if calling user did not have privilege
for reading system EA. Now we just lise user EA and skip system EA in
reading them is not allowed.
2011-06-28 07:50:03 +00:00
manu 4033ef79a2 Fix multiple non compliances in our Linux-like extattr API, and make it
public so that it can be used.
2011-06-27 16:39:43 +00:00
christos bc12521d3b regen 2011-06-26 17:05:55 +00:00
christos 7823fd0964 - syscalls that takes socklen_t arguments should do so.
- add pipe2, dup3, paccept, kqueue1
2011-06-26 17:05:24 +00:00
christos e2bebf7172 * Arrange for interfaces that create new file descriptors to be able to
set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).

    - Add F_DUPFD_CLOEXEC to fcntl(2).
    - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing.
    - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK.
    - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK.
    - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter
      for socket(2) and socketpair(2).
    - Add new paccept(2) syscall that takes an additional sigset_t to alter
      the sigmask temporarily and a flags argument to set SOCK_CLOEXEC,
      SOCK_NONBLOCK.
    - Add new mode character 'e' to fopen(3) and popen(3) to open pipes
      and file descriptors for close on exec.
    - Add new kqueue1(2) syscall with a new flags argument to open the
      kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.

* Fix the system calls that take socklen_t arguments to actually do so.

* Don't include userland header files (signal.h) from system header files
  (rump_syscallargs.h).

* Bump libc version for the new syscalls.
2011-06-26 16:42:39 +00:00
matt 65bd0920b3 Allow PAX_ASLR to be used by itself. 2011-06-23 23:42:43 +00:00
manu 448e1c49b2 Add mount -o extattr option to enable extended attributs (corrently only
for UFS1).
Remove kernel option for EA backing store autocreation and do it by
default. Add a sysctl so that autocreated attriutr size can be modified.
2011-06-17 14:23:50 +00:00
matt 5ca5a72bf6 Deal with PCU state when performing coredumps. As the kernel moves each LWP
into LSSUSPENDED state, have that LWP save its PCU state for the coredump and
release its PCU status since its probably going to be exiting very soon.
Make pcu_save_all tolerate for being called for non-curlwp if that lwp belongs
to the same process, has a state of LSSUSPENDED, and no PCUs are in use.

Make the MD coredump code use pcu_save_all(l) since it'll need to save all
the PCU state anyways and can take advantage of the above tests.
2011-06-13 21:32:42 +00:00
rmind e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
uebayasi 064389cedb Fix build; p was not used, but l was passed to kauth. Use curlwp directly. 2011-06-11 03:00:19 +00:00
matt bdbb859bae Use KASSERTMSG so if these trigger, we can see what exactly caused them to fire. 2011-06-11 01:07:33 +00:00
matt 1f1f4e99e8 l isn't used. nuke it. 2011-06-10 21:02:46 +00:00
uebayasi 282c08f330 do_sys_rename: Kill an unused variable. 2011-06-10 13:07:14 +00:00
matt a1b165afd2 Make pcu_save_all and pcu_discard_all KASSERTs accept LW_SYSTEM threads
since kthread_create will call lwp_create with lwp0 which may not be curlwp.
2011-06-07 17:51:58 +00:00
matt f3c47d398e Add some more MI hook points for PCU. Discard the PCU state at lwp_exit and
at exec time.  Before forking, save the PCU state so that cpu_lwp_fork
doesn't have.  Remove MD code which did that before.
2011-06-06 22:04:34 +00:00
njoly 7c78532f22 Create empty temporary rumphdr.types file if missing; to avoid error
messages for compat syscalls files regen.
2011-06-05 14:13:53 +00:00
dsl ce8178264d Don't directly call sys_sync() from random bits of code, instead
add do_sys_sync() that takes an 'lwp' (for l_cred) as an argument.
Explicitly pass &lwp0 rather than NULL and expecting sys_sync to
  substitute some random lwp.
2011-06-05 09:04:22 +00:00
rmind 3df4c27d37 Revert maxdmap/maxsmap constification, as it causes problems on some
sparc models.  Reported by tsutsui@.
2011-06-03 17:58:18 +00:00
dsl 2ab3977571 Fix type in comment
(before I replace the 'l' with 'curlwp')
2011-06-02 18:54:43 +00:00
alnsn a739efc5b5 kern/42030 - tracking of file descriptors by ktrace/kdump 2011-06-01 21:24:59 +00:00
christos 1f1986d685 provide a diagnostic for unsplit drivers. 2011-06-01 02:43:33 +00:00
dyoung 0840f9ccfc Don't use the C preprocessor to configure USERCONF. Instead, either do
or do not link in subr_userconf.c and x86_userconf.c.

Provide no-op stubs for userconf_bootinfo(), userconf_init(), and
userconf_prompt().

Delete all occurrences of #include "opt_userconf.h" as well as USERCONF
and __HAVE_USERCONF_BOOTINFO #ifdef'age.
2011-05-31 23:28:52 +00:00
rmind cfda9e3195 sysctl_proc_corename: perform KAUTH_PROCESS_CORENAME check (for set case)
after the new name is copied into cnbuf.  Spotted by enami@.
2011-05-31 00:15:28 +00:00
christos 41ceba0065 when undoing the sigsuspend setup, either take the signal and allow the
signal path to restore the mask, or restore the mask here.
2011-05-29 22:14:53 +00:00
manu d1c4787eb6 Add SOCK_SEQPACKET to PL_LOCAL sockets. Based on patch from Jesse Off,
submitted 8 years ago:
http://mail-index.netbsd.org/tech-kern/2003/04/14/0006.html
2011-05-29 03:32:46 +00:00
christos 0b60c7be7c If a signal did not fire, restore the original signal mask for pselect/pollts
using a signal mask. Tested by tron.
2011-05-28 15:33:40 +00:00
uebayasi c6e687b646 Catch up with B_* flag name changes in debug code. 2011-05-26 04:51:57 +00:00
uebayasi dcf649145a Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.
From jmmv@, no objections seen in the proposed thread:

	http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html
2011-05-26 04:25:26 +00:00
joerg 415e4a8a32 Use a real panic as safe guard 2011-05-24 18:18:22 +00:00
joerg 0f07b5f4ad Use proper format string 2011-05-24 16:40:21 +00:00
joerg cbd926d403 Add some needed __UNCONST 2011-05-24 16:39:56 +00:00
mrg cdf9d44f55 fix proc.pid.corename:
- "oldp is not NULL" means the get case
- "newp is not NULL" means the set case
which may both happen at the same time.
2011-05-24 01:19:48 +00:00
rmind 5b686f3960 Add some general description of vnode life-cycle. 2011-05-19 03:26:06 +00:00
rmind 4a4e52516e Remove cache_purge(9) calls from reclamation routines in the file systems,
as vclean(9) performs it for us since Lite2 merge.
2011-05-19 03:11:55 +00:00
rmind 95ea6d26ab Re-implement kthread_join(9), so that it actually works (hi haad@). 2011-05-19 03:07:29 +00:00
christos fc6147c605 No need to mask twice. The setup function does it. 2011-05-18 14:48:04 +00:00
christos e2543d0362 PR/43625: Mark Davies: Fix pselect(2) to honor the temporary mask. pselect(2)
(and pollts(2)) are similar to sigsuspend(2) in that they temporarily change
the process signal mask and wait for signal delivery. Factor out and share the
code that does this.
2011-05-18 03:51:41 +00:00
mrg 8169e46991 move and rename the uvm history code out of uvm_stat to "kernhist".
rename "UVMHIST" option to enable the uvm histories.

TODO:
- make UVMHIST properly depend upon KERNHIST
- enable dynamic registration of histories.  this is mostly just
  allocating something in a bitmap, and is only for viewing multiple
  histories in a merged form.


tested on amd64 and sparc64.
2011-05-17 04:18:05 +00:00
dholland bd77476310 Hack for PR 44961: restore the prior "logic" pertaining to looking up /
to prevent a crash when attempting rename("/", "foo"). This is not really
what I want going forward and it may cause e.g. rmdir("blah/") to fail, so
if it causes trouble for anyone back it out. The right fix is going to have
to wait until the qemu/tcp_vtw problems I ran into last night get sorted out.
2011-05-16 15:09:31 +00:00
rmind 4f9fb56b98 fork1: fix stop-on-fork case, lend a correct lock to LWP for LSSTOP state.
Fixes PR/44935.
2011-05-14 18:50:07 +00:00
rmind a4a64d151a - Sprinkle __read_mostly, consitify maxdmap and maxsmap.
- Prevent sys/resourcevar.h from inclusion in userland.
- sys_{set,get}priority: use id_t for 'who', not int.
- Make donice() routine static.
- Remove trailing spaces, KNF.
2011-05-14 17:57:05 +00:00
rmind 53963a9398 Improve/fix comments, give more meaningful names for variables. 2011-05-14 17:12:28 +00:00
rmind 2db2f4467c - Replace shmmap_entry_pool with kmem(9), as pool is not worth.
- Sprinkle __cacheline_aligned and __read_mostly.
2011-05-13 22:22:55 +00:00