From patchwork Thu Jan 10 12:17:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 155150 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1837483jaa; Thu, 10 Jan 2019 04:27:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN7V+QrXd4mCvLfgidGYFNUdfRo0EK32u1SnMFkluN9DId+R9wW7pw43u0KZWfJIQi0KTaIW X-Received: by 2002:adf:fc89:: with SMTP id g9mr6604995wrr.96.1547123255201; Thu, 10 Jan 2019 04:27:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547123255; cv=none; d=google.com; s=arc-20160816; b=q/yWQr58Z+giotX1g7a8V9IOtTfh5mhcbXoadueMpcbsR0yCUH7U47c9JSS+8so9V1 cp5t9yDXF7ifbLfjvoJVw2zFhXGEhr2g0Pq5/3IVA8jPauHGKGDYiQXZHaofYu6A5JO/ H6fsz8ByUgDPpd5+oARJG/whr14LpRmMgRtpJH6wQPOlRGvolTBnO5KS80PdMTQ90UrQ Zz8iAJvsUHtzGic63q7RSc/s2Nc8sBpAGVA9zyIJgJTc5ucD86sXsmX//8bvAhMPzJ7O i/mh8Oj72ROAKcTq6QCFAWb+YF+6rWfx8YdiyFMc2Ey1BTq+2aXf4+1IpU8ot0mUOktx 6kXQ== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=p2TU+6xewpFPfZjXVs3cgyi3ohvpda2DuzV/stCY8oE=; b=0/ij/ds9nNS9IKQmitAHb7P8RYry0FntPHP8ZNHJshskHASf2qqBrO6067FjBmqr9R 3CSEC/CHyUkwhQzCUGB2GLrnqRnkY+wYg/wH+OuQxD2F60NfqluSv8ZusYRHLed2SNr5 nP/LaxxWKwbYoQ2xcToi8OA5ypEgctgIHShzOdv7pzYphoQCAtFoIBY7w5065jRFCAAH 7/349QYebzfpjxa2do1e+unxLgM5N5jGse7t7jiOj/GaFBjLdXdOwoCoJ7mMzToOmx0D ZyQMejTmx8yGDl2QgoFBlbrOg2pUoXUXjrlA3UU6rH7FrpYM80JZL7lhNxiWMVWqEin7 DHCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AJuLh51m; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s7si42293005wru.343.2019.01.10.04.27.34 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 Jan 2019 04:27:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AJuLh51m; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:58335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZQs-00035E-4v for patch@linaro.org; Thu, 10 Jan 2019 07:27:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZI2-0004nh-3S for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:18:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghZHu-0007nY-I2 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:18:22 -0500 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:38951) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghZHo-0007kU-6W for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:18:13 -0500 Received: by mail-pl1-x641.google.com with SMTP id 101so5114634pld.6 for ; Thu, 10 Jan 2019 04:18:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p2TU+6xewpFPfZjXVs3cgyi3ohvpda2DuzV/stCY8oE=; b=AJuLh51mCjv+PuR7LJlWLy0+bBdGQxM2YHVFZgU8IqRAy9ye5EVa2UVVT7/OQnnMlZ JIajoHJVxnWpRvchgc2UYuoVn4+TQecYAZ7ltNTJogNVDA/rpZTnzm9tt8gAh9Sm3c8l w3pYWSdzUSO25Vr66BKyqwPHBEUA5YJJRW59s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p2TU+6xewpFPfZjXVs3cgyi3ohvpda2DuzV/stCY8oE=; b=LeFGlfl9i0qjXJ73bVbDP9GSDxmwFE0eK7yhT+he+kG314GNjq7FJw5Yc/IFYXoF0T 89vIGF/yoTgO0C4gv4Dm1KJ8bBLUEiwazqbGY3+pbfxchrfnjaHUNHWwghKFBX4bJLY+ AYUPeoTtxrqa00WkSq0xY/P7cvSHesrcWh4L/2Ml85Rtj5C6B9kyQN/8sQxPjUnkXuZA YamXgchPgN0Ay/mkIcwqMuEDDMCDzXRBHEx0VepAZHxj3D9uckxAa6KmXeWiAb0kjw1V myqPxDuK8F/8kJ4P3QwWzbxWfC7R8D3UCr85EWNzQAAlBTyCrch19n3DCM6T+azlKBgy BCkA== X-Gm-Message-State: AJcUukftJz2TDyrAPDDlRgkKNV99fUAXSWot9zq+aXoHWkcbBj9KFdpy gQmGPCrluHwkxCUYk7VDL0XhKh8axAr3eg== X-Received: by 2002:a17:902:ba89:: with SMTP id k9mr10262428pls.189.1547122688704; Thu, 10 Jan 2019 04:18:08 -0800 (PST) Received: from cloudburst.twiddle.net (c220-239-117-135.belrs4.nsw.optusnet.com.au. [220.239.117.135]) by smtp.gmail.com with ESMTPSA id h74sm140934699pfd.35.2019.01.10.04.18.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 04:18:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 23:17:35 +1100 Message-Id: <20190110121736.23448-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190110121736.23448-1-richard.henderson@linaro.org> References: <20190110121736.23448-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH 10/11] linux-user/aarch64: Reset btype for signal handlers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" It does not make sense for a SIGILL handler to enter with the btype set as for the indirect branch that caused the SIGILL. Nor does it make sense to return from a handler with BTYPE set. This could be argued to be the handler's job, setting BTYPE within ucontext->uc_mcontext.pstate, but handling this here while the ABI is undiscussed. Signed-off-by: Richard Henderson --- linux-user/aarch64/signal.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.17.2 diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index f84a9cf28a..1fb229e696 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -218,6 +218,8 @@ static void target_restore_general_frame(CPUARMState *env, __get_user(env->pc, &sf->uc.tuc_mcontext.pc); __get_user(pstate, &sf->uc.tuc_mcontext.pstate); pstate_write(env, pstate); + /* Reset btype that might have been there going into the frame. */ + env->btype = 0; } static void target_restore_fpsimd_record(CPUARMState *env, @@ -510,6 +512,8 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, env->xregs[29] = frame_addr + fr_ofs; env->pc = ka->_sa_handler; env->xregs[30] = return_addr; + /* Reset btype going into the signal handler. */ + env->btype = 0; if (info) { tswap_siginfo(&frame->info, info); env->xregs[1] = frame_addr + offsetof(struct target_rt_sigframe, info);