From nobody Sat Apr 4 16:13:42 2026 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B4AF312826 for ; Fri, 20 Feb 2026 22:27:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771626425; cv=none; b=CU9Mav0vfXvCBwky4cMPW9+btsyoUq73zPCJnvU8+sFe0jLE50Lc2WNT2xQYlUJ/CXoYZCoKKg85KsfCs5R7LCM/7TO1Mrt2PQ9l4kltQYT2H3udjkvgAWbgF/p+SDig9YVLqvoIVHgPCx85+eomGDH+4duPPledBv+4K5ocaAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771626425; c=relaxed/simple; bh=b91pEac6YrQf6AA0BkSypFpVCQSBxS1GtFd+o1jKsNg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EV+M0YivrQrKesGUV9RaCBw0RoV39bNe2bT10BPzL6qLocYcsKvjvWx2jD4UMOuzSL0iDeeSSvQvwxGMAu+daW5wFHHGc+hEclHfMPy+NY3Kj/lxxPzOpAJhiUiFbowyuebDHnaI953Nwoq1GPzdWSgtaf87U2YGfb9jMhUfrks= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=KA6h99nr; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="KA6h99nr" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1771626419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aF3XpM5Vp8Ae6GR1ZtZNYmZ1UwRARFZZQsmTjQhrewc=; b=KA6h99nr3OpKSOHhBN4nWmF9Crwf8vreYTxv7+UQE80tAfuEzhesTkHwmA9YmH13Sk9YRb 7sZLh1vLRaGS6LobrcOftpF33hBMFpNJ3EHU5D8vptTu4pbVr4h0SC5+5TbwLeN6KVPUuK YSBEnTuhLHK4P38OenLgau58rlN2DrY= From: Ihor Solodrai To: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Eduard Zingerman , Jiri Olsa , Mykyta Yatsenko , =?UTF-8?q?Alexis=20Lothor=C3=A9?= Cc: Amery Hung , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: [PATCH bpf v3 11/15] selftests/bpf: Free bpf_object in test_sysctl Date: Fri, 20 Feb 2026 14:26:00 -0800 Message-ID: <20260220222604.1155148-12-ihor.solodrai@linux.dev> In-Reply-To: <20260220222604.1155148-1-ihor.solodrai@linux.dev> References: <20260220222604.1155148-1-ihor.solodrai@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" ASAN reported a resource leak due to the bpf_object not being tracked in test_sysctl. Add obj field to struct sysctl_test to properly clean it up. Acked-by: Eduard Zingerman Signed-off-by: Ihor Solodrai --- tools/testing/selftests/bpf/prog_tests/test_sysctl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/test_sysctl.c b/tools/t= esting/selftests/bpf/prog_tests/test_sysctl.c index 273dd41ca09e..2a1ff821bc97 100644 --- a/tools/testing/selftests/bpf/prog_tests/test_sysctl.c +++ b/tools/testing/selftests/bpf/prog_tests/test_sysctl.c @@ -27,6 +27,7 @@ struct sysctl_test { OP_EPERM, SUCCESS, } result; + struct bpf_object *obj; }; =20 static struct sysctl_test tests[] =3D { @@ -1471,6 +1472,7 @@ static int load_sysctl_prog_file(struct sysctl_test *= test) return -1; } =20 + test->obj =3D obj; return prog_fd; } =20 @@ -1573,6 +1575,7 @@ static int run_test_case(int cgfd, struct sysctl_test= *test) /* Detaching w/o checking return code: best effort attempt. */ if (progfd !=3D -1) bpf_prog_detach(cgfd, atype); + bpf_object__close(test->obj); close(progfd); printf("[%s]\n", err ? "FAIL" : "PASS"); return err; --=20 2.53.0