[GH-ISSUE #42] Reject PRI-error samples in the initial GFW assessment #28

Open
opened 2026-10-26 16:39:32 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @odcpw on GitHub (Oct 24, 2026).
Original GitHub issue: https://github.com/Zagitta/gpu-unlock/issues/42

Problem

At 4189b17711bd487d9ea4a8ff0055e6d58d19d6d3,
gpu_unlock_gfw_assess()
rejects 0xffffffff but accepts some 0xbadfxxxx register-error values as a
completed GFW state. The same module's inaccessible() helper treats the
0xbadfxxxx family as inaccessible.

This is an offline-reproduced validator inconsistency, not a report that a
specific GPU produced this sample or that the entire unlock bypassed its
remaining checks.

Minimal reproduction

Save as gfw-sentinel-repro.c at the repository root:

#include <stdio.h>
#include "kernel/gpu_unlock/gfw_eval.h"

int main(void)
{
    const struct gpu_unlock_gfw_sample sample = {
        .config_ok = true,
        .plm = 0xbadf0001,
        .boot = 0xbadf00ff,
        .cpuctl = 0xbadf0010,
    };
    printf("%d\n", gpu_unlock_gfw_assess(&sample));
}
cc -std=c11 -Wall -Wextra -Werror -I kernel/gpu_unlock \
  kernel/gpu_unlock/gfw_eval.c gfw-sentinel-repro.c -o gfw-sentinel-repro
./gfw-sentinel-repro

Actual: 0 (complete). Expected: an inaccessible-device result (-ENODEV),
not success.

Caller distinction

The initial unlock_transaction_gfw() passes samples directly to this helper.
It has additional feature/WPR2 checks after a successful assessment, so this
does not prove a complete transaction bypass.

wait_post_flr_gfw() already applies inaccessible() to the sample first and
treats temporary unreadable values as -EAGAIN within a bounded deadline.
That post-reset tolerance should remain intact.

Proposed patch and acceptance tests

  • Apply the register-error classification consistently in the pure GFW
    predicate before testing completion bits.
  • Align the initial sampler with the existing post-FLR sampler: verify the
    full PCI identity, defer the protected BOOT read until PL0 is readable, and
    retry transient inaccessible samples within the existing bounded deadline.
    Keep the predicate's inaccessible classification separate from the caller's
    retry policy.
  • Add unit cases for an error value in each sampled register separately,
    mixed error samples, all-ones values, valid completion, and legitimate
    not-yet-complete samples.
  • Add an initial-GFW adapter case that rejects an inaccessible sample without
    launching FWSEC or Booter: a permanent error must time out; an error followed
    by valid samples must recover without succeeding on the error sample.
  • Preserve bounded post-FLR recovery from transient inaccessible reads.

No driver reload, firmware execution, or live GPU testing was performed for
this finding.

Originally created by @odcpw on GitHub (Oct 24, 2026). Original GitHub issue: https://github.com/Zagitta/gpu-unlock/issues/42 ## Problem At `4189b17711bd487d9ea4a8ff0055e6d58d19d6d3`, [`gpu_unlock_gfw_assess()`](https://github.com/Zagitta/gpu-unlock/blob/4189b17711bd487d9ea4a8ff0055e6d58d19d6d3/kernel/gpu_unlock/gfw_eval.c#L10-L24) rejects `0xffffffff` but accepts some `0xbadfxxxx` register-error values as a completed GFW state. The same module's `inaccessible()` helper treats the `0xbadfxxxx` family as inaccessible. This is an offline-reproduced validator inconsistency, not a report that a specific GPU produced this sample or that the entire unlock bypassed its remaining checks. ## Minimal reproduction Save as `gfw-sentinel-repro.c` at the repository root: ```c #include <stdio.h> #include "kernel/gpu_unlock/gfw_eval.h" int main(void) { const struct gpu_unlock_gfw_sample sample = { .config_ok = true, .plm = 0xbadf0001, .boot = 0xbadf00ff, .cpuctl = 0xbadf0010, }; printf("%d\n", gpu_unlock_gfw_assess(&sample)); } ``` ```sh cc -std=c11 -Wall -Wextra -Werror -I kernel/gpu_unlock \ kernel/gpu_unlock/gfw_eval.c gfw-sentinel-repro.c -o gfw-sentinel-repro ./gfw-sentinel-repro ``` Actual: `0` (complete). Expected: an inaccessible-device result (`-ENODEV`), not success. ## Caller distinction The initial `unlock_transaction_gfw()` passes samples directly to this helper. It has additional feature/WPR2 checks after a successful assessment, so this does not prove a complete transaction bypass. `wait_post_flr_gfw()` already applies `inaccessible()` to the sample first and treats temporary unreadable values as `-EAGAIN` within a bounded deadline. That post-reset tolerance should remain intact. ## Proposed patch and acceptance tests - Apply the register-error classification consistently in the pure GFW predicate before testing completion bits. - Align the initial sampler with the existing post-FLR sampler: verify the full PCI identity, defer the protected BOOT read until PL0 is readable, and retry transient inaccessible samples within the existing bounded deadline. Keep the predicate's inaccessible classification separate from the caller's retry policy. - Add unit cases for an error value in each sampled register separately, mixed error samples, all-ones values, valid completion, and legitimate not-yet-complete samples. - Add an initial-GFW adapter case that rejects an inaccessible sample without launching FWSEC or Booter: a permanent error must time out; an error followed by valid samples must recover without succeeding on the error sample. - Preserve bounded post-FLR recovery from transient inaccessible reads. No driver reload, firmware execution, or live GPU testing was performed for this finding.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Zagitta/gpu-unlock#28
No description provided.