Skip to content

linux-user: Support extended clone(CLONE_VM)

Josh Kunz qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5linux-user: Refactor do_fork to use new `qemu_clone`linux-user/Makefile.objs linux-user/clone.c linux-user/clone.h +1 more+365 -1921 reply
2/5linux-user: Make fd_trans task-specific.linux-user/Makefile.objs linux-user/fd-trans-tbl.c linux-user/fd-trans-type.h +5 more+115 -320 replies
3/5linux-user: Make sigact_table part of the task state.linux-user/qemu.h linux-user/signal.c linux-user/syscall.c+52 -80 replies
4/5linux-user: Support CLONE_VM and extended clone optionslinux-user/clone.c linux-user/qemu.h linux-user/signal.c +2 more+592 -256 replies
5/5linux-user: Add PDEATHSIG test for clone process hierarchy.tests/tcg/multiarch/Makefile.target tests/tcg/multiarch/linux-test.c+153 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] linux-user: Support extended clone(CLONE_VM)

This patch series implements extended support for the clone system call. As best I can tell, any option combination including CLONE_VM should be supported with the addition of this patch series. The implementation is described in greater detail in the patches themselves.

Testing:

* All targets built on x86_64.
* make check and make check-tcg are passing. Additional tests have been added to linux-test.c to validate clone behavior.

Caveats:

* This series touches, but does not fix, several bits of code that are racey (namely the sigact table and the fd trans table).
* exit_group does not perform the appropriate cleanup for non-thread children created with CLONE_VM. CPUs for such children are never cleaned up. The correct implementation of exit-group is non-trivial (since it also needs to track/handle cleanup for threads in the clone'd child process). Also, I don't fully understand the interaction between QOM<->linux-user. My naive implementation based on the current implementation exit(2) was regularly crashing. If maintainers have suggestions for better ways to handle exit_group, they would be greatly appreciated.
* execve does not clean up the CPUs of clone'd children, for the same reasons as exit_group.

Josh Kunz (5):
linux-user: Refactor do_fork to use new qemu_clone
linux-user: Make fd_trans task-specific.
linux-user: Make sigact_table part of the task state.
linux-user: Support CLONE_VM and extended clone options
linux-user: Add PDEATHSIG test for clone process hierarchy.

 linux-user/Makefile.objs            |   2 +-
 linux-user/clone.c                  | 565 ++++++++++++++++++++++++++++
 linux-user/clone.h                  |  27 ++
 linux-user/fd-trans-tbl.c           |  13 +
 linux-user/fd-trans-type.h          |  17 +
 linux-user/fd-trans.c               |   3 -
 linux-user/fd-trans.h               |  75 ++--
 linux-user/main.c                   |   1 +
 linux-user/qemu.h                   |  49 +++
 linux-user/signal.c                 |  84 ++++-
 linux-user/syscall.c                | 452 ++++++++++++----------
 tests/tcg/multiarch/Makefile.target |   3 +
 tests/tcg/multiarch/linux-test.c    | 227 ++++++++++-
 13 files changed, 1264 insertions(+), 254 deletions(-)
 create mode 100644 linux-user/clone.c
 create mode 100644 linux-user/clone.h
 create mode 100644 linux-user/fd-trans-tbl.c
 create mode 100644 linux-user/fd-trans-type.h
Signature · 1 line
2.27.0.290.gba653c62da-goog