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: <Z8BiUnkPnvrx06vp@gmail.com>
Date: Thu, 27 Feb 2025 14:02:10 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Kevin Brodsky <kevin.brodsky@....com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, bp@...en8.de,
	dan.j.williams@...el.com, dave.hansen@...ux.intel.com,
	david@...hat.com, jane.chu@...cle.com, osalvador@...e.de,
	tglx@...utronix.de
Subject: Re: [PATCH v2 2/2] x86/mm: Remove unnecessary include in set_memory.h


* Kevin Brodsky <kevin.brodsky@....com> wrote:

> Commit 03b122da74b2 ("x86/sgx: Hook arch_memory_failure() into
> mainline code") included <linux/mm.h> in asm/set_memory.h to provide
> some helper. However commit b3fdf9398a16 ("x86/mce: relocate
> set{clear}_mce_nospec() functions") moved the inline definitions
> someplace else, and now set_memory.h just declares a bunch of
> functions.
> 
> No need for the whole linux/mm.h for declaring functions; just
> remove that include. This helps avoid circular dependency headaches
> (e.g. if linux/mm.h ends up including <linux/set_memory.h>).
> 
> This change requires a couple of include fixups not to break the
> build:
> 
> * asm/smp.h: including <asm/thread_info.h> directly relies on
>   <linux/thread_info.h> having already been included, because the
>   former needs the BAD_STACK/NOT_STACK constants defined in the
>   latter. This is no longer the case when asm/smp.h is included from
>   some driver file - just include <linux/thread_info.h> to stay out
>   of trouble.
> 
> * sev-guest.c relies on <asm/set_memory.h> including <linux/mm.h>,
>   so we just need to make that include explicit.
> 
> Signed-off-by: Kevin Brodsky <kevin.brodsky@....com>
> ---
>  arch/x86/include/asm/set_memory.h       | 1 -
>  arch/x86/include/asm/smp.h              | 2 +-
>  drivers/virt/coco/sev-guest/sev-guest.c | 1 +
>  3 files changed, 2 insertions(+), 2 deletions(-)

So I tried to pick up this patch belatedly, but there's more places 
that mistakenly learned to rely on the stray <linux/mm.h> inclusion, 
for example on x86 defconfig-ish kernels:


  In file included from drivers/gpu/drm/i915/gt/intel_ggtt.c:6:
  ./arch/x86/include/asm/set_memory.h:40:57: error: unknown type name ‘pgprot_t’
  40 | int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot);
  |                                                         ^~~~~~~~

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ