All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/37] bsd-user: Upstream most of the remaining system calls
@ 2026-05-18 21:27 Warner Losh
  2026-05-18 21:27 ` [PATCH v2 01/37] bsd-user: catchup to locking / mapping routines in bsd-misc Warner Losh
                   ` (37 more replies)
  0 siblings, 38 replies; 73+ messages in thread
From: Warner Losh @ 2026-05-18 21:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kyle Evans, Pierrick Bouvier, Warner Losh, Stacey Son, Kyle Evans,
	Jessica Clarke, Mikaël Urankar, Michal Meloun, Sean Bruno,
	Karim Taha, Alexander Kabaev

Upstream the file, thread, socket and remaining signal system calls (too
numerous to list here).

This series is an ambitous use of claude to help me upstream all the
remaining system calls. I've batched them together in what I think are
reasonable chunks, and had claude do the grunt work of copying the code
over and attributing the commits from our complex branching history. The
chopping up was a bit arbitrary, but I think it's good. The commit
messages may be a little weak, but may also be OK. I've also double
checked the style and made fixes upstream for them as well. Claude also
reviewed all these changes and found a few bugs that I've fixed. I've
personally read through them all and haven't found anything glaring. I
fixed all the bugs that were found, in most cases differently than
claude's suggestions.

I've added 'Assisted-by: Claude...' to all these commits to reflect my
leaning on Claude so hard. This use falls within the 'non-creative' use
that the Qemu project has said is OK. If that's not the right thing to
do, I can remove them.

This leaves sysctl translation, the powerpc architecture support,
coredumps and a transition to 'truss' based system call tracing. With
these changes applied we'er down from a high of about 30k lines of diffs
to only 5k (not counting genereted, but checked in files in blitz). The
changes are 8k, so maybe a bit ambitious from that perspective as well.

There's a few lines over 80 that I've not cleaned up. Let me know if
that's a problem. The other warnings are about adding files, and there's
no new MAINTAINERS entry needed. And the 'arch dependent defines should
be avoided' are needed to cope with different FreeBSD build systems
having different system calls.

Note, this is called out below too, but in v2 I've folded back all the
fixes based on some out-of-band feedback I recieved to do this the
normal way and the qemu project isn't interested in the fixes to fixes.

This is a big experiment, in many ways, for me, so I'm interested in
whatever feedback you may have to make things better in the future.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
Changes in v2:
- don't write offsets on errors for copy_file_range
- pipe2: Check the raw system call value directly
- setsockopt: Check target_to_host_ip_mreq return value
- <several places>: Check return value of host_to_target_sockaddr
- do_bsd_setsockopt: Read in the socket option
- ntp_gettime: write back time on non-errors, not just 0
- do_freebsd_sigtimedwait check t2h_freebsd_timespec return
- do_freebsd_swapcontext writing incorrectly, readonly data (0 to user_unlock)
- do_thr_set_name needs get_errno()
- Have ntp_adjtime write back the structure
- kevent_freebsd11 no need to explicitly mask, datatypes do this for us
- do_freebsd_setcontext just reads the mcontext, 0 in unlock_user
- target_to_host_sigevent is read-only, so pass 0 in unlock_user
- target_to_host_ip_mreq needs tswap32 for int32_t
- use get_errno on kenv return values to report errors better
- kevent: only copy the number of events returns, not whole buffer
- Copy tolerance field of timex
- freebsd_umtx_sem_wake use VERIFY_READ instead of write to read struct
- Avoid double g2h_untagged mistakes in !_UMTX_OPTIMIZED
- Fixed additional missing unlock in freebsd_rw_rdlock and freebsd_rw_wrlock in !_UMTX_OPTIMIZED
- Squashed all the bug commit back to the appropriate earleir patch
- Link to v1: https://lore.kernel.org/qemu-devel/20260515-misc-2026q2-v1-0-5438ca41b27a@bsdimp.com

---
Warner Losh (37):
      bsd-user: catchup to locking / mapping routines in bsd-misc.
      bsd-user: Rename cpu_env to env throughout bsd-user
      bsd-user: Add bsd-signal.h with sigaction through sigreturn
      bsd-user: Add signal shims sigwait through kill and os-signal.h
      bsd-user: Add signal system call dispatch
      bsd-user: Add poll, lseek, pipe, and swap system call shims
      bsd-user: Add os-file.h with pipe2, chflagsat, close_range, and more
      bsd-user: Add file operation system call dispatch
      bsd-user: Add bsd-socket.h with bind through getsockname
      bsd-user: Add socket shims socketpair through shutdown
      bsd-user: Add os-socket.h with sendrecvmsg and message structures
      bsd-user: Add do_bsd_setsockopt and socket option definitions
      bsd-user: Add do_bsd_getsockopt
      bsd-user: Add FreeBSD socket helpers and sockaddr conversion
      bsd-user: Add os-socket.c with cmsg conversion functions
      bsd-user: Add socket system call dispatch
      bsd-user: Add os-time.h with clock and time-of-day functions
      bsd-user: Add utimes, futimes, and ktimer functions to os-time.h
      bsd-user: Add select, pselect, and ppoll to os-time.h
      bsd-user: Add kqueue and kevent functions to os-time.h
      bsd-user: Add sigtimedwait, itimer, and futimens to os-time.h
      bsd-user: Add os-time.c and time-related type definitions
      bsd-user: Add time system call dispatch
      bsd-user: Add thread, umtx, and ACL type definitions
      bsd-user: Add cpu_copy and make init_task_state non-static
      bsd-user: Add os-thread.h with thr and context functions
      bsd-user: Add do_freebsd__umtx_op to os-thread.h
      bsd-user: Add os-thread.c with umtx, mutex, and thread creation
      bsd-user: Add thread system call dispatch
      bsd-user: Add os-extattr.h with file and fd extattr functions
      bsd-user: Add link and list extattr functions to os-extattr.h
      bsd-user: Add ACL system call shims to os-extattr.h
      bsd-user: Add os-extattr.c with ACL conversion functions
      bsd-user: Add extended attribute and ACL system call dispatch
      bsd-user: Add scheduler and cpuset functions to os-misc.h
      bsd-user: Add kmod, posix, and misc functions to os-misc.h
      bsd-user: Add scheduler, cpuset, kmod, and misc syscall dispatch

 bsd-user/aarch64/target.h     |    2 +-
 bsd-user/arm/target.h         |    2 +-
 bsd-user/bsd-file.h           |  164 +++-
 bsd-user/bsd-mem.h            |    4 +-
 bsd-user/bsd-proc.h           |   24 +-
 bsd-user/bsd-signal.h         |  231 ++++++
 bsd-user/bsd-socket.c         |   98 +++
 bsd-user/bsd-socket.h         |  283 +++++++
 bsd-user/freebsd/meson.build  |    8 +-
 bsd-user/freebsd/os-extattr.c |  116 +++
 bsd-user/freebsd/os-extattr.h |  662 ++++++++++++++++
 bsd-user/freebsd/os-file.h    |  129 ++++
 bsd-user/freebsd/os-misc.h    |  470 +++++++++++-
 bsd-user/freebsd/os-proc.c    |    4 +-
 bsd-user/freebsd/os-proc.h    |   26 +-
 bsd-user/freebsd/os-signal.h  |   20 +
 bsd-user/freebsd/os-socket.c  |  234 ++++++
 bsd-user/freebsd/os-socket.h  |  770 +++++++++++++++++++
 bsd-user/freebsd/os-stat.h    |    8 +-
 bsd-user/freebsd/os-sys.c     |    4 +-
 bsd-user/freebsd/os-syscall.c |  790 +++++++++++++++++--
 bsd-user/freebsd/os-thread.c  | 1682 +++++++++++++++++++++++++++++++++++++++++
 bsd-user/freebsd/os-thread.h  |  596 +++++++++++++++
 bsd-user/freebsd/os-time.c    |  346 +++++++++
 bsd-user/freebsd/os-time.h    |  983 ++++++++++++++++++++++++
 bsd-user/freebsd/qemu-os.h    |   48 ++
 bsd-user/i386/target.h        |    2 +-
 bsd-user/main.c               |   32 +-
 bsd-user/meson.build          |    1 +
 bsd-user/qemu-bsd.h           |   26 +
 bsd-user/qemu.h               |   48 +-
 bsd-user/riscv/target.h       |    2 +-
 bsd-user/signal-common.h      |    4 +
 bsd-user/signal.c             |   67 ++
 bsd-user/syscall_defs.h       |  458 +++++++++--
 bsd-user/x86_64/target.h      |    2 +-
 36 files changed, 8150 insertions(+), 196 deletions(-)
---
base-commit: edcc429e9e41a8e0e415dcdab6aa52ad17ef8889
change-id: 20260504-misc-2026q2-a5af31ac032a

Best regards,
-- 
Warner Losh <imp@bsdimp.com>



^ permalink raw reply	[flat|nested] 73+ messages in thread

end of thread, other threads:[~2026-06-03  9:19 UTC | newest]

Thread overview: 73+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-18 21:27 [PATCH v2 00/37] bsd-user: Upstream most of the remaining system calls Warner Losh
2026-05-18 21:27 ` [PATCH v2 01/37] bsd-user: catchup to locking / mapping routines in bsd-misc Warner Losh
2026-05-19 15:00   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 02/37] bsd-user: Rename cpu_env to env throughout bsd-user Warner Losh
2026-05-19 14:59   ` Pierrick Bouvier
2026-05-19 15:05   ` Pierrick Bouvier
2026-05-19 17:32     ` Warner Losh
2026-05-18 21:27 ` [PATCH v2 03/37] bsd-user: Add bsd-signal.h with sigaction through sigreturn Warner Losh
2026-05-22 22:39   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 04/37] bsd-user: Add signal shims sigwait through kill and os-signal.h Warner Losh
2026-05-22 22:42   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 05/37] bsd-user: Add signal system call dispatch Warner Losh
2026-05-22 22:45   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 06/37] bsd-user: Add poll, lseek, pipe, and swap system call shims Warner Losh
2026-05-22 22:51   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 07/37] bsd-user: Add os-file.h with pipe2, chflagsat, close_range, and more Warner Losh
2026-05-22 22:54   ` Pierrick Bouvier
2026-05-25 21:32     ` Warner Losh
2026-05-18 21:27 ` [PATCH v2 08/37] bsd-user: Add file operation system call dispatch Warner Losh
2026-05-22 22:57   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 09/37] bsd-user: Add bsd-socket.h with bind through getsockname Warner Losh
2026-05-22 23:04   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 10/37] bsd-user: Add socket shims socketpair through shutdown Warner Losh
2026-05-22 23:08   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 11/37] bsd-user: Add os-socket.h with sendrecvmsg and message structures Warner Losh
2026-05-22 23:10   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 12/37] bsd-user: Add do_bsd_setsockopt and socket option definitions Warner Losh
2026-05-22 23:28   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 13/37] bsd-user: Add do_bsd_getsockopt Warner Losh
2026-05-22 23:28   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 14/37] bsd-user: Add FreeBSD socket helpers and sockaddr conversion Warner Losh
2026-05-22 23:29   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 15/37] bsd-user: Add os-socket.c with cmsg conversion functions Warner Losh
2026-05-22 23:31   ` Pierrick Bouvier
2026-05-23  4:35     ` Warner Losh
2026-05-18 21:27 ` [PATCH v2 16/37] bsd-user: Add socket system call dispatch Warner Losh
2026-05-22 23:31   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 17/37] bsd-user: Add os-time.h with clock and time-of-day functions Warner Losh
2026-05-22 23:32   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 18/37] bsd-user: Add utimes, futimes, and ktimer functions to os-time.h Warner Losh
2026-05-22 23:38   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 19/37] bsd-user: Add select, pselect, and ppoll " Warner Losh
2026-05-22 23:46   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 20/37] bsd-user: Add kqueue and kevent functions " Warner Losh
2026-05-22 23:49   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 21/37] bsd-user: Add sigtimedwait, itimer, and futimens " Warner Losh
2026-05-22 23:50   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 22/37] bsd-user: Add os-time.c and time-related type definitions Warner Losh
2026-05-22 23:52   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 23/37] bsd-user: Add time system call dispatch Warner Losh
2026-05-22 23:52   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 24/37] bsd-user: Add thread, umtx, and ACL type definitions Warner Losh
2026-05-22 23:53   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 25/37] bsd-user: Add cpu_copy and make init_task_state non-static Warner Losh
2026-05-22 23:53   ` Pierrick Bouvier
2026-05-18 21:27 ` [PATCH v2 26/37] bsd-user: Add os-thread.h with thr and context functions Warner Losh
2026-05-18 21:27 ` [PATCH v2 27/37] bsd-user: Add do_freebsd__umtx_op to os-thread.h Warner Losh
2026-05-18 21:27 ` [PATCH v2 28/37] bsd-user: Add os-thread.c with umtx, mutex, and thread creation Warner Losh
2026-05-18 21:27 ` [PATCH v2 29/37] bsd-user: Add thread system call dispatch Warner Losh
2026-05-18 21:27 ` [PATCH v2 30/37] bsd-user: Add os-extattr.h with file and fd extattr functions Warner Losh
2026-05-18 21:27 ` [PATCH v2 31/37] bsd-user: Add link and list extattr functions to os-extattr.h Warner Losh
2026-05-18 21:27 ` [PATCH v2 32/37] bsd-user: Add ACL system call shims " Warner Losh
2026-05-18 21:27 ` [PATCH v2 33/37] bsd-user: Add os-extattr.c with ACL conversion functions Warner Losh
2026-05-18 21:27 ` [PATCH v2 34/37] bsd-user: Add extended attribute and ACL system call dispatch Warner Losh
2026-05-18 21:27 ` [PATCH v2 35/37] bsd-user: Add scheduler and cpuset functions to os-misc.h Warner Losh
2026-05-18 21:27 ` [PATCH v2 36/37] bsd-user: Add kmod, posix, and misc " Warner Losh
2026-05-18 21:27 ` [PATCH v2 37/37] bsd-user: Add scheduler, cpuset, kmod, and misc syscall dispatch Warner Losh
2026-05-23  0:03 ` [PATCH v2 00/37] bsd-user: Upstream most of the remaining system calls Pierrick Bouvier
2026-05-23  0:40   ` Warner Losh
2026-05-23  1:19     ` Pierrick Bouvier
2026-05-23 18:56       ` Helge Deller
2026-05-25  2:17         ` Warner Losh
2026-06-03  9:18       ` Daniel P. Berrangé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.