Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2428927imj; Mon, 18 Feb 2019 05:57:53 -0800 (PST) X-Google-Smtp-Source: AHgI3IaVr5g5ggL1X44OGFTu/xd/NW1jWf6M8eM6jONiq2Mk6GDWd/FzF/j5tQ//4TPlluTBFljC X-Received: by 2002:a17:902:9a4a:: with SMTP id x10mr24601515plv.93.1550498273835; Mon, 18 Feb 2019 05:57:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550498273; cv=none; d=google.com; s=arc-20160816; b=oxwWVtScPzNza2oSlLfHzq0Ax7J8V8hTUsmcsyvLnXJ8QVNlpvBwXpGWImRAYeW4dr XhTo+3mwZE1DUNJ8NlOWKFCHHGTDy7jx+d9zGQvueLAIFlTvsVVUqGYvsrmrwf2/XO9x qI8clejwRt6XQqXBIFepiXO+JSPHiyXUt6Sol7P5Udia/dVELBeD0mWqSSWQyblGZkeL eLQiODX1+isb3NfBLW9WukwDJLKNZPq3lJplX+BhZdWjg3gcVRhCTAt14zPCW470o9Nl ekbc9JiALoc8YV0i1Er3m1qYXYTQeMbrO17oh+cpLyvRNdz3kJBCv7+TEq2Mp4cdyRkK Qbtg== 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=WfxQIH/qp4EYq7zCBgWdsfcTNfG4ZV+8YqjndzNYHu4=; b=xJIIsm47HQdif066eP9Gy0YIxm2fIkTTQvejlIbI49ecDxIId+IJmSW9ARbU6FtCY9 2+WLLhmyC87dh1j10XdcXvtozT6JxdFBkGIRJP18vGJvvErgMaDrrb2acXCxrMK3bnDK N1cFrZVM8eCAMdaHRDcU3wau2aUbq+AHwaxx+6zNyqxK9olvrU207EL9MKMMi/yqKnKt C7FAsr8bhCK4LfShEqRfcwIaArxbCx629ituroQ0xe1VBVeuK167mS1atD6w7Ku0iQmY akX9KfNSxS7lgRdDHwICPm75LpwE16hjdoWcdlgFMIqRBNptoT1CqVmQf2NLenycCyru YAOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qr2JjCCP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w19si12108875plp.185.2019.02.18.05.57.38; Mon, 18 Feb 2019 05:57:53 -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=Qr2JjCCP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733259AbfBRN4q (ORCPT + 99 others); Mon, 18 Feb 2019 08:56:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:36982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387870AbfBRN4m (ORCPT ); Mon, 18 Feb 2019 08:56:42 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 77D2221900; Mon, 18 Feb 2019 13:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498202; bh=jv8w+m1JI7iogxehGCTRVuqOJcBuyy9mNNkCfhUcjVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qr2JjCCPTSzsGQkRQW4TDzVhNnVWHCYQA/Xorc3z0AFojnBRjr+jAZR6OEAbcjac8 jVWMsbPQLKbP7iD9hwDDDE9Qd2wFjIdEcmSQOwTXrTXCzoH4q2KMHsglnoX+F44vrH 5dZINBdgBQ9bi3/8Yf/dIX+y3ya6scL0QcvS87Gw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Derek Robson , Linus Torvalds , Michael Matz , x86@kernel.org Subject: [PATCH 4.14 56/62] x86/a.out: Clear the dump structure initially Date: Mon, 18 Feb 2019 14:44:02 +0100 Message-Id: <20190218133510.564676766@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133505.801423074@linuxfoundation.org> References: <20190218133505.801423074@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Borislav Petkov commit 10970e1b4be9c74fce8ab6e3c34a7d718f063f2c upstream. dump_thread32() in aout_core_dump() does not clear the user32 structure allocated on the stack as the first thing on function entry. As a result, the dump.u_comm, dump.u_ar0 and dump.signal which get assigned before the clearing, get overwritten. Rename that function to fill_dump() to make it clear what it does and call it first thing. This was caught while staring at a patch by Derek Robson . Signed-off-by: Borislav Petkov Cc: Derek Robson Cc: Linus Torvalds Cc: Michael Matz Cc: x86@kernel.org Cc: Link: https://lkml.kernel.org/r/20190202005512.3144-1-robsonde@gmail.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/ia32/ia32_aout.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c @@ -51,7 +51,7 @@ static unsigned long get_dr(int n) /* * fill in the user structure for a core dump.. */ -static void dump_thread32(struct pt_regs *regs, struct user32 *dump) +static void fill_dump(struct pt_regs *regs, struct user32 *dump) { u32 fs, gs; memset(dump, 0, sizeof(*dump)); @@ -157,10 +157,12 @@ static int aout_core_dump(struct coredum fs = get_fs(); set_fs(KERNEL_DS); has_dumped = 1; + + fill_dump(cprm->regs, &dump); + strncpy(dump.u_comm, current->comm, sizeof(current->comm)); dump.u_ar0 = offsetof(struct user32, regs); dump.signal = cprm->siginfo->si_signo; - dump_thread32(cprm->regs, &dump); /* * If the size of the dump file exceeds the rlimit, then see