From 82876c3bf24be50a54d132d79e573accabb83e2d Mon Sep 17 00:00:00 2001 From: ExtinctFire Date: Fri, 16 Oct 2020 15:59:22 +0800 Subject: [PATCH] use upstream solution to set kernel.core_pipe_limit=16 Signed-off-by: ExtinctFire --- change-default-coredump-path.patch | 25 ----------- sysctl-set-kernel.core_pipe_limit-16.patch | 51 ++++++++++++++++++++++ systemd.spec | 10 ++++- 3 files changed, 59 insertions(+), 27 deletions(-) delete mode 100644 change-default-coredump-path.patch create mode 100644 sysctl-set-kernel.core_pipe_limit-16.patch diff --git a/change-default-coredump-path.patch b/change-default-coredump-path.patch deleted file mode 100644 index c4a5368..0000000 --- a/change-default-coredump-path.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0152674da19404b89c4efc607b112d567e533887 Mon Sep 17 00:00:00 2001 -From: Yangyang Shen -Date: Sat, 26 Sep 2020 18:53:43 +0800 -Subject: [PATCH] change default coredump path - ---- - sysctl.d/50-coredump.conf.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sysctl.d/50-coredump.conf.in b/sysctl.d/50-coredump.conf.in -index da76fd7..756ce24 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=|@rootlibexecdir@/systemd-coredump %P %u %g %s %t %c %h -+kernel.core_pattern=/var/lib/systemd/coredump/core-%e-%p-%t - - # Also dump processes executing a set-user-ID/set-group-ID program that is - # owned by a user/group other than the real user/group ID of the process, or --- -2.23.0 - diff --git a/sysctl-set-kernel.core_pipe_limit-16.patch b/sysctl-set-kernel.core_pipe_limit-16.patch new file mode 100644 index 0000000..b606485 --- /dev/null +++ b/sysctl-set-kernel.core_pipe_limit-16.patch @@ -0,0 +1,51 @@ +From 2a9b9323cd844baae3229e9dba67e478bee70654 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 12 Oct 2020 16:31:42 +0200 +Subject: [PATCH 042/100] sysctl: set kernel.core_pipe_limit=16 + +We need to make sure that our coredump pattern handler manages to read +process metadata from /proc/$PID/ before the kernel reaps the crashed +process. By default the kernel will reap the process as soon as it can. +By setting kernel.core_pipe_limit to a non-zero the kernel will wait for +userspace to finish before reaping. + +We'll set the value to 16, which allows 16 crashes to be +processed in parallel. This matches the MaxConnections= setting in +systemd-coredump.socket. + +See: #17301 + +(This doesn't close 17301, since we probably should also gracefully +handle if /proc/$PID/ vanished already while our coredump handler runs, +just in case people loclly set the sysctl back to zero. i.e. we should +collect what we can and rather issue an incomplete log record than +none.) +--- + sysctl.d/50-coredump.conf.in | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/sysctl.d/50-coredump.conf.in b/sysctl.d/50-coredump.conf.in +index da76fd71d6..4338756efd 100644 +--- a/sysctl.d/50-coredump.conf.in ++++ b/sysctl.d/50-coredump.conf.in +@@ -15,6 +15,17 @@ + # See systemd-coredump(8) and core(5). + kernel.core_pattern=|@rootlibexecdir@/systemd-coredump %P %u %g %s %t %c %h + ++# Allow that 16 coredumps are dispatched in parallel by the kernel. We want to ++# be able to collect process metadata from /proc/%P/ while processing ++# coredumps, and thus need to make sure the crashed processes are not reaped ++# until we finished collecting what we need. The kernel default for this sysctl ++# is "0" which means the kernel doesn't wait for userspace processes to finish ++# processing before reaping the crashed processes — by setting this higher the ++# kernel will delay reaping until we are done, but only for the specified ++# number of crashes in parallel. The value of 16 is chosen to match ++# systemd-coredump.socket's MaxConnections= value. ++kernel.core_pipe_limit=16 ++ + # Also dump processes executing a set-user-ID/set-group-ID program that is + # owned by a user/group other than the real user/group ID of the process, or + # a program that has file capabilities. ("2" is called "suidsafe" in core(5)). +-- +2.23.0 + diff --git a/systemd.spec b/systemd.spec index 6f2db0c..42d485e 100644 --- a/systemd.spec +++ b/systemd.spec @@ -20,7 +20,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 246 -Release: 9 +Release: 10 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -68,7 +68,7 @@ Patch0016: systemd-change-time-log-level.patch Patch0017: fix-capsh-drop-but-ping-success.patch Patch0018: 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch %ifarch aarch64 -Patch0019: change-default-coredump-path.patch +Patch0019: sysctl-set-kernel.core_pipe_limit-16.patch %endif BuildRequires: gcc, gcc-c++ @@ -1493,6 +1493,12 @@ fi %exclude /usr/share/man/man3/* %changelog +* Fri Oct 16 2020 openEuler Buildteam - 246-10 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:modify the last modification with upstream patch, set kernel.core_pipe_limit=16 + * Sun Sep 27 2020 openEuler Buildteam - 246-9 - Type:enhancement - ID:NA -- Gitee