From patchwork Sat Sep 24 11:44:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 12987588 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2E46EC07E9D for ; Sat, 24 Sep 2022 11:58:24 +0000 (UTC) Received: from localhost ([::1]:58296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oc3nb-0006cY-6B for qemu-devel@archiver.kernel.org; Sat, 24 Sep 2022 07:58:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3au-0004NA-OB for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:16 -0400 Received: from mout.gmx.net ([212.227.15.18]:34955) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3ao-0003QX-PX for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1664019904; bh=lFc+aSczTf/lfEWnrgRAr9DsesvWR7zUq4s0rUImplE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=DjBiPYVu8PdsWcj0Qn3SFZyPcs5ECbzGLL/VyF61P13TM+sSGFtDDdFll5DXss7D6 sYNpV40VYrNiUbmUuFltszHvJjcm0hfRSmmoh0+REY6Vnb0l1I1UkYPt1KJUDVO+vG T59CnkJJu3/nRCngKGVfUwJ30H+mnZVk6ysvzjzc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from p100.fritz.box ([92.116.155.187]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MfYPi-1pDKDw1c8O-00fyRS; Sat, 24 Sep 2022 13:45:04 +0200 From: Helge Deller To: Richard Henderson , Laurent Vivier , qemu-devel@nongnu.org Cc: Helge Deller Subject: [PATCH 1/7] linux-user: Fix TARGET_PROT_SEM for XTENSA Date: Sat, 24 Sep 2022 13:44:55 +0200 Message-Id: <20220924114501.21767-2-deller@gmx.de> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220924114501.21767-1-deller@gmx.de> References: <20220924114501.21767-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:SSnw3jWag7EDyaKLVBnQ1aKZQZMaTwIF245BGGn8NmWtlPwygfs G1rYMxSCXnjTC5ItzM5N/iHwkQsEFuinhwL+g6nFFVMs35pmOc4AGhulBmcNjxWqS23q0Sn TClDwy/YtA4gq35e1q3IFzdpnhQMjVdFzNxHmM/3UrZPY/pzIR4jFLyWOg1PAgF7pk9IuNN X/ayybd9bEpL2fvm7/eGQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:oRWQNlyahjM=:zlc0Nk6hhyxn/nOtMQgY2S j80ixdpC1XFJSFe+k7uPuc8EswrPZa3220AbGVaz845bKSQANuJW5YueYHChw0IOCAihoekuv cTmcdKT6A6Ywb2D43sjRchl1GYe/FCiZl9g5LmLAP+/iD5BpWy1XXxGrpYFVznOZ27iMugXVf Z4O9HcfDQMM1H5dJ5S+Wk0tG7U049KESN16cap9vv84MYnnKam/05Kojxd0U9C33D45+6GzZP J5C0QiTML5d6I0HWQmOmWo32IcxQjwOmFw5z4trFOo3wXAttQkhxxpGWWOeq8Odt9M0miB1tD 5+eH+RuJC2F11XUvulCihwNexF43ITSx64VaQwuvhZJlHH1SqSMRib/snxXj5AQgoFIY0X975 eYx0WGwb9TCNMgt//yKcs9amP+gCvj804cwiz65tWDIBeTZt0ACQfRTqHCJl08bqjt3gyFQj2 cMmheMP6taywyMVIim0YR56Oid3X7Edcc8rHwlX3PliMOr0ibRb+7htCO4tUGcv/ZFdPzlO3Q HlsALTgwBkVu7D5bS88Qz2gs0yr+D5ait4fVITEFTDUpaPOUvr48iZlt5kDX4uNh+RUWQpp1/ DKN+SoTcOAgxym3/35bztsk0SWa1rLAVLanEiqeQB9CS5WZiKJUxFMlSWrRW158b+INRnyNWB QBUbmu5hrmOT7bPN/XiaXbHWaBqI2jerj8r6vsayR4YjziAOe1jW80axeEgyp/9M/aB9q7f4K q34LXBXlA588tu/PKWwvm8Hfj76ncDf0T/HDKakKiGUMZcliOcOEXFGL1Q71XCOHGB4+ltSl7 L0UtUH+JE97Xm8OiA6OJ+UbfZVH8R/6X6NBjFNd31xjYrlZzQwk21WdMnh2RaCkdCzrrniH7/ U7MOnzX4+HCKUjTr3wSEENcjImOjM8uADwrJtb+Be+azYmvycTP3B4uzA/+S9u0q655yhZrpw JV5WajUHMpSByaY2hmHzJxJFc4ru+cUK/f8/WjQyMbSY+0lscph9ueddoQeL2Lmw6L0Xh24Gu pU197D+mGd10bHlXotrv7Ikxq/G0zrwl/sxx8PFiwVNcTUa7c4oqxNF0LDSy0hosvRGMBS4Fu P7okZa0ZAv81tLLAIzl0MNQWLl+HY1UwBf/fWmiLpmviMhe/GNSJMGgKmRbqAA7FvCYwoDWXa FN+iTiTXtJUhTqet6ilq5rlQBK Received-SPF: pass client-ip=212.227.15.18; envelope-from=deller@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The xtensa platform has a value of 0x10 for PROT_SEM. Signed-off-by: Helge Deller Reviewed-by: Laurent Vivier --- linux-user/syscall_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.37.3 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 85b0f33e91..1e3577bfa5 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1246,7 +1246,7 @@ struct target_winsize { #include "termbits.h" -#if defined(TARGET_MIPS) +#if defined(TARGET_MIPS) || defined(TARGET_XTENSA) #define TARGET_PROT_SEM 0x10 #else #define TARGET_PROT_SEM 0x08 From patchwork Sat Sep 24 11:44:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 12987585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DD660C32771 for ; Sat, 24 Sep 2022 11:54:41 +0000 (UTC) Received: from localhost ([::1]:55054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oc3k0-00035w-Lp for qemu-devel@archiver.kernel.org; Sat, 24 Sep 2022 07:54:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3as-0004Kk-D9 for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:14 -0400 Received: from mout.gmx.net ([212.227.15.19]:46535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3an-0003R0-2O for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1664019904; bh=Jn37Ns805be5TNP0dnWflE8APtxrU6ZlAd65bpZKf/Y=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=N2XJYBxH4O87zk0X6RfNGxxMUK9sw9K1/nZtdLIGATi3jah0bt5PwiJlGQlVzDoGi pK/Tk5SBfocbIdVYtwSMdjRnRY7YYmSmV2AF633NmfDhTRyLp780gwDz9xPfsIIyt+ AhlpJfvTT7UYJMrzHr0DYhotkbLE1tXYcCmXCaBk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from p100.fritz.box ([92.116.155.187]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MqJm5-1p6QTb2IAF-00nNEj; Sat, 24 Sep 2022 13:45:04 +0200 From: Helge Deller To: Richard Henderson , Laurent Vivier , qemu-devel@nongnu.org Cc: Helge Deller Subject: [PATCH 2/7] linux-user: Add proper strace format strings for getdents()/getdents64() Date: Sat, 24 Sep 2022 13:44:56 +0200 Message-Id: <20220924114501.21767-3-deller@gmx.de> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220924114501.21767-1-deller@gmx.de> References: <20220924114501.21767-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:LO34WL182r4WzLKWNWvbZjjWJaDNX9JI1fspoWZJvKs4+I7xBbK V8J75YJCHilG2JblLbsTiqiLus3ng8kjehVfT0LoV3lvNse8XiaFEbrS+3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17oIZigGFFg8dA6TovD7WVXRcPhaueWvxms5YFPrhSlZmp7WSj 4GLR1Ul/fHWVDXXqzP7jlqVqqRMZs0GKAKc+qMLl3o0420XMgiyhLFrh0jPjt7AuP3qgBmyGo fxCbndYnWaSHqv9v0jJ23RoKeWR8l2yNAX31OUO94Lm37NP9S71WSY9nBIhWSyJG/guwTPNWi EI0XlY+M6bZQq3NEPaFJ+wS8DmjCoOMyOzRBuUsJ+XColROmyjDshfxtW9bRuoIW6N91Kqyrk aLjGx0SNbVmB0zx5mW0bFmwMlO Received-SPF: pass client-ip=212.227.15.19; envelope-from=deller@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Helge Deller --- linux-user/strace.list | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.37.3 diff --git a/linux-user/strace.list b/linux-user/strace.list index da8c1bf34e..bfef568d18 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -285,10 +285,10 @@ { TARGET_NR_getcwd, "getcwd" , "%s(%p,%d)", NULL, NULL }, #endif #ifdef TARGET_NR_getdents -{ TARGET_NR_getdents, "getdents" , NULL, NULL, NULL }, +{ TARGET_NR_getdents, "getdents" , "%s(%d,%p,%u)", NULL, NULL }, #endif #ifdef TARGET_NR_getdents64 -{ TARGET_NR_getdents64, "getdents64" , NULL, NULL, NULL }, +{ TARGET_NR_getdents64, "getdents64" , "%s(%d,%p,%u)", NULL, NULL }, #endif #ifdef TARGET_NR_getdomainname { TARGET_NR_getdomainname, "getdomainname" , NULL, NULL, NULL }, From patchwork Sat Sep 24 11:44:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 12987586 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D7F81C07E9D for ; Sat, 24 Sep 2022 11:55:03 +0000 (UTC) Received: from localhost ([::1]:48916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oc3kM-0003er-6X for qemu-devel@archiver.kernel.org; Sat, 24 Sep 2022 07:55:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3at-0004Lo-SU for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:15 -0400 Received: from mout.gmx.net ([212.227.15.15]:48391) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3an-0003Qq-1L for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1664019904; bh=ljqkKXznJzX9TgABKStdjkw7mBu4gZIwRnYEMPdc0Nk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ck2J9vX8ol5SL4sOEDcmi2dz0MjgVnUT6Htm/95nbbJSgwn4Dx/PnhZHGRu/Y8N+T 2lqVXev2p27Ot7P3JyAeLBwE+97PHm87xmhnlfL+XGFgeqy32sEEbbiH6lVdXl9vNH fmgHvaWYTHjtEt7A7FfcVpvApVFAc3pwNlcxzXvw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from p100.fritz.box ([92.116.155.187]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mk0Ne-1p04gS2y7M-00kMAg; Sat, 24 Sep 2022 13:45:04 +0200 From: Helge Deller To: Richard Henderson , Laurent Vivier , qemu-devel@nongnu.org Cc: Helge Deller Subject: [PATCH 3/7] linux-user/hppa: Add signal trampoline for hppa target Date: Sat, 24 Sep 2022 13:44:57 +0200 Message-Id: <20220924114501.21767-4-deller@gmx.de> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220924114501.21767-1-deller@gmx.de> References: <20220924114501.21767-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:SjGi00umzcJqHOb6307zBG9ZrpcKPI9HaJY5CHtU0YpqINJCVHi 9o2D/fPR4DuIMLP65UVo1V/ZVZ8wCGobWV1UWrKNfTaPNNRT2EPtvEGneqVX1LX/a0jbysz 0u5GMDgLV3qTUM6pKwc3zZHV4E/KRLacPVKGfEQkIwe4V3oJmBWw545kL+2IAOvbVK9yY1n Nz5Nj2el2Dz0iW+P23fQQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:DlWbEM4nQG8=:JaHedRlZpoii9TAb074rlI s6XuSHAoq7Jv2a3aAmImtLPOzYSLjgwdc/x3EK3Quy5tAGiG3nBOR+JZGTQgiKPgiMYEnLgVg t36kb4Ay3o4q2RInrFD/14SM5SdMhjpJNP8WdT6FU5rhv+DBuNlmtPU4C1iO+25lpLJBf044w cnT7BGJb6PJWuqOXwkUhYgWGvTo8wMzKPB/BZMOj0hMtE+9P15YfThszHbHYl7g7ULyimfciq 4fPZYDAY/yMypJt/5Vl5HcXtdtvYuHiew3jpO3cLCfQDalZslAsOFbxNADI/YXPVW0KTErcxG BK0nTaAXCVz8IBC9gZrImATLYQJR5ZNDnMGsmSI/CXXsP85nO4Pg3DEgR3r0RGw4ky1Sn2Ifb q1VGAYSwaPrFCT0vq90REXTs83mq9X0KDoBo+rtwKCWwmVxZwBuukv6w3WOMh204dujXdo8fV I0QGqQrzJEBSxN6NVmWeV1REhjDRNolYJ9dTEPtw9LaVW26cTtH7hPHetCBlYxDO+elyOv6RX SEuYa2GeQEMO5xmihsm7R+6oLcRd/dTlRLp2vJg3GVBOdLWglyCEjT18Iy11mXqdPD+wqBLny FXn7lEABeyPhK1x/3OuY8AIbiqYLR6tp+U94zbdMcUb92wyBbs5qzUNzvlij/R06XOGM2J+Yq Z24ugFIJ5c5IRIlJBKUJYyXzavBAfDtDMOh7eGKcCKocKmsbz5icynXr08cd9DwdBiQpp9SeR BMrFYdbkyMNbauCfyh2MQXWs691rZiUqebyZz0rOBZLl5S+p0GjEAOKPygqHZvRNvNKOzY3GZ RyYkzZ3gwe4/jsrY+2uQCxzUHX34oLz/U2uRJ7tjjtT+wY2IMWP66QWtGvDupflCmEKlOSiMn Xdvlif+sk+lNzeCM/gAXaOtHTefKPhuISHt50IUsgSUiis+Y8//jQzZMb6HnvZGfAScJ2V9jg T4QwbIY6Ja0U00rHp7l9J6vtQk0vMu7hW/S7TaC5IiAgLPBGi+B6wRrdBYGiIS1cQmDgcQNeX 0Y/4tiaMKJGtALBfzXuunWXz6S/Eq57iWr5ufPVbUA3xqc5cWMzVhE306K1wBa4Kl4PTp1Lk0 L+U1NpU+iFWdKU21BltuJlFvHjbeRbdm/dMee/mfzN+hGbj+hEyMG8gRx8DvFnw3bTjjNMO/6 puT3UZQJ/HghzQMS6eLosYh6j5 Received-SPF: pass client-ip=212.227.15.15; envelope-from=deller@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" In Linux kernel v5.18 the vDSO for signal trampoline was added. This code mimiks the bare minimum of this vDSO and thus avoids that the parisc emulation needs executable stacks. Signed-off-by: Helge Deller --- linux-user/hppa/signal.c | 41 +++++++++++++++++++++++++-------- linux-user/hppa/target_signal.h | 14 +---------- 2 files changed, 32 insertions(+), 23 deletions(-) -- 2.37.3 diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c index 962f551c04..396e310dc9 100644 --- a/linux-user/hppa/signal.c +++ b/linux-user/hppa/signal.c @@ -41,7 +41,7 @@ struct target_ucontext { }; struct target_rt_sigframe { - abi_uint tramp[9]; + abi_uint tramp[2]; /* syscall restart return address */ target_siginfo_t info; struct target_ucontext uc; /* hidden location of upper halves of pa2.0 64-bit gregs */ @@ -101,9 +101,15 @@ static void restore_sigcontext(CPUArchState *env, struct target_sigcontext *sc) __get_user(env->cr[CR_SAR], &sc->sc_sar); } -/* No, this doesn't look right, but it's copied straight from the kernel. */ +#if TARGET_ABI_BITS == 32 +#define SIGFRAME 64 +#define FUNCTIONCALLFRAME 48 +#else +#define SIGFRAME 128 +#define FUNCTIONCALLFRAME 96 +#endif #define PARISC_RT_SIGFRAME_SIZE32 \ - ((sizeof(struct target_rt_sigframe) + 48 + 64) & -64) + ((sizeof(struct target_rt_sigframe) + FUNCTIONCALLFRAME + SIGFRAME) & -SIGFRAME) void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, @@ -118,7 +124,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, if ((ka->sa_flags & TARGET_SA_ONSTACK) && !sas_ss_flags(sp)) { sp = (ts->sigaltstack_used.ss_sp + 0x7f) & ~0x3f; } - frame_addr = QEMU_ALIGN_UP(sp, 64); + frame_addr = QEMU_ALIGN_UP(sp, SIGFRAME); sp = frame_addr + PARISC_RT_SIGFRAME_SIZE32; trace_user_setup_rt_frame(env, frame_addr); @@ -139,14 +145,9 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, setup_sigcontext(&frame->uc.tuc_mcontext, env); - __put_user(0x34190000, frame->tramp + 0); /* ldi 0,%r25 */ - __put_user(0x3414015a, frame->tramp + 1); /* ldi __NR_rt_sigreturn,%r20 */ - __put_user(0xe4008200, frame->tramp + 2); /* be,l 0x100(%sr2,%r0) */ - __put_user(0x08000240, frame->tramp + 3); /* nop */ - unlock_user_struct(frame, frame_addr, 1); - env->gr[2] = h2g(frame->tramp); + env->gr[2] = default_rt_sigreturn; env->gr[30] = sp; env->gr[26] = sig; env->gr[25] = h2g(&frame->info); @@ -197,3 +198,23 @@ long do_rt_sigreturn(CPUArchState *env) force_sig(TARGET_SIGSEGV); return -QEMU_ESIGRETURN; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 6*4, 0); + abi_ulong SIGFRAME_CONTEXT_REGS32; + assert(tramp != NULL); + + SIGFRAME_CONTEXT_REGS32 = offsetof(struct target_rt_sigframe, uc.tuc_mcontext); + SIGFRAME_CONTEXT_REGS32 -= PARISC_RT_SIGFRAME_SIZE32; + + __put_user(SIGFRAME_CONTEXT_REGS32, tramp + 0); + __put_user(0x08000240, tramp + 1); /* nop - b/c dwarf2 unwind routines */ + __put_user(0x34190000, tramp + 2); /* ldi 0, %r25 (in_syscall=0) */ + __put_user(0x3414015a, tramp + 3); /* ldi __NR_rt_sigreturn, %r20 */ + __put_user(0xe4008200, tramp + 4); /* ble 0x100(%sr2, %r0) */ + __put_user(0x08000240, tramp + 5); /* nop */ + + default_rt_sigreturn = (sigtramp_page + 8) | 3; + unlock_user(tramp, sigtramp_page, 6*4); +} diff --git a/linux-user/hppa/target_signal.h b/linux-user/hppa/target_signal.h index af6c2fce58..190bb3d653 100644 --- a/linux-user/hppa/target_signal.h +++ b/linux-user/hppa/target_signal.h @@ -70,18 +70,6 @@ typedef struct target_sigaltstack { /* mask for all SS_xxx flags */ #define TARGET_SS_FLAG_BITS TARGET_SS_AUTODISARM -/* - * We cannot use a bare sigtramp page for hppa-linux. - * - * Unlike other guests where we use the instructions at PC to validate - * an offset from SP, the hppa libgcc signal frame fallback unwinding uses - * the PC address itself to find the frame. This is due to the fact that - * the hppa grows the stack upward, and the frame is of unknown size. - * - * TODO: We should be able to use a VDSO to address this, by providing - * proper unwind info for the sigtramp code, at which point the fallback - * unwinder will not be used. - */ -#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 0 +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 #endif /* HPPA_TARGET_SIGNAL_H */ From patchwork Sat Sep 24 11:44:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 12987583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5778EC32771 for ; Sat, 24 Sep 2022 11:51:09 +0000 (UTC) Received: from localhost ([::1]:50942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oc3ga-000091-8e for qemu-devel@archiver.kernel.org; Sat, 24 Sep 2022 07:51:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3as-0004Kj-CH for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:14 -0400 Received: from mout.gmx.net ([212.227.15.19]:45065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3an-0003Qz-1c for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1664019905; bh=oS0kxEt+F0E35jkxOGn6ha6sD9LlgtX+JRCZyYDzpiA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=aX/T2H1ILKgTFqavzugpoNmiMuwLolfZUX8e0dhIVNdiswcQ29xpihKFo6kz9CjSE /USSUgWtpXKYmWqPPTV43+Jjr+uR4rFw2tK4L6PU/wr8inf3gULkESoDvO6o0an9+M uXJEMgbun0abI1haAZcckAKcwJSsV0z94Bs//fUw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from p100.fritz.box ([92.116.155.187]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MYvcA-1opAbg3SwC-00UseE; Sat, 24 Sep 2022 13:45:04 +0200 From: Helge Deller To: Richard Henderson , Laurent Vivier , qemu-devel@nongnu.org Cc: Helge Deller Subject: [PATCH 4/7] linux-user/hppa: Drop stack guard page on hppa target Date: Sat, 24 Sep 2022 13:44:58 +0200 Message-Id: <20220924114501.21767-5-deller@gmx.de> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220924114501.21767-1-deller@gmx.de> References: <20220924114501.21767-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:yVQSzZ/ST5tvwbbdjx8o2XA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O/R6O1tmD4aM23AOGSxMQhS9lJU0SYKUsD6evcFea1Y9gCC8tYi dolQ+tNazbqxXz7XGUzkZ5PaPiKwcGdKJDt8DM81ZuYiXGSOsQQ3ld1UClhY8FH52kkdzsPPE 9AHAruklxTFaZqIcAoV544vXjRDSWZTxV+czBJVybMdTg28EVmRjYpRS8NVJtxouFBiZIMtdJ u5IE24Gesj5gd9b/1Ylp3H1ofRzJM+Tj4okw33ZAMgQi9V2eg3H0KpqmOZ66ODaI0JNevkW+/ 4mb+ZeEXbHJmkV5OHxpQ7NW3pXZGiAM6aPMid3CiY2JRlQ3S/is/Z+yTEFNheupyPDirmFkJK aCZ00qWb7ybMM3vjzzzs9bbgll Received-SPF: pass client-ip=212.227.15.19; envelope-from=deller@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The stack-overflow check when building the "grep" debian package fails on the debian hppa target. Reason is, that the guard page at the top of the stack (which is added by qemu) prevents the fault handler in the grep program to properly detect the stack overflow. The Linux kernel on a physical machine doesn't install a guard page either, so drop it and as such fix the build of "grep". Signed-off-by: Helge Deller --- linux-user/elfload.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) -- 2.37.3 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index ce902dbd56..51ec5dd668 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2033,9 +2033,15 @@ static abi_ulong setup_arg_pages(struct linux_binprm *bprm, if (size < STACK_LOWER_LIMIT) { size = STACK_LOWER_LIMIT; } - guard = TARGET_PAGE_SIZE; - if (guard < qemu_real_host_page_size()) { - guard = qemu_real_host_page_size(); + + if (STACK_GROWS_DOWN) { + guard = TARGET_PAGE_SIZE; + if (guard < qemu_real_host_page_size()) { + guard = qemu_real_host_page_size(); + } + } else { + /* no guard page for hppa target where stack grows upwards. */ + guard = 0; } error = target_mmap(0, size + guard, PROT_READ | PROT_WRITE, @@ -2051,7 +2057,6 @@ static abi_ulong setup_arg_pages(struct linux_binprm *bprm, info->stack_limit = error + guard; return info->stack_limit + size - sizeof(void *); } else { - target_mprotect(error + size, guard, PROT_NONE); info->stack_limit = error + size; return error; } From patchwork Sat Sep 24 11:44:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 12987589 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BEAB3C07E9D for ; Sat, 24 Sep 2022 11:59:28 +0000 (UTC) Received: from localhost ([::1]:57852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oc3od-0000Py-Jw for qemu-devel@archiver.kernel.org; Sat, 24 Sep 2022 07:59:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3at-0004Lm-Rc for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:15 -0400 Received: from mout.gmx.net ([212.227.15.15]:59043) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3an-0003Qn-Ui for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1664019905; bh=prBuuUKqXQ/QQZOTLE66uCdrZzZWYpud5lfUUjs7PRk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ggxE4kRbj3RpIUSjHFJAyL9LFgh4SzvR2R9ZErhcTg487UkDZa62lR+HX+726Po7v hitN0LcxH2w/4NOLH9kwXI/i9xwWkzvEx3APc0dCsycqcdnhpHfEWLKgIDEbvAs1Ld IfP75xtqCVAdyC/YxZOUQd7lLUb1YMUnLY8lYXhQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from p100.fritz.box ([92.116.155.187]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1My32L-1pTTdH3xrr-00zYxV; Sat, 24 Sep 2022 13:45:04 +0200 From: Helge Deller To: Richard Henderson , Laurent Vivier , qemu-devel@nongnu.org Cc: Helge Deller Subject: [PATCH 5/7] linux-user/hppa: Increase guest stack size to 80MB for hppa target Date: Sat, 24 Sep 2022 13:44:59 +0200 Message-Id: <20220924114501.21767-6-deller@gmx.de> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220924114501.21767-1-deller@gmx.de> References: <20220924114501.21767-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ok+i4KaY1Q5D4nXvPPLl7oC3RUd+WsmUW0Z/yy4snOUrCBbrjdZ OCkvpG0w1JlrH5lZwlaZeIXOZk0dCjbDzYypQfPS+LM3y0ScvucHpkvEJ+dWfn52L0L74SK mZ8ZXeaWJ2Wq4IUFATFjWC1ksySclrOYpKUlZWMSf2guTWBH1t+sBusU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NEi8Bu5LP1UANvkEuk+bjsqtz+f0yEUQtQLIcaDCnB9L2A395w8 nTVKmgFF8KvbM4uun1QvXcrblv1WU9435/4pfO2czyQd0Nm98xnHLXaucZdVQMn9FNcuvcVuM 2pEKhCzRFXgqSjjGfGlEV6MfBsr8I+DasYT0MjRSMHrX41sIZ90p+4GrVsp19xlTP9OxWo7AL LrvlIrUaoYsf/WuJlz4MOx2M3w Received-SPF: pass client-ip=212.227.15.15; envelope-from=deller@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The hppa target requires a much bigger stack than many other targets, and the Linux kernel allocates 80 MB by default for it. This patch increases the guest stack for hppa to 80MB, and prevents that this default stack size gets reduced by a lower stack limit on the host. Since the stack grows upwards on hppa, the stack_limit value marks the upper boundary of the stack. Fix the output of /proc/self/maps (in the guest) to show the [stack] marker on the correct memory area. Signed-off-by: Helge Deller --- linux-user/hppa/target_syscall.h | 2 ++ linux-user/main.c | 9 +++++++-- linux-user/syscall.c | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) -- 2.37.3 diff --git a/linux-user/hppa/target_syscall.h b/linux-user/hppa/target_syscall.h index 4b382c1fcf..9a8f8ca628 100644 --- a/linux-user/hppa/target_syscall.h +++ b/linux-user/hppa/target_syscall.h @@ -26,4 +26,6 @@ struct target_pt_regs { #define TARGET_MCL_FUTURE 2 #define TARGET_MCL_ONFAULT 4 +#define TARGET_DEFAULT_STACK_SIZE 80 * 1024 * 1024UL + #endif /* HPPA_TARGET_SYSCALL_H */ diff --git a/linux-user/main.c b/linux-user/main.c index 587bd02db2..3a86feb09a 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -124,10 +124,14 @@ static void usage(int exitcode); static const char *interp_prefix = CONFIG_QEMU_INTERP_PREFIX; const char *qemu_uname_release; +#if !defined(TARGET_DEFAULT_STACK_SIZE) /* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so we allocate a bigger stack. Need a better solution, for example by remapping the process stack directly at the right place */ -unsigned long guest_stack_size = 8 * 1024 * 1024UL; +#define TARGET_DEFAULT_STACK_SIZE 8 * 1024 * 1024UL +#endif + +unsigned long guest_stack_size = TARGET_DEFAULT_STACK_SIZE; /***********************************************************/ /* Helper routines for implementing atomic operations. */ @@ -690,7 +694,8 @@ int main(int argc, char **argv, char **envp) struct rlimit lim; if (getrlimit(RLIMIT_STACK, &lim) == 0 && lim.rlim_cur != RLIM_INFINITY - && lim.rlim_cur == (target_long)lim.rlim_cur) { + && lim.rlim_cur == (target_long)lim.rlim_cur + && lim.rlim_cur > guest_stack_size) { guest_stack_size = lim.rlim_cur; } } diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 4bbf46b622..d17f5d1c66 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8043,7 +8043,11 @@ static int open_self_maps(CPUArchState *cpu_env, int fd) continue; } +#ifdef TARGET_HPPA + if (h2g(max) == ts->info->stack_limit) { +#else if (h2g(min) == ts->info->stack_limit) { +#endif path = "[stack]"; } else { path = e->path; From patchwork Sat Sep 24 11:45:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 12987584 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 52EE6C32771 for ; Sat, 24 Sep 2022 11:52:07 +0000 (UTC) Received: from localhost ([::1]:33764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oc3hW-0000ij-7H for qemu-devel@archiver.kernel.org; Sat, 24 Sep 2022 07:52:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3at-0004Lh-Ng for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:15 -0400 Received: from mout.gmx.net ([212.227.15.19]:58593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3an-0003Qx-2A for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1664019905; bh=iBQTvRWn/tCi0bI0VQceSHERcxvx6dX6scs3iCTZovE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=YhR/yQ/zu5oKFc9t9CYtioejfU5cQYmXcjz0MLAUnYHpnh1/8eRM4yDMEOmGN4Rff BRSPDlPZDzYlt61EqV2zPvRuPfSjikSinCP9nD5RwQgP2CYVTNlNE3enp57hRjJ5Mq kfsqjvVqk60sqqLgwCaIqNyQkalGi4OaTS0XLkh0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from p100.fritz.box ([92.116.155.187]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MYeMj-1ootco0FDH-00VhrR; Sat, 24 Sep 2022 13:45:05 +0200 From: Helge Deller To: Richard Henderson , Laurent Vivier , qemu-devel@nongnu.org Cc: Helge Deller Subject: [PATCH 6/7] linux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in mprotect() Date: Sat, 24 Sep 2022 13:45:00 +0200 Message-Id: <20220924114501.21767-7-deller@gmx.de> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220924114501.21767-1-deller@gmx.de> References: <20220924114501.21767-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:eiwKm/IQDzRHmIlm4FfbWTu4y8kDkpq5MA84r66KZ1Pc3xdBf1Y xVhpEcP8H7WQHBfJPCTriQJ6ruGiS1OXeRxXp2ZcAIPBhG8RUAWAWg1yh8dn1kpbiNkh2my 4vZ3HvVC3CPLDPV95hxvBGqYcgKFTwhzr7mN4+FzYXgfo6KLLdOMTN7yDhtniRePa1wudJI 6K8bBFZqglT5LhTGPXwQg== X-UI-Out-Filterresults: notjunk:1;V03:K0:/aH2kct9kuc=:HCNiVWbBXvUmdGWS4kRb1U 4hATUkC5THIJ5AmPvevnA6UZDuG/b3YmKoE+jaMompbfl2wbu73vN7m91u42wMl/PB865d7p1 MijirJa2AFi8ZvWx5fKn7lpzHyx0zJr+LX/UHhiEEEqZen7lb+pEpIfMyt6+J+ZHgbSLNZTLH 6qnjH5ZDYTRFk2vhlhrrXsKwXp3lh/T9gqVjqvwhOufweHXo2xAK1TGJRS1a3u11m/I/AcvIv SPngzItg1ZtlcJqfyJ2B55f5TCa4hWwvgPwrECVbQjnMoCUgjICB798YouVJj97swrGGPFmGJ cFxey7T6o2kpfuyRGp1Nw1Gyp92ZNNib1d1rY9Kdqhemq0pBfCOOUahgrQVKRd4VHYhfx/lrZ dDF3Ttnh1ckNOfINJ36XQLEunoXY/qLYGcUfEVYCkz/WGkLM1UyqeFPce/zVr48u5beVfXvzY E8mPgdWondjUhJe01hMsmuWfAT44o8L7lc/t85SCvcqZsLl/Y0r2K6auDj38ppu1eJCbB/WNa C3N1YD6mb9RCj/f0Jv+K+H0zqZKHI1ZpX5xzSM55WVu2v4h2FfpvPJRDDZM6UEL9Wtx48AgVL Tdfk5vtT3luQPSxFVrLQen/8t5ivbsYaZo6slHYMAd2XtegmhFXh6xEoq9C7XL41LTQ+Yetdu k237Moe9SUCFn8O4zjoiJtaDbEClQDhFk2Aq3jL2BZ9QyCXhG5CfLf44AySrn/L64ZBzBHnUh 6VwJo7KtlbjiwgJk27ZU9zeEyZ8H1Q/Zzfew1uRCGwEyFCV9lcyEkBnyYTPBDUUZxRzmUgz6/ bsB9pTqipT+lq2ovVNIdVxGRAqkfbKI07seQ53t9uIl2+9jis+dnvKzIXkZM7HNfNEn9GTvfu /GYlC3vbCg4vQszi9UIH4GSY975BMLlgQtueuP28D2COj10pIhO3ESNLIwtviiMFk9TuRNntI vC/mSTHF5ZDI93qBxYA3jh39whPGPruhhzlYPtyhjn8ltfjrpHb0jG6vHH9EvcQgmupMBA/ON BzHkgR48mQsW8hMA3WF43GDL7B0Yz1eiDNLtsDgOSNZ1bPWXsX+XdHdqLfGXlmYqn7YA3bTpe 4HmBr0U2uEdHF7yH9JDBDUsZRo9UUX8lpHLs6AGe4Nmc+mOF61ogWbCTpm40pog9vZhUcSVzq 1bK+60hiyBgnwJ12E7pc0VaB5X Received-SPF: pass client-ip=212.227.15.19; envelope-from=deller@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The hppa platform uses an upwards-growing stack and required in Linux kernels < 5.18 an executable stack for signal processing. For that some executables and libraries are marked to have an executable stack, for which glibc uses the mprotect() syscall to mark the stack like this: mprotect(xfa000000,4096,PROT_EXEC|PROT_READ|PROT_WRITE|PROT_GROWSUP). Currently qemu will return -TARGET_EINVAL for this syscall because of the checks in validate_prot_to_pageflags(), which doesn't allow the PROT_GROWSUP or PROT_GROWSDOWN flags and thus triggers this error in the guest: error while loading shared libraries: libc.so.6: cannot enable executable stack as shared object requires: Invalid argument Allow mprotect() to handle both flags and thus fix the guest. The glibc tst-execstack testcase can be used to reproduce the issue. Signed-off-by: Helge Deller --- linux-user/mmap.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.37.3 diff --git a/linux-user/mmap.c b/linux-user/mmap.c index dba6823668..b7478ad0fa 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -105,6 +105,8 @@ static int validate_prot_to_pageflags(int *host_prot, int prot) page_flags |= PAGE_MTE; } } +#elif TARGET_HPPA + valid |= PROT_GROWSDOWN | PROT_GROWSUP; #endif return prot & ~valid ? 0 : page_flags; From patchwork Sat Sep 24 11:45:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 12987587 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 49687C32771 for ; Sat, 24 Sep 2022 11:57:28 +0000 (UTC) Received: from localhost ([::1]:43840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oc3mg-0005w7-FJ for qemu-devel@archiver.kernel.org; Sat, 24 Sep 2022 07:57:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3at-0004Lf-LS for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:15 -0400 Received: from mout.gmx.net ([212.227.15.18]:36477) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc3an-0003Qa-1L for qemu-devel@nongnu.org; Sat, 24 Sep 2022 07:45:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1664019905; bh=9mDTRgDgEAEQ9XZte8gnccGZQae4pGNUlPhIB0AT4eA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=kuB4TPaqfuPOBqJh49K53pu5yhdJyKTaAhoCMktLTq1mTFGcCy+5h+y9M2vqQJjkU 1b3KeYSoBsom17xqpFmLNAiEnrLnPAtVuTb97qHTutkV3UrvjXx6Kxvl0mQ9xovmj4 96XcsTB9lUvgLL7MNxsmBh2fGYZqOSLGVUO5xgYs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from p100.fritz.box ([92.116.155.187]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MVN6j-1ojNJO0lNP-00SQ4n; Sat, 24 Sep 2022 13:45:05 +0200 From: Helge Deller To: Richard Henderson , Laurent Vivier , qemu-devel@nongnu.org Cc: Helge Deller Subject: [PATCH 7/7] linux-user/hppa: Fix setup_sigcontext() Date: Sat, 24 Sep 2022 13:45:01 +0200 Message-Id: <20220924114501.21767-8-deller@gmx.de> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220924114501.21767-1-deller@gmx.de> References: <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cmJG0CiSt/EK0PkBoquAibCARRYTmNp+4zOcj8K+wZhyF33P/8QnAS4iCKK5CSd46DWtRnI IMlVQwVxcHei6U0xQnoLZDe80hfKqhl4NWrazSM2fWtQy0R9xCgJ5Np+epjEubmLzDnEjJCZU wuhXBdjWWCnZsxvvcT5/akpctCO2XQXd8dGr7eKIWPtJMVLWTy2X9+ba16e296R5+WIgJ1ZG/ 2DDgMrO8VupHEGN0hbHKrZiMj6vbmC1ffXZruJ3wOxqqYkeQLd8U8KYchgnS4jcPdXMd5+WUm nOVeBLnB8k1gpPPnoSWuos3Sj1mtJDJlmvguRFAJoU4SVarOHWqC2A63YedKa517qLDmprxAX HhKUoblKFWNmVypkIzCn9czYao4dj5IsL3CXfBu6SlTopYQGZ9q0mylGsjQY7PDOOUSLyTek2 20H2Zk1i/JbxTH7Y8PO5NTNiyQ Received-SPF: pass client-ip=212.227.15.18; envelope-from=deller@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We don't emulate a preemptive kernel on this level, and the hppa architecture doesn't allow context switches on the gateway page. So we always have to return to sc_iaoq[] and not to gr[31]. This fixes the remaining random segfaults which still occured. Signed-off-by: Helge Deller --- linux-user/hppa/signal.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) -- 2.37.3 diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c index 396e310dc9..f253a15864 100644 --- a/linux-user/hppa/signal.c +++ b/linux-user/hppa/signal.c @@ -49,23 +49,13 @@ struct target_rt_sigframe { static void setup_sigcontext(struct target_sigcontext *sc, CPUArchState *env) { - int flags = 0; int i; - /* ??? if on_sig_stack, flags |= 1 (PARISC_SC_FLAG_ONSTACK). */ - - if (env->iaoq_f < TARGET_PAGE_SIZE) { - /* In the gateway page, executing a syscall. */ - flags |= 2; /* PARISC_SC_FLAG_IN_SYSCALL */ - __put_user(env->gr[31], &sc->sc_iaoq[0]); - __put_user(env->gr[31] + 4, &sc->sc_iaoq[1]); - } else { - __put_user(env->iaoq_f, &sc->sc_iaoq[0]); - __put_user(env->iaoq_b, &sc->sc_iaoq[1]); - } + __put_user(env->iaoq_f, &sc->sc_iaoq[0]); + __put_user(env->iaoq_b, &sc->sc_iaoq[1]); __put_user(0, &sc->sc_iasq[0]); __put_user(0, &sc->sc_iasq[1]); - __put_user(flags, &sc->sc_flags); + __put_user(0, &sc->sc_flags); __put_user(cpu_hppa_get_psw(env), &sc->sc_gr[0]); for (i = 1; i < 32; ++i) {