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] [day] [month] [year] [list]
Message-Id: <20241030154009.16b693b53b3c00d2439fd854@linux-foundation.org>
Date: Wed, 30 Oct 2024 15:40:09 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Marc Dionne <marc.c.dionne@...il.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, Vlastimil Babka
 <vbabka@...e.cz>, Marc Dionne <marc.dionne@...istor.com>
Subject: Re: [PATCH v3] tools/mm: Fix slabinfo crash when MAX_SLABS is
 exceeded

On Wed, 30 Oct 2024 10:32:08 -0300 Marc Dionne <marc.c.dionne@...il.com> wrote:

> From: Marc Dionne <marc.dionne@...istor.com>
> 
> The number of slabs can easily exceed the hard coded MAX_SLABS in the
> slabinfo tool, causing it to overwrite memory and crash.
> 
> Increase the value of MAX_SLABS, and check if that has been exceeded for
> each new slab, instead of at the end when it's already too late.  Also
> move the check for MAX_ALIASES into the loop body.
> 
> @@ -1240,6 +1240,8 @@ static void read_slab_dir(void)
>  				p--;
>  			alias->ref = strdup(p);
>  			alias++;
> +			if (alias - aliasinfo == MAX_ALIASES)
> +				fatal("Too many aliases\n");

Again, this is not correct.  It has a potential off-by-one error.

If at this point, (alias - aliasinfo == MAX_ALIASES), we *do not know*
whether there are "Too many aliases".  Because the parsing might have
reached the end of input, in which case we're fine.

A fix for this is to check for an invalid `alias' immediately before we
use it, as I described in the previous email.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ