Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1052976pxb; Sun, 19 Sep 2021 04:47:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw94RL34CUsh9i+G64VMxq2RdIk9S1PlpVu2fTBpvNc08o+Yv6HI3winhqMw5yK0fKpv7zz X-Received: by 2002:a17:906:585a:: with SMTP id h26mr22657736ejs.31.1632052020182; Sun, 19 Sep 2021 04:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632052020; cv=none; d=google.com; s=arc-20160816; b=FLwBvDXmQPI2fOlu7PKb3rd+aY+ZkTGvCSGAf47rtGa4h9S+DySZL17pbusL73pnRV 6OjjCa/AvQFUBAhyN4oiPZfqA9fhZddGBeyeV5/4/LvEAqjmRAd5Tsrd4VYuQ9soeIX4 itA4EDVNuABi01kpr4JEVWlWwOLd+ajCSmF/CiWOrpv2i2Qjb/H6//Qvu1GSHn0MAAy2 K0b/VSIwXiR4wav3gvrEZHUeT8kQYwJbUmihGgTXUwp2IM96qoi/wyAAhjwN1Z2Mqndb ejuFjrt3e1cLCQIoVmzeDvl8crHkOs9LACd+aPp472sQKf8lfTp/sQVNn23W9/KHwV8F 5Ddw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:references:in-reply-to:user-agent:subject:cc:to:from :date:dkim-signature; bh=Y5UMBWWt/LJ8qjahwEM2I/jMeULFNYghvJW7PvWLkMo=; b=hnMV7KWuHqZ53q3tzjGPvhhotj07kshNwMQ95WZzrBh96Jg0USUAkqjCjaSM+mq+O3 4bUaRkeB6Y4rzGCcadVnxNBsft+XUJFy5b210SuULuSuyn3X1WJiZsakT84QWPYJ11NP gSwXdB2MWKr9PISfsNvfstl4BBLoQOsJnLKvPjLXBkpWKq8OIvhMlDQHnZFHi+K84lHC 3o+P0LWv3h1XA/AVKF3Q8aGtG8bCBv8oHmKvF6yzWbqIARkBDnnofq9zMQm5agpQdp0L uCUbmIc+pIat8Pf3nQ6bzUHQShE3JKILQfaCXHbamNKZcwqFMVTgVc2nVcoa4RdVXht5 /vAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=AfrHCn31; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id os28si6105549ejb.559.2021.09.19.04.46.31; Sun, 19 Sep 2021 04:47:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=AfrHCn31; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240510AbhIRW4k (ORCPT + 99 others); Sat, 18 Sep 2021 18:56:40 -0400 Received: from mout.gmx.net ([212.227.17.21]:37799 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232125AbhIRW4j (ORCPT ); Sat, 18 Sep 2021 18:56:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1632005625; bh=Pwh/KmGzeiwrqQm3C9sI0E5AfSnePPH3AAuooUuBTY4=; h=X-UI-Sender-Class:Date:From:To:CC:Subject:In-Reply-To:References; b=AfrHCn31S00A+m3IQ6CvlxYlpRX53Lkbs/Ru5BY+abRvw9V27s/cMSqh8HlJehfUN JaNmhUhyb83dCO1Hnvs6OzcqXhrmMoW/TE0jmkTExd53CesKdb9Rv4BIOY/gHD+kcV GvwM/PUhuEEwFp8yIzyfDrAEzDQaSohI5b2gFwzc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [127.0.0.1] ([89.15.236.83]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mgeo8-1n6ZCm3Vc4-00h86f; Sun, 19 Sep 2021 00:53:45 +0200 Date: Sun, 19 Sep 2021 00:53:35 +0200 From: Heinrich Schuchardt To: Alec Brown , "coreboot@coreboot.org" , "grub-devel@gnu.org" , "linux-kernel@vger.kernel.org" , "systemd-devel@lists.freedesktop.org" , "trenchboot-devel@googlegroups.com" , "u-boot@lists.denx.de" , "x86@kernel.org" , "xen-devel@lists.xenproject.org" CC: Aleksandr Burmashev , "allen.cryptic@gmail.com" , "andrew.cooper3@citrix.com" , "andy.shevchenko@gmail.com" , "ardb@kernel.org" , "btrotter@gmail.com" , Daniel Kiper , "dpsmith@apertussolutions.com" , Eric DeVolder , Eric Snowberg , "frowand.list@gmail.com" , "hpa@zytor.com" , "hun@n-dimensional.de" , "james.dutton@gmail.com" , "javierm@redhat.com" , Joao Martins , "jwerner@chromium.org" , Kanth Ghatraju , Konrad Wilk , "krystian.hebel@3mdeb.com" , "leif@nuviainc.com" , "lukasz.hawrylko@intel.com" , "luto@amacapital.net" , "michal.zygowski@3mdeb.com" , "mjg59@google.com" , "mtottenh@akamai.com" , "nico.h@gmx.de" , "phcoder@gmail.com" , "piotr.krol@3mdeb.com" , "pjones@redhat.com" , "pmenzel@molgen.mpg.de" , "rasmus.villemoes@prevas.dk" , "rdunlap@infradead.org" , "roger.pau@citrix.com" , Ross Philipson , "sjg@chromium.org" , "trini@konsulko.com" , "tyhicks@linux.microsoft.com" , "ulrich.windl@rz.uni-regensburg.de" , "wvervoorn@eltan.com" , "rharwood@redhat.com" Subject: =?US-ASCII?Q?Re=3A_=5BSPECIFICATION_RFC_v3=5D_The_firmw?= =?US-ASCII?Q?are_and_bootloader_log_specification?= User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:p+pgeoo6oBsAP4kAPcHthdyoXpZ4AZYVoI5rLrwKC/Udvo8IvyC 9B0KDNX92DA77n0Iq/jNAwdnMSZ4ZBx9tN8lOSZfSACpGaqq5KS7YKa0+1xIPBL02PF4Xui yl/ffVYfKSD5IF5H/4RJMjiFO8h3Z0d73xYMJiRgqEWPf/GH4VkK9yuHTfh7ibu6tQ2g7ET OCUlrIKDVm9LiXYsCD48Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:1uRDmIY6xbk=:xsJ4Qt3Clc/AmnfVmjW15V mnfp54ZfezrJamNK/0LSMX2ZRC0GVYPIUt0YTHrdS4GRGbTzOhXHfSrB3srhlBcDHi3IKjpQM ZYPAFeDLGtBZsH2J1o1jC+C916gcziGLaDmYW0Q7Hk3YtEhcorqg2JqfmA7NsCZJF9yyev0ks PaSvUW2LsEiL/nxF27y8kWIWsqqMZ3Vpnp3ZhaBU/hLrcj4dn+EKkcImtVmz7AgOj3zEjg0ia eYU86/Ud6AUbUFIB8l74tZ3v6MHFXRmALSAUONJPe3sGykkaY95WwDTt/b7OlRJlQVIcavw2O WtjdjHojv4Xfwdfe/Hmv27YwHxs5N7eYlKk/J84J/XV0QK5zZQ9BQqWhV1TP3DeZLNWTn5bnL XtDHpRNwYuKZB9Jdoj5o6eVT8gxPDPW2PoBzW5DGreXhHiYzvacXI1BDZy36r4xj8hu8aYPkI rLXraOitFx7/8Yh+BUHA/+xBbrbhO+9Pw5WjavxWAN2ojK8UcB2NE4qwAX6CK+0OoaRnqtUjG XYWlX3T0mbFi7nPmpPolWbItPTGbpRIeOPwxs0exR16IfxBpmYvXm0kAoYfcl+niZVQybx3Ki Z/Z53jxyIcTDQAxH/lHEYL32U6PNFA6gIg7x/Mhfsb3RNgOsCX/4SFsoB7p5hM8kqdLNu2JHn inYsrnfpNFprGhfYFsP54/gJayFFV7CYeSCaDi09oo07JWt0jYlcBHq4ZAPPuflAOI0HeXQLo r1jpX/YtxWHzW4CyqPSpXMn1PNrLJ+Cl5PU1OjlJ2KD5lzwdqWfEt+Q2+r+xzfpTKz/hBiY7T OT0c3DfNf/DWBEv/zOH0RheBwlIselptrIybSc03c3jThRGibdINSSAaH/vHpGfnxwPYp4K/6 UcvOx8GGN9kzQOjHg3Xn33SQOtCRsm/QXTNZ7PsOZarnUlvsh6rVJt6JzTQmdPUyBQKWJU4NS +dplF3ZPX88ILFf/pIcWPxtDXTauS2TDHUwtYYd72EENou8XI+/7lmGl8AU9qF1uDhBZ7t5qQ t2KOCJ0Jc5RZtWhDHljvtWR6wtzvOaD8EvowmWgikvTIrkA7h2POZtZZuKt1b81/ZkDoodZMR YDx8rKGb1NOqA0= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 18=2E September 2021 18:04:13 MESZ schrieb Alec Brown : >Hi everyone, > >I've been working on improving the specification for the firmware and boo= tloader >log that Daniel Kiper has proposed and take into account most of the sugg= estions >that were made in these threads [1], [2]=2E > >The goal is to allow various boot components to pass logs to the running = OS and >then to the user space for processing and analysis=2E These logs should b= e generic >enough so that it can work in multiple environments and be human readable= =2E Hello Alec, in your mail it remains unclear which information you want to put into the= log and why it is needed=2E I would prefer the motivation and content to b= e clarified before defining any interface structures=2E We already the EFI_TCG2_PROTOCOL and RFC 5424 (The syslog protocol)=2E Why= do we need to start from scratch? Best regards Heinrich=20 > >It has yet to be decided where to put the final version of this specifica= tion=2E >It should be merged into an existing specification, e=2Eg=2E UEFI, ACPI, = Multiboot2, >or be standalone, such as a part of OASIS Standards=2E > >Below is how the layout of these logs would store their data=2E > >bf_log_header: > +-------------------+ >u32 | version | >u32 | size | >u8[64] | producer | >u8[64] | log_format | >u64 | flags | >u64 | next_bflh_addr | >u64 | log_addr | >u32 | log_size | > +-------------------+ > >bf_log_buffer: > +-------------------+ >u32 | version | >u32 | size | >u8[64] | producer | >u32 | next_msg_off | >bf_log_msg[l] | msgs | > +-------------------+ > >bf_log_msg: > +-------------------+ >u32 | size | >u64 | ts_nsec | >u32 | level | >u32 | facility | >u32 | msg_off | >u8[n] | type | >u8[m] | msg | > +-------------------+ > >Where l is the number of msgs, n is the size of type, and m is the size o= f the >msg=2E > >The bf_log_header structure forms a linked list=2E Each bf_log_header ele= ment in >the linked list points to the individual log buffer and the next bf_log_h= eader >element in the linked list=2E The first element in the linked list points= to the >last boot component in the boot chain=2E The last element points to the s= tarting >boot component in the boot chain=2E The log buffers which contain the log >messages are produced by the various boot components, typically from the >firmware to the bootloader=2E The log message is stored in a log format t= hat is >compatible with the boot component that produced it=2E > >The fields in bf_log_header structure: > - version: the firmware and bootloader log header version number, 1 for= now, > - size: the size of the bf_log_header to allow for backward compatibili= ty if=20 > other fields are added, > - producer: the producer/firmware/bootloader/=2E=2E=2E entity, NUL term= inated > string, e=2Eg=2E GRUB, Coreboot; the length allows for ASCII UUID sto= rage, > - log_format: the format used to record the log messages, NUL terminate= d > string, e=2Eg=2E bf_log_msg, cbmem_cons, etc=2E; various producers ma= y generate > logs in various formats if needed, > - flags: bit field used to store information about the log state, if bi= t 0 has > been set it means the log was truncated, > - next_bflh_addr: the physical address of the next bf_log_header struct= ure, > none if zero, > - log_addr: the physical address of where the log buffer is stored, > - log_size: the total size of the log buffer=2E > >The bf_log_buffer is used to store log messages from the firmware and >bootloader=2E This format for storing messages is called the bf log forma= t=2E The >bf_log_buffer contains the header information of the bf log format with t= he log >messages being stored in an array of bf_log_msg messages=2E > >The fields in bf_log_buffer structure: > - version: the firmware and bootloader log version number, 1 for now, > - size: the total allocated space for the bf_log_buffer including the l= og > messages stored in msgs, > - producer: the producer/firmware/bootloader/=2E=2E=2E entity, NUL term= inated > string, e=2Eg=2E GRUB, Coreboot; the length allows for ASCII UUID sto= rage; same > as the field in bf_log_header, > - next_msg_off: the byte offset from the beginning of the allocated spa= ce for > bf_log_buffer to the next byte after the last bf_log_msg in msgs, > - msgs: the array of log messages stored in the bf_log_msg structures= =2E > >The fields in bf_log_msg structure: > - size: the total size of the bf_log_msg entry, > - ts_nsec: the timestamp in nanoseconds starting from 0 (zero); the pro= ducer > using this log format defines the meaning of 0, > - level: similar to the syslog meaning; used to differentiate normal lo= g > messages from debug log messages, but the exact interpretation depend= s on > the producer, > - facility: similar to the syslog meaning; used to differentiate the so= urces > of the log messages, but the exact interpretation depends on the prod= ucer, > - msg_off: the byte offset which the msg field starts in bf_log_msg, > - type: the log message type; similar to facility but NUL terminated st= ring > instead of integer, but the exact interpretation depends on the produ= cer, > - msg: the log message, NUL terminated string=2E > >In bf_log_msg, the producers are free to use or ignore any of the level, >facility, and type fields=2E If level or facility are ignored, they shoul= d be set >to 0=2E If type is ignored, it should be set to an empty NUL terminated s= tring=2E > >Since it doesn't seem possible to have each boot component using the same= log >format, we added a log_format and log_phys_addr fields to give flexibilit= y in >how logs are stored=2E An example of a different log format that can be u= sed is >the cbmem_console log format used by coreboot: > >cbmem_console: > +-------------------+ >u32 | size | >u32 | cursor | >u8[m] | body | > +-------------------+ > >There is still the outstanding issue of how the logs will be sent to the = OS=2E If >UEFI is used, we can use config tables=2E If ACPI or Device Tree is used,= we can >use bf_log_header=2Enext_bflh_addr to present the logs=2E If none of thes= e platforms >are used, it becomes a lot trickier to solve this issue=2E > >Any suggestions are much appreciated and will be taken into consideration= =2E > >I will be presenting this work at the LPC System Boot and Security >Micro-conference on the 22nd of September at 7:50 AM PDT (14:50 UTC)=2E C= ome and >join if you want to discuss the design=2E The schedule for the System Boo= t and >Security Micro-conference can be found here [3]=2E > >Thanks! >Alec Brown > >[1] https://lists=2Egnu=2Eorg/archive/html/grub-devel/2020-11/msg00100=2E= html >[2] https://lists=2Egnu=2Eorg/archive/html/grub-devel/2020-12/msg00021=2E= html >[3] https://linuxplumbersconf=2Eorg/event/11/sessions/116/#20210922