From patchwork Fri Nov 3 20:18:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kurinnoi X-Patchwork-Id: 10041147 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 8BE3F602D8 for ; Fri, 3 Nov 2017 20:18:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F3742967C for ; Fri, 3 Nov 2017 20:18:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74064298C8; Fri, 3 Nov 2017 20:18:56 +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=-6.3 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 630B8296A8 for ; Fri, 3 Nov 2017 20:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754036AbdKCUSy (ORCPT ); Fri, 3 Nov 2017 16:18:54 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:45308 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750772AbdKCUSw (ORCPT ); Fri, 3 Nov 2017 16:18:52 -0400 Received: by mail-lf0-f67.google.com with SMTP id n69so4468017lfn.2 for ; Fri, 03 Nov 2017 13:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:subject:message-id:mime-version :content-transfer-encoding; bh=lqjcUT7f61g5Ltl+Sdj+bJmC6/nHms0aBsqTuTdNToU=; b=AUeUOPuTWJvI6ROXTOxipKbs+ictWO+Yrf1LJ9rE+9m0zh1rxYRYP3ypTBHBgPBMEx mFYudHpIxL9A5rqTt8qlfsyLt1iGS77vqx4QYpTfhaW3TscylpJwNGa6HWQKwvqMnNSa 4+BcCJH9r+3FYItUAIfKsxHqDfT83QhuVwMC7SUsMLpXm69tJgnNaLTTI7KM+RHDZ5mk B11o68FygqG4F1XdF9EOUnpa5vnJYb5JgYtuCePMIsDFASfXhGq0iBKekNR2xj1LVaoV yBsx/5rim2UBLnUG5Zn0yVxrbphqhwuFymByUNrV2YzCbqiunitpfV6KR4QKujac9xYB D/kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:subject:message-id :mime-version:content-transfer-encoding; bh=lqjcUT7f61g5Ltl+Sdj+bJmC6/nHms0aBsqTuTdNToU=; b=eaF5+ZccC/inkAnoT6zM6Se6P04ihsxYl/eJrPq7RMks4SJe2++X5PSf4cFKl2TbN+ P93bHpJ7Mf5LgTSx7RB4TRbbDrzMM8piwNEjsF1erGtnnfYwvarH5IQ4hnUcQQ70G7v2 HlJUo42H6d3kwKLqw0pr7CTH1oVv5TLOs1qrkgxUTLO4vebAKozoIkCDX72r61DJNa48 3SEbc57Eo39LDG9T1dJcmp0Wx4QWAOYokEqOjMWxAODGPIwDcwHCvce5BmKV4ywJVvjz 82OrXCyv98TBnUOuIKsLv3bJzdbH489ZnQGgHEADgSG7Y7sGU6d3I6UlBg5LyBW8R7KH E2xw== X-Gm-Message-State: AMCzsaUZ1MgcsPAY/1/JaoFabK/HVtYwut8K4C06bOwV1rAJwJVmjn7P 6Z/9QRrHC5dCKHcaRLYMYfnW3pY0 X-Google-Smtp-Source: ABhQp+Q9SZN3oUsOp/zp5GLA0mwkvpzOSVUYwhTqpwuKa31ENh4sUjAO0PaT1SZjvsTw1vPSBtVM4Q== X-Received: by 10.46.91.138 with SMTP id m10mr3641796lje.95.1509740331112; Fri, 03 Nov 2017 13:18:51 -0700 (PDT) Received: from totoro ([83.217.199.75]) by smtp.gmail.com with ESMTPSA id r2sm1165494lff.62.2017.11.03.13.18.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Nov 2017 13:18:50 -0700 (PDT) Date: Fri, 3 Nov 2017 23:18:49 +0300 From: Mikhail Kurinnoi To: linux-integrity@vger.kernel.org, Mimi Zohar Subject: [PATCH] evm: return the real setxattr/removexattr failure status for inode without xattr support Message-ID: <20171103231849.0fb36c15@totoro> MIME-Version: 1.0 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 This patch provide changes in order to return the real setxattr/removexattr failure status for inode without xattr support. Signed-off-by: Mikhail Kurinnoi security/integrity/evm/evm_main.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index 9826c02e2db8..ca412d65a416 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c @@ -294,8 +294,7 @@ static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name, if (!posix_xattr_acl(xattr_name)) return 0; evm_status = evm_verify_current_integrity(dentry); - if ((evm_status == INTEGRITY_PASS) || - (evm_status == INTEGRITY_NOXATTRS)) + if (evm_status == INTEGRITY_NOXATTRS) return 0; goto out; } @@ -319,12 +318,15 @@ static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name, -EPERM, 0); } out: - if (evm_status != INTEGRITY_PASS) - integrity_audit_msg(AUDIT_INTEGRITY_METADATA, d_backing_inode(dentry), - dentry->d_name.name, "appraise_metadata", - integrity_status_msg[evm_status], - -EPERM, 0); - return evm_status == INTEGRITY_PASS ? 0 : -EPERM; + if ((evm_status == INTEGRITY_PASS) || + (evm_status == INTEGRITY_UNKNOWN)) + return 0; + + integrity_audit_msg(AUDIT_INTEGRITY_METADATA, d_backing_inode(dentry), + dentry->d_name.name, "appraise_metadata", + integrity_status_msg[evm_status], + -EPERM, 0); + return -EPERM; } /**