Re: [PATCH] mm/filemap: fix NULL pointer dereference in do_read_cache_folio()
From: Matthew Wilcox
Date: Tue Nov 18 2025 - 07:52:24 EST
On Mon, Nov 17, 2025 at 09:05:17PM -0800, Christoph Hellwig wrote:
> On Sun, Nov 16, 2025 at 10:32:12PM +0000, Matthew Wilcox wrote:
> > I don't think it's necessarily all that hard to make buildid work
> > for DAX. It's probably something like:
> >
> > if (IS_DAX(file_inode(file)))
> > kernel_read(file, buf, count, &pos);
> >
> > but that's just off the top of my head.
>
> The code should just unconditionally use kernel_read(). Relying
> on ->read_folio to just work is only something file system code and
> library code called by the file systems can assume.
>
> Something reading ELF headers has no bunsiness poking into this layer.
Please read the rest of the thread; this code can be called in contexts
that can't block. That was why I proposed the kiocb_read() refactoring
that I would expect you to have an opinion on.