Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp625535ybz; Wed, 15 Apr 2020 15:23:37 -0700 (PDT) X-Google-Smtp-Source: APiQypKK+zgAWi3C1eClbZgCkjYPP6oaBTjcG4sq7RY0kISgC7ky/F/xg9IQReh6dJZv5El20A5W X-Received: by 2002:a17:906:4317:: with SMTP id j23mr6775541ejm.377.1586989417649; Wed, 15 Apr 2020 15:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586989417; cv=none; d=google.com; s=arc-20160816; b=bzZP6nkVpiV3aOk8y1+dS/OeQCRzVgo+01JYRPeWaquMOUVWw9R+fJ5L006015lhC2 anoXZRkGhAwO/6Rv7KjbguLPu3sS5QOi1wfqxXhmDhLbnMHRxOrjY0FltUln53pcIi0W b77Abxhd73bxLfP2AHu0AjMs8arV02EFlJQj4MGsad4LTigrHULBDyBlLvqoe5glfVMd jdB97McRGIRqtSYlFI4T7hMWkIdZiOzRVGKLfaDvt9JMaYCKrRkkXDw23HuMZlQVWs1D LBc+EGO7Ei+8d6aytAgNS7M0zmVhRmLCXwvqOEq1GkPmVA4/Es06l51YxCO/21YpmSDh vbLw== 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; bh=6I3FIZce64bDLoDmq+PGpLnRSsjIWzLbWIT/VRIHmeE=; b=CWdhxx5I/IcluYcKpT9fsG7CnZoPKxeTQ7hWm0ifkw8xT2sK/40yTklKa/aITsPbzV 4vwltkazTgnCmi1u0HbDYzW6yuR7CdYj+MbVDHiRYpIUwjNhe4Z1hVum38VvHOa2TpLo Hp8qE7YN6tVMbC+P5wjx1YgP+5wXV8LJrBU1Vz7B2kFK6ULFld8/+JX2Z2g4H9ofFZf2 EBnPQLQCpbNqPW/4tU4h//XpUmxm7rJfrg9nC6+xR90Q9Awn+YxZGuoLPk+bjvZBYQFM IjYa3jUGHcUfejlF5433iaLsRLGmzwMSyPfCLakJCDsC+5Y0VMmmUYg1gZp3WVIB96pd Ux6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=aaFgGe6j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j24si6267390edt.64.2020.04.15.15.23.14; Wed, 15 Apr 2020 15:23:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=aaFgGe6j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2635328AbgDOHsw (ORCPT + 99 others); Wed, 15 Apr 2020 03:48:52 -0400 Received: from mail.skyhub.de ([5.9.137.197]:59110 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2635311AbgDOHst (ORCPT ); Wed, 15 Apr 2020 03:48:49 -0400 Received: from zn.tnic (p200300EC2F095B00D1697A0DDC961078.dip0.t-ipconnect.de [IPv6:2003:ec:2f09:5b00:d169:7a0d:dc96:1078]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 422671EC0591; Wed, 15 Apr 2020 09:48:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1586936927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=6I3FIZce64bDLoDmq+PGpLnRSsjIWzLbWIT/VRIHmeE=; b=aaFgGe6jWyv4YuhUEmn54xvS7cekKBpl1xOqbx8WG5AQUdvs5M4tZ+BWgpX56AQHD3zx00 88uB8Ur4sb4XGJIsrt8YBqQfopZqBEtOqGuhqJRPkE7+Aeg6PTqSpUTCVBZsDJkIrc/nj6 Rbfqu1uNhaWhU4tILvnpJNzieRDwqzc= Date: Wed, 15 Apr 2020 09:48:42 +0200 From: Borislav Petkov To: Michael Matz Cc: Jakub Jelinek , Sergei Trofimovich , linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , x86@kernel.org Subject: Re: [PATCH v2] x86: fix early boot crash on gcc-10 Message-ID: <20200415074842.GA31016@zn.tnic> References: <20200326223501.GK11398@zn.tnic> <20200328084858.421444-1-slyfox@gentoo.org> <20200413163540.GD3772@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 14, 2020 at 01:50:29PM +0000, Michael Matz wrote: > So this part expects that the caller (!) of trace_hardirqs_on was compiled > with a frame pointer (in %ebp). /me looks at the .s file... options passed comment at the top has -fno-omit-frame-pointer > Obviously that's not the case as you traced above. Is start_secondary > the immediate caller in the above case? Yes, start_secondary() is the function which is marked as __attribute__((optimize("-fno-stack-protector"))) and it does: # arch/x86/kernel/smpboot.c:264: local_irq_enable(); call trace_hardirqs_on # (the local_irq_enable() is a macro which has the call to trace_hardirqs_on(). > Look at it's disassembly. If it doesn't have the usual push > %ebp/mov%esp,%ebp prologue it probably doesn't use a frame pointer. Here's the preamble: .text .p2align 4 .type start_secondary, @function start_secondary: pushl %esi # pushl %ebx # subl $28, %esp #, # arch/x86/kernel/smpboot.c:226: cr4_init(); call cr4_init # ... Those two pushes on entry are for callee-saved regs, AFAICT, because it is going to use them later. But no frame setup. > In that case I would speculate that having a frame pointer > was (before the change above) only a side-effect of being > compiled with -fstack-protector, which got now disabled. Looks like it. And that's 32-bit. 64-bit variant of this looks more like it: .text .p2align 4 .type start_secondary, @function start_secondary: pushq %rbp # subq $8, %rsp #, although it doesn't save %rsp on the stack. I think it leaves space on the stack for the canary but I'm not sure. > But I was under the impression that the upstream kernels build with > -fno-omit-frame-pointer, so that sounds unexpected. Yap, see above. > But I have no better explanation at the moment. If the above > speculation doesn't make you progress: preprocessed file and a note of > what the immediate caller of trace_hardirqs_on is in the above case, > please. Ok, I'll find you on IRC to talk details. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette