Page MenuHomeFreeBSD

Remove an unneeded and incorrect memset().
ClosedPublic

Authored by brooks on Sep 29 2017, 8:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 13 2024, 2:55 AM
Unknown Object (File)
Dec 24 2023, 1:07 AM
Unknown Object (File)
Nov 15 2023, 9:48 AM
Unknown Object (File)
Oct 13 2023, 5:11 PM
Unknown Object (File)
Oct 12 2023, 8:59 AM
Unknown Object (File)
Sep 23 2023, 10:41 AM
Unknown Object (File)
Aug 29 2023, 11:17 PM
Unknown Object (File)
Aug 10 2023, 10:15 PM
Subscribers
None

Details

Summary

On Variant I TLS architectures (aarch64, arm, mips, powerpc, and riscv)
the __libc_allocate_tls function allocates thread local storage memory
with calloc(). It then copies initialization data over the portions with
non-zero initial values. Before this change it would then pointlessly
zero the already zeroed remainder of the storage. Unfortunately the
calculation was wrong and it would zero TLS_TCB_SIZE (2*sizeof(void *))
additional bytes.

In practice, this overflow only matters if the TLS segment is sized such
that calloc() allocates a less than TLS_TCB_SIZE extra memory. Even
then, the likely result will be zeroing part of the next bucket. This
coupled with the impact being confined to Tier II platforms means there
will be no security advisory for this issue.

Found using: CHERI
Sponsored by: DARPA, AFRL
MFC After: 1 week

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable