Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp614137rwi; Wed, 2 Nov 2022 16:12:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EDyxlBIdqJmMAtEslwPmUPZq00USWCzwSPTfptgahTRvUQjiVEeoTdIGM0spClUsD551K X-Received: by 2002:a05:6a00:1309:b0:535:d421:1347 with SMTP id j9-20020a056a00130900b00535d4211347mr27554221pfu.5.1667430753588; Wed, 02 Nov 2022 16:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667430753; cv=none; d=google.com; s=arc-20160816; b=ubg0OpRFGVi3YgsFHu2qLUJA5o2RKprogqall3xJJXoxNO9V6BPsNB8XsnAu+w6gfG ak6VJi8UP2O0RCoXRRZPrvinnii9ZHVtZKC2Znb3AzVG9Cj3+gjdw72/GeIFgnu+52e6 Pl7F392mjHLTES6N45ypwFm8E1zXB/yfEN3wV8bvuLjNMIQVHZwT5sc/V3vqZp1tPDdX FI4I5C30wXIhZC3YAgshcrojKTLr6yQfkfAm/993OCQWFs/1VmA6KVi4w1i5QZxKLVKD zoUQvYdQw7YmCmluyiyetSpc3poRT4t5M2AwCIPJMwsPtmhUKRQMhSQfQCLYUZxBSfS2 7BxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=dR8uIufVFmQcFdrcHJYjIkFyqVjcm0qVXvQv/HVwRjc=; b=m0FeP7m/9sFxo9t83tcrljCNnoDJmbxzCFjaYkFP3/kVZTb6v6nw6Obwl+I1uTEfj4 ClJndYpUkYYOa8QpvGY2frw2HqKe0ceci5AKKJgCGIlOI0HGAf8BGXwKG7TnizHwAC8r lCaEfpr/0xawuFXYNcIfDDsGGjuRiyx6Z9s7d3kf6HRpTOoB9nD1/m4aqeHWgHmO7cny lZaLkPmcZQ+ufNC02Q2+96SjNo/xwVrX9ZwVvjVseOMXmt8mY/hA1YXdPtUxMcL/magT 5aLZaYom/wEKK3z4TcZO7WAnuOFK/2qle/V/wl3g0RiRm3+WcLnIHgP6Qkn3AjFBzKBm HH6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s14-20020a056a0008ce00b0055fa098c388si20333821pfu.259.2022.11.02.16.12.19; Wed, 02 Nov 2022 16:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231372AbiKBWS1 (ORCPT + 97 others); Wed, 2 Nov 2022 18:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbiKBWS0 (ORCPT ); Wed, 2 Nov 2022 18:18:26 -0400 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C841760FF; Wed, 2 Nov 2022 15:18:24 -0700 (PDT) Received: by mail-oi1-f173.google.com with SMTP id t62so175051oib.12; Wed, 02 Nov 2022 15:18:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dR8uIufVFmQcFdrcHJYjIkFyqVjcm0qVXvQv/HVwRjc=; b=d3Zn6YxfLie56/O3Wm2JZwzO7nurUYi3rOmteRFj5pU5/sqXUvu9pCJgwBeEdjCTXU ASCas664Uy5cxV3PTPTXwvHUjET1a3ng3mcZkgoOPcPVeFqxvfRFCr48GW811T+DZyDZ heQ9LOspNpCuprPXhn87gcUP7pqNsYDXiL/t2N+pFyFXc/QOl0BM+bPFu4ORvCeBSmOR op4oy7y5TMbQEEP9bPqzlo/tHIXDvQl1DX+8Ok5SzB7SHDnw6F3gKR8NQOgYqfqOIh4A yOckmqIgBkQ6XS2q3WusM24dbvhmiDUnFZfAm3Cz070cWk+kF2CPnPUerVvr3LSmFKtH mGgg== X-Gm-Message-State: ACrzQf1gpglYoPNsHx2oZMQZIAYGPzHkI73Q1erRB+MjiM2SyVx0uADd 29cE/P9k4+mRk5Cy6h7cTBE4YOGu0YGyJR0HMYU= X-Received: by 2002:aca:ac82:0:b0:359:d662:5bfb with SMTP id v124-20020acaac82000000b00359d6625bfbmr15283796oie.218.1667427504100; Wed, 02 Nov 2022 15:18:24 -0700 (PDT) MIME-Version: 1.0 References: <20221101052340.1210239-1-namhyung@kernel.org> <20221101052340.1210239-3-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Wed, 2 Nov 2022 15:18:12 -0700 Message-ID: Subject: Re: [PATCH bpf-next 2/3] bpf: Add bpf_perf_event_read_sample() helper To: Song Liu Cc: Alexei Starovoitov , Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , Peter Zijlstra , Martin KaFai Lau , Yonghong Song , John Fastabend , KP Singh , Hao Luo , Stanislav Fomichev , LKML , bpf , Steven Rostedt , Ingo Molnar , Arnaldo Carvalho de Melo Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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, Nov 1, 2022 at 5:13 PM Song Liu wrote: > > On Tue, Nov 1, 2022 at 3:17 PM Namhyung Kim wrote: > > IIUC we want something like below to access sample data directly, > > right? > > > > BPF_CORE_READ(ctx, data, ip); > > > > I haven't tried this, but I guess we may need something like > > data = ctx->data; > BPF_CORE_READ(data, ip); Ok, will try. > > > Some fields like raw and callchains will have variable length data > > so it'd be hard to check the boundary at load time. > > I think we are fine as long as we can check boundaries at run time. Sure, that means it's the responsibility of BPF writers, right? > > > Also it's possible > > that some fields are not set (according to sample type), and it'd be > > the user's (or programmer's) responsibility to check if the data is > > valid. If these are not the concerns, I think I'm good. > > So we still need 1/3 of the set to make sure the data is valid? Of course, I'll keep it in the v2. Thanks, Namhyung