https://bugs.kde.org/show_bug.cgi?id=452274

--- Comment #19 from Paul Floyd <pjfl...@wanadoo.fr> ---
So what I think is happening is that a non-blocking write is occurring which
results in an immediate return with EAGAIN (Failure(0x23)  in the logs).
Nevertheless the syscall is being marked as SfMayBlock.

m_signals.c has this comment

   So what we have to do, when doing any syscall which SfMayBlock, is to
   quickly switch in the SCSS-specified signal mask just before the
   syscall, and switch it back just afterwards, and hope that we don't
   get caught up in some weird race condition.  This is the primary
   purpose of the ultra-magical pieces of assembly code in
   coregrind/m_syswrap/syscall-<plat>.S

I'm not sure if this is such a weird race condition, or whether it was just
wrong to set SfMayBlock.

I tried commenting out 
   *flags |= SfMayBlock;

in PRE(sys_write), syswrap-generic.c line 4280. With the the small testcase
works. 

I doubt that this is a real solution, it may well cause hangs in other
situations.

I then tried to be a bit more clever with

   int fd_flags = VG_(fcntl(ARG1, VKI_F_GETFL, 0));
   if ((fd_flags & VKI_O_NONBLOCK) == 0)
      *flags |= SfMayBlock;

but for fd 2 I just see flags of 0xa (write and append).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to