From: Florian Weimer <fw@deneb.enyo.de>
To: postmaster@yuristudio.net
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Issue with fcntl FD_CLOEXEC and execve
Date: Sat, 20 Jun 2020 08:53:42 +0200 [thread overview]
Message-ID: <87mu4yp6rt.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <000801d64679$d347bf10$79d73d30$@yuristudio.net> (postmaster's message of "Fri, 19 Jun 2020 22:40:10 +0200")
* postmaster:
> The pipe works fine and the process can correctly transmit data back to the
> master. The only issue appears when trying to run input pump based
> applications like cat, grep, etc. When running these applications the pipe
> write end which is marked FC_CLOEXEC should be closed when execve is
> triggered, however it is not, but execve still succeeded.
> When the target process to execve is not an input pump (uname, ls, .) no
> issue occurs and the pipe is correctly closed when execve is triggered and
> succeeds.
>
> That is a problem as my master process expects the blocking read to return
> with either cause of pipe file descriptor closed or some data written. In
> this case when the target process is an input pump the master process never
> gets notified of file descriptor closed and by extension locks forever.
Do you have a minimal but complete example that shows the problem?
You cannot really make standard input a CLOEXEC descriptor. If you do
not want subprocesses to use the original standard input, you need to
replace the descriptor with /dev/null before the execve call (but
already in the subprocess).
next prev parent reply other threads:[~2020-06-20 6:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 20:40 Issue with fcntl FD_CLOEXEC and execve postmaster
2020-06-20 6:53 ` Florian Weimer [this message]
2020-06-21 18:46 ` Yuri Edward
[not found] ` <fadc7cda-a84b-33ed-e15a-8203673f9d61@yuristudio.net>
2020-06-21 19:57 ` Florian Weimer
2020-06-22 17:09 ` Yuri Edward
-- strict thread matches above, loose matches on Subject: below --
2020-06-21 19:03 Yuri Edward
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mu4yp6rt.fsf@mid.deneb.enyo.de \
--to=fw@deneb.enyo.de \
--cc=linux-c-programming@vger.kernel.org \
--cc=postmaster@yuristudio.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).