Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 01 May 2024 17:19:25 +0200
From: Leah Neukirchen <leah@...u.org>
To: Alejandro Colomar <alx@...nel.org>
Cc: musl@...ts.openwall.com
Subject: Re: gcvt(3) should be MT-Safe, AS-Safe, AC-Safe

Alejandro Colomar <alx@...nel.org> writes:

> Hi,
>
> glibc's gcvt(1) is documented to be MT-Safe | AS-Safe | AC-Safe.
> <https://sourceware.org/glibc/manual/latest/html_mono/libc.html#index-gcvt>
> It's an interesting function to be called from a signal handler, where
> snprintf(3) is not available.
>
> But musl implements it as a call to sprintf(3); that doesn't seem safe.

POSIX 2001 says:
https://pubs.opengroup.org/onlinepubs/009695399/functions/gcvt.html

> These functions need not be reentrant. A function that is not
> required to be reentrant is not required to be thread-safe.

POSIX 2008 removed the whole function.

I recommend not putting application logic into signal handlers.

-- 
Leah Neukirchen  <leah@...u.org>  https://leahneukirchen.org/

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.