diff mbox

[SRU,Precise] x86: mm/fault: Fix semaphore imbalance

Message ID 1426160076-15844-1-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques March 12, 2015, 11:34 a.m. UTC
From: Ben Hutchings <ben@decadent.org.uk>

When backporting commit 33692f27597f ('vm: add VM_FAULT_SIGSEGV
handling support') I didn't notice that it depended on a recent change
to the locking context of mm_fault_error() (commit 7fb08eca4527,
'x86: mm: move mmap_sem unlock from mm_fault_error() to caller').
That isn't easily applicable to 3.2, so instead make sure we drop
mm->mmap_sem on the new branch of mm_fault_error().

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
(cherry picked from commit 6749fd110bf44164782df9bba86c0327474446b9 linux-3.2.y)
BugLink: http://bugs.launchpad.net/bugs/1431280
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/mm/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Brad Figg March 12, 2015, 12:21 p.m. UTC | #1
On Thu, Mar 12, 2015 at 11:34:36AM +0000, Luis Henriques wrote:
> From: Ben Hutchings <ben@decadent.org.uk>
> 
> When backporting commit 33692f27597f ('vm: add VM_FAULT_SIGSEGV
> handling support') I didn't notice that it depended on a recent change
> to the locking context of mm_fault_error() (commit 7fb08eca4527,
> 'x86: mm: move mmap_sem unlock from mm_fault_error() to caller').
> That isn't easily applicable to 3.2, so instead make sure we drop
> mm->mmap_sem on the new branch of mm_fault_error().
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> (cherry picked from commit 6749fd110bf44164782df9bba86c0327474446b9 linux-3.2.y)
> BugLink: http://bugs.launchpad.net/bugs/1431280
> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> ---
>  arch/x86/mm/fault.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> index 8cac08822a0f..351590ec87b8 100644
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -878,7 +878,7 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
>  			     VM_FAULT_HWPOISON_LARGE))
>  			do_sigbus(regs, error_code, address, fault);
>  		else if (fault & VM_FAULT_SIGSEGV)
> -			bad_area_nosemaphore(regs, error_code, address);
> +			bad_area(regs, error_code, address);
>  		else
>  			BUG();
>  	}
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

I ran a number of tests on a kernel with this applied. This resolved a hang
that I was getting while running the QRT tests.

Brad
Stefan Bader March 12, 2015, 1:38 p.m. UTC | #2
Ok, so bad_area will unlock the semaphore and then call the same function as
bad_area_nosemaphore. Which is consistent with the description and oh well its
testable... so ack.
Andy Whitcroft March 18, 2015, 9:20 a.m. UTC | #3
Noting that this has already been applied to Precise.

-apw
Luis Henriques March 18, 2015, 9:33 a.m. UTC | #4
On Wed, Mar 18, 2015 at 09:20:03AM +0000, Andy Whitcroft wrote:
> Noting that this has already been applied to Precise.
> 
> -apw

Yes, and I completely forgot to send the notification.  Thanks, Andy!

Cheers,
--
Luís
diff mbox

Patch

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 8cac08822a0f..351590ec87b8 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -878,7 +878,7 @@  mm_fault_error(struct pt_regs *regs, unsigned long error_code,
 			     VM_FAULT_HWPOISON_LARGE))
 			do_sigbus(regs, error_code, address, fault);
 		else if (fault & VM_FAULT_SIGSEGV)
-			bad_area_nosemaphore(regs, error_code, address);
+			bad_area(regs, error_code, address);
 		else
 			BUG();
 	}