[compiler-rt] Reapply "[sanitizer_common] AND signals in BlockSignals instead of deleting (#113443)" for non-Android Linux only (PR #115790)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 15:56:41 PST 2024
================
@@ -164,33 +164,57 @@ void SetSigProcMask(__sanitizer_sigset_t *set, __sanitizer_sigset_t *oldset) {
CHECK_EQ(0, internal_sigprocmask(SIG_SETMASK, set, oldset));
}
+# if SANITIZER_LINUX
+// Deletes the specified signal from newset, if it is not present in oldset
+// Equivalently: newset[signum] = newset[signum] & oldset[signum]
+static void KeepUnblocked(__sanitizer_sigset_t &newset,
+ __sanitizer_sigset_t &oldset, int signum) {
+ // FIXME: https://github.com/google/sanitizers/issues/1816
+ if (SANITIZER_ANDROID || !internal_sigismember(&oldset, signum))
+ internal_sigdelset(&newset, signum);
+}
+# endif
+
// Block asynchronous signals
void BlockSignals(__sanitizer_sigset_t *oldset) {
- __sanitizer_sigset_t set;
- internal_sigfillset(&set);
+# if SANITIZER_LINUX
+ __sanitizer_sigset_t currentset;
+
+# if !SANITIZER_ANDROID
+ // FIXME: https://github.com/google/sanitizers/issues/1816
+ SetSigProcMask(NULL, ¤tset);
+# endif // SANITIZER_ANDROID
+# endif // SANITIZER_LINUX
+
+ __sanitizer_sigset_t newset;
----------------
vitalybuka wrote:
Move this into the begining of the function,
```
__sanitizer_sigset_t newset;
internal_sigfillset(&newset);
```
and we can have single `if SANITIZER_LINUX` for the whole function
https://github.com/llvm/llvm-project/pull/115790
More information about the llvm-commits
mailing list