Page MenuHomeFreeBSD

Another round of subr_blist.c fixes
ClosedPublic

Authored by alc on Jun 25 2017, 6:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 10 2024, 6:02 PM
Unknown Object (File)
Feb 2 2024, 6:39 AM
Unknown Object (File)
Dec 22 2023, 10:30 PM
Unknown Object (File)
Nov 15 2023, 10:44 AM
Unknown Object (File)
Nov 7 2023, 2:54 PM
Unknown Object (File)
Nov 7 2023, 10:56 AM
Unknown Object (File)
Nov 7 2023, 2:33 AM
Unknown Object (File)
Oct 25 2023, 2:21 PM
Subscribers
None

Details

Summary

Address the remaining integer overflow issues with the "skip" parameters and "next_skip" variables. The "skip" value in struct blist has long been a 64-bit quantity but various functions have implicitly truncated this value to 32 bits. Now, all arithmetic involving the "skip" value is 64 bits wide. (This should allow us to relax the size limit on a swap device in the swap pager.)

Maintain the ability to test this allocator as a user-space application by including <stdbool.h>.

Remove an unused variable from blst_radix_print().

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kern/subr_blist.c
629 โ†—(On Diff #30064)

Is child size enough for this ? If yes, might be it makes sense to use daddr_t still but assert that it is under one node.

kern/subr_blist.c
629 โ†—(On Diff #30064)

Yes, it is. Throughout this code the variable name "radix" is a misnomer. The variables named "radix" actually represent the maximum number of possible leaves in the subtree, and not what you and I expect "radix" to mean. So, when we divide "(freeBlk - blk)" by "radix" we are operating on numbers that differ by at most a factor of BLIST_META_RADIX, or 16.

I think that I can #define MPASS() to be assert() for user-space compilation and sprinkle MPASS(child >= 0 && child < BLIST_META_RADIX) throughout the code.

This revision is now accepted and ready to land.Jun 25 2017, 9:38 PM
This revision was automatically updated to reflect the committed changes.