Re: [PATCH] btrfs: fix NULL pointer deref during assertion in btrfs_backref_free_node()

David Sterba <[email protected]>
Newsgroups org.kernel.vger.linux-btrfs
Message-ID <[email protected]>
On Mon, Jun 29, 2026 at 04:09:17PM +0100, [email protected] wrote:
>   ASSERT(node->eb == NULL, "node->eb->start=%llu", node->eb->start);

> It seems that this happens on some systems for some reason, when the
> ASSERT() macro calls the inline function verify_assert_printk_format()
> to evaluate the format string and arguments, causing the NULL pointer
> dereference on node->eb.

I wonder what are the conditions that lead to generating code for the
assertion and verify_assert_printk_format() in particular. It's a static
inline so lots of space for optimizing out everything.

There was a review report

https://sashiko.dev/#/patchset/b6f6b52824e4b9e6ee9f883e09e53da9eb8152ee.1780409231.git.fdmanana%40suse.com

that we discussed on slack and my compilation test did not generate any
code for it and your actual test run did not hit the crash.

So for any verbose assertion we must assume the printk expressions must
be valid in connection with the condition being either true or false. I
don't think we can check or enforce that by tools, so we remember that
or get reminded by sashiko.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.