Re: [PATCH v3 1/2] net: tap: check if the file descriptor is valid before using it

2020-07-07 Thread Laurent Vivier
On 07/07/2020 09:56, Jason Wang wrote: > > On 2020/7/2 上午3:39, Laurent Vivier wrote: >> +void qemu_set_nonblock(int fd) >> +{ >> +    int f; >> +    f = qemu_try_set_nonblock(fd); >> +    assert(f == 0); >>   } > > > So we keep this assert which means it can still be triggered from monitor? > >

Re: [PATCH v3 1/2] net: tap: check if the file descriptor is valid before using it

2020-07-07 Thread Jason Wang
On 2020/7/2 上午3:39, Laurent Vivier wrote: +void qemu_set_nonblock(int fd) +{ +int f; +f = qemu_try_set_nonblock(fd); +assert(f == 0); } So we keep this assert which means it can still be triggered from monitor? I don't check all the callers, but I got: in tap_init_one() we ha

Re: [PATCH v3 1/2] net: tap: check if the file descriptor is valid before using it

2020-07-06 Thread Philippe Mathieu-Daudé
On 7/2/20 10:18 AM, Philippe Mathieu-Daudé wrote: > On 7/2/20 10:17 AM, Laurent Vivier wrote: >> On 02/07/2020 10:00, Philippe Mathieu-Daudé wrote: >>> On 7/1/20 9:39 PM, Laurent Vivier wrote: qemu_set_nonblock() checks that the file descriptor can be used and, if not, crashes QEMU. An as

Re: [PATCH v3 1/2] net: tap: check if the file descriptor is valid before using it

2020-07-02 Thread Philippe Mathieu-Daudé
On 7/2/20 10:17 AM, Laurent Vivier wrote: > On 02/07/2020 10:00, Philippe Mathieu-Daudé wrote: >> On 7/1/20 9:39 PM, Laurent Vivier wrote: >>> qemu_set_nonblock() checks that the file descriptor can be used and, if >>> not, crashes QEMU. An assert() is used for that. The use of assert() is >>> used

Re: [PATCH v3 1/2] net: tap: check if the file descriptor is valid before using it

2020-07-02 Thread Laurent Vivier
On 02/07/2020 10:00, Philippe Mathieu-Daudé wrote: > On 7/1/20 9:39 PM, Laurent Vivier wrote: >> qemu_set_nonblock() checks that the file descriptor can be used and, if >> not, crashes QEMU. An assert() is used for that. The use of assert() is >> used to detect programming error and the coredump wi

Re: [PATCH v3 1/2] net: tap: check if the file descriptor is valid before using it

2020-07-02 Thread Philippe Mathieu-Daudé
On 7/1/20 9:39 PM, Laurent Vivier wrote: > qemu_set_nonblock() checks that the file descriptor can be used and, if > not, crashes QEMU. An assert() is used for that. The use of assert() is > used to detect programming error and the coredump will allow to debug > the problem. > > But in the case of

[PATCH v3 1/2] net: tap: check if the file descriptor is valid before using it

2020-07-01 Thread Laurent Vivier
qemu_set_nonblock() checks that the file descriptor can be used and, if not, crashes QEMU. An assert() is used for that. The use of assert() is used to detect programming error and the coredump will allow to debug the problem. But in the case of the tap device, this assert() can be triggered by a