From patchwork Mon Nov 9 20:41:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Johansen X-Patchwork-Id: 38036 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 3E192B7B77 for ; Tue, 10 Nov 2009 11:49:46 +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 1N7b5V-0002V3-Vn; Mon, 09 Nov 2009 20:43:46 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1N7b3u-0001ji-Mz for kernel-team@lists.ubuntu.com; Mon, 09 Nov 2009 20:42:06 +0000 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1N7b3u-00046K-Lx; Mon, 09 Nov 2009 20:42:06 +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 1N7b3u-0001ZQ-9B; Mon, 09 Nov 2009 20:42:06 +0000 From: John Johansen To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/4] UBUNTU: SAUCE: AppArmor: Fix oops after profile removal Date: Mon, 9 Nov 2009 12:41:53 -0800 Message-Id: <1257799316-12573-2-git-send-email-john.johansen@canonical.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1257799316-12573-1-git-send-email-john.johansen@canonical.com> References: <1257799316-12573-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/475619 Profile removal results in child profiles having their replacedby field assigned an ERR_PTR. Which will cause a null pointer oops. This will affect any application that has a profile in a hat, or a learning mode subprofile when the base profile is removed. The use of ERR_PTR used to be the way AppArmor would distinguish between a removal and unconfined, this became invalid when the namespace->unconfined profile was introduced. After replacement the child process will change its context so that its profile is set ERR_PTR, the ERR_PTR then gets filtered to a NULL ptr which then causes the oops. Signed-off-by: John Johansen --- ubuntu/apparmor/policy.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ubuntu/apparmor/policy.c b/ubuntu/apparmor/policy.c index 390bbf6..a772801 100644 --- a/ubuntu/apparmor/policy.c +++ b/ubuntu/apparmor/policy.c @@ -322,7 +322,7 @@ void __aa_remove_profile(struct aa_profile *profile, if (replacement) profile->replacedby = aa_get_profile(replacement); else - profile->replacedby = ERR_PTR(-EINVAL); + profile->replacedby = aa_get_profile(profile->ns->unconfined); list_del_init(&profile->base.list); if (!(profile->flags & PFLAG_NO_LIST_REF)) aa_put_profile(profile);