Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2968653ybh; Mon, 16 Mar 2020 13:11:32 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtZ9qClq/V83KhOZA3ovXYUl0ookVIM9xrhnfy1Pgn2ApMOCNoeNYW21RjCY5YlKrhC3UQq X-Received: by 2002:aca:5c8b:: with SMTP id q133mr923452oib.38.1584389492502; Mon, 16 Mar 2020 13:11:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584389492; cv=none; d=google.com; s=arc-20160816; b=qJRVThe2oZpfJarH5R6Gz1cdoXczRb3C0/fH0OdkVoaFacO1u+gb/gZOPBtJ8L9YdQ 1GFuXNUiL42ND2sbNRNwNwP13y2hIz4k6gxS1s/g16iNe3h6m1uRxRZEoTJ5oWq+SiYJ +2Lnpb1/AerfeueF2wMFTwz1hq0Xv2Bp7B+jBWq+k2Cx/U6TZI8gH2km2SOmMrbEzv6M ggR4Vv/7D+CjHO60RJjM73jq/Acse02aI40xZnn/rCzM7XGdI4RSsiX0ggftgRpaO3yW GNt4d+lkfmmZq6HRqQDOQPQUb0TAcaRhReW0IqN2y237kuww83EYEn62DOxrKBFX1eUc atnQ== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=xsg87v4ZnYqqejOLTfGiV7OR+/GOIkFfOkgI4flZm7Y=; b=rRcTZWT0thB4T+gq5E99B2yvjLUy/g6D8oWuGMYZzMB7lYVK/vCcYzD1VIypTjqldx tWQbhNUdz9qnapc/heP3QP+G2EiBDk25vn5HnYub89eF7nqxrA88ij48K6j/GOmWRIZf R/sTDvb3XWIqL3DgXc029W5lBDOqnBiWNxx6ZhX+WduHRsex6scUaexrhIX/8XHm+weT xgPS0ZgnyJy1iJc7a/Jdv0UglXtJhr2PFNfHYrpJqlBRxFLWX/CWf7A9vJWkCEgoCqPt JwcxdIPdM/lb/YZohV2Z3Dh58tgM9R64ybPjClG4NfO3B4nB0mvAgl1bgFxoV4pB6LMq IqUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="K/loFjT9"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si419985oiy.229.2020.03.16.13.11.19; Mon, 16 Mar 2020 13:11:32 -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=pass header.i=@redhat.com header.s=mimecast20190719 header.b="K/loFjT9"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732535AbgCPUJK (ORCPT + 99 others); Mon, 16 Mar 2020 16:09:10 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:48767 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732448AbgCPUJK (ORCPT ); Mon, 16 Mar 2020 16:09:10 -0400 X-Greylist: delayed 6769 seconds by postgrey-1.27 at vger.kernel.org; Mon, 16 Mar 2020 16:09:09 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584389348; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=xsg87v4ZnYqqejOLTfGiV7OR+/GOIkFfOkgI4flZm7Y=; b=K/loFjT9FGdNOkXSa0BaJ+TiQvrXWzOOcN8vVFMBZivDrOPrLF/60C3ry0HoGch+A8jfHi TeDmxJfEApM9zeujT8u77awBZlFNB9BrwoEbfycHd4DanoQ2707Yysx5UPV1HFeRt3FINc wAe8ABkObGkz/2mi/FH9rk6IQIRuM1s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-24-NBCfviDWPRObsGGk1T4h_A-1; Mon, 16 Mar 2020 16:09:04 -0400 X-MC-Unique: NBCfviDWPRObsGGk1T4h_A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9EEDE1005514; Mon, 16 Mar 2020 20:09:02 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-22.ams2.redhat.com [10.36.112.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F87D5C1BB; Mon, 16 Mar 2020 20:09:01 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 02GK8w6U025167; Mon, 16 Mar 2020 21:08:58 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 02GK8t6d025166; Mon, 16 Mar 2020 21:08:55 +0100 Date: Mon, 16 Mar 2020 21:08:55 +0100 From: Jakub Jelinek To: Arvind Sankar Cc: Borislav Petkov , Peter Zijlstra , Sergei Trofimovich , linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andy Lutomirski , x86@kernel.org Subject: Re: [PATCH] x86: fix early boot crash on gcc-10 Message-ID: <20200316200855.GS2156@tucnak> Reply-To: Jakub Jelinek References: <20200314164451.346497-1-slyfox@gentoo.org> <20200316130414.GC12561@hirez.programming.kicks-ass.net> <20200316132648.GM2156@tucnak> <20200316134234.GE12561@hirez.programming.kicks-ass.net> <20200316175450.GO26126@zn.tnic> <20200316181957.GA348193@rani.riverdale.lan> <20200316185418.GA372474@rani.riverdale.lan> <20200316195340.GA768497@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200316195340.GA768497@rani.riverdale.lan> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 16, 2020 at 03:53:41PM -0400, Arvind Sankar wrote: > > /* > > * Initialize the stackprotector canary value. > > * > > * NOTE: this must only be called from functions that never return, > > * and it must always be inlined. > > */ > > static __always_inline void boot_init_stack_canary(void) > > Ugh, gcc10 tail-call optimizes the cpu_startup_entry call, and so checks > the canary before jumping out. The xen one will need to have stack > protector disabled too. It doesn't optimize the arch_call_rest_init call > in start_kernel for some reason, but we should probably disable it there > too. If you mark cpu_startup_entry with __attribute__((noreturn)), then gcc won't tail call it. If you don't, you could add asm (""); after the call to avoid the tail call too. > > a06: 0f ae f8 sfence > a09: 48 8b 44 24 08 mov 0x8(%rsp),%rax > a0e: 65 48 2b 04 25 28 00 sub %gs:0x28,%rax > a15: 00 00 > a17: 75 1b jne a34 > a19: 48 83 c4 10 add $0x10,%rsp > a1d: bf 8d 00 00 00 mov $0x8d,%edi > a22: 5b pop %rbx > a23: e9 00 00 00 00 jmpq a28 > a24: R_X86_64_PLT32 cpu_startup_entry-0x4 > a28: 0f 01 1d 00 00 00 00 lidt 0x0(%rip) # a2f > a2b: R_X86_64_PC32 debug_idt_descr-0x4 > a2f: e9 cc fe ff ff jmpq 900 > a34: e8 00 00 00 00 callq a39 > a35: R_X86_64_PLT32 __stack_chk_fail-0x4 Jakub