Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1414497imm; Thu, 5 Jul 2018 22:58:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe21qdECXTTg54YQv90Co0pZwNBgMtnUdfCuiDLnmebH0cOJ7JmYPROa5lDUya/TUQvPzv/ X-Received: by 2002:a62:6882:: with SMTP id d124-v6mr9286103pfc.122.1530856694282; Thu, 05 Jul 2018 22:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856694; cv=none; d=google.com; s=arc-20160816; b=wBMWE4vIZHAWDCnARH5JNV0qQfz0mHQYbIq+C7oxoG/IF1zma0p2lBPsTqN3cz1cci q3f2yTKA8AuLjra7pTGt4G0ITeTpwaq05w+UEPN8w2Q0tj9YP/x7fzbM8zSb9Q/8MQUF 6/5x9s0U5Hl+qQl/7vrg/Y3zHAVaaP4Kf8C39PgR0ZSlmepo/JovPGu5yM8+//RK3Q+s /aPSJ2YnQsGpD1qYP97ER+puwpPXnW62G0D5QR7hqeM1q/aismMS0/TtLB2o+1Xt6EMP ymCVhLFCQnsz03/aw3f18sTdSkX6dVyF9+zjCZTwf0eZsitYJpKaDl2qff+PyKuN8fI/ Tvqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:message-id:in-reply-to :date:mime-version:arc-authentication-results; bh=Kp03BeH08piz6rq0XChk5RJvZ2TDqqADHS50PGDx7VQ=; b=XgQqFOS6OQe0iJczR5VcBuhAxmoy9XGT2gmD//GhbxPSYFqMElED0u6NNfqIy5M4mF 1bH8HjInLjLmD1i/RBO+VIG0ulWNNEXTxdgdj456dx20npqd+OCnvJvRCaneGgrNC/Vd fBFcs2vK9I2Fx+Sp2eJMOrAikOO99/C+LAPMcoShMylPl4Wo7GqQwp7kLw8TGu4u+oJz 92fhXiRfRnIj90I97Sn9wqtwe01xk3aTROXCWOtNcpCEIUp9swbyViDRKp4DjalYIeGm +fW02p/J1NQEQWMsAt53ZRvz7+YQiY5M5zL7f+lZh9QvvFJoZAiNiU+BHmpStcORj+Ok wdsQ== 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=appspotmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65-v6si7640768pfd.73.2018.07.05.22.58.00; Thu, 05 Jul 2018 22:58:14 -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=appspotmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933779AbeGFFzd (ORCPT + 99 others); Fri, 6 Jul 2018 01:55:33 -0400 Received: from mail-it0-f69.google.com ([209.85.214.69]:40882 "EHLO mail-it0-f69.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934504AbeGFFwF (ORCPT ); Fri, 6 Jul 2018 01:52:05 -0400 Received: by mail-it0-f69.google.com with SMTP id l82-v6so7550450ita.5 for ; Thu, 05 Jul 2018 22:52:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id:subject :from:to:cc; bh=Kp03BeH08piz6rq0XChk5RJvZ2TDqqADHS50PGDx7VQ=; b=VDvyhCyDKzjnGX5CYMzb71vgEZR8BQN/NqdV1yAl6lSCU2i8C2J6whRpWu3t4ONQ1l kvM0VRbpGi0CqZViw/l6xU1Dc8y3rf5ykHZFB+7WKrjArjisa9x+CkXvkL7gOdGrkYFY iUL5k2A9Fc157rZyEbs86nJo4WZEcDKy6PiQ1k/+sjPGZ4Zw+i6Sv/XXIwPUA1qe6w3D e874A7XyapoZOiAafl93ax1Lzi0T1A9RxFcDDHOXfEzRD+kAvfLQ8l4YXQu5eqqzi+kT ZS4GkTyBgzGDDl3t+Z0sTIMFf1hUWpGByqZSm/mT7Xglg1XVDPTf9FOmjG5ZHfsptdlJ AcYQ== X-Gm-Message-State: APt69E0pF08dt1f6xDUerUqrNp+EA8PlbOkXzwD5K0N5zsaws3vqu6Y3 tkZFMgSdgCRLonFVPljhktNE3fDQma8Ql9gcbw7Jth+afDFv MIME-Version: 1.0 X-Received: by 2002:a6b:1ac9:: with SMTP id a192-v6mr1528065ioa.98.1530856324916; Thu, 05 Jul 2018 22:52:04 -0700 (PDT) Date: Thu, 05 Jul 2018 22:52:04 -0700 In-Reply-To: <20180706054712.883804664@linuxfoundation.org> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <00000000000072ed1305704e434e@google.com> Subject: Re: [PATCH 4.14 14/61] vt: prevent leaking uninitialized data to userspace via /dev/vcs* From: syzbot To: Greg Kroah-Hartman Cc: glider@google.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 4.14-stable review patch. If anyone has any objections, please let me > know. > ------------------ > From: Alexander Potapenko > commit 21eff69aaaa0e766ca0ce445b477698dc6a9f55a upstream. > KMSAN reported an infoleak when reading from /dev/vcs*: > BUG: KMSAN: kernel-infoleak in vcs_read+0x18ba/0x1cc0 > Call Trace: > ... > kmsan_copy_to_user+0x7a/0x160 mm/kmsan/kmsan.c:1253 > copy_to_user ./include/linux/uaccess.h:184 > vcs_read+0x18ba/0x1cc0 drivers/tty/vt/vc_screen.c:352 > __vfs_read+0x1b2/0x9d0 fs/read_write.c:416 > vfs_read+0x36c/0x6b0 fs/read_write.c:452 > ... > Uninit was created at: > kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279 > kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:189 > kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:315 > __kmalloc+0x13a/0x350 mm/slub.c:3818 > kmalloc ./include/linux/slab.h:517 > vc_allocate+0x438/0x800 drivers/tty/vt/vt.c:787 > con_install+0x8c/0x640 drivers/tty/vt/vt.c:2880 > tty_driver_install_tty drivers/tty/tty_io.c:1224 > tty_init_dev+0x1b5/0x1020 drivers/tty/tty_io.c:1324 > tty_open_by_driver drivers/tty/tty_io.c:1959 > tty_open+0x17b4/0x2ed0 drivers/tty/tty_io.c:2007 > chrdev_open+0xc25/0xd90 fs/char_dev.c:417 > do_dentry_open+0xccc/0x1440 fs/open.c:794 > vfs_open+0x1b6/0x2f0 fs/open.c:908 > ... > Bytes 0-79 of 240 are uninitialized > Consistently allocating |vc_screenbuf| with kzalloc() fixes the problem > Reported-by: syzbot+17a8efdf800000@syzkaller.appspotmail.com > Signed-off-by: Alexander Potapenko > Cc: stable > Signed-off-by: Greg Kroah-Hartman > --- > drivers/tty/vt/vt.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > --- a/drivers/tty/vt/vt.c > +++ b/drivers/tty/vt/vt.c > @@ -782,7 +782,7 @@ int vc_allocate(unsigned int currcons) / > if (!*vc->vc_uni_pagedir_loc) > con_set_default_unimap(vc); > - vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL); > + vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL); > if (!vc->vc_screenbuf) > goto err_free; > @@ -869,7 +869,7 @@ static int vc_do_resize(struct tty_struc > if (new_screen_size > (4 << 20)) > return -EINVAL; > - newscreen = kmalloc(new_screen_size, GFP_USER); > + newscreen = kzalloc(new_screen_size, GFP_USER); > if (!newscreen) > return -ENOMEM; Can't find the corresponding bug.