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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YWr7UN1+RkayVWy2@casper.infradead.org>
Date:   Sat, 16 Oct 2021 17:18:24 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     Len Baker <len.baker@....com>
Cc:     Luis Chamberlain <mcgrof@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Iurii Zaikin <yzaikin@...gle.com>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        linux-hardening@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sysctl: Avoid open coded arithmetic in memory allocator
 functions

On Sat, Oct 16, 2021 at 05:28:28PM +0200, Len Baker wrote:
> +static size_t new_dir_size(size_t namelen)
> +{
> +	size_t bytes;
> +
> +	if (check_add_overflow(sizeof(struct ctl_dir), sizeof(struct ctl_node),
> +			       &bytes))
> +		return SIZE_MAX;
> +	if (check_add_overflow(bytes, array_size(sizeof(struct ctl_table), 2),
> +			       &bytes))
> +		return SIZE_MAX;
> +	if (check_add_overflow(bytes, namelen, &bytes))
> +		return SIZE_MAX;
> +	if (check_add_overflow(bytes, (size_t)1, &bytes))
> +		return SIZE_MAX;
> +
> +	return bytes;
> +}

I think this is overkill.  All these structs are small and namelen is
supplied by the kernel, not specified by userspace.  It really complicates
the code, and I don't see the advantage.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ