Page MenuHomeFreeBSD

bsdinstall(8): partedit can hang/crash on read/lseek/malloc failures
Needs ReviewPublic

Authored by will_worrbase.com on Mar 3 2018, 8:36 AM.
Tags
None
Referenced Files
F81622990: D14573.id.diff
Fri, Apr 19, 3:34 AM
Unknown Object (File)
Thu, Apr 18, 3:18 AM
Unknown Object (File)
Wed, Apr 17, 2:52 AM
Unknown Object (File)
Wed, Apr 10, 5:30 PM
Unknown Object (File)
Mar 4 2024, 10:06 AM
Unknown Object (File)
Jan 29 2024, 2:41 PM
Unknown Object (File)
Dec 23 2023, 10:40 AM
Unknown Object (File)
Dec 14 2023, 7:13 PM
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

bsdinstall(8): partedit can hang/crash on read/lseek/malloc failures

This fixes a few problems:

  • if lseek(2) fails, bootsize underflows to SIZE_T_MAX, making the resulting allocation dangerous
  • if malloc(3) fails, we end up with a null pointer deref later
  • if read(2) fails, the installer will hang trying to read(2) boot loader code
Test Plan

Tested via entering the partition editor in bsdinstall

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 15351
Build 15406: arc lint + arc unit

Event Timeline

will_worrbase.com retitled this revision from Replace malloc + read in a loop with mmap to bsdinstall(8): partedit can hang/crash on read/lseek/malloc failures.Mar 3 2018, 8:37 AM
will_worrbase.com edited the summary of this revision. (Show Details)