From patchwork Tue Nov 10 18:29:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Johansen X-Patchwork-Id: 38070 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 F141FB7B91 for ; Wed, 11 Nov 2009 09:02:21 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1N7vVX-0003H8-M8; Tue, 10 Nov 2009 18:31:59 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1N7vTE-0002bg-2I for kernel-team@lists.ubuntu.com; Tue, 10 Nov 2009 18:29:36 +0000 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1N7vTD-0002o9-UI; Tue, 10 Nov 2009 18:29:36 +0000 Received: from pool-98-108-130-232.ptldor.fios.verizon.net ([98.108.130.232] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1N7vTD-0001YE-He; Tue, 10 Nov 2009 18:29:35 +0000 From: John Johansen To: kernel-team@lists.ubuntu.com Subject: [PATCH 4/5] UBUNTU: SAUCE: AppArmor: Fix refcounting bug causing leak of creds Date: Tue, 10 Nov 2009 10:29:12 -0800 Message-Id: <1257877753-9448-5-git-send-email-john.johansen@canonical.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1257877753-9448-1-git-send-email-john.johansen@canonical.com> References: <1257877753-9448-1-git-send-email-john.johansen@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.8 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com BugLink: http://bugs.launchpad.net/bugs/479115 SRU Justification: Failure to put the cred causes a memory leak that is larger than the cred struct, as it leaks everything it references. This happens for every unconfined processes that does an exec, change_hat or change_profile and passes through this function. AppArmor when doing ptrace check for domain changes, fails to drop the ref count on the task creds when it is unconfined. Signed-off-by: John Johansen Acked-by: Stefan Bader Acked-by: Andy Whitcroft --- ubuntu/apparmor/domain.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/ubuntu/apparmor/domain.c b/ubuntu/apparmor/domain.c index 128e527..fe89ddc 100644 --- a/ubuntu/apparmor/domain.c +++ b/ubuntu/apparmor/domain.c @@ -65,9 +65,10 @@ static int aa_may_change_ptraced_domain(struct task_struct *task, rcu_read_unlock(); if (!tracerp) - return error; + goto out; error = aa_may_ptrace(tracer, tracerp, to_profile, PTRACE_MODE_ATTACH); +out: put_cred(cred); return error;