Page MenuHomeFreeBSD

uma: Add KASAN state transitions
ClosedPublic

Authored by markj on Mar 27 2021, 11:29 PM.
Tags
None
Referenced Files
F109497789: D29456.diff
Wed, Feb 5, 8:33 PM
Unknown Object (File)
Sat, Feb 1, 8:18 PM
Unknown Object (File)
Fri, Jan 17, 12:01 PM
Unknown Object (File)
Dec 16 2024, 2:33 AM
Unknown Object (File)
Dec 9 2024, 1:22 AM
Unknown Object (File)
Oct 29 2024, 6:00 AM
Unknown Object (File)
Oct 17 2024, 1:40 PM
Unknown Object (File)
Oct 17 2024, 1:40 PM
Subscribers

Details

Summary


- Add a UMA_ZONE_NOKASAN flag to indicate that items from a particular
zone should not be sanitized. This is applied implicitly for NOFREE
and cache zones.
- Add KASAN call backs which get invoked:
1) when a slab is imported into a keg
2) when an item is allocated from a zone
3) when an item is freed to a zone
4) when a slab is freed back to the VM

In state transitions 1 and 3, memory is poisoned so that accesses will
trigger a panic. In state transitions 2 and 4, memory is marked
valid.
- Disable trashing if KASAN is enabled. It just adds extra CPU overhead
to catch problems that are detected by KASAN.

Diff Detail

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

Event Timeline

sys/vm/uma.h
279

Aside, in cases like this I'd like style(9) to put the first line of the comment beside the /*.

sys/vm/uma_core.c
536

Sort of bikeshed territory, but I wonder if

#ifdef KASAN
... implementation
#else
... stubs
#endif

isn't more straightforward

1688–1690

these and a couple of other changes can be committed independently first?

sys/vm/uma_core.c
1688–1690

I should just drop this part, it's left over from an earlier version of the patch.

markj marked 2 inline comments as done.
  • Drop spurious hunk.
  • Provide separate stubs for the !KASAN case.
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.