qemu-devel
[Top][All Lists]
Advanced

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

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


From: Peter Maydell
Subject: Re: [Qemu-devel] audit needed for signal handlers
Date: Mon, 11 Nov 2013 17:11:18 +0000

On 11 November 2013 16:56, Anthony Liguori <address@hidden> wrote:
> On Mon, Nov 11, 2013 at 8:50 AM, Eric Blake <address@hidden> 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 won't be corrupted.
>
> Isn't this precisely why EINTR exists?

EINTR won't help you in the case like:

   ret = some_syscall();
   [execution returns from syscall, with errno set to X]
   [signal happens here; handler trashes errno]
   if (ret < 0) {
      use errno;
   }

EINTR exists mostly because properly resuming syscalls
was too hard for Bell Labs :-)

-- PMM



reply via email to

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