Bug 506499 - Unhandled syscall 592 (exterrctl - FreeBSD)
Summary: Unhandled syscall 592 (exterrctl - FreeBSD)
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.25 GIT
Platform: FreeBSD Ports FreeBSD
: NOR normal
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-02 19:21 UTC by martin.i.oliveira
Modified: 2025-08-19 09:11 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description martin.i.oliveira 2025-07-02 19:21:59 UTC
SUMMARY
Valgrind reports unhandled syscall 592 (exterrctl), which was recently added to FreeBSD 15 on May 31, 2025: https://github.com/freebsd/freebsd-src/commit/09dfe066f00c927e88c23265387d432e6d9f0c5e.

STEPS TO REPRODUCE
Get a very recent FreeBSD 15 release. This syscall seems to be always called. For example, the following hits it (no special compilation flags required):

int main()
{
    return 0;
}

OBSERVED RESULT
==47244== Memcheck, a memory error detector
==47244== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==47244== Using Valgrind-3.26.0.GIT-7208eb445f-20250530 and LibVEX; rerun with -h for copyright info
==47244== Command: ./a.out
==47244== 
--47244-- Valgrind options:
--47244--    --verbose
--47244-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-lzcnt-rdtscp-sse3-ssse3-avx-avx2-bmi-f16c-rdrand-rdseed-fma
--47244-- Page sizes: currently 4096, max supported 4096
--47244-- Valgrind library directory: /usr/local/libexec/valgrind
--47244-- Reading syms from /tmp/a.out
--47244-- Reading syms from /libexec/ld-elf.so.1
--47244-- Reading syms from /usr/local/libexec/valgrind/memcheck-amd64-freebsd
--47244--    object doesn't have a dynamic symbol table
--47244-- Scheduler: using generic scheduler lock implementation.
--47244-- Reading suppressions file: /usr/local/libexec/valgrind/default.supp
==47244== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-47244-by-eidbbw-on-???
==47244== embedded gdbserver: writing to   /tmp/vgdb-pipe-to-vgdb-from-47244-by-eidbbw-on-???
==47244== embedded gdbserver: shared mem   /tmp/vgdb-pipe-shared-mem-vgdb-47244-by-eidbbw-on-???
==47244== 
==47244== TO CONTROL THIS PROCESS USING vgdb (which you probably
==47244== don't want to do, unless you know exactly what you're doing,
==47244== or are doing some strange experiment):
==47244==   /usr/local/libexec/valgrind/../../bin/vgdb --pid=47244 ...command...
==47244== 
==47244== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==47244==   /path/to/gdb ./a.out
==47244== and then give GDB the following command
==47244==   target remote | /usr/local/libexec/valgrind/../../bin/vgdb --pid=47244
==47244== --pid is optional if only one valgrind process is running
==47244== 
--47244-- Reading syms from /usr/local/libexec/valgrind/vgpreload_core-amd64-freebsd.so
--47244-- Reading syms from /usr/local/libexec/valgrind/vgpreload_memcheck-amd64-freebsd.so
--47244-- Reading syms from /lib/libc.so.7
--47244-- Reading syms from /lib/libsys.so.7
--47244--   Considering /usr/lib/debug/lib/libc.so.7.debug ..
--47244--   .. CRC is valid
--47244-- REDIR: 0x49bf530 (libc.so.7:memchr) redirected to 0x48446f0 (_vgnU_ifunc_wrapper)
--47244-- REDIR: 0x49bfae0 (libc.so.7:memccpy) redirected to 0x48446f0 (_vgnU_ifunc_wrapper)
--47244-- REDIR: 0x49c04f0 (libc.so.7:stpcpy) redirected to 0x48446f0 (_vgnU_ifunc_wrapper)
--47244-- REDIR: 0x49c06b0 (libc.so.7:stpncpy) redirected to 0x48446f0 (_vgnU_ifunc_wrapper)
--47244-- REDIR: 0x49c0ac0 (libc.so.7:strchrnul) redirected to 0x48446f0 (_vgnU_ifunc_wrapper)
--47244-- REDIR: 0x49c0fd0 (libc.so.7:strcspn) redirected to 0x48446f0 (_vgnU_ifunc_wrapper)
--47244-- REDIR: 0x49c13c0 (libc.so.7:strlcpy) redirected to 0x48446f0 (_vgnU_ifunc_wrapper)
--47244-- WARNING: unhandled amd64-freebsd syscall: 592
--47244--   Considering /usr/lib/debug/lib/libsys.so.7.debug ..
--47244--   .. CRC is valid
--47244--   Considering /usr/lib/debug/libexec/ld-elf.so.1.debug ..
--47244--   .. CRC is valid
==47244==    at 0x4B8C91A: exterrctl (in /lib/libsys.so.7)
==47244==    by 0x400B44C: ??? (in /libexec/ld-elf.so.1)
==47244==    by 0x400A0E5: ??? (in /libexec/ld-elf.so.1)
==47244==    by 0x4006E98: ??? (in /libexec/ld-elf.so.1)
--47244-- You may be able to write your own handler.
--47244-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--47244-- Nevertheless we consider this a bug.  Please report
--47244-- it at http://valgrind.org/support/bug_reports.html.
--47244-- REDIR: 0x49c03e0 (libc.so.7:memset) redirected to 0x4858210 (memset)
--47244-- REDIR: 0x49c17e0 (libc.so.7:strncmp) redirected to 0x48446f0 (_vgnU_ifunc_wrapper)
--47244-- REDIR: 0x49c1890 (libc.so.7:???) redirected to 0x4855ec0 (strncmp)
==47244== 
==47244== HEAP SUMMARY:
==47244==     in use at exit: 0 bytes in 0 blocks
==47244==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==47244== 
==47244== All heap blocks were freed -- no leaks are possible
==47244== 
==47244== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

SOFTWARE/OS VERSIONS
$ uname -a
FreeBSD ebbw-vili-sw-bsd15 15.0-CURRENT FreeBSD 15.0-CURRENT #3 n278329-171f66b0c2ca: Mon Jun 30 11:02:50 MDT 2025     root@ebbw-vili-sw-bsd15:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
Comment 1 Paul Floyd 2025-07-03 05:06:44 UTC
Thanks for reporting this.

I’ll try to make a quick fix over the next few days. I need to study the syscall more to see if there are cases where Valgrind needs to do more than just verify the arguments.
Comment 2 Paul Floyd 2025-07-03 13:28:54 UTC
For thread creation I need to look more at setting the uexterr member of struct pthread.



https://github.com/freebsd/freebsd-src/blob/9d004de910bb7ea4d959dd3726318c4c6bdbd48c/lib/libthr/thread/thr_create.c#L296
Comment 3 Paul Floyd 2025-07-12 20:26:51 UTC
I'll bump the valgrind-devel port with this change soonish.

commit 36e090c39cbacf34425e199e77691c4e9d708fc2 (HEAD -> master, origin/master, origin/HEAD)
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date:   Sat Jul 12 22:23:05 2025 +0200

    Bug 506499 - Unhandled syscall 592 (exterrctl - FreeBSD)
    
    Also add wrapers for inotify_add_watch_at and inotify_rm_watch
    
    No specific tests for these yet.
Comment 4 martin.i.oliveira 2025-08-14 18:04:46 UTC
Hi Paul,

thanks for fixing this issue so quickly. I just wanted to kindly follow-up and check if there were any issues updating the valgrind-devel port, I don't see it in https://github.com/freebsd/freebsd-ports/tree/main/devel/valgrind-devel.

Thank you once again!
Comment 5 Paul Floyd 2025-08-14 20:44:48 UTC
Sorry I ran out of time before going on holiday. I’ll do it when I get back next week.
Comment 6 Paul Floyd 2025-08-19 09:11:28 UTC
I just opened a FreeBSD bugzilla item for valgriknd-devel.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288949