On Sun, 9 Jul 2023 13:29:58 -0700 Andrew Hewus Fresh <and...@afresh1.com> wrote:
> +syscall_emulator.h Emulator to dispatch syscalls to libc This got installed as /usr/libdata/perl5/powerpc64-openbsd/CORE/syscall_emulator.h ExtUtils::MakeMaker is using cc -DHAS_SYSCALL_EMULATOR to build my XS module; the define causes <perl.h> to #include <syscall_emulator.h>. Can we hide this feature from XS? I wish that only pp_sys.c and syscall_emulator.c would #include <syscall_emulator.h>, that syscall_emulator.h would not be installed, and that -DHAS_SYSCALL_EMULATOR would not appear in non-core modules. Also, the new test has a heap overflow, because $sb is too small for a struct stat, $ cd /usr/src/gnu/usr.bin/perl/obj $ MALLOC_OPTIONS=S perl t/op/syscall_emulator.t /usr/include/sys/syscall.h -> /usr/include/sys/syscall.ph 1..13 ok 1 - Opened test.txt for write/create ok 2 - Wrote out to test.txt ok 3 - closed test.txt perl(15511) in malloc(): write after free 0xc36d1efcddc0 Abort trap (core dumped) I prevented the overflow by making $sb too big, --- t/op/syscall_emulator.t.before Thu Jul 13 00:39:10 2023 +++ t/op/syscall_emulator.t Wed Jul 19 15:32:40 2023 @@ -47,7 +47,7 @@ my $out = "Hello World\n"; my $in = "\0" x 32; my ($in_p, $in_v); -my $sb = "\0\0\0\0"; +my $sb = "\0" x 4096; my $st_mode; my $perms = S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH;