Talk:SECURITY Debugging with Hardened Gentoo

From Gentoo Linux Wiki

Jump to: navigation, search

With the simplest source code:

// test1.c
int main() {
    int i = 1;
    int j = 2;
    int k = i + j;
    return 0;
}

I compiled exactly as advised:

$ g++ -fPIC -g3 -fno-pie -fno-stack-protector-all -nonow -norelro -nopie -c test1.c
$ g++ -ggdb -o test1 test1.o
$ /sbin/paxctl -prmxs test1

I ran GDB exactly as advised:

$ gdb -q /lib/ld-linux.so.2
(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run ./test1
Starting program: /lib/ld-linux.so.2 ./test1
warning: shared library handler failed to enable breakpoint

Program exited normally.
(gdb)

This works but if I can't set any breakpoint, it's not useful:

$ gdb -q /lib/ld-linux.so.2
(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) file ./test1
Reading symbols from /home/ywlaw/dev/eyesim3/test1...done.
(gdb) b test1.c:6
Breakpoint 1 at 0x702: file test1.c, line 6.
(gdb) run ./test1
Starting program: /home/ywlaw/dev/eyesim3/test1 ./test1
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x702: Input/output error.
Cannot insert breakpoint -3.
Error accessing memory address 0x5c0: Input/output error.

(gdb)

In conclusion, a solution is yet to be found.


Any solution to this problem? if some one can pls email me at vodkamilkshake at uk2.net.

Personal tools