Page MenuHomeFreeBSD

Add calls to verify_file to loader.
ClosedPublic

Authored by sjg on Jul 19 2018, 12:30 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 29, 10:25 AM
Unknown Object (File)
Mar 11 2024, 8:23 AM
Unknown Object (File)
Jan 22 2024, 12:09 PM
Unknown Object (File)
Jan 6 2024, 12:50 PM
Unknown Object (File)
Dec 30 2023, 4:41 PM
Unknown Object (File)
Dec 23 2023, 3:57 AM
Unknown Object (File)
Dec 11 2023, 1:02 AM
Unknown Object (File)
Nov 28 2023, 2:37 PM
Subscribers

Details

Summary

The basic idea is that whenever the loader opens a file
it calls verify_file() to verify it.
If that returns < 0, the file should be discarded.
This can obviously cause the boot to fail.

Some parts of the loader like load_elf.c know exactly what they are
dealing with and how important verification is.
load_elf always passes VE_MUST which tells verify_file() that
a matching hash is always required.

Other parts of the loader have no idea what file they are opening
on behalf of loader.rc etc, and these typically pass VE_GUESS
asking verify_file() to decide.

For files like loader.conf, a missing hash can be tollerated so
VE_GUESS maps to VE_TRY, for other files it maps to VE_WANT.
The only difference in behavior from those two depends on how strict
the loader has been told to be, in strict mode (eg for FIPS mode)
VE_WANT is treated as for VE_MUST, otherwise it is treated like VE_TRY.

At no time is a hash error tollerated, all the above only applies to
the case where no hash for a file can be found.

The intergration at this point is aimed to be as simple
as possible.

Further work for example would be to overhaul load_elf.c
to make use of the more efficient api in libve/vectx.c
but that would be an extensive re-work.

Diff Detail

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

Event Timeline

Cannot find agc - who I know should be interested

stand/defs.mk
155 ↗(On Diff #45506)

Per discussion with imp, this will not be committed (yet)

Adding xrefs to related reviews

D16337 for build options etc
D16335 for libve
D16334 for libbearssl
This revision was not accepted when it landed; it landed in state Needs Review.Feb 26 2019, 6:22 AM
Closed by commit rS344568: Enable veriexec for loader (authored by sjg). · Explain Why
This revision was automatically updated to reflect the committed changes.