From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796307656; b=d3quhODi0CL+IRR152e65JWvO0Mz6lUJk4inpCIaHJS25VH1XIjOBfxOka3vjtels5t9 7F9TdVeDpUS8A+xgUkrFLiA1jvHoP9NV4fG6gu5BUTN5rbCCLixDXgn6L691dMR1lJKqf 1rwrTYNODpgHa7sF5PAgYPDKa03zEXfUDw5QLa4enVCj2PwvEamLrgcfVBh9lOmoxEnow /Jvqa1dTdsA9NhlZXVLKkHEr9B0U95eFMqlQlFxNkGVJGl0WVrH4LBjzWfj1Ufg8kThpR UCJ/r7uj1Q0bze6oiwg6eKf/94GoBMgflNBTKDcSMXVh7KCk0f9/rpvCwsMKICmtUkQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796307656; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:X-Google-Original-From:Date:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=iVUmzG6J2/rficyQtYSwxVGwhUZz3/UKxzR+2T2WCTA=; b=gUf8RTqG+0w8+Elow703MXG1vvqgD9INBByKH6PNdQnN+M3lN2LfRoo7ZJYdtShLBJLU MkmF4Gl2O0jt+cUFewIvVpIMHnxLyi2/XyG13z5mrMHu2AH6V1gIbbIZmyN/dFlBQ1HT/ 2TILRN6PXzL8zQVVIycr2mjdAOylil7TX13kBuT0b+AV2pkkMbj7xW4MWPm0CVK4JTKaI yMupPFYgz5QzA8zZa25U3A8XH4AMQ9qtlu2rORm7WB6CoDSNQGT8ecaUvYAg/z4xuLgZ+ T2YNovHjfl3we39SS1PnfvoazVU1cpRse6luhJqEJ2uuTgBTalyO07g6/vOnAmULpZA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="hN/YWP/2"; arc=none smtp.remote-ip=209.85.221.53 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 890D3606A336 for ; Thu, 3 Dec 2026 14:20:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 890D3606A336 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hN/YWP/2 Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-48e3b22e971so7404620f8f.0 for ; Thu, 03 Dec 2026 06:20:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796307655; x=1796912455; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:date:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=iVUmzG6J2/rficyQtYSwxVGwhUZz3/UKxzR+2T2WCTA=; b=hN/YWP/2aP6TD4trG2ezi0HJiAY83OleXBAoq6oYipetlEiLzMbTN+t5BGBfIIFzr4 D07i/lwvBStMdREdTtHHlq2x5yzlIS5DfXFz6F+FKUJC+EH6TTWjh3IpBxDjndgIbTF2 3KTPBg8WhJFr2ZXTbFC3vvleslaqEHV9JSdOwOrmG2ocNNx44WwygJFZpBcNMyHAJ+J1 ZqdREjT+bhDgbMeKv8FvbDty8YCUZcgkYzFTjYdvrS4xYUomrIM3Ubyi9PxcUZ7jM2bW 9x/i9cnVckoWziQcDkkD21gP2ZAVOJXPiTw8eB5CmS0DJjvMXMNd8KJFwffRD2QVhcN3 l/gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796307655; x=1796912455; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=iVUmzG6J2/rficyQtYSwxVGwhUZz3/UKxzR+2T2WCTA=; b=Fwvu80kD0bSK+XbjiFiYzcKI8yYBPTPJ//md+pgp+qnVnBjpyhCRzoIhLC5wS4uCbm BGnJ2oRJODhwvH3iDbJWtzJaEw3wqpuPdwJW9B5VuyNbqzL00HOuVEXRJ7sUTEL0gQpm q1rnpYiLBOrp4VpxIxbGZc0iSfk3fW95VT6RaLTN5Of1S8qGywGXBXV6wKkbaJJyNnzH rTAptd1YDzgwFr33RMusO6jImM7DuRqkZIjLixCiFVoW0hXMwlY317HbIogLH+ikxH2/ NTjt/DHQpQnLMu0JCJ/+mUybomly9cMrJH6U+OLSpznfPdQHyQyK23zTQ/0R5zEUtBXA P90w== X-Forwarded-Encrypted: i=1; AL+hErHQb6i+mliwumfyoFZ+vaoF64210M5EoSEvZ6YNfmkvGisfvAIbAsmh4IUfL128FQ0I60koeus3YKahNnU=@vger.kernel.org X-Gm-Message-State: APuU4Z/Qo/qRKMwe7oyhX/PSOmOcH/7ftX95CdPu2UqvqaE/pg/5SYPK YIs+9atDzdDZue2vVqCsSkdO3wCJ1ijmlpZJzNVXjDWsA9wE1FUfXPG2 X-Gm-Gg: AZFdTZeQUTFkm8/bsfvhN7uoCcgHLQBaM/sktxqFKMkDCyMdeC5QzFMosag6GyCaIY0 +0HRmBExlaytRTMD6C8oAGY5NOJZx0UUtQqUQnx9vdG4fGR8u4YS31GxdPrA8046wJ1dP6f+b7K ygg+RkqDl3uB1t0TDCdq+FNzHXIApGTeGa+squx7yQyAapNahKbktqA7bxOofN/Bq8ufwMDgXHq Pf1c/X5NZFsoGr/rIrJ4H+i0ik3A8MvZbRXPME4QdMX0K2LipCIu5L8WwzPQfRDgzzfnumpr5jB p2KH7t43mISZeUtkp6gQD5teW+vm0QCxf23eZuYm04sXoQlZglbImRUS8XVFjwTQXlcquN3QcK/ m8hN8Ra3uEiSEGHXmhlh5sHOOkN4ou2JVL+VuTViYynORwNRhXWOS/HG/SSqa9CB+fUg2KJivJS MplFNP8u6X/LhbRuhYG/zmSCFAQGGqmtUgFK2irRNU5GZIgIQfv5Bp0xVzYPrpkIWlzvrzJ3abK lUXpw8YB22hA87AqTllep0giXReyqa7clC6LZGFkq0DD2xPF4Am/61RMiNSO72RxW4JS2zmtR2p X-Received: by 2002:a05:6000:4028:b0:4a6:bc53:246c with SMTP id ffacd0b85a97d-4abb3956374mr85794583f8f.42.1796307654747; Thu, 03 Dec 2026 06:20:54 -0800 (PST) Received: from krava ([2a02:8308:a00c:e200::25dc]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6bb989b3sm84106115f8f.51.2026.12.03.06.20.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 06:20:54 -0800 (PST) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Thu, 3 Dec 2026 15:20:51 +0100 To: Alexei Starovoitov Cc: Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu , bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Song Liu , Yonghong Song , Quentin Monnet , Alan Maguire Subject: Re: [PATCH RFC bpf-next 00/31] bpf: Attach kprobe multi link to inlined functions Message-ID: References: <20261202123035.10335-1-jolsa@kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Dec 03, 2026 at 01:57:14AM +0000, Alexei Starovoitov wrote: > On Wed, Dec 02, 2026 at 04:30 AM Jiri Olsa wrote: > > This patchset adds BPF_F_KPROBE_MULTI_INLINE flag that attaches also > > the inlined instances of the functions in the syms array. The > > instances are resolved from inline BTF (CONFIG_DEBUG_INFO_BTF_INLINE) > > of vmlinux and modules and each gets its own kprobe. > > I like the idea. kprobes behind the kprobe multi link is the piece > that was missing. > But the lookup by name in the kernel is kinda heavy. > > In Alan's RFC thread I leaned towards the kernel doing the whole thing. > The reason: kprobe multi could not attach to arbitrary IPs. > Patch 7 shows that it can. That changes the trade off. > > Lets start with the mechanism only. > addrs[] takes any address that kprobes accept. > fprobe gets the ftrace locations. Every other address gets a kprobe. > Such addrs fail with -ENOENT in fprobe_init() today, so no need for > a flag. > User space reads vmlinux.inline from sysfs and passes the sites. ok, makes sense, more comments below > > libbpf works this way already. It resolves "tcp_*" in user space and > passes addrs. In this series wildcards can't use inline (patch 19). > To match fully inlined functions libbpf has to read vmlinux.inline > anyway. > > this series addrs[] > ----------------- ----------------------- ------------------------- > name -> sites kernel, exact names user space, wildcards too > subset of sites no yes > vmlinux.inline 2nd copy, ~10 Mbytes, mmap in user space > never freed > cookie per function per site > args bpf_get_func_arg() cookie -> arg spec, like > usdt.bpf.h > arch x86-64 any with kprobes > link info 5 new fields as is > fdinfo 2 new lines as is, %pS > bpftool new table, BTF lookup print sym+off > new flags 2 0 > > Your use case from Alan's v2 thread works too: trace foo() only where > it is inlined in bar(). User space picks the sites. > > Then there is no need for BTF parsing in the kernel, module_sect_addr(), > regs_get_dwarf_register(), inline_* in bpf_link_info, STRICT, etc. > Patches 2 and 3 stay. > > If tracers show that the lookup has to be in the kernel we add it > on top of addrs[]. uapi doesn't go the other way. initially I thought that doing the lookup in user space might be a security concern for shirudo, but it's probably just more work for the loader, not a security risk > > What the diff doesn't do: > It is all or none. imo that's the right default. > It doesn't say which address kprobes refuse. The link_create log can > name it. A flag to skip such addresses can come later. link info shows > what is attached. I think we need the skip flag. kprobes refuse some of the inlined sites (jump label, static call, bug table, NOKPROBE_SYMBOL, noinstr) and finding those in user space would need vmlinux and a copy of the kprobe checks, which seems too much I changed the bench test to print out the stats: inlined instances 20695 attached 19947 skipped, notrace function 563 skipped, refused by kprobes 185 it's the worst case, normal attach with just a few functions would hit much less, but it's still inconvenient, because user space has to retry the attach for each address the log names > It calls register_kprobes(). enable_kprobes() goes on top. ok > Two functions inlined at one address share one cookie. I think we can still allow same addresses having their own cookie, if we keep the cookie in the kprobe struct and pass it through the run context instead of looking it up by the address it's probably needed for the arg specs too, two inline functions on the same address would otherwise end up with the same spec thanks, jirka