Internships/ProjectIdeas/FreeBSDUser

From QEMU
Revision as of 15:45, 9 February 2023 by Bsdimp (talk | contribs) (→‎FreeBSD user emulation improvements)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

FreeBSD user emulation improvements

Summary: Get "Hello World" compiling and running in a FreeBSD/armv7 chroot

QEMU's user emulator (bsd-user) runs BSD executables. This is often used in cross-compilation environments where bsd-user enables programs for other CPU architectures to run. FreeBSD support is not yet complete in QEMU and this project will make progress towards this.

Your task is to get "Hello World" compiling with clang 14.0 in a FreeBSD 13.2/armv7 jail running on FreeBSD/amd64 and the resulting "Hello World" executable should also run successfully. In order to do this, the following 35 system calls need to be added: __realpathat, __sysctl, _umtx_op, cpuset_getaffinity, execve, fcntl, fstat, fstatat, ftruncate, getcontext, getdirentries, geteuid, getpid, getrandom, getrlimit, getuid, ioctl, issetugid, lseek, madvise, minherit, mmap, mprotect, munmap, rfork, rtprio_thread, sigaction, sigaltstack, sigfastblock, sigprocmask, sysarch, thr_new, thr_self, wait4.

Code for these system calls exists in Warner Losh's "blitz" git branch and consists of a few thousand lines. This code is working, but not polished enough to be merged into QEMU without additional work. Your tasks will involve:

  • Verify that the code achieves the goal and debug it when necessary
  • Build patch series (git commits) that extract just the necessary code and send them to the qemu-devel mailing list
  • Update the patches to address code review feedback from the mailing list

Each individual commit must compile and should not break anything that was working before the commit. Unit tests need to be written for subsets of the system calls that are needed to help with the development process (or existing QEMU test cases that fail need to have that failure corrected). A plan for incremental testing as the code develops is needed.

This project will expose you to FreeBSD system calls and emulation. You will also gain experience with porting and maintaining patches.

Links:

Details:

  • Project size: 350 hours
  • Skill level: intermediate
  • Language: C
  • Mentor: Warner Losh <imp@bsdimp.com>
  • Suggested by: Warner Losh <imp@bsdimp.com>