diff options
| author | Roman Bogorodskiy <novel@FreeBSD.org> | 2026-08-28 16:43:26 +0000 |
|---|---|---|
| committer | Roman Bogorodskiy <novel@FreeBSD.org> | 2026-10-06 16:51:40 +0000 |
| commit | 4445d039583a0a47fc335e0d34401581bcbc104e (patch) | |
| tree | 676380fea938bea155ef25faada015435817e886 /packages/Python/lldbsuite/test/python_api/sbdata/main.cpp | |
| parent | 0bccbb9e98930f55bff5a943c881e460d4f31aec (diff) | |
stand: userboot: improve userdisk error handling
Currently, userdisk_init() iterates through disks and
checks whether DIOCGSECTORSIZE and DIOCGMEDIASIZE ioctls
are available for the device. If either ioctl fails, userdisk_init()
returns ENXIO with ud_info only partially initialized.
devinit() records the failure, but loader_main() ignores
devinit()'s return value, so later code may access an
uninitialized entry.
In certain cases this code can still boot from a disk even if
userdisk_init() returns ENXIO, for example, when the first of
two disks is valid and the second errors out.
To address this issue while not breaking the current behavior, do
the following:
- Zero-initialize the userdisk_info array and use a zero media size
to mark disks that do not support the ioctls mentioned above or
report an empty medium.
- Update userdisk_print() not to print unusable disks.
- Update userdisk_open() to return EIO for unusable disks.
- Update extract_currdev() to pick the first usable disk
instead of the first disk. Introduce userboot_disk_firstunit()
for that.
Additionally, reset counters on ud_info allocation failure to prevent
accessing unallocated data.
Reviewed by: jhb (previous version), markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59262
Diffstat (limited to 'packages/Python/lldbsuite/test/python_api/sbdata/main.cpp')
0 files changed, 0 insertions, 0 deletions
