From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69ABAC433ED for ; Mon, 12 Apr 2021 17:38:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 38A6761354 for ; Mon, 12 Apr 2021 17:38:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241512AbhDLRjJ (ORCPT ); Mon, 12 Apr 2021 13:39:09 -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-Google-Smtp-Source: ABdhPJy0EiYNU3fwxaO23AZhu4GaOvCjO3kSPlebWlyhQK9ZuPI9EKRW3Vu04v64PYdcqxw19cp07O8cMOhJ2J700QI= 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.