Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4743140pjb; Mon, 27 Jul 2020 04:07:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVK9ICx+YXYiADWhFPULgttGmezOzFH62E4/sq/+/QopfFyBBKVzEcvYhU/YwO9bs8KAFk X-Received: by 2002:aa7:c3d8:: with SMTP id l24mr20231657edr.97.1595848078699; Mon, 27 Jul 2020 04:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595848078; cv=none; d=google.com; s=arc-20160816; b=RgUxp2fi0DADvk5qsRLv9poPKBXJIWAHclBrId4qVvjfi6NuarU8a0qJpJSWYIKtAC 1WpZmPmvFHvo6O6okEfuqgbe5lWy0eV6+gITL9vIBrmEW4qZuaubzzzikkHHfcow4WWd E2X6Dnd3WfrUlRHScsBhqBmV4mRIr1yNdlTeVgzaIg8402HGronYPIORoZPoKkPMrn2v IxnrmV5tF1rch1ytU2cA0igvTpLOCLCYGArbTydNxE+fQrAju2Su6kGY3ygLbgx8xIAQ +lvWc0IzCUPekCusBXNILinH31HZzv9SwgjD06Vn8M3+dMExFvcslysb7yR37nwCUtd/ xnmw== 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=N8iW/H9w3+t4jIzjIADkZwUcJ/MSGheItPR+O7GljdE=; b=NoFcwxNvBy8QwxOSJ3R/+qBMBIFkkcm5usYHTB68GOHpv2+Sd38vc1ZP9z4aGjPgXY pI01FHAH31msqa2YMHpa6R29AD0S9u0d2w+C2VNDs98NHC5JPLEU0H+pf19TMVxnRFNq o+TcOiznZF1pH3jDEYHvGkXJz7e3ihgds7Rth8phhUNHex0NfkVrrN/t5uWy+7JYm8k9 3Iu2WbTncs5NYYr6ibeuBV/Q5WPwMr8FJVpY1AdfleuHP/QAOmYZLvithdIHXCFjeM93 IqmH4YFEclWYI3GCRvcyftwEuuwz5EcrWNMN47owLfI/SSAjWXO3XgpOREUuMfwpuEFI 2ceA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BOOtDTGz; 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 rh7si3997635ejb.101.2020.07.27.04.07.36; Mon, 27 Jul 2020 04:07:58 -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=BOOtDTGz; 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 S1728385AbgG0K5s (ORCPT + 99 others); Mon, 27 Jul 2020 06:57:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:34104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726324AbgG0K5r (ORCPT ); Mon, 27 Jul 2020 06:57:47 -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 33B532070B; Mon, 27 Jul 2020 10:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595847467; bh=U/1331pETiuwhTM+IUIHu8BPQ+Psbv5olq3HsSqSQj4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=BOOtDTGzLu1hTazCClx7HJFY7Dt9e0BGgjqhW55IgbB7sYLyFJQmkCiZsCNCbcDAN qbhKky3oNrVus9Cyuz3LIUQvJMOg0lqaOeqv0zAxcW3IpJh6GA0wELNna+X8ji8WNE 0goynQGVKw1nTR64C36POjKqj7RQSApbiKx8wIkk= Message-ID: <1595847465.4841.63.camel@kernel.org> Subject: Re: [PATCH v3 12/19] firmware_loader: Use security_post_load_data() From: Mimi Zohar To: Kees Cook , Greg Kroah-Hartman Cc: 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 Date: Mon, 27 Jul 2020 06:57:45 -0400 In-Reply-To: <20200724213640.389191-13-keescook@chromium.org> References: <20200724213640.389191-1-keescook@chromium.org> <20200724213640.389191-13-keescook@chromium.org> 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 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. Mimi