Commit graph

472 commits

Author SHA1 Message Date
Philipp Schuster
8b051cae03 test: extend coverage for str_to_fat()
Test for the recently fixed issue.
2026-08-24 10:02:38 +02:00
Philipp Schuster
b49072be6c test: add test_get_processor_info_extended() 2026-08-24 10:02:38 +02:00
Philipp Schuster
099ebe9b86
cargo: update deps 2026-08-24 08:34:04 +02:00
Philipp Schuster
1ff2c5d528
clippy: adjust latest nightly findings 2026-08-23 14:44:00 +02:00
Philipp Schuster
e5e4964e4d
docs: fix auxiliary rustdoc links 2026-08-13 17:24:10 +02:00
PelleKrab
746394287e feat(test-runner): add IOMMU test coverage 2026-06-25 00:54:12 -06:00
Jarl Evanson
4b63af8b16 uefi: Add PciRootBridgeIo memory and I/O space access 2026-06-16 12:13:54 -04:00
Philipp Schuster
786764fd9f
uefi-test-runner: skipping HTTPS test for aarch64
Since edk2-stable202511, the default OpenSSL security level has been
raised from 0 to 3, which rejects older RSA-based keys. Unfortunately,
the EDK2 aarch64 build forcefully disables all EC-based keys
(-DEDK2_OPENSSL_NOEC=1), effectively preventing connections to most
HTTPS/TLS hosts. Temporarily disable this test on aarch64 until EC-based
keys are supported there.
2026-06-15 11:10:49 +02:00
Philipp Schuster
7613eb9618
uefi-test-runner: make HTTPS test more reliable
We do not have control over the TLS certificates of these hosts. To
ensure non-flaky tests, we add a list of potential hosts where at least
one must succeed.
2026-06-15 11:03:05 +02:00
Philipp Schuster
608dd7c3e3
uefi-test-runner: fix HTTPS (TLS) test
## TL;DR

Switch from https://raw.githubusercontent.com to https://example.com
as GitHub's host is currently not accepted by OpenSSLs security level 3
(was 0 in older edk2).

## Root cause

The failure is not caused by a stale `cacerts.bin` or by a missing OVMF
TLS build option. It is caused by edk2 commit
`fb43f0c085045771bc2dee2f867d87298de2facb` (2025-09-19):

```text
CryptoPkg: Add support to set TLS security level.
```

That commit changed `CryptoPkg/Library/TlsLib/TlsInit.c` from:

```c
SSL_set_security_level (TlsConn->Ssl, 0);
```

to:

```c
SSL_set_security_level (TlsConn->Ssl, 3);
```

OpenSSL security level 3 rejects RSA end-entity certificates below 3072
bits. `raw.githubusercontent.com` currently serves a 2048-bit RSA leaf
certificate, so the TLS handshake is rejected as too weak.

## Evidence

The regression starts between these OVMF prebuilts:

- `edk2-stable202502`: GitHub HTTPS test works.
- `edk2-stable202602`: GitHub HTTPS test fails.
- `edk2-stable202605`: GitHub HTTPS test fails.

The failure is endpoint-specific. With the new OVMF, changing only the
HTTPS test URL to `https://example.com/` makes
`cargo xtask run --headless` pass.

Host OpenSSL reproduces the policy failure:

```sh
openssl s_client -4 \
    -connect raw.githubusercontent.com:443 \
    -servername raw.githubusercontent.com \
    -verify_return_error \
    -auth_level 3 \
    -brief
```

Expected error:

```text
verify error:num=66:EE certificate key too weak
```

At auth level 2, the same endpoint verifies successfully:

```sh
openssl s_client -4 \
    -connect raw.githubusercontent.com:443 \
    -servername raw.githubusercontent.com \
    -verify_return_error \
    -auth_level 2 \
    -brief
```

## Solution

Although edk2 now has an internal `TlsSetSecurityLevel()` helper, it is
not exposed through `EFI_TLS_PROTOCOL`, and `HttpDxe` does not let an
HTTP client lower the level. A firmware-side alternative would be to
patch edk2 to make the security level configurable, or lower the default
to level 2.

For uefi-rs, we stop using `raw.githubusercontent.com` as the HTTPS
integration test endpoint. We use a stable endpoint whose certificate
satisfies OpenSSL security level 3, for example ECDSA P-256 or
RSA 3072+. We go with `https://example.com`.

Assisted-by: Codex:GPT-5.5
2026-06-15 11:03:05 +02:00
Philipp Schuster
a63f87c742
trewide: allow() -> expect() + remove unneeded allow()
This helps to keep track with rules are actually used/violated + throws
a warning if that changes over time.
2026-06-14 17:06:00 +02:00
Jarl Evanson
c59db5c464 uefi-test-runner: Add PciRootBridgeIo attribute manipulation tests 2026-06-12 05:47:12 +02:00
Philipp Schuster
a7542a6416
chore(deps): cargo bump deps 2026-05-31 21:17:30 +02:00
Nicholas Bishop
b578053269 Fix connect_controller to take a list for driver_image.
The parameter in `uefi-raw` was wrong. This parameter is supposed to be
a null-terminated array of handles. Changed it to `*const Handle`
accordingly.

This makes the `uefi` wrapper a little ugly, since the equivalent if
`&[Option<Handle>]`, and the user must ensure that the last element of
the slice is `None`. Fortunately this parameter is usually unused, and
the user can just pass in `&[]`, so the API ugliness should be OK.
2026-05-03 20:06:37 -04:00
Jarl Evanson
b845b0ccf9 uefi-test-runner: add example for InputEx protocol 2026-04-28 07:17:16 +00:00
Philipp Schuster
1ea976d7f0 uefi: make TimerTrigger more pleasant to use 2026-04-20 18:10:43 +02:00
Philipp Schuster
2be7c63542 runtime: add CStr16::from_bytes_with_nul for UCS-2 string handling
Some UEFI variables hold UEFI strings. With the new constructor, it is
much simpler to transform a UEFI variable into a USC-2 string.
2026-03-22 10:10:42 +01:00
Philipp Schuster
62f4691443 uefi: serial: retry on timeout in fmt::Write to prevent partial writes
On real hardware, Status::TIMEOUT is common even during normal
operation, not just on failure. The previous implementation treated it
as a hard error, silently dropping bytes. Retrying until all bytes are
sent makes the fmt::Write impl reliable and match the expectations of
its callers.

This uses an the same endless loop protection mentioned earlier.
2026-03-21 15:28:38 +01:00
Nicholas Bishop
093e2278e6 test-runner: rename cpy -> copy to make typos happy 2026-03-15 17:20:53 +01:00
Philipp Schuster
84e00a3c5a uefi-test-runner: test new protocol helpers on Handle 2026-02-02 13:14:42 +01:00
Philipp Schuster
86f82fabf4 uefi: rename DevicePath[Node]::{to_string -> to_string16}()
This is a pre-requisite for the next commit that implements
Display. Display comes with a to_string() method already.
2026-02-02 13:13:20 +01:00
Philipp Schuster
a44c4e4029 uefi-test-runner: serial: test new functionality 2026-02-02 10:50:55 +01:00
Markus Ebner
f8444fd6ea
Extend pci integration test with check for generated device paths 2026-01-26 10:57:09 +01:00
Nicholas Bishop
5e8c1b5c49 test-runner: Replace addr_of with raw pointer syntax 2026-01-20 15:21:16 -05:00
Philipp Schuster
0413a7e0a7 uefi: check_event: consume Event by reference
Cloning Events is inconvenient, so we make the life if devs a little
easier.
2026-01-18 18:58:08 +01:00
Philipp Schuster
eb0a3494bf tests: improve debuggability 2025-12-27 22:18:36 +01:00
Philipp Schuster
256827771b uefi: http: improve code by directly passing in the vector
This makes usage more natural as one can pass in the
possibly uncomplete body of the http response type.
2025-12-27 22:18:36 +01:00
Philipp Schuster
bdc806f7c3 tests: fix failing integration-test
Since recently, example.com isn't sending a Content-Length header and
uses a chunked encoding. It is not trivial to implement this so we skip
this situation for now.
2025-12-27 22:14:16 +01:00
Markus Ebner
3d29ddaed1
uefi: Refactor PciRootBridgeIo::enumerate() with tree-topology information
- Refactored return type from standard BTreeSet to custom PciTree struct
- Removed special FullPciIoAddress type, since segment number is PciRoot dependent
- During enumeration, skip branches we have already seen
- During enumeration, collect tree topology information (which child bus linked from where)
- Add complicated pci structure in integration test vm
- Print child busses for every device entry in integration test
2025-11-26 21:54:32 +01:00
Markus Ebner
a82e24e973
uefi: Use new pci device enumeration in integration test 2025-11-09 20:25:10 +01:00
Ren Trieu
111fa51231
uefi: Implementing var(), vars(), and set_var() for shell interface protocol
The var() and vars() functions wrap the UEFI get_env() implementation to
retrieve a single and multiple environment variables respectively.
The set_var() function wraps the UEFI set_env() variable to set the value
of an environment variable.

Co-authored-by: Philipp Schuster <phip1611@gmail.com>
2025-11-07 09:54:30 -08:00
Philipp Schuster
2083642b4b clippy: latest nightly fixes 2025-11-02 09:27:37 +01:00
Philipp Schuster
6149921541 uefi: remove inconsistent println ! 2025-10-21 07:59:40 +02:00
Philipp Schuster
58365f79cb uefi: re-export EfiMacAddr
Otherwise, some users have to also pull in uefi-raw in a matching
version as dependency. We however want to prevent a mix use
in public API. See [0] for context.

[0] https://rust-osdev.zulipchat.com/#narrow/channel/426438-uefi-rs/topic/Re-export.20.60uefi-raw.60.20from.20.60uefi.60.3F/near/545022347
2025-10-21 07:39:45 +02:00
Philipp Schuster
72af12bb22 uefi: snp: use core::net-types in public API 2025-10-21 07:39:45 +02:00
Philipp Schuster
7182f97027 uefi: pxe: use core::net-types in public API
Please note that some structs that are low-level types and
UEFI-facing still use EfiIpAddr instead. This includes for
example

```rust
/// This struct contains optional parameters for [`BaseCode::discover`].
///
/// Corresponds to the `EFI_PXE_BASE_CODE_DISCOVER_INFO` type in the C API.
#[repr(C)]
#[derive(Debug, Pointee)]
pub struct DiscoverInfo {
    use_m_cast: bool,
    use_b_cast: bool,
    use_u_cast: bool,
    must_use_list: bool,
    server_m_cast_ip: EfiIpAddr,
    ip_cnt: u16,
    srv_list: [Server],
}
```

Once https://github.com/rust-osdev/uefi-rs/issues/1642 is resolved,
this can be improved.
2025-10-21 07:39:45 +02:00
Philipp Schuster
c0760b4663 uefi: document udp_read of PXE protocol + improve test 2025-10-17 17:10:16 +02:00
Nicholas Bishop
ee26d747cc test-runner: Add example of using the Input protocol 2025-09-03 14:20:12 -04:00
Ren Trieu
18953be01c
uefi: Revising style for EFI Shell CurDir functions
Co-authored-by: Nicholas Bishop <nbishop@nbishop.net>
2025-08-18 12:59:06 -07:00
Ren Trieu
873e3821b1
uefi: Revising function calls, names, and return types to better match standard convention 2025-08-12 08:28:39 -07:00
Ren Trieu
6d6586e413
uefi-test-runner: Added tests for EFI Shell cur_dir functions
This commit includes tests for the following EFI Shell Protocol functions:
get_cur_dir() and set_cur_dir().
2025-08-12 08:20:26 -07:00
Nicholas Bishop
7e0b8b3d5d Use size_of/align_of from prelude
As of the 2024 edition, size_of/size_of_val/align_of/align_of_val are in the
prelude, so no need to import or use a fully qualified path.
2025-08-02 16:37:20 -04:00
Nicholas Bishop
c3df136f73 uefi/test-runner: Remove crate:: and uefi:: prefix from Status
In many places, especially doc comments, `Status` was referred to as
`uefi::Status` or `crate::Status`. Consistently use `Status` instead, adding
imports as needed. Note that in cases where `Status` is only used in docstrings,
the `use` is gated by `#[cfg(doc)]`. (This avoids needing a bunch of manual
`Status::*` links in docstrings.)

This is mostly a mechanical find-replace change, except for adding imports where
needed.
2025-06-28 14:02:48 -04:00
Nicholas Bishop
4b94bd67e6 uefi/test-runner: Fix mismatched-lifetime-syntaxes lints 2025-06-19 15:43:53 -04:00
Philipp Schuster
6fb6005099
Merge pull request #1690 from rust-osdev/bishop-fix-lints-4
Fix mismatched_lifetime_syntaxes lint
2025-06-10 05:46:23 +00:00
Nicholas Bishop
18f5a61cdd test-runner: Fix clippy::uninlined_format_args lint 2025-06-08 14:54:23 -04:00
Nicholas Bishop
43aee0840e test-runner: Fix mismatched_lifetime_syntaxes lint 2025-06-08 14:26:16 -04:00
Nicholas Bishop
70a63b8924
Merge pull request #1621 from rust-osdev/snp-test
SNP Integration Test: Improve Clarity
2025-06-02 18:14:51 +00:00
Ren Trieu
4772497701
uefi-raw: Add EFI Shell Protocol
Co-authored-by: Philipp Schuster <phip1611@gmail.com>
2025-06-01 09:58:28 -07:00
Timothy Roberts
5f75bed0b8
uefi: Begin implementing the EFI Shell Protocol 2025-06-01 06:08:11 -07:00