Skip to content

Conversation

@fneddy
Copy link
Contributor

@fneddy fneddy commented Nov 18, 2025

on s390x 128bit types have a smaller alignment then on x861. This leads to smaller structs (24 instead of 32 bytes) and therefore the write_unaligned will write outside of the structs boundary.

To fix the test, change the trailing u32 into a u8. This will generate 7 trailing padding bytes on s390x and 15 on x86_64. Also change the start of the garbage data so it will span over x,y and padding:

s390x:   XXXXXXXXXXXXXXXXY-------
x86_64:  XXXXXXXXXXXXXXXXY---------------
                      GGGGGGGG

Footnotes

  1. s390x ELF ABI Table 1.1, Page 12 https://github.com/IBM/s390x-abi

on s390x 128bit types have a smaller alignment then on x86[^1]. This leads to smaller structs and therefore the write_unaligned will write outside of the structs boundary.

To fix the test, change the trailing u32 into a u8. This will generate 7 trailing padding bytes on s390x and 15 on x86_64. Also change the start of the garbage data so it will span over x,y and padding:

```
s390x:   XXXXXXXXXXXXXXXXY-------
x86_64:  XXXXXXXXXXXXXXXXY---------------
                      GGGGGGGG

```

[^1]: s390x ELF ABI Table 1.1, Page 12 https://github.com/IBM/s390x-abi
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 18, 2025

r? @madsmtm

rustbot has assigned @madsmtm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@fneddy
Copy link
Contributor Author

fneddy commented Nov 18, 2025

tagging @RalfJung who introduced the test in #148259

@RalfJung
Copy link
Member

Given that what we are testing here is entirely target-independent code (the handling of provenance in the interpreter), I think I'd prefer just skipping the test on s390x over the risk of making the test not test the right thing any more.

@RalfJung
Copy link
Member

This leads to smaller structs (24 instead of 32 bytes) and therefore the write_unaligned will write outside of the structs boundary.

If you add align(16) to the struct Pair, does that suffice? That should make it 32 bytes large, right?

@RalfJung
Copy link
Member

Actually never mind that, repr(align) would make this not be a ScalarPair any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants