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=-3.8 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 807A5C4727C for ; Thu, 1 Oct 2020 07:26:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 46A3C21481 for ; Thu, 1 Oct 2020 07:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725892AbgJAH0k (ORCPT ); Thu, 1 Oct 2020 03:26:40 -0400 Received: from mx2.suse.de ([195.135.220.15]:56300 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725878AbgJAH0k (ORCPT ); Thu, 1 Oct 2020 03:26:40 -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 0AD74ACD8; Thu, 1 Oct 2020 07:26:39 +0000 (UTC) Date: Thu, 1 Oct 2020 09:26:37 +0200 From: Petr Vorel To: Mimi Zohar Cc: ltp@lists.linux.it, Mimi Zohar , Lakshmi Ramasubramanian , linux-integrity@vger.kernel.org Subject: Re: [PATCH v4 4/4] ima_tpm.sh: Fix calculating PCR aggregate Message-ID: <20201001072637.GA32109@dell5510> Reply-To: Petr Vorel References: <20200930160214.29358-1-pvorel@suse.cz> <20200930160214.29358-5-pvorel@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org Hi Mimi, > > > +get_pcr10_aggregate() > > +{ > > + local params pcr > > + local msg="$ERRMSG_EVMCTL" > > + local res=TCONF > > + > > + if [ -z "$MISSING_EVMCTL" ]; then > > + params="--ignore-violations" <=== > Violations should cause the measurement list verification to fail. I didn't get this one. the idea is: TCONF for old evmctl version (failure can be caused by old version, but TFAIL for new version). > > + msg= > > + res=TFAIL > > + elif check_ima_policy_cmdline "tcb"; then > > + tst_res TCONF "using builtin IMA TCB policy $ERRMSG_EVMCTL" > > + return > > + fi > > + > > + evmctl -v ima_measurement $params $BINARY_MEASUREMENTS > hash.txt 2>&1 > > + if [ $? -ne 0 -a -z "$MISSING_EVMCTL" ]; then > > + tst_res TFAIL "evmctl failed $ERRMSG_EVMCTL" > > + tst_res TINFO "hash file:" > > + cat hash.txt >&2 > > + return > > + fi > > + > > + pcr=$(grep -E "^($ALGORITHM: )*PCRAgg.*:" hash.txt \ > The IMA measurement list may contain records for other PCR 10. The > output may contain other PCRs. Using "PCRAgg.*10:" is safer. > Probably need to use "grep -m 1 -E" as well. +1 good point. Kind regards, Petr