Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp994780yba; Thu, 4 Apr 2019 02:01:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhXTuAVe5xvfb9trLwSy5DNbHfcB81f1wzIr2lSGRXp0KXWxWBO9VSfJDvu+PDiAtR02He X-Received: by 2002:a62:70c6:: with SMTP id l189mr4662257pfc.139.1554368461404; Thu, 04 Apr 2019 02:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554368461; cv=none; d=google.com; s=arc-20160816; b=N78vR/ogp4Rvf8cPOtuDKapSg0iYWilmM4cAplJ4m33nauTcBvms4Jx+hlJ8MG6dl7 EgMlj2HSb1sWDnF67s+5tFHGH/TWY43vuA8Uwu48AMyWD8nxd8mnNUP9GIAL2VYcRWRA Hg8D6tNJgzDeqJ/X7LMqKQ/rsvVioTrqGWKlQWjv6tNpQrPUJ1FTIgLeKENqtlcrAPxW hHA4pSXCLz8q0RGsGhatBxAMt077E+S3EmfyjxwKP0rMwP17GvVNgXGqeBW7ttUSJkB1 RKAQ+7FpcSdj0c8pR1/fvPbBq31w7evSjC8n8OGvK0P/3opWWgC0XzjQ4kWAQKZkcwlN XSXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oVCEuj6qmBKhHtgbGh30fvDWgNQXGitkL8b74DYQb4U=; b=0jjZwvUiHUzdu6xM9edRfLwgfwxzg/tWY2Z7u4d+F1LIafHhTOBUru8uWQZersTfss xhl1AC605YB4VEjJQeDcarEzBcJvYhqAQoFjrmGowaEIbPpqHzf4W3qwMGS44NFApibv vSbPJNy9GTYSZrUs8nOi9+KF7xQ7FT6z7YZRNY8UTnVo0PUxWCuTPWma0Pnwa7Pld0qJ 9U2UEm6Vuo8RG5JU+RZd9DNNj1akugz33AkuT/qvBOxS3Ad0wmimznLuHeTVHPxwXFha 4By2m3SsDXqzU6Blp/TSWfzuoTy69yP1GyzQUEWdm3fuXBNjiWTvCGKFmXe/dEJf10Gq 8DRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VlV5pcW9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 82si15949915pft.35.2019.04.04.02.00.46; Thu, 04 Apr 2019 02:01:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VlV5pcW9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731189AbfDDJAC (ORCPT + 99 others); Thu, 4 Apr 2019 05:00:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:36528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731175AbfDDJAB (ORCPT ); Thu, 4 Apr 2019 05:00:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B2E892147C; Thu, 4 Apr 2019 09:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368401; bh=Wqevb1Ad+roFVX+bnBhfx246ng5AuZTwMhkLbmDl6OQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VlV5pcW92A+I4afT0ZShbwn4Ov46zIVAnw/XMzKQR6P+Xk0tuekMKmLWi94wYgwFF GxKbkXTcF0/lUCJGGZAFrmKeqQuoxBjAhbq+lAAVREwFMTSfOX6VW6eoRfgDNeY9pY DuxMWh7HsDMufEEDXM9MNLKI0QEr4ivr3RiY7txU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Will Deacon , Catalin Marinas Subject: [PATCH 4.19 001/187] arm64: debug: Dont propagate UNKNOWN FAR into si_code for debug signals Date: Thu, 4 Apr 2019 10:45:38 +0200 Message-Id: <20190404084603.181541247@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Will Deacon commit b9a4b9d084d978f80eb9210727c81804588b42ff upstream. FAR_EL1 is UNKNOWN for all debug exceptions other than those caused by taking a hardware watchpoint. Unfortunately, if a debug handler returns a non-zero value, then we will propagate the UNKNOWN FAR value to userspace via the si_addr field of the SIGTRAP siginfo_t. Instead, let's set si_addr to take on the PC of the faulting instruction, which we have available in the current pt_regs. Cc: Reviewed-by: Mark Rutland Signed-off-by: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- arch/arm64/mm/fault.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -827,11 +827,12 @@ void __init hook_debug_fault_code(int nr debug_fault_info[nr].name = name; } -asmlinkage int __exception do_debug_exception(unsigned long addr, +asmlinkage int __exception do_debug_exception(unsigned long addr_if_watchpoint, unsigned int esr, struct pt_regs *regs) { const struct fault_info *inf = debug_fault_info + DBG_ESR_EVT(esr); + unsigned long pc = instruction_pointer(regs); int rv; /* @@ -841,10 +842,10 @@ asmlinkage int __exception do_debug_exce if (interrupts_enabled(regs)) trace_hardirqs_off(); - if (user_mode(regs) && instruction_pointer(regs) > TASK_SIZE) + if (user_mode(regs) && pc > TASK_SIZE) arm64_apply_bp_hardening(); - if (!inf->fn(addr, esr, regs)) { + if (!inf->fn(addr_if_watchpoint, esr, regs)) { rv = 1; } else { struct siginfo info; @@ -853,7 +854,7 @@ asmlinkage int __exception do_debug_exce info.si_signo = inf->sig; info.si_errno = 0; info.si_code = inf->code; - info.si_addr = (void __user *)addr; + info.si_addr = (void __user *)pc; arm64_notify_die(inf->name, regs, &info, esr); rv = 0; }