Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 7 Jan 2019 18:13:28 +0100
From: Markus Wichmann <>
Subject: Re: pthread_key_create bug?

On Sun, Jan 06, 2019 at 09:11:28PM -0500, Rich Felker wrote:
> See commit 84d061d5a31c9c773e29e1e2b1ffe8cb9557bc58.
> Rich

Speaking of that commit: Am I missing something? The log message of that
commit says that pthread_key_delete was stuffed into another file to
avoid __synccall() being pulled into programs not referencing
pthread_key_delete(). Yet pthread_key_create.c contains
clean_dirty_tsd(), which contains a hard dependency on
__pthread_key_delete_synccall(), which will do the synccall, and thus
pull everything in.

I appreciate that the function in question can never be called unless
pthread_key_delete() is used, but the linker can't know that. The
compiler can't see code of the other compilation units and thus has to
generate code containing a reference to __pthread_key_delete_synccall(),
and the linker can't see that the reference is unreachable unless
__pthread_key_delete() is linked in...

Wait a minute. If we made that a weak reference, that would already
suffice. Wouldn't even necessarily need an alias, since it is
unreachable without pthread_key_delete() anyway.

Is the attached patch acceptable?


View attachment "0004-Add-weak-reference-to-reduce-static-size.patch" of type "text/x-diff" (1188 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.