Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2049448rwi; Thu, 3 Nov 2022 12:02:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gkDo84rk/pUnpDBAz4psIWyR/wMklNOxEkEIuFVzKIK6PP4GX9l5Czshkx7xVR9Fjc3kn X-Received: by 2002:a17:906:4fce:b0:78d:9fcb:50c7 with SMTP id i14-20020a1709064fce00b0078d9fcb50c7mr31196721ejw.63.1667502170983; Thu, 03 Nov 2022 12:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667502170; cv=none; d=google.com; s=arc-20160816; b=GC3D03STwPway+973vvlHEkZmkk2PVBZdvJhAddEhd3BvQWUi/KQz5IU45dFDgRlVb OwqjN5UiFLaq03Cuishod0GKjG0EsbqhtsDeM3XqnJNry2KNTLZmolpV9yxiL0GG+Z5j nbvCQqY4mPafng5ENJ8oFJrMIzueHDDlEYy5/U/sjK3/SYp7H9XHVmQH7yQZSZ9zQgwA t33MuMNijhDBbLrowyR3rsU5daSfth9/ChdwAe8o8x58uBZRg8aLJebXWQKudyBP3sqt Yua4LkgeeZhj3HhKQrea+lNVnGqxQihKM3TKAY8BBQp3GVGXNQHxbv/wQY9FXWeSorRG tNkQ== 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:dkim-signature; bh=8dusEqUBpJZxxY8bc6EzwbmRiVW2mGWm7QmGi0YQ2yo=; b=XsdcBAWYcLRQnE0ALv9zzKlb72hIeCfYruJ2+zWNiRYGDcsbhArldyr9EvVNMAJhgv elRLZKH7fvkhVFvFXpJKGQIoNGXVI0h7s1TAUY8dD/4QB27fhjN73crP5e1yw4kXxF8T GDlN8IRyc+XsTYg8Ii05RAS8zW/Mk+6mXX1QWho0Y8KfayDbq+Qd0nIF5jq4L4ESOEXb GJdR0JtITbyodKlLbIH7ao0CICnhvvmpwNefKLTpMrrC2KPPMf4cyszwO6CsnuzuJ12i 77JgBq29dnqAJ3D7jyT43YVgSMAHIW0emyEd6FQPyi6uzCOtO0B/EwZCb3VfCYecyI6Y Ka8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="sk/BhSI8"; 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 l22-20020a170906795600b0078de4629958si2600310ejo.248.2022.11.03.12.02.26; Thu, 03 Nov 2022 12:02:50 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="sk/BhSI8"; 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 S230527AbiKCSlc (ORCPT + 97 others); Thu, 3 Nov 2022 14:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230394AbiKCSl3 (ORCPT ); Thu, 3 Nov 2022 14:41:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB55313DC4; Thu, 3 Nov 2022 11:41:28 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 7715FB81F9B; Thu, 3 Nov 2022 18:41:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E4F5C43144; Thu, 3 Nov 2022 18:41:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667500886; bh=+x0WEovETjX96nWQFwOLkbvYF0kQ4DTi71pRIT1th6o=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=sk/BhSI8QNzqciRrw9XBNYN9knhXD9DdOeneUlayCBRtzammb7jhAAzW6DfJns8DO G2RQpa8pFrb80OQ9TNrZzaJxR0FNtvaNGzREmplYDIvGdT/G9wMDUkmBReIO4kibec cqPzdRHmnXbzh1ndHNfqvgD8T7jSAbzafTLjByx5n8sI+RmfA6xB3zc8RN/9whgc9w nQo2lCfzkda5pjhmCCcw0X3fcT9B4D8oTClXhbhHrzy37CX7/eEe5CYbJDQvAxAYrm 1ufC2U7Q1KNupRmJxVm1YRAvXzPDU/Cs5bIdy5gkz9kB4n+F1PP1o3748w+02tE6VQ qUqCd3Sg2Ftog== Received: by mail-ej1-f47.google.com with SMTP id d26so7656421eje.10; Thu, 03 Nov 2022 11:41:25 -0700 (PDT) X-Gm-Message-State: ACrzQf3OQDYQNusxAojeaPtxMFmbAXsJUnq6RqD4yPJ1/DoWiqECBeGT iUbk2K8Qr7dXYpD/woMoJJ9/KPANRRsjaWJZVIg= X-Received: by 2002:a17:907:b602:b0:7ad:e82c:3355 with SMTP id vl2-20020a170907b60200b007ade82c3355mr17171451ejc.3.1667500884319; Thu, 03 Nov 2022 11:41:24 -0700 (PDT) MIME-Version: 1.0 References: <20221101052340.1210239-1-namhyung@kernel.org> <20221101052340.1210239-3-namhyung@kernel.org> In-Reply-To: From: Song Liu Date: Thu, 3 Nov 2022 11:41:12 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next 2/3] bpf: Add bpf_perf_event_read_sample() helper To: Namhyung Kim 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=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Wed, Nov 2, 2022 at 3:18 PM Namhyung Kim wrote: > > 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? Right, the author of the BPF program could check whether the data is valid. Song > > > > > > 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