!19 fixup non-lethal signals (REQ_INFO, FLUSH_PCAP) to avoid corrupting binary pcap output

From: @kylinos-zhangqiang 
Reviewed-by: @zengwefeng 
Signed-off-by: @zengwefeng
This commit is contained in:
openeuler-ci-bot 2022-08-24 03:18:41 +00:00 committed by Gitee
commit 244b71d5ad
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,33 @@
From 8a28e07f3bfd2a031491db55173370e10dc074e3 Mon Sep 17 00:00:00 2001
From: Alexandre Ferrieux <alexandre.ferrieux@orange.com>
Date: Sat, 16 Jul 2022 21:34:39 +0200
Subject: [PATCH] Set SA_RESTART on non-lethal signals (REQ_INFO, FLUSH_PCAP)
to avoid corrupting binary pcap output
---
tcpdump.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tcpdump.c b/tcpdump.c
index e028d2e7..515edf5d 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -2743,7 +2743,14 @@ static void
memset(&new, 0, sizeof(new));
new.sa_handler = func;
- if (sig == SIGCHLD)
+ if ((sig == SIGCHLD)
+# ifdef SIGNAL_REQ_INFO
+ || (sig == SIGNAL_REQ_INFO)
+# endif
+# ifdef SIGNAL_FLUSH_PCAP
+ || (sig == SIGNAL_FLUSH_PCAP)
+# endif
+ )
new.sa_flags = SA_RESTART;
if (sigaction(sig, &new, &old) < 0)
return (SIG_ERR);
--
2.25.1

View File

@ -1,7 +1,7 @@
Name: tcpdump Name: tcpdump
Epoch: 14 Epoch: 14
Version: 4.99.1 Version: 4.99.1
Release: 2 Release: 3
Summary: A network traffic monitoring tool Summary: A network traffic monitoring tool
License: BSD with advertising License: BSD with advertising
URL: http://www.tcpdump.org URL: http://www.tcpdump.org
@ -14,6 +14,7 @@ Patch0: backport-0002-Use-getnameinfo-instead-of-gethostbyaddr.patch
Patch1: backport-0003-Drop-root-priviledges-before-opening-first-savefile-.patch Patch1: backport-0003-Drop-root-priviledges-before-opening-first-savefile-.patch
Patch2: backport-0007-Introduce-nn-option.patch Patch2: backport-0007-Introduce-nn-option.patch
Patch3: backport-0009-Change-n-flag-to-nn-in-TESTonce.patch Patch3: backport-0009-Change-n-flag-to-nn-in-TESTonce.patch
Patch4: backport-0090-Set-SA_RESTART-non-lethal-signals-avoid-corrupting-binary-pcap-output.patch
Requires(pre): shadow-utils Requires(pre): shadow-utils
BuildRequires: automake openssl-devel libpcap-devel git-core gcc BuildRequires: automake openssl-devel libpcap-devel git-core gcc
@ -87,6 +88,12 @@ make check
%{_mandir}/man8/tcpdump.8* %{_mandir}/man8/tcpdump.8*
%changelog %changelog
* Wed Aug 17 2022 zhangqiang <zhangqiang@kylinos.cn> - 14:4.99.1-3
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:Set SA_RESTART on non-lethal signals (REQ_INFO, FLUSH_PCAP) to avoid corrupting binary pcap output
* Sat Jun 11 2022 gaihuiying <eaglegai@163.com> - 4.99.1-2 * Sat Jun 11 2022 gaihuiying <eaglegai@163.com> - 4.99.1-2
- Type:bugfix - Type:bugfix
- CVE:NA - CVE:NA