Skip to content

Conversation

@ben-craig
Copy link

This adds the capability to test the STL in the Windows kernel. The expectation is that the Windows kernel will support most of the freestanding facilities, with the likely exception of those involving RTTI and exceptions.

On the cmake side of things, I add a new executable that will do the necessary Windows things to load a kernel driver and run the unit test. I also create a static lib with shared per-test code. This includes a custom assert implementation that won't crash the system, but will instead continue executing and report the results up though the executable. This is basically downgrading the "assert" to an "expect". In practice, this hasn't caused me any problems so far.

The certificate used for driver signing is generated at test time, and is self signed. The certificate has a password that is generated during test time, and then forgotten when the test is done running. The certificate also has a very quick expiration date (2 days). All of these together should make the certificate both difficult to attack, and not worth attacking, as it will (at most) give you access to one CI VM for 2 days.

This supersedes #1421 (which superseded #1385)

CaseyCarter and others added 30 commits July 25, 2020 20:43
We correctly deprecated `atomic_init` when implementing P0883R2, but missed that the effects changed as well.
@ben-craig ben-craig requested a review from a team as a code owner July 4, 2021 21:07
@StephanTLavavej StephanTLavavej added the test Related to test code label Jul 6, 2021
@StephanTLavavej
Copy link
Member

The tests are failing with:

1: Test command: "C:\Program Files\Python39\python.exe" "D:/build/tests/utils/stl-lit/stl-lit.py" "--timeout=240" "--shuffle" "-j30" "--xunit-xml-output=D:\build/test-results.xml" "-vv" "--num-shards=8" "--run-shard=1" "C:/a/1/s/llvm-project/libcxx/test/std" "C:/a/1/s/tests/std/tests" "C:/a/1/s/tests/tr1/tests"
1: Test timeout computed to be: 10000000
1: stl-lit.py: C:\a\1\s\llvm-project\llvm\utils\lit\lit\TestingConfig.py:99: fatal: unable to parse config file 'D:\\build\\tests\\libcxx\\lit.site.cfg', traceback: Traceback (most recent call last):
1:   File "C:\a/1/s/llvm-project/llvm\utils\lit\lit\TestingConfig.py", line 88, in load_from_path
1:     exec(compile(data, path, 'exec'), cfg_globals, None)
1:   File "D:\build\tests\libcxx\lit.site.cfg", line 43, in <module>
1:     stl.test.config.configure(
1:   File "C:\a\1\s\tests\utils\stl\test\config.py", line 63, in configure
1:     raise RuntimeError(report)
1: RuntimeError: Command: "powershell" "-ExecutionPolicy" "Bypass" "-File" "C:/a/1/s/tests/utils/kernel/generateMsvcCert.ps1" "-out" "D:/build/out/bin/i386/MsvcStlTestingCert.pfx" "-pass" "REDACTED_BY_STL"
1: Exit Code: 1
1: Standard Error:
1: --
1: New-SelfSignedCertificate : CertEnroll::CX509Enrollment::_CreateRequest: Access denied. 0x80090010 (-2146893808
1: NTE_PERM)
1: At C:\a\1\s\tests\utils\kernel\generateMsvcCert.ps1:21 char:9
1: + $cert = New-SelfSignedCertificate -Type CodeSigningCert -DnsName "Msv ...
1: +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1:     + CategoryInfo          : NotSpecified: (:) [New-SelfSignedCertificate], Exception
1:     + FullyQualifiedErrorId : System.Exception,Microsoft.CertificateServices.Commands.NewSelfSignedCertificateCommand

@StephanTLavavej StephanTLavavej added the help wanted Extra attention is needed label Jul 13, 2021
@StephanTLavavej
Copy link
Member

Marking as help wanted; @ben-craig mentioned that the tests are failing because the CI isn't running as admin.

@StephanTLavavej
Copy link
Member

We're going to close this PR for now - although we remain interested in supporting and testing kernel mode, we haven't found a way to get this working in the CI system. A possible way to make progress here would be to set up a fork of this repo with an Azure Pipelines Virtual Machine Scale Set, using very small/cheap VMs (not the 32-core monsters used by the official repo), and then iterating with that VMSS until the proper incantations to enable kernel mode testing with ultra-admin-etc. permissions are found. If and when a path forward is discovered, a new PR can be opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed test Related to test code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants