From patchwork Thu Jul 28 15:14:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 594076 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp587127maz; Thu, 28 Jul 2022 08:18:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uKDuv5vI/w6MavfaV/Mj4EBnm+3oW5+jdCQ3GEgD8VUKO3bfF4K+3hXOuyHMoRZGKzIxuh X-Received: by 2002:a05:622a:134f:b0:31f:32be:a750 with SMTP id w15-20020a05622a134f00b0031f32bea750mr19538066qtk.207.1659021489582; Thu, 28 Jul 2022 08:18:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659021489; cv=none; d=google.com; s=arc-20160816; b=V0O5o2xobmgHtM23gqJn25x0bqtlTCdMM/Nq7L3zAiHpCFdARiH3RyaGi+AcYp03lP MHtud+WzkPQZITME7LN6cFOnrLGS3dYG01+9K1/kxXyELTBAVn/ZZoC1Eo+bWSZNedNK nPAsBszmtEKLLMnXNKNtLD2odce1VCKwd1GA308X8TaF4IeWt3zOEQ8oXMYztpy3jk0y RQGJ2uiA40pScLuZloqYJFijfpHNTWS478Y8AkmYTtnnw6WBbg1+gG+l4gNxDRIp/toD jeL6+8Fs8mxxyxgyMcsCAgCcUMR3LFgLTc1aqbRO1bNd3xoOlkGLv51ctfezky6pEfR6 DkBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=c4ss+tbkFJfFRzI7qatNEZJh7WZ3snIsk/Ar1GUZZ/8=; b=UdLmLLakLfMAAw0rcSnbCHNWZ3/vgt0K2suZewWUZ8+d4WrIPJv//oLyg8ao9qT/q0 SI7XGDc3Jx78H6gG4jAAR9eMnQchqNnsufa0DwVtv/cHpUjlGuQFvNbOlQPWpa1aWBw4 6XIdsuOHyjOkW49JHdVvLGrIuPdHQBVDP/9hzD5w9QUji7/USbX0bG5Ffi3+JWPEHyT8 f9kO+v+PdKBBwJae+ye42c5+BsHCn6VYt0UAM1/a0j8jbXg4MIE4vdHD3VtcAsQh5jQ5 rFgE/1ng1M74Rn85WG/EjyhnNSy2ktul8Vjb/ZfW7J9vDR/j/8Q5UoLJl9Vn3XHmP/JG xhjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gtSM04pK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j6-20020a05621419c600b0047378d5c70bsi602367qvc.502.2022.07.28.08.18.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Jul 2022 08:18:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gtSM04pK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH5H6-0005mA-4B for patch@linaro.org; Thu, 28 Jul 2022 11:18:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH5DI-0005JJ-Gv for qemu-devel@nongnu.org; Thu, 28 Jul 2022 11:14:12 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:38647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oH5DG-0005mO-Am for qemu-devel@nongnu.org; Thu, 28 Jul 2022 11:14:11 -0400 Received: by mail-wm1-x330.google.com with SMTP id 2-20020a1c0202000000b003a3a22178beso1108831wmc.3 for ; Thu, 28 Jul 2022 08:14:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=c4ss+tbkFJfFRzI7qatNEZJh7WZ3snIsk/Ar1GUZZ/8=; b=gtSM04pK6sDMm69TAJ5+8HYHe4EtHeEyoad9VOeXBzeyqelA4/VeL4rklBuApqallC FrwJMa5EhXxFVFdiSb1XPvv7OgABLg57DUydnxZrsVlvff5hccUmsorSYSLT8Y71IMsZ J5v4ayx2ZIj6A2tpYXyXN588gp05X1MQwx0i8bEQCYS6rkd/9uW36uCyHp+tSxDVNP4I iujduaV46/JN4PaE9ZBbZTtu47BR4o+r3HvHF6GpNBTm4Gk+E/oLoE1UPzg58dIm8nNh Irgedyhnrmx7L/CM2r5Sh87QISMNW62jZOoQH+09Ln9EH8KquxbSTVKwJV6rjyDKK27m m0qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=c4ss+tbkFJfFRzI7qatNEZJh7WZ3snIsk/Ar1GUZZ/8=; b=UkewrFgOiM37MOS4B4hTcFjaBiim67Lh7lZ+u97F4Z5MlfJsSsbgfNQTcU7OXxZcuz R3z2Nix8tgHLhxctBX0/ZYYIKr/MK61W87QH8atFL8fFiOwBZzmn0vJIUrF0krmBSS5U WpNwaUtI1Zm0AnEFsjBOkqp8IHg7JUWOxyn05MvFIbEV2VuSgCpc9h475FEvEk7eSXnQ uxVOepBxlg4J7WA0QfuniuWCpz9tCSdbuqHEFJr6GvRYpZGlSSDaTi7r4TRxS7QgbtGw +Z74XlwBMJFonQISE0XfVi6R9SNKog5LlNTj0AowcH6m46EsRlP96/7iJvWfARUwLRO1 qvcg== X-Gm-Message-State: AJIora/DG6sf+ms51gi3bEpO1kSn4SAEvjr5WDRLIiwhGdKiFsJYQ7YC zAPsl0sq92sQk+3cjIPtIPq/reZYqSoigg== X-Received: by 2002:a05:600c:190c:b0:3a3:4293:3710 with SMTP id j12-20020a05600c190c00b003a342933710mr7029854wmq.81.1659021248338; Thu, 28 Jul 2022 08:14:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id f18-20020a5d50d2000000b0021e9fafa601sm1337573wrt.22.2022.07.28.08.14.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 08:14:08 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Laurent Vivier Subject: [PATCH for-7.1] linux-user/flatload.c: Fix setting of image_info::end_code Date: Thu, 28 Jul 2022 16:14:06 +0100 Message-Id: <20220728151406.2262862-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The flatload loader sets the end_code field in the image_info struct incorrectly, due to a typo. This is a very long-standing bug (dating all the way back to when the bFLT loader was added in 2006), but has gone unnoticed because (a) most people don't use bFLT binaries (b) we don't actually do anything with the end_code field, except print it in debugging traces and pass it to TCG plugins Fix the typo. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1119 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- linux-user/flatload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/flatload.c b/linux-user/flatload.c index e4c2f89a226..e99570ca182 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -808,7 +808,7 @@ int load_flt_binary(struct linux_binprm *bprm, struct image_info *info) /* Stash our initial stack pointer into the mm structure */ info->start_code = libinfo[0].start_code; - info->end_code = libinfo[0].start_code = libinfo[0].text_len; + info->end_code = libinfo[0].start_code + libinfo[0].text_len; info->start_data = libinfo[0].start_data; info->end_data = libinfo[0].end_data; info->start_brk = libinfo[0].start_brk;