View Issue Details

IDProjectCategoryView StatusLast Update
0036163FPCCompilerpublic2020-03-11 13:07
ReporterTrevor Roydhouse Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Platformx86_64OSFreeBSD 
Product Version3.0.4 
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

Trevor Roydhouse

2020-03-10 07:41

reporter   ~0121521

This issue has been resolved by Jose Alonso Cardenas Marquez in the FreeBSD ports system. See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239135

Thaddy de Koning

2020-03-10 17:10

reporter   ~0121541

This is fixed already I believe. Recently.

Trevor Roydhouse

2020-03-11 00:13

reporter   ~0121544

I cannot close this now resolved issue. And there is no way to attract someone with the power to do so (unlike bugzilla where I can set a flag for feedback etc).

Thaddy de Koning

2020-03-11 09:41

reporter   ~0121553

Last edited: 2020-03-11 09:42

View 3 revisions

It is fixed in trunk. 3.0.4. will not receive updates pending the 3.2.0 release. I believe it is also back-ported to 3.2.0
You should try 3.2.0 and /or trunk

Thaddy de Koning

2020-03-11 13:07

reporter   ~0121555

It is NOT fixed for freebsd in trunk. Call number is still 197, not 477 so you are right.

Issue History

Date Modified Username Field Change
2019-10-11 08:34 Trevor Roydhouse New Issue
2020-03-10 07:41 Trevor Roydhouse Note Added: 0121521
2020-03-10 17:10 Thaddy de Koning Note Added: 0121541
2020-03-11 00:13 Trevor Roydhouse Note Added: 0121544
2020-03-11 09:41 Thaddy de Koning Note Added: 0121553
2020-03-11 09:42 Thaddy de Koning Note Edited: 0121553 View Revisions
2020-03-11 09:42 Thaddy de Koning Note Edited: 0121553 View Revisions
2020-03-11 13:07 Thaddy de Koning Note Added: 0121555