Page MenuHomeFreeBSD

kmem: Add KASAN state transitions
ClosedPublic

Authored by markj on Mar 27 2021, 11:29 PM.
Tags
None
Referenced Files
F167097508: D29458.id87407.diff
Wed, Aug 19, 1:52 AM
F167061825: D29458.id87407.diff
Tue, Aug 18, 8:22 PM
F167051890: D29458.id86415.diff
Tue, Aug 18, 8:01 PM
Unknown Object (File)
Sun, Aug 16, 9:54 PM
Unknown Object (File)
Sat, Aug 15, 7:45 PM
Unknown Object (File)
Fri, Aug 14, 9:58 PM
Unknown Object (File)
Sat, Aug 8, 2:30 PM
Unknown Object (File)
Sat, Aug 8, 2:19 PM
Subscribers

Details

Summary

Memory allocated with kmem_* is unmapped upon free, so KASAN doesn't
provide a ton of benefit, but since allocations are always a multiple of
the page size we can create a redzone.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 38129
Build 35018: arc lint + arc unit

Event Timeline

andrew added inline comments.
sys/vm/vm_kern.c
422

Does this mean we don't get buffer overflow checks when size is a multiple of PAGE_SIZE?

sys/vm/vm_kern.c
422

That's correct. I thought about padding it by one page but was a bit wary about doing so for contig allocs, since that could conceivably result in an impossible allocation request. For instance, suppose that high - low == size, we wouldn't be able to add padding. And we have to either pad all allocations or none.

One thing we could do is add a guard page instead, so that overflows result in a page fault. That's not KASAN-specific, of course, but it'd make sense to enable that when KASAN is enabled. Any thoughts?

This revision was not accepted when it landed; it landed in state Needs Review.Apr 13 2021, 9:42 PM
This revision was automatically updated to reflect the committed changes.