Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5175236pxj; Wed, 26 May 2021 04:48:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxV8htFlUZq/snw1u6m1wKJkDEZtz3Ls02mNv/5MSXL1XAGQvbMKVpq/UHD2FEf36qNPYgz X-Received: by 2002:a5d:9804:: with SMTP id a4mr25978422iol.164.1622029694563; Wed, 26 May 2021 04:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622029694; cv=none; d=google.com; s=arc-20160816; b=IK8bHbN+60xSzTfki8SwvyLDNVoOkgBpmi4fNMFxeg1Inkfdu96ddaxuoUIgxagGUA MhvW9qP2QJlRnm1+ngWj7E9Fn9FQuJ+XcYuwMw+egPgRq2SaC7YwIlKw8CeQKL2rg+Kq DZy+PU3K+Mfdb2FFVcl82/4/JdDhCqp7m5K+20xo3iTlxLTORirLaUPw1K18MXVhMlmO vcOGwZYpXUDN5pB33wQsPKyCGAZJp9OZk/0bp0ty9jBVPaFjagCV1gtPUTNm+dNnqDdD YtpCVkgNRmih86NM3O/33uPNTVGTEkO+Z7P8FlVYfcPbusj8F0OS2yAu78zMx5AW0mpU Tmmw== 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=VS73K7bp7jN/HhyzJwuMyv7xzdk+IFRIucNuBSxTF3I=; b=P8+IlbtLXOl7xnUzK+GRd6Wc75cVFPwmK+tpnwHPos0fxfkJOl7z05uSJX9a7jQozX qkvpdrJv+DSv4dAkJh/ItOsMen2FGwbP9c/mOlOlkZUcuF9PnWpgRmmHXlzr6gwAGqT8 FvWEhDlAB4AGwR0nmDZlXV+zyu2uS9zU7Sd2VDbQJ0G1y0E5HaDWCi716fWQQz7vy3Ai ZNTgMg+/tiPoA35boIBVzPsnN3jxeQkdPMm7h7JVsKGo40QA7wZNpCKFiSzKms3pzLls pslLB+NeyhLpiWm5uM+pJgWYim/Blq9V82M9VrRZwvhEHlODUn++YiOsDxoAPxLASy0w X4og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SJd0Rk23; 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 c12si1928859ilh.154.2021.05.26.04.48.00; Wed, 26 May 2021 04:48:14 -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=SJd0Rk23; 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 S233074AbhEZID6 (ORCPT + 99 others); Wed, 26 May 2021 04:03:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:38990 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232812AbhEZID4 (ORCPT ); Wed, 26 May 2021 04:03:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E4B7613D3; Wed, 26 May 2021 08:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622016145; bh=lruHPAWz+JCx1JmZ/0Vse4XTb21USc/CY1aMZrfI25g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SJd0Rk23zHcoI4KJ4yWdfJ/xU3z3lhlEVC5s0XCINOGDmbvZnW4erjhOFYAfL/wYk DnQXZ79DJr9SUf8OnY/76848Vvo6ukfk6u7pu+KQriN4bq99z6xsd9fILzSOCuiEm9 DBR11L8RllQHJyBsHo8sACGmT5FhWoyB19Hlf0iGaKIMUiORrkOnbvJhFCv1na1VKV P+vyCd53galgzKurW2iSM42FXBXcycr+WqIl//yLaITTSKKjBEIcpbr4bKa6UCJ4ze Xx0j27ickBYBR11hR6hmWO/0/bTVOv1sLwuXTcFQuUJTA2hLDlkOK53nfNBC95cGgc Ai3KVNnVC+1Kw== From: Masami Hiramatsu To: Steven Rostedt , 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, tglx@linutronix.de, kernel-team@fb.com, yhs@fb.com, Josh Poimboeuf , linux-ia64@vger.kernel.org, Abhishek Sagar , Andrii Nakryiko Subject: [PATCH -tip v6 01/13] ia64: kprobes: Fix to pass correct trampoline address to the handler Date: Wed, 26 May 2021 17:02:20 +0900 Message-Id: <162201614019.278331.4298879353454259298.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <162201612941.278331.5293566981784464165.stgit@devnote2> References: <162201612941.278331.5293566981784464165.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 Commit e792ff804f49 ("ia64: kprobes: Use generic kretprobe trampoline handler") missed to pass the wrong trampoline address (it passes the descriptor address instead of function entry address). This fixes it to pass correct trampoline address to __kretprobe_trampoline_handler(). This also changes to use correct symbol dereference function to get the function address from the kretprobe_trampoline. Fixes: e792ff804f49 ("ia64: kprobes: Use generic kretprobe trampoline handler") Signed-off-by: Masami Hiramatsu --- 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 fc1ff8a4d7de..ca4b4fa45aef 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 */ @@ -918,14 +919,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;