verify_file() caches the result for each file by dev/ino, including
VE_UNVERIFIED_OK. That status only says that the file was unverified
but acceptable at the severity the caller asked for, but a later
request for the same file takes the cached result as-is: verify_prep()
and vectx_open() both treat it as "not verifying this", even at
VE_MUST.
As a result, anything that could be opened at a lower severity could
then be loaded where it must verify, e.g.:
include /boot/modules/evil.ko # VE_WANT, no fingerprint
load evil # VE_MUST, but cached as OK
Stop caching VE_UNVERIFIED_OK so that each request is judged by its own
severity, under whatever policy is in effect at the time. Files that
would be accepted unverified have no usable fingerprint, so there's
nothing to hash; they're just looked up again (and reported, if verbose)
each time they're opened.
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.