]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bug 445607 Unhandled amd64-freebsd syscall: 247
authorPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 17 Nov 2021 22:15:23 +0000 (23:15 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 17 Nov 2021 22:15:23 +0000 (23:15 +0100)
I can't find much in the way of documentation for this.
Added to scalar, but no specific tests.

coregrind/m_syswrap/priv_syswrap-freebsd.h
coregrind/m_syswrap/syswrap-amd64-freebsd.c
coregrind/m_syswrap/syswrap-freebsd.c
coregrind/m_syswrap/syswrap-x86-freebsd.c
memcheck/tests/freebsd/scalar.c
memcheck/tests/freebsd/scalar.stderr.exp-freebsd130
memcheck/tests/freebsd/scalar.stderr.exp-freebsd130-x86

index 348a7fcdbdad433df71230fcd82b6987ae99e9a7..0b60467df135287f0589f4271531f1324f9235b2 100644 (file)
@@ -227,7 +227,7 @@ DECL_TEMPLATE(freebsd, sys_timer_getoverrun) // 239
 // unimpl ffclock_setestimate 242
 // unimpl ffclock_getestimate 243
 DECL_TEMPLATE(freebsd, sys_clock_nanosleep) // 244
-// unimpl clock_getcpuclockid2 247
+DECL_TEMPLATE(freebsd, sys_clock_getcpuclockid2) // 247
 // unimpl ntp_gettime 248
 DECL_TEMPLATE(freebsd, sys_minherit) // 250
 DECL_TEMPLATE(freebsd, sys_rfork) // 251
index 24226fa17cad3c77f61324e406da25fd48bebf1b..076f5b4c4d7f0d8b93541598baf2667047728172 100644 (file)
@@ -290,6 +290,18 @@ PRE(sys_freebsd6_ftruncate)
 }
 #endif
 
+// SYS_clock_getcpuclockid2   247
+// no manpage for this, from syscalls.master
+// int clock_getcpuclockid2(id_t id, int which, _Out_ clockid_t *clock_id);
+PRE(sys_clock_getcpuclockid2)
+{
+   PRINT("sys_clock_getcpuclockid2( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",
+         SARG1,SARG2,ARG3);
+   PRE_REG_READ3(int, "clock_getcpuclockid2",
+                 id_t, id, int, len, clockid_t *, clock_id);
+   PRE_MEM_WRITE("clock_getcpuclockid2(clock_id)", ARG3, sizeof(vki_clockid_t));
+}
+
 // SYS_rfork 251
 // pid_t rfork(int flags);
 PRE(sys_rfork)
index 6dbf48d557c1ba447a7e42a3d63c4d7dec0461b4..07f00b497ddb51545151aff4fa8470a37e112f72 100644 (file)
@@ -2438,12 +2438,17 @@ PRE(sys_clock_nanosleep)
 POST(sys_clock_nanosleep)
 {
    if (ARG2 != 0)
-      PRE_MEM_WRITE( "clock_nanosleep(rmtp)", ARG2, sizeof(struct vki_timespec) );
+      POST_MEM_WRITE( ARG2, sizeof(struct vki_timespec) );
 }
 
 // SYS_clock_getcpuclockid2   247
-// no manpage for this
-// @todo
+// x86/amd64
+
+POST(sys_clock_getcpuclockid2)
+{
+   POST_MEM_WRITE(ARG3, sizeof(vki_clockid_t));
+}
+
 
 // SYS_ntp_gettime   248
 // int ntp_gettime(struct ntptimeval *);
@@ -6519,7 +6524,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    // unimpl SYS_ffclock_getestimate                       243
 
    BSDXY(__NR_clock_nanosleep,  sys_clock_nanosleep),   // 244
-   // unimpl SYS_clock_getcpuclockid2                      247
+   BSDXY(__NR_clock_getcpuclockid2, sys_clock_getcpuclockid2), // 247
 
    // unimpl SYS_ntp_gettime                               248
    BSDXY(__NR_minherit,         sys_minherit),          // 250
index d65d0100c4af605c1be5ed764dae11d7e70afd94..0c8da316f9f6f01638fde0274aa5a16c487ba198 100644 (file)
@@ -1,6 +1,6 @@
 
 /*--------------------------------------------------------------------*/
-/*--- Platform-specific syscalls stuff.        syswrap-x86-freebsd.c ---*/
+/*--- Platform-specific syscalls stuff.      syswrap-x86-freebsd.c ---*/
 /*--------------------------------------------------------------------*/
 
 /*
@@ -662,6 +662,20 @@ PRE(sys_freebsd6_ftruncate)
 }
 #endif
 
+// SYS_clock_getcpuclockid2   247
+// no manpage for this, from syscalls.master
+// int clock_getcpuclockid2(id_t id, int which, _Out_ clockid_t *clock_id);
+PRE(sys_clock_getcpuclockid2)
+{
+   PRINT("sys_clock_getcpuclockid2( %lld, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",
+         MERGE64(ARG1,ARG2),SARG3,ARG4);
+   PRE_REG_READ4(int, "clock_getcpuclockid2",
+                 vki_uint32_t, MERGE64_FIRST(offset),
+                 vki_uint32_t, MERGE64_SECOND(offset),
+                 int, len, clockid_t *, clock_id);
+   PRE_MEM_WRITE("clock_getcpuclockid2(clock_id)", ARG3, sizeof(vki_clockid_t));
+}
+
 // SYS_rfork 251
 // pid_t rfork(int flags);
 PRE(sys_rfork)
index ce604df3521e686ee103cd8d646b8948c03daaaa..3364625c72949d9b2c585dce7073c3ff5d5b8e8c 100644 (file)
@@ -889,7 +889,9 @@ int main(void)
    SY(SYS_clock_nanosleep, x0+5000, x0+3000, x0, x0+1); SUCC;
 #endif
 
-   // unimpl SYS_clock_getcpuclockid2                      247
+   // SYS_clock_getcpuclockid2                             247
+   GO(SYS_clock_getcpuclockid2, "3s 1m");
+   SY(SYS_clock_getcpuclockid2, x0+1, x0+1, x0+1); FAIL;
 
    // BSDXY(__NR_ntp_gettime,      sys_ntp_gettime),       // 248
 
index 3a74760bd52037d103d3f2a1671e6df8f4f01959..309749f072e190443974105945a3fe9b18588b28 100644 (file)
@@ -1890,6 +1890,22 @@ Syscall param clock_nanosleep(rmtp) points to unaddressable byte(s)
    ...
  Address 0x........ is not stack'd, malloc'd or (recently) free'd
 
+---------------------------------------------------------
+247:SYS_clock_getcpuclockid2 3s 1m
+---------------------------------------------------------
+Syscall param clock_getcpuclockid2(id) contains uninitialised byte(s)
+   ...
+
+Syscall param clock_getcpuclockid2(len) contains uninitialised byte(s)
+   ...
+
+Syscall param clock_getcpuclockid2(clock_id) contains uninitialised byte(s)
+   ...
+
+Syscall param clock_getcpuclockid2(clock_id) points to unaddressable byte(s)
+   ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
 ---------------------------------------------------------
 250:            SYS_minherit @todo
 ---------------------------------------------------------
index 8d587d4537498e3710f0ca1296458de8cd5dd8e2..62ed782c5f288956602ae65de1c5a9287e6eb4db 100644 (file)
@@ -1890,6 +1890,22 @@ Syscall param clock_nanosleep(rmtp) points to unaddressable byte(s)
    ...
  Address 0x........ is not stack'd, malloc'd or (recently) free'd
 
+---------------------------------------------------------
+247:SYS_clock_getcpuclockid2 3s 1m
+---------------------------------------------------------
+Syscall param clock_getcpuclockid2(offset_low) contains uninitialised byte(s)
+   ...
+
+Syscall param clock_getcpuclockid2(offset_high) contains uninitialised byte(s)
+   ...
+
+Syscall param clock_getcpuclockid2(len) contains uninitialised byte(s)
+   ...
+
+Syscall param clock_getcpuclockid2(clock_id) points to unaddressable byte(s)
+   ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
 ---------------------------------------------------------
 250:            SYS_minherit @todo
 ---------------------------------------------------------