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
(1) |
2
|
3
(2) |
4
(2) |
5
|
6
|
|
7
(1) |
8
|
9
|
10
(1) |
11
(1) |
12
(2) |
13
|
|
14
|
15
|
16
(1) |
17
(1) |
18
|
19
|
20
(13) |
|
21
(3) |
22
(2) |
23
(6) |
24
(2) |
25
(5) |
26
(2) |
27
(2) |
|
28
(6) |
|
|
|
|
|
|
|
From: Mark W. <ma...@so...> - 2021-02-21 22:21:45
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=ddf692c5cc38239856effa4fc4144ff4c216cd94 commit ddf692c5cc38239856effa4fc4144ff4c216cd94 Author: Mark Wielaard <ma...@kl...> Date: Sun Feb 21 22:45:51 2021 +0100 Fix typo in DWARF 5 line table readers This typo meant the directory entry was most often zero, which happened to be sometimes correct anyway (since zero is the compdir). So for simple testcases it looked correct. But it would be wrong for compilation units not in the current compdir. Like files compiled with a relative of absolute path (and then combined into the same compilation unit with LTO). The same typo was in both readdwarf.c (read_dwarf2_lineblock) and readdwarf3.c (read_filename_table). read_dwarf2_lineblock also had an extra "dwarf" string in the --debug-dump=line output. https://bugzilla.redhat.com/show_bug.cgi?id=1927153 Diff: --- coregrind/m_debuginfo/readdwarf.c | 4 ++-- coregrind/m_debuginfo/readdwarf3.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c index 88d5d99f17..3996623edb 100644 --- a/coregrind/m_debuginfo/readdwarf.c +++ b/coregrind/m_debuginfo/readdwarf.c @@ -683,7 +683,7 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, directories_count = step_leb128U(&data); /* Read the contents of the Directory table. */ if (di->ddump_line) - VG_(printf)(" dwarf The Directory Table%s\n", + VG_(printf)(" The Directory Table%s\n", directories_count == 0 ? " is empty." : ":" ); for (n = 0; n < directories_count; n++) { @@ -796,7 +796,7 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di, if (f == p_ndx) name = get_line_str (di, ui, &data, form, debugstr_img, debuglinestr_img); - else if (n == d_ndx) + else if (f == d_ndx) diridx = get_line_ndx (di, &data, form); else data = skip_line_form (di, ui, data, form); diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c index 82bc8f241f..60fc402447 100644 --- a/coregrind/m_debuginfo/readdwarf3.c +++ b/coregrind/m_debuginfo/readdwarf3.c @@ -2323,7 +2323,7 @@ void read_filename_table( /*MOD*/XArray* /* of UInt* */ fndn_ix_Table, if (f == p_ndx) str = get_line_str (cc->di, cc->is_dw64, &c, form, debugstr_img, debuglinestr_img); - else if (n == d_ndx) + else if (f == d_ndx) dir_xa_ix = get_line_ndx (cc->di, &c, form); else skip_line_form (cc->di, cc->is_dw64, &c, form); |
|
From: Paul F. <pa...@so...> - 2021-02-21 15:45:11
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=323690a7707684fa85c8f460aff93c9d0dc2c4cd commit 323690a7707684fa85c8f460aff93c9d0dc2c4cd Author: Paul Floyd <pj...@wa...> Date: Sun Feb 21 16:43:42 2021 +0100 Add enomem and swapcontext tests to .gitignore Diff: --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index eec6169891..3afc37f4cd 100644 --- a/.gitignore +++ b/.gitignore @@ -416,6 +416,7 @@ /drd/tests/std_string /drd/tests/std_thread /drd/tests/std_thread2 +/drd/tests/swapcontext /drd/tests/tc01_simple_race /drd/tests/tc02_simple_tls /drd/tests/tc03_re_excl @@ -1063,6 +1064,7 @@ /memcheck/tests/linux/sys-openat /memcheck/tests/linux/sys-execveat /memcheck/tests/linux/check_execveat +/memcheck/tests/linux/enomem # /memcheck/tests/mips32/ /memcheck/tests/mips32/*.stderr.diff |
|
From: Mark W. <ma...@so...> - 2021-02-21 14:21:46
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=610973c79dbec9ed76a74ba884150183b2a26786 commit 610973c79dbec9ed76a74ba884150183b2a26786 Author: Mark Wielaard <ma...@kl...> Date: Sun Feb 21 15:18:54 2021 +0100 swapcontext.vgtest fails with glibc-debuginfo installed With debuginfo installed the backtace contains the swapcontext.S source file. Filter that out, like the clone.S source file is in drd/tests/filter_stderr. Diff: --- drd/tests/filter_stderr | 1 + 1 file changed, 1 insertion(+) diff --git a/drd/tests/filter_stderr b/drd/tests/filter_stderr index 59907f6270..f5c56a3541 100755 --- a/drd/tests/filter_stderr +++ b/drd/tests/filter_stderr @@ -29,6 +29,7 @@ sed \ -e "s/(tc20_verifywrap.c:261)/(tc20_verifywrap.c:262)/" \ -e "/^Copyright (C) 2006-20.., and GNU GPL'd, by Bart Van Assche.$/d" \ -e "s/\([A-Za-z_]*\) (clone.S:[0-9]*)/\1 (in \/...libc...)/" \ +-e "s/\([A-Za-z_]*\) (swapcontext.S:[0-9]*)/\1 (in \/...libc...)/" \ -e "s/[A-Za-z_]* (pthread_create.c:[0-9]*)/(within libpthread-?.?.so)/" \ -e "s/[A-Za-z_]* (in [^ ]*libpthread-[0-9.]*\.so)/(within libpthread-?.?.so)/" \ -e "s:(within /lib[0-9]*/ld-[0-9.]*\.so):(within ld-?.?.so):" \ |
|
From: Bart V. A. <bva...@so...> - 2021-02-20 22:57:25
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=719d23b7a9c3b02411dee7d5d4d3744938bb768c commit 719d23b7a9c3b02411dee7d5d4d3744938bb768c Author: Bart Van Assche <bva...@ac...> Date: Sat Feb 20 14:48:58 2021 -0800 drd/tests/swapcontext: Improve portability Diff: --- drd/tests/swapcontext.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/drd/tests/swapcontext.c b/drd/tests/swapcontext.c index f3944d1ba6..e692559b06 100644 --- a/drd/tests/swapcontext.c +++ b/drd/tests/swapcontext.c @@ -16,7 +16,6 @@ typedef struct thread_local { ucontext_t uc[3]; size_t nrsw; - int tfd; } thread_local_t; static void f(void *data, int n) @@ -26,15 +25,11 @@ static void f(void *data, int n) thread_local_t *tlocal = data; while (1) { - memset(&pfd, 0, sizeof(pfd)); - pfd.fd = tlocal->tfd; - pfd.events = POLLIN; - - if (poll(&pfd, 1, 0) == 1) { - if (++tlocal->nrsw == NR_SWITCHES) - return; - swapcontext(&tlocal->uc[n], &tlocal->uc[3 - n]); - } + struct timespec delay = { .tv_nsec = 1000 }; + nanosleep(&delay, NULL); + if (++tlocal->nrsw == NR_SWITCHES) + return; + swapcontext(&tlocal->uc[n], &tlocal->uc[3 - n]); } } @@ -62,19 +57,6 @@ void *worker(void *data) __valgrind_register_current_stack(); - tlocal->tfd = timerfd_create(CLOCK_REALTIME, 0); - if (tlocal->tfd < 0) - abort(); - - it.it_interval.tv_sec = 0; - it.it_interval.tv_nsec = 1000; - - it.it_value.tv_sec = time(NULL); - it.it_value.tv_nsec = 1000; - - if (timerfd_settime(tlocal->tfd, TFD_TIMER_ABSTIME, &it, NULL) < 0) - abort(); - if (getcontext(&(tlocal->uc[1])) < 0) abort(); if (getcontext(&(tlocal->uc[2])) < 0) |
|
From: Paul F. <pj...@wa...> - 2021-02-20 20:45:17
|
On 2/20/21 9:17 PM, Mark Wielaard wrote: > > And I think swapcontext itself isn't portable either. > So maybe the testcase should be GNU/Linux only? swapcontext should be OK, at least there is a manpage for it on all 3 OSes. I expect that the timerfd part will be difficult to port. A+ Paul |
|
From: Mark W. <ma...@so...> - 2021-02-20 20:30:54
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=dec30506534c0c1bb0e77e62275e697b041e3c3a commit dec30506534c0c1bb0e77e62275e697b041e3c3a Author: Allison Karlitskaya <all...@re...> Date: Tue Oct 13 13:17:11 2020 +0200 Linux: Add wrapper for fcntl(F_{GET,ADD}_SEALS) Add also a testcase to memcheck/tests/linux, enabled according to a new check for memfd_create() in configure.ac. https://bugs.kde.org/show_bug.cgi?id=361770 Diff: --- .gitignore | 1 + NEWS | 1 + configure.ac | 3 ++ coregrind/m_syswrap/syswrap-linux.c | 4 ++ include/vki/vki-linux.h | 3 ++ memcheck/tests/linux/Makefile.am | 5 +++ memcheck/tests/linux/memfd.c | 75 +++++++++++++++++++++++++++++++++++ memcheck/tests/linux/memfd.stderr.exp | 6 +++ memcheck/tests/linux/memfd.vgtest | 3 ++ 9 files changed, 101 insertions(+) diff --git a/.gitignore b/.gitignore index dff20848e6..eec6169891 100644 --- a/.gitignore +++ b/.gitignore @@ -1047,6 +1047,7 @@ /memcheck/tests/linux/lsframe2 /memcheck/tests/linux/Makefile /memcheck/tests/linux/Makefile.in +/memcheck/tests/linux/memfd /memcheck/tests/linux/rfcomm /memcheck/tests/linux/sigqueue /memcheck/tests/linux/stack_changes diff --git a/NEWS b/NEWS index cdd103b01e..55bf58ae8a 100644 --- a/NEWS +++ b/NEWS @@ -78,6 +78,7 @@ where XXXXXX is the bug number as listed below. 140939 --track-fds reports leakage of stdout/in/err and doesn't respect -q 217695 malloc/calloc/realloc/memalign failure doesn't set errno to ENOMEM 345077 linux syscall execveat support (linux 3.19) +361770 Missing F_ADD_SEALS 369029 handle linux syscalls sched_getattr and sched_setattr 384729 __libc_freeres inhibits cross-platform valgrind 391853 Makefile.all.am:L247 and @SOLARIS_UNDEF_LARGESOURCE@ being empty diff --git a/configure.ac b/configure.ac index 41ae942429..4648450fe3 100755 --- a/configure.ac +++ b/configure.ac @@ -4358,6 +4358,7 @@ AC_CHECK_FUNCS([ \ klogctl \ mallinfo \ memchr \ + memfd_create \ memset \ mkdir \ mremap \ @@ -4409,6 +4410,8 @@ 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]) +AM_CONDITIONAL([HAVE_MEMFD_CREATE], + [test x$ac_cv_func_memfd_create = xyes]) if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \ -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \ diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index fcc534454a..3d6939d147 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -6784,6 +6784,7 @@ PRE(sys_fcntl) case VKI_F_GETSIG: case VKI_F_GETLEASE: case VKI_F_GETPIPE_SZ: + case VKI_F_GET_SEALS: PRINT("sys_fcntl ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2); PRE_REG_READ2(long, "fcntl", unsigned int, fd, unsigned int, cmd); break; @@ -6798,6 +6799,7 @@ PRE(sys_fcntl) case VKI_F_SETOWN: case VKI_F_SETSIG: case VKI_F_SETPIPE_SZ: + case VKI_F_ADD_SEALS: PRINT("sys_fcntl[ARG3=='arg'] ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2, ARG3); PRE_REG_READ3(long, "fcntl", @@ -6930,6 +6932,7 @@ PRE(sys_fcntl64) case VKI_F_GETSIG: case VKI_F_SETSIG: case VKI_F_GETLEASE: + case VKI_F_GET_SEALS: PRINT("sys_fcntl64 ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2); PRE_REG_READ2(long, "fcntl64", unsigned int, fd, unsigned int, cmd); break; @@ -6941,6 +6944,7 @@ PRE(sys_fcntl64) case VKI_F_SETFL: case VKI_F_SETLEASE: case VKI_F_NOTIFY: + case VKI_F_ADD_SEALS: PRINT("sys_fcntl64[ARG3=='arg'] ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2, ARG3); PRE_REG_READ3(long, "fcntl64", diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index 3b9dc37796..426d9db92f 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -1504,6 +1504,9 @@ struct vki_dirent64 { #define VKI_F_SETPIPE_SZ (VKI_F_LINUX_SPECIFIC_BASE + 7) #define VKI_F_GETPIPE_SZ (VKI_F_LINUX_SPECIFIC_BASE + 8) +#define VKI_F_ADD_SEALS (VKI_F_LINUX_SPECIFIC_BASE + 9) +#define VKI_F_GET_SEALS (VKI_F_LINUX_SPECIFIC_BASE + 10) + struct vki_flock { short l_type; short l_whence; diff --git a/memcheck/tests/linux/Makefile.am b/memcheck/tests/linux/Makefile.am index 1c53ffbaf8..7e796aa7fa 100644 --- a/memcheck/tests/linux/Makefile.am +++ b/memcheck/tests/linux/Makefile.am @@ -13,6 +13,7 @@ EXTRA_DIST = \ ioctl-tiocsig.vgtest ioctl-tiocsig.stderr.exp \ lsframe1.vgtest lsframe1.stdout.exp lsframe1.stderr.exp \ lsframe2.vgtest lsframe2.stdout.exp lsframe2.stderr.exp \ + memfd.vgtest memfd.stderr.exp \ rfcomm.vgtest rfcomm.stderr.exp \ sigqueue.vgtest sigqueue.stderr.exp \ stack_changes.stderr.exp stack_changes.stdout.exp \ @@ -58,6 +59,10 @@ if HAVE_AT_FDCWD check_PROGRAMS += sys-openat endif +if HAVE_MEMFD_CREATE +check_PROGRAMS += memfd +endif + if HAVE_COPY_FILE_RANGE check_PROGRAMS += sys-copy_file_range endif diff --git a/memcheck/tests/linux/memfd.c b/memcheck/tests/linux/memfd.c new file mode 100644 index 0000000000..f37e4b5c2f --- /dev/null +++ b/memcheck/tests/linux/memfd.c @@ -0,0 +1,75 @@ +#define _GNU_SOURCE + +#include <assert.h> +#include <errno.h> +#include <fcntl.h> +#include <sys/mman.h> +#include <unistd.h> + +#include "../../memcheck.h" + +static void +assert_expected (int fd, int expected_seals) +{ + int current_seals = fcntl (fd, F_GET_SEALS); + assert (current_seals == expected_seals); +} + +static void +add_seal (int fd, int *expected_seals, int new_seal) +{ + int r = fcntl (fd, F_ADD_SEALS, new_seal); + assert (r == 0); + + *expected_seals |= new_seal; + + // Make sure we get the result we expected. + assert_expected (fd, *expected_seals); +} + +static void +add_seal_expect_fail (int fd, int new_seal, int expected_errno) +{ + int r = fcntl (fd, F_ADD_SEALS, new_seal); + assert (r == -1 && errno == expected_errno); +} + +int +main (void) +{ + int expected_seals = 0; + int fd; + + // Try with an fd that doesn't support sealing. + fd = memfd_create ("xyz", 0); + if (fd < 0) + { + // Not supported, nothing to test... + return 1; + } + + assert_expected (fd, F_SEAL_SEAL); + add_seal_expect_fail (fd, F_SEAL_WRITE, EPERM); + assert_expected (fd, F_SEAL_SEAL); // ...should still be unset after failed attempt + close (fd); + + // Now, try the successful case. + fd = memfd_create ("xyz", MFD_ALLOW_SEALING); + add_seal (fd, &expected_seals, F_SEAL_SHRINK); + add_seal (fd, &expected_seals, F_SEAL_GROW); + + // Now prevent more sealing. + add_seal (fd, &expected_seals, F_SEAL_SEAL); + + // And make sure that it indeed fails. + add_seal_expect_fail (fd, F_SEAL_WRITE, EPERM); + assert_expected (fd, expected_seals); + close (fd); + + // Test the only memory failure possible: passing an undefined argument to F_ADD_SEALS + int undefined_seal = 0; + VALGRIND_MAKE_MEM_UNDEFINED(&undefined_seal, sizeof undefined_seal); + fcntl (-1, F_ADD_SEALS, undefined_seal); + + return 0; +} diff --git a/memcheck/tests/linux/memfd.stderr.exp b/memcheck/tests/linux/memfd.stderr.exp new file mode 100644 index 0000000000..13009d8ae4 --- /dev/null +++ b/memcheck/tests/linux/memfd.stderr.exp @@ -0,0 +1,6 @@ +Syscall param fcntl(arg) contains uninitialised byte(s) + ... + by 0x........: main (memfd.c:72) + Uninitialised value was created by a client request + at 0x........: main (memfd.c:71) + diff --git a/memcheck/tests/linux/memfd.vgtest b/memcheck/tests/linux/memfd.vgtest new file mode 100644 index 0000000000..4096401f73 --- /dev/null +++ b/memcheck/tests/linux/memfd.vgtest @@ -0,0 +1,3 @@ +prereq: test -e memfd +vgopts: -q --track-origins=yes +prog: memfd |
|
From: Mark W. <ma...@kl...> - 2021-02-20 20:17:49
|
Hi Paul, On Sat, 2021-02-20 at 20:47 +0100, Paul Floyd wrote: > > On 20 Feb 2021, at 20:13, Mark Wielaard <ma...@kl...> wrote: > > The buildbot found two setups where the make distcheck test failed > > with > > the last commit: > > This fails to compile on Solaris and FreeBSD and will almost > certainly not compile on macOS. This is because > > +#include <sys/timerfd.h> > > does not exist on these platforms. This either needs a configure > check or a more portable timer API. And I think swapcontext itself isn't portable either. So maybe the testcase should be GNU/Linux only? Cheers, Mark |
|
From: Paul F. <pj...@wa...> - 2021-02-20 19:47:59
|
> On 20 Feb 2021, at 20:13, Mark Wielaard <ma...@kl...> wrote: > > Hi, > > The buildbot found two setups where the make distcheck test failed with > the last commit: > > Hi This fails to compile on Solaris and FreeBSD and will almost certainly not compile on macOS. This is because +#include <sys/timerfd.h> does not exist on these platforms. This either needs a configure check or a more portable timer API. A+ Paul |
|
From: Mark W. <ma...@kl...> - 2021-02-20 19:29:46
|
Hi, The buildbot found two setups where the make distcheck test failed with the last commit: On Sat, 2021-02-20 at 17:25 +0000, bui...@bu... wrote: > The Buildbot has detected a failed build on builder whole buildset > while building valgrind. > Full details are available at: > https://builder.wildebeest.org/buildbot/#builders/37/builds/143 > > Buildbot URL: https://builder.wildebeest.org/buildbot/ > > Worker for this Build: fedora-x86_64 > > Build Reason: <unknown> > Blamelist: Bart Van Assche <bva...@ac...> > > BUILD FAILED: failed test (failure) > > Sincerely, > -The BuildbotThe Buildbot has detected a failed build on builder > whole buildset while building valgrind. > Full details are available at: > https://builder.wildebeest.org/buildbot/#builders/38/builds/122 > > Buildbot URL: https://builder.wildebeest.org/buildbot/ > > Worker for this Build: fedora-s390x > > Build Reason: <unknown> > Blamelist: Bart Van Assche <bva...@ac...> > > BUILD FAILED: failed test (failure) Should hopefully be fixed by: commit 7aac53c6d0ca7e11d4037ff474dcd1c08862fd30 Author: Mark Wielaard <ma...@kl...> Date: Sat Feb 20 20:05:31 2021 +0100 Fix valgrind.h include in drd/tests/swapcontext.c In tree tests should include "valgrind.h" not <valgrind/valgrind.h> the later might pick up the system installed valgrind.h and doesn't work when srcdir != builddir. diff --git a/drd/tests/swapcontext.c b/drd/tests/swapcontext.c index e73a612dc..f3944d1ba 100644 --- a/drd/tests/swapcontext.c +++ b/drd/tests/swapcontext.c @@ -11,7 +11,7 @@ #include <sys/timerfd.h> #include <ucontext.h> #include <unistd.h> -#include <valgrind/valgrind.h> +#include "valgrind.h" typedef struct thread_local { ucontext_t uc[3]; If not, I am sure the buildbot will let us know soon :) Cheers, Mrk |
|
From: Mark W. <ma...@so...> - 2021-02-20 19:09:33
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=7aac53c6d0ca7e11d4037ff474dcd1c08862fd30 commit 7aac53c6d0ca7e11d4037ff474dcd1c08862fd30 Author: Mark Wielaard <ma...@kl...> Date: Sat Feb 20 20:05:31 2021 +0100 Fix valgrind.h include in drd/tests/swapcontext.c In tree tests should include "valgrind.h" not <valgrind/valgrind.h> the later might pick up the system installed valgrind.h and doesn't work when srcdir != builddir. Diff: --- drd/tests/swapcontext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drd/tests/swapcontext.c b/drd/tests/swapcontext.c index e73a612dc3..f3944d1ba6 100644 --- a/drd/tests/swapcontext.c +++ b/drd/tests/swapcontext.c @@ -11,7 +11,7 @@ #include <sys/timerfd.h> #include <ucontext.h> #include <unistd.h> -#include <valgrind/valgrind.h> +#include "valgrind.h" typedef struct thread_local { ucontext_t uc[3]; |
|
From: Bart V. A. <bva...@so...> - 2021-02-20 16:46:01
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=0062f2b519ea48b82164ae423fac58a59ee00f1a commit 0062f2b519ea48b82164ae423fac58a59ee00f1a Author: Bart Van Assche <bva...@ac...> Date: Sun Feb 14 18:42:04 2021 -0800 drd/tests/swapcontext: Add a swapcontext() test Diff: --- drd/tests/Makefile.am | 5 ++ drd/tests/swapcontext.c | 124 +++++++++++++++++++++++++++++++++++++++ drd/tests/swapcontext.stderr.exp | 7 +++ drd/tests/swapcontext.vgtest | 4 ++ 4 files changed, 140 insertions(+) diff --git a/drd/tests/Makefile.am b/drd/tests/Makefile.am index 5df76150e9..a489c8b46d 100644 --- a/drd/tests/Makefile.am +++ b/drd/tests/Makefile.am @@ -267,6 +267,8 @@ EXTRA_DIST = \ sem_open_traced.vgtest \ sem_wait.stderr.exp \ sem_wait.vgtest \ + swapcontext.stderr.exp \ + swapcontext.vgtest \ sigalrm.stderr.exp \ sigalrm.vgtest \ sigaltstack.stderr.exp \ @@ -406,6 +408,7 @@ check_PROGRAMS = \ sem_as_mutex \ sem_open \ sigalrm \ + swapcontext \ threaded-fork \ trylock \ unit_bitmap \ @@ -585,3 +588,5 @@ std_thread2_LDFLAGS = -Wl,--no-as-needed endif sem_wait_SOURCES = sem_wait.cpp + +swapcontext_SOURCES = swapcontext.c diff --git a/drd/tests/swapcontext.c b/drd/tests/swapcontext.c new file mode 100644 index 0000000000..e73a612dc3 --- /dev/null +++ b/drd/tests/swapcontext.c @@ -0,0 +1,124 @@ +/* See also https://bugs.kde.org/show_bug.cgi?id=432381. */ + +#define _GNU_SOURCE + +#include <poll.h> +#include <pthread.h> +#include <signal.h> +#include <stdlib.h> +#include <string.h> +#include <sys/time.h> +#include <sys/timerfd.h> +#include <ucontext.h> +#include <unistd.h> +#include <valgrind/valgrind.h> + +typedef struct thread_local { + ucontext_t uc[3]; + size_t nrsw; + int tfd; +} thread_local_t; + +static void f(void *data, int n) +{ + enum { NR_SWITCHES = 200000 }; + struct pollfd pfd; + thread_local_t *tlocal = data; + + while (1) { + memset(&pfd, 0, sizeof(pfd)); + pfd.fd = tlocal->tfd; + pfd.events = POLLIN; + + if (poll(&pfd, 1, 0) == 1) { + if (++tlocal->nrsw == NR_SWITCHES) + return; + swapcontext(&tlocal->uc[n], &tlocal->uc[3 - n]); + } + } +} + +void __valgrind_register_current_stack(void) +{ + pthread_attr_t attr; + size_t stacksize; + void *stack; + + if (pthread_getattr_np(pthread_self(), &attr) != 0) + abort(); + + if (pthread_attr_getstack(&attr, &stack, &stacksize) != 0) + abort(); + + VALGRIND_STACK_REGISTER(stack, stack + stacksize); +} + +#define STACKSIZE 8192 + +void *worker(void *data) +{ + thread_local_t *tlocal = data; + struct itimerspec it; + + __valgrind_register_current_stack(); + + tlocal->tfd = timerfd_create(CLOCK_REALTIME, 0); + if (tlocal->tfd < 0) + abort(); + + it.it_interval.tv_sec = 0; + it.it_interval.tv_nsec = 1000; + + it.it_value.tv_sec = time(NULL); + it.it_value.tv_nsec = 1000; + + if (timerfd_settime(tlocal->tfd, TFD_TIMER_ABSTIME, &it, NULL) < 0) + abort(); + + if (getcontext(&(tlocal->uc[1])) < 0) + abort(); + if (getcontext(&(tlocal->uc[2])) < 0) + abort(); + + tlocal->uc[1].uc_link = &tlocal->uc[0]; + tlocal->uc[1].uc_stack.ss_sp = malloc(STACKSIZE); + tlocal->uc[1].uc_stack.ss_size = STACKSIZE; + makecontext(&tlocal->uc[1], (void (*)(void))f, 2, tlocal, 1); + VALGRIND_STACK_REGISTER(tlocal->uc[1].uc_stack.ss_sp, + tlocal->uc[1].uc_stack.ss_sp + + tlocal->uc[1].uc_stack.ss_size); + + tlocal->uc[2].uc_link = &tlocal->uc[0]; + tlocal->uc[2].uc_stack.ss_sp = malloc(STACKSIZE); + tlocal->uc[2].uc_stack.ss_size = STACKSIZE; + makecontext(&tlocal->uc[2], (void (*)(void))f, 2, tlocal, 2); + VALGRIND_STACK_REGISTER(tlocal->uc[2].uc_stack.ss_sp, + tlocal->uc[2].uc_stack.ss_sp + + tlocal->uc[2].uc_stack.ss_size); + + swapcontext(&tlocal->uc[0], &tlocal->uc[1]); + return NULL; +} + +int main(int argc, char *argv[]) +{ + enum { NR = 32 }; + thread_local_t tlocal[NR]; + pthread_t thread[NR]; + int i; + + memset(tlocal, 0, sizeof(tlocal)); + + for (i = 0; i < NR; i++) + pthread_create(&thread[i], NULL, worker, &tlocal[i]); + + // Wait until the threads have been created. + sleep(1); + for (i = 0; i < NR; i++) + pthread_kill(thread[i], SIGINT); + + for (i = 0; i < NR; i++) + pthread_join(thread[i], NULL); + + return 0; +} diff --git a/drd/tests/swapcontext.stderr.exp b/drd/tests/swapcontext.stderr.exp new file mode 100644 index 0000000000..1ebc73a407 --- /dev/null +++ b/drd/tests/swapcontext.stderr.exp @@ -0,0 +1,7 @@ + + +Process terminating with default action of signal 2 (SIGINT) + at 0x........: swapcontext (in /...libc...) + by 0x........: f (swapcontext.c:?) + +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) diff --git a/drd/tests/swapcontext.vgtest b/drd/tests/swapcontext.vgtest new file mode 100644 index 0000000000..98e3712c40 --- /dev/null +++ b/drd/tests/swapcontext.vgtest @@ -0,0 +1,4 @@ +prereq: test -e swapcontext && ./supported_libpthread +vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no --num-callers=2 +prog: swapcontext +stderr_filter: filter_stderr |
|
From: Bart V. A. <bva...@so...> - 2021-02-20 16:45:46
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=fd5a12afcb126d3be18f78a6f17d49847e202742 commit fd5a12afcb126d3be18f78a6f17d49847e202742 Author: Bart Van Assche <bva...@ac...> Date: Fri Feb 19 20:24:57 2021 -0800 drd: Process stack registration client requests Reset stack information if the client registers a new stack Diff: --- NEWS | 1 + drd/drd_main.c | 8 ++++++++ drd/drd_thread.c | 11 +++++++++++ drd/drd_thread.h | 1 + 4 files changed, 21 insertions(+) diff --git a/NEWS b/NEWS index c910af0f4e..cdd103b01e 100644 --- a/NEWS +++ b/NEWS @@ -120,6 +120,7 @@ where XXXXXX is the bug number as listed below. 431556 Complete arm64 FADDP v8.2 instruction support 432102 Add support for DWARF5 as produced by GCC11 432161 Addition of arm64 v8.2 FADDP, FNEG and FSQRT +432381 drd: Process STACK_REGISTER client requests 432672 vg_regtest: test-specific environment variables not reset between tests 432809 VEX should support REX.W + POPF 432861 PPC modsw and modsd give incorrect results for 1 mod 12 diff --git a/drd/drd_main.c b/drd/drd_main.c index 7873c1f977..2f2279e52d 100644 --- a/drd/drd_main.c +++ b/drd/drd_main.c @@ -629,6 +629,13 @@ static void drd_stop_using_mem_stack_signal(Addr a, SizeT len) True); } +static void drd_register_stack(Addr start, Addr end) +{ + DrdThreadId drd_tid = DRD_(thread_get_running_tid)(); + + DRD_(thread_register_stack)(drd_tid, start, end); +} + static void drd_pre_thread_create(const ThreadId creator, const ThreadId created) { @@ -852,6 +859,7 @@ void drd_pre_clo_init(void) VG_(track_die_mem_munmap) (drd_stop_using_nonstack_mem); VG_(track_die_mem_stack) (drd_stop_using_mem_stack); VG_(track_die_mem_stack_signal) (drd_stop_using_mem_stack_signal); + VG_(track_register_stack) (drd_register_stack); VG_(track_pre_deliver_signal) (drd_pre_deliver_signal); VG_(track_post_deliver_signal) (drd_post_deliver_signal); VG_(track_start_client_code) (drd_start_client_code); diff --git a/drd/drd_thread.c b/drd/drd_thread.c index 548c74843b..32064c3b15 100644 --- a/drd/drd_thread.c +++ b/drd/drd_thread.c @@ -431,6 +431,17 @@ void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee) DRD_(thread_delayed_delete)(drd_joinee); } +void DRD_(thread_register_stack)(DrdThreadId tid, Addr addr1, Addr addr2) +{ + tl_assert(0 <= (int)tid && tid < DRD_N_THREADS + && tid != DRD_INVALID_THREADID); + tl_assert(addr1 < addr2); + DRD_(g_threadinfo)[tid].stack_min = addr2; + DRD_(g_threadinfo)[tid].stack_min_min = addr2; + DRD_(g_threadinfo)[tid].stack_startup = addr2; + DRD_(g_threadinfo)[tid].stack_max = addr2; +} + /** * NPTL hack: NPTL allocates the 'struct pthread' on top of the stack, * and accesses this data structure from multiple threads without locking. diff --git a/drd/drd_thread.h b/drd/drd_thread.h index 063ae35fc9..0f7d783733 100644 --- a/drd/drd_thread.h +++ b/drd/drd_thread.h @@ -153,6 +153,7 @@ void DRD_(thread_delete)(const DrdThreadId tid, Bool detached); void DRD_(thread_finished)(const DrdThreadId tid); void DRD_(drd_thread_atfork_child)(const DrdThreadId tid); void DRD_(thread_pre_cancel)(const DrdThreadId tid); +void DRD_(thread_register_stack)(DrdThreadId tid, Addr addr1, Addr addr2); void DRD_(thread_set_stack_startup)(const DrdThreadId tid, const Addr stack_startup); Addr DRD_(thread_get_stack_min)(const DrdThreadId tid); |
|
From: Bart V. A. <bva...@so...> - 2021-02-20 16:45:29
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=dc29ef72df49d88fa1c0866d362803f920a6e2d5 commit dc29ef72df49d88fa1c0866d362803f920a6e2d5 Author: Bart Van Assche <bva...@ac...> Date: Sun Feb 14 20:08:52 2021 -0800 core: Pass stack change user requests on to tools Since DRD tracks the lowest and highest stack address that has been used, it needs to know about stack registration events. Hence pass on stack registration events to tools. Diff: --- coregrind/m_scheduler/scheduler.c | 1 + coregrind/m_tooliface.c | 2 ++ coregrind/pub_core_tooliface.h | 2 ++ include/pub_tool_tooliface.h | 3 +++ 4 files changed, 8 insertions(+) diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index 77f78ebbc7..dc22dca176 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -2050,6 +2050,7 @@ void do_client_request ( ThreadId tid ) case VG_USERREQ__STACK_REGISTER: { UWord sid = VG_(register_stack)((Addr)arg[1], (Addr)arg[2]); SET_CLREQ_RETVAL( tid, sid ); + VG_TRACK(register_stack, (Addr)arg[1], (Addr)arg[2]); break; } case VG_USERREQ__STACK_DEREGISTER: { diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c index efa991debf..cbafe47c52 100644 --- a/coregrind/m_tooliface.c +++ b/coregrind/m_tooliface.c @@ -438,6 +438,8 @@ DEF0(track_die_mem_stack, Addr, SizeT) DEF0(track_ban_mem_stack, Addr, SizeT) +DEF0(track_register_stack, Addr, Addr) + DEF0(track_pre_mem_read, CorePart, ThreadId, const HChar*, Addr, SizeT) DEF0(track_pre_mem_read_asciiz, CorePart, ThreadId, const HChar*, Addr) DEF0(track_pre_mem_write, CorePart, ThreadId, const HChar*, Addr, SizeT) diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h index 4da8cd29e9..5f75d49972 100644 --- a/coregrind/pub_core_tooliface.h +++ b/coregrind/pub_core_tooliface.h @@ -226,6 +226,8 @@ typedef struct { void (*track_ban_mem_stack)(Addr, SizeT); + void (*track_register_stack)(Addr, Addr); + void (*track_pre_mem_read) (CorePart, ThreadId, const HChar*, Addr, SizeT); void (*track_pre_mem_read_asciiz)(CorePart, ThreadId, const HChar*, Addr); void (*track_pre_mem_write) (CorePart, ThreadId, const HChar*, Addr, SizeT); diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h index c7eef06eb1..62c9969612 100644 --- a/include/pub_tool_tooliface.h +++ b/include/pub_tool_tooliface.h @@ -609,6 +609,9 @@ void VG_(track_die_mem_stack) (void(*f)(Addr a, SizeT len)); /* Used for redzone at end of thread stacks */ void VG_(track_ban_mem_stack) (void(*f)(Addr a, SizeT len)); +/* Used to report VG_USERREQ__STACK_REGISTER client requests */ +void VG_(track_register_stack) (void(*f)(Addr start, Addr end)); + /* These ones occur around syscalls, signal handling, etc */ void VG_(track_pre_mem_read) (void(*f)(CorePart part, ThreadId tid, const HChar* s, Addr a, SizeT size)); |
|
From: Mark W. <ma...@so...> - 2021-02-20 16:00:18
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=84c7df99173ca9589daea551557e4a107bbbde1c commit 84c7df99173ca9589daea551557e4a107bbbde1c Author: Mark Wielaard <ma...@kl...> Date: Sat Feb 20 16:56:33 2021 +0100 Update NEWS with some core and platform (s390) changes and bug fixes. Mention the new DWARF version 5 support needed with GCC 11. s390 now supports z14 vector instructions. Add missing bugs fixed and sort them by bug number (n-i-bz last). Pull in 3.16.1 release data. Diff: --- NEWS | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index 69856917f6..c910af0f4e 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,29 @@ support for X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux. * ==================== CORE CHANGES =================== +* DWARF version 5 support + + - Valgrind can now read DWARF version 5 debuginfo as produced by GCC 11 + +* ================== PLATFORM CHANGES ================= + +* s390: + + - Implement the new instructions/features that were added to + z/Architecture with the vector-enhancements facility 1. Also + cover the instructions from the vector-packed-decimal facility + that are defined outside the chapter "Vector Decimal + Instructions", but not the ones from that chapter itself. + + For a detailed list of newly supported instructions see the + updates to `docs/internals/s390-opcodes.csv'. + + Since the miscellaneous instruction extensions facility 2 was + already added in Valgrind 3.16.0, this completes the support + necessary to run general programs built with `--march=z14' under + Valgrind. The vector-packed-decimal facility is currently not + exploited by the standard toolchain and libraries. + * ==================== TOOL CHANGES ==================== * DHAT: @@ -56,50 +79,64 @@ where XXXXXX is the bug number as listed below. 217695 malloc/calloc/realloc/memalign failure doesn't set errno to ENOMEM 345077 linux syscall execveat support (linux 3.19) 369029 handle linux syscalls sched_getattr and sched_setattr -n-i-bz helgrind: If hg_cli__realloc fails, return NULL. - 384729 __libc_freeres inhibits cross-platform valgrind +391853 Makefile.all.am:L247 and @SOLARIS_UNDEF_LARGESOURCE@ being empty 397605 ioctl FICLONE mishandled 408663 Suppression file for musl libc 404076 s390x: z14 vector instructions not implemented 410743 shmat() calls for 32-bit programs fail when running in 64-bit valgrind (actually affected all x86 and nanomips regardless of host bitness) +413547 regression test does not check for Arm 64 features. +414268 Enable AArch64 feature detection and decoding for v8.x instructions 415293 Incorrect call-graph tracking due to new _dl_runtime_resolve_xsave* 422174 unhandled instruction bytes: 0x48 0xE9 (REX prefixed JMP instruction) 422261 platform selection fails for unqualified client name 422623 epoll_ctl warns for uninitialized padding on non-amd64 64bit arches 423021 PPC: Add missing ISA 3.0 documentation link and HWCAPS test. -424298 amd64: Implement RDSEED -426144 Fix "condition variable has not been initialized" on Fedora 33. 423195 PPC ISA 3.1 support is missing, part 1 423361 Adds io_uring support on arm64/aarch64 (and all other arches) +424012 crash with readv/writev having invalid but not NULL arg2 iovec +424298 amd64: Implement RDSEED 425232 PPC ISA 3.1 support is missing, part 2 +425820 Failure to recognize vpcmpeqq as a dependency breaking idiom. +426014 arm64: implement fmadd and fmsub as Iop_MAdd/Sub 426123 PPC ISA 3.1 support is missing, part 3 -427787 Support new faccessat2 linux syscall (439) -428035 drd: Unbreak the musl build -428648 s390_emit_load_mem panics due to 20-bit offset for vector load +426144 Fix "condition variable has not been initialized" on Fedora 33. 427400 PPC ISA 3.1 support is missing, part 4 427401 PPC ISA 3.1 support is missing, part 5 -427870 lmw, lswi and related PowerPC insns aren't allowed on ppc64le 427404 PPC ISA 3.1 support is missing, part 6 -429692 unhandled ppc64le-linux syscall: 147 (getsid) +427870 lmw, lswi and related PowerPC insns aren't allowed on ppc64le +427787 Support new faccessat2 linux syscall (439) +428035 drd: Unbreak the musl build +428648 s390_emit_load_mem panics due to 20-bit offset for vector load +428716 cppcheck detects potential leak in VEX/useful/smchash.c 428909 helgrind: need to intercept duplicate libc definitions for Fedora 33 +429692 unhandled ppc64le-linux syscall: 147 (getsid) 429864 s390x: C++ atomic test_and_set yields false-positive memcheck diagnostics +429952 Errors when building regtest with clang 430354 ppc stxsibx and stxsihx instructions write too much data 430485 expr_is_guardable doesn't handle Iex_Qop +431556 Complete arm64 FADDP v8.2 instruction support +432102 Add support for DWARF5 as produced by GCC11 +432161 Addition of arm64 v8.2 FADDP, FNEG and FSQRT 432672 vg_regtest: test-specific environment variables not reset between tests 432809 VEX should support REX.W + POPF 432861 PPC modsw and modsd give incorrect results for 1 mod 12 +n-i-bz helgrind: If hg_cli__realloc fails, return NULL. -Release 3.16.1 (?? June 2020) + + +Release 3.16.1 (22 June 2020) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -3.16.1 is identical to 3.16.0, except that it fixes the following bug that -was discovered late in the 3.16.0 release process: +3.16.1 fixes two critical bugs discovered after 3.16.0 was frozen. It also +fixes character encoding problems in the documentation HTML. + +422677 PPC sync instruction L field should only be 2 bits in ISA 3.0 +422715 32-bit x86: vex: the `impossible' happened: expr_is_guardable: unhandled expr -422715 valgrind 3.16.0 on 32-bit x86: vex: the `impossible' happened: - expr_is_guardable: unhandled expr +(3.16.1, 22 June 2020, 36d6727e1d768333a536f274491e5879cab2c2f7) |
|
From: Mark W. <ma...@so...> - 2021-02-20 15:18:18
|
The unsigned tag 'VALGRIND_3_16_1' was created pointing to:
24f63fd435... -> 3.16.1
Tagger: Mark Wielaard <ma...@kl...>
Date: Sat Feb 20 16:16:49 2021 +0100
valgrind 3.16.1 final release
|
|
From: Mark W. <ma...@so...> - 2021-02-20 15:17:57
|
The unsigned tag 'VALGRIND_3_16_0' was created pointing to:
108b4a0880... -> 3.16.0 final
Tagger: Mark Wielaard <ma...@kl...>
Date: Sat Feb 20 16:17:13 2021 +0100
valgrind 3.16.0 final release
|
|
From: Mark W. <ma...@so...> - 2021-02-17 12:16:05
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=1c9a0bf58a47e855e6e5bf78a30bcee0af835804 commit 1c9a0bf58a47e855e6e5bf78a30bcee0af835804 Author: Mark Wielaard <ma...@kl...> Date: Fri Feb 12 23:29:34 2021 +0100 PR217695 malloc/calloc/realloc/memalign failure doesn't set errno to ENOMEM When one of the allocation functions in vg_replace_malloc failed they return NULL, but didn't set errno. This is slightly tricky since errno is implementation defined and might be a macro. In the case of glibc ernno is defined as: extern int *__errno_location (void) __THROW __attribute__ ((__const__)); #define errno (*__errno_location ()) We can use the same trick as we use for __libc_freeres in coregrind/vg_preloaded.c. Define the function as "weak". This means it will only be defined if another library (glibc in this case) actually provides a definition. Otherwise it will be NULL. So we will only call it if it is defined and one of the allocation functions failed, returned NULL. Include a new linux only memcheck testcase, enomem.vgtest. https://bugs.kde.org/show_bug.cgi?id=217695 Diff: --- NEWS | 1 + coregrind/m_replacemalloc/vg_replace_malloc.c | 15 ++++++++++++ memcheck/tests/linux/Makefile.am | 6 +++-- memcheck/tests/linux/enomem.c | 34 +++++++++++++++++++++++++++ memcheck/tests/linux/enomem.stderr.exp | 0 memcheck/tests/linux/enomem.stdout.exp | 4 ++++ memcheck/tests/linux/enomem.vgtest | 2 ++ 7 files changed, 60 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index eafe0cb009..69856917f6 100644 --- a/NEWS +++ b/NEWS @@ -53,6 +53,7 @@ where XXXXXX is the bug number as listed below. 140178 open("/proc/self/exe", ...); doesn't quite work 140939 --track-fds reports leakage of stdout/in/err and doesn't respect -q +217695 malloc/calloc/realloc/memalign failure doesn't set errno to ENOMEM 345077 linux syscall execveat support (linux 3.19) 369029 handle linux syscalls sched_getattr and sched_setattr n-i-bz helgrind: If hg_cli__realloc fails, return NULL. diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index a0e3aa398f..c3be5c6a81 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -192,6 +192,17 @@ static void init(void); if (info.clo_trace_malloc) { \ VALGRIND_INTERNAL_PRINTF(format, ## args ); } +/* Tries to set ERRNO to ENOMEM if possible. + Only implemented for glibc at the moment. +*/ +#if defined(VGO_linux) +extern int *__errno_location (void) __attribute__((weak)); +#define SET_ERRNO_ENOMEM if (__errno_location) \ + (*__errno_location ()) = VKI_ENOMEM; +#else +#define SET_ERRNO_ENOMEM {} +#endif + /* Below are new versions of malloc, __builtin_new, free, __builtin_delete, calloc, realloc, memalign, and friends. @@ -246,6 +257,7 @@ static void init(void); \ v = (void*)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, n ); \ MALLOC_TRACE(" = %p\n", v ); \ + if (!v) SET_ERRNO_ENOMEM; \ return v; \ } @@ -752,6 +764,7 @@ static void init(void); if (umulHW(size, nmemb) != 0) return NULL; \ v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_calloc, nmemb, size ); \ MALLOC_TRACE(" = %p\n", v ); \ + if (!v) SET_ERRNO_ENOMEM; \ return v; \ } @@ -826,6 +839,7 @@ static void init(void); } \ v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_realloc, ptrV, new_size ); \ MALLOC_TRACE(" = %p\n", v ); \ + if (!v) SET_ERRNO_ENOMEM; \ return v; \ } @@ -899,6 +913,7 @@ static void init(void); \ v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_memalign, alignment, n ); \ MALLOC_TRACE(" = %p\n", v ); \ + if (!v) SET_ERRNO_ENOMEM; \ return v; \ } diff --git a/memcheck/tests/linux/Makefile.am b/memcheck/tests/linux/Makefile.am index 3111f631b4..1c53ffbaf8 100644 --- a/memcheck/tests/linux/Makefile.am +++ b/memcheck/tests/linux/Makefile.am @@ -29,7 +29,8 @@ EXTRA_DIST = \ getregset.stderr.exp getregset.stdout.exp \ sys-preadv_pwritev.vgtest sys-preadv_pwritev.stderr.exp \ sys-preadv2_pwritev2.vgtest sys-preadv2_pwritev2.stderr.exp \ - sys-execveat.vgtest sys-execveat.stderr.exp sys-execveat.stdout.exp + sys-execveat.vgtest sys-execveat.stderr.exp sys-execveat.stdout.exp \ + enomem.vgtest enomem.stderr.exp enomem.stdout.exp check_PROGRAMS = \ brk \ @@ -50,7 +51,8 @@ check_PROGRAMS = \ timerfd-syscall \ proc-auxv \ sys-execveat \ - check_execveat + check_execveat \ + enomem if HAVE_AT_FDCWD check_PROGRAMS += sys-openat diff --git a/memcheck/tests/linux/enomem.c b/memcheck/tests/linux/enomem.c new file mode 100644 index 0000000000..05cc08cd52 --- /dev/null +++ b/memcheck/tests/linux/enomem.c @@ -0,0 +1,34 @@ + +/* Test malloc, calloc, realloc and memalign set errno to ENOMEM */ + +#include <errno.h> +#include <limits.h> +#include <malloc.h> +#include <stdio.h> +#include <stdlib.h> + +int main ( void ) +{ + char* small = malloc (16); + char* p; + + errno = 0; + p = malloc(SSIZE_MAX); + if (!p && errno == ENOMEM) puts("malloc: Cannot allocate memory"); + + errno = 0; + p = calloc(1, SSIZE_MAX); + if (!p && errno == ENOMEM) puts("calloc: Cannot allocate memory"); + + errno = 0; + p = realloc(small, SSIZE_MAX); + if (!p && errno == ENOMEM) puts("realloc: Cannot allocate memory"); + + errno = 0; + p = memalign(64, SSIZE_MAX); + if (!p && errno == ENOMEM) puts("memalign: Cannot allocate memory"); + + free(small); + + return 0; +} diff --git a/memcheck/tests/linux/enomem.stderr.exp b/memcheck/tests/linux/enomem.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/memcheck/tests/linux/enomem.stdout.exp b/memcheck/tests/linux/enomem.stdout.exp new file mode 100644 index 0000000000..0c43a85a42 --- /dev/null +++ b/memcheck/tests/linux/enomem.stdout.exp @@ -0,0 +1,4 @@ +malloc: Cannot allocate memory +calloc: Cannot allocate memory +realloc: Cannot allocate memory +memalign: Cannot allocate memory diff --git a/memcheck/tests/linux/enomem.vgtest b/memcheck/tests/linux/enomem.vgtest new file mode 100644 index 0000000000..9a6b949279 --- /dev/null +++ b/memcheck/tests/linux/enomem.vgtest @@ -0,0 +1,2 @@ +prog: enomem +vgopts: -q |
|
From: Paul F. <pa...@so...> - 2021-02-16 12:23:16
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=ee01ed8f13d235ad84cdca11ca88523cc5b52287 commit ee01ed8f13d235ad84cdca11ca88523cc5b52287 Author: Paul Floyd <pj...@wa...> Date: Tue Feb 16 13:22:10 2021 +0100 Fix compilation on macOS with new debuginfo reader Diff: --- coregrind/m_debuginfo/readmacho.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coregrind/m_debuginfo/readmacho.c b/coregrind/m_debuginfo/readmacho.c index 9153a74ca1..d93e24ecf8 100644 --- a/coregrind/m_debuginfo/readmacho.c +++ b/coregrind/m_debuginfo/readmacho.c @@ -1152,7 +1152,7 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) debug_line_mscn, debug_str_mscn, DiSlice_INVALID, /* ALT .debug_str */ - debug_line_str ); + debug_line_str_mscn ); /* The new reader: read the DIEs in .debug_info to acquire information on variable types and locations or inline info. |
|
From: Mark W. <ma...@so...> - 2021-02-12 19:47:29
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=e2e830f61271c28dddfa6b478044870d2188cf57 commit e2e830f61271c28dddfa6b478044870d2188cf57 Author: Mark Wielaard <ma...@kl...> Date: Fri Feb 12 20:42:00 2021 +0100 PR432809 VEX should support REX.W + POPF It seems a REX.W prefix simply explicitly sets the operant size to 8, and so can/must be ignored as redundant. This is what we already do for PUSH, POP and PUSHF. All instructions are described as "When in 64-bit mode, instruction defaults to 64-bit operand size and cannot encode 32-bit operand size." in the instruction manual. Original patch and analysis by Mike Dalessio <mik...@gm...> https://bugs.kde.org/show_bug.cgi?id=432809 Diff: --- NEWS | 1 + VEX/priv/guest_amd64_toIR.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index dbe029ecea..eafe0cb009 100644 --- a/NEWS +++ b/NEWS @@ -88,6 +88,7 @@ n-i-bz helgrind: If hg_cli__realloc fails, return NULL. 430354 ppc stxsibx and stxsihx instructions write too much data 430485 expr_is_guardable doesn't handle Iex_Qop 432672 vg_regtest: test-specific environment variables not reset between tests +432809 VEX should support REX.W + POPF 432861 PPC modsw and modsd give incorrect results for 1 mod 12 Release 3.16.1 (?? June 2020) diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c index 2faca7d03f..30487065d7 100644 --- a/VEX/priv/guest_amd64_toIR.c +++ b/VEX/priv/guest_amd64_toIR.c @@ -20586,7 +20586,7 @@ Long dis_ESC_NONE ( /* Note. There is no encoding for a 32-bit popf in 64-bit mode. So sz==4 actually means sz==8. */ if (haveF2orF3(pfx)) goto decode_failure; - vassert(sz == 2 || sz == 4); + vassert(sz == 2 || sz == 4 || sz == 8); if (sz == 4) sz = 8; if (sz != 8) goto decode_failure; // until we know a sz==2 test case exists t1 = newTemp(Ity_I64); t2 = newTemp(Ity_I64); |
|
From: Carl L. <ca...@so...> - 2021-02-12 17:02:30
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=b4eff82004077b5628e9c0958121fe6156c29664 commit b4eff82004077b5628e9c0958121fe6156c29664 Author: Carl Love <ce...@us...> Date: Wed Feb 10 21:04:22 2021 -0600 PPC, modsw and modsd instruction fix Diff: --- NEWS | 1 + VEX/priv/guest_ppc_toIR.c | 144 ++-- none/tests/ppc64/Makefile.am | 4 +- none/tests/ppc64/test_isa_3_0_other.stdout.exp-LE | 2 +- none/tests/ppc64/test_mod_instructions.c | 251 +++++++ none/tests/ppc64/test_mod_instructions.stderr.exp | 2 + none/tests/ppc64/test_mod_instructions.stdout.exp | 824 ++++++++++++++++++++++ none/tests/ppc64/test_mod_instructions.vgtest | 2 + 8 files changed, 1162 insertions(+), 68 deletions(-) diff --git a/NEWS b/NEWS index 3e0f5a0bd3..dbe029ecea 100644 --- a/NEWS +++ b/NEWS @@ -88,6 +88,7 @@ n-i-bz helgrind: If hg_cli__realloc fails, return NULL. 430354 ppc stxsibx and stxsihx instructions write too much data 430485 expr_is_guardable doesn't handle Iex_Qop 432672 vg_regtest: test-specific environment variables not reset between tests +432861 PPC modsw and modsd give incorrect results for 1 mod 12 Release 3.16.1 (?? June 2020) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c index 3d4833d96a..880a47ebb2 100644 --- a/VEX/priv/guest_ppc_toIR.c +++ b/VEX/priv/guest_ppc_toIR.c @@ -7453,14 +7453,13 @@ static Bool dis_modulo_int ( UInt prefix, UInt theInstr ) IRTemp rB = newTemp( Ity_I64 ); IRTemp rA2_63 = newTemp( Ity_I64 ); /* all 1's if rA != -2^63 */ IRTemp rB_0 = newTemp( Ity_I1 ); /* 1 if rB = 0 */ - IRTemp rB_1 = newTemp( Ity_I1 ); /* 1 if rB = -1 */ - IRTemp rA_1 = newTemp( Ity_I1 ); /* 1 if rA = -1 */ + IRTemp rB_1 = newTemp( Ity_I1 ); /* 1 if rB = 1 */ + IRTemp rB_m1 = newTemp( Ity_I1 ); /* 1 if rB = -1 */ + IRTemp rA_m1 = newTemp( Ity_I1 ); /* 1 if rA = -1 */ IRTemp resultis0 = newTemp( Ity_I64 ); - IRTemp resultisF = newTemp( Ity_I64 ); IRTemp quotient = newTemp( Ity_I64 ); IRTemp quotientTimesDivisor = newTemp( Ity_I64 ); IRTemp remainder = newTemp( Ity_I64 ); - IRTemp tmp = newTemp( Ity_I64 ); DIP("modsd r%u,r%u,r%u\n", rD_addr, rA_addr, rB_addr); @@ -7477,30 +7476,46 @@ static Bool dis_modulo_int ( UInt prefix, UInt theInstr ) assign( rB_1, binop( Iop_CmpEQ64, mkexpr( rB ), - mkU64( 0xFFFFFFFFFFFFFFFF ) ) ); + mkU64( 0x1 ) ) ); + + assign( rB_m1, binop( Iop_CmpEQ64, + mkexpr( rB ), + mkU64( 0xFFFFFFFFFFFFFFFF ) ) ); - assign( rA_1, binop( Iop_CmpEQ64, + assign( rA_m1, binop( Iop_CmpEQ64, mkexpr( rA ), mkU64( 0xFFFFFFFFFFFFFFFF ) ) ); /* Need to match the HW for these special cases - * rA = -2^31 and rB = -1 result all zeros - * rA = -1 and rB = -1 result all zeros - * rA = -1 and (rB != -1 AND rB != 0) result all 1's - */ + rA = -2^31 and rB = -1 result all zeros + rA = -1 and rB = -1 result all zeros + + if an attempt is made to perform any of the divisions: + 0x80000000 % -1 + <anything> % 0 + result is undefined. Force result to zero to match the + HW behaviour. */ + assign( resultis0, binop( Iop_Or64, - mkexpr( rA2_63 ), - unop ( Iop_1Sto64, mkexpr( rB_1 ) ) ) ); - assign( resultisF, - binop( Iop_And64, - unop( Iop_1Sto64, mkexpr( rA_1 ) ), - binop( Iop_And64, - unop( Iop_Not64, - unop( Iop_1Sto64, mkexpr( rB_0 ) ) ), - unop( Iop_Not64, - unop( Iop_1Sto64, mkexpr( rB_1 ) ) ) - ) ) ); + binop( Iop_Or64, + /* -1 % 1 */ + binop( Iop_And64, + unop( Iop_1Sto64, mkexpr( rA_m1 ) ), + unop( Iop_1Sto64, mkexpr( rB_1 ) ) ), + /* rA % 0 (division by zero) */ + unop( Iop_1Sto64, mkexpr( rB_0 ) ) ), + binop( Iop_Or64, + binop( Iop_And64, + unop( Iop_Not64, + mkexpr( rA2_63 ) ), + unop ( Iop_1Sto64, + mkexpr( rB_m1 ) ) ), + /* -1 % -1 */ + binop( Iop_And64, + unop( Iop_1Sto64, mkexpr( rA_m1 ) ), + unop( Iop_1Sto64, mkexpr( rB_m1 ) ) + ) ) ) ); /* The following remainder computation works as long as * rA != -2^63 and rB != -1. @@ -7518,33 +7533,25 @@ static Bool dis_modulo_int ( UInt prefix, UInt theInstr ) mkexpr( rA ), mkexpr( quotientTimesDivisor ) ) ); - assign( tmp, binop( Iop_And64, + assign( rD, binop( Iop_And64, mkexpr( remainder ), unop( Iop_Not64, mkexpr( resultis0 ) ) ) ); - - assign( rD, binop( Iop_Or64, - binop( Iop_And64, - unop (Iop_Not64, - mkexpr( resultisF ) ), - mkexpr( tmp ) ), - mkexpr( resultisF ) ) ); break; } case 0x30B: // modsw Modulo Signed Word { IRTemp rA = newTemp( Ity_I32 ); IRTemp rB = newTemp( Ity_I32 ); - IRTemp rA2_32 = newTemp( Ity_I32 ); /* all 1's if rA = -2^32 */ - IRTemp rB_0 = newTemp( Ity_I1 ); /* 1 if rB = 0 */ - IRTemp rB_1 = newTemp( Ity_I1 ); /* 1 if rB = -1 */ - IRTemp rA_1 = newTemp( Ity_I1 ); /* 1 if rA = -1 */ + IRTemp rA2_32 = newTemp( Ity_I32 ); /* all 1's if rA = -2^32 */ + IRTemp rB_0 = newTemp( Ity_I1 ); /* 1 if rB = 0 */ + IRTemp rB_1 = newTemp( Ity_I1 ); /* 1 if rB = 1 */ + IRTemp rB_m1 = newTemp( Ity_I1 ); /* 1 if rB = -1, 0xFFFFFFFF */ + IRTemp rA_m1 = newTemp( Ity_I1 ); /* 1 if rA = -1, 0xFFFFFFFF */ IRTemp resultis0 = newTemp( Ity_I32 ); - IRTemp resultisF = newTemp( Ity_I64 ); IRTemp quotient = newTemp( Ity_I32 ); IRTemp quotientTimesDivisor = newTemp( Ity_I32 ); IRTemp remainder = newTemp( Ity_I32 ); - IRTemp tmp = newTemp( Ity_I64 ); DIP("modsw r%u,r%u,r%u\n", rD_addr, rA_addr, rB_addr); @@ -7574,36 +7581,48 @@ static Bool dis_modulo_int ( UInt prefix, UInt theInstr ) assign( rB_1, binop( Iop_CmpEQ32, mkexpr( rB ), - mkU32( 0xFFFFFFFF ) ) ); + mkU32( 0x00000001 ) ) ); - assign( rA_1, binop( Iop_CmpEQ32, + assign( rB_m1, binop( Iop_CmpEQ32, + mkexpr( rB ), + mkU32( 0xFFFFFFFF ) ) ); + + assign( rA_m1, binop( Iop_CmpEQ32, mkexpr( rA ), mkU32( 0xFFFFFFFF ) ) ); /* Need to match the HW for these special cases - * rA = -2^31 and rB = -1 result all zeros - * rA = -1 and rB = -1 result all zeros - * rA = -1 and (rB != -1 AND rB != 0) result all 1's - */ + rA = -2^31 and rB = -1 result all zeros + rA = -1 and rB = -1 result all zeros + rA = -1 and rB = 1 result all zeros + + if an attempt is made to perform any of the divisions: + 0x80000000 % -1 + <anything> % 0 + result is undefined. Force result to zero to match the + HW beaviour. */ + assign( resultis0, binop( Iop_Or32, - unop( Iop_Not32, - binop( Iop_And32, - mkexpr( rA2_32 ), - unop( Iop_1Sto32, - mkexpr( rB_1 ) ) ) ), - binop( Iop_And32, - unop( Iop_1Sto32, mkexpr( rA_1 ) ), - unop( Iop_1Sto32, mkexpr( rB_1 ) ) ) ) ); - assign( resultisF, - binop( Iop_And64, - unop( Iop_1Sto64, mkexpr( rA_1 ) ), - binop( Iop_And64, - unop( Iop_Not64, - unop( Iop_1Sto64, mkexpr( rB_0 ) ) ), - unop( Iop_Not64, - unop( Iop_1Sto64, mkexpr( rB_1 ) ) ) - ) ) ); + binop( Iop_Or32, + /* -1 % 1 */ + binop( Iop_And32, + unop( Iop_1Sto32, mkexpr( rA_m1 ) ), + unop( Iop_1Sto32, mkexpr( rB_1 ) ) ), + /* rA % 0 (division by zero) */ + unop( Iop_1Sto32, mkexpr( rB_0 ) ) ), + + binop( Iop_Or32, + /* 0x8000000 % -1 */ + binop( Iop_And32, + mkexpr( rA2_32 ), + unop( Iop_1Sto32, + mkexpr( rB_m1 ) ) ), + /* -1 % -1 */ + binop( Iop_And32, + unop( Iop_1Sto32, mkexpr( rA_m1 ) ), + unop( Iop_1Sto32, mkexpr( rB_m1 ) ) + ) ) ) ); /* The following remainder computation works as long as * rA != -2^31 and rB != -1. @@ -7622,19 +7641,12 @@ static Bool dis_modulo_int ( UInt prefix, UInt theInstr ) mkexpr( rA ), mkexpr( quotientTimesDivisor ) ) ); - assign( tmp, binop( Iop_32HLto64, + assign( rD, binop( Iop_32HLto64, mkU32( 0 ), binop( Iop_And32, mkexpr( remainder ), unop( Iop_Not32, mkexpr( resultis0 ) ) ) ) ); - - assign( rD, binop( Iop_Or64, - binop( Iop_And64, - unop ( Iop_Not64, - mkexpr( resultisF ) ), - mkexpr( tmp ) ), - mkexpr( resultisF ) ) ); break; } diff --git a/none/tests/ppc64/Makefile.am b/none/tests/ppc64/Makefile.am index cd5dc91a46..23a22d922b 100644 --- a/none/tests/ppc64/Makefile.am +++ b/none/tests/ppc64/Makefile.am @@ -49,6 +49,8 @@ EXTRA_DIST = \ test_isa_3_0_altivec.stdout.exp-LE test_isa_3_0_altivec.vgtest \ test_isa_3_0_other.stderr.exp \ test_isa_3_0_other.stdout.exp-LE test_isa_3_0_other.vgtest \ + test_mod_instructions.stderr.exp test_mod_instructions.stdout.exp \ + test_mod_instructions.vgtest \ test_isa_3_1_RT.vgtest test_isa_3_1_RT.stderr.exp test_isa_3_1_RT.stdout.exp \ test_isa_3_1_XT.vgtest test_isa_3_1_XT.stderr.exp test_isa_3_1_XT.stdout.exp \ test_isa_3_1_VRT.vgtest test_isa_3_1_VRT.stderr.exp test_isa_3_1_VRT.stdout.exp \ @@ -63,7 +65,7 @@ check_PROGRAMS = \ test_isa_2_06_part1 test_isa_2_06_part2 test_isa_2_06_part3 \ test_dfp1 test_dfp2 test_dfp3 test_dfp4 test_dfp5 \ test_isa_2_07_part1 test_isa_2_07_part2 \ - test_isa_3_0 \ + test_isa_3_0 test_mod_instructions \ test_isa_3_1_RT test_isa_3_1_XT test_isa_3_1_VRT \ test_isa_3_1_Misc test_isa_3_1_AT \ subnormal_test \ diff --git a/none/tests/ppc64/test_isa_3_0_other.stdout.exp-LE b/none/tests/ppc64/test_isa_3_0_other.stdout.exp-LE index cc0e88e9a3..4d6da7999f 100644 --- a/none/tests/ppc64/test_isa_3_0_other.stdout.exp-LE +++ b/none/tests/ppc64/test_isa_3_0_other.stdout.exp-LE @@ -7,7 +7,7 @@ modsw 0000001cbe991def, 0000000000000000 => 0000000000000000 (00000000) modsw 0000001cbe991def, 0000001cbe991def => 0000000000000000 (00000000) modsw 0000001cbe991def, ffffffffffffffff => 0000000000000000 (00000000) modsw ffffffffffffffff, 0000000000000000 => 0000000000000000 (00000000) -modsw ffffffffffffffff, 0000001cbe991def => ffffffffffffffff (00000000) +modsw ffffffffffffffff, 0000001cbe991def => 00000000ffffffff (00000000) modsw ffffffffffffffff, ffffffffffffffff => 0000000000000000 (00000000) moduw 0000000000000000, 0000000000000000 => 0000000000000000 (00000000) diff --git a/none/tests/ppc64/test_mod_instructions.c b/none/tests/ppc64/test_mod_instructions.c new file mode 100644 index 0000000000..07e1cd2881 --- /dev/null +++ b/none/tests/ppc64/test_mod_instructions.c @@ -0,0 +1,251 @@ +#include <stdio.h> + +long test_modsd( long srcA, long srcB) +{ + long dst; + __asm__ __volatile__ ("modsd %0,%1,%2" : "=r" (dst): "r" (srcA), "r" (srcB)); + + return dst; +} + +unsigned long test_modud( unsigned long srcA, unsigned long srcB) +{ + unsigned long dst; + __asm__ __volatile__ ("modud %0,%1,%2" : "=r" (dst): "r" (srcA), "r" (srcB)); + + return dst; +} + +int test_modsw( int srcA, int srcB) +{ + int dst; + __asm__ __volatile__ ("modsw %0,%1,%2" : "=r" (dst): "r" (srcA), "r" (srcB)); + + return dst; +} + +unsigned test_moduw( unsigned srcA, unsigned srcB) +{ + unsigned dst; + __asm__ __volatile__ ("moduw %0,%1,%2" : "=r" (dst): "r" (srcA), "r" (srcB)); + + return dst; +} + +int main() +{ + int srcA_si, srcB_si, dst_si; + unsigned int srcA_ui, srcB_ui, dst_ui; + long srcA_sl, srcB_sl, dst_sl; + unsigned long srcA_ul, srcB_ul, dst_ul; + int i_si, j_si; + long int i_sl, j_sl; + int i_ui, j_ui; + long int i_ul, j_ul; + +#define SI_NEGATIVE_START 0x80000000 +#define SI_NEGATIVE_STOP 0x80000008 +#define SI_POSITIVE_START 0x7FFFFFF8 +#define SI_POSITIVE_STOP 0x7FFFFFFF +#define SI_ZERO_START -5 +#define SI_ZERO_STOP 5 + +#define DI_NEGATIVE_START 0x8000000000000000LL +#define DI_NEGATIVE_STOP 0x8000000000000008LL +#define DI_POSITIVE_START 0x7FFFFFFFFFFFFFF8LL +#define DI_POSITIVE_STOP 0x7FFFFFFFFFFFFFFFLL +#define DI_ZERO_START -5 +#define DI_ZERO_STOP 5 + +#define UI_START 0xFFFFFFF8 +#define UI_STOP 0xFFFFFFFF +#define UI_ZERO_START 0 +#define UI_ZERO_STOP 10 + +#define UL_START 0xFFFFFFFFFFFFFFF8ULL +#define UL_STOP 0xFFFFFFFFFFFFFFFFULL +#define UL_ZERO_START 0 +#define UL_ZERO_STOP 10 + + /* Signed tests need to check the most negative values, + the most positive values and values around zero. */ + + /* Signed integer tests */ + for (i_si = SI_NEGATIVE_START; i_si < SI_NEGATIVE_STOP; i_si++) + for (j_si = SI_NEGATIVE_START; j_si < SI_NEGATIVE_STOP; j_si++) + { + srcA_si = i_si; + srcB_si = j_si; + + dst_si = test_modsw( srcA_si, srcB_si); +#ifdef debug + printf("srcA_si = %d \n", srcA_si); + printf("srcB_si = %d \n", srcB_si); + printf ("modsw result = %d\n\n", dst_si); +#else + printf ("modsw result = %d\n", dst_si); +#endif + } + + for (i_si = SI_ZERO_START; i_si < SI_ZERO_STOP; i_si++) + for (j_si = SI_ZERO_START; j_si < SI_ZERO_STOP; j_si++) + { + srcA_si = i_si; + srcB_si = j_si; + + dst_si = test_modsw( srcA_si, srcB_si); + +#ifdef debug + printf("srcA_si = %d \n", srcA_si); + printf("srcB_si = %d \n", srcB_si); + printf ("modsw result = %d\n\n", dst_si); +#else + printf ("modsw result = %d\n", dst_si); +#endif + } + + for (i_si = SI_POSITIVE_START; i_si < SI_POSITIVE_STOP; i_si++) + for (j_si = SI_POSITIVE_START; j_si < SI_POSITIVE_STOP; j_si++) + { + srcA_si = i_si; + srcB_si = j_si; + + dst_si = test_modsw( srcA_si, srcB_si); + +#ifdef debug + printf("srcA_si = %d \n", srcA_si); + printf("srcB_si = %d \n", srcB_si); + printf ("modsw result = %d\n\n", dst_si); +#else + printf ("modsw result = %d\n", dst_si); +#endif + } + + /* Signed long integer tests */ + for (i_sl = DI_NEGATIVE_START; i_sl < DI_NEGATIVE_STOP; i_sl++) + for (j_sl = DI_NEGATIVE_START; j_sl < DI_NEGATIVE_STOP; j_sl++) + { + srcA_sl = i_sl; + srcB_sl = j_sl; + + dst_sl = test_modsd( srcA_sl, srcB_sl); + +#ifdef debug + printf("srcA_sl = %ld \n", srcA_sl); + printf("srcB_sl = %ld \n", srcB_sl); + printf ("modsd result = %ld\n\n", dst_sl); +#else + printf ("modsd result = %ld\n", dst_sl); +#endif + } + + for (i_sl = DI_ZERO_START; i_sl < DI_ZERO_STOP; i_sl++) + for (j_sl = DI_ZERO_START; j_sl < DI_ZERO_STOP; j_sl++) + { + srcA_sl = i_sl; + srcB_sl = j_sl; + + dst_sl = test_modsd( srcA_sl, srcB_sl); + +#ifdef debug + printf("srcA_sl = %ld \n", srcA_sl); + printf("srcB_sl = %ld \n", srcB_sl); + printf ("modsd result = %ld\n\n", dst_sl); +#else + printf ("modsd result = %ld\n", dst_sl); +#endif + } + + for (i_sl = DI_POSITIVE_START; i_sl < DI_POSITIVE_STOP; i_sl++) + for (j_sl = DI_POSITIVE_START; j_sl < DI_POSITIVE_STOP; j_sl++) + { + srcA_sl = i_sl; + srcB_sl = j_sl; + + dst_sl = test_modsd( srcA_sl, srcB_sl); + +#ifdef debug + printf("srcA_sl = %ld \n", srcA_sl); + printf("srcB_sl = %ld \n", srcB_sl); + printf ("modsd result = %ld\n\n", dst_sl); +#else + printf ("modsd result = %ld\n", dst_sl); +#endif + } + + /* Unsigned tests need to check the most positive values + and the values around zero. */ + + /* Unsigned integer tests */ + for (i_ui = UI_START; i_ui < UI_STOP; i_ui++) + for (j_ui = UI_START; j_ui < UI_STOP; j_ui++) + { + srcA_ui = i_ui; + srcB_ui = j_ui; + + dst_ui = test_moduw( srcA_ui, srcB_ui); + +#ifdef debug + printf("srcA_ui = %u \n", srcA_ui); + printf("srcB_ui = %u \n", srcB_ui); + printf ("moduw result = %u\n\n", dst_ui); +#else + printf ("moduw result = %u\n", dst_ui); +#endif + } + + for (i_ui = SI_ZERO_START; i_ui < SI_ZERO_STOP; i_ui++) + for (j_ui = SI_ZERO_START; j_ui < SI_ZERO_STOP; j_ui++) + { + srcA_ui = i_ui; + srcB_ui = j_ui; + + dst_ui = test_moduw( srcA_ui, srcB_ui); + +#ifdef debug + printf("srcA_ui = %u \n", srcA_ui); + printf("srcB_ui = %u \n", srcB_ui); + printf ("moduw result = %u\n", dst_ui); +#else + printf ("moduw result = %u\n\n", dst_ui); +#endif + } + + /* Unsigned long integer tests */ + for (i_ul = UL_START; i_ul < UL_STOP; i_ul++) + for (j_ul = UL_START; j_ul < UL_STOP; j_ul++) + { + srcA_ul = i_ul; + srcB_ul = j_ul; + + dst_ul = test_modud( srcA_ul, srcB_ul); + +#ifdef debug + printf("srcA_ul = %lu \n", srcA_ul); + printf("srcB_ul = %lu \n", srcB_ul); + printf ("modud result = %lu\n\n", dst_ul); +#else + printf ("modud result = %lu\n", dst_ul); +#endif + } + + for (i_ul = UL_ZERO_START; i_ul < UL_ZERO_STOP; i_ul++) + for (j_ul = UL_ZERO_START; j_ul < UL_ZERO_STOP; j_ul++) + { + srcA_ul = i_ul; + srcB_ul = j_ul; + + dst_ul = test_modud( srcA_ul, srcB_ul); + +#ifdef debug + printf("srcA_ul = %lu \n", srcA_ul); + printf("srcB_ul = %lu \n", srcB_ul); + printf ("modud result = %lu\n\n", dst_ul); +#else + printf ("modud result = %lu\n", dst_ul); +#endif + } + + return 0; +} + diff --git a/none/tests/ppc64/test_mod_instructions.stderr.exp b/none/tests/ppc64/test_mod_instructions.stderr.exp new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/none/tests/ppc64/test_mod_instructions.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/ppc64/test_mod_instructions.stdout.exp b/none/tests/ppc64/test_mod_instructions.stdout.exp new file mode 100644 index 0000000000..b53f97e546 --- /dev/null +++ b/none/tests/ppc64/test_mod_instructions.stdout.exp @@ -0,0 +1,824 @@ +modsw result = 0 +modsw result = -1 +modsw result = -2 +modsw result = -3 +modsw result = -4 +modsw result = -5 +modsw result = -6 +modsw result = -7 +modsw result = -2147483647 +modsw result = 0 +modsw result = -1 +modsw result = -2 +modsw result = -3 +modsw result = -4 +modsw result = -5 +modsw result = -6 +modsw result = -2147483646 +modsw result = -2147483646 +modsw result = 0 +modsw result = -1 +modsw result = -2 +modsw result = -3 +modsw result = -4 +modsw result = -5 +modsw result = -2147483645 +modsw result = -2147483645 +modsw result = -2147483645 +modsw result = 0 +modsw result = -1 +modsw result = -2 +modsw result = -3 +modsw result = -4 +modsw result = -2147483644 +modsw result = -2147483644 +modsw result = -2147483644 +modsw result = -2147483644 +modsw result = 0 +modsw result = -1 +modsw result = -2 +modsw result = -3 +modsw result = -2147483643 +modsw result = -2147483643 +modsw result = -2147483643 +modsw result = -2147483643 +modsw result = -2147483643 +modsw result = 0 +modsw result = -1 +modsw result = -2 +modsw result = -2147483642 +modsw result = -2147483642 +modsw result = -2147483642 +modsw result = -2147483642 +modsw result = -2147483642 +modsw result = -2147483642 +modsw result = 0 +modsw result = -1 +modsw result = -2147483641 +modsw result = -2147483641 +modsw result = -2147483641 +modsw result = -2147483641 +modsw result = -2147483641 +modsw result = -2147483641 +modsw result = -2147483641 +modsw result = 0 +modsw result = 0 +modsw result = -1 +modsw result = -2 +modsw result = -1 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = -1 +modsw result = -2 +modsw result = -1 +modsw result = -4 +modsw result = 0 +modsw result = -1 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = -1 +modsw result = 0 +modsw result = -3 +modsw result = -3 +modsw result = 0 +modsw result = -1 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = -1 +modsw result = 0 +modsw result = -3 +modsw result = -2 +modsw result = -2 +modsw result = -2 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = -2 +modsw result = -2 +modsw result = -1 +modsw result = -1 +modsw result = -1 +modsw result = -1 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = -1 +modsw result = -1 +modsw result = -1 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 1 +modsw result = 1 +modsw result = 1 +modsw result = 1 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 1 +modsw result = 1 +modsw result = 1 +modsw result = 2 +modsw result = 2 +modsw result = 2 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 2 +modsw result = 2 +modsw result = 3 +modsw result = 3 +modsw result = 0 +modsw result = 1 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 1 +modsw result = 0 +modsw result = 3 +modsw result = 4 +modsw result = 0 +modsw result = 1 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 0 +modsw result = 1 +modsw result = 0 +modsw result = 0 +modsw result = 2147483640 +modsw result = 2147483640 +modsw result = 2147483640 +modsw result = 2147483640 +modsw result = 2147483640 +modsw result = 2147483640 +modsw result = 1 +modsw result = 0 +modsw result = 2147483641 +modsw result = 2147483641 +modsw result = 2147483641 +modsw result = 2147483641 +modsw result = 2147483641 +modsw result = 2 +modsw result = 1 +modsw result = 0 +modsw result = 2147483642 +modsw result = 2147483642 +modsw result = 2147483642 +modsw result = 2147483642 +modsw result = 3 +modsw result = 2 +modsw result = 1 +modsw result = 0 +modsw result = 2147483643 +modsw result = 2147483643 +modsw result = 2147483643 +modsw result = 4 +modsw result = 3 +modsw result = 2 +modsw result = 1 +modsw result = 0 +modsw result = 2147483644 +modsw result = 2147483644 +modsw result = 5 +modsw result = 4 +modsw result = 3 +modsw result = 2 +modsw result = 1 +modsw result = 0 +modsw result = 2147483645 +modsw result = 6 +modsw result = 5 +modsw result = 4 +modsw result = 3 +modsw result = 2 +modsw result = 1 +modsw result = 0 +modsd result = 0 +modsd result = -1 +modsd result = -2 +modsd result = -3 +modsd result = -4 +modsd result = -5 +modsd result = -6 +modsd result = -7 +modsd result = -9223372036854775807 +modsd result = 0 +modsd result = -1 +modsd result = -2 +modsd result = -3 +modsd result = -4 +modsd result = -5 +modsd result = -6 +modsd result = -9223372036854775806 +modsd result = -9223372036854775806 +modsd result = 0 +modsd result = -1 +modsd result = -2 +modsd result = -3 +modsd result = -4 +modsd result = -5 +modsd result = -9223372036854775805 +modsd result = -9223372036854775805 +modsd result = -9223372036854775805 +modsd result = 0 +modsd result = -1 +modsd result = -2 +modsd result = -3 +modsd result = -4 +modsd result = -9223372036854775804 +modsd result = -9223372036854775804 +modsd result = -9223372036854775804 +modsd result = -9223372036854775804 +modsd result = 0 +modsd result = -1 +modsd result = -2 +modsd result = -3 +modsd result = -9223372036854775803 +modsd result = -9223372036854775803 +modsd result = -9223372036854775803 +modsd result = -9223372036854775803 +modsd result = -9223372036854775803 +modsd result = 0 +modsd result = -1 +modsd result = -2 +modsd result = -9223372036854775802 +modsd result = -9223372036854775802 +modsd result = -9223372036854775802 +modsd result = -9223372036854775802 +modsd result = -9223372036854775802 +modsd result = -9223372036854775802 +modsd result = 0 +modsd result = -1 +modsd result = -9223372036854775801 +modsd result = -9223372036854775801 +modsd result = -9223372036854775801 +modsd result = -9223372036854775801 +modsd result = -9223372036854775801 +modsd result = -9223372036854775801 +modsd result = -9223372036854775801 +modsd result = 0 +modsd result = 0 +modsd result = -1 +modsd result = -2 +modsd result = -1 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = -1 +modsd result = -2 +modsd result = -1 +modsd result = -4 +modsd result = 0 +modsd result = -1 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = -1 +modsd result = 0 +modsd result = -3 +modsd result = -3 +modsd result = 0 +modsd result = -1 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = -1 +modsd result = 0 +modsd result = -3 +modsd result = -2 +modsd result = -2 +modsd result = -2 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = -2 +modsd result = -2 +modsd result = -1 +modsd result = -1 +modsd result = -1 +modsd result = -1 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = -1 +modsd result = -1 +modsd result = -1 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 1 +modsd result = 1 +modsd result = 1 +modsd result = 1 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 1 +modsd result = 1 +modsd result = 1 +modsd result = 2 +modsd result = 2 +modsd result = 2 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 2 +modsd result = 2 +modsd result = 3 +modsd result = 3 +modsd result = 0 +modsd result = 1 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 1 +modsd result = 0 +modsd result = 3 +modsd result = 4 +modsd result = 0 +modsd result = 1 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 0 +modsd result = 1 +modsd result = 0 +modsd result = 0 +modsd result = 9223372036854775800 +modsd result = 9223372036854775800 +modsd result = 9223372036854775800 +modsd result = 9223372036854775800 +modsd result = 9223372036854775800 +modsd result = 9223372036854775800 +modsd result = 1 +modsd result = 0 +modsd result = 9223372036854775801 +modsd result = 9223372036854775801 +modsd result = 9223372036854775801 +modsd result = 9223372036854775801 +modsd result = 9223372036854775801 +modsd result = 2 +modsd result = 1 +modsd result = 0 +modsd result = 9223372036854775802 +modsd result = 9223372036854775802 +modsd result = 9223372036854775802 +modsd result = 9223372036854775802 +modsd result = 3 +modsd result = 2 +modsd result = 1 +modsd result = 0 +modsd result = 9223372036854775803 +modsd result = 9223372036854775803 +modsd result = 9223372036854775803 +modsd result = 4 +modsd result = 3 +modsd result = 2 +modsd result = 1 +modsd result = 0 +modsd result = 9223372036854775804 +modsd result = 9223372036854775804 +modsd result = 5 +modsd result = 4 +modsd result = 3 +modsd result = 2 +modsd result = 1 +modsd result = 0 +modsd result = 9223372036854775805 +modsd result = 6 +modsd result = 5 +modsd result = 4 +modsd result = 3 +modsd result = 2 +modsd result = 1 +modsd result = 0 +moduw result = 0 +moduw result = 4294967288 +moduw result = 4294967288 +moduw result = 4294967288 +moduw result = 4294967288 +moduw result = 4294967288 +moduw result = 4294967288 +moduw result = 1 +moduw result = 0 +moduw result = 4294967289 +moduw result = 4294967289 +moduw result = 4294967289 +moduw result = 4294967289 +moduw result = 4294967289 +moduw result = 2 +moduw result = 1 +moduw result = 0 +moduw result = 4294967290 +moduw result = 4294967290 +moduw result = 4294967290 +moduw result = 4294967290 +moduw result = 3 +moduw result = 2 +moduw result = 1 +moduw result = 0 +moduw result = 4294967291 +moduw result = 4294967291 +moduw result = 4294967291 +moduw result = 4 +moduw result = 3 +moduw result = 2 +moduw result = 1 +moduw result = 0 +moduw result = 4294967292 +moduw result = 4294967292 +moduw result = 5 +moduw result = 4 +moduw result = 3 +moduw result = 2 +moduw result = 1 +moduw result = 0 +moduw result = 4294967293 +moduw result = 6 +moduw result = 5 +moduw result = 4 +moduw result = 3 +moduw result = 2 +moduw result = 1 +moduw result = 0 +moduw result = 0 + +moduw result = 4294967291 + +moduw result = 4294967291 + +moduw result = 4294967291 + +moduw result = 4294967291 + +moduw result = 0 + +moduw result = 0 + +moduw result = 1 + +moduw result = 2 + +moduw result = 3 + +moduw result = 1 + +moduw result = 0 + +moduw result = 4294967292 + +moduw result = 4294967292 + +moduw result = 4294967292 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 2 + +moduw result = 1 + +moduw result = 0 + +moduw result = 4294967293 + +moduw result = 4294967293 + +moduw result = 0 + +moduw result = 0 + +moduw result = 1 + +moduw result = 1 + +moduw result = 1 + +moduw result = 3 + +moduw result = 2 + +moduw result = 1 + +moduw result = 0 + +moduw result = 4294967294 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 2 + +moduw result = 2 + +moduw result = 4 + +moduw result = 3 + +moduw result = 2 + +moduw result = 1 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 1 + +moduw result = 0 + +moduw result = 3 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 1 + +moduw result = 1 + +moduw result = 1 + +moduw result = 1 + +moduw result = 1 + +moduw result = 0 + +moduw result = 0 + +moduw result = 1 + +moduw result = 1 + +moduw result = 1 + +moduw result = 2 + +moduw result = 2 + +moduw result = 2 + +moduw result = 2 + +moduw result = 2 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 2 + +moduw result = 2 + +moduw result = 3 + +moduw result = 3 + +moduw result = 3 + +moduw result = 3 + +moduw result = 3 + +moduw result = 0 + +moduw result = 0 + +moduw result = 1 + +moduw result = 0 + +moduw result = 3 + +moduw result = 4 + +moduw result = 4 + +moduw result = 4 + +moduw result = 4 + +moduw result = 4 + +moduw result = 0 + +moduw result = 0 + +moduw result = 0 + +moduw result = 1 + +moduw result = 0 + +modud result = 0 +modud result = 18446744073709551608 +modud result = 18446744073709551608 +modud result = 18446744073709551608 +modud result = 18446744073709551608 +modud result = 18446744073709551608 +modud result = 18446744073709551608 +modud result = 1 +modud result = 0 +modud result = 18446744073709551609 +modud result = 18446744073709551609 +modud result = 18446744073709551609 +modud result = 18446744073709551609 +modud result = 18446744073709551609 +modud result = 2 +modud result = 1 +modud result = 0 +modud result = 18446744073709551610 +modud result = 18446744073709551610 +modud result = 18446744073709551610 +modud result = 18446744073709551610 +modud result = 3 +modud result = 2 +modud result = 1 +modud result = 0 +modud result = 18446744073709551611 +modud result = 18446744073709551611 +modud result = 18446744073709551611 +modud result = 4 +modud result = 3 +modud result = 2 +modud result = 1 +modud result = 0 +modud result = 18446744073709551612 +modud result = 18446744073709551612 +modud result = 5 +modud result = 4 +modud result = 3 +modud result = 2 +modud result = 1 +modud result = 0 +modud result = 18446744073709551613 +modud result = 6 +modud result = 5 +modud result = 4 +modud result = 3 +modud result = 2 +modud result = 1 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 1 +modud result = 1 +modud result = 1 +modud result = 1 +modud result = 1 +modud result = 1 +modud result = 1 +modud result = 1 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 2 +modud result = 2 +modud result = 2 +modud result = 2 +modud result = 2 +modud result = 2 +modud result = 2 +modud result = 0 +modud result = 0 +modud result = 1 +modud result = 0 +modud result = 3 +modud result = 3 +modud result = 3 +modud result = 3 +modud result = 3 +modud result = 3 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 1 +modud result = 0 +modud result = 4 +modud result = 4 +modud result = 4 +modud result = 4 +modud result = 4 +modud result = 0 +modud result = 0 +modud result = 1 +modud result = 2 +modud result = 1 +modud result = 0 +modud result = 5 +modud result = 5 +modud result = 5 +modud result = 5 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 2 +modud result = 1 +modud result = 0 +modud result = 6 +modud result = 6 +modud result = 6 +modud result = 0 +modud result = 0 +modud result = 1 +modud result = 1 +modud result = 3 +modud result = 2 +modud result = 1 +modud result = 0 +modud result = 7 +modud result = 7 +modud result = 0 +modud result = 0 +modud result = 0 +modud result = 2 +modud result = 0 +modud result = 3 +modud result = 2 +modud result = 1 +modud result = 0 +modud result = 8 +modud result = 0 +modud result = 0 +modud result = 1 +modud result = 0 +modud result = 1 +modud result = 4 +modud result = 3 +modud result = 2 +modud result = 1 +modud result = 0 diff --git a/none/tests/ppc64/test_mod_instructions.vgtest b/none/tests/ppc64/test_mod_instructions.vgtest new file mode 100644 index 0000000000..d281fcc60b --- /dev/null +++ b/none/tests/ppc64/test_mod_instructions.vgtest @@ -0,0 +1,2 @@ +prereq: ../../../tests/check_ppc64_auxv_cap arch_3_00 +prog: test_mod_instructions |
|
From: Mark W. <ma...@so...> - 2021-02-11 17:41:52
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=208f2d96069574e7a75cb3f8e53adb216e4795b9 commit 208f2d96069574e7a75cb3f8e53adb216e4795b9 Author: Mark Wielaard <ma...@kl...> Date: Thu Feb 11 18:29:52 2021 +0100 vg_regtest: test-specific environment variables not reset between tests Test-specific environment variables set in .vgtest files are not reset between tests. This can result in tests running with environment variables intended for a previously run test. This can be easily fixed by clearing the @env and @envB arrays in tests/vg_regtest:read_vgtest_file() Original patch by Aaron Merey <am...@re...> https://bugs.kde.org/show_bug.cgi?id=432672 Diff: --- NEWS | 1 + tests/vg_regtest.in | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index cd372235f2..3e0f5a0bd3 100644 --- a/NEWS +++ b/NEWS @@ -87,6 +87,7 @@ n-i-bz helgrind: If hg_cli__realloc fails, return NULL. diagnostics 430354 ppc stxsibx and stxsihx instructions write too much data 430485 expr_is_guardable doesn't handle Iex_Qop +432672 vg_regtest: test-specific environment variables not reset between tests Release 3.16.1 (?? June 2020) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in index 5803b86f59..c7cc60124b 100755 --- a/tests/vg_regtest.in +++ b/tests/vg_regtest.in @@ -300,9 +300,9 @@ sub read_vgtest_file($) my ($f) = @_; # Defaults. - ($vgopts, $prog, $args) = ("", undef, ""); + ($vgopts, $prog, $args, @env) = ("", undef, "", ()); ($stdout_filter, $stderr_filter) = (undef, undef); - ($progB, $argsB, $stdinB) = (undef, "", undef); + ($progB, $argsB, $stdinB, @envB) = (undef, "", undef, ()); ($stdoutB_filter, $stderrB_filter) = (undef, undef); ($prereq, $post, $cleanup) = (undef, undef, undef); ($stdout_filter_args, $stderr_filter_args) = (undef, undef); |
|
From: Mark W. <ma...@so...> - 2021-02-10 20:36:16
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=c9781cc97e719c1ecf0cfad9ca2f86631c017268 commit c9781cc97e719c1ecf0cfad9ca2f86631c017268 Author: Mark Wielaard <ma...@kl...> Date: Mon Feb 8 00:25:52 2021 +0100 PR140939 --track-fds reports leakage of stdout/in/err and doesn't respect -q Make --track-fds=yes not report on file descriptors 0, 1, and 2 (stdin, stdout, and stderr) by default. Add a new option --track-fds=all that does report on the std file descriptors still being open. Update testsuite and documentation. Original patch by Peter Kelly <pm...@cs...> Updated by Daniel Fahlgren <da...@fa...> https://bugs.kde.org/show_bug.cgi?id=140939 Diff: --- NEWS | 1 + coregrind/m_gdbserver/server.c | 4 ++-- coregrind/m_main.c | 15 +++++++++++++-- coregrind/m_options.c | 2 +- coregrind/m_syswrap/syswrap-generic.c | 25 ++++++++++++++++++++----- coregrind/pub_core_options.h | 4 ++-- docs/xml/manual-core-adv.xml | 8 ++++++-- docs/xml/manual-core.xml | 7 +++++-- gdbserver_tests/mchelp.stdoutB.exp | 4 ++-- gdbserver_tests/mssnapshot.stderrB.exp | 2 +- none/tests/cmdline1.stdout.exp | 3 ++- none/tests/cmdline2.stdout.exp | 3 ++- none/tests/fdleak_cmsg.stderr.exp | 4 ++-- none/tests/fdleak_cmsg.vgtest | 2 +- none/tests/fdleak_creat.stderr.exp | 2 +- none/tests/fdleak_creat.vgtest | 2 +- none/tests/fdleak_dup.stderr.exp | 2 +- none/tests/fdleak_dup.vgtest | 2 +- none/tests/fdleak_dup2.stderr.exp | 2 +- none/tests/fdleak_dup2.vgtest | 2 +- none/tests/fdleak_fcntl.stderr.exp | 2 +- none/tests/fdleak_fcntl.vgtest | 2 +- none/tests/fdleak_ipv4.stderr.exp | 22 ++-------------------- none/tests/fdleak_open.stderr.exp | 11 +---------- none/tests/fdleak_pipe.stderr.exp | 11 +---------- none/tests/fdleak_socketpair.stderr.exp | 11 +---------- 26 files changed, 73 insertions(+), 82 deletions(-) diff --git a/NEWS b/NEWS index 5342336ecc..cd372235f2 100644 --- a/NEWS +++ b/NEWS @@ -52,6 +52,7 @@ To see details of a given bug, visit where XXXXXX is the bug number as listed below. 140178 open("/proc/self/exe", ...); doesn't quite work +140939 --track-fds reports leakage of stdout/in/err and doesn't respect -q 345077 linux syscall execveat support (linux 3.19) 369029 handle linux syscalls sched_getattr and sched_setattr n-i-bz helgrind: If hg_cli__realloc fails, return NULL. diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c index cc809a8b63..8e4bae8567 100644 --- a/coregrind/m_gdbserver/server.c +++ b/coregrind/m_gdbserver/server.c @@ -234,7 +234,7 @@ int handle_gdb_valgrind_command (char *mon, OutputSink *sink_wanted_at_return) " v.info last_error : show last error found\n" " v.info location <addr> : show information about location <addr>\n" " v.info n_errs_found [msg] : show the nr of errors found so far and the given msg\n" -" v.info open_fds : show open file descriptors (only if --track-fds=yes)\n" +" v.info open_fds : show open file descriptors (only if --track-fds=[yes|all])\n" " v.kill : kill the Valgrind process\n" " v.clo <clo_option>... : changes one or more dynamic command line options\n" " with no clo_option, show the dynamically changeable options.\n" @@ -427,7 +427,7 @@ int handle_gdb_valgrind_command (char *mon, OutputSink *sink_wanted_at_return) VG_(show_open_fds) (""); else VG_(gdb_printf) - ("Valgrind must be started with --track-fds=yes" + ("Valgrind must be started with --track-fds=[yes|all]" " to show open fds\n"); ret = 1; break; diff --git a/coregrind/m_main.c b/coregrind/m_main.c index c182fd90e9..68edc4d499 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -110,7 +110,8 @@ static void usage_NORETURN ( int need_help ) " --vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none]\n" " where event is one of:\n" " startup exit valgrindabexit all none\n" -" --track-fds=no|yes track open file descriptors? [no]\n" +" --track-fds=no|yes|all track open file descriptors? [no]\n" +" all includes reporting stdin, stdout and stderr\n" " --time-stamp=no|yes add timestamps to log messages? [no]\n" " --log-fd=<number> log messages to file descriptor [2=stderr]\n" " --log-file=<file> log messages to <file>\n" @@ -600,7 +601,17 @@ static void process_option (Clo_Mode mode, else if VG_BOOL_CLOM(cloPD, arg, "--show-below-main", VG_(clo_show_below_main)) {} else if VG_BOOL_CLO(arg, "--keep-debuginfo", VG_(clo_keep_debuginfo)) {} else if VG_BOOL_CLOM(cloPD, arg, "--time-stamp", VG_(clo_time_stamp)) {} - else if VG_BOOL_CLO(arg, "--track-fds", VG_(clo_track_fds)) {} + else if VG_STR_CLO(arg, "--track-fds", tmp_str) { + if (VG_(strcmp)(tmp_str, "yes") == 0) + VG_(clo_track_fds) = 1; + else if (VG_(strcmp)(tmp_str, "all") == 0) + VG_(clo_track_fds) = 2; + else if (VG_(strcmp)(tmp_str, "no") == 0) + VG_(clo_track_fds) = 0; + else + VG_(fmsg_bad_option)(arg, + "Bad argument, should be 'yes', 'all' or 'no'\n"); + } else if VG_BOOL_CLOM(cloPD, arg, "--trace-children", VG_(clo_trace_children)) {} else if VG_BOOL_CLOM(cloPD, arg, "--child-silent-after-fork", VG_(clo_child_silent_after_fork)) {} diff --git a/coregrind/m_options.c b/coregrind/m_options.c index 10641d4faa..688523324e 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -172,7 +172,7 @@ Bool VG_(clo_read_var_info) = False; XArray *VG_(clo_req_tsyms); // array of strings Bool VG_(clo_run_libc_freeres) = True; Bool VG_(clo_run_cxx_freeres) = True; -Bool VG_(clo_track_fds) = False; +UInt VG_(clo_track_fds) = 0; Bool VG_(clo_show_below_main)= False; Bool VG_(clo_keep_debuginfo) = False; Bool VG_(clo_show_emwarns) = False; diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 3810f74744..0739ccc9af 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -823,11 +823,28 @@ getsockdetails(Int fd) /* Dump out a summary, and a more detailed list, of open file descriptors. */ void VG_(show_open_fds) (const HChar* when) { - OpenFd *i = allocated_fds; + OpenFd *i; + int non_std = 0; - VG_(message)(Vg_UserMsg, "FILE DESCRIPTORS: %d open %s.\n", fd_count, when); + for (i = allocated_fds; i; i = i->next) { + if (i->fd > 2) + non_std++; + } + + /* If we are running quiet and there are either no open file descriptors + or not tracking all fds, then don't report anything. */ + if ((fd_count == 0 + || ((non_std == 0) && (VG_(clo_track_fds) < 2))) + && (VG_(clo_verbosity) == 0)) + return; + + VG_(message)(Vg_UserMsg, "FILE DESCRIPTORS: %d open (%d std) %s.\n", + fd_count, fd_count - non_std, when); + + for (i = allocated_fds; i; i = i->next) { + if (i->fd <= 2 && VG_(clo_track_fds) < 2) + continue; - while (i) { if (i->pathname) { VG_(message)(Vg_UserMsg, "Open file descriptor %d: %s\n", i->fd, i->pathname); @@ -850,8 +867,6 @@ void VG_(show_open_fds) (const HChar* when) VG_(message)(Vg_UserMsg, " <inherited from parent>\n"); VG_(message)(Vg_UserMsg, "\n"); } - - i = i->next; } VG_(message)(Vg_UserMsg, "\n"); diff --git a/coregrind/pub_core_options.h b/coregrind/pub_core_options.h index 136c0ff6e0..5dd01addcc 100644 --- a/coregrind/pub_core_options.h +++ b/coregrind/pub_core_options.h @@ -283,8 +283,8 @@ extern const HChar* VG_(clo_prefix_to_strip); wildcards. */ extern XArray *VG_(clo_req_tsyms); -/* Track open file descriptors? */ -extern Bool VG_(clo_track_fds); +/* Track open file descriptors? 0 = No, 1 = Yes, 2 = All (including std) */ +extern UInt VG_(clo_track_fds); /* Should we run __libc_freeres at exit? Sometimes causes crashes. Default: YES. Note this is subservient to VG_(needs).libc_freeres; diff --git a/docs/xml/manual-core-adv.xml b/docs/xml/manual-core-adv.xml index 8d2e905e42..1fa801edc1 100644 --- a/docs/xml/manual-core-adv.xml +++ b/docs/xml/manual-core-adv.xml @@ -1371,8 +1371,12 @@ client request. <listitem> <para><varname>v.info open_fds</varname> shows the list of open file descriptors and details related to the file descriptor. - This only works if <option>--track-fds=yes</option> - was given at Valgrind startup.</para> + This only works if <option>--track-fds=yes</option> or + <option>--track-fds=all</option> (to include + <computeroutput>stdin</computeroutput>, + <computeroutput>stdout</computeroutput> and + <computeroutput>stderr</computeroutput>) was given at Valgrindr + startup.</para> </listitem> <listitem> diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml index 2e90ab7b8c..5d52d2e3be 100644 --- a/docs/xml/manual-core.xml +++ b/docs/xml/manual-core.xml @@ -852,7 +852,7 @@ in most cases. We group the available options by rough categories.</para> <varlistentry id="opt.track-fds" xreflabel="--track-fds"> <term> - <option><![CDATA[--track-fds=<yes|no> [default: no] ]]></option> + <option><![CDATA[--track-fds=<yes|no|all> [default: no] ]]></option> </term> <listitem> <para>When enabled, Valgrind will print out a list of open file @@ -860,7 +860,10 @@ in most cases. We group the available options by rough categories.</para> command <varname>v.info open_fds</varname>. Along with each file descriptor is printed a stack backtrace of where the file was opened and any details relating to the file descriptor such - as the file name or socket details.</para> + as the file name or socket details. Use <option>all</option> to + include reporting on <computeroutput>stdin</computeroutput>, + <computeroutput>stdout</computeroutput> and + <computeroutput>stderr</computeroutput>.</para> </listitem> </varlistentry> diff --git a/gdbserver_tests/mchelp.stdoutB.exp b/gdbserver_tests/mchelp.stdoutB.exp index f8582de345..6f45932d10 100644 --- a/gdbserver_tests/mchelp.stdoutB.exp +++ b/gdbserver_tests/mchelp.stdoutB.exp @@ -5,7 +5,7 @@ general valgrind monitor commands: v.info last_error : show last error found v.info location <addr> : show information about location <addr> v.info n_errs_found [msg] : show the nr of errors found so far and the given msg - v.info open_fds : show open file descriptors (only if --track-fds=yes) + v.info open_fds : show open file descriptors (only if --track-fds=[yes|all]) v.kill : kill the Valgrind process v.clo <clo_option>... : changes one or more dynamic command line options with no clo_option, show the dynamically changeable options. @@ -64,7 +64,7 @@ general valgrind monitor commands: v.info last_error : show last error found v.info location <addr> : show information about location <addr> v.info n_errs_found [msg] : show the nr of errors found so far and the given msg - v.info open_fds : show open file descriptors (only if --track-fds=yes) + v.info open_fds : show open file descriptors (only if --track-fds=[yes|all]) v.kill : kill the Valgrind process v.clo <clo_option>... : changes one or more dynamic command line options with no clo_option, show the dynamically changeable options. diff --git a/gdbserver_tests/mssnapshot.stderrB.exp b/gdbserver_tests/mssnapshot.stderrB.exp index 067303ef14..8d463a4a71 100644 --- a/gdbserver_tests/mssnapshot.stderrB.exp +++ b/gdbserver_tests/mssnapshot.stderrB.exp @@ -6,7 +6,7 @@ general valgrind monitor commands: v.info last_error : show last error found v.info location <addr> : show information about location <addr> v.info n_errs_found [msg] : show the nr of errors found so far and the given msg - v.info open_fds : show open file descriptors (only if --track-fds=yes) + v.info open_fds : show open file descriptors (only if --track-fds=[yes|all]) v.kill : kill the Valgrind process v.clo <clo_option>... : changes one or more dynamic command line options with no clo_option, show the dynamically changeable options. diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp index 4b98743a66..7f05709548 100644 --- a/none/tests/cmdline1.stdout.exp +++ b/none/tests/cmdline1.stdout.exp @@ -25,7 +25,8 @@ usage: valgrind [options] prog-and-args --vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none] where event is one of: startup exit valgrindabexit all none - --track-fds=no|yes track open file descriptors? [no] + --track-fds=no|yes|all track open file descriptors? [no] + all includes reporting stdin, stdout and stderr --time-stamp=no|yes add timestamps to log messages? [no] --log-fd=<number> log messages to file descriptor [2=stderr] --log-file=<file> log messages to <file> diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index 9e8e3df01f..7c8a23f8b0 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -25,7 +25,8 @@ usage: valgrind [options] prog-and-args --vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none] where event is one of: startup exit valgrindabexit all none - --track-fds=no|yes track open file descriptors? [no] + --track-fds=no|yes|all track open file descriptors? [no] + all includes reporting stdin, stdout and stderr --time-stamp=no|yes add timestamps to log messages? [no] --log-fd=<number> log messages to file descriptor [2=stderr] --log-file=<file> log messages to <file> diff --git a/none/tests/fdleak_cmsg.stderr.exp b/none/tests/fdleak_cmsg.stderr.exp index 6e5a797b9f..0fe56eaeed 100644 --- a/none/tests/fdleak_cmsg.stderr.exp +++ b/none/tests/fdleak_cmsg.stderr.exp @@ -1,6 +1,6 @@ -FILE DESCRIPTORS: 7 open at exit. +FILE DESCRIPTORS: 7 open (3 std) at exit. Open AF_UNIX socket ...: /tmp/sock ... @@ -24,7 +24,7 @@ Open file descriptor ...: /dev/null -FILE DESCRIPTORS: 6 open at exit. +FILE DESCRIPTORS: 6 open (3 std) at exit. Open file descriptor ...: /tmp/data2 ... diff --git a/none/tests/fdleak_cmsg.vgtest b/none/tests/fdleak_cmsg.vgtest index 5083320443..4b4bd8ab06 100644 --- a/none/tests/fdleak_cmsg.vgtest +++ b/none/tests/fdleak_cmsg.vgtest @@ -1,4 +1,4 @@ prog: fdleak_cmsg -vgopts: --track-fds=yes +vgopts: --track-fds=all stderr_filter: filter_fdleak args: < /dev/null diff --git a/none/tests/fdleak_creat.stderr.exp b/none/tests/fdleak_creat.stderr.exp index e7a6e918af..7b70478b9d 100644 --- a/none/tests/fdleak_creat.stderr.exp +++ b/none/tests/fdleak_creat.stderr.exp @@ -1,6 +1,6 @@ -FILE DESCRIPTORS: 4 open at exit. +FILE DESCRIPTORS: 4 open (3 std) at exit. Open file descriptor ...: /tmp/file ... diff --git a/none/tests/fdleak_creat.vgtest b/none/tests/fdleak_creat.vgtest index ffa412a456..25c243e024 100644 --- a/none/tests/fdleak_creat.vgtest +++ b/none/tests/fdleak_creat.vgtest @@ -1,4 +1,4 @@ prog: fdleak_creat -vgopts: --track-fds=yes +vgopts: --track-fds=all stderr_filter: filter_fdleak args: < /dev/null diff --git a/none/tests/fdleak_dup.stderr.exp b/none/tests/fdleak_dup.stderr.exp index 7737a7d9dc..8ceada9230 100644 --- a/none/tests/fdleak_dup.stderr.exp +++ b/none/tests/fdleak_dup.stderr.exp @@ -1,6 +1,6 @@ -FILE DESCRIPTORS: 5 open at exit. +FILE DESCRIPTORS: 5 open (3 std) at exit. Open file descriptor ...: /dev/null ... diff --git a/none/tests/fdleak_dup.vgtest b/none/tests/fdleak_dup.vgtest index d150dfef0a..012fbe02eb 100644 --- a/none/tests/fdleak_dup.vgtest +++ b/none/tests/fdleak_dup.vgtest @@ -1,4 +1,4 @@ prog: fdleak_dup -vgopts: --track-fds=yes +vgopts: --track-fds=all stderr_filter: filter_fdleak args: < /dev/null diff --git a/none/tests/fdleak_dup2.stderr.exp b/none/tests/fdleak_dup2.stderr.exp index 98d61a92a4..4576a578b3 100644 --- a/none/tests/fdleak_dup2.stderr.exp +++ b/none/tests/fdleak_dup2.stderr.exp @@ -1,6 +1,6 @@ -FILE DESCRIPTORS: 6 open at exit. +FILE DESCRIPTORS: 6 open (3 std) at exit. Open file descriptor ...: /dev/null ... diff --git a/none/tests/fdleak_dup2.vgtest b/none/tests/fdleak_dup2.vgtest index 7b0d95eeac..8d5e287b8e 100644 --- a/none/tests/fdleak_dup2.vgtest +++ b/none/tests/fdleak_dup2.vgtest @@ -1,4 +1,4 @@ prog: fdleak_dup2 -vgopts: --track-fds=yes +vgopts: --track-fds=all stderr_filter: filter_fdleak args: < /dev/null diff --git a/none/tests/fdleak_fcntl.stderr.exp b/none/tests/fdleak_fcntl.stderr.exp index 7737a7d9dc..8ceada9230 100644 --- a/none/tests/fdleak_fcntl.stderr.exp +++ b/none/tests/fdleak_fcntl.stderr.exp @@ -1,6 +1,6 @@ -FILE DESCRIPTORS: 5 open at exit. +FILE DESCRIPTORS: 5 open (3 std) at exit. Open file descriptor ...: /dev/null ... diff --git a/none/tests/fdleak_fcntl.vgtest b/none/tests/fdleak_fcntl.vgtest index 5b506eaafc..9ee14740be 100644 --- a/none/tests/fdleak_fcntl.vgtest +++ b/none/tests/fdleak_fcntl.vgtest @@ -1,4 +1,4 @@ prog: fdleak_fcntl -vgopts: --track-fds=yes +vgopts: --track-fds=all stderr_filter: filter_fdleak args: < /dev/null diff --git a/none/tests/fdleak_ipv4.stderr.exp b/none/tests/fdleak_ipv4.stderr.exp index 80c62019f1..72c2b46859 100644 --- a/none/tests/fdleak_ipv4.stderr.exp +++ b/none/tests/fdleak_ipv4.stderr.exp @@ -1,34 +1,16 @@ -FILE DESCRIPTORS: 5 open at exit. +FILE DESCRIPTORS: 5 open (3 std) at exit. Open AF_INET socket 4: 127.0.0.1:... <-> 127.0.0.1:... ... Open AF_INET socket 3: 127.0.0.1:... <-> unbound ... -Open file descriptor ...: ... - <inherited from parent> -Open file descriptor ...: ... - <inherited from parent> -Open file descriptor ...: /dev/null - <inherited from parent> - - - -FILE DESCRIPTORS: 4 open at exit. +FILE DESCRIPTORS: 4 open (3 std) at exit. Open AF_INET socket 3: 127.0.0.1:... <-> 127.0.0.1:... ... -Open file descriptor ...: ... - <inherited from parent> - -Open file descriptor ...: ... - <inherited from parent> - -Open file descriptor ...: /dev/null - <inherited from parent> - diff --git a/none/tests/fdleak_open.stderr.exp b/none/tests/fdleak_open.stderr.exp index 948ed97d4e..f3f51167f1 100644 --- a/none/tests/fdleak_open.stderr.exp +++ b/none/tests/fdleak_open.stderr.exp @@ -1,16 +1,7 @@ -FILE DESCRIPTORS: 4 open at exit. +FILE DESCRIPTORS: 4 open (3 std) at exit. Open file descriptor ...: /dev/null ... -Open file descriptor ...: ... - <inherited from parent> - -Open file descriptor ...: ... - <inherited from parent> - -Open file descriptor ...: /dev/null - <inherited from parent> - diff --git a/none/tests/fdleak_pipe.stderr.exp b/none/tests/fdleak_pipe.stderr.exp index 832fd7e11c..5f92ea69c2 100644 --- a/none/tests/fdleak_pipe.stderr.exp +++ b/none/tests/fdleak_pipe.stderr.exp @@ -1,19 +1,10 @@ -FILE DESCRIPTORS: 5 open at exit. +FILE DESCRIPTORS: 5 open (3 std) at exit. Open file descriptor ...: ... Open file descriptor ...: ... -Open file descriptor ...: ... - <inherited from parent> - -Open file descriptor ...: ... - <inherited from parent> - -Open file descriptor ...: /dev/null - <inherited from parent> - diff --git a/none/tests/fdleak_socketpair.stderr.exp b/none/tests/fdleak_socketpair.stderr.exp index 377b1318ee..73832a108b 100644 --- a/none/tests/fdleak_socketpair.stderr.exp +++ b/none/tests/fdleak_socketpair.stderr.exp @@ -1,19 +1,10 @@ -FILE DESCRIPTORS: 5 open at exit. +FILE DESCRIPTORS: 5 open (3 std) at exit. Open AF_UNIX socket ...: <unknown> ... Open AF_UNIX socket ...: <unknown> ... -Open file descriptor ...: ... - <inherited from parent> - -Open file descriptor ...: ... - <inherited from parent> - -Open file descriptor ...: /dev/null - <inherited from parent> - |
|
From: Mark W. <ma...@so...> - 2021-02-07 13:56:42
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=57c823aefea32e1fba3af47d29e66313d0bc13cd commit 57c823aefea32e1fba3af47d29e66313d0bc13cd Author: Mark Wielaard <ma...@kl...> Date: Sat Feb 6 22:02:56 2021 +0100 PR140178 Support opening /proc/self/exe Some programs open /proc/self/exe to read some data. Currently valgrind supports following the /proc/self/exe link (to the original binary, so you could then open that), but directly opening /proc/self/exe will open the valgrind tool, not the executable file itself. Add ML_(handle_self_exe_open) which dups VG_(cl_exec_fd) if the file to open is /proc/self/exe or /proc/<pid>/exe. And do the same for openat. https://bugs.kde.org/show_bug.cgi?id=140178 Diff: --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-generic.h | 4 ++++ coregrind/m_syswrap/syswrap-generic.c | 38 ++++++++++++++++++++++++++++-- coregrind/m_syswrap/syswrap-linux.c | 16 +++++++++++++ 4 files changed, 57 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 57a3c27ec4..5342336ecc 100644 --- a/NEWS +++ b/NEWS @@ -51,6 +51,7 @@ To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX where XXXXXX is the bug number as listed below. +140178 open("/proc/self/exe", ...); doesn't quite work 345077 linux syscall execveat support (linux 3.19) 369029 handle linux syscalls sched_getattr and sched_setattr n-i-bz helgrind: If hg_cli__realloc fails, return NULL. diff --git a/coregrind/m_syswrap/priv_syswrap-generic.h b/coregrind/m_syswrap/priv_syswrap-generic.h index 4717abac65..c50b313999 100644 --- a/coregrind/m_syswrap/priv_syswrap-generic.h +++ b/coregrind/m_syswrap/priv_syswrap-generic.h @@ -106,6 +106,10 @@ extern Bool ML_(handle_auxv_open)(SyscallStatus *status, const HChar *filename, int flags); +extern Bool +ML_(handle_self_exe_open)(SyscallStatus *status, const HChar *filename, + int flags); + /* Helper function for generic mprotect and linux pkey_mprotect. */ extern void handle_sys_mprotect (ThreadId tid, SyscallStatus *status, Addr *addr, SizeT *len, Int *prot); diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 7d4b385a38..3810f74744 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -4078,6 +4078,38 @@ Bool ML_(handle_auxv_open)(SyscallStatus *status, const HChar *filename, } #endif // defined(VGO_linux) || defined(VGO_solaris) +#if defined(VGO_linux) +Bool ML_(handle_self_exe_open)(SyscallStatus *status, const HChar *filename, + int flags) +{ + HChar name[30]; // large enough for /proc/<int>/exe + + if (!ML_(safe_to_deref)((const void *) filename, 1)) + return False; + + /* Opening /proc/<pid>/exe or /proc/self/exe? */ + VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)()); + if (!VG_STREQ(filename, name) && !VG_STREQ(filename, "/proc/self/exe")) + return False; + + /* Allow to open the file only for reading. */ + if (flags & (VKI_O_WRONLY | VKI_O_RDWR)) { + SET_STATUS_Failure(VKI_EACCES); + return True; + } + + SysRes sres = VG_(dup)(VG_(cl_exec_fd)); + SET_STATUS_from_SysRes(sres); + if (!sr_isError(sres)) { + OffT off = VG_(lseek)(sr_Res(sres), 0, VKI_SEEK_SET); + if (off < 0) + SET_STATUS_Failure(VKI_EMFILE); + } + + return True; +} +#endif // defined(VGO_linux) + PRE(sys_open) { if (ARG2 & VKI_O_CREAT) { @@ -4119,8 +4151,10 @@ PRE(sys_open) } } - /* Handle also the case of /proc/self/auxv or /proc/<pid>/auxv. */ - if (ML_(handle_auxv_open)(status, (const HChar *)(Addr)ARG1, ARG2)) + /* Handle also the case of /proc/self/auxv or /proc/<pid>/auxv + or /proc/self/exe or /proc/<pid>/exe. */ + if (ML_(handle_auxv_open)(status, (const HChar *)(Addr)ARG1, ARG2) + || ML_(handle_self_exe_open)(status, (const HChar *)(Addr)ARG1, ARG2)) return; #endif // defined(VGO_linux) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 52074149d7..fcc534454a 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -5745,6 +5745,22 @@ PRE(sys_openat) return; } + /* And for /proc/self/exe or /proc/<pid>/exe case. */ + + VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)()); + if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) + && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0 + || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/exe") == 0)) { + sres = VG_(dup)( VG_(cl_exec_fd) ); + SET_STATUS_from_SysRes( sres ); + if (!sr_isError(sres)) { + OffT off = VG_(lseek)( sr_Res(sres), 0, VKI_SEEK_SET ); + if (off < 0) + SET_STATUS_Failure( VKI_EMFILE ); + } + return; + } + /* Otherwise handle normally */ *flags |= SfMayBlock; } |
|
From: Mark W. <ma...@so...> - 2021-02-04 16:33:29
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=b918f710208889d579026627830a80b24be1513d commit b918f710208889d579026627830a80b24be1513d Author: Mark Wielaard <ma...@kl...> Date: Thu Feb 4 17:21:56 2021 +0100 PR423361 Adds io_uring support on arm64/aarch64 (and all other arches) io_uring syscalls only work on x86/amd64, but they can be enabled on all arches. Based on a patch by Nathan Ringo <nathan@remexre.xyz>. https://bugs.kde.org/show_bug.cgi?id=423361 Diff: --- NEWS | 1 + coregrind/m_syswrap/syswrap-arm-linux.c | 4 ++++ coregrind/m_syswrap/syswrap-arm64-linux.c | 4 ++++ coregrind/m_syswrap/syswrap-mips32-linux.c | 4 ++++ coregrind/m_syswrap/syswrap-mips64-linux.c | 3 +++ coregrind/m_syswrap/syswrap-nanomips-linux.c | 3 +++ coregrind/m_syswrap/syswrap-ppc32-linux.c | 4 ++++ coregrind/m_syswrap/syswrap-ppc64-linux.c | 4 ++++ coregrind/m_syswrap/syswrap-s390x-linux.c | 4 ++++ 9 files changed, 31 insertions(+) diff --git a/NEWS b/NEWS index 2d0409157b..57a3c27ec4 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,7 @@ n-i-bz helgrind: If hg_cli__realloc fails, return NULL. 424298 amd64: Implement RDSEED 426144 Fix "condition variable has not been initialized" on Fedora 33. 423195 PPC ISA 3.1 support is missing, part 1 +423361 Adds io_uring support on arm64/aarch64 (and all other arches) 425232 PPC ISA 3.1 support is missing, part 2 426123 PPC ISA 3.1 support is missing, part 3 427787 Support new faccessat2 linux syscall (439) diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 978aedbe69..428cb7c6fc 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -1047,6 +1047,10 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval_time64), // 423 + 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 + LINX_(__NR_faccessat2, sys_faccessat2), // 439 }; diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index 051d84989b..024ece27f5 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -826,6 +826,10 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_statx, sys_statx), // 397 + 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 + LINX_(__NR_faccessat2, sys_faccessat2), // 439 }; diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index f35fb8bbb4..62b085ea21 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -1132,6 +1132,10 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval_time64), // 423 + 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 + LINX_ (__NR_faccessat2, sys_faccessat2), // 439 }; diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index bd260679c4..b73c03da16 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -812,6 +812,9 @@ static SyscallTableEntry syscall_main_table[] = { LINX_ (__NR_syncfs, sys_syncfs), LINXY (__NR_statx, sys_statx), LINX_ (__NR_setns, sys_setns), + LINXY (__NR_io_uring_setup, sys_io_uring_setup), + LINXY (__NR_io_uring_enter, sys_io_uring_enter), + LINXY (__NR_io_uring_register, sys_io_uring_register), LINX_ (__NR_faccessat2, sys_faccessat2), }; diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index a904745ab1..14127b181a 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -821,6 +821,9 @@ static SyscallTableEntry syscall_main_table[] = { // (__NR_pkey_mprotect, sys_ni_syscall), // (__NR_pkey_alloc, sys_ni_syscall), // (__NR_pkey_free, sys_ni_syscall), + LINXY (__NR_io_uring_setup, sys_io_uring_setup), + LINXY (__NR_io_uring_enter, sys_io_uring_enter), + LINXY (__NR_io_uring_register, sys_io_uring_register), LINX_ (__NR_faccessat2, sys_faccessat2), }; diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index 6ddd482d92..aad14f8ba4 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -1050,6 +1050,10 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval_time64), // 423 + 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 + LINX_(__NR_faccessat2, sys_faccessat2), // 439 }; diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 6f682923bb..eea93a8787 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1015,6 +1015,10 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_statx, sys_statx), // 383 + 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 + LINX_(__NR_faccessat2, sys_faccessat2), // 439 }; diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index c5e4bb9570..af6c4eb210 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -860,6 +860,10 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_statx, sys_statx), // 379 + 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 + LINX_(__NR_faccessat2, sys_faccessat2), // 439 }; |
|
From: Mark W. <ma...@so...> - 2021-02-04 15:52:35
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=f7e87e6ae3497287ceac6ef266d4f10ee8ab3c53 commit f7e87e6ae3497287ceac6ef266d4f10ee8ab3c53 Author: Mark Wielaard <ma...@kl...> Date: Thu Feb 4 16:14:00 2021 +0100 PR422261 platform selection fails for unqualified client name Bug introduced with commit f15beea76 "Fix memory leak in launcher-linux.c" Need to try opening the actual 'client' path, not just the 'clientname' file name. Reported-by: Michael Wojcik <mic...@mi...> https://bugs.kde.org/show_bug.cgi?id=422261 Diff: --- NEWS | 1 + coregrind/launcher-linux.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index e196e8fecd..2d0409157b 100644 --- a/NEWS +++ b/NEWS @@ -63,6 +63,7 @@ n-i-bz helgrind: If hg_cli__realloc fails, return NULL. (actually affected all x86 and nanomips regardless of host bitness) 415293 Incorrect call-graph tracking due to new _dl_runtime_resolve_xsave* 422174 unhandled instruction bytes: 0x48 0xE9 (REX prefixed JMP instruction) +422261 platform selection fails for unqualified client name 422623 epoll_ctl warns for uninitialized padding on non-amd64 64bit arches 423021 PPC: Add missing ISA 3.0 documentation link and HWCAPS test. 424298 amd64: Implement RDSEED diff --git a/coregrind/launcher-linux.c b/coregrind/launcher-linux.c index 7a1224877e..bc95e3c115 100644 --- a/coregrind/launcher-linux.c +++ b/coregrind/launcher-linux.c @@ -158,7 +158,7 @@ static const char *select_platform(const char *clientname) if (strcmp (client, clientname) != 0) VG_(debugLog)(2, "launcher", "selecting platform for '%s'\n", client); - if ((fd = open(clientname, O_RDONLY)) < 0) { + if ((fd = open(client, O_RDONLY)) < 0) { return_null: free (client); return NULL; |