Received: by 10.192.165.148 with SMTP id m20csp4028083imm; Tue, 8 May 2018 01:28:16 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr8gP4ui8uyyjZwd9m5XKWXvNvDMB+7xDNXLim2DUMzbMdCOZjRrh9MkgXDdG5I7CC0kz/n X-Received: by 2002:a63:5f14:: with SMTP id t20-v6mr792756pgb.246.1525768096911; Tue, 08 May 2018 01:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525768096; cv=none; d=google.com; s=arc-20160816; b=Mk5rBPJc5WDUpe60LvQWLxvrNvZTFUUL4rfx+TyQDB13OwOXZis82guomI226JQvTF hMHBAblrSPT4d+a4Zj2qcw6pmK3/Yppr5OxJKeGraVjdIcCCsKUHfQNsqap+ARqoNkCC JFKAg0fMrbOzg3HOAeg/e7/KyFBYG8Isko25JPnhiCW8BXw6Tv3yRfJCx69cKY3/wZHO YOJNrwrj9V/1pNvULg9MD0hMHppWITDNWW+haz7MPsLDBOwbf51zXpI1Y3EibSr50GYQ aP5QpMddhrPmzK15yLoT7sWttMm1QkaIbx1tisssGNE87LCSs/xcnRpCuC78Y60z7RjZ zt4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=VEhhDI1uqv6uhhUggY64edXwLFrGdU8kw9sSqDiyR0k=; b=UgkISSt1TRVNG2trw3N2QJjKGjc1OgS5nRRHu9p6/LMuBHK3+HPPWRb3WdpkKDjlNj bu7rSrw9WBmnTu/gR9WU5alo00b/vSezzyBxFA6dSBslQ3ZW8jQC03Fk8hv3AU34tdWq +e8B/OF7L8dD7trbDDTw5kqZBUQ1GkwVLGNZXHRubXz7UQ87HvLrayWKc+eAfspiYBI8 bRLNYZtzS7v9V0/RMzWZb7IIviof2adhTit0BCqDriK3KBezxCDoyWTBxVBQaZcRshNI OyBRPv8viARKeFuZObjPiJIu38faokT+0mUt6udKtI/UDAR6Ixctl6tbj1RpW0KIdoQj IMtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a34-v6si15872565pld.281.2018.05.08.01.28.02; Tue, 08 May 2018 01:28:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932977AbeEHI1T (ORCPT + 99 others); Tue, 8 May 2018 04:27:19 -0400 Received: from la.guarana.org ([173.254.219.205]:41314 "EHLO la.guarana.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754816AbeEHI1R (ORCPT ); Tue, 8 May 2018 04:27:17 -0400 Received: by la.guarana.org (Postfix, from userid 1006) id B7A8A346238C; Tue, 8 May 2018 04:27:16 -0400 (EDT) Date: Tue, 8 May 2018 04:27:16 -0400 From: Kevin Easton To: "Michael S. Tsirkin" Cc: Jason Wang , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH net] vhost: Use kzalloc() to allocate vhost_msg_node Message-ID: <20180508082716.GA21344@la.guarana.org> References: <000000000000a5b2b1056a86e98c@google.com> <20180427154502.GA22544@la.guarana.org> <20180507155534-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180507155534-mutt-send-email-mst@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 07, 2018 at 04:03:25PM +0300, Michael S. Tsirkin wrote: > On Fri, Apr 27, 2018 at 11:45:02AM -0400, Kevin Easton wrote: > > The struct vhost_msg within struct vhost_msg_node is copied to userspace, > > so it should be allocated with kzalloc() to ensure all structure padding > > is zeroed. > > > > Signed-off-by: Kevin Easton > > Reported-by: syzbot+87cfa083e727a224754b@syzkaller.appspotmail.com > > --- > > drivers/vhost/vhost.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > > index f3bd8e9..1b84dcff 100644 > > --- a/drivers/vhost/vhost.c > > +++ b/drivers/vhost/vhost.c > > @@ -2339,7 +2339,7 @@ EXPORT_SYMBOL_GPL(vhost_disable_notify); > > /* Create a new message. */ > > struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type) > > { > > - struct vhost_msg_node *node = kmalloc(sizeof *node, GFP_KERNEL); > > + struct vhost_msg_node *node = kzalloc(sizeof *node, GFP_KERNEL); > > if (!node) > > return NULL; > > node->vq = vq; > > > Let's just init the msg though. > > OK it seems this is the best we can do for now, > we need a new feature bit to fix it for 32 bit > userspace on 64 bit kernels. > > Does the following help? Yes, the reproducer doesn't trigger the error with that patch applied. - Kevin