qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] slirp: fork_exec(): Don't close() a negative nu


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] slirp: fork_exec(): Don't close() a negative number in fork_exec()
Date: Tue, 11 Jul 2017 21:40:32 +0100

On 11 July 2017 at 20:08, Dr. David Alan Gilbert <address@hidden> wrote:
> * Peter Maydell (address@hidden) wrote:
>> [cc'd Eric as the sort of person
>>
>> On 11 July 2017 at 17:29, Dr. David Alan Gilbert <address@hidden> wrote:
>> > * Peter Maydell (address@hidden) wrote:
>> >> In a fork_exec() error path we try to closesocket(s) when s might
>> >> be a negative number because the thing that failed was the
>> >> qemu_socket() call. Add a guard so we don't do this.
>> >>
>> >> (Spotted by Coverity: CID 1005727 issue 1 of 2.)
>> >>
>> >> Signed-off-by: Peter Maydell <address@hidden>
>> >> ---
>> >> Issue 2 of 2 in CID 1005727 is trickier -- we need to move as
>> >> much as possible of the client-end connect/accept out of the
>> >> child process and into the parent as possible. I'm not sure
>> >> if it's safe to do it all in the parent without deadlocking...
>> >
>> > or just bail earlier?
>>
>> The problem is you can only bail while you're in the parent
>> before forking. Once you've started the child there's no
>> mechanism for dealing with failure.
>
> Well, you can always exit the child before anything worse can happen.

You need a mechanism then for causing the parent to notice.
The current code would leave the parent in a blocking
accept() call forever (this is what all the XXX comments
in the current code are about).

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]