Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp473818rwb; Tue, 29 Nov 2022 00:50:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf6h4Xk1zgJePdwgSGwqAEwuWjmnf2cTk9QPO4D/dLGjvBP66MTaebaYKvqulHVciXFjcmO6 X-Received: by 2002:a17:906:f90:b0:7ba:9c18:11e7 with SMTP id q16-20020a1709060f9000b007ba9c1811e7mr24141400ejj.198.1669711810577; Tue, 29 Nov 2022 00:50:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669711810; cv=none; d=google.com; s=arc-20160816; b=zWtbRtrlNSr9XIGj2svl0oXzBXFPPf03ZJtcWZ16o454Yp/cNmn0pkIhQJ6dP1X+XB 8VT5XGFoZfV1OHMJZGvqfI3fejLNOcBYO4NUC6J+nV7fDf6iCXgrz9bkgy3K9LHFNueT MagJhj7UmnrTRVMeLKYZ8llIZcbCzhVkKfBiRoL8qK8Ki+wePTrJTP+NSIbbckjISs3j MMdJZhO+jx88ShUPcXp9IV8th/T3z5eUOI4Pqu9nO6h1UZLl8F/e0RrTX7hYj5BDmJ7N V5oMjFDG/32OarayfFT/XncBaDeQckCARFpzsqTbWKMC2bQDomAR7z1WO388sdN0vC5Q oydg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=c2uLthRh1cekqoux6NKDaUFI7tnAo+8/uewFZFHwfUw=; b=oo2kgBai2gx0tp+9PHcQpmFivwEGa7B/zjrsx5UuvbfPB+7dd+P0bV/S09PVkY1f6O KY+ZOf5+xPuvgtrdlm95/hezW2w8K1ITmDO8l1IDW5Bsuov6qmksWziOvXc76QwdXnnG SeeqGnWQfCj5KTJwpvtIXpf80wBOOhRU+LmXMjtyrC6/Ogf0mWSDYilSH4vSfjltGvfa FQe+snbgftJ4OrFEqwUwFQUFcsN8tYxmBt0A+/DmadCV4CPpTv/JgDva9v+JfgLEZ6Fi bewKUEgxGpO0CDEH6CHAkyzl93zTImpYoKtI52hUZS1TbWYvG+Te/vfneGvWbuVxwS9P Vvhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=jrdvWei+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t1-20020a056402240100b0046aff50132asi5960490eda.316.2022.11.29.00.49.50; Tue, 29 Nov 2022 00:50:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=jrdvWei+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230512AbiK2Icl (ORCPT + 83 others); Tue, 29 Nov 2022 03:32:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231151AbiK2Ibx (ORCPT ); Tue, 29 Nov 2022 03:31:53 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B28B58038 for ; Tue, 29 Nov 2022 00:31:25 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (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 120E91EC04AD; Tue, 29 Nov 2022 09:31:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1669710682; 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:in-reply-to:in-reply-to: references:references; bh=c2uLthRh1cekqoux6NKDaUFI7tnAo+8/uewFZFHwfUw=; b=jrdvWei+zrZRNks1rtZP6RnET0S8IR3zKlLvTMSkQI3RCmaQjJjieWBA1wv9HTWgpw5jfk HaRcPKPWBACEOplTeXsGcQhXIUCE5IdiNX9TFCFuFDUaGPJnv/UHvupf0ZPuleOCs1pj2z n3VYubTHueFDOsfMz1kSgc1jYFekbUY= Date: Tue, 29 Nov 2022 09:31:17 +0100 From: Borislav Petkov To: Uros Bizjak Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" Subject: Re: [PATCH] x86/boot: Remove x86_32 PIC using ebx workaround Message-ID: References: <20221104124546.196077-1-ubizjak@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 29, 2022 at 08:39:23AM +0100, Uros Bizjak wrote: > On Mon, Nov 28, 2022 at 11:20 PM Borislav Petkov wrote: > > > > On Fri, Nov 04, 2022 at 01:45:46PM +0100, Uros Bizjak wrote: > > > Current minimum required version of GCC is version 5.1 which allows > > > reuse of PIC hard register on x86/x86-64 targets [1]. Remove > > > obsolete workaround that was needed for earlier GCC versions. > > > > > > [1] https://gcc.gnu.org/gcc-5/changes.html > > > > Thanks for the doc pointer. > > > > Lemme see if I understand this commit message correctly: > > > > SysV i386 ABI says that %ebx is used as the base reg in PIC. gcc 5 and > > newer can handle all possible cases properly where inline asm could > > clobber the PIC reg. I.e., it is able to deal with the "=b" constraint > > where an insn can overwrite %ebx and it'll push and pop around that > > statement. > > gcc-5 considers PIC register as a pseudo-register and reloads it So not a "hard" register as you say above? > x86_64 does not use PIC register for small code models. Also, it uses > %r15 instead of %rbx for PIC register, so the removed workaround > applies only to x86_32. Let's see: arch/x86/Makefile: # Never want PIC in a 32-bit kernel, prevent breakage with GCC built # with nonstandard options KBUILD_CFLAGS += -fno-pic $ gcc -Wp,-MMD,arch/x86/boot/.cpuflags.o.d ... -fno-pic ... -D__KBUILD_MODNAME=kmod_cpuflags -c -o arch/x86/boot/cpuflags.o arch/x86/boot/cpuflags.c So this workaround applies to nothing, I'd say. :) -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette