From patchwork Wed Sep 7 20:49:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 9319895 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7B8A6607D3 for ; Wed, 7 Sep 2016 20:49:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6736029421 for ; Wed, 7 Sep 2016 20:49:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BD0829424; Wed, 7 Sep 2016 20:49:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1318829421 for ; Wed, 7 Sep 2016 20:49:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750772AbcIGUts (ORCPT ); Wed, 7 Sep 2016 16:49:48 -0400 Received: from mail-oi0-f53.google.com ([209.85.218.53]:34588 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756660AbcIGUtr (ORCPT ); Wed, 7 Sep 2016 16:49:47 -0400 Received: by mail-oi0-f53.google.com with SMTP id m11so43514004oif.1 for ; Wed, 07 Sep 2016 13:49:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CSGQEwQKmHoGCWmjTzWSdcIl/KLkIibKbakVRWzgi6c=; b=qr3pov/01/JjVKPxVzpZMX5f2Bhi7g7ht+LfrCelQhqa6+RuZZQ8kvRxBAni/aL72D zbXUjVXLgpD2XjyX07kDURmbtWLwJ1PVmhKBHKoWdD8lzKYBXisblRj6EzFBAOzrvIMN ApQPDq5nhIYs3VG2iz1hYpqXABzqgTMza4tvE5Lc/Jfc67KD9RPpeSpbVJpqeEJBuPjN zoDbJ2LrhDW4pTrFs3i2onP2KoPG874PkSDvPavE4MPS2D+xztUYhYupa3On87zLJ0nR 0DEvNRY3jMu8beGr1/1VAzJjjTeYvcVHzonmZQYtA9k4T4aPfyc8uVtXSiy4zCqyFLHO aRMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CSGQEwQKmHoGCWmjTzWSdcIl/KLkIibKbakVRWzgi6c=; b=EJ6EOhr/SA8As5WvamFxZwAanJdUaHyM5Lp+a2wqzQJU2tFTWYY2MEHNOabtkh17x9 rTflC1x1OUllMDftHM2QIIq6IMUeziel1vf9G/cM9Wv5X9pacXihuQ5R5z7ieqZ6hm9s f1/3WLhTCGtWHbi8KkwcECjz2XPPsQXxBNuoDYsVxrdfaEXHUN764xbmeGONXle37SIZ qNsNuRpvkRJdN+AhlYRSpPHF1q4xamg+UeAIrpX/Tp3YIe1vj+cJt9WuSs3Wsun+O6gt ypqSXbLaBuLOX5mSVXLVPxYcy91WXFJdrsKLefyIoX6PBMFfqFAZa7OFch66IF5lWw36 J23w== X-Gm-Message-State: AE9vXwPsYkAKH75f2qRC0xGEdpLP8XCCbswgibKCsFFGjzw+KsVZDcJkCJzy7G7p1NQlsx+s X-Received: by 10.202.195.1 with SMTP id t1mr41627090oif.144.1473281387006; Wed, 07 Sep 2016 13:49:47 -0700 (PDT) Received: from localhost ([2605:a601:aa9:6620:d4eb:affd:1959:c40a]) by smtp.gmail.com with ESMTPSA id 7sm8006681otf.10.2016.09.07.13.49.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Sep 2016 13:49:46 -0700 (PDT) From: Seth Forshee To: Mimi Zohar Cc: "Eric W. Biederman" , Dmitry Kasatkin , linux-ima-devel@lists.sourceforge.net, linux-ima-user@lists.sourceforge.net, linux-security-module@vger.kernel.org Subject: [RFC 2/2] ima: Allow CAP_SYS_ADMIN in s_user_ns to write IMA xattrs Date: Wed, 7 Sep 2016 15:49:43 -0500 Message-Id: <1473281383-144843-3-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473281383-144843-1-git-send-email-seth.forshee@canonical.com> References: <1473281383-144843-1-git-send-email-seth.forshee@canonical.com> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Seth Forshee --- security/integrity/ima/ima_appraise.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index a13fc6809554..007cea65b5ef 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -353,8 +353,9 @@ void ima_inode_post_setattr(struct dentry *dentry) static int ima_protect_xattr(struct dentry *dentry, const char *xattr_name, const void *xattr_value, size_t xattr_value_len) { + struct inode *inode = d_backing_inode(dentry); if (strcmp(xattr_name, XATTR_NAME_IMA) == 0) { - if (!capable(CAP_SYS_ADMIN)) + if (!ns_capable(inode->i_sb->s_user_ns, CAP_SYS_ADMIN)) return -EPERM; return 1; }