Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3977489pxb; Tue, 25 Jan 2022 00:28:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwe+/yLNDrZg+y2ts4h6iFRC8jHmplRGPXOVWx7P5enySIKpqq8TGC2Wf/hSj4SUlcK/hJK X-Received: by 2002:a05:6402:2804:: with SMTP id h4mr18867378ede.193.1643099323189; Tue, 25 Jan 2022 00:28:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099323; cv=none; d=google.com; s=arc-20160816; b=M7M8zPtThsyJM/Y3tZrWxjupWt4s50E3WAfE0KkcnD9gnnma4KD2qa8mc52xhYsN+D NH643FfwkRw1y4A0CawoQRkyiUjXvkfVeotXjvS9ncNTLn9U8L6scxJPVoNhxs4sAByX 8nxWhVFescuAZM2ZBpVGCzxFlrXRti+yAxsR0oMn3azKU7pXW+BYo/v2v54IqkmtxRAC sTnfqxupp8qiW4cdzzrtPAMm4wa5VCUDCReckd+CARubr3CrlvtLd7kP3w6SLe/8NW5/ R3edU+j/Xm/fiAEg5avKFJr0LwRPvS+xSlOiWLtrJs9JTUnDNrfyusbuhqYDHgc7waiZ mgrw== 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=HQly4aK0/XUN2AjJvl0/0D/2AaFMBUyjdalnXMRJHzw=; b=hQATqDdYyGBBiaeLT4ZjbRg/7PT6VxXhMARnqg5ysF02R0yMZGF89U6ScBwbP9k1sF 8N60NQ4rx7BtbOwJbTXZzCtoavi9m4Uo6/anuIsIpUlJTSGk+trn1z9QD431ONbi82Ae cLVjYEs47zamVvAKdfK9MSj6te6uehcubW9881q2eClUzsuLRsb4VPo4YwPW+W8smyhn pfFE2mpxiEuzbx8WDW8P875rJ/w45jALkD6jRMdQPfKpuCVfouemc87t8Z3Ppcqcj6DY fhbzPg/256XJoXjqGAjcZrYnm41/pkq9Q9mVt1HLBzXc2QohQs2CPPzyThqVvLQ7Gb5Y ihpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2o4DZ2A+; 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 z27si9782097ejl.466.2022.01.25.00.28.18; Tue, 25 Jan 2022 00:28:43 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2o4DZ2A+; 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 S3422721AbiAYCcA (ORCPT + 99 others); Mon, 24 Jan 2022 21:32:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46800 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356723AbiAXUUq (ORCPT ); Mon, 24 Jan 2022 15:20:46 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF0CF61496; Mon, 24 Jan 2022 20:20:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEF72C340E5; Mon, 24 Jan 2022 20:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055644; bh=b7tX3ZlHFJtdTxVMz/rlSEv/QGf1NcHRNgd6ZSQZdFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2o4DZ2A+OjpQ/GQJp3oOCLTyaATTc/mtZgHuXMO1A/jblHz/AnHmBcAuzrU20n7Wd APeI2KROYkD9Z0mXm9ggGpLJYPQmx3wheQh84l7764X6iL7zGjMRwjfqg3QUropOcM kIZwtv+vRo/vKR9uj/uirrw3R9ri5jPb9nHG0TW4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexei Starovoitov , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.15 185/846] libbpf: Clean gen_loaders attach kind. Date: Mon, 24 Jan 2022 19:35:02 +0100 Message-Id: <20220124184107.359387999@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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: Alexei Starovoitov [ Upstream commit 19250f5fc0c283892a61f3abf9d65e6325f63897 ] The gen_loader has to clear attach_kind otherwise the programs without attach_btf_id will fail load if they follow programs with attach_btf_id. Fixes: 67234743736a ("libbpf: Generate loader program out of BPF ELF file.") Signed-off-by: Alexei Starovoitov Signed-off-by: Andrii Nakryiko Acked-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20211201181040.23337-12-alexei.starovoitov@gmail.com Signed-off-by: Sasha Levin --- tools/lib/bpf/gen_loader.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/gen_loader.c b/tools/lib/bpf/gen_loader.c index 8df718a6b142d..33c19590ee434 100644 --- a/tools/lib/bpf/gen_loader.c +++ b/tools/lib/bpf/gen_loader.c @@ -663,9 +663,11 @@ void bpf_gen__prog_load(struct bpf_gen *gen, debug_ret(gen, "prog_load %s insn_cnt %d", attr.prog_name, attr.insn_cnt); /* successful or not, close btf module FDs used in extern ksyms and attach_btf_obj_fd */ cleanup_relos(gen, insns); - if (gen->attach_kind) + if (gen->attach_kind) { emit_sys_close_blob(gen, attr_field(prog_load_attr, attach_btf_obj_fd)); + gen->attach_kind = 0; + } emit_check_err(gen); /* remember prog_fd in the stack, if successful */ emit(gen, BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_7, -- 2.34.1