All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Daniel Palmer <daniel@thingy.jp>
Cc: linux@weissschuh.net, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 02/10] tools/nolibc: crt: Split _start_c() into stack-only and normal parts
Date: Sat, 7 Feb 2026 16:45:17 +0100	[thread overview]
Message-ID: <aYdeDWCCeDjYerin@1wt.eu> (raw)
In-Reply-To: <20260204124542.523567-3-daniel@thingy.jp>

On Wed, Feb 04, 2026 at 09:45:34PM +0900, Daniel Palmer wrote:
> To prepare for nolibc programs being able to relocate themselves
> we need to split _start_c() into two parts:
> 
> - One part that only uses the stack so there are no accesses via
>   the GOT etc that isn't setup yet. Note that on m68k at least
>   this also means forcing the stackprotector off because accessing
>   the stack protector canary is done via the GOT.
> 
> - Another part that is called after we have done relocation so it
>   is safe to access global variables etc that might use the GOT etc.
> 
> Signed-off-by: Daniel Palmer <daniel@thingy.jp>
> ---
>  tools/include/nolibc/compiler.h |  6 ++++
>  tools/include/nolibc/crt.h      | 57 ++++++++++++++++++---------------
>  2 files changed, 38 insertions(+), 25 deletions(-)
> 
> diff --git a/tools/include/nolibc/compiler.h b/tools/include/nolibc/compiler.h
> index 87090bbc53e0..3f403e54e4f4 100644
> --- a/tools/include/nolibc/compiler.h
> +++ b/tools/include/nolibc/compiler.h
> @@ -47,4 +47,10 @@
>  #  define __nolibc_fallthrough do { } while (0)
>  #endif /* __nolibc_has_attribute(fallthrough) */
>  
> +#if __nolibc_has_feature(undefined_behavior_sanitizer)
> +#  define __no_sanitize __attribute__((no_sanitize("function")))
> +#else
> +#  define __no_sanitize
> +#endif

I'm starting to feel uncomfortable with the addition of new __no_foo
stuff, which doesn't have the "nolibc" prefix, risking to conflict with
userland code. I think we'll have to go through a cleanup patch at some
point for __no_sanitize and __no_stack_protector.

So probably in order to reduce the technical debt it would be nice to
to prepend __nolibc in front of this new internal macro. Maybe this part
of the patch should be a separate cleanup patch by the way, as future
patches might depend on it.

Willy

  reply	other threads:[~2026-02-07 15:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 12:45 [RFC PATCH v2 00/10] nolibc: Add static-pie support Daniel Palmer
2026-02-04 12:45 ` [RFC PATCH v2 01/10] elf: Add relocation types used by nolibc Daniel Palmer
2026-02-07 15:35   ` Willy Tarreau
2026-02-16 20:33   ` Thomas Weißschuh
2026-02-04 12:45 ` [RFC PATCH v2 02/10] tools/nolibc: crt: Split _start_c() into stack-only and normal parts Daniel Palmer
2026-02-07 15:45   ` Willy Tarreau [this message]
2026-02-08  1:40     ` Daniel Palmer
2026-02-16 20:42   ` Thomas Weißschuh
2026-02-04 12:45 ` [RFC PATCH v2 03/10] tools/nolibc: Add basic ELF self-relocation support for static PIE Daniel Palmer
2026-02-07 15:49   ` Willy Tarreau
2026-02-04 12:45 ` [RFC PATCH v2 04/10] tools/nolibc: m68k: Add relocation support Daniel Palmer
2026-02-16 20:51   ` Thomas Weißschuh
2026-02-04 12:45 ` [RFC PATCH v2 05/10] tools/nolibc: x86: " Daniel Palmer
2026-02-16 21:06   ` Thomas Weißschuh
2026-02-04 12:45 ` [RFC PATCH v2 06/10] tools/nolibc: riscv: " Daniel Palmer
2026-02-04 12:45 ` [RFC PATCH v2 07/10] tools/nolibc: arm: " Daniel Palmer
2026-02-04 12:45 ` [RFC PATCH v2 08/10] tools/nolibc: sh: " Daniel Palmer
2026-02-04 12:45 ` [RFC PATCH v2 09/10] tools/nolibc: ppc: " Daniel Palmer
2026-02-04 12:45 ` [RFC PATCH v2 10/10] selftests/nolibc: Add option for building with -static-pie Daniel Palmer
2026-02-16 20:59   ` Thomas Weißschuh
2026-02-07 15:34 ` [RFC PATCH v2 00/10] nolibc: Add static-pie support Willy Tarreau
2026-02-08  1:35   ` Daniel Palmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aYdeDWCCeDjYerin@1wt.eu \
    --to=w@1wt.eu \
    --cc=daniel@thingy.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.