[PATCH] D129016: [PowerPC] implemented @llvm.ppc.kill.canary to corrupt stack guard
Paul Scoropan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 1 14:42:17 PDT 2022
pscoro added inline comments.
================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:11150
+
+ const uint64_t XORWord = 0xFFFFFFFF; // XORing with 0b111...111 will never
+ // result in the original word
----------------
To address a comment on the previous review, I fixed the XOR to do what I intended. When you XOR bits against 1, you are guaranteed to not return the same bit because of exclusivity. Therefore XORing the canary word against 0xFFFFFFFF (0b1111...111) guarantees that the corrupted canary word is never the same as the original
================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:11157
+ : M->getNamedValue("__stack_chk_guard");
+ if (GV == nullptr) { // linux uses LOAD_STACK_GUARD node instead of having a
+ // canary word global value
----------------
Addressing a comment from the previous review, GV != nullptr can not be an assert because linux implements stack guard loading differently than aix. This review now also supports linux as well
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129016/new/
https://reviews.llvm.org/D129016
More information about the cfe-commits
mailing list