From patchwork Thu May 16 11:06:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 2576471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id C21FCDFB7B for ; Thu, 16 May 2013 11:07:12 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ucw1e-0002Z8-Lz; Thu, 16 May 2013 11:07:10 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ucw1b-0000CO-GW; Thu, 16 May 2013 11:07:07 +0000 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ucw1X-0000C5-G4 for linux-arm-kernel@lists.infradead.org; Thu, 16 May 2013 11:07:04 +0000 Received: by mail-wi0-f174.google.com with SMTP id c10so4120650wiw.1 for ; Thu, 16 May 2013 04:06:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=/54LHMsub0xrvpPcNACG0yscCU6yJmp/KmUyiq3vFUA=; b=S4tNcsuE3VVoi7c45WKAPEdmPwUjFXROeEUBhKA4jeWu96j0+qcBxh394LIO8b+oSL yvJmCeTE+JvFCdO4vjl2r3Utb90PyROBhTbvaoQ8e6Xf/eiYYoA8gMHqrlU24P+RR5rk I7Ktk+CKYKzec66wC+K6J6xAedf8e9cq0+Em4cwPHtAPxjIhNFFUESfO0ZTyRaBqVnCu BB1XiH5mgoAYzaXVtdGVhDcjHVJ/rcm60NrIHDetISQcsYIFb0byaguH3mZba9BoadeP 0Nacol2eSQvJZ1AO513eSSyCMRo+U7azBQlZxCPZwqx3U0gul07vgPLoIQUiWaic3ZQb TABA== X-Received: by 10.180.183.76 with SMTP id ek12mr23445605wic.30.1368702400515; Thu, 16 May 2013 04:06:40 -0700 (PDT) Received: from localhost.localdomain (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id f2sm2969183wiv.11.2013.05.16.04.06.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 16 May 2013 04:06:39 -0700 (PDT) From: Steve Capper To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: remove the .vm_mm value from gate_vma. Date: Thu, 16 May 2013 12:06:34 +0100 Message-Id: <1368702394-1737-1-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQnU9aPyRz83SlVICvGUNcbZYpb3RJh2I4WN1/w+UKluqrh85vkq57OmSKi2WhVrz5+0nUFF X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130516_070703_648608_3855E8D3 X-CRM114-Status: GOOD ( 13.36 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Steve Capper , will.deacon@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org If one reads /proc/$PID/smaps, the mmap_sem belonging to the address space of the task being examined is locked for reading. All the pages of the vmas belonging to the task's address space are then walked with this lock held. If a gate_vma is present in the architecture, it too is examined by the fs/proc/task_mmu.c code. As gate_vma doesn't belong to the address space of the task though, its pages are not walked. A recent cleanup (commit f6604efe) of the gate_vma initialisation code set the vm_mm value to &init_mm. Unfortunately a non-NULL vm_mm value in the gate_vma will cause the task_mmu code to attempt to walk the pages of the gate_vma (with no mmap-sem lock held). If one enables Transparent Huge Page support and vm debugging, this will then cause OOPses as pmd_trans_huge_lock is called without mmap_sem being locked. This patch removes the .vm_mm value from gate_vma, restoring the original behaviour of the task_mmu code. Signed-off-by: Steve Capper --- arch/arm/kernel/process.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index f219703..282de48 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -411,7 +411,6 @@ static struct vm_area_struct gate_vma = { .vm_start = 0xffff0000, .vm_end = 0xffff0000 + PAGE_SIZE, .vm_flags = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYEXEC, - .vm_mm = &init_mm, }; static int __init gate_vma_init(void)