Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2719571ybv; Mon, 24 Feb 2020 10:15:54 -0800 (PST) X-Google-Smtp-Source: APXvYqzRiGG6FqZaWK0T2k6ipJUmsl+HnXGrwavHc5zv/mANKObGwu8O+txUOZqXjmZzBCSffDOJ X-Received: by 2002:a54:4091:: with SMTP id i17mr273505oii.99.1582568154022; Mon, 24 Feb 2020 10:15:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582568154; cv=none; d=google.com; s=arc-20160816; b=zdcH3eyb36Fy+QvJnEeH2CJE9pzOeRTfOZgilauWize3WBHA/K9abrmgqGrp6/ADZO CQ4e5aurJqVPGfLVkmJ/2KO68RD3CV2XiSRz7NF5ON/IHLkwuuvSEItW1XcebPnWxjzf DlSTzMh6AcModzYJ4aZwWQgD3w3BvLen7yxIw4kbbnHOXodlrDRpvwBj8YalF5NXNPMw S9b/iab1ibb3ncgUxCxgSPs2GdlCvQkkfd3Inn0/xx9QUErGVVeoqjFKP5LbUh8OWTGI rJLcVgvCn55p3gN9OiOUC6yjhD8xx3e8hw+xFNIBrkxF7NVUPfUSxNCq6a3LfhUSEwZ/ MDnQ== 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:dkim-signature; bh=jmFBf1vo/qwJPrNFPFUvHNgiYrzvMPlwNVPcTu2Nu5E=; b=ocLBvXf/2Efc56KhHXlek1WwsU7mlqWqPbFwTpff4g/AaX0v3I7u7ctmkp7zmFIgKF D0qlUdDyLATh/vqRZSKPtIQUSaGwbtm3rvIgmeSzbG65hjaWefSU5bp4fKZtlrFqQj58 5LStvF0crYPAxwrt4aR615RGOaMQ3ty6b+glwd63fLP3MbkHJVBhVVsSA3J/bn4w6IfW m478SEB+VZTZloHDr3d/N2eAPM0oZrAT3dNaYAVB2Kd9R4uiitUahtpmqg/KiCf1VIhk rsqk8an413RjkfHtOwuIBEv0niDNcItaJ0OAwtVOyCcxdi/maVd0ydwgBVQwUSs5jYCc jung== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="SpDWs/dE"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12si6407084otq.156.2020.02.24.10.15.41; Mon, 24 Feb 2020 10:15:54 -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; dkim=pass header.i=@kernel.org header.s=default header.b="SpDWs/dE"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727711AbgBXSPf (ORCPT + 99 others); Mon, 24 Feb 2020 13:15:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:56424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726208AbgBXSPf (ORCPT ); Mon, 24 Feb 2020 13:15:35 -0500 Received: from gmail.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6529620732; Mon, 24 Feb 2020 18:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582568134; bh=t/2K0XLnJvtS4TWQEXZ1LFWhbvFI+cAOsWJ66Zfp0CU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SpDWs/dE5mPhFZ0jUnGbPTs6U6yinPlR+T5X+uvzrFRuhNd9jCVfE1c6GLVCUEFYP wTJ/jNRwy3jLwCZ2Bs2t1S6ZK6nX1QPg0FRZxc+7jaIdx5uEmdNnyvdNzFE/7dyvv7 cZHlQro4RycFa3pgfowrM4xAKKex8hetRW7rfDcQ= Date: Mon, 24 Feb 2020 10:15:32 -0800 From: Eric Biggers To: Jiri Slaby Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Al Viro Subject: Re: [PATCH] tty: fix compat TIOCGSERIAL leaking uninitialized memory Message-ID: <20200224181532.GA109047@gmail.com> References: <000000000000387920059f4e0351@google.com> <20200224083838.306381-1-ebiggers@kernel.org> <1edbbced-58c1-7674-2d01-6a807ddf5968@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1edbbced-58c1-7674-2d01-6a807ddf5968@suse.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 24, 2020 at 09:47:26AM +0100, Jiri Slaby wrote: > On 24. 02. 20, 9:38, Eric Biggers wrote: > > From: Eric Biggers > > > > Commit 77654350306a ("take compat TIOC[SG]SERIAL treatment into > > tty_compat_ioctl()") changed the compat version of TIOCGSERIAL to start > > copying a whole struct to userspace rather than individual fields, but > > failed to initialize all padding and fields -- namely the hole after the > > 'iomem_reg_shift' field, and the 'reserved' field. > > > > Fix this by initializing the struct to zero. > > > > Reported-by: syzbot+8da9175e28eadcb203ce@syzkaller.appspotmail.com > > Fixes: 77654350306a ("take compat TIOC[SG]SERIAL treatment into tty_compat_ioctl()") > > Cc: # v4.20+ > > Signed-off-by: Eric Biggers > > --- > > drivers/tty/tty_io.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c > > index 1fcf7ad83dfa0..d24c250312edf 100644 > > --- a/drivers/tty/tty_io.c > > +++ b/drivers/tty/tty_io.c > > @@ -2731,6 +2731,7 @@ static int compat_tty_tiocgserial(struct tty_struct *tty, > > struct serial_struct v; > > int err; > > memset(&v, 0, sizeof(struct serial_struct)); > > + memset(&v32, 0, sizeof(struct serial_struct32)); > > sizeof(v32) please. > Sure, I was trying to be consistent with the other line, but I'll just change them both to sizeof. - Eric