display.c: backport: async-signal-unsafe handler deadlocks on SIGHUP
This commit is contained in:
parent
1a1d977eae
commit
ff1b03de5d
44
display-sig-unsafe.patch
Normal file
44
display-sig-unsafe.patch
Normal file
@ -0,0 +1,44 @@
|
||||
diff -up ./ps/display.c.ori ./ps/display.c
|
||||
--- ./ps/display.c.ori 2021-02-09 11:11:25.000000000 +0100
|
||||
+++ ./ps/display.c 2022-11-29 18:39:13.254573784 +0100
|
||||
@@ -44,6 +44,8 @@
|
||||
#define SIGCHLD SIGCLD
|
||||
#endif
|
||||
|
||||
+#define SIG_IS_TERM_OR_HUP(signo) (((signo) == SIGTERM) || (signo) == SIGHUP)
|
||||
+
|
||||
char *myname;
|
||||
|
||||
/* just reports a crash */
|
||||
@@ -54,20 +56,23 @@ static void signal_handler(int signo){
|
||||
sigprocmask(SIG_BLOCK, &ss, NULL);
|
||||
if(signo==SIGPIPE) _exit(0); /* "ps | head" will cause this */
|
||||
/* fprintf() is not reentrant, but we _exit() anyway */
|
||||
- fprintf(stderr,
|
||||
- _("Signal %d (%s) caught by %s (%s).\n"),
|
||||
- signo,
|
||||
- signal_number_to_name(signo),
|
||||
- myname,
|
||||
- PACKAGE_VERSION
|
||||
- );
|
||||
+ if (!SIG_IS_TERM_OR_HUP(signo)) {
|
||||
+ fprintf(stderr,
|
||||
+ _("Signal %d (%s) caught by %s (%s).\n"),
|
||||
+ signo,
|
||||
+ signal_number_to_name(signo),
|
||||
+ myname,
|
||||
+ PACKAGE_VERSION
|
||||
+ );
|
||||
+ }
|
||||
switch (signo) {
|
||||
case SIGHUP:
|
||||
case SIGUSR1:
|
||||
case SIGUSR2:
|
||||
exit(EXIT_FAILURE);
|
||||
default:
|
||||
- error_at_line(0, 0, __FILE__, __LINE__, "%s", _("please report this bug"));
|
||||
+ if (!SIG_IS_TERM_OR_HUP(signo))
|
||||
+ error_at_line(0, 0, __FILE__, __LINE__, "%s", _("please report this bug"));
|
||||
signal(signo, SIG_DFL); /* allow core file creation */
|
||||
sigemptyset(&ss);
|
||||
sigaddset(&ss, signo);
|
@ -4,7 +4,7 @@
|
||||
Summary: System and process monitoring utilities
|
||||
Name: procps-ng
|
||||
Version: 3.3.17
|
||||
Release: 8%{?dist}
|
||||
Release: 9%{?dist}
|
||||
License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
|
||||
URL: https://sourceforge.net/projects/procps-ng/
|
||||
|
||||
@ -22,6 +22,7 @@ Patch4: free-new-used-calc.patch
|
||||
Patch5: sysctl-support-systemd-globs.patch
|
||||
Patch6: sysctl-print-dotted-keys-again.patch
|
||||
Patch7: pgrep-uid-gid-overflow-backport.patch
|
||||
Patch8: display-sig-unsafe.patch
|
||||
|
||||
|
||||
BuildRequires: make
|
||||
@ -165,6 +166,10 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
|
||||
%files i18n -f %{name}.lang
|
||||
|
||||
%changelog
|
||||
* Tue Nov 29 2022 Jan Rybar <jrybar@redhat.com> - 3.3.17-9
|
||||
- display.c: backport: async-signal-unsafe handler deadlocks on SIGHUP
|
||||
- Resolves: rhbz#2141697
|
||||
|
||||
* Thu Aug 18 2022 Jan Rybar <jrybar@redhat.com> - 3.3.17-8
|
||||
- pgrep: uid/gid overflow fix backport
|
||||
- Resolves: rhbz#2119083
|
||||
|
Loading…
Reference in New Issue
Block a user