Re: [GIT PULL] overlayfs fixes for 5.14-rc6

From: Linus Torvalds
Date: Mon Aug 09 2021 - 17:25:38 EST


On Mon, Aug 9, 2021 at 10:00 AM Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
>
> ovl: fix mmap denywrite

Ugh. Th edances with denywrite and mapping_unmap_writable are really
really annoying.

I've pulled this, but I really get the feeling that there's duplicated
code for these things, and that all the "if error goto" cases (some
old, some new) are really really uglky.

I get the feeling that the whole thing with deny_write_access and
mapping_map_writable could possibly be done after-the-fact somehow as
part of actually inserting the vma in the vma tree, rather than done
as the vma is prepared.

And most users of vma_set_file() probably really don't want that whole
thing at all (ie the DRM stuff that just switches out a local thing.
They also don't check for the new error cases you've added.

So I really think this is quite questionable, and those cases should
probably have been done entirely inside ovlfs rather than polluting
the cases that don't care and don't check.

Linus