Page MenuHomeFreeBSD

linuxkpi: Fix assertion in `lkpi_vmf_insert_pfn_prot_locked()`
ClosedPublic

Authored by dumbbell on Jul 12 2026, 4:33 PM.
Referenced Files
Unknown Object (File)
Sun, Sep 13, 1:11 AM
Unknown Object (File)
Sat, Sep 12, 11:12 AM
Unknown Object (File)
Sat, Sep 12, 11:08 AM
Unknown Object (File)
Fri, Sep 11, 4:26 PM
Unknown Object (File)
Thu, Sep 10, 10:47 AM
Unknown Object (File)
Mon, Sep 7, 12:28 PM
Unknown Object (File)
Mon, Sep 7, 2:38 AM
Unknown Object (File)
Sat, Sep 5, 2:00 PM
Subscribers

Details

Summary

Before this change, the assertion would not catch a page index matching the end address, even though the end address of a mapping is outside of that mapping.

While here, add another assertion to catch page indexes outside of the expected range earlier.

Also, pagefaulting an address outside of the mapping range should return VM_FAULT_SIGBUS instead of panicing.

Sponsored by: The FreeBSD Foundation

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

bz added inline comments.
sys/compat/linuxkpi/common/src/linux_page.c
526

Can this even still happen now that the above addr check is added?

dumbbell added inline comments.
sys/compat/linuxkpi/common/src/linux_page.c
526

No, it shouldn’t. I kept it, just in case we mess something up with the beginning of the function. I can remove it if you prefer, I don’t mind.

bz added inline comments.
sys/compat/linuxkpi/common/src/linux_page.c
526

If it stays for documentation, I am fine.

This revision is now accepted and ready to land.Mon, Sep 7, 7:12 PM
This revision was automatically updated to reflect the committed changes.
dumbbell marked an inline comment as done.