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
Unknown Object (File)
Jan 11 2024, 7:37 PM
Unknown Object (File)
Dec 20 2023, 2:50 AM
Unknown Object (File)
Dec 19 2023, 5:03 AM
Unknown Object (File)
Dec 12 2023, 5:39 PM
Unknown Object (File)
Aug 29 2023, 10:29 AM
Unknown Object (File)
Aug 27 2023, 9:53 AM
Unknown Object (File)
Jul 7 2023, 4:52 PM
Unknown Object (File)
May 19 2023, 5:20 AM
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).