summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-02-20 13:28:06 +0100
committerThomas Gleixner <tglx@linutronix.de>2020-06-11 15:14:54 +0200
commitf64366efd8c60b93138b813d071d2cd201fd0f6e (patch)
tree27e6ce22ce10c84e95b811e18e2ec53b952fb155 /arch/x86
parentdf65bba1dcd8ffadd922a71196b78c6d7630c33b (diff)
x86/int3: Inline bsearch()
Avoid calling out to bsearch() by inlining it, for normal kernel configs this was the last external call and poke_int3_handler() is now fully self sufficient -- no calls to external code. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com> Acked-by: Andy Lutomirski <luto@kernel.org> Link: https://lkml.kernel.org/r/20200505135313.731774429@linutronix.de
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/alternative.c8
-rw-r--r--arch/x86/kernel/traps.c5
2 files changed, 9 insertions, 4 deletions
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 50a8d24a417e..8fd39ff74a49 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -1033,7 +1033,7 @@ static __always_inline void *text_poke_addr(struct text_poke_loc *tp)
return _stext + tp->rel_addr;
}
-static int noinstr patch_cmp(const void *key, const void *elt)
+static __always_inline int patch_cmp(const void *key, const void *elt)
{
struct text_poke_loc *tp = (struct text_poke_loc *) elt;
@@ -1077,9 +1077,9 @@ int noinstr poke_int3_handler(struct pt_regs *regs)
* Skip the binary search if there is a single member in the vector.
*/
if (unlikely(desc->nr_entries > 1)) {
- tp = bsearch(ip, desc->vec, desc->nr_entries,
- sizeof(struct text_poke_loc),
- patch_cmp);
+ tp = __inline_bsearch(ip, desc->vec, desc->nr_entries,
+ sizeof(struct text_poke_loc),
+ patch_cmp);
if (!tp)
goto out_put;
} else {
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index b28a64d7691f..280c290f414f 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -570,6 +570,11 @@ exit:
dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
{
+ /*
+ * poke_int3_handler() is completely self contained code; it does (and
+ * must) *NOT* call out to anything, lest it hits upon yet another
+ * INT3.
+ */
if (poke_int3_handler(regs))
return;