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: <20190131064139.GB28876@rapoport-lnx>
Date:   Thu, 31 Jan 2019 08:41:39 +0200
From:   Mike Rapoport <rppt@...ux.ibm.com>
To:     Christophe Leroy <christophe.leroy@....fr>
Cc:     linux-mm@...ck.org, Rich Felker <dalias@...c.org>,
        linux-ia64@...r.kernel.org, devicetree@...r.kernel.org,
        Catalin Marinas <catalin.marinas@....com>,
        Heiko Carstens <heiko.carstens@...ibm.com>, x86@...nel.org,
        linux-mips@...r.kernel.org, Max Filippov <jcmvbkbc@...il.com>,
        Guo Ren <guoren@...nel.org>, sparclinux@...r.kernel.org,
        Christoph Hellwig <hch@....de>, linux-s390@...r.kernel.org,
        linux-c6x-dev@...ux-c6x.org,
        Yoshinori Sato <ysato@...rs.sourceforge.jp>,
        Richard Weinberger <richard@....at>, linux-sh@...r.kernel.org,
        Russell King <linux@...linux.org.uk>,
        kasan-dev@...glegroups.com,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Mark Salter <msalter@...hat.com>,
        Dennis Zhou <dennis@...nel.org>,
        Matt Turner <mattst88@...il.com>,
        linux-snps-arc@...ts.infradead.org,
        uclinux-h8-devel@...ts.sourceforge.jp,
        Petr Mladek <pmladek@...e.com>, linux-xtensa@...ux-xtensa.org,
        linux-alpha@...r.kernel.org, linux-um@...ts.infradead.org,
        linux-m68k@...ts.linux-m68k.org, Rob Herring <robh+dt@...nel.org>,
        Greentime Hu <green.hu@...il.com>,
        xen-devel@...ts.xenproject.org, Stafford Horne <shorne@...il.com>,
        Guan Xuetao <gxt@....edu.cn>,
        linux-arm-kernel@...ts.infradead.org,
        Michal Simek <monstr@...str.eu>,
        Tony Luck <tony.luck@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        Paul Burton <paul.burton@...s.com>,
        Vineet Gupta <vgupta@...opsys.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linuxppc-dev@...ts.ozlabs.org,
        "David S. Miller" <davem@...emloft.net>,
        openrisc@...ts.librecores.org,
        Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH v2 19/21] treewide: add checks for the return value of
 memblock_alloc*()

On Thu, Jan 31, 2019 at 07:07:46AM +0100, Christophe Leroy wrote:
> 
> 
> Le 21/01/2019 à 09:04, Mike Rapoport a écrit :
> >Add check for the return value of memblock_alloc*() functions and call
> >panic() in case of error.
> >The panic message repeats the one used by panicing memblock allocators with
> >adjustment of parameters to include only relevant ones.
> >
> >The replacement was mostly automated with semantic patches like the one
> >below with manual massaging of format strings.
> >
> >@@
> >expression ptr, size, align;
> >@@
> >ptr = memblock_alloc(size, align);
> >+ if (!ptr)
> >+ 	panic("%s: Failed to allocate %lu bytes align=0x%lx\n", __func__,
> >size, align);
> >
> >Signed-off-by: Mike Rapoport <rppt@...ux.ibm.com>
> >Reviewed-by: Guo Ren <ren_guo@...ky.com>             # c-sky
> >Acked-by: Paul Burton <paul.burton@...s.com>	     # MIPS
> >Acked-by: Heiko Carstens <heiko.carstens@...ibm.com> # s390
> >Reviewed-by: Juergen Gross <jgross@...e.com>         # Xen
> >---
> 
> [...]
> 
> >diff --git a/mm/sparse.c b/mm/sparse.c
> >index 7ea5dc6..ad94242 100644
> >--- a/mm/sparse.c
> >+++ b/mm/sparse.c
> 
> [...]
> 
> >@@ -425,6 +436,10 @@ static void __init sparse_buffer_init(unsigned long size, int nid)
> >  		memblock_alloc_try_nid_raw(size, PAGE_SIZE,
> >  						__pa(MAX_DMA_ADDRESS),
> >  						MEMBLOCK_ALLOC_ACCESSIBLE, nid);
> >+	if (!sparsemap_buf)
> >+		panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%lx\n",
> >+		      __func__, size, PAGE_SIZE, nid, __pa(MAX_DMA_ADDRESS));
> >+
> 
> memblock_alloc_try_nid_raw() does not panic (help explicitly says: Does not
> zero allocated memory, does not panic if request cannot be satisfied.).

"Does not panic" does not mean it always succeeds.
 
> Stephen Rothwell reports a boot failure due to this change.

Please see my reply on that thread.

> Christophe
> 
> >  	sparsemap_buf_end = sparsemap_buf + size;
> >  }
> >
> 

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ