From nobody Wed Nov 27 04:57:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1700582273; cv=none; d=zohomail.com; s=zohoarc; b=lWXLuTmTQIgGtwpr2Kb0kmBjm0vIT/brj/RkimadWXWqf3UMY6i9NTh4KuaAO8xHLkG4H3BJgejzcqKLQi0BP/VLA5v3oYtwBwCZcZNV1YnTcyu3rlqXIEAklbH3e48xRQn6ikgX5uwWDFKuKZCk9l3Kt1mhyZqoqvCa/4yAdHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700582273; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CTjER+jT+9VVHqyYdg2i5cJ66ptGMsZM63IndAeZ5lQ=; b=TnrrYLPXMwGDAqj9BWOT4DvFXskFyI5mVSEmILXmBal4NIU2lP4ImhIguCr+xwPWnBEv3P11q1xQeE3h2Q0Ul/iKrRpvcBgbmk6VnAeZLMZw//IH/gYjxGqxEaBZXImR0HDAnOWF3e50OZpwjoHFgHYCVZuVLlROOL1xNz0YtlE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1700582273629817.9255585960141; Tue, 21 Nov 2023 07:57:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5T7k-0004Xs-O0; Tue, 21 Nov 2023 10:57:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5T7i-0004WX-JM for qemu-devel@nongnu.org; Tue, 21 Nov 2023 10:57:14 -0500 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5T7e-0002ea-VC for qemu-devel@nongnu.org; Tue, 21 Nov 2023 10:57:12 -0500 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6d7e6df999fso258060a34.1 for ; Tue, 21 Nov 2023 07:57:10 -0800 (PST) Received: from stoup.. ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id n22-20020a9d4d16000000b006cd0a04b56esm1543574otf.56.2023.11.21.07.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 07:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700582229; x=1701187029; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CTjER+jT+9VVHqyYdg2i5cJ66ptGMsZM63IndAeZ5lQ=; b=X8Raq6adkF8U8A/h2PaFMKHTO2IGSfI3DLjKFv0gwunkMSeLH8DBYvnoTnaEc7HzBN usw58tznUSjKeS2aSJJR0/fJATviCbQaQvZziFXJWpu+guGNCtaOOq1o+VtuAUZ/HRR+ ieJXUHe5A1etZH9Lfs+yLFtBiO3OS+/zK27m6txnSAz8UFwAgD1WtvrUDyYpbjhhvU6C aKRm+uSGzTmcwIDgBSHxDfprNHE7arl0CHLHU1D9aet5dWejlR5KyKSU0z0sUuyXrhdY CzRFRzUAsten+HxQsC5OahZoMELy/id9SotgxgmulAMXmdAR7nUL9eXdIe4Gsq4B/SIh z3Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700582229; x=1701187029; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CTjER+jT+9VVHqyYdg2i5cJ66ptGMsZM63IndAeZ5lQ=; b=a5MttXxQ/7RVHYEykBC1oa6ncWrR9BHmO3XEjRbekk7AzS0Vlcz896WI5EEJtSAZQQ ik0Ui9m+ux8/PaUkwucUTEolxgeoaiRuTVirIxcwFxumvsArdkSOZvzIbpq9qFaPZmol IvRlVdVazhbw85qkPTbzTD+k/RptMc7S1J1YeMQ6gAF54L0n1JC/6myk4GMWJr0JLM2F Uo8faZua84sm3vP5F/4lslott0Qa86Z7G93s463mcFn/vl3KqZTVoh/+MDLCdpl7i1cb 6emggMihtJw4d26HwoKicgZQALhr5+CUt1nvFE1iBpKMUlR5Aef3eRxraFmIO2b8xeYz 2cuw== X-Gm-Message-State: AOJu0YytbCx4JLc7AbkzYTXjRs8ox1E8NkbVvI8zrldYlVSAgsBhq9g/ q6OxFzSEyvD5LZSxS/k4kw+ozSnCH3lJsqRW6LcnFg== X-Google-Smtp-Source: AGHT+IHOMnM/KhH9+1CaQh8XHDmsAls9GaDVNgY0XaW1+qUjBnRK/NpyCM7amq3s3HUWxcCtU1rMmg== X-Received: by 2002:a05:6830:6b81:b0:6d3:132a:5350 with SMTP id dd1-20020a0568306b8100b006d3132a5350mr11149313otb.11.1700582229667; Tue, 21 Nov 2023 07:57:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Michael Tokarev Subject: [PULL 1/1] linux-user: Fix loaddr computation for some elf files Date: Tue, 21 Nov 2023 09:56:57 -0600 Message-Id: <20231121155657.798505-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121155657.798505-1-richard.henderson@linaro.org> References: <20231121155657.798505-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x329.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1700582275202100005 Content-Type: text/plain; charset="utf-8" The file offset of the load segment is not relevant to the low address, only the beginning of the virtual address page. Cc: qemu-stable@nongnu.org Fixes: a93934fecd4 ("elf: take phdr offset into account when calculating th= e program load address") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1952 Signed-off-by: Richard Henderson Reviewed-by: Michael Tokarev --- linux-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 4cd6891d7b..cf9e74468b 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -3308,7 +3308,7 @@ static void load_elf_image(const char *image_name, co= nst ImageSource *src, for (i =3D 0; i < ehdr->e_phnum; ++i) { struct elf_phdr *eppnt =3D phdr + i; if (eppnt->p_type =3D=3D PT_LOAD) { - abi_ulong a =3D eppnt->p_vaddr - eppnt->p_offset; + abi_ulong a =3D eppnt->p_vaddr & TARGET_PAGE_MASK; if (a < loaddr) { loaddr =3D a; } --=20 2.34.1