[PATCHv2] malloc: Make sure tcache_key is odd enough

Samuel Thibault samuel.thibault@ens-lyon.org
Sun Aug 3 21:29:51 GMT 2025


Andreas Schwab, le dim. 03 août 2025 23:06:25 +0200, a ecrit:
> 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..

It is within 80 columns.

I guess the style issue is the heading *s only?

Samuel


More information about the Libc-alpha mailing list