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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 29 Mar 2022 13:20:11 +0200
From:   Christian Brauner <brauner@...nel.org>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Arve Hjønnevåg <arve@...roid.com>,
        Todd Kjos <tkjos@...roid.com>,
        Martijn Coenen <maco@...roid.com>,
        Joel Fernandes <joel@...lfernandes.org>,
        Hridya Valsaraju <hridya@...gle.com>,
        Suren Baghdasaryan <surenb@...gle.com>,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        Todd Kjos <tkjos@...gle.com>
Subject: Re: [PATCH] binderfs: Fix the maximum minor value in
 binderfs_binder_device_create() and binderfs_binder_ctl_create()

On Sun, Mar 27, 2022 at 01:18:17PM +0200, Christophe JAILLET wrote:
> ida_alloc_max(..., max, ...) returns values from 0 to max, inclusive.
> 
> So, BINDERFS_MAX_MINOR is a valid value for 'minor'.
> 
> BINDERFS_MAX_MINOR is '1U << MINORBITS' and we have:
> 	#define MKDEV(ma,mi)	(((ma) << MINORBITS) | (mi))
> 
> So, When this value is used in MKDEV() and it will overflow.
> 
> Fixes: 3ad20fe393b3 ("binder: implement binderfs")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> This patch is completely speculative.
> 
> The 'BINDERFS_MAX_MINOR_CAPPED - 1' is here only for symmetry with the
> BINDERFS_MAX_MINOR case. I'm not sure at all that is is needed and, more
> importantly, that it is correct.

Hm, since we're "removing" one alloctable device for the initial ipc
namespace, I think we need the -1 for the capped value.

Though I wonder if the simpler fix wouldn't just be to:

#define BINDERFS_MAX_MINOR MINORMASK

since include/linux/kdev_t.h has:

#define MINORBITS	20
#define MINORMASK	((1U << MINORBITS) - 1)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ