Project

General

Profile

Actions

Bug #8507

closed

dladm show-link segfaults if you specify too many fields

Added by Robert Mustacchi about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Category:
lib - userland libraries
Start date:
2017-07-18
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

If you specify the same field more than once it causes a segfault:

# dladm show-link -o link,class,mtu,state,bridge,over,link
dladm: warning: Not enough space
Segmentation Fault (core dumped)

# dladm show-link -o class,mtu,state,bridge,over,link
CLASS     MTU    STATE    BRIDGE     OVER                          LINK
phys      1500   up       --         --                            e1000g0
phys      1500   down     --         --                            ixgbe0

# dladm show-link -o link,class,mtu,state,bridge,over,over
dladm: warning: Not enough space
Segmentation Fault (core dumped)

The failure mode here is slightly tighter in that dladm (and friends) die if you specify more fields than there are fields – which tautologically means that you have specified at least one field at least twice. e.g.:

# dladm show-link -o class,class,class,class,class
CLASS     CLASS     CLASS     CLASS     CLASS
vnic      vnic      vnic      vnic      vnic
vnic      vnic      vnic      vnic      vnic
# dladm show-link -o class,class,class,class,class,class,class
dladm: warning: Not enough space
Segmentation Fault (core dumped)

There are actually two problems here: one is that it is failing (with an out-of-memory error) the other is that the resulting out-of-memory error isn't properly handled (inducing the seg fault).


Related issues

Related to illumos gate - Bug #8640: libofmt needs to include required headersClosedRobert Mustacchi2017-09-08

Actions
Related to illumos gate - Bug #8639: libofmt doesn't properly build its lint libraryClosedRobert Mustacchi2017-09-08

Actions
Actions #1

Updated by Robert Mustacchi about 6 years ago

  • Related to Bug #8640: libofmt needs to include required headers added
Actions #2

Updated by Robert Mustacchi about 6 years ago

  • Related to Bug #8639: libofmt doesn't properly build its lint library added
Actions #3

Updated by Electric Monk about 6 years ago

  • Status changed from New to Closed

git commit b2f2652061ea587b1b2b4e246659e1d7e7313f42

commit  b2f2652061ea587b1b2b4e246659e1d7e7313f42
Author: Bryan Cantrill <bryan@joyent.com>
Date:   2017-09-25T18:48:01.000Z

    8507 dladm show-link segfaults if you specify too many fields
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Ryan Zezeski <ryan.zeseski@joyent.com>
    Reviewed by: Yuri Pankov <yuripv@gmx.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

Actions

Also available in: Atom PDF