Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp442428rwb; Tue, 29 Nov 2022 00:13:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf4DU1sYjMWnOh72UUg6UjN2rfXIAw/OAlBRn5jJhstm9OrXQQQPHQEiY79xL3zConQtYO3l X-Received: by 2002:a17:906:bce9:b0:7ad:960d:3a4d with SMTP id op9-20020a170906bce900b007ad960d3a4dmr29253924ejb.522.1669709610906; Tue, 29 Nov 2022 00:13:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669709610; cv=none; d=google.com; s=arc-20160816; b=JrmudohF1abAmrNlvWsMJN0w6ON2Ozf5dJOOnl7lwOXZ5LJNlpNZJneWDAnKbbTxfD K8OWwZwjZubLR7Obd3uYC5b4r45fYNRx+vMEPXBcDi1ttJgHmVYsUQ822Vbo34b4HEo9 /+ElDgBcKM0461CoZGRLnqLRLobpX8j4+DqYS0yPA018zRxrSCsDlpyxGGF3zsWEC8w0 IlqscHOK4WPYFQYRK0WEfr+nepiJIZoaefM7tkizv3nhQy1AybAadHkWqdkc8E1ENYPP rOVwmqpjVHn+m/80Dv4+9fG1/3nUVSf7b3yayKXgk2N8Rjsc3xQ1TxvB9cpXf1HMoNnP zpUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2uE27wZBYUmbjYRRdmIErO64UjNOYGILNAfn5DaLwQw=; b=FQtUVwAGPeGWoyKXAKE1FHh/Bmy6BNx5qfmiOVqL0wwRYSlcxVtJ3aBlh/XF8ESEqT H65U5BfY5skK5Te1UAvQaZk48vFTbQpcr3Qgkxp7dJsF3PXmKc1nMfqTCRx4yZ+9aVvA 1NNoJPJstGqMJIXapWzxNwan+Z3n2O3VQQ8g6gX94BIKHlhGm+3S0uFob0zoxF1IGOMq 0EcIiT1Fp1AL4XXZQbnj6yXzx+sjjKkOYsZeOINYBJWC72bRyHlkCxVL4RgTeB75WVA1 /fCP6WIxO1rkOVNJNqNhQup9EK9siR7JyyNCC+aXzj1miZEMs46zF3CXYzGhFJ4fBpYK uuPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="EEenj/Oq"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa41-20020a17090786a900b007771bc8dbb4si12175063ejc.781.2022.11.29.00.13.08; Tue, 29 Nov 2022 00:13:30 -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=@gmail.com header.s=20210112 header.b="EEenj/Oq"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229670AbiK2Hjh (ORCPT + 82 others); Tue, 29 Nov 2022 02:39:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbiK2Hjg (ORCPT ); Tue, 29 Nov 2022 02:39:36 -0500 Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com [IPv6:2607:f8b0:4864:20::1132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6C0D49B63 for ; Mon, 28 Nov 2022 23:39:35 -0800 (PST) Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-3bf4ade3364so80302757b3.3 for ; Mon, 28 Nov 2022 23:39:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2uE27wZBYUmbjYRRdmIErO64UjNOYGILNAfn5DaLwQw=; b=EEenj/OqfjE4/fDoCbT05POwpd7FIodjXiZmbhNCTdgXUAzL24A0THU3oHnVMzJ72o Cx17Pee4kXRrLi4yguuZftqJHHOcPf4s5NtxidGBCXO00yMpFt1yFxU0xzeHJDbNsNkO ViVpNz4hd6oJUQteGTbXPEzjIbJy14sbAX0VbIdX08jYLPhU1ig2Vw/Sf+ZoxIFmZ/Vt HxB03Q2RwG0/u+u8GMXhxo/G0OR2But458Qbf1Cid+oJpsA3aNkCByuDb+edvPxWI4l7 aQNDHwGrMzTk3y9SBbDBFjxqcPsfKt/vP3d2/HHyam9YEXuis0JrvUrc6PDyE0sVexci XzUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2uE27wZBYUmbjYRRdmIErO64UjNOYGILNAfn5DaLwQw=; b=IEv0qf9AA3cc7gz/Ea24lHrDDIxfypbxxQm0jWj0cyum/dMlvnRPmcXOBFdCgNLHxj 8BSMU58z81DKgy/R1q6Dlxez2ef7itMjFOJxxtctbsgI67M/lnqN5tROWUslHVVPxMqu /XYG+Z4qg8zR0ULhu91pTni1qx3iB0H3J4xLp8ZgD2lwRPi921fbXOqlRU4YG7LDOlZO rbwIAwlWq3k21PJDTaeWvpErDaNt32BRwjdxkiJRZKmmYirP2kjznD/METZAxIHykPSB 936Fb2wxho9GW42+57d4hHDO/Ipgcxq2QU0DjTOdNxGoi13gQ9IKhKgAlHgIxXVnwH/8 0P+g== X-Gm-Message-State: ANoB5pnG4S8i6tY4K/vax2gmCsgztmSZ6UUolhIz5sQkzEkf2A7vM39e dzhGh6j27DCVLpmtBLK2zUx1d/7iEudEnvfeAZw= X-Received: by 2002:a81:700f:0:b0:38e:8263:755a with SMTP id l15-20020a81700f000000b0038e8263755amr52075160ywc.480.1669707574998; Mon, 28 Nov 2022 23:39:34 -0800 (PST) MIME-Version: 1.0 References: <20221104124546.196077-1-ubizjak@gmail.com> In-Reply-To: From: Uros Bizjak Date: Tue, 29 Nov 2022 08:39:23 +0100 Message-ID: Subject: Re: [PATCH] x86/boot: Remove x86_32 PIC using ebx workaround To: Borislav Petkov Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 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 before instruction that requires the value in %ebx. This way, PIC register is no more special and does not need any special handling. This includes inline asm which can clobber %ebx. > > So far so good. > > Why then does this matter for x86-64 where PIC addressing is done > rip-relative so %rbx is normal reg there? 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. Uros.