Re: [PATCH 5.0 25/89] RDMA/ucontext: Fix regression with disassociate

From: Michal Kubecek
Date: Fri May 03 2019 - 07:47:47 EST


On Tue, Apr 30, 2019 at 01:38:16PM +0200, Greg Kroah-Hartman wrote:
> From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
>
> commit 67f269b37f9b4d52c5e7f97acea26c0852e9b8a1 upstream.
>
> When this code was consolidated the intention was that the VMA would
> become backed by anonymous zero pages after the zap_vma_pte - however this
> very subtly relied on setting the vm_ops = NULL and clearing the VM_SHARED
> bits to transform the VMA into an anonymous VMA. Since the vm_ops was
> removed this broke.
>
> Now userspace gets a SIGBUS if it touches the vma after disassociation.
>
> Instead of converting the VMA to anonymous provide a fault handler that
> puts a zero'd page into the VMA when user-space touches it after
> disassociation.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Suggested-by: Andrea Arcangeli <aarcange@xxxxxxxxxx>
> Fixes: 5f9794dc94f5 ("RDMA/ucontext: Add a core API for mmaping driver IO memory")
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> ---

This commit breaks build on s390 and mips, please pick also commit
6a5c5d26c4c6 ("rdma: fix build errors on s390 and MIPS due to bad
ZERO_PAGE use").

Michal Kubecek