1 Star 0 Fork 25

src-oepkgs-oE-rv/procps-ng

forked from src-openEuler/procps-ng 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-0003-top-at-abnormal-end-allow-core-dumps-fix-qualys-bug.patch 1.79 KB
一键复制 编辑 原始数据 按行查看 历史
吴超超 提交于 2020-11-03 14:28 . sync patchs
From 9e4c2cca392399d7e1cf167816913581631b842c Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Fri, 3 Jan 2020 00:00:00 -0600
Subject: [PATCH] top: at abnormal end allow core dumps (fix qualys bug)
A Qualys audit patch, represented in the commit below,
added the _exit() call to our abnormal signal handler.
Unfortunately, that disabled the associated core dump.
This patch restores expected behavior of those signals
whose default produces a core dump file + termination.
Reference(s):
commit 0847390b8335c1747a3ea0944123b2f594251bc0
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/top/top.c b/top/top.c
index 09b8ef9..8e8c7d9 100644
--- a/top/top.c
+++ b/top/top.c
@@ -579,18 +579,22 @@ static void error_exit (const char *str) {
/*
* Catches all remaining signals not otherwise handled */
+static void sig_abexit (int sig) NORETURN;
static void sig_abexit (int sig) {
sigset_t ss;
-// POSIX.1-2004 async-signal-safe: sigfillset, sigprocmask, signal, raise
+// POSIX.1-2004 async-signal-safe: sigfillset, sigprocmask, signal, sigemptyset, sigaddset, raise
sigfillset(&ss);
sigprocmask(SIG_BLOCK, &ss, NULL);
at_eoj(); // restore tty in preparation for exit
fprintf(stderr, N_fmt(EXIT_signals_fmt)
, sig, signal_number_to_name(sig), Myname);
signal(sig, SIG_DFL); // allow core dumps, if applicable
+ sigemptyset(&ss);
+ sigaddset(&ss, sig);
+ sigprocmask(SIG_UNBLOCK, &ss, NULL);
raise(sig); // ( plus set proper return code )
- _exit(sig | 0x80); // if default sig action is ignore
+ _exit(EXIT_FAILURE); // if default sig action is ignore
} // end: sig_abexit
--
2.22.0.windows.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-oepkgs-oe-rv/procps-ng.git
git@gitee.com:src-oepkgs-oe-rv/procps-ng.git
src-oepkgs-oe-rv
procps-ng
procps-ng
master

搜索帮助