Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1838420ybh; Mon, 20 Jul 2020 08:24:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOLhB/Nc4pJEhRYnfcSs7n5MH/cPVsW5LNgRuQT4fTjY0PxcdMgZNps7cSM31xkLHoMbsc X-Received: by 2002:a17:906:547:: with SMTP id k7mr20601239eja.287.1595258671583; Mon, 20 Jul 2020 08:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595258671; cv=none; d=google.com; s=arc-20160816; b=mMDFbXMrZsLG+GN2/mZ+dLWMCRk9qZevBYBsyv5s2pun6so4c4kbvbaVLzDC2NpODO dpuDrMw+N7CSZCX50ag+eA4I5oeIFkB6cb9zDEoxlcUSqTvggPN6SkHfMPh//ADG7l7J pfNFjs6o1/2IPlqyjeCBjRuc3OruTDnb7CrxLkZzt7hg1CnTvb061f9Ti0JrUYpp5ZcR c/t3yU3s6mTvzbIWSt9qXAdJ16jHmFQZyMWNzAyvZj7EfpY7pzmYzG/2VTj/eVCVlxT6 x6n6MKcYQaHgosZXu3oPTnifKURVWyy7Vkg6fRKmbbqXC4W0M/HJFWOnELr0PECEmb6g vgFg== 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:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=CqS9U/JNzCSIjXUszMYIcdntol7I0ryQGZZYozavQL4=; b=USQakWePv4V5sQ/RJ5xc5gn/biLkq5jmS7manvaPNSDeOMezknwKFXIuCRhO9AUbDt gBevWtVgehHM1T48SbZPQZ5SU0oA1XHQcrV3WZCSkIxhN8Vs82pk4OoHeJGqCPRgxtuX gc/F9lJHlROlCn64G7lo/LALTjqZZPbo7IFt1/PyOMGRE0M9oe0WKTPU8RV1hfxDJB9S /afA7h5ERXQoBPaRs85flq4IRC3cf71r0F2twYQdLrQBAzwu4Uq/+pCpGXKupaTZGfBi aWksqyVjiVNwom/fyCAatON4Al7wgZOVFjc/okMIEXxBJBgVylDyhC+fQdh7M+dUfojQ la2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b="AE0SG8/E"; 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=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si11214670eds.603.2020.07.20.08.24.09; Mon, 20 Jul 2020 08:24:31 -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=@linux.microsoft.com header.s=default header.b="AE0SG8/E"; 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=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728476AbgGTPX6 (ORCPT + 99 others); Mon, 20 Jul 2020 11:23:58 -0400 Received: from linux.microsoft.com ([13.77.154.182]:47788 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728346AbgGTPX5 (ORCPT ); Mon, 20 Jul 2020 11:23:57 -0400 Received: from prsriva-linux.hsd1.wa.comcast.net (c-24-19-135-168.hsd1.wa.comcast.net [24.19.135.168]) by linux.microsoft.com (Postfix) with ESMTPSA id 1683120B490E; Mon, 20 Jul 2020 08:23:56 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1683120B490E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1595258636; bh=CqS9U/JNzCSIjXUszMYIcdntol7I0ryQGZZYozavQL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AE0SG8/E6wBmbZ4EqTcgPsc6hjDeaH1vCTsOf8jC2XVcGxeWkhxooH74ghblQ5hJQ w+NDu7uzbohe7xPFnD9HKHMhe2w6ObWDc/7CXJ0kveULkpHKRNVBerW0tbkCN8L9IZ Ir1LiFxjj9FHH4Z6+WyIYbfekxzPJ6JJHs8e9K3g= From: Prakhar Srivastava To: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, robh+dt@kernel.org, frowand.list@gmail.com, zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, jmorris@namei.org, serge@hallyn.com, pasha.tatashin@soleen.com, allison@lohutok.net, kstewart@linuxfoundation.org, takahiro.akashi@linaro.org, tglx@linutronix.de, vincenzo.frascino@arm.com, mark.rutland@arm.com, masahiroy@kernel.org, james.morse@arm.com, bhsharma@redhat.com, mbrugger@suse.com, hsinyi@chromium.org, tao.li@vivo.com, christophe.leroy@c-s.fr, gregkh@linuxfoundation.org, nramas@linux.microsoft.com, prsriva@linux.microsoft.com, tusharsu@linux.microsoft.com, balajib@linux.microsoft.com, bauerman@linux.ibm.com, robh@kernel.org Subject: [PATCH V3 4/6] Add support in arm64 to store the memory information of the IMA measurement log in the kimage used for kexec. Date: Mon, 20 Jul 2020 08:23:40 -0700 Message-Id: <20200720152342.337990-5-prsriva@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200720152342.337990-1-prsriva@linux.microsoft.com> References: <20200720152342.337990-1-prsriva@linux.microsoft.com> 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 Store the phyical address and size of the IMA measurement logs that get picked up by the setup_dtb during kexec. Signed-off-by: Prakhar Srivastava --- arch/arm64/include/asm/ima.h | 17 +++++++++++++++++ arch/arm64/include/asm/kexec.h | 3 +++ arch/arm64/kernel/machine_kexec_file.c | 17 +++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 arch/arm64/include/asm/ima.h diff --git a/arch/arm64/include/asm/ima.h b/arch/arm64/include/asm/ima.h new file mode 100644 index 000000000000..70ac39b74607 --- /dev/null +++ b/arch/arm64/include/asm/ima.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_ARCH_IMA_H +#define _ASM_ARCH_IMA_H + +struct kimage; + +#ifdef CONFIG_IMA_KEXEC +int arch_ima_add_kexec_buffer(struct kimage *image, unsigned long load_addr, + size_t size); +#else +static inline int arch_ima_add_kexec_buffer(struct kimage *image, + unsigned long load_addr, size_t size) +{ + return 0; +} +#endif /* CONFIG_IMA_KEXEC */ +#endif /* _ASM_ARCH_IMA_H */ diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h index d24b527e8c00..7bd60c185ad3 100644 --- a/arch/arm64/include/asm/kexec.h +++ b/arch/arm64/include/asm/kexec.h @@ -100,6 +100,9 @@ struct kimage_arch { void *elf_headers; unsigned long elf_headers_mem; unsigned long elf_headers_sz; + + phys_addr_t ima_buffer_addr; + size_t ima_buffer_size; }; extern const struct kexec_file_ops kexec_image_ops; diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c index 361a1143e09e..4c54723e7a04 100644 --- a/arch/arm64/kernel/machine_kexec_file.c +++ b/arch/arm64/kernel/machine_kexec_file.c @@ -38,6 +38,23 @@ const struct kexec_file_ops * const kexec_file_loaders[] = { NULL }; +/** + * arch_ima_add_kexec_buffer - do arch-specific steps to add the IMA buffer + * + * Architectures should use this function to pass on the IMA buffer + * information to the next kernel. + * + * Return: 0 on success, negative errno on error. + */ +int arch_ima_add_kexec_buffer(struct kimage *image, unsigned long load_addr, + size_t size) +{ + image->arch.ima_buffer_addr = load_addr; + image->arch.ima_buffer_size = size; + return 0; +} + + int arch_kimage_file_post_load_cleanup(struct kimage *image) { vfree(image->arch.dtb); -- 2.25.1