bn/asm/x86[_64]-mont*.pl: implement slightly alternative page-walking.
authorAndy Polyakov <appro@openssl.org>
Wed, 16 Mar 2016 22:33:53 +0000 (23:33 +0100)
committerAndy Polyakov <appro@openssl.org>
Mon, 22 Aug 2016 13:08:36 +0000 (15:08 +0200)
commit9c8bca1c206df7886aaef4692badc4049b488e40
tree6c6b10eca652643f23acf29868604c18f670bbe0
parent91dc6054582d1b7f263a67527ebbe2c050d178fc
bn/asm/x86[_64]-mont*.pl: implement slightly alternative page-walking.

Original strategy for page-walking was adjust stack pointer and then
touch pages in order. This kind of asks for double-fault, because
if touch fails, then signal will be delivered to frame above adjusted
stack pointer. But touching pages prior adjusting stack pointer would
upset valgrind. As compromise let's adjust stack pointer in pages,
touching top of the stack. This still asks for double-fault, but at
least prevents corruption of neighbour stack if allocation is to
overstep the guard page.

Also omit predict-non-taken hints as they reportedly trigger illegal
instructions in some VM setups.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 3ba1ef829cf3dd36eaa5e819258d90291c6a1027)
crypto/bn/asm/x86-mont.pl
crypto/bn/asm/x86_64-mont.pl
crypto/bn/asm/x86_64-mont5.pl