Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2708172pxb; Tue, 13 Apr 2021 08:20:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyg5U/xbOzlc9e7nOsNkvlVQ3vLyfOFhWmmakmASPG1rjQkGpcwLq1U3/tTLJ7ZSSH/d8Vu X-Received: by 2002:a17:90b:392:: with SMTP id ga18mr535037pjb.222.1618327211226; Tue, 13 Apr 2021 08:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618327211; cv=none; d=google.com; s=arc-20160816; b=hVXEpBz3zf9yFcPksIisbejXb+ky9uxjUE2WFnpFjFfpMS7Lt6nwKG2VSt+TgvwUnX O4bsGdAxeXebGKX6CyYTLCheiaiRwWrxsK75rIwhtYUICmjc7PfQkO2SzHmcTpHrnJkm +3EBJMKOg4KkaenNP0fqcOp8Uumca/4qUeXAP2f65cu5SLXtWYV6YAyBHe20GHe3sZ7o puDYm4UmggXJgmisLLalJqo7kKz66sWpwOkDrMrtU1xfORXm6m7roqHSSm4tvDKEQO05 vw1c5Qb2U9KhyV8hG58ZFvQvrqyupih8JB4OFCG61sAxNt1oFxOYl42zTVjUZ8FrSn8U Z4EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PJrYhyCxKNE6YVpSStofrcu0tixZ6hbUvszUPwq1LtA=; b=RpryonIQAwdNVtuiK/IrzYXUuJ8VSkwaC69Ei4edHfWtSyi4zEVKCtMG9VyN7zu4IZ wCwR2N9vEbZcgqilEF9ECk/WfXXDssVs1gub4OtO/XpqJCOsMukk+pgQl4SU5uyMZYf3 k5YXbN+O/6YvthbvXP6AivIeRh6RyXucy3ZbVeOY8FaXlWypTSyf2XonQq8AZy98kNfb P9YGY2mvReiZsKUVh9Bf1ZY7oIowMpFfkyrFgXlpUSGO02S58ZYMNFgyj/rpMMD5I8X8 /XJ5QZWJKE9Sxqm2fayxnVCwdBEUplb2VXzfoaUlneA2E4YBWz/qio5upi1+aPstBDJn mEBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ijyCbK3/"; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a3si17935007plm.258.2021.04.13.08.19.55; Tue, 13 Apr 2021 08:20:11 -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=@redhat.com header.s=mimecast20190719 header.b="ijyCbK3/"; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344309AbhDMMw7 (ORCPT + 99 others); Tue, 13 Apr 2021 08:52:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46888 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244817AbhDMMw5 (ORCPT ); Tue, 13 Apr 2021 08:52:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618318356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PJrYhyCxKNE6YVpSStofrcu0tixZ6hbUvszUPwq1LtA=; b=ijyCbK3/NsLJvXlCMrQ4FslWHkVccJlPc2KAiVRYSaI1a1lix0jA3XWK3GUT7CRvQ69Tta pfDgquPJ9o+tkt2U/UXi2rZyhSpNpuzjs4Q7lpEnygrnt327/wSifoIkW/6+EtB5MB4OSu h5YlN+9dypKX8xgkKGdh5FwbfSXPkx0= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-12-J-f7kF18MvOfDEK0-_R0BQ-1; Tue, 13 Apr 2021 08:52:33 -0400 X-MC-Unique: J-f7kF18MvOfDEK0-_R0BQ-1 Received: by mail-wr1-f71.google.com with SMTP id h16so742216wrq.5 for ; Tue, 13 Apr 2021 05:52:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PJrYhyCxKNE6YVpSStofrcu0tixZ6hbUvszUPwq1LtA=; b=p1t6oVFsFnrD6f8Z9Mks/G9dNpEd1M3OlBjfPwCPfBvoaYW4iVh9Ya8+fxyZq9CzLl goWPP1ks0HoSGr+5l659ETR56lHn+FCy08Mq2LHCSr6sMzOLKyl1Km1+7y0MBzAKtGk4 ABuWVbd+RQ8odkNFMc656+9Ba4l9QKtFezIkIX1lPFS6yCBCkIemt9tLmJpj4G8SykAS lRkvN2jdsgAb3TMk08gWkt554kN4NU8Sc7bJ8BM+wzYDEfNdfQf3Y3CECKuV2fslYdNP LgIh21O9WsXy29SfTOhsaqe3f3iVlPDAiXGvlYOgxAQKz5YDtOMCPUqiAcQIk1si6NYK WGrA== X-Gm-Message-State: AOAM530s2P2a/XHLRHPYs0ONkz3JpVrBez5Zs+dGpsSi2PpHN/ubUFKm vQVwqNzPkcV3XA2FjVq7SA5Ybcf0Z9N3bq5P0wCpGuTBZ2EKBNczStwJt8sLihSuOqBGXuMRy0C wWINUb+g4SC+GsGjFXXKtR7F6 X-Received: by 2002:a7b:c444:: with SMTP id l4mr4054545wmi.36.1618318351897; Tue, 13 Apr 2021 05:52:31 -0700 (PDT) X-Received: by 2002:a7b:c444:: with SMTP id l4mr4054531wmi.36.1618318351621; Tue, 13 Apr 2021 05:52:31 -0700 (PDT) Received: from redhat.com ([2a10:8006:2281:0:1994:c627:9eac:1825]) by smtp.gmail.com with ESMTPSA id h17sm394077wru.67.2021.04.13.05.52.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 05:52:30 -0700 (PDT) Date: Tue, 13 Apr 2021 08:52:27 -0400 From: "Michael S. Tsirkin" To: Eric Dumazet Cc: Guenter Roeck , Linus Torvalds , Xuan Zhuo , Linux Kernel Mailing List , Netdev Subject: Re: Linux 5.12-rc7 Message-ID: <20210413085218-mutt-send-email-mst@kernel.org> References: <20210412051445.GA47322@roeck-us.net> <78c858ba-a847-884f-80c3-cb1eb84d4113@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 13, 2021 at 02:45:46PM +0200, Eric Dumazet wrote: > On Tue, Apr 13, 2021 at 12:43 PM Eric Dumazet wrote: > > > > On Tue, Apr 13, 2021 at 11:24 AM Eric Dumazet wrote: > > > > > > On Mon, Apr 12, 2021 at 10:05 PM Guenter Roeck wrote: > > > > > > > > On 4/12/21 10:38 AM, Eric Dumazet wrote: > > > > [ ... ] > > > > > > > > > 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. > > > > > > > > > > > > > After sprinkling the kernel with debug messages: > > > > > > > > 424 00:01:33.674181 sendto(6, "E\0\1H\0\0\0\0@\21y\246\0\0\0\0\377\377\377\377\0D\0C\00148\346\1\1\6\0\246\336\333\v\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0RT\0\ > > > > 424 00:01:33.693873 close(6) = 0 > > > > 424 00:01:33.694652 fcntl64(5, F_SETFD, FD_CLOEXEC) = 0 > > > > 424 00:01:33.695213 clock_gettime64(CLOCK_MONOTONIC, 0x7be18a18) = -1 EFAULT (Bad address) > > > > 424 00:01:33.695889 write(2, "udhcpc: clock_gettime(MONOTONIC) failed\n", 40) = -1 EFAULT (Bad address) > > > > 424 00:01:33.697311 exit_group(1) = ? > > > > 424 00:01:33.698346 +++ exited with 1 +++ > > > > > > > > I only see that after adding debug messages in the kernel, so I guess there must be > > > > a heisenbug somehere. > > > > > > > > Anyway, indeed, I see (another kernel debug message): > > > > > > > > __do_sys_clock_gettime: Returning -EFAULT on address 0x7bacc9a8 > > > > > > > > So udhcpc doesn't even try to read the reply because it crashes after sendto() > > > > when trying to read the current time. Unless I am missing something, that means > > > > that the problem happens somewhere on the send side. > > > > > > > > To make things even more interesting, it looks like the failing system call > > > > isn't always clock_gettime(). > > > > > > > > Guenter > > > > > > > > > I think GRO fast path has never worked on SUPERH. Probably SUPERH has > > > never used a fast NIC (10Gbit+) > > > > > > The following hack fixes the issue. > > > > > > > > > diff --git a/net/core/dev.c b/net/core/dev.c > > > index af8c1ea040b9364b076e2d72f04dc3de2d7e2f11..91ba89a645ff91d4cd4f3d8dc8a009bcb67da344 > > > 100644 > > > --- a/net/core/dev.c > > > +++ b/net/core/dev.c > > > @@ -5916,13 +5916,16 @@ static struct list_head > > > *gro_list_prepare(struct napi_struct *napi, > > > > > > static void skb_gro_reset_offset(struct sk_buff *skb) > > > { > > > +#if !defined(CONFIG_SUPERH) > > > const struct skb_shared_info *pinfo = skb_shinfo(skb); > > > const skb_frag_t *frag0 = &pinfo->frags[0]; > > > +#endif > > > > > > NAPI_GRO_CB(skb)->data_offset = 0; > > > NAPI_GRO_CB(skb)->frag0 = NULL; > > > NAPI_GRO_CB(skb)->frag0_len = 0; > > > > > > +#if !defined(CONFIG_SUPERH) > > > if (!skb_headlen(skb) && pinfo->nr_frags && > > > !PageHighMem(skb_frag_page(frag0))) { > > > NAPI_GRO_CB(skb)->frag0 = skb_frag_address(frag0); > > > @@ -5930,6 +5933,7 @@ static void skb_gro_reset_offset(struct sk_buff *skb) > > > skb_frag_size(frag0), > > > skb->end - skb->tail); > > > } > > > +#endif > > > } > > > > > > static void gro_pull_from_frag0(struct sk_buff *skb, int grow) > > > > OK ... more sh debugging : > > > > diff --git a/arch/sh/mm/alignment.c b/arch/sh/mm/alignment.c > > index fb517b82a87b1065cf38c06cb3c178ce86587b00..5d18f9f792991105a8aa05cc6231b7d4532d72c9 > > 100644 > > --- a/arch/sh/mm/alignment.c > > +++ b/arch/sh/mm/alignment.c > > @@ -27,7 +27,7 @@ static unsigned long se_multi; > > valid! */ > > static int se_usermode = UM_WARN | UM_FIXUP; > > /* 0: no warning 1: print a warning message, disabled by default */ > > -static int se_kernmode_warn; > > +static int se_kernmode_warn = 1; > > > > core_param(alignment, se_usermode, int, 0600); > > > > @@ -103,7 +103,7 @@ void unaligned_fixups_notify(struct task_struct > > *tsk, insn_size_t insn, > > (void *)instruction_pointer(regs), insn); > > else if (se_kernmode_warn) > > pr_notice_ratelimited("Fixing up unaligned kernel access " > > - "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", > > + "in \"%s\" pid=%d pc=%px ins=0x%04hx\n", > > tsk->comm, task_pid_nr(tsk), > > (void *)instruction_pointer(regs), insn); > > } > > > > I now see something of interest : > > Fixing up unaligned kernel access in "udhcpc" pid=91 pc=8c43fc2e ins=0x6236 > > Fixing up unaligned kernel access in "udhcpc" pid=91 pc=8c43fc2e ins=0x6236 > > Fixing up unaligned kernel access in "udhcpc" pid=91 pc=8c43fc30 ins=0x6636 > > Fixing up unaligned kernel access in "udhcpc" pid=91 pc=8c43fc30 ins=0x6636 > > Fixing up unaligned kernel access in "udhcpc" pid=91 pc=8c43fc3a ins=0x6636 > > Fixing up unaligned kernel access in "udhcpc" pid=91 pc=8c43fc3a ins=0x6636 > > Fixing up unaligned kernel access in "udhcpc" pid=91 pc=8c43fc3a ins=0x6636 > > Fixing up unaligned kernel access in "udhcpc" pid=91 pc=8c43fc3a ins=0x6636 > > Fixing up unaligned kernel access in "udhcpc" pid=91 pc=8c43fc3a ins=0x6636 > > Fixing up unaligned kernel access in "udhcpc" pid=91 pc=8c43fc3a ins=0x6636 > > > > So basically the frag0 idea only works if drivers respect NET_IP_ALIGN > > (So that IP header is 4-byte aligned) > > > > It seems either virtio_net or qemu does not respect the contract. > > > > A possible generic fix would then be : > > > > > > diff --git a/net/core/dev.c b/net/core/dev.c > > index af8c1ea040b9364b076e2d72f04dc3de2d7e2f11..1f79b9aa9a3f2392fddd1401f95ad098b5e03204 > > 100644 > > --- a/net/core/dev.c > > +++ b/net/core/dev.c > > @@ -5924,7 +5924,8 @@ static void skb_gro_reset_offset(struct sk_buff *skb) > > NAPI_GRO_CB(skb)->frag0_len = 0; > > > > if (!skb_headlen(skb) && pinfo->nr_frags && > > - !PageHighMem(skb_frag_page(frag0))) { > > + !PageHighMem(skb_frag_page(frag0)) && > > + (!NET_IP_ALIGN || !(skb_frag_off(frag0) & 3))) { > > NAPI_GRO_CB(skb)->frag0 = skb_frag_address(frag0); > > NAPI_GRO_CB(skb)->frag0_len = min_t(unsigned int, > > skb_frag_size(frag0), > > > Official submission : > > https://patchwork.kernel.org/project/netdevbpf/patch/20210413124136.2750358-1-eric.dumazet@gmail.com/ Thanks a lot Eric! -- MST