Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp67202pxb; Mon, 13 Sep 2021 13:07:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLVzw9lxJWq4FocYW/80vUh5g0LsCKgtLjq5NfCDTcllvsltfzi2TfIHcCPsRfnbAJcIjR X-Received: by 2002:a17:906:6c94:: with SMTP id s20mr14958832ejr.152.1631563657776; Mon, 13 Sep 2021 13:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631563657; cv=none; d=google.com; s=arc-20160816; b=wu/qVC0KA7mW9/U+M3PYNZl5pH8PYzoPsdNwMhcs5xBlq56rE0U0i52jnEgFpwg/wQ QfSxSyn/Etf5dBMq8bfBtMHFem2the/hEMUMmLqEMSx8rogi8hLeiyuHP9kRSpBSJL0Y rnI1Dqp6jN7SOC6br1lv/Wm6Ge8/ZS/pD2FsNDp0pCnDdHmGyqo4C0A83CuepBLhLBw0 vkMwt3vzpI6dz16MmRED7TLg5DFsva7M+S4gj6uz0S+Bk+TTarTveDQLVCMPF2RxEPnT X6frC6pIgydyFaIiR1JSVJrf93+g9p9przdQCY+J1O/ahBRQrcaIV6n1XOSyiAmcKntj Ob6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KcUAe407m+MPI7KSmWtrb0d6nSBVic6MaADebImhRUQ=; b=UmFnP4fEQDpP+du6e9jWBECVirbe87WhE2HNj4N35u6M0/HrpfpRVLuolwm2Rxaax6 cWbVQdGoM5sngTGHWi/AXtsz6+2mk5jS5N6veWD/2/TonDkYRSPu0ZY6dyG9RMkkXwoP 6Vj3EWIKMbRERmZAaQ31F/YNyXD61NGuivGcRQ2sLR6dWsRtX65uPtI45LqgpzCYvZPo tYk4pBZBXvkL/crN1VyAxdD3i9z7UtkAi3p8lWFNx30B1RQOE4pvQIZBNwDLp8zQ8jkk LC8nJ5/ptgMxazoF0I3zFhWlO8HoYXKyMUq7up7PPMJ2gCzofeCqb8fXYyao8jzLVnyt hlKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h41ba1Vg; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 6si11594889eje.339.2021.09.13.13.07.11; Mon, 13 Sep 2021 13:07:37 -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=@linuxfoundation.org header.s=korg header.b=h41ba1Vg; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242812AbhIMNqp (ORCPT + 99 others); Mon, 13 Sep 2021 09:46:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:41960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242980AbhIMNlP (ORCPT ); Mon, 13 Sep 2021 09:41:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C5D9F6134F; Mon, 13 Sep 2021 13:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539789; bh=uiKeTbmRF95U4LLFHxQAHG5XWouIQW7bQH0cUQ036h0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h41ba1VgrOSVh2JQawOPdHYZxosbwiIGANsf2ENNdgaWcCAJtSb8wkspO2xgckjZC VE32xP1FFtFslE1AoWSs+KCjh2xACC9pNsZWLltLtQWqNLVBLTZs7TacDnHe7fkQfH OhPrkDMbfG3okt7ClZ/XoPi8AF91JV2W+ZHj9Kc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Daniel Borkmann , Yonghong Song , Sasha Levin Subject: [PATCH 5.10 161/236] libbpf: Re-build libbpf.so when libbpf.map changes Date: Mon, 13 Sep 2021 15:14:26 +0200 Message-Id: <20210913131105.861387748@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrii Nakryiko [ Upstream commit 61c7aa5020e98ac2fdcf07d07eec1baf2e9f0a08 ] Ensure libbpf.so is re-built whenever libbpf.map is modified. Without this, changes to libbpf.map are not detected and versioned symbols mismatch error will be reported until `make clean && make` is used, which is a suboptimal developer experience. Fixes: 306b267cb3c4 ("libbpf: Verify versioned symbols") Signed-off-by: Andrii Nakryiko Signed-off-by: Daniel Borkmann Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20210815070609.987780-8-andrii@kernel.org Signed-off-by: Sasha Levin --- tools/lib/bpf/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index 310f647c2d5b..154b75fc1373 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -4,8 +4,9 @@ RM ?= rm srctree = $(abs_srctree) +VERSION_SCRIPT := libbpf.map LIBBPF_VERSION := $(shell \ - grep -oE '^LIBBPF_([0-9.]+)' libbpf.map | \ + grep -oE '^LIBBPF_([0-9.]+)' $(VERSION_SCRIPT) | \ sort -rV | head -n1 | cut -d'_' -f2) LIBBPF_MAJOR_VERSION := $(firstword $(subst ., ,$(LIBBPF_VERSION))) @@ -131,7 +132,6 @@ SHARED_OBJDIR := $(OUTPUT)sharedobjs/ STATIC_OBJDIR := $(OUTPUT)staticobjs/ BPF_IN_SHARED := $(SHARED_OBJDIR)libbpf-in.o BPF_IN_STATIC := $(STATIC_OBJDIR)libbpf-in.o -VERSION_SCRIPT := libbpf.map BPF_HELPER_DEFS := $(OUTPUT)bpf_helper_defs.h LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET)) @@ -184,10 +184,10 @@ $(BPF_HELPER_DEFS): $(srctree)/tools/include/uapi/linux/bpf.h $(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION) -$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN_SHARED) +$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN_SHARED) $(VERSION_SCRIPT) $(QUIET_LINK)$(CC) $(LDFLAGS) \ --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \ - -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -lz -o $@ + -Wl,--version-script=$(VERSION_SCRIPT) $< -lelf -lz -o $@ @ln -sf $(@F) $(OUTPUT)libbpf.so @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION) @@ -202,7 +202,7 @@ $(OUTPUT)libbpf.pc: check: check_abi -check_abi: $(OUTPUT)libbpf.so +check_abi: $(OUTPUT)libbpf.so $(VERSION_SCRIPT) @if [ "$(GLOBAL_SYM_COUNT)" != "$(VERSIONED_SYM_COUNT)" ]; then \ echo "Warning: Num of global symbols in $(BPF_IN_SHARED)" \ "($(GLOBAL_SYM_COUNT)) does NOT match with num of" \ -- 2.30.2