From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AE77C433DF for ; Wed, 15 Jul 2020 16:34:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E8DD2065E for ; Wed, 15 Jul 2020 16:34:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725993AbgGOQev (ORCPT ); Wed, 15 Jul 2020 12:34:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:42622 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbgGOQev (ORCPT ); Wed, 15 Jul 2020 12:34:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 89EA3AF83; Wed, 15 Jul 2020 16:34:52 +0000 (UTC) Date: Wed, 15 Jul 2020 18:34:47 +0200 From: Joerg Roedel To: Kees Cook Cc: Joerg Roedel , x86@kernel.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v4 34/75] x86/head/64: Build k/head64.c with -fno-stack-protector Message-ID: <20200715163446.GB24822@suse.de> References: <20200714120917.11253-1-joro@8bytes.org> <20200714120917.11253-35-joro@8bytes.org> <202007141831.F3165F22@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202007141831.F3165F22@keescook> 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, Jul 14, 2020 at 06:34:24PM -0700, Kees Cook wrote: > On Tue, Jul 14, 2020 at 02:08:36PM +0200, Joerg Roedel wrote: > > +# make sure head64.c is built without stack protector > > +nostackp := $(call cc-option, -fno-stack-protector) > > +CFLAGS_head64.o := $(nostackp) > > Recent refactoring[1] for stack protector suggests this should just > unconditionally be: > > CFLAGS_head64.o += -fno-stack-protector > > But otherwise, yeah, this should be fine here -- it's all early init > stuff. > > Reviewed-by: Kees Cook Thanks, I am not sure this patch will be needed in the next version, as I am currently rebasing to tip/master, which also made idt_descr static in kernel/idt.c. So with that I think I have to move the early IDT init functions to kernel/idt.c too and setup %gs earlier in head_64.S to make stack-protector happy. The %gs setup actually needs to happen two times, one time when the kernel still runs identity mapped and then again when it switched to virtual addresses. Regards, Joerg