I dynamically loaded a piece of code into memory for execution and reported to SIGSEGV. Debug with gdb and find a strange phenomenon:
first of all, the environment is:
(gdb) bt
-sharp0 0x00007ffff7e91360 in ?? ()
(gdb) i r
...
rip 0x7ffff7e91360
cs 0x33
(gdb) x/i 0x7ffff7e91360
=> 0x7ffff7e91360: rex.W jmpq *0x5e019(%rip) -sharp 0x7ffff7eef380
(gdb) x/7xb 0x7ffff7e91360
0x7ffff7e91360: 0x48 0xff 8x25 0x19 0xe0 0x05 0x00
(gdb) x/5i 0x7ffff7eef380
0x7ffff7eef380: mov %gs,(%rax)
0x7ffff7eef382: or (%rax),%al
0x7ffff7eef384: add %al,(%rax)
0x7ffff7eef386: add %al,(%rax)
0x7ffff7eef388: subb $0xa,(%rax)
(gdb) x/8xb 0x7ffff7eef380
0x7ffff7eef380: 0x8c 0x28 0x0a 0x00 0x00 0x00 0x00 0x00
gdb gives a hint 0x7ffff7eef380
the information here is also strange.
single-step debugging:
(gdb) stepi
0x00000000000a288c in ?? ()
the address here is not mapped, cannot be accessed, and the segment is incorrect.
what may be the cause of this problem? Thank you!