This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Commit af3c029
authored
winch(aarch64): Revisit the shadow stack pointer approach (#10146)
This commit marks another step toward finalizing AArch64 support in
Winch.
While enabling spec tests, I experienced some unexpected failures
related to Wasm loads/stores and traps. The observed
symptoms are as follows:
* Under normal conditions, Wasm loads/stores work as expected.
* In out-of-bounds scenarios, loads/stores result in a segmentation
fault, whereas the expected behavior is to trigger an out-of-bounds trap.
* When out-of-bounds access can be determined statically, the program
still results in a segmentation fault instead of the anticipated
out-of-bounds trap.
Debugging revealed the following issues:
* The stack pointer was not correctly aligned to 16 bytes when entering
signal handlers, which caused the segmentation fault.
* Wasm loads and stores were not flagged as untrusted, leading to
segmentation faults even when the stack pointer was properly aligned.
This commit fixes the previous issues by:
* Correctly flagging wasm loads and stores as untrusted.
* Reworking the shadow stack pointer approach such that it allows
aligning the stack pointer at arbitrary points in the program,
particularly where signal handling might be needed. This rework
involves changing some principles introduced in
bytecodealliance/wasmtime#5652; namely:
changing the primary stack pointer register to be the shadow stack
pointer. See the updates comments in the code for more details.
Note that this change doesn't enable spectests. To try this change, run:
cargo run -- wast -Ccompiler=winch tests/spec_testsuite/address.wast1 parent bb2ae7c commit af3c029
472 files changed
Lines changed: 2252 additions & 2198 deletions
File tree
- tests/disas/winch/aarch64
- br_if
- br_table
- br
- call_indirect
- call
- f32_abs
- f32_add
- f32_ceil
- f32_convert_i32_s
- f32_convert_i32_u
- f32_convert_i64_s
- f32_convert_i64_u
- f32_copysign
- f32_demote_f64
- f32_div
- f32_eq
- f32_floor
- f32_ge
- f32_gt
- f32_le
- f32_lt
- f32_max
- f32_min
- f32_mul
- f32_nearest
- f32_neg
- f32_ne
- f32_reinterpret_i32
- f32_sqrt
- f32_sub
- f32_trunc
- f64_abs
- f64_add
- f64_ceil
- f64_convert_i32_s
- f64_convert_i32_u
- f64_convert_i64_s
- f64_convert_i64_u
- f64_copysign
- f64_div
- f64_eq
- f64_floor
- f64_ge
- f64_gt
- f64_le
- f64_lt
- f64_max
- f64_min
- f64_mul
- f64_nearest
- f64_neg
- f64_ne
- f64_promote_f32
- f64_reinterpret_i64
- f64_sqrt
- f64_sub
- f64_trunc
- i32_add
- i32_and
- i32_clz
- i32_ctz
- i32_divs
- i32_divu
- i32_eq
- i32_extend_16_s
- i32_extend_8_s
- i32_ge_s
- i32_ge_u
- i32_gt_s
- i32_gt_u
- i32_le_s
- i32_le_u
- i32_lt_s
- i32_lt_u
- i32_mul
- i32_ne
- i32_or
- i32_popcnt
- i32_reinterpret_f32
- i32_rems
- i32_remu
- i32_rotl
- i32_rotr
- i32_shl
- i32_shr_s
- i32_shr_u
- i32_sub
- i32_trunc_f32_s
- i32_trunc_f32_u
- i32_trunc_f64_s
- i32_trunc_f64_u
- i32_wrap_i64
- i32_xor
- i64_add
- i64_and
- i64_clz
- i64_ctz
- i64_divs
- i64_divu
- i64_eq
- i64_extend_16_s
- i64_extend_32_s
- i64_extend_8_s
- i64_extend_i32_s
- i64_extend_i32_u
- i64_ge_s
- i64_ge_u
- i64_gt_s
- i64_gt_u
- i64_le_s
- i64_le_u
- i64_lt_s
- i64_lt_u
- i64_mul
- i64_ne
- i64_or
- i64_popcnt
- i64_reinterpret_f64
- i64_rems
- i64_remu
- i64_rotl
- i64_rotr
- i64_shl
- i64_shr_s
- i64_shr_u
- i64_sub
- i64_trunc_f32_s
- i64_trunc_f32_u
- i64_trunc_f64_s
- i64_trunc_f64_u
- i64_xor
- load
- nop
- params
- store
- winch/codegen/src
- isa/aarch64
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
| 24 | + | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
37 | 36 | | |
38 | | - | |
39 | | - | |
| 37 | + | |
| 38 | + | |
40 | 39 | | |
41 | 40 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
| 24 | + | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
0 commit comments