Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp386351iob; Wed, 18 May 2022 04:31:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcRAcbU1285pPNUMOuM8xbWrXc5p/Jd/63XYCV5AVVxM3SRRixiku49DS+6DH8SF2jf/B6 X-Received: by 2002:a17:902:db07:b0:15e:b669:42a2 with SMTP id m7-20020a170902db0700b0015eb66942a2mr26435962plx.80.1652873479076; Wed, 18 May 2022 04:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652873479; cv=none; d=google.com; s=arc-20160816; b=oqiAlQ151VM6/FGZjqc9nPeTubZT2q0sLH7dwzDfiu3FrmbMM9YUQp3W4feZU6BQI6 b0QwKtoW5qJRuWijg+nwTMlQ9QB9t0QhnZZPrVR+Lc5TyVXhQLDOrGjc9Y6RrK3jFcL/ WIVV8ojEOXr6ANV4H8AEGdxr/HhSJdnvVRWQQXcAllxypV2wHNUR7gF74CBy0UO+7Sdg ER+ix6V5+yt3nILlyk9WIwKtXd52jmTuuFcfQOM+9zy0RhmlrdQSCIkTs0vdF73gRwd5 8DXtW05kMucljM08X+9u92XX3xVkHo/YZRHZXHsXArXkfajEQUKNKDhbzX8NmKY1dghw kkPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=d5+0ld6vIvXb4AXUGD3+swLgU10VfBo9gjxiU0sZkxo=; b=Tn8cSoq+lEfZmEy57QGIQpXe0y9EKQOPikcGt8nodtyowHbr24AOg59e+Ml5bW5Inz 66jOuaG8/fonwvAN2v+a25pB+fo7hEPWV/h6/Lgd5uggesL98wOZGdUIJN4UEayZQ4ft 08r2+aHj4hNW0W7HMhFJrzPlzzpFCy/9hf1swc7i//mXEKeSqVTlDbZROxDE22p+29zs 3nhYAOs68GkqzRBZCN06THS071xN42catWsMvYEA0gg+gf/OyutHPDVepf14ZYYrH/gU 874QL+kDrs1+DWifCCIVab5BVLd4dnoko349AY30UmVra6NkI10C+cmwHb4v1dVYhJEQ 4m3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="p/1CquKZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l19-20020a635713000000b003dbb0401e4bsi2337067pgb.62.2022.05.18.04.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 04:31:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="p/1CquKZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0BE646323; Wed, 18 May 2022 04:25:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235643AbiERLZO (ORCPT + 99 others); Wed, 18 May 2022 07:25:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235629AbiERLZH (ORCPT ); Wed, 18 May 2022 07:25:07 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69D4517568B; Wed, 18 May 2022 04:25:01 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id h11so1410866eda.8; Wed, 18 May 2022 04:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=d5+0ld6vIvXb4AXUGD3+swLgU10VfBo9gjxiU0sZkxo=; b=p/1CquKZ2KpM2HaO8peNflZCDXRy0gj1cVIe/nKuz2bP3fYtq/w6wqKzwsLpsT9sMD eOIxisTYSYNgbg4yismK+RPzGoMDjuIUDdrodj8vre7ZvWH+kOtmRAk8nwls1ZzxfOfR DAvb98vky1RH0iPEq1fpikV2GkjxIT2l41TIRP8VJtrvBnZrZ7nVKMiQmOBcVo3ZeQFh TG/yXdcL9O9dAom4vJfalvK9zJF9cFVCUObOLVqWNWDrwLe6rt5qsVdkdIR2lUtKALoi netJXodpCUQx+tB+tBGEOFoXZXTCuHTxi/S4eaMvX5cud32/jbiR3qYO+cccCDDnlO1E aRHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=d5+0ld6vIvXb4AXUGD3+swLgU10VfBo9gjxiU0sZkxo=; b=D5aWc2fTkCLfMpw4uGyCGWLCshsT3iOwqh5FrTTNBZaOOQjN7Kfnj8Iwwg8ykhGuY8 GBloRv3upSeQ7rYTY6PN72NLViUtcNIpR2eRmTNSuco/QTRzVs7trwMertsFu9k8IP6M rOp8nuAkTLB9aMG8bWih2eBZBbgOExr3jI3PQb3vXvROmxOCO59kMj5ZLJVFp2uDhhJL hrlvgao72rKpPSG2n5G9Kwa3VpCUCIcIBAm3y/a0BbugazhaYMujJQMYmYcVEUHQqiym 2NFdwJokKzW4yf6TX+dnX8G9mcV56Yk7N7iQNuc4mRLlhMNRsPyrSUHaks+J6UqzGmrI sMmQ== X-Gm-Message-State: AOAM532twxSjR5hsM4wMLrFnCq5w3P/2WoYpSxivyFXz7/vlhCEnuMHO GqKbcTJZne2O1N/0AKwIVak= X-Received: by 2002:a05:6402:1cc1:b0:428:a06e:a30f with SMTP id ds1-20020a0564021cc100b00428a06ea30fmr23710681edb.377.1652873099648; Wed, 18 May 2022 04:24:59 -0700 (PDT) Received: from krava ([193.85.244.190]) by smtp.gmail.com with ESMTPSA id n24-20020a056402515800b0042ad0358c8bsm1188980edd.38.2022.05.18.04.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 04:24:59 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Wed, 18 May 2022 13:24:56 +0200 To: Yonghong Song Cc: Jiri Olsa , Eugene Syromiatnikov , Masami Hiramatsu , Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , linux-kselftest@vger.kernel.org Subject: Re: [PATCH bpf-next v3 4/4] bpf_trace: pass array of u64 values in kprobe_multi.addrs Message-ID: References: <6ef675aeeea442fa8fc168cd1cb4e4e474f65a3f.1652772731.git.esyr@redhat.com> <20220517123050.GA25149@asgard.redhat.com> <7c5e64f2-f2cf-61b7-9231-fc267bf0f2d8@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7c5e64f2-f2cf-61b7-9231-fc267bf0f2d8@fb.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 17, 2022 at 02:34:55PM -0700, Yonghong Song wrote: > > > On 5/17/22 1:03 PM, Jiri Olsa wrote: > > On Tue, May 17, 2022 at 02:30:50PM +0200, Eugene Syromiatnikov wrote: > > > On Tue, May 17, 2022 at 11:12:34AM +0200, Jiri Olsa wrote: > > > > On Tue, May 17, 2022 at 09:36:47AM +0200, Eugene Syromiatnikov wrote: > > > > > With the interface as defined, it is impossible to pass 64-bit kernel > > > > > addresses from a 32-bit userspace process in BPF_LINK_TYPE_KPROBE_MULTI, > > > > > which severly limits the useability of the interface, change the ABI > > > > > to accept an array of u64 values instead of (kernel? user?) longs. > > > > > Interestingly, the rest of the libbpf infrastructure uses 64-bit values > > > > > for kallsyms addresses already, so this patch also eliminates > > > > > the sym_addr cast in tools/lib/bpf/libbpf.c:resolve_kprobe_multi_cb(). > > > > > > > > so the problem is when we have 32bit user sace on 64bit kernel right? > > > > > > > > I think we should keep addrs as longs in uapi and have kernel to figure out > > > > if it needs to read u32 or u64, like you did for symbols in previous patch > > > > > > No, it's not possible here, as addrs are kernel addrs and not user space > > > addrs, so user space has to explicitly pass 64-bit addresses on 64-bit > > > kernels (or have a notion whether it is running on a 64-bit > > > or 32-bit kernel, and form the passed array accordingly, which is against > > > the idea of compat layer that tries to abstract it out). > > > > hum :-\ I'll need to check on compat layer.. there must > > be some other code doing this already somewhere, right? so the 32bit application running on 64bit kernel using libbpf won't work at the moment, right? because it sees: bpf_kprobe_multi_opts::addrs as its 'unsigned long' which is 4 bytes and it needs to put there 64bits kernel addresses if we force the libbpf interface to use u64, then we should be fine > > I am not familiar with all these compatibility thing. But if we > have 64-bit pointer for **syms, maybe we could also have > 64-bit pointer for *syms for consistency? right, perhaps we could have one function to read both syms and addrs arrays > > > jirka > > > > > > > > > we'll need to fix also bpf_kprobe_multi_cookie_swap because it assumes > > > > 64bit user space pointers if we have both addresses and cookies 64 then this should be ok > > > > > > > > would be gret if we could have selftest for this let's add selftest for this thanks, jirka