From: Paul Floyd Date: Sat, 20 Jan 2024 20:14:37 +0000 (+0100) Subject: Bug 480052 - WARNING: unhandled amd64-freebsd syscall: 580 X-Git-Tag: VALGRIND_3_23_0~204 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3cacde0ca261196031cb84b22ad427483bae057e;p=thirdparty%2Fvalgrind.git Bug 480052 - WARNING: unhandled amd64-freebsd syscall: 580 --- diff --git a/NEWS b/NEWS index 864c078143..1aaea80114 100644 --- a/NEWS +++ b/NEWS @@ -51,6 +51,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. (unhandled instruction bytes: 0x2E 0x8D 0xB4 0x26 478837 valgrind fails to read debug info for rust binaries 479041 Executables without RW sections do not trigger debuginfo reading +480052 WARNING: unhandled amd64-freebsd syscall: 580 n-i-bz Add redirect for memccpy To see details of a given bug, visit diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index 30b90ca37f..f40e3c7d2f 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -556,17 +556,20 @@ DECL_TEMPLATE(freebsd, sys_aio_readv) // 579 #if (FREEBSD_VERS >= FREEBSD_13_1) -// unimpl __NR_fspacectl 580 +#if (FREEBSD_VERS >= FREEBSD_14) +// there was a hole in the numbering +DECL_TEMPLATE(freebsd, sys_fspacectl) // 580 +#endif // unimpl __NR_sched_getcpu 581 DECL_TEMPLATE(freebsd, sys_swapoff) // 582 #endif #if (FREEBSD_VERS >= FREEBSD_15) -DECL_TEMPLATE(freebsd, sys_kqueuex); // 583 -DECL_TEMPLATE(freebsd, sys_membarrier); // 584 -DECL_TEMPLATE(freebsd, sys_timerfd_create); // 585 -DECL_TEMPLATE(freebsd, sys_timerfd_gettime); // 586 -DECL_TEMPLATE(freebsd, sys_timerfd_settime); // 587 +DECL_TEMPLATE(freebsd, sys_kqueuex) // 583 +DECL_TEMPLATE(freebsd, sys_membarrier) // 584 +DECL_TEMPLATE(freebsd, sys_timerfd_create) // 585 +DECL_TEMPLATE(freebsd, sys_timerfd_gettime) // 586 +DECL_TEMPLATE(freebsd, sys_timerfd_settime) // 587 #endif DECL_TEMPLATE(freebsd, sys_fake_sigreturn) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index c2435f6adb..bfb1cf876e 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -6985,6 +6985,28 @@ POST(sys_aio_readv) #if (FREEBSD_VERS >= FREEBSD_13_1) +#if (FREEBSD_VERS >= FREEBSD_14) +// SYS_fspacectl 580 +// int fspacectl(int fd, int cmd, const struct spacectl_range *rqsr, int flags, +// struct spacectl_range *rmsr); +PRE(sys_fspacectl) +{ + PRINT("fspacectl ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, SARG2, ARG3, SARG4, ARG5); + PRE_REG_READ5(int, "fspacectl", int, fd, int, cmd, const struct spacectl_range *, rqsr, int, flags, struct spacectl_range *, rmsr); + PRE_MEM_READ("fspacectl(rqsr)", (Addr)ARG3, sizeof(struct vki_spacectl_range)); + if (ARG5) { + PRE_MEM_WRITE("fspacectl(rmsr)", (Addr)ARG5, sizeof(struct vki_spacectl_range)); + } +} + +POST(sys_fspacectl) +{ + if (ARG5) { + POST_MEM_WRITE((Addr)ARG5, sizeof(struct vki_spacectl_range)); + } +} +#endif + // SYS_swapoff 582 // int swapoff(const char *special, u_int flags); PRE(sys_swapoff) @@ -7817,7 +7839,10 @@ const SyscallTableEntry ML_(syscall_table)[] = { #endif #if (FREEBSD_VERS >= FREEBSD_13_1) - // unimpl __NR_fspacectl 580 + +#if (FREEBSD_VERS >= FREEBSD_14) + BSDXY(__NR_fspacectl, sys_fspacectl), // 580 +#endif // unimpl __NR_sched_getcpu 581 BSDX_(__NR_swapoff, sys_swapoff), // 582 #endif diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index a7fed64339..d19c8de018 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -1593,6 +1593,12 @@ struct vki_dirent { #define VKI_F_SEAL_GROW 0x0004 #define VKI_F_SEAL_WRITE 0x0008 +struct vki_spacectl_range { + vki_off_t r_offset; + vki_off_t r_len; +}; + + //---------------------------------------------------------------------- // From sys/unistd.h //---------------------------------------------------------------------- diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h index 0b68383383..1be22fa501 100644 --- a/include/vki/vki-scnums-freebsd.h +++ b/include/vki/vki-scnums-freebsd.h @@ -668,7 +668,9 @@ #if (FREEBSD_VERS >= FREEBSD_13_1) +#if (FREEBSD_VERS >= FREEBSD_14) #define __NR_fspacectl 580 +#endif #define __NR_sched_getcpu 581 #define __NR_swapoff 582