Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libc/tls



On Fri, Nov 22, 2019 at 08:53:25AM +0900, Takeshi Nakayama wrote:
> >>> Takeshi Nakayama <nakayama%NetBSD.org@localhost> wrote
> 
> > >>> Joerg Sonnenberger <joerg%bec.de@localhost> wrote
> > 
> > > On Thu, Nov 21, 2019 at 11:06:16PM +0000, Takeshi Nakayama wrote:
> > > > Module Name:	src
> > > > Committed By:	nakayama
> > > > Date:		Thu Nov 21 23:06:16 UTC 2019
> > > > 
> > > > Modified Files:
> > > > 	src/lib/libc/tls: tls.c
> > > > 
> > > > Log Message:
> > > > Fix PR/54074 and PR/54093 completely.
> > > > 
> > > > More similar to the ld.elf_so logic, it is necessary to align with
> > > > p_align first.  Also, invert the #ifdef condition for consistency.
> > > 
> > > This commit just wastes space without reason.
> > 
> > No, without this commit the TLS offset calculation is mismatch if
> > alignof(max_align_t)) != p_align.
> 
> Ah, this is wrong.
> Correctly, the TLS offset calculation is mismatch with what ld(1)
> expected if p_memsz is not aligned with p_align.

For TLS variant I, it literally just adds padding at the end of the
allocation. For TLS variant II, it is redundant, because the rounding is
already done in with max_align_t. We do not support p_align > malloc
alignment and the patch is certainly nowhere near enough to change that.
It is actively harmful in that it can make people believe that it could
ever work.

Joerg


Home | Main Index | Thread Index | Old Index