← Back to team overview

kernel-packages team mailing list archive

[Bug 1495706] Re: strace cannot attach to process despite being root and setting scope

 

** Description changed:

  I am trying to run `strace` against kworker, but I cannot attach strace
  despite havingset ptrace_scope=0 and being root.
  
  Here is the proof:
  
- # echo 1 >  /proc/sys/kernel/yama/ptrace_scope     
  root@rasal:/home/me# whoami
  root
- root@rasal:/home/me# cat /proc/sys/kernel/yama/ptrace_scope 
+ root@rasal:/home/me# cat /proc/sys/kernel/yama/ptrace_scope
  0
  root@rasal:/home/me# ps ax | grep kworker
-     5 ?        S<     0:00 [kworker/0:0H]
-    31 ?        S<     0:00 [kworker/1:0H]
-    35 ?        S      0:00 [kworker/2:0]
-    36 ?        S<     0:00 [kworker/2:0H]
-    41 ?        S<     0:00 [kworker/3:0H]
-    58 ?        S      0:00 [kworker/1:1]
-    76 ?        S      0:00 [kworker/3:1]
-    78 ?        S      0:00 [kworker/1:2]
-    79 ?        S      0:00 [kworker/2:1]
-   149 ?        S      0:00 [kworker/0:1]
-   162 ?        S      0:00 [kworker/u16:3]
-   163 ?        S      0:00 [kworker/u16:4]
-   164 ?        S      0:00 [kworker/u16:5]
-   448 ?        S<     0:00 [kworker/3:1H]
-   449 ?        S<     0:00 [kworker/1:1H]
-   451 ?        S<     0:00 [kworker/2:1H]
-   452 ?        S<     0:00 [kworker/0:1H]
-   560 ?        S      0:00 [kworker/3:2]
-   604 ?        S      0:00 [kworker/0:2]
-  1006 ?        S<     0:00 [kworker/u17:0]
-  1017 ?        S<     0:00 [kworker/u17:1]
-  4222 ?        S      0:00 [kworker/3:0]
-  4249 pts/4    S+     0:00 grep --color=auto kworker
+     5 ?        S<     0:00 [kworker/0:0H]
+    31 ?        S<     0:00 [kworker/1:0H]
+    35 ?        S      0:00 [kworker/2:0]
+    36 ?        S<     0:00 [kworker/2:0H]
+    41 ?        S<     0:00 [kworker/3:0H]
+    58 ?        S      0:00 [kworker/1:1]
+    76 ?        S      0:00 [kworker/3:1]
+    78 ?        S      0:00 [kworker/1:2]
+    79 ?        S      0:00 [kworker/2:1]
+   149 ?        S      0:00 [kworker/0:1]
+   162 ?        S      0:00 [kworker/u16:3]
+   163 ?        S      0:00 [kworker/u16:4]
+   164 ?        S      0:00 [kworker/u16:5]
+   448 ?        S<     0:00 [kworker/3:1H]
+   449 ?        S<     0:00 [kworker/1:1H]
+   451 ?        S<     0:00 [kworker/2:1H]
+   452 ?        S<     0:00 [kworker/0:1H]
+   560 ?        S      0:00 [kworker/3:2]
+   604 ?        S      0:00 [kworker/0:2]
+  1006 ?        S<     0:00 [kworker/u17:0]
+  1017 ?        S<     0:00 [kworker/u17:1]
+  4222 ?        S      0:00 [kworker/3:0]
+  4249 pts/4    S+     0:00 grep --color=auto kworker
  root@rasal:/home/me# strace -p 4222
  strace: attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted
  Could not attach to process.  If your uid matches the uid of the target
  process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
  again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
  root@rasal:/home/me#  uname -a
- Linux rasal 3.16.0-49-generic #65~14.04.1-Ubuntu SMP Wed Sep 9 10:03:23 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux        
+ Linux rasal 3.16.0-49-generic #65~14.04.1-Ubuntu SMP Wed Sep 9 10:03:23 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
  
  Any info on this?
  
  ProblemType: Bug
  DistroRelease: Ubuntu 14.04
  Package: linux-image-3.16.0-49-generic 3.16.0-49.65~14.04.1
  ProcVersionSignature: Ubuntu 3.16.0-49.65~14.04.1-generic 3.16.7-ckt15
  Uname: Linux 3.16.0-49-generic x86_64
  ApportVersion: 2.14.1-0ubuntu3.13
  Architecture: amd64
  CurrentDesktop: KDE
  Date: Tue Sep 15 00:01:12 2015
  InstallationDate: Installed on 2014-05-05 (497 days ago)
  InstallationMedia: Kubuntu 14.04 LTS "Trusty Tahr" - Release amd64 (20140416.1)
  SourcePackage: linux-lts-utopic
  UpgradeStatus: Upgraded to trusty on 2014-11-21 (297 days ago)

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux-lts-utopic in Ubuntu.
https://bugs.launchpad.net/bugs/1495706

Title:
  strace cannot attach to process despite being root and setting scope

Status in linux-lts-utopic package in Ubuntu:
  New

Bug description:
  I am trying to run `strace` against kworker, but I cannot attach
  strace despite havingset ptrace_scope=0 and being root.

  Here is the proof:

  root@rasal:/home/me# whoami
  root
  root@rasal:/home/me# cat /proc/sys/kernel/yama/ptrace_scope
  0
  root@rasal:/home/me# ps ax | grep kworker
      5 ?        S<     0:00 [kworker/0:0H]
     31 ?        S<     0:00 [kworker/1:0H]
     35 ?        S      0:00 [kworker/2:0]
     36 ?        S<     0:00 [kworker/2:0H]
     41 ?        S<     0:00 [kworker/3:0H]
     58 ?        S      0:00 [kworker/1:1]
     76 ?        S      0:00 [kworker/3:1]
     78 ?        S      0:00 [kworker/1:2]
     79 ?        S      0:00 [kworker/2:1]
    149 ?        S      0:00 [kworker/0:1]
    162 ?        S      0:00 [kworker/u16:3]
    163 ?        S      0:00 [kworker/u16:4]
    164 ?        S      0:00 [kworker/u16:5]
    448 ?        S<     0:00 [kworker/3:1H]
    449 ?        S<     0:00 [kworker/1:1H]
    451 ?        S<     0:00 [kworker/2:1H]
    452 ?        S<     0:00 [kworker/0:1H]
    560 ?        S      0:00 [kworker/3:2]
    604 ?        S      0:00 [kworker/0:2]
   1006 ?        S<     0:00 [kworker/u17:0]
   1017 ?        S<     0:00 [kworker/u17:1]
   4222 ?        S      0:00 [kworker/3:0]
   4249 pts/4    S+     0:00 grep --color=auto kworker
  root@rasal:/home/me# strace -p 4222
  strace: attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted
  Could not attach to process.  If your uid matches the uid of the target
  process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
  again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
  root@rasal:/home/me#  uname -a
  Linux rasal 3.16.0-49-generic #65~14.04.1-Ubuntu SMP Wed Sep 9 10:03:23 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

  Any info on this?

  ProblemType: Bug
  DistroRelease: Ubuntu 14.04
  Package: linux-image-3.16.0-49-generic 3.16.0-49.65~14.04.1
  ProcVersionSignature: Ubuntu 3.16.0-49.65~14.04.1-generic 3.16.7-ckt15
  Uname: Linux 3.16.0-49-generic x86_64
  ApportVersion: 2.14.1-0ubuntu3.13
  Architecture: amd64
  CurrentDesktop: KDE
  Date: Tue Sep 15 00:01:12 2015
  InstallationDate: Installed on 2014-05-05 (497 days ago)
  InstallationMedia: Kubuntu 14.04 LTS "Trusty Tahr" - Release amd64 (20140416.1)
  SourcePackage: linux-lts-utopic
  UpgradeStatus: Upgraded to trusty on 2014-11-21 (297 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-lts-utopic/+bug/1495706/+subscriptions


References