From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796307656; b=Yli3woatIb9jTLgsA3FTHpjOqMXRWJwJ0PzDIoFUjKA28UvgD3jiBYC/736JNYg2ElKz Qa/0pXfsafEf4yW1jjGcreiadiLlDd1Ha8Lyo+1Fac85xNDqoYy5HkktPe/vyD+uhsu/x ItJ/hb/j6btfgdpEDlbs5o9U4mPTAfh3S/dsV8l3xsC1l/HjhxEWCVKydLovqej/Cv8+i O5SlYzSR34DM55YIPrjVEU3+otLK7CMhjWaracYXKLOLKfRy/BA9JRwHe/IbgYGKZbLYs H8Ljo7RrOSgoH+sofsBU1m7imM2uEOXezl1bRAC0B9EzBUBRapLaETypxWDdRXX3/jQ== 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=Dd82qs2BPR2goHv53hdi0hEgN1zj0Y3heAuox+Cvhuv52wiFu3pvCvUzJI0NeJPsA3pN z1V8rq9D7RwMpoCVrDrzygd8qFzsCK2eMSPkoUt6eZfxo5tcFAdpDpXCfff91lLMyuOQB +VlBBwYbyQZC/owMxoc5BT9Sm05S3JRCwp/QOz3Ysf5BYHd5EQ9141bsajDY5fkZzu/+z tsSEoXFMtJUoWGsH03Eh6TW+3zkrVPV9jVC4ISkFNRzokg6xPxn/c297RW8ZrD34I+m89 y6jpo9CuLMHNo7hFzSjlznFbPBSq5T00eawJkltetRFHl9CE0eEE3iWMhfV+Wl4LHSw== 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.49 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 852AF606A335 for ; Thu, 3 Dec 2026 14:20:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 852AF606A335 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-f49.google.com with SMTP id ffacd0b85a97d-4a9be758734so9266146f8f.1 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=oNlvg+VJcwxQ00csg2dyorTVigo+9rU/CoODdPVQ+MkDy0uaOa+DqDNkv5UbmCwT5C h9jei86m3ZbusFeX7dk1K5dBN3musidRSA9Rz8CEA2pE5FrvHjpKfC1STKku0XnaHORw Y+4Gjeloeiopa6cNoeqbDxDndlBrUnYd52oV1OVRBL12AsNDMBc8p7mEsCkrnBJejWCZ /ceMTYVh8w7AZTqZtbUkdNHciaDatsxaPBw23eH7IqMy0tt9Tv0QT4g27r7k00uxpe1W 5RTR5xbjFBwzXpXLRjY737ln3ImcEnHXumdFxnvQNHMBfEffXOiKPEp2ISOoIahUzYa0 iI5g== X-Forwarded-Encrypted: i=1; AL+hErGJT4FumxvwavJFt4wJMsY2lHxLaSvThonCCrmV+mqV4vh2RsQxneP6Lv/x9/39574NDzI=@vger.kernel.org X-Gm-Message-State: APuU4Z8dl5uoKYXSVpgSTp9xvRQF0kut99MGbg2WX2enut65ek2WsESH 3M+TrLMgaHPz6ySqfVMwd519/zB75IDwWXt1SK8+NV+v7xQPSUS/9U3I X-Gm-Gg: AZFdTZdKykZmI9EOiT3dkWMe01hkTMML+mW/j9prBEgV6mQgmd8RzTAKqjKYzIbL5Hy nyk6e7F45LYcmyglUVBc2e0Av8ZLPwvxtYCUXnF57lpzL1OxHu8hjC6RV6xqcWp3YFpdtXawHW3 CoDapmZHXzkH1hOAMGDgGIhf5W2KHEQofPG6TtkPYmvQXWPn73VhAWpxR4YVM1O6QheDXFsHWDz zvAB+vvNrsgg6+bA2XKjdC0OQGJ0Pvr0KoWh6/BSKLrnY2uBlE4E3mdXQi7aTy3B6Zu4aBEL3Ec qLp7eb9hP+9nYjfj30ZMJaERh9PdKrdmWq4q3YQAKt44yPKA2xLmqugow2923m7vzHURF3N3BXn go2s1eh5AmsDPPkBTh+P5cS2/wCUi34MckEa815SCJgH2cSHCmuZIasCnKXGFS0y9g7ikRLp2L2 T9dFUgZGPHxnxT+C7VaW81tXyfm+0mce9t5O2BEYQB2b98+RAIfP2hKUl0555yTrBFMYGNT6JsL uXNW1IT8/lYtORcAoh8wezlTF5/l3PXeb9/0MdPK5oZEWzfs6gJbEsefWZ4+N5jA4J0CRMBmiLf 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: bpf@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