From nobody Sun Feb 8 03:58:10 2026 Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) (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 A4DEA27CB04 for ; Wed, 22 Oct 2025 16:46:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761151591; cv=none; b=GIYMr8mLBZwgXCTVzjGSHc8Bbf/wEOU9OmlIAQbI7lrogKD438vYMeVJzi3RQYXosW2Y8OZBi8NLrGM2IzvXwi7sD5bnHTYRYgq+6LWejIk0EjmPWZ61tbJtTPHMJVNipfyIfhOcrutZWxjZRs/IyPN2M85m3QejjwiVMJafRI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761151591; c=relaxed/simple; bh=wrsQAp0TGs8gJXBhL+Pm/Ez5V7kMDw/AHC3OiikOpMQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X2qxBebv4KF+KdC4HYSjGrcyf46kZAkrP40PkWZjSdagwnVxMOk/pggnK6xw3tkNrVrP4HubfHc1B3nw3hbFqC6oqfLFQYdwuXoqalN3VC2mc/oKZlJC5XO39BIfRF0E3m9hQoFYc9ZlzzCDy37G3BUoCJTKyaZzcgRrlloXjKU= 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=VoFBlYf/; arc=none smtp.client-ip=91.218.175.185 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="VoFBlYf/" 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=1761151587; 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=tE0qJy2M/AZrZXVbIbayGvBfV5fR9ey5S78aB6UPd6Y=; b=VoFBlYf/alWqPDOqivJXzjjBUpQ3M2YCxCaxiBivgUp3LrNSG5JbaoDyskPlf+7cMhPSFE gxV6E+zta7cYYyC3KgBWKE6iEd1bjb0KXNWwHe1TIvo+ZJnNEiYkiAq6MhSkF3V43/nQsu VUDRCNdsnRJ4EXpSLCcbujeIGzweTxs= From: KaFai Wan To: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com, andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, shuah@kernel.org, paul.chaignon@gmail.com, m.shachnai@gmail.com, luis.gerhorst@fau.de, colin.i.king@gmail.com, harishankar.vishwanathan@gmail.com, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: KaFai Wan Subject: [PATCH bpf-next 2/2] selftests/bpf: Add test for conditional jumps on same register Date: Thu, 23 Oct 2025 00:44:57 +0800 Message-ID: <20251022164457.1203756-3-kafai.wan@linux.dev> In-Reply-To: <20251022164457.1203756-1-kafai.wan@linux.dev> References: <20251022164457.1203756-1-kafai.wan@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" Add a test case to verify that conditional jumps on the same register (e.g., JGT r0 > r0) do not trigger verifier BUG warnings when the register holds a scalar with range. Signed-off-by: KaFai Wan --- .../selftests/bpf/progs/verifier_bounds.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/testing/selftests/bpf/progs/verifier_bounds.c b/tools/te= sting/selftests/bpf/progs/verifier_bounds.c index 0a72e0228ea9..620095635af5 100644 --- a/tools/testing/selftests/bpf/progs/verifier_bounds.c +++ b/tools/testing/selftests/bpf/progs/verifier_bounds.c @@ -1709,4 +1709,21 @@ __naked void jeq_disagreeing_tnums(void *ctx) : __clobber_all); } =20 +SEC("socket") +__description("JGT on same register") +__success __log_level(2) +__naked void jgt_same_register(void *ctx) +{ + asm volatile(" \ + call %[bpf_get_prandom_u32]; \ + w8 =3D 0x80000000; \ + r0 &=3D r8; \ + if r0 > r0 goto +1; \ + call %[bpf_get_prandom_u32]; \ + exit; \ +" : + : __imm(bpf_get_prandom_u32) + : __clobber_all); +} + char _license[] SEC("license") =3D "GPL"; --=20 2.43.0