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
F102664096: D35448.id106824.diff
Fri, Nov 15, 1:23 PM
Unknown Object (File)
Sat, Nov 9, 12:27 AM
Unknown Object (File)
Sat, Nov 9, 12:26 AM
Unknown Object (File)
Thu, Oct 17, 10:49 PM
Unknown Object (File)
Oct 5 2024, 5:26 AM
Unknown Object (File)
Oct 5 2024, 5:25 AM
Unknown Object (File)
Oct 5 2024, 3:14 AM
Unknown Object (File)
Oct 2 2024, 11:10 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).