Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1562175rwl; Thu, 5 Jan 2023 15:51:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXuwxkvnT1BRcXUY5BnTLgtIm0ULSYQQflt+bAuwMaxPPGfkELrEkg+KY9my5B2uT3wcbo+h X-Received: by 2002:a05:6a20:43a1:b0:b1:d250:d08c with SMTP id i33-20020a056a2043a100b000b1d250d08cmr65024860pzl.36.1672962690377; Thu, 05 Jan 2023 15:51:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672962690; cv=none; d=google.com; s=arc-20160816; b=paPAInGxJwuTu7dZWQaoxnDkh0fAVJl/Pj6oC85tcX7qrgM/Sbm6QXQrDuOo49EgSQ liE8rr5GkVi63G7QOQldRxZqEhKb9NdY0E+cLRTNhfDqqYWnF5596kcc1WWBBgHv//Mx qZH6ORjRTEdEBOGAClogkKpg4dahkOAzqz4m5Zg/3tw7Qk779ixi8jnW52Z60AKNJJiD F6MxYHmSPKH4NyzavEeArclPxIyz4Hf04+L34ASSIVTjbp1iRxTJz/JlLaEZx/pidABi o8Pl33BdTUs5uj4+6nwhaUjfJX2k7odwMSDZDHTwyxKfAcCYpKbrODcBV7So49w9uSDZ HwWw== 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=MNSXfz4m5shOmHSh2WUVIS4WJOht1d11VQUN1BAQyAQ=; b=db8/zVdkjeIgQZ7rIxYF6DJO9AGWXDFMMK6kX6mPvS6iz94uxKsupPBrokoS1JKjt8 oPZEp5RBSFJ2XiUudf+b9Wsos3w9cJPk5z0HUsRumsYgp/2BmnbPm+LH4OGbrDPOVd6U abdWAnm7bPxLngg4VYF68QGeUWONx+YnoWFAFkVvDhtBiquIYFR+MI3PggBQQfizinG3 /8wqM3l3O5bMUniWf6MB60GYOAQ7buFN69OEBB0c5xreY9Y5eBUNY1bz2ba+sdAKin76 n2PMelcaMcXEgAoKkw+Cl8S7pO/KadWgSgUJNXdUJRQl0r8FBwVXKaMw+wKAOpRs96es 7vaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Tj1AmzT6; 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 s82-20020a632c55000000b0049cd14d3a7esi24506749pgs.75.2023.01.05.15.51.21; Thu, 05 Jan 2023 15:51: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=@alien8.de header.s=dkim header.b=Tj1AmzT6; 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 S235845AbjAEXOR (ORCPT + 57 others); Thu, 5 Jan 2023 18:14:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230402AbjAEXOP (ORCPT ); Thu, 5 Jan 2023 18:14:15 -0500 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1673A676E3 for ; Thu, 5 Jan 2023 15:14:15 -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 AA1B31EC068E; Fri, 6 Jan 2023 00:14:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1672960453; 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=MNSXfz4m5shOmHSh2WUVIS4WJOht1d11VQUN1BAQyAQ=; b=Tj1AmzT6HkBmnWWY+h6OT0DBaVXA4PS7z1JyoElSP4qyy/LfF8MzT0xpGbJBQhDpEFlihE 4brdy9Bfoq9bC7IoMIocjbUPdTxbmKdoyRYL8lMYWtHK3age3EJETwOMSL65MsHc3kaMsU kDMTdwIlS9aRSpMlWrIekJZgQ9jkUrc= Date: Fri, 6 Jan 2023 00:14:09 +0100 From: Borislav Petkov To: Miaohe Lin Cc: "x86@kernel.org" , linux-kernel , "tglx@linutronix.de" , "mingo@redhat.com" , Dave Hansen , hpa@zytor.com Subject: Re: [BUG Report] undefined reference to `convert_to_fxsr' Message-ID: References: <50aa72a7-043d-8091-78de-458cbcc6c356@huawei.com> <23e2907c-5188-5ac6-3db8-1c5a12120bf2@huawei.com> <64fe1be4-954f-fe6f-44f0-59b572548663@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <64fe1be4-954f-fe6f-44f0-59b572548663@huawei.com> 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, Jan 03, 2023 at 11:05:01AM +0800, Miaohe Lin wrote: > Yes, it still reproduces in my working server. It might be the problem of gcc > version. What is that compiler you're using? Where did you get the package from? Does it have some out-of-tree patches in it? > I think it's because convert_to_fxsr() is only defined when CONFIG_X86_32 or > CONFIG_IA32_EMULATION is enabled. No, convert_to_fxsr() is part of arch/x86/kernel/fpu/regset.c which is built-in unconditionally. What happens is this here: bool fpu__restore_sig(void __user *buf, int ia32_frame) ... } else { success = __fpu_restore_sig(buf, buf_fx, ia32_fxstate); } That ia32_fxstate is false because ia32_frame &= (IS_ENABLED(CONFIG_X86_32) || IS_ENABLED(CONFIG_IA32_EMULATION)); neither of those config items are set... /* * Only FXSR enabled systems need the FX state quirk. * FRSTOR does not need it and can use the fast path. */ if (ia32_frame && use_fxsr()) { buf_fx = buf + sizeof(struct fregs_state); size += sizeof(struct fregs_state); ia32_fxstate = true; ^^^^^^^^^^^^^^^^^^^ ... so this doesn't happen. } Then, in __fpu_restore_sig() you have: if (likely(!ia32_fxstate)) { /* Restore the FPU registers directly from user memory. */ return restore_fpregs_from_user(buf_fx, user_xfeatures, fx_only, state_size); } and since ia32_fxstate is false, we return here, the compiler sees that everything behind that code is dead code and eliminates it. Your compiler doesn't, apparently. It does remove it from regset.c, though, as it sees it is an unused function, which leads to this undefined reference. So it looks like a funky compiler to me... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette