From: Danish Khateeb <danishkhateeb03@gmail.com>
To: Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>
Cc: "Shuah Khan" <shuah@kernel.org>, "Andy Chiu" <andybnac@gmail.com>,
"Sergey Matyukevich" <geomatsi@gmail.com>,
"Thomas Weißschuh" <linux@weissschuh.net>,
linux-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Danish Khateeb" <danishkhateeb03@gmail.com>
Subject: [PATCH 2/2] selftests: riscv: vector: Fix the check for children exiting with -1
Date: Sat, 26 Sep 2026 10:55:35 -0500 [thread overview]
Message-ID: <20260926155535.306111-3-danishkhateeb03@gmail.com> (raw)
In-Reply-To: <20260926155535.306111-1-danishkhateeb03@gmail.com>
vstate_exec_nolibc and launch_test() look for a child which failed with
exit(-1) by checking WEXITSTATUS(status) == -1. But WEXITSTATUS() only
returns the low 8 bits of the exit code, so the check never matches.
vstate_exec_nolibc then returns ctrl as if the child had succeeded,
which is the value the harness expects. So when a child finds that its
vstate_ctrl differs from its parent's, it prints an error, but the test
still passes.
Compare the exit status with 255 instead. A successful child exits with
its vstate_ctrl, which is at most 0x1f. launch_test() already failed
the test on 255, but now reports it as an abnormal exit.
Fixes: 7cf6198ce22d ("selftests: Test RISC-V Vector prctl interface")
Assisted-by: LLM
Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
---
tools/testing/selftests/riscv/vector/v_helpers.c | 2 +-
tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/riscv/vector/v_helpers.c b/tools/testing/selftests/riscv/vector/v_helpers.c
index de6da7c8d2f1..8942ddf2b52b 100644
--- a/tools/testing/selftests/riscv/vector/v_helpers.c
+++ b/tools/testing/selftests/riscv/vector/v_helpers.c
@@ -81,7 +81,7 @@ int launch_test(char *next_program, int test_inherit, int xtheadvector)
return -3;
}
- if ((WIFEXITED(status) && WEXITSTATUS(status) == -1) ||
+ if ((WIFEXITED(status) && WEXITSTATUS(status) == 255) ||
WIFSIGNALED(status)) {
printf("child exited abnormally\n");
return -4;
diff --git a/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c b/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
index 5f53e5e8ac52..05f18b13a36a 100644
--- a/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
+++ b/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
exit(-1);
}
- if (WIFEXITED(status) && WEXITSTATUS(status) == -1) {
+ if (WIFEXITED(status) && WEXITSTATUS(status) == 255) {
puts("child exited abnormally\n");
exit(-1);
}
--
2.55.0
prev parent reply other threads:[~2026-09-26 15:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 15:55 [PATCH 0/2] selftests: riscv: vector: Fix the checks of the child's exit status Danish Khateeb
2026-09-26 15:55 ` [PATCH 1/2] selftests: riscv: vstate_exec_nolibc: Check the return value of waitpid() Danish Khateeb
2026-09-26 15:55 ` Danish Khateeb [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=20260926155535.306111-3-danishkhateeb03@gmail.com \
--to=danishkhateeb03@gmail.com \
--cc=alex@ghiti.fr \
--cc=andybnac@gmail.com \
--cc=aou@eecs.berkeley.edu \
--cc=geomatsi@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@weissschuh.net \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=shuah@kernel.org \
/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®