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. (I'm

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 that

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 ebl...@redhat.com 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

[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;

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 ebl...@redhat.com 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;

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 ebl...@redhat.com 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;

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? It is

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 context

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

2013-11-11 Thread Peter Maydell
On 11 November 2013 17:05, Paolo Bonzini pbonz...@redhat.com 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

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

2013-11-11 Thread Peter Maydell
On 11 November 2013 16:56, Anthony Liguori anth...@codemonkey.ws wrote: On Mon, Nov 11, 2013 at 8:50 AM, Eric Blake ebl...@redhat.com 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

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 pbonz...@redhat.com 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.

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 signal

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

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 ebl...@redhat.com 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;