Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170980635
D24813.id71660.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D24813.id71660.diff
View Options
Index: sys/kern/kern_sig.c
===================================================================
--- sys/kern/kern_sig.c
+++ sys/kern/kern_sig.c
@@ -189,6 +189,10 @@
SYSCTL_INT(_kern, OID_AUTO, coredump, CTLFLAG_RW,
&do_coredump, 0, "Enable/Disable coredumps");
+static int do_corestop = 0;
+SYSCTL_INT(_kern, OID_AUTO, corestop, CTLFLAG_RW,
+ &do_corestop, 0, "Send SIGSTOP before dumping core");
+
static int set_core_nodump_flag = 0;
SYSCTL_INT(_kern, OID_AUTO, nodump_coredump, CTLFLAG_RW, &set_core_nodump_flag,
0, "Enable setting the NODUMP flag on coredump files");
@@ -2004,6 +2008,7 @@
struct sigacts *ps;
struct proc *p;
sigset_t sigmask;
+ char pidstr[16];
int code, sig;
p = td->td_proc;
@@ -2018,6 +2023,15 @@
sigmask = td->td_sigmask;
if (td->td_sigblock_val != 0)
SIGSETOR(sigmask, fastblock_mask);
+
+ if (do_corestop && (sigprop(sig) & SIGPROP_CORE) &&
+ (p->p_flag2 & P2_CORESTOPPED) == 0) {
+ ksi->ksi_signo = sig = SIGSTOP;
+ p->p_flag2 |= P2_CORESTOPPED;
+ snprintf(pidstr, sizeof(pidstr), "pid=%d", p->p_pid);
+ devctl_notify("kernel", "signal", "corestop", pidstr);
+ }
+
if ((p->p_flag & P_TRACED) == 0 && SIGISMEMBER(ps->ps_sigcatch, sig) &&
!SIGISMEMBER(sigmask, sig)) {
#ifdef KTRACE
Index: sys/sys/proc.h
===================================================================
--- sys/sys/proc.h
+++ sys/sys/proc.h
@@ -782,6 +782,7 @@
#define P2_PROTMAX_DISABLE 0x00000400 /* Force disable implied PROT_MAX. */
#define P2_STKGAP_DISABLE 0x00000800 /* Disable stack gap for MAP_STACK */
#define P2_STKGAP_DISABLE_EXEC 0x00001000 /* Stack gap disabled after exec */
+#define P2_CORESTOPPED 0x00002000 /* Crashed, got SIGSTOP */
/* Flags protected by proctree_lock, kept in p_treeflags. */
#define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 9, 12:04 AM (6 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38547906
Default Alt Text
D24813.id71660.diff (1 KB)
Attached To
Mode
D24813: Corestop.
Attached
Detach File
Event Timeline
Log In to Comment