Re: [PATCH 1/4] fs: Implement close-on-fork

From: Bernd Petrovitsch
Date: Wed Apr 22 2020 - 12:33:39 EST


On 22/04/2020 16:02, Karstens, Nate wrote:
>> It's not safe to call system() from a threaded app. That's all. It's right there in the DESCRIPTION:
>
> That is true, but that description is missing from both the Linux man page and the glibc documentation (https://www.gnu.org/software/libc/manual/html_mono/libc.html#Running-a-Command). It seems like a minor point that won't be noticed until it causes a problem, and problems are rare enough they might go unnoticed for a while. We have removed system() from our application, but we're also concerned that libraries we integrate will use system() without our knowledge.

Reimplementing system() is trivial.
LD_LIBRARY_PRELOAD should take care of all system(3) calls.

I wonder it it has some value to add runtime checking for
"multi-threaded" to such lib functions and error out if
yes.

Apart from that, system() is a PITA even on
single/non-threaded apps.

MfG,
Bernd
--
There is no cloud, just other people computers.
-- https://static.fsf.org/nosvn/stickers/thereisnocloud.svg

Attachment: pEpkey.asc
Description: application/pgp-keys