[ptrace] please review follow fork/exec changes

Dmitry Mikulin dmitrym at juniper.net
Tue Feb 7 20:46:34 UTC 2012



> 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.

> @@ -889,7 +890,9 @@ 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.


More information about the freebsd-current mailing list