Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4364697pxb; Tue, 25 Jan 2022 08:51:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQHiTRhReaeAnqy4r66nKhUszw7zrKMQm8OvBKZ9TcG+9hwf3cBBVwBXqayQGJVHEtJs9d X-Received: by 2002:a50:9dc1:: with SMTP id l1mr20848511edk.231.1643129504621; Tue, 25 Jan 2022 08:51:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643129504; cv=none; d=google.com; s=arc-20160816; b=X0LxfVqigoVRzZHnwnwlqucT6+KC0BeXTe4Q0Nv73tiCujs+GkbJrha2V9v9QoigUi wnJTEjaBK7lTpHxY3ypJm1PSj7v2aI/KwlpKY0DsdUoeGVdzJVGoKO8ODrd6XiGXES5h GO4RRzJd9Az+aliVtvSTbz5rs+x2AvNTnR0syWUd4ttWDyt2WU6u6RCoBsfYzZxCinlW Vjg5E2PmOGXFhPAcq8AsHmiCUPfPMLODDKB3+rqqSxYbe7uu8D6Po4QFheG64VfCn/1l kkHxs52/gi74TOiNbjUu1O/7j6kjDxVe0qKDW7sHcpwS4K8CTk24Dqw0J+5a1fv9/5MG WB4w== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=3Ag5UfdVwZ+epUdTrUY+mV7i8gSbi5eGsv2tDt+PLF8=; b=KXPSul+JCp15QB3hqSjZjhlTT75ttAEgNi/G9RkAkkAvlMf/ghIfUhhY/QBm5NCDmL 5nLxyPfvPUP7fkFSO1/T3+LrftKbYX5SLuYSuJxw7scCiJ1QHCxKit+S1qDny+5BlrV7 iCyuJQCvCZ3B/QfcRgQTmgaCHv/TpQ7ySL3pq6kRHpPncukQO9FWPg5avVgCm6PGWzV5 G1rnEPIZMdXhk9eceguSJJSaEFgyYx/pFZv4/Xchk/U9J1wlfYve5QryOQ9pMqccP2w8 ejitKatFa5bkyYO3zi66O+KL5U1eAmUNhMBSwiysFd3I3FxbHep+EyKWwvUTnWBv9zgS 617A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZJS+FA0Q; 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 g13si9802581eds.489.2022.01.25.08.51.19; Tue, 25 Jan 2022 08:51:44 -0800 (PST) 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=ZJS+FA0Q; 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 S1380573AbiAYMQe (ORCPT + 99 others); Tue, 25 Jan 2022 07:16:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59782 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355907AbiAYMLm (ORCPT ); Tue, 25 Jan 2022 07:11:42 -0500 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 705A560FFB; Tue, 25 Jan 2022 12:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7418EC340E8; Tue, 25 Jan 2022 12:11:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643112700; bh=s/++T4vWmGwl42K8BOKMjcTgDgC5RAaZIAeyuP1TZj8=; h=From:To:Cc:Subject:Date:From; b=ZJS+FA0Q8+xLsXW24zmFHFubs1V+od2Jg1gEZG2lRCqe1+7Dc8wsIq/IH7GprIg8g vyFl4vH8fyW/bXzYjxKU+BReikOScUnbCVMi5M2qNw6rMc11hTQQipPf79vRx0qc20 sMiHHeAfw/zDK4jmfqGu2ZQ/j6fTnwRzKihj2C6IZbU/QL/U/ninW9A7qKkqwA4P9S U/pxb/B1l9/FibMe8/6x8heEBFmQFvQ4jV8qpMG2JGVaHvmdt82/aKhLR2wP2bI9v/ Mnj1wCaGotnXDebto6Y/WZonD4eJSBtV8h4mjPxCReXLDD9etXS0NthVd1j3PuDS8p DzS5IJsue/ghA== From: Masami Hiramatsu To: Jiri Olsa , Alexei Starovoitov Cc: Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu , netdev@vger.kernel.org, bpf@vger.kernel.org, lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt , "Naveen N . Rao" , Anil S Keshavamurthy , "David S . Miller" Subject: [PATCH v5 0/9] fprobe: Introduce fprobe function entry/exit probe Date: Tue, 25 Jan 2022 21:11:34 +0900 Message-Id: <164311269435.1933078.6963769885544050138.stgit@devnote2> X-Mailer: git-send-email 2.25.1 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 Hi, Here is the 5th version of fprobe. This version fixed some build issues on fprobe and rethook (thanks for kernel test bot to give a hint!). The previous version is here[1]; [1] https://lore.kernel.org/all/164304056155.1680787.14081905648619647218.stgit@devnote2/ This series introduces the fprobe, the function entry/exit probe with multiple probe point support. This also introduces the rethook for hooking function return as same as kretprobe does. This abstraction will help us to generalize the fgraph tracer, because we can just switch it from rethook in fprobe, depending on the kernel configuration. The patch [1/9] is from Jiri's series[2]. [2] https://lore.kernel.org/all/20220104080943.113249-1-jolsa@kernel.org/T/#u Thank you, --- Jiri Olsa (1): ftrace: Add ftrace_set_filter_ips function Masami Hiramatsu (8): fprobe: Add ftrace based probe APIs rethook: Add a generic return hook rethook: x86: Add rethook x86 implementation ARM: rethook: Add rethook arm implementation arm64: rethook: Add arm64 rethook implementation fprobe: Add exit_handler support fprobe: Add sample program for fprobe docs: fprobe: Add fprobe description to ftrace-use.rst Documentation/trace/fprobe.rst | 131 +++++++++++ Documentation/trace/index.rst | 1 arch/arm/Kconfig | 1 arch/arm/include/asm/stacktrace.h | 4 arch/arm/kernel/stacktrace.c | 6 arch/arm/probes/Makefile | 1 arch/arm/probes/rethook.c | 71 ++++++ arch/arm64/Kconfig | 1 arch/arm64/include/asm/stacktrace.h | 2 arch/arm64/kernel/probes/Makefile | 1 arch/arm64/kernel/probes/rethook.c | 25 ++ arch/arm64/kernel/probes/rethook_trampoline.S | 87 +++++++ arch/arm64/kernel/stacktrace.c | 7 - arch/x86/Kconfig | 1 arch/x86/include/asm/unwind.h | 8 + arch/x86/kernel/Makefile | 1 arch/x86/kernel/kprobes/common.h | 1 arch/x86/kernel/rethook.c | 115 +++++++++ include/linux/fprobe.h | 86 +++++++ include/linux/ftrace.h | 3 include/linux/rethook.h | 99 ++++++++ include/linux/sched.h | 3 kernel/exit.c | 2 kernel/fork.c | 3 kernel/trace/Kconfig | 25 ++ kernel/trace/Makefile | 2 kernel/trace/fprobe.c | 198 ++++++++++++++++ kernel/trace/ftrace.c | 53 ++++ kernel/trace/rethook.c | 311 +++++++++++++++++++++++++ samples/Kconfig | 7 + samples/Makefile | 1 samples/fprobe/Makefile | 3 samples/fprobe/fprobe_example.c | 103 ++++++++ 33 files changed, 1349 insertions(+), 14 deletions(-) create mode 100644 Documentation/trace/fprobe.rst create mode 100644 arch/arm/probes/rethook.c create mode 100644 arch/arm64/kernel/probes/rethook.c create mode 100644 arch/arm64/kernel/probes/rethook_trampoline.S create mode 100644 arch/x86/kernel/rethook.c create mode 100644 include/linux/fprobe.h create mode 100644 include/linux/rethook.h create mode 100644 kernel/trace/fprobe.c create mode 100644 kernel/trace/rethook.c create mode 100644 samples/fprobe/Makefile create mode 100644 samples/fprobe/fprobe_example.c -- Masami Hiramatsu (Linaro)