2012-12-13 14 views

risposta

10

È perché jstack -F utilizza la chiamata di sistema ptrace(2) per cercare di accedere ai dati JVM, che non riesce se non si dispone dei diritti:

$ strace -e all -f jstack -F 26846 
... 
[pid 27653] ptrace(PTRACE_ATTACH, 26846, 0, 0) = -1 EPERM (Operation not permitted) 
... 

Dal ptrace(2) man:

EPERM The specified process cannot be traced. This could be because the parent 
     has insufficient privileges (the required capability is CAP_SYS_PTRACE); 
     unprivileged processes cannot trace processes that they cannot send 
     signals to or those running set-user-ID/set-group-ID programs, for obvious 
     reasons. Alternatively, the process may already be being traced, or be 
     init(8) (PID 1). 

Vedere anche capabilities(7). Utilizzando sudo, ottieni le funzionalità di root, che includono CAP_SYS_PTRACE.

Problemi correlati