Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB3F7606A322 for ; Thu, 3 Dec 2026 08:42:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=RS2UZTYc Received: from list by lists.xenproject.org with outflank-mailman.1511869.1704227 (Exim 4.92) (envelope-from ) id 1xZ2Oj-00065d-7Z; Thu, 03 Dec 2026 08:42:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1511869.1704227; Thu, 03 Dec 2026 08:42:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xZ2Oj-00065W-4H; Thu, 03 Dec 2026 08:42:37 +0000 Received: by outflank-mailman (input) for mailman id 1511869; Thu, 03 Dec 2026 08:42:35 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xZ2Oh-00065Q-FH for xen-devel@lists.xenproject.org; Thu, 03 Dec 2026 08:42:35 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xZ2Og-00E0um-Ry for xen-devel@lists.xenproject.org; Thu, 03 Dec 2026 09:42:34 +0100 Received: from [10.42.69.8] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6b112b75-bab6-0a2a0a5309dd-0a2a4508978c-14 for ; Thu, 03 Dec 2026 09:42:34 +0100 Received: from [209.85.128.42] (helo=mail-wm1-f42.google.com) by tlsNG-c1860d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6b1128a9-f659-0a2a45080019-d155802ae8fb-3 for ; Thu, 03 Dec 2026 09:30:33 +0100 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-49d05d51553so95615355e9.2 for ; Thu, 03 Dec 2026 00:30:33 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ca120cbee5sm14078964f8f.32.2026.12.03.00.30.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Dec 2026 00:30:32 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Post: List-Help: List-Subscribe: , Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:Content-Type:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1796286633; x=1796891433; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=EhcXUFtf6P6ETDH2iBhpuhq4hKBshbTYTaudmQOdAvE=; b=RS2UZTYcywqHZtCTLd4Y09D4yFdJMbuVNVMzcC/+Qy5Hl4TEfQnKkHVuP/GCYYDLfX 0sTNa4FDgIbT7VNl6MYrXPPpNkOggl9ciaSbXnIJF9tKdARuEyY+ekbddDPfAPyXPMLd 5FYeH5Dwb7Eac53m0v9L84ELNOvt1fQyMEe0ujBUYVI5Y87qIs2hvWUfnSzmw9MRXqoW yhKnVKAgqTJUNj4xw9RjHLbuyserUCu9oGkmvPGAlNJaXYueTKzCeiRWXLlTVQ/saFbw cNbIiwWo7BcfnQxy70o06rp89Vla7xyVQg4QsjrF4x6sNTHcEx442M8WwoPLIIZyauFX eH5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796286633; x=1796891433; h=content-transfer-encoding:content-type:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=EhcXUFtf6P6ETDH2iBhpuhq4hKBshbTYTaudmQOdAvE=; b=FLbEB9/gzoJJ7MCDPGLU9GKXER2zD+Mk87wFet+DIGJwkyYhomtE1WVZqEcHgVwNcH ZRIw9HCzxCOzyKdf82V9N4O54WRe0EdZYN1SUrLLaB7TzO/p0qcxjPtZJbKAls2pW7H9 EW7kAb7URuxmtDaYjZvb+sdFLcCwfvH0IRvJtrHmlrZA0ieE2/VOfrwwdoMdou0JuLIO /BjkK0Pd6XaSe3abRT838+uCvS6y537GLLYWWodjc4O9ToDESSTkmsJ8DaPJ65DqWB9m QrPZvTVaSsJMdQ5k+NuyVj6LQ5VchAz2az5egcIpc1uOE7YhVcvzgh5VUeqnowJPJRuF cJag== X-Forwarded-Encrypted: i=1; AL+hErGt8mcBpDkYr4AGXuSjKDsSvjRNbjB/A7TIpbrQ0TPSlm65fjdnPJq93YIH0EAt5U/bKSJc8CsOnQM=@lists.xenproject.org X-Gm-Message-State: APuU4Z/E+vwfr6SWLCNW6c2QpJGuNRU4jYigW2xP910/wDboOXD9yoAy 71zFPamCQwkq7Uf+vZuasKA0NqZWvy0RWCfsh8klia5+cRHLwHgKst4OeUU2UhrTKA== X-Gm-Gg: AZFdTZdtZ5JqrQSIB/Y0LkeT5sdxqhPgD8FlXW0FfP5EuBLj4UrZhJ9JlO0o4GgQzAc 6+j63LKRk07VJdEJo/NJV0k/+e30err42UoaoHLdXNu3EEC6IoBebtG2eMuA+yW1BhXBb2jcySv VA/tIXrFOr7e3NU6gQZmo0a3GxYKZVxtsWK3DYkCLSxwpOCZr1+DLNJZhYS3ptDXadpmb0bMY5p ASaKqysulo/ckwj3trSsrfKVhAY5GRGvs+Z95FoRHSqbjv1khMRAjb3NgrNScfEVhL53HGbNN6w K/lSXlIZiovGpgdvPyXyLrQKd/rwIW5cO8czN6TesU2S/JqKhl7N8Y4Y7mNqw1DrYPH88PpCkc0 MHH+2sKhU+McxgcXRS9dbwqU5SBaKEUu40rSQZb84LMGrg4dnn4dhFMKBPna3165ZpqA8Tu3ZSM 6Z7lvuIrcPgCzrNdZVk6PTebyxR0sYLu0NJjP0RXPUoKRRVHcnD87ou0t/5qYPtmZni0LddJOjK /bz5PdWhB/INOpWJOgi1zbTEYoGyKQwt9rBYumF5NSRoMLRx+4+h0VZAPnkpyCODWb5t1bBlIP0 wKklb8I5u1+7lmrdD3VkhZIZJsjlykodNuCZj+gp0SeOyQkDZlYx5n7TSWWEoii+hoeon5bUDFO jbMKdMElP3IRgHaw= X-Received: by 2002:a05:600c:4f0d:b0:4bb:5c97:f4b1 with SMTP id 5b1f17b1804b1-4bb8881941bmr913693025e9.24.1796286633248; Thu, 03 Dec 2026 00:30:33 -0800 (PST) Message-ID: <46d2312e-868f-401d-a31d-468ef2138eb2@suse.com> Date: Thu, 3 Dec 2026 09:30:32 +0100 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] x86/EFI: don't let the EDD disk counter wrap To: Anandu Padinhare Cc: "andrew.cooper3@citrix.com" , "roger@xenproject.org" , "marmarek@invisiblethingslab.com" , "dpsmith@apertussolutions.com" , "teddy.astie@vates.tech" , "xen-devel@lists.xenproject.org" References: Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCg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vtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-purgate-ID: tlsNG-c1860d/1796286633-D5F4787B-353D5016/13/0 X-purgate-type: clean X-purgate-size: 2442 X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 03.12.2026 07:18, Anandu Padinhare wrote: > efi_arch_edd() increments the u8 boot_edd_info_nr once per candidate > disk, without bound. Disks past EDD_INFO_MAX are meant to be skipped by > the "boot_edd_info_nr > EDD_INFO_MAX" checks in the device path > handling, but with 256 or more disks the counter wraps to zero. For the > 256th disk "info" and "params" then point at boot_edd_info[255], about > 20KiB past the end of the array, while the checks pass, so its details > are written there. With xen.efi that is currently the alternatives > table, and Xen panics with "Unable to apply alternatives". Later disks > overwrite the first entries. "edd=" can't avoid this, as it is ignored > when booting via EFI. > > Saturate the counter at EDD_INFO_MAX + 1 instead. > > Fixes: 51f03ec421fb ("x86-64/EFI: construct EDD data from device path protocol information") > Signed-off-by: Anandu Padinhare > --- > Reproduced in QEMU/OVMF with 256 and 260 whole disks (NVMe namespaces): > xen.efi panics; via GRUB/multiboot2 Xen boots, but Dom0 gets wrong EDD > entries. With this patch both boot with the first 6 disks, and with 5, > 15 and 255 disks Dom0's EDD data is unchanged. > > The only other use of the counter in the loop is the fake device number > of MBR signatures, now 0x87 rather than 0x88 and up for the 8th and > later disks. Neither matches an EDD entry, and Linux ignores it. If > the old values should be kept, a separate disk counter can do that. Why would that be? You can use the present counter, by ... > --- a/xen/arch/x86/efi/efi-boot.h > +++ b/xen/arch/x86/efi/efi-boot.h > @@ -398,7 +398,9 @@ static void __init efi_arch_edd(void) > params->bytes_per_sector = bio->Media->BlockSize; > params->dpte_ptr = ~0; > } > - ++boot_edd_info_nr; > + /* Don't wrap, or the checks below would stop skipping extra disks. */ > + if ( boot_edd_info_nr <= EDD_INFO_MAX ) > + ++boot_edd_info_nr; ... doing this differently. One possibility would be if ( !++boot_edd_info_nr ) --boot_edd_info_nr; That said, overall it may indeed be better to introduce a local variable, and only store into boot_edd_info_nr at the end of the function. That'll likely yield better generated code (even if in an __init function this may not matter all this much). Jan