Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame^] | 1 | From 696891f6c5a1c6acab95dffd8c1d3a986ca71a18 Mon Sep 17 00:00:00 2001 |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2 | From: Yousong Zhou <yszhou4tech@gmail.com> |
| 3 | Date: Fri, 24 Mar 2017 10:36:03 +0800 |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame^] | 4 | Subject: [PATCH] Fix invalid sigprocmask call |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 5 | MIME-Version: 1.0 |
| 6 | Content-Type: text/plain; charset=UTF-8 |
| 7 | Content-Transfer-Encoding: 8bit |
| 8 | |
| 9 | The POSIX document says |
| 10 | |
| 11 | The pthread_sigmask() and sigprocmask() functions shall fail if: |
| 12 | |
| 13 | [EINVAL] |
| 14 | The value of the how argument is not equal to one of the defined values. |
| 15 | |
| 16 | and this is how musl-libc is currently doing. Fix the call to be safe |
| 17 | and correct |
| 18 | |
| 19 | [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html |
| 20 | |
| 21 | gdb/ChangeLog: |
| 22 | 2017-03-24 Yousong Zhou <yszhou4tech@gmail.com> |
| 23 | |
| 24 | * common/signals-state-save-restore.c (save_original_signals_state): |
| 25 | Fix invalid sigprocmask call. |
| 26 | |
| 27 | Upstream-Status: Pending [not author, cherry-picked from LEDE https://bugs.lede-project.org/index.php?do=details&task_id=637&openedfrom=-1%2Bweek] |
| 28 | Signed-off-by: André Draszik <adraszik@tycoint.com> |
| 29 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 30 | --- |
| 31 | gdbsupport/signals-state-save-restore.cc | 2 +- |
| 32 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 33 | |
| 34 | diff --git a/gdbsupport/signals-state-save-restore.cc b/gdbsupport/signals-state-save-restore.cc |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame^] | 35 | index 3ec7a259c9c..0702eca7725 100644 |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 36 | --- a/gdbsupport/signals-state-save-restore.cc |
| 37 | +++ b/gdbsupport/signals-state-save-restore.cc |
| 38 | @@ -38,7 +38,7 @@ save_original_signals_state (bool quiet) |
| 39 | int i; |
| 40 | int res; |
| 41 | |
| 42 | - res = gdb_sigmask (0, NULL, &original_signal_mask); |
| 43 | + res = gdb_sigmask (SIG_BLOCK, NULL, &original_signal_mask); |
| 44 | if (res == -1) |
| 45 | perror_with_name (("sigprocmask")); |
| 46 | |