Skip to content

Disable preserve_none under ASAN due to bugs#21676

Open
morrisonlevi wants to merge 1 commit intophp:masterfrom
morrisonlevi:preserve-none-asan
Open

Disable preserve_none under ASAN due to bugs#21676
morrisonlevi wants to merge 1 commit intophp:masterfrom
morrisonlevi:preserve-none-asan

Conversation

@morrisonlevi
Copy link
Copy Markdown
Contributor

@morrisonlevi morrisonlevi commented Apr 8, 2026

@iluuu1994
Copy link
Copy Markdown
Member

iluuu1994 commented Apr 8, 2026

This is a bit unfortunate, as it makes it impossible to test the tailcall VM with ASAN. The error disappeared for me with Clang 21 (see llvm/llvm-project#95928 (comment)). Which Clang version are you running?

@iluuu1994 iluuu1994 requested a review from arnaud-lb April 8, 2026 20:28
@morrisonlevi
Copy link
Copy Markdown
Contributor Author

morrisonlevi commented Apr 9, 2026

I had issues on clang 19 (to intentionally match Rust 1.84-1.88 for cross-langauge LTO and other reasons) on aarch64. I saw your comment when looking at the PRs! "Hey, that's a friendly face!" However, the fact that LLVM disabled it in main just a week ago does not give me confidence to enable this for any version, when ASAN is enabled, which is why I opened this PR. They cited issues on x86_64 as well. Thoughts?

@iluuu1994
Copy link
Copy Markdown
Member

However, the fact that LLVM disabled it in main just a week ago does not give me confidence to enable this for any version

Yeah, that's fair. Though it's also possible this is only an issue with C++ in Clang 20+, but not C. Hence I'd prefer only enabling this if we run into an actual issue, especially considering this is exclusively a development configuration.

But ultimately, Arnaud should decide.

@iluuu1994
Copy link
Copy Markdown
Member

Or maybe disable it only for Clang 19 and lower.

@arnaud-lb
Copy link
Copy Markdown
Member

There appears to be two known issues with preserve_none:

For the first issue, I agree that we should disable preserve_none when using Clang 19 and lower + ASan.

I've investigated the second issue a bit, and found that it's likely a more general AArch64+preserve_none issue, unfortunately: llvm/llvm-project#177519 (comment).

This happens in specific conditions where the compiler can not use the stack pointer directly, and must address locals via x19, the "base pointer". The spilling logic in the AArch64 backend seems to ignore x19 in that case.

This affects functions that:

  • Have over-aligned locals
  • Use alloca
  • Call a preserve_none function (not tailcall)
  • Allow some locals to escape

I need to looks more into it, but I think that this doesn't affect php-src, or we could workaround the issue. The only function that calls a preserve_none functions is execute_ex (other call sites are tail calls), and it doesn't use alloca. ASan may use alloca, but even then the other criteria may not match. Otherwise, a workaround would be to wrap that call in a simpler function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants