-
Notifications
You must be signed in to change notification settings - Fork 1
/
0030-Hand-off-coredumps-to-a-wrapper-that-will-optionally.patch
54 lines (50 loc) · 1.68 KB
/
0030-Hand-off-coredumps-to-a-wrapper-that-will-optionally.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 7356368de5b38b7bdc35e6333799907aeb00bfb1 Mon Sep 17 00:00:00 2001
From: William Douglas <[email protected]>
Date: Fri, 27 Jul 2018 17:50:48 +0000
Subject: [PATCH 30/38] Hand off coredumps to a wrapper that will optionally
use telemetry
Send core files to a wrapper script that will try and send the coredumps to the
telemetry core handler if it exists and also send the coredumps to systemd's
core file handler.
---
src/coredump/coredump-wrapper | 17 +++++++++++++++++
sysctl.d/50-coredump.conf.in | 2 +-
2 files changed, 18 insertions(+), 1 deletion(-)
create mode 100755 src/coredump/coredump-wrapper
diff --git a/src/coredump/coredump-wrapper b/src/coredump/coredump-wrapper
new file mode 100755
index 0000000000..1a74a5d6ed
--- /dev/null
+++ b/src/coredump/coredump-wrapper
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+if [ $# != 9 ]; then
+ echo "Expected 9 arguments, got $#"
+ exit -1
+fi
+
+E="$1"
+shift
+
+if [ -x /usr/bin/crashprobe ]; then
+ tee >(/usr/bin/crashprobe -p "$8" -E "$E" -s "$4") | /usr/lib/systemd/systemd-coredump "$@"
+else
+ /usr/lib/systemd/systemd-coredump "$@"
+fi
diff --git a/sysctl.d/50-coredump.conf.in b/sysctl.d/50-coredump.conf.in
index 5fb551a8cf..2cd5a7f95e 100644
--- a/sysctl.d/50-coredump.conf.in
+++ b/sysctl.d/50-coredump.conf.in
@@ -13,7 +13,7 @@
# the core dump.
#
# See systemd-coredump(8) and core(5).
-kernel.core_pattern=|{{LIBEXECDIR}}/systemd-coredump %P %u %g %s %t %c %h
+kernel.core_pattern=|{{LIBEXECDIR}}/coredump-wrapper %E %P %u %g %s %t %c %h %e
# Allow 16 coredumps to be dispatched in parallel by the kernel.
# We collect metadata from /proc/%P/, and thus need to make sure the crashed
--
2.36.1