Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp857663ybk; Wed, 13 May 2020 15:14:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziPUuDtcQEAmZvDFj12ecfA/resacjJWR/4VYZMMPgvu0w4+r6VA5hRfMkO096bJdH/VMO X-Received: by 2002:aa7:dbc3:: with SMTP id v3mr1588399edt.103.1589408055221; Wed, 13 May 2020 15:14:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589408055; cv=none; d=google.com; s=arc-20160816; b=jc9wABy00GAu8r5BFEwGj9NgWg+xZ5z6ZHfB6R97660dk5kSPgm/KcoakRz265krSi v1hHJTfJU9rryHToYTs80n8cEucnGZmuvFsaAiPkJQtz4P1xhBqFwKHDK3Fk3GfSK6y7 QFTMIPmrcMz3QJ/XrwB2/C4F3kiCODNGk+T0dXinSXsRZeJCKUAqg8jS5GPIc/kV9kyr 3z+MVMMGol/tLxHPs9c85puiriONOiCcT9ehP0Hd5bdLfRj9RSj/M6zExil+YCvN/jUh a0FNI8UkI6qKQl2AygQ0whbfNDdAZvqC4pMwba/7R7a9hr48SRHdRwMGApZ4AteJRiBx jW7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=voIN9IcS4RQlKkk4srWHv+UkLkvxDbxeRdLu6P/kwXg=; b=jvU+KAt+bObJwCC5sLFy1i4VULgdTUXuV3yrk1AO5ItU+HN8LWmVWY+PBFiGZ5j46D AGj3pLZm/d3xkfiKV+9+PrzkFVUDje8OAFSL7z0arz7GfKLd7noGe/Bt6MP4pWVszLli AMwBhd63XULaQvcl43EQ7p1FDPwmv7tRw5REmvcTVEadnXcbWVerL+m4pyY1Yig1xftE 1dbgh+CdGdVH38GrIci/84Ug+9gQiYo3yoLHgbJP2/7xWmELoK1Dd/VVdmKbuzwEyJ0i ChXXRkpDOfh+UEAfCm6Am36SsNc5JSOol5x/GtKXGO4P7hB7QFnYMJAoiEnZmFrAeUPh RQsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QnPxg2o6; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si674681ejl.473.2020.05.13.15.13.51; Wed, 13 May 2020 15:14:15 -0700 (PDT) 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=@kernel.org header.s=default header.b=QnPxg2o6; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730757AbgEMWMJ (ORCPT + 99 others); Wed, 13 May 2020 18:12:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:41886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730064AbgEMWMI (ORCPT ); Wed, 13 May 2020 18:12:08 -0400 Received: from localhost.localdomain (pool-96-246-152-186.nycmny.fios.verizon.net [96.246.152.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D8BC2205ED; Wed, 13 May 2020 22:12:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589407927; bh=GV/563MM7mfJ5kgZQMtPYK3qifQTKvZPMYMdtCfkpg4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=QnPxg2o6WRGBCwquEmJwsTp9lab8RyunbaH6LJWNZVMAa+vsaO6yi1Gh/WhPrcSaB hPLr7mpacQrrP+TT/6Fz0YhgShEVqUV9yZY1x46w+KlFOdGienxqLp8Trk96SbD4Ep u6J8Ozjqn/PIgG9D3/Bf5UaKrfeaywoNQfJJhUEo= Message-ID: <1589407924.5098.208.camel@kernel.org> Subject: Re: [PATCH v5 1/7] fs: introduce kernel_pread_file* support From: Mimi Zohar To: Luis Chamberlain Cc: Scott Branden , Greg Kroah-Hartman , David Brown , Alexander Viro , Shuah Khan , bjorn.andersson@linaro.org, Shuah Khan , Arnd Bergmann , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-fsdevel@vger.kernel.org, BCM Kernel Feedback , Olof Johansson , Andrew Morton , Dan Carpenter , Colin Ian King , Kees Cook , Takashi Iwai , linux-kselftest@vger.kernel.org, Andy Gross , linux-security-module , linux-integrity Date: Wed, 13 May 2020 18:12:04 -0400 In-Reply-To: <20200513212847.GT11244@42.do-not-panic.com> References: <20200508002739.19360-1-scott.branden@broadcom.com> <20200508002739.19360-2-scott.branden@broadcom.com> <1589395153.5098.158.camel@kernel.org> <0e6b5f65-8c61-b02e-7d35-b4ae52aebcf3@broadcom.com> <1589396593.5098.166.camel@kernel.org> <1589398747.5098.178.camel@kernel.org> <1589404814.5098.185.camel@kernel.org> <20200513212847.GT11244@42.do-not-panic.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-05-13 at 21:28 +0000, Luis Chamberlain wrote: > On Wed, May 13, 2020 at 05:20:14PM -0400, Mimi Zohar wrote: > > On Wed, 2020-05-13 at 12:41 -0700, Scott Branden wrote: > > > > > > On 2020-05-13 12:39 p.m., Mimi Zohar wrote: > > > > On Wed, 2020-05-13 at 12:18 -0700, Scott Branden wrote: > > > >> On 2020-05-13 12:03 p.m., Mimi Zohar wrote: > > > >>> On Wed, 2020-05-13 at 11:53 -0700, Scott Branden wrote: > > > >> Even if the kernel successfully verified the firmware file signature it > > > >> would just be wasting its time.  The kernel in these use cases is not always > > > >> trusted.  The device needs to authenticate the firmware image itself. > > > > There are also environments where the kernel is trusted and limits the > > > > firmware being provided to the device to one which they signed. > > > > > > > >>> The device firmware is being downloaded piecemeal from somewhere and > > > >>> won't be measured? > > > >> It doesn't need to be measured for current driver needs. > > > > Sure the device doesn't need the kernel measuring the firmware, but > > > > hardened environments do measure firmware. > > > > > > > >> If someone has such need the infrastructure could be added to the kernel > > > >> at a later date.  Existing functionality is not broken in any way by > > > >> this patch series. > > > > Wow!  You're saying that your patch set takes precedence over the > > > > existing expectations and can break them. > > > Huh? I said existing functionality is NOT broken by this patch series. > > > > Assuming a system is configured to measure and appraise firmware > > (rules below), with this change the firmware file will not be properly > > measured and will fail signature verification. > > > > Sample IMA policy rules: > > measure func=FIRMWARE_CHECK > > appraise func=FIRMWARE_CHECK appraise_type=imasig > > Would a pre and post lsm hook for pread do it? IMA currently measures and verifies the firmware file signature on the post hook.  The file is read once into a buffer.  With this change, IMA would need to be on the pre hook, to read the entire file, calculating the file hash and verifying the file signature.  Basically the firmware would be read once for IMA and again for the device. Mimi