Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3644126pxb; Mon, 9 Nov 2020 17:24:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxlJRS2EduzPkyoX5Yc84PzgTs6X13oboIwLHCu0v09Lq5xn29/dfYp5agVCwLxe8zOWpwU X-Received: by 2002:aa7:cdd3:: with SMTP id h19mr18572921edw.330.1604971461063; Mon, 09 Nov 2020 17:24:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604971461; cv=none; d=google.com; s=arc-20160816; b=dQRrNB+0kLN7zUXwTXjLM1JhX1W6GzgYO67kB0gqgmw4cPGQQ5QFIS8yZVRlOKEZfw rtARUNcnCH9kDxiBJG+hyCUnSnHCa7kvxCTnfICev60rPqebG+Ld9MG3XV3Xru0YovYG 1ZXh0rV8NBiZIMs5lkCYQoHjA4wykPlzhx41SP5nD2zTYIaacjNmqHyvVVmhwJI2V+z+ VVKjSOSJvr17aTbn2s/K7gKtCSuGu2zlFt1k4JjDaV2Fc+IEKoEMM6NL/sLROdC1OEzD iJbV8tlW92sCk9DVmIu+5fXKeNimg5YBxPNqanmOrzRLUkFI1XCvoGV2r73FWwt2rvpR Hfzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from; bh=N4e6BXnK1DQyBgqt5ZUWb8BP6PwP7zOgc5pbdvHnPkw=; b=tu+7btFrY+uHZ1GFGv8dtz6rkD2xSNM54oL71t5nw9TXteNBQDf++kC+FASMYQ/cn6 NgtKslpT2ulbhtueGd8lekppY+ndrb/xBWHK0rND8/XMb9VexiW28Kj7RZEqydRFX4Fj gcRQbG/lF2BqA0e5TGKYEfM3ix+JSl2tXb0ns7CPppGcuVKpEGaPdKJbCrRAr9T3vrsO rzLhJhX9W1IWDqv2xiKwyVMgow13z0iO6TJh1/21ZmNpsvt2rq6CQzETqO8KdW0gfLxi auF4ZyZNQ8VyS47oslUNekCMjmQDP+vMDEF3sjttg1L3wm4IC5vcPV4vOiGo1GX7+QPG 2+5Q== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f4si8110687edc.234.2020.11.09.17.23.58; Mon, 09 Nov 2020 17:24:21 -0800 (PST) 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731438AbgKJBVi convert rfc822-to-8bit (ORCPT + 99 others); Mon, 9 Nov 2020 20:21:38 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:21438 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731358AbgKJBVi (ORCPT ); Mon, 9 Nov 2020 20:21:38 -0500 Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AA1KlaW017171 for ; Mon, 9 Nov 2020 17:21:37 -0800 Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com with ESMTP id 34pbyeg47d-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 09 Nov 2020 17:21:37 -0800 Received: from intmgw001.08.frc2.facebook.com (2620:10d:c085:208::f) by mail.thefacebook.com (2620:10d:c085:11d::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Mon, 9 Nov 2020 17:21:36 -0800 Received: by devbig012.ftw2.facebook.com (Postfix, from userid 137359) id 0C5192EC923D; Mon, 9 Nov 2020 17:19:34 -0800 (PST) From: Andrii Nakryiko To: , , , CC: , , , , Andrii Nakryiko , Arnaldo Carvalho de Melo , Greg Kroah-Hartman Subject: [PATCH v4 bpf-next 0/5] Integrate kernel module BTF support Date: Mon, 9 Nov 2020 17:19:27 -0800 Message-ID: <20201110011932.3201430-1-andrii@kernel.org> X-Mailer: git-send-email 2.24.1 X-FB-Internal: Safe Content-Type: text/plain Content-Transfer-Encoding: 8BIT X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-09_15:2020-11-05,2020-11-09 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 bulkscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 phishscore=0 adultscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011100008 X-FB-Internal: deliver Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch set adds BTF generation for kernel modules using a compact split BTF approach. Respective patches have all the details. Kernel module BTFs rely on pahole's split BTF support, which is added in [0] and will be available starting from v1.19. Support for it is detected automatically during kernel build time. This patch set implements in-kernel support for split BTF loading and validation. It also extends GET_OBJ_INFO API for BTFs to return BTF's module name and a flag whether BTF itself is in-kernel or user-provided. vmlinux BTF is also exposed to user-space through the same BTF object iteration APIs. Follow up patch set will utilize the fact that vmlinux and module BTFs now have associated ID to provide ability to attach BPF fentry/fexit/etc programs to functions defined in kernel modules. bpftool is also extended to show module/vmlinux BTF's name. [0] https://patchwork.kernel.org/project/netdevbpf/list/?series=378699&state=* v3->v4: - copy_to_user() on ENOSPC in btf_get_info_by_fd() (Martin); v2->v3: - get rid of unnecessary gotos (Song); v2->v1: - drop WARNs, add fewer pr_warn()'s instead (Greg); - properly initialize sysfs binary attribute structure (Greg); - add __maybe_unused to any_section_objs, used conditionally by module BTF; rfc->v1: - CONFIG_DEBUG_INFO_BTF_MODULES is derived automatically (Alexei); - vmlinux BTF now has explicit "vmlinux" name (Alexei); - added sysfs ABI documentation for /sys/kernel/btf/ (Greg). Cc: Arnaldo Carvalho de Melo Cc: Greg Kroah-Hartman Andrii Nakryiko (5): bpf: add in-kernel split BTF support bpf: assign ID to vmlinux BTF and return extra info for BTF in GET_OBJ_INFO kbuild: build kernel module BTFs if BTF is enabled and pahole supports it bpf: load and verify kernel module BTFs tools/bpftool: add support for in-kernel and named BTF in `btf show` Documentation/ABI/testing/sysfs-kernel-btf | 8 + include/linux/bpf.h | 2 + include/linux/module.h | 4 + include/uapi/linux/bpf.h | 3 + kernel/bpf/btf.c | 406 ++++++++++++++++++--- kernel/bpf/sysfs_btf.c | 2 +- kernel/module.c | 32 ++ lib/Kconfig.debug | 9 + scripts/Makefile.modfinal | 20 +- tools/bpf/bpftool/btf.c | 28 +- tools/include/uapi/linux/bpf.h | 3 + 11 files changed, 459 insertions(+), 58 deletions(-) -- 2.24.1