Add pac-ret hardening to _init and _fini#4
Conversation
Ideally, this should be conditional on whether ptrauth_returns is requested and which key is used, but this patch still should be safe as PACIASP and AUTIASP are encoded as HINT and both prologue and epilogue use the same IA key.
kovdan01
left a comment
There was a problem hiding this comment.
LGTM, but I think that corresponding new tests should be implemented for this.
BTW, is there a demand for _init and _fini usage with PAuth? AFAIK, we already support .init_array and .fini_array sections - does anyone want to use _init and _fini (given that this PAuth support for musl is mostly just a proof-of-concept)? I don't mind supporting this, just curious :)
And regarding this:
this patch still should be safe as PACIASP and AUTIASP are encoded as HINT
Probably, it's worth adding a comment saying that hint-encoded instructions are OK both with pauth and without that.
I'm not sure anybody wants to actually use these functions, but as far as I see, |
|
Updated the PR description to explain the purpose of this change. |
Ideally, this should be conditional on whether ptrauth_returns is requested and which key is used, but this patch still should be safe as PACIASP and AUTIASP are encoded as HINT and both prologue and epilogue use the same IA key.
Please note that even if
.init_arrayand.fini_arrayare actually used,_initand_finifunctions are statically linked into every executable, thus this patch is a natural way to silence multiple warnings reported by PAuth gadget scanner for every executable.