Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp234162pxv; Thu, 8 Jul 2021 19:49:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkllSUOAY+f/9/WCC+GweBeQusDQoh6p3rw5LcZjHH7wE5yJd0LENutdeUQAb2aAGzmBpu X-Received: by 2002:aa7:c4c7:: with SMTP id p7mr14020087edr.290.1625798962011; Thu, 08 Jul 2021 19:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625798962; cv=none; d=google.com; s=arc-20160816; b=SevtN+QMa3ksYaNoHqLGEQuW8/6E5BuyVkHbJkugXewgGxUxRD5vsv2lOEgs6MQTBi 7XXnClgr0TtGKvauB8lPm1Tg3+ZGUGmSEq77P3QC4tQlbFaxei8YWABVNBYlzyUbXzBd IGQFMO0Ip0hjHNWPDdvL1lE4ID515pisOpVng568WDKNuGAhmqI28bYWUVSXkUicuRSs jt51ziMNbFECTzF6H8s1sTBSmspiRwaAwqpv10TzseeDi0HHIaVVHeXe/xFvFffkRowC TbTeHb8EEB4VaVDrXRDZN+NEvJ1t4D7YVCj4sZDX/dNDcvhQm2IW6r8k3F3rvxS2Fnw9 PFCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=3KOuMkvHO7xTU5Sp3SZ7XX8v7ZTo70AIZBVvoPZLOSY=; b=x/gQ1c6ItCKOR58GYfsyhc1rRb/DmmZ5shIptKQfGD8oQfA45W7JsRPemoOvw5kWBH arAAWa0QrddzIojrOXfloR8gskRyPdS2kXfHsRGjz1knqx0yuIe1cKJKMtOcetj+teRc HwJNVKZhgDeLNdMPq/H2ZXCvaCDj7uTeeq8kTx3NVkGjYhgNFkAYvzw4waa3kR7nJl7S ZbMgGw0X3T+5gDQPw77Hd3zgk+OFLK+J+RrFLByiaV9XGzlrHI1YeHlYR+NHU+gZ1Uzv BXKSGxflz6rxi6pKKF7w5JIsYm9MD4kYKxaLKrH+jNq2w3L7PlSVlWDPVIbYyHNRz8Nw TqXA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp8si5645635ejc.457.2021.07.08.19.48.58; Thu, 08 Jul 2021 19:49:21 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230478AbhGICur (ORCPT + 99 others); Thu, 8 Jul 2021 22:50:47 -0400 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:34675 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbhGICur (ORCPT ); Thu, 8 Jul 2021 22:50:47 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=chengshuyi@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0Uf9vV8Z_1625798875; Received: from localhost(mailfrom:chengshuyi@linux.alibaba.com fp:SMTPD_---0Uf9vV8Z_1625798875) by smtp.aliyun-inc.com(127.0.0.1); Fri, 09 Jul 2021 10:48:02 +0800 From: Shuyi Cheng To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Shuyi Cheng Subject: [PATCH bpf-next v3 0/2] libbpf: Introduce 'btf_custom_path' to 'bpf_obj_open_opts' Date: Fri, 9 Jul 2021 10:47:51 +0800 Message-Id: <1625798873-55442-1-git-send-email-chengshuyi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Patch 1: Add 'btf_custom_path' to 'bpf_obj_open_opts', allow developers to use custom btf to perform CO-RE relocation. Patch 2: Fixed the memory leak problem pointed out by Andrii. Changelog: ---------- v2: https://lore.kernel.org/bpf/CAEf4Bza_ua+tjxdhyy4nZ8Boeo+scipWmr_1xM1pC6N5wyuhAA@mail.gmail.com/T/#mf9cf86ae0ffa96180ac29e4fd12697eb70eccd0f v2->v3: --- Load the BTF specified by btf_custom_path to btf_vmlinux_override instead of btf_bmlinux. --- Fix the memory leak that may be introduced by the second version of the patch. --- Add a new patch to fix the possible memory leak caused by obj->kconfig. v1: https://lore.kernel.org/bpf/CAEf4BzaGjEC4t1OefDo11pj2-HfNy0BLhs_G2UREjRNTmb2u=A@mail.gmail.com/t/#m4d9f7c6761fbd2b436b5dfe491cd864b70225804 v1->v2: -- Change custom_btf_path to btf_custom_path. -- If the length of btf_custom_path of bpf_obj_open_opts is too long, return ERR_PTR(-ENAMETOOLONG). -- Add `custom BTF is in addition to vmlinux BTF` with btf_custom_path field. Shuyi Cheng (2): libbpf: Introduce 'btf_custom_path' to 'bpf_obj_open_opts' libbpf: Fix the possible memory leak caused by obj->kconfig tools/lib/bpf/libbpf.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++---- tools/lib/bpf/libbpf.h | 6 +++++- 2 files changed, 53 insertions(+), 5 deletions(-) -- 1.8.3.1