From patchwork Tue Oct 5 13:57:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 515248 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1962318imy; Tue, 5 Oct 2021 07:00:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUKyGnXlnNLhekN3DF9FMsvIG7A+cCttpEYfKls9vTafcStWH0AEiHxtONYqm5rRFfklcI X-Received: by 2002:a17:90b:1b06:: with SMTP id nu6mr3928714pjb.15.1633442450144; Tue, 05 Oct 2021 07:00:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633442450; cv=none; d=google.com; s=arc-20160816; b=AfvVtPjit7zWWGp9V1jNtdM3pDvVpt505FU+5EqA28J0xBH2fU//1rNFBYpg+/LrUS 28hCg7eUvn5Dr/HiwuJbAKWr+WVsXEEImYt7Q1FgS6fznOCUMlYoJ8Q0UGKFldDhCf8S bL+ooftcR/l+fcbM09eXBS4mBeeKyOooQpw0dr2VGBEqYWYKHzpHknFEhYaDkAT78uwq RbfdBtcTq2qF/OHeM0PD4BEgbRFdb3LJHE781LHz+so5H+krTFWbqnHdGWI889frQPdy 8V2pIuJyrdkX9J6LqHMng6wUSKSlnjpc/6I7t7jG4hXbBSMKZeBS+jkicXRWWTFJeu8b GA9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=KqFDymeH30hOKQybd4WUwwVdJ6s3CdxDq4EQ5FQDzI4=; b=xUBUkq5+81RyjfHC0nqpWfdb5Hp5eOCcfRQrs6jHZGjy4n3RHO+5iEP/Ir2aesewZO BwX8kVeEyUhzrniHY3ByeEN8cRNzW9qdgBAAYvRv+2fOvPiQdWLXSR6ixq18FZHYBXG9 8aR5EiWin52x24hlHGus2IVCkcQwEdKt4vgx6/onlY44dvSVezWOHnFifh1SdXXHJbpS fzxbI982mU6tDlIlENfYD/G7HukckxBZwa6/FXkjJAZK0FoaHUfLJkBZorv+9Qwp/Do3 qVaXsVdmB0KBytILXBk8jJNO4cP3QnLY3iEFZx6E+vShAwnraCUPoLT7RoXIHUzC337u ix+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o26si2370602pfe.205.2021.10.05.07.00.49; Tue, 05 Oct 2021 07:00:50 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235366AbhJEOCj (ORCPT + 11 others); Tue, 5 Oct 2021 10:02:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:40902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236014AbhJEOB7 (ORCPT ); Tue, 5 Oct 2021 10:01:59 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 CCDCE613D5; Tue, 5 Oct 2021 13:58:28 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.94.2) (envelope-from ) id 1mXkxf-0055ji-T8; Tue, 05 Oct 2021 09:58:27 -0400 Message-ID: <20211005135827.746867602@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 05 Oct 2021 09:57:45 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Josh Poimboeuf , X86 ML , Daniel Xu , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , Abhishek Sagar , Andrii Nakryiko , Paul McKenney , stable@vger.kernel.org, Masami Hiramatsu Subject: [for-linus][PATCH 12/27] ia64: kprobes: Fix to pass correct trampoline address to the handler References: <20211005135733.485175654@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masami Hiramatsu 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 Cc: Ingo Molnar Cc: X86 ML Cc: Daniel Xu Cc: Thomas Gleixner Cc: Borislav Petkov Cc: Peter Zijlstra Cc: Abhishek Sagar Cc: Andrii Nakryiko Cc: Paul McKenney Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) --- arch/ia64/kernel/kprobes.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.32.0 diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 441ed04b1037..d4048518a1d7 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c @@ -398,7 +398,8 @@ static void kretprobe_trampoline(void) int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) { - regs->cr_iip = __kretprobe_trampoline_handler(regs, kretprobe_trampoline, NULL); + regs->cr_iip = __kretprobe_trampoline_handler(regs, + dereference_function_descriptor(kretprobe_trampoline), NULL); /* * By returning a non-zero value, we are telling * kprobe_handler() that we don't want the post_handler @@ -414,7 +415,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, ri->fp = NULL; /* 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 */ @@ -902,14 +903,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;