Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp737902pxb; Tue, 14 Sep 2021 07:43:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxx1bNqG5OuEta7Z6OFJIhlr0kTtp+ZbKkjwgSpqL8sk6NVekKtIxGU7iDh3mTB+1Sq5DX8 X-Received: by 2002:a05:6402:886:: with SMTP id e6mr19593734edy.41.1631630628307; Tue, 14 Sep 2021 07:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631630628; cv=none; d=google.com; s=arc-20160816; b=z71puYRYQXyhI3VYt7Gl4m5UCP8Z5wKTkwefumHwJ4vL3J0upUQt0biu9O4acZkRby ZLf7QcuuHFwzlBFLD3eBYpe87aXowMnRgSsGxw0Fw9FZzx1AsCduQDWTUx2edmj40Pv8 iKWK2kFoKEtiu/TPU6nj8vbMYlW18far21gnkKIvsmdZaXGTIFO6VKgN/0tZ0y1p9ZtI Y1wo2wHUxlI2XvGT4ExDqsm3BX2xReZzEIU4lxkSCZp2+luDeApptz7TsnXI6K124bJ9 EvjDScbLTTT0rgFI4roz83szarygdj9I+FgQsscxCMcxRA4GWFpPFbW1h7Y7SkdQPjxf ZQgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q0AHOAnrUU3O7KyQu2cUEAqsNm2eLYiyFJP8584h9Mo=; b=1H8gwbUKEac4kiZHv1nfycKlrCXWm3YLcvhYlapSlcB87iL10e5bDPjDgti/1WaFbt niqcrsSMtbQZ+RwjtOPfKKmiDrcKPRouswCualPTKYpBdC62nFXShGpTBS0usUySabF1 I7ytKmhfLa5bt6MYj8OooFe/LynzIjH07oo+LrK24LIZIssxin40q0bsA8vSj4Vux+3I ooe6xlbzsnrU84pYsf/cYl88DZqMdttT1KORV3M30ByIo5Ke3NkGGYsSImV6EWu06VKu /d+RNuCTUOuif9DpdTGg/Hd7K1qc5d2G0M+8nPPq9v1Yg8ZWsVJMMBnhChFWporxpMJO lGoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="N6V/Bs+f"; 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 s27si10478609edy.251.2021.09.14.07.43.24; Tue, 14 Sep 2021 07:43:48 -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=k20201202 header.b="N6V/Bs+f"; 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 S234622AbhINOnG (ORCPT + 99 others); Tue, 14 Sep 2021 10:43:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:35924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234540AbhINOls (ORCPT ); Tue, 14 Sep 2021 10:41:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 77E98610FB; Tue, 14 Sep 2021 14:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631630431; bh=ZNH37xRqRkeLbZ1aRCFRgCl0otMIRMYADO1YOQyAq1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N6V/Bs+fEbkae985bgY/OhAZW/evyfTR4skoNAMGYZDV545jQf4VT0ptoU3E5whXr 1R+CX0KAIIlBytMj0y7E7W2mXtkCxvWi5DIwx5VHwPLCMkSWXKrTIcnQ31yREII46m +zAs56qTJxJRoGS1nakj/nxC7R23mR5c+Hzvu3D+V87KYxaYJJe8ySTTjoEdbD94LR YazKaalCB3PYS4aMj6NtuiTUzwIdF/AggbExYcLlma62CHB58LXJ1dTIV4Ny0wyw/F rGSLu8NNH0jtMwhEnFAyCbPz712OBQWJrpdEtiu+o1TChaaCv8dIZg8Qkvc5NHjvV6 Ks42dZzKZOBqQ== From: Masami Hiramatsu To: Steven Rostedt , Josh Poimboeuf , Ingo Molnar Cc: X86 ML , Masami Hiramatsu , Daniel Xu , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kuba@kernel.org, mingo@redhat.com, ast@kernel.org, Thomas Gleixner , Borislav Petkov , Peter Zijlstra , kernel-team@fb.com, yhs@fb.com, linux-ia64@vger.kernel.org, Abhishek Sagar , Andrii Nakryiko , Paul McKenney Subject: [PATCH -tip v11 12/27] ia64: kprobes: Fix to pass correct trampoline address to the handler Date: Tue, 14 Sep 2021 23:40:27 +0900 Message-Id: <163163042696.489837.12551102356265354730.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163163030719.489837.2236069935502195491.stgit@devnote2> References: <163163030719.489837.2236069935502195491.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Fixes: e792ff804f49 ("ia64: kprobes: Use generic kretprobe trampoline handler") Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu --- Changes in v9: - Update changelog according to Ingo's suggestion. - Add Cc: stable tag. Changes in v5: - Fix a compile error typo. --- arch/ia64/kernel/kprobes.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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;