Skip to content

Conversation

elinor-fung
Copy link
Member

dotnet/runtime#103007 switched apphost/singlefilehost to enable CET shadow stack compatibility by default, with an option to disable it in HostWriter.CreateAppHost. This change updates the SDK to disable CET compat if the project sets <CetCompat>false</CetCompat>.

cc @dotnet/appmodel @AaronRobinsonMSFT @janvorli @mangod9

@elinor-fung elinor-fung requested a review from a team June 7, 2024 18:32
@elinor-fung elinor-fung requested a review from a team as a code owner June 7, 2024 18:32
@ghost ghost added Area-Infrastructure untriaged Request triage from a team member labels Jun 7, 2024
Copy link
Member

@agocke agocke left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@joeloff
Copy link
Member

joeloff commented Jun 7, 2024

Q: I noticed this is targeting Windows/EXE. Is it possible to produce a CET compatible library which is then linked into an application or is this something that's enabled for the running application as a whole? I'm asking because it seems this is controlled by a bit in the PE header so presumably you can set this for some, none or all DLLs your application consumes.

@janvorli
Copy link
Member

Q: I noticed this is targeting Windows/EXE. Is it possible to produce a CET compatible library which is then linked into an application or is this something that's enabled for the running application as a whole? I'm asking because it seems this is controlled by a bit in the PE header so presumably you can set this for some, none or all DLLs your application consumes

@joeloff if a CET is enabled in a process, it needs to be so from the very beginning of the process runtime. The OS needs to create a shadow stack that is used to store return addresses in parallel to the regular stack at the process startup. DLLs can also be marked as CET compatible. There is a policy that can be set system-wide or per process that determines whether a process that runs with CET enabled can load all DLLs or only the ones with the CET compatibility flag set and containing EHCONT data.

@elinor-fung elinor-fung merged commit 2defc3d into dotnet:main Jun 10, 2024
@elinor-fung elinor-fung deleted the host-cet-compat branch June 10, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-NetSDK untriaged Request triage from a team member

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants