View Issue Details

IDProjectCategoryView StatusLast Update
0036163FPCCompilerpublic2019-10-11 19:54
ReporterTrevor RoydhouseAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Platformx86_64OSFreeBSDOS Version11.x and 12.x
Product Version3.0.4Product Build 
Target VersionFixed in Version 
Summary0036163: FP Compiler uses 14 year old system call for mmap (COMPAT6)
DescriptionFPC 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 ReproduceCompile 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)
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2019-10-11 08:34 Trevor Roydhouse New Issue