From nobody Fri Oct 31 16:06:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1746102242; cv=none; d=zohomail.com; s=zohoarc; b=by1M/POHDHxNQK9aAGIamIO42t7JWxYW4XNz/qE6v1ceK9CSytongDb4B7SzRVMPNsR/ui6ymSi7PF7iHENglOrhZpXOef7Ru27xu9E3bGjtJwn4j0SF/mc8iwmlqJWgiLd3qr3Sr7IL5i5lmcEnGmsueVJEKLhT2HIY19GEX8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746102242; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=a/PqX/nwwI08euGI8uJVy+/V+w3ULiNbLKDIxnxdS24=; b=djeMZ+cZ9kESEKPGJM2Qsen2VhoVs/sjwlec9o0StySmOgnrQX1xvxzSqnjpIE25ViwObUvpvJdiH2Zg7vOXLqxI4oI4kaVlDQzm/YseU32bfDHcceBwvZ/k0ZSgEViUbuoHCVFSE+s+MgVBCWUf7/nH5EEzWkT0IdBoM9/P8ts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1746102242385589.0440055813675; Thu, 1 May 2025 05:24:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.974109.1362053 (Exim 4.92) (envelope-from ) id 1uASx2-0008Gg-AI; Thu, 01 May 2025 12:23:40 +0000 Received: by outflank-mailman (output) from mailman id 974109.1362053; Thu, 01 May 2025 12:23:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uASx2-0008GZ-6L; Thu, 01 May 2025 12:23:40 +0000 Received: by outflank-mailman (input) for mailman id 974109; Thu, 01 May 2025 12:23:38 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uASx0-0008GT-Mq for xen-devel@lists.xenproject.org; Thu, 01 May 2025 12:23:38 +0000 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [2a00:1450:4864:20::62c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 1bd24329-2687-11f0-9eb4-5ba50f476ded; Thu, 01 May 2025 14:23:38 +0200 (CEST) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-ac25520a289so145579866b.3 for ; Thu, 01 May 2025 05:23:38 -0700 (PDT) Received: from eddie5.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad0da51681asm33401366b.105.2025.05.01.05.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 May 2025 05:23:36 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1bd24329-2687-11f0-9eb4-5ba50f476ded DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1746102217; x=1746707017; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=a/PqX/nwwI08euGI8uJVy+/V+w3ULiNbLKDIxnxdS24=; b=WDILSqImnr4j7gmJTZ89wQGxekU/L5Z3JasKdKX8lrp3QdZOu18QYiagrYmohndB9v ztxGOTZgsBkacEEaSi0TsT1X4lWoD/mWU7WD6plt2DxtBMjqdj/+o7nlZ0GaszKr8Ngj Y/fPxTBjGNHROfsueTxwGnYvjBlt7QnPqGwQ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746102217; x=1746707017; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a/PqX/nwwI08euGI8uJVy+/V+w3ULiNbLKDIxnxdS24=; b=ewQvuMpZ+NfrEflB8cy4CvwpExpw2hMLWNcdX2XQqMP+ZHWzkqqgeg19x6cQ3/Fhd8 ybb0yacK5KOqK684n1Ad981W1sdG4Qmaleap9+L5Xqf3PCd3wbk5ca5RoKhZuuqtN3Ap cuYK6xznl/uFZYV4MOHa7YpbDMPXr4z9t+jficiOa7tnmQ7jZi9OzDDzJt1ACHfPHHWG 77gLXNmjePn/nrHETogqINSZBnMifYQ2Da0kO5TNvXxmzle3nJHTmW2hBKFJoCqH7Y5B vMZmffoz4JRKOxkaFAUZCK/EjJm3HlqB1lThjjnxr8YPS1FWK/4G17lb29kHYIe0Lbow 6DXA== X-Gm-Message-State: AOJu0YzKFj8KR2qOd3rGBGTxCaRiNZ8sr3lSChj+6oB6Gix/9uF6D+sH AO+d0iy7x5+CIKD5u7djFs3BSBCzt3itDJbGlpktsRD/ATY9PYQ5uEf47OWn1SkjJo4+6A0bpwO YwzI= X-Gm-Gg: ASbGncu8zXYKSykaft5ZPLQn3yPj6JGIqe3CKndfsW25O2guQ+cLsZVW6WzKaBt7Fq9 W8yRgBlDj3MxhqH4aMmObHbhjgew5bIj7fRenAwK7TAmgf5Mupo+iXX5zHjgbh/vm/rvsRoDRo6 qYC0xyd0eR50+RkP7+oUtnaGz6Ew1BMFGItmkDZz/9xuMLHIsGKwHJYGZami8Bpz8KjxBFFl9At eg30dJ+K7OZbeSg/8e+1XB/wAxVZBaYDZG6kvQ3Orfojs5OBxrNj1DGvpOzMDgyKa0MOxGg0/cd PNk3KPoSO1EeFP36+6r5JBnOt+1saBDIH/o6zQbIRlJLTeNWEGi+YB+DhfcwP45p X-Google-Smtp-Source: AGHT+IGt1lh2PjmnZHhjKw7j3jKh8mY0cZW9WiCl6UNuO+iXLXk/ZRrjx0QUdHGwzSkNHQXupvsHgA== X-Received: by 2002:a17:907:2da4:b0:ac7:1350:e878 with SMTP id a640c23a62f3a-acefbfe3165mr226433566b.46.1746102217040; Thu, 01 May 2025 05:23:37 -0700 (PDT) From: Gerald Elder-Vass To: xen-devel@lists.xenproject.org Cc: Gerald Elder-Vass , Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Julien Grall , Stefano Stabellini Subject: [XEN PATCH v2] sbat: Add SBAT section to the Xen EFI binary Date: Thu, 1 May 2025 12:23:22 +0000 Message-ID: <20250501122322.230599-1-gerald.elder-vass@cloud.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1746102243383019000 Content-Type: text/plain; charset="utf-8" SBAT is a revocation scheme for UEFI SecureBoot, and is mandated by Microso= ft for signing. The SBAT section provides a way for the binary to declare a generation id for its upstream source and any vendor changes applied. A compatible loader can then revoke vulnerable binaries by generation, using the binary's declared generation id(s) to determine if it is safe to load. More information about SBAT is available here: https://github.com/rhboot/shim/blob/main/SBAT.md Vendors should append a custom line onto sbat.csv(.in) with their vendor specific sbat data. Populate the SBAT section in the Xen binary by using the information in xen/arch/x86/sbat.csv Signed-off-by: Gerald Elder-Vass Signed-off-by: Frediano Ziglio Tested-by: Gerald Elder-Vass Reviewed-by: Frediano Ziglio --- Changed since v1: * Updated commit message to explain why SBAT is needed * Renamed sbat_data.o rule to sbat.o * Moved sbat.o rule into alphabetical order * Removed xen specific entry from sbat.csv (and rule for auto filling vers= ion) - The alternative of adding a "customise me" line would result in more overhead for anyone else building Xen, regardless of UEFI SecureBoot u= sage diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index d902fb7accd9..8fc5c69111d5 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -58,6 +58,7 @@ obj-y +=3D percpu.o obj-y +=3D physdev.o obj-$(CONFIG_COMPAT) +=3D x86_64/physdev.o obj-y +=3D psr.o +obj-y +=3D sbat.o obj-y +=3D setup.o obj-y +=3D shutdown.o obj-y +=3D smp.o @@ -277,6 +278,9 @@ $(obj)/efi.lds: AFLAGS-y +=3D -DEFI $(obj)/xen.lds $(obj)/efi.lds: $(src)/xen.lds.S FORCE $(call if_changed_dep,cpp_lds_S) =20 +$(obj)/sbat.o: $(src)/sbat.csv + $(OBJCOPY) -I binary -O elf64-x86-64 --rename-section .data=3D.sbat,reado= nly,data,contents $< $@ + clean-files :=3D \ include/asm/asm-macros.* \ $(objtree)/.xen-syms.[0-9]* \ diff --git a/xen/arch/x86/sbat.csv b/xen/arch/x86/sbat.csv new file mode 100644 index 000000000000..1f262b5f038b --- /dev/null +++ b/xen/arch/x86/sbat.csv @@ -0,0 +1 @@ +sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 9a1dfe1b340a..e6405941e1b7 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -343,6 +343,8 @@ SECTIONS *(.reloc) __base_relocs_end =3D .; } + + .sbat (NOLOAD) : { *(.sbat) } #elif defined(XEN_BUILD_EFI) /* * Due to the way EFI support is currently implemented, these two symbols diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h index a17810bb286f..756f97d48183 100644 --- a/xen/include/xen/xen.lds.h +++ b/xen/include/xen/xen.lds.h @@ -92,7 +92,8 @@ *(.comment.*) \ *(.note.*) #else -#define DISCARD_EFI_SECTIONS +#define DISCARD_EFI_SECTIONS \ + *(.sbat) #endif =20 /* Sections to be discarded. */