From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932434AbdJ0DEL (ORCPT ); Thu, 26 Oct 2017 23:04:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45010 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751483AbdJ0DEH (ORCPT ); Thu, 26 Oct 2017 23:04:07 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CF3E185541 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jasowang@redhat.com Subject: Re: [PATCH net] tuntap: properly align skb->head before building skb To: Eric Dumazet Cc: netdev , LKML , Wei Wei , Willem de Bruijn , Dmitry Vyukov , Mark Rutland References: <1509020155-3830-1-git-send-email-jasowang@redhat.com> From: Jason Wang Message-ID: Date: Fri, 27 Oct 2017 11:03:57 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 27 Oct 2017 03:04:07 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017年10月26日 22:11, Eric Dumazet wrote: > On Thu, Oct 26, 2017 at 5:15 AM, Jason Wang wrote: >> An unaligned alloc_frag->offset caused by previous allocation will >> result an unaligned skb->head. This will lead unaligned >> skb_shared_info and then unaligned dataref which requires to be >> aligned for accessing on some architecture. Fix this by aligning >> alloc_frag->offset before the frag refilling. >> >> Fixes: 0bbd7dad34f8 ("tun: make tun_build_skb() thread safe") >> Cc: Eric Dumazet >> Cc: Willem de Bruijn >> Cc: Wei Wei >> Cc: Dmitry Vyukov >> Cc: Mark Rutland >> Reported-by: Wei Wei >> Signed-off-by: Jason Wang >> --- >> - The patch is needed for -stable. >> - Wei, can you try this patch to see if it solves your issue? >> --- >> drivers/net/tun.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/net/tun.c b/drivers/net/tun.c >> index b9973fb..60e44f2 100644 >> --- a/drivers/net/tun.c >> +++ b/drivers/net/tun.c >> @@ -1286,6 +1286,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, >> buflen += SKB_DATA_ALIGN(len + pad); >> rcu_read_unlock(); >> >> + alloc_frag->offset = ALIGN((u64)alloc_frag->offset, TUN_RX_PAD); > You have to align to one cache line (SMP_CACHE_BYTES), or SKB_DATA_ALIGN(1) Oh right. > Then eventually use skb_reserve() for NET_IP_ALIGN, but I guess it is > already done. Yes. Thanks