Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3305908imu; Sun, 11 Nov 2018 12:02:14 -0800 (PST) X-Google-Smtp-Source: AJdET5dqyoZudyI9ivAbxy67JyS3wvdBQ6yxBKGb7hhgiSlUawdV8xhbRd1/AeQW8HbXpqtiJz+4 X-Received: by 2002:a62:14d4:: with SMTP id 203-v6mr17201369pfu.221.1541966534435; Sun, 11 Nov 2018 12:02:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966534; cv=none; d=google.com; s=arc-20160816; b=aI+S89g7Be61qXecP05Algwzp7vqutG4V7IJIB/EsH9xWEtJM1N90d9BvYdhG52A/t 1VuU5AMAPRNJfjf2azr99VQPbnv1ZVI+ODOqLKszDYeOpdMFIozxUTlV7lgweysWb7MO ntojXrK3dark+6a04EDRJ9p5ipjGmQR3ao5/9111kjONcgejC25fKGUOnHyiM2QmcmH3 t9sKh8VINMtaBxinJghSGTGsiJZqtmDKdHjw9rZLKi8ftwNPI75cFqbgZj1mENHhwIZ+ /FdxziO4GvlY2CeulbGahQd5lQA9dmHxb1SkhDUprULNkGQagwQJyKg3EwDu9fqPfN0d Grog== 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; bh=+vYlW24TyC2nI352pJYmFh3sGCuFh3pJQ3IuK6rOgxA=; b=JziwNcqWkF5n3iJ8hixUaT6j7nwXYdZWO0DDQdo1+B3LjaUBMD1lFzAK6j1pw4E8Pd jyaSQ0cxfaCftWY/TFmcDUt+aFfFMFtyqr+t+3KmOoAxoZtccVH8MnNn++c0setOKaxB mRGdZKvWlNilPsk0OP3OXv6Dw59SrdIkKREHDEs5b2gcdfL0JVVPJLM4nFPM2pGkMfce PlnYEf1RgQkA91NuysK390C+Aidc4n/a6UN/EV9nIUR/W5EjwvBWEgeJ5sUJVa2lZKYr 1Ad2UCGxuqZeE2nHsOPMPlZPEmDnN3UZf2zm6HBe6hB/Dq47n5bp/m6ec4u5+1iZmZo+ eAvA== 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 l11-v6si14176444pgm.102.2018.11.11.12.01.59; Sun, 11 Nov 2018 12:02:14 -0800 (PST) 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 S1730884AbeKLFsh (ORCPT + 99 others); Mon, 12 Nov 2018 00:48:37 -0500 Received: from mail-io1-f72.google.com ([209.85.166.72]:40575 "EHLO mail-io1-f72.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730859AbeKLFsg (ORCPT ); Mon, 12 Nov 2018 00:48:36 -0500 Received: by mail-io1-f72.google.com with SMTP id r14-v6so7978408ioc.7 for ; Sun, 11 Nov 2018 11:59:08 -0800 (PST) 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=+vYlW24TyC2nI352pJYmFh3sGCuFh3pJQ3IuK6rOgxA=; b=BgrQECZat8Vn0FCe1q2YFyPVIkxFzW5WvlmgfO3Iv3ZFn5XyGJQktzRClidN+4H3Ec ixwQmpb7+dmtiVEu26hoEgOS6MeghxC7qs5LDOtOXCQQxDT8v2MVxs8pQWWLUenk1UvT jV8eBjk44UfzI1O0Wc850TRjfGVQNt+HJRLXK6++27rnyo+HW5zdT/7QbTJHTF5mgIOc vgyUTdPr/EdTufyOgmJMmNSO2Fasta2r7phtfwa8rm24wydlM1bQvABEGmbbxhBmRjmR w20XoaWSVImd45vbSDPklQZLwMK3yttaWT+arbK+tB6w9tF1PSgMgq4DxL9RkmNYAUzc EEmw== X-Gm-Message-State: AGRZ1gIR1FQrJnvmUlPw3CAWyMPWuC3TLuk2RJTDd4dNAhutiE03tO17 olepEJBfxQaQNucusd/BLM3gyBgItdxv/6f8gaKDVbBqUi14 MIME-Version: 1.0 X-Received: by 2002:a24:62c9:: with SMTP id d192-v6mr1830943itc.38.1541966347661; Sun, 11 Nov 2018 11:59:07 -0800 (PST) Date: Sun, 11 Nov 2018 11:59:07 -0800 In-Reply-To: X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <000000000000687eda057a6904e9@google.com> Subject: Re: [PATCH 3.16 213/366] vt: prevent leaking uninitialized data to userspace via /dev/vcs* From: syzbot To: Ben Hutchings Cc: akpm@linux-foundation.org, ben@decadent.org.uk, 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 > 3.16.61-rc1 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 > Signed-off-by: Greg Kroah-Hartman > Signed-off-by: Ben Hutchings > --- > 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.