[PATCH] D98906: [X86] Improve lowering of the unrolled inline-asm probing

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 09:12:09 PDT 2021


andreadb added a comment.

In D98906#2641469 <https://reviews.llvm.org/D98906#2641469>, @nagisa wrote:

> In D98906#2641418 <https://reviews.llvm.org/D98906#2641418>, @andreadb wrote:
>
>> Be careful about referencing stack locations below the red-zone.
>>
>> The x86-64 ABI mandates a 128 bytes red zone. Your new instruction would effectively write a zero at a location below the red-zone.
>> That region of memory is not reserved, and should be considered volatile. For example: signals and interrupt handlers are allowed to modify it.
>
> Isn't the volatility unimportant for the purposes of stack probing? The write exists only to poke the page (lightly) to ensure there's no page that is not rw, probing does not particularly care if the data at the relevant addresses are overwritten, or even that the byte is written to the address in the first place (as long as it triggers page permission checks). The only concern could be that some signal handler or an interrupt put some data there, but when these are running the probing itself is suspended, isn't it?

I agree. If the goal is just doing stack probing then it should be fine.

Mine was more of a generic "be careful about the red-zone". Just to make sure that it was considered in this design. I didn't know about your particular use case scenario though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98906/new/

https://reviews.llvm.org/D98906



More information about the llvm-commits mailing list