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:   Tue, 25 Jul 2023 11:38:48 +0200
From:   Petr Mladek <pmladek@...e.com>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     Luis Chamberlain <mcgrof@...nel.org>,
        Arnd Bergmann <arnd@...db.de>, Rong Tao <rongtao@...tc.cn>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Will Deacon <will@...nel.org>,
        Quentin Perret <qperret@...gle.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] samples/hw_breakpoint: fix building without module
 unloading

On Tue 2023-07-25 10:25:36, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> __symbol_put() is really meant as an internal helper and is not available
> when module unloading is disabled, unlike the previously used symbol_put():

Ah, I have missed this.

> samples/hw_breakpoint/data_breakpoint.c: In function 'hw_break_module_exit':
> samples/hw_breakpoint/data_breakpoint.c:73:9: error: implicit declaration of function '__symbol_put'; did you mean '__symbol_get'? [-Werror=implicit-function-declaration]
> 
> The hw_break_module_exit() function is not actually used when module
> unloading is disabled, but it still causes the build failure for an
> undefined identifier. Enclose this one call in an appropriate #ifdef to
> clarify what the requirement is. Leaving out the entire exit function
> would also work but feels less clar in this case.

> --- a/samples/hw_breakpoint/data_breakpoint.c
> +++ b/samples/hw_breakpoint/data_breakpoint.c
> @@ -70,7 +70,9 @@ static int __init hw_break_module_init(void)
>  static void __exit hw_break_module_exit(void)
>  {
>  	unregister_wide_hw_breakpoint(sample_hbp);
> +#ifdef CONFIG_MODULE_UNLOAD
>  	__symbol_put(ksym_name);
> +#endif
>  	printk(KERN_INFO "HW Breakpoint for %s write uninstalled\n", ksym_name);
>  }

I see that both symbol_put() and symbol_put_addr() are defined
as noops twice:

   + when !defined(CONFIG_MODULE_UNLOAD)
   + when !defined(CONFIG_MODULES)

This patch is enough because samples/hw_breakpoint/data_breakpoint.c
could be built only as a module, so feel free to use:

Reviewed-by: Petr Mladek <pmladek@...e.com>

But even better solution would be to define symbol_put_name() as
a noop in both situations and use it.

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ