Skip to content

Instantly share code, notes, and snippets.

@colematt
Last active November 7, 2019 21:29
Show Gist options
  • Save colematt/13971b0f3720c1d459f9f78840f7727d to your computer and use it in GitHub Desktop.
Save colematt/13971b0f3720c1d459f9f78840f7727d to your computer and use it in GitHub Desktop.
[Disable Yama PTrace Restrictions] #intel #Pin #Linux

Why would you want to do this?

There is a known problem of using Intel® SDE on Linux* systems that prevents the use of ptrace attach via the sysctl /proc/sys/kernel/yama/ptrace_scope. In this case Pin is not able to use its default (parent) injection mode. (SDE does not need to run as root.)

How do you do it?

The following commands disable yama on the system until the next reboot. Add to the init scripts to make permanent.

This command is recommended by the Intel SDE installation guide, but doesn't work on after Ubuntu 14.04 because the directory doesn't exist:

$ echo 0 > /proc/sys/kernel/yama/ptrace_scope 

This command does work, most recently verified on Ubuntu 19.04:

$ sudo sysctl -w kernel.yama.ptrace_scope=0

kernel.yama.ptrace_scope

Value Meaning
0 All processes can be debugged, as long as they have same uid. This is the classical way of how ptracing worked.
1 Only a parent process can be debugged.
2 Only admin can use ptrace, as it required CAP_SYS_PTRACE capability.
3 No processes may be traced with ptrace. Once set, a reboot is needed to enable ptracing again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment