Don't perform TCB_WAITEXECVE wait if not needed.
* defs.h (ptrace_setoptions_for_all): Expose this variable. * strace.c (ptrace_setoptions_for_all): Remove "static". * process.c (internal_exec): Don't set TCB_WAITEXECVE bit if we know that post-execve SIGTRAP is not going to happen.
This commit is contained in:
1
defs.h
1
defs.h
@ -505,6 +505,7 @@ extern struct tcb **tcbtab;
|
|||||||
extern int *qual_flags;
|
extern int *qual_flags;
|
||||||
extern int debug, followfork;
|
extern int debug, followfork;
|
||||||
extern unsigned int ptrace_setoptions_followfork;
|
extern unsigned int ptrace_setoptions_followfork;
|
||||||
|
extern unsigned int ptrace_setoptions_for_all;
|
||||||
extern int dtime, xflag, qflag;
|
extern int dtime, xflag, qflag;
|
||||||
extern cflag_t cflag;
|
extern cflag_t cflag;
|
||||||
extern int acolumn;
|
extern int acolumn;
|
||||||
|
10
process.c
10
process.c
@ -1775,8 +1775,7 @@ struct tcb *tcp;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
internal_exec(tcp)
|
internal_exec(struct tcb *tcp)
|
||||||
struct tcb *tcp;
|
|
||||||
{
|
{
|
||||||
#ifdef SUNOS4
|
#ifdef SUNOS4
|
||||||
if (exiting(tcp) && !syserror(tcp) && followfork)
|
if (exiting(tcp) && !syserror(tcp) && followfork)
|
||||||
@ -1785,8 +1784,11 @@ struct tcb *tcp;
|
|||||||
#if defined LINUX && defined TCB_WAITEXECVE
|
#if defined LINUX && defined TCB_WAITEXECVE
|
||||||
if (exiting(tcp) && syserror(tcp))
|
if (exiting(tcp) && syserror(tcp))
|
||||||
tcp->flags &= ~TCB_WAITEXECVE;
|
tcp->flags &= ~TCB_WAITEXECVE;
|
||||||
else
|
else {
|
||||||
tcp->flags |= TCB_WAITEXECVE;
|
/* Maybe we have post-execve SIGTRAP suppressed? */
|
||||||
|
if (!(ptrace_setoptions_for_all & PTRACE_O_TRACEEXEC))
|
||||||
|
tcp->flags |= TCB_WAITEXECVE; /* no */
|
||||||
|
}
|
||||||
#endif /* LINUX && TCB_WAITEXECVE */
|
#endif /* LINUX && TCB_WAITEXECVE */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
2
strace.c
2
strace.c
@ -85,7 +85,7 @@ extern char *optarg;
|
|||||||
|
|
||||||
int debug = 0, followfork = 0;
|
int debug = 0, followfork = 0;
|
||||||
unsigned int ptrace_setoptions_followfork = 0;
|
unsigned int ptrace_setoptions_followfork = 0;
|
||||||
static unsigned int ptrace_setoptions_for_all = 0;
|
unsigned int ptrace_setoptions_for_all = 0;
|
||||||
/* Which WSTOPSIG(status) value marks syscall traps? */
|
/* Which WSTOPSIG(status) value marks syscall traps? */
|
||||||
static unsigned int SYSCALLTRAP = SIGTRAP;
|
static unsigned int SYSCALLTRAP = SIGTRAP;
|
||||||
int dtime = 0, xflag = 0, qflag = 0;
|
int dtime = 0, xflag = 0, qflag = 0;
|
||||||
|
Reference in New Issue
Block a user