Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@doughgle
Created November 20, 2017 15:26
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save doughgle/e3a8c350dbf2370e69212f8b91fa4c88 to your computer and use it in GitHub Desktop.
Save doughgle/e3a8c350dbf2370e69212f8b91fa4c88 to your computer and use it in GitHub Desktop.
Linux kernel 4.14 patch to disguise TracerPid in /proc/*/status
commit acc0182c3d3869802bc20c8bf4e04c3464936bcc
Author: Douglas Hellinger <doug.hellinger@hotmail.com>
Date: Sun Nov 19 22:48:46 2017 +0800
Fix tracerPid=0 in /proc
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 6f6fc16..bcf470d 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -171,7 +171,8 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
tracer = ptrace_parent(p);
if (tracer)
- tpid = task_pid_nr_ns(tracer, ns);
+ // hide TracerPid
+ tpid = 0;
tgid = task_tgid_nr_ns(p, ns);
ngid = task_numa_group_id(p);
@EvanCarroll
Copy link

Be nice if you could get this accepted upstream with a kernel flag. Microsoft is using this in a futile attempt to lock down their products https://unix.stackexchange.com/q/413697/3285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment