Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2526327imm; Thu, 7 Jun 2018 12:08:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIbm0bAJfqLcpUznHiKP1QBVkAnyyMbWASVtRBVwgcNoUTwK5cmVcPsq4UMwxlJEbVIMo/S X-Received: by 2002:a17:902:b60c:: with SMTP id b12-v6mr3361110pls.44.1528398504002; Thu, 07 Jun 2018 12:08:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528398503; cv=none; d=google.com; s=arc-20160816; b=ClxrORlDQKAS8Y3e6KB4k5RYTKoPfvU54Uamyz1GTnZkkbFX+j1O0py9c4dOOuRGQH ns+ZFB8dfS7AeYF2CmEX/hrJQUBp3Zrfx3RMznt099wYcVGumxoucJw2MTAHEiGcVX4g bkGHFGW9nXh32A4yi6GnDbowXXMpirUdL81EdcVW0DPMcOOjQzHG6ILXw+2Vkha5oXyD u1uKZNOa5j6OAH1iwstL5IoQmSJCMgIisPsTsjh4Z073Leg988mVajbAhOojdoxZbwxY xY8md8kyaJG7wK6yTwQxREiZvMXWagJ8fPQwz2FtseVALa3KUjMKgWHgMv1VUlCacr7u w9ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=4oUynEmjHBahZRf8u4cRWTnI2FFsYNZpuVtdJrq169M=; b=hKYZTUOXMI69Pv0TdHBbugEBCS37qJ1eODUiLIHDrUBs4n2JOvEqEtWa4rI5lA8vZD qXIprYb/WmKQDv9byBJDc0ShEQtTOyAXv2kFxuZVjpkDro1U8PE5FfxfkTyzwFiT1KqF G1rrUL8JHqtMLdk9FmfEuN5pq84XqxI7yPOL8G1wXCOXd+gv/01cVumo1wH/JbxE4WFS grqeaehpn23AoTRZMaRg/yZNsag/YSYi0R7Yxl18WqxJyO3V5vRuPTRUsUBS27tPoMh7 KoCSM2sztmaEVaJQwxloJT8elyUyDp7+0jz15XE2ri5DP3ypch3iX4wUsCeXVWyTPL+4 dMow== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4-v6si16000141plt.590.2018.06.07.12.08.09; Thu, 07 Jun 2018 12:08:23 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935978AbeFGR7K (ORCPT + 99 others); Thu, 7 Jun 2018 13:59:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37106 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935049AbeFGR7I (ORCPT ); Thu, 7 Jun 2018 13:59:08 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 20943401EF1B; Thu, 7 Jun 2018 17:59:08 +0000 (UTC) Received: from redhat.com (ovpn-120-226.rdu2.redhat.com [10.10.120.226]) by smtp.corp.redhat.com (Postfix) with SMTP id D12E91C703; Thu, 7 Jun 2018 17:59:06 +0000 (UTC) Date: Thu, 7 Jun 2018 20:59:06 +0300 From: "Michael S. Tsirkin" To: Al Viro Cc: syzbot , avagin@openvz.org, davem@davemloft.net, dingtianhong@huawei.com, edumazet@google.com, elena.reshetova@intel.com, jasowang@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, matthew@mjdsystems.ca, mingo@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, syzkaller-bugs@googlegroups.com, virtualization@lists.linux-foundation.org, willemb@google.com Subject: Re: KMSAN: uninit-value in _copy_to_iter (2) Message-ID: <20180607205611-mutt-send-email-mst@kernel.org> References: <000000000000a5b2b1056a86e98c@google.com> <000000000000cf4578056ab12452@google.com> <20180607183627-mutt-send-email-mst@kernel.org> <20180607174355.GR30522@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180607174355.GR30522@ZenIV.linux.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 07 Jun 2018 17:59:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 07 Jun 2018 17:59:08 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 07, 2018 at 06:43:55PM +0100, Al Viro wrote: > On Thu, Jun 07, 2018 at 06:38:48PM +0300, Michael S. Tsirkin wrote: > > #syz test: https://github.com/google/kmsan.git/master d2d741e5d1898dfde1a75ea3d29a9a3e2edf0617 > > > > Subject: vhost: fix info leak > > > > Fixes: CVE-2018-1118 > > Signed-off-by: Michael S. Tsirkin > > --- > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > > index f0be5f35ab28..9beefa6ed1ce 100644 > > --- a/drivers/vhost/vhost.c > > +++ b/drivers/vhost/vhost.c > > @@ -2345,6 +2345,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); > > Umm... Maybe kzalloc(), then? You have > > struct vhost_msg_node { > struct vhost_msg msg; > struct vhost_virtqueue *vq; > struct list_head node; > }; > > and that's what, 68 bytes in msg, then either 4 bytes pointer or > 4 bytes padding + 8 bytes pointer, then two pointers? How much > does explicit partial memset() save you here? Yes but 0 isn't a nop here so if this struct is used without a sensible initialization, it will crash elsewhere. I prefer KASAN to catch such uses. > > node->vq = vq; > > node->msg.type = type; > > return node;