]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
veloader use vectx API for kernel and modules
authorsjg <sjg@FreeBSD.org>
Sun, 8 Mar 2020 18:48:01 +0000 (18:48 +0000)
committersjg <sjg@FreeBSD.org>
Sun, 8 Mar 2020 18:48:01 +0000 (18:48 +0000)
commita1a62ee99a75607b0b931d00a426851be26c79a8
tree3b2543114efad107c814fe42e0295316b0a8cdd4
parent7993a62d04cc0b8b93383da4e3226e4385d55d95
veloader use vectx API for kernel and modules

The vectx API, computes the hash for verifying a file as it is read.
This avoids the overhead of reading files twice - once to verify, then
again to load.

For doing an install via loader, avoiding the need to rewind
large files is critical.

This API is only used for modules, kernel and mdimage as these are the
biggest files read by the loader.
The reduction in boot time depends on how expensive the I/O is
on any given platform.  On a fast VM we see 6% improvement.

For install via loader the first file to be verified is likely to be the
kernel, so some of the prep work (finding manifest etc) done by
verify_file() needs to be factored so it can be reused for
vectx_open().

For missing or unrecognized fingerprint entries, we fail
in vectx_open() unless verifying is disabled.

Otherwise fingerprint check happens in vectx_close() and
since this API is only used for files which must be verified
(VE_MUST) we panic if we get an incorrect hash.

Reviewed by: imp,tsoome
MFC after: 1 week
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org//D23827
stand/common/readin.h [new file with mode: 0644]