Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752155AbdCMP1q (ORCPT ); Mon, 13 Mar 2017 11:27:46 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56943 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751188AbdCMP1j (ORCPT ); Mon, 13 Mar 2017 11:27:39 -0400 Date: Mon, 13 Mar 2017 16:27:29 +0100 From: Heiko Carstens To: Marcelo Henrique Cerri Cc: Martin Schwidefsky , linux-s390@vger.kernel.org, Peter Oberparleiter , Joy Latten , linux-kernel@vger.kernel.org Subject: Re: [PATCH] s390/decompressor: fix initrd corruption caused by bss clear References: <1489418098-1564-1-git-send-email-marcelo.cerri@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1489418098-1564-1-git-send-email-marcelo.cerri@canonical.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17031315-0008-0000-0000-000003FE718C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17031315-0009-0000-0000-00001CCC67C5 Message-Id: <20170313152729.GC5009@osiris> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-13_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703130122 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1232 Lines: 28 On Mon, Mar 13, 2017 at 12:14:58PM -0300, Marcelo Henrique Cerri wrote: > Reorder the operations in decompress_kernel() to ensure initrd is moved > to a safe location before the bss section is zeroed. > > During decompression bss can overlap with the initrd and this can > corrupt the initrd contents depending on the size of the compressed > kernel (which affects where the initrd is placed by the bootloader) and > the size of the bss section of the decompressor. > > Also use the correct initrd size when checking for overlaps with > parmblock. > > Fixes: 06c0dd72aea3 ([S390] fix boot failures with compressed kernels) > Cc: stable@vger.kernel.org > Reviewed-by: Joy Latten > Reviewed-by: Vineetha HariPai > Signed-off-by: Marcelo Henrique Cerri > --- > arch/s390/boot/compressed/misc.c | 35 +++++++++++++++++++---------------- > 1 file changed, 19 insertions(+), 16 deletions(-) Indeed. I just checked that we currently have 32 bytes within the bss section of the compressed kernel image, where clearing it would corrupt the initrd if would be placed directly behind the image. I will look into the patch tomorrow. Thanks, Heiko