From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61C43C433EF for ; Sun, 24 Jul 2022 21:22:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230142AbiGXVWA (ORCPT ); Sun, 24 Jul 2022 17:22:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbiGXVV7 (ORCPT ); Sun, 24 Jul 2022 17:21:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45A19DE90 for ; Sun, 24 Jul 2022 14:21:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C63DB611CF for ; Sun, 24 Jul 2022 21:21:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A2E6C3411E; Sun, 24 Jul 2022 21:21:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658697718; bh=taQuBYGz0PZZQ9dJYa0GeJkbLiip/7XGeKqHHFf9tBw=; h=From:To:Cc:Subject:Date:From; b=bnPNIcVwGwYJYOkys1zEemq4fcSriaGaI9Yly65jyqxNAC5r5iAjo1Cr84f1zgB48 NH6Y67V7+Y2Cu8cAeqFYTFs3a+NTlKSxEdpM4sdIlIpiBWVH4eDH6O07xa/GSEWjbO tsTDioyA/7+sd799VtW7zrGEyHSD+SzALOlItcOTYz/OFplNrSd0hqtG4kjMi8uJhh oWm7hTuV3iB17uHvFapWY11Dg3bT99VywyoNd0heeibQzQsBfVqUxmkuYCL92q2iG6 vzXf7hkmcckQ30U7i396BxJVI4wC1RZjTNHt6y7qezQ7ngEp9gvxPx//DeWFHPnejF 2Y0FFU+f4qjuw== From: Jiri Olsa To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: bpf@vger.kernel.org, Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Peter Zijlstra Subject: [PATCH bpf-next 0/5] bpf: Fixes for CONFIG_X86_KERNEL_IBT Date: Sun, 24 Jul 2022 23:21:41 +0200 Message-Id: <20220724212146.383680-1-jolsa@kernel.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org hi, Martynas reported bpf_get_func_ip returning +4 address when CONFIG_X86_KERNEL_IBT option is enabled and I found there are some failing bpf tests when this option is enabled. The CONFIG_X86_KERNEL_IBT option adds endbr instruction at the function entry, so the idea is to 'fix' entry ip for kprobe_multi and trampoline probes, because they are placed on the function entry. For kprobes I only fixed the bpf test program to adjust ip based on CONFIG_X86_KERNEL_IBT option. I'm not sure what the right fix should be in here, because I think user should be aware where the kprobe is placed, on the other hand we move the kprobe address if its placed on top of endbr instruction. v1 changes: - read previous instruction in kprobe_multi link handler and adjust entry_ip for CONFIG_X86_KERNEL_IBT option - split first patch into 2 separate changes - update changelogs thanks, jirka --- Jiri Olsa (5): ftrace: Keep the resolved addr in kallsyms_callback bpf: Adjust kprobe_multi entry_ip for CONFIG_X86_KERNEL_IBT bpf: Use given function address for trampoline ip arg selftests/bpf: Disable kprobe attach test with offset for CONFIG_X86_KERNEL_IBT selftests/bpf: Fix kprobe get_func_ip tests for CONFIG_X86_KERNEL_IBT arch/x86/net/bpf_jit_comp.c | 9 ++++----- kernel/trace/bpf_trace.c | 4 ++++ kernel/trace/ftrace.c | 3 +-- tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c | 25 ++++++++++++++++++++----- tools/testing/selftests/bpf/progs/get_func_ip_test.c | 7 +++++-- tools/testing/selftests/bpf/progs/kprobe_multi.c | 2 +- 6 files changed, 35 insertions(+), 15 deletions(-)