Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2503664pxb; Tue, 13 Apr 2021 03:39:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBa97Lf95Mo6ia2FybhfmcNKOhJ5AZr910tgRKnr7Du/4FsMuQOpIWZ9HaB+7bOAtIDn8b X-Received: by 2002:a63:d61:: with SMTP id 33mr32007960pgn.201.1618310362634; Tue, 13 Apr 2021 03:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618310362; cv=none; d=google.com; s=arc-20160816; b=G8CdwHGtWytYR/F/4WkdOWLwzjSHQ2S2oXNgiP0kGrTsP7ivQcMo0Ee2/MgqQWATsa phkPF+sqt5TfB/tb47ZbragdSNJk6CFsl8spTpN2JBVvVaB0r+xn1rYdqxhHrY608tr3 2iEg3YzVBOxSD7YDl0rB/cMd7XNcVccgawMoZ1kvfggrL8QgVRLtxzTr1LZDmH70FHke gLaXX1X94tDL48PZYEhfAlA13vbUekD/hJNw2d0G8vTBP+K4Z5k08Bp5UF5EgZutCY/V WAv+EyCSF9LWdeg6AriDpiTXoXF0gMASeE3TalXqg/5GfFLBN5LIY3qpb7llkyKPqBr2 +8/Q== 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=xKqpB62SjNio2Vd56mEqjJEuhNSyfFYY6eHBB/193EQ=; b=dPTaatHM0Pv/sUPusfSpBbJc+KCDRom8SVJrzTGphH92Pnj6m6F0P3N8QWc3PyV6kT 0TH88FE9GFnfDBQezA+8bQAR/F+dB6JZEcpWw6IHGtDlJMB8pirHCPLUvQn+3g7+fvUy GtoxQxkPeB0JoOY3cB1ETJIAuKXdAbH3nNsmwOGgknz07OxDzDsYTlSeus7ODhkdskmx 6TSbX6dsgIvpU0r2/kajdKxUeKo6QiNn7KpH7QSKrax+QLLfoxGBwPy2BMeVTWiNhesH PbaPFXhNsxgZySuvQYJWbW1nMFfxxPHNltu3uCiuii8+DSJByx2SIL05mkUXZzu2K22B rsMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=p4PodsA1; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp21si1793589pjb.17.2021.04.13.03.39.10; Tue, 13 Apr 2021 03:39:22 -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=@google.com header.s=20161025 header.b=p4PodsA1; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242972AbhDLRjH (ORCPT + 99 others); Mon, 12 Apr 2021 13:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238649AbhDLRjH (ORCPT ); Mon, 12 Apr 2021 13:39:07 -0400 Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E8E7C061574 for ; Mon, 12 Apr 2021 10:38:49 -0700 (PDT) Received: by mail-yb1-xb29.google.com with SMTP id g38so15040374ybi.12 for ; Mon, 12 Apr 2021 10:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xKqpB62SjNio2Vd56mEqjJEuhNSyfFYY6eHBB/193EQ=; b=p4PodsA1vpWv71j2yZJVbDvfmrbUTGbEFVb88ZbZhJ187WBM1ypqp2kVqBq6u5t+MQ WoW5s5KSbvgXMFRBVRd1ctEbA/hoZORBHjX2FROvw6VImed5q9Y55xCdupdd5byeMmUT U/vUHMhhJ/K1TaH7dZDwIiAo3RdrNTTp7bXWUIi8bie8ssHOjGtei0HSyWll5i04APXB nxRbm16fUlmD6MmBfQpz9aFAZPvVTg/G+lvKo4A2EwpNoH+2ZlmnsJe7VeU7ilSdY1K6 1v9N5EV4/VUhV5sktr7Z8RUHjKCI1HVSsuUXTwmyTHBEeLb8QEsZSNjR7Lj6KWUfd1MD 17oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xKqpB62SjNio2Vd56mEqjJEuhNSyfFYY6eHBB/193EQ=; b=noIBD/++OtjtQBWDVxLs6GQccEVnW1w7Ez5JuvyGJxqSNOFpQ93KcHy1hMVCmqEOni qxox/JXygS7Cs2v7uQfGVV+1vNPW7qvWHy3VkhFsXgR+rr5i0m2LU8atUazfFBrpeH54 gWtDq47GNoQDBmJFhjlXJzWZAT4Z4WUNDTtB2QPC4zyD229vTBn6sLLQ8ZjqkChhrdqg +9KrdzD3EjPZ5IsxEGdWUoDd7sLFOBO2hYs9lv6aGyQ1qzAzgJtRkcNOWlmCEmdEHJy1 hJbrYX+YTZ4JpevDQBxVrFIThmSAAd2tMlq0E/dNGOUBt4ubk3/YH4/zmxMaAg54RTRo sIOA== X-Gm-Message-State: AOAM532Z4gexvxToQv0fdXfxWK5BL4iL67uB6UX3PvR9dLVQb/JhGL/y ZXteRuGhU+y10KMRjqRfCtmtssJDkfi8rmCkZAG+NA2w6sdRnQ== X-Received: by 2002:a25:4244:: with SMTP id p65mr10489640yba.452.1618249128058; Mon, 12 Apr 2021 10:38:48 -0700 (PDT) MIME-Version: 1.0 References: <20210412051445.GA47322@roeck-us.net> <78c858ba-a847-884f-80c3-cb1eb84d4113@roeck-us.net> In-Reply-To: <78c858ba-a847-884f-80c3-cb1eb84d4113@roeck-us.net> From: Eric Dumazet Date: Mon, 12 Apr 2021 19:38:36 +0200 Message-ID: Subject: Re: Linux 5.12-rc7 To: Guenter Roeck Cc: Linus Torvalds , Xuan Zhuo , "Michael S. Tsirkin" , Linux Kernel Mailing List , Netdev Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 12, 2021 at 7:31 PM Guenter Roeck wrote: > > On 4/12/21 9:31 AM, Eric Dumazet wrote: > > On Mon, Apr 12, 2021 at 6:28 PM Linus Torvalds > > wrote: > >> > >> On Sun, Apr 11, 2021 at 10:14 PM Guenter Roeck wrote: > >>> > >>> Qemu test results: > >>> total: 460 pass: 459 fail: 1 > >>> Failed tests: > >>> sh:rts7751r2dplus_defconfig:ata:net,virtio-net:rootfs > >>> > >>> The failure bisects to commit 0f6925b3e8da ("virtio_net: Do not pull payload in > >>> skb->head"). It is a spurious problem - the test passes roughly every other > >>> time. When the failure is seen, udhcpc fails to get an IP address and aborts > >>> with SIGTERM. So far I have only seen this with the "sh" architecture. > >> > >> Hmm. Let's add in some more of the people involved in that commit, and > >> also netdev. > >> > >> Nothing in there looks like it should have any interaction with > >> architecture, so that "it happens on sh" sounds odd, but maybe it's > >> some particular interaction with the qemu environment. > > > > Yes, maybe. > > > > I spent few hours on this, and suspect a buggy memcpy() implementation > > on SH, but this was not conclusive. > > > > I replaced all memcpy() calls in skbuff.h with calls to > > static inline void __my_memcpy(unsigned char *to, const unsigned char *from, > unsigned int len) > { > while (len--) > *to++ = *from++; > } > > That made no difference, so unless you have some other memcpy() in mind that > seems to be unlikely. Sure, note I also had : diff --git a/net/core/dev.c b/net/core/dev.c index af8c1ea040b9364b076e2d72f04dc3de2d7e2f11..4e05a32542dd606aaaaee8038017fea949939c0e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5938,7 +5938,7 @@ static void gro_pull_from_frag0(struct sk_buff *skb, int grow) BUG_ON(skb->end - skb->tail < grow); - memcpy(skb_tail_pointer(skb), NAPI_GRO_CB(skb)->frag0, grow); + memmove(skb_tail_pointer(skb), NAPI_GRO_CB(skb)->frag0, grow); skb->data_len -= grow; skb->tail += grow; diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c421c8f809256f7b13a8b5a1331108449353ee2d..41796dedfa9034f2333cf249a0d81b7250e14d1f 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -2278,7 +2278,7 @@ int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len) skb_frag_off(f) + offset - start, copy, p, p_off, p_len, copied) { vaddr = kmap_atomic(p); - memcpy(to + copied, vaddr + p_off, p_len); + memmove(to + copied, vaddr + p_off, p_len); kunmap_atomic(vaddr); } > > > By pulling one extra byte, the problem goes away. > > > > Strange thing is that the udhcpc process does not go past sendto(). > > > > I have been trying to debug that one. Unfortunately gdb doesn't work with sh, > so I can't use it to debug the problem. I'll spend some more time on this today. Yes, I think this is the real issue here. This smells like some memory corruption. In my traces, packet is correctly received in AF_PACKET queue. I have checked the skb is well formed. But the user space seems to never call poll() and recvmsg() on this af_packet socket.