Skip to content

Commit

Permalink
add access_denied, see if this helps identify when we have shim acces…
Browse files Browse the repository at this point in the history
…s denied with newer ovmf
  • Loading branch information
raharper committed Mar 19, 2024
1 parent 7058d02 commit 8187207
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/harness
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ def denied_boot(_name, _tdata, result):
raise TestError("boot was not denied")


def access_denied(_name, _tdata, result):
"""Validate that shell refused to boot shim"""
if result.is_denied() is True:
return
rase TestError("shim access was not denied")


def load_test_data(testfile):
testdata = yaml.safe_load(read_file(testfile))

Expand Down Expand Up @@ -151,6 +158,7 @@ CHECKS = {
"booted-expected-cli": booted_expected_cli,
"warned-cmdline": warned_cmdline,
"denied-boot": denied_boot,
"access-denied": access_denied,
}


Expand Down Expand Up @@ -892,6 +900,7 @@ class TestResult:
re_cmdline = re.compile(r"KERNEL COMMAND LINE: (?P<value>[^\n]*)\n")
re_rejected = re.compile(r"Custom kernel command line rejected\n")
re_warned = re.compile(r"Custom kernel would be rejected in secure mode\n")
re_denied = re.compile(r"failed to load.*: Access Denied\n")

def __init__(self, rdir):
self.rdir = rdir
Expand Down Expand Up @@ -919,6 +928,10 @@ class TestResult:
def is_warned(self):
return self.re_warned.search(self.serial) is not None

@functools.lru_cache
def is_denied(self):
return self.re_denied.search(self.serial) is not None


class TestError(Exception):
pass
Expand Down
1 change: 1 addition & 0 deletions test/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# - booted-expected-cli: the kernel booted and had the provided 'expected'.
# - denied-boot: stubby refused to boot kernel.
# - warned-cmdline: stubby warned that secureboot would not allow.
# - access-denied: uefi shell refuses to run shim.efi
#
# notes:
# sb-shim -> secureboot=true shim=yes
Expand Down

0 comments on commit 8187207

Please sign in to comment.