[PATCH 0/2] tools/nolibc: fork: fix on s390 and add test

Thomas Weißschuh posted 2 patches 2 years, 8 months ago
tools/include/nolibc/arch-s390.h             |  8 ++++++++
tools/include/nolibc/sys.h                   |  2 ++
tools/testing/selftests/nolibc/nolibc-test.c | 20 ++++++++++++++++++++
3 files changed, 30 insertions(+)
[PATCH 0/2] tools/nolibc: fork: fix on s390 and add test
Posted by Thomas Weißschuh 2 years, 8 months ago
The generic fork() implementation in nolibc falls back to the clone()
syscall. On s390 the first two arguments to clone() are swapped compared
to other architectures, breaking the implementation in nolibc.

Add a custom implementation of fork() to s390 that works.

While at it also add a testcase for fork().

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (2):
      tools/nolibc: s390: provide custom implementation for sys_fork
      tools/nolibc: add testcase for fork()/waitpid()

 tools/include/nolibc/arch-s390.h             |  8 ++++++++
 tools/include/nolibc/sys.h                   |  2 ++
 tools/testing/selftests/nolibc/nolibc-test.c | 20 ++++++++++++++++++++
 3 files changed, 30 insertions(+)
---
base-commit: c1c4f33b6be9b3412d9e0ba01b367f4ffe47c379
change-id: 20230415-nolibc-fork-b7087a345166

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>

Re: [PATCH 0/2] tools/nolibc: fork: fix on s390 and add test
Posted by Willy Tarreau 2 years, 8 months ago
Hi Thomas,

On Sat, Apr 15, 2023 at 11:28:46PM +0200, Thomas Weißschuh wrote:
> The generic fork() implementation in nolibc falls back to the clone()
> syscall. On s390 the first two arguments to clone() are swapped compared
> to other architectures, breaking the implementation in nolibc.
> 
> Add a custom implementation of fork() to s390 that works.
> 
> While at it also add a testcase for fork().
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Thanks for these. Please always Cc the authors of code you're fixing
(e.g. there could be more subtle details that only the author knows
about). Here I think it's OK, but I've CCed Sven and will add him to
your fix.

Thank you!
Willy