Re: [PATCH] ovl: fix mmap denywrite
From: Christian König <christian.koenig@amd.com>
Date: 2021-06-23 11:41:10
Also in:
linux-fsdevel, linux-mm
From: Christian König <christian.koenig@amd.com>
Date: 2021-06-23 11:41:10
Also in:
linux-fsdevel, linux-mm
Am 22.06.21 um 17:10 schrieb Miklos Szeredi:
On Tue, 22 Jun 2021 at 14:43, Christian König [off-list ref] wrote:quoted
Am 22.06.21 um 14:30 schrieb Miklos Szeredi:quoted
Overlayfs did not honor positive i_writecount on realfile for VM_DENYWRITE mappings. Similarly negative i_mmap_writable counts were ignored for VM_SHARED mappings. Fix by making vma_set_file() switch the temporary counts obtained and released by mmap_region().Mhm, I don't fully understand the background but that looks like something specific to overlayfs to me. So why are you changing the common helper?Need to hold the temporary counts until the final ones are obtained in vma_link(), which is out of overlayfs' scope.
Ah! So basically we need to move the denial counts which mmap_region() added to the original file to the new one as well. That's indeed a rather good point. Can you rather change the vma_set_file() function to return the error and add a __must_check? I can take care fixing the users in DMA-buf and DRM subsystem. Thanks, Christian.
Thanks, Miklos