Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp571058ybg; Tue, 28 Jul 2020 13:05:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBMYFt0meQPQL8D2DW7WfCo6AroET+hGjrTXsGYOf0Qc3ETOZ4AyrwXfpKjqabafjverpw X-Received: by 2002:a05:6402:3137:: with SMTP id dd23mr12043389edb.230.1595966752704; Tue, 28 Jul 2020 13:05:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595966752; cv=none; d=google.com; s=arc-20160816; b=FimBlduLByWXMuQeVibJnD6Fc7k86FszdN1Alzgr6p8p104hKdiCOUcW2cbiXxPGhR 9m1weJQCSFNwE1SFG3hyEF3Fv+QE3a9U2Lv0827clvJoDxfbmrrsb0XK0FvOfqf8snD4 lVOwIQGUAkDUxygR2XkihtAlVqtjOrx1ClKbySzCTHVHBStR6WB2lwyW6jr0U3uym/Yr pNkzfGqNKSGpTdY71dMH3ABvKe+aCgwoG+vHRm21DAzDBNnKG/Q+eHv8F7Or9GhgsjXZ UlG18ZTtT8XHodMeg0qLhjwXUcVhZRPMPg33XI1RDnnbqMZabyn2UTiFOZBuOtN5Qpb+ mA9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9heSWvK+yRSCWH0FUufTfQBWh+umkfCd2hlFkX04++k=; b=whs1Kh30bxymiFbgk7KQxnptnWZ51TIzKAukVlJVgaLqE2tVMVDe21UenjGdutzvfg 0EvMgxh6Ts8saUD+qHCpjU3xQCYG85+b4/ISfx5In69USwk2Jr04idYPqlbndrb8XcVX j8iNo+MXygeSUXpGud/kcUDajwtljTDiYVB8DaPWTIFC+/wvFPJnSvFEURN0SF8Po2U2 iH/eIpLFciYNRJZaBZFvTdUfgrgBDAzXg4G1XWg6pcxQm6EOBC/M8DIWXrEK8DvOYpNU DviR/e76Ybk6KzsAZEoeYc+LjS1IOS8ITRvkEaqjxqcloikwx8mSKpJkf58V/LwsQ3vx mFmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nCLucWk+; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k10si9028771ejr.155.2020.07.28.13.05.30; Tue, 28 Jul 2020 13:05:52 -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=@chromium.org header.s=google header.b=nCLucWk+; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732954AbgG1Tn7 (ORCPT + 99 others); Tue, 28 Jul 2020 15:43:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730016AbgG1Tn6 (ORCPT ); Tue, 28 Jul 2020 15:43:58 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA105C0619D4 for ; Tue, 28 Jul 2020 12:43:58 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id r11so3658470pfl.11 for ; Tue, 28 Jul 2020 12:43:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=9heSWvK+yRSCWH0FUufTfQBWh+umkfCd2hlFkX04++k=; b=nCLucWk+Dyfu97vMzTeRd0pPVzYtyDNd2u/hsiI1JS+JNzt9OPNMBUUcXoQPSNKzCE sxgq9zXhcvrt/uWcVzsLxXuu99WkVd+E7Uz7NHGi5XPz9/SV0mWz+0D0XANYFXj7lKbh hrtn+MCSjUVEebJjPSWPZJTk2J/1NZ5OuBXbI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=9heSWvK+yRSCWH0FUufTfQBWh+umkfCd2hlFkX04++k=; b=Chdw3CD2lAUreK6noQYV6U0uy5+eV5Wl09TPTO389x4p8PZyIjQmgOuzU2woXsz93W tUX7+AvYoOQWHl47iQ9jRGsTmqM5vR8k8diRk/KSEYGHJGPaAgbCqZHYRrYqm6Y4CvEe B4uRNYNDfZYY9XED580WthpnKxFaQeJBknYh5nmxhAV8VO0DMnpafE4ng6GsjjZeGeA4 sOTHVxLJ/XBMP2wvwjCsBeZTyBMw62BirW76fREmXcUkPHsaDsZyI5vIhGHohtla4TSj CmQe6S/9RLdvZS/W2VJGtrOoWpX20hNVN3WenQPl5iMW+Gs09pkjO8pTE+oCrYuifhRB wwZQ== X-Gm-Message-State: AOAM5316KXXtARr6Br8qffzfsleOIzKqodejOGDtpH5w3yTJpsDDtFX1 K4nQ/eYwzudTwr75G5Hdu8ZD4A== X-Received: by 2002:aa7:8801:: with SMTP id c1mr25615711pfo.105.1595965438290; Tue, 28 Jul 2020 12:43:58 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id m66sm10017751pfd.90.2020.07.28.12.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 12:43:57 -0700 (PDT) Date: Tue, 28 Jul 2020 12:43:56 -0700 From: Kees Cook To: Mimi Zohar Cc: Greg Kroah-Hartman , Scott Branden , Luis Chamberlain , Jessica Yu , SeongJae Park , KP Singh , linux-efi@vger.kernel.org, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org, selinux@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 12/19] firmware_loader: Use security_post_load_data() Message-ID: <202007281242.B6016AE4B@keescook> References: <20200724213640.389191-1-keescook@chromium.org> <20200724213640.389191-13-keescook@chromium.org> <1595847465.4841.63.camel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1595847465.4841.63.camel@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 27, 2020 at 06:57:45AM -0400, Mimi Zohar wrote: > On Fri, 2020-07-24 at 14:36 -0700, Kees Cook wrote: > > Now that security_post_load_data() is wired up, use it instead > > of the NULL file argument style of security_post_read_file(), > > and update the security_kernel_load_data() call to indicate that a > > security_kernel_post_load_data() call is expected. > > > > Wire up the IMA check to match earlier logic. Perhaps a generalized > > change to ima_post_load_data() might look something like this: > > > > return process_buffer_measurement(buf, size, > > kernel_load_data_id_str(load_id), > > read_idmap[load_id] ?: FILE_CHECK, > > 0, NULL); > > > > Signed-off-by: Kees Cook > > process_measurement() measures, verifies a file signature - ?both > signatures stored as an xattr and as an appended buffer signature - > and augments audit records with the file hash. (Support for measuring, > augmenting audit records, and/or verifying fs-verity signatures has > yet to be added.) > > As explained in my response to 11/19, the file descriptor provides the > file pathname associated with the buffer data. ?In addition, IMA > policy rules may be defined in terms of other file descriptor info - > uid, euid, uuid, etc. > > Recently support was added for measuring the kexec boot command line, > certificates being loaded onto a keyring, and blacklisted file hashes > (limited to appended signatures). ?None of these buffers are signed. > ?process_buffer_measurement() was added for this reason and as a > result is limited to just measuring the buffer data. > > Whether process_measurement() or process_buffer_measurement() should > be modified, needs to be determined. ?In either case to support the > init_module syscall, would at minimum require the associated file > pathname. Right -- I don't intend to make changes to the init_module() syscall since it's deprecated, so this hook is more of a "fuller LSM coverage for old syscalls" addition. IMA can happily continue to ignore it, which is what I have here, but I thought I'd at least show what it *might* look like. Perhaps BPF LSM is a better example. Does anything need to change for this patch? -- Kees Cook