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]
Date:   Wed, 27 Apr 2022 23:29:19 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Miroslav Benes <mbenes@...e.cz>,
        Emil Velikov <emil.l.velikov@...il.com>,
        Jessica Yu <jeyu@...nel.org>,
        Quentin Perret <qperret@...gle.com>,
        Matthias Maennich <maennich@...gle.com>
Subject: Re: [PATCH v2] export: fix string handling of namespace in EXPORT_SYMBOL_NS

On Wed, Apr 27, 2022 at 6:06 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> Commit c3a6cf19e695 ("export: avoid code duplication in
> include/linux/export.h") broke the ability for a defined string to be
> used as a namespace value.

In hindsight, this was a bad idea.


EXPORT_SYMBOL_NS_GPL(dw_spi_resume_host, "SPI_DW_CORE")

   is much much better than:

EXPORT_SYMBOL_NS_GPL(dw_spi_resume_host, SPI_DW_CORE)




ccflags-y += -DDEFAULT_SYMBOL_NAMESPACE=USB_STORAGE

is also a bad idea.

When you look at EXPORT_SYMBOL_GPL() in C files, you will not be
aware of the presence of the namespace.



Anyway, it is presumably too late to fix it.


>  Fix this up by using stringify to properly
> encode the namespace name.
>
> Fixes: c3a6cf19e695 ("export: avoid code duplication in include/linux/export.h")
> Cc: Miroslav Benes <mbenes@...e.cz>
> Cc: Emil Velikov <emil.l.velikov@...il.com>
> Cc: Jessica Yu <jeyu@...nel.org>
> Cc: Quentin Perret <qperret@...gle.com>
> Cc: Masahiro Yamada <yamada.masahiro@...ionext.com>

This email is no longer valid.

Feel free to replace it with

Reviewed-by: Masahiro Yamada <masahiroy@...nel.org>



> Cc: Matthias Maennich <maennich@...gle.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
> v2: use stringify() instead of 2 step redirection as pointed out by Masahiro
>
>  include/linux/export.h | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/export.h b/include/linux/export.h
> index 27d848712b90..5910ccb66ca2 100644
> --- a/include/linux/export.h
> +++ b/include/linux/export.h
> @@ -2,6 +2,8 @@
>  #ifndef _LINUX_EXPORT_H
>  #define _LINUX_EXPORT_H
>
> +#include <linux/stringify.h>
> +
>  /*
>   * Export symbols from the kernel to modules.  Forked from module.h
>   * to reduce the amount of pointless cruft we feed to gcc when only
> @@ -154,7 +156,6 @@ struct kernel_symbol {
>  #endif /* CONFIG_MODULES */
>
>  #ifdef DEFAULT_SYMBOL_NAMESPACE
> -#include <linux/stringify.h>
>  #define _EXPORT_SYMBOL(sym, sec)       __EXPORT_SYMBOL(sym, sec, __stringify(DEFAULT_SYMBOL_NAMESPACE))
>  #else
>  #define _EXPORT_SYMBOL(sym, sec)       __EXPORT_SYMBOL(sym, sec, "")
> @@ -162,8 +163,8 @@ struct kernel_symbol {
>
>  #define EXPORT_SYMBOL(sym)             _EXPORT_SYMBOL(sym, "")
>  #define EXPORT_SYMBOL_GPL(sym)         _EXPORT_SYMBOL(sym, "_gpl")
> -#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_NS(sym, ns)      __EXPORT_SYMBOL(sym, "", __stringify(ns))
> +#define EXPORT_SYMBOL_NS_GPL(sym, ns)  __EXPORT_SYMBOL(sym, "_gpl", __stringify(ns))
>
>  #endif /* !__ASSEMBLY__ */
>
> --
> 2.36.0
>


-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ