RFR: 8304725: AsyncGetCallTrace can cause SIGBUS on M1

Johannes Bechberger jbechberger at openjdk.org
Thu Mar 23 07:29:45 UTC 2023


On Thu, 23 Mar 2023 07:03:04 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> You now effectively disable execution of generated code for the whole extend of AGCT?

That's exactly what async-profiler does already https://github.com/async-profiler/async-profiler/blob/c8de91df6b090af82e91a066deb81a3afb505331/src/profiler.cpp#L383, I wonder why we don't have problems there with SafeFetch on older JVMs.

> Okay. Though the prospect of async profiler modifying the code cache by walking the stack seems scary.

We discussed it before. It's probably safe, but yes, my initial reaction was also "why not just remove this", but it should have a performance impact.

> Drive by comment: how async safe is WX enabler? If a thread is in the middle of it and we shoot a signal and enable, what will happen?

This is a really good point. I think that making the field that stores this information `volatile` could alleviate the problem (?). This would ensure that no reordering takes place in:


 _wx_state = WXWrite;
  os::current_thread_enable_wx(_wx_state);

(https://github.com/openjdk/jdk/blob/77cd917a97b184871ab2d3325ceb6c53afeca28b/src/hotspot/share/runtime/thread.inline.hpp#L78)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/13144#issuecomment-1480713645


More information about the serviceability-dev mailing list