Closed honghaier250 closed 2 days ago
Do you know if ASLR is affecting your nginx? uaddr()
does not work in the presence of ASLR.
The outputs of the following two commands will give us the answer if you're not sure:
file /usr/local/nginx/sbin/ngin
- does this say something like "pie executable"?cat /proc/sys/kernel/randomize_va_space
- is this non-zero?If both answers are "yes", then ASLR will be enabled for your nginx.
You could either:
-pie
0
to /proc/sys/kernel/randomize_va_space
uaddr()
before dereferencing the pointer.@ajor However, I already disable ASLR by: echo 0 > /proc/sys/kernel/randomize_va_space
I know, it should plus base address 0x555555554000
#!/usr/bin/env bpftrace
uprobe:/usr/local/nginx/sbin/nginx:ngx_process_events_and_timers {
$base = (uint64)0x555555554000;
$offset = (uint32)uaddr("ngx_accept_disabled");
$ngx_accept_disabled = *(int64*)($base + $offset);
printf("%d, %ld\n", pid,, $ngx_accept_disabled);
}
What reproduces the bug? Provide code if possible.
I want access nginx global variables: ngx_accept_disabled,but can not get correct value
bpftrace --info
outputnginx -V output