代码拉取完成,页面将自动刷新
同步操作将从 yangshicheng/systemd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 098a25754b0835ffe078b12f75a1862cf528a986 Mon Sep 17 00:00:00 2001
From: Daan De Meyer <daan.j.demeyer@gmail.com>
Date: Fri, 15 Jul 2022 01:49:25 +0200
Subject: [PATCH] coredump: Connect stdout/stderr to /dev/null before doing
anything
When invoked as the coredump handler by the kernel, systemd-coredump's
stdout and stderr streams are closed. This is dangerous as this means
the fd's can get reallocated, leading to hard to debug errors such as
log messages ending up being appended to a compressed coredump file.
To avoid such issues in the future, let's bind stdout/stderr to
/dev/null so the file descriptors can't get used for anything else.
(cherry picked from commit 1f9d2a8199c261593aa6a11df9cce5d31e23c714)
(cherry picked from commit fba50bc0fc5a69e5573ceadb5d6224f365d3c3f5)
(cherry picked from commit 3e1224d4ac3f44558c7bc3ceec2d6080afe21dc3)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/098a25754b0835ffe078b12f75a1862cf528a986
---
src/coredump/coredump.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index c6639c0100..72df958bc3 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -1268,6 +1268,13 @@ static int process_kernel(int argc, char* argv[]) {
struct iovec_wrapper *iovw;
int r;
+ /* When we're invoked by the kernel, stdout/stderr are closed which is dangerous because the fds
+ * could get reallocated. To avoid hard to debug issues, let's instead bind stdout/stderr to
+ * /dev/null. */
+ r = rearrange_stdio(STDIN_FILENO, -1, -1);
+ if (r < 0)
+ return log_error_errno(r, "Failed to connect stdout/stderr to /dev/null: %m");
+
log_debug("Processing coredump received from the kernel...");
iovw = iovw_new();
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。