FP Compiler uses 14 year old system call for mmap (COMPAT6)
Original Reporter info from Mantis: trev @trevoz
-
Reporter name: Trevor Roydhouse
Original Reporter info from Mantis: trev @trevoz
- Reporter name: Trevor Roydhouse
Description:
FPC uses a 14 year old system call for mmap. On startup truss reveals:
compat6.mmap(0x0,0x100000,0x3,0x1002,0xffffffffffffffff,0x0,0x0) = 34368864256 (0x8008b4000)
compat6.mmap(0x0,0x8000,0x3,0x1002,0xffffffffffffffff,0x0,0x0) = 34369912832 (0x8009b4000)
This requires the FreeBSD kernel to have the COMPAT6 and COMPAT7 (this needed to compile a kernel with COMPAT5) options when building the kernel.
The source of the dependency is in rtl/freebsd/sysnr.inc which includes this line:
syscall_nr_mmap = 197;
Instead, it should be 477 which is the "standard" mmap system call number.
Refer: https://github.com/freebsd/freebsd/blob/master/sys/kern/syscalls.master
197 AUE_MMAP COMPAT6 {
void *mmap(
_In_ void *addr,
size_t len,
int prot,
int flags,
int fd,
int pad,
off_t pos
);
}
and
477 AUE_MMAP STD {
void *mmap(
_In_ void *addr,
size_t len,
int prot,
int flags,
int fd,
off_t pos
);
}
Steps to reproduce:
Compile a FreeBSD 11.x or 12.x kernel without the COMPAT6 and COMPAT7 options. Run ppcx64 which will result in a core dump with "Bad system call (core dumped)". truss shows:
sigaction(SIGFPE,{ 0x4224f0 SA_SIGINFO ss_t },{ SIG_DFL 0x0 ss_t }) = 0 (0x0)
sigaction(SIGSEGV,{ 0x4224f0 SA_SIGINFO ss_t },{ SIG_DFL 0x0 ss_t }) = 0 (0x0)
sigaction(SIGBUS,{ 0x4224f0 SA_SIGINFO ss_t },{ SIG_DFL 0x0 ss_t }) = 0 (0x0)
sigaction(SIGILL,{ 0x4224f0 SA_SIGINFO ss_t },{ SIG_DFL 0x0 ss_t }) = 0 (0x0)
ioctl(1,TIOCGETA,0x7fffffffe4a0) = 0 (0x0)
ioctl(2,TIOCGETA,0x7fffffffe4a0) = 0 (0x0)
ioctl(1,TIOCGETA,0x7fffffffe4a0) = 0 (0x0)
ioctl(2,TIOCGETA,0x7fffffffe4a0) = 0 (0x0)
compat6.mmap() ERR#78 'Function not implemented'
SIGNAL 12 (SIGSYS) code=SI_KERNEL
process killed, signal = 12 (core dumped)
Mantis conversion info:
- Mantis ID: 36163
- OS: FreeBSD
- OS Build: 11.x and 12.x
- Platform: x86_64
- Version: 3.0.4
- Monitored by: » Vincent (Vincent Snijders), » @trevoz (Trevor Roydhouse)