[PATCH] D30407: AArch64: Disable the Load Stack Guard on OpenBSD/aarch64

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 10:43:41 PST 2017


t.p.northover added a comment.

OK, I've digged a bit more deeply and I don't think this is the right fix. Currently we seem to have 2 relevant toggles:

- `getIRStackGuard` can return nullptr or something valid.
- `useLoadStackGuardNode` can return true or false.

In most places (that return nullptr in the first case), useLoadStackGuardNode switches between a pseudo-instruction that will load from the specified global, and an explicit load from that global in the DAG. However, in the one place where you have an @llvm.stackprotector call the load is (correctly) skipped, unless useLoadStackGuardNode returns true.

So we've got two issues here:

- The handling of @llvm.stackprotector is pretty clearly buggy: there should be no option to useLoadStackGuard because the load has already happened according to the IR semantics.
- OpenBSD almost certainly doesn't need this divergent code-path anyway, and should just be overriding the guard's global variable. As far as I can tell the divergence was introduced without any intent by r188766 (purely for the convenience of not having to make sure OpenBSD works with the new scheme, I expect).

The newer (SDAG) scheme appears to have enhanced security (no spills of the guard, better epilogue behaviour), so it's probably in OpenBSD's best interests to switch.


Repository:
  rL LLVM

https://reviews.llvm.org/D30407





More information about the llvm-commits mailing list