From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 795C9C433FE for ; Fri, 4 Mar 2022 02:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N36ARCb6MwNVjy5Sn/zt1KvTq2bccY44OCmk4Sul3DU=; b=wRkOTEvX8PluKp 7ErRYH1HWEZdYIOBrlZYWVMxwR05V78GgTvx71IpUHxiS+VH9HuSPDLaVQ9kUg3gKbGVrzALUneYP PTrYP/xEDGy9c4QbLqDVJ4ggoX62YG7i+dA5rA1R1SYBuDw9Eo7E8/1ZOZAR3eOnH0L0pfX2N7bRS HwOO6bM6QSh6Mb4Si3FHc08MqB7MmruMIoe/sunwTnSXLrcWwAcJutz9E4tRkwJIWe7wFHoigmjG6 GltLNLe94e0CismoueJz4Tnakb2z0+xHegXLuRKktNAOJl6V6Re3GLRYYZW5jAHEzey88MPCs5ZiP Y6WXP4Zc9ugg4ccWe8Ng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPxIg-008HCd-50; Fri, 04 Mar 2022 02:04:10 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPxIU-008HA1-0e; Fri, 04 Mar 2022 02:03:59 +0000 Received: by mail-pl1-x634.google.com with SMTP id z11so6453593pla.7; Thu, 03 Mar 2022 18:03:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FR7366Di99yTyHJIbovR9LHqPQL69gNs/+RxpOoEfdQ=; b=VJLlau3KSmcs7NGnpO9zSiLmHToeEVv2U1Y3zyv87tdjdXEwmoBehutpwwHFEQImR3 KYdPhwq3nbwlqbVynWP+9T00kskMgoKgW37M1jva2kQnpkqD6ZX54qve/Ajfn6fKxh1g 3Xh8w305m+aD5E8ZLQvcs7El6f0EhomMrBhVWjSfIIeBl5ONM97vaQKWYn0U/BSk4fae lmTUiI2L5kJOUsjW8xaZEX+Be2LEGARI8C0wgCBvqnwfLo9ee5m+SJ9crFJf7OfyHgXg CtO9uYYTKorZC3Dhbhn6nsxDNf4Zw/BB3m+EUcy2Jx32lKx2JgDIYD59sr/G7CnqN8KH hxTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FR7366Di99yTyHJIbovR9LHqPQL69gNs/+RxpOoEfdQ=; b=l+crOhdci98TDtQUhlA+ZCRjWB5ezPlVhe79gDZ4urQFmH7TPazfTMKeCcTPA+g93O YfqCfg/FSt5hIacGbF5Zgk6vPRpEnr0i7OKmlXt8aGJUp/FSQ19QWaRGXs1L+NLsOynn +3EKMMNHFwnzUYM5bW48YuaTaec7siO2p6kxDchWMEl/vgogEz1H2WkK6UDGM9Joxr/g 1zDpsufN/k4sVlKeZyi/UdUZDkZ00O/CRh49A9xTtbjkzBQ3bbb7GYzrCD4GmXeUXDNP rEsgDeLhzcKdSw8Ofvl/gsbszELva927Kb9xThtwRj9387yeg/ixUVsaNZ9mK6qitW5n B2aw== X-Gm-Message-State: AOAM532ali7LZFZP9mPYPKt4yR56AWFNMBOOYH1FtRpRkY3xYOmiE9QP UN14D4BrFLImIlA9TQeBKFr/4n5XqO+WJknJ X-Google-Smtp-Source: ABdhPJxB1g/JhYbgFUWmoGCqe3SF0cDhpB9lBeq/c6KeGJIUqMZpsqvOww4gzLEBClJulGZxFOU/rA== X-Received: by 2002:a17:90a:eb07:b0:1be:f354:940a with SMTP id j7-20020a17090aeb0700b001bef354940amr8283349pjz.43.1646359437290; Thu, 03 Mar 2022 18:03:57 -0800 (PST) Received: from localhost ([240e:3a1:2e5:800:f995:6136:f760:a3d0]) by smtp.gmail.com with ESMTPSA id bh6-20020a056a00308600b004f6aa0367f6sm1162719pfb.118.2022.03.03.18.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 18:03:56 -0800 (PST) From: Coiby Xu To: kexec@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Baoquan He , Dave Young , Will Deacon , "Eric W . Biederman" , Coiby Xu , linux-kernel@vger.kernel.org (open list) Subject: [RESEND PATCH v3 1/3] kexec: clean up arch_kexec_kernel_verify_sig Date: Fri, 4 Mar 2022 10:03:39 +0800 Message-Id: <20220304020341.85583-2-coiby.xu@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220304020341.85583-1-coiby.xu@gmail.com> References: <20220304020341.85583-1-coiby.xu@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220303_180358_089857_35A79309 X-CRM114-Status: GOOD ( 12.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Coiby Xu commit 9ec4ecef0af7790551109283ca039a7c52de343c ("kexec_file,x86, powerpc: factor out kexec_file_ops functions" allows implementing the arch-specific implementation of kernel image verification in kexec_file_ops->verify_sig. Currently, there is no arch-specific implementation of arch_kexec_kernel_verify_sig. So clean it up. Suggested-by: Eric W. Biederman Signed-off-by: Coiby Xu --- include/linux/kexec.h | 4 ---- kernel/kexec_file.c | 34 +++++++++++++--------------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 0c994ae37729..755fed183224 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -196,10 +196,6 @@ int arch_kexec_apply_relocations(struct purgatory_info *pi, const Elf_Shdr *relsec, const Elf_Shdr *symtab); int arch_kimage_file_post_load_cleanup(struct kimage *image); -#ifdef CONFIG_KEXEC_SIG -int arch_kexec_kernel_verify_sig(struct kimage *image, void *buf, - unsigned long buf_len); -#endif int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf); extern int kexec_add_buffer(struct kexec_buf *kbuf); diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 8347fc158d2b..3720435807eb 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -89,25 +89,6 @@ int __weak arch_kimage_file_post_load_cleanup(struct kimage *image) return kexec_image_post_load_cleanup_default(image); } -#ifdef CONFIG_KEXEC_SIG -static int kexec_image_verify_sig_default(struct kimage *image, void *buf, - unsigned long buf_len) -{ - if (!image->fops || !image->fops->verify_sig) { - pr_debug("kernel loader does not support signature verification.\n"); - return -EKEYREJECTED; - } - - return image->fops->verify_sig(buf, buf_len); -} - -int __weak arch_kexec_kernel_verify_sig(struct kimage *image, void *buf, - unsigned long buf_len) -{ - return kexec_image_verify_sig_default(image, buf, buf_len); -} -#endif - /* * arch_kexec_apply_relocations_add - apply relocations of type RELA * @pi: Purgatory to be relocated. @@ -184,13 +165,24 @@ void kimage_file_post_load_cleanup(struct kimage *image) } #ifdef CONFIG_KEXEC_SIG +static int kexec_image_verify_sig(struct kimage *image, void *buf, + unsigned long buf_len) +{ + if (!image->fops || !image->fops->verify_sig) { + pr_debug("kernel loader does not support signature verification.\n"); + return -EKEYREJECTED; + } + + return image->fops->verify_sig(buf, buf_len); +} + static int kimage_validate_signature(struct kimage *image) { int ret; - ret = arch_kexec_kernel_verify_sig(image, image->kernel_buf, - image->kernel_buf_len); + ret = kexec_image_verify_sig(image, image->kernel_buf, + image->kernel_buf_len); if (ret) { if (IS_ENABLED(CONFIG_KEXEC_SIG_FORCE)) { -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel