Page MenuHomeFreeBSD

Fix pkgfs stat so it satisfies libsecureboot
Needs ReviewPublic

Authored by sjg on Mar 11 2020, 8:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 8:36 AM
Unknown Object (File)
Tue, Apr 30, 8:18 AM
Unknown Object (File)
Tue, Apr 30, 8:15 AM
Unknown Object (File)
Tue, Apr 30, 8:14 AM
Unknown Object (File)
Tue, Apr 30, 3:19 AM
Unknown Object (File)
Feb 5 2024, 4:42 PM
Unknown Object (File)
Dec 29 2023, 11:37 PM
Unknown Object (File)
Dec 20 2023, 9:57 PM
Subscribers

Details

Reviewers
imp
tsoome
stevek
Group Reviewers
bhyve
Summary

We need a valid st_dev, st_ino and st_mtime
to correctly track which files have been verified
and to update our notion of time.

ve_utc_set(): ignore utc if it would jump our current time
by more than VE_UTC_MAX_JUMP (20 years).

Allow testing of install command via userboot.
Need to fix its stat implementation too.

bhyveload also needs stat fixed - due to change to userboot.h

Track the names of files we have hashed into pcr

For the purposes of measured boot, it is important
to be able to reproduce the hash reflected in
loader.ve.pcr
so loader.ve.hashed provides a list of names in the order they
were added.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 29953
Build 27770: arc lint + arc unit

Event Timeline

Fix pkg_seek - can rewind within cache limit

vectx_close: ensure we have hashed whole file

generally this is OK. a bit of creeping featurism, but I think it may be needed to support the desired functionality.

lib/libsecureboot/vepcr.c
104

what is the consequence of memory allocation failure here?

156

how is memory allocation failure handled? Can ve_pcr_hashed_get callers code? Eg, what's one layer up and beyond that uses / needs loader.ve.hashed set and how will it react to not being set?

ve_pcr_update: check malloc failure

lib/libsecureboot/vepcr.c
104

Per the update ;-)
If malloc fails, the only fallout is if userland is trying to do measured boot.
Any gap in hashed list will make it impossible to verify the pcr value reliably.

156

if malloc fails caller gets NULL and doesn't export loader.ve.hashed
which only impacts userland if trying to do measured boot.
Makes it harder for sure, not necessarily impossible.