serge-sans-paille added a comment.

@efriedma : there's indeed an intersection with the `probe-stack` attribute. 
The `probe-stack` attribute (a) forces a function call, and (b) this function 
call only happens **before** the stack gets expanded.

(a) is probably a performance issue in several cases, plus it requires an extra 
register (that's mentioned in  https://reviews.llvm.org/D9653) 
(b) is an issue, as pointed out in https://lwn.net/Articles/726587/ (grep for 
valgrind)  : from valgrind point of view, accessing un-allocated stack memory 
triggers error, and we probably want to please valgrind

Doing the call *after* the stack allocation is also not an option, as a signal 
could be raised between the stack allocation and the stack probing, escaping 
the stack probe if a custom signal handler is executed.

That being said, I do think it would be a good thing to have a special value 
for `probe-stack`, say `probe-stack=inline-asm`, that would trigger generation 
of inlined assembly as I do. That way we have all the pieces in one place, with 
different strategies. And we would have clang set the attribute for each 
function when `-fstack-clash-protection` is given.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68720



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to