Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp780325ybz; Sat, 25 Apr 2020 04:13:06 -0700 (PDT) X-Google-Smtp-Source: APiQypL4zyniqzKLe9yKH41KwMTtRtIq937BTFJLCas2+IVOAH/7SrGMkXoYpWNz7nTtibgE4tiU X-Received: by 2002:aa7:d28a:: with SMTP id w10mr10765812edq.206.1587813186433; Sat, 25 Apr 2020 04:13:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587813186; cv=none; d=google.com; s=arc-20160816; b=0a5kYHAtwwivdIXc62oYD2ToiK2CRYKFChYcQ/mPNYbvXwjgh77pFkWZq2iYwb3vnw r5OmRfyqyzo5mHrf50Ab+j3iHsSca4wP3Y85TXgnmb/yndtdPCOH4i1D6bneL/j9/Dxe YZ0EP3cYG0G6XN4LDFk98ahKyRAdUmzp3FbHP8oLrsZ/cq6fTnA5yuJG0QLy8y79BG/Y Y1/iYFbYKdgqkVEu9KlXZkMQ6/U0x3cwPYvU2J5Uhzr8JXs22OoWKncNvmgUXrCkdv5x /ZJLuzaqBvfgSr/GYHNMVSEAd2vztM6BOjxDvt/Vuyny3oW4RW7q28yXUX5BmIdB4RP0 UtvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=der1/DmaRryShWyEusSXygQSqzNYs9Hyp6vKjaV8CDo=; b=hRae7GMRVHrFvFwhGadQ/i4uzmtaxlhvER3pIEFlgCf2La6VWPGKww/wLiEuNk56e8 /RmlcUlQR+kVeEjUMshKjlInNYl/rv1s4SMlnghr/+U9+pFqtaMhLV46Akn1iNVi8Moa Do1chtKIOCcy867IgF039K3wvNwjTK6V0Sc6gGJcxQoAF0kkC+34vBQ7i7ji43F8SwJe Qsq4tMMoh4jI2rYB7nGKt2iDfV0SBmHfcmfGm3Dv1z6govUDk8VRn+1oRUyWwgxarQ09 +neVgQcnXo6pv0AG0W07PQrNC1cL9V0RKIcK8morThFD5uqro/fdJNf40sOOUmwjbzF5 0FRw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h20si2282860eds.141.2020.04.25.04.12.43; Sat, 25 Apr 2020 04:13:06 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726241AbgDYLKB (ORCPT + 99 others); Sat, 25 Apr 2020 07:10:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:55232 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726059AbgDYLKA (ORCPT ); Sat, 25 Apr 2020 07:10:00 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A3D3BAC24; Sat, 25 Apr 2020 11:09:56 +0000 (UTC) Subject: Re: [PATCH] x86: Fix early boot crash on gcc-10, next try To: Borislav Petkov , 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 , =?UTF-8?Q?Martin_Li=c5=a1ka?= , =?UTF-8?Q?Fr=c3=a9d=c3=a9ric_Pierret_=28fepitre=29?= , boris.ostrovsky@oracle.com 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> <20200425085759.GA24294@zn.tnic> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: <1fbcc917-420a-10a6-26a6-047b0b1c4783@suse.com> Date: Sat, 25 Apr 2020 13:09:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200425085759.GA24294@zn.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25.04.20 10:57, Borislav Petkov wrote: > 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? I'm fine with you including it in your patch. Juergen