[PATCH v2] linux: Fix __closefrom_fallback iterates until max int (BZ#28993)
Adhemerval Zanella
adhemerval.zanella@linaro.org
Thu Mar 24 11:29:24 GMT 2022
On 24/03/2022 08:25, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
>
>> The __closefrom_fallback tries to get a available file descriptor
>> if the initial open ("/proc/self/fd/", ...) fails. It assumes the
>> failure would be only if procfs is not mount (ENOENT), however if
>> the the proc file is not accessible (due some other kernel filtering
>> such apparmor) it will iterate over a potentially large file set
>> issuing close calls.
>>
>> It should only try the close fallback if open returns EMFILE.
>
> I disagree. If there are performance issues due to the current code,
> people should fix their container hosts.
For closefrom it will trigger a __foritfy_fail and for
posix_spawn_file_actions_addclosefrom_np it will make posix_spawn fail.
I think on both cases it is better to fail early.
More information about the Libc-alpha
mailing list