Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1896832pxb; Mon, 13 Sep 2021 07:44:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs4QBhQuVR6j1KRSvj0UoiOw7KqVouW57UKp9waedbl4HW+rDUIV7Esq4QimrJ1H3aMLSC X-Received: by 2002:a5d:9d01:: with SMTP id j1mr9533193ioj.27.1631544261586; Mon, 13 Sep 2021 07:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631544261; cv=none; d=google.com; s=arc-20160816; b=S2SF6pGddHOiqapstij2l2IYtuEf4Q0XnkBMtVDbUWz+qsqm2F/ew7f0O8SzRa25zv weqS6uSA2Y4CStxYUPrjsLUc8MguM6ldStvpFx2q18PUVFtA8/ZBCwFpelzMP91LdBTz Blh1gG8Woi6FaO/pr776DYW7uv1Vj6eyuYFkA5x6iEUUx7y+c45pKqwzdeAZuQIyHn1Z ST3zAI/1Acruk0iJjU3bhqGihnygIZjMISSsMlxxw3j5MicGbqzMWkLAn/a062TfIAYy qb9mq1iStkWKOV5fx8PfPqd2PaZiW8fBOT4EaDOPsZy8kmfJ59XHmAFVXbVLZvvykYvN drmw== 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=VtRZHO5WQjyJBWzmI3O5BVzob9vB9qNAscp+k+C6Zeo=; b=xerwh9ebKlhYWOSoncqE/r8bqdJf4P1gvA1RHoBbpDE4Kltj8n9r0O8+UNOec4888p nS02FEQcbgasJySzYSyEBP5dFyTDmNbvKKP3FutTUiRv+SDFJq4CsCpnTRI6SvY3yS3V Da1XeHGpP35JyR9yoYjk+k3lSB4PfXrxMjHd7ZyssgaPOmMi2jrA8DiBsS2Mb+nASI1h XYUDOlw3HBnxH+CO4cYVTRBvWuYngPDSD6JIx1x0N3mr/kwZAYjSgr5z1pd043UupRmF DNIex5B407KrFY4P1g+TnAPDGfDMPz5a3TS07FYqQvH4Ya3Nyz0I56qG9LZz6kXsfsk2 THrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xZi4KNdJ; 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 n22si6922724ioo.36.2021.09.13.07.44.06; Mon, 13 Sep 2021 07:44: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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xZi4KNdJ; 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 S1347347AbhIMOlo (ORCPT + 99 others); Mon, 13 Sep 2021 10:41:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:55970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242968AbhIMOfx (ORCPT ); Mon, 13 Sep 2021 10:35:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8376661BE2; Mon, 13 Sep 2021 13:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631541230; bh=cgd4lvp8ET4FpQcD9aMt+wZ5XqW2kd5Gg/QmI8LlYZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xZi4KNdJ3EA1R0zP5ksJAYnVdXf+yGMcVT3jYQU1mcFHFIUgaHW+PTgTfuhVe4Lf5 PJPWaU6z3c71nvjiJA/6x5BLTGJWp5xAiFi54GbR669/0GPC/M4SM4BmcscMQhknYR 7ctIH+Rry/Js9zLh67U05haOe39BVq75UI/6kTUs= 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.14 216/334] libbpf: Re-build libbpf.so when libbpf.map changes Date: Mon, 13 Sep 2021 15:14:30 +0200 Message-Id: <20210913131120.725012358@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131113.390368911@linuxfoundation.org> References: <20210913131113.390368911@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 ec14aa725bb0..74c3b73a5fbe 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))) @@ -110,7 +111,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)) @@ -163,10 +163,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) @@ -181,7 +181,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