lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 30 Jan 2018 16:56:32 -0800
From:   "Srivatsa S. Bhat" <srivatsa@...il.mit.edu>
To:     logang@...tatee.com, gregkh@...uxfoundation.org
Cc:     axboe@...nel.dk, jlayton@...chiereds.net, bfields@...ldses.org,
        linux-kernel@...r.kernel.org,
        "Srivatsa S. Bhat" <srivatsa@...il.mit.edu>
Subject: Change in register_blkdev() behavior


Hi,

Before commit 133d55cdb2f "block: order /proc/devices by major number",
if register_blkdev() was called with major = [1..UINT_MAX], it used to
succeed (provided the requested major number was actually free).

However, while fixing the ordering in /proc/devices, commit 133d55cdb2f
also added this change:

@@ -309,6 +309,14 @@ int register_blkdev(unsigned int major, const char *name)
                ret = major;
        }
 
+       if (major >= BLKDEV_MAJOR_MAX) {
+               pr_err("register_blkdev: major requested (%d) is greater than the maximum (%d) for %s\n",
+                      major, BLKDEV_MAJOR_MAX, name);
+
+               ret = -EINVAL;
+               goto out;
+       }
+
        p = kmalloc(sizeof(struct blk_major_name), GFP_KERNEL);
        if (p == NULL) {
                ret = -ENOMEM;

So, after this commit, calls to register_blkdev() fail if the requested
major number is >= 512 (BLKDEV_MAJOR_MAX). I'm wondering if this was an
intentional change or not, as it wasn't explicitly called out in the
changelog (and the comment on top of register_blkdev() describing its
inputs seems quite out-of-date). This also breaks LTP testcase
block_dev/tc05, which tests for edge-cases and expects register_blkdev()
to succeed with major=UINT_MAX.

If the restriction on the major number was intentional, perhaps we
should get the LTP testcase modified for kernel versions >= 4.14.
Otherwise, we should fix register_blkdev to preserve the old behavior.
(I guess the same thing applies to commit 8a932f73e5b "char_dev: order
/proc/devices by major number" as well).

Thoughts?

Regards,
Srivatsa

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ