Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753235AbdGCLpA (ORCPT ); Mon, 3 Jul 2017 07:45:00 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:36080 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752557AbdGCLo6 (ORCPT ); Mon, 3 Jul 2017 07:44:58 -0400 MIME-Version: 1.0 In-Reply-To: <20170630235240.GE13714@linux-l9pv.suse> References: <20170512080534.4085-1-glin@suse.com> <20170601081136.ruiao3w2wfc3hftg@GaryWorkstation> <20170630235240.GE13714@linux-l9pv.suse> From: Ard Biesheuvel Date: Mon, 3 Jul 2017 12:44:52 +0100 Message-ID: Subject: Re: [RFC v2 PATCH] x86/boot: Add the secdata section to the setup header To: joeyli Cc: Gary Lin , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2297 Lines: 54 On 30 June 2017 at 23:52, joeyli wrote: > Hi Ard, > > On Thu, Jun 01, 2017 at 08:46:26AM +0000, Ard Biesheuvel wrote: >> On 1 June 2017 at 08:11, Gary Lin wrote: >> > On Fri, May 12, 2017 at 04:05:34PM +0800, Gary Lin wrote: >> >> A new section, secdata, in the setup header is introduced to store the >> >> distro-specific security version which is designed to help the >> >> bootloader to warn the user when loading a less secure or vulnerable >> >> kernel. The secdata section can be presented as the following: >> >> >> >> struct sec_hdr { >> >> __u16 header_length; >> >> __u32 distro_version; >> >> __u16 security_version; >> >> } __attribute__((packed)); >> >> char *signer; >> >> >> >> It consists of a fixed size structure and a null-terminated string. >> >> "header_length" is the size of "struct sec_hdr" and can be used as the >> >> offset to "signer". It also can be a kind of the "header version" to >> >> detect if any new member is introduced. >> >> >> >> The kernel packager of the distribution can put the distro name in >> >> "signer" and the distro version in "distro_version". When a severe >> >> vulnerability is fixed, the packager increases "security_version" in >> >> the kernel build afterward. The bootloader can maintain a list of the >> >> security versions of the current kernels and only allows the kernel with >> >> a higher or equal security version to boot. If the user is going to boot >> >> a kernel with a lower security version, a warning should show to prevent >> >> the user from loading a vulnerable kernel accidentally. >> >> >> >> Enabling UEFI Secure Boot is recommended when using the security version >> >> or the attacker may alter the security version stealthily. >> >> >> > Any comment? >> > >> >> This is now entirely x86-specific. My preference would be to have a >> generic solution instead. >> >> -- >> Ard. > > On x86 platform with secure boot, UEFI boot loader (e.g. shim) keeps the > kernel security version in boot variable for comparing to prevent replay > attack. > > Will ARM platform also apply this approach? Does ARM platform have > secure boot knob in firmware? > Yes, there is no reason to assume ARM differs from x86 in this respect. Shim can be built for ARM as well as for x86.