From patchwork Wed Aug 3 14:56:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 595101 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp494483maz; Wed, 3 Aug 2022 07:57:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tZEASHtYwp9FPrEKIeDpj6w4cR10+AWVncNThrHccDsRW9PtwYKyUz34Doq4qvr47EWfW/ X-Received: by 2002:ac8:57c1:0:b0:31e:ea20:51b7 with SMTP id w1-20020ac857c1000000b0031eea2051b7mr22339730qta.284.1659538647414; Wed, 03 Aug 2022 07:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659538647; cv=none; d=google.com; s=arc-20160816; b=TebhqslqBrEM48S+Gcgp/UbIbXNjIQdhI0YrOAZ2P9XVQhdLC0jEQDHRMLQHQhJbEc AMm+58LYOJdogWPjOFPjfmqhpvD5NdaIhWGW1moUoOK0oqCSk8HnkjAsX0BziqKbMBUa sP3DG16xdHnfk79vsa9IBAYazlh1qVNwwE/lj4TDVGcdeM3uV4CcHd5xDRX+jJCp9NMY Icde6GVhz7XoeGZj3jsj6hwfA7L+IHf3ZQcXg7vVqwg0rtdZQAlbS/rtEDaT5sanvff+ 14hU2EO+SJuCM2OgbmaWZzSnCGeRJs3m1a0JmcWpm23VCuqOdml3GGTSlZZA2CP37FwD +f9A== 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:references:in-reply-to:message-id:date:subject:cc:to :from; bh=wJrt/ZFB/ATb1q9JTcoLDx9LAqZNj9cOZFp5/WlLEzA=; b=JUe6xGkB6Q0PH11CIMkvzHdGsi/6n+2H7HYwUwgwa+9eoeLxkDm5NXsCBJTRQkpvMv emlk1hgzMz5z42YagyR3yc2Avz5AZrSQ4icLF812ZoauKyAdy1cBquxF0gynCa8Ttz+K NRw+MHfhtnOFSahxLUZ3AYZPN6C335qn4rUjRY0AKatseDdewVamagt7m6tiXeOFe4Ie SY/Qik7pRbqbtd2spd6USLq2oWltiqDAPKTnalsDGga6oq1vvCxBXcR8kzTBqcX4azDP y7RHT6IIy088HunAVTTNoiKF5a4U8Cs260QgHIvu3JV2EV0JNqA7If/FbNhEqhHrnggA EcLw== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r4-20020a056214212400b0046e741042b3si4627510qvc.196.2022.08.03.07.57.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Aug 2022 07:57:27 -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; 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" Received: from localhost ([::1]:51678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJFoM-0001o4-Ql for patch@linaro.org; Wed, 03 Aug 2022 10:57:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJFnJ-0001iz-MP for qemu-devel@nongnu.org; Wed, 03 Aug 2022 10:56:21 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:53027) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJFnH-0005qt-R7 for qemu-devel@nongnu.org; Wed, 03 Aug 2022 10:56:21 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N1feo-1nHPlv32nQ-011waR; Wed, 03 Aug 2022 16:56:15 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Peter Maydell , Richard Henderson Subject: [PULL 1/3] linux-user/flatload.c: Fix setting of image_info::end_code Date: Wed, 3 Aug 2022 16:56:11 +0200 Message-Id: <20220803145613.428167-2-laurent@vivier.eu> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220803145613.428167-1-laurent@vivier.eu> References: <20220803145613.428167-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:Lr7n808hpcUaD00oh3QJaa0FHLrEXBFu0/qYupJX/lfoENFSvsG FW1lGgVsNtKs94qQcsef596rHW0tldUQU30gMTpS9qxtmyEaLrIiAsAkk1sR5XKLGMePLP1 MzWq+Svd23P7Dn61JthcPMxSf0RK35MbNomZJQ0bKYtHVY1fxNUphilHAhjwVqEDS7licPu qFq997PMeuQbnrqZHCzfg== X-UI-Out-Filterresults: notjunk:1;V03:K0:99P32HVzIpU=:dTTA2QnvRzKMiJap/8bxX2 YzUxrO93D2S6b/r61jSh5qj/AhNkyEQpbmxPGQMe2TwrKegPFwIDcqx72JwA/fvyEEvv3LK3j LViSjZ2IcJd5071rbO+vVzEohscEUm+5sWWmX1Iry/t5LtlWokj4X0K0a6cX53uE5I3WMttPX MkmfcbR58Sw1m5LRtlKWhC+UOtFNRo9cQr32j/eB//zUBULnqExCuBfa/1KvEur7xq6IgkgdN r8q2gx7ZKh3ALBIZDGqzhjD1FIySxgregcGrV7NXi/D9q/9lWdrHuK0clPf2S5MYPEXk2X2Wx DnKYQMKZfi8/Y602DzGzdYA2gMsgRP3kyegM1WsOdKYPmyaBsYi222rvvVZDmbblgh8Y8ATtk GoCqxgMaxPN06STgAAs1TeQ8Nw3B0lgxooPEP+07fD9E4H1wvxaqebbHTjJiR8g6xfL8Nnt95 rfAT4UjG7sPDhkhmFYb+gQmhJu8/0HtGPATOC1XIY5QRwG+efpN/vhOO5r4UNt+kyB7YmLMok V6xT4T6GosY5RY5WsF+CXUzvxiO8fhPQ0gjD9EXCRKqy9KpeBogrDXnXldtk986iKdBj/gCmw yw+e7kwZXORC0zMXtJ+trup0Fm9PQYvn1Y1daEB5zvNWoydBUUTbRE6M6WrtnXWndrHIiQ6sw CiG3Jpt2coqP6J7gkUviYhALJPXCfBmt9Fj3PB0irX6qjok4WpA61ZFfKJgD/w5eiZ0BmqE9B N60ntL5lsB3GYyUdvz55wSgmvgmKZs/aJRHQ+Q== Received-SPF: none client-ip=217.72.192.74; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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" From: Peter Maydell 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 Message-Id: <20220728151406.2262862-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- 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 e4c2f89a2267..e99570ca182b 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;