Re: [PATCH v2 2/2] mm: prevent gup_fast from racing with COW during fork

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

 



On Fri, Oct 30, 2020 at 05:51:05PM +0100, Jan Kara wrote:

> Looks good to me. Just one nit below. With that fixed feel free to add:
> 
> Reviewed-by: Jan Kara <jack@xxxxxxx>

Thanks!

> > @@ -446,6 +447,12 @@ struct mm_struct {
> >  		 */
> >  		atomic_t has_pinned;
> >  
> > +		/**
> > +		 * @write_protect_seq: Odd when any thread is write protecting
> > +		 * pages in this mm, for instance during fork().
> > +		 */
> > +		seqcount_t write_protect_seq;
> > +
> 
> So this comment isn't quite true. We can be writeprotecting pages due to
> many other reasons and not touch write_protect_seq. E.g. for shared
> mappings or due to explicit mprotect() calls. So the write_protect_seq
> protection has to be about something more than pure write protection. One
> requirement certainly is that the VMA has to be is_cow_mapping(). What
> about mprotect(2) calls? I guess the application would have only itself to
> blame so we don't care?

Yes, that sounds right, How about

/**
 * @write_protect_seq: Locked when any thread is write protecting
 * pages for COW in this mm, for instance during page table copying
 * for fork().
 */

mprotect and shared mappings cause faults on write access not COW?

Jason




[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