From patchwork Tue May 22 15:22:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Johansen X-Patchwork-Id: 160662 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 156F3B6FAA for ; Wed, 23 May 2012 01:22:55 +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 1SWqv9-0006I3-60; Tue, 22 May 2012 15:22:47 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SWqv6-0006GZ-R8 for kernel-team@lists.ubuntu.com; Tue, 22 May 2012 15:22:44 +0000 Received: from static-50-53-53-239.bvtn.or.frontiernet.net ([50.53.53.239] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SWqv6-00061D-A0 for kernel-team@lists.ubuntu.com; Tue, 22 May 2012 15:22:44 +0000 From: John Johansen To: kernel-team@lists.ubuntu.com Subject: [PATCH 4/5] UBUNTU [upstream] apparmor: fix profile lookup for unconfined Date: Tue, 22 May 2012 08:22:20 -0700 Message-Id: <1337700142-13370-5-git-send-email-john.johansen@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1337700142-13370-1-git-send-email-john.johansen@canonical.com> References: <1337700142-13370-1-git-send-email-john.johansen@canonical.com> 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: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com OriginalLocation: security/next bf83208e0b7f5938f5a7f6d9dfa9960bf04692fa BugLink: http://bugs.launchpad.net/bugs/978038 also affects apparmor portion of BugLink: http://bugs.launchpad.net/bugs/987371 The unconfined profile is not stored in the regular profile list, but change_profile and exec transitions may want access to it when setting up specialized transitions like switch to the unconfined profile of a new policy namespace. Signed-off-by: John Johansen --- security/apparmor/policy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index b8100a7..39056af 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c @@ -904,6 +904,10 @@ struct aa_profile *aa_lookup_profile(struct aa_namespace *ns, const char *hname) profile = aa_get_profile(__lookup_profile(&ns->base, hname)); read_unlock(&ns->lock); + /* the unconfined profile is not in the regular profile list */ + if (!profile && strcmp(hname, "unconfined") == 0) + profile = aa_get_profile(ns->unconfined); + /* refcount released by caller */ return profile; }