Project

General

Profile

Actions

Bug #13828

closed

beadm: Fix wrong array size

Added by Nan Xiao 7 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
zfs - Zettabyte File System
Start date:
Due date:
% Done:

100%

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

Description

Since ZFS_MAX_DATASET_NAME_LEN has included NUL byte, the definition of name array in count_widths and print_be_snapshots should be:

char name[ZFS_MAX_DATASET_NAME_LEN];

not:

char name[ZFS_MAX_DATASET_NAME_LEN + 1];

Actions #1

Updated by Electric Monk 6 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 1a414bb636b35c18399549b05b65aef849e6f9df

commit  1a414bb636b35c18399549b05b65aef849e6f9df
Author: Nan Xiao <nan@chinadtrace.org>
Date:   2021-06-01T02:20:34.000Z

    13828 beadm: Fix wrong array size
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions #2

Updated by Nan Xiao 6 months ago

Test result of my patch:

I used OmniOS bloody as a testbed, and found the maximum allowed ZFS dataset length is 64 bytes. If input name length is more than 64 bytes, "Invalid argument." error is printed.

(1) Use stock beadm:
$ pfexec beadm create 0123456789012345678901234567890123456789012345678901234567890123
Created successfully

$ beadm list
BE Active Mountpoint Space Policy Created
omnios-r151039-2 NR / 3.75G static 2021-05-25 16:57
0123456789012345678901234567890123456789012345678901234567890123 - - 107K static 2021-06-01 14:03

(2) Use beadm with my patch:
$ pfexec /build/illumos-gate/usr/src/cmd/beadm/beadm create 0123456789012345678901234567890123456789012345678901234567890123
Created successfully

$ beadm list
BE Active Mountpoint Space Policy Created
omnios-r151039-2 NR / 3.75G static 2021-05-25 16:57
0123456789012345678901234567890123456789012345678901234567890123 - - 107K static 2021-06-01 14:05

The BE names outputted by two "beadm"s are same, so it means my patch should work.

Actions

Also available in: Atom PDF