<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hello!<div><br></div><div>strace requires that the ptrace_scope is set to 0 in order to be able to attach to non child processes.</div><div>If attaching fails strace prints an error message, but the exit code is 0. I expect a nonzero exit code.</div><div><br></div><div><div>The manual states the following:</div><div><br></div><div>> When using -p, the exit status of strace is zero unless there was an unexpected error in doing the tracing.</div></div><div><br></div><div>The behavior is reproducable with strace 4.8 and 4.10.</div><div><br></div><div>An example:</div><div><br></div><div><div><div>$ strace -p 1234</div><div>strace: attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted</div><div>Could not attach to process.  If your uid matches the uid of the target</div><div>process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try</div><div>again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf</div><div>$ echo $?</div><div>> 0</div></div></div><div><br></div><div><div>Regards,</div></div><div>Oliver Hanappi</div></div>
</div><br></div>