110 lines
3.7 KiB
Diff
110 lines
3.7 KiB
Diff
From nobody Tue Aug 5 14:41:39 2008
|
|
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
Subject: [patch] ia64 vfork() fix #2
|
|
To: strace-devel@lists.sourceforge.net
|
|
Date: Tue, 5 Aug 2008 13:51:18 +0200
|
|
|
|
|
|
--gatW/ieO32f1wygP
|
|
Content-Type: text/plain; charset=us-ascii
|
|
Content-Disposition: inline
|
|
|
|
Hi,
|
|
|
|
the original fix of a hang of vfork() tracing with -f was posted here:
|
|
http://sourceforge.net/mailarchive/message.php?msg_name=20080630132558.GA4346%40host0.dyn.jankratochvil.net
|
|
|
|
Unfortunately it did convert vfork() into (+/-) pthread_create() instead of
|
|
intended fork(). It brought no regressions but the fix was incomplete as
|
|
there was a race possibly causing a crash when the child waited too long:
|
|
|
|
clone(Process 944 attached (waiting for parent)
|
|
Process 944 resumed (parent 942 ready)
|
|
child_stack=0, flags=CLONE_VM|CLONE_VFORK|SIGCHLD) = 944
|
|
[pid 942] exit_group(0) = ?
|
|
--- SIGSEGV (Segmentation fault) @ 200000000010ccb1 (58) ---
|
|
Process 944 detached
|
|
|
|
Fixed by this patch. I hope the fix commit is OK when the original patch was
|
|
already accepted.
|
|
|
|
|
|
Sorry,
|
|
Jan
|
|
|
|
--gatW/ieO32f1wygP
|
|
Content-Type: text/plain; charset=us-ascii
|
|
Content-Disposition: inline; filename="strace-4.5.16-ia64-vfork-vm.patch"
|
|
|
|
2008-08-05 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
* util.c (CLONE_VM): Define if not defined already.
|
|
(setbpt): Clear CLONE_VM in the case we already clear CLONE_VFORK for
|
|
SYS_clone and SYS_clone2.
|
|
Reported by Michal Nowak.
|
|
Fixes RH#455078.
|
|
|
|
--- util.c 18 Jul 2008 01:19:36 -0000 1.77
|
|
+++ util.c 5 Aug 2008 08:54:14 -0000
|
|
@@ -1284,6 +1284,9 @@ struct tcb *tcp;
|
|
#ifndef CLONE_VFORK
|
|
# define CLONE_VFORK 0x00004000
|
|
#endif
|
|
+#ifndef CLONE_VM
|
|
+# define CLONE_VM 0x00000100
|
|
+#endif
|
|
#ifndef CLONE_STOPPED
|
|
# define CLONE_STOPPED 0x02000000
|
|
#endif
|
|
@@ -1533,15 +1536,19 @@ struct tcb *tcp;
|
|
#ifdef SYS_clone2
|
|
case SYS_clone2:
|
|
#endif
|
|
- /* ia64 calls directly `clone (CLONE_VFORK)' contrary to
|
|
- x86 SYS_vfork above. Even on x86 we turn the vfork
|
|
- semantics into plain fork - each application must not
|
|
- depend on the vfork specifics according to POSIX. We
|
|
- would hang waiting for the parent resume otherwise. */
|
|
+ /* ia64 calls directly `clone (CLONE_VFORK | CLONE_VM)'
|
|
+ contrary to x86 SYS_vfork above. Even on x86 we turn the
|
|
+ vfork semantics into plain fork - each application must not
|
|
+ depend on the vfork specifics according to POSIX. We would
|
|
+ hang waiting for the parent resume otherwise. We need to
|
|
+ clear also CLONE_VM but only in the CLONE_VFORK case as
|
|
+ otherwise we would break pthread_create. */
|
|
+
|
|
if ((arg_setup (tcp, &state) < 0
|
|
|| set_arg0 (tcp, &state,
|
|
(tcp->u_arg[arg0_index] | CLONE_PTRACE)
|
|
- & ~CLONE_VFORK) < 0
|
|
+ & ~(tcp->u_arg[arg0_index] & CLONE_VFORK
|
|
+ ? CLONE_VFORK | CLONE_VM : 0)) < 0
|
|
|| arg_finish_change (tcp, &state) < 0))
|
|
return -1;
|
|
tcp->flags |= TCB_BPTSET;
|
|
|
|
--gatW/ieO32f1wygP
|
|
Content-Type: text/plain; charset="us-ascii"
|
|
MIME-Version: 1.0
|
|
Content-Transfer-Encoding: 7bit
|
|
Content-Disposition: inline
|
|
|
|
-------------------------------------------------------------------------
|
|
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
|
|
Build the coolest Linux based applications with Moblin SDK & win great prizes
|
|
Grand prize is a trip for two to an Open Source event anywhere in the world
|
|
http://moblin-contest.org/redirect.php?banner_id=100&url=/
|
|
--gatW/ieO32f1wygP
|
|
Content-Type: text/plain; charset="us-ascii"
|
|
MIME-Version: 1.0
|
|
Content-Transfer-Encoding: 7bit
|
|
Content-Disposition: inline
|
|
|
|
_______________________________________________
|
|
Strace-devel mailing list
|
|
Strace-devel@lists.sourceforge.net
|
|
https://lists.sourceforge.net/lists/listinfo/strace-devel
|
|
|
|
--gatW/ieO32f1wygP--
|
|
|