Commit Graph

6696 Commits

Author SHA1 Message Date
rmind
d2fec2fc4f sys_shmat: initialise shmid of shmmap entry earlier. Now error path,
i.e. shm_delete_mapping, wont use random value.
2008-12-22 13:49:17 +00:00
cegger
beb4d1e5cc undo turn malloc flags to enums.
Requested by christos.

Keep malloc flag defines in kernel section.
2008-12-21 17:49:55 +00:00
ad
74302d0fab Redo previous. Don't count deferrals due to raised IPL. It's not that
meaningful.
2008-12-21 13:26:58 +00:00
ad
ff0249c394 Prevent a potential deadlock from a multithreaded process doing:
t1	dup2(0, 1)
t2	dup2(1, 0)
2008-12-21 10:25:00 +00:00
ad
7ca206492d Don't try to sync if panicing:
- It doesn't work and a dead system that can't be reset from the console is
  worse than a system that has painced and rebooted. If you can make it work
  reliably please do so.

- If the system is paniced there is every reason to suspect VM structures
  and the contents of the buffer cache.
2008-12-21 10:23:10 +00:00
ad
6d599f4e1f - Fix a bug where we trashed descriptor zero in the old open files array
while ironically trying to preserve the same during copy. Would only have
  occurred if a multithreaded program expanded the descriptor table and,
  within a tiny window of exposure, another thread in the program tried to
  access descriptor zero.

- Convert to use kmem_alloc/kmem_free.
2008-12-21 09:58:22 +00:00
ad
82ae73e0b6 Don't increment the 'kpreempt defer: IPL' counter if a preemption is pending
and we try to process it from interrupt context. We can't process it, and
will be handled at EOI anyway. Can happen when kernel_lock is released.
2008-12-20 23:06:14 +00:00
cegger
378da548fc Turn malloc flags into an enum.
While here, move the flags definition into _KERNEL section.
2008-12-19 21:22:01 +00:00
pgoyette
81649575af When checking for "set-up is complete", look for the CTLFLAGS_PERMANENT
in the root of the tree being modified, rather than in the system default
tree.  This permits module compat_netbsd32 to initialize its shadow tree
at load time.

Discussed on tech-kern, with no objections.

Addresses my PR kern/40167
2008-12-19 17:28:59 +00:00
pgoyette
9c68331911 Store config(1)'s root filesystem type as a text string rather than
embedding the address of its xxx_mountroot() in swapnetbsd.c.  This
permits booting of kernels with hard-wired filesystem type even if the
filesystem is in a loadable module (ie, not linked into the kernel
image).

Discussed on current-users.  Tested on amd64 and i386 with both hard-
wired and '?' filesystem times, and on both modular and monolithic
kernels.

Thanks to pooka@ for code review and suggestions.

Addresses my PR kern/40167
2008-12-19 17:11:57 +00:00
thorpej
4730b27d42 Make condvars really opaque -- hide the wait message member from consumers
of the API.
2008-12-19 07:57:28 +00:00
cegger
9b87d582bd kill MALLOC and FREE macros. 2008-12-17 20:51:31 +00:00
christos
9a5d3f2817 replace bitmask_snprintf(9) with snprintb(3) 2008-12-16 22:35:21 +00:00
ad
7c89190b50 Start percpu allocation at (ALIGNBYTES + 1) to avoid problem with importing
offset zero to vmem.
2008-12-15 11:59:22 +00:00
ad
c1ef49a66f Back VMEM_ADDR_NULL change. It's too invasive. 2008-12-15 11:42:34 +00:00
ad
b8c27c5dfc Check for VMEM_ADDR_NULL, not NULL. 2008-12-15 11:33:13 +00:00
ad
f9b17a5200 Define VMEM_ADDR_NULL as UINTPTR_MAX, otherwise a vmem that can allocate
a block starting at zero will not work.

XXX pool_cache uses NULL to signify failed allocation.
XXX how did the percpu allocator work before?
2008-12-15 11:29:49 +00:00
ad
50f32f7a93 Put vm_lock into its own cache line. 2008-12-15 10:26:10 +00:00
elad
f4f1989ae8 PR/39559: Juan RP: veriexec(4): too easy to cause a NULL dereference
through it in kernel

Patch from PR applied with tiny modifications, thanks!

Discussed with blymn@ a while ago.
2008-12-14 23:20:23 +00:00
elad
48949a2a2a Fix length passed to strlcpy(): we used to get names one character shorter
than reality.

Should be pulled up to netbsd-5.
2008-12-14 23:12:58 +00:00
ad
024c36f64b vclean: be paranoid and set v_tag, v_op while holding v_interlock.
FS code could check their values while scrolling through mnt_vnodelist.
2008-12-14 11:15:59 +00:00
ad
31420e7959 - vrelel: fix broken "dead but not clean" assertion. The vnode can be
dead and dirty if cleaning is in progress.
- Add an assertion, fix some text.
2008-12-14 11:13:36 +00:00
ad
70a01ab869 softint_disestablish: the soft interrupt could still be running on a CPU
somewhere in the system. If it is, wait for it to complete before tearing
it down. The caller commits to not trigger the interrupt again once
disestablish is set in motion.
2008-12-13 21:13:30 +00:00
ad
7a3593355a Fix a comment. 2008-12-13 20:49:49 +00:00
ad
24da1f6ca4 PR kern/36183 problem with ptrace and multithreaded processes
Fix the famous "gdb + threads = panic" problem.
Also, fix another revivesa merge botch.
2008-12-13 20:43:38 +00:00
ad
2e606b7b1b sigchecktrace: process SIGKILL before everything else. 2008-12-13 18:55:01 +00:00
christos
15e362cca8 fix endif comment 2008-12-10 18:07:30 +00:00
christos
0bff293dd2 disable VMEM_DEBUG by default. 2008-12-10 17:32:32 +00:00
christos
10fdeaec16 vmem_check_sanity is just too expensive for DEBUG. Enable it only for
VMEM_DEBUG.
2008-12-10 16:59:12 +00:00
cegger
33d827105a vmem_check_sanity: refactor overlapping check for better readability.
Move use of vmem_check_sanity into locked sections. Pointed out by ad@
2008-12-09 07:54:59 +00:00
cegger
4dfe7b7870 ddb: make show vmem print exact span type
vmem_check_sanity: print exact span type
vmem_add1: KASSERT span types
2008-12-07 22:39:01 +00:00
pooka
54b9426187 Move some sysctl node creations away from linksets and into the
constructors for subsystems.

XXX: CTLFLAG_PERMANENT is non-sensible.
2008-12-07 20:58:46 +00:00
cegger
f001f650d6 make this compile with MALLOC_DEBUG but w/o DEBUG 2008-12-07 14:24:28 +00:00
cegger
f132fda3fe vmem_check_sanity: fix check to correctly detect even exactly duplicate spans. 2008-12-07 11:49:51 +00:00
ad
7ab182873b Add cpu_softintr_p() for assertions 2008-12-07 11:40:53 +00:00
cegger
bb1d17f443 build fix: make i386 build again 2008-12-07 09:40:42 +00:00
cegger
2aa8aa0f8f Spans may never overlap. Overlapping spans mean memory corruption
when used by kmem(9), for example.
Do sanity checks to detect such spans on DEBUG kernels.
2008-12-07 02:21:04 +00:00
cegger
10de0e2b14 ddb: new 'show vmem' and 'show all vmems' commands.
Useful to inspect vmem(9) structures.
2008-12-07 00:51:15 +00:00
ad
e91b9bcc27 Make the fake ELF object work with gdb.
- Output a .bss section and make all the symbols relative to it, instead
  of making them absolute.
- Output a single load section, no need for two.

'gdb /dev/ksyms' still doesn't work because ksyms doesn't do mmap yet.
2008-12-05 21:38:10 +00:00
ad
8ff4eb83a8 Back out revision 1.35 which is no longer necessary and causes the system
to try autounloading modules perpetually.
2008-12-05 12:55:09 +00:00
ad
6efc20038a PR kern/40110: null, overlay and umap modules loading -> panic (layerfs symbols not there) 2008-12-05 12:51:17 +00:00
he
3e2feea4e5 Ksyms are optional, so make the call to ksyms_init() dependent
on the same conditionals which are defined in sys/conf/files.
2008-12-04 23:18:13 +00:00
christos
579a92f63b PR/40097: bouyer@antioche.lip6.fr: MODULAR tries to unload non-module subsystems
Don't try to unload built-in modules, and if a module is busy don't retry
immediately.
2008-12-03 15:15:01 +00:00
ad
11701b3bf7 Add a couple of sysctls:
kern.module.autoload = 1
kern.module.verbose = 0
2008-12-03 12:14:11 +00:00
ad
6cddbf0ca5 Correct error messages added in revision 1.32. In part from drochner@. 2008-12-03 11:23:15 +00:00
ad
7ad98abc71 - Wrap sys/cpu.h contents in _LOCORE.
- Add a RESCHED_LAZY flag and use instead of zero.
2008-12-02 17:57:32 +00:00
martin
719a906ef5 As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.
2008-11-30 18:21:31 +00:00
elad
67fb7f0d5c PR/40002: Daniel Horecki: sockstat doesn't work for user with sysctl
security.curtain=1

If the kauth call failed, we'd silently continue the loop, but the error
code would remain and eventually "leak" to userspace. Reset the error to
zero when continuing.

Tested by snj@ and myself. Okay snj@.
2008-11-28 18:58:59 +00:00
ad
1a8ada2ed9 exec_add, exec_remove: allow zero entries in case a module provides nothing. 2008-11-28 10:55:10 +00:00
christos
78d77f514f better error messages, and more messages for DIAGNOSTIC. 2008-11-27 21:36:51 +00:00