blist: fix a possible blist corruption with blist_alloc() due to unsigned
authorsemarie <semarie@openbsd.org>
Sat, 13 Aug 2022 16:02:15 +0000 (16:02 +0000)
committersemarie <semarie@openbsd.org>
Sat, 13 Aug 2022 16:02:15 +0000 (16:02 +0000)
commit31c3ffda2848f054f38e2e590ed853f201b7a5e0
tree601584cec578081da5427aadfdb42c1ba46c08b8
parent969fab7dc2b334c290f596bbb983866ad3d0d961
blist: fix a possible blist corruption with blist_alloc() due to unsigned
swblk_t on OpenBSD.

reorder if condition in blst_meta_alloc(), in order to check if the node is
'Terminator' node first (and leave the loop).

DragonFlyBSD is unaffected by it as swblk_t is signed (and the first condition
isn't taken).

add a regress test for it.

while here, more the KASSERT() to KDASSERT(). it is useful but only with DEBUG.

ok miod@ todd@
regress/sys/uvm/blist/Makefile
regress/sys/uvm/blist/test-6.in [new file with mode: 0644]
regress/sys/uvm/blist/test-6.out [new file with mode: 0644]
sys/kern/subr_blist.c