From patchwork Mon Nov 25 15:15:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13885076 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CDDE6D58D5D for ; Mon, 25 Nov 2024 15:15:50 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.842796.1258474 (Exim 4.92) (envelope-from ) id 1tFaoK-00010Q-Pj; Mon, 25 Nov 2024 15:15:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 842796.1258474; Mon, 25 Nov 2024 15:15:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tFaoK-00010J-NB; Mon, 25 Nov 2024 15:15:36 +0000 Received: by outflank-mailman (input) for mailman id 842796; Mon, 25 Nov 2024 15:15:35 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tFaoJ-000108-TL for xen-devel@lists.xenproject.org; Mon, 25 Nov 2024 15:15:35 +0000 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [2a00:1450:4864:20::32b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1ca04a54-ab40-11ef-99a3-01e77a169b0f; Mon, 25 Nov 2024 16:15:32 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-432d9b8558aso31859015e9.0 for ; Mon, 25 Nov 2024 07:15:32 -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-3825fbc38afsm10578877f8f.67.2024.11.25.07.15.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Nov 2024 07:15:29 -0800 (PST) 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: 1ca04a54-ab40-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjozMmIiLCJoZWxvIjoibWFpbC13bTEteDMyYi5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6IjFjYTA0YTU0LWFiNDAtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMyNTQ3NzMyLjA0Njc3Miwic2VuZGVyIjoiamJldWxpY2hAc3VzZS5jb20iLCJyZWNpcGllbnQiOiJ4ZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcifQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732547731; x=1733152531; 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=TGRkgRXpIK18BrPBydpyw7bMQqZHWSHjK9VFOA2LsgU=; b=Z2/y9KLFnk+Ji0Fq6trGwrskKYb/MHr5tx4d+HERI7P2dhqsGqZC16mikhzS4rT9Kn HEvSQLDfXP/CiYy7pBZov8Cx0S3KM81AY1AgwZDoTiF45JX6zofkdGkMtLgZCSa0cTz3 7E+ThnnK5naXu6dMqWywvJMfas2PolPPOVCijTnp8gwgNUP48nptVuyPXI6DKK0WwCX7 1Yje6UIcokzHwpgGZy7fF4rTZSuLO8za2URTLNpmWwerOXbWNjttuv70qTWCN3Gt2SOM mej/TvnRZ+39978Vd5e4/zSk81/huz4CVeJ6BjkK0EPQcMKf/OKTXATKgjidKq6iOsob NXYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732547731; x=1733152531; 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=TGRkgRXpIK18BrPBydpyw7bMQqZHWSHjK9VFOA2LsgU=; b=aoq1iVb5Ft0Iegx528LHypi9+47t9Yo90Ce/DGVkFL2Th0bwmI7u3r4bBpqaRxALqa //MgKwy5c9CdRurjyDQqrfCKIa5HX5nswa+OCIH54JmsVo0IjKP8Vjz+bQLNtcDP4bgl jhUEaozP7zhVtvlYc9XPdUV8FJoHwPPOZOyh7wqWo0JRmMUcpGP5vJl1oJOAiqBFIyXk 9toKY8IkAa/Su4bBg5ZuJ900Z6UnivHCPOHDf+incQoL9UlfiJMMV2iKeKnQ6Z4dbOcm mMNBxorXgFrRxeeh8/vqnrd2CNGEGyvCnmx02Ytbkfi616Re/aehCc72fRmtd9VgodPw DLFA== X-Gm-Message-State: AOJu0YwFsutvBapFaCyklO5Vb9MkA9q0xE7sgCPFOhNfdc81HNSIaUYW /p/HQka16oJAwvX2pNk16avp+1qaoXyGmzM3Z5kP1M1wJbjQ14oDBuiA8XCQy5Fz14inzCvw0bA = X-Gm-Gg: ASbGncvbWHEpuNOG0Irije7ywsLQugQlkcwVSTP6lYXq5xVYR/9s9oN2S/RhHg98Aj9 fw4Rt5ODVT3qVaAxE6e9KnTJcj/fWrHFnMnX3YjBA67Y9NkND4JLJItXBNBZ6pLwHKwx+Uj+rc4 GsZfn0aDGczDEo8TieAZw+PGqdPIMDdaOgD0AL7+4+NQXNKKs4RfRYMG7OFhDsRCp4MyGovDCHh fcVa550pr2aUJp0mVqY9y1wKMJ75F+m0EhloFwLpHTyKcKLp5g+CwIonmU8EJZZ8TqJip+3Hlby Z014YS1JkRqSygRFjsMzi0brTFHg+lW0gvA= X-Google-Smtp-Source: AGHT+IGPj/0qEdeUlaY1455oF82V8Slr3195f0Xx9Hr3o5MCdEhyzG3ilHWB2pxtvz0kKbiL/xRXyw== X-Received: by 2002:a05:6000:2c8:b0:382:3211:6b7e with SMTP id ffacd0b85a97d-3826061faefmr10747933f8f.31.1732547729929; Mon, 25 Nov 2024 07:15:29 -0800 (PST) Message-ID: <9eca264f-57b3-45d3-8017-cd11af0b6cf7@suse.com> Date: Mon, 25 Nov 2024 16:15:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/2] libxl/ACPI: don't hard-code guest page size 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> We have libxl_ctxt.page_size for this purpose; use it to eliminate a latent buffer overrun. Fixes: 14c0d328da2b ("libxl/acpi: Build ACPI tables for HVMlite guests") Signed-off-by: Jan Beulich Reviewed-by: Anthony PERARD --- Yet better might be to limit the size to what's actually used (libacpi's struct acpi_info). That would then also have avoided the respective part of XSA-???. --- a/tools/libs/light/libxl_x86_acpi.c +++ b/tools/libs/light/libxl_x86_acpi.c @@ -218,7 +218,7 @@ int libxl__dom_load_acpi(libxl__gc *gc, dom->acpi_modules[0].guest_addr_out = 0x100000 - 64; dom->acpi_modules[1].data = (void *)config.infop; - dom->acpi_modules[1].length = 4096; + dom->acpi_modules[1].length = libxl_ctxt.page_size; dom->acpi_modules[1].guest_addr_out = ACPI_INFO_PHYSICAL_ADDRESS; dom->acpi_modules[2].data = libxl_ctxt.buf; From patchwork Mon Nov 25 15:15:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13885077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 66AF8D58D5A for ; Mon, 25 Nov 2024 15:16:10 +0000 (UTC) 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 X-Outflank-Mailman: Message body and most headers restored to incoming version 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-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> 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 @@ /* 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)) struct libxl_acpi_ctxt { @@ -177,7 +179,7 @@ int libxl__dom_load_acpi(libxl__gc *gc, } /* These are all copied into guest memory, so use zero-ed memory. */ - config.rsdp = (unsigned long)libxl__zalloc(gc, libxl_ctxt.page_size); + config.rsdp = (unsigned long)libxl__zalloc(gc, RSDP_LEN); config.infop = (unsigned long)libxl__zalloc(gc, libxl_ctxt.page_size); /* Pages to hold ACPI tables */ libxl_ctxt.buf = 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; dom->acpi_modules[0].data = (void *)config.rsdp; - dom->acpi_modules[0].length = 64; + dom->acpi_modules[0].length = RSDP_LEN; /* * Some Linux versions cannot properly process hvm_start_info.rsdp_paddr * and so we need to put RSDP in location that can be discovered by ACPI'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 = ACPI_INFO_PHYSICAL_ADDRESS + (1 + acpi_pages_num) * libxl_ctxt.page_size; else - dom->acpi_modules[0].guest_addr_out = 0x100000 - 64; + dom->acpi_modules[0].guest_addr_out = 0x100000 - RSDP_LEN; dom->acpi_modules[1].data = (void *)config.infop; dom->acpi_modules[1].length = libxl_ctxt.page_size;