Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2151560pxa; Mon, 3 Aug 2020 08:42:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgREj99r2h2bc0rGq8bS9x4YSZdI3wGx+lBjokm0AKFKAuIx6zN+ICoVRaZfjCXGOkPU9U X-Received: by 2002:a17:906:33d1:: with SMTP id w17mr18509598eja.68.1596469371741; Mon, 03 Aug 2020 08:42:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596469371; cv=none; d=google.com; s=arc-20160816; b=rYZjuLG+GPMxzX76samhGrT/F1+XN/xWEExZiw9ngi4ejnwaNTKx/W84x0wlmSLi2S jj7nCr3wgmAMErEZmImgrJVxEIaa0eIbVQXKJ4zxU9KuvXGSorPSoiFQi5wq8kYREFaq 99KANo0SfVMqdfVGjG3zz3Rav56bbo92TsA3ig4gOg51fc3ykEg035N8UTRHNA+grH4v RkMIJaa34SNsiEP6uUMes3GGZBQ8A6Dq1u+700gdmgvpP3R+qVaVSZL3VKTvEls4VGT4 LCU9wEq8KMjfeHue8EAb4sp2qYbcA2GL11Y/jgIVLrvV2ZlSbBEa9hDEATb+9Nl3Q2nB 9K2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=zDbpSdI+Kg7J21FMtDaptpRpDHvK4QQHCXQIzqF2Kt8=; b=AV8nE2e6d5CaCJdcvbmTFH5U7uSikXv1E6jqjI4N9PeHqUKJGhEPa7UmvruQZUujc4 Lcm12Z8CwvRCKvi1eL6NU3o5oYaZpHpXCjr4FN/kafywQG188scdpWyn5q+6Qqj2CFvd i57M2GoreTp+WYb03KBvwZvEMwlnS8CyfTQSpi5ofWQwqk5NRrWp5mRmpXAmZo0OGO7m Wud06VLGtvXMU/6dUdOJcWlwuug5r8MNFEiT28Ntoxjd75i4WzNYaSs2jpDOTHQYfVSr i1EpVBkjyZR+9d44CTeC9+vlyejYT59Ab78BOBbuX55QtZYATL4jlmY4zfyjEk4FEmwq 8/qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=h3lU+1ox; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh23si8867383ejb.493.2020.08.03.08.42.29; Mon, 03 Aug 2020 08:42:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=h3lU+1ox; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727867AbgHCPl5 (ORCPT + 99 others); Mon, 3 Aug 2020 11:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726805AbgHCPl5 (ORCPT ); Mon, 3 Aug 2020 11:41:57 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCD19C06174A for ; Mon, 3 Aug 2020 08:41:56 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id z18so31083923wrm.12 for ; Mon, 03 Aug 2020 08:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=zDbpSdI+Kg7J21FMtDaptpRpDHvK4QQHCXQIzqF2Kt8=; b=h3lU+1oxPPOe5Swh2bMYvJ8QZyr2RAeEDsNKI3Wl0DqmhQRbEmjGM9H9UUkrmZjOdw l/rSdNWDp4v0+B7g2+pXgW2Wx8kp2vICMRLuNoWtWfNrzS7HUjIjvcdffOBXILgAYOgO ELENyyZDMqP+Xc8OTSYTHH03K5WrobUBwa/AA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zDbpSdI+Kg7J21FMtDaptpRpDHvK4QQHCXQIzqF2Kt8=; b=TgVPYeY0UkKMgv9CIT/jJ6ikR0AaAmf5IkE/9js0RCU91HCV6kmtyGjVqpQDcbNeP9 BA+G4XN47I/3ixKut2MxKMe8KZWwST4iqHIr6LjGkkXmfZ0kfB3eitxTYj4YBF5RpKig 4hKlbjSh5B7J5wgo5tn7MFR8Z0KVrJFBUpN0EGGe1NrVI3XlDt37uGkZZEivN2OtgfKd TDyh2ZYJhhkqavDSu3Zob/WpZ3eO2VviPfAh+lRcp2u/PCzqwCOhyrLigd2J2Tn2OwLJ 3gG9wjbDRkoPEyk8VG7hVLqkQU9fQIDHdFp1Qb5yVdHeLm4/8q5YXSs7gyy2tqAP7P3B Uzww== X-Gm-Message-State: AOAM532+Af9F4c61mU4rWJ01ucTjCh/YAckLj681JlDTB6ADhxy22NBb /WA4RZRx+i57DKDyUToi9D306A== X-Received: by 2002:adf:edd0:: with SMTP id v16mr17070883wro.271.1596469315419; Mon, 03 Aug 2020 08:41:55 -0700 (PDT) Received: from kpsingh-macbookpro2.roam.corp.google.com ([81.6.44.51]) by smtp.gmail.com with ESMTPSA id q4sm25807370wme.31.2020.08.03.08.41.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Aug 2020 08:41:54 -0700 (PDT) Subject: Re: [PATCH bpf-next v7 5/7] bpf: Implement bpf_local_storage for inodes To: Martin KaFai Lau Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Paul Turner , Jann Horn , Florent Revest References: <20200730140716.404558-1-kpsingh@chromium.org> <20200730140716.404558-6-kpsingh@chromium.org> <20200731010822.fctk5lawnr3p7blf@kafai-mbp.dhcp.thefacebook.com> <20200731190226.6ugmk6cnl2yortgt@kafai-mbp.dhcp.thefacebook.com> From: KP Singh Message-ID: Date: Mon, 3 Aug 2020 17:41:54 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200731190226.6ugmk6cnl2yortgt@kafai-mbp.dhcp.thefacebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31.07.20 21:02, Martin KaFai Lau wrote: > On Fri, Jul 31, 2020 at 02:08:55PM +0200, KP Singh wrote: > [ ... ] >>>> +const struct bpf_map_ops inode_storage_map_ops = { [...] >> >> btf dump file /sys/kernel/btf/vmlinux | grep "STRUCT 'inode'" >> "[915] STRUCT 'inode' size=984 vlen=48 >> >> So it seems like btf_id[0] and btf_id[1] are set to the BTF ID >> for inode. Now I think this might just be a coincidence as >> the next helper (bpf_inode_storage_delete) >> also has a BTF argument of type inode. > It seems the next BTF_ID_LIST(bpf_inode_storage_delete_btf_ids) > is not needed because they are the same. I think one > BTF_ID_LIST(bpf_inode_btf_ids) can be used for both helpers. > Cool, yeah. I have fixed it and also for sock helpers. Will send a new series out. - KP >> >> and sure enough if I call: >> >> bpf_inode_storage_delete from my selftests program, >> it does not load: [...] >> ./test_progs -t test_local_storage >> [ 20.577223] btf_ids[0]=0 >> [ 20.577702] btf_ids[1]=915 >> >> Thanks for noticing this! >> >> - KP >> >>> >>>> + >>>> +const struct bpf_func_proto bpf_inode_storage_get_proto = { >>>> + .func = bpf_inode_storage_get, >>>> + .gpl_only = false, >>>> + .ret_type = RET_PTR_TO_MAP_VALUE_OR_NULL, >>>> + .arg1_type = ARG_CONST_MAP_PTR, >>>> + .arg2_type = ARG_PTR_TO_BTF_ID, >>>> + .arg3_type = ARG_PTR_TO_MAP_VALUE_OR_NULL, >>>> + .arg4_type = ARG_ANYTHING, >>>> + .btf_id = bpf_inode_storage_get_btf_ids, >>>> +}; >>>> + >>>> +BTF_ID_LIST(bpf_inode_storage_delete_btf_ids) >>>> +BTF_ID(struct, inode) >>>> + >>>> +const struct bpf_func_proto bpf_inode_storage_delete_proto = { >>>> + .func = bpf_inode_storage_delete, >>>> + .gpl_only = false, >>>> + .ret_type = RET_INTEGER, >>>> + .arg1_type = ARG_CONST_MAP_PTR, >>>> + .arg2_type = ARG_PTR_TO_BTF_ID, >>>> + .btf_id = bpf_inode_storage_delete_btf_ids, >>>> +};