File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,30 @@ const FIXTURES_BASE = isNode
18
18
? path . join ( __dirname , 'fixtures' )
19
19
: process . env . FIXTURES_PATH ! ;
20
20
21
+ function checkYamaPtraceScope ( ) {
22
+ let result : string ;
23
+ try {
24
+ result = ChildProc . execSync ( 'sysctl kernel.yama.ptrace_scope' ) . toString ( ) . trim ( ) ;
25
+ } catch ( e ) {
26
+ console . warn ( `Failed to check ptrace_scope value: ${ e } ` ) ;
27
+ return ;
28
+ }
29
+
30
+ if ( result === 'kernel.yama.ptrace_scope = 0' ) {
31
+ return ; // Perfect!
32
+ } else if ( result === 'kernel.yama.ptrace_scope = 1' ) {
33
+ console . error (
34
+ 'Yama ptrace scope is set to 1, which will prevent Frida from attaching to processes. ' +
35
+ 'You can change this by running:\n> sudo sysctl kernel.yama.ptrace_scope=0'
36
+ ) ;
37
+ process . exit ( 1 ) ;
38
+ } else {
39
+ console . warn ( `Unexpected ptrace_scope value: ${ result } ` ) ;
40
+ }
41
+ }
42
+
43
+ if ( isNode && process . platform === 'linux' ) checkYamaPtraceScope ( ) ;
44
+
21
45
describe ( "Frida-JS" , ( ) => {
22
46
23
47
let fridaClient : FridaSession ;
You can’t perform that action at this time.
0 commit comments