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

Installer test infrastructure around the install_location config file on macOS crashes test process with RC2 SDK #61131

Closed
jkoritzinsky opened this issue Nov 2, 2021 · 3 comments · Fixed by #107170
Labels
area-Host disabled-test The test is disabled in source code against the issue in-pr There is an active PR which will close this issue when it is merged os-mac-os-x macOS aka OSX
Milestone

Comments

@jkoritzinsky
Copy link
Member

jkoritzinsky commented Nov 2, 2021

The installer test infrastructure creates a dummy install_location config file for some of the nethost testing. When using the RC2 SDK, the test process crashes while running the tests that use this infrastructure.

See #60256 (comment)

After the RC2 SDK update is merged, we should figure out the cause of this failure and re-enable the disabled tests.

@jkoritzinsky jkoritzinsky added disabled-test The test is disabled in source code against the issue os-mac-os-x macOS aka OSX area-Host labels Nov 2, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Nov 2, 2021
@ghost
Copy link

ghost commented Nov 2, 2021

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

The installer test infrastructure creates a dummy install_location config file for some of the nethost testing. When using the RC2 SDK, the test process crashes while running the tests that use this infrastructure.

After the RC2 SDK update is merged, we should figure out the cause of this failure and re-enable the disabled tests.

Author: jkoritzinsky
Assignees: -
Labels:

disabled-test, os-mac-os-x, area-Host

Milestone: -

@agocke agocke removed the untriaged New issue has not been triaged by the area owner label May 10, 2022
@agocke agocke added this to the 7.0.0 milestone May 10, 2022
@elinor-fung
Copy link
Member

This is some System Integrity Protection sadness. I don't actually understand macOS / SIP to know exactly what is going on, why it would have started happening when the repo switched to 6.0 RC2, or how to address I - but here is what I see:

Crash report:

System Integrity Protection: enabled

Crashed Thread:        8

Exception Type:        EXC_CRASH (Code Signature Invalid)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace CODESIGNING, Code 0x2

I didn't manage to get a core dump (maybe I need to do something extra beyond unlimited ulimit and having access to /cores, since SIP is enabled?), but based on some printf-ing, we are crashing in this call:

Only happens when modifying Release host bits. We explicitly run codesign in that case. If I remove the codesign call, the crash stops happening.

set(strip_command ${strip_command} && codesign -f -s - ${strip_source_file})

Only happens when a process that uses the binary that gets edited is previously launched. This is probably why we have a bunch of other tests that use TestOnlyProductBehavior/RegisteredInstallLocationOverride without issue. For example:

[Fact]
public void DummyTest()
{
    // TestOnlyProductBehavior.Enable succeeds if we don't launch the nativehost process (which uses nethost)
    Console.WriteLine("Launching process");
    Command.Create(sharedState.NativeHostPath, GetHostFxrPath).Execute();

    Console.WriteLine("Enabling test behaviour");
    using (var test = TestOnlyProductBehavior.Enable(sharedState.NethostPath))
    {
        Console.WriteLine("Enabled test behaviour");
    }
}

@vitek-karas
Copy link
Member

I don't know the details either, but I do remember a discussion somewhere and the problem was that macOS cached some security related information about a file. This sounds similar.

What we could do is to change the infra in such a way that we always create a new copy of the runtime directories before we apply test-only behavior - this would guarantee that the executable is not used before it's modified as test-only.

Alternatively: We make copies of all the runtime files for each test class anyway (no test should use the original runtime files directly), we could stamp the produce as test-only as part of this copy and simply run everything in the test-only mode. It should not have any impact on the validity of test results.

@vitek-karas vitek-karas modified the milestones: 7.0.0, 8.0.0 Aug 5, 2022
@agocke agocke modified the milestones: 8.0.0, Future Jul 24, 2023
@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Host disabled-test The test is disabled in source code against the issue in-pr There is an active PR which will close this issue when it is merged os-mac-os-x macOS aka OSX
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants