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: <Yk/zhV3SGib6TaI5@zn.tnic>
Date:   Fri, 8 Apr 2022 10:34:13 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Jithu Joseph <jithu.joseph@...el.com>
Cc:     hdegoede@...hat.com, markgross@...nel.org, tglx@...utronix.de,
        mingo@...hat.com, dave.hansen@...ux.intel.com, x86@...nel.org,
        hpa@...or.com, corbet@....net, gregkh@...uxfoundation.org,
        andriy.shevchenko@...ux.intel.com, ashok.raj@...el.com,
        tony.luck@...el.com, rostedt@...dmis.org, dan.j.williams@...el.com,
        linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
        platform-driver-x86@...r.kernel.org, patches@...ts.linux.dev,
        ravi.v.shankar@...el.com
Subject: Re: [PATCH v2 01/10] x86/microcode/intel: expose
 collect_cpu_info_early() for IFS

On Thu, Apr 07, 2022 at 12:13:38PM -0700, Jithu Joseph wrote:
> diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/microcode_intel.h
> index d85a07d7154f..cf0fd1d712b4 100644
> --- a/arch/x86/include/asm/microcode_intel.h
> +++ b/arch/x86/include/asm/microcode_intel.h
> @@ -68,6 +68,10 @@ static inline u32 intel_get_microcode_revision(void)
>  	return rev;
>  }
>  
> +int cpu_collect_info_early(struct ucode_cpu_info *uci);
> +bool cpu_signatures_match(unsigned int s1, unsigned int p1,
> +			  unsigned int s2, unsigned int p2);
> +

So you can't move the functions to cpu/intel.c but put the
prototype declarations in the microcode header - they should go to
arch/x86/include/asm/cpu.h or so.


>  #ifdef CONFIG_MICROCODE_INTEL
>  extern void __init load_ucode_intel_bsp(void);
>  extern void load_ucode_intel_ap(void);
> diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
> index 8321c43554a1..2008c8267fd3 100644
> --- a/arch/x86/kernel/cpu/intel.c
> +++ b/arch/x86/kernel/cpu/intel.c
> @@ -181,6 +181,53 @@ static bool bad_spectre_microcode(struct cpuinfo_x86 *c)
>  	return false;
>  }
>  
> +bool cpu_signatures_match(unsigned int s1, unsigned int p1,

That function is Intel-specific:

intel_cpu_signatures_match()

and it is small enough to stick it in the above header and make it an
inline without the need for an export.

> +			  unsigned int s2, unsigned int p2)
> +{
> +	if (s1 != s2)
> +		return false;
> +
> +	/* Processor flags are either both 0 ... */
> +	if (!p1 && !p2)
> +		return true;
> +
> +	/* ... or they intersect. */
> +	return p1 & p2;
> +}
> +EXPORT_SYMBOL_GPL(cpu_signatures_match);
> +
> +int cpu_collect_info_early(struct ucode_cpu_info *uci)

intel_collect_cpu_info_early()

-- 
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