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 52575C433EF for ; Fri, 15 Apr 2022 09:42:24 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BymaDdOql4cHy2jhN3RrHKV5PruZcVUMEYbVGJQ3juA=; b=KhomrT3Wu1yo0YKsNc1VxeE20X WfZtzpDyTUcbTgoaMnQG6x3OqQnAto6aF+CyMPCYP5nxDcQqQBSXLKXFFN0Fxge/jejQJjmV0oILW 2NZmDT2a12bVTcV6hL/KEqFS4OsOQIj7Y/f4e5anTy0B0oKhq3JvsEaio4k8dy3LwpAeSSII8F4SM A59CBPpGUI1+QBqKfXjWf2MwH5B14NssutNb+dODKZKo2qU2UpADp0W7AO3DEDAEeWbbEETW2OCIg DhWbbhe7w/FP7FCbi7PXYOeIRtV9MKuWXal095Jwjz+Mk14F2R/bh5oBz/luBV7+yUYz1bv6KIes4 O75u+CdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nfIS3-009VID-SY; Fri, 15 Apr 2022 09:41:15 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nfIRv-009VFw-Mo for linux-arm-kernel@lists.infradead.org; Fri, 15 Apr 2022 09:41:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650015664; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=h/1JCepYENbf71BepdLs1YbkeOFNfXucyH17mK6yMh0=; b=P4YlSyiZVt5WyIPAO7FzLhswtB7xChoRCqtA5Hg5jqYVnkdQSRDobbMB2ocz3+zGvWFxy+ qwcImrDfgi9YVctRJeBU0ZQ5A1Pj79LQw6Nv+aDj9fegHhef2kBYyiqAL5TYGd72evopKg VFhgFi2jnQkCkTtOei0AcwtM1kdFLzU= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-434-Pv6rxnW5OqOpIVygFgyNfg-1; Fri, 15 Apr 2022 05:41:03 -0400 X-MC-Unique: Pv6rxnW5OqOpIVygFgyNfg-1 Received: by mail-pj1-f69.google.com with SMTP id q1-20020a17090a2dc100b001cba43e127dso4481978pjm.9 for ; Fri, 15 Apr 2022 02:41:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=h/1JCepYENbf71BepdLs1YbkeOFNfXucyH17mK6yMh0=; b=VOYCtoxXjqyjMw2zNjm9iJfGzvpjaWBmN59AwWjOWPaSpIbboOtp3JFuA5ekSwzEL3 fRLhOXDml3TLnjToMEMqN15oRXIIXE8EqXQHSL6qmHCV7kI09uZMrYvHfeeK2EnitSco lVSZllEvbzKNF65WNEnvKq4DdTvXplXsSbHlX1Q2XICQi+HLF5ycnr8q2+FbiXxbvWlq fCemgYoIYk3bqlb+eIdSfT2eVzxSNOX0TwhoRSq2LAsWHlOArt9Mnh4h/YFZ2tu5S+nZ WxCsEAAJbaRSgji7r50n2XNfDeALzSToautA8huUhlyPIfmzPSVpdBqEnOX9nSRAV5gu vpbQ== X-Gm-Message-State: AOAM5302kegqak8/LY2rcGR6y2fvlWtu5p6io3fpeD5Ig8EJQs6TS8e4 59uFrzr7stOUjhR5t+SWfFY2kkx1yQlOTyF2Qy0Qep0xKPfPRwa1hxZUCRVHkFf+PyDogz2Ya9h ly22yKgjhJkvOaG6OieW0vYi9ueJIRlTivRI= X-Received: by 2002:a63:1b20:0:b0:382:70f9:dc24 with SMTP id b32-20020a631b20000000b0038270f9dc24mr5565808pgb.485.1650015661931; Fri, 15 Apr 2022 02:41:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQDFG3xXhNMasYOz+54LcHe6OLSQeA86AaCczvVXkLHAleqFPwF0nDj11Z+KebJClfH8oefA== X-Received: by 2002:a63:1b20:0:b0:382:70f9:dc24 with SMTP id b32-20020a631b20000000b0038270f9dc24mr5565778pgb.485.1650015661542; Fri, 15 Apr 2022 02:41:01 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id k13-20020aa7820d000000b004fa72a52040sm2267691pfi.172.2022.04.15.02.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 02:41:00 -0700 (PDT) Date: Fri, 15 Apr 2022 17:37:35 +0800 From: Coiby Xu To: Baoquan He Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Michal Suchanek , Dave Young , Will Deacon , "Eric W . Biederman" , Mimi Zohar , Chun-Yi Lee , stable@kernel.org, open list Subject: Re: [PATCH v6 1/4] kexec: clean up arch_kexec_kernel_verify_sig Message-ID: <20220415093735.74eusyuuboa32aqs@Rk> References: <20220414014344.228523-1-coxu@redhat.com> <20220414014344.228523-2-coxu@redhat.com> MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=coxu@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220415_024108_060109_C3AAC308 X-CRM114-Status: GOOD ( 19.46 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Apr 14, 2022 at 11:44:25AM +0800, Baoquan He wrote: >On 04/14/22 at 09:43am, Coiby Xu wrote: >> Currently there is no arch-specific implementation of >> arch_kexec_kernel_verify_sig. Even if we want to add an implementation >> for an architecture in the future, we can simply use "(struct >> kexec_file_ops*)->verify_sig". So clean it up. >> >> Suggested-by: Eric W. Biederman >> Cc: stable@kernel.org > >It should be not worth noticing stable kernel that a clean up patch need >be back ported. Thanks for the suggestion! For the 2nd and 3rd patch, I'll add prerequisite info, Cc: stable@kernel.org # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig and Cc: stable@kernel.org # 34d5960af253: kexec: clean up arch_kexec_kernel_verify_sig Cc: stable@kernel.org # 83b7bb2d49ae: kexec, KEYS: make the code in bzImage64_verify_sig generic respectively. > >Otherwise this looks good to me, > >Acked-by: Baoquan He Thanks for reviewing the patch! > >> Reviewed-by: Michal Suchanek >> 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 58d1b58a971e..413235c6c797 100644 >> --- a/include/linux/kexec.h >> +++ b/include/linux/kexec.h >> @@ -202,10 +202,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 >> > -- Best regards, Coiby _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel