Skip to content

Conversation

@Enselic
Copy link
Member

@Enselic Enselic commented Oct 24, 2025

To avoid linker errors like

relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against `.data.rel.ro..L.hwasan'

we need to have -C target-feature=+tagged-globals, which is documented here. I learned that here.

Closes #83989

try-job: aarch64-gnu

@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 24, 2025
@Enselic
Copy link
Member Author

Enselic commented Oct 24, 2025

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 24, 2025
tests/ui/sanitizer/hwaddress.rs: Run on aarch64 and remove cgu hack

try-job: aarch64-gnu
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment was marked as outdated.

@Enselic

This comment was marked as outdated.

rust-bors bot added a commit that referenced this pull request Oct 24, 2025
tests/ui/sanitizer/hwaddress.rs: Run on aarch64 and remove cgu hack

try-job: aarch64-gnu
@rust-bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment was marked as outdated.

@Enselic

This comment was marked as outdated.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 24, 2025
tests/ui/sanitizer/hwaddress.rs: Run on aarch64 and remove cgu hack

try-job: aarch64-gnu
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment was marked as outdated.

To avoid linker errors like

    relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against `.data.rel.ro..L.hwasan'

we need to have `-C target-feature=+tagged-globals`, which is documented here:
https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html#hwaddresssanitizer
@Enselic

This comment was marked as outdated.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 24, 2025
tests/ui/sanitizer/hwaddress.rs: Run on aarch64 and remove cgu hack

try-job: aarch64-gnu
@rust-bors
Copy link

rust-bors bot commented Oct 24, 2025

☀️ Try build successful (CI)
Build commit: 17d9639 (17d9639cb3c83c378f550f5436c615028128329d, parent: ab925646fae038b02bd462cd328ae9eef1639236)

@Enselic
Copy link
Member Author

Enselic commented Oct 24, 2025

Try build succeeded, so ready for review.

r? @nagisa since you reviewed the original PR and hopefully is comfortable to also review this one.

@nagisa
Copy link
Member

nagisa commented Oct 26, 2025

Hm, if hwasan generally requires tagged globals (which it seems to do,) shouldn't we be enabling that feature whenever the hwaddress sanitizer is requested?

This is what LLVM folks are saying in the linked LLVM PR they're doing for Clang as well...

@Enselic
Copy link
Member Author

Enselic commented Oct 27, 2025

I agree. But that is probably not trivial, and while we wait for someone to get around to fix that, it seems like a good idea to make the test run on aarch64 and with 1 cgu to prevent regressions from slipping in.

I'm currently on mobile. I can file an issue for that when I'm back on a desktop computer.

(I see now I forgot to move this PR out of Draft.)

@Enselic Enselic marked this pull request as ready for review October 27, 2025 03:59
@rustbot
Copy link
Collaborator

rustbot commented Oct 27, 2025

Some changes occurred in tests/ui/sanitizer

cc @rcvalle

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 27, 2025
@nagisa
Copy link
Member

nagisa commented Oct 27, 2025

Yeah please file an issue.

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 27, 2025

📌 Commit 38a1790 has been approved by nagisa

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 27, 2025
@Enselic
Copy link
Member Author

Enselic commented Oct 27, 2025

Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 28, 2025
tests/ui/sanitizer/hwaddress.rs: Run on aarch64 and remove cgu hack

To avoid linker errors like

    relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against `.data.rel.ro..L.hwasan'

we need to have `-C target-feature=+tagged-globals`, which is documented [here](https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html#hwaddresssanitizer).  I learned that [here](llvm/llvm-project#164876 (comment)).

Closes rust-lang#83989

try-job: aarch64-gnu
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 28, 2025
tests/ui/sanitizer/hwaddress.rs: Run on aarch64 and remove cgu hack

To avoid linker errors like

    relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against `.data.rel.ro..L.hwasan'

we need to have `-C target-feature=+tagged-globals`, which is documented [here](https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html#hwaddresssanitizer).  I learned that [here](llvm/llvm-project#164876 (comment)).

Closes rust-lang#83989

try-job: aarch64-gnu
bors added a commit that referenced this pull request Oct 28, 2025
Rollup of 14 pull requests

Successful merges:

 - #144936 (CFI: Fix types that implement Fn, FnMut, or FnOnce)
 - #147185 (repr(transparent): do not consider repr(C) types to be 1-ZST)
 - #147840 (Rework unsizing coercions in the new solver)
 - #147915 (Update target maintainers android.md)
 - #148013 (1.91.0 release notes)
 - #148044 (compiletest: show output in debug logging)
 - #148057 (tests/ui/sanitizer/hwaddress.rs: Run on aarch64 and remove cgu hack)
 - #148139 (Add `coverage` scope for controlling paths in code coverage)
 - #148154 (Add a mailmap entry)
 - #148158 (ci: loongarch64: use medium code model to avoid relocation overflows)
 - #148166 (Re-enable macro-stepping test for AArch64)
 - #148172 (rustc-dev-guide subtree update)
 - #148175 (Fix typos: duplicate words in comments)
 - #148186 (rustdoc-search: add an integration test for CCI)

Failed merges:

 - #147935 (Add LLVM realtime sanitizer)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 78526e4 into rust-lang:master Oct 28, 2025
12 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Oct 28, 2025
rust-timer added a commit that referenced this pull request Oct 28, 2025
Rollup merge of #148057 - Enselic:hwasan-fix-v2, r=nagisa

tests/ui/sanitizer/hwaddress.rs: Run on aarch64 and remove cgu hack

To avoid linker errors like

    relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against `.data.rel.ro..L.hwasan'

we need to have `-C target-feature=+tagged-globals`, which is documented [here](https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html#hwaddresssanitizer).  I learned that [here](llvm/llvm-project#164876 (comment)).

Closes #83989

try-job: aarch64-gnu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

UI test sanitize/hwaddress.rs fails with linker error on aarch64 when executed with 1 CGU

5 participants