From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Josh Poimboeuf <jpoimboe@redhat.com>,
Ingo Molnar <mingo@kernel.org>, X86 ML <x86@kernel.org>,
Daniel Xu <dxu@dxuuu.xyz>, Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>,
Peter Zijlstra <peterz@infradead.org>,
Abhishek Sagar <sagar.abhishek@gmail.com>,
Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Paul McKenney <paulmck@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
"Steven Rostedt (VMware)" <rostedt@goodmis.org>
Subject: [PATCH 4.19 10/12] ia64: kprobes: Fix to pass correct trampoline address to the handler
Date: Fri, 29 Apr 2022 12:41:27 +0200 [thread overview]
Message-ID: <20220429104048.762619339@linuxfoundation.org> (raw)
In-Reply-To: <20220429104048.459089941@linuxfoundation.org>
From: Masami Hiramatsu <mhiramat@kernel.org>
commit a7fe2378454cf46cd5e2776d05e72bbe8f0a468c upstream.
The following commit:
Commit e792ff804f49 ("ia64: kprobes: Use generic kretprobe trampoline handler")
Passed the wrong trampoline address to __kretprobe_trampoline_handler(): it
passes the descriptor address instead of function entry address.
Pass the right parameter.
Also use correct symbol dereference function to get the function address
from 'kretprobe_trampoline' - an IA64 special.
Link: https://lkml.kernel.org/r/163163042696.489837.12551102356265354730.stgit@devnote2
Fixes: e792ff804f49 ("ia64: kprobes: Use generic kretprobe trampoline handler")
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: X86 ML <x86@kernel.org>
Cc: Daniel Xu <dxu@dxuuu.xyz>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Abhishek Sagar <sagar.abhishek@gmail.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Paul McKenney <paulmck@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/ia64/kernel/kprobes.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -424,7 +424,7 @@ int __kprobes trampoline_probe_handler(s
struct hlist_node *tmp;
unsigned long flags, orig_ret_address = 0;
unsigned long trampoline_address =
- ((struct fnptr *)kretprobe_trampoline)->ip;
+ (unsigned long)dereference_function_descriptor(kretprobe_trampoline);
INIT_HLIST_HEAD(&empty_rp);
kretprobe_hash_lock(current, &head, &flags);
@@ -500,7 +500,7 @@ void __kprobes arch_prepare_kretprobe(st
ri->ret_addr = (kprobe_opcode_t *)regs->b0;
/* Replace the return addr with trampoline addr */
- regs->b0 = ((struct fnptr *)kretprobe_trampoline)->ip;
+ regs->b0 = (unsigned long)dereference_function_descriptor(kretprobe_trampoline);
}
/* Check the instruction in the slot is break */
@@ -1030,14 +1030,14 @@ static struct kprobe trampoline_p = {
int __init arch_init_kprobes(void)
{
trampoline_p.addr =
- (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip;
+ dereference_function_descriptor(kretprobe_trampoline);
return register_kprobe(&trampoline_p);
}
int __kprobes arch_trampoline_kprobe(struct kprobe *p)
{
if (p->addr ==
- (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip)
+ dereference_function_descriptor(kretprobe_trampoline))
return 1;
return 0;
next prev parent reply other threads:[~2022-04-29 10:42 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 10:41 [PATCH 4.19 00/12] 4.19.241-rc1 review Greg Kroah-Hartman
2022-04-29 10:41 ` [PATCH 4.19 01/12] media: vicodec: upon release, call m2m release before freeing ctrl handler Greg Kroah-Hartman
2022-04-29 10:41 ` [PATCH 4.19 02/12] floppy: disable FDRAWCMD by default Greg Kroah-Hartman
2022-04-29 10:41 ` [PATCH 4.19 03/12] hamradio: defer 6pack kfree after unregister_netdev Greg Kroah-Hartman
2022-04-29 10:41 ` [PATCH 4.19 04/12] hamradio: remove needs_free_netdev to avoid UAF Greg Kroah-Hartman
2022-04-29 10:41 ` [PATCH 4.19 05/12] net/sched: cls_u32: fix netns refcount changes in u32_change() Greg Kroah-Hartman
2022-04-29 10:41 ` [PATCH 4.19 06/12] powerpc/64/interrupt: Temporarily save PPR on stack to fix register corruption due to SLB miss Greg Kroah-Hartman
2022-04-29 10:41 ` [PATCH 4.19 07/12] powerpc/64s: Unmerge EX_LR and EX_DAR Greg Kroah-Hartman
2022-04-29 10:41 ` [PATCH 4.19 08/12] Revert "ia64: kprobes: Fix to pass correct trampoline address to the handler" Greg Kroah-Hartman
2022-04-29 10:41 ` [PATCH 4.19 09/12] Revert "ia64: kprobes: Use generic kretprobe trampoline handler" Greg Kroah-Hartman
2022-04-29 10:41 ` Greg Kroah-Hartman [this message]
2022-04-29 10:41 ` [PATCH 4.19 11/12] Revert "net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link" Greg Kroah-Hartman
2022-04-29 10:41 ` [PATCH 4.19 12/12] lightnvm: disable the subsystem Greg Kroah-Hartman
2022-04-29 17:15 ` [PATCH 4.19 00/12] 4.19.241-rc1 review Jon Hunter
2022-04-29 18:36 ` Shuah Khan
2022-04-29 23:48 ` Guenter Roeck
2022-04-30 5:55 ` Naresh Kamboju
2022-04-30 10:18 ` Sudip Mukherjee
2022-05-03 10:41 ` Pavel Machek
2022-05-03 14:16 ` Guenter Roeck
2022-05-03 14:25 ` Greg Kroah-Hartman
2022-05-03 16:41 ` Guenter Roeck
2022-05-09 8:04 ` Greg Kroah-Hartman
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=20220429104048.762619339@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=andrii.nakryiko@gmail.com \
--cc=bp@alien8.de \
--cc=dxu@dxuuu.xyz \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sagar.abhishek@gmail.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.