From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3F9437BE8D for ; Wed, 14 Jan 2026 10:22:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768386126; cv=none; b=LRKUSbErvtu4f/q+G4SdGw+TRbPLdXJ8zJG4t92WDADZIAnmPjkvq4dfUmqexpXNpg/1wIc0Tl/+tM4R267KLbjPiKbh4euQ3dL+DgOQfuP0euDCKRb2i4cgXlFq2NgU8PzaHiDd5PxMSzrw1XAaxNkY2F0+G7fj7A7yn9+TBKM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768386126; c=relaxed/simple; bh=qFjyHEoSPa/oVe6y4HK8GkTglyZRyMJMCVgOKQbXCD8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=b2kxgN1XjodKKfiNeXo8wnoPHhjOf55rnydP9la1DIOzT1cZly+b4o/Z67UpB2ZrDFzhsqmC06rozH2iL+Pdwwl8CbAVHxnaqXtDenP/MRdlwbPdt3Kjmnq/Qxh0D1rTdJk1yczKQMaUY9pypTOEMHL4lU162+irtzx/QV49I5k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=h+AgMnvU; arc=none smtp.client-ip=209.85.208.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h+AgMnvU" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-650854c473fso1287676a12.1 for ; Wed, 14 Jan 2026 02:22:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768386118; x=1768990918; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=hGsBnBGnrh5GWqFiAd50Xj6Kf9Z4MbPCxq5OgC98qGU=; b=h+AgMnvU/AkrBRgNJ7ipySM7bdfJwMbRKFSs7RQ0450t64pvtnchHhKgBNlYdcCY6k xpNiFG/gysjWg2i4YKX47J2sJEONOCb0a5/aliUsH8LGT6Sdtktfc0+68f70dzhAd9zM ehjNycNgLAJ7RP0Rteq6JdVL5lr79pW3YECHe/H6fhvJnVHCwBQd0RdrjBNOC/1rvzVt RVouI7X/wZjgEBJ4FeGHYSBk6EiaBoz90h5OgQP1rxoHKDxTGla+UWDyV9vz4O3XL7kQ CeW3atktPBbSBurjIYmF5Ve6CNa8au87UisWzkhXSQMxpiBWstchvftXFJXOOML3VS7f mA1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768386118; x=1768990918; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hGsBnBGnrh5GWqFiAd50Xj6Kf9Z4MbPCxq5OgC98qGU=; b=hKN+nehhOcd0Qs4xfyfjJb1mflSeJHfD3VD8GCxJjcJB2LKglB/pwyFeZqdaQeImjZ QqArKUKevkbUQEdK1rQD5re4V3WXzWP6Y7E5/sPsPHsfVkefORL4F+pcroJeTKt9jMfG U0Sue51SILSbGGhF7HCZzuvFY1oIlhOadGQI5Ak/zF9/nm8EBhTR6azvXW6W4CP41YtW WBv+odni/854NYrsRcUt1a5dzC08emrr2bpq6Uokzec8jhesT1kKTqf9KnUh/MznTfKk A10bQK4OmJ6kEBzanbC7bAPlSsaUwbYXG52hrOxBDhBNLw1E95SNvzwB4IxKaTiMEUwf BT3g== X-Forwarded-Encrypted: i=1; AJvYcCX2t/cwfT6NROugsXomhZoaHdf4ceqsKNcB+5XCccW5JqbnTH559KswkkiPaMqI1VUlm7AU0Gb1PLtcxhQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzKROqAbHXcI1pAlcX+k/MwLzKQLgIy6nlroUxdO0KVbq8/klFH 3xpn7NzdXmWSejg0DOIE9uEtCXWiAUDAkt4I5p10FIxJzY/+JHHey1VX X-Gm-Gg: AY/fxX7AkXiwJaKl2A7swFFh9UtA+25yYdyTQGdcqJ4gHCK5qlNidnswOkuzrnn9arr pKWytOUlK2KGNcdB1q2W8wr/cGd8kdUvLr+EBkxGuSzgtpT23U2kvBRVPjYa5ctsUP4v1y+KyYY nSbsNlBCZzOeWXv3fOpxh2rNfoun+aZhWPZDgw1ITQO4yQrpcjtEwznHbtX3rLEuK9gYa/7B+Ju iIg1nAzbfTuvhHAOw/xnclKSNxiU3CRjW9JTqu/GNHHn5m5j2nXVTm7n6bYW0/funNkdkGyiEsV GFcK47q4DtAhp5q3stPlz7mhCCglSL0CEiqzzBbfDiU4A2qpFk0otEWHz0R8pjcnHkivMVylHxJ iGxoDbt1V1vV990/aLhProZRqyE2GJYFFIdKm2WeDYMUOrzRD7/vX+tyIuVFw3m4/bYkQxJMFdu d9QTxxnb6rKhMBsnwl3hVRPVLXAzTiCA4= X-Received: by 2002:a05:6402:3487:b0:636:2699:3812 with SMTP id 4fb4d7f45d1cf-653ebedc568mr1854657a12.0.1768386118153; Wed, 14 Jan 2026 02:21:58 -0800 (PST) Received: from mail.gmail.com ([2a04:ee41:4:b2de:1ac0:4dff:fe0f:3782]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6507bf6d5e0sm22281306a12.31.2026.01.14.02.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jan 2026 02:21:57 -0800 (PST) Date: Wed, 14 Jan 2026 10:29:44 +0000 From: Anton Protopopov To: Xu Kuohai Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Yonghong Song , Puranjay Mohan Subject: Re: [PATCH bpf-next v4 1/4] bpf: Fix an off-by-one error in check_indirect_jump Message-ID: References: <20260114093914.2403982-1-xukuohai@huaweicloud.com> <20260114093914.2403982-2-xukuohai@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260114093914.2403982-2-xukuohai@huaweicloud.com> On 26/01/14 05:39PM, Xu Kuohai wrote: > From: Xu Kuohai > > Fix an off-by-one error in check_indirect_jump() that skips the last > element returned by copy_insn_array_uniq(). > > Fixes: 493d9e0d6083 ("bpf, x86: add support for indirect jumps") > Signed-off-by: Xu Kuohai > --- > kernel/bpf/verifier.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index faa1ecc1fe9d..22605d9e0ffa 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -20336,7 +20336,7 @@ static int check_indirect_jump(struct bpf_verifier_env *env, struct bpf_insn *in > return -EINVAL; > } > > - for (i = 0; i < n - 1; i++) { > + for (i = 0; i < n; i++) { > other_branch = push_stack(env, env->gotox_tmp_buf->items[i], > env->insn_idx, env->cur_state->speculative); > if (IS_ERR(other_branch)) > -- > 2.47.3 Nack, the last state doesn't require a push_stack() call, it is verified directly under this loop. Instead of this patch, just add another call to mark_indirect_target().