Received: by 10.213.65.68 with SMTP id h4csp780591imn; Tue, 27 Mar 2018 08:38:25 -0700 (PDT) X-Google-Smtp-Source: AG47ELuIPccNla0HgwkmoVYQtrq7k/obOXEIQhM25deAJEgZ1nErp6oYfdWKrUsy0MF2DkZtjwLB X-Received: by 10.167.129.129 with SMTP id g1mr37062481pfi.224.1522165105598; Tue, 27 Mar 2018 08:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522165105; cv=none; d=google.com; s=arc-20160816; b=bwj0umzbbksdfxqIxkWBpm/q8rHuUUFDJRamfI5HNir4cupXCngqQ5mZFw/d75MOQz c44yjARKOCPVep3ZxIDKH+q98AI7mxU3q35zwF6hhHK6DM+0gNkzeP4TEk1r3BpuJFs3 ZCOWKSaHMHE0IDjoQXSk5WunBgRj9KYdyFsbmiz+u1nlm/1yLtjuWoQQfUWIIkA5gs5V pMlKrWCpB8mF4Lm6gSiPm7i38YSEuQyOpyufAq/UE4C/ZyjZXTQn96orn/9XK5MyRC8J FqFlVI7YBAqcRumn1nNItDgSf96J/+EIc2qzANrbxXO9Na4Fp1CZych+LIi885z42Q0x wVtA== 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:arc-authentication-results; bh=lOALnDXhNfgSgvyQgk8XfLWOQbk7eKprabVUMD31kHA=; b=iolhYeytysK/iuMrQh5HhNOT+IY5R7wAJzketGmufm8qlqjppC0WRtA3N0Mmo3WQ1q OSo2ZRrenFXHXvI4V4isZFQb52F04ODc9acgxdnbp0m5rjnspRj9oRYwEsSk9dGFXvbS 1zD4Ufwrz5Tpw4nahgklM4++zgb8N/y0dHExMnQATmdm3HojYHul/9a2d0DppZkodeOa kINPhWELlmoJgvcpfJgzjv8J8Wwj1z9QypHWh7Ec33Bpor5Ib+pwnvheT9RcjAfOMl+I v3mVtvo7zi3O78Er0S96SnfN+kQCQoHHJ7tgmogZ31xeiME71PwVt8zHUviujove8I09 RDsw== ARC-Authentication-Results: i=1; mx.google.com; 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 g3-v6si1420823plp.662.2018.03.27.08.38.11; Tue, 27 Mar 2018 08:38:25 -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; 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 S1752645AbeC0Pgu (ORCPT + 99 others); Tue, 27 Mar 2018 11:36:50 -0400 Received: from 216-12-86-13.cv.mvl.ntelos.net ([216.12.86.13]:33258 "EHLO brightrain.aerifal.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752614AbeC0Pgq (ORCPT ); Tue, 27 Mar 2018 11:36:46 -0400 Received: from dalias by brightrain.aerifal.cx with local (Exim 3.15 #2) id 1f0qeC-0001HZ-00; Tue, 27 Mar 2018 15:36:28 +0000 Date: Tue, 27 Mar 2018 11:36:28 -0400 From: Rich Felker To: Russell King - ARM Linux Cc: Tony Lindgren , Stephen Rothwell , 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: <20180327153628.GJ1436@brightrain.aerifal.cx> References: <20180323181452.GJ5799@atomide.com> <20180327090409.GA10990@n2100.armlinux.org.uk> <20180327113453.GC10990@n2100.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180327113453.GC10990@n2100.armlinux.org.uk> User-Agent: Mutt/1.5.21 (2010-09-15) 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 12:34:53PM +0100, Russell King - ARM Linux 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. > > 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. I've asked this multiple times in this thread and as far as I know nobody has answered. Rich