Uninitialised memory detected by Valgrind after mpn_sec_tabselect on i686
Mike Crowe
mac at mcrowe.com
Tue Jul 22 17:21:06 CEST 2025
On Tuesday 22 July 2025 at 16:11:12 +0200, Torbjörn Granlund wrote:
> I believe this is not actually a bug in GMP. But we might make some
> changes in order to make valgrind happy.
>
> This is what might be happening:
>
> The function mpn_sec_tabselect is used for choosing a bignum value from
> a table of bignum values, without leaking which entry is chosen.
>
> It reads the destination bignum variable and the next tabled bignum
> variable, and then use logic operations to chose either.
>
> Valgrind becomes unhappy as mpn_sec_tabselect pseudo-depends on the
> value of its destination bignum area.
>
> We should probably change this. It is not hard, but masny asm
> mpn_sec_tabselect needs to be changed.
Hi Torbjörn,
Thank you for investigating so quickly. What you say makes sense.
FWIW we run the same Valgrind tests on x86_64 too, but don't see the same
problem there. (Configured with --host=x86_64-oe-linux, using
x86_64/sec_tabselect.asm.)
Mike.
More information about the gmp-bugs
mailing list