Re: [PATCH] futex: Fix fault_in_user_writeable()

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

 



On Tue, Aug 17, 2021 at 11:05:15AM +0200, Thomas Gleixner wrote:
> Huacai,
> 
> On Tue, Aug 17 2021 at 15:38, Huacai Chen wrote:
> > On Tue, Aug 17, 2021 at 3:07 PM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> > On X86, it returns 0; on MIPS64 without patch, it hangs in kernel; on
> > MIPS64 with this patch, it returns -1.
> 
> As expected.
> 
> > Then, I want to know, on "W implies R" archs (such as X86), should it
> > return 0? Maybe return -1 is more reasonable? (because the VMA is
> > marked as write-only). If this program should return -1, then I don't
> > think this is a MIPS-specific problem.
> 
> No. mmap(.., PROT_WRITE...) is simply impossible on x86 and implies
> PROT_READ as documented in mmap(2).
> 
> So why should this fail and only fail in the fault case, but succeed
> when the PTE is already established?

I wouldn't actually mind if it failed on fault -- it's the 'best' we can
do on x86. Doing a RmW op on PROT_WRITE is silly and deserves all the
wreckage it can get.



[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux