Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp580204ybh; Wed, 15 Jul 2020 09:35:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhTym25+PxCz6NM/9L45xh+xuA8a6OyGyFZ83OtfFnXht2fSSa6QhnqchysVJcdZOYjU+2 X-Received: by 2002:a17:906:140e:: with SMTP id p14mr10103630ejc.430.1594830923207; Wed, 15 Jul 2020 09:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594830923; cv=none; d=google.com; s=arc-20160816; b=L+1J8GSNA+C1eww53UzYSlEnzx//JVLrKHk2H8DyXDZdgJUdas8q20kK1NmWejHPlB U5lK5qwPgeDC3ILLaAwzUSh+C3QRpcX0+l+3LqhzAd/LZTp54BLjBKoVONJ+ITkOeTpC 0OSS+fc/wPaz+78UBIADkIsO7S5SZKw/3RzJa2bKxGnadPIhaISoL4ynVFskqCBswQQI lmocUPN7D1oudXh0J6V6Zm0ddJF+M3QOs5AFw4p9+cjqSQR9vWdPSkKQrz1f6MtrPWQv 2/9/D9UNwk4nOtwtdiocuAySb4eqw3XQ1ZB157VUWYMY8BYK+s6Yb031dAvKPCYXQX7m Cj1Q== 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; bh=kgORzJo421QQagLTB9jfpDW02kYQ8bsOaCW77EfRrH4=; b=ks/9nsyBtB2fPZGgAVFTi7oYcZjArFF6lhTUgMWySfcbrTuXrVUO4AYCviiWhQ6BSm PKKle5fcch7uGq3+jSwjVU7mYzEGmmvgBfnBLvkGx9PbYG3QoF9zYsm5Xp3Uo8vRcTAq aYXc5Vf5giGMQoMoh6Je0mruKNtz/8moq2b+fy24dp7F5ny4MiUv15kK2rmVvmFk6uYx w60ow/Bg7+dakMBjUdXEFUxQZPWMGGFlU7r/dQIMBqf2Pucw36AQFR9N6gVfAeXM4k8U pp7HW91TKFSJpP9mCr37K/ErpJPXRd2Nf6ec0LHefE8l5MFDsTusMW4/pVzQEjX/XKCz 7yeQ== 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 t17si1668732ejs.635.2020.07.15.09.35.00; Wed, 15 Jul 2020 09:35:23 -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 S1725909AbgGOQev (ORCPT + 99 others); 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