Age | Commit message (Collapse) | Author |
|
in ptsignal(), which broke ptrace() in various circumstances, act more like
sigsuspend() by updating the signal mask and picking off waited for signals
when one occurs. Don't always restart when an unwaited-for-but-handled
signal occurs, as that screws with both timeout calculation and cancellation.
main problem noted by jmatthew@
ok tedu@
|
|
even if sysctl kern.nosuidcoredump has been set to 2 or 3. This
allows a regular user to debug his programs again.
OK guenther@ deraadt@
|
|
receiving broadcast signals (kill -1). The flag can be set via a new
sysctl KERN_PROC_NOBROADCASTKILL. This will be used by iscsid to survive
the mass killing by init(8) when terminating multi-user operations.
With and OK guenther@
|
|
This adds a new assertion macro, KERNEL_ASSERT_LOCKED(), to assert that
kernel_lock is held. In the long process of removing kernel_lock, there will
be a lot (hundreds or thousands) of use of this; virtually almost all functions
in !MP-safe subsystems should have this assertion. Thus this assertion should
have a short, good name.
Not only that "KERNEL_ASSERT_LOCKED" is consistent with other KERNEL_* and
SCHED_ASSERT_LOCKED() macros.
Input from dlg@ guenther@ kettenis@.
OK dlg@ guenther@
|
|
Discussed with guenther and kettenis
|
|
Remember initprocess instead of initproc.
ok matthew@ blambert@
|
|
don't need to be married.
ok guenther miod beck jsing kettenis
|
|
PS_{ZOMBIE,EMBRYO} on the process instead of peeking into the process's
thread data. This eliminates the need for the thread-level SDEAD state.
Change kvm_getprocs() (both the sysctl() and kvm backends) to report the
"most active" scheduler state for the process's threads.
tweaks kettenis@
feedback and ok matthew@
|
|
an untraced process but finds it blocking or ignoring it, just kill
the process instead of looping. It's undefined behavor in POSIX but
quite annoying when encountered in practice.
improvements from kettenis@
ok matthew@
|
|
and FORK_SYSTEM as a flag to set them. This eliminates needing to
peek into other processes threads in various places. Inspired by NetBSD
ok miod@ matthew@
|
|
the /var/crash/programname/ directory, as root. For instance,
# mkdir /var/crash/bgpd/
# chmod 700 /var/crash/bgpd/ # If you skip this step, you are a moron
# sysctl kern.nosuidcoredump=3
# bgpd
# pkill -ABRT bgpd
# ls /var/crash/bgpd/
14764.core 23207.core 6423.core
Of course, in real life the idea is that you don't kill the daemon but it
crashes and you collect parallel cores. Careful you don't fill your /var.
Further tuneables are being considered.
Sorry to be picking on bgpd for this example. I've watched the "too
difficult to debug privsep code" angst for far too long.
ok guenther
|
|
to avoid possible use-after-free references when swapping ids in threaded
processes. "Do I have the right creds?" checks are always made with the
threads creds.
Inspired by FreeBSD and NetBSD
"right time" deraadt@
|
|
struct ucred; struct process then directly links to the ucred
Based on a discussion at c2k10 or so before noting that FreeBSD and
NetBSD did this too.
ok matthew@
|
|
dropping the pcred argument. Fix handling of kill(-1, sig) from a
thread other than the original thread.
ok deraadt@
|
|
Tweak the handling of ktrace EMUL when changing ktracing: only
generate one per process (not one per thread) and pass the correct
proc pointer down to the VFS layer. Permit generating of NAMI and
CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
|
included there
|
|
testing help mpi@
|
|
multi-threaded processes when they receive a signal:
1. Make the parent of the process (the tracer) wait for all threads to be
stopped (in wait4(2)) instead of the thread that received the signal.
This prevents us from calling tsleep(9) recursively.
2. Assume that we already hold the kernel lock if the P_SINTR flag is set
(just like we already assumed we were holding the scheduler lock) and
don't try to grab it again.
This should fix the panic that many people reported when debugging
multi-threaded programs with gdb(1).
ok & lots of help from guenther@
|
|
|
|
make it a list of processes, and change P_NOZOMBIE and P_STOPPED from thread
flags to process flags. Add allprocess list for the code that just wants
to see processes.
ok tedu@
|
|
hardclock() set a flag on the running thread and force AST processing,
and then have the thread signal itself from userret().
idea and flag names from FreeBSD
ok jsing@
|
|
take the signal by preference if it's eligible (unblocked or sigwaiting).
ok jsing@
|
|
|
|
|
|
sigmask even if there are no pending signals under the temporary
sigmask.
Refactor existing select() and poll() system calls to introduce the
pselect() and ppoll() system calls.
Add rthread wrappers for pselect() and ppoll(). While there, update
cancellation point comments to reflect recent fdatasync() addition.
Minor bumps for libc and librthread due to new symbols.
ok guenther, millert, deraadt, jmc
|
|
|
|
.h files to pull it in, if needed
ok tedu
|
|
up the VFS calls in the error paths in coredump()
Pointed out by armani@, ok beck@
|
|
with kettenis guenther and beck.
ok guenther
|
|
yield between operations. Re-grab the vnode every operation,
so that multiple coredumps can be saved at the same time.
ok guenther beck etc
|
|
dynamically, by comparing the stack pointer against the altstack
base and size, so that you get the correct answer if you longjmp
out of the signal handler, as tested by regress/sys/kern/stackjmp/.
Also, fix alt stack handling on vax, where it was completely broken.
Testing and corrections by miod@, krw@, tobiasu@, pirofti@
|
|
thread coredumps, the former thread needs to be released by the
later single_thread_set(SINGLE_EXIT) call, even though its P_WEXIT
flag is set.
ok kettenis@
|
|
can be suspended and/or decrement pr->ps_singlecount if necessary.
With that added, the call the other direction needs to use its own
flag (EXIT_THREAD_NOCHECK) to avoid looping.
problem diagnosed from a hang naddy@ hit; ok kettenis@
|
|
attached to and not just the thread, which can go away.
Problem observed by jsg@; ok jsg@ matthew@
|
|
It implements a full-stop model where all threads are stopped before handing
over control to the debugger. Events are reported as before through wait(2);
you will have to call ptrace(PT_GET_PROCESS_STATE, ...) to find out which
thread hit the event. Since this changes the size of struct ptrace_state,
you will have to recompile gdb.
ok guenther@
|
|
|
|
ok guenther@
|
|
of per-rthread. Handling of per-thread tick and runtime counters
inspired by how FreeBSD does it.
ok kettenis@
|
|
structs timespec, timeval, sigaction, and rlimit.
ok otto@ jsing@
|
|
|
|
the main thread exiting. c.f. regress/sys/kern/main-thread-exited/
|
|
- move the P_TRACED and P_INEXEC flags, and p_oppid, p_ptmask, and
p_ptstat member from struct proc to struct process
- sort the PT_* requests into those that take a PID vs those that
can also take a TID
- stub in PT_GET_THREAD_FIRST and PT_GET_THREAD_NEXT
ok kettenis@
|
|
for the thread handling it. Otherwise (i.e., no sig divert), prefer
to deliver a process-aimed signal to some thread which doesn't have
the signal blocked.
ok tedu@
|
|
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.
Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().
Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.
|
|
when exec succeeds.
ok jsing@
|
|
copied area, and initialize it properly in the FORK_THREAD case.
This restores the behavior of a forked process inheriting its parent's
signal stack.
ok guenther@
|
|
past, pull that code out seperately.
ok guenther miod
|
|
and use curp vs p instead of p1 vs p2. Add curpr and pr variables
for the respective struct processes. Make sigactsshare() return
the shared sigacts intead of taking the struct proc to update.
ok deraadt@
|
|
layers. Then things get terribly confusing because the various MI layers
swap variable names for parameters, local variables, and structure fields
numerous times. Unconfuse all this mess.
Note that exec_elf.c coredump cpi_sigcode used to contain the MD traptype
but will now contain the MI siginfo-style "code" value.
ok miod kettenis pirofti
|
|
as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|