While malloc sleeps, the disk list could change during sysctl. Then
authorbluhm <bluhm@openbsd.org>
Wed, 22 Dec 2021 22:20:13 +0000 (22:20 +0000)
committerbluhm <bluhm@openbsd.org>
Wed, 22 Dec 2021 22:20:13 +0000 (22:20 +0000)
commit278923c07fda6048b6fcd284d05cda35cc047737
tree02746311e7fc43579cb80e04603c86994ce20607
parent1b8f8c22454c7e1dde8ed9f3c194f99348d8d8c5
While malloc sleeps, the disk list could change during sysctl.  Then
allocated memory could be too short for the list of disks.  Retry
allocating enough space until it did not change.
The disk list and duid memory are protected by kernel lock.  Use
asserts to mark this explicitly.
Reported-by: syzbot+807423f6868bbfb836bc@syzkaller.appspotmail.com
OK anton@ mpi@
sys/kern/kern_sysctl.c
sys/kern/subr_disk.c