Re: [Qemu-devel] audit needed for signal handlers

2013-11-12 Thread Laszlo Ersek
On 11/11/13 19:03, Max Filippov wrote: > On Mon, Nov 11, 2013 at 8:50 PM, Eric Blake wrote: >> Quick - identify the bug in this code (from ui/curses.c): >> >> static void curses_winch_handler(int signum) >> { >> struct winsize { >> unsigned short ws_row; >> unsigned short ws_co

Re: [Qemu-devel] audit needed for signal handlers

2013-11-12 Thread Laszlo Ersek
On 11/11/13 18:47, Paolo Bonzini wrote: > Il 11/11/2013 18:13, Peter Maydell ha scritto: That said, aren't all signals in QEMU (except SIG_IPI) caught with signalfd and the handlers run synchronously in the iothread? >> Eric specifically points out one which is not. >> (I'm pretty sure th

Re: [Qemu-devel] audit needed for signal handlers

2013-11-12 Thread Gerd Hoffmann
On Mo, 2013-11-11 at 18:47 +0100, Paolo Bonzini wrote: > Il 11/11/2013 18:13, Peter Maydell ha scritto: > >> > That said, aren't all signals in QEMU (except SIG_IPI) caught with > >> > signalfd and the handlers run synchronously in the iothread? > > Eric specifically points out one which is not. >

Re: [Qemu-devel] audit needed for signal handlers

2013-11-11 Thread Max Filippov
On Mon, Nov 11, 2013 at 8:50 PM, Eric Blake wrote: > Quick - identify the bug in this code (from ui/curses.c): > > static void curses_winch_handler(int signum) > { > struct winsize { > unsigned short ws_row; > unsigned short ws_col; > unsigned short ws_xpixel; /* unus

Re: [Qemu-devel] audit needed for signal handlers

2013-11-11 Thread Eric Blake
On 11/11/2013 10:05 AM, Paolo Bonzini wrote: > > That said, aren't all signals in QEMU (except SIG_IPI) caught with > signalfd and the handlers run synchronously in the iothread? signalfd is currently a Linux-only concept - what happens on BSD? -- Eric Blake eblake redhat com+1-919-301-3

Re: [Qemu-devel] audit needed for signal handlers

2013-11-11 Thread Paolo Bonzini
Il 11/11/2013 18:13, Peter Maydell ha scritto: >> > That said, aren't all signals in QEMU (except SIG_IPI) caught with >> > signalfd and the handlers run synchronously in the iothread? > Eric specifically points out one which is not. > (I'm pretty sure that 'reinstall signal handler at > end of sig

Re: [Qemu-devel] audit needed for signal handlers

2013-11-11 Thread Eric Blake
On 11/11/2013 10:13 AM, Peter Maydell wrote: > On 11 November 2013 17:05, Paolo Bonzini wrote: >> That said, aren't all signals in QEMU (except SIG_IPI) caught with >> signalfd and the handlers run synchronously in the iothread? > > Eric specifically points out one which is not. > (I'm pretty sur

Re: [Qemu-devel] audit needed for signal handlers

2013-11-11 Thread Peter Maydell
On 11 November 2013 16:56, Anthony Liguori wrote: > On Mon, Nov 11, 2013 at 8:50 AM, Eric Blake wrote: >> Here's a hint: ioctl() can clobber errno. But if a signal handler is >> called in the middle of other code that is using errno, then the handler >> MUST restore the value of errno before ret

Re: [Qemu-devel] audit needed for signal handlers

2013-11-11 Thread Peter Maydell
On 11 November 2013 17:05, Paolo Bonzini wrote: > That said, aren't all signals in QEMU (except SIG_IPI) caught with > signalfd and the handlers run synchronously in the iothread? Eric specifically points out one which is not. (I'm pretty sure that 'reinstall signal handler at end of signal handl

Re: [Qemu-devel] audit needed for signal handlers

2013-11-11 Thread Eric Blake
On 11/11/2013 09:56 AM, Anthony Liguori wrote: >> Here's a hint: ioctl() can clobber errno. But if a signal handler is >> called in the middle of other code that is using errno, then the handler >> MUST restore the value of errno before returning, if it is to guarantee >> that the interrupted con

Re: [Qemu-devel] audit needed for signal handlers

2013-11-11 Thread Paolo Bonzini
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 11/11/2013 18:08, Eric Blake ha scritto: >>> That said, aren't all signals in QEMU (except SIG_IPI) caught >>> with signalfd and the handlers run synchronously in the >>> iothread? > signalfd is currently a Linux-only concept - what happens on BSD?

Re: [Qemu-devel] audit needed for signal handlers

2013-11-11 Thread Paolo Bonzini
Il 11/11/2013 17:56, Anthony Liguori ha scritto: > On Mon, Nov 11, 2013 at 8:50 AM, Eric Blake wrote: >> Quick - identify the bug in this code (from ui/curses.c): >> >> static void curses_winch_handler(int signum) >> { >> struct winsize { >> unsigned short ws_row; >> unsigned s

Re: [Qemu-devel] audit needed for signal handlers

2013-11-11 Thread Anthony Liguori
On Mon, Nov 11, 2013 at 8:50 AM, Eric Blake wrote: > Quick - identify the bug in this code (from ui/curses.c): > > static void curses_winch_handler(int signum) > { > struct winsize { > unsigned short ws_row; > unsigned short ws_col; > unsigned short ws_xpixel; /* unus

[Qemu-devel] audit needed for signal handlers

2013-11-11 Thread Eric Blake
Quick - identify the bug in this code (from ui/curses.c): static void curses_winch_handler(int signum) { struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; /* unused */ unsigned short ws_ypixel; /* unused */ } ws;