Received: by 10.213.65.68 with SMTP id h4csp874806imn; Tue, 27 Mar 2018 10:22:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/8WAQAgwu4FetQzaM5xpRGkto7dXRMxWoQkioBdrRB35YQO5yr+/xYLYcTxFkaURp+gyZ8 X-Received: by 10.101.101.133 with SMTP id u5mr118949pgv.151.1522171332458; Tue, 27 Mar 2018 10:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522171332; cv=none; d=google.com; s=arc-20160816; b=wThj0pxVroZzcJI0Xw82CBFM99nQvjFl6Qp1nyG8JfGZp/OCHt1mFwRDMWkCn3gHG6 xP3FcZHpvNwBWn/wTySrwu8b7b0U2GtyA31iw91cmZ6uC0tX+tPA35NxQVkCLyqPpVJT faWCoqJhHS1dFUnsq2rUTdYVlZiVVZ6ZQdB67jC3zurqsMHtBcda3zVD4G1Fnmxidfle Jhz3vaVBvvXpQAx+8tOPhMHTsS7bx95drJI3lRX8SX9/QB/YB5p30U6G87A6O74FLjSR JxXJJu8Ws5vYIsaaRXZ2UpiZDkfw+7phz1dCFKOzAeLA3eMgTidmhQDH+kXW5erLH61E 27ZQ== 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=T47eYKuS+N1r/An2zfJ4ukW59gCsQs79QI/4FhGml7c=; b=mwm6S8UkpvYneNZgbJxSvxSOk+Kav/8ZT/nqXfsUFDAV+I97UdZwrEeYnm3xMQ2cNg /0RYqrgSPNRl86mWW0etQ6Dpdpi1pez1aLmL/c48OskVy5t4FX7PbOHHBPw4KAH4f7eU sO8Pl84FLTPXVk+KjPa5O54V8kzqLp5ZbKkVJzE1Vkcnq14SCVBzK004W9ttAR2/+ARU qFFG6Kpd8EbWHVr3oCjpIrlTiYWyOwVmHmQ/xL+6BQ3v34ZBJQuoUjHyUaH35q97UjbB hlHzlsad42+TFYnD/yO5te2m7p5rwfX+0Dlz6F4hY7CmoKIm0vRo8EZxjz5Eod1Feqyu Rvlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=oHPDtZOs; 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 o69si1221539pfj.329.2018.03.27.10.21.58; Tue, 27 Mar 2018 10:22:12 -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=oHPDtZOs; 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 S1754943AbeC0RU6 (ORCPT + 99 others); Tue, 27 Mar 2018 13:20:58 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:34388 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754831AbeC0RUy (ORCPT ); Tue, 27 Mar 2018 13:20:54 -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=T47eYKuS+N1r/An2zfJ4ukW59gCsQs79QI/4FhGml7c=; b=oHPDtZOsJfiiWKB8e2IBhJ7zfvboxv0U6/AAVFZwuqPyIvqh7gbeEeY9+aMcmYfQgaw+YFNYNy8pFYFopeutUYDECL7tbud0GQ3287yhNgg/xGCjeD46r8R1qbunvLFL0CO4bfglTTByXu7tbvFKNeRZDkjUao5SYxrA+oom4Eo=; Received: from n2100.armlinux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:50202) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1f0sGt-0005QD-Jn; Tue, 27 Mar 2018 18:20:31 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1f0sGq-0003sJ-GD; Tue, 27 Mar 2018 18:20:28 +0100 Date: Tue, 27 Mar 2018 18:20:27 +0100 From: Russell King - ARM Linux To: Rich Felker Cc: Tony Lindgren , Huacai Chen , Andrew Morton , Stephen Rothwell , Ralf Baechle , James Hogan , Yoshinori Sato , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Subject: Re: Regression with arm in next with stack protector Message-ID: <20180327172027.GA14598@n2100.armlinux.org.uk> References: <20180323181452.GJ5799@atomide.com> <20180327090409.GA10990@n2100.armlinux.org.uk> <20180327153525.GI1436@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180327153525.GI1436@brightrain.aerifal.cx> 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 11:35:25AM -0400, Rich Felker wrote: > 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. > > Can someone please answer why this is even needed to begin with? I > don't see any compelling reason __stack_chk_guard needs a particular > value in the decompressor, which is not dealing with any non-constant > input. Untrue - it can do some parsing of the DT and updating/appending information from ATAGs. However, all that should be coming from a trusted environment, so I don't see much of a "trust" issue here. (If the parent environment is not trusted, then the environment we're running in is not trusted.) > Just putting __stack_chk_guard in its bss should be fine and > would eliminate all the risks of wrong code to load a value into it. > Alternatively put it in initialized data with the desired value. I'm no expert with this, so I can't comment. I build my kernels with gcc 4.7.4, which I don't think supports this feature. -- 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