Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3549887imm; Mon, 4 Jun 2018 05:36:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLXs0QQKSWAWfrMirIcZBFS5cbH+7y3eABmuddCP3Nu6/RbDPCuI499Tw4C4Odwds+MXLcR X-Received: by 2002:a17:902:1c7:: with SMTP id b65-v6mr21666765plb.298.1528115762692; Mon, 04 Jun 2018 05:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528115762; cv=none; d=google.com; s=arc-20160816; b=0l8RgAt1byg/okIHWMZcgyEUVfT6ZJH/Sh9qUh8KiHKaWLIRAgbE9hgJmIYlEwGRzF chtJBt00BvDGLgDaaZQHn5Df2NH4LsNh378ZhFfjz4zKsZAmL4WhzDiZ4dB5q093UAK3 deYIZvBTnt4nrbQNMZqo0oh74FVKvIAf8nwtY/5vEVTdc3u1bMzunddF9rmZQcOCkK8j 4rBSNLOp3jTuJnhpvuEhJGCZJN+kiw5J7yU74jBm1GI6sovH75CPm0XWi4u+LiCktsY/ /s6HzKD9nX5bdFq1pCQTheSrUFW036RrWbkUj5lP2rwfsFqbv82bYzbzUMTt/fkTwNso sk0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=yPHjGrLZushKvNNQioB86DpHQZkLQwAIL8towJCF9h4=; b=Se3KcJ+e8DJBh+xSR06UbSS5B3JNn5FjrjfQwXOeRHU0uPS1zebRRHnpjj4cAzWURn LNOBw/3MGLXYAMVQ/R3WQQY5lyTRTGccTLsTEPzP/FHUkRSwwiMCqfYoDJsMCOLCqH/4 qWyiwlboPp4jAV67FOMks3ODlOOTV8XqrM9dOVt7WGFK0qHQ/8PCmogKX7qI3Jtdhi1f IIgctCFeDOiq7sRKvyo/dIc7ZPQTbwHcY5Arymw1TCeJZocoukqGBrfU+037yTMv0H9P z4mzaIcS03RL+J+gacnYgTdfKMihyN1TD/wumetOMO/JdTEW1tyhtZxoYwI6b3qBLAnh H/CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=o6GVGkOY; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x66-v6si16203023pgb.297.2018.06.04.05.35.47; Mon, 04 Jun 2018 05:36:02 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=o6GVGkOY; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752518AbeFDMfQ (ORCPT + 99 others); Mon, 4 Jun 2018 08:35:16 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:45886 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752399AbeFDMfN (ORCPT ); Mon, 4 Jun 2018 08:35:13 -0400 Received: by mail-pf0-f193.google.com with SMTP id a22-v6so2738977pfo.12 for ; Mon, 04 Jun 2018 05:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yPHjGrLZushKvNNQioB86DpHQZkLQwAIL8towJCF9h4=; b=o6GVGkOYXq7uyv0hkikTGmwtopIr8F86ysrF+Ax6bMLotDAkI/hn2/BxFzO3svWZta pq8+bIi/IOtaLB7IPgSDdKoHHpYzfc59DciQ+MfGkGqaXXdM4KAK+Jitb7GsrRmZTtpV pTmkE++HpCGIZJlp+woEQaBsskmA+Usw8+U5nC8Rr1T4YNmkSXzUMGeu47cH1k1pLWYY gXjBGB9sSMJhRKUhE/zI0MnICcfdYRgSysOsQ/whoL4CcZuy0b25p748p8iMwTuypin9 o6hEIVq2i4IKBeNF/MjD5XY2NthsdHSX6L1kuXPSGLaTd2T/1U9tNXhRUpii7irSxhJr Usdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yPHjGrLZushKvNNQioB86DpHQZkLQwAIL8towJCF9h4=; b=CQCuvXtafnU2tbFWYo5vRCZnkCuzF3aHILtvNHc1fjGSyDtC6aj0VmNLwtLC1ozr6r OVEMilJ3gfxpRPGP6WMbs8B+ew4yGV4pT5UJEeeYyARvj3NIESEp2u7qr0xrJw/6LfRs sTewgPd0o1aR41NvPafXWz8tw/GWnBcm9jkYzcQjGkiWvOGR6nCkgRs4VnvMTCp3W92R /88oHgiE8j1EamVRYdlnlyyLb1CV6eiT0bU4zIVsT5NzeSVu5jFiSOAGCydm4jj1ctld yQsVgAbTMk1aaunA2gzp7XKlKKNzni1xgnadYDDtFNGGGvgOTXe7nrByyFEmx5OQrz1U CebA== X-Gm-Message-State: ALKqPwc7Kzb/7weCwt/ivRnC8KSk9dV6k8IcxC+hvzAszA2kx2e8XLXQ 4o777lU/jbGAO/DSedxN98v/QUgjHvyIBAIfEPhYhg== X-Received: by 2002:a62:9652:: with SMTP id c79-v6mr21337147pfe.114.1528115713202; Mon, 04 Jun 2018 05:35:13 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:d01:0:0:0:0 with HTTP; Mon, 4 Jun 2018 05:34:52 -0700 (PDT) In-Reply-To: <20180530055704-mutt-send-email-mst@kernel.org> References: <20180427154502.GA22544@la.guarana.org> <20180529221908.GA22742@roeck-us.net> <20180530055704-mutt-send-email-mst@kernel.org> From: Dmitry Vyukov Date: Mon, 4 Jun 2018 14:34:52 +0200 Message-ID: Subject: Re: [net] vhost: Use kzalloc() to allocate vhost_msg_node To: "Michael S. Tsirkin" Cc: Guenter Roeck , Kevin Easton , Jason Wang , KVM list , virtualization@lists.linux-foundation.org, netdev , LKML , syzkaller-bugs Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 30, 2018 at 5:01 AM, Michael S. Tsirkin wrote: > On Tue, May 29, 2018 at 03:19:08PM -0700, Guenter Roeck 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 >> >> Is this patch going anywhere ? >> >> The patch fixes CVE-2018-1118. It would be useful to understand if and when >> this problem is going to be fixed. >> >> Thanks, >> Guenter >> > --- >> > 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; > > As I pointed out, we don't need to init the whole structure. The proper > fix is thus (I think) below. > > Could you use your testing infrastructure to confirm this fixes the issue? Hi Michael, syzbot is self-service, see: https://github.com/google/syzkaller/blob/master/docs/syzbot.md#testing-patches > Thanks! > > Signed-off-by: Michael S. Tsirkin > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > index f3bd8e941224..58d9aec90afb 100644 > --- a/drivers/vhost/vhost.c > +++ b/drivers/vhost/vhost.c > @@ -2342,6 +2342,9 @@ struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type) > struct vhost_msg_node *node = kmalloc(sizeof *node, GFP_KERNEL); > if (!node) > return NULL; > + > + /* Make sure all padding within the structure is initialized. */ > + memset(&node->msg, 0, sizeof node->msg); > node->vq = vq; > node->msg.type = type; > return node; > > -- > You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group. > To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/20180530055704-mutt-send-email-mst%40kernel.org. > For more options, visit https://groups.google.com/d/optout.