Re: [PATCH] linux-user: Use qemu_set_cloexec() to mark pidfd as FD_CLOEXEC

2025-07-11 Thread Richard Henderson
On 7/11/25 08:12, Peter Maydell wrote: 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

Re: [PATCH] linux-user: Use qemu_set_cloexec() to mark pidfd as FD_CLOEXEC

2025-07-11 Thread Richard Henderson
On 7/11/25 08:12, Peter Maydell wrote: 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

Re: [PATCH] linux-user: Use qemu_set_cloexec() to mark pidfd as FD_CLOEXEC

2025-07-11 Thread Daniel P . Berrangé
On Fri, Jul 11, 2025 at 03:12:17PM +0100, Peter Maydell wrote: > 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 Cov

[PATCH] linux-user: Use qemu_set_cloexec() to mark pidfd as FD_CLOEXEC

2025-07-11 Thread Peter Maydell
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 bot