From patchwork Wed Jan 16 02:57:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia Zhang X-Patchwork-Id: 10765377 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 DD3E713B4 for ; Wed, 16 Jan 2019 02:59:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC6642CE4B for ; Wed, 16 Jan 2019 02:59:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFD042CE6E; Wed, 16 Jan 2019 02:59:50 +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,UNPARSEABLE_RELAY 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 682C82CE4B for ; Wed, 16 Jan 2019 02:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730775AbfAPC7u (ORCPT ); Tue, 15 Jan 2019 21:59:50 -0500 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:34421 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729852AbfAPC7u (ORCPT ); Tue, 15 Jan 2019 21:59:50 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R381e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01451;MF=zhang.jia@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TIKMQge_1547607466; Received: from localhost(mailfrom:zhang.jia@linux.alibaba.com fp:SMTPD_---0TIKMQge_1547607466) by smtp.aliyun-inc.com(127.0.0.1); Wed, 16 Jan 2019 10:57:47 +0800 From: Jia Zhang To: pvorel@suse.cz, zohar@linux.ibm.com Cc: linux-integrity@vger.kernel.org, ltp@lists.linux.it, zhang.jia@linux.alibaba.com Subject: [PATCH v3 4/6] ima: Code cleanup Date: Wed, 16 Jan 2019 10:57:39 +0800 Message-Id: <1547607461-11233-5-git-send-email-zhang.jia@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1547607461-11233-1-git-send-email-zhang.jia@linux.alibaba.com> References: <1547607461-11233-1-git-send-email-zhang.jia@linux.alibaba.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 - Change the legacy function name from PATH_CHECK to FILE_CHECK. - Use the variable IMA_POLICY instead of hard code path. Signed-off-by: Jia Zhang Reviewed-by: Mimi Zohar --- testcases/kernel/security/integrity/ima/policy/measure.policy | 2 +- testcases/kernel/security/integrity/ima/policy/measure.policy-invalid | 2 +- testcases/kernel/security/integrity/ima/tests/ima_policy.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/security/integrity/ima/policy/measure.policy b/testcases/kernel/security/integrity/ima/policy/measure.policy index c68e722..9976ddf 100644 --- a/testcases/kernel/security/integrity/ima/policy/measure.policy +++ b/testcases/kernel/security/integrity/ima/policy/measure.policy @@ -13,4 +13,4 @@ dont_measure fsmagic=0x01021994 dont_measure fsmagic=0x73636673 measure func=FILE_MMAP mask=MAY_EXEC measure func=BPRM_CHECK mask=MAY_EXEC -measure func=PATH_CHECK mask=MAY_READ uid=0 +measure func=FILE_CHECK mask=MAY_READ uid=0 diff --git a/testcases/kernel/security/integrity/ima/policy/measure.policy-invalid b/testcases/kernel/security/integrity/ima/policy/measure.policy-invalid index e406757..04dff89 100644 --- a/testcases/kernel/security/integrity/ima/policy/measure.policy-invalid +++ b/testcases/kernel/security/integrity/ima/policy/measure.policy-invalid @@ -13,4 +13,4 @@ dont_measure fsmagic=0x01021994 dnt_measure fsmagic=0x73636673 measure func=FILE_MMAP mask=MAY_EXEC measure func=BPRM_CHECK mask=MAY_EXEC -measure func=PATH_CHECK mask=MAY_READ uid=0 +measure func=FILE_CHECK mask=MAY_READ uid=0 diff --git a/testcases/kernel/security/integrity/ima/tests/ima_policy.sh b/testcases/kernel/security/integrity/ima/tests/ima_policy.sh index 64aa8cb..a0c7869 100755 --- a/testcases/kernel/security/integrity/ima/tests/ima_policy.sh +++ b/testcases/kernel/security/integrity/ima/tests/ima_policy.sh @@ -28,7 +28,7 @@ check_policy_writable() { local err="IMA policy already loaded and kernel not configured to enable multiple writes to it (need CONFIG_IMA_WRITE_POLICY=y)" - [ -f /sys/kernel/security/ima/policy ] || tst_brk TCONF "$err" + [ -f $IMA_POLICY ] || tst_brk TCONF "$err" # CONFIG_IMA_READ_POLICY echo "" 2> log > $IMA_POLICY grep -q "Device or resource busy" log && tst_brk TCONF "$err"