lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y7dZwWsiUfHKxN3S@zn.tnic>
Date:   Fri, 6 Jan 2023 00:14:09 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Miaohe Lin <linmiaohe@...wei.com>
Cc:     "x86@...nel.org" <x86@...nel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...hat.com" <mingo@...hat.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>, hpa@...or.com
Subject: Re: [BUG Report] undefined reference to `convert_to_fxsr'

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ