[PATCH] D60039: Fix the bug of garbage collection of siod.
LuoYuanke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 1 18:24:08 PDT 2019
LuoYuanke added a comment.
In D60039#1450808 <https://reviews.llvm.org/D60039#1450808>, @craig.topper wrote:
> Are sure RBP isn't in the jmp buffer? There's a macro used by setjmp called PTR_MANGLE that can xor the pointer with another variable which can obscure the value. It gets xored again in longjmp to demangle it. But in either case its not a good idea to examine the contents of jmp_buf so I think this is the right fix.
Yes. I'm sure. There is two evidence that shows rbp is not saved in jmp buffer on my machine. First I set a breakpoint before calling setjmp and dump the register in gdb. After calling setjmp, I also dump the memory of jmp buffer and it shows the rbp value is not saved in jmp buffer. Second I disassemble the setjmp code as below and there is no code to save rbp in jmp buffer. Also when app fails, the failed object pointer is the same value of rbp which shows in gdb before setjmp.
Breakpoint 1, 0x00007ffff6f94040 in _setjmp () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.17-196.el7.x86_64
(gdb) disassemble
Dump of assembler code for function _setjmp:
=> 0x00007ffff6f94040 <+0>: xor %esi,%esi
0x00007ffff6f94042 <+2>: jmpq 0x7ffff6f93fa0 <__sigsetjmp>
End of assembler dump.
(gdb) disassemble __sigsetjmp
Dump of assembler code for function __sigsetjmp:
0x00007ffff6f93fa0 <+0>: mov %rbx,(%rdi)
0x00007ffff6f93fa3 <+3>: mov %rbp,%rax
0x00007ffff6f93fa6 <+6>: xor %fs:0x30,%rax
0x00007ffff6f93faf <+15>: rol $0x11,%rax
0x00007ffff6f93fb3 <+19>: mov %rax,0x8(%rdi)
0x00007ffff6f93fb7 <+23>: mov %r12,0x10(%rdi)
0x00007ffff6f93fbb <+27>: mov %r13,0x18(%rdi)
0x00007ffff6f93fbf <+31>: mov %r14,0x20(%rdi)
0x00007ffff6f93fc3 <+35>: mov %r15,0x28(%rdi)
0x00007ffff6f93fc7 <+39>: lea 0x8(%rsp),%rdx
0x00007ffff6f93fcc <+44>: xor %fs:0x30,%rdx
0x00007ffff6f93fd5 <+53>: rol $0x11,%rdx
0x00007ffff6f93fd9 <+57>: mov %rdx,0x30(%rdi)
0x00007ffff6f93fdd <+61>: mov (%rsp),%rax
0x00007ffff6f93fe1 <+65>: nop
0x00007ffff6f93fe2 <+66>: xor %fs:0x30,%rax
0x00007ffff6f93feb <+75>: rol $0x11,%rax
0x00007ffff6f93fef <+79>: mov %rax,0x38(%rdi)
0x00007ffff6f93ff3 <+83>: jmpq 0x7ffff6f94000 <__sigjmp_save>
(gdb) disassemble __sigjmp_save
Dump of assembler code for function __sigjmp_save:
0x00007ffff6f94000 <+0>: xor %eax,%eax
0x00007ffff6f94002 <+2>: test %esi,%esi
0x00007ffff6f94004 <+4>: push %rbx
0x00007ffff6f94005 <+5>: mov %rdi,%rbx
0x00007ffff6f94008 <+8>: je 0x7ffff6f9401f <__sigjmp_save+31>
0x00007ffff6f9400a <+10>: lea 0x48(%rdi),%rdx
0x00007ffff6f9400e <+14>: xor %esi,%esi
0x00007ffff6f94010 <+16>: xor %edi,%edi
0x00007ffff6f94012 <+18>: callq 0x7ffff6f94490 <sigprocmask>
0x00007ffff6f94017 <+23>: test %eax,%eax
0x00007ffff6f94019 <+25>: sete %al
0x00007ffff6f9401c <+28>: movzbl %al,%eax
0x00007ffff6f9401f <+31>: mov %eax,0x40(%rbx)
0x00007ffff6f94022 <+34>: xor %eax,%eax
0x00007ffff6f94024 <+36>: pop %rbx
0x00007ffff6f94025 <+37>: retq
End of assembler dump.
Repository:
rT test-suite
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60039/new/
https://reviews.llvm.org/D60039
More information about the llvm-commits
mailing list