From patchwork Fri Mar 18 09:41:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coiby Xu X-Patchwork-Id: 12785079 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 66936C433F5 for ; Fri, 18 Mar 2022 09:43:05 +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=Kryg+5fXk4ZgYKKsHUfVRRmzjy6xrvhcHeoUCepBwes=; b=o/iPbAhCx1a9Nz /ZpqYY4Ac8Vp//eyQPOiEGnNsuN5JS4MOEFknJfVi0MCXuT4zbx+FofoS1Qsxk7RC2jpiXYrBNh45 mjkFL4F/7M70XsNzNqsxFvHhN8ZAoMy+sOHkGpYnHRgpbU7XELdh+kzE0yFT4VA9VV0IVmfpqZiyu 0en0p7ejQ/3mysi1j7WFfdooT5tJ5p3nsaIyifYfmHds+cHaWGZ+v2wVCSaxVKN5YVAChnfR1lqbf e6GwFEou7PeiGoc2nVs4IppvZSjJkAJhQrn2bBDrs8C3c0HKK6Z7RSK+od67Yq5paxmvFYG3TLeK5 mQ67r20izwap5UAJJrlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nV97H-00108u-TK; Fri, 18 Mar 2022 09:41:52 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nV96l-000zvm-Ci for linux-arm-kernel@lists.infradead.org; Fri, 18 Mar 2022 09:41:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647596478; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DFnb1M2EIoVuc/P5RSzyYqF5MQJZi0h79OModGmGN0w=; b=Sqrjr5CfkeZ2aGehwv9MUV/3E4LSLrw7G+XQSE0CRBajIOx3EQ/gVQwHZxog5NaSrowDKo hxdTKFZ/yZ0f8DBDtMgHimkiMgxnNpowT+GQdtAwAbRvnaAqoCDC/DxFNH5Oyd1iNACXyQ i6Lm2u+qnqORq1tekdYpBkzw5dqsiDE= Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-563-ZqVdruwcOp6ppj8PkH2x3A-1; Fri, 18 Mar 2022 05:41:17 -0400 X-MC-Unique: ZqVdruwcOp6ppj8PkH2x3A-1 Received: by mail-pf1-f198.google.com with SMTP id b19-20020a621b13000000b004fa68b3677bso1503754pfb.20 for ; Fri, 18 Mar 2022 02:41:17 -0700 (PDT) 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=DFnb1M2EIoVuc/P5RSzyYqF5MQJZi0h79OModGmGN0w=; b=q0/7sR+Sk8g/bR2NFUGb5vI+ZjrscYrr3pP7fl4Q55OIN6aaD9OhA2MBr/i7/+HJBj b4XE2zRUjg8KzxVLrwHT44RtUs0VEFHOTmXchXj8S1pAKfhTMwmfzh2BLymEbDp5MkTu JOk49FUEQoAmqyRyzSMMwHf7rOA9k3QuQXX8kf5oGj/xX8MxKl25I/lR4dP+Q6go0W8b V8kEhr7fZ/rCtJJxA0Dd3fI7k+RPqa2e6MN/Kkp+9HidYFMjOkbd7KdeWsoOWc2Jefje maI0BVUOjzpd//rv7KzqJvFRIqj+XzczIYBc4E1Ig64Y4FTpouyFtq2moiTeaYAL1HJ7 zVgA== X-Gm-Message-State: AOAM530LdD83+rr1gBnBXQRp0QAy8CchPTKUmwOM1OHB05GkYpZwi6vw SCzwxEO1J2U5i2vL5teloTFs1LcHMawJq240BhMSZy/TFAMj+Znwo6Sm15jn+qB2G3GITmKQ5X8 p2g4lmvA8jkbXEvTrNH8lXbgreN8ShAz/hM8= X-Received: by 2002:a17:90a:2dc6:b0:1bf:654e:e17f with SMTP id q6-20020a17090a2dc600b001bf654ee17fmr10153827pjm.64.1647596475808; Fri, 18 Mar 2022 02:41:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSZE86KXD2JeC35ujxrinCaDl8UVUyVWu0d7AoIhInD1hZpGVEB0gCt6zGlQQDIot8DU43WQ== X-Received: by 2002:a17:90a:2dc6:b0:1bf:654e:e17f with SMTP id q6-20020a17090a2dc600b001bf654ee17fmr10153807pjm.64.1647596475545; Fri, 18 Mar 2022 02:41:15 -0700 (PDT) Received: from localhost ([240e:3a1:2e5:800:f995:6136:f760:a3d0]) by smtp.gmail.com with ESMTPSA id x7-20020a17090a1f8700b001bf1db72189sm7788102pja.23.2022.03.18.02.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Mar 2022 02:41:14 -0700 (PDT) From: Coiby Xu To: kexec@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Baoquan He , Dave Young , Will Deacon , "Eric W . Biederman" , Catalin Marinas , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 3/3] arm64: kexec_file: use more system keyrings to verify kernel image signature Date: Fri, 18 Mar 2022 17:41:01 +0800 Message-Id: <20220318094101.274950-4-coxu@redhat.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220318094101.274950-1-coxu@redhat.com> References: <20220318094101.274950-1-coxu@redhat.com> MIME-Version: 1.0 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220318_024119_625121_52746D57 X-CRM114-Status: GOOD ( 11.62 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This allows to verify arm64 kernel image signature using not only .builtin_trusted_keys but also .secondary_trusted_keys and .platform keyring. Acked-by: Will Deacon Signed-off-by: Coiby Xu --- arch/arm64/kernel/kexec_image.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/arm64/kernel/kexec_image.c b/arch/arm64/kernel/kexec_image.c index 9ec34690e255..51af1c22d6da 100644 --- a/arch/arm64/kernel/kexec_image.c +++ b/arch/arm64/kernel/kexec_image.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -133,8 +132,7 @@ static void *image_load(struct kimage *image, #ifdef CONFIG_KEXEC_IMAGE_VERIFY_SIG static int image_verify_sig(const char *kernel, unsigned long kernel_len) { - return verify_pefile_signature(kernel, kernel_len, NULL, - VERIFYING_KEXEC_PE_SIGNATURE); + return kexec_kernel_verify_pe_sig(kernel, kernel_len); } #endif