Re: [PATCH 1/1] userfaultfd: hugetlbfs: prevent UFFDIO_COPY to fill beyond the end of i_size

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

 



On Tue, 17 Oct 2017 00:39:14 +0200 Andrea Arcangeli <aarcange@xxxxxxxxxx> wrote:

> kernel BUG at fs/hugetlbfs/inode.c:484!
> RIP: 0010:[<ffffffff815f8520>]  [<ffffffff815f8520>] remove_inode_hugepages+0x3d0/0x410
> Call Trace:
>  [<ffffffff815f95b9>] hugetlbfs_setattr+0xd9/0x130
>  [<ffffffff81526312>] notify_change+0x292/0x410
>  [<ffffffff816cc6b6>] ? security_inode_need_killpriv+0x16/0x20
>  [<ffffffff81503c65>] do_truncate+0x65/0xa0
>  [<ffffffff81504035>] ? do_sys_ftruncate.constprop.3+0xe5/0x180
>  [<ffffffff8150406a>] do_sys_ftruncate.constprop.3+0x11a/0x180
>  [<ffffffff8150410e>] SyS_ftruncate+0xe/0x10
>  [<ffffffff81999f27>] tracesys+0xd9/0xde
> 
> This oops was caused by the lack of i_size check in
> hugetlb_mcopy_atomic_pte. mmap() can still succeed beyond the end of
> the i_size after vmtruncate zapped vmas in those ranges, but the
> faults must not succeed, and that includes UFFDIO_COPY.
> 
> We could differentiate the retval to userland to represent a SIGBUS
> like a page fault would do (vs SIGSEGV), but it doesn't seem very
> useful and we'd need to pick a random retval as there's no meaningful
> syscall retval that would differentiate from SIGSEGV and SIGBUS,
> there's just -EFAULT.
> 
> Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
> Signed-off-by: Andrea Arcangeli <aarcange@xxxxxxxxxx>

No cc:stable?  The patch applies to 4.13 textually...

--
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