Bug 675999 - blkid crashes on a server with more than 128 storage devices
blkid crashes on a server with more than 128 storage devices
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: util-linux-ng (Show other bugs)
Unspecified Linux
medium Severity medium
: rc
: ---
Assigned To: Karel Zak
: Patch
Depends On: 675694
  Show dependency treegraph
Reported: 2011-02-08 10:10 EST by Eric Sandeen
Modified: 2011-12-06 12:10 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 675694
Last Closed: 2011-12-06 12:10:35 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Eric Sandeen 2011-02-08 10:10:10 EST
+++ This bug was initially created as a clone of Bug #675694 +++

Description of problem:
blkid crashes on a server with more than 128 storage devices

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.blkid -c /dev/<list of storage device, more than 128>
Actual results:

Expected results:
should'nt crash

Additional info:
$ vim e2fsprogs-1.39/misc/blkid.c
 92 int main(int argc, char **argv)
 93 {
 94         blkid_cache cache = NULL;
 95         char *devices[128] = { NULL, };
 96         char *show[128] = { NULL, };
<--- bad mojo, 128 device artificial limit.
 97         char *search_type = NULL, *search_value = NULL;
 98         char *read = NULL;

update the limit to a higher value ( say 8192) as shown below

 95         char *devices[8192] = { NULL, };
 96         char *show[8192] = { NULL, };

--- Additional comment from esandeen@redhat.com on 2011-02-07 18:01:34 EST ---

Yep, that's no good.

We'll need something more flexible than just increasing the artificial limit, though.

--- Additional comment from esandeen@redhat.com on 2011-02-08 10:09:04 EST ---

I've sent a patch upstream (to util-linux-ng) for this, and kzak committed it.  Once it shows up in git I'll pull it back & put it into rhel5.

Also, will dup this to rhel6.

The "show" array is OK, because:

                case 's':
                        if (numtag + 1 >= sizeof(show) / sizeof(*show)) {
                                fprintf(stderr, "Too many tags specified\n");
                        show[numtag++] = optarg;
                        show[numtag] = NULL;

if the index grows past the size of the array, it will error out.
Comment 2 Eric Sandeen 2011-02-08 10:26:09 EST
From: Eric Sandeen <sandeen@redhat.com>
Date: Tue, 8 Feb 2011 05:44:26 +0000 (-0600)
Subject: blkid: dynamically allocate devicename array
X-Git-Url: http://git.kernel.org/?p=utils%2Futil-linux%2Futil-linux.git;a=commitdiff_plain;h=ea51c09c11f7110eca54fa35ab5ac51a7635c8c2

blkid: dynamically allocate devicename array

If more than 128 devices are specified on the blkid cmdline,
the devices[] array will overflow.

We can dynamically allocate the devices[] array based on number
of arguments to avoid this problem.

[kzak@redhat.com: - add "if (optind < argc)" check]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Comment 8 errata-xmlrpc 2011-12-06 12:10:35 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.