From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28427C433E1 for ; Wed, 24 Mar 2021 10:29:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 87BD0619E3 for ; Wed, 24 Mar 2021 10:29:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87BD0619E3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=vivier.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lP0lK-0007y1-Dr for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 06:29:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lP0kI-00074T-Ev; Wed, 24 Mar 2021 06:28:14 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:48123) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lP0kF-0007cH-5x; Wed, 24 Mar 2021 06:28:14 -0400 Received: from [192.168.100.1] ([82.142.25.162]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.103]) with ESMTPSA (Nemesis) id 1MJV9M-1l5I2E1Kzw-00JuvS; Wed, 24 Mar 2021 11:28:02 +0100 Subject: Re: [PATCH 1/1] linux-user/s390x: Apply h2g to address of sigreturn stub To: Andreas Krebbel References: <20210324085129.29684-1-krebbel@linux.ibm.com> <5070a253-cd95-59b0-dbdb-2eb549e9f61c@redhat.com> From: Laurent Vivier Message-ID: Date: Wed, 24 Mar 2021 11:28:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <5070a253-cd95-59b0-dbdb-2eb549e9f61c@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:vdf2LxqzDu4NmELyKRKdZF0i4VmFVw7KOu6HhBYaohRRhjdEzA+ kxq8LgCeEVBcWTZRsDfKcsUZ6CGyvMuSVAoHCZpg1ZEE8MnJJVthd8DyUtj8Ed3+PJ4DdhO k9GCF9BDzeeqqv3OkzOGH8+Auq4nBB/MY3QYH14SmkKR+69tnEVwWRZRf8+Qgce4PTUXpV1 cM5pkKHmjfBaNgDgsvnxg== X-UI-Out-Filterresults: notjunk:1;V03:K0:cJW3rKYgI4g=:mqHAk92x5cRFqdlXKMz6bn PB9h7pU3Y0EjqFGJ4gRS+GaI4v+HAgd5mo7y1/kLGr2e7FBwQ40PNAYElwjUiMUTtrYgq5AWe s59H2AVcsM7NwHdPJ7ed0YFX4fl78Q2uD1/Fm59oTSoD/p1HBbQ0KvhyT+0nWjYCEbQt4sXVC lEwhRCueSSVzNZFNcGMkKWoVGq+yRymC9JiATTJsYDCMbbot69vEVGLMYfUudUztC/OesRFYF 0AgPBTkne3+tFwKfkhsLb4kPyNaR+PWIwziX6OSUyuvAkK/geXasFc941y6aB1bGKbLLi24sz lRVMnJ+rD3v9LTzHI3J2JQeUTl3lpgUeppOKED8cquSNVDNxkxGD1amNVmVktVjUQAZMSR8q7 U8CiL5h9HAstBhUs6CYYtba7TVn6Do5OTj3i6xaLFNOSZsnN8H5yFtoYeq+JumPvUB0aIJMXz lmnu6w2EEZBRMeaLjpFIm+Q8s0fxJJi2bZRBJ3KK6BtKWDrsBqhZ Received-SPF: none client-ip=212.227.126.187; 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, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Le 24/03/2021 à 10:17, David Hildenbrand a écrit : > On 24.03.21 09:51, Andreas Krebbel wrote: >> The sigreturn SVC is put onto the stack by the emulation code.  Hence >> the address of it should not be subject to guest_base transformation >> when fetching it. >> >> The fix applies h2g to the address when writing it into the return >> address register to nullify the transformation applied to it later. >> >> Note: This only caused problems if Qemu has been built with >> --disable-pie (as it is in distros nowadays). Otherwise guest_base >> defaults to 0 hiding the actual problem. >> >> Signed-off-by: Andreas Krebbel >> --- >>   linux-user/s390x/signal.c | 4 ++-- >>   1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c >> index ecfa2a14a9..1412376958 100644 >> --- a/linux-user/s390x/signal.c >> +++ b/linux-user/s390x/signal.c >> @@ -152,7 +152,7 @@ void setup_frame(int sig, struct target_sigaction *ka, >>           env->regs[14] = (unsigned long) >>                   ka->sa_restorer | PSW_ADDR_AMODE; >>       } else { >> -        env->regs[14] = (frame_addr + offsetof(sigframe, retcode)) >> +        env->regs[14] = h2g(frame_addr + offsetof(sigframe, retcode)) >>                           | PSW_ADDR_AMODE; Well, it really doesn't sound good as frame_addr is a guest address (and sa_restorer is too) Where is the code that does the g2h() you want to nullify? Thanks, Laurent