Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp897303pxb; Wed, 27 Oct 2021 14:42:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzMyfakf0n48cDLkQgraQxXxSpJS0Go/Bk1lZFN+nlBbAu7vVAMqFCCgw3XhvkM+rP5uVd X-Received: by 2002:a17:902:8d8d:b0:140:638:a87c with SMTP id v13-20020a1709028d8d00b001400638a87cmr295724plo.9.1635370950900; Wed, 27 Oct 2021 14:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370950; cv=none; d=google.com; s=arc-20160816; b=WozJEjUMb3LlyTXQyE5S/e17b/yIWcvB8rCsS8yVYRmzAD9IYAqhB9o1vosoM3F7jZ FUAtcijP5P+SfkmwiUpkkhqQ387C/PsCnbBWmcYc0bzAqamsGAoZG9tTlAu/sfYP7FDz y5J8i+LcIsVZLj2VX8yNbyTk2lsJzWwn5Zyhtrlk7bn0d5xbNchNtJ4g0HDYwbhvU76e V7xIcTJeoyyOB5Z8Ux+9Iy7XYhelmfs/tb7Acpv7fEFpGPfwp1RhfgPvCSpsqFisRUpm zNQKj1dYS8HXR8KuksGzOi0xOK5ErXKZ8JxEUaSayc7BE3QweUhYhM+4W4UtMmzjYujG yCRA== 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=mtt6K2LWB25b7AgK97wNPqfxuIsCgwqKLzzbnl0i1Og=; b=FGMs6gyV4ayCVDtEb+1apSJE8f3V3jcyGrq73ho3yDWK7uACVwiA6q6B/REBq4GjLv +1zTEC1ebBAz1TLYpXzt+Qir+IiUXWo2mMGZfPkMTTPyIl8JI8JF07StJli5CnWC3UCX PcPg4+/wKqvjEyF1DHDmBSmpieyfLK9KyPelaMlWQh5GV15Ykd4sb3yyo99iOEdjyLm9 5Wpr1IyXgh1oSHA5SIFfl8QMLAbY1TDsAzpaPEHYWZhX0VwS2n+zeQol/jl2wI5sUxZn bKDczQc6x8TFnW9ssLeMoTxl53HGIZ83DvLg/s5R88JAIwETZlwMAq6AtNjb9kcDXw2Z uXiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Lq6qabtt; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i126si1354603pfg.228.2021.10.27.14.42.18; Wed, 27 Oct 2021 14:42:30 -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=@gmail.com header.s=20210112 header.b=Lq6qabtt; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239281AbhJ0IKO (ORCPT + 99 others); Wed, 27 Oct 2021 04:10:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239104AbhJ0IKM (ORCPT ); Wed, 27 Oct 2021 04:10:12 -0400 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42408C061570; Wed, 27 Oct 2021 01:07:47 -0700 (PDT) Received: by mail-ot1-x336.google.com with SMTP id y15-20020a9d460f000000b0055337e17a55so2444581ote.10; Wed, 27 Oct 2021 01:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mtt6K2LWB25b7AgK97wNPqfxuIsCgwqKLzzbnl0i1Og=; b=Lq6qabtt5TSFhvKVjpTcThsWSl7eI2dotOpZ5O7Mpls+7760sqwjU6GEHLFl9uBUo3 bzXa1dequ8KHrj7O842qkEk8yIyEP4McDhVijHxmygaN/xbOfyvFUPldpkwRPp8h9teA 8jvhOnu6Pt56tAoEy6AgQDgoGHug8T8+V+Q3NH08NM+2E2JTe95d2Xq6D1hYy9dzzaC4 ZXaq/z2D9vo2Q5O59mnr81Yn8YR4QIYFlijX0PXcRXhhKEBlv1UTN112MWfA/4+wYRhM 2rOlrXb0ecdjOm8o2OZbx/1UP2Dqkj5+AKJFV3nYxbNaPbbMFcVUK6v81DgQLYMWOCWs bC6w== 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=mtt6K2LWB25b7AgK97wNPqfxuIsCgwqKLzzbnl0i1Og=; b=Utn0xVhzj7k1bwuUhUtmsjTcBY2E1S9oPoU+HlT79AbXobqtKF3iXRqq0LPFbPcTWc D6+8hezdcKUwgsi9ySqs3i5wkYTjMcBvnwgo5ymUHMhs+vB+sY4DjqpdLl30ybv8D/vy Gh41rN8LBYKuan3MK4j8gUv+Bu+qoXvtqk1JBMj9dhtDXyc554SyATrD4AOc1gKkNrKS HEDs+2Qs7jR5DenwTIaGoaXvkjFRtP3pLXmF0tOzOkE1MMAyfi+IgrL3R4X2IO3cSYB2 MKb+BjXKoarrKlHMqI3lMKjdKYd4+wd2XCOGKMbV8Y/1GGR76xFy0afPqUdCk3/ldZx1 QZig== X-Gm-Message-State: AOAM5331rPh62u5hgOYq85KQ6G74xMSc4RXbtD6pK2+4KLU5HK94ZC+Q YmIu9Uv/gTpNN/lj+34rI6wjSSHykQ+E3x6XwV0= X-Received: by 2002:a9d:72de:: with SMTP id d30mr23748654otk.18.1635322066670; Wed, 27 Oct 2021 01:07:46 -0700 (PDT) MIME-Version: 1.0 References: <20211026131859.59114-1-kerneljasonxing@gmail.com> In-Reply-To: From: Jason Xing Date: Wed, 27 Oct 2021 16:07:10 +0800 Message-ID: Subject: Re: [PATCH net] net: gro: set the last skb->next to NULL when it get merged To: David Miller , kuba@kernel.org, alobakin@pm.me, jonathan.lemon@gmail.com, Willem de Bruijn , pabeni@redhat.com, vvs@virtuozzo.com, cong.wang@bytedance.com Cc: netdev , LKML , Jason Xing Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 27, 2021 at 3:23 PM Jason Xing wrote: > > On Tue, Oct 26, 2021 at 9:19 PM wrote: > > > > From: Jason Xing > > > > Setting the @next of the last skb to NULL to prevent the panic in future > > when someone does something to the last of the gro list but its @next is > > invalid. > > > > For example, without the fix (commit: ece23711dd95), a panic could happen > > with the clsact loaded when skb is redirected and then validated in > > validate_xmit_skb_list() which could access the error addr of the @next > > of the last skb. Thus, "general protection fault" would appear after that. > > > > Signed-off-by: Jason Xing > > --- > > net/core/skbuff.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/net/core/skbuff.c b/net/core/skbuff.c > > index 2170bea..7b248f1 100644 > > --- a/net/core/skbuff.c > > +++ b/net/core/skbuff.c > > @@ -4396,6 +4396,7 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb) > > skb_shinfo(p)->frag_list = skb; > > else > > NAPI_GRO_CB(p)->last->next = skb; > > + skb->next = NULL; > > NAPI_GRO_CB(p)->last = skb; > > Besides, I'm a little bit confused that this operation inserts the > newest skb into the tail of the flow, so the tail of flow is the > newest, head oldest. The patch (commit: 600adc18) introduces the flush > of the oldest when the flow is full to lower the latency, but actually > it fetches the tail of the flow. Do I get something wrong here? I feel I have to update this part. The commit 600adc18 evicts and flushes the oldest flow. But for the current kernel, when "napi->gro_hash[hash].count >= MAX_GRO_SKBS" happens, the gro_flush_oldest() flushes the oldest skb of one certain flow, actually it is the newest skb because it is at the end of the list. > it is really odd. > > Thanks, > Jason > > > __skb_header_release(skb); > > lp = p; > > -- > > 1.8.3.1 > >