Improving the Linux compatibility layer in the FreeBSD kernel

The goal is to update to 2.6.16 compatible Linux syscalls. Without this compatibility, we are not able to update to a more recent linux_base port.

Perforce branch

//depot/projects/linuxolator, diff at http://www.Leidinger.net/FreeBSD/linuxolator/linuxolator-p4.diff (last updated 20070317 @ 5pm CET)

Test equipment

LTP

Very easy to set up: install linux_dist-gentoo-stage3, download the tarball into a directory below /usr/local/gentoo-stage3/, mkdir dev and sys in the gentoo-stage3 directory, mount devfs, linprocfs and linsysfs and then do a "chroot /usr/local/gentoo-stage3 bash". To prepare the LTP extract the tarball, cd into the directory, type "make && make install" and then you can run the first tests with "./runltp -v -p -l mylogfilename 2>&1 | tee verboselog.txt".

If you don't have at least revision 1.187 of /sys/compat/linux/linux/misc.c you need to comment out "reboot02" in runtest/syscalls or your system will reboot. "send01" (and some test immediatly after that test) will cause a kernel panic if you don't have at least revision 1.282 of uipc_socket.c (mutex so_snd held when returning to userland).

There are some tests which hang around and do not finish if you use a -current prior to ~20061222, you need to kill those tests there.

Keep an eye on /usr/local/gentoo-stage3/tmp between tests and clean it up. You should also run "ipcs" and remove some leftover (compare before and after each run).

A little funny note: we are even more compatible than a real linux distribution (don't take this literally). LTP 20061222 does not even compile on Ubuntu 6.10. The error message is ../../generate.sh: 60: arith: syntax error: "cnt--" and the line in question is while [ $((cnt--)) -gt 0 ] ; do. If you do a loop unrolling by hand it fails later when you try to run the LTP tests even before it tries the first test. We did not try to proceed further, we want to fix problems on FreeBSD, not on Linux.

Missing stuff

Syscalls

syscall

status

adjtimex

not started

capget

not started

create_module

will not be implemented

epoll_XXX

implemented in p4

futex

in current, problems when swapping out/mmaping etc.

inotify_XXX

userspace implementation available, expected to be ported to kernel soon

io_XXX

in P4, needs testing

lookup_cookie

not started

mincore

not started

prctl

partially implemented

ptrace

not started

readahead

not started

remap_file_pages

not started

rt_sigpending

missing on amd64

rt_sigtimedwait

missing on amd64

sched_setaffinity / sched_getaffinity

not started

sendfile64

not started

setfsgid

not started

setfsuid

not started

swapoff

not started

syslog

not started

unshare

not started

vhangup

not started

IPC

type

status

11

missing in -stable

12

missing in -stable

13

implemented in current as of 20070114

17

implemented in current as of 20070114

-257

not started, probably a "has to fail" regression test sentinel

ioctl

type

status

used by

0x6d02 ('m',2)

not implemented

dd

0x541c ('T',28)

not implemented

consoletype

PRs

TODO

in -current

MFC

The following needs to be MFCed (incomplete list):

The following will not be MFCed (maybe incomplete list):

Bugs

A note to users: Feel free to read the following list of things to fix, but do not make conclusions out of it. The linux compatibility environment runs just fine. There are some broken edge cases which don't affect the daily use. The following list is only meaningful for developers. Just because something is marked as a bug, it doesn't mean it doesn't work. It may be the case that some obscure error condition does not return the expected error value, or that a seldomly used feature is not implemented.

Misc

Automated test results

linux-kernel (last edited 2007-09-21 18:21:36 by AlexanderLeidinger)