Page MenuHomeFreeBSD

loader: Relax the check in is_kernphys_relocatable()
ClosedPublic

Authored by markj on Jun 10 2022, 6:39 PM.
Tags
None
Referenced Files
F98875841: D35448.diff
Sat, Oct 5, 3:14 AM
Unknown Object (File)
Wed, Oct 2, 11:10 PM
Unknown Object (File)
Wed, Oct 2, 4:38 PM
Unknown Object (File)
Thu, Sep 26, 7:44 PM
Unknown Object (File)
Thu, Sep 26, 11:04 AM
Unknown Object (File)
Wed, Sep 25, 8:51 PM
Unknown Object (File)
Mon, Sep 23, 1:07 PM
Unknown Object (File)
Sun, Sep 22, 8:28 PM
Subscribers

Details

Summary

The check fails in new kernels compiled with KASAN enabled because
AddressSanitizer inserts redzones around global variables, so the size
of the "kernphys" symbol is 32 rather than 8. Thus we fall back to
copying even though it's not necessary.

Simply remove the size check. I didn't want to extend the symbol size
check since there's no guarantee that AddressSanitizer will always emit
32 bytes for "kernphys".

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Jun 10 2022, 6:39 PM

The idea with the size check was to provide versioning of the loader->kernel handoff interface by changing the symbol size.

This revision is now accepted and ready to land.Jun 11 2022, 9:13 AM
In D35448#804143, @kib wrote:

The idea with the size check was to provide versioning of the loader->kernel handoff interface by changing the symbol size.

I suppose we could instead have something like:

vm_paddr_t kernphysv2;
#define kernphys kernphysv2

if the interface needs to change again in the future?

I indeed think that the interface version change would require some symbol's addition, not necessarily renaming existing symbol (since then current loader would unconditionally fall to copy mode, which is undesirable).