Skip to content

Commit 625f812

Browse files
committed
Refactor
1 parent 8ec1550 commit 625f812

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -180,28 +180,25 @@ void BlockSignals(__sanitizer_sigset_t *oldset) {
180180
# if SANITIZER_LINUX
181181
__sanitizer_sigset_t currentset;
182182

183-
# if !SANITIZER_ANDROID
183+
__sanitizer_sigset_t newset;
184+
internal_sigfillset(&newset);
185+
186+
# if !SANITIZER_ANDROID
184187
// FIXME: https://github.com/google/sanitizers/issues/1816
185188
SetSigProcMask(NULL, &currentset);
186-
# endif // SANITIZER_ANDROID
187-
# endif // SANITIZER_LINUX
188189

189-
__sanitizer_sigset_t newset;
190-
internal_sigfillset(&newset);
191-
# if SANITIZER_LINUX && !SANITIZER_ANDROID
192190
// Glibc uses SIGSETXID signal during setuid call. If this signal is blocked
193191
// on any thread, setuid call hangs.
194192
// See test/sanitizer_common/TestCases/Linux/setuid.c.
195193
KeepUnblocked(newset, currentset, 33);
196-
# endif
197-
# if SANITIZER_LINUX
194+
# endif // !SANITIZER_ANDROID
195+
198196
// Seccomp-BPF-sandboxed processes rely on SIGSYS to handle trapped syscalls.
199197
// If this signal is blocked, such calls cannot be handled and the process may
200198
// hang.
201199
KeepUnblocked(newset, currentset, 31);
202-
# endif
203200

204-
# if SANITIZER_LINUX && !SANITIZER_ANDROID
201+
# if !SANITIZER_ANDROID
205202
// Don't block synchronous signals
206203
// but also don't unblock signals that the user had deliberately blocked.
207204
// FIXME: https://github.com/google/sanitizers/issues/1816
@@ -212,9 +209,10 @@ void BlockSignals(__sanitizer_sigset_t *oldset) {
212209
KeepUnblocked(newset, currentset, SIGABRT);
213210
KeepUnblocked(newset, currentset, SIGFPE);
214211
KeepUnblocked(newset, currentset, SIGPIPE);
215-
# endif
212+
# endif //! SANITIZER_ANDROID
216213

217214
SetSigProcMask(&newset, oldset);
215+
# endif // SANITIZER_LINUX
218216
}
219217

220218
ScopedBlockSignals::ScopedBlockSignals(__sanitizer_sigset_t *copy) {

0 commit comments

Comments
 (0)