Skip to content

Conversation

@DanBlackwell
Copy link
Contributor

@DanBlackwell DanBlackwell commented Nov 14, 2025

This sanitizer adds MTE (memory tagging extension) checks to stack variable accesses. It does not have a runtime library component, so some changes have been made to the driver logic to account for this cleanly.

The corresponding Swift change is at: swiftlang/swift#85515.

rdar://161721201

Copy link
Member

@kateinoigakukun kateinoigakukun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me, modulo the missing optional guard

) throws -> String? {
let environment = (targetTriple.environment == .android) ? "-android" : ""
return "libclang_rt.\(sanitizer.libraryName)-\(targetTriple.archName)\(environment).a"
return "libclang_rt.\(sanitizer.runtimeLibraryName)-\(targetTriple.archName)\(environment).a"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return "libclang_rt.\(sanitizer.runtimeLibraryName)-\(targetTriple.archName)\(environment).a"
guard let runtimeLibraryName = sanitizer.runtimeLibraryName else { return nil }
return "libclang_rt.\(runtimeLibraryName)-\(targetTriple.archName)\(environment).a"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review! Good spot, I have added the guard now.

@cachemeifyoucan
Copy link
Contributor

@swift-ci please test

DanBlackwell added a commit to swiftlang/swift that referenced this pull request Dec 5, 2025
This sanitizer adds MTE (memory tagging extension) checks to stack
variable accesses. Enablement simply requires setting an attribute on
function definitions, and the instrumentation is added by LLVM.

The corresponding swift-driver change is at:
swiftlang/swift-driver#2016.

rdar://161721201
@DanBlackwell
Copy link
Contributor Author

@swift-ci please test

This sanitizer adds MTE (memory tagging extension) checks to stack variable accesses. It does not have a runtime library component, so some changes have been made to the driver logic to account for this cleanly.
@DanBlackwell DanBlackwell force-pushed the add-memtagstack-option branch from d8c9c31 to f474ff0 Compare December 9, 2025 14:51
@DanBlackwell
Copy link
Contributor Author

@swift-ci please test

@DanBlackwell
Copy link
Contributor Author

@swift-ci please test windows

@DanBlackwell DanBlackwell merged commit 31f762e into swiftlang:main Dec 12, 2025
37 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants