[PATCH] Mark syslog as MT-unsafe (bug 26100)
Mon Jun 15 14:18:39 GMT 2020
On Mon, Jun 15, 2020 at 8:31 AM Andreas Schwab <firstname.lastname@example.org> wrote:
> On Jun 15 2020, Florian Weimer wrote:
> > If it's not too hard, I think it would be a reasonable enhancement.
> > Lack of thread safety is surprising here, and I expect that a lot of
> > code assumes it.
> Its use of shared global state makes it inherently non-safe.
Messages to syslog need to be serialized over the whole process
_anyway_, so I don't see a problem with having
syslog/openlog/closelog/setlogmask take an internal mutex around the
shared global state. However, for further bulletproofing we would
need to promise that these functions never acquire any _other_ locks,
in particular that they do not call malloc, and I don't know whether
they do now.
If we're going to do this it should be clearly documented as a GNU
extension; POSIX does not guarantee this.
More information about the Libc-alpha