Skip to content

Commit a9c9c28

Browse files
committed
Move sandbox disablement within Signals.inc
1 parent fbb67e6 commit a9c9c28

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

llvm/lib/Support/Unix/Signals.inc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ void sys::unregisterHandlers() {
354354

355355
/// Process the FilesToRemove list.
356356
static void RemoveFilesToRemove() {
357-
[[maybe_unused]] auto BypassSandbox = sys::sandbox::scopedDisable();
358357
FileToRemoveList::removeAllFiles(FilesToRemove);
359358
}
360359

@@ -443,7 +442,11 @@ static void InfoSignalHandler(int Sig) {
443442
CurrentInfoFunction();
444443
}
445444

446-
void llvm::sys::RunInterruptHandlers() { RemoveFilesToRemove(); }
445+
void sys::RunInterruptHandlers() {
446+
[[maybe_unused]] auto BypassSandbox = sandbox::scopedDisable();
447+
448+
RemoveFilesToRemove();
449+
}
447450

448451
void llvm::sys::SetInterruptFunction(void (*IF)()) {
449452
InterruptFunction.exchange(IF);

llvm/lib/Support/Windows/Signals.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,13 +563,11 @@ static void Cleanup(bool ExecuteSignalHandlers) {
563563
CleanupExecuted = true;
564564

565565
// FIXME: open files cannot be deleted.
566-
if (FilesToRemove != NULL) {
567-
[[maybe_unused]] auto BypassSandbox = sys::sandbox::scopedDisable();
566+
if (FilesToRemove != NULL)
568567
while (!FilesToRemove->empty()) {
569568
llvm::sys::fs::remove(FilesToRemove->back());
570569
FilesToRemove->pop_back();
571570
}
572-
}
573571

574572
if (ExecuteSignalHandlers)
575573
llvm::sys::RunSignalHandlers();
@@ -578,6 +576,8 @@ static void Cleanup(bool ExecuteSignalHandlers) {
578576
}
579577

580578
void llvm::sys::RunInterruptHandlers() {
579+
[[maybe_unused]] auto BypassSandbox = sandbox::scopedDisable();
580+
581581
// The interrupt handler may be called from an interrupt, but it may also be
582582
// called manually (such as the case of report_fatal_error with no registered
583583
// error handler). We must ensure that the critical section is properly

0 commit comments

Comments
 (0)