From patchwork Wed Jan 18 17:45:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 136668 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 B153BB6EFE for ; Thu, 19 Jan 2012 04:45:34 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RnZZZ-0004H0-Vz; Wed, 18 Jan 2012 17:45:22 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RnZZY-0004Gm-Iw for kernel-team@lists.ubuntu.com; Wed, 18 Jan 2012 17:45:20 +0000 Received: from [85.210.149.110] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1RnZZY-0000NU-Ee; Wed, 18 Jan 2012 17:45:20 +0000 From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [oneiric CVE 1/1] overlayfs: apply device cgroup and security permissions to overlay files Date: Wed, 18 Jan 2012 17:45:17 +0000 Message-Id: <1326908717-10722-2-git-send-email-apw@canonical.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1326908717-10722-1-git-send-email-apw@canonical.com> References: <1326908717-10722-1-git-send-email-apw@canonical.com> Cc: Andy Whitcroft 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 When checking permissions on an overlayfs inode we do not take into account either device cgroup restrictions nor security permissions. This allows a user to mount an overlayfs layer over a restricted device directory and by pass those permissions to open otherwise restricted files. Use devcgroup_inode_permission() and security_inode_permission() against the underlying inodes when calculating ovl_permission(). CVE-2012-0055 BugLink: http://bugs.launchpad.net/bugs/915941 BugLink: http://bugs.launchpad.net/bugs/918212 Signed-off-by: Andy Whitcroft --- fs/overlayfs/inode.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index ce39fab..1551032 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include "overlayfs.h" int ovl_setattr(struct dentry *dentry, struct iattr *attr) @@ -118,6 +120,11 @@ int ovl_permission(struct inode *inode, int mask, unsigned int flags) else err = generic_permission(realinode, mask, flags, realinode->i_op->check_acl); + + if (!err) + err = devcgroup_inode_permission(realinode, mask); + if (!err) + err = security_inode_permission(realinode, mask); out_dput: dput(alias); return err;