Skip to content
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

[SR-7574] Use libfuzzer on the demangler #50116

Closed
gottesmm opened this issue May 1, 2018 · 9 comments
Closed

[SR-7574] Use libfuzzer on the demangler #50116

gottesmm opened this issue May 1, 2018 · 9 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself good first issue Good for newcomers

Comments

@gottesmm
Copy link
Member

gottesmm commented May 1, 2018

Previous ID SR-7574
Radar None
Original Reporter @gottesmm
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, StarterBug
Assignee None
Priority Medium

md5: d743c2f6a14a558328505e603463db0b

Issue Description:

This task would involve creating a driver that invokes the demangler. My suggestion would be to start with the demangler test cases. Another possible source of test cases are symbols in swift binaries and in sil test cases if they start with the $S prefix.

@belkadan
Copy link
Contributor

belkadan commented May 1, 2018

We already guarantee in debug builds that every symbol we mangle can be demangled, so a proper fuzzer would have to mutate the symbols in Swift binaries to be useful.

@gottesmm
Copy link
Member Author

gottesmm commented May 2, 2018

@belkadan I am assuming you mispoke and meant when asserts are enabled?

@belkadan
Copy link
Contributor

belkadan commented May 2, 2018

Er, yes, sorry for imprecision.

@gottesmm
Copy link
Member Author

gottesmm commented May 2, 2018

No worries. I am imprecise all the time as well ; ). I was specifically imagining a simple driver that just pushed strings through swift-demangle. I am not talking about generating swift programs with libfuzzer. I am just talking about generating/mixing random strings.

@gottesmm
Copy link
Member Author

gottesmm commented May 2, 2018

And to be clear, I know how to do this ; ). So I am going to mark making the infrastructure a starter bug.

@swift-ci
Copy link
Collaborator

Comment by Tapan Thaker (JIRA)

@gottesmm: Wanted to take up this bug, but I am not entirely sure what you mean. Trying to get clarity:

This task involves the following subtasks:
1 - Add a new argument to swiftc such that `swiftc -driver-demangle <string>' would demangle and print the string
2 - Use the above and write a test using http://llvm.org/docs/LibFuzzer.html

@gottesmm
Copy link
Member Author

tt (JIRA User) This was actually implemented recently by @dcci. I just forgot to move this bug to resolved.

That being said there are other opportunities for fuzzing that we would like to implement. Consider for instance a fuzzer that took in a sil module and then fuzzed the optimizer list. Would something like that interest you?

@swift-ci
Copy link
Collaborator

Comment by Tapan Thaker (JIRA)

@gottesmm: Sure, I will be interested. I am still pretty new to the codebase. So might need some help here and there 🙂.

@gottesmm
Copy link
Member Author

tt (JIRA User) Sure. Here is an SR for it:

https://bugs.swift.org/browse/SR-7994

I outlined there what I imagined was the simplest way to do this. Lets continue the discussion there.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants