Received: by 10.213.65.68 with SMTP id h4csp551908imn; Tue, 27 Mar 2018 04:36:51 -0700 (PDT) X-Google-Smtp-Source: AG47ELs9ilOS7UAqLTaJc6WwoYaSvQ50ZcmiFvY4tcgtZdSfyvNPDgIHCsuMHtlOYSOjeEF/dlP/ X-Received: by 10.98.159.200 with SMTP id v69mr20039805pfk.230.1522150611772; Tue, 27 Mar 2018 04:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522150611; cv=none; d=google.com; s=arc-20160816; b=nzbyxYZvsKsKRr4AoZEIy76uIarMxLyaAWNzvexnFLfAuobfwJ0Bc5Vyu88xkASweR vrYDS0zO798ComRdgMLNl2FjsgQoMJnG1dz7q0N5+Wdw7U+/rC8dsTOpsqtXTNlF91ZQ Ej88X9XWGIUVQSz9TgGjQtNIVH+O+7WkGrU9qPO9g/zbSPdx1BszpRH1RNg2cORaB/Mo +OhbyXTliiSC3bzlW7MWaNFWQLccaipdbT4+GKXQJ1DCeBnBsTl1DWxnigmNyrQZrBFK KnDcmxHHVTUvWkEn8qZanUNaQ+Lay3k/AAntAMWCoyOFF/QAy2qXX6Jm3jsJu076wT7M eEHg== 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:arc-authentication-results; bh=t8y9uyVaWMmciiIlKItNYYbzIJFeXcCaIJ1jLDIr13Y=; b=JrokhSkjC0hzlbdM9mgM1NPGGLAZd4emKJIsnHIqVIVqBmHqFWfGh3R848Lpx0XB0R cV6ycMh4Xn8f9OloHY10bVX1+lgdL6ku7e/h80652WY1Dcpvb9YS1YBajMSheVuik66R Fk2pVU8Wte+GJWko/5GrIhi9enpHPek8QIdX8wWMgKyqPFH0N+gr/P/UdigmP5D1wNqk pKSHWeBgeYhYouDQdzDEsW+RIzSCKTte0DwvgNrbPGeZ4r+9tZwFgm/1veoQBBeXzZLe knxUMCrHCwein8kJI3vlG65Ya7ghRs+rqrltBg33lgVlOLu2/sRBAmi9aQtfNRSnpp3y lUrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=YGJxelFO; 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=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u24si736892pgv.424.2018.03.27.04.36.37; Tue, 27 Mar 2018 04:36:51 -0700 (PDT) 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=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=YGJxelFO; 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=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752227AbeC0LfL (ORCPT + 99 others); Tue, 27 Mar 2018 07:35:11 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:57442 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbeC0LfJ (ORCPT ); Tue, 27 Mar 2018 07:35:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=t8y9uyVaWMmciiIlKItNYYbzIJFeXcCaIJ1jLDIr13Y=; b=YGJxelFOsWGmN9zktCXTfKvTwug05gDj8ved9Q1ED5nmfD0+ZUmeHBpwjCpBUfnc3Zj54MtnYzSL0zdIMe5twFqmf0vb2REodrkOx6xyt4pPendoVOKhd7LPdFqkB/Tp17WrqDk1gyBB9E/lQM4lXKkO3FZXCfm0RNfSRADnP+s=; Received: from n2100.armlinux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:45999) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1f0msR-0003gc-P5; Tue, 27 Mar 2018 12:34:55 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1f0msP-0007bW-Mr; Tue, 27 Mar 2018 12:34:53 +0100 Date: Tue, 27 Mar 2018 12:34:53 +0100 From: Russell King - ARM Linux To: Tony Lindgren Cc: Stephen Rothwell , Rich Felker , Yoshinori Sato , linux-kernel@vger.kernel.org, Ralf Baechle , linux-omap@vger.kernel.org, Huacai Chen , Andrew Morton , James Hogan , linux-arm-kernel@lists.infradead.org Subject: Re: Regression with arm in next with stack protector Message-ID: <20180327113453.GC10990@n2100.armlinux.org.uk> References: <20180323181452.GJ5799@atomide.com> <20180327090409.GA10990@n2100.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180327090409.GA10990@n2100.armlinux.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 27, 2018 at 10:04:10AM +0100, Russell King - ARM Linux wrote: > On Fri, Mar 23, 2018 at 11:14:53AM -0700, Tony Lindgren wrote: > > Hi, > > > > Looks like commit 5638790dadae ("zboot: fix stack protector in > > compressed boot phase") breaks booting on arm. > > > > This is all I get from the bootloader on omap3: > > > > Starting kernel ... > > > > data abort > > pc : [<810002d0>] lr : [<100110a8>] > > reloc pc : [<9d6002d0>] lr : [<2c6110a8>] > > sp : 81467c18 ip : 81466bf0 fp : 81466bf0 > > r10: 80fc2c40 r9 : 81000258 r8 : 86fec000 > > r7 : ffffffff r6 : 81466bf8 r5 : 00000000 r4 : 80008000 > > r3 : 81466c14 r2 : 81466c18 r1 : 000a0dff r0 : 00466bf8 > > Flags: nZCv IRQs off FIQs off Mode SVC_32 > > Resetting CPU ... > > > > resetting ... > > The reason for this is the following code that was introduced by the > referenced patch: > > + ldr r0, =__stack_chk_guard > + ldr r1, =0x000a0dff > + str r1, [r0] > > This uses the absolute address of __stack_chk_guard in the decompressor, > which is a self-relocatable image. As with all constructs like the > above, this absolute address doesn't get fixed up, and so it ends up > pointing at invalid memory (in this case 0x466bf8) vs RAM at 0x80000000, > and the decompressor looks to be around 0x81000000. > > Such constructs can not be used in the decompressor for exactly this > reason - they need to use PC-relative addressing instead just like > everything else does in head.S. Is there any reason we can't do this in misc.c: const unsigned int __stack_chk_guard = 0x000a0dff; ? That would save having runtime code to set that value up, and after all, it is constant. Arguments about it potentially ending up at a fixed offset into the image need not be said - that's already the case with placing it in the early assembly code, and as has been established, it needs to be initialised prior to any C code being called. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up