From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Ezra Buehler <ezra@easyb.ch>
Cc: linux-arm-kernel@lists.infradead.org,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Matthew Wilcox <willy@infradead.org>,
Ryan Roberts <ryan.roberts@arm.com>,
David Hildenbrand <david@redhat.com>,
open list <linux-kernel@vger.kernel.org>,
Muchun Song <muchun.song@linux.dev>,
Hugh Dickins <hughd@google.com>,
Qi Zheng <zhengqi.arch@bytedance.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
"Vishal Moola \(Oracle\)" <vishal.moola@gmail.com>,
linux-mm@kvack.org, Peter Xu <peterx@redhat.com>,
Vlastimil Babka <vbabka@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
"Mike Rapoport \(Microsoft\)" <rppt@kernel.org>
Subject: Re: [REGRESSION] NULL pointer dereference on ARM (AT91SAM9G25) during compaction
Date: Mon, 10 Feb 2025 17:03:13 +0000 [thread overview]
Message-ID: <Z6oxUdrVBPd5ZTEu@shell.armlinux.org.uk> (raw)
In-Reply-To: <CAM1KZSmZ2T_riHvay+7cKEFxoPgeVpHkVFTzVVEQ1BO0cLkHEQ@mail.gmail.com>
On Mon, Feb 10, 2025 at 05:49:38PM +0100, Ezra Buehler wrote:
> When running vanilla Linux 6.13 or newer (6.14-rc2) on the
> AT91SAM9G25-based GARDENA smart Gateway, we are seeing a NULL pointer
> dereference resulting in a kernel panic. The culprit seems to be commit
> fc9c45b71f43 ("arm: adjust_pte() usepte_offset_map_rw_nolock()").
> Reverting the commit apparently fixes the issue.
The blamed commit is buggy:
arch/arm/include/asm/tlbflush.h:
#define update_mmu_cache(vma, addr, ptep) \
update_mmu_cache_range(NULL, vma, addr, ptep, 1)
So vmf can be NULL. This didn't used to matter before this commit,
because vmf was not used by ARM's update_mmu_cache_range(). However,
the commit introduced a dereference of it, which now causes a NULL
point dereference.
Not sure what the correct solution is, but at a guess, both:
if (ptl != vmf->ptl)
need to become:
if (!vmf || ptl != vmf->ptl)
but I haven't checked wha tthe locking context actually is here
(I've been out of MM stuff too long to know this off the top of my
head.)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Ezra Buehler <ezra@easyb.ch>
Cc: linux-mm@kvack.org, Qi Zheng <zhengqi.arch@bytedance.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
"Mike Rapoport (Microsoft)" <rppt@kernel.org>,
Muchun Song <muchun.song@linux.dev>,
Vlastimil Babka <vbabka@suse.cz>,
Ryan Roberts <ryan.roberts@arm.com>,
"Vishal Moola (Oracle)" <vishal.moola@gmail.com>,
Hugh Dickins <hughd@google.com>,
Matthew Wilcox <willy@infradead.org>,
Peter Xu <peterx@redhat.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
open list <linux-kernel@vger.kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [REGRESSION] NULL pointer dereference on ARM (AT91SAM9G25) during compaction
Date: Mon, 10 Feb 2025 17:03:13 +0000 [thread overview]
Message-ID: <Z6oxUdrVBPd5ZTEu@shell.armlinux.org.uk> (raw)
In-Reply-To: <CAM1KZSmZ2T_riHvay+7cKEFxoPgeVpHkVFTzVVEQ1BO0cLkHEQ@mail.gmail.com>
On Mon, Feb 10, 2025 at 05:49:38PM +0100, Ezra Buehler wrote:
> When running vanilla Linux 6.13 or newer (6.14-rc2) on the
> AT91SAM9G25-based GARDENA smart Gateway, we are seeing a NULL pointer
> dereference resulting in a kernel panic. The culprit seems to be commit
> fc9c45b71f43 ("arm: adjust_pte() usepte_offset_map_rw_nolock()").
> Reverting the commit apparently fixes the issue.
The blamed commit is buggy:
arch/arm/include/asm/tlbflush.h:
#define update_mmu_cache(vma, addr, ptep) \
update_mmu_cache_range(NULL, vma, addr, ptep, 1)
So vmf can be NULL. This didn't used to matter before this commit,
because vmf was not used by ARM's update_mmu_cache_range(). However,
the commit introduced a dereference of it, which now causes a NULL
point dereference.
Not sure what the correct solution is, but at a guess, both:
if (ptl != vmf->ptl)
need to become:
if (!vmf || ptl != vmf->ptl)
but I haven't checked wha tthe locking context actually is here
(I've been out of MM stuff too long to know this off the top of my
head.)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2025-02-10 17:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 16:49 [REGRESSION] NULL pointer dereference on ARM (AT91SAM9G25) during compaction Ezra Buehler
2025-02-10 16:49 ` Ezra Buehler
2025-02-10 17:03 ` Russell King (Oracle) [this message]
2025-02-10 17:03 ` Russell King (Oracle)
2025-02-11 3:45 ` Qi Zheng
2025-02-11 3:45 ` Qi Zheng
2025-02-11 9:14 ` David Hildenbrand
2025-02-11 9:14 ` David Hildenbrand
2025-02-11 9:29 ` Qi Zheng
2025-02-11 9:29 ` Qi Zheng
2025-02-11 9:37 ` David Hildenbrand
2025-02-11 9:37 ` David Hildenbrand
2025-02-11 9:43 ` Qi Zheng
2025-02-11 9:43 ` Qi Zheng
2025-02-11 12:09 ` David Hildenbrand
2025-02-11 12:09 ` David Hildenbrand
2025-02-11 12:41 ` Qi Zheng
2025-02-11 12:41 ` Qi Zheng
2025-02-12 6:40 ` [PATCH] arm: pgtable: fix NULL pointer dereference issue Qi Zheng
2025-02-12 7:27 ` Ezra Buehler
2025-02-12 7:32 ` Qi Zheng
2025-02-12 8:20 ` David Hildenbrand
2025-02-12 8:28 ` Qi Zheng
2025-02-12 8:30 ` David Hildenbrand
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=Z6oxUdrVBPd5ZTEu@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=david@redhat.com \
--cc=ezra@easyb.ch \
--cc=hughd@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=peterx@redhat.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=vbabka@suse.cz \
--cc=vishal.moola@gmail.com \
--cc=willy@infradead.org \
--cc=zhengqi.arch@bytedance.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.