Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp679234ybz; Sat, 25 Apr 2020 02:00:24 -0700 (PDT) X-Google-Smtp-Source: APiQypJ4AF6kG7R99LyH6m6z3/OL00yLasJE+hk/YN5dIxFndLb8L7GOwsXdH4GzeNuXKLE5whV4 X-Received: by 2002:a17:906:e210:: with SMTP id gf16mr11147113ejb.214.1587805224790; Sat, 25 Apr 2020 02:00:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587805224; cv=none; d=google.com; s=arc-20160816; b=EgkNvG7fWcsKS5jrvPxTFnwQRuDXAD0SFHNStIrthxFuWcJrhvL+lgGVvPYNhbCoRD eVaTViw+KOFAw9VyT2rO0MSQkU56T0J42UM85C2KZdGSYHkzar39UOXnTGOZlG6+3Hvw SY9Lp1rEX7RJd22tCOsI7+GDkBC2qwVElJrAac+R9E19i9YLSgszMAo/Camy8DD2M87a Et9/OFlk2ZvrAxvx3njavL7jJdQLQSG3b9lTReCFUI7h9oe6mV4f3rRsafZNrKX47gVV svW3z1ZewGRgkFKvLDDaHe11tXxjReIvO5ehBcg2LIFz1AaJCH0RYS+5E6sfqPZPz35s A6zQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=H3Y4V1uVz2ZFfCyhURzs0bYXQDQsiH4z6rVXjpkd4EA=; b=EZl08+Wuhc+oIO2L5P/tUV2DdGlLkf1uJ7u8Se/bK7cPfQy6AJ33C3huVV5XwH+it8 XbNa6cO0wnACH01de/wsk7/bIjJIqS8kNy5QsYZ15AEekwr9BWFyRxUpXD44yfdkBSSQ RdQs+cJ0Oq1cAm3s890itymo36mkPF7g9hng6lGKdVnE0wAXrF3v0FmzJLfXkl17LctS R5Luy7QmMbOPtoNtqDYKQQO5zZFxa5nlO+6KEzTnOvHZgIpcA6MrJ7CCMTKVi8U5u9wb gg10ldOWvPU1R4NY8o9jsJwtwIlPHidh/pa2e4qI2niK0vQZUDKI+GIu/I+Kk+w7bOpH MqWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=h+zIYo6O; 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 g7si4348534edq.580.2020.04.25.02.00.01; Sat, 25 Apr 2020 02:00:24 -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=h+zIYo6O; 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 S1726159AbgDYI6M (ORCPT + 99 others); Sat, 25 Apr 2020 04:58:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726035AbgDYI6K (ORCPT ); Sat, 25 Apr 2020 04:58:10 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39084C09B04A for ; Sat, 25 Apr 2020 01:58:10 -0700 (PDT) Received: from zn.tnic (p200300EC2F2A110038DA0814AB9A5F9F.dip0.t-ipconnect.de [IPv6:2003:ec:2f2a:1100:38da:814:ab9a:5f9f]) (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 672301EC0C89; Sat, 25 Apr 2020 10:58:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1587805086; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H3Y4V1uVz2ZFfCyhURzs0bYXQDQsiH4z6rVXjpkd4EA=; b=h+zIYo6OzDqCmKYjla0c3j+uqIn2RNYYZqPs42836G8Ri+qS+ebhncWZb6xmb6Er95AAS6 NzW8l0r679yN+ffI+oMgcDzBIV702f0Hgqfu31tXKNdVc9FYQYDVBGGrdrzwGYoYMzGdfw YsFyDZA+BazaPSEtblmlkmJZtkNCbEU= Date: Sat, 25 Apr 2020 10:57:59 +0200 From: Borislav Petkov To: Arvind Sankar Cc: Nick Desaulniers , Michael Matz , Jakub Jelinek , Sergei Trofimovich , LKML , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , x86@kernel.org, clang-built-linux , Kees Cook , Martin =?utf-8?B?TGnFoWth?= , =?utf-8?Q?Fr=C3=A9d=C3=A9ric_Pierret_=28fepitre=29?= , boris.ostrovsky@oracle.com, jgross@suse.com Subject: Re: [PATCH] x86: Fix early boot crash on gcc-10, next try Message-ID: <20200425085759.GA24294@zn.tnic> References: <20200422102309.GA26846@zn.tnic> <20200422192113.GG26846@zn.tnic> <20200422212605.GI26846@zn.tnic> <20200423125300.GC26021@zn.tnic> <20200423161126.GD26021@zn.tnic> <20200425014657.GA2191784@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200425014657.GA2191784@rani.riverdale.lan> 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 Fri, Apr 24, 2020 at 09:46:57PM -0400, Arvind Sankar wrote: > The comment above boot_init_stack_canary's definition should be updated > to note that it needs to be called from a function that, in addition to > not returning, either has stackprotector disabled or avoids ending in a > tail call. How's that? diff --git a/arch/x86/include/asm/stackprotector.h b/arch/x86/include/asm/stackprotector.h index 91e29b6a86a5..237a54f60d6b 100644 --- a/arch/x86/include/asm/stackprotector.h +++ b/arch/x86/include/asm/stackprotector.h @@ -55,8 +55,12 @@ /* * Initialize the stackprotector canary value. * - * NOTE: this must only be called from functions that never return, - * and it must always be inlined. + * NOTE: this must only be called from functions that never return, it must + * always be inlined and it should be called from a compilation unit for + * which stack protector is disabled. + * + * Alternatively, the caller should not end with a function call which gets + * tail-call optimized as that would lead to checking a modified canary value. */ static __always_inline void boot_init_stack_canary(void) { > There are also other calls that likely need to be fixed as well -- in > init/main.c, arch/x86/xen/smp_pv.c, and there is a powerpc version of > start_secondary in arch/powerpc/kernel/smp.c which may also be affected. Yes, there was an attempt to fix former: https://lkml.kernel.org/r/20200413123535.10884-1-frederic.pierret@qubes-os.org I probably should point the folks to this thread. CCed. Boris O, Jürgen, I'm guessing I should fix cpu_bringup_and_idle() too, see: https://lkml.kernel.org/r/20200423161126.GD26021@zn.tnic or do you prefer a separate patch? Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette