Follow @Openwall on Twitter for new release announcements and other news
[<prev] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87mscwdse4.fsf@oldenburg.str.redhat.com>
Date: Fri, 04 Apr 2025 14:26:43 +0200
From: Florian Weimer <fweimer@...hat.com>
To: Keith Packard <keithp@...thp.com>
Cc: libc-coord@...ts.openwall.com
Subject: Re: Future directions for *_r functions

* Keith Packard:

> Florian Weimer <fweimer@...hat.com> writes:
>
>> * Store a pointer in TLS space that points to the global data object on
>>   the main thread, and further TLS data on other threads.  This is the
>>   approach that was used for _res.
>
> This seems like it would avoid use-after-free, but I can't see how you'd
> ever manage to free the storage -- if you can't free it when the thread
> exits, when can you ever prove that it can't be reached by the
> application?

The lifetime extends until the end of the process for the data structure
on the main thread only.  Things allocated on other threads would still
be freed.

But as I said, I don't think that's a model for the non-_r functions.

> It sounds like there may be intractable issues with fixing this in a way
> that preserves existing ABI consequences.

Yes, that is true.

Thanks,
Florian

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.