From patchwork Thu Oct 8 20:45:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Johansen X-Patchwork-Id: 35529 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 5CE58B7B77 for ; Fri, 9 Oct 2009 07:46:17 +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 1MvzsJ-0000pe-7V; Thu, 08 Oct 2009 21:46:11 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1Mvzri-0000Ye-03 for kernel-team@lists.ubuntu.com; Thu, 08 Oct 2009 21:45:34 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1Mvzrg-00042U-HI; Thu, 08 Oct 2009 21:45:32 +0100 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 1Mvzrg-00021t-2Y; Thu, 08 Oct 2009 21:45:32 +0100 From: John Johansen To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2] UBUNTU: SAUCE: AppArmor: Fix off by 2 error in getprocattr mem allocation Date: Thu, 8 Oct 2009 13:45:11 -0700 Message-Id: <1255034711-11623-3-git-send-email-john.johansen@canonical.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1255034711-11623-1-git-send-email-john.johansen@canonical.com> References: <1255034711-11623-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/446595 In AppArmor's get procattr interface when a namespace is defined the allocation is not large enough for + "://" + , so AppArmor overwrites 2 bytes of memory it has not allocated. Signed-off-by: John Johansen --- ubuntu/apparmor/procattr.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ubuntu/apparmor/procattr.c b/ubuntu/apparmor/procattr.c index 834cfab..e83f04f 100644 --- a/ubuntu/apparmor/procattr.c +++ b/ubuntu/apparmor/procattr.c @@ -49,7 +49,7 @@ int aa_getprocattr(struct aa_namespace *ns, struct aa_profile *profile, len = strlen(unconfined_str); if (ns != default_namespace) - len += strlen(ns->base.name) + 1; + len += strlen(ns->base.name) + 3; /* :// */ str = kmalloc(len + 1, GFP_ATOMIC); if (!str)