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: <3b8dad35-5af2-41f3-aea2-07db9761dd4a@suse.com>
Date: Wed, 14 May 2025 10:40:23 +0200
From: Petr Pavlu <petr.pavlu@...e.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: mcgrof@...nel.org, x86@...nel.org, hpa@...or.com,
 samitolvanen@...gle.com, da.gomez@...sung.com, masahiroy@...nel.org,
 nathan@...nel.org, nicolas@...sle.eu, linux-kernel@...r.kernel.org,
 linux-modules@...r.kernel.org, linux-kbuild@...r.kernel.org,
 hch@...radead.org, gregkh@...uxfoundation.org, roypat@...zon.co.uk
Subject: Re: [PATCH v3 5/5] module: Provide EXPORT_SYMBOL_GPL_FOR_MODULES()
 helper

On 5/2/25 16:12, Peter Zijlstra wrote:
> Helper macro to more easily limit the export of a symbol to a given
> list of modules.
> 
> Eg:
> 
>   EXPORT_SYMBOL_GPL_FOR_MODULES(preempt_notifier_inc, "kvm");
> 
> will limit the use of said function to kvm.ko, any other module trying
> to use this symbol will refure to load (and get modpost build
> failures).
> 
> Requested-by: Masahiro Yamada <masahiroy@...nel.org>
> Requested-by: Christoph Hellwig <hch@...radead.org>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
> [...]
> --- a/include/linux/export.h
> +++ b/include/linux/export.h
> @@ -24,11 +24,17 @@
>  	.long sym
>  #endif
>  
> -#define ___EXPORT_SYMBOL(sym, license, ns)		\
> +/*
> + * LLVM integrated assembler cam merge adjacent string literals (like
> + * C and GNU-as) passed to '.ascii', but not to '.asciz' and chokes on:
> + *
> + *   .asciz "MODULE_" "kvm" ;
> + */

Typo: "cam" -> "can't". I can correct it when picking up the series.

Reviewed-by: Petr Pavlu <petr.pavlu@...e.com>

-- Petr

> +#define ___EXPORT_SYMBOL(sym, license, ns...)		\
>  	.section ".export_symbol","a"		ASM_NL	\
>  	__export_symbol_##sym:			ASM_NL	\
>  		.asciz license			ASM_NL	\
> -		.asciz ns			ASM_NL	\
> +		.ascii ns "\0"			ASM_NL	\
>  		__EXPORT_SYMBOL_REF(sym)	ASM_NL	\
>  	.previous
>  
> @@ -85,4 +91,6 @@
>  #define EXPORT_SYMBOL_NS(sym, ns)	__EXPORT_SYMBOL(sym, "", ns)
>  #define EXPORT_SYMBOL_NS_GPL(sym, ns)	__EXPORT_SYMBOL(sym, "GPL", ns)
>  
> +#define EXPORT_SYMBOL_GPL_FOR_MODULES(sym, mods) __EXPORT_SYMBOL(sym, "GPL", "module:" mods)
> +
>  #endif /* _LINUX_EXPORT_H */
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ