From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Willy Tarreau <w@1wt.eu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tools/nolibc: rename sys_foo() functions to _sys_foo()
Date: Sun, 22 Mar 2026 11:43:56 +0100 [thread overview]
Message-ID: <9b30e65c-2ee8-4f0a-b4b9-a48a0964e586@t-8ch.de> (raw)
In-Reply-To: <ab-xIgENyZHgqoCK@1wt.eu>
On 2026-03-22 10:06:42+0100, Willy Tarreau wrote:
> On Thu, Mar 19, 2026 at 05:20:17PM +0100, Thomas Weißschuh wrote:
> > The sys_foo() naming scheme used by the syscall wrappers may collide
> > with application symbols. Especially as 'sys_' is an obvious naming
> > scheme an application may choose for its own custom systemcall wrappers.
>
> Yes but on the other hand it might implement it when missing the one
> offered by the libc.
I don't really get this sentence. Do you refer to the '#ifdef sys_foo'
as you mention below?
(...)
> > While this may break some existing users, adapting them should be
> > straightforward. Given that nolibc is most-likely vendored, no
> > unexpected breakage should happen. No in-tree users are affected.
>
> I also checked in my local stuff (preinit, watchdog daemon etc) and
> didn't find any user of sys_*.
Nice!
> > These conflicts happen when compiling some of the kernel selftests
> > with nolibc.
>
> You mean some of the syscall entry points ? If so, I'm seeing one
> exception of _sys_rt_sigreturn(), not convinced it could be an issue
> though.
Not the syscall entrypoints, these are internal to the kernel.
Some selftests bypass libc (for various, legitimate reasons) and
directly call the syscalls. They tend to name their wrappers
'sys_foo()'.
See for example these:
* tools/testing/selftests/vDSO/vdso_test_correctness.c
* tools/testing/selftests/bpf/bpf_util.h
* tools/testing/selftests/bpf/task_local_storage_helpers.h
* tools/testing/selftests/rseq/param_test.c
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> > ---
> > I am not really thrilled about breaking these names.
> > But every other option seems to be horribly to maintain
> > or will break sooner or later anyways.
> > Any ideas?
>
> I think your approach is reasonable for the reasons you explained. Yes we
> do want to continue to export these, and they're not supposed to be spread
> all over application code, so changes if any should be very limited. So:
>
> Acked-by: Willy Tarreau <w@1wt.eu>
Thanks! And pushed to the git tree.
> On a related topic, I've been thinking several times about how to discover
> support or not of a syscall in nolibc by the application, especially since
> the lib improves fast and applications might not want to wait for it to
> support a new syscall, and end up with their own as you suggested above.
> Maybe this _sys_foo thing could be the opportunity for us to generalize
> the systematic addition of:
>
> #define _sys_foo _sys_foo
>
> before every definition, so that application can simply use #ifndef to
> define their own local version. There's no emergency, it's been that way
> for years, I'm sharing it just as food for thought.
I am not sure about that.
In the most common case, where the version of nolibc is locked,
the local version would either be used all the time or never.
So any ifdeffery would only make the code harder to read.
Even if a user really needs to handle different versions of nolibc,
in my opinion they should just always use their custom code to make
sure to keep the behavior predictable.
Thomas
next prev parent reply other threads:[~2026-03-22 10:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 16:20 Thomas Weißschuh
2026-03-22 9:06 ` Willy Tarreau
2026-03-22 10:43 ` Thomas Weißschuh [this message]
2026-03-22 11:03 ` Willy Tarreau
2026-03-24 17:01 ` Thomas Weißschuh
2026-03-29 5:06 ` Willy Tarreau
2026-04-04 14:29 ` Thomas Weißschuh
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=9b30e65c-2ee8-4f0a-b4b9-a48a0964e586@t-8ch.de \
--to=linux@weissschuh.net \
--cc=linux-kernel@vger.kernel.org \
--cc=w@1wt.eu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®