When debugging you'll probably have found that
The first cause is that your
The second reason is that your hardened kernel may be hidding the mappings. This
is a known problem and
One solution is disabling the RANDMMAP feature with
# paxctl -r binary
Other fix is disabling the option that hides the addresses on the PaX protected executables to avoid attacks based on that information. This option may make the things easier for an attacker until it is enabled again although also means that the environment will be the most similar possible to the real execution environment.
Address Space Protection ---> [ ] Remove addresses from /proc/<pid>/[smaps|maps|stat]
A last solution is disabling the last pie linking stage while compiling using
Try adding
You may find that PaX may prevent
The first solution is making PaX disable the RANDEXEC and MPROTECT features
for the binary to be debugged. To do this you have to set with
# /sbin/paxctl -m binary
After that
# /sbin/paxctl -ps binary
Below we'll expose what's happening on a lower level when you add a software breakpoint, and why PaX disallows this. You need to know a bit about how processors work in order to understand it. This is not needed to solve your problem so feel free to ignore it.
When the debugger adds a soft breakpoint it changes the instruction on the
executable memory image so it is a breakpoint instruction (on x86 and amd64
they are the
Another solution is using hardware breakpoints, they don't require any changes
on PaX behavior, but they are usually limited (for example to a maximum of 4 on
x86 and amd64 including address watchpoints) and also have the problem that they
require the program to be already running in order to be added (although there
is some WIP to fix this in
To use them just use the
Below we'll expose what's happening on a lower level when you add a hardware breakpoint. You need to know a bit about how processors work in order to understand it. This is not needed to solve your problem so feel free to ignore it.
When the debugger adds a hardware breakpoint it changes some of the processor registers (on x86 and amd64 they are the Dr registers) so the processor halts when a certain address is accessed (either for reading, writing or execution). As a result this implies that no data has to be written in memory solving the soft breakpoints problem, but also limits the number of available breakpoints.
After debugging you may want to restore the system to its normal state, if you
used
# paxctl -ze binary