From nobody Tue Feb 10 10:19:57 2026 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=1693601020; cv=none; d=zohomail.com; s=zohoarc; b=G7iaRHscy4rR4bzinRX5fkuDuiZ2TX0Ds3+FyGxhQBqKajQMxqwPjcOD2llgLs/9pSk7W/FwEMy+fOhXBMqwNDL5aMElpnw6TM05njS/0Zm6ud2SoNaXHS+61Y2SGXCbGcl1E06rEoYQjwa8oPbUl7ySt+zfZs/6QpFayMM0Hhg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693601020; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ll7Fcerm+Jswr+2aKJK47stIuMjiaUzk13pA9L+5+w4=; b=XsG4teRGeH2q11i4vNEXANCYzMwDSz2/Y5rdGttHAG1xK5/jMhqdW9bLYMGmI/GClk7LWLFGuy0+j7QnddTIyPffRzub0oRraEMQudKL9O8s2R7xgJHx/v/+7t8EcYNk3dW5dIoF58XDklJIj7CM595fBhiPvbOEQYa7sQUu0g4= 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 1693601020164101.00447289141152; Fri, 1 Sep 2023 13:43:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcAyu-0006yW-MT; Fri, 01 Sep 2023 16:43:06 -0400 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 1qcAyr-0006xv-TH for qemu-devel@nongnu.org; Fri, 01 Sep 2023 16:43:01 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcAyp-0001xK-EN for qemu-devel@nongnu.org; Fri, 01 Sep 2023 16:43:01 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-68a42d06d02so2060523b3a.0 for ; Fri, 01 Sep 2023 13:42:59 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id j15-20020aa78d0f000000b0068c97a4eb0dsm3320666pfe.191.2023.09.01.13.42.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 13:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693600978; x=1694205778; 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=Ll7Fcerm+Jswr+2aKJK47stIuMjiaUzk13pA9L+5+w4=; b=mTuoqtqHphL1rODik5Se1W8KUGmaWNZhfI1X3w/A1JXLJrjlnURoVV8JjWX2EoCe9m iE5E5x8pDhm2HJf6400WiRC/tWaJPM22jLDE1mLtV4nLb1fesO9gE5lznoXm1ijAMDAQ C+QiCYHO3KQgyj6u/T24Fd5FYwBLmDxTktuWupQMjPW1aEfmK/Lx0moEkpNoUdC9snQn MaOdUqaXPVzB/xCNdWk8hHvJX7FxUmO04c0H5vT165YKAj9x+uq7OhEijXPnFjDe6l0x qmXZ0rFJn8HOykKt7y/PCIvjT4kSZS/7zQ5tXsPHjrNk5Rp60pR/fhZzOvkkdBoY3If4 xOlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693600978; x=1694205778; 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=Ll7Fcerm+Jswr+2aKJK47stIuMjiaUzk13pA9L+5+w4=; b=gsDLDW822ZRfNE6cjDihDujIJREnResSE3O0I2TXV3fxShcYBZiqqaBpi01nd8F+mf 7U29BHdqt4JU2fPG4j5YZas2MlVNEPZj47L0JYbcRQXA6IY6H6i3pM2WSUsGfdOIDpJg IqY6jsUijN3ZWmiNGDFVHR7BBxUSBDmM2VQLqYK/M5QmkiOSFJpGmJdEOoJR4m411o3i x9ifcBS79Ett5wHZQkjR7fExGNyWjrsnNZsAMt00NAxAHK+MnGp1G6KPMRkVZhT7D314 mkKaAxP7iCjKI+L/R7ikIC1vhBKdGAqKxr48G/a0MIz8XezwqVGtR//Uf18MwQy6lWrt rsiw== X-Gm-Message-State: AOJu0Yym0/qvCf0asabgt99o1R5RqesnskLVFhLpx0tx5FarWh9Wsvze WtUjdgxORn/JGvCP1lf6NSHTfSPEQdOmcnFkQrU= X-Google-Smtp-Source: AGHT+IGgQMn9byzk5q5MreeTo/qxLM8KOMPfY74qXf5SJz5KhohxjEVP0vrkwCD3sg/9M1HdkLH9DQ== X-Received: by 2002:a05:6a00:1587:b0:68c:42:d3d7 with SMTP id u7-20020a056a00158700b0068c0042d3d7mr4219861pfk.25.1693600978168; Fri, 01 Sep 2023 13:42:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Helge Deller , Ilya Leoshkevich , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 06/13] linux-user: Adjust brk for load_bias Date: Fri, 1 Sep 2023 13:42:44 -0700 Message-Id: <20230901204251.137307-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230901204251.137307-1-richard.henderson@linaro.org> References: <20230901204251.137307-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: 1693601020980100001 PIE executables are usually linked at offset 0 and are relocated somewhere during load. The hiaddr needs to be adjusted to keep the brk next to the executable. Cc: qemu-stable@nongnu.org Fixes: 1f356e8c013 ("linux-user: Adjust initial brk when interpreter is clo= se to executable") Tested-by: Helge Deller Reviewed-by: Ilya Leoshkevich Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- 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 7c95098e3e..d52d47c5c3 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -3327,7 +3327,7 @@ static void load_elf_image(const char *image_name, in= t image_fd, info->start_data =3D -1; info->end_data =3D 0; /* Usual start for brk is after all sections of the main executable. */ - info->brk =3D TARGET_PAGE_ALIGN(hiaddr); + info->brk =3D TARGET_PAGE_ALIGN(hiaddr + load_bias); info->elf_flags =3D ehdr->e_flags; =20 prot_exec =3D PROT_EXEC; --=20 2.34.1