Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: gregkh@linuxfoundation.org
Cc: mark.rutland@arm.com, catalin.marinas@arm.com,
	kyrylo.tkachov@arm.com, stable@vger.kernel.org, will@kernel.org
Subject: Re: FAILED: patch "[PATCH] arm64: hugetlb: avoid potential NULL dereference" failed to apply to 4.4-stable tree
Date: Tue, 12 May 2020 11:04:44 -0400	[thread overview]
Message-ID: <20200512150444.GR13035@sasha-vm> (raw)
In-Reply-To: <158928280312186@kroah.com>

On Tue, May 12, 2020 at 01:26:43PM +0200, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 4.4-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From 027d0c7101f50cf03aeea9eebf484afd4920c8d3 Mon Sep 17 00:00:00 2001
>From: Mark Rutland <mark.rutland@arm.com>
>Date: Tue, 5 May 2020 13:59:30 +0100
>Subject: [PATCH] arm64: hugetlb: avoid potential NULL dereference
>MIME-Version: 1.0
>Content-Type: text/plain; charset=UTF-8
>Content-Transfer-Encoding: 8bit
>
>The static analyzer in GCC 10 spotted that in huge_pte_alloc() we may
>pass a NULL pmdp into pte_alloc_map() when pmd_alloc() returns NULL:
>
>|   CC      arch/arm64/mm/pageattr.o
>|   CC      arch/arm64/mm/hugetlbpage.o
>|                  from arch/arm64/mm/hugetlbpage.c:10:
>| arch/arm64/mm/hugetlbpage.c: In function ‘huge_pte_alloc’:
>| ./arch/arm64/include/asm/pgtable-types.h:28:24: warning: dereference of NULL ‘pmdp’ [CWE-690] [-Wanalyzer-null-dereference]
>| ./arch/arm64/include/asm/pgtable.h:436:26: note: in expansion of macro ‘pmd_val’
>| arch/arm64/mm/hugetlbpage.c:242:10: note: in expansion of macro ‘pte_alloc_map’
>|     |arch/arm64/mm/hugetlbpage.c:232:10:
>|     |./arch/arm64/include/asm/pgtable-types.h:28:24:
>| ./arch/arm64/include/asm/pgtable.h:436:26: note: in expansion of macro ‘pmd_val’
>| arch/arm64/mm/hugetlbpage.c:242:10: note: in expansion of macro ‘pte_alloc_map’
>
>This can only occur when the kernel cannot allocate a page, and so is
>unlikely to happen in practice before other systems start failing.
>
>We can avoid this by bailing out if pmd_alloc() fails, as we do earlier
>in the function if pud_alloc() fails.
>
>Fixes: 66b3923a1a0f ("arm64: hugetlb: add support for PTE contiguous bit")
>Signed-off-by: Mark Rutland <mark.rutland@arm.com>
>Reported-by: Kyrill Tkachov <kyrylo.tkachov@arm.com>
>Cc: <stable@vger.kernel.org> # 4.5.x-
>Cc: Will Deacon <will@kernel.org>
>Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

There was a context conflict with 441a62780687 ("arm64/hugetlb: Use
macros for contiguous huge page sizes"). I've fixed it and queued the
patch for 4.14 and 4.9.
-- 
Thanks,
Sasha

      reply	other threads:[~2020-05-12 15:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 11:26 FAILED: patch "[PATCH] arm64: hugetlb: avoid potential NULL dereference" failed to apply to 4.4-stable tree gregkh
2020-05-12 15:04 ` Sasha Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200512150444.GR13035@sasha-vm \
    --to=sashal@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kyrylo.tkachov@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox