mossberg created this revision.
mossberg added reviewers: jingham, jankratochvil, labath, clayborg,
stella.stamenova.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Original diff: D71372 <https://reviews.llvm.org/D71372>
Related diff: D71784 <https://reviews.llvm.org/D71784>
D71784 <https://reviews.llvm.org/D71784> shows that we cannot assume the stack
is not executable across platforms. Refactor the test to use a variable from
the .data section which should be guaranteed non-executable.
I would appreciate guidance regarding the `var@GOTPCREL(%rip)`. Directly
referencing `var` would not assemble on my darwin machine due to an error about
absolute addressing, and I used this to workaround it. I'm not sure if it's
even portable to other platforms?
@jankratochvil Would you be able to test this on a Fedora machine, please?
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71789
Files:
lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
Index: lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
===================================================================
--- lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
+++ lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
@@ -1,14 +1,13 @@
.text
.globl asm_main
asm_main:
- sub $0x8, %rsp
- movq $0, (%rsp)
- push %rsp
+ mov var@GOTPCREL(%rip), %rcx
+ push %rcx
jmp _nonstandard_stub
# Takes a single pointer argument via the stack, which is nonstandard for x64.
# Executing 'thread step-out' here will initially attempt to write a
-# breakpoint to that stack address, but should fail because of the executable
+# breakpoint to that .data address, but should fail because of the executable
# memory check.
_nonstandard_stub:
mov (%rsp), %rdi
@@ -18,3 +17,7 @@
add $0x10, %rsp
ret
+
+ .data
+var:
+ .long 0
Index: lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
===================================================================
--- lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
+++ lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
@@ -1,14 +1,13 @@
.text
.globl asm_main
asm_main:
- sub $0x8, %rsp
- movq $0, (%rsp)
- push %rsp
+ mov var@GOTPCREL(%rip), %rcx
+ push %rcx
jmp _nonstandard_stub
# Takes a single pointer argument via the stack, which is nonstandard for x64.
# Executing 'thread step-out' here will initially attempt to write a
-# breakpoint to that stack address, but should fail because of the executable
+# breakpoint to that .data address, but should fail because of the executable
# memory check.
_nonstandard_stub:
mov (%rsp), %rdi
@@ -18,3 +17,7 @@
add $0x10, %rsp
ret
+
+ .data
+var:
+ .long 0
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits