lkml.org 
[lkml]   [2022]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 01/12] mm/shmem: Introduce F_SEAL_INACCESSIBLE
On Mon, Feb 07, 2022 at 01:24:42PM +0100, Vlastimil Babka wrote:
> On 1/18/22 14:21, Chao Peng wrote:
> > From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> >
> > /*
> > diff --git a/mm/shmem.c b/mm/shmem.c
> > index 18f93c2d68f1..72185630e7c4 100644
> > --- a/mm/shmem.c
> > +++ b/mm/shmem.c
> > @@ -1098,6 +1098,13 @@ static int shmem_setattr(struct user_namespace *mnt_userns,
> > (newsize > oldsize && (info->seals & F_SEAL_GROW)))
> > return -EPERM;
> >
> > + if (info->seals & F_SEAL_INACCESSIBLE) {
> > + if(i_size_read(inode))
>
> Is this needed? The rest of the function seems to trust oldsize obtained by
> plain reading inode->i_size well enough, so why be suddenly paranoid here?

oldsize sounds enough here, unless kirill has different mind.

>
> > + return -EPERM;
> > + if (newsize & ~PAGE_MASK)
> > + return -EINVAL;
> > + }
> > +
> > if (newsize != oldsize) {
> > error = shmem_reacct_size(SHMEM_I(inode)->flags,
> > + if ((info->seals & F_SEAL_INACCESSIBLE) &&
> > + (offset & ~PAGE_MASK || len & ~PAGE_MASK)) {
>
> Could we use PAGE_ALIGNED()?

Yes, definitely, thanks.

Chao
>
> > + error = -EINVAL;
> > + goto out;
> > + }
> > +
> > shmem_falloc.waitq = &shmem_falloc_waitq;
> > shmem_falloc.start = (u64)unmap_start >> PAGE_SHIFT;
> > shmem_falloc.next = (unmap_end + 1) >> PAGE_SHIFT;

\
 
 \ /
  Last update: 2022-02-17 13:58    [W:0.129 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site