Bug 94001 - read from /proc/$pid/cmdline hang
Summary: read from /proc/$pid/cmdline hang
Status: RESOLVED CODE_FIX
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: Andrew Morton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-28 13:27 UTC by Stefan
Modified: 2015-03-03 19:11 UTC (History)
1 user (show)

See Also:
Kernel Version: 3.2.67
Subsystem:
Regression: No
Bisected commit-id:


Attachments
signature.asc (812 bytes, application/pgp-signature)
2015-03-03 02:32 UTC, Ben Hutchings
Details

Description Stefan 2015-02-28 13:27:40 UTC
Symptoms: ps aux, pstree, w etc. hang uninterruptibly. A read from cmdline does
not return. The process whose commandline cannot be read is a pidof -s wdm. 

The first bad commit after 3.2.66 is:

https://git.kernel.org/cgit/linux/kernel/git/bwh/linux-3.2.y.git/commit/?id=a8467a7ab41236cad681a5c3e5f2373625755d42
Comment 1 Andrew Morton 2015-03-02 23:35:52 UTC
huh.  I wonder if 3.2.66 is missing some other commit.  Do more recent kernels such as 3.19 have the same problem?
Comment 2 Linus Torvalds 2015-03-03 01:09:46 UTC
On Mon, Mar 2, 2015 at 3:35 PM,  Andrew Morton wrote:
> huh.  I wonder if 3.2.66 is missing some other commit.  Do more recent
> kernels
> such as 3.19 have the same problem?

I think this comes from backporting commits 9c145c56d0c8 and
33692f27597f without the prerequisite commit 7fb08eca4527. It wasn't
obvious that they were related,

                           Linus
Comment 3 Ben Hutchings 2015-03-03 02:32:46 UTC
Created attachment 168611 [details]
signature.asc

On Mon, 2015-03-02 at 17:09 -0800, Linus Torvalds wrote:
> On Mon, Mar 2, 2015 at 3:35 PM,  Andrew Morton wrote:
> > huh.  I wonder if 3.2.66 is missing some other commit.  Do more recent
> kernels
> > such as 3.19 have the same problem?
> 
> I think this comes from backporting commits 9c145c56d0c8 and
> 33692f27597f without the prerequisite commit 7fb08eca4527. It wasn't
> obvious that they were related,

Yeah, I spotted that too late.  I couldn't see how to backport the
prerequisite but I have this fix queued up:

From: Ben Hutchings <ben@decadent.org.uk>
Date: Wed, 25 Feb 2015 00:02:28 +0000
Subject: x86: mm/fault: Fix semaphore imbalance

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>
---
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -878,7 +878,7 @@ mm_fault_error(struct pt_regs *regs, uns
 			     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();
 	}
--- END ---

Ben.
Comment 4 Linus Torvalds 2015-03-03 02:38:31 UTC
On Mon, Mar 2, 2015 at 6:32 PM, Ben Hutchings <ben@decadent.org.uk> wrote:
>
> Yeah, I spotted that too late.  I couldn't see how to backport the
> prerequisite but I have this fix queued up:

Yes, that looks good to me.

                   Linus
Comment 5 Stefan 2015-03-03 19:11:59 UTC
(In reply to Ben Hutchings from comment #3)
> Yeah, I spotted that too late.  I couldn't see how to backport the
> prerequisite but I have this fix queued up:

Works. Thanks!

Note You need to log in before you can comment on or make changes to this bug.