[llvm] [AArch64] Stack probing for function prologues (PR #66524)

Oskar Wirga via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 18:17:33 PDT 2023


oskarwirga wrote:

> Upon function entry the caller guarantees that it has probed the stack (e.g. performed a store) at some address [sp, #N], where0 <= N <= 1024.

I haven't been able to produce a minimal, sharable example as of yet, but I'm encountering a runtime error associated with an inlined function where stack probing is active. The error manifests as a null pointer dereference, originating from a stack value that is probed (and set to 0) before being subsequently dereferenced.

The IR contributing to this runtime issue is somewhat complex and challenging to interpret, but here's my observations:

- A value returned from `malloc(some_struct)` is stored in a stack variable.
- This stack variable is passed as an argument to a function.
- This function is later inlined, and within the inlined body, it attempts to set a value in the struct.
- At runtime, when setting the value we get a null pointer dereference.

I'm working to isolate this issue and will share a repro ASAP. In the meantime, any insights or suggestions based on this description would be greatly appreciated.

Also is it required to write to the value? Would reading the value be sufficient?

https://github.com/llvm/llvm-project/pull/66524


More information about the llvm-commits mailing list