Skip to content

[SR-14813] [Fuzzers] Fix the mangler and reflection fuzzer build. #38023

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 5 commits into from
Jun 29, 2021

Conversation

al45tair
Copy link
Contributor

@al45tair al45tair commented Jun 22, 2021

The mangler fuzzer and reflection fuzzer build was broken, both by a problem in the CMake scripts and also because of changes that have happened in other parts of the code.

Resolves SR-14813.
rdar://79623532

The mangler fuzzer and reflection fuzzer build was broken, both by a problem in
the CMake scripts and also because of changes that have happened in other parts
of the code.
@al45tair al45tair requested a review from gottesmm June 22, 2021 11:00
@al45tair
Copy link
Contributor Author

@swift-ci Please smoke test

case DLQ_GetPtrAuthMask: {
auto result = static_cast<uintptr_t *>(outBuffer);
#if __has_feature(ptrauth_calls)
*result = (uintptr_t)ptrauth_strip((void*)0x0007ffffffffffff, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a true mask that we can rely on instead of hard coding?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment here explaining what you are doing in more detail. That is can you explain here what you are actually testing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also you should run this through git-clang-format. The reason why I know that you haven't is that (void*) should be (void *). Also can you use static_cast like the rest of the code rather than using c casts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I think that __has_feature is a clang extension.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of the above is true, however I copied this piece of code directly from include/swift/Remote/InProcessMemoryReader.h (apparently the original was written by @kubamracek).

Not sure where that leaves us exactly. Should I fix that file at the same time?

Copy link
Contributor Author

@al45tair al45tair Jun 23, 2021

Choose a reason for hiding this comment

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

As far as __has_feature() goes, it looks like we use it all over the shop, and various files have their own variant of

#ifndef __has_feature
#define __has_feature(x) 0
#endif

which arguably belongs in swift/Basic/Compiler.h with the other similar defines. Maybe fixing that should be a separate PR, though?

al45tair added 4 commits June 23, 2021 12:52
We only had the C/C++/ObjC/ObjC++ option.  Add the Swift one too.
Replace use of stdio.h, stddef.h and stdint.h with the C++ versions of
those headers.
We should be using C++ casts here.
Used git-clang-format to fix up the changed code.
@al45tair
Copy link
Contributor Author

@swift-ci Please smoke test

@al45tair al45tair requested a review from gottesmm June 25, 2021 11:15
@al45tair al45tair merged commit 4b1978c into swiftlang:main Jun 29, 2021
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.

2 participants