Project

General

Profile

Bug #11502

installboot: find_multiboot() does crash with small files

Added by Toomas Soome 12 months ago. Updated 12 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

$ pstack core
core 'core' of 19352:   installboot -i /boot/pmbr
 0805642f find_multiboot (84ccdb8, 10000, 8039554, 8052db5, 84cb860, 0) + 5d
 0805329d read_bootblock_from_file (84cb860, 84ccd78, 4b, 8039aac) + 1b8
 0805334e print_einfo_cb (84ccd68, 84cb860, 0, 0, 0, 0) + 16
 08054645 handle_getinfo (8039ca8, 8039aac, 8057f07, fefe0018) + 5b
 08055a61 main     (8039a3c, fefc62e8, 8039a78, 8052657, 3, 8039aa4) + 2d8
 08052657 _start_crt (3, 8039aa4, f4104cc4, 0, 0, 0) + 96
 0805252a _start   (3, 8039ca8, 8039cb4, 8039cb7, 0, 8039cc2) + 1a
tsoome@beastie:/code/illumos-gate/usr/src/cmd/boot/installboot/i386$

The cause for the crash is, in case of small files, we need to limit the multiboot header search on file size, not buffer size.

With fix:

$ ./installboot -i /boot/pmbr 
Unable to find multiboot header
Error reading bootblock from /boot/pmbr
$

History

#1

Updated by Toomas Soome 12 months ago

  • Description updated (diff)
#2

Updated by Electric Monk 12 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit 741b4d05bd52eb10a07f4f147bd8a211e5fe4351

commit  741b4d05bd52eb10a07f4f147bd8a211e5fe4351
Author: Toomas Soome <tsoome@me.com>
Date:   2019-07-31T05:02:33.000Z

    11502 installboot: find_multiboot() does crash with small files
    Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
    Reviewed by: Robert Mustacchi <robert.mustacchi@joyent.com>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF