From: Borislav Petkov <bp@alien8.de>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: "x86@kernel.org" <x86@kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
hpa@zytor.com
Subject: Re: [BUG Report] undefined reference to `convert_to_fxsr'
Date: Fri, 6 Jan 2023 00:14:09 +0100 [thread overview]
Message-ID: <Y7dZwWsiUfHKxN3S@zn.tnic> (raw)
In-Reply-To: <64fe1be4-954f-fe6f-44f0-59b572548663@huawei.com>
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
next prev parent reply other threads:[~2023-01-05 23:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-28 12:31 Miaohe Lin
2022-12-28 12:39 ` Borislav Petkov
2022-12-29 1:50 ` Miaohe Lin
2022-12-29 15:17 ` Borislav Petkov
2022-12-30 1:49 ` Miaohe Lin
2022-12-30 11:16 ` Borislav Petkov
2023-01-03 3:05 ` Miaohe Lin
2023-01-05 23:14 ` Borislav Petkov [this message]
2023-01-07 2:10 ` Miaohe Lin
2023-01-07 11:07 ` Borislav Petkov
2023-01-09 1:48 ` Miaohe Lin
2023-01-09 11:49 ` Borislav Petkov
2023-01-09 12:32 ` Miaohe Lin
2023-01-09 17:09 ` Nathan Chancellor
2023-01-10 1:13 ` Miaohe Lin
2022-12-30 12:20 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y7dZwWsiUfHKxN3S@zn.tnic \
--to=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®