Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp815534rwl; Fri, 24 Mar 2023 02:17:44 -0700 (PDT) X-Google-Smtp-Source: AKy350aJhPa755Kfi5ULu9f92p4Yg6P7RwHnaq6Nca/z+9PLIosmIxA1mmm47ejch3WnsTrtaKrw X-Received: by 2002:a17:906:fc1e:b0:92b:f3c3:7c5f with SMTP id ov30-20020a170906fc1e00b0092bf3c37c5fmr1960956ejb.53.1679649463998; Fri, 24 Mar 2023 02:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679649463; cv=none; d=google.com; s=arc-20160816; b=Y9wLZQX52iBcfx2786A+qlQAhqzy2DDQfwRwdAsO8jWPNj8VmcRrfBGdDpYyIs+OzX JuZxS6Rgjp0S7hNLm2VV36ZhCbfNDoW+hPWcSKVGbSDYsZOaCpiP/7zC/Q75waf4GzaK QlMdgLFZ26Nq+XVNKcUTdF/rZJTgsPe+14AR5V5uHCRdu3hsRqgtqO+RLJZsh+1f1ZFY h9ZtfrJHj1B2CJxdCEPm4O4I/Dlr/A3sy84VTWSniaz93dTlcRR2941Y7QZvvSXHX7Wr 20QKhTY+fBL7Nh68OpkOtMURDDGl0HFUUnX8KrCLqD/jSPjgICP3vclfeZLYoZcy/NaL hXeQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QVH2oh9fpzLQkJXdwpUJ4533V1wJBPoDSclzcYbqRDs=; b=vdyobuz8GTQsKly/O+M0uzCh6zRBlowxb0o3FHnaR1vACBkKlzYOpVtbQHi6+RcCvG Cwz39JJOYeIrDnk/yLRPxHBuXezPa/UWiVbEbIF5uNoVz5zb5Wld1LIYcsEIIeUMZ8q4 dl30pcDFkXHZJwX5/8nMRnDAsbsJilUkwACfaSe4eK0CcKd+XZKIAI6OFXV7/+L9oWmb iknWZaCSFykMVwW8zJEAvPHBHAD/E1hq3P7bLUkvCtmUGrbsLbIWQtWcZB8dQ/Vt9tse qSczzADFOrfZKIa3Ahtmx/t7yBjqmFiRHtH1CyYNg1VNqfas59lpDwhcSxO95QcvaoTH SRBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JcfmRJa7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a17090648c200b0093a15738c2bsi9285988ejt.25.2023.03.24.02.17.20; Fri, 24 Mar 2023 02:17:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JcfmRJa7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231952AbjCXJHP (ORCPT + 99 others); Fri, 24 Mar 2023 05:07:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231872AbjCXJHL (ORCPT ); Fri, 24 Mar 2023 05:07:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCC7A13DF2 for ; Fri, 24 Mar 2023 02:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679648787; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QVH2oh9fpzLQkJXdwpUJ4533V1wJBPoDSclzcYbqRDs=; b=JcfmRJa7JAl5IOGs2Fi9/qCxnQQ19wBLpDhTmjjKU5JTespDVA6uTxkURoa2+8HWbmc+4x UhnF91etkOQqfB9UFp0awr9/BIlosexl1ChfIAqR1nAL/x594wG0KkgL8CtulEb0SIoifp MusLvpxQAtKIVpDurxRRwy5vE4ucgQY= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-232-B6swCce_MkeVGTozWnVGfQ-1; Fri, 24 Mar 2023 05:06:25 -0400 X-MC-Unique: B6swCce_MkeVGTozWnVGfQ-1 Received: by mail-ed1-f71.google.com with SMTP id es16-20020a056402381000b004fa3e04c882so2252048edb.10 for ; Fri, 24 Mar 2023 02:06:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679648784; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QVH2oh9fpzLQkJXdwpUJ4533V1wJBPoDSclzcYbqRDs=; b=SJakHxlwydxv4OIDRUO0tMZR3W9t/7C3a4GOQtPW6O60YgL/osZ6a0etIfPHfqTjJm 2MJ8bR+QFhHRTc5/dy//CdVGacQlnmRnGY770BesCLCTKgl91CMxV6wMOKaEpo+hwwTr BoaBlDB1WdVjmmUbWhVj+IbuWFhhjZDhYVI1tF/czwSUZh6PNhD/e7FWLBBa9RiRZkXV BNEtrsZid0qpW+JWz6WkbthryT2YqzOFeImGwa1bijTGwYaNH19nHvtCLJ1b6YsO5G76 1TsapzB4W+m2fA792/Ep5htCQASf9nQuFGb0nyNCi4XMQC5ViBuw5EYi+tiStVnXRiYB H8hA== X-Gm-Message-State: AAQBX9f5biNLLCcxHSpIt8klKzm9EYT1extYWX+VNz/lNfZodTc2D0vl 27qIwpHd5Cqca456kCL5DhkwmZ7sFHZW8pjh/nFYO8w6LVX5Y9xDwn48U0L8PbQxkJ5WBGllt/7 nwWaCrGm0xArq6Y70LTTC2JLy X-Received: by 2002:a17:906:fb08:b0:8b1:2d0e:281 with SMTP id lz8-20020a170906fb0800b008b12d0e0281mr2290904ejb.18.1679648784739; Fri, 24 Mar 2023 02:06:24 -0700 (PDT) X-Received: by 2002:a17:906:fb08:b0:8b1:2d0e:281 with SMTP id lz8-20020a170906fb0800b008b12d0e0281mr2290873ejb.18.1679648784448; Fri, 24 Mar 2023 02:06:24 -0700 (PDT) Received: from sgarzare-redhat (host-82-53-134-98.retail.telecomitalia.it. [82.53.134.98]) by smtp.gmail.com with ESMTPSA id g8-20020a1709061e0800b0093bd173baa6sm3300977ejj.202.2023.03.24.02.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 02:06:23 -0700 (PDT) Date: Fri, 24 Mar 2023 10:06:21 +0100 From: Stefano Garzarella To: syzbot , Bobby Eshleman , Bobby Eshleman Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, stefanha@redhat.com, syzkaller-bugs@googlegroups.com, virtualization@lists.linux-foundation.org, Krasnov Arseniy , Krasnov Arseniy Vladimirovich Subject: Re: [syzbot] [kvm?] [net?] [virt?] general protection fault in virtio_transport_purge_skbs Message-ID: References: <000000000000708b1005f79acf5c@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 24, 2023 at 9:55 AM Stefano Garzarella wrote: > > On Fri, Mar 24, 2023 at 9:31 AM Stefano Garzarella wrote: > > > > Hi Bobby, > > can you take a look at this report? > > > > It seems related to the changes we made to support skbuff. > > Could it be a problem of concurrent access to pkt_queue ? > > IIUC we should hold pkt_queue.lock when we call skb_queue_splice_init() > and remove pkt_list_lock. (or hold pkt_list_lock when calling > virtio_transport_purge_skbs, but pkt_list_lock seems useless now that > we use skbuff) > In the previous patch was missing a hunk, new one attached: #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fff5a5e7f528 --- a/net/vmw_vsock/vsock_loopback.c +++ b/net/vmw_vsock/vsock_loopback.c @@ -15,7 +15,6 @@ struct vsock_loopback { struct workqueue_struct *workqueue; - spinlock_t pkt_list_lock; /* protects pkt_list */ struct sk_buff_head pkt_queue; struct work_struct pkt_work; }; @@ -32,9 +31,7 @@ static int vsock_loopback_send_pkt(struct sk_buff *skb) struct vsock_loopback *vsock = &the_vsock_loopback; int len = skb->len; - spin_lock_bh(&vsock->pkt_list_lock); skb_queue_tail(&vsock->pkt_queue, skb); - spin_unlock_bh(&vsock->pkt_list_lock); queue_work(vsock->workqueue, &vsock->pkt_work); @@ -113,9 +110,9 @@ static void vsock_loopback_work(struct work_struct *work) skb_queue_head_init(&pkts); - spin_lock_bh(&vsock->pkt_list_lock); + spin_lock_bh(&vsock->pkt_queue.lock); skb_queue_splice_init(&vsock->pkt_queue, &pkts); - spin_unlock_bh(&vsock->pkt_list_lock); + spin_unlock_bh(&vsock->pkt_queue.lock); while ((skb = __skb_dequeue(&pkts))) { virtio_transport_deliver_tap_pkt(skb); @@ -132,7 +129,6 @@ static int __init vsock_loopback_init(void) if (!vsock->workqueue) return -ENOMEM; - spin_lock_init(&vsock->pkt_list_lock); skb_queue_head_init(&vsock->pkt_queue); INIT_WORK(&vsock->pkt_work, vsock_loopback_work); @@ -156,9 +152,7 @@ static void __exit vsock_loopback_exit(void) flush_work(&vsock->pkt_work); - spin_lock_bh(&vsock->pkt_list_lock); virtio_vsock_skb_queue_purge(&vsock->pkt_queue); - spin_unlock_bh(&vsock->pkt_list_lock); destroy_workqueue(vsock->workqueue); }