Yohei Kojima <y-...@outlook.jp> writes:
> On 2023/03/31 4:06, Markus Armbruster wrote: >> Yohei Kojima <y-...@outlook.jp> writes: >> >>> Add qemu_strerror() which follows the POSIX specification for >>> strerror(). While strerror() is not guaranteed to be thread-safe, this >>> function is thread-safe. >> >> Why not g_strerror()? >> > > Because g_strerror() uses mutex in its implementation and there is a > risk to occur the deadlock. If one thread enters g_strerror() (soon the > mutex is locked), then another thread calls fork(), and the forked > child process try to call g_strerror(), then deadlock occurs. I think we should mention this avoids the deadlock in the commit message. With that: Reviewed-by: Alex Bennée <alex.ben...@linaro.org> > >>> This function is added to solve the following issue: >>> https://gitlab.com/qemu-project/qemu/-/issues/416 >> >> The issue even asks for it... >> > > Originally yes, but Daniel told the deadlock (or a mutex starvation) > risk for g_strerror() in the later discussion of the issue. Probably I > should have mention that in the commit message or the cover letter. > >>> Signed-off-by: Yohei Kojima <y-...@outlook.jp> >> -- Alex Bennée Virtualisation Tech Lead @ Linaro