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 07B7AC433EF for ; Thu, 12 May 2022 02:36:37 +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: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:In-Reply-To:References: List-Owner; bh=0TFeRAgult33xz0J4Bav8GW/cT/16Uhngm2XWp6++08=; b=kdIdinGvpuT3Lf Vyfer22MxbH+dUbi+1TR95lQX+2rXiWg7EjR69Jk8bqa1qY8vJsYaGKuVz7hSAQ+v0ZPxmw91kOZl QXHYGZm1d5RYMe+J/z0wfPU9YupfMr5fXevKvxpcJKs+HsR22PSwoIoFDG3PTrgRZZuz//1sjfxRQ cnW85Ue0fBcdtnkaMrcbkkbe6brpOvOMWMqFzmyshz/08nCDmwR5cAueZRn24jvAQDNx0SlJ3dETY PevX+vdY4OCrNF+HhdgdPGwgFrJWrYV/imbzeGFigI2JrTaukWs7s32FJ+M/X4CcRcomb71YBLlrF bKdItNGjZW6vmpdD3gIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1noyfe-009W9n-IG; Thu, 12 May 2022 02:35:19 +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 1noyeY-009VWt-JP for linux-arm-kernel@lists.infradead.org; Thu, 12 May 2022 02:34:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652322848; 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; bh=ecSZEn3a6Ef6N+8RkG8UCyITQThreutGys9fVfqXdWA=; b=Z70WEdRYJOfPMp9mcSFuWi72uABl655PxwjTJ8jboeEtoeDkf2p+GQaJ7kzZ+HPXIksNlx DT3XGLAR4YAKhDu6qkFDBEweNw6Cp8sNJllZSosd+Xn5lJf1AKQ0WySmGsdFNzEl7hlVWY 7SY8ToOtyn29/G8TsTwDfoNYyTcGlUE= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-541-5vScuqFgPmG4yONjGL45Vw-1; Wed, 11 May 2022 22:34:06 -0400 X-MC-Unique: 5vScuqFgPmG4yONjGL45Vw-1 Received: by mail-pl1-f199.google.com with SMTP id y14-20020a1709027c8e00b0015906c1ea31so1984333pll.20 for ; Wed, 11 May 2022 19:34:06 -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:mime-version :content-transfer-encoding; bh=ecSZEn3a6Ef6N+8RkG8UCyITQThreutGys9fVfqXdWA=; b=Zn2VFCPN+8U0rSu4PX/zCCFzdmkGr4sEFvuPUnQTLqNG2E02ne7btnvjfKilTFJwNz irIPrfSJZyP20hdsfq+r4A8fAauC066ypaP1RFcOq8LTn1q2nHSkAW5S2J9dje8eyqOW xFAmr9sJvzDrkBeHO9J0MS4D+dZNYMrfdlh0FaQafEmH+Ns7YmGWH1p3feyVhCz1f/wV ba5nV1rc7IGGk15OVCBuyODZBq3v9o/49YfhCdKhcnxJSDpNEJIuNdErGSki4AedNHlS 8gSQ9rPt8u8nOm5uPqvySRwtByywJBwy0sla88CKf1EEfyGbhVW1mC6gpi7vHMZdz/u1 XNMw== X-Gm-Message-State: AOAM533UGlGQ0h4fEdzHku+ilwSPVSBSKnHE5LI3rc9CxcqaCth5t4OI /J7hS35/kSjRZ7XUAJs5nVzctYV9YE6iwhpbmfM5ICVd/S2x8CUNcj/DOpxXHgTCmvjfLbNPy/n 11reQDeV1PizNHSsIMeKH52jDkm59K2TQx1E= X-Received: by 2002:a17:90b:4a12:b0:1de:c82d:7cda with SMTP id kk18-20020a17090b4a1200b001dec82d7cdamr5550084pjb.9.1652322845385; Wed, 11 May 2022 19:34:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjt/K02NT5o3oItbCpzgJpOSC4SxzdHuikIzThjKttcE5WaI0zHU3XBEFkit7UhmB3GsKAYw== X-Received: by 2002:a17:90b:4a12:b0:1de:c82d:7cda with SMTP id kk18-20020a17090b4a1200b001dec82d7cdamr5550059pjb.9.1652322845057; Wed, 11 May 2022 19:34:05 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id f8-20020a170902ab8800b0015e8d4eb1f9sm2588146plr.67.2022.05.11.19.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 19:34:04 -0700 (PDT) From: Coiby Xu To: kexec@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Michal Suchanek , Baoquan He , Dave Young , Will Deacon , "Eric W . Biederman" , Mimi Zohar , Chun-Yi Lee Subject: [PATCH v7 0/4] use more system keyrings to verify arm64 and s390 kexec kernel image signature Date: Thu, 12 May 2022 10:33:58 +0800 Message-Id: <20220512023402.9913-1-coxu@redhat.com> X-Mailer: git-send-email 2.35.3 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-20220511_193410_766306_471D4804 X-CRM114-Status: GOOD ( 15.14 ) 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 Currently, a problem faced by arm64 is if a kernel image is signed by a MOK key, loading it via the kexec_file_load() system call would be rejected with the error "Lockdown: kexec: kexec of unsigned images is restricted; see man kernel_lockdown.7". This happens because arm64 uses only the primary keyring i.e. the .builtin_trusted_keys keyring that contains only kernel built-in keys to verify the kexec kernel image. MOK keys are loaded into the .platform keyring or/and .machine keyring. The .machine keyring is linked to the secondary keyring i.e. .secondary_trusted_keys keyring when the end-user chooses to trust MOK keys. The platform keyring is exclusively used for kexec kernel image verification and .secondary_trusted_keys together with .builtin_trusted_keys are the system trusted keyrings. So obviously there is no reason to not use .secondary_trusted_keys or .platform keyring for kernel image signature verification. Similarly, s390 only uses platform keyring for kernel image signature verification and built-in keys and secondary keyring are not used. This patch set allows arm64 and s390 to use more system keyrings including the .secondary_trusted_keys and .platform keyring to verify kexec kernel image signature as x86 does. The 3rd arm64 patch depends on the first two patches. The 4th s390 patch can be applied independently. v7: - drop the Fixes tag for the 2nd patch and add patch prerequisites [Baoquan] - improve cover letter v6: - integrate the first three patches of "[PATCH 0/4] Unifrom keyring support across architectures and functions" from Michal [1] - improve commit message [Baoquan, Michal] - directly assign kexec_kernel_verify_pe_sig to kexec_file_ops->verify_sig [Michal] v5: - improve commit message [Baoquan] v4: - fix commit reference format issue and other checkpatch.pl warnings [Baoquan] v3: - s/arch_kexec_kernel_verify_pe_sig/kexec_kernel_verify_pe_sig [Eric] - clean up arch_kexec_kernel_verify_sig [Eric] v2: - only x86_64 and arm64 need to enable PE file signature check [Dave] [1] https://lore.kernel.org/lkml/cover.1644953683.git.msuchanek@suse.de/ Coiby Xu (3): kexec: clean up arch_kexec_kernel_verify_sig kexec, KEYS: make the code in bzImage64_verify_sig generic arm64: kexec_file: use more system keyrings to verify kernel image signature Michal Suchanek (1): kexec, KEYS, s390: Make use of built-in and secondary keyring for signature verification arch/arm64/kernel/kexec_image.c | 11 +----- arch/s390/kernel/machine_kexec_file.c | 18 +++++++--- arch/x86/kernel/kexec-bzimage64.c | 20 +---------- include/linux/kexec.h | 7 ++-- kernel/kexec_file.c | 51 ++++++++++++++++----------- 5 files changed, 50 insertions(+), 57 deletions(-) -- 2.35.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel