Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp649172pxu; Fri, 4 Dec 2020 11:56:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxaig1s5LgHXck8y1rMS9a5o0MEfB28LKxLTZOdisjGuTt+pEwspjiI4TBcF5miipNt3DF5 X-Received: by 2002:a17:906:304c:: with SMTP id d12mr8935555ejd.84.1607111798146; Fri, 04 Dec 2020 11:56:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607111798; cv=none; d=google.com; s=arc-20160816; b=jEtowUyUGDTglZ1G6zoAPeV3enKFLJ6wzV6aP3dJhXp34m0uiUuZHV6ZVdz5RC8YQR Fz2JlD9ScBzjnci5UylcGoIQX3wDoQoGoxfnTuU3b97t6sZVR8QhvsNKW9ZH8yGgauHv wqQ5hhzysTIJDXCdFCtXMV6KqFrtnHzf8AF8bDATc7KYCBcg/Jp4oHxZMTeFCLf9lGQY sjtnbic8DoWgCJnJbjS9eicoiZXqkvN8c4nXvDz0ZGf5hnPvs0S9RMpPRdq0nxmjOye2 9V85axA6k2auLRdYIgdEwuzly4merw7X4b/9MugewWn9srBSfvKmSJilh2SUbDwlAbTI KVnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=RYcDmiClExarWqft2RPrsbd40L4/wuzZPH77VZjBycQ=; b=q0PoajXMEk2RSII1xmuqyNJ94eigdMiKj+X9fHuumElb0OMt2EGCRXvuM80z6mDEqy K4wKNJS4E9cwdHrdMiLzxsdoSQtVc1g7CwOBoquunAQGQLm6vkuRn7Xr8N0uwYC14lV7 uep9/A2S0hY63LJVDg5+faeJeF9DhZmUTF0qBdLhcavMprvh51g9xDi1rEOD1k67qlK0 HIYb+Ntvtusfl2cnhyha2SHwWVMOHcEGofhn8LjnT66zHveW3NysmaCmL5Bw8SilKIX/ /tOvQsXhWRNAkKwqstCMG9s/0xCTwXZ0dnjtrourkgObku+L7PWsR4LyGodlN4qfNwEd Mi8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=s1qEpeOQ; 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 nq7si2045302ejb.109.2020.12.04.11.56.15; Fri, 04 Dec 2020 11:56:38 -0800 (PST) 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=s1qEpeOQ; 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 S2387922AbgLDTxT (ORCPT + 99 others); Fri, 4 Dec 2020 14:53:19 -0500 Received: from linux.microsoft.com ([13.77.154.182]:52950 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727877AbgLDTxR (ORCPT ); Fri, 4 Dec 2020 14:53:17 -0500 Received: from localhost.localdomain (c-73-42-176-67.hsd1.wa.comcast.net [73.42.176.67]) by linux.microsoft.com (Postfix) with ESMTPSA id 0001720B718C; Fri, 4 Dec 2020 11:51:59 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0001720B718C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1607111520; bh=RYcDmiClExarWqft2RPrsbd40L4/wuzZPH77VZjBycQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s1qEpeOQTXn69iJ45FIdvBMZ2l4FJD8AfFgq9DYqKyOk5uSyHuj0Tg4FC+iTFebQH DKhJz7gaGU1/+rpDiYUr7awiNGOyYbAkK6pMdJ0HqI3vT6E5YzNhZ130Lipj+xZx3Q tYS4dIun10H4ziTrz+9I7z4hqzjqa1/rMch2g7Pc= From: Lakshmi Ramasubramanian To: zohar@linux.ibm.com, bauerman@linux.ibm.com, robh@kernel.org, gregkh@linuxfoundation.org, james.morse@arm.com, catalin.marinas@arm.com, sashal@kernel.org, will@kernel.org, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, robh+dt@kernel.org, frowand.list@gmail.com, vincenzo.frascino@arm.com, mark.rutland@arm.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, masahiroy@kernel.org, bhsharma@redhat.com, mbrugger@suse.com, hsinyi@chromium.org, tao.li@vivo.com, christophe.leroy@c-s.fr Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, prsriva@linux.microsoft.com, balajib@linux.microsoft.com Subject: [PATCH v10 7/8] powerpc: Move arch_ima_add_kexec_buffer to ima Date: Fri, 4 Dec 2020 11:51:48 -0800 Message-Id: <20201204195149.611-8-nramas@linux.microsoft.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204195149.611-1-nramas@linux.microsoft.com> References: <20201204195149.611-1-nramas@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org arch_ima_add_kexec_buffer() sets the address and size of the IMA measurement log in the architecture specific field in struct kimage. This function does not have architecture specific code, but is currently limited to powerpc. Move arch_ima_add_kexec_buffer() to security/integrity/ima/ima_kexec.c so that it is accessible for other architectures as well. Signed-off-by: Lakshmi Ramasubramanian --- arch/powerpc/include/asm/ima.h | 3 --- arch/powerpc/kexec/ima.c | 21 --------------------- security/integrity/ima/ima_kexec.c | 22 ++++++++++++++++++++++ 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/arch/powerpc/include/asm/ima.h b/arch/powerpc/include/asm/ima.h index d8444d27f0d8..d6ab5d944dcd 100644 --- a/arch/powerpc/include/asm/ima.h +++ b/arch/powerpc/include/asm/ima.h @@ -7,9 +7,6 @@ struct kimage; #ifdef CONFIG_IMA_KEXEC -int arch_ima_add_kexec_buffer(struct kimage *image, unsigned long load_addr, - size_t size); - int setup_ima_buffer(const struct kimage *image, void *fdt, int chosen_node); #else static inline int setup_ima_buffer(const struct kimage *image, void *fdt, diff --git a/arch/powerpc/kexec/ima.c b/arch/powerpc/kexec/ima.c index bf7084c0c4da..b2793be353a9 100644 --- a/arch/powerpc/kexec/ima.c +++ b/arch/powerpc/kexec/ima.c @@ -13,27 +13,6 @@ #include #include -/** - * arch_ima_add_kexec_buffer - do arch-specific steps to add the IMA buffer - * - * @image: kimage struct to set IMA buffer data - * @load_addr: Starting address where IMA buffer is loaded at - * @size: Number of bytes in 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; -} - static int write_number(void *p, u64 value, int cells) { if (cells == 1) { diff --git a/security/integrity/ima/ima_kexec.c b/security/integrity/ima/ima_kexec.c index 4d354593aecf..5263dafe8f4d 100644 --- a/security/integrity/ima/ima_kexec.c +++ b/security/integrity/ima/ima_kexec.c @@ -74,6 +74,28 @@ static int ima_dump_measurement_list(unsigned long *buffer_size, void **buffer, return ret; } +/** + * arch_ima_add_kexec_buffer - do arch-specific steps to add the IMA buffer + * + * @image: kimage struct to set IMA buffer data + * @load_addr: Starting address where IMA buffer is loaded at + * @size: Number of bytes in 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. + */ +static 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; +} + /* * Called during kexec_file_load so that IMA can add a segment to the kexec * image for the measurement list for the next kernel. -- 2.29.2