Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1349084ybh; Mon, 13 Jul 2020 16:40:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDUmQkxIODLHGC/rkaFXuCJjTdiQ38urR0Yv5GDzHzIAjrfweM1Vh4PqQSMyMiUrR30jLV X-Received: by 2002:a50:d55b:: with SMTP id f27mr1789911edj.312.1594683637649; Mon, 13 Jul 2020 16:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594683637; cv=none; d=google.com; s=arc-20160816; b=JmddadSqdMEaCXlovuIegmuH9V/O/GAQqum4Iv2xL/+jPWdEaq5nhQddGG228RVFB9 mYS1Xfql+ZqdhQW6kXQBc/oHBpT8lTP1nXPiIi5iiBq/I02pFS6Qd8y1L6AWJAL9nyt4 sk50zPQvvotncFySY6yKTdRqyYMQJ0dsQxqEktvaSqgpNPtKxIMe2xANKsYmUVL50PRw bLuOk6vpCrpZm1c1xVfvYGuiC2xSwRHwhesNrfs6SmkZAnhLMvnCVApOTpBYKkdXBk+p vhLHY+9ZBK9hxL1DcdcyM0Iy8f5SDpz6eGn/QC+E6t3UnCjbKdALY367NL/AFYEogjBa 7KgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Qu+X2nXkt0w9bGVryK6hQjJo+IEM0VJkDG3738DpKwk=; b=v1Xit15pEJGF+qOQZ5g1etMFGHfzRkjBUjD1DOZbz0omRzV8gcTG7aEeBmr3M5eaIW pg3kHvQgul38JiB0WxYXGwqua3As/DIH3OZSPfXjx1sNgdbMOJsUWR1phH3XUvmuXNnH M9nQoBkUj6PeMnLbjkRfRbWbEeV727qjAuaoaDHn7BVDd7cnqVWcQWJHufPCvKtaom6c tXY0U42LSlW3btrZLZ1nvWRlCGyILrp5lskTUPPKu9yi4ptuyy50GXNxezZ4wQ+N56tL TMaikIF7CiLU3owbaHx0/UFrlmrEC/2AFbkng8YwOIf2pUs73jdfNJy7Gr4HHHbHzBgZ D3LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qf6HTW4K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk22si9790042edb.289.2020.07.13.16.40.15; Mon, 13 Jul 2020 16:40:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qf6HTW4K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726832AbgGMXkA (ORCPT + 99 others); Mon, 13 Jul 2020 19:40:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:51650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726339AbgGMXj7 (ORCPT ); Mon, 13 Jul 2020 19:39:59 -0400 Received: from localhost.localdomain (unknown [89.208.247.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 62D63214DB; Mon, 13 Jul 2020 23:39:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594683599; bh=6rrEJJgvghk15CsdApGD/JSMn7IJrqCOSnvwvAKk4cQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qf6HTW4K7qcujZ2v6bi3oLAkoq0TxMt1FVb3f7mG9FioTvcQ6X8XkEjXz7Ls9xdK/ L5Pa1tLfB8JBCCaNgCR+PeJ1VZApS3oltMlVyX9wGKAVM/GJfstzNNtpbuTGoq0wLJ Klv+GnAZ1wh6fyoHrDl0oAzJn8y4EvP1MwSDFVMw= From: guoren@kernel.org To: palmerdabbelt@google.com, paul.walmsley@sifive.com, mhiramat@kernel.org, oleg@redhat.com Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, anup@brainfault.org, linux-csky@vger.kernel.org, greentime.hu@sifive.com, zong.li@sifive.com, guoren@kernel.org, me@packi.ch, bjorn.topel@gmail.com, Guo Ren Subject: [PATCH v3 3/7] riscv: Fixup kprobes handler couldn't change pc Date: Mon, 13 Jul 2020 23:39:18 +0000 Message-Id: <1594683562-68149-4-git-send-email-guoren@kernel.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594683562-68149-1-git-send-email-guoren@kernel.org> References: <1594683562-68149-1-git-send-email-guoren@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guo Ren The "Changing Execution Path" section in the Documentation/kprobes.txt said: Since kprobes can probe into a running kernel code, it can change the register set, including instruction pointer. Signed-off-by: Guo Ren Cc: Masami Hiramatsu Cc: Palmer Dabbelt --- arch/riscv/kernel/mcount-dyn.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/mcount-dyn.S b/arch/riscv/kernel/mcount-dyn.S index 35a6ed7..4b58b54 100644 --- a/arch/riscv/kernel/mcount-dyn.S +++ b/arch/riscv/kernel/mcount-dyn.S @@ -123,6 +123,7 @@ ENDPROC(ftrace_caller) sd ra, (PT_SIZE_ON_STACK+8)(sp) addi s0, sp, (PT_SIZE_ON_STACK+16) + sd ra, PT_EPC(sp) sd x1, PT_RA(sp) sd x2, PT_SP(sp) sd x3, PT_GP(sp) @@ -157,6 +158,7 @@ ENDPROC(ftrace_caller) .endm .macro RESTORE_ALL + ld ra, PT_EPC(sp) ld x1, PT_RA(sp) ld x2, PT_SP(sp) ld x3, PT_GP(sp) @@ -190,7 +192,6 @@ ENDPROC(ftrace_caller) ld x31, PT_T6(sp) ld s0, (PT_SIZE_ON_STACK)(sp) - ld ra, (PT_SIZE_ON_STACK+8)(sp) addi sp, sp, (PT_SIZE_ON_STACK+16) .endm -- 2.7.4