Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1058402imm; Wed, 15 Aug 2018 10:39:01 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzRhVlXVptr31nvZB1ZO8rJS43WvF9fqFKGKs4MJ5JNdiUQSYg2PwPLq5+cgyIRmbo8gu/Q X-Received: by 2002:a63:4506:: with SMTP id s6-v6mr26573793pga.422.1534354741425; Wed, 15 Aug 2018 10:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534354741; cv=none; d=google.com; s=arc-20160816; b=khX079Ns1Iy65JVrem+oOHdDpsN2wR3rBk2v+azdMxd4u/7qvTn5Zjb9vZq6Q1pkqy 3jt5rj0OVSATOezfmUaxsd6dhf4F758SBOd8JznwwoxivyxHNXp9oxxNp3JRpHzR2sl1 A5323kfXpeYVQglNY15eSL8ATz6ieXlzgPYSRL6lj9lbY8fD92wxqM94gRX9DedL16gD jz9ISwr+cL8GBzEN8pEBoOjBFSQF48bK8CZ0e8g1/yIgZrN06muCbxCiqCeQoOh6mUnv ur34E537GkVA5UHx8nIKwVZ9eYVxZV8LFwTowi3TDIcVNBpFKZdCsObY9Vom8oplJYp5 bKjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:references:cc:to:from:subject :arc-authentication-results; bh=7NgxDgNgZH8zXISd5vdACvZo+xv3Ie29sj/89V8CNOw=; b=ax70m0Mxbd3iBgn+CVYFn2/T2m+ZQfDUAcLEyJQAeQyiLLCpuurdfjFqThltBQ0Lgz ay+hCJrRmAftpnn6SMP/YW5ggOpQlwcDc9VXA3dQRhYub4TkJwQkS6wJPg3kkoCCku/t BEkZyFiPZ4wilbSiDMPT0DKGvfnLXlsj+0TGvCCmfIV7kcIrNp27jRTWsk+rx5vYqdmq o2ct3Z7LXkEHPn1OEePzEEPmPNvQL4CsDSjjp3M+OpyDAjl9FW2Rg3U45LoV5CKXh9yK 9Jh6w49gxc/e2r/NO6ooeB8QGbJzOmb8Ra4Yyz1bL6Bk0VPITasars00BT6J/g8aqmT7 bABg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e205-v6si24736749pfh.158.2018.08.15.10.38.46; Wed, 15 Aug 2018 10:39:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730023AbeHOUay (ORCPT + 99 others); Wed, 15 Aug 2018 16:30:54 -0400 Received: from mail.sembritzki.me ([5.45.101.249]:60334 "EHLO mail.sembritzki.me" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729381AbeHOUay (ORCPT ); Wed, 15 Aug 2018 16:30:54 -0400 Received: from [192.168.1.22] (x4dbb4132.dyn.telefonica.de [77.187.65.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.sembritzki.me (Postfix) with ESMTPSA id 58449A7A3E; Wed, 15 Aug 2018 19:37:46 +0200 (CEST) Subject: Re: [PATCH] Fix kexec forbidding kernels signed with custom platform keys to boot From: Yannik Sembritzki To: Linus Torvalds , David Howells , Vivek Goyal Cc: Thomas Gleixner , Ingo Molnar , Peter Anvin , the arch/x86 maintainers , Linux Kernel Mailing List References: <20180815100053.13609-1-yannik@sembritzki.me> <654fbafb-69da-cd9a-b176-7b03401e71c5@sembritzki.me> Openpgp: preference=signencrypt Autocrypt: addr=yannik@sembritzki.me; prefer-encrypt=mutual; keydata= xsFNBFLQZToBEADD7mghnzDjt9mG5rD4QG1vNuqbSnqkr9j8ONNdAnSP5fAYHDWqVVGWMxJF Sc7qu5Z1GUd5l0jvd+pM9oWoIFkcr6a9ZjsYZLTe+YN612KLSpqdEbssKQlembHFzX8qOzr5 bta/g5VtZmzf22HynDwNF8hfIzrfdE0PZUCEtIfwE7aeg8JBb0yHz2Gknd90s3DRcx9Ba4Zl GmB4hYqzpNQedZU0W8Tp/ISI2osQIc81qxur4XF23jfYVOygE3pxkAMB5y0goATeGE5JSCll 6i7XXHN/Qbh7+8u/ZFbNTVONy3VrA+/1AXx41zDUrbc7v11F/+vN5vZcDjlFXc8cR1kwPV5P xGTtdDfJ6Ko0lN+8xoe3CLhnzQRPtZAvulKxiVknILl6l8yI8zwKXJxqzcg/d34PQMs1UxYY 2FW0j+tXSUHRpGUFpBUO44tLUWdTz3+lscEAYnnHSFpl9N5ExaUtfO+P7uIoY56lhd/zkuSw zudsv5qNMHLTH9k4gM9Gofp0jXGRc4Swumt/hF3BzmvvwMASci4kkFVgk4sxLlp+xzj51Oc+ WFIRSRkcx6xyWZKWeFcaPGd6+E0IR+7hkL2lQPta8+ypnn8AhYH2h17OiXOjs4ACLkZdoA+j JiPv6r+kWdLw3NNKDrdWewVfscSRooAZqm4+45u8VnbMuqgxfwARAQABzShZYW5uaWsgU2Vt YnJpdHpraSA8eWFubmlrQHNlbWJyaXR6a2kubWU+wsGWBBMBAgBAAhsjBwsJCAcDAgEGFQgC CQoLBBYCAwECHgECF4AWIQRni0pjVV8jkbaA6/4plgq9sKUg5QUCWgjAyQUJCRmPDwAKCRAp lgq9sKUg5RzMEACw1nDkJ2tM/VP0TWmcCD243CyqyxMA50M2JDhoh+Vlnwev7VBX+/mr9AgP EQKjDha3/cXXvWm5ve/LDJ+SjmijGuUsCLhuiymOxfFXZ3F9f6f8/kwgXh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lybCOCZC NWz7ydfD8yYcVcpaUFpe9fGR9/ogu7guXPDEB9oVmkPA4UzXT8djV01+4bn2wCq2qrDwihpc Z+wE1CjGdlcyTPKIWqTVKZBeOJZ6QQdQ4Mf/EFGtk+Al8k/V9Wf8jskaScpoq2to9OUxXi3x ednXTOffXTn/jHBeFrAgHIHzxl0AEQEAAcLBfAQYAQIAJgIbDBYhBGeLSmNVXyORtoDr/imW Cr2wpSDlBQJaCMDMBQkJGY8SAAoJECmWCr2wpSDltkcQALvt01s8+bWJky9vK+Bforkjo9kN xlx+P4iYQ4O1GC3l7beZgBn6XCHXgv4fxPjY8bcTBamD9EKPgd3L2qMneAuR8quBlT1+/7Ys PiNmWjDSGjk9pJ+civRLwmrrEfOS2h5vBK87afuXxVriwpKxTRn//vzfsCT7E0W5BcmlvjT1 rMdPaESGKURSlhmMHN/+UfMpEzBdz2Xk52F5FL8vAX3aL4hCpw0VANq07ZujTFD9wsQ1KbOu kTGWoS2HPZy4Fkna9LWyvq6Hsi2oOV2sdMthpDlp6n+sWzJAQbgVde+BGGyzOzPYcm1a4Yo5 XAbVTkBmRHlLDM0ODi+aL/T4ecgPRfWiKt+iwiph7SvvQVVeB60JV6y48+VHnM6y0jHr70rz 4EP3uVthtKTeAs4jrPrayXVOuDfFp9m8WsefoXy/llWe9F/2PPXAQbrNeLPQxyhCkNpmbqCd pz34mj88o+7V4BsiU+q6nqs9bsU/9Oc6d6fsaXpzMUMXKJxKndlSAnyjbdsw+WLYlT1VrmMK QM0ulk0PSn8u1L2TNLx+3nhY+IfGuWZqD7xXmI7ujh0UrqwIjMDd7+Ewfr2RdTrvtuSq5BYb U8vMWqT95t3jNocATQaWbKgHK9udONAFx1CZrLdHQFtEnrz+1illZG7oHaZyQBotCDrgu8QN YfNfIPB+ Message-ID: <273c639a-b322-996a-84f2-e55ad187893b@sembritzki.me> Date: Wed, 15 Aug 2018 19:37:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <654fbafb-69da-cd9a-b176-7b03401e71c5@sembritzki.me> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: de-DE Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'm sorry, the sign-off was missing again (this is my first submission to linux). Signed-off-by: Yannik Sembritzki Cc: stable@vger.kernel.org ---  arch/x86/kernel/kexec-bzimage64.c | 5 ++++-  1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index 7326078e..2ba47e24 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -41,6 +41,9 @@  #define MIN_KERNEL_LOAD_ADDR    0x100000  #define MIN_INITRD_LOAD_ADDR    0x1000000   +// Allow both builtin trusted keys and secondary trusted keys +#define TRUST_FULL_KEYRING    (void *)1UL +  /*   * This is a place holder for all boot loader specific data structure which   * gets allocated in one call but gets freed much later during cleanup @@ -532,7 +535,7 @@ static int bzImage64_cleanup(void *loader_data)  static int bzImage64_verify_sig(const char *kernel, unsigned long kernel_len)  {      return verify_pefile_signature(kernel, kernel_len, -                       NULL, +                       TRUST_FULL_KEYRING,                         VERIFYING_KEXEC_PE_SIGNATURE);  }  #endif -- 2.17.1 On 15.08.2018 19:27, Yannik Sembritzki wrote: > Would this be okay? > > diff --git a/arch/x86/kernel/kexec-bzimage64.c > b/arch/x86/kernel/kexec-bzimage64.c > index 7326078e..2ba47e24 100644 > --- a/arch/x86/kernel/kexec-bzimage64.c > +++ b/arch/x86/kernel/kexec-bzimage64.c > @@ -41,6 +41,9 @@ >  #define MIN_KERNEL_LOAD_ADDR   0x100000 >  #define MIN_INITRD_LOAD_ADDR   0x1000000 >   > +// Allow both builtin trusted keys and secondary trusted keys > +#define TRUST_FULL_KEYRING     (void *)1UL > + >  /* >   * This is a place holder for all boot loader specific data structure which >   * gets allocated in one call but gets freed much later during cleanup > @@ -532,7 +535,7 @@ static int bzImage64_cleanup(void *loader_data) >  static int bzImage64_verify_sig(const char *kernel, unsigned long > kernel_len) >  { >         return verify_pefile_signature(kernel, kernel_len, > -                                      NULL, > +                                      TRUST_FULL_KEYRING, >                                        VERIFYING_KEXEC_PE_SIGNATURE); >  } >  #endif > -- > > On 15.08.2018 18:54, Linus Torvalds wrote: >> This needs more people involved, and at least a sign-off. >> >> It looks ok, but I think we need a #define for the magical (void *)1UL >> thing. I see the use in verify_pkcs7_signature(), but still. >> >> Linus >> >> >> >> On Wed, Aug 15, 2018 at 3:11 AM Yannik Sembritzki wrote: >>> --- >>> arch/x86/kernel/kexec-bzimage64.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c >>> index 7326078e..eaaa125d 100644 >>> --- a/arch/x86/kernel/kexec-bzimage64.c >>> +++ b/arch/x86/kernel/kexec-bzimage64.c >>> @@ -532,7 +532,7 @@ static int bzImage64_cleanup(void *loader_data) >>> static int bzImage64_verify_sig(const char *kernel, unsigned long kernel_len) >>> { >>> return verify_pefile_signature(kernel, kernel_len, >>> - NULL, >>> + (void *)1UL, >>> VERIFYING_KEXEC_PE_SIGNATURE); >>> } >>> #endif >>> -- >>> 2.17.1 >>> >>> The exact scenario under which this issue occurs is described here: >>> https://bugzilla.redhat.com/show_bug.cgi?id=1554113 >>>