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: <e2f2b0e3-a72d-4b6f-9677-02de711b7d3a@t-8ch.de>
Date: Mon, 15 Sep 2025 10:55:44 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Benjamin Berg <benjamin@...solutions.net>
Cc: linux-um@...ts.infradead.org, Willy Tarreau <w@....eu>, 
	linux-kselftest@...r.kernel.org, Arnaldo Carvalho de Melo <acme@...hat.com>, 
	linux-kernel@...r.kernel.org, Tiwei Bie <tiwei.btw@...group.com>, 
	Benjamin Berg <benjamin.berg@...el.com>
Subject: Re: [PATCH 6/9] tools/nolibc: add option to disable startup code

On 2025-09-15 09:11:12+0200, Benjamin Berg wrote:
> From: Benjamin Berg <benjamin.berg@...el.com>
> 
> In principle, it is possible to use nolibc for only some object files in
> a program. In that case, the startup code in _start and _start_c is not
> going to be used. Add the NOLIBC_NO_STARTCODE compile time option to
> disable it entirely and also remove anything that depends on it.

Not a big fan of the naming. More than only _start()/_start_c() are
disabled. Maybe NOLIBC_NO_RUNTIME?  I'm horrible at naming...

> Doing this avoids warnings from modpost for UML as the _start_c code
> references the main function from the .init.text section while it is not
> inside .init itself.
> 
> Signed-off-by: Benjamin Berg <benjamin.berg@...el.com>
> ---
>  tools/include/nolibc/arch-arm.h       | 2 ++
>  tools/include/nolibc/arch-arm64.h     | 2 ++
>  tools/include/nolibc/arch-loongarch.h | 2 ++
>  tools/include/nolibc/arch-m68k.h      | 2 ++
>  tools/include/nolibc/arch-mips.h      | 2 ++
>  tools/include/nolibc/arch-powerpc.h   | 2 ++
>  tools/include/nolibc/arch-riscv.h     | 2 ++
>  tools/include/nolibc/arch-s390.h      | 2 ++
>  tools/include/nolibc/arch-sh.h        | 2 ++
>  tools/include/nolibc/arch-sparc.h     | 2 ++
>  tools/include/nolibc/arch-x86.h       | 4 ++++
>  tools/include/nolibc/crt.h            | 3 +++
>  tools/include/nolibc/stackprotector.h | 2 ++
>  tools/include/nolibc/stdlib.h         | 2 ++
>  tools/include/nolibc/sys.h            | 3 ++-
>  tools/include/nolibc/sys/auxv.h       | 3 +++
>  16 files changed, 36 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/include/nolibc/arch-arm.h b/tools/include/nolibc/arch-arm.h
> index 1f66e7e5a444..24ad348cc1e8 100644
> --- a/tools/include/nolibc/arch-arm.h
> +++ b/tools/include/nolibc/arch-arm.h
> @@ -185,6 +185,7 @@
>  })
>  
>  /* startup code */
> +#ifndef NOLIBC_NO_STARTCODE

I'd prefer the ifdef around the comments.

>  void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
>  {
>  	__asm__ volatile (
> @@ -193,5 +194,6 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _s
>  	);
>  	__nolibc_entrypoint_epilogue();
>  }
> +#endif /* NOLIBC_NO_STARTCODE */

(...)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ