[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <nycvar.YSQ.7.76.1808281940360.10215@knanqh.ubzr>
Date: Tue, 28 Aug 2018 19:52:03 -0400 (EDT)
From: Nicolas Pitre <nicolas.pitre@...aro.org>
To: Matthew Wilcox <willy@...radead.org>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Souptick Joarder <jrdr.linux@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/10] cramfs: Convert to use vmf_insert_mixed
On Tue, 28 Aug 2018, Matthew Wilcox wrote:
> On Tue, Aug 28, 2018 at 01:49:25PM -0400, Nicolas Pitre wrote:
> > On Tue, 28 Aug 2018, Matthew Wilcox wrote:
> > > - ret = vm_insert_mixed(vma, vma->vm_start + off, pfn);
> > > + vmf = vmf_insert_mixed(vma, vma->vm_start + off, pfn);
> > > + if (vmf & VM_FAULT_ERROR) {
> > > + pages = i;
> > > + break;
> > > + }
> >
> > I'd suggest this to properly deal with errers instead:
> >
> > - ret = vm_insert_mixed(vma, vma->vm_start + off, pfn);
> > + vmf = vmf_insert_mixed(vma, vma->vm_start + off, pfn);
> > + if (vmf & VM_FAULT_ERROR)
> > + ret = vm_fault_to_errno(vmf, 0);
>
> By my reading of this function, the intent is actually to return 0
> here and allow demand paging to work. Of course, I've spent all of
> twenty minutes staring at this function, so I defer to the maintainer.
Demand paging is used when the filesystem layout isn't amenable to a
direct mapping. It is not a fallback for when we're OOM or some other
internal errors which ought to be reported immediately.
> I think you'd need to be running a make-memory-allocations-fail fuzzer
> to hit this, so it's likely never been tested.
Well, it has been tested sort of, e.g. when vm_insert_mixed() returned
an error due to misaligned addresses during development. Normally,
vm_insert_mixed() and vmf_insert_mixed() should always succeed, and if
they don't we certainly don't want to ignore it.
Nicolas
Powered by blists - more mailing lists