From patchwork Mon Aug 29 15:11:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herton Ronaldo Krzesinski X-Patchwork-Id: 112083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 53887B6F95 for ; Tue, 30 Aug 2011 01:11:28 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Qy3UX-0007eI-EB; Mon, 29 Aug 2011 15:11:13 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Qy3UV-0007dI-Mx for kernel-team@lists.ubuntu.com; Mon, 29 Aug 2011 15:11:11 +0000 Received: from [177.16.120.174] (helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Qy3UV-0005uP-6t for kernel-team@lists.ubuntu.com; Mon, 29 Aug 2011 15:11:11 +0000 From: "Herton R. Krzesinski" To: Ubuntu Kernel Team Subject: [lucid/fsl-imx51, maverick/ti-omap4, natty/ti-omap4][PATCH] proc: fix oops on invalid /proc//maps access, CVE-2011-1020 Date: Mon, 29 Aug 2011 12:11:07 -0300 Message-Id: <1314630667-5227-1-git-send-email-herton.krzesinski@canonical.com> X-Mailer: git-send-email 1.7.4.1 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Linus Torvalds When m_start returns an error, the seq_file logic will still call m_stop with that error entry, so we'd better make sure that we check it before using it as a vma. Introduced by commit ec6fd8a4355c ("report errors in /proc/*/*map* sanely"), which replaced NULL with various ERR_PTR() cases. (On ia64, you happen to get a unaligned fault instead of a page fault, since the address used is generally some random error code like -EPERM) Reported-by: Anca Emanuel Reported-by: Tony Luck Cc: Al Viro Cc: Américo Wang Cc: Stephen Wilson Signed-off-by: Linus Torvalds (cherry picked from commit 76597cd31470fa130784c78fadb4dab2e624a723) CVE-2011-1020 BugLink: http://bugs.launchpad.net/bugs/813026 Signed-off-by: Herton R. Krzesinski --- fs/proc/task_mmu.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) This is already applied on lucid, maverick and natty master/master-next, but is required also on lucid/fsl-imx51, maverick/ti-omap4, natty/ti-omap4 diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 7c708a4..2e7addf 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -182,7 +182,8 @@ static void m_stop(struct seq_file *m, void *v) struct proc_maps_private *priv = m->private; struct vm_area_struct *vma = v; - vma_stop(priv, vma); + if (!IS_ERR(vma)) + vma_stop(priv, vma); if (priv->task) put_task_struct(priv->task); }