Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1668194rwb; Thu, 15 Dec 2022 12:51:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf5NKWbZeiVLs4JELHkvD9vKg9WxDt1KmkfpSOE2FTEQ4dlF2E2gmAUb1fY1DyQcwfH+f+z8 X-Received: by 2002:a17:906:1d01:b0:7c1:36:9002 with SMTP id n1-20020a1709061d0100b007c100369002mr24847532ejh.67.1671137490560; Thu, 15 Dec 2022 12:51:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671137490; cv=none; d=google.com; s=arc-20160816; b=l/KJNPRiJiYhQza2llnv27qmlOMHagLUUrkOQCIa7VMaJ0O82g0Eujyby4ZZt9Cb1v vAs3DXGgT08d1/LxVNU1go5GezskFJx/CKJ6cTNDKqEmgul0ZEO/qZCWjzt9w21rcKoJ AAcZu4Rwo5AWcoPqeypnYzwv8yALBesNANOItN5eYsT9Gzz5+FBUhnh19c309wye3Jy/ U6+WMI1p6M/1tgYbhTjfSM6dhaPRrl+dYGR+gSUW0FpxZPvzE10RnrQ1TP908Cf4dKBW e3S8ErkD7pFn+3ZxLbjr+pmrLayYPjH/70sp1ayWg7zC9Z17nF7Gjl2EprZmZ+uIi0rZ AEmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=E4naCWagDDNWcJfZ4giahWBUN8Tiu/D+CnkJXaoCn4I=; b=R/Fl9A4ADmqXrrV3aLrL2PseZYhJM8kMb1boStyXyz2xzNOMhI1BKck/C+YbYX42kA z4/E1AvewRMRlgWK/ca9upa8Y/17WqEoBEVcRbslX5ufTGwrGQRw3xiVMDgADA0qNA7u BcWVrfvY67QoJxOywNDqAT4MG+ZQ6FblNXaf8MxxFcQaqyQqSv96HnixR39J9y7wFZYO uwkBACWuZaAaNXwbXiuAeHfVXsvveTyoT8BzIVGM67thwm3FNt9O0pKSrzt4kZ53p9H5 q6+JXvmSBpd8bC2HqtK7yXxo1lP21eUkp9HlKjiMQpMmWAmRwLYxiBjeDMFGZ8sMawVx +tTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=LjjqHVVB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji11-20020a170907980b00b007806c141214si275989ejc.153.2022.12.15.12.51.13; Thu, 15 Dec 2022 12:51:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=LjjqHVVB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229488AbiLOUQW (ORCPT + 68 others); Thu, 15 Dec 2022 15:16:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiLOUQP (ORCPT ); Thu, 15 Dec 2022 15:16:15 -0500 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D76FA32B86 for ; Thu, 15 Dec 2022 12:16:14 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id b12so373903pgj.6 for ; Thu, 15 Dec 2022 12:16:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=E4naCWagDDNWcJfZ4giahWBUN8Tiu/D+CnkJXaoCn4I=; b=LjjqHVVBowUybQjG82rnjJe+F8hs1qicEYul58tnTyt23xDcn2E0r4inwVLRfydSHc C9a35wJ651tp7QQB6uOkFi1wXA3qIIVZsmH4XubLF9bUEItPe3bhh260zxE239dBYUsJ VHKmhzKdkZT134gwNk1FjGgMrA9+Ol2xZI9q/yijm65h4F8Tzhjn3bMpb9shazrkhK6+ RiBLxadlYztFtdvqO918dlZwLjdUjkP8I5E6QfcmX1fFyJydKoh9WKRCVuRlnVpUXyeP SWfIb/hAmtfXHvdZQSJWQid0+pfH9b7T8KGxZP4h++RtfdqcnufOc9PpXDGUs2fuSPjy xFEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=E4naCWagDDNWcJfZ4giahWBUN8Tiu/D+CnkJXaoCn4I=; b=uj1Ef311puePAnwrYsdM1QBa3tw5OjR12objnLYnPPgUTV2s8mZ7E8I1JDwhWTy4bQ jG4PljhA48KWFaKBf2PXQIAUsZz5Bd0OgVOjZtuVfH6szespZe1O1uPBPRr7fOQShHsy 2OTkt5ZGrofG3cWbecud2bQo3aVBTgV7xEQsVf3wBnZO1+xvWqCwDeSm1UubK8ABKv2G LwL05TNzzS8ClYQAGk7RmVThC8jtWdayXMuMBXKTC4cRmdXx+gU8NQ28ipBdRhdT1NFm npUX8zJKk3f6cZkHvmz7lYqH1OlXpXn6XQToYUExbd82Nz3eQ2psnMkotM+sZFMDCRqI COkQ== X-Gm-Message-State: ANoB5pmPW9WY37L11K2TNUIDjo+LpUSIoZQkTS3Jx1RON449IK6IwZwx 3pFRNp2SiwPdEe1+l+mlblRHAyVaB7ULoAECNXkqvBw+RrAt X-Received: by 2002:a63:64c5:0:b0:479:2109:506 with SMTP id y188-20020a6364c5000000b0047921090506mr1313297pgb.92.1671135374221; Thu, 15 Dec 2022 12:16:14 -0800 (PST) MIME-Version: 1.0 References: <20221209195453.never.494-kees@kernel.org> <20221212211319.GA15511@mail.hallyn.com> <202212132006.F29BB81A@keescook> In-Reply-To: <202212132006.F29BB81A@keescook> From: Paul Moore Date: Thu, 15 Dec 2022 15:16:03 -0500 Message-ID: Subject: Re: [PATCH] LoadPin: Ignore the "contents" argument of the LSM hooks To: Kees Cook Cc: "Serge E. Hallyn" , James Morris , linux-security-module@vger.kernel.org, Mimi Zohar , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 13, 2022 at 11:06 PM Kees Cook wrote: > On Mon, Dec 12, 2022 at 03:13:19PM -0600, Serge E. Hallyn wrote: > > On Fri, Dec 09, 2022 at 11:54:57AM -0800, Kees Cook wrote: > > > LoadPin only enforces the read-only origin of kernel file reads. Whether > > > or not it was a partial read isn't important. Remove the overly > > > conservative checks so that things like partial firmware reads will > > > succeed (i.e. reading a firmware header). > > > > > > Fixes: 2039bda1fa8d ("LSM: Add "contents" flag to kernel_read_file hook") > > > Cc: Paul Moore > > > Cc: James Morris > > > Cc: "Serge E. Hallyn" > > > > Acked-by: Serge Hallyn > > > > Seems reasonable. > > Thanks! > > > So the patch which introduced this was > > 2039bda1f: LSM: Add "contents" flag to kernel_read_file hook > > It sounds like the usage of @contents which it added to ima still > > makes sense. But what about the selinux_kernel_read_file() one? > > I think those continue to make sense since those LSM may be sensitive to > the _content_ (rather than the _origin_) of the file. Agreed. When @contents is false SELinux does a permission check between the calling process and itself, but when @contents is true it performs a check between the calling process and the file being read. -- paul-moore.com