]> git.ozlabs.org Git - ccan/commit
altstack: Declare memory clobbers
authorDavid Gibson <david@gibson.dropbear.id.au>
Mon, 15 Feb 2016 11:47:36 +0000 (22:47 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 15 Feb 2016 11:47:36 +0000 (22:47 +1100)
commitdd3f80c16c4d7767777fc58face6394feb3e38cb
treedeb5f7312c1dccc5a48a6df76ce54c96958e260f
parentc9b3a91ce2d91f92054f22131ced091d6bcf836e
altstack: Declare memory clobbers

altstack includes a couple of inline asm blocks with x86 push and pop
instructions.  These instructions will access memory (the stack), but
that's not declared in inline asm statement.  We seem to be getting away
with it, but in theory that could allow the compiler to re-order accesses
to local variables across the asm block.  Since those blocks change the
location of the stack, that could be very bad.

Adding a "memory" clobber should prevent this (effectively making the asm
blocks a compiler memory barrier).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ccan/altstack/altstack.c