Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp914143pxu; Mon, 23 Nov 2020 07:14:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwy3dyIYExkNGSMrrpiPbeVtZpJP7qs7tvd0PRzFUFLAiv+GrQeno9g9HtiJleDCbQ/zOCA X-Received: by 2002:a50:bb25:: with SMTP id y34mr46301894ede.249.1606144473811; Mon, 23 Nov 2020 07:14:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606144473; cv=none; d=google.com; s=arc-20160816; b=KyUfW7Qd839QNlkiOlaKaQstV0oCcPX0EindYr6Y2abzjiFsHsmynk4mKCM8G2MctL PHaU9rCGDUB7UA5I7QPSIq80YVcxE8TDs2ZZ/fM1fjO+UoGSWiAFT6O75RDzQOdX3bAW FJChbi8OOJ/pl9DIqYEotCrSuT9dux6n20hI/TrhPxVQ9yZqioz3X4JieKdHcGNZF/b7 dYO9n1aIymRw4bRh9tNi9ETy9CpmL75RDuRykbQLtpTUWuppTUGY5VOm3HTRvMoQLwhB mLx6fACQsBLeXaGlg4sgeqkcAlrpSPgWnAXQmPBweXwIr/AmBd4tQP0Vi69zhgtp07Xk hEZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=UIFhmGdF1pfMFaT9mYBNCV4Q59iOT78U5d23p3L9Aps=; b=cCQLondOirUUQWtjze9rkier28SeLO/n1WpxylCDZvOGIy7EqAIw7+n0r6NJmjJcxo Lz7Pc69QXJ95ETlPZX7NczIWaFI0ZhE8K/d7ssUceaBW5IKAu81s4kSE+TDaST77Z1JN bgl93jj3SZD9qs2fxtxsy1/aPq/aw3uyGCoxr7c4rjxyRgStFxbexExwdDZ9VSGPvvyz fYJN+LcvrxoxDd6ISY7jkKeJ8Q1l6UPY/E6UodAzDWsmgaAoZ5nnAM22naGTbEmCahaN 1ZzyaO5PO8c0rBkzi6S8PnwheGaJLm4JjYNwRBRGYazvDQvQFiUQ1NWWGs0nNpdizbz7 crfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=AswzMkIZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt10si6756997edb.503.2020.11.23.07.14.08; Mon, 23 Nov 2020 07:14:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=AswzMkIZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389326AbgKWPKy (ORCPT + 99 others); Mon, 23 Nov 2020 10:10:54 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52884 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732025AbgKWPKv (ORCPT ); Mon, 23 Nov 2020 10:10:51 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ANF2IL1069677; Mon, 23 Nov 2020 10:10:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=UIFhmGdF1pfMFaT9mYBNCV4Q59iOT78U5d23p3L9Aps=; b=AswzMkIZ8sf9pvFyoFUCfNh8oEMJ6X0EaoEk/kWKUtl7YeTcgUTriD8zfi0ha+7/amXc /jZNlBJn2ErOkFcXi3G1chcJgSE9sJwYcMgm80fse4wov2Id9aB5xKwmSqMrTGmPDUHn ed7P6fDc/IX23E9Zn80d16U6gscub4Om/p7MSMSIlPHm1Y+7JYK9SP+PpW7Ss1zUKFx5 ZniPymzSGmltghLKG6z/EduZcxQophcjf7Sb9sYCk9DzNnLmjvsFoWDOvi7aqUIuFbqb PCcpTKxL4X5u6byn4alF6BEgDhOVHAjKu28lWOhYEF/IG9bZiDju2EG4tOCc6bU3IKwW tQ== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 34yw5wjjrr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Nov 2020 10:10:34 -0500 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0ANF96va016786; Mon, 23 Nov 2020 15:10:32 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 34xt5hangx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Nov 2020 15:10:32 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ANFAUKN55771624 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Nov 2020 15:10:30 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 08E74A4055; Mon, 23 Nov 2020 15:10:30 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F76CA405D; Mon, 23 Nov 2020 15:10:27 +0000 (GMT) Received: from sig-9-65-241-175.ibm.com (unknown [9.65.241.175]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 23 Nov 2020 15:10:27 +0000 (GMT) Message-ID: <0f54c1636b390689031ac48e32b238a83777e09c.camel@linux.ibm.com> Subject: Re: [PATCH bpf-next v2 3/3] bpf: Update LSM selftests for bpf_ima_inode_hash From: Mimi Zohar To: KP Singh Cc: James Morris , open list , bpf , Linux Security Module list , Yonghong Song , Alexei Starovoitov , Daniel Borkmann , Florent Revest , Brendan Jackman , Petr Vorel Date: Mon, 23 Nov 2020 10:10:26 -0500 In-Reply-To: References: <20201121005054.3467947-1-kpsingh@chromium.org> <20201121005054.3467947-3-kpsingh@chromium.org> <05776c185bdc61a8d210107e5937c31e2e47b936.camel@linux.ibm.com> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.28.5 (3.28.5-12.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-23_11:2020-11-23,2020-11-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=3 adultscore=0 clxscore=1015 spamscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 phishscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011230100 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Cc'ing Petr Vorel] On Mon, 2020-11-23 at 15:06 +0100, KP Singh wrote: > On Mon, Nov 23, 2020 at 2:24 PM Mimi Zohar wrote: > > > > On Sat, 2020-11-21 at 00:50 +0000, KP Singh wrote: > > > From: KP Singh > > > > > > - Update the IMA policy before executing the test binary (this is not an > > > override of the policy, just an append that ensures that hashes are > > > calculated on executions). > > > > Assuming the builtin policy has been replaced with a custom policy and > > CONFIG_IMA_WRITE_POLICY is enabled, then yes the rule is appended. If > > a custom policy has not yet been loaded, loading this rule becomes the > > defacto custom policy. > > > > Even if a custom policy has been loaded, potentially additional > > measurements unrelated to this test would be included the measurement > > list. One way of limiting a rule to a specific test is by loopback > > mounting a file system and defining a policy rule based on the loopback > > mount unique uuid. > > Thanks Mimi! > > I wonder if we simply limit this to policy to /tmp and run an executable > from /tmp (like test_local_storage.c does). > > The only side effect would be of extra hashes being calculated on > binaries run from /tmp which is not too bad I guess? The builtin measurement policy (ima_policy=tcb") explicitly defines a rule to not measure /tmp files. Measuring /tmp results in a lot of measurements. {.action = DONT_MEASURE, .fsmagic = TMPFS_MAGIC, .flags = IMA_FSMAGIC}, > > We could do the loop mount too, but I am guessing the most clean way > would be to shell out to mount from the test? Are there some other examples > of IMA we could look at? LTP loopback mounts a filesystem, since /tmp is not being measured with the builtin "tcb" policy. Defining new policy rules should be limited to the loopback mount. This would pave the way for defining IMA- appraisal signature verification policy rules, without impacting the running system. Mimi