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]
Message-Id: <20180713130243.13d02e94bedc8cc3caf275ca@linux-foundation.org>
Date:   Fri, 13 Jul 2018 13:02:43 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Pavel Tatashin <pasha.tatashin@...cle.com>
Cc:     Oscar Salvador <osalvador@...hadventures.net>,
        steven.sistare@...cle.com, daniel.m.jordan@...cle.com,
        linux-kernel@...r.kernel.org, kirill.shutemov@...ux.intel.com,
        mhocko@...e.com, linux-mm@...ck.org, dan.j.williams@...el.com,
        jack@...e.cz, jglisse@...hat.com, jrdr.linux@...il.com,
        bhe@...hat.com, gregkh@...uxfoundation.org, vbabka@...e.cz,
        richard.weiyang@...il.com, dave.hansen@...el.com,
        rientjes@...gle.com, mingo@...nel.org, abdhalee@...ux.vnet.ibm.com,
        mpe@...erman.id.au
Subject: Re: [PATCH v5 1/5] mm/sparse: abstract sparse buffer allocations

On Fri, 13 Jul 2018 09:24:44 -0400 Pavel Tatashin <pasha.tatashin@...cle.com> wrote:

> On 07/13/2018 09:17 AM, Oscar Salvador wrote:
> > On Thu, Jul 12, 2018 at 04:37:26PM -0400, Pavel Tatashin wrote:
> >> +static void *sparsemap_buf __meminitdata;
> >> +static void *sparsemap_buf_end __meminitdata;
> >> +
> >> +void __init sparse_buffer_init(unsigned long size, int nid)
> >> +{
> >> +	BUG_ON(sparsemap_buf);
> > 
> > Why do we need a BUG_ON() here?
> > Looking at the code I cannot really see how we can end up with sparsemap_buf being NULL.
> > Is it just for over-protection?
> 
> This checks that we do not accidentally leak memory by calling sparse_buffer_init() consequently without sparse_buffer_fini() in-between.

A memory leak isn't serious enough to justify crashing the kernel. 
Therefore

--- a/mm/sparse.c~mm-sparse-abstract-sparse-buffer-allocations-fix-fix
+++ a/mm/sparse.c
@@ -469,7 +469,7 @@ static void *sparsemap_buf_end __meminit
 
 void __init sparse_buffer_init(unsigned long size, int nid)
 {
-	BUG_ON(sparsemap_buf);
+	WARN_ON(sparsemap_buf);	/* forgot to call sparse_buffer_fini()? */
 	sparsemap_buf =
 		memblock_virt_alloc_try_nid_raw(size, PAGE_SIZE,
 						__pa(MAX_DMA_ADDRESS),
_

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ