Skip to content

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

Closed

Description

@jkoritzinsky

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.

Activity

  1. added
    disabled-test
    os-macos
    on Nov 2, 2021
  2. ghost added
    untriaged
    on Nov 2, 2021
  3. removed
    untriaged
    on May 10, 2022
  4. added this to the 7.0.0 milestone on May 10, 2022
  5. elinor-fung commented on Jun 10, 2022

    @elinor-fung
    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");
        }
    }
  6. vitek-karas commented on Jun 13, 2022

    @vitek-karas
    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.

  7. modified the milestones: 7.0.0, 8.0.0 on Aug 5, 2022
  8. modified the milestones: 8.0.0, Future on Jul 24, 2023
  9. added
    in-pr
    on Aug 30, 2024
  10. locked and limited conversation to collaborators on Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Hostdisabled-testin-pros-macos

    Type

    No type

    Projects

    • Status
      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions