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] [day] [month] [year] [list]
Message-ID: <CAK7LNASFyJL8UOfFXxFcaoSNavkxf1dfShUZGF=pgbRYOARctA@mail.gmail.com>
Date: Thu, 6 Feb 2025 01:08:18 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, 
	Linus Torvalds <torvalds@...ux-foundation.org>, Arnd Bergmann <arnd@...db.de>, 
	Daniel Gomez <da.gomez@...sung.com>, Luis Chamberlain <mcgrof@...nel.org>, 
	Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>, Petr Pavlu <petr.pavlu@...e.com>, 
	Sami Tolvanen <samitolvanen@...gle.com>, linux-arch@...r.kernel.org, 
	linux-modules@...r.kernel.org
Subject: Re: [PATCH v3] kbuild: keep symbols for symbol_get() even with CONFIG_TRIM_UNUSED_KSYMS

On Sun, Feb 2, 2025 at 3:51 AM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> Linus observed that the symbol_request(utf8_data_table) call fails when
> CONFIG_UNICODE=y and CONFIG_TRIM_UNUSED_KSYMS=y.
>
> symbol_get() relies on the symbol data being present in the ksymtab for
> symbol lookups. However, EXPORT_SYMBOL_GPL(utf8_data_table) is dropped
> due to CONFIG_TRIM_UNUSED_KSYMS, as no module references it in this case.
>
> Probably, this has been broken since commit dbacb0ef670d ("kconfig option
> for TRIM_UNUSED_KSYMS").
>
> This commit addresses the issue by leveraging modpost. Symbol names
> passed to symbol_get() are recorded in the special .no_trim_symbol
> section, which is then parsed by modpost to forcibly keep such symbols.
> The .no_trim_symbol section is discarded by the linker scripts, so there
> is no impact on the size of the final vmlinux or modules.
>
> This commit cannot resolve the issue for direct calls to __symbol_get()
> because the symbol name is not known at compile-time.
>
> Although symbol_get() may eventually be deprecated, this workaround
> should be good enough meanwhile.
>
> Reported-by: Linus Torvalds <torvalds@...ux-foundation.org>
> Suggested-by: Linus Torvalds <torvalds@...ux-foundation.org>
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> ---
>
> Changes in v3:
>  - More precise check in case symbol_get() is called from a module
>
> Changes in v2:
>  - Call keep_no_trim_symbols() for modules as well.
>    EXPORT_SYMBOL() may disppear if symbol_get() calls a symbol
>    within this same module.
>
>  include/asm-generic/vmlinux.lds.h |  1 +
>  include/linux/module.h            |  5 ++++-
>  scripts/mod/modpost.c             | 35 +++++++++++++++++++++++++++++++
>  scripts/mod/modpost.h             |  6 ++++++
>  scripts/module.lds.S              |  1 +
>  5 files changed, 47 insertions(+), 1 deletion(-)
>

Applied to linux-kbuild/fixes.



-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ