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

enable GS Cookie on OSX #39143

Merged
merged 2 commits into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/coreclr/src/vm/ceemain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,6 @@ void InitGSCookie()
}
CONTRACTL_END;

#if defined(TARGET_OSX) && defined(CORECLR_EMBEDDED)
// OSX does not like the way we change section protection when running in a superhost bundle
// disabling this for now
// https://github.com/dotnet/runtime/issues/38184
return;
#endif

volatile GSCookie * pGSCookiePtr = GetProcessGSCookiePtr();

#ifdef TARGET_UNIX
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/vm/vars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ typedef DPTR(GSCookie) PTR_GSCookie;
#define READONLY_ATTR
#else
#ifdef __APPLE__
#define READONLY_ATTR_ARGS section("__TEXT,__const")
#define READONLY_ATTR_ARGS section("__DATA,__const")
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to change it only for CORECLR_EMBEDDED? See the previous discussion: #36808 (comment).

Copy link
Member

Choose a reason for hiding this comment

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

@am11 do you see a reason to make this different for embedded and regular coreclr? It seems to me that it is fine to have it in the __DATA,__const segment for both.

Copy link
Member

Choose a reason for hiding this comment

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

If it is working for all cases, then sounds good. :)
I was just thinking that since we have __TEXT,__const _s_gsCookie in the osx binary from the beginning (and previous change did not alter the section type); considering the requirements such as Mojave hardened runtime, maybe we do not need to change the type for the existing (non-embedded) case.

Copy link
Member

Choose a reason for hiding this comment

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

I've verified that it works with the non-embedded coreclr with Mojave hardened runtime (running the app signed and from bundle) too.

#else
#define READONLY_ATTR_ARGS section(".rodata")
#endif
Expand Down