Skip to content

Add UBSan support for C family languages #1733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2018

Conversation

rahul-malik
Copy link
Contributor

Please test with following pull request:
swiftlang/swift#18553

}

/// Sanitization flags for the Swift compiler.
public func compileSwiftFlags() -> [String] {
return sanitizers.map({ "-sanitize=\($0.rawValue)" })
// UBSan is only available for C family languages
return sanitizers.filter{ $0 != .undefined }.map{ $0.flagName }
Copy link
Member

Choose a reason for hiding this comment

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

this used to return -sanitize=asan and now is -fsanitize=asan, that's intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wait, this is an old commit, one sec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@keith - thats actually not correct though, before it was -sanitize=address and the asan/tsan values were used to create the dylib path to the santizer runtime

@rahul-malik
Copy link
Contributor Author

@keith - Forgot to push my more recent changes, updated now!

@@ -0,0 +1,3 @@
# CUBSan

A description of this package.
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm? ;)

@@ -0,0 +1 @@
int main(int argc, char **argv);
Copy link
Contributor

Choose a reason for hiding this comment

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

The header is not required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I agree, if anything this seems like the linking testing is happening in the Swift PR and should be sufficient. Should we just remove the fixture entirely then?

Copy link
Contributor

@aciidgh aciidgh left a comment

Choose a reason for hiding this comment

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

LGTM. We don't actually need the test case as we're doing anything extra at the swiftpm level.

@rahul-malik
Copy link
Contributor Author

@acdlite @keith @vlm - Thanks for your feedback, I've removed the fixture entirely since it isn't necessary for this PR. There are tests for the Swift driver changes that assert the runtime is linked correctly which should be sufficient.

@aciidgh
Copy link
Contributor

aciidgh commented Aug 8, 2018

Cool, thanks!

@aciidgh
Copy link
Contributor

aciidgh commented Aug 8, 2018

I'll hold off merging until swiftlang/swift#18553 is merged

@aciidgh
Copy link
Contributor

aciidgh commented Aug 8, 2018

@swift-ci smoke test

@aciidgh aciidgh added the WIP Work in progress label Aug 9, 2018
@rahul-malik
Copy link
Contributor Author

@aciidb0mb3r - Finally got back to this. I believe I figured out the test issues and updated my swift pr here swiftlang/swift#18553. Feel free to re-test

@rahul-malik
Copy link
Contributor Author

@aciidb0mb3r - Swift PR just merged so this should be good to go!

@aciidgh aciidgh merged commit b8d4c97 into swiftlang:master Nov 13, 2018
@aciidgh
Copy link
Contributor

aciidgh commented Nov 13, 2018

Thanks!

@rahul-malik rahul-malik deleted the rmalik-ubsan branch November 13, 2018 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants