diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2025-07-11 15:12:17 +0100 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2025-07-11 10:45:14 -0600 |
commit | d6390204c61e148488f034d1f79be35cd3318d93 (patch) | |
tree | 602945ed1080fc551aeac9438a6e69218f95db60 /scripts/rust/rustc_args.py | |
parent | c86da2b1dd7589d414b5a2d1e5361d6c3b4ca885 (diff) | |
download | qemu-d6390204c61e148488f034d1f79be35cd3318d93.zip qemu-d6390204c61e148488f034d1f79be35cd3318d93.tar.gz qemu-d6390204c61e148488f034d1f79be35cd3318d93.tar.bz2 |
linux-user: Use qemu_set_cloexec() to mark pidfd as FD_CLOEXEC
In the linux-user do_fork() function we try to set the FD_CLOEXEC
flag on a pidfd like this:
fcntl(pid_fd, F_SETFD, fcntl(pid_fd, F_GETFL) | FD_CLOEXEC);
This has two problems:
(1) it doesn't check errors, which Coverity complains about
(2) we use F_GETFL when we mean F_GETFD
Deal with both of these problems by using qemu_set_cloexec() instead.
That function will assert() if the fcntls fail, which is fine (we are
inside fork_start()/fork_end() so we know nothing can mess around
with our file descriptors here, and we just got this one from
pidfd_open()).
(As we are touching the if() statement here, we correct the
indentation.)
Coverity: CID 1508111
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250711141217.1429412-1-peter.maydell@linaro.org>
Diffstat (limited to 'scripts/rust/rustc_args.py')
0 files changed, 0 insertions, 0 deletions