linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>,
	Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Anton Blanchard <anton@samba.org>,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH v5 5/7] powerpc/64s: Un-blacklist system_call() from kprobes
Date: Thu, 29 Jun 2017 23:19:18 +0530	[thread overview]
Message-ID: <d40ddfd827291861bcc18b25e3722616f5f60a81.1498755960.git.naveen.n.rao@linux.vnet.ibm.com> (raw)
In-Reply-To: <cover.1498755960.git.naveen.n.rao@linux.vnet.ibm.com>
In-Reply-To: <cover.1498755960.git.naveen.n.rao@linux.vnet.ibm.com>

It is actually safe to probe system_call() in entry_64.S, but only till
we unset MSR_RI. To allow this, add a new symbol system_call_exit()
after the mtmsrd and blacklist that.

Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/entry_64.S | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index c39436706555..5b919b2a62da 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -187,6 +187,18 @@ system_call:			/* label this so stack traces look sane */
 	andi.	r10,r8,MSR_RI
 	beq-	unrecov_restore
 #endif
+
+/*
+ * This is a few instructions into the actual syscall exit path (which actually
+ * starts at .Lsyscall_exit) to cater to kprobe blacklisting and to reduce the
+ * number of visible symbols for profiling purposes.
+ *
+ * We can probe from system_call until this point as MSR_RI is set. But once it
+ * is cleared below, we won't be able to take a trap.
+ *
+ * This is blacklisted from kprobes further below with _ASM_NOKPROBE_SYMBOL().
+ */
+system_call_exit:
 	/*
 	 * Disable interrupts so current_thread_info()->flags can't change,
 	 * and so that we don't get interrupted after loading SRR0/1.
@@ -413,7 +425,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
 	b	.	/* prevent speculative execution */
 #endif
 _ASM_NOKPROBE_SYMBOL(system_call_common);
-_ASM_NOKPROBE_SYMBOL(system_call);
+_ASM_NOKPROBE_SYMBOL(system_call_exit);
 
 /* Save non-volatile GPRs, if not already saved. */
 _GLOBAL(save_nvgprs)
-- 
2.13.1

  parent reply	other threads:[~2017-06-29 17:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 17:49 [PATCH v5 0/7] powerpc: build out kprobes blacklist -- series 3 Naveen N. Rao
2017-06-29 17:49 ` [PATCH v5 1/7] powerpc64/elfv1: Only dereference function descriptor for non-text symbols Naveen N. Rao
2017-07-04 10:48   ` [v5, " Michael Ellerman
2017-06-29 17:49 ` [PATCH v5 2/7] powerpc/64s: Convert .L__replay_interrupt_return to a local label Naveen N. Rao
2017-06-29 17:49 ` [PATCH v5 3/7] powerpc/64s: Blacklist system_call() and system_call_common() from kprobes Naveen N. Rao
2017-07-01  2:24   ` Michael Ellerman
2017-07-02 12:40     ` Nicholas Piggin
2017-07-02 17:25       ` Naveen N. Rao
2017-06-29 17:49 ` [PATCH v5 4/7] powerpc/64s: Move system_call() symbol to just after setting MSR_EE Naveen N. Rao
2017-06-29 17:49 ` Naveen N. Rao [this message]
2017-06-29 17:49 ` [PATCH v5 6/7] powerpc/64s: Blacklist functions invoked on a trap Naveen N. Rao
2017-06-29 17:49 ` [PATCH v5 7/7] powerpc/64s: Blacklist rtas entry/exit from kprobes Naveen N. Rao
2017-06-30  7:07 ` [PATCH v5 0/7] powerpc: build out kprobes blacklist -- series 3 Nicholas Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d40ddfd827291861bcc18b25e3722616f5f60a81.1498755960.git.naveen.n.rao@linux.vnet.ibm.com \
    --to=naveen.n.rao@linux.vnet.ibm.com \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mhiramat@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).