Re: [ptrace] please review follow fork/exec changes

From: Dmitry Mikulin <dmitrym_at_juniper.net>
Date: Tue, 7 Feb 2012 12:45:40 -0800
> So, do you in fact need to distinguish exec stops from syscall exit
> against exec stops from PT_FOLLOW_EXEC,

This is pretty much what I need. It's the same stop in syscall return right? I don't want to change when the stop happens, I want to have an lwpinfo flag that tells me when a stop occurred in a process under PT_FOLLOW_EXEC.

> _at__at_ -889,7 +890,9 _at__at_ exec_fail_dealloc:
>
>   	if (error == 0) {
>   		PROC_LOCK(p);
> -		td->td_dbgflags |= TDB_EXEC;
> +		if ((p->p_flag&  P_TRACED) != 0&&
> +		    ((P_FOLLOWEXEC) != 0 || (p->p_stops&  S_PT_SCX) != 0))
> +			td->td_dbgflags |= TDB_EXEC;
>   		PROC_UNLOCK(p);
>   

There's a small bug in the patch that makes it not work. The check for P_FOLLOWEXEC should be:

+		((p->p_flag&  P_FOLLOWEXEC) != 0 || (p->p_stops&  S_PT_SCX) != 0))


Looks like the patch should work for me but I need to verify.
Received on Tue Feb 07 2012 - 19:46:34 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:23 UTC