![]() |
|
Message-ID: <20250720045524.GF6263@brightrain.aerifal.cx> Date: Sun, 20 Jul 2025 00:55:24 -0400 From: Rich Felker <dalias@...c.org> To: Luca Kellermann <mailto.luca.kellermann@...il.com> Cc: Markus Wichmann <nullplan@....net>, musl@...ts.openwall.com Subject: Re: [PATCH 3/4] scandir: fix leaks caused by cancellation On Sun, Jul 20, 2025 at 06:46:20AM +0200, Luca Kellermann wrote: > On Sat, Jul 12, 2025 at 10:44:56AM -0400, Rich Felker wrote: > > So I think we probably need to just block around the opendir > > and closedir calls, but otherwise leave it unblocked. > > In that case, the cancellation cleanup handler will still be needed > to prevent leaks when sel() or cmp() act upon a cancellation request. As documented in the application usage notes in the spec, if these functions don't return (it mentions longjmp) it's expected that resources may not be freed. I'm unclear why they put such a non-normative note there rather than normative text saying the behavior is undefined if these functions don't satisfy their contract to return a value (and thereby, not to cause cancellation to be acted upon, not call longjmp to leave the caller's context, etc.). Maybe this should be opened as a bug against the spec. For at least some of the other functions that take callbacks, it's explicitly undefined if they don't return normally. Rich
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.