From: Johannes Weiner <hannes@cmpxchg.org>
To: Michael Hicklen <michael.s.hicklen@gmail.com>
Cc: linux-ext4@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, tytso@mit.edu, vbabka@suse.cz
Subject: Re: kernel NULL pointer dereference in drain_obj_stock during ext4 e4defrag
Date: Wed, 8 Jul 2026 14:36:31 -0400 [thread overview]
Message-ID: <ak6Yr-BHnRIr_LoE@cmpxchg.org> (raw)
In-Reply-To: <CALhAV-Bzbe5BtGsH=tdd9KBK+53w3Nwy8drWcAkAeq=UyoH4xA@mail.gmail.com>
Hello Michael,
On Tue, Jul 07, 2026 at 06:51:14PM -0500, Michael Hicklen wrote:
> Kernel: 7.1.2-arch3-1
> Arch: x86_64
> Hardware: MSI MS-7C95 / PRO B550M-VC WIFI
> CPU: AMD (kvm_amd loaded)
>
> Workload:
>
> 4 concurrent e4defrag processes operating on 4 separate ext4
> filesystems on 4 separate HDDs.
>
> The crash happens during memory reclaim while ext4_move_extents() is running.
>
> First oops:
>
> BUG: kernel NULL pointer dereference, address: 0000000000000676
> #PF: supervisor read access in kernel mode
>
> RIP: drain_obj_stock+0x175/0x310
Thanks for the report. The trace and register state suggests that we
have the stock pointing to a dead objcg. Through this mess of
container_of(), you basically have to read the lines in reverse:
drain_obj_stock()
mod_objcg_mlstate(old = stock->cached_objcg, stock->cached_pgdat, ...)
rcu_read_lock()
memcg = obj_cgroup_memcg(old) // objcg->memcg: stale value
lruvec = mem_cgroup_lruvec(memcg, pgdat) // memcg->nodeinfo[nid]: stale value
mod_memcg_lruvec_state(lruvec, ...)
pn = container_of(lruvec, ...)
memcg = pn->memcg // freed pn, first 8 bytes now contain 6
pn = memcg->nodeinfo[pgdat->node_id] // <<< faults: 6 + 0x670 = 0x676
Michael, do you have the full dmesg available from this machine? The
oops you included already include taint flags for previous crashes and
warnings.
There is an interleaved Code: block (twice) that disassembles to what
looks like an obj_cgroup_get() encountering a percpu_count_ptr of 0,
which further suggests use-after-free of the objcg.
prev parent reply other threads:[~2026-07-08 18:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 23:51 kernel NULL pointer dereference in drain_obj_stock during ext4 e4defrag Michael Hicklen
2026-07-08 18:36 ` Johannes Weiner [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=ak6Yr-BHnRIr_LoE@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=michael.s.hicklen@gmail.com \
--cc=tytso@mit.edu \
--cc=vbabka@suse.cz \
/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