Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp337403pxb; Mon, 13 Sep 2021 21:10:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn8QGS0WO5MnEjqv9xix9cqPuvsq+3aYiK3CCYlaGaZmhaUSGkyqmWBM34stcjJFEhwLzq X-Received: by 2002:a05:6638:1514:: with SMTP id b20mr8178321jat.47.1631592618673; Mon, 13 Sep 2021 21:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631592618; cv=none; d=google.com; s=arc-20160816; b=uXfuRqgaC+FQzcuV8vAXkuzz+yLo7QJbiG35YHACkpIZdfFehjE/+jN5qRUsS6puKP X6qW8jvJ1f1jWvawR+Rb4SHI5cM0h2xyigbRWh6/tXdo+oVMHTX3lI0iqG9nxzlD1H4s M0tcPob4epAXObQ1JcR0Xwei4lENQtkHB/RKt9zO9QI0ATAj4MvCD2UqqnFqIJU2bj+B h+0nsLkMTpnj3HH+AYOvvu3bn93AFIEXoFzf17VXBcQIqYJWnK9V+H/EdBplJp5DtBPY F/rHu93pnERvi9w1SIG87URtt79hdpa/vQXoeIezMq2Hu2oKXC9SpDMRxb9GtKkWZYCR E6WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6dUT5DvFbbYMaoEPiPLDAN+5dOCe4J7gs07f/JQLEu4=; b=UouVh5uOByzDYnhOLs/1/KJ8qV7LyiNcsyAD9DBAD90SXCan7aFrNKnLW/jadL6vqR vxdXNF7HfhBr1IQxzoFV//M9aW4XoDqxZpImDCN/F64PFOhWboY4UfSTkGcuImd1tVQU b6dBHHwYsXopW6goWWCkO5xAtuRMgI6XDrYJItupd1WdzAz3VJVUKMi+zzF66CjASBwB eLYFyfyPXFuNAXl3+GQJs2pLTC4tc1MsVg1mQEp3wK2Vo4RVHlOGrGy8hcfHsuhMzDhX rBQeK4C2zI2t32FD3KGyjgBqqrs9sFMCUUfwUZiHUTpx7Owfq2IZe/GSz9M0TBC3VGI4 LcVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@anyfinetworks-com.20150623.gappssmtp.com header.s=20150623 header.b="J/wx5v2j"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si9098496iot.102.2021.09.13.21.10.06; Mon, 13 Sep 2021 21:10:18 -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=@anyfinetworks-com.20150623.gappssmtp.com header.s=20150623 header.b="J/wx5v2j"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231571AbhINEK0 (ORCPT + 99 others); Tue, 14 Sep 2021 00:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbhINEK0 (ORCPT ); Tue, 14 Sep 2021 00:10:26 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 767CEC061760 for ; Mon, 13 Sep 2021 21:09:09 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id z5so25263203ybj.2 for ; Mon, 13 Sep 2021 21:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anyfinetworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6dUT5DvFbbYMaoEPiPLDAN+5dOCe4J7gs07f/JQLEu4=; b=J/wx5v2jZ0Heo5oVWltVNHdeOQREYdrh2D95/smvODoPomwE/csFmxg4onKdso9qR9 EfFBXL2wHjX1fBOUF67wimCgII2bIWFK8xZZw9tKLsWuQKwo8wrM8VqjTjWQ6Akf5uLH nakQ4kSYuhEzwfLHPkW07LWmQ+sFlPMRzk+e4VzdoyRoEfRHoKSn82FIfkehZ1DAZ8u6 ClhYEb4jsK8xm8n1xVWO8yKChQslWMK0fcZuyPY9s0t69ybkZiGM6UZNDz0dD5Pj7D+I Tk8Gh2p99gRTr9qH6v+wxLr8R92WMubX4N3Vn0y579w9XX2sQnkWRqgvTxb0WEk8CuW5 BwBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6dUT5DvFbbYMaoEPiPLDAN+5dOCe4J7gs07f/JQLEu4=; b=fvC6AxXdMv6jVmd1ET0TuhHuQn2Rj2pKhGkzLqxrkvQwgTjaVVxJbMOZ9hC46xNQ9s /47P+PY8NUdu3GoxJmDFH4loanb+/xxJM6ZV7OfCm2QUqCs40IIXCj/qe3UNCI5E6R5e lL6W8YXwhtfppBbmDlrIeTsVwW7su1HNLatiOd9840NtRcWNS3ZeTu83+/GDcJ3mQgm8 gzLn+YNz6wiSsLAQyQ0CXyBx9Y7HkWDEuk3i/RLLyQ5I1YnvpTV7fCRE63/xIHd1UE9a SvyZZSjhGCkhGvbzbRzZZ9sVKGcUznCnB2D+MRiKurqEfbx/9+bOvBahmkoxfetK1AaJ 42PQ== X-Gm-Message-State: AOAM533h1GaNpyJB5m+lQq8zGCZJVjG4z97GrAd/UtTaYwuGmlVzeuUw /V30jI9/hGhTdgvi8bMgo0IFJti4CpBGGRc4aK4uGQ== X-Received: by 2002:a25:b904:: with SMTP id x4mr18387519ybj.48.1631592548588; Mon, 13 Sep 2021 21:09:08 -0700 (PDT) MIME-Version: 1.0 References: <20210909114106.141462-1-sashal@kernel.org> <20210909114106.141462-101-sashal@kernel.org> In-Reply-To: <20210909114106.141462-101-sashal@kernel.org> From: Johan Almbladh Date: Tue, 14 Sep 2021 06:08:57 +0200 Message-ID: Subject: Re: [PATCH AUTOSEL 5.14 101/252] bpf: Fix off-by-one in tail call count limiting To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Andrii Nakryiko , Yonghong Song , Networking , bpf , Daniel Borkmann Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sasha, This patch should not be applied to any of the stable kernels. It was reverted in f9dabe016b63 ("bpf: Undo off-by-one in interpreter tail call count limit"). I don't think it will pass the CI selftests so maybe it wouldn't be applied anyway, but nevertheless I want to inform you about it. Johan On Thu, Sep 9, 2021 at 1:43 PM Sasha Levin wrote: > > From: Johan Almbladh > > [ Upstream commit b61a28cf11d61f512172e673b8f8c4a6c789b425 ] > > Before, the interpreter allowed up to MAX_TAIL_CALL_CNT + 1 tail calls. > Now precisely MAX_TAIL_CALL_CNT is allowed, which is in line with the > behavior of the x86 JITs. > > Signed-off-by: Johan Almbladh > Signed-off-by: Andrii Nakryiko > Acked-by: Yonghong Song > Link: https://lore.kernel.org/bpf/20210728164741.350370-1-johan.almbladh@anyfinetworks.com > Signed-off-by: Sasha Levin > --- > kernel/bpf/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c > index 0a28a8095d3e..82af6279992d 100644 > --- a/kernel/bpf/core.c > +++ b/kernel/bpf/core.c > @@ -1564,7 +1564,7 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn) > > if (unlikely(index >= array->map.max_entries)) > goto out; > - if (unlikely(tail_call_cnt > MAX_TAIL_CALL_CNT)) > + if (unlikely(tail_call_cnt >= MAX_TAIL_CALL_CNT)) > goto out; > > tail_call_cnt++; > -- > 2.30.2 >