Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp891944imc; Mon, 11 Mar 2019 01:35:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdJ3FS3Jcp7VomrtUFx1rOxVTWPWF/SmnCNcSX0fOtmwGaoOor2K8Sk+J5NsvRQrNzFrqZ X-Received: by 2002:aa7:81c5:: with SMTP id c5mr32787772pfn.217.1552293302364; Mon, 11 Mar 2019 01:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552293302; cv=none; d=google.com; s=arc-20160816; b=EWYzu7c/w9ib3X01JIOQXsy6aRoIwdBTPeGJ1QQXlO2pOoMcPVGiOtvH4K4i5hh+dJ 9IFEaZZeT3gs3r4FSKPHD9Hfx05S+0fFsNCaD81/4laM/X4jnSbmmFKDSL/1Aa7PpieI SZJ0HAYCjPO/w8zryJX61+xZQ6VXWuFlVRQuoZjEMSlrs2knhMCiR8r+lhzIxfI0C/BR CHG5wuiUnYkiuBvDEWo27RgGbpnZwPZfHtgOtfrEVgaPftYSfMTQPk7+J3AirJUjOpvg keGqKm+BvsdjvfDuC8QfQ5tRjPj1Wo02ZAzDpbrvI66tgkDwzLTM9EyLaYknn8ffJl/8 QPXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date; bh=6+j59VOLqh1ZKPRb7f7EwXo7JxXdE7pybWlS1UMckqY=; b=WG3R5Zr1nMmZCtt4cTzu1rSNqDheQNG3q0rLNO2cjGgwlAPrRUWxRsjr8OkOoXvu0g q5pCNKwMLOQ9+s23dmhcirA6wGKkJ9OcC3DN02bPzURsQMQonmWkOMazNCT+NyNtuNRv WanIRBIvjwPSdtnB9QvoHAvesU2Y4nqAptpfshCvsx3gdFxlFtrzhp14m9Ang0PagYaJ 2bf3rC+XhBOM8TMlThkJp0+4e7GX9idiQK+UX6IIHsG1IZvEwNYQWsy0nuw/JPelycRc jf3nsQXNjRhQyq76nOPGaUmU6RLxuVSpgJGe6RFngo7Oq+oGkLsV1gz47lI+Z0/RH8Lc zWnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si4590884pfj.144.2019.03.11.01.34.46; Mon, 11 Mar 2019 01:35:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726914AbfCKIeV (ORCPT + 99 others); Mon, 11 Mar 2019 04:34:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:37642 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725839AbfCKIeV (ORCPT ); Mon, 11 Mar 2019 04:34:21 -0400 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 0B78CAE30; Mon, 11 Mar 2019 08:34:20 +0000 (UTC) Date: Mon, 11 Mar 2019 09:34:17 +0100 From: Petr Vorel To: Mimi Zohar Cc: linux-kselftest@vger.kernel.org, Shuah Khan , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/5] selftests/ima: kexec_file_load syscall test Message-ID: <20190311083417.GA13067@x230> Reply-To: Petr Vorel References: <1551223620-11586-1-git-send-email-zohar@linux.ibm.com> <1551223620-11586-5-git-send-email-zohar@linux.ibm.com> <20190228220039.GC20335@dell5510> <1552240104.5062.10.camel@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1552240104.5062.10.camel@linux.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mimi, > On Thu, 2019-02-28 at 23:00 +0100, Petr Vorel wrote: > > > + local keypair1="$2" > > > + local keypair2="$3" > > > + > > > + mount_securityfs > > > + > > > + local ima_policy=$SECURITYFS/ima/policy > > > + if [ ! -e $ima_policy ]; then > > > + log_fail "$ima_policy not found" > > > + fi > > > + > > > + if [ -n $keypair2 ]; then > > > + grep -e "^$action.*$keypair1" "$ima_policy" | \ > > > + grep -q -e "$keypair2" > > > + else > > > + grep -q -e "^$action.*$keypair1" "$ima_policy" > > > + fi > > > + > > > + [ $? -eq 0 ] && ret=1 || ret=0 > > > + return $ret > > return $? is enough here (+ ret was not defined as local and mixing tabs with spaces) > "grep -q" exits with zero if any match is found. ?This line inverts > the result so that 1 is returned for found. Right. Sorry for wrong report :). > ?v3 will make "ret" local and fix the tabs/spaces. > Mimi Kind regards, Petr