|
From: Jeremy F. <je...@go...> - 2003-10-22 01:49:35
|
On Tue, 2003-10-21 at 16:08, Tom Hughes wrote:
> In message <1066774658.4409.2.camel@localhost.localdomain>
> Jeremy Fitzhardinge <je...@go...> wrote:
>
> > OK, there seems to be some slight timing difference between 2.4-RH and
> > 2.6, or something. Anyway, I think this is the right fix - can you test
> > it out?
>
> I'm running on a dual processor box which may change things given
> that there are at least three threads of control running here.
No, its all nicely reproducible on my UP laptop, so I think it's just
something to do with the way the kernels work. I'm not really sure why
I didn't see this under 2.6.
> That patch certainly improves things - it fixes the case where there is
> no handler installed for the signal. The modified test program that is
> attached to this message, and which installs a SIGCHLD handler, exhibits
> a different problem however.
>
> Specifically the wait4 system call exists with ERESTARTSYS but is isn't
> restarted and the waitpid library call returns 114 which is the number of
> the wait4 system call, as shown here:
Gak. I tested all this, honest. Try this (manually hacked up, so the
lines will be all off) patch.
Index: vg_proxylwp.c
===================================================================
RCS file: /cvsroot/valgrind/valgrind/coregrind/vg_proxylwp.c,v
retrieving revision 1.1
diff -c -r1.1 vg_proxylwp.c
*** vg_proxylwp.c 13 Oct 2003 22:26:54 -0000 1.1
--- vg_proxylwp.c 22 Oct 2003 00:34:49 -0000
***************
*** 714,720 ****
case PX_RunSyscall:
/* Run a syscall for our thread; results will be poked
back into tst */
! reply.syscallno = tst->m_eax;
vg_assert(px->state == PXS_WaitReq ||
px->state == PXS_SigACK);
--- 716,722 ----
case PX_RunSyscall:
/* Run a syscall for our thread; results will be poked
back into tst */
! reply.syscallno = tst->syscallno;
vg_assert(px->state == PXS_WaitReq ||
px->state == PXS_SigACK);
***************
*** 728,734 ****
reply.syscallno);
tst->m_eax = -VKI_ERESTARTSYS;
} else {
! Int syscallno = tst->m_eax;
px->state = PXS_RunSyscall;
/* If we're interrupted before we get to the syscall
--- 730,736 ----
reply.syscallno);
tst->m_eax = -VKI_ERESTARTSYS;
} else {
! Int syscallno = tst->syscallno;
px->state = PXS_RunSyscall;
/* If we're interrupted before we get to the syscall
***************
*** 1264,1269 ****
--- 1271,1279 ----
req.request = PX_RunSyscall;
+ tst->syscallno = tst->m_eax;
+ tst->m_eax = -VKI_ERESTARTSYS;
+
/* clear the results pipe before we try to write to a proxy to
prevent a deadlock */
VG_(proxy_results)();
|