From: Thomas Weißschuh linux@weissschuh.net
[ Upstream commit 61a3cf7934b6da3c926cd9961860dd94eb7192ba ]
wait4() is deprecated, non-standard and about to be removed from nolibc.
Switch to the equivalent waitpid() call.
Signed-off-by: Thomas Weißschuh linux@weissschuh.net Reviewed-by: Mark Brown broonie@kernel.org Acked-by: Catalin Marinas catalin.marinas@arm.com Link: https://lore.kernel.org/r/20250821-nolibc-enosys-v1-6-4b63f2caaa89@weissschu... Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
Based on my comprehensive analysis of the commit and related changes, here is my determination:
## Backport Status: YES (conditional)
### Analysis
**Commit Summary:** This commit replaces `wait4()` with `waitpid()` in the ARM64 TPIDR2 selftest. The change is part of a coordinated nolibc cleanup series that removes deprecated syscall wrappers.
**Code Changes Analysis:** The commit makes a functionally equivalent substitution: - **Before**: `wait4(ret, &status, __WCLONE, NULL)` - **After**: `waitpid(ret, &status, __WCLONE)`
Since the `rusage` parameter to `wait4()` was NULL, this is semantically identical to `waitpid()`. The man page explicitly states wait4() is "nonstandard" and "deprecated," recommending waitpid() for new programs.
**Why This Should Be Backported:**
1. **Build Dependency**: This commit (61a3cf7934b6d) is patch 6/7 of the nolibc-enosys series, immediately followed by patch 7/7 (4c2ef951cfe68) which removes wait4() from nolibc. Both commits are already backported to this 6.17 tree, indicating stable maintainers have decided to keep nolibc synchronized.
2. **Infrastructure Maintenance**: Without this change, the tpidr2 test will fail to compile once wait4() is removed from nolibc, breaking the ARM64 selftest suite.
3. **Low Risk**: The change is trivial, well-reviewed (Mark Brown, Catalin Marinas), and functionally equivalent. Only test code is affected, not kernel runtime code.
4. **No Regression Risk**: waitpid() with these arguments behaves identically to wait4() with NULL rusage parameter.
**Stable Tree Criteria:** - ✓ Small and contained (5 lines changed) - ✓ No side effects or architectural changes - ✓ Minimal regression risk - ✗ Not a traditional bug fix (no user-facing bug) - ✗ No explicit Cc: stable tag - ✓ Required for test infrastructure when nolibc is updated
**Conclusion:** This is a **conditional YES** - it MUST be backported if and only if the corresponding nolibc wait4() removal (commit 4c2ef951cfe68) is also backported. The two commits form an inseparable pair for maintaining build compatibility. Since both are already present in this 6.17 stable tree, the backporting decision was correct for maintaining test infrastructure alongside nolibc updates.
tools/testing/selftests/arm64/abi/tpidr2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/arm64/abi/tpidr2.c b/tools/testing/selftests/arm64/abi/tpidr2.c index f58a9f89b952c..3b520b7efa49e 100644 --- a/tools/testing/selftests/arm64/abi/tpidr2.c +++ b/tools/testing/selftests/arm64/abi/tpidr2.c @@ -182,16 +182,16 @@ static int write_clone_read(void) }
for (;;) { - waiting = wait4(ret, &status, __WCLONE, NULL); + waiting = waitpid(ret, &status, __WCLONE);
if (waiting < 0) { if (errno == EINTR) continue; - ksft_print_msg("wait4() failed: %d\n", errno); + ksft_print_msg("waitpid() failed: %d\n", errno); return 0; } if (waiting != ret) { - ksft_print_msg("wait4() returned wrong PID %d\n", + ksft_print_msg("waitpid() returned wrong PID %d\n", waiting); return 0; }