lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 21 Mar 2017 14:42:25 +0530
From:   "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
To:     Laurent Dufour <ldufour@...ux.vnet.ibm.com>, mpe@...erman.id.au,
        benh@...nel.crashing.org, paulus@...ba.org, bsingharora@...il.com,
        npiggin@...il.com
Cc:     linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] powerpc/mm: move mmap_sem unlocking in do_page_fault()

Laurent Dufour <ldufour@...ux.vnet.ibm.com> writes:

> Since the fault retry is now handled earlier, we can release the
> mmap_sem lock earlier too and remove later unlocking previously done in
> mm_fault_error().
>

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com> 


> Signed-off-by: Laurent Dufour <ldufour@...ux.vnet.ibm.com>
> ---
>  arch/powerpc/mm/fault.c | 19 ++++---------------
>  1 file changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index 2a6bc7e6e69a..21e06cce8984 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -151,13 +151,6 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
>  	 * continue the pagefault.
>  	 */
>  	if (fatal_signal_pending(current)) {
> -		/*
> -		 * If we have retry set, the mmap semaphore will have
> -		 * alrady been released in __lock_page_or_retry(). Else
> -		 * we release it now.
> -		 */
> -		if (!(fault & VM_FAULT_RETRY))
> -			up_read(&current->mm->mmap_sem);
>  		/* Coming from kernel, we need to deal with uaccess fixups */
>  		if (user_mode(regs))
>  			return MM_FAULT_RETURN;
> @@ -170,8 +163,6 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
>
>  	/* Out of memory */
>  	if (fault & VM_FAULT_OOM) {
> -		up_read(&current->mm->mmap_sem);
> -
>  		/*
>  		 * We ran out of memory, or some other thing happened to us that
>  		 * made us unable to handle the page fault gracefully.
> @@ -182,10 +173,8 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
>  		return MM_FAULT_RETURN;
>  	}
>
> -	if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
> -		up_read(&current->mm->mmap_sem);
> +	if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE))
>  		return do_sigbus(regs, addr, fault);
> -	}
>
>  	/* We don't understand the fault code, this is fatal */
>  	BUG();
> @@ -452,11 +441,12 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
>  				goto retry;
>  		}
>  		/* We will enter mm_fault_error() below */
> -	}
> +	} else
> +		up_read(&current->mm->mmap_sem);
>
>  	if (unlikely(fault & (VM_FAULT_RETRY|VM_FAULT_ERROR))) {
>  		if (fault & VM_FAULT_SIGSEGV)
> -			goto bad_area;
> +			goto bad_area_nosemaphore;
>  		rc = mm_fault_error(regs, address, fault);
>  		if (rc >= MM_FAULT_RETURN)
>  			goto bail;
> @@ -488,7 +478,6 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
>  			      regs, address);
>  	}
>
> -	up_read(&mm->mmap_sem);
>  	goto bail;
>
>  bad_area:
> -- 
> 2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ