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
Unknown Object (File)
Jan 28 2024, 7:11 AM
Unknown Object (File)
Dec 22 2023, 10:42 PM
Unknown Object (File)
Dec 14 2023, 8:40 PM
Unknown Object (File)
Dec 13 2023, 4:17 PM
Unknown Object (File)
Nov 28 2023, 1:49 AM
Unknown Object (File)
Oct 20 2023, 1:18 AM
Unknown Object (File)
Oct 19 2023, 11:26 PM
Unknown Object (File)
Sep 13 2023, 6:12 PM
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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable