From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796497731; b=FC0l05gEuYaLOGWiCawoqkXdIMaVfm0eDaBSYH1XXH8MzIQBvAkigkc0QStEsET9lz9J yXWeHtSKDTNgHUQQ3VfqJL0z7Ef+hF9IBANppZV9TRRifAzXhSV5XbUmICaPJIQ/nsd6J kvJVWQchiZLLbsHou65hNHcPcp3EouqWBectUDnQRQ45p1H9XTMTjXrej2qPZ13LcpFyM n8g+GWKrt4LcRP2evSc9TMZH/fpxk0IyTcM9+hfuSUMvSjbw+m5fGzXKDTA3/LJ3nrk3i hd8NPINv6gnJxigwNuayt5Z/yYYiqNHKVeCro9h1RYu06SUE4e9bvx0yVPNboTx0psw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796497731; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=38VIMOi1F8h5vjNSGTXPu7eHHTT6h+HKepcpXpx57bM=; b=uZbs1FPgV6y0Fcf9gqTjur8LIaP/pDen95mcK/apdmJjX8Trtqh/jqaIBxq0FYrttdwR Xsq507Er0hdYPQ9amHvJU4xAOf0V3tWWcG5m17ipY00NNQQ0AHp7j8/HxlqMWGRdxhwcJ qVx3ZKdOsQC5OLrlqckpYZNk7kUFBa9nyJebA5Te3ufC9IeaHrFfiZotcocdGu684uszS OR7AT9tqjeg6c4jesGvYLQgKK++MAPf96+WOZMXHQUjO7bTuTxwQtueaAGcIGjEY+UMiI DuB+M0ePJHkR2pVNhika0f9/rJTpEayzKCGufAu2U5QbyJMzglpiHbJVsvdR5LKeSWA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cvMmRJLD; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13571606A322 for ; Sat, 5 Dec 2026 19:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cvMmRJLD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48C501F00A12; Sat, 5 Dec 2026 19:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796497730; bh=38VIMOi1F8h5vjNSGTXPu7eHHTT6h+HKepcpXpx57bM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=cvMmRJLDQtkpK16i+e+DSCjwXdH/sGhtYuzFPms5WphWYv+NXsAlggMCTJNDCXXlV QKQjrJAQEA3/chK8QHn6N+NlMhtgDye3ZQIJA96xhy2S/NP1okS/yg3DW4SxpZlq4e pSQ+F1LDw4A85qQ7O44YxzmTF3E6Zn2RA3UDw5x4KHXWBHOhdTM9qf6kPAqyf/UWTs +38O0TmTx7sBFWLhFdPpRl6eSeZjyBL7aFRjVCSzWXWqr1MeArs5mzRhCx8ru4bmer al6i/lYF0tXqYzW24s8kPROtXbCPds5PG2l8o1z/kKeMjZ4EDfUpOKgeEblIGo1ouS ttiGk9BUNYQvg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH RFC] efi/libstub: arm64: Disable pointer authentication on the ThinkPad X13s Reply-To: sashiko-reviews@lists.linux.dev To: "Christopher Obbard" , "Ard Biesheuvel" , "Ilias Apalodimas" Cc: "Bjorn Andersson" , "Johan Hovold" , "Marc Zyngier" , linux-efi@vger.kernel.org In-Reply-To: <20261205-wip-obbardc-qcom-x13s-nopauth-v1-1-913a21a18286@oss.qualcomm.com> References: <20261205-wip-obbardc-qcom-x13s-nopauth-v1-1-913a21a18286@oss.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 19:08:49 +0000 X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] efi/libstub: empty cmdline clobbers FDT bootargs and CONFIG_CMDLINE - [Medium] efi/libstub: efi_quirk_cmdline ignored under CONFIG_CMDLINE_FORCE - [Medium] efi/libstub: efi_add_quirk_cmdline() can exceed COMMAND_LINE_SIZE - [Low] efi/libstub: unmeasured SMBIOS quirk disables PAuth via arm64.nopauth -- commit 996c453c39b0a2907966f4e7ee2f19941e71289e Author: Christopher Obbard efi/libstub: arm64: Disable pointer authentication on the ThinkPad X13s This commit adds an efi_quirk_cmdline hook so check_platform_features() can prepend kernel command line options in the EFI stub, and uses it on arm64 to prepend arm64.nopauth on the Lenovo ThinkPad X13s based on SMBIOS type 1 strings. Link: https://github.com/jhovold/linux/wiki/X13s#kernel-command-line Link: https://git.launchpad.net/~ubuntu-concept/ubuntu/+source/ubuntu-x13s-= settings/tree/grub.d/ubuntu-x13s-settings.cfg?h=3Dmain Link: https://wiki.debian.org/InstallingDebianOn/Thinkpad/X13s#Boot_Debian_= Installer > diff --git a/drivers/firmware/efi/libstub/arm64.c b/drivers/firmware/efi/= libstub/arm64.c > index c190a3ac97001..838df75a46587 100644 > --- a/drivers/firmware/efi/libstub/arm64.c > +++ b/drivers/firmware/efi/libstub/arm64.c > @@ -55,6 +55,24 @@ static bool system_needs_vamap(void) > return false; > } > =20 > +static bool system_is_thinkpad_x13s(void) > +{ > + const struct efi_smbios_type1_record *record; > + const u8 *str; > + > + record =3D (struct efi_smbios_type1_record *)efi_get_smbios_record(1); > + if (!record || record->header.length < > + offsetofend(struct efi_smbios_type1_record, family)) > + return false; > + > + str =3D efi_get_smbios_string(record, manufacturer); > + if (!str || strcmp(str, "LENOVO")) > + return false; > + > + str =3D efi_get_smbios_string(record, family); > + return str && !strcmp(str, "ThinkPad X13s Gen 1"); > +} > + > efi_status_t check_platform_features(void) > { > u64 tg; > @@ -67,6 +85,13 @@ efi_status_t check_platform_features(void) > if (VA_BITS_MIN >=3D 48 && !system_needs_vamap()) > efi_novamap =3D true; > =20 > + /* > + * The Lenovo ThinkPad X13s firmware does not let the kernel use > + * pointer authentication, and the kernel does not boot if it tries. > + */ > + if (IS_ENABLED(CONFIG_ARM64_PTR_AUTH) && system_is_thinkpad_x13s()) > + efi_quirk_cmdline =3D "arm64.nopauth"; [Severity: Low] Can an untrusted host VMM in a confidential arm64 guest spoof these SMBIOS type 1 strings to disable pointer authentication without affecting the measured command line? efi_convert_cmdline() measures the raw LoadOptions into EFISTUB_EVT_LOAD_OPTIONS before efi_stub_common() runs, and system_is_thinkpad_x13s() checks only SMBIOS strings without a hardware identity check (such as MIDR_EL1) or measurement of efi_quirk_cmdline. In an Arm CCA Realm booting via UEFI, a spoofed SMBIOS table would force all six pointer authentication ID register fields to zero while leaving the load-options measurement unchanged. > diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/e= fi/libstub/efi-stub.c > index a824b2ba3026b..7747da185399f 100644 > --- a/drivers/firmware/efi/libstub/efi-stub.c > +++ b/drivers/firmware/efi/libstub/efi-stub.c [ ... ] > @@ -173,12 +179,34 @@ efi_status_t efi_handle_cmdline(efi_loaded_image_t = *image, char **cmdline_ptr) > return EFI_SUCCESS; > } > =20 > +/* > + * Put efi_quirk_cmdline in front of the command line. It has to go firs= t, > + * because anything after "--" is passed to init. > + */ > +static char *efi_add_quirk_cmdline(char *cmdline) > +{ > + size_t quirk_len =3D strlen(efi_quirk_cmdline); > + size_t len =3D strlen(cmdline); > + char *new; > + > + if (efi_bs_call(allocate_pool, EFI_LOADER_DATA, quirk_len + len + 2, > + (void **)&new) !=3D EFI_SUCCESS) > + return NULL; [Severity: Medium] Can prepending efi_quirk_cmdline push the command line past COMMAND_LINE_SIZE? efi_convert_cmdline() caps the converted command line at COMMAND_LINE_SIZE - 1 bytes and truncates on a safe whitespace boundary outside quotes. Because efi_add_quirk_cmdline() adds quirk_len + 1 bytes without re-checking that bound, early_init_dt_scan_chosen() will silently truncate the tail mid-option or mid-quote, while idreg-override.c:get_bootargs_cmdline() still parses the untruncated /chosen/bootargs property. > + memcpy(new, efi_quirk_cmdline, quirk_len); > + new[quirk_len] =3D ' '; > + memcpy(new + quirk_len + 1, cmdline, len + 1); > + > + return new; > +} [Severity: High] Does turning an empty UEFI command line into "arm64.nopauth " clobber existing FDT /chosen/bootargs and disable the CONFIG_CMDLINE fallback? When UEFI LoadOptions are empty, update_fdt() previously skipped writing /chosen/bootargs, preserving DTB bootargs or allowing early_init_dt_scan_chosen() and idreg-override.c:parse_cmdline() to fall back to CONFIG_CMDLINE. Because cmdline_ptr is now non-empty, update_fdt() overwrites /chosen/bootargs, dropping all configured boot parameters (such as root=3D = or console=3D) on setups that boot with empty LoadOptions. It also leaves a trailing space when cmdline is empty. [ ... ] > @@ -186,6 +214,18 @@ efi_status_t efi_stub_common(efi_handle_t handle, > if (status !=3D EFI_SUCCESS) > return status; > =20 > + if (efi_quirk_cmdline) { > + quirk_cmdline =3D efi_add_quirk_cmdline(cmdline_ptr); > + if (quirk_cmdline) { > + efi_info("Adding \"%s\" to the command line\n", > + efi_quirk_cmdline); > + cmdline_ptr =3D quirk_cmdline; > + } else { > + efi_warn("Failed to add \"%s\" to the command line\n", > + efi_quirk_cmdline); > + } > + } [Severity: Medium] Should this skip adding efi_quirk_cmdline (or avoid claiming it was added) when CONFIG_CMDLINE_FORCE is enabled? Both early_init_dt_scan_chosen() and idreg-override.c:parse_cmdline() ignore /chosen/bootargs under CONFIG_CMDLINE_FORCE, so arm64.nopauth has no effect and pointer authentication remains enabled despite the info message. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205-wip-obbard= c-qcom-x13s-nopauth-v1-1-913a21a18286@oss.qualcomm.com?part=3D1