Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 31, 2017 at 02:22:04PM +0200, Michal Hocko wrote:
> On Thu 27-07-17 09:26:59, Mike Rapoport wrote:
> > In the non-cooperative userfaultfd case, the process exit may race with
> > outstanding mcopy_atomic called by the uffd monitor.  Returning -ENOSPC
> > instead of -EINVAL when mm is already gone will allow uffd monitor to
> > distinguish this case from other error conditions.
> 
> Normally we tend to return ESRCH in such case. ENOSPC sounds rather
> confusing...

Well, I don't remember why I used ENOSPC in userfault_copy at the first
place, but if we are to keep it userfaultfd_zeropage should return the same
error...

> > Cc: stable@xxxxxxxxxxxxxxx
> > Fixes: 96333187ab162 ("userfaultfd_copy: return -ENOSPC in case mm has gone")
> > 
> > Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx>
> > ---
> > 
> > Unfortunately, I've overlooked userfaultfd_zeropage when I updated
> > userfaultd_copy :(
> > 
> >  fs/userfaultfd.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
> > index cadcd12a3d35..2d8c2d848668 100644
> > --- a/fs/userfaultfd.c
> > +++ b/fs/userfaultfd.c
> > @@ -1643,6 +1643,8 @@ static int userfaultfd_zeropage(struct userfaultfd_ctx *ctx,
> >  		ret = mfill_zeropage(ctx->mm, uffdio_zeropage.range.start,
> >  				     uffdio_zeropage.range.len);
> >  		mmput(ctx->mm);
> > +	} else {
> > +		return -ENOSPC;
> >  	}
> >  	if (unlikely(put_user(ret, &user_uffdio_zeropage->zeropage)))
> >  		return -EFAULT;
> > -- 
> > 2.7.4
> > 
> > --
> > To unsubscribe, send a message with 'unsubscribe linux-mm' in
> > the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
> > see: http://www.linux-mm.org/ .
> > Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>
> 
> -- 
> Michal Hocko
> SUSE Labs
> 

-- 
Sincerely yours,
Mike.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux