From patchwork Mon Feb 11 16:53:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ignaz Forster X-Patchwork-Id: 10806337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7078313A4 for ; Mon, 11 Feb 2019 16:55:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 603792A45E for ; Mon, 11 Feb 2019 16:55:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 544C32A2A0; Mon, 11 Feb 2019 16:55:11 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 0B4AF2A1AE for ; Mon, 11 Feb 2019 16:55:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727448AbfBKQzK (ORCPT ); Mon, 11 Feb 2019 11:55:10 -0500 Received: from mx2.suse.de ([195.135.220.15]:36172 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726036AbfBKQzK (ORCPT ); Mon, 11 Feb 2019 11:55:10 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6A199ADD8; Mon, 11 Feb 2019 16:55:09 +0000 (UTC) From: Ignaz Forster To: Mimi Zohar , linux-integrity@vger.kernel.org, Miklos Szeredi , linux-unionfs@vger.kernel.org Cc: Fabian Vogt , Ignaz Forster , Fabian Vogt Subject: [PATCH 5/5] Use __vfs_getxattr to get overlayfs xattrs Date: Mon, 11 Feb 2019 17:53:23 +0100 Message-Id: <20190211165323.9369-6-iforster@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190211165323.9369-1-iforster@suse.com> References: <20190211165323.9369-1-iforster@suse.com> Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ignaz Forster In vfs_getxattr a query of "security.selinux" will return "unlabeled", while in __vfs_getxattr -ENODATA will be returned for the same query. This causes a difference in the generated EVM hashes for the file on the underlying file system and overlayfs. Circumvent this by calling __vfs_getxattr directly. Co-developed-by: Fabian Vogt Signed-off-by: Fabian Vogt Signed-off-by: Ignaz Forster --- fs/overlayfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index 3b7ed5d2279c..e2c737936576 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -374,7 +374,8 @@ int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name, ovl_i_dentry_upper(inode) ?: ovl_dentry_lower(dentry); old_cred = ovl_override_creds(dentry->d_sb); - res = vfs_getxattr(realdentry, name, value, size); + res = __vfs_getxattr(realdentry, d_backing_inode(realdentry), + name, value, size); revert_creds(old_cred); return res; }