From patchwork Tue Nov 10 18:29:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Johansen X-Patchwork-Id: 38069 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 9D802B7BB3 for ; Wed, 11 Nov 2009 09:02:20 +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 1N7vVg-0003Lo-4e; Tue, 10 Nov 2009 18:32:08 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1N7vTG-0002c7-UM for kernel-team@lists.ubuntu.com; Tue, 10 Nov 2009 18:29:38 +0000 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1N7vTG-0002rL-T1; Tue, 10 Nov 2009 18:29:38 +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 1N7vTG-0001YH-FR; Tue, 10 Nov 2009 18:29:38 +0000 From: John Johansen To: kernel-team@lists.ubuntu.com Subject: [PATCH 5/5] UBUNTU: SAUCE: AppArmor: Fix oops there is no tracer and doing unsafe transition. Date: Tue, 10 Nov 2009 10:29:13 -0800 Message-Id: <1257877753-9448-6-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/480112 SRU Justification: This bug can cause confined process to oops at address 0. This can occur when executing a process if the LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP flags are set. The likely hood of if/how often this will occur depends on if ptrace is being used. As reported by Tetsuo Handa on kernel-team mailing list: In aa_may_change_ptraced_domain, if (!tracer) cred == NULL, and put_cred(cred) will oops. This will only happen on exec if the task is marked as LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP, so should only happen to ptraced tasks that are confined. Fix this by returning directly from aa_may_change_ptrace_domain if there is now tracer. Signed-off-by: John Johansen Acked-by: Stefan Bader Acked-by: Andy Whitcroft --- ubuntu/apparmor/domain.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/ubuntu/apparmor/domain.c b/ubuntu/apparmor/domain.c index fe89ddc..12e45c6 100644 --- a/ubuntu/apparmor/domain.c +++ b/ubuntu/apparmor/domain.c @@ -64,6 +64,10 @@ static int aa_may_change_ptraced_domain(struct task_struct *task, cred = aa_get_task_policy(tracer, &tracerp); rcu_read_unlock(); + /* not ptraced */ + if (!tracer) + return 0; + if (!tracerp) goto out;