Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp691953ybg; Mon, 1 Jun 2020 11:49:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRiZU4dF+ORZcHF7V39DgR/KwVzkrxCOCBoYdQQMZC0TJXwoGb+esL9Z85gYf1HexIAZRK X-Received: by 2002:a50:fe94:: with SMTP id d20mr22139645edt.254.1591037354833; Mon, 01 Jun 2020 11:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591037354; cv=none; d=google.com; s=arc-20160816; b=VLzCphYJH8ibFmeKY+zRFNkIZopWTLOoQMBTjd6E5T4WCNaBNbgDSD2ftToYl4ryLn ABoQyttwSaTTQWtX8NsY58ns+gR95p5NjpHLqB0bTp7bTAa8cTTHJkWBRMoImRm4z/jb ogtkAbV6Dy+Pyin5NNcYkVxscddWHypikB2rJjon3nZ/WvDUzghPvyCP7uF405RhtyF5 5JbjMs/HuQVq/2D3OHJ36qYQcEIXfgMDQgWr1Tx+JtVP+0cp704qdppw2jSK6lpRKYd8 Pl6ebyFkiUh70MvdcHE1cFEDeFSvNpVp0D3ho0cC8yn6dBMY4VsEdWNIqKMfXDC6sCgA tQLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+M9Ij3QkjVV0+/qBxCEnjccvh6XLlkYI7KMP+6B+C8g=; b=Yh8iZLwjiWgsVw8FDxA0JEL40VnW/2CfnLWjR6+hmBqbimzi/xf3HCny6kOVidV/SP nVb+UenSoBr+0VAnf0gl3x77tvceUAV9OzZ36pk7hhNroiQbqAU5jZN0S0k7BVrtjC7+ LS4RBJ6nKkLHWyGoJneIM5Wo1PghyyZNfbcpOkUoDGsh1K4RwfN6u2ibCZipWdUlFdhR 7QSLIzZScDYBNRxMj2lFS280D9FPQLSRlnw28aW5HDmal61/L891O4tbi53NA06tj9VB oDVtrLeD83jqR43gLn6RnIKTZyq7+nsazgXfIAqWS40FuhwoeKxfqSqMCDwJtk9ayFBB 6Rlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n2nUqx0g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si197221ejo.321.2020.06.01.11.48.51; Mon, 01 Jun 2020 11:49:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n2nUqx0g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730777AbgFASpM (ORCPT + 99 others); Mon, 1 Jun 2020 14:45:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:56364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730459AbgFASJv (ORCPT ); Mon, 1 Jun 2020 14:09:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 538A42068D; Mon, 1 Jun 2020 18:09:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591034990; bh=PiFQg7pPmhc7HgkT58PSucyAyYM65EXKVRcjGMPYxeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n2nUqx0g+C00L95c/kall3IsOd7wRluH8XhfXvMCEcGs3o/yP5tHNTq/liXZfLueX BjgNJk+fweksQc5CTZX6rRSOMZ2ldlsHFaFmeTq923gvfDRen4WOCWqTo6rLPT9YJ2 3cJrNW/SMhq/s6/owmle3BisNO2uid2VIAwZTvDc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, sam , Alexander Potapenko , Andrew Morton , Kees Cook , Al Viro , Alexey Dobriyan , Linus Torvalds , Sasha Levin Subject: [PATCH 5.4 101/142] fs/binfmt_elf.c: allocate initialized memory in fill_thread_core_info() Date: Mon, 1 Jun 2020 19:54:19 +0200 Message-Id: <20200601174048.446359312@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174037.904070960@linuxfoundation.org> References: <20200601174037.904070960@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Potapenko [ Upstream commit 1d605416fb7175e1adf094251466caa52093b413 ] KMSAN reported uninitialized data being written to disk when dumping core. As a result, several kilobytes of kmalloc memory may be written to the core file and then read by a non-privileged user. Reported-by: sam Signed-off-by: Alexander Potapenko Signed-off-by: Andrew Morton Acked-by: Kees Cook Cc: Al Viro Cc: Alexey Dobriyan Cc: Link: http://lkml.kernel.org/r/20200419100848.63472-1-glider@google.com Link: https://github.com/google/kmsan/issues/76 Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/binfmt_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index c5642bcb6b46..7ce3cfd965d2 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1731,7 +1731,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, (!regset->active || regset->active(t->task, regset) > 0)) { int ret; size_t size = regset_size(t->task, regset); - void *data = kmalloc(size, GFP_KERNEL); + void *data = kzalloc(size, GFP_KERNEL); if (unlikely(!data)) return 0; ret = regset->get(t->task, regset, -- 2.25.1