]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r324243:
authorbrooks <brooks@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 14 Oct 2017 16:49:39 +0000 (16:49 +0000)
committerbrooks <brooks@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 14 Oct 2017 16:49:39 +0000 (16:49 +0000)
commit22188b764c8bfd883d5066fed39573c5fed7e3f3
treeb2b6a41ca081b39fb9b1b465f308c2bf4a5763f3
parentd23b8e7e68136e12dbffe1538e744b11b5b71355
MFC r324243:

Remove an unneeded and incorrect memset().

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 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.

Reviewed by: kib, dfr
Discussed with: security-officer (delphij)
Found by: CHERI
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12547

git-svn-id: svn://svn.freebsd.org/base/stable/10@324617 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
lib/libc/gen/tls.c