Page MenuHomeFreeBSD

amd64: add LASS support
ClosedPublic

Authored by kib on Feb 10 2026, 1:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 18, 1:20 PM
Unknown Object (File)
Sun, Mar 15, 8:23 PM
Unknown Object (File)
Sat, Mar 14, 11:41 PM
Unknown Object (File)
Sat, Mar 14, 12:16 PM
Unknown Object (File)
Mon, Mar 2, 9:39 PM
Unknown Object (File)
Sun, Mar 1, 4:15 AM
Unknown Object (File)
Sun, Mar 1, 4:15 AM
Unknown Object (File)
Sun, Mar 1, 4:14 AM
Subscribers

Details

Summary
In short, LASS enforces all kernel memory accesses to have bit 63 set to
1, and all userspace accesses have bit 63 set to 0.  Violations of these
rules cause #GP. There are natural exceptions, like SMAP with rflags.AC=1
allows kernel to access userspace.

Enablement is simple, we need to set CR4.LASS bit on all CPUs.  There
are complications when kernel has to execute code at low addresses, e.g.
for la57 trampoline, or calling into EFI RT.  The patch turns CR4.LASS
off around these regions.

LASS is officially documented in SDM, since at least rev. 085, October
2024.  Tested in simics.

Diff Detail

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

Event Timeline

kib requested review of this revision.Feb 10 2026, 1:57 PM
kib added a subscriber: emaste.
sys/amd64/amd64/machdep.c
1358

Why here and not in initializecpu(), where similar features like SMAP are enabled?

sys/x86/x86/mp_x86.c
1137 ↗(On Diff #171645)

Same here, why isn't this handled in initializecpu()?

kib marked 2 inline comments as done.

Move setting CR4.LASS into initializecpu()

Add comment why SMAP is required.

sys/x86/x86/mp_x86.c
1135 ↗(On Diff #171747)

This part of the change can be dropped I think.

kib marked an inline comment as done.

Drop unneeded chunk.

We'll want to add a note to mitigations(7) as well; I can take a look at that.

sys/amd64/amd64/initcpu.c
294

Let's expand LASS once on first use - Linear Address Space Separation (LASS). Where we fetch the tunable seems as good a place as any.

This revision is now accepted and ready to land.Feb 11 2026, 3:10 PM
kib marked an inline comment as done.Feb 11 2026, 3:15 PM

We'll want to add a note to mitigations(7) as well; I can take a look at that.

Note that this is not quite a mitigation. It is more a switch that makes CPU accept the typical, of not only, UVA/KVA layout used on amd64.

But indeed, LASS short-circuits even a possibility for things like meltdown.

Expand LASS in the comment.

This revision now requires review to proceed.Feb 11 2026, 3:15 PM
This revision is now accepted and ready to land.Feb 11 2026, 3:25 PM
This revision was automatically updated to reflect the committed changes.