You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
|
2
(5) |
3
(1) |
4
|
5
|
6
|
|
7
|
8
|
9
|
10
(1) |
11
(1) |
12
|
13
|
|
14
(1) |
15
(1) |
16
(1) |
17
|
18
(1) |
19
|
20
|
|
21
|
22
(1) |
23
(1) |
24
|
25
|
26
|
27
|
|
28
|
29
|
30
|
31
|
|
|
|
|
From: Mark W. <ma...@so...> - 2019-07-02 22:31:21
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=b0861063a8d2a55bb7423e90d26806bab0f78a12 commit b0861063a8d2a55bb7423e90d26806bab0f78a12 Author: Alexandra Hájková <aha...@re...> Date: Tue Jun 4 13:47:14 2019 +0200 Add support for preadv2 and pwritev2 syscalls Support for amd64, x86 - 64 and 32 bit, arm64, ppc64, ppc64le, s390x, mips64. This should work identically on all arches, tested on x86 32bit and 64bit one, but enabled on all. Refactor the code to be reusable between old/new syscalls. Resolve TODO items in the code. Add the testcase for the preadv2/pwritev2 and also add the (similar) testcase for the older preadv/pwritev syscalls. Trying to test handling an uninitialized flag argument for the v2 syscalls does not work because the flag always comes out as defined zero. Turns out glibc does this deliberately on 64bit architectures because the kernel does actually have a low_offset and high_offset argument, but ignores the high_offset/assumes it is zero. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=601cc11d054ae4b5e9b5babec3d8e4667a2cb9b5 https://bugs.kde.org/408414 Diff: --- NEWS | 1 + configure.ac | 8 + coregrind/m_syswrap/priv_syswrap-generic.h | 13 ++ coregrind/m_syswrap/priv_syswrap-linux.h | 2 + coregrind/m_syswrap/syswrap-amd64-linux.c | 2 + coregrind/m_syswrap/syswrap-arm64-linux.c | 4 +- coregrind/m_syswrap/syswrap-linux.c | 193 ++++++++++++++++----- coregrind/m_syswrap/syswrap-mips64-linux.c | 2 + coregrind/m_syswrap/syswrap-ppc64-linux.c | 2 + coregrind/m_syswrap/syswrap-s390x-linux.c | 2 + coregrind/m_syswrap/syswrap-x86-linux.c | 2 + memcheck/tests/linux/Makefile.am | 12 +- memcheck/tests/linux/sys-preadv2_pwritev2.c | 79 +++++++++ .../tests/linux/sys-preadv2_pwritev2.stderr.exp | 56 ++++++ memcheck/tests/linux/sys-preadv2_pwritev2.vgtest | 3 + memcheck/tests/linux/sys-preadv_pwritev.c | 77 ++++++++ memcheck/tests/linux/sys-preadv_pwritev.stderr.exp | 52 ++++++ memcheck/tests/linux/sys-preadv_pwritev.vgtest | 3 + 18 files changed, 469 insertions(+), 44 deletions(-) diff --git a/NEWS b/NEWS index 5e6c49b..6406035 100644 --- a/NEWS +++ b/NEWS @@ -54,6 +54,7 @@ where XXXXXX is the bug number as listed below. 407764 drd cond_post_wait gets wrong (?) condition on s390x z13 system 408009 Expose rdrand and f16c even on avx if host cpu supports them 408091 Missing pkey syscalls +408414 Add support for missing for preadv2 and pwritev2 syscalls 404406 s390x: z14 miscellaneous instructions not implemented n-i-bz Fix minor one time leaks in dhat. n-i-bz Add --run-cxx-freeres=no in outer args to avoid inner crashes. diff --git a/configure.ac b/configure.ac index 3528925..3596d2f 100755 --- a/configure.ac +++ b/configure.ac @@ -4173,6 +4173,10 @@ AC_CHECK_FUNCS([ \ process_vm_readv \ process_vm_writev \ copy_file_range \ + preadv \ + pwritev \ + preadv2 \ + pwritev2 \ ]) # AC_CHECK_LIB adds any library found to the variable LIBS, and links these @@ -4190,6 +4194,10 @@ AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP], [test x$ac_cv_func_pthread_setname_np = xyes]) AM_CONDITIONAL([HAVE_COPY_FILE_RANGE], [test x$ac_cv_func_copy_file_range = xyes]) +AM_CONDITIONAL([HAVE_PREADV_PWRITEV], + [test x$ac_cv_func_preadv = xyes && test x$ac_cv_func_pwritev = xyes]) +AM_CONDITIONAL([HAVE_PREADV2_PWRITEV2], + [test x$ac_cv_func_preadv2 = xyes && test x$ac_cv_func_pwritev2 = xyes]) if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \ -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then diff --git a/coregrind/m_syswrap/priv_syswrap-generic.h b/coregrind/m_syswrap/priv_syswrap-generic.h index 3e1c8b6..73f9224 100644 --- a/coregrind/m_syswrap/priv_syswrap-generic.h +++ b/coregrind/m_syswrap/priv_syswrap-generic.h @@ -109,6 +109,19 @@ ML_(handle_auxv_open)(SyscallStatus *status, const HChar *filename, /* Helper function for generic mprotect and linux pkey_mprotect. */ extern void handle_sys_mprotect (ThreadId tid, SyscallStatus *status, Addr *addr, SizeT *len, Int *prot); +/* Helper functions for preadv/preadv2. */ +extern +void handle_pre_sys_preadv(ThreadId tid, SyscallStatus* status, + Int fd, Addr vector, Int count, + const char *str); +extern +void handle_post_sys_preadv(ThreadId tid, SyscallStatus* status, Addr vector, Int count); + +/* Helper function for pwritev/pwritev2. */ +extern +void handle_sys_pwritev(ThreadId tid, SyscallStatus* status, + Int fd, Addr vector, Int count, + const char *str); DECL_TEMPLATE(generic, sys_ni_syscall); // * P -- unimplemented DECL_TEMPLATE(generic, sys_exit); diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index be2f9bd..8ce8ef3 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -46,7 +46,9 @@ DECL_TEMPLATE(linux, sys_oldumount); DECL_TEMPLATE(linux, sys_umount); DECL_TEMPLATE(linux, sys_perf_event_open); DECL_TEMPLATE(linux, sys_preadv); +DECL_TEMPLATE(linux, sys_preadv2); DECL_TEMPLATE(linux, sys_pwritev); +DECL_TEMPLATE(linux, sys_pwritev2); DECL_TEMPLATE(linux, sys_sendmmsg); DECL_TEMPLATE(linux, sys_recvmmsg); DECL_TEMPLATE(linux, sys_dup3); diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 382dc65..9b8068d 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -857,6 +857,8 @@ static SyscallTableEntry syscall_table[] = { // LIN__(__NR_kexec_file_load, sys_ni_syscall), // 320 LINXY(__NR_bpf, sys_bpf), // 321 + LINXY(__NR_preadv2, sys_preadv2), // 327 + LINX_(__NR_pwritev2, sys_pwritev2), // 328 LINXY(__NR_statx, sys_statx), // 332 diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index c700e3d..d12d406 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -818,8 +818,8 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_membarrier, sys_membarrier), // 283 // (__NR_mlock2, sys_ni_syscall), // 284 LINX_(__NR_copy_file_range, sys_copy_file_range), // 285 - // (__NR_preadv2, sys_ni_syscall), // 286 - // (__NR_pwritev2, sys_ni_syscall), // 287 + LINX_(__NR_preadv2, sys_ni_syscall), // 286 + LINX_(__NR_pwritev2, sys_ni_syscall), // 287 // (__NR_pkey_mprotect, sys_ni_syscall), // 288 // (__NR_pkey_alloc, sys_ni_syscall), // 289 // (__NR_pkey_free, sys_ni_syscall), // 290 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 36d09d6..2fe15d9 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -5501,12 +5501,57 @@ POST(sys_open_by_handle_at) /* --------------------------------------------------------------------- p{read,write}v wrappers ------------------------------------------------------------------ */ +/* This handles the common part of the PRE macro for preadv and preadv2. */ +void handle_pre_sys_preadv(ThreadId tid, SyscallStatus* status, + Int fd, Addr vector, Int count, const char *str) +{ + struct vki_iovec * vec; + Int i; + /* safe size for the "preadv/preadv2(vector[i])" string */ + char tmp[30]; + + if (!ML_(fd_allowed)(fd, str, tid, False)) { + SET_STATUS_Failure( VKI_EBADF ); + } else if (count > 0) { + VG_(strcpy) (tmp, str); + VG_(strcat) (tmp, "(vector)"); + PRE_MEM_READ( tmp, vector, count * sizeof(struct vki_iovec) ); + + if (ML_(safe_to_deref) ((void *)(Addr)vector, + count * sizeof(struct vki_iovec))) { + vec = (struct vki_iovec *)(Addr)vector; + for (i = 0; i < count; i++) { + VG_(snprintf) (tmp, 30, "%s(vector[%d])", str, i); + PRE_MEM_WRITE( tmp, (Addr)vec[i].iov_base, vec[i].iov_len ); + } + } + } +} + +/* This handles the common part of the POST macro for preadv and preadv2. */ +void handle_post_sys_preadv(ThreadId tid, SyscallStatus* status, Addr vector, Int count) +{ + vg_assert(SUCCESS); + if (RES > 0) { + Int i; + struct vki_iovec * vec = (struct vki_iovec *)(Addr)vector; + Int remains = RES; + + /* RES holds the number of bytes read. */ + for (i = 0; i < count; i++) { + Int nReadThisBuf = vec[i].iov_len; + if (nReadThisBuf > remains) nReadThisBuf = remains; + POST_MEM_WRITE( (Addr)vec[i].iov_base, nReadThisBuf ); + remains -= nReadThisBuf; + if (remains < 0) VG_(core_panic)("preadv: remains < 0"); + } + } +} PRE(sys_preadv) { - Int i; - struct vki_iovec * vec; *flags |= SfMayBlock; + const char *str = "preadv"; #if VG_WORDSIZE == 4 /* Note that the offset argument here is in lo+hi order on both big and little endian platforms... */ @@ -5525,45 +5570,89 @@ PRE(sys_preadv) #else # error Unexpected word size #endif - if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) { - SET_STATUS_Failure( VKI_EBADF ); - } else { - PRE_MEM_READ( "preadv(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) ); + Int fd = ARG1; + Addr vector = ARG2; + Int count = ARG3; + + handle_pre_sys_preadv(tid, status, fd, vector, count, str); - if (ARG2 != 0) { - /* ToDo: don't do any of the following if the vector is invalid */ - vec = (struct vki_iovec *)(Addr)ARG2; - for (i = 0; i < (Int)ARG3; i++) - PRE_MEM_WRITE( "preadv(vector[...])", - (Addr)vec[i].iov_base, vec[i].iov_len ); - } - } } POST(sys_preadv) { - vg_assert(SUCCESS); - if (RES > 0) { - Int i; - struct vki_iovec * vec = (struct vki_iovec *)(Addr)ARG2; - Int remains = RES; + Addr vector = ARG2; + Int count = ARG3; - /* RES holds the number of bytes read. */ - for (i = 0; i < (Int)ARG3; i++) { - Int nReadThisBuf = vec[i].iov_len; - if (nReadThisBuf > remains) nReadThisBuf = remains; - POST_MEM_WRITE( (Addr)vec[i].iov_base, nReadThisBuf ); - remains -= nReadThisBuf; - if (remains < 0) VG_(core_panic)("preadv: remains < 0"); + handle_post_sys_preadv(tid, status, vector, count); +} + +PRE(sys_preadv2) +{ + *flags |= SfMayBlock; + const char *str = "preadv2"; +#if VG_WORDSIZE == 4 + /* Note that the offset argument here is in lo+hi order on both + big and little endian platforms... */ + PRINT("sys_preadv2 ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD + "u, %lld, %" FMT_REGWORD "u )", + ARG1, ARG2, ARG3, (Long)LOHI64(ARG4,ARG5), ARG6); + PRE_REG_READ6(ssize_t, "preadv2", + unsigned long, fd, const struct iovec *, vector, + unsigned long, count, vki_u32, offset_low, + vki_u32, offset_high, unsigned long, flags); +#elif VG_WORDSIZE == 8 + PRINT("sys_preadv2 ( %lu, %#lx, %lu, %ld, %lu )", ARG1, ARG2, ARG3, SARG4, ARG5); + PRE_REG_READ5(ssize_t, "preadv2", + unsigned long, fd, const struct iovec *, vector, + unsigned long, count, Word, offset, unsigned long, flags); +#else +# error Unexpected word size +#endif + Int fd = ARG1; + Addr vector = ARG2; + Int count = ARG3; + + handle_pre_sys_preadv(tid, status, fd, vector, count, str); +} + +POST(sys_preadv2) +{ + Addr vector = ARG2; + Int count = ARG3; + + handle_post_sys_preadv(tid, status, vector, count); +} + +/* This handles the common part of the PRE macro for pwritev and pwritev2. */ +void handle_sys_pwritev(ThreadId tid, SyscallStatus* status, + Int fd, Addr vector, Int count, const char *str) +{ + Int i; + struct vki_iovec * vec; + /* safe size for the "preadv/preadv2(vector[i])" string */ + char tmp[30]; + + if (!ML_(fd_allowed)(fd, str, tid, False)) { + SET_STATUS_Failure( VKI_EBADF ); + } else if (count > 0) { + VG_(strcpy) (tmp, str); + VG_(strcat) (tmp, "(vector)"); + PRE_MEM_READ( tmp, vector, count * sizeof(struct vki_iovec) ); + if (ML_(safe_to_deref) ((void *)(Addr)vector, + count * sizeof(struct vki_iovec))) { + vec = (struct vki_iovec *)(Addr)vector; + for (i = 0; i < count; i++) { + VG_(snprintf) (tmp, 30, "%s(vector[%d])", str, i); + PRE_MEM_READ( tmp, (Addr)vec[i].iov_base, vec[i].iov_len ); + } } } } PRE(sys_pwritev) { - Int i; - struct vki_iovec * vec; *flags |= SfMayBlock; + const char *str = "pwritev"; #if VG_WORDSIZE == 4 /* Note that the offset argument here is in lo+hi order on both big and little endian platforms... */ @@ -5581,19 +5670,41 @@ PRE(sys_pwritev) #else # error Unexpected word size #endif - if (!ML_(fd_allowed)(ARG1, "pwritev", tid, False)) { - SET_STATUS_Failure( VKI_EBADF ); - } else { - PRE_MEM_READ( "pwritev(vector)", - ARG2, ARG3 * sizeof(struct vki_iovec) ); - if (ARG2 != 0) { - /* ToDo: don't do any of the following if the vector is invalid */ - vec = (struct vki_iovec *)(Addr)ARG2; - for (i = 0; i < (Int)ARG3; i++) - PRE_MEM_READ( "pwritev(vector[...])", - (Addr)vec[i].iov_base, vec[i].iov_len ); - } - } + Int fd = ARG1; + Addr vector = ARG2; + Int count = ARG3; + + handle_sys_pwritev(tid, status, fd, vector, count, str); +} + +PRE(sys_pwritev2) +{ + *flags |= SfMayBlock; + const char *str = "pwritev2"; +#if VG_WORDSIZE == 4 + /* Note that the offset argument here is in lo+hi order on both + big and little endian platforms... */ + PRINT("sys_pwritev2 ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD + "u, %lld, %" FMT_REGWORD "u )", + ARG1, ARG2, ARG3, (Long)LOHI64(ARG4,ARG5), ARG6); + PRE_REG_READ6(ssize_t, "pwritev2", + unsigned long, fd, const struct iovec *, vector, + unsigned long, count, vki_u32, offset_low, + vki_u32, offset_high, unsigned long, flags); +#elif VG_WORDSIZE == 8 + /* Note offset_high isn't actually used? */ + PRE_REG_READ6(ssize_t, "pwritev2", + unsigned long, fd, const struct iovec *, vector, + unsigned long, count, Word, offset, + Word, offset_high, unsigned long, flags); +#else +# error Unexpected word size +#endif + Int fd = ARG1; + Addr vector = ARG2; + Int count = ARG3; + + handle_sys_pwritev(tid, status, fd, vector, count, str); } /* --------------------------------------------------------------------- diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 201050a..1ab8244 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -830,6 +830,8 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_memfd_create, sys_memfd_create), LINX_(__NR_membarrier, sys_membarrier), LINX_(__NR_copy_file_range, sys_copy_file_range), + LINX_(__NR_preadv2, sys_preadv2), + LINX_(__NR_pwritev2, sys_pwritev2), LINX_(__NR_syncfs, sys_syncfs), LINXY(__NR_statx, sys_statx), }; diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index baa2934..d65a664 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1006,6 +1006,8 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_membarrier, sys_membarrier), // 365 LINX_(__NR_copy_file_range, sys_copy_file_range), // 379 + LINX_(__NR_preadv2, sys_preadv2), // 380 + LINX_(__NR_pwritev2, sys_pwritev2), // 381 LINXY(__NR_statx, sys_statx), // 383 }; diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index 1481e76..3354d41 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -853,6 +853,8 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_shutdown, sys_shutdown), // 373 LINX_(__NR_copy_file_range, sys_copy_file_range), // 375 + LINXY(__NR_preadv2, sys_preadv2), // 376 + LINX_(__NR_pwritev2, sys_pwritev2), // 377 LINXY(__NR_statx, sys_statx), // 379 }; diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 9ff53a9..33d1213 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1607,6 +1607,8 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_membarrier, sys_membarrier), // 375 LINX_(__NR_copy_file_range, sys_copy_file_range), // 377 + LINXY(__NR_preadv2, sys_preadv2), // 378 + LINX_(__NR_pwritev2, sys_pwritev2), // 379 LINXY(__NR_pkey_mprotect, sys_pkey_mprotect), // 380 LINX_(__NR_pkey_alloc, sys_pkey_alloc), // 381 diff --git a/memcheck/tests/linux/Makefile.am b/memcheck/tests/linux/Makefile.am index 00e99a5..e133258 100644 --- a/memcheck/tests/linux/Makefile.am +++ b/memcheck/tests/linux/Makefile.am @@ -26,7 +26,9 @@ EXTRA_DIST = \ timerfd-syscall.vgtest timerfd-syscall.stderr.exp \ with-space.stderr.exp with-space.stdout.exp with-space.vgtest \ proc-auxv.vgtest proc-auxv.stderr.exp getregset.vgtest \ - getregset.stderr.exp getregset.stdout.exp + getregset.stderr.exp getregset.stdout.exp \ + sys-preadv_pwritev.vgtest sys-preadv_pwritev.stderr.exp \ + sys-preadv2_pwritev2.vgtest sys-preadv2_pwritev2.stderr.exp check_PROGRAMS = \ brk \ @@ -54,6 +56,14 @@ if HAVE_COPY_FILE_RANGE check_PROGRAMS += sys-copy_file_range endif +if HAVE_PREADV_PWRITEV + check_PROGRAMS += sys-preadv_pwritev +endif + +if HAVE_PREADV2_PWRITEV2 + check_PROGRAMS += sys-preadv2_pwritev2 +endif + AM_CFLAGS += $(AM_FLAG_M3264_PRI) AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) diff --git a/memcheck/tests/linux/sys-preadv2_pwritev2.c b/memcheck/tests/linux/sys-preadv2_pwritev2.c new file mode 100644 index 0000000..942eab6 --- /dev/null +++ b/memcheck/tests/linux/sys-preadv2_pwritev2.c @@ -0,0 +1,79 @@ +#define _GNU_SOURCE +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> +#include <unistd.h> +#include <sys/syscall.h> +#include <sys/uio.h> +#include <string.h> +#include "../../memcheck.h" + +#include <errno.h> + +int main(int argc, char **argv) +{ + char str0[] = "hello "; + char str1[] = "world\n"; + struct iovec iov[2]; + int fd; + + fd = open("prwv2_source", O_CREAT | O_RDWR, 0644); + if (fd == -1) { + perror("prwv2_source"); + exit(EXIT_FAILURE); + } + + iov[0].iov_base = str0; + iov[0].iov_len = strlen(str0); + iov[1].iov_base = str1; + iov[1].iov_len = strlen(str1); + + /* Check pwritev2 and preadv2 called with the correct arguments works. */ + if (pwritev2(fd, iov, 2, 0, 0) == -1) { + perror("pwritev2"); + exit(EXIT_FAILURE); + } + + if (preadv2(fd, iov, 2, 0, 0) == -1) { + perror("preadv2"); + printf("errno: %d\n", errno); + exit(EXIT_FAILURE); + } + + /* Check valgrind will produce expected warnings for the + various wrong arguments. */ + do { + /* always allocate 16 bytes to not to have different .exps for different reg sizes */ + char *mem = malloc(16); + void *t = (void *) &mem[0]; + void *z = (void *) -1; + int c = *((int *) &mem[4]); + int flag = *((int *) &mem[8]); + pwritev2(fd, NULL, 2, 0, 0); + pwritev2(fd, z, 2, 0, 0); + pwritev2(fd, t, 2, 0, 0); + pwritev2(fd, iov, -1, 0, 0); + pwritev2(fd, iov, c, 0, 0); + pwritev2(fd, iov, 2, -5, 0); + pwritev2(-1, iov, 2, -5, 0); + pwritev2(fd, iov, 2, -5, flag); + + preadv2(fd, NULL, 2, 0, 0); + preadv2(fd, z, 2, 0, 0); + preadv2(fd, t, 2, 0, 0); + preadv2(fd, iov, -1, 0, 0); + preadv2(fd, iov, c, 0, 0); + preadv2(fd, iov, 2, -5, 0); + preadv2(-1, iov, 2, -5, 0); + + iov[1].iov_base = (void *) -1; + pwritev2(fd, iov, 2, 0, 0); + preadv2(fd, iov, 2, 0, 0); + free(mem); + } while (0); + + close(fd); + unlink("prwv2_source"); + exit(EXIT_SUCCESS); +} diff --git a/memcheck/tests/linux/sys-preadv2_pwritev2.stderr.exp b/memcheck/tests/linux/sys-preadv2_pwritev2.stderr.exp new file mode 100644 index 0000000..e11f2a5 --- /dev/null +++ b/memcheck/tests/linux/sys-preadv2_pwritev2.stderr.exp @@ -0,0 +1,56 @@ +Syscall param pwritev2(vector) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv2_pwritev2.c:53) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param pwritev2(vector) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv2_pwritev2.c:54) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param pwritev2(vector) points to uninitialised byte(s) + ... + by 0x........: main (sys-preadv2_pwritev2.c:55) + Address 0x........ is 0 bytes inside a block of size 16 alloc'd + at 0x........: malloc (vg_replace_malloc.c:...) + by 0x........: main (sys-preadv2_pwritev2.c:48) + +Syscall param pwritev2(count) contains uninitialised byte(s) + ... + by 0x........: main (sys-preadv2_pwritev2.c:57) + +Syscall param pwritev2(flags) contains uninitialised byte(s) + ... + by 0x........: main (sys-preadv2_pwritev2.c:60) + +Syscall param preadv2(vector) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv2_pwritev2.c:62) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param preadv2(vector) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv2_pwritev2.c:63) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param preadv2(vector) points to uninitialised byte(s) + ... + by 0x........: main (sys-preadv2_pwritev2.c:64) + Address 0x........ is 0 bytes inside a block of size 16 alloc'd + at 0x........: malloc (vg_replace_malloc.c:...) + by 0x........: main (sys-preadv2_pwritev2.c:48) + +Syscall param preadv2(count) contains uninitialised byte(s) + ... + by 0x........: main (sys-preadv2_pwritev2.c:66) + +Syscall param pwritev2(vector[1]) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv2_pwritev2.c:71) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param preadv2(vector[1]) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv2_pwritev2.c:72) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + diff --git a/memcheck/tests/linux/sys-preadv2_pwritev2.vgtest b/memcheck/tests/linux/sys-preadv2_pwritev2.vgtest new file mode 100644 index 0000000..5cd23aa --- /dev/null +++ b/memcheck/tests/linux/sys-preadv2_pwritev2.vgtest @@ -0,0 +1,3 @@ +prereq: test -e sys-preadv2_pwritev2 +prog: sys-preadv2_pwritev2 +vgopts: -q diff --git a/memcheck/tests/linux/sys-preadv_pwritev.c b/memcheck/tests/linux/sys-preadv_pwritev.c new file mode 100644 index 0000000..f5087dd --- /dev/null +++ b/memcheck/tests/linux/sys-preadv_pwritev.c @@ -0,0 +1,77 @@ +#define _GNU_SOURCE +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> +#include <unistd.h> +#include <sys/syscall.h> +#include <sys/uio.h> +#include <string.h> +#include "../../memcheck.h" + +#include <errno.h> + +int main(int argc, char **argv) +{ + char str0[] = "hello "; + char str1[] = "world\n"; + struct iovec iov[2]; + int fd; + + fd = open("prwv_source", O_CREAT | O_RDWR, 0644); + if (fd == -1) { + perror("prwv2_source"); + exit(EXIT_FAILURE); + } + + iov[0].iov_base = str0; + iov[0].iov_len = strlen(str0); + iov[1].iov_base = str1; + iov[1].iov_len = strlen(str1); + + /* Check pwritev and preadv called with the correct arguments works. */ + if (pwritev(fd, iov, 2, 0) == -1) { + perror("pwritev"); + exit(EXIT_FAILURE); + } + + if (preadv(fd, iov, 2, 0) == -1) { + perror("preadv"); + printf("errno: %d\n", errno); + exit(EXIT_FAILURE); + } + + /* Check valgrind will produce expected warnings for the + various wrong arguments. */ + do { + /* always allocate 16 bytes to not to have different .exps for different reg sizes */ + char *mem = malloc(16); + void *t = (void *) &mem[0]; + void *z = (void *) -1; + int c = *((int *) &mem[4]); + pwritev(fd, NULL, 2, 0); + pwritev(fd, z, 2, 0); + pwritev(fd, t, 2, 0); + pwritev(fd, iov, -1, 0); + pwritev(fd, iov, c, 0); + pwritev(fd, iov, 2, -5); + pwritev(-1, iov, 2, -5); + + preadv(fd, NULL, 2, 0); + preadv(fd, z, 2, 0); + preadv(fd, t, 2, 0); + preadv(fd, iov, -1, 0); + preadv(fd, iov, c, 0); + preadv(fd, iov, 2, -5); + preadv(-1, iov, 2, -5); + + iov[1].iov_base = (void *) -1; + pwritev(fd, iov, 2, 0); + preadv(fd, iov, 2, 0); + free(mem); + } while (0); + + close(fd); + unlink("prwv_source"); + exit(EXIT_SUCCESS); +} diff --git a/memcheck/tests/linux/sys-preadv_pwritev.stderr.exp b/memcheck/tests/linux/sys-preadv_pwritev.stderr.exp new file mode 100644 index 0000000..4fede44 --- /dev/null +++ b/memcheck/tests/linux/sys-preadv_pwritev.stderr.exp @@ -0,0 +1,52 @@ +Syscall param pwritev(vector) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv_pwritev.c:52) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param pwritev(vector) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv_pwritev.c:53) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param pwritev(vector) points to uninitialised byte(s) + ... + by 0x........: main (sys-preadv_pwritev.c:54) + Address 0x........ is 0 bytes inside a block of size 16 alloc'd + at 0x........: malloc (vg_replace_malloc.c:...) + by 0x........: main (sys-preadv_pwritev.c:48) + +Syscall param pwritev(count) contains uninitialised byte(s) + ... + by 0x........: main (sys-preadv_pwritev.c:56) + +Syscall param preadv(vector) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv_pwritev.c:60) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param preadv(vector) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv_pwritev.c:61) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param preadv(vector) points to uninitialised byte(s) + ... + by 0x........: main (sys-preadv_pwritev.c:62) + Address 0x........ is 0 bytes inside a block of size 16 alloc'd + at 0x........: malloc (vg_replace_malloc.c:...) + by 0x........: main (sys-preadv_pwritev.c:48) + +Syscall param preadv(count) contains uninitialised byte(s) + ... + by 0x........: main (sys-preadv_pwritev.c:64) + +Syscall param pwritev(vector[1]) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv_pwritev.c:69) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param preadv(vector[1]) points to unaddressable byte(s) + ... + by 0x........: main (sys-preadv_pwritev.c:70) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + diff --git a/memcheck/tests/linux/sys-preadv_pwritev.vgtest b/memcheck/tests/linux/sys-preadv_pwritev.vgtest new file mode 100644 index 0000000..f07dc29 --- /dev/null +++ b/memcheck/tests/linux/sys-preadv_pwritev.vgtest @@ -0,0 +1,3 @@ +prereq: test -e sys-preadv_pwritev +prog: sys-preadv_pwritev +vgopts: -q |
|
From: Tom H. <to...@co...> - 2019-07-02 11:49:21
|
On 02/07/2019 11:43, Catalin Vasile via Valgrind-developers wrote: > I've talked with the IT team from my company, and they say they do not > block sourceforge. Could you please check if there is something blocked > at your end, please? We don't have any access to sourceforge servers or logs so there is no way for us to check anything. Tom -- Tom Hughes (to...@co...) http://compton.nu/ |
|
From: Catalin V. <cat...@ke...> - 2019-07-02 11:13:46
|
Hi, I've subscribed to your mailing list. I even started a thread on it in the last days of June. I see my e-mails being received in the mailing list archive on the web interface, but I don't actually receive them myself. Neither do I receive the community replies. I also tried sending the subscription password and it also didn't work. If I try to subscribe again I do receive that I'm already subscribed. I've talked with the IT team from my company, and they say they do not block sourceforge. Could you please check if there is something blocked at your end, please? Best regards, Catalin Vasile |
|
From: Bart V. A. <bva...@so...> - 2019-07-02 02:28:13
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=97fa86915e717dc68123f05b668b73adfe8885a9 commit 97fa86915e717dc68123f05b668b73adfe8885a9 Author: Bart Van Assche <bva...@ac...> Date: Mon Jul 1 15:09:04 2019 -0700 Add support for the Linux io_uring system calls Man pages and test code are available in the following git repository: http://git.kernel.dk/cgit/liburing/ Diff: --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 7 ++ coregrind/m_syswrap/syswrap-amd64-linux.c | 4 + coregrind/m_syswrap/syswrap-linux.c | 73 ++++++++++++++ coregrind/m_syswrap/syswrap-x86-linux.c | 6 +- include/pub_tool_vki.h | 1 + include/vki/vki-linux-io_uring.h | 159 ++++++++++++++++++++++++++++++ 7 files changed, 250 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 770a231..5e6c49b 100644 --- a/NEWS +++ b/NEWS @@ -57,6 +57,7 @@ where XXXXXX is the bug number as listed below. 404406 s390x: z14 miscellaneous instructions not implemented n-i-bz Fix minor one time leaks in dhat. n-i-bz Add --run-cxx-freeres=no in outer args to avoid inner crashes. +n-i-bz Add support for the Linux io_uring system calls Release 3.15.0 (12 April 2019) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 2471524..be2f9bd 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -304,6 +304,13 @@ DECL_TEMPLATE(linux, sys_pkey_alloc); DECL_TEMPLATE(linux, sys_pkey_free); DECL_TEMPLATE(linux, sys_pkey_mprotect); +// Linux io_uring system calls. See also commit 2b188cc1bb85 ("Add io_uring IO +// interface") # v5.1. See also commit edafccee56ff ("io_uring: add support +// for pre-mapped user IO buffers") # v5.1. +DECL_TEMPLATE(linux, sys_io_uring_setup); +DECL_TEMPLATE(linux, sys_io_uring_enter); +DECL_TEMPLATE(linux, sys_io_uring_register); + /* --------------------------------------------------------------------- Wrappers for sockets and ipc-ery. These are split into standalone procedures because x86-linux hides them inside multiplexors diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 2d6b95f..382dc65 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -867,6 +867,10 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_pkey_mprotect, sys_pkey_mprotect), // 329 LINX_(__NR_pkey_alloc, sys_pkey_alloc), // 330 LINX_(__NR_pkey_free, sys_pkey_free), // 331 + + LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 + LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 + LINXY(__NR_io_uring_register, sys_io_uring_register), // 427 }; SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 5452b8d..36d09d6 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -12190,6 +12190,79 @@ POST(sys_pkey_mprotect) ML_(notify_core_and_tool_of_mprotect)(addr, len, prot); } +PRE(sys_io_uring_setup) +{ + PRINT("sys_io_uring_setup ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", + ARG1, ARG2); + PRE_REG_READ2(long, "io_uring_setup", unsigned int, entries, + struct vki_io_uring_params *, p); + if (ARG2) + PRE_MEM_READ("io_uring_setup(p)", ARG2, + offsetof(struct vki_io_uring_params, sq_off)); +} + +POST(sys_io_uring_setup) +{ + vg_assert(SUCCESS); + if (!ML_(fd_allowed)(RES, "io_uring_setup", tid, True)) { + VG_(close)(RES); + SET_STATUS_Failure( VKI_EMFILE ); + } else { + if (VG_(clo_track_fds)) + ML_(record_fd_open_with_given_name)(tid, RES, (HChar*)(Addr)ARG1); + POST_MEM_WRITE(ARG2 + offsetof(struct vki_io_uring_params, sq_off), + sizeof(struct vki_io_sqring_offsets) + + sizeof(struct vki_io_cqring_offsets)); + } +} + +PRE(sys_io_uring_enter) +{ + PRINT("sys_io_uring_enter ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %" + FMT_REGWORD "u %" FMT_REGWORD "u, %" FMT_REGWORD "u %" + FMT_REGWORD "u )", + ARG1, ARG2, ARG3, ARG4, ARG5, ARG6); + PRE_REG_READ6(long, "io_uring_enter", + unsigned int, fd, unsigned int, to_submit, + unsigned int, min_complete, unsigned int, flags, + const void *, sig, unsigned long, sigsz); + if (ARG5) + PRE_MEM_READ("io_uring_enter(sig)", ARG5, ARG6); +} + +POST(sys_io_uring_enter) +{ +} + +PRE(sys_io_uring_register) +{ + PRINT("sys_io_uring_register ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %" + FMT_REGWORD "u %" FMT_REGWORD "u )", ARG1, ARG2, ARG3, ARG4); + PRE_REG_READ4(long, "io_uring_register", + unsigned int, fd, unsigned int, opcode, + void *, arg, unsigned int, nr_args); + switch (ARG2) { + case VKI_IORING_REGISTER_BUFFERS: + PRE_MEM_READ("", ARG3, ARG4 * sizeof(struct vki_iovec)); + break; + case VKI_IORING_UNREGISTER_BUFFERS: + break; + case VKI_IORING_REGISTER_FILES: + PRE_MEM_READ("", ARG3, ARG4 * sizeof(__vki_s32)); + break; + case VKI_IORING_UNREGISTER_FILES: + break; + case VKI_IORING_REGISTER_EVENTFD: + PRE_MEM_READ("", ARG3, sizeof(__vki_s32)); + break; + case VKI_IORING_UNREGISTER_EVENTFD: + break; + } +} + +POST(sys_io_uring_register) +{ +} #undef PRE #undef POST diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 3829fa4..9ff53a9 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1614,7 +1614,11 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_statx, sys_statx), // 383 /* Explicitly not supported on i386 yet. */ - GENX_(__NR_arch_prctl, sys_ni_syscall) // 384 + GENX_(__NR_arch_prctl, sys_ni_syscall), // 384 + + LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 + LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 + LINXY(__NR_io_uring_register, sys_io_uring_register),// 427 }; SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/include/pub_tool_vki.h b/include/pub_tool_vki.h index 560800d..4aa36f3 100644 --- a/include/pub_tool_vki.h +++ b/include/pub_tool_vki.h @@ -46,6 +46,7 @@ #if defined(VGO_linux) # include "vki/vki-linux.h" # include "vki/vki-linux-drm.h" +# include "vki/vki-linux-io_uring.h" #elif defined(VGO_darwin) # include "vki/vki-darwin.h" #elif defined(VGO_solaris) diff --git a/include/vki/vki-linux-io_uring.h b/include/vki/vki-linux-io_uring.h new file mode 100644 index 0000000..5059c30 --- /dev/null +++ b/include/vki/vki-linux-io_uring.h @@ -0,0 +1,159 @@ +/* + This file is part of Valgrind, a dynamic binary instrumentation framework. + + Copyright (C) 2019 Bart Van Assche <bva...@ac...> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + The GNU General Public License is contained in the file COPYING. +*/ + +#ifndef _VKI_IO_URING_H_ +#define _VKI_IO_URING_H_ + +// Derived from linux-5.2/include/uapi/linux/io_uring.h */ + +/* + * IO submission data structure (Submission Queue Entry) + */ +struct vki_io_uring_sqe { + __vki_u8 opcode; /* type of operation for this sqe */ + __vki_u8 flags; /* IOSQE_ flags */ + __vki_u16 ioprio; /* ioprio for the request */ + __vki_s32 fd; /* file descriptor to do IO on */ + __vki_u64 off; /* offset into file */ + __vki_u64 addr; /* pointer to buffer or iovecs */ + __vki_u32 len; /* buffer size or number of iovecs */ + union { + int rw_flags; + __vki_u32 fsync_flags; + __vki_u16 poll_events; + __vki_u32 sync_range_flags; + __vki_u32 msg_flags; + }; + __vki_u64 user_data; /* data to be passed back at completion time */ + union { + __vki_u16 buf_index; /* index into fixed buffers, if used */ + __vki_u64 __pad2[3]; + }; +}; + +/* + * sqe->flags + */ +#define VKI_IOSQE_FIXED_FILE (1U << 0) /* use fixed fileset */ +#define VKI_IOSQE_IO_DRAIN (1U << 1) /* issue after inflight IO */ +#define VKI_IOSQE_IO_LINK (1U << 2) /* links next sqe */ + +/* + * io_uring_setup() flags + */ +#define VKI_IORING_SETUP_IOPOLL (1U << 0) /* io_context is polled */ +#define VKI_IORING_SETUP_SQPOLL (1U << 1) /* SQ poll thread */ +#define VKI_IORING_SETUP_SQ_AFF (1U << 2) /* sq_thread_cpu is valid */ + +#define VKI_IORING_OP_NOP 0 +#define VKI_IORING_OP_READV 1 +#define VKI_IORING_OP_WRITEV 2 +#define VKI_IORING_OP_FSYNC 3 +#define VKI_IORING_OP_READ_FIXED 4 +#define VKI_IORING_OP_WRITE_FIXED 5 +#define VKI_IORING_OP_POLL_ADD 6 +#define VKI_IORING_OP_POLL_REMOVE 7 +#define VKI_IORING_OP_SYNC_FILE_RANGE 8 +#define VKI_IORING_OP_SENDMSG 9 +#define VKI_IORING_OP_RECVMSG 10 + +/* + * sqe->fsync_flags + */ +#define VKI_IORING_FSYNC_DATASYNC (1U << 0) + +/* + * IO completion data structure (Completion Queue Entry) + */ +struct vki_io_uring_cqe { + __vki_u64 user_data; /* sqe->data submission passed back */ + __vki_s32 res; /* result code for this event */ + __vki_u32 flags; +}; + +/* + * Magic offsets for the application to mmap the data it needs + */ +#define VKI_IORING_OFF_SQ_RING 0ULL +#define VKI_IORING_OFF_CQ_RING 0x8000000ULL +#define VKI_IORING_OFF_SQES 0x10000000ULL + +/* + * Filled with the offset for mmap(2) + */ +struct vki_io_sqring_offsets { + __vki_u32 head; + __vki_u32 tail; + __vki_u32 ring_mask; + __vki_u32 ring_entries; + __vki_u32 flags; + __vki_u32 dropped; + __vki_u32 array; + __vki_u32 resv1; + __vki_u64 resv2; +}; + +/* + * sq_ring->flags + */ +#define VKI_IORING_SQ_NEED_WAKEUP (1U << 0) /* needs io_uring_enter wakeup */ + +struct vki_io_cqring_offsets { + __vki_u32 head; + __vki_u32 tail; + __vki_u32 ring_mask; + __vki_u32 ring_entries; + __vki_u32 overflow; + __vki_u32 cqes; + __vki_u64 resv[2]; +}; + +/* + * io_uring_enter(2) flags + */ +#define VKI_IORING_ENTER_GETEVENTS (1U << 0) +#define VKI_IORING_ENTER_SQ_WAKEUP (1U << 1) + +/* + * Passed in for io_uring_setup(2). Copied back with updated info on success + */ +struct vki_io_uring_params { + __vki_u32 sq_entries; + __vki_u32 cq_entries; + __vki_u32 flags; + __vki_u32 sq_thread_cpu; + __vki_u32 sq_thread_idle; + __vki_u32 resv[5]; + struct vki_io_sqring_offsets sq_off; + struct vki_io_cqring_offsets cq_off; +}; + +/* + * io_uring_register(2) opcodes and arguments + */ +#define VKI_IORING_REGISTER_BUFFERS 0 +#define VKI_IORING_UNREGISTER_BUFFERS 1 +#define VKI_IORING_REGISTER_FILES 2 +#define VKI_IORING_UNREGISTER_FILES 3 +#define VKI_IORING_REGISTER_EVENTFD 4 +#define VKI_IORING_UNREGISTER_EVENTFD 5 + +#endif |
|
From: Bart V. A. <bva...@so...> - 2019-07-02 02:27:58
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=a9fc7bceeb0b090d1010312fe8da10f359b5097e commit a9fc7bceeb0b090d1010312fe8da10f359b5097e Author: Bart Van Assche <bva...@ac...> Date: Mon Jul 1 15:01:59 2019 -0700 Update Linux x86 system call number definitions Introduce new header files for the system call numbers that are shared across all Linux architectures and also for the system call numbers that are shared across all 32-bit architectures. Diff: --- include/pub_tool_vkiscnums_asm.h | 13 ++++++++++ include/vki/vki-scnums-32bit-linux.h | 49 +++++++++++++++++++++++++++++++++++ include/vki/vki-scnums-amd64-linux.h | 4 ++- include/vki/vki-scnums-shared-linux.h | 42 ++++++++++++++++++++++++++++++ include/vki/vki-scnums-x86-linux.h | 14 +++++++++- 5 files changed, 120 insertions(+), 2 deletions(-) diff --git a/include/pub_tool_vkiscnums_asm.h b/include/pub_tool_vkiscnums_asm.h index 484dded..af1552f 100644 --- a/include/pub_tool_vkiscnums_asm.h +++ b/include/pub_tool_vkiscnums_asm.h @@ -32,30 +32,43 @@ #define __PUB_TOOL_VKISCNUMS_ASM_H #if defined(VGP_x86_linux) +# include "vki/vki-scnums-shared-linux.h" +# include "vki/vki-scnums-32bit-linux.h" # include "vki/vki-scnums-x86-linux.h" #elif defined(VGP_amd64_linux) +# include "vki/vki-scnums-shared-linux.h" # include "vki/vki-scnums-amd64-linux.h" #elif defined(VGP_ppc32_linux) +# include "vki/vki-scnums-shared-linux.h" +# include "vki/vki-scnums-32bit-linux.h" # include "vki/vki-scnums-ppc32-linux.h" #elif defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux) +# include "vki/vki-scnums-shared-linux.h" # include "vki/vki-scnums-ppc64-linux.h" #elif defined(VGP_s390x_linux) +# include "vki/vki-scnums-shared-linux.h" # include "vki/vki-scnums-s390x-linux.h" #elif defined(VGP_arm_linux) +# include "vki/vki-scnums-shared-linux.h" +# include "vki/vki-scnums-32bit-linux.h" # include "vki/vki-scnums-arm-linux.h" #elif defined(VGP_arm64_linux) +# include "vki/vki-scnums-shared-linux.h" # include "vki/vki-scnums-arm64-linux.h" #elif defined(VGP_mips32_linux) +# include "vki/vki-scnums-shared-linux.h" +# include "vki/vki-scnums-32bit-linux.h" # include "vki/vki-scnums-mips32-linux.h" #elif defined(VGP_mips64_linux) +# include "vki/vki-scnums-shared-linux.h" # include "vki/vki-scnums-mips64-linux.h" #elif defined(VGP_x86_darwin) || defined(VGP_amd64_darwin) diff --git a/include/vki/vki-scnums-32bit-linux.h b/include/vki/vki-scnums-32bit-linux.h new file mode 100644 index 0000000..f276dda --- /dev/null +++ b/include/vki/vki-scnums-32bit-linux.h @@ -0,0 +1,49 @@ +/* + This file is part of Valgrind, a dynamic binary instrumentation framework. + + Copyright (C) 2019 Bart Van Assche <bva...@ac...> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + The GNU General Public License is contained in the file COPYING. +*/ + +#ifndef __VKI_SCNUMS_32BIT_LINUX_H +#define __VKI_SCNUMS_32BIT_LINUX_H + +// Derived from the __BITS_PER_LONG == 32 sections in +// linux-5.2/include/uapi/asm-generic/unistd.h + +#define __NR_clock_gettime64 403 +#define __NR_clock_settime64 404 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres_time64 406 +#define __NR_clock_nanosleep_time64 407 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime64 409 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime64 411 +#define __NR_utimensat_time64 412 +#define __NR_pselect6_time64 413 +#define __NR_ppoll_time64 414 +#define __NR_io_pgetevents_time64 416 +#define __NR_recvmmsg_time64 417 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_timedreceive_time64 419 +#define __NR_semtimedop_time64 420 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_futex_time64 422 +#define __NR_sched_rr_get_interval_time64 423 + +#endif diff --git a/include/vki/vki-scnums-amd64-linux.h b/include/vki/vki-scnums-amd64-linux.h index ee6cccb..6513473 100644 --- a/include/vki/vki-scnums-amd64-linux.h +++ b/include/vki/vki-scnums-amd64-linux.h @@ -30,7 +30,7 @@ #ifndef __VKI_SCNUMS_AMD64_LINUX_H #define __VKI_SCNUMS_AMD64_LINUX_H -// Derived from linux-2.6/arch/x86/entry/syscalls/syscall_64.tbl +// Derived from linux-5.2/arch/x86/entry/syscalls/syscall_64.tbl #define __NR_read 0 #define __NR_write 1 @@ -412,6 +412,8 @@ #define __NR_pkey_alloc 330 #define __NR_pkey_free 331 #define __NR_statx 332 +#define __NR_io_pgetevents 333 +#define __NR_rseq 334 #endif /* __VKI_SCNUMS_AMD64_LINUX_H */ diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h new file mode 100644 index 0000000..6221d5a --- /dev/null +++ b/include/vki/vki-scnums-shared-linux.h @@ -0,0 +1,42 @@ + +/* System call numbers for Linux that are shared across all architectures. */ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2019 Bart Van Assche <bva...@ac...> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + The GNU General Public License is contained in the file COPYING. +*/ + +#ifndef __VKI_SCNUMS_SHARED_LINUX_H +#define __VKI_SCNUMS_SHARED_LINUX_H + +// Derived from linux-5.2/include/uapi/asm-generic/unistd.h + +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 + +#endif diff --git a/include/vki/vki-scnums-x86-linux.h b/include/vki/vki-scnums-x86-linux.h index 37683aa..5019321 100644 --- a/include/vki/vki-scnums-x86-linux.h +++ b/include/vki/vki-scnums-x86-linux.h @@ -30,7 +30,7 @@ #ifndef __VKI_SCNUMS_X86_LINUX_H #define __VKI_SCNUMS_X86_LINUX_H -// Derived from linux-2.6/arch/x86/entry/syscalls/syscall_32.tbl +// Derived from linux-5.2/arch/x86/entry/syscalls/syscall_32.tbl #define __NR_restart_syscall 0 #define __NR_exit 1 @@ -417,6 +417,18 @@ #define __NR_pkey_free 382 #define __NR_statx 383 #define __NR_arch_prctl 384 +#define __NR_io_pgetevents 385 +#define __NR_rseq 386 +#define __NR_semget 393 +#define __NR_semctl 394 +#define __NR_shmget 395 +#define __NR_shmctl 396 +#define __NR_shmat 397 +#define __NR_shmdt 398 +#define __NR_msgget 399 +#define __NR_msgsnd 400 +#define __NR_msgrcv 401 +#define __NR_msgctl 402 #endif /* __VKI_SCNUMS_X86_LINUX_H */ |