From nobody Fri Dec 27 17:12:40 2024 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1732547786; cv=none; d=zohomail.com; s=zohoarc; b=KvyaXEQ/GVa2aqf3EnZiqbKjbNQhBLbpZEMxjInwlMzRHkUakYH/UagXkn+swNcxUHtE4Ni/79Yu8ApIhyd30FfVf4Gow8Kooasj+/JuX1s4BIbm0ge+C4MdD4aJBU40ZmdJ8p422mJmYX/dTZN1jK1EykvGvmwnPs9zUqGxuWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732547786; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6Rt7SMGZpWzGl0ygHzpmt9iX7x/9cyy3QYKd49U7x4A=; b=maHeKIifkN+uXJ/LOnIS3mLFR8ROS93NyX7yJ0lNyoeVhk/JyhTQiXa4RxtEO2H5oTxOlYRSKNAGd2tnE73Zeh/f9vZ0LsAQ5n1lWisnm8CVekZJpf3Yd4/5dNzWO5/D2A0Pkj1fvxyIMxd+BHNeYCr4oZKFaSU6ZSBO4lk/8FQ= 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=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 173254778647391.0690197692578; Mon, 25 Nov 2024 07:16:26 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.842798.1258485 (Exim 4.92) (envelope-from ) id 1tFaod-0001Nf-1y; Mon, 25 Nov 2024 15:15:55 +0000 Received: by outflank-mailman (output) from mailman id 842798.1258485; Mon, 25 Nov 2024 15:15:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tFaoc-0001NX-V2; Mon, 25 Nov 2024 15:15:54 +0000 Received: by outflank-mailman (input) for mailman id 842798; Mon, 25 Nov 2024 15:15:53 +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 1tFaob-0001NF-UJ for xen-devel@lists.xenproject.org; Mon, 25 Nov 2024 15:15:53 +0000 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [2a00:1450:4864:20::32e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2819672f-ab40-11ef-a0cd-8be0dac302b0; Mon, 25 Nov 2024 16:15:51 +0100 (CET) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-434a1639637so5766675e9.1 for ; Mon, 25 Nov 2024 07:15:51 -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 5b1f17b1804b1-43499bdfc0fsm73468575e9.19.2024.11.25.07.15.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Nov 2024 07:15:50 -0800 (PST) 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: 2819672f-ab40-11ef-a0cd-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjozMmUiLCJoZWxvIjoibWFpbC13bTEteDMyZS5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6IjI4MTk2NzJmLWFiNDAtMTFlZi1hMGNkLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyNTQ3NzUxLjI3NzUsInNlbmRlciI6ImpiZXVsaWNoQHN1c2UuY29tIiwicmVjaXBpZW50IjoieGVuLWRldmVsQGxpc3RzLnhlbnByb2plY3Qub3JnIn0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732547751; x=1733152551; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=6Rt7SMGZpWzGl0ygHzpmt9iX7x/9cyy3QYKd49U7x4A=; b=Pgk1r2+qTEhIKSfo4KXN1fr0FkXYjrjh+4Nn7jcfpmzzciMHTg11yz+RQA5LKyaBNK SarxrteHJgwUSR4MmpuEIrYQsyoiefTZW6Mzt7squpC80p/tzL4sYilKvv3GVjLNgEZo bVtkZRwVa5ZM4JzByMJ5RPOacTWVVDs3rbUnVyhRoh3qVv7w4+DA3eyx/8aQNz/w9ddg zFizeZ5gjbP/WMOeOfLZ/SVI/BT2my6Ba8MUSuE5MpYpKutnfEWDS9fhQns7Ij3mU3FV IJkbIGOJGKiXs/DecOKIyH7FM1C2NA0A4KLQa5B+wK2IAWjx+LJVz/C5xpm0WX+ET6T5 SEYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732547751; x=1733152551; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6Rt7SMGZpWzGl0ygHzpmt9iX7x/9cyy3QYKd49U7x4A=; b=LSbQrAEBivm8yVc1/0kW1X5GHx99XzRMSTjW6bSH6PzUagh+XhMuuAJWKaV7sAIyNb NfdZ7W6RD+FlFsgxEmlePT0Y2p0WBGEY8RI7rGLrt0vsTWjX0PAElnzIujmWIk71Dua9 4lt011vyI2z8FImxsXxFKmPsVgOnBW2bKt7e1+dzcy9L4z0yi30805aoBwVCMVPxWAU/ npfpCUh50Bycko1+i9Mj+/9CUp542yPiarUOGyLYeGi7uBASP0mk6D6bIcu1tTskJZv+ ZcylReXGP+j9Q7S0fK+ZTjFribPJ0N9Q6Eyi/Sephb0DrT/bZnZ1hh9FoOB7MI7fQOsf DAlg== X-Gm-Message-State: AOJu0YykQ4ZoqZRsCYr15HZXmLUnB/y8A+yIUGF+SQsZrlSPncHjLwOH XHfJbOCDfQGAOBYhXmxgsm9p5iLchFlo/jZ3EjS4scdO3VMQXlj8/ZREOHzhrseU1HGjCZ4qIJc = X-Gm-Gg: ASbGnct8tYh0RRlKRf2jT83s5bizulms5hndZ/LxhMDRgokQ55BMFE91lxX9KWvspom GOtpA4f2HA44kZ0Ytp7p6Gmg/Xz/YZzYe0wEsVGBCHWomP5rIAr0G0+HqIvOFaLQZwsVdyNjrKz LfiI5G9AT1p5C+5P9QZ/1e4cnUg4sRG/bTrWodtQHOUk+UaKL9ZgJ9dcbEaIRv7j1fXrOuLA2Nc IUgtIL5UcwE3tuRgkREoj2D3odwbInurETBa3zo/pBQVlpeFh6JtnAGkqIPbfC7ED4aY+9pUg53 jcELWJdGU+EpVi3eFBkpmNj7C86V5HkYTAo= X-Google-Smtp-Source: AGHT+IHIdwO1/kmBMbSzRc2tO32O71nDHVfl2hV7/GbvC6N2YVBcLBl0tlbMu0lm0aFGyeaEHjC9FQ== X-Received: by 2002:a05:600c:1d0f:b0:432:d735:cc73 with SMTP id 5b1f17b1804b1-433ce424ff9mr110023085e9.11.1732547750515; Mon, 25 Nov 2024 07:15:50 -0800 (PST) Message-ID: Date: Mon, 25 Nov 2024 16:15:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/2] libxl/ACPI: bound RSDP allocation From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Anthony PERARD , Juergen Gross References: <7455ff48-4bbc-465c-baff-d5c0ff684dfd@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7455ff48-4bbc-465c-baff-d5c0ff684dfd@suse.com> Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1732547788574019100 Content-Type: text/plain; charset="utf-8" First instroduce a manifest constant, to avoid open-coding 64 in several places. Then use this constant to bound the allocation. Signed-off-by: Jan Beulich Reviewed-by: Anthony PERARD --- Similarly bounding the info "page" allocation would be nice, but would require knowing libacpi's struct acpi_info size here. --- a/tools/libs/light/libxl_x86_acpi.c +++ b/tools/libs/light/libxl_x86_acpi.c @@ -20,6 +20,8 @@ =20 /* Number of pages holding ACPI tables */ #define NUM_ACPI_PAGES 16 +/* Hard-coded size of RSDP */ +#define RSDP_LEN 64 #define ALIGN(p, a) (((p) + ((a) - 1)) & ~((a) - 1)) =20 struct libxl_acpi_ctxt { @@ -177,7 +179,7 @@ int libxl__dom_load_acpi(libxl__gc *gc, } =20 /* These are all copied into guest memory, so use zero-ed memory. */ - config.rsdp =3D (unsigned long)libxl__zalloc(gc, libxl_ctxt.page_size); + config.rsdp =3D (unsigned long)libxl__zalloc(gc, RSDP_LEN); config.infop =3D (unsigned long)libxl__zalloc(gc, libxl_ctxt.page_size= ); /* Pages to hold ACPI tables */ libxl_ctxt.buf =3D libxl__zalloc(gc, NUM_ACPI_PAGES * @@ -204,18 +206,18 @@ int libxl__dom_load_acpi(libxl__gc *gc, libxl_ctxt.guest_start) >> libxl_ctxt.page_shift; =20 dom->acpi_modules[0].data =3D (void *)config.rsdp; - dom->acpi_modules[0].length =3D 64; + dom->acpi_modules[0].length =3D RSDP_LEN; /* * Some Linux versions cannot properly process hvm_start_info.rsdp_pad= dr * and so we need to put RSDP in location that can be discovered by AC= PI's - * standard search method, in R-O BIOS memory (we chose last 64 bytes) + * standard search method, in R-O BIOS memory (we chose last RSDP_LEN = bytes) */ if (strcmp(xc_dom_guest_os(dom), "linux") || xc_dom_feature_get(dom, XENFEAT_linux_rsdp_unrestricted)) dom->acpi_modules[0].guest_addr_out =3D ACPI_INFO_PHYSICAL_ADDRESS= + (1 + acpi_pages_num) * libxl_ctxt.page_size; else - dom->acpi_modules[0].guest_addr_out =3D 0x100000 - 64; + dom->acpi_modules[0].guest_addr_out =3D 0x100000 - RSDP_LEN; =20 dom->acpi_modules[1].data =3D (void *)config.infop; dom->acpi_modules[1].length =3D libxl_ctxt.page_size;