From patchwork Fri Sep 24 13:56:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 514572 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1496873jao; Fri, 24 Sep 2021 06:58:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/VUdD+lPqqPCFlAsL+vbnBnhunT7vWKSxOQ1wvAPwz/KtdL+iVIHOY3VvdaTphOYFthJe X-Received: by 2002:ac8:6b07:: with SMTP id w7mr2241093qts.282.1632491906691; Fri, 24 Sep 2021 06:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632491906; cv=none; d=google.com; s=arc-20160816; b=nJfgakcc48SI7BiFzKnr9jHahqlshbfdB79L6gj+W5u9VueiORJJtNzTse/gy/yzoL c/mzv1+Qh9A8MHK/WFVTmuq0g9o2pJfjAl9Ag9E6axEUfePDwBIA6PPPh6w3fmTec2N5 1nDw4DB/04x397so2SWFGe6Gu5CsnLGs3xGuPh6jukAXB7PDonDv+OIkxqMo6tJTA44u udfIkMcIOgriieqFq312AL4L/i9Hu+a3NYBMXkaZIpqD1khzMj9qqZV+hDdn44yqBBTr qIya93yf1RtHc5OSx8Ppw41EjH23gw5lPtvneLnES14/akuu5UbVp6UFdZnkDjdIz/Re PjDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from; bh=pQS1Ogr2p3VUzWhBEoXp9pL1EPwJoW6ALRyNamD9xFo=; b=dqZwrrt0tYWULfBTz2RwbmWPvu0pIWPccFuwbe2RDgNaN0O4olz6Q7hOg+uPQh28xV 0IxDvep/sn6//7bUFstIjOXr8brVBD9yrHFwNmRgQofPccVp8hSNkkqqZ7tfszWxTs1p D46I6eD4q4rDpp1S4O6HIBZQTQWL6kr2dk5qX3p4REJq6iQbEyBtXBB0GWGYEtFvq2F0 t2aCVbaLkjSghMEniohdi+Us7yIa1/r1d5J3alStMu5ux0YQsBDHuzgXn/HW24jwDUnf 1xEOMp+z6FMQEYM7QrqcGpa983RZQjgiOjaz2h4weJW2lgkdIj9I9JlYWwUUm5DAnDB2 dnrQ== 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 f14si6112754qkp.247.2021.09.24.06.58.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Sep 2021 06:58:26 -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]:54428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTlic-0004KK-7q for patch@linaro.org; Fri, 24 Sep 2021 09:58:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgr-0002wt-Ua for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:37 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:46103) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgq-00058l-A3 for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:37 -0400 Received: from quad ([82.142.21.142]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mna0x-1nAI7R3vBl-00jdR4; Fri, 24 Sep 2021 15:56:33 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 1/7] linux-user/aarch64: Set siginfo_t addr field for SIGTRAP signals Date: Fri, 24 Sep 2021 15:56:25 +0200 Message-Id: <20210924135631.2067582-2-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924135631.2067582-1-laurent@vivier.eu> References: <20210924135631.2067582-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:fPR3/8rh0PhPJq2VfS7RHrsnKVH7dIdhp/GFaBpA1tqK4y3ot+B 8ST1s+ikw4k1FRiPsf6ktKNj/Y8cyEf0X5e+HiX/E/GW7uZ0AwpOSwaLDnHEGJNMMokI+rk K0rLBIFVfHzmayg405cbDJuIzimafC5SIAdOQB1HGYZgFsiMWbQS5xkfGWOZTjVpiJHh3V+ 4K0s0ZhVlAoYjjM7IlNug== X-UI-Out-Filterresults: notjunk:1; V03:K0:p4A86pW3S8U=:TcCU6kc/qq7AENANt5n4Q7 o8lHi/dQXumLzwJsAmmY4LcRDSNorcpWARm2oAY12cNprC2N9cW7JNfjEg83wx4uTaBtyQGt6 lLTjZeDkq/bBZYtGYHa8SXpldWwIhLxmp1z+ewQq6ou9/+HsI9Pfv+2Kup5eGM9q03VO0B2By S0G48TPFPrKNIOmDRTzvNdAlHZSriA1X10v0Mq8v0Huo2RnLCrVWWI97bljpRpdLiqn0583Cn la3UNAElZbsP32wqQsFxv/ppeBoJkEhmpmdtplKAEKAe2rXHbTyk21iNwcUl6vwb7Yu/CTQQh NqEOsWepBzyFE6yRW2znLCvIlzWMjZDd3b3CdhmJmkJ2hoJGs4PhJtREaxksFWf3HPGBYSRa4 S3U/yiB+fHMWTjYvX+9JSPTjx7EO0G8762Fbjkx5gsfO3T+r8SPqiId2VkcBHX1gjaUHzwpH6 RQtfe1kSlXvi3iiA+y5Vyw09xUmF1joDhHvwFKubRKL5rCtPPS0bWHJu/CRE8i6RHxZKRPfp8 qFCqd/xRr/l+W4CwroZtsuZowiqWex/I63FBYvi7E4c+Dlg7Sbkga2jdyDjfugCbD3KxSuZVm ySvZZM4CavK75NRDhw8oSXy1Ph8zRGgdL17IDWDQZx6bVZUc833j9tIE1TtpBtFlftDgkGGga Plw9NJwAq7sTrxVPPIFnkuPSKoFYNr4TId5rFkKmZhGa612x1xvXGQ3aorF9PjdLUjOJiIgBF GJUpmww39vkhykzxOOU+jwH2de8eTOYJQwYnQw== Received-SPF: none client-ip=217.72.192.75; 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, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell When generating a TRAP_BRKPT SIGTRAP, set the siginfo_t addr field to the PC where the breakpoint/singlestep trap occurred; this is what the kernel does for this signal for this architecture. Fixes: Coverity 1459154 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20210813131809.28655-2-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/aarch64/cpu_loop.c | 1 + 1 file changed, 1 insertion(+) -- 2.31.1 diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 5425b85659a9..980e734e54f3 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -150,6 +150,7 @@ void cpu_loop(CPUARMState *env) info.si_signo = TARGET_SIGTRAP; info.si_errno = 0; info.si_code = TARGET_TRAP_BRKPT; + info._sifields._sigfault._addr = env->pc; queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); break; case EXCP_SEMIHOST: From patchwork Fri Sep 24 13:56:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 514573 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1498109jao; Fri, 24 Sep 2021 07:00:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSzFnQOgAMcQGb9JVx02xBjqRqfQy5v17defDosqhc4QMLyYAss6hm/VID79/E2JLHgxDw X-Received: by 2002:a0c:8e8e:: with SMTP id x14mr1308651qvb.67.1632492006336; Fri, 24 Sep 2021 07:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632492006; cv=none; d=google.com; s=arc-20160816; b=ViCw3DBZp5rVvird88G8nELx1sVrwezt5dEzwHO0GuXobik/OPUNE/4PwSWU1oL1Wq sSiqJDyaNBXo92xgndfkgeeK39uyPkzbWMzwpBFllHKo874FqnDT8l2YMa2dQIQFzsl3 zYMv7J+QzKpm4hPl1uWbeFfNIWLICvdQIWVxJqatzJWUEiuEU+U53mFPVsOgdD73S8pf dujI1kWgwVpOdqlhrll3XqExLYtIVqroBHB8j/3p0sfCrE/c441ce5zN7Cilt8zY/fed TFBXCAbT0w541/IzBM0WodymgPD40Pmx/+wz+xg5Xcffgv/xg0S2QmGvYAGg+Q/fJis2 dwcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from; bh=vVA0mkR6BXMMWYIynuJCwykKk2feaAE05gyx9c1vaBY=; b=QqbWprgShqJ/4CiLk6OtaOZ9UaGEhuzIn9DCUTrGH07NOpgKwNaVWZsMp6KHyFUr+u l7tYjc8q8EnSUdoBQjf99GNhhSsGwaHHB3R94sWUNC0SSTQKUIvZtkiyI8u6fntGpiqL fXp9ZXDKydqH0CQKF3tuUK0X2byZt7x3UW64n4UiplnO0+LOCOHcxtBfxtsYUbPo4A8u migBgVzGwHc1/hkStH7T8MXk3aokwb3rfoMi/GWMYZctUkorxL+JWHg0Gn70Zm50gS+w 2kQdbDp9cM8GKtECO1WiqWb9pbE2Ci5CQeXC8GXOOSzZ9m7EDqAkoiI02riw95ngnH+G 7q4g== 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 f10si6563040qkp.212.2021.09.24.07.00.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Sep 2021 07:00:06 -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]:60930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTlkD-0000DS-Ow for patch@linaro.org; Fri, 24 Sep 2021 10:00:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgt-0002zU-8u for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:39 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:35781) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgq-00058S-Ug for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:38 -0400 Received: from quad ([82.142.21.142]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MtfeD-1mi8Le1gHH-00v5ku; Fri, 24 Sep 2021 15:56:33 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 2/7] linux-user/arm: Set siginfo_t addr field for SIGTRAP signals Date: Fri, 24 Sep 2021 15:56:26 +0200 Message-Id: <20210924135631.2067582-3-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924135631.2067582-1-laurent@vivier.eu> References: <20210924135631.2067582-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:GG4Ei9bgJnhqFlbD4cbNUt5vrrHJzrkD9ShlT/QeeBu4wmNQPO9 1mu8LTcY+N5/0nFHltZs3sRyODmOzvpSkek+11/QSQ9SFAGGWlnHubSbAKPUKSAcUp9xscL 5zs+fNREp8mHdzCg5yuSbRqOJVDwEKi7qWwUNhihsWPxy2My8m/GO4z6YtwOUdFmsL89lCH ZM39yxwdqcWC+W363dObA== X-UI-Out-Filterresults: notjunk:1; V03:K0:vvNUg0noIpU=:58GBK7gN/HXnlF/zsO7Oim KHMOtK/KEhxJ+H8NkhxAKnnyoMzqGNZhC+6mJDED/Fd8w2L5/T7Jw0HhzA0EtT1406vhtsUXD nTDge4tUGUu9h8HNYhT1a2ttHDKmlENkpgRgjL6hPZyL4R+IfvhZiGuE8f3fP/XwNSQPy1H00 qAarhkxoh7xu5a09elyr/IJBX++RwZb03mTCa8BzwJ6ph92+4kUyPu0R0kTgJ583Kje1CqSqM Tr38GGnJKqc87m592KqyH2szppSW9bmDZyyqMnqA5hQK+UsTQVfzM8Fbzzxf1ecAjMcxiZMKh oIiztPLQFt0E/zL6HjlT6kgVUsJZ+ibN/lPjwdsB45zAtXGjeU3bmOFcykMYM2jCJlA6ly1y0 jLumwkguDkzISRpl/Go4PWTTN79t6QqphcuGBIcbP7TnPc67BbFAX6whFilW3LCwVqoqXvMy2 Y+JdwA7LmPf2lRpfVnVs/hg6R3N+avBWemSP9xdFFPWdbLV2JM8sFGVjATPHvxL9NrBduyWwV gZOFmMDFIgOJZzNX+zJzRvgyIvZKp4rPHj+1jkcAE5NRpC9Gb0vnA/CJuStc+k+hlBr0M13BX saVLLo0QmML0twzNlzqVIBleiLZr7Kp0dqPfcYBsES6gunavet34AqkMfKLy7mWsBDroXWfmh 5iDs4uuQGD+YZBU0fGRuDkZR1AYY2A+4W/6ql1Q3KlzYv9x6Fsd6B2WzPb+6rCAjmWxzU5fLt qZofud5xD/th84/nv+QQ9z3RG5uBs5GuwU9mYw== Received-SPF: none client-ip=212.227.17.10; 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_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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell When generating a TRAP_BRKPT SIGTRAP, set the siginfo_t addr field to the PC where the breakpoint/singlestep trap occurred; this is what the kernel does for this signal for this architecture. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20210813131809.28655-3-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/cpu_loop.c | 1 + 1 file changed, 1 insertion(+) -- 2.31.1 diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 07032b300610..0900d18105a1 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -455,6 +455,7 @@ void cpu_loop(CPUARMState *env) info.si_signo = TARGET_SIGTRAP; info.si_errno = 0; info.si_code = TARGET_TRAP_BRKPT; + info._sifields._sigfault._addr = env->regs[15]; queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); break; case EXCP_KERNEL_TRAP: From patchwork Fri Sep 24 13:56:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 514570 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1496259jao; Fri, 24 Sep 2021 06:57:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbzarcN9sdkyaPlCqeuJQ/j9HhqYpShSTBI8JjX1wSGimzhND2AfeNHDP58Y4ZRchL1FV6 X-Received: by 2002:a37:41c6:: with SMTP id o189mr10595768qka.195.1632491859810; Fri, 24 Sep 2021 06:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632491859; cv=none; d=google.com; s=arc-20160816; b=i8cz3+k2Guspo8uvGWgNBpjiVoovwtHhZOuWRw4M1vkGLr3spSzwjDz4rT+AVNze1q icuG0DJyrU05RbhHNeLZIYoD3cX5Eq45Csu6Zz5SGWVLoo3fjRZDflO+OTa8UcWfrXAO P6XllWf1vNIrTO0w5VFN6zY+O9m2L/vAXlFyfHOBBPi14sx/MkyorAQV+t18R7nSVzyI IRyp4e/ZnWqByIfGGF6cuItoMKN58YnJoRJ/Y0EMMBWZ2i0d3YYetca9c9PWAgIRXuEU ZZxZ3kwn+GiZ5WS8rflWxDHuIU/gsLWgdJuLDe05lN2T3mp3JhVbllSvHzVeeb37ztHV 5dBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from; bh=mLA5aYXAQsLFse+CdjekEHos7bBiHxPKGi4Ae9eJxjI=; b=Y0S3H8etqusRcBaxZpRFy1ObN33iP5+Tq4KPE1DlfnEhN1xA8sQlLcJuLod5u0rJi9 OCFIDAytASG3uvmOGNz0CuE5APtz4PXEOgs+SnGE+Q1tLYBlGGLpWDHKWfqT6Ehny8fS Jcrq+q8t+vfhFpRbMgUWT/sNNb4XRUvck1Yp1O/c/1bsLJGHVOZ5GcI6il4zTSuucH+q yCc3uQMxFsr/qc2S9A54ahGDq2ErktwsNnYDvfrkArNBona5h7skplxGKqQTZncsxCqw TJqlBZd9E+e6CBxvs8Rcvv+eUAx5b6JDR/Tr9T4DwCR05MwRo84nWNeVr5T0ZjxawKpP CVNQ== 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 k15si6905212qtg.265.2021.09.24.06.57.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Sep 2021 06:57:39 -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]:52526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTlhr-00031R-Aq for patch@linaro.org; Fri, 24 Sep 2021 09:57:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgt-0002zJ-6P for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:39 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:48477) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgq-00058q-Hc for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:38 -0400 Received: from quad ([82.142.21.142]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MlO9r-1n85CG3njR-00lqMU; Fri, 24 Sep 2021 15:56:34 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 3/7] linux-user/arm: Use force_sig() to deliver fpa11 emulation SIGFPE Date: Fri, 24 Sep 2021 15:56:27 +0200 Message-Id: <20210924135631.2067582-4-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924135631.2067582-1-laurent@vivier.eu> References: <20210924135631.2067582-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:WOmLcxSORRujtu9L/LcTUgSJGpqELirPKh1VErxI4QC+PGxIwZH wZEpEL/0mEnoJ/bPblYB58GVc8tEMDHBZhDeDwm2twPv5ZYHzHv5NEZNSPoKEpF4HJZoc78 lP6XU8I7vzPoF46k+OvYa3tfXeF05DSG+EU2oKHCdFd5l/wrOJgz1R5+yY7OD6fkV8QEU9K 0pETnl78uqR8jPndnx2DQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:DLmTv2KpK4M=:eSoCpIzkS+03dk0PdP97sj Dl4QWHN2rV91QRpe/TgtwD0K+1lzLthzL3GZA0en0X/wEP3Wujtx0KGiC2XOVzQ2ceRZVzaL/ 6/JW905HAYm+UETifkgcAhfexk0IoThajQ6p4VFAT+43ZnUxjTETNAt490arI4VLhs0SKv7Jk CJWW3/eP/RMg33XSmiZDUUKsbf5AmEkpq1e7fstCwo/xIvpbZ7HAYsy3IN34kG2uwNO6M52cK hOK4wbckR/eGsr/rX1NA2pYsojkedyyGdEPOdczLO6RXq4JTNHFShts9CIrlYveQc9BsGFRfu a55NKKlyIsBIPs+o67Rl+l0vSlc08PQ6VOe9BzhJ1JRLRYkO7qm6AT7RqgRbfsgN6Nn+V2aOj ROmT3LnZ2L7tCKNjRI3p8wFqHsBFaLAE12Z+WcRqiPmtN2fqSip8gDjQH2Pd47XBy1pWZyPDb FNORzoDuWJJ3Dk3vJm0N/W81fDUQ/IlvickS4wNwpXHCtjKKy76WJ6SIz41sFl+yq83XE6/0C wRKXMKmN/CFjfYZ3O4H5ViB91wXwNjwXp+s/To1GcBq3JTHTt7VVIcgFv7iYNlmIY3jQ7NEeI /T3NLGRhr424PRszoC6NGkNJOQ6W9E31p+MosPlp3bJPnKuKEGBfwT8AHqv2JFn2vL8ETb/47 eKoLeqNKjIsbnUGXC3Q9pzDFWwRV5DhIXkrVn1AXjgKRIYyAUicQIcOWxvt0Gf9IZESCPN5Lq JzvDq+UziKqF17iBIzkzf6dDbRSQ/rOmzUs9nQ== Received-SPF: none client-ip=217.72.192.73; 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 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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In the Arm target code, when the fpa11 emulation code tells us we need to send the guest a SIGFPE, we do this with queue_signal(), but we are using the wrong si_type, and we aren't setting the _sifields union members corresponding to either the si_type we are using or the si_type we should be using. As the existing comment notes, the kernel code for this calls the old send_sig() function to deliver the signal. This eventually results in the kernel's signal handling code fabricating a siginfo_t with a SI_KERNEL code and a zero pid and uid. For QEMU this means we need to use QEMU_SI_KILL. We already have a function for that: force_sig() sets up the whole target_siginfo_t the way we need it. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20210813131809.28655-4-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/cpu_loop.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) -- 2.31.1 diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 0900d18105a1..fb78a1aab308 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -268,16 +268,13 @@ static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode) ts->fpa.fpsr |= raise & ~enabled; if (raise & enabled) { - target_siginfo_t info = { }; - /* * The kernel's nwfpe emulator does not pass a real si_code. - * It merely uses send_sig(SIGFPE, current, 1). + * It merely uses send_sig(SIGFPE, current, 1), which results in + * __send_signal() filling out SI_KERNEL with pid and uid 0 (under + * the "SEND_SIG_PRIV" case). That's what our force_sig() does. */ - info.si_signo = TARGET_SIGFPE; - info.si_code = TARGET_SI_KERNEL; - - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig(TARGET_SIGFPE); } else { env->regs[15] += 4; } From patchwork Fri Sep 24 13:56:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 514571 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1496288jao; Fri, 24 Sep 2021 06:57:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmU8CuSNLdDZfSvoOtTlrAe9T4izT69/apjt8uMBemP6t+Jus3durlOEO1DdHjjgruMU/u X-Received: by 2002:ac8:7212:: with SMTP id a18mr4113826qtp.103.1632491862199; Fri, 24 Sep 2021 06:57:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632491862; cv=none; d=google.com; s=arc-20160816; b=MUk6N1Kg8Glxllc1drQmFcCRl3NTu/oK0y2YdVMOPZJaP7MAGcc9/toAvV4AL0ryED VbmOp6erxpliWYkm2Cmdmbz6zGnqKQ8fX3xjjq0v3eyVHRYzTbRDT1ocOXQOXYCOcmyc 48ejD0hsruXzvsggpazkf8bYLd/CJYfy/LxmIK4IwBNqfTLWAew6zvAnztAZBqmRXr6W Eh5MoeI9yt86540FXyvTdDYCaRqpw0zOxaO92M/IEuG03Q0a0KAEz8SKj6fmeiMe2GA7 hMKdM86RX2vW1qzJKzkVQpN2JU6MSrVpI3sMXGpe7280z5P/8YksBoJrFPMqhFWMC2qe Lrkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from; bh=wgPePADtulHJqPkDQm58eScGGjDpVlrug1ev1v35kZs=; b=JPniL0pIXpb1ExvmIrEUPcWz26aKDaOh0uVy/5vEtRd5V0gqcTN0/on5pGOiavGt4R EK51ITvvUKNOGX9BmOx9TSBe4UJoRkSlb85QDbZIEi+soTtUljXb+QzRDcYUWaCI+RLA 7hmc028E4wgt8CaZ0tfL/3QuRee65gi1fw+ZGgtX6Qzk2wbbw7amiiC/eYMhHnXnqRTp msvJ5PuAqSrOgzTqmknxh0z8azrpvdvqFsW/H7THG3HXd+lOvi1Eo8+VRVXFHOozeUbo jd9WDl89ZjhtQD+O3ez4JAPsJaWP789/RJJQSIlzOUaklhGFqMS8f2VyCxDSV/y9asUU B9zA== 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 s17si5930314qks.281.2021.09.24.06.57.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Sep 2021 06:57:42 -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]:52586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTlhs-00034f-Jj for patch@linaro.org; Fri, 24 Sep 2021 09:57:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgt-0002z7-2t for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:39 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:47669) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgq-00058z-DW for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:38 -0400 Received: from quad ([82.142.21.142]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MysBI-1mq61g1e9C-00vsyT; Fri, 24 Sep 2021 15:56:34 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 4/7] linux-user: Zero out target_siginfo_t in force_sig() Date: Fri, 24 Sep 2021 15:56:28 +0200 Message-Id: <20210924135631.2067582-5-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924135631.2067582-1-laurent@vivier.eu> References: <20210924135631.2067582-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:ppNP15x2czCuvY1892z6woD8TKTsVrnHpcpOymAF7UVDRkS0kdD aJyaezdd2d6rYS1IypNuHESeZdx/tkLUAk4DmOc7DQbt8EcPE32HeJtJOuqlzOkvPaZ+29R IxEtwq5S3OIKUfeAS3oLKyWy0/u+lOBQ6r1+1ZLqSv5TqgwLm2Gb+N5u+Hhom8gipPU8pKx wYbvctDM0/THCs8jCmNxg== X-UI-Out-Filterresults: notjunk:1; V03:K0:u4Nog+Vvs6g=:tIgHdiMIfaivEYr4b2N9WS J4k+vg+jt5GtuguGq6xEs85iEPW6QCpiHck3x/k6W26jISGRWOvXDI+dZ2AudQLC9Zc5kg15e vHOthc/oqWJTmzJcUCGSans3PcAqorYaLgEycDZ86jqceC8d1Yo2LVEYnn5AbnWOvfmXIQeQp AB+HpMsW+NUNNJfHHm0XLh7adtunHcmLXaEpHjLbBwA7MN4ugWuMhlZttarWaGpgtCv3G1erE fVC8Es/lA9OUpZgqQRWAlrsKR5cvIFx/TyYkuEE8wiO3r6pFS+3Ur8gM+cvm4L68nOn8mrgNF TZSO6k2L1m+rk0Ccdbi2HA0eSd3+MkN9y3tCm/mKiNnKd3ND8ZL/azXyDg7SAYjog7p7pZ457 3JR+jOsdL3Fv9xmX1RFaD0DbxeQ4Osb6yYCMn5Gi16cxGuT3tn6vIRU+FkrGj2X4PsI8nLDUn WkzknjygjZQmHKTAgbJg4fzKkMiolfll0JXcuecRztqGawD5TyQjFa/db4ecHeZ1sa5GIr5Lk jE6JcPDP6FcHsNB83EVtw9y+bCJrPWAWfwaxfVPsJ86Rkq+dp+y0F4rsB2fJPZUNba9tKy4ie Ab/PDun4S8eF/Ew4u2Xh6XFIyq5G8VVFcVu088XqPtSHUp3kqDKkPgDWq/gmyvVxZNBvALfp0 VKZVQO0X0zmI5/7GGB0EwHeZuxBHU1TGn7x7OkRdIJero2UQfs1v4B2cLl2TH6OjjsARK7tbA 3YK3A1rzrtnZ//l1kOI9OLsp0o/G47fNoysQ7g== Received-SPF: none client-ip=217.72.192.75; 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, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The target_siginfo_t we populate in force_sig() will eventually get copied onto the target's stack. Zero it out so that any extra padding in the sifields union is consistently zero when the guest sees it. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20210813131809.28655-5-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.31.1 diff --git a/linux-user/signal.c b/linux-user/signal.c index f8346f5ec5fd..910b9dc6f7d1 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -641,7 +641,7 @@ void force_sig(int sig) { CPUState *cpu = thread_cpu; CPUArchState *env = cpu->env_ptr; - target_siginfo_t info; + target_siginfo_t info = {}; info.si_signo = sig; info.si_errno = 0; From patchwork Fri Sep 24 13:56:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 514575 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1499044jao; Fri, 24 Sep 2021 07:01:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9lVPNXc/Wy4P39XQUBZEPx8ab/nCuNizfOh9r+U9RZfk798IpIqRMqlMPV+7X/RKal9Yq X-Received: by 2002:a67:f914:: with SMTP id t20mr1557832vsq.36.1632492062069; Fri, 24 Sep 2021 07:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632492062; cv=none; d=google.com; s=arc-20160816; b=ipHVfkmguGhU57D04Gu8dYet0qZcLxpKuGIfyCcDAvhSYomq5OUFxR3SlYNRk422ES Gi7IZMFv6mWXSO8GiLRRguF9GKeg1ixPUB4YCzrFUb1kW8aB3eEsPDFBNkfc1Rx124Y9 1eOXlS18OOJ9uAK38oCoUzFFBkbeI01WgncJ22YLY6n1DxYf83cojQxV3m8XxDqEVyYA Mx/F4sX7INyK5qKEziLmvfIPH0EWDfSTO1qjziZLz53/n4Gi/Wy53B5FCcdIYh9/CPCb M/pukZtDJsx8HCq5PdLU+lroRQi8XeeAz4cd5X5etqGmmqQLAzGaTEbOyrQ/WnRtyxRr dA2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from; bh=nKzyPXG/7bRh166i4e71Piga9rVkqzfkoVNi3HTq6/w=; b=nHqdvpvO1/VRCmOxb1S66BsCmNwZZNz6wrmGYX+wL1AaROxQH/0pnfX1zQ/1toMIrb e55DkSAVV++NZO5ucwlvFt8Bpq7pvicwjnvZ/hNBf/L8dVS+U6SuczGcNMzk4lsPsvUE zao9mV7ZwZUfWKL2s/v4BldSA7EhaeLK7kv7phhl1ek0c6ClRM9YuImtzSqUPEFwNu/s f1WVKLrfD957GdaQY4JouJtGz/2oCTyONSJYzKg1NF/tP4LtBWiNooQJIpLGvDuKfjjC yqOJw3OIWiAaXIGaNr6X3pH6b7Jt974tP3x0wEyeaFAjA5dlTq5bViXjM5OMqzFR2Zjx F+hQ== 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 u2si6124688vsi.1.2021.09.24.07.01.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Sep 2021 07:01:02 -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]:34384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTll6-0001K9-TS for patch@linaro.org; Fri, 24 Sep 2021 10:01:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgt-000314-UV for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:39 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:60799) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgr-00059W-4J for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:39 -0400 Received: from quad ([82.142.21.142]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mcp3E-1n3Ngm3ivS-00ZyOz; Fri, 24 Sep 2021 15:56:35 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 5/7] linux-user: Provide new force_sig_fault() function Date: Fri, 24 Sep 2021 15:56:29 +0200 Message-Id: <20210924135631.2067582-6-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924135631.2067582-1-laurent@vivier.eu> References: <20210924135631.2067582-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:Aa/W3+/9Dd/FWKEHqQrSMRuBgk3RRcCeVu9Z8Z4ztYIsgzvM0pR frAf6FULRJj5hXG6AFG0xeToUdC+jA1IePhgKUikjFKiX/UOq0bPHqKgqEyGBRHKIu69NgK j74TlMGV6DkFxddn18xq4wdERh3QbaEMDqV72SCfpTsgxuA7dtS3+Inz5GNfTUg8Js0QCqq anyYXLa4dXGDQr3cIkDhw== X-UI-Out-Filterresults: notjunk:1; V03:K0:gNsuaqKw5uw=:BRlI4WXHriuCEU09lruvwV MMqojHOBzyWENOd0kNRREKN3cEicKYGlh2LrOH7fufbZXsGP9y4DJf6cJUMUUyxz6Gl2IeWOL 9zqDdaUc1k9PFf3B/VukKu52EwjK9DCG41+u9WGRjQvCzm80tuy/88HTP9UpBqW52JUhCyN3u kwxEZibWcCc4G4KHKefQpwbpDOq48EXx1IvJ/zjLC5NF1xsPtEvtu4BDxiW1Y0+P4EKUyWXdz YOq0oVxf55fWXWXKFrbrtv4OCruFYi2cq9rc/8i5m/svnHoRw3bZpK3eTiBgkacb6kyN3WPHh A9UUYlVvVKIJdHwayJZN6stzCrlMwS17HxznjNNy6WtOyCoLPl0wYMpZTK+GtqtSFu7ASfBxt mbEibhEkQt1cWARPOj7bUloHb34Mhxd/6Ntf8at+/tkjVT80cSHNzjx1Yv7fgJ+9JfLXUwVzc tU6WPw3d5HPRqj/M9+j6EnFyipVHKkTikup4QQd+o7HtAWlBNSNK+0ioJcRVrfkyXjXGpnTg0 AJg9MpGuKjNabDIKExUYKsafsW3nq7ZzbN7wzeVej4wKCIoUrDi2fsY2FEgi+5inuvVtCfrVw evyLPeHdfSUnFLTTbEEFW1VgypZeZDSEFSHE1XwdVVVNDoMELOoIW/gJZf70H6782w6vGa2MM 7Ud4/f4MlfIjn1RduBzA3pDvhe5Zb0ciH0XwlOWMcj4xhLed526+zp126gBdRVLUZfsevO+db 5wZuOy1dRkKJ7pDgc0Rb8BEiJvTQiGqGckHH2w== Received-SPF: none client-ip=217.72.192.74; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In many places in the linux-user code we need to queue a signal for the guest using the QEMU_SI_FAULT si_type. This requires that the caller sets up and passes us a target_siginfo, including setting the appropriate part of the _sifields union for the si_type. In a number of places the code forgets to set the _sifields union field. Provide a new force_sig_fault() function, which does the same thing as the Linux kernel function of that name -- it takes the signal number, the si_code value and the address to use in _sifields._sigfault, and assembles the target_siginfo itself. This makes the callsites simpler and means it's harder to forget to pass in an address value. We follow force_sig() and the kernel's force_sig_fault() in not requiring the caller to pass in the CPU pointer but always acting on the CPU of the current thread. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20210813131809.28655-6-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/signal-common.h | 1 + linux-user/signal.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) -- 2.31.1 diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 58ea23f6ea94..79511becb4e7 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -40,6 +40,7 @@ void tswap_siginfo(target_siginfo_t *tinfo, void set_sigmask(const sigset_t *set); void force_sig(int sig); void force_sigsegv(int oldsig); +void force_sig_fault(int sig, int code, abi_ulong addr); #if defined(TARGET_ARCH_HAS_SETUP_FRAME) void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUArchState *env); diff --git a/linux-user/signal.c b/linux-user/signal.c index 910b9dc6f7d1..203821645509 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -651,6 +651,23 @@ void force_sig(int sig) queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); } +/* + * Force a synchronously taken QEMU_SI_FAULT signal. For QEMU the + * 'force' part is handled in process_pending_signals(). + */ +void force_sig_fault(int sig, int code, abi_ulong addr) +{ + CPUState *cpu = thread_cpu; + CPUArchState *env = cpu->env_ptr; + target_siginfo_t info = {}; + + info.si_signo = sig; + info.si_errno = 0; + info.si_code = code; + info._sifields._sigfault._addr = addr; + queue_signal(env, sig, QEMU_SI_FAULT, &info); +} + /* Force a SIGSEGV if we couldn't write to memory trying to set * up the signal frame. oldsig is the signal we were trying to handle * at the point of failure. From patchwork Fri Sep 24 13:56:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 514576 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1501824jao; Fri, 24 Sep 2021 07:03:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw53rETNIIt6Z0/qf8rogaQX0gBkXvS1xHyBNYJjN4xkYKz8GNNPV9Skal2szalAhdMAKRr X-Received: by 2002:a05:620a:c4d:: with SMTP id u13mr10636074qki.411.1632492210444; Fri, 24 Sep 2021 07:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632492210; cv=none; d=google.com; s=arc-20160816; b=KKAesvMScOidyG8PCofA0GBkroLcdzv6fm7b5jB9RueT0QxWSGLrjQvNLot1d61xt6 6y15CXQqL6u1IGpHzyHwfj+sSJu9iN2HvoM2Wib02TS2MaYUELTo58dxpnQbqPiNFtL5 kLJKdScz3mr8pCKXnzisKh3LCdRPm8hdurRFnN+UmeRA23luHfApSgbOBGo8dUEcgthX NoPBBI/QepEJD9mj8w3zVu6pnwhxU06Z6F0em2GEtHU6wgXmZPBmfWVh6WaUqMcfUWgd daYeqFUhPqO80T6aSjQcFPmNrf2Fa+N8qy+T8rWIAJqShK4jGOK61hRG+/LkJjKJ25vb xBsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from; bh=p+YIg+ohRLXbSiWgTXYClEhedxqEhBHgb/zCnqhBh80=; b=qUf26Ew/Cu+I9wcDaZQlaUYAKXeRtFr5QPcXmmv7zgCrshSQF5ISu/w00w+Swh0wX0 pJdx+/ktpCBy09+qkdJf2a+kqgyVl+cU1EHE9DcFG5HJA8fXdKIhDOCdYH8j17lsew07 DMwo+4Jf8RVX8jty4aYxCyGm90GePcmCwMoz2Ixeg+IiVbD0S7qT/IZN3oBY+1i279IU v4C9r0T0AeJelDJLFCEgFqepoGiZDoWw0yvzUNrmrddjJRznnDVRJIGsz/j4/vOy8s75 1o5XtlqQ5I+jtuyaDCJ5X8FuYTO7UesIumzDJQDCj3zSebSK5SflO8YlRTuhhRyQ4Otg oftg== 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 iy14si6552679qvb.213.2021.09.24.07.03.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Sep 2021 07:03:30 -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]:39852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTlnV-00054r-T1 for patch@linaro.org; Fri, 24 Sep 2021 10:03:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgu-00032i-KM for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:40 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:59141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgs-0005AF-5R for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:40 -0400 Received: from quad ([82.142.21.142]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N3bGP-1muGu01dop-010c3Y; Fri, 24 Sep 2021 15:56:35 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 6/7] linux-user/arm: Use force_sig_fault() Date: Fri, 24 Sep 2021 15:56:30 +0200 Message-Id: <20210924135631.2067582-7-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924135631.2067582-1-laurent@vivier.eu> References: <20210924135631.2067582-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:GR3BsFG5L32UWDfi68Eb/l0ifBT1ItetpTC46iNdBYsV5jx+Jee 1nm3TfPWBMjNPfjChpHxjcTz+vCA4a+RpvzFRnwItOHSAPi39hRepSq549WvlsK34h3i/5Y TTNBWUJIEj306mH+QdRNRivMfykFKRLiKNLbRmWrw2bUorP6MIeCJIRPqRC/ZjTt04JoF45 lW1bWUcsNmzT69OeCMRUQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:DJQyKOes5TI=:faTkQ5QLfVg0DQJSUAajCm P+wrEh1GoxAGqFYED1CPQSgj6gT8QZd53r3t+q0V7VI5d6TtRf6YfQW5xbtaPx/ZhTHFKHe/Y ms0P4dkecvvWL1k2JQL3U4XH/58oYbg3eDjFc/wuNKH4j2Z2gwtRZymZ8Hgxy0KprlvNbiolX 4MhlqYikDqgq3Gb4sZSPp3Tjj6OqAbJ8RMzWmB8X/o02cnc9YTiphwad2v5ACuyylGtsjgpQd BPqwEoevY4NcdpvCX2l4nm/JAaN50ZYXy1bUCNbr1edPWWwtZNfK3OAW4X5tlQbaE9aS6rLj9 w6jbORUqkYQng7ICsC5BjU9ynAjT73GkqfwlNeN548bOej7MgffV6m/2NR05pl50Hz+HAUeza xi57A468AFEupY7GTC+vAS7xBgu7i2EK2xCjggkiEQnkoypGH3LkRG4Jy5NV6ClptMjv/WdYW KNyLcMt/8ohhjAbH3CNbDXA/i/aPqxVSCNrUDfP5RobgXx6Vp4qRftCGWRxeJH5vMR4NysNEm 9Lej9JmFYrictpDBCt2SGcD7wbahELDzPnj2zfvEg4LKtrdNfeN+SO61AiXRn7dTonJhcu8bT ndnLkLzkM8SFp8H+lZNYiWNcG2Pt/X2HBkSsuuN4Ihmi5xLvwYXsBgopKqCCu1OKu6lYqtDfg kXmqKOZkTBzMYLuDjKCIs+k/5HsoElu/Ty4tRI7Z03BhGSOw0YSrOEmBSE/ynIH173K2vzj5a piun5XUBWldG/OOMviWCzTlRxGoAMeZ0M4Dp3g== Received-SPF: none client-ip=212.227.17.24; 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Use the new force_sig_fault() function instead of setting up a target_siginfo_t and calling queue_signal(). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20210813131809.28655-7-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/cpu_loop.c | 53 +++++++++++---------------------------- 1 file changed, 15 insertions(+), 38 deletions(-) -- 2.31.1 diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index fb78a1aab308..ae09adcb9501 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -94,7 +94,6 @@ static void arm_kernel_cmpxchg64_helper(CPUARMState *env) { uint64_t oldval, newval, val; uint32_t addr, cpsr; - target_siginfo_t info; /* Based on the 32 bit code in do_kernel_trap */ @@ -143,12 +142,9 @@ segv: end_exclusive(); /* We get the PC of the entry address - which is as good as anything, on a real kernel what you get depends on which mode it uses. */ - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = env->exception.vaddress; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, + env->exception.vaddress); } /* Handle a jump to the kernel code page. */ @@ -286,8 +282,6 @@ void cpu_loop(CPUARMState *env) CPUState *cs = env_cpu(env); int trapnr; unsigned int n, insn; - target_siginfo_t info; - uint32_t addr; abi_ulong ret; for(;;) { @@ -322,11 +316,8 @@ void cpu_loop(CPUARMState *env) break; } - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPN; - info._sifields._sigfault._addr = env->regs[15]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, + env->regs[15]); } break; case EXCP_SWI: @@ -394,18 +385,14 @@ void cpu_loop(CPUARMState *env) * Otherwise SIGILL. This includes any SWI with * immediate not originally 0x9fxxxx, because * of the earlier XOR. + * Like the real kernel, we report the addr of the + * SWI in the siginfo si_addr but leave the PC + * pointing at the insn after the SWI. */ - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLTRP; - info._sifields._sigfault._addr = env->regs[15]; - if (env->thumb) { - info._sifields._sigfault._addr -= 2; - } else { - info._sifields._sigfault._addr -= 4; - } - queue_signal(env, info.si_signo, - QEMU_SI_FAULT, &info); + abi_ulong faultaddr = env->regs[15]; + faultaddr -= env->thumb ? 2 : 4; + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLTRP, + faultaddr); } break; } @@ -436,24 +423,14 @@ void cpu_loop(CPUARMState *env) break; case EXCP_PREFETCH_ABORT: case EXCP_DATA_ABORT: - addr = env->exception.vaddress; - { - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = addr; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } + /* XXX: check env->error_code */ + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, + env->exception.vaddress); break; case EXCP_DEBUG: case EXCP_BKPT: excp_debug: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - info._sifields._sigfault._addr = env->regs[15]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->regs[15]); break; case EXCP_KERNEL_TRAP: if (do_kernel_trap(env)) From patchwork Fri Sep 24 13:56:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 514574 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1498110jao; Fri, 24 Sep 2021 07:00:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgBbgtxV62heLK+75s1tnUGpddHALSYouT3oZqdKwflCOULWJyCd9NA8yclK9Rf3gNtFNS X-Received: by 2002:ac8:5943:: with SMTP id 3mr4376868qtz.385.1632492006422; Fri, 24 Sep 2021 07:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632492006; cv=none; d=google.com; s=arc-20160816; b=MPK+BduMgwfgVRWMzF6z0Xf5WKY0MfYYB3e6YaDl4K7ZULDCNMeF5sUIaiXFQAFaz/ WwW6p0ijnvxiRBCLUGcv9AugH8zYUhWswBXqU2AzWTkUQ4h+uMhD6M5DlhqIKoRssag7 9OR4UnK5TFw5nJDbACni3fEnZ79i787kDB2mp8eyFUhiWhWaf1hahkK8dZCjDdoU6SwE KaJnzvIRWZGM7YShxKaFwcHGTm5/UAmc573PaKyEboB0W7t0b7JAQISe7hpK5QhJ2hAC JyFWKPoiSbexmgOeMWw70ztYq5afykirEkeRMv20woJFKp9b+rqw/xgBgn6Aml7BQDDC ILAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from; bh=+6+jBq8xsKilqsiXPheSz21gw6dAjLSLx7AEQdV3FLQ=; b=atC54/c1hQF1leb7G6o9TmvQnVwldUtZ60sTRM4gG5+j73vQpgpGYD99MdJwX4LU3y 0fzLGVC0neI5jYKSqtGzjMIpgusXpAOofhSuJNjhH7Qo3yVukPlHNfuWaD6CPrQr0192 AK55e6usOrm3Vr6hmII+bIerd1Nm4w9pRJG/LfyC5AdHif5Xybm/Uu9oXq3t61PnyAVH jH+691HM3Ct9KsSnWcqErlXpczRrD7RPVEuM9i2NnhEGVmKWEhyFzUSs+OBHNHJk8s5A WRUfqlsRYg6vy6K63GvkYAcxpxr4+FGj3R1Czq0dShsFxdPrTRwblSLA0igsQhNdcszl rGjw== 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 w14si5155058qki.182.2021.09.24.07.00.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Sep 2021 07:00:06 -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]:60988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTlkD-0000Fi-UD for patch@linaro.org; Fri, 24 Sep 2021 10:00:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgu-00031v-CA for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:40 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:56441) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlgr-0005AD-Ty for qemu-devel@nongnu.org; Fri, 24 Sep 2021 09:56:40 -0400 Received: from quad ([82.142.21.142]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M3lLh-1mU2nw3aR1-000uhQ; Fri, 24 Sep 2021 15:56:36 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 7/7] linux-user/aarch64: Use force_sig_fault() Date: Fri, 24 Sep 2021 15:56:31 +0200 Message-Id: <20210924135631.2067582-8-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924135631.2067582-1-laurent@vivier.eu> References: <20210924135631.2067582-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:J3ppuy8nfO+aKlVA06tx1O+/lmCpIvulGhaBp63Ja53tzKTkDx/ lU51QVqlImUxMDgEqZ9CWiZwxxqnYZdOZeMLpoqtf5R1jtbg1FTna6Ny1O1pFtLIuMXrY/n JTT+k8T2HuTmlI7udk8CJrRYaGMkg8gYRIldit/FyMMaWFjLc6zSijNqJ3srsDIrs9xvDWN SfPkt53kNdp4O6biL/6jA== X-UI-Out-Filterresults: notjunk:1; V03:K0:IVFbgakdjLc=:fcUK1nHhTn8Vazbaf7hreC oJLChlIRB5bzP0iXVnzWeSZBGgLLw1rZruTDpgCYKoyg/m3bxU7lOTU01YRUX7pIHYbcYUa3B rFUn54Me50TWoSTgdOTaR3ZkYUscCHBAxrGxgBeYj8+Ms7+Eswp6sfQdX8FWWBDDWrk7YN4uf 7ZspxwEdd3pT2IflHcMDenVvLz1xbxXCv4OMe8nPOXHU624rhWoPgMQR5Cx4lwzgN8sa3zWMZ FFpP8WQgDVO9ueNvJSjSfBd3xNSG5DAwCB9JXlmdOzGGb1TcteWRY92olT36JIf/V6AfqQYYe vDas0PmujcEO94c9Azo8FR0kTJyjYB/Q2ebE1GrAxsXPdMD9qvEd6yF9pSIJgVBvDREk3jTZ4 UjdHHb9ufty2TQGIo/y8xp/pBE2ywl8ISCVbD3BPQwIMouNT0aJKyd+gNkLtWo2WNfk7hj6SH 3YdS2lsRf7nu9acZ28+Z6LknK9UOsW1BedPIaoxq6tGNZlq2GxOsYu1VJy0OHQpIiucB7C2j3 e/sBBKsfIZ+PRVr54Zw7VLvALlA8Vi6tF7syermrayfgoH0Mn2+2OOoIOHJLLGYWwyPaUlkcP emP4mwoxlhAAjWUzrtnBOsy/7joGKIm0uuRKqOLl5PLCstr1vZcJYbYEVNIDQfNkJio8KXzeC RE+OB2BLvgpMERQsIS6RmfuTEvD6BFzlv9vlykdu6jaxRD5VRi8oiXbJjQzyRpE8dVF+TaHNz kMIUEFuKvsS/N0Jz2w53cHkB8kwKzfed6Is/Gw== Received-SPF: none client-ip=212.227.17.10; 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_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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Use the new force_sig_fault() function instead of setting up a target_siginfo_t and calling queue_signal(). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20210813131809.28655-8-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/aarch64/cpu_loop.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) -- 2.31.1 diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 980e734e54f3..034b737435a3 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -79,9 +79,8 @@ void cpu_loop(CPUARMState *env) { CPUState *cs = env_cpu(env); - int trapnr, ec, fsc; + int trapnr, ec, fsc, si_code; abi_long ret; - target_siginfo_t info; for (;;) { cpu_exec_start(cs); @@ -110,18 +109,10 @@ void cpu_loop(CPUARMState *env) /* just indicate that signals should be handled asap */ break; case EXCP_UDEF: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPN; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->pc); break; case EXCP_PREFETCH_ABORT: case EXCP_DATA_ABORT: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info._sifields._sigfault._addr = env->exception.vaddress; - /* We should only arrive here with EC in {DATAABORT, INSNABORT}. */ ec = syn_get_ec(env->exception.syndrome); assert(ec == EC_DATAABORT || ec == EC_INSNABORT); @@ -130,28 +121,24 @@ void cpu_loop(CPUARMState *env) fsc = extract32(env->exception.syndrome, 0, 6); switch (fsc) { case 0x04 ... 0x07: /* Translation fault, level {0-3} */ - info.si_code = TARGET_SEGV_MAPERR; + si_code = TARGET_SEGV_MAPERR; break; case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */ case 0x0d ... 0x0f: /* Permission fault, level {1-3} */ - info.si_code = TARGET_SEGV_ACCERR; + si_code = TARGET_SEGV_ACCERR; break; case 0x11: /* Synchronous Tag Check Fault */ - info.si_code = TARGET_SEGV_MTESERR; + si_code = TARGET_SEGV_MTESERR; break; default: g_assert_not_reached(); } - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGSEGV, si_code, env->exception.vaddress); break; case EXCP_DEBUG: case EXCP_BKPT: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case EXCP_SEMIHOST: env->xregs[0] = do_common_semihosting(cs); @@ -171,11 +158,7 @@ void cpu_loop(CPUARMState *env) /* Check for MTE asynchronous faults */ if (unlikely(env->cp15.tfsr_el[0])) { env->cp15.tfsr_el[0] = 0; - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info._sifields._sigfault._addr = 0; - info.si_code = TARGET_SEGV_MTEAERR; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MTEAERR, 0); } process_pending_signals(env);