-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
s390x: Add support for inline probestack (#9423)
This implements the gen_inline_probestack callback in line with the implementation on other platforms, which allows detection of stack overflows with misconfigured hosts. Fixes: #9396
- Loading branch information
Showing
8 changed files
with
205 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
cranelift/filetests/filetests/isa/s390x/inline-probestack.clif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
test compile precise-output | ||
set enable_probestack=true | ||
set probestack_strategy=inline | ||
; This is the default and is equivalent to a page size of 4096 | ||
set probestack_size_log2=12 | ||
target s390x | ||
|
||
|
||
; If the stack size is just one page, we can avoid the stack probe entirely | ||
function %single_page() -> i64 tail { | ||
ss0 = explicit_slot 2048 | ||
|
||
block0: | ||
v1 = stack_addr.i64 ss0 | ||
return v1 | ||
} | ||
|
||
; VCode: | ||
; aghi %r15, -2048 | ||
; block0: | ||
; la %r2, 0(%r15) | ||
; aghi %r15, 2048 | ||
; br %r14 | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; aghi %r15, -0x800 | ||
; block1: ; offset 0x4 | ||
; la %r2, 0(%r15) | ||
; aghi %r15, 0x800 | ||
; br %r14 | ||
|
||
function %unrolled() -> i64 tail { | ||
ss0 = explicit_slot 8192 | ||
|
||
block0: | ||
v1 = stack_addr.i64 ss0 | ||
return v1 | ||
} | ||
|
||
; VCode: | ||
; aghi %r15, -4096 | ||
; mvi 0(%r15), 0 | ||
; aghi %r15, -4096 | ||
; mvi 0(%r15), 0 | ||
; aghi %r15, 8192 | ||
; aghi %r15, -8192 | ||
; block0: | ||
; la %r2, 0(%r15) | ||
; aghi %r15, 8192 | ||
; br %r14 | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; aghi %r15, -0x1000 | ||
; mvi 0(%r15), 0 | ||
; aghi %r15, -0x1000 | ||
; mvi 0(%r15), 0 | ||
; aghi %r15, 0x2000 | ||
; aghi %r15, -0x2000 | ||
; block1: ; offset 0x18 | ||
; la %r2, 0(%r15) | ||
; aghi %r15, 0x2000 | ||
; br %r14 | ||
|
||
function %large() -> i64 tail { | ||
ss0 = explicit_slot 100000 | ||
|
||
block0: | ||
v1 = stack_addr.i64 ss0 | ||
return v1 | ||
} | ||
|
||
; VCode: | ||
; lhi %r1, 25 | ||
; 0: aghi %r15, -4096 ; mvi 0(%r15), 0 ; brct %r1, 0b | ||
; agfi %r15, 102400 | ||
; agfi %r15, -100000 | ||
; block0: | ||
; la %r2, 0(%r15) | ||
; agfi %r15, 100000 | ||
; br %r14 | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; lhi %r1, 0x19 | ||
; aghi %r15, -0x1000 | ||
; mvi 0(%r15), 0 | ||
; brct %r1, 4 | ||
; agfi %r15, 0x19000 | ||
; agfi %r15, -0x186a0 | ||
; block1: ; offset 0x1c | ||
; la %r2, 0(%r15) | ||
; agfi %r15, 0x186a0 | ||
; br %r14 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters