From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E326C433E0 for ; Fri, 7 Aug 2020 14:15:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8067620866 for ; Fri, 7 Aug 2020 14:15:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726242AbgHGOP3 (ORCPT ); Fri, 7 Aug 2020 10:15:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:58244 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726096AbgHGOP2 (ORCPT ); Fri, 7 Aug 2020 10:15:28 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C9D2DAC41; Fri, 7 Aug 2020 14:15:45 +0000 (UTC) Date: Fri, 7 Aug 2020 16:15:24 +0200 From: Petr Vorel To: ltp@lists.linux.it Cc: Lachlan Sneff , Lakshmi Ramasubramanian , Mimi Zohar , linux-integrity@vger.kernel.org, Cyril Hrubis Subject: Re: [PATCH 1/1] IMA/ima_keys.sh Fix policy content check usage Message-ID: <20200807141524.GA3247@dell5510> Reply-To: Petr Vorel References: <20200807112929.8984-1-pvorel@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200807112929.8984-1-pvorel@suse.cz> Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org Hi all, ... > --- a/testcases/kernel/security/integrity/ima/tests/ima_keys.sh > +++ b/testcases/kernel/security/integrity/ima/tests/ima_keys.sh > @@ -16,11 +16,14 @@ TST_NEEDS_DEVICE=1 > # (450d0fd51564 - "IMA: Call workqueue functions to measure queued keys") > test1() > { > - local keyrings keycheck_lines keycheck_line templates test_file="file.txt" > + local keyrings keycheck_lines keycheck_line templates > + local policy="func=KEY_CHECK" > + local test_file="file.txt" > tst_res TINFO "verifying key measurement for keyrings and templates specified in IMA policy file" > - keycheck_lines=$(require_ima_policy_content "func=KEY_CHECK" "") > + require_ima_policy_content $policy > + keycheck_lines=$(check_ima_policy_content $policy "") > keycheck_line=$(echo "$keycheck_lines" | grep "keyrings" | head -n1) While working on this patchset, I wonder, why we don't check for 'func=KEY_CHECK.*keyrings' in single grep call instead of grepping it twice. IMHO single grep call is enough. Or am I missing something? Kind regards, Petr