Skip to content

enable GS Cookie on OSX - #39143

Merged
janvorli merged 2 commits into
dotnet:masterfrom
VSadov:enableGSCookieOSX
Jul 13, 2020
Merged

enable GS Cookie on OSX#39143
janvorli merged 2 commits into
dotnet:masterfrom
VSadov:enableGSCookieOSX

Conversation

@VSadov

@VSadov VSadov commented Jul 11, 2020

Copy link
Copy Markdown
Member

Use '#define READONLY_ATTR_ARGS section("__DATA,__const")' for the s_gsCookie

which puts it in read only data segment.
It used to be readonly TEXT segment and that was causing issues when container is the singlefile host executable.

Fixes:#38184

@VSadov VSadov changed the title [WIP] enable GS Cookie on OSX enable GS Cookie on OSX Jul 11, 2020
@VSadov
VSadov requested a review from janvorli July 11, 2020 17:16
@VSadov
VSadov marked this pull request as ready for review July 11, 2020 17:16
#else
#ifdef __APPLE__
#define READONLY_ATTR_ARGS section("__TEXT,__const")
#define READONLY_ATTR_ARGS section("__DATA,__const")

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@janvorli janvorli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thank you!

@janvorli
janvorli merged commit 371ae3c into dotnet:master Jul 13, 2020
@VSadov

VSadov commented Jul 13, 2020

Copy link
Copy Markdown
Member Author

Thanks!!

@VSadov
VSadov deleted the enableGSCookieOSX branch July 13, 2020 17:03
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants