Page MenuHomeFreeBSD

swap_pager: Handle large swap_pager_reserve() requests
ClosedPublic

Authored by markj on Sep 7 2021, 3:46 PM.
Tags
None
Referenced Files
F86062817: D31875.id94844.diff
Fri, Jun 14, 8:35 PM
Unknown Object (File)
Sun, Jun 2, 7:11 PM
Unknown Object (File)
Tue, May 21, 8:52 PM
Unknown Object (File)
Tue, May 21, 8:52 PM
Unknown Object (File)
Tue, May 21, 7:09 PM
Unknown Object (File)
May 5 2024, 12:24 PM
Unknown Object (File)
May 4 2024, 7:04 PM
Unknown Object (File)
Apr 30 2024, 11:05 AM
Subscribers

Details

Summary

This interface is used solely by md(4) when the MD_RESERVE flag is
specified, as in mdconfig -a -t swap -s 1G -o reserve. It
pre-allocates swap blocks for the entire object.

The number of blocks to be reserved is specified as a vm_size_t, but
swp_pager_getswapspace() can allocate at most INT_MAX blocks. vm_size_t
also seems like the incorrect type to use here it refers only to the
size of the VM object, not the size of a mapping. So:

  • change the type of "size" in swap_pager_reserve() to vm_pindex_t, and
  • clamp the requested number of blocks for a single swp_pager_getswapspace() call to INT_MAX.

Reported by: syzkaller

Diff Detail

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