mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Daniel Palmer <daniel@thingy.jp>
Cc: w@1wt.eu, linux-kernel@vger.kernel.org,
	 Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	 Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	llvm@lists.linux.dev
Subject: Re: [PATCH v3 3/3] selftests/nolibc: Add test for getcwd() and readlink()
Date: Fri, 3 Jul 2026 19:38:01 +0200	[thread overview]
Message-ID: <24e874dd-9bf0-46b2-b22e-73ec3c6ff941@t-8ch.de> (raw)
In-Reply-To: <20260702085101.3304547-4-daniel@thingy.jp>

(+Cc clang/llvm folks, scroll down to test_getcwd())

Hi Daniel,

On 2026-07-02 17:51:01+0900, Daniel Palmer wrote:
> Add a test that uses both getcwd() and readlink() so that both
> are exercised.
> 
> First the happy path is tested by fetching what should be the
> same string via getcwd() and readlink() and checking they match.
> 
> Then a few different combinations of bad parameters are passed to
> getcwd() to make sure it returns NULL and sets errno in those
> cases.
> 
> Signed-off-by: Daniel Palmer <daniel@thingy.jp>

Applied, thanks.

> ---
>  tools/testing/selftests/nolibc/nolibc-test.c | 53 ++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
> index c1c1ce43a047..ad3f6e0751be 100644
> --- a/tools/testing/selftests/nolibc/nolibc-test.c
> +++ b/tools/testing/selftests/nolibc/nolibc-test.c
> @@ -854,6 +854,58 @@ static int test_dirent(void)
>  	return 0;
>  }
>  
> +static int test_getcwd(void)
> +{

I removed the static from this function.
When it is inlined the tests fail on SPARC on clang.
It seems the system call register is clobbered before the syscall is
invoked. It works fine on GCC.
The fix in [0] makes things a bit better, but not completely.

To reproduce:

* Check out the branch for-next in [1]
* Apply [0]
* cd tools/testing/selftests/nolibc
* ./run-tests.sh -m user -l sparc32
* Only run the problematic testcase: ./nolibc-test syscall:1

(The "sparc64" configuration is also broken,
it looks like the same issue)

This happens for me with clang 22.1.6.

(...)

[0] https://lore.kernel.org/lkml/20260703-nolibc-sparc-asm-v1-1-c7fe73e2e777@weissschuh.net/
[1] https://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc.git/


Thomas

      reply	other threads:[~2026-07-03 17:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02  8:50 [PATCH v3 0/3] nolibc: Add " Daniel Palmer
2026-07-02  8:50 ` [PATCH v3 1/3] tools/nolibc: unistd: Add getcwd() Daniel Palmer
2026-07-02 11:33   ` Willy Tarreau
2026-07-02  8:51 ` [PATCH v3 2/3] tools/nolibc: unistd: Add readlink() Daniel Palmer
2026-07-02 11:34   ` Willy Tarreau
2026-07-02  8:51 ` [PATCH v3 3/3] selftests/nolibc: Add test for getcwd() and readlink() Daniel Palmer
2026-07-03 17:38   ` Thomas Weißschuh [this message]

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=24e874dd-9bf0-46b2-b22e-73ec3c6ff941@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=daniel@thingy.jp \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --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®