[PATCHv2] malloc: Make sure tcache_key is odd enough
Andreas Schwab
schwab@linux-m68k.org
Sun Aug 3 21:06:25 GMT 2025
On Aug 03 2025, Samuel Thibault wrote:
> @@ -3152,6 +3155,18 @@ tcache_key_initialize (void)
> if (__getrandom_nocancel_nostatus_direct (&tcache_key, sizeof(tcache_key),
> GRND_NONBLOCK)
> != sizeof (tcache_key))
> + tcache_key = 0;
> +
> + /* We need tcache_key to be non-zero (otherwise tcache_double_free_verify's
> + * clearing of e->key would go unnoticed and it would loop getting called
> + * through __libc_free), and we want tcache_key not to be a commonly-occurring
> + * value in memory, so ensure a minimum amount of one and zero bits. */
Please use the correct comment style, and fill to less than 80 columns..
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
More information about the Libc-alpha
mailing list