Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

expect SIGBUS for PROT_NONE access on macOS/*BSD due to overlapped timer #34

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions include/eosio/vm/signals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ namespace eosio { namespace vm {

//a failure in the code range...
if (addr >= code_memory_range.data() && addr < code_memory_range.data() + code_memory_range.size()) {
//a SEGV in the code range when timed_run_has_timed_out=false is due to a _different_ thread's execution activating a deadline
//a SEGV/BUS in the code range when timed_run_has_timed_out=false is due to a _different_ thread's execution activating a deadline
// timer. Return and retry executing the same code again. Eventually timed_run() on the other thread will reset the page
// permissions and progress on this thread can continue
if (sig == SIGSEGV && timed_run_has_timed_out.load(std::memory_order_acquire) == false)
//on linux no SIGBUS handler is registered (see setup_signal_handler_impl()) so it will never occur here
if ((sig == SIGSEGV || sig == SIGBUS) && timed_run_has_timed_out.load(std::memory_order_acquire) == false)
return;
//otherwise, jump out
siglongjmp(*dest, sig);
Expand Down