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)
Sep 20 2024, 10:53 AM
Unknown Object (File)
Sep 18 2024, 12:06 AM
Unknown Object (File)
Sep 8 2024, 7:46 PM
Unknown Object (File)
Sep 8 2024, 5:32 PM
Unknown Object (File)
Sep 8 2024, 12:53 AM
Unknown Object (File)
Aug 12 2024, 3:32 AM
Unknown Object (File)
Aug 11 2024, 7:11 PM
Unknown Object (File)
Jul 29 2024, 6:32 AM
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.