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

[NativeAOT/x86] Enable SAFESEH #100430

Closed
jkotas opened this issue Mar 29, 2024 · 2 comments · Fixed by #100433
Closed

[NativeAOT/x86] Enable SAFESEH #100430

jkotas opened this issue Mar 29, 2024 · 2 comments · Fixed by #100433

Comments

@jkotas
Copy link
Member

jkotas commented Mar 29, 2024

Repro

Build repro/reproNative convenience project for win x86 target (https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/nativeaot.md)

Result

1>repro.obj : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(AllocFast.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(WriteBarriers.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(ExceptionHandling.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(GcProbe.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(StubDispatch.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(MiscStubs.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(PInvoke.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(UniversalTransition.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>C:\runtime\src\coreclr\tools\aot\ILCompiler\reproNative\Release\reproNative.exe : fatal error LNK1281: Unable to generate SAFESEH image.

The reproNative project has the secure vcproj defaults, passes /SAFESEH to the linker and linker complains that the inputs are not annotated with SAFESEH.

We should get the obj inputs annotated correctly (looks like it will require change in the obj writer) and pass SAFESEH to the linker on win-x86 to avoid compliance warnings from tools like https://github.com/microsoft/binskim

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Mar 29, 2024
@jkotas jkotas added area-NativeAOT-coreclr arch-x86 os-windows and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Mar 29, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Mar 29, 2024
@jkotas
Copy link
Member Author

jkotas commented Mar 29, 2024

cc @filipnavara

@filipnavara filipnavara self-assigned this Mar 29, 2024
@filipnavara
Copy link
Member

filipnavara commented Mar 29, 2024

The ObjWriter change should be quite trivial. We just need to emit the @feat.00 symbol and we already do a very similar thing for control flow guard.

@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Mar 29, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants