From f54b622a8f60006317abdb54d4fd9dfe0936d421 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 2 May 2025 12:19:11 +0200 Subject: [PATCH 001/412] illumos regtest: filter a gdb warning I only get it when running make test from oi-userland components, not when running make regtest from a shell. Possibly a locale or similar issue. --- NEWS | 30 ++++++++++++++++++++++++++++++ configure.ac | 6 +++--- gdbserver_tests/filter_gdb.in | 3 +++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index cd4670aca..6a15080c1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,33 @@ +Release 3.26.0 (?? Oct 2025) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This release supports X86/Linux, AMD64/Linux, ARM32/Linux, ARM64/Linux, +PPC32/Linux, PPC64BE/Linux, PPC64LE/Linux, S390X/Linux, MIPS32/Linux, +MIPS64/Linux, RISCV64/Linux, ARM/Android, ARM64/Android, MIPS32/Android, +X86/Android, X86/Solaris, AMD64/Solaris, AMD64/MacOSX 10.12, X86/FreeBSD, +AMD64/FreeBSD and ARM64/FreeBSD There is also preliminary support for +X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux. + +* ==================== CORE CHANGES =================== + +* ================== PLATFORM CHANGES ================= + +* ==================== TOOL CHANGES =================== + +* ==================== FIXED BUGS ==================== + +The following bugs have been fixed or resolved. Note that "n-i-bz" +stands for "not in bugzilla" -- that is, a bug that was reported to us +but never got a bugzilla entry. We encourage you to file bugs in +bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather +than mailing the developers (or mailing lists) directly -- bugs that +are not entered into bugzilla tend to get forgotten about or ignored. + + +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 above. + Release 3.25.0 (25 Apr 2025) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/configure.ac b/configure.ac index 2dfbd1c1a..84a69f810 100755 --- a/configure.ac +++ b/configure.ac @@ -16,10 +16,10 @@ AC_PREREQ(2.69) # Also set the (expected/last) release date here. # Do not forget to rerun ./autogen.sh m4_define([v_major_ver], [3]) -m4_define([v_minor_ver], [25]) +m4_define([v_minor_ver], [26]) m4_define([v_micro_ver], [0]) -m4_define([v_suffix_ver], []) -m4_define([v_rel_date], ["25 Apr 2025"]) +m4_define([v_suffix_ver], [GIT]) +m4_define([v_rel_date], ["?? Oct 2025"]) m4_define([v_version], m4_if(v_suffix_ver, [], [v_major_ver.v_minor_ver.v_micro_ver], diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in index d7b1bb11c..7f7862a88 100755 --- a/gdbserver_tests/filter_gdb.in +++ b/gdbserver_tests/filter_gdb.in @@ -276,6 +276,9 @@ s/^0x........ in \(\w\+ (\)/\1/ /^Missing debuginfo.*/d /^Missing rpms.*/d +# illumos, but only when building the port +/\.\/gdb: warning: Couldn't determine a path for the index cache directory\./d + EOF dir=`dirname $0` From 8edc2fa6f8d70dbe10d634adff2513aa68143a22 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 2 May 2025 16:59:58 +0200 Subject: [PATCH 002/412] FreeBSD close_range syscall Simplify the checking. No ned to test for reserved fds, and just split the close_range if debug output is enabled. Add a call to close_range with an upper bound of ~0U in the testcase. These changes will probably be the basis for fixing https://bugs.kde.org/show_bug.cgi?id=503641 --- coregrind/m_syswrap/syswrap-freebsd.c | 62 +++++++++++++-------------- memcheck/tests/close_range.c | 5 ++- memcheck/tests/close_range.stderr.exp | 6 +-- 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 7ea04fdbc..41cd07561 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -6615,10 +6615,8 @@ POST(sys___realpathat) // int close_range(u_int lowfd, u_int highfd, int flags); PRE(sys_close_range) { - SysRes res = VG_(mk_SysRes_Success)(0); - unsigned int lowfd = ARG1; - unsigned int fd_counter; // will count from lowfd to highfd - unsigned int highfd = ARG2; + UInt lowfd = ARG1; + UInt highfd = ARG2; /* on linux the may lock if futexes are used * there is a lock in the kernel but I assume it's just @@ -6642,46 +6640,48 @@ PRE(sys_close_range) return; } - fd_counter = lowfd; - do { - if (fd_counter > highfd - || (fd_counter == 2U/*stderr*/ && VG_(debugLog_getLevel)() > 0) - || fd_counter == VG_(log_output_sink).fd - || fd_counter == VG_(xml_output_sink).fd) { - /* Split the range if it contains a file descriptor we're not - * supposed to close. */ - if (fd_counter - 1 >= lowfd) { - res = VG_(do_syscall3)(__NR_close_range, (UWord)lowfd, (UWord)fd_counter - 1, ARG3 ); - } - lowfd = fd_counter + 1; - } - } while (fd_counter++ <= highfd); + vg_assert(VG_(log_output_sink).fd == -1 || + VG_(log_output_sink).fd >= VG_(fd_hard_limit)); + vg_assert(VG_(xml_output_sink).fd == -1 || + VG_(xml_output_sink).fd >= VG_(fd_hard_limit)); - /* If it failed along the way, it's presumably the flags being wrong. */ - SET_STATUS_from_SysRes (res); + if (VG_(debugLog_getLevel)() > 0 && + lowfd <= 2U && + highfd >= 2U && + lowfd != highfd) { + SysRes res = VG_(mk_SysRes_Success)(0); + if (lowfd <= 1U) { + res = VG_(do_syscall3)(__NR_close_range, lowfd, 1U, ARG3); + } + if (!sr_isError(res) && highfd >= 3U) { + res = VG_(do_syscall3)(__NR_close_range, 3U, highfd, ARG3); + } + /* If it failed along the way, it's presumably the flags being wrong. */ + SET_STATUS_from_SysRes (res); + } else { + SET_STATUS_from_SysRes(VG_(do_syscall3)(__NR_close_range, lowfd, highfd, ARG3)); + } } POST(sys_close_range) { - unsigned int fd; - unsigned int last = ARG2; + UInt fd; + UInt highfd = ARG2; if (!VG_(clo_track_fds) || (ARG3 & VKI_CLOSE_RANGE_CLOEXEC) != 0) return; - if (last >= VG_(fd_hard_limit)) - last = VG_(fd_hard_limit) - 1; + if (highfd >= VG_(fd_hard_limit)) + highfd = VG_(fd_hard_limit) - 1; /* If the close_range range is too wide, we don't want to loop through the whole range. */ - if (ARG2 == ~0U) - ML_(record_fd_close_range)(tid, ARG1); - else { - for (fd = ARG1; fd <= last; fd++) - if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0) - && fd != VG_(log_output_sink).fd - && fd != VG_(xml_output_sink).fd) + if (ARG2 >= VG_(fd_hard_limit)) { + ML_(record_fd_close_range)(tid, ARG1); + } else { + for (fd = ARG1; fd <= highfd; fd++) + if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0)) ML_(record_fd_close)(tid, fd); } } diff --git a/memcheck/tests/close_range.c b/memcheck/tests/close_range.c index 6d8b5a0ba..5c21e7f42 100644 --- a/memcheck/tests/close_range.c +++ b/memcheck/tests/close_range.c @@ -65,7 +65,7 @@ int main(void) errno = 0; // wrong order - close_range(fd3, fd1, 2); + close_range(fd3, fd1, 0); assert(errno = EINVAL); errno = 0; @@ -82,6 +82,9 @@ int main(void) close_range(3, rl.rlim_cur+1, 0); + int res = close_range(2U, ~0U, 0); + assert(res == 0); + { unsigned a; unsigned b; diff --git a/memcheck/tests/close_range.stderr.exp b/memcheck/tests/close_range.stderr.exp index 2f4d018f2..51dfcd40a 100644 --- a/memcheck/tests/close_range.stderr.exp +++ b/memcheck/tests/close_range.stderr.exp @@ -1,12 +1,12 @@ Syscall param close_range(lowfd) contains uninitialised byte(s) at 0x........: close_range (in /...libc...) - by 0x........: main (close_range.c:89) + by 0x........: main (close_range.c:92) Syscall param close_range(highfd) contains uninitialised byte(s) at 0x........: close_range (in /...libc...) - by 0x........: main (close_range.c:89) + by 0x........: main (close_range.c:92) Syscall param close_range(flags) contains uninitialised byte(s) at 0x........: close_range (in /...libc...) - by 0x........: main (close_range.c:89) + by 0x........: main (close_range.c:92) From 933e542b431f17681cc915de656e853dc16d4fe7 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 2 May 2025 18:53:09 +0200 Subject: [PATCH 003/412] Bug 503641 - close_range syscalls started failing with 3.25.0 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 58 ++++++++++----------- memcheck/tests/close_range.stderr.exp.linux | 6 +-- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/NEWS b/NEWS index 6a15080c1..71c389c53 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +503641 close_range syscalls started failing with 3.25.0 To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index de710c97e..6f3917830 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -13699,17 +13699,20 @@ PRE(sys_execveat) PRE(sys_close_range) { - SysRes res = VG_(mk_SysRes_Success)(0); - Int beg, end; - Int first = ARG1; - Int last = ARG2; + UInt first = ARG1; + UInt last = ARG2; + + vg_assert(VG_(log_output_sink).fd == -1 || + VG_(log_output_sink).fd >= VG_(fd_hard_limit)); + vg_assert(VG_(xml_output_sink).fd == -1 || + VG_(xml_output_sink).fd >= VG_(fd_hard_limit)); FUSE_COMPATIBLE_MAY_BLOCK(); PRINT("sys_close_range ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2, ARG3); PRE_REG_READ3(long, "close_range", unsigned int, first, unsigned int, last, - unsigned int, flags); + int, flags); if (first > last) { SET_STATUS_Failure( VKI_EINVAL ); @@ -13724,29 +13727,28 @@ PRE(sys_close_range) return; } - beg = end = first; - do { - if (end > last - || (end == 2/*stderr*/ && VG_(debugLog_getLevel)() > 0) - || end == VG_(log_output_sink).fd - || end == VG_(xml_output_sink).fd) { - /* Split the range if it contains a file descriptor we're not - * supposed to close. */ - if (end - 1 >= beg) - res = VG_(do_syscall3)(__NR_close_range, (UWord)beg, (UWord)end - 1, ARG3 ); - beg = end + 1; + if (VG_(debugLog_getLevel)() > 0 && + first <= 2U && + last >= 2U && + first != last) { + SysRes res = VG_(mk_SysRes_Success)(0); + if (first <= 1U) { + res = VG_(do_syscall3)(__NR_close_range, first, 1U, ARG3); } - } while (end++ <= last); - - /* If it failed along the way, it's presumably the flags being wrong. */ - SET_STATUS_from_SysRes (res); + if (!sr_isError(res) && last >= 3U) { + res = VG_(do_syscall3)(__NR_close_range, 3U, last, ARG3); + } + /* If it failed along the way, it's presumably the flags being wrong. */ + SET_STATUS_from_SysRes (res); + } else { + SET_STATUS_from_SysRes(VG_(do_syscall3)(__NR_close_range, first, last, ARG3)); + } } POST(sys_close_range) { - Int fd; - Int first = ARG1; - Int last = ARG2; + UInt fd; + UInt last = ARG2; if (!VG_(clo_track_fds) || (ARG3 & VKI_CLOSE_RANGE_CLOEXEC) != 0) @@ -13757,13 +13759,11 @@ POST(sys_close_range) /* If the close_range range is too wide, we don't want to loop through the whole range. */ - if (last == ~0U) - ML_(record_fd_close_range)(tid, first); + if (ARG2 >= VG_(fd_hard_limit)) + ML_(record_fd_close_range)(tid, ARG1); else { - for (fd = first; fd <= last; fd++) - if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0) - && fd != VG_(log_output_sink).fd - && fd != VG_(xml_output_sink).fd) + for (fd = ARG1; fd <= last; fd++) + if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0)) ML_(record_fd_close)(tid, fd); } } diff --git a/memcheck/tests/close_range.stderr.exp.linux b/memcheck/tests/close_range.stderr.exp.linux index 3a0de7837..93c4bfa27 100644 --- a/memcheck/tests/close_range.stderr.exp.linux +++ b/memcheck/tests/close_range.stderr.exp.linux @@ -1,12 +1,12 @@ Syscall param close_range(first) contains uninitialised byte(s) at 0x........: close_range (in /...libc...) - by 0x........: main (close_range.c:89) + by 0x........: main (close_range.c:92) Syscall param close_range(last) contains uninitialised byte(s) at 0x........: close_range (in /...libc...) - by 0x........: main (close_range.c:89) + by 0x........: main (close_range.c:92) Syscall param close_range(flags) contains uninitialised byte(s) at 0x........: close_range (in /...libc...) - by 0x........: main (close_range.c:89) + by 0x........: main (close_range.c:92) From 09c161e6e0ee8ee057d81cfb71c0d98b16f36a19 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 4 May 2025 08:55:45 +0200 Subject: [PATCH 004/412] Bug 503677 - duplicated-cond compiler warning in dis_RV64M --- NEWS | 1 + VEX/priv/guest_riscv64_toIR.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 71c389c53..b69dc84f8 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,7 @@ than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. 503641 close_range syscalls started failing with 3.25.0 +503677 duplicated-cond compiler warning in dis_RV64M To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/VEX/priv/guest_riscv64_toIR.c b/VEX/priv/guest_riscv64_toIR.c index 5d9b903c9..393a7ca7d 100644 --- a/VEX/priv/guest_riscv64_toIR.c +++ b/VEX/priv/guest_riscv64_toIR.c @@ -1754,8 +1754,6 @@ static Bool dis_RV64M(/*MB_OUT*/ DisResult* dres, UInt rs1 = INSN(19, 15); UInt rs2 = INSN(24, 20); if (funct3 == 0b010) { - /* Invalid {MUL,DIV,REM}, fall through. */ - } else if (funct3 == 0b010) { /* MULHSU, not currently handled, fall through. */ } else { if (rd != 0) { From 98d78dde1ffd0848d106d0c1b37476fff9f36fed Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 4 May 2025 10:38:50 +0200 Subject: [PATCH 005/412] FreeBSD regtest: cleanup test warnings when building with GCC --- drd/tests/thread_name_freebsd.c | 2 +- helgrind/tests/Makefile.am | 1 + massif/tests/Makefile.am | 1 + memcheck/tests/Makefile.am | 3 +- memcheck/tests/amd64-freebsd/Makefile.am | 6 ++-- memcheck/tests/freebsd/Makefile.am | 46 ++++++++++++++++-------- memcheck/tests/x86-freebsd/Makefile.am | 5 +-- 7 files changed, 44 insertions(+), 20 deletions(-) diff --git a/drd/tests/thread_name_freebsd.c b/drd/tests/thread_name_freebsd.c index 0f4954ba7..dbd342154 100644 --- a/drd/tests/thread_name_freebsd.c +++ b/drd/tests/thread_name_freebsd.c @@ -20,7 +20,7 @@ static void* thread_func(void* argp) { const int thread_num = (ptrdiff_t)(argp); pthread_mutex_t invalid_mutex; - char thread_name[32]; + char thread_name[33]; snprintf(thread_name, sizeof(thread_name), "thread_func instance %d", thread_num + 1); diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am index 7adc5c602..817e08a72 100755 --- a/helgrind/tests/Makefile.am +++ b/helgrind/tests/Makefile.am @@ -271,6 +271,7 @@ else annotate_hbefore_CFLAGS = $(AM_CFLAGS) endif +tc09_bad_unlock_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_BUT_SET_VARIABLE@ bug322621_SOURCES = bug322621.cpp if HAVE_CXX17 check_PROGRAMS += bug392331 diff --git a/massif/tests/Makefile.am b/massif/tests/Makefile.am index ab781fa93..d4d798f69 100644 --- a/massif/tests/Makefile.am +++ b/massif/tests/Makefile.am @@ -109,6 +109,7 @@ deep_CFLAGS = $(AM_CFLAGS) -Wno-unused-result ignoring_CFLAGS = $(AM_CFLAGS) -Wno-unused-result insig_CFLAGS = $(AM_CFLAGS) -Wno-unused-result long_names_CFLAGS = $(AM_CFLAGS) -Wno-unused-result +malloc_usable_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ one_CFLAGS = $(AM_CFLAGS) -Wno-unused-result thresholds_CFLAGS = $(AM_CFLAGS) -Wno-unused-result realloc_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_FREE_NONHEAP_OBJECT@ diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index bdaa9d761..401fe8ca8 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -672,8 +672,9 @@ leak_cpp_interior_SOURCES = leak_cpp_interior.cpp # we are actually testing for at runtime. accounting_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ badfree_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_FREE_NONHEAP_OBJECT@ -bug155125_CFLAGS = $(AM_CFLAGS) -Wno-unused-result @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ +bug155125_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNUSED_RESULT@ @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ bug472219_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +malloc_usable_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@ mallinfo_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ sbfragment_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations diff --git a/memcheck/tests/amd64-freebsd/Makefile.am b/memcheck/tests/amd64-freebsd/Makefile.am index e33607f20..9f1cefea2 100644 --- a/memcheck/tests/amd64-freebsd/Makefile.am +++ b/memcheck/tests/amd64-freebsd/Makefile.am @@ -20,5 +20,7 @@ AM_CFLAGS += @FLAG_M64@ AM_CXXFLAGS += @FLAG_M64@ AM_CCASFLAGS += @FLAG_M64@ -posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ -posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ + diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index 1213b3189..b362d6148 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -208,18 +208,36 @@ check_PROGRAMS += timerfd timerfd_LDFLAGS = -lm endif -aligned_alloc_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ -delete_sized_mismatch_CXXFLAGS = ${AM_CXXFLAGS} --std=c++14 -delete_sized_mismatch_SOURCES = delete_sized_mismatch.cpp - -errno_aligned_allocs_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ - - -extattr_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_BUT_SET_VARIABLE@ - -memalign_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ - -openpty_LDFLAGS = ${AM_LDFLAGS} -lutil - -scalar_CFLAGS = ${AM_CFLAGS} -g +access_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +aligned_alloc_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ +capsicum_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +chflags_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +chmod_chown_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +delete_sized_mismatch_CXXFLAGS = ${AM_CXXFLAGS} --std=c++14 +delete_sized_mismatch_SOURCES = delete_sized_mismatch.cpp +errno_aligned_allocs_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ +extattr_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_BUT_SET_VARIABLE@ @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +get_set_login_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ +getfh_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ +getfsstat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +linkat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +memalign_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ +misc_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ +openpty_LDFLAGS = ${AM_LDFLAGS} -lutil +pdfork_pdkill_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +realpathat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ +revoke_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ +scalar_CFLAGS = ${AM_CFLAGS} -g @FLAG_W_NO_UNINITIALIZED@ +scalar_abort2_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ +scalar_fork_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_VARIABLE@ +scalar_pdfork_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ +scalar_thr_exit_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ +scalar_vfork_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_VARIABLE@ +sctp2_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ +sigwait_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ +stat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +statfs_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +timing_safe_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ +utimens_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +utimes_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ diff --git a/memcheck/tests/x86-freebsd/Makefile.am b/memcheck/tests/x86-freebsd/Makefile.am index 913914a04..1d8069021 100644 --- a/memcheck/tests/x86-freebsd/Makefile.am +++ b/memcheck/tests/x86-freebsd/Makefile.am @@ -19,5 +19,6 @@ AM_CFLAGS += @FLAG_M32@ AM_CXXFLAGS += @FLAG_M32@ AM_CCASFLAGS += @FLAG_M32@ -posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ -posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ From ecff86148825f0c6e58e55029b1d842839559ab0 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 4 May 2025 20:16:26 +0200 Subject: [PATCH 006/412] ltp-excludes: Add fork14, futex_cmp_requeue and pidfd_send_signal There are a few more linux test project syscall tests that seem to cause some trouble for some buildbots. The fork14 test uses a lot of memory, as do the futex_cmp_requeue tests (at least on ppc64le). And the pidfd_send_signal tests, when run inside a container, seem to kill the test wrapper (and the container it runs in). --- auxprogs/ltp-excludes.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/auxprogs/ltp-excludes.txt b/auxprogs/ltp-excludes.txt index 5b1d898c8..236d77942 100644 --- a/auxprogs/ltp-excludes.txt +++ b/auxprogs/ltp-excludes.txt @@ -1,7 +1,13 @@ bind06 epoll-ltp +fork14 +futex_cmp_requeue01 +futex_cmp_requeue02 inotify09 msgstress01 +pidfd_send_signal01 +pidfd_send_signal02 +pidfd_send_signal03 sendmsg03 setsockopt06 setsockopt07 From 0a4aef0523aae920fd3f102e1e4b2f4aaf501d05 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 4 May 2025 21:29:34 +0000 Subject: [PATCH 007/412] s390x: Add disassembly for special insns Surely we want to see this when tracing the frintend. Also: new function s390_irgen_inject_ir to wrap the handling of the special insn for IR injection. --- VEX/priv/guest_s390_toIR.c | 52 +++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 102c6a903..a28043a62 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -20676,8 +20676,8 @@ s390_irgen_PPA(UChar m3, UChar r1, UChar r2) static void s390_irgen_client_request(void) { - if (0) - vex_printf("%%R3 = client_request ( %%R2 )\n"); + if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) + vex_printf("special insn: client_request"); Addr64 next = guest_IA_curr_instr + S390_SPECIAL_OP_PREAMBLE_SIZE + S390_SPECIAL_OP_SIZE; @@ -20691,8 +20691,8 @@ s390_irgen_client_request(void) static void s390_irgen_guest_NRADDR(void) { - if (0) - vex_printf("%%R3 = guest_NRADDR\n"); + if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) + vex_printf("special insn: guest_NRADDR"); put_gpr_dw0(3, IRExpr_Get(S390X_GUEST_OFFSET(guest_NRADDR), Ity_I64)); } @@ -20700,6 +20700,9 @@ s390_irgen_guest_NRADDR(void) static void s390_irgen_call_noredir(void) { + if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) + vex_printf("special insn: call_noredir"); + Addr64 next = guest_IA_curr_instr + S390_SPECIAL_OP_PREAMBLE_SIZE + S390_SPECIAL_OP_SIZE; @@ -20713,6 +20716,30 @@ s390_irgen_call_noredir(void) dis_res->jk_StopHere = Ijk_NoRedir; } +static void +s390_irgen_inject_ir(void) +{ + if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) + vex_printf("special insn: inject_ir"); + + vex_inject_ir(irsb, Iend_BE); + + /* Invalidate the current insn. The reason is that the IRop we're + injecting here can change. In which case the translation has to + be redone. For ease of handling, we simply invalidate all the + time. */ + stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_CMSTART), + mkU64(guest_IA_curr_instr))); + stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_CMLEN), + mkU64(guest_IA_next_instr - guest_IA_curr_instr))); + vassert(guest_IA_next_instr - guest_IA_curr_instr == + S390_SPECIAL_OP_PREAMBLE_SIZE + S390_SPECIAL_OP_SIZE); + + put_IA(mkaddr_expr(guest_IA_next_instr)); + dis_res->whatNext = Dis_StopHere; + dis_res->jk_StopHere = Ijk_InvalICache; +} + static s390_decode_t s390_decode_2byte_and_irgen(const UChar *bytes) { @@ -23775,22 +23802,7 @@ s390_decode_special_and_irgen(const UChar *bytes) } else if (bytes[0] == 0x18 && bytes[1] == 0x44 /* lr %r4, %r4 */) { s390_irgen_call_noredir(); } else if (bytes[0] == 0x18 && bytes[1] == 0x55 /* lr %r5, %r5 */) { - vex_inject_ir(irsb, Iend_BE); - - /* Invalidate the current insn. The reason is that the IRop we're - injecting here can change. In which case the translation has to - be redone. For ease of handling, we simply invalidate all the - time. */ - stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_CMSTART), - mkU64(guest_IA_curr_instr))); - stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_CMLEN), - mkU64(guest_IA_next_instr - guest_IA_curr_instr))); - vassert(guest_IA_next_instr - guest_IA_curr_instr == - S390_SPECIAL_OP_PREAMBLE_SIZE + S390_SPECIAL_OP_SIZE); - - put_IA(mkaddr_expr(guest_IA_next_instr)); - dis_res->whatNext = Dis_StopHere; - dis_res->jk_StopHere = Ijk_InvalICache; + s390_irgen_inject_ir(); } else { /* We don't know what it is. */ return S390_DECODE_UNKNOWN_SPECIAL_INSN; From 64beb80f9757566049fa6064048b700210836b51 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 4 May 2025 22:30:25 +0000 Subject: [PATCH 008/412] s390x: Follow-up to 558f5e9517 Said patch removes the resteering machinery which allowed chasing through unconditional jumps/calls during IR generation. There were two fixme's related to this which are now removed. Also eliminate functions 'call_function_and_chase' and 'always_goto_and_chase' which no longer are meaningful. Use 'call_function' and 'always_goto' instead. --- VEX/priv/guest_s390_toIR.c | 48 ++++++++++---------------------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index a28043a62..405bcfa7f 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -507,16 +507,6 @@ call_function(IRExpr *callee_address) dis_res->jk_StopHere = Ijk_Call; } -/* Function call with known target. */ -static void -call_function_and_chase(Addr64 callee_address) -{ - put_IA(mkaddr_expr(callee_address)); - - dis_res->whatNext = Dis_StopHere; - dis_res->jk_StopHere = Ijk_Call; -} - /* Function return sequence */ static void return_from_function(IRExpr *return_address) @@ -578,18 +568,6 @@ always_goto(IRExpr *target) dis_res->jk_StopHere = Ijk_Boring; } - -/* An unconditional branch to a known target. */ -// QQQQ fixme this is now the same as always_goto -static void -always_goto_and_chase(Addr64 target) -{ - put_IA(mkaddr_expr(target)); - - dis_res->whatNext = Dis_StopHere; - dis_res->jk_StopHere = Ijk_Boring; -} - /* A system call */ static void system_call(IRExpr *sysno) @@ -5799,7 +5777,7 @@ static const HChar * s390_irgen_BRAS(UChar r1, UShort i2) { put_gpr_dw0(r1, mkU64(guest_IA_next_instr)); - call_function_and_chase(addr_relative(i2)); + call_function(mkaddr_expr(addr_relative(i2))); return "bras"; } @@ -5808,7 +5786,7 @@ static const HChar * s390_irgen_BRASL(UChar r1, UInt i2) { put_gpr_dw0(r1, mkU64(guest_IA_next_instr)); - call_function_and_chase(addr_rel_long(i2)); + call_function(mkaddr_expr(addr_rel_long(i2))); return "brasl"; } @@ -5821,7 +5799,7 @@ s390_irgen_BRC(UChar m1, UShort i2) if (m1 == 0) { } else { if (m1 == 15) { - always_goto_and_chase(addr_relative(i2)); + always_goto(mkaddr_expr(addr_relative(i2))); } else { assign(cond, s390_call_calculate_cond(m1)); if_condition_goto(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)), @@ -5843,7 +5821,7 @@ s390_irgen_BRCL(UChar m1, UInt i2) if (m1 == 0) { } else { if (m1 == 15) { - always_goto_and_chase(addr_rel_long(i2)); + always_goto(mkaddr_expr(addr_rel_long(i2))); } else { assign(cond, s390_call_calculate_cond(m1)); if_condition_goto(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)), @@ -6154,7 +6132,7 @@ s390_irgen_CRJ(UChar r1, UChar r2, UShort i4, UChar m3) if (m3 == 0) { } else { if (m3 == 14) { - always_goto_and_chase(addr_relative(i4)); + always_goto(mkaddr_expr(addr_relative(i4))); } else { assign(op1, get_gpr_w1(r1)); assign(op2, get_gpr_w1(r2)); @@ -6179,7 +6157,7 @@ s390_irgen_CGRJ(UChar r1, UChar r2, UShort i4, UChar m3) if (m3 == 0) { } else { if (m3 == 14) { - always_goto_and_chase(addr_relative(i4)); + always_goto(mkaddr_expr(addr_relative(i4))); } else { assign(op1, get_gpr_dw0(r1)); assign(op2, get_gpr_dw0(r2)); @@ -6252,7 +6230,7 @@ s390_irgen_CIJ(UChar r1, UChar m3, UShort i4, UChar i2) if (m3 == 0) { } else { if (m3 == 14) { - always_goto_and_chase(addr_relative(i4)); + always_goto(mkaddr_expr(addr_relative(i4))); } else { assign(op1, get_gpr_w1(r1)); op2 = (Int)(Char)i2; @@ -6277,7 +6255,7 @@ s390_irgen_CGIJ(UChar r1, UChar m3, UShort i4, UChar i2) if (m3 == 0) { } else { if (m3 == 14) { - always_goto_and_chase(addr_relative(i4)); + always_goto(mkaddr_expr(addr_relative(i4))); } else { assign(op1, get_gpr_dw0(r1)); op2 = (Long)(Char)i2; @@ -7000,7 +6978,7 @@ s390_irgen_CLRJ(UChar r1, UChar r2, UShort i4, UChar m3) if (m3 == 0) { } else { if (m3 == 14) { - always_goto_and_chase(addr_relative(i4)); + always_goto(mkaddr_expr(addr_relative(i4))); } else { assign(op1, get_gpr_w1(r1)); assign(op2, get_gpr_w1(r2)); @@ -7025,7 +7003,7 @@ s390_irgen_CLGRJ(UChar r1, UChar r2, UShort i4, UChar m3) if (m3 == 0) { } else { if (m3 == 14) { - always_goto_and_chase(addr_relative(i4)); + always_goto(mkaddr_expr(addr_relative(i4))); } else { assign(op1, get_gpr_dw0(r1)); assign(op2, get_gpr_dw0(r2)); @@ -7098,7 +7076,7 @@ s390_irgen_CLIJ(UChar r1, UChar m3, UShort i4, UChar i2) if (m3 == 0) { } else { if (m3 == 14) { - always_goto_and_chase(addr_relative(i4)); + always_goto(mkaddr_expr(addr_relative(i4))); } else { assign(op1, get_gpr_w1(r1)); op2 = (UInt)i2; @@ -7123,7 +7101,7 @@ s390_irgen_CLGIJ(UChar r1, UChar m3, UShort i4, UChar i2) if (m3 == 0) { } else { if (m3 == 14) { - always_goto_and_chase(addr_relative(i4)); + always_goto(mkaddr_expr(addr_relative(i4))); } else { assign(op1, get_gpr_dw0(r1)); op2 = (ULong)i2; @@ -23946,8 +23924,6 @@ disInstr_S390_WRK(const UChar *insn) dres.jk_StopHere = Ijk_INVALID; dres.hint = Dis_HintNone; - /* fixs390: consider chasing of conditional jumps */ - /* Normal and special instruction handling starts here. */ if (s390_decode_and_irgen(insn, insn_length, &dres) == 0) { /* All decode failures end up here. The decoder has already issued an From 685affd00645ea5d4492897d372e457bfc8cf838 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 6 May 2025 08:53:04 +0000 Subject: [PATCH 009/412] s390x: disasm-test: Fix compiler warning (BZ 503817) Forgotten pointer dereference. Beef up unit test accordingly. Fix a few -Wsign-compare compiler warnings along the way. Fixes https://bugs.kde.org/show_bug.cgi?id=503817 --- NEWS | 1 + none/tests/s390x/disasm-test/opcode.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index b69dc84f8..7c66ec08b 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 503641 close_range syscalls started failing with 3.25.0 503677 duplicated-cond compiler warning in dis_RV64M +503817 s390x: fix 'ordered comparison of pointer with integer zero' compiler warnings To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/none/tests/s390x/disasm-test/opcode.c b/none/tests/s390x/disasm-test/opcode.c index e638c973c..6acf25ec7 100644 --- a/none/tests/s390x/disasm-test/opcode.c +++ b/none/tests/s390x/disasm-test/opcode.c @@ -1408,11 +1408,11 @@ parse_int(const char *p, int is_unsigned, long long *val) error("integer expected\n"); return p; } - if (is_unsigned && val < 0) { + if (is_unsigned && *val < 0) { error("unsigned value expected\n"); return p; } - return skip_digits(val < 0 ? p + 1 : p); + return skip_digits(*val < 0 ? p + 1 : p); } @@ -1834,7 +1834,7 @@ get_opcode_by_name(const char *name) { unsigned len = strlen(name); - for (int i = 0; i < num_opcodes; ++i) { + for (unsigned i = 0; i < num_opcodes; ++i) { const char *op = opcodes[i]; if (strncmp(op, name, len) == 0 && (op[len] == ' ' || op[len] == '\0')) @@ -1966,7 +1966,7 @@ parse_opcode(const char *spec) if (debug) { printf("opcode: |%s|\n", opc->name); - for (int i = 0; i < opc->num_opnds; ++i) { + for (unsigned i = 0; i < opc->num_opnds; ++i) { const opnd *d = opc->opnds + i; printf("opnd %2d: %-8s type: %-5s", i, d->name, opnd_kind_as_string(d->kind)); @@ -1977,7 +1977,7 @@ parse_opcode(const char *spec) if (d->allowed_values) { printf(" values:"); unsigned nval = d->allowed_values[0]; - for (int j = 1; j <= nval; ++j) { + for (unsigned j = 1; j <= nval; ++j) { if (d->is_unsigned) printf(" %u", (unsigned)d->allowed_values[j]); else @@ -2005,7 +2005,7 @@ get_opcode_by_index(unsigned ix) void release_opcode(opcode *opc) { - for (int i = 0; i < opc->num_opnds; ++i) { + for (unsigned i = 0; i < opc->num_opnds; ++i) { const opnd *q = opc->opnds + i; free(q->name); free(q->allowed_values); @@ -2026,7 +2026,7 @@ static const char *unit_tests[] = { "err1 m", "err2 m2:", "err3 m3:s", "err4 m4:s5", "err5 m5{", "err6 m6:{", "err7 m7:{}", "err8 m8:{1", "err9 m9:{1,", "err10 m0:{2..}", "err11 m11:{2..1}", "err12 m11:u{1,2}", - "err13 m13:r", "err14 m14:u" + "err13 m13:r", "err14 m14:u", "err15 q1:u5{-1},q2:u8{3..1}" }; @@ -2037,6 +2037,6 @@ run_unit_tests(void) debug = 1; - for (int i = 0; i < num_tests; ++i) + for (unsigned i = 0; i < num_tests; ++i) parse_opcode(unit_tests[i]); } From 0ce068434ec359324ff1e27f0c7bd5df8ae4e813 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Mon, 5 May 2025 14:23:16 +0200 Subject: [PATCH 010/412] Run the LTP syscall tests in parallel - Run the LTP syscall tests in parallel to save time. - Allow for running only selected tests using TESTS env var. --- auxprogs/Makefile.am | 6 +++++ auxprogs/ltp-tester.sh | 58 +++++++++++++++++++++++++++++++----------- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index 9cec4f222..3a2d0d176 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -231,7 +231,13 @@ gsl-check: $(GSL_BUILD_DIR)/gsl-build diff -u $(abs_top_srcdir)/auxprogs/gsl-1.6.out.x86.exp \ $(GSL_BUILD_DIR)/valgrind-gsl.out +# Extract -jNUM from MAKEFLAGS. +# Note that any spaces between -j and NUM have already been removed. +# Also there will be only one (the last) -jNUM left in MAKEFLAGS. +PARALLEL_JOBS=$(subst -j,,$(filter -j%,$(MAKEFLAGS))) + ltp-check: $(LTP_SRC_DIR) + PARALLEL_JOBS=$(PARALLEL_JOBS) \ LTP_SRC_DIR=$(LTP_SRC_DIR) \ VALGRIND=$(abs_top_builddir)/vg-in-place \ $(abs_top_srcdir)/auxprogs/ltp-tester.sh diff --git a/auxprogs/ltp-tester.sh b/auxprogs/ltp-tester.sh index 000cfaa7f..e31f8a6b1 100755 --- a/auxprogs/ltp-tester.sh +++ b/auxprogs/ltp-tester.sh @@ -13,31 +13,30 @@ LOGDIR=${LOGDIR:-$LTP_SRC_DIR/valgrind-ltp-logs} SUMMARY_LOG="$LOGDIR/summary.log" DIFFCMD="diff -u" VALGRIND="${VALGRIND:-$LTP_SRC_DIR/../../../vg-in-place}" +# For parallel testing, consider IO intensive jobs, take nproc into account +PARALLEL_JOBS=${PARALLEL_JOBS:-$(nproc)} +# TESTS env var may be specified to restrict testing to selected test cases # Initialize LOGDIR -mkdir -p $LOGDIR; rm -rf $LOGDIR/* +mkdir -p $LOGDIR; rm -rf ${LOGDIR:?}/* myLog () { msg="$1" echo "$msg" - echo -e "FAIL: $msg" >> $SUMMARY_LOG + echo -e "FAIL: $msg" >> summary } -cd $LTP_SRC_DIR - -mapfile -t files < <(find testcases/kernel/syscalls -executable -and -type f \ - | sort | grep -v -f $ORIG_PWD/ltp-excludes.txt) -c=${#files[@]}; i=0 - -for test in "${files[@]}"; do - dir=$(dirname $test) - exe=$(basename $test) +doTest () +{ + t=$1 + nr=$2 + dir=$(dirname $t) + exe=$(basename $t) l="$LOGDIR/$exe" mkdir -p $l - i=$((++i)) + echo "[$nr/$c] Testing $exe ..." | tee -a $l/summary pushd $dir >/dev/null - echo "[$i/$c] Testing $exe ..." | tee -a $SUMMARY_LOG PATH="$ORIG_PATH:$PWD" ./$exe >$l/log1std 2>$l/log1err ||: $VALGRIND -q --tool=none --log-file=$l/log2 ./$exe >$l/log2std 2>$l/log2err ||: @@ -60,7 +59,7 @@ for test in "${files[@]}"; do myLog "${exe}: unempty log2:\n$(cat log2)" fi - if grep -f $ORIG_PWD/ltp-error-patterns.txt * > error-patterns-found.txt; then + if grep -f $ORIG_PWD/ltp-error-patterns.txt log* > error-patterns-found.txt; then myLog "${exe}: error string found:\n$(cat error-patterns-found.txt)" fi @@ -73,7 +72,36 @@ for test in "${files[@]}"; do fi popd >/dev/null popd >/dev/null +} + +cd $LTP_SRC_DIR + +if [ -n "$TESTS" ]; then + echo "Running individual syscall tests specified in the TESTS env var ..." + mapfile -t files < <(find testcases/kernel/syscalls -executable -and -type f \ + | sort | grep -f <(echo $TESTS | tr ' ' '\n' | sed 's/.*/\/\0$/')) +else + echo "Running whole the LTP syscall testsuite ..." + mapfile -t files < <(find testcases/kernel/syscalls -executable -and -type f \ + | sort | grep -v -f $ORIG_PWD/ltp-excludes.txt) +fi + +c=${#files[@]}; i=0 + +# Run tests in parallel +for test in "${files[@]}"; do + while test "$(jobs -l | wc -l)" -gt $PARALLEL_JOBS; do sleep 0.1; done + i=$((++i)) + doTest $test $i & done -echo "TESTING FINISHED, logs in $LOGDIR" +wait +# Reconstruct $SUMMARY_LOG +for test in "${files[@]}"; do + exe=$(basename $test) + l="$LOGDIR/$exe" + cat $l/summary >> $SUMMARY_LOG +done + +echo "TESTING FINISHED, logs in $LOGDIR" From cb266a0b87b3e6d432b8f1d4d0cbe0351222d783 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 6 May 2025 21:22:47 +0000 Subject: [PATCH 011/412] s390x: BPRP related fixes objdump disassembly for BPRP looks like so: c5 0f ff 00 00 00 bprp 0,88 ,8a But the disasm-test parser assumed there could only be one address including a symbol name on a given line. It stopped comparison beyond that point. The line c5 0f ff 00 00 00 bprp 0,88 ,fffe would compare equal to the above -- a false positive. Once fixed, BPRP testcases began failing. This is because the i3 field is 24 bit wide. So an UShort is not good enough to represent it. --- VEX/priv/guest_s390_toIR.c | 8 ++-- none/tests/s390x/disasm-test/objdump.c | 11 ----- none/tests/s390x/disasm-test/verify.c | 64 ++++++++++++++++++++------ 3 files changed, 54 insertions(+), 29 deletions(-) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 405bcfa7f..b3ee122c5 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -2757,8 +2757,8 @@ s390_format_E(const HChar *(*irgen)(void)) } static void -s390_format_MII_UPP(const HChar *(*irgen)(UChar m1, UShort i2, UShort i3), - UChar m1, UShort i2, UShort i3) +s390_format_MII_UPP(const HChar *(*irgen)(UChar m1, UShort i2, UInt i3), + UChar m1, UShort i2, UInt i3) { const HChar *mnm; @@ -2766,7 +2766,7 @@ s390_format_MII_UPP(const HChar *(*irgen)(UChar m1, UShort i2, UShort i3), if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) S390_DISASM(MNM(mnm), UINT(m1), PCREL((Int)((Short)(i2 << 4) >> 4)), - PCREL((Int)(Short)i3)); + PCREL((Int)(i3 << 8) >> 8)); } static void @@ -20621,7 +20621,7 @@ s390_irgen_BPP(UChar m1, UShort i2, IRTemp op3addr) } static const HChar * -s390_irgen_BPRP(UChar m1, UShort i2, UShort i3) +s390_irgen_BPRP(UChar m1, UShort i2, UInt i3) { /* Treat as a no-op */ return "bprp"; diff --git a/none/tests/s390x/disasm-test/objdump.c b/none/tests/s390x/disasm-test/objdump.c index 7100e4742..1646fe9ba 100644 --- a/none/tests/s390x/disasm-test/objdump.c +++ b/none/tests/s390x/disasm-test/objdump.c @@ -153,17 +153,6 @@ read_objdump(const char *file) char *dis_insn = p; - /* Remove symbolic jump targets, if any. E.g. change - 1b68: c0 e5 ff ff fd a4 brasl %r14,16b0 to - 1b68: c0 e5 ff ff fd a4 brasl %r14,16b0 - */ - p = strchr(p, '<'); - if (p) { - *p-- = '\0'; - while (isspace(*p)) // remove trailing white space - *p-- = '\0'; - } - if (strncmp(dis_insn, mark, strlen(mark)) == 0) { if (marker_seen) break; // we're done diff --git a/none/tests/s390x/disasm-test/verify.c b/none/tests/s390x/disasm-test/verify.c index 2d6fe48c0..8dee9f596 100644 --- a/none/tests/s390x/disasm-test/verify.c +++ b/none/tests/s390x/disasm-test/verify.c @@ -121,27 +121,63 @@ disasm_same(const char *from_objdump, const char *from_vex, const char *p2 = from_vex; while (42) { + while (isspace(*p1)) + ++p1; + while (isspace(*p2)) + ++p2; if (*p1 == '\0' && *p2 == '\0') return 1; if (*p1 == '\0' || *p2 == '\0') return 0; + + if (*p1 == *p2) { + ++p1; + ++p2; + continue; + } + + /* Consider the case where the VEX disassembly has ".+integer" + or ".-integer" and the objdump disassembly has an hex address + possibly followed by a symbolic address, e.g. . */ + if (*p2++ != '.') return 0; + + long long offset_in_bytes = 0; + unsigned long long target_address = 0; + + while (isxdigit(*p1)) { + target_address *= 16; + if (isdigit(*p1)) + target_address += *p1 - '0'; + else { + int c = tolower(*p1); + if (c >= 'a' && c <= 'f') + target_address += 10 + c - 'a'; + else + return 0; // error + } + ++p1; + } while (isspace(*p1)) ++p1; - while (isspace(*p2)) + if (*p1 == '<') { + while (*p1++ != '>') + ; + } + + int is_negative = 0; + if (*p2 == '-') { + is_negative = 1; + ++p2; + } else if (*p2 == '+') + ++p2; + while (isdigit(*p2)) { + offset_in_bytes *= 10; + offset_in_bytes += *p2 - '0'; ++p2; - if (*p1 != *p2) { - long long offset_in_bytes; - unsigned long long target_address; - - /* Consider the case where the VEX disassembly has ".+integer" - or ".-integer" and the objdump disassembly has an - address. */ - if (*p2++ != '.') return 0; - if (sscanf(p2, "%lld", &offset_in_bytes) != 1) return 0; - if (sscanf(p1, "%llx", &target_address) != 1) return 0; - return address + offset_in_bytes == target_address; } - ++p1; - ++p2; + if (is_negative) + offset_in_bytes *= -1; + + if (address + offset_in_bytes != target_address) return 0; } } From ff6e14ab798af0628c54c6a704c1cb8844a79419 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 9 May 2025 00:21:25 +0200 Subject: [PATCH 012/412] mount syscall param filesystemtype may be NULL On Linux the mount syscall, depending on flags provided, the source, type and data my be ignored. We already don't check data and allow source to be NULL. Normally when type is ignored an application will provide an empty string "". But sometimes NULL is passed (like for source). So we now also allow type to be NULL to prevent false positives. Adjust the linux/scalar.c tests so the type param is still unaddressable. https://bugs.kde.org/show_bug.cgi?id=503914 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 6 ++++-- memcheck/tests/arm64-linux/scalar.c | 2 +- memcheck/tests/x86-linux/scalar.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 7c66ec08b..1ced90cae 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 503641 close_range syscalls started failing with 3.25.0 503677 duplicated-cond compiler warning in dis_RV64M 503817 s390x: fix 'ordered comparison of pointer with integer zero' compiler warnings +503914 mount syscall param filesystemtype may be NULL To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 6f3917830..afd4a618b 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -1000,7 +1000,8 @@ PRE(sys_mount) { // Nb: depending on 'flags', the 'type' and 'data' args may be ignored. // We are conservative and check everything, except the memory pointed to - // by 'data'. + // by 'data'. And since both 'source' and 'type' may be ignored, we allow + // them to be NULL. *flags |= SfMayBlock; PRINT("sys_mount( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", @@ -1012,7 +1013,8 @@ PRE(sys_mount) if (ARG1) PRE_MEM_RASCIIZ( "mount(source)", ARG1); PRE_MEM_RASCIIZ( "mount(target)", ARG2); - PRE_MEM_RASCIIZ( "mount(type)", ARG3); + if (ARG3) + PRE_MEM_RASCIIZ( "mount(type)", ARG3); } PRE(sys_oldumount) diff --git a/memcheck/tests/arm64-linux/scalar.c b/memcheck/tests/arm64-linux/scalar.c index 622ea1c47..49e0ca6a7 100644 --- a/memcheck/tests/arm64-linux/scalar.c +++ b/memcheck/tests/arm64-linux/scalar.c @@ -128,7 +128,7 @@ int main(void) // __NR_mount 21 GO(__NR_mount, "5s 3m"); - SY(__NR_mount, x0, x0, x0, x0, x0); FAIL; + SY(__NR_mount, x0, x0, x0-1, x0, x0); FAIL; // __NR_umount arm64 only has umount2 //GO(__NR_umount, "1s 1m"); diff --git a/memcheck/tests/x86-linux/scalar.c b/memcheck/tests/x86-linux/scalar.c index 83ed38c4d..fe36a47ef 100644 --- a/memcheck/tests/x86-linux/scalar.c +++ b/memcheck/tests/x86-linux/scalar.c @@ -137,7 +137,7 @@ int main(void) // __NR_mount 21 GO(__NR_mount, "5s 3m"); - SY(__NR_mount, x0, x0, x0, x0, x0); FAIL; + SY(__NR_mount, x0, x0, x0-1, x0, x0); FAIL; // __NR_umount 22 GO(__NR_umount, "1s 1m"); From 5efdbbd321e6816ab2ae436d38c20bdcc72b4c17 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 9 May 2025 13:46:44 +0200 Subject: [PATCH 013/412] Add workaround for missing riscv_hwprobe syscall (258) On riscv newer glibc (2.41) will probe instruction support using the riscv_hwprobe syscall. Since Valgrind currently doesn't have a wrapper for riscv_hwprobe that causes a Warning. Since the RISC-V Hardware Probing Interface is non-trivial and we don't really implement extended riscv instructions anyway work around that by "implementing" riscv_hwprobe as sys_ni_syscall so it generates an ENOSYS and glibc will silently fall back to not using any extended instructions. https://docs.kernel.org/arch/riscv/hwprobe.html https://bugs.kde.org/show_bug.cgi?id=503253 --- coregrind/m_syswrap/syswrap-riscv64-linux.c | 1 + include/vki/vki-scnums-riscv64-linux.h | 1 + 2 files changed, 2 insertions(+) diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index e0146f2b0..ebf9c3105 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -545,6 +545,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_perf_event_open, sys_perf_event_open), /* 241 */ LINXY(__NR_accept4, sys_accept4), /* 242 */ LINXY(__NR_recvmmsg, sys_recvmmsg), /* 243 */ + GENX_(__NR_riscv_hwprobe, sys_ni_syscall), /* 258 */ PLAX_(__NR_riscv_flush_icache, sys_riscv_flush_icache), /* 259 */ GENXY(__NR_wait4, sys_wait4), /* 260 */ LINXY(__NR_prlimit64, sys_prlimit64), /* 261 */ diff --git a/include/vki/vki-scnums-riscv64-linux.h b/include/vki/vki-scnums-riscv64-linux.h index e4cc04a60..17b6839f8 100644 --- a/include/vki/vki-scnums-riscv64-linux.h +++ b/include/vki/vki-scnums-riscv64-linux.h @@ -321,6 +321,7 @@ #define __NR_mmap __NR3264_mmap #define __NR_fadvise64 __NR3264_fadvise64 +#define __NR_riscv_hwprobe (__NR_arch_specific_syscall + 14) #define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15) #endif /* __VKI_SCNUMS_RISCV64_LINUX_H */ From 9dd24c9b57cde064ca8b356c985b2e1cb7972adc Mon Sep 17 00:00:00 2001 From: Ivan Tetyushkin Date: Mon, 21 Apr 2025 11:59:48 +0300 Subject: [PATCH 014/412] riscv64: Fix nan-boxing for single-precision calculations For float values, for arithmetics we expect to have canonical nan if used double register is not currectly nan-boxed. https://bugs.kde.org/show_bug.cgi?id=503098 --- NEWS | 1 + VEX/priv/guest_riscv64_toIR.c | 28 ++++++++++++++++++++------- none/tests/riscv64/float32.c | 6 ++++++ none/tests/riscv64/float32.stdout.exp | 3 +++ 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 1ced90cae..460eb5656 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +503098 Incorrect NAN-boxing for float registers in RISC-V 503641 close_range syscalls started failing with 3.25.0 503677 duplicated-cond compiler warning in dis_RV64M 503817 s390x: fix 'ordered comparison of pointer with integer zero' compiler warnings diff --git a/VEX/priv/guest_riscv64_toIR.c b/VEX/priv/guest_riscv64_toIR.c index 393a7ca7d..59297acd1 100644 --- a/VEX/priv/guest_riscv64_toIR.c +++ b/VEX/priv/guest_riscv64_toIR.c @@ -522,9 +522,13 @@ static IRExpr* getFReg32(UInt fregNo) vassert(fregNo < 32); /* Note that the following access depends on the host being little-endian which is checked in disInstr_RISCV64(). */ - /* TODO Check that the value is correctly NaN-boxed. If not then return - the 32-bit canonical qNaN, as mandated by the RISC-V ISA. */ - return IRExpr_Get(offsetFReg(fregNo), Ity_F32); + IRExpr* f64 = getFReg64(fregNo); + IRExpr* high_half = unop(Iop_64HIto32, unop(Iop_ReinterpF64asI64, f64)); + IRExpr* cond = binop(Iop_CmpEQ32, high_half, mkU32(0xffffffff)); + IRExpr* res = IRExpr_ITE( + cond, IRExpr_Get(offsetFReg(fregNo), Ity_F32), + /* canonical nan */ unop(Iop_ReinterpI32asF32, mkU32(0x7fc00000))); + return res; } /* Write a 32-bit value into a guest floating-point register. */ @@ -2160,8 +2164,10 @@ static Bool dis_RV64F(/*MB_OUT*/ DisResult* dres, UInt rs2 = INSN(24, 20); UInt imm11_0 = INSN(31, 25) << 5 | INSN(11, 7); ULong simm = vex_sx_to_64(imm11_0, 12); - storeLE(irsb, binop(Iop_Add64, getIReg64(rs1), mkU64(simm)), - getFReg32(rs2)); + // do not modify the bits being transferred; + IRExpr* f64 = getFReg64(rs2); + IRExpr* i32 = unop(Iop_64to32, unop(Iop_ReinterpF64asI64, f64)); + storeLE(irsb, binop(Iop_Add64, getIReg64(rs1), mkU64(simm)), i32); DIP("fsw %s, %lld(%s)\n", nameFReg(rs2), (Long)simm, nameIReg(rs1)); return True; } @@ -2456,8 +2462,16 @@ static Bool dis_RV64F(/*MB_OUT*/ DisResult* dres, INSN(24, 20) == 0b00000 && INSN(31, 25) == 0b1110000) { UInt rd = INSN(11, 7); UInt rs1 = INSN(19, 15); - if (rd != 0) - putIReg32(irsb, rd, unop(Iop_ReinterpF32asI32, getFReg32(rs1))); + if (rd != 0) { + // For RV64, the higher 32 bits of the destination register are filled + // with copies of the floating-point number’s sign bit. + IRExpr* freg = getFReg64(rs1); + IRExpr* low_half = unop(Iop_64to32, unop(Iop_ReinterpF64asI64, freg)); + IRExpr* sign = binop(Iop_And32, low_half, mkU32(1u << 31)); + IRExpr* cond = binop(Iop_CmpEQ32, sign, mkU32(1u << 31)); + IRExpr* high_part = IRExpr_ITE(cond, mkU32(0xffffffff), mkU32(0)); + putIReg64(irsb, rd, binop(Iop_32HLto64, high_part, low_half)); + } DIP("fmv.x.w %s, %s\n", nameIReg(rd), nameFReg(rs1)); return True; } diff --git a/none/tests/riscv64/float32.c b/none/tests/riscv64/float32.c index b63305a64..f635bc761 100644 --- a/none/tests/riscv64/float32.c +++ b/none/tests/riscv64/float32.c @@ -1578,6 +1578,12 @@ static void test_float32_additions(void) TESTINST_1_1_FI(4, "fcvt.s.lu fa0, a0", 0x0000000001000001, 0x60, fa0, a0); /* 2**24+1 (DYN-RMM) -> 2**24+2 (NX) */ TESTINST_1_1_FI(4, "fcvt.s.lu fa0, a0", 0x0000000001000001, 0x80, fa0, a0); + + // check nan-boxing + /* fabs.s rd, rs1 */ + TESTINST_1_2_F(4, "fsgnjx.s fa0, fa1, fa1", 0xfaffffff3f800000, + 0xfaffffff3f800000, 0x00, fa0, fa1, fa1); + } int main(void) diff --git a/none/tests/riscv64/float32.stdout.exp b/none/tests/riscv64/float32.stdout.exp index 013c7eda2..734370d51 100644 --- a/none/tests/riscv64/float32.stdout.exp +++ b/none/tests/riscv64/float32.stdout.exp @@ -1554,3 +1554,6 @@ fcvt.s.lu fa0, a0 :: fcvt.s.lu fa0, a0 :: inputs: a0=0x0000000001000001, fcsr=0x00000080 output: fa0=0xffffffff4b800001, fcsr=0x00000081 +fsgnjx.s fa0, fa1, fa1 :: + inputs: fa1=0xfaffffff3f800000, fa1=0xfaffffff3f800000, fcsr=0x00000000 + output: fa0=0xffffffff7fc00000, fcsr=0x00000000 From 01f66db19fd91bbe869d1272ab67e441396cabe5 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 11 May 2025 10:28:01 +0200 Subject: [PATCH 015/412] Linux PPC64 syscall: add sys_io_pgetevents --- coregrind/m_syswrap/syswrap-ppc64-linux.c | 1 + include/vki/vki-scnums-ppc64-linux.h | 1 + 2 files changed, 2 insertions(+) diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 7a79c6dee..007fa6336 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1022,6 +1022,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_statx, sys_statx), // 383 GENX_(__NR_rseq, sys_ni_syscall), // 387 + LINX_(__NR_io_pgetevents, sys_io_pgetevents), // 388 LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 diff --git a/include/vki/vki-scnums-ppc64-linux.h b/include/vki/vki-scnums-ppc64-linux.h index a76fa6d32..6d8b2b508 100644 --- a/include/vki/vki-scnums-ppc64-linux.h +++ b/include/vki/vki-scnums-ppc64-linux.h @@ -408,6 +408,7 @@ #define __NR_pkey_free 385 #define __NR_pkey_mprotect 386 #define __NR_rseq 387 +#define __NR_io_pgetevents 388 #endif /* __VKI_SCNUMS_PPC64_LINUX_H */ From f23b5b7257356ed39e89f941eb1856ff52a78bdf Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 11 May 2025 19:40:22 +0200 Subject: [PATCH 016/412] FreeBSD warnings: a couple of signatures that warn of mismatches when -fno-bultin is specified. There's still infinite recursion and crashes with clang though. --- coregrind/m_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 55ffd769b..ff82e3a50 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -3544,12 +3544,12 @@ void *memcpy(void *dest, const void *src, size_t n); void *memcpy(void *dest, const void *src, size_t n) { return VG_(memcpy)(dest, src, n); } -void* memmove(void *dest, const void *src, SizeT n); -void* memmove(void *dest, const void *src, SizeT n) { +void* memmove(void *dest, const void *src, size_t n); +void* memmove(void *dest, const void *src, size_t n) { return VG_(memmove)(dest,src,n); } -void* memset(void *s, int c, SizeT n); -void* memset(void *s, int c, SizeT n) { +void* memset(void *s, int c, size_t n); +void* memset(void *s, int c, size_t n) { return VG_(memset)(s,c,n); } From c00d3a54ddeac43af72ca624bef2451ddea35789 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 11 May 2025 21:25:11 +0200 Subject: [PATCH 017/412] Regtest: add an xml version of memcheck realloc_size_zero --- memcheck/tests/Makefile.am | 3 + .../tests/realloc_size_zero_xml.stderr.exp | 90 +++++++++++++++++++ .../tests/realloc_size_zero_xml.stdout.exp | 2 + memcheck/tests/realloc_size_zero_xml.vgtest | 6 ++ 4 files changed, 101 insertions(+) create mode 100644 memcheck/tests/realloc_size_zero_xml.stderr.exp create mode 100644 memcheck/tests/realloc_size_zero_xml.stdout.exp create mode 100644 memcheck/tests/realloc_size_zero_xml.vgtest diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 401fe8ca8..06d97ae5a 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -353,6 +353,9 @@ EXTRA_DIST = \ realloc_size_zero.stderr.exp realloc_size_zero.stdout.exp-glibc \ realloc_size_zero.stdout.exp-other \ realloc_size_zero.vgtest \ + realloc_size_zero_xml.stderr.exp \ + realloc_size_zero_xml.stdout.exp \ + realloc_size_zero_xml.vgtest \ realloc_size_zero_yes.stderr.exp realloc_size_zero_yes.stdout.exp \ realloc_size_zero_yes.vgtest \ realloc_size_zero_again_yes.stderr.exp \ diff --git a/memcheck/tests/realloc_size_zero_xml.stderr.exp b/memcheck/tests/realloc_size_zero_xml.stderr.exp new file mode 100644 index 000000000..3b6450ff4 --- /dev/null +++ b/memcheck/tests/realloc_size_zero_xml.stderr.exp @@ -0,0 +1,90 @@ + + + + +4 +memcheck + + + ... + ... + ... + ... + + +... +... +memcheck + + + ... + + ./realloc_size_zero + + + + + RUNNING + + + + + 0x........ + ... + ReallocSizeZero + realloc() with size 0 + + + 0x........ + ... + realloc + ... + vg_replace_malloc.c + ... + + + 0x........ + ... + main + ... + realloc_size_zero.c + ... + + + Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd + + + 0x........ + ... + malloc + ... + vg_replace_malloc.c + ... + + + 0x........ + ... + main + ... + realloc_size_zero.c + ... + + + + + + + FINISHED + + + + + + ... + 0x........ + + + + + + diff --git a/memcheck/tests/realloc_size_zero_xml.stdout.exp b/memcheck/tests/realloc_size_zero_xml.stdout.exp new file mode 100644 index 000000000..103f1d5eb --- /dev/null +++ b/memcheck/tests/realloc_size_zero_xml.stdout.exp @@ -0,0 +1,2 @@ +p not NULL after realloc 0 +p2 not NULL after realloc 0 diff --git a/memcheck/tests/realloc_size_zero_xml.vgtest b/memcheck/tests/realloc_size_zero_xml.vgtest new file mode 100644 index 000000000..1b88b523b --- /dev/null +++ b/memcheck/tests/realloc_size_zero_xml.vgtest @@ -0,0 +1,6 @@ +prog: realloc_size_zero +vgopts: -q --xml=yes --xml-fd=2 --log-file=/dev/null +stderr_filter: filter_xml + + + From 3404f081ed2027ccdb756c87bcaea7f95fd0525a Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 11 May 2025 23:12:15 +0200 Subject: [PATCH 018/412] More gdb filtering for glibc 2.41 with debuginfo installed --- gdbserver_tests/filter_gdb.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in index 7f7862a88..98f28d13c 100755 --- a/gdbserver_tests/filter_gdb.in +++ b/gdbserver_tests/filter_gdb.in @@ -137,6 +137,12 @@ s/in _dl_sysinfo_int80 () from \/lib\/ld-linux.so.*/in syscall .../ # in __syscall_cancel_arch is just in a syscall s/in __syscall_cancel_arch .*/in syscall .../ +# as is just __syscall_cancel_arch +s/__syscall_cancel_arch .*/0x........ in syscall .../ + +# gdb with source might figure out there is just a ret instruction +/^[1-9][0-9\t ]*ret$/d + # do_syscall is in syscall s/__libc_do_syscall ().*/0x........ in syscall .../ From 05631e8f0541bb918a48cd6616b340ffb5966647 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 12 May 2025 07:20:59 +0200 Subject: [PATCH 019/412] Linux regtest: add an expected for memcheck realloc_size_zero_xml --- memcheck/tests/Makefile.am | 1 + memcheck/tests/realloc_size_zero_xml.stdout.exp-glibc | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 memcheck/tests/realloc_size_zero_xml.stdout.exp-glibc diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 06d97ae5a..eb3b6f9ee 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -355,6 +355,7 @@ EXTRA_DIST = \ realloc_size_zero.vgtest \ realloc_size_zero_xml.stderr.exp \ realloc_size_zero_xml.stdout.exp \ + realloc_size_zero_xml.stdout.exp-glibc \ realloc_size_zero_xml.vgtest \ realloc_size_zero_yes.stderr.exp realloc_size_zero_yes.stdout.exp \ realloc_size_zero_yes.vgtest \ diff --git a/memcheck/tests/realloc_size_zero_xml.stdout.exp-glibc b/memcheck/tests/realloc_size_zero_xml.stdout.exp-glibc new file mode 100644 index 000000000..ed2bcf0cd --- /dev/null +++ b/memcheck/tests/realloc_size_zero_xml.stdout.exp-glibc @@ -0,0 +1,2 @@ +p is NULL after realloc 0 +p2 not NULL after realloc 0 From 21a098eadf71c4ce75e2b288a23835f403b065ae Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 12 May 2025 21:38:46 +0200 Subject: [PATCH 020/412] illumos regtest: mask a leak in memcheck/tests/realloc_size_zero_xml There's what looks like a libc printf buffer possible leak in this test on illumos. With xml output leak reporting is hard coded to on. So to avoid this extra error add --show-possibly-lost=no Maybe this should be suppressed. I haven't managed to reproduce it without xml and outside of perl regtest. --- memcheck/tests/realloc_size_zero_xml.vgtest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcheck/tests/realloc_size_zero_xml.vgtest b/memcheck/tests/realloc_size_zero_xml.vgtest index 1b88b523b..226289cb0 100644 --- a/memcheck/tests/realloc_size_zero_xml.vgtest +++ b/memcheck/tests/realloc_size_zero_xml.vgtest @@ -1,5 +1,5 @@ prog: realloc_size_zero -vgopts: -q --xml=yes --xml-fd=2 --log-file=/dev/null +vgopts: -q --xml=yes --xml-fd=2 --log-file=/dev/null --show-possibly-lost=no stderr_filter: filter_xml From 40b67282da1463090f9e19ccc68d9a719375a92c Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 13 May 2025 14:21:08 +0200 Subject: [PATCH 021/412] auxprogs/ltp-tester.sh: Fix typo in summary log grep This does point out a couple more failures. In case the test results differ when running under valgrind, but there are no other error indicators. e.g. openat202 now reports: openat202: diff -u log1summary log2summary: --- log1summary +++ log2summary @@ -1,5 +1,5 @@ -passed 9 -failed 0 +passed 8 +failed 1 broken 0 skipped 0 warnings 0 Which points out we have a bug in our openat wrapper when given /proc/self/exe with RESOLVE_NO_MAGICLINKS (which should fail with ELOOP, but succeeds when running under valgrind, probably because we have a "magic" /proc/self/exe wrapper). --- auxprogs/ltp-tester.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/auxprogs/ltp-tester.sh b/auxprogs/ltp-tester.sh index e31f8a6b1..b5ba83c0b 100755 --- a/auxprogs/ltp-tester.sh +++ b/auxprogs/ltp-tester.sh @@ -49,9 +49,9 @@ doTest () # output ordering changes and more. They aren't trivially # comparable. We resort to comparing at least the final # summary of individual test results - tail -10 $l/log1err | grep -E "^(passed|failed|broken|skipped|warnings):" > $l/log1summary ||: - tail -10 $l/log2err | grep -E "^(passed|failed|broken|skipped|warnings):" > $l/log2summary ||: - tail -10 $l/log3err | grep -E "^(passed|failed|broken|skipped|warnings):" > $l/log3summary ||: + tail -10 $l/log1err | grep -E "^(passed|failed|broken|skipped|warnings)" > $l/log1summary ||: + tail -10 $l/log2err | grep -E "^(passed|failed|broken|skipped|warnings)" > $l/log2summary ||: + tail -10 $l/log3err | grep -E "^(passed|failed|broken|skipped|warnings)" > $l/log3summary ||: # Check logs, report errors pushd $l >/dev/null From 29a5fcb3f6371584f89f9b54c793cc0f29802553 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 14 May 2025 00:13:06 +0200 Subject: [PATCH 022/412] Don't count closed inherited file descriptors Programs which close some inherited file descriptors and are run under valgrind with -q and --track-fds=yes would still show the FILE DESCRIPTORS banner even if there were no non-inherited file descriptors still open. Fix this by not counting already closed inherited file descriptors. Add a simple testcase to show /usr/bin/cat /dev/null doesn't produce any output running under valgrind -q --track-fds=yes. https://bugs.kde.org/show_bug.cgi?id=504177 --- NEWS | 1 + coregrind/m_syswrap/syswrap-generic.c | 2 +- none/tests/Makefile.am | 1 + none/tests/fdleak_cat.stderr.exp | 0 none/tests/fdleak_cat.vgtest | 3 +++ 5 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 none/tests/fdleak_cat.stderr.exp create mode 100644 none/tests/fdleak_cat.vgtest diff --git a/NEWS b/NEWS index 460eb5656..a1833ad40 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 503677 duplicated-cond compiler warning in dis_RV64M 503817 s390x: fix 'ordered comparison of pointer with integer zero' compiler warnings 503914 mount syscall param filesystemtype may be NULL +504177 FILE DESCRIPTORS banner shows when closing some inherited fds To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 82a682a5c..81c8fc028 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -987,7 +987,7 @@ void VG_(show_open_fds) (const HChar* when) int inherited = 0; for (i = allocated_fds; i; i = i->next) { - if (i->where == NULL) + if (i->where == NULL && !i->fd_closed) inherited++; } diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 043454828..bebc2f4dd 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -140,6 +140,7 @@ EXTRA_DIST = \ execve.vgtest execve.stdout.exp execve.stderr.exp \ faultstatus.vgtest faultstatus.stderr.exp faultstatus.stderr.exp-s390x \ fcntl_setown.vgtest fcntl_setown.stdout.exp fcntl_setown.stderr.exp \ + fdleak_cat.vgtest fdleak_cat.stderr.exp \ fdleak_cmsg.stderr.exp fdleak_cmsg.vgtest \ fdleak_cmsg_xml.stderr.exp-ppc64le \ fdleak_cmsg_xml.stderr.exp fdleak_cmsg_xml.vgtest \ diff --git a/none/tests/fdleak_cat.stderr.exp b/none/tests/fdleak_cat.stderr.exp new file mode 100644 index 000000000..e69de29bb diff --git a/none/tests/fdleak_cat.vgtest b/none/tests/fdleak_cat.vgtest new file mode 100644 index 000000000..11a618d85 --- /dev/null +++ b/none/tests/fdleak_cat.vgtest @@ -0,0 +1,3 @@ +prog: /usr/bin/cat +vgopts: -q --track-fds=yes +args: /dev/null From 045adc91f364e97fcc522fdf6b8915fd3cfeb24b Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 14 May 2025 07:47:43 +0200 Subject: [PATCH 023/412] regtest: use /bin/cat in none/tests/fdleak_cat.vgtest There's no /usr/bin/cat on FreeBSD or Darwin. --- none/tests/fdleak_cat.vgtest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/none/tests/fdleak_cat.vgtest b/none/tests/fdleak_cat.vgtest index 11a618d85..2cf78a0d0 100644 --- a/none/tests/fdleak_cat.vgtest +++ b/none/tests/fdleak_cat.vgtest @@ -1,3 +1,3 @@ -prog: /usr/bin/cat +prog: /bin/cat vgopts: -q --track-fds=yes args: /dev/null From 568ce38ac76e1cefc20b006c7da8cf7bf2209596 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 13 May 2025 20:34:48 +0200 Subject: [PATCH 024/412] Bug 504101 - Add a "vgstack" script This works just like pstack/gstack (and bstack on FreeBSD). Run "vgstack [valgrind pid]" and you will get the guest backtraces. --- .gitignore | 1 + NEWS | 1 + configure.ac | 3 +- coregrind/Makefile.am | 2 + coregrind/vgstack.in | 158 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 164 insertions(+), 1 deletion(-) create mode 100755 coregrind/vgstack.in diff --git a/.gitignore b/.gitignore index fa0fa0d34..962c97606 100644 --- a/.gitignore +++ b/.gitignore @@ -178,6 +178,7 @@ /coregrind/valgrind /coregrind/vgdb /coregrind/vgpreload_core-x86-darwin.so.dSYM +/coregrind/vgstack /coregrind/vg_intercept.c /coregrind/vg_replace_malloc.c /coregrind/vg_toolint.c diff --git a/NEWS b/NEWS index a1833ad40..065f32fd5 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 503677 duplicated-cond compiler warning in dis_RV64M 503817 s390x: fix 'ordered comparison of pointer with integer zero' compiler warnings 503914 mount syscall param filesystemtype may be NULL +504101 Add a "vgstack" script 504177 FILE DESCRIPTORS banner shows when closing some inherited fds To see details of a given bug, visit diff --git a/configure.ac b/configure.ac index 84a69f810..00cf62d47 100755 --- a/configure.ac +++ b/configure.ac @@ -5692,7 +5692,8 @@ AC_CONFIG_FILES([ include/Makefile auxprogs/Makefile mpi/Makefile - coregrind/Makefile + coregrind/Makefile + coregrind/vgstack memcheck/Makefile memcheck/tests/Makefile memcheck/tests/common/Makefile diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am index 700751dea..784459569 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am @@ -34,6 +34,8 @@ bin_PROGRAMS = \ valgrind \ vgdb +bin_SCRIPTS = vgstack + if VGCONF_OS_IS_LINUX valgrind_SOURCES = \ launcher-linux.c \ diff --git a/coregrind/vgstack.in b/coregrind/vgstack.in new file mode 100755 index 000000000..75ed868e9 --- /dev/null +++ b/coregrind/vgstack.in @@ -0,0 +1,158 @@ +#!/bin/sh + +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# Copyright (C) 2025 Paul Floyd +# pjfloyd@wanadoo.fr + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Print a stack trace of a running process. +# Similar to the gcore command, but instead of creating a core file, +# we simply have gdb print out the stack backtrace to the terminal. + +# This script is largely based on gstack/pstack from gdb. +# There is a bit of extra filtering to remove gdb warnings, +# the shell used is /bin/sh rather than bash. +# The main functional change is that it 'uses target remote | vgdb' +# instead of 'attach'. + +GDB=${GDB:-$(command -v gdb)} +GDBARGS=${GDBARGS:-} +AWK=${AWK:-} +VERSION="@VERSION@" + +# Find an appropriate awk interpreter if one was not specified +# via the environment. +awk_prog="" +if [ -z "$AWK" ]; then + for prog in gawk mawk nawk awk; do + awk_prog=$(command -v $prog) + test -n "$awk_prog" && break + done + AWK="$awk_prog" +fi +if [ ! -x "$AWK" ]; then + echo "$0: could not find usable awk interpreter" 1>&2 + exit 2 +fi + +print_usage() { + echo "Usage: $0 [-h|--help] [-v|--version] PID" +} + +print_try_help() { + echo "Try '$0 --help' for more information." +} + +print_help() { + print_usage + echo "Print a stack trace of a running program" + echo + echo " -h, --help Print this message then exit." + echo " -v, --version Print version information then exit." +} + +print_version() { + echo "${0}-${VERSION}" +} + +# Parse options. +while getopts hv-: OPT; do + if [ "$OPT" = "-" ]; then + OPT="${OPTARG%%=*}" + OPTARG="${OPTARG#'$OPT'}" + OPTARG="${OPTARG#=}" + fi + + case "$OPT" in + h | help) + print_help + exit 0 + ;; + v | version) + print_version + exit 0 + ;; + \?) + # getopts has already output an error message. + print_try_help 1>&2 + exit 2 ;; + *) + echo "$0: unrecognized option '--$OPT'" 1>&2 + print_try_help 1>&2 + exit 2 + ;; + esac +done +shift $((OPTIND-1)) + +# The sole remaining argument should be the PID of the process +# whose backtrace is desired. +if [ $# -ne 1 ]; then + print_usage 1>&2 + exit 1 +fi + +PID=$1 + +awk_script=$(cat << EOF +BEGIN { + first=1 + attach_okay=0 +} + +/ATTACHED/ { + attach_okay=1 +} + +/^#/ { + if (attach_okay) { + print \$0 + } +} + +/^Thread/ { + if (attach_okay) { + if (first == 0) + print "" + first=0 + print \$0 + } +} + +/warning:/ { + next +} + +END { +if (attach_okay == 0) + exit 2 +} +EOF + ) + +# Run GDB and remove some unwanted noise. +"$GDB" --quiet -nx $GDBARGS <&1 | +set width 0 +set height 0 +set pagination no +set debuginfod enabled off +define vgdb-bt +target remote | vgdb --pid=\$arg0 +echo "ATTACHED" +thread apply all bt +end +vgdb-bt $PID +EOF +$AWK -- "$awk_script" From 41f0f95d9415faa5f76fcab92f45ca05957c4032 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Thu, 15 May 2025 12:03:55 +0200 Subject: [PATCH 025/412] Wrap linux specific cachestat syscall cachestat takes an fd, cstat_range and flags arguments and writes out page cache statistics via the cstat struct. Declare a sys_cachestat wrapper in priv_syswrap-linux.h and hook it for {amd64,arm,arm64,mips64,nanomips,ppc32,ppc64,riscv64,s390x,x86}-linux using LINXY with PRE/POST handlers in syswrap-linux.c. Define __NR_cachestat for amd64, arm, arm64, mips32, mips64, nanomips, ppc32, ppc64, riscv64, s390x, and x86. https://bugs.kde.org/show_bug.cgi?id=501741 --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 1 + coregrind/m_syswrap/syswrap-amd64-linux.c | 1 + coregrind/m_syswrap/syswrap-arm-linux.c | 1 + coregrind/m_syswrap/syswrap-arm64-linux.c | 1 + coregrind/m_syswrap/syswrap-linux.c | 20 ++++++++++++++++++++ coregrind/m_syswrap/syswrap-mips32-linux.c | 1 + coregrind/m_syswrap/syswrap-mips64-linux.c | 1 + coregrind/m_syswrap/syswrap-nanomips-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc32-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc64-linux.c | 1 + coregrind/m_syswrap/syswrap-riscv64-linux.c | 1 + coregrind/m_syswrap/syswrap-s390x-linux.c | 1 + coregrind/m_syswrap/syswrap-x86-linux.c | 1 + include/vki/vki-linux.h | 13 +++++++++++++ include/vki/vki-scnums-shared-linux.h | 1 + 16 files changed, 47 insertions(+) diff --git a/NEWS b/NEWS index 065f32fd5..a1a5fa24d 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 503914 mount syscall param filesystemtype may be NULL 504101 Add a "vgstack" script 504177 FILE DESCRIPTORS banner shows when closing some inherited fds +501741 syscall cachestat not wrapped To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 4dad82dfb..966eae543 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -59,6 +59,7 @@ DECL_TEMPLATE(linux, sys_tee); DECL_TEMPLATE(linux, sys_vmsplice); DECL_TEMPLATE(linux, sys_readahead); DECL_TEMPLATE(linux, sys_move_pages); +DECL_TEMPLATE(linux, sys_cachestat); // clone is similar enough between linux variants to have a generic // version, but which will call an extern defined in syswrap--linux.c diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 646a83240..c22683192 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -902,6 +902,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 }; diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index a12053dd0..05cd1e4b6 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -1073,6 +1073,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 + LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 }; diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index c8bb486c4..28cb3647c 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -853,6 +853,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 }; diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index afd4a618b..d4653d027 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -6196,6 +6196,26 @@ PRE(sys_fchmodat) PRE_MEM_RASCIIZ( "fchmodat(path)", ARG2 ); } +PRE(sys_cachestat) +{ + PRINT("sys_cachestat ( %lu, %#lx, %#lx, %lu )", ARG1, ARG2, ARG3, ARG4); + PRE_REG_READ4(long, "cachestat", + unsigned long, fd, struct vki_cachestat_range *, cstat_range, + struct vki_cachestat*, cstat, unsigned long, flags); + if (!ML_(fd_allowed)(ARG1, "cachestat", tid, False)) + SET_STATUS_Failure( VKI_EBADF ); + const struct vki_cachestat_range *cstat_range = (struct vki_cachestat_range *)(Addr)ARG2; + PRE_MEM_READ("cachestat(cstat_range)", ARG2, sizeof(*cstat_range) ); + const struct vki_cachestat *cstat = (struct vki_cachestat *)(Addr)ARG3; + PRE_MEM_WRITE("cachestat(cstat)", ARG3, sizeof(*cstat) ); +} + +POST(sys_cachestat) +{ + vg_assert(SUCCESS); + POST_MEM_WRITE(ARG3, sizeof(struct vki_cachestat)); +} + PRE(sys_fchmodat2) { FUSE_COMPATIBLE_MAY_BLOCK(); diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 3644a088e..d16a9a4bc 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -1180,6 +1180,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 + LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 }; diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index ba73b68d8..fe1f3db7f 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -835,6 +835,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY (__NR_landlock_create_ruleset, sys_landlock_create_ruleset), LINX_ (__NR_landlock_add_rule, sys_landlock_add_rule), LINX_ (__NR_landlock_restrict_self, sys_landlock_restrict_self), + LINXY (__NR_cachestat, sys_cachestat), LINX_ (__NR_fchmodat2, sys_fchmodat2), LINXY (__NR_userfaultfd, sys_userfaultfd), }; diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index 728607317..87153737d 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -840,6 +840,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY (__NR_landlock_create_ruleset,sys_landlock_create_ruleset), LINX_ (__NR_landlock_add_rule, sys_landlock_add_rule), LINX_ (__NR_landlock_restrict_self, sys_landlock_restrict_self), + LINXY (__NR_cachestat, sys_cachestat), LINX_ (__NR_fchmodat2, sys_fchmodat2), }; diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index 089a9a59b..bc180b8b1 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -1079,6 +1079,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 + LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 }; diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 007fa6336..6e97358e8 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1046,6 +1046,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 + LINXY (__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 }; diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index ebf9c3105..7a1ff0751 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -597,6 +597,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), /* 445 */ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), /* 446 */ LINXY(__NR_memfd_secret, sys_memfd_secret), /* 447 */ + LINXY(__NR_cachestat, sys_cachestat), /* 451 */ LINX_(__NR_fchmodat2, sys_fchmodat2), /* 452 */ }; diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index 9191c2093..f4ceae461 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -888,6 +888,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + LINXY (__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 }; diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index d7f173cd9..662780588 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1674,6 +1674,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 }; diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index 29e62ce86..0d2bed6dc 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -5478,6 +5478,19 @@ struct vki_open_how { #define VKI_CLOSE_RANGE_UNSHARE (1U << 1) #define VKI_CLOSE_RANGE_CLOEXEC (1U << 2) +struct vki_cachestat_range { + __vki_u64 off; + __vki_u64 len; +}; + +struct vki_cachestat { + __vki_u64 nr_cache; + __vki_u64 nr_dirty; + __vki_u64 nr_writeback; + __vki_u64 nr_evicted; + __vki_u64 nr_recently_evicted; +}; + //---------------------------------------------------------------------- // From linux/magic.h //---------------------------------------------------------------------- diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h index 20346ca71..616f8052d 100644 --- a/include/vki/vki-scnums-shared-linux.h +++ b/include/vki/vki-scnums-shared-linux.h @@ -54,6 +54,7 @@ #define __NR_memfd_secret 447 +#define __NR_cachestat 451 #define __NR_fchmodat2 452 #endif From b429488ff5aa59bc684d48755bf6e6d866262cd7 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 15 May 2025 21:42:19 +0000 Subject: [PATCH 026/412] Compile code that gets linked with libc by adding -fhosted. The use of -fno-builtin interfers with -Wformat: no format warnings will be given when both options are present. Because -fno-builtin means: when you encounter a function that has the same name as a built-in function, forget everything you know about that function. That includes functions attributes. And without __attribute__((format...)) there will be no -Wformat warnings. The fix is to append -fhosted when compiling something that gets linked with libc. As command line options are processed left to right adding -fhosted at the end overrides any earlier -fno-builtin option. Fix compiler warnings. Add some ugly ifdeffery to drd/drd_intercepts.c. I could not figure out how to rewrite the offensive printf to avoid testcase breakage. --- auxprogs/Makefile.am | 8 ++++---- auxprogs/valgrind-di-server.c | 2 +- auxprogs/valgrind-listener.c | 2 +- coregrind/Makefile.am | 4 ++-- coregrind/vgdb-invoker-ptrace.c | 6 +++--- coregrind/vgdb.c | 4 ++-- drd/drd_pthread_intercepts.c | 7 +++++++ helgrind/hg_intercepts.c | 6 +++--- memcheck/tests/vbit-test/Makefile.am | 4 ++-- memcheck/tests/vbit-test/irops.c | 2 +- none/tests/s390x/disasm-test/Makefile.am | 2 +- none/tests/s390x/disasm-test/opcode.c | 2 +- 12 files changed, 28 insertions(+), 21 deletions(-) diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index 3a2d0d176..4a10fb1cf 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -33,7 +33,7 @@ bin_PROGRAMS = valgrind-listener valgrind-di-server valgrind_listener_SOURCES = valgrind-listener.c valgrind_listener_CPPFLAGS = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind -valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI) +valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI) -fhosted valgrind_listener_CCASFLAGS = $(AM_CCASFLAGS_PRI) valgrind_listener_LDFLAGS = $(AM_CFLAGS_PRI) if VGCONF_PLATVARIANT_IS_ANDROID @@ -52,7 +52,7 @@ endif valgrind_di_server_SOURCES = valgrind-di-server.c valgrind_di_server_CPPFLAGS = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind -valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI) +valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI) -fhosted valgrind_di_server_CCASFLAGS = $(AM_CCASFLAGS_PRI) valgrind_di_server_LDFLAGS = $(AM_CFLAGS_PRI) if VGCONF_PLATVARIANT_IS_ANDROID @@ -87,7 +87,7 @@ endif getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = getoff.c getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) +getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -fhosted getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_PRI) getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ if HAVE_DLINFO_RTLD_DI_TLS_MODID @@ -104,7 +104,7 @@ endif if VGCONF_HAVE_PLATFORM_SEC getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = getoff.c getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) -getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) +getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) -fhosted getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_SEC) getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = $(AM_CFLAGS_SEC) if HAVE_DLINFO_RTLD_DI_TLS_MODID diff --git a/auxprogs/valgrind-di-server.c b/auxprogs/valgrind-di-server.c index 1b6506e3d..a7607c069 100644 --- a/auxprogs/valgrind-di-server.c +++ b/auxprogs/valgrind-di-server.c @@ -1172,7 +1172,7 @@ int main (int argc, char** argv) break; if (i >= M_CONNECTIONS) { - fprintf(stderr, "\n\nMore than %d concurrent connections.\n" + fprintf(stderr, "\n\nMore than %u concurrent connections.\n" "Restart the server giving --max-connect=INT on the\n" "commandline to increase the limit.\n\n", M_CONNECTIONS); diff --git a/auxprogs/valgrind-listener.c b/auxprogs/valgrind-listener.c index 158f11c08..5607e138d 100644 --- a/auxprogs/valgrind-listener.c +++ b/auxprogs/valgrind-listener.c @@ -355,7 +355,7 @@ int main (int argc, char** argv) break; if (i >= M_CONNECTIONS) { - fprintf(stderr, "\n\nMore than %d concurrent connections.\n" + fprintf(stderr, "\n\nMore than %u concurrent connections.\n" "Restart the listener giving --max-connect=INT on the\n" "commandline to increase the limit.\n\n", M_CONNECTIONS); diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am index 784459569..4ead1542b 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am @@ -62,7 +62,7 @@ AR = ${LTO_AR} RANLIB = ${LTO_RANLIB} valgrind_CPPFLAGS = $(AM_CPPFLAGS_PRI) -valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) +valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fhosted valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI) valgrind_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ # If there is no secondary platform, and the platforms include x86-darwin, @@ -104,7 +104,7 @@ vgdb_SOURCES += vgdb-invoker-freebsd.c endif vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) $(GDB_SCRIPTS_DIR) -vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) +vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fhosted vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI) vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ if VGCONF_PLATVARIANT_IS_ANDROID diff --git a/coregrind/vgdb-invoker-ptrace.c b/coregrind/vgdb-invoker-ptrace.c index 3a6a455d0..a6df5dc07 100644 --- a/coregrind/vgdb-invoker-ptrace.c +++ b/coregrind/vgdb-invoker-ptrace.c @@ -271,10 +271,10 @@ Bool waitstopped (pid_t pid, int signal_expected, const char *msg) msg, signal_expected); p = waitpid(pid, &status, __WALL); DEBUG(1, "after waitpid pid %d p %d status 0x%x %s\n", pid, p, - status, status_image (status)); + (unsigned)status, status_image (status)); if (p != pid) { ERROR(errno, "%s waitpid pid %d in waitstopped %d status 0x%x %s\n", - msg, pid, p, status, status_image (status)); + msg, pid, p, (unsigned)status, status_image (status)); return False; } @@ -867,7 +867,7 @@ Bool invoker_invoke_gdbserver (pid_t pid) web search '[patch] Fix syscall restarts for amd64->i386 biarch' e.g. http://sourceware.org/ml/gdb-patches/2009-11/msg00592.html */ *(long *)&user_save.regs.rax = *(int*)&user_save.regs.rax; - DEBUG(1, "Sign extending %8.8lx to %8.8lx\n", + DEBUG(1, "Sign extending %8.8llx to %8.8llx\n", user_mod.regs.rax, user_save.regs.rax); } #elif defined(VGA_arm) diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c index 409ceac5d..dab425d68 100644 --- a/coregrind/vgdb.c +++ b/coregrind/vgdb.c @@ -732,7 +732,7 @@ getpkt(char *buf, int fromfd, int ackfd) break; TSFPRINTF(stderr, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n", - (c1 << 4) + c2, csum, buf); + (unsigned)((c1 << 4) + c2), (unsigned)csum, buf); ssize_t res = 0; while (res == 0) { res = write(ackfd, "-", 1); @@ -1080,7 +1080,7 @@ static ssize_t receive_packet(char *buf, int noackmode) if (!(csum == (c1 << 4) + c2)) { TSFPRINTF(stderr, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n", - (c1 << 4) + c2, csum, buf); + (unsigned)((c1 << 4) + c2), (unsigned)csum, buf); if (!noackmode) if (!write_to_gdb ("-", 1)) return -1; diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c index bb9210193..73b802efc 100644 --- a/drd/drd_pthread_intercepts.c +++ b/drd/drd_pthread_intercepts.c @@ -1556,7 +1556,14 @@ sem_t* sem_open_intercept(const char *name, int oflag, mode_t mode, CALL_FN_W_WWWW(ret, fn, name, oflag, mode, value); // To do: figure out why gcc 9.2.1 miscompiles this function if the printf() // call below is left out. +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#endif printf(""); +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ_DRD_POST_SEM_OPEN, ret != SEM_FAILED ? ret : 0, name, oflag, mode, value); diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c index e639abca8..b1082cd4b 100644 --- a/helgrind/hg_intercepts.c +++ b/helgrind/hg_intercepts.c @@ -3550,7 +3550,7 @@ PTH_FUNC(sem_t*, semZuopen, if (TRACE_SEM_FNS) { fprintf(stderr, "<< sem_open(\"%s\",%ld,%lx,%lu) ", - name,oflag,mode,value); + name,oflag,(unsigned long)mode,value); fflush(stderr); } @@ -3790,7 +3790,7 @@ static long QMutex_tryLock_WRK(void* self) void *, self, long, (ret & 0xFF) ? True : False); if (TRACE_QT4_FNS) { - fprintf(stderr, " :: Q::tryLock -> %lu >>\n", ret); + fprintf(stderr, " :: Q::tryLock -> %ld >>\n", ret); } return ret; @@ -3827,7 +3827,7 @@ static long QMutex_tryLock_int_WRK(void* self, long arg2) void *, self, long, (ret & 0xFF) ? True : False); if (TRACE_QT4_FNS) { - fprintf(stderr, " :: Q::tryLock(int) -> %lu >>\n", ret); + fprintf(stderr, " :: Q::tryLock(int) -> %ld >>\n", ret); } return ret; diff --git a/memcheck/tests/vbit-test/Makefile.am b/memcheck/tests/vbit-test/Makefile.am index ded4ab174..d406da76b 100644 --- a/memcheck/tests/vbit-test/Makefile.am +++ b/memcheck/tests/vbit-test/Makefile.am @@ -48,7 +48,7 @@ vbit_test_CPPFLAGS = $(AM_CPPFLAGS_PRI) \ -I$(top_srcdir)/include \ -I$(top_srcdir)/memcheck \ -I$(top_srcdir)/VEX/pub -vbit_test_CFLAGS = $(AM_CFLAGS_PRI) +vbit_test_CFLAGS = $(AM_CFLAGS_PRI) -fhosted vbit_test_DEPENDENCIES = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a vbit_test_LDADD = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a vbit_test_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ @@ -67,7 +67,7 @@ vbit_test_sec_CPPFLAGS = $(AM_CPPFLAGS_SEC) \ -I$(top_srcdir)/include \ -I$(top_srcdir)/memcheck \ -I$(top_srcdir)/VEX/pub -vbit_test_sec_CFLAGS = $(AM_CFLAGS_SEC) \ +vbit_test_sec_CFLAGS = $(AM_CFLAGS_SEC) -fhosted \ $(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) vbit_test_sec_DEPENDENCIES = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@) diff --git a/memcheck/tests/vbit-test/irops.c b/memcheck/tests/vbit-test/irops.c index 4755ce41c..33c78fef1 100644 --- a/memcheck/tests/vbit-test/irops.c +++ b/memcheck/tests/vbit-test/irops.c @@ -1449,6 +1449,6 @@ get_irop(IROp op) } } - fprintf(stderr, "unknown opcode %d\n", op); + fprintf(stderr, "unknown opcode %u\n", (unsigned)op); exit(1); } diff --git a/none/tests/s390x/disasm-test/Makefile.am b/none/tests/s390x/disasm-test/Makefile.am index 61d4f3196..9d3ee3a29 100644 --- a/none/tests/s390x/disasm-test/Makefile.am +++ b/none/tests/s390x/disasm-test/Makefile.am @@ -29,7 +29,7 @@ disasm_test_SOURCES = $(SOURCES) disasm_test_CPPFLAGS = $(AM_CPPFLAGS_PRI) \ -I$(top_srcdir)/VEX/pub \ -I$(top_srcdir)/VEX/priv -disasm_test_CFLAGS = $(AM_CFLAGS_PRI) +disasm_test_CFLAGS = $(AM_CFLAGS_PRI) -fhosted disasm_test_DEPENDENCIES = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a disasm_test_LDADD = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a disasm_test_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ diff --git a/none/tests/s390x/disasm-test/opcode.c b/none/tests/s390x/disasm-test/opcode.c index 6acf25ec7..ef0649133 100644 --- a/none/tests/s390x/disasm-test/opcode.c +++ b/none/tests/s390x/disasm-test/opcode.c @@ -1968,7 +1968,7 @@ parse_opcode(const char *spec) printf("opcode: |%s|\n", opc->name); for (unsigned i = 0; i < opc->num_opnds; ++i) { const opnd *d = opc->opnds + i; - printf("opnd %2d: %-8s type: %-5s", i, d->name, + printf("opnd %2u: %-8s type: %-5s", i, d->name, opnd_kind_as_string(d->kind)); if (d->kind != OPND_D12XB && d->kind != OPND_D12B && d->kind != OPND_D20XB && d->kind != OPND_D20B && From 4f3f688a31ef1a213bd1a3a9e897e99cfe3950f6 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 16 May 2025 07:58:02 +0200 Subject: [PATCH 027/412] Bug 504265 - FreeBSD: missing syscall wrappers for fchroot and setcred --- .gitignore | 2 ++ NEWS | 1 + configure.ac | 8 +++++- coregrind/m_syswrap/priv_syswrap-freebsd.h | 3 ++ coregrind/m_syswrap/syswrap-freebsd.c | 25 +++++++++++++++++ include/vki/vki-freebsd.h | 17 ++++++++++++ include/vki/vki-scnums-freebsd.h | 2 ++ memcheck/tests/freebsd/Makefile.am | 15 ++++++++++ memcheck/tests/freebsd/fchroot.cpp | 17 ++++++++++++ memcheck/tests/freebsd/fchroot.stderr.exp | 4 +++ memcheck/tests/freebsd/fchroot.vgtest | 3 ++ memcheck/tests/freebsd/scalar.c | 32 +++++++++++++++++++++- memcheck/tests/freebsd/scalar.stderr.exp | 22 +++++++++++++++ memcheck/tests/freebsd/setcred.cpp | 31 +++++++++++++++++++++ memcheck/tests/freebsd/setcred.stderr.exp | 30 ++++++++++++++++++++ memcheck/tests/freebsd/setcred.vgtest | 3 ++ 16 files changed, 213 insertions(+), 2 deletions(-) create mode 100644 memcheck/tests/freebsd/fchroot.cpp create mode 100644 memcheck/tests/freebsd/fchroot.stderr.exp create mode 100644 memcheck/tests/freebsd/fchroot.vgtest create mode 100644 memcheck/tests/freebsd/setcred.cpp create mode 100644 memcheck/tests/freebsd/setcred.stderr.exp create mode 100644 memcheck/tests/freebsd/setcred.vgtest diff --git a/.gitignore b/.gitignore index 962c97606..be8c1a268 100644 --- a/.gitignore +++ b/.gitignore @@ -1435,6 +1435,7 @@ /memcheck/tests/freebsd/eventfd2 /memcheck/tests/freebsd/extattr /memcheck/tests/freebsd/fbsd278566 +/memcheck/tests/freebsd/fchroot /memcheck/tests/freebsd/fexecve /memcheck/tests/freebsd/file_locking_wait6 /memcheck/tests/freebsd/get_set_context @@ -1461,6 +1462,7 @@ /memcheck/tests/freebsd/scalar_vfork /memcheck/tests/freebsd/sctp /memcheck/tests/freebsd/sctp2 +/memcheck/tests/freebsd/setcred /memcheck/tests/freebsd/setproctitle /memcheck/tests/freebsd/sigwait /memcheck/tests/freebsd/stat diff --git a/NEWS b/NEWS index a1a5fa24d..bae5f6fcf 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 504101 Add a "vgstack" script 504177 FILE DESCRIPTORS banner shows when closing some inherited fds 501741 syscall cachestat not wrapped +504265 FreeBSD: missing syscall wrappers for fchroot and setcred To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/configure.ac b/configure.ac index 00cf62d47..caa79c014 100755 --- a/configure.ac +++ b/configure.ac @@ -5006,7 +5006,9 @@ AC_CHECK_FUNCS([ \ fdatasync \ getrandom \ getrlimitusage \ - timer_delete + timer_delete \ + fchroot \ + setcred ]) # AC_CHECK_LIB adds any library found to the variable LIBS, and links these @@ -5064,6 +5066,10 @@ AM_CONDITIONAL([HAVE_GETRLIMITUSAGE], [test x$ac_cv_func_getrlimitusage = xyes]) AM_CONDITIONAL([HAVE_TIMER_DELETE], [test x$ac_cv_func_timer_delete = xyes]) +AM_CONDITIONAL([HAVE_FCHROOT], + [test x$ac_cv_func_fchroot = xyes]) +AM_CONDITIONAL([HAVE_SETCRED], + [test x$ac_cv_func_setcred = xyes]) if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \ -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \ diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index 8b78c5d74..f8d404239 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -538,7 +538,10 @@ DECL_TEMPLATE(freebsd, sys_timerfd_settime) // 587 // __FreeBSD_version 1400507 and 1500012 DECL_TEMPLATE(freebsd, sys_kcmp) // 588 + DECL_TEMPLATE(freebsd, sys_getrlimitusage) // 589 +DECL_TEMPLATE(freebsd, sys_fchroot) // 590 +DECL_TEMPLATE(freebsd, sys_setcred) // 591 DECL_TEMPLATE(freebsd, sys_fake_sigreturn) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 41cd07561..8fcfe1090 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -7001,6 +7001,28 @@ POST(sys_getrlimitusage) } } +// SYS_fchroot 590 +// int fchroot(int fd); +PRE(sys_fchroot) +{ + PRINT("sys_fchroot(%ld)", ARG1); + PRE_REG_READ1(int, "fchroot", int, fd); + + /* Be strict. */ + if (!ML_(fd_allowed)(ARG1, "fchroot", tid, False)) + SET_STATUS_Failure(VKI_EBADF); +} + +// SYS_setcred +// int setcred(u_int flags, const struct setcred *wcred, size_t size); +PRE(sys_setcred) +{ + PRINT("sys_setcred(%ld, %#" FMT_REGWORD "x, %lu)", ARG1, ARG2, ARG3); + PRE_REG_READ3(int, "setcred", u_int, flags, const struct setcred*, wcred, size_t, size); + PRE_MEM_READ("setcred(wcred)", ARG2, sizeof(struct vki_setcred)); +} + + #undef PRE #undef POST @@ -7694,6 +7716,9 @@ const SyscallTableEntry ML_(syscall_table)[] = { BSDX_(__NR_kcmp, sys_kcmp), // 588 BSDXY(__NR_getrlimitusage, sys_getrlimitusage), // 589 + BSDX_(__NR_fchroot, sys_fchroot), // 590 + BSDX_(__NR_setcred, sys_setcred), // 591 + BSDX_(__NR_fake_sigreturn, sys_fake_sigreturn), // 1000, fake sigreturn }; diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index b870025f0..253997999 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -3257,6 +3257,23 @@ union vki_ccb { #define VKI_CAMIOCOMMAND _VKI_IOWR(VKI_CAM_VERSION, 2, union vki_ccb) +//---------------------------------------------------------------------- +// From cam/scsi/scsi_all.h +//---------------------------------------------------------------------- +struct vki_setcred { + vki_uid_t sc_uid; /* effective user id */ + vki_uid_t sc_ruid; /* real user id */ + vki_uid_t sc_svuid; /* saved user id */ + vki_gid_t sc_gid; /* effective group id */ + vki_gid_t sc_rgid; /* real group id */ + vki_gid_t sc_svgid; /* saved group id */ + vki_u_int sc_pad; /* see 32-bit compat structure */ + vki_u_int sc_supp_groups_nb; /* number of supplementary groups */ + vki_gid_t *sc_supp_groups; /* supplementary groups */ + struct vki_mac *sc_label; /* MAC label */ +}; + + /*--------------------------------------------------------------------*/ /*--- end ---*/ diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h index 098b722f4..a92abb9a1 100644 --- a/include/vki/vki-scnums-freebsd.h +++ b/include/vki/vki-scnums-freebsd.h @@ -627,6 +627,8 @@ #define __NR_kcmp 588 #define __NR_getrlimitusage 589 +#define __NR_fchroot 590 +#define __NR_setcred 591 #define __NR_fake_sigreturn 1000 diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index b362d6148..091d05678 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -53,6 +53,8 @@ EXTRA_DIST = \ extattr.stderr.exp \ fbsd278566.vgtest \ fbsd278566.stderr.exp \ + fchroot.vgtest \ + fchroot.stderr.exp \ fexecve.vgtest \ fexecve.stderr.exp \ file_locking_wait6.vgtest \ @@ -109,6 +111,8 @@ EXTRA_DIST = \ sctp2.vgtest \ sctp2.stderr.exp \ sctp2.stdout.exp \ + setcred.vgtest \ + setcred.stderr.exp \ setproctitle.vgtest \ setproctitle.stderr.exp \ setproctitle.stdout.exp \ @@ -176,6 +180,11 @@ if HAVE_AIO_READV check_PROGRAMS += aiov endif +if HAVE_FCHROOT +check_PROGRAMS += fchroot +fchroot_SOURCES = fchroot.cpp +endif + if HAVE_GETRLIMITUSAGE check_PROGRAMS += getrlimitusage endif @@ -203,6 +212,12 @@ if FREEBSD_KQUEUEX_SYSCALL check_PROGRAMS += kqueuex endif +if HAVE_SETCRED +check_PROGRAMS += setcred +setcred_SOURCES = setcred.cpp +setcred_CXXFLAGS = ${AM_CXXFLAGS} @FLAG_W_NO_UNINITIALIZED@ +endif + if FREEBSD_TIMERFD_SYSCALL check_PROGRAMS += timerfd timerfd_LDFLAGS = -lm diff --git a/memcheck/tests/freebsd/fchroot.cpp b/memcheck/tests/freebsd/fchroot.cpp new file mode 100644 index 000000000..84b7ee7ad --- /dev/null +++ b/memcheck/tests/freebsd/fchroot.cpp @@ -0,0 +1,17 @@ +#include +#include + +int main() +{ + int fd1; + int* fd2{new int}; + + fd1 = open("..", O_DIRECTORY | O_RDONLY); + // will fail unless run as root + fchroot(fd1); + + fchroot(*fd2); + + delete fd2; +} + diff --git a/memcheck/tests/freebsd/fchroot.stderr.exp b/memcheck/tests/freebsd/fchroot.stderr.exp new file mode 100644 index 000000000..938d3474f --- /dev/null +++ b/memcheck/tests/freebsd/fchroot.stderr.exp @@ -0,0 +1,4 @@ +Syscall param fchroot(fd) contains uninitialised byte(s) + at 0x........: fchroot (in /...libc...) + by 0x........: main (fchroot.cpp:13) + diff --git a/memcheck/tests/freebsd/fchroot.vgtest b/memcheck/tests/freebsd/fchroot.vgtest new file mode 100644 index 000000000..a07103eed --- /dev/null +++ b/memcheck/tests/freebsd/fchroot.vgtest @@ -0,0 +1,3 @@ +prereq: test -e ./fchroot +prog: fchroot +vgopts: -q diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index 65348c232..eddde2f42 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -2450,7 +2450,37 @@ int main(void) FAKE_SY(" ...\n"); FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); FAKE_SY("\n"); -#endif +#endif + +#if defined(SYS_fchroot) + GO(SYS_fchroot, "1s, 0m"); + SY(SYS_fchroot, x0+1000); +#else + FAKE_GO("590: SYS_fchroot 1s, 0m"); + FAKE_SY("Syscall param fchroot(fd) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); +#endif + +#if defined(SYS_setcred) + GO(SYS_setcred, "3s, 1m"); + SY(SYS_setcred, x0+100, x0+3, x0+50); +#else + FAKE_GO("591: SYS_setcred 3s, 1m"); + FAKE_SY("Syscall param setcred(flags) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param setcred(wcred) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param setcred(size) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param setcred(wcred) points to unaddressable byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); + FAKE_SY("\n"); +#endif /* SYS_exit 1 */ GO(SYS_exit, "1s 0m"); diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 0e47fe1aa..59ed18524 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -5740,6 +5740,28 @@ Syscall param getrlimitusage(res) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +590: SYS_fchroot 1s, 0m +--------------------------------------------------------- +Syscall param fchroot(fd) contains uninitialised byte(s) + ... + +--------------------------------------------------------- +591: SYS_setcred 3s, 1m +--------------------------------------------------------- +Syscall param setcred(flags) contains uninitialised byte(s) + ... + +Syscall param setcred(wcred) contains uninitialised byte(s) + ... + +Syscall param setcred(size) contains uninitialised byte(s) + ... + +Syscall param setcred(wcred) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 1: SYS_exit 1s 0m --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/setcred.cpp b/memcheck/tests/freebsd/setcred.cpp new file mode 100644 index 000000000..7553599df --- /dev/null +++ b/memcheck/tests/freebsd/setcred.cpp @@ -0,0 +1,31 @@ +#include +#include + +int main() +{ + struct setcred cred1; + struct setcred* cred2; + int flags1{0}; + int flags2; + size_t size1{sizeof(cred1)}; + size_t size2; + + std::memset(&cred1, 250, sizeof(cred1)); + + // needs to be root to work correctly + setcred(flags1, &cred1, size1); + + // not accessible + setcred(flags1, nullptr, size1); + + // uninit + setcred(flags2, cred2, size2); + + cred2 = new struct setcred; + + // uninit memory + setcred(flags1, cred2, size1); + + delete cred2; +} + diff --git a/memcheck/tests/freebsd/setcred.stderr.exp b/memcheck/tests/freebsd/setcred.stderr.exp new file mode 100644 index 000000000..1d9cecf8e --- /dev/null +++ b/memcheck/tests/freebsd/setcred.stderr.exp @@ -0,0 +1,30 @@ +Syscall param setcred(wcred) points to unaddressable byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:19) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param setcred(flags) contains uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:22) + +Syscall param setcred(wcred) contains uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:22) + +Syscall param setcred(size) contains uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:22) + +Syscall param setcred(wcred) points to uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:22) + Address 0x........ is on thread 1's stack + in frame #2, created by __libc_start1 (???:) + +Syscall param setcred(wcred) points to uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:27) + Address 0x........ is 0 bytes inside a block of size 48 alloc'd + at 0x........: ...operator new... (vg_replace_malloc.c:...) + by 0x........: main (setcred.cpp:24) + diff --git a/memcheck/tests/freebsd/setcred.vgtest b/memcheck/tests/freebsd/setcred.vgtest new file mode 100644 index 000000000..8c4f4d36f --- /dev/null +++ b/memcheck/tests/freebsd/setcred.vgtest @@ -0,0 +1,3 @@ +prereq: test -e ./setcred +prog: setcred +vgopts: -q From c0f090af75d0235b2df775a89c238021021253f4 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 16 May 2025 08:04:06 +0200 Subject: [PATCH 028/412] FreeBSD regtest: update 32bit scalar --- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 6a532ae8e..091a1770d 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -5812,6 +5812,28 @@ Syscall param getrlimitusage(res) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +590: SYS_fchroot 1s, 0m +--------------------------------------------------------- +Syscall param fchroot(fd) contains uninitialised byte(s) + ... + +--------------------------------------------------------- +591: SYS_setcred 3s, 1m +--------------------------------------------------------- +Syscall param setcred(flags) contains uninitialised byte(s) + ... + +Syscall param setcred(wcred) contains uninitialised byte(s) + ... + +Syscall param setcred(size) contains uninitialised byte(s) + ... + +Syscall param setcred(wcred) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 1: SYS_exit 1s 0m --------------------------------------------------------- From 5894abc5fa9de30c6b4dde453bff3ac1034aa330 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 16 May 2025 11:46:06 +0200 Subject: [PATCH 029/412] PR503969: Make test results of make ltpchecks compatible with bunsen Synthesize automake-like testcase log format for bunsen compatibility. Each testcase now produces a triplet of .{log,trs}, and a test-suite.log file. This way test results can be uploaded to bunsen using the t-upload-git-push command. The .log file contains the actual testcase log. The .trs file contains automake-encoded test result. The test-suite.log file contains testcase timing information. The log directory tree respect the one of the LTP testcases to avoid naming collisions. Here is how the test result was uploaded to Bunsen: > TESTING FINISHED, logs in /home/mcermak/WORK/valgrind/valgrind/auxprogs/auxchecks/ltp-full-20250130/ltp > make[1]: Leaving directory '/home/mcermak/WORK/valgrind/valgrind/auxprogs' > > real 8m27.467s > user 44m46.416s > sys 6m46.405s > 41$ cd /home/mcermak/WORK/valgrind/valgrind/auxprogs/auxchecks/ltp-full-20250130/ltp > 41$ t-upload-git-push ssh://builder.sourceware.org/git/bunsendb.git mcermak/PR503969-$(date +%s) \ > $(find . -type f -name '*.log' -o -name '*.trs' -o -name 'test-suite.log') > 3036eba2de1cc44a1942f9681720ea234da9029e refs/tags/mcermak/PR503969-1747389329 > 41$ Here's the resulting bunsen upload: https://builder.sourceware.org/testrun/3036eba2de1cc44a1942f9681720ea234da9029e --- NEWS | 1 + auxprogs/ltp-tester.sh | 51 +++++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/NEWS b/NEWS index bae5f6fcf..d6fbbb41b 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 504101 Add a "vgstack" script 504177 FILE DESCRIPTORS banner shows when closing some inherited fds 501741 syscall cachestat not wrapped +503969 Make test results of make ltpchecks compatible with bunsen 504265 FreeBSD: missing syscall wrappers for fchroot and setcred To see details of a given bug, visit diff --git a/auxprogs/ltp-tester.sh b/auxprogs/ltp-tester.sh index b5ba83c0b..036f196ce 100755 --- a/auxprogs/ltp-tester.sh +++ b/auxprogs/ltp-tester.sh @@ -8,24 +8,21 @@ if [ -z "${LTP_SRC_DIR:-}" ]; then fi ORIG_PATH=$PATH -ORIG_PWD=$PWD -LOGDIR=${LOGDIR:-$LTP_SRC_DIR/valgrind-ltp-logs} -SUMMARY_LOG="$LOGDIR/summary.log" +SCRIPT_SRC=$(dirname $0) +LOGDIR=${LOGDIR:-$LTP_SRC_DIR/ltp} DIFFCMD="diff -u" VALGRIND="${VALGRIND:-$LTP_SRC_DIR/../../../vg-in-place}" # For parallel testing, consider IO intensive jobs, take nproc into account PARALLEL_JOBS=${PARALLEL_JOBS:-$(nproc)} # TESTS env var may be specified to restrict testing to selected test cases +# Configure the LTP testsuite behavior per +# https://lore.kernel.org/ltp/20250505195003.GB137650@pevik/T/#t +export LTP_COLORIZE_OUTPUT=0 +export LTP_REPRODUCIBLE_OUTPUT=1 -# Initialize LOGDIR +# Initialize LOGDIR for bunsen upload (https://sourceware.org/bunsen/) mkdir -p $LOGDIR; rm -rf ${LOGDIR:?}/* -myLog () -{ - msg="$1" - echo "$msg" - echo -e "FAIL: $msg" >> summary -} doTest () { @@ -33,14 +30,17 @@ doTest () nr=$2 dir=$(dirname $t) exe=$(basename $t) - l="$LOGDIR/$exe" + l="$LOGDIR/$dir/$exe" + rv="PASS" mkdir -p $l - echo "[$nr/$c] Testing $exe ..." | tee -a $l/summary + echo "[$nr/$c] Testing $exe ..." pushd $dir >/dev/null PATH="$ORIG_PATH:$PWD" + t1=$(date +%s) ./$exe >$l/log1std 2>$l/log1err ||: $VALGRIND -q --tool=none --log-file=$l/log2 ./$exe >$l/log2std 2>$l/log2err ||: $VALGRIND -q --tool=memcheck --log-file=$l/log3 ./$exe >$l/log3std 2>$l/log3err ||: + t2=$(date +%s) # We want to make sure that LTP syscall tests give identical # results with and without valgrind. The test logs go to the @@ -56,20 +56,28 @@ doTest () # Check logs, report errors pushd $l >/dev/null if test -s log2; then - myLog "${exe}: unempty log2:\n$(cat log2)" + echo -e "${exe}: unempty log2:\n$(cat log2)" | tee -a $l/$exe.log + rv="FAIL" fi - if grep -f $ORIG_PWD/ltp-error-patterns.txt log* > error-patterns-found.txt; then - myLog "${exe}: error string found:\n$(cat error-patterns-found.txt)" + if grep -f $SCRIPT_SRC/ltp-error-patterns.txt log* > error-patterns-found.txt; then + echo -e "${exe}: error string found:\n$(cat error-patterns-found.txt)" | tee -a $l/$exe.log + rv="FAIL" fi if ! ${DIFFCMD} log1summary log2summary >/dev/null; then - myLog "${exe}: ${DIFFCMD} log1summary log2summary:\n$(${DIFFCMD} log1summary log2summary)" + echo -e "${exe}: ${DIFFCMD} log1summary log2summary:\n$(${DIFFCMD} log1summary log2summary)" | tee -a $l/$exe.log + rv="FAIL" fi if ! ${DIFFCMD} log2summary log3summary >/dev/null; then - myLog "${exe}: ${DIFFCMD} log2summary log3summary:\n$(${DIFFCMD} log2summary log3summary)" + echo -e "${exe}: ${DIFFCMD} log2summary log3summary:\n$(${DIFFCMD} log2summary log3summary)" | tee -a $l/$exe.log + rv="FAIL" fi + + # synthetize automake style testlogs for bunsen import + echo ":test-result: $rv" | tee -a $l/$exe.log > $l/$exe.trs + echo "Test time secs: $((t2 - t1))" > $l/test-suite.log popd >/dev/null popd >/dev/null } @@ -83,7 +91,7 @@ if [ -n "$TESTS" ]; then else echo "Running whole the LTP syscall testsuite ..." mapfile -t files < <(find testcases/kernel/syscalls -executable -and -type f \ - | sort | grep -v -f $ORIG_PWD/ltp-excludes.txt) + | sort | grep -v -f $SCRIPT_SRC/ltp-excludes.txt) fi c=${#files[@]}; i=0 @@ -97,11 +105,4 @@ done wait -# Reconstruct $SUMMARY_LOG -for test in "${files[@]}"; do - exe=$(basename $test) - l="$LOGDIR/$exe" - cat $l/summary >> $SUMMARY_LOG -done - echo "TESTING FINISHED, logs in $LOGDIR" From 8dbf86733e76d30c194f5321a72c6b44f1055e20 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 16 May 2025 21:32:02 +0200 Subject: [PATCH 030/412] FreeBSD regtest: updates for FreeBSD 15.0-CURRENT Mostly minor expected/filter changes. Helgrind did detect a race condition in a Valgrind file static variable. Teh DRD dlopen test needs to be linked with the thread library. In a VirtualBox environment I'm getting 4 hanging testcases (3 in gdbserver_tests and none/freebsd/bug452274). --- drd/tests/Makefile.am | 4 +++- freebsd-helgrind.supp | 7 ++++++- helgrind/tests/Makefile.am | 1 + helgrind/tests/filter_fiw | 8 ++++++++ helgrind/tests/free_is_write.stderr.exp | 2 +- helgrind/tests/free_is_write.vgtest | 1 + memcheck/tests/Makefile.am | 2 +- memcheck/tests/filter_sendmsg | 5 +++++ memcheck/tests/sendmsg.stderr.exp | 2 +- memcheck/tests/sendmsg.stderr.exp-freebsd | 7 +++---- memcheck/tests/sendmsg.stderr.exp-freebsd-x86 | 20 ------------------- memcheck/tests/sendmsg.stderr.exp-solaris | 2 +- memcheck/tests/sendmsg.vgtest | 1 + none/tests/fdleak_cmsg_supp.supp | 2 +- 14 files changed, 33 insertions(+), 31 deletions(-) create mode 100755 helgrind/tests/filter_fiw create mode 100755 memcheck/tests/filter_sendmsg delete mode 100644 memcheck/tests/sendmsg.stderr.exp-freebsd-x86 diff --git a/drd/tests/Makefile.am b/drd/tests/Makefile.am index e2030ad15..7fa1611a9 100755 --- a/drd/tests/Makefile.am +++ b/drd/tests/Makefile.am @@ -550,7 +550,9 @@ bug322621_SOURCES = bug322621.cpp condvar_SOURCES = condvar.cpp condvar_CXXFLAGS = $(AM_CXXFLAGS) -std=c++0x concurrent_close_SOURCES = concurrent_close.cpp -if !VGCONF_OS_IS_FREEBSD +if VGCONF_OS_IS_FREEBSD +dlopen_main_LDADD = ${LDADD} +else dlopen_main_LDADD = -ldl endif dlopen_lib_so_SOURCES = dlopen_lib.c diff --git a/freebsd-helgrind.supp b/freebsd-helgrind.supp index dd998f15c..1a6f37249 100644 --- a/freebsd-helgrind.supp +++ b/freebsd-helgrind.supp @@ -238,4 +238,9 @@ Helgrind:Race fun:thr_exit } - +# sigh, this is our own variable in coregrind/m_replacemalloc/vg_replace_malloc.c +{ + FREEBSD15-AMD64-MALLOC + Helgrind:Race + fun:malloc +} diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am index 817e08a72..b8c5fd0e7 100755 --- a/helgrind/tests/Makefile.am +++ b/helgrind/tests/Makefile.am @@ -5,6 +5,7 @@ dist_noinst_SCRIPTS = \ filter_stderr_solaris \ filter_helgrind \ filter_xml \ + filter_fiw \ filter_freebsd.awk \ filter_stderr_freebsd \ filter_bug392331 diff --git a/helgrind/tests/filter_fiw b/helgrind/tests/filter_fiw new file mode 100755 index 000000000..9ff7ae79a --- /dev/null +++ b/helgrind/tests/filter_fiw @@ -0,0 +1,8 @@ +#! /bin/sh + +# free_is_write may have different arena sizes + +./filter_stderr "$@" | + +sed 's/size [^ ]* in arena/size ... in arena/' + diff --git a/helgrind/tests/free_is_write.stderr.exp b/helgrind/tests/free_is_write.stderr.exp index daa327ce0..5d05242ac 100644 --- a/helgrind/tests/free_is_write.stderr.exp +++ b/helgrind/tests/free_is_write.stderr.exp @@ -23,7 +23,7 @@ Locks held: none This conflicts with a previous read of size 1 by thread #x Locks held: none at 0x........: main (free_is_write.c:36) - Address 0x........ is 5 bytes inside an unallocated block of size 16 in arena "client" + Address 0x........ is 5 bytes inside an unallocated block of size ... in arena "client" Done. diff --git a/helgrind/tests/free_is_write.vgtest b/helgrind/tests/free_is_write.vgtest index 5ba9d3423..1e68c6054 100644 --- a/helgrind/tests/free_is_write.vgtest +++ b/helgrind/tests/free_is_write.vgtest @@ -1,2 +1,3 @@ prog: free_is_write vgopts: --free-is-write=yes +stderr_filter: filter_fiw diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index eb3b6f9ee..928ac16e6 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -86,6 +86,7 @@ dist_noinst_SCRIPTS = \ filter_varinfo3 \ filter_memcheck \ filter_malloc_free \ + filter_sendmsg \ filter_size_t \ filter_stanza \ filter_stanza.awk \ @@ -385,7 +386,6 @@ EXTRA_DIST = \ sem.stderr.exp sem.vgtest \ sendmsg.stderr.exp sendmsg.stderr.exp-solaris sendmsg.vgtest \ sendmsg.stderr.exp-freebsd \ - sendmsg.stderr.exp-freebsd-x86 \ sh-mem.stderr.exp sh-mem.vgtest \ sh-mem-random.stderr.exp sh-mem-random.stdout.exp64 \ sh-mem-random.stdout.exp sh-mem-random.vgtest \ diff --git a/memcheck/tests/filter_sendmsg b/memcheck/tests/filter_sendmsg new file mode 100755 index 000000000..c11650dd0 --- /dev/null +++ b/memcheck/tests/filter_sendmsg @@ -0,0 +1,5 @@ +#! /bin/sh + +./filter_stderr "$@" | +sed -e "s/frame #./frame #.../" \ + -e "/by 0x........: sendmsg (in \/...libc...)/d" diff --git a/memcheck/tests/sendmsg.stderr.exp b/memcheck/tests/sendmsg.stderr.exp index 397a57996..1268300b2 100644 --- a/memcheck/tests/sendmsg.stderr.exp +++ b/memcheck/tests/sendmsg.stderr.exp @@ -2,6 +2,6 @@ Syscall param sendmsg(msg) points to uninitialised byte(s) at 0x........: sendmsg (in /...libc...) by 0x........: main (sendmsg.c:46) Address 0x........ is on thread 1's stack - in frame #1, created by main (sendmsg.c:13) + in frame #..., created by main (sendmsg.c:13) sendmsg: 6 diff --git a/memcheck/tests/sendmsg.stderr.exp-freebsd b/memcheck/tests/sendmsg.stderr.exp-freebsd index 7cf17e625..d65f86f05 100644 --- a/memcheck/tests/sendmsg.stderr.exp-freebsd +++ b/memcheck/tests/sendmsg.stderr.exp-freebsd @@ -2,19 +2,18 @@ Syscall param socketcall.connect(serv_addr.sa_len) points to uninitialised byte( ... by 0x........: main (sendmsg.c:29) Address 0x........ is on thread 1's stack - in frame #1, created by main (sendmsg.c:13) + in frame #..., created by main (sendmsg.c:13) Syscall param sendmsg(sendmsg) points to uninitialised byte(s) at 0x........: _sendmsg (in /...libc...) - by 0x........: sendmsg (in /...libc...) by 0x........: main (sendmsg.c:46) Address 0x........ is on thread 1's stack - in frame #2, created by main (sendmsg.c:13) + in frame #..., created by main (sendmsg.c:13) Syscall param socketcall.connect(serv_addr.sa_len) points to uninitialised byte(s) ... by 0x........: main (sendmsg.c:59) Address 0x........ is on thread 1's stack - in frame #1, created by main (sendmsg.c:13) + in frame #..., created by main (sendmsg.c:13) sendmsg: 6 diff --git a/memcheck/tests/sendmsg.stderr.exp-freebsd-x86 b/memcheck/tests/sendmsg.stderr.exp-freebsd-x86 deleted file mode 100644 index 9aafb02af..000000000 --- a/memcheck/tests/sendmsg.stderr.exp-freebsd-x86 +++ /dev/null @@ -1,20 +0,0 @@ -Syscall param socketcall.connect(serv_addr.sa_len) points to uninitialised byte(s) - ... - by 0x........: main (sendmsg.c:29) - Address 0x........ is on thread 1's stack - in frame #2, created by main (sendmsg.c:13) - -Syscall param sendmsg(sendmsg) points to uninitialised byte(s) - at 0x........: _sendmsg (in /...libc...) - by 0x........: sendmsg (in /...libc...) - by 0x........: main (sendmsg.c:46) - Address 0x........ is on thread 1's stack - in frame #2, created by main (sendmsg.c:13) - -Syscall param socketcall.connect(serv_addr.sa_len) points to uninitialised byte(s) - ... - by 0x........: main (sendmsg.c:59) - Address 0x........ is on thread 1's stack - in frame #2, created by main (sendmsg.c:13) - -sendmsg: 6 diff --git a/memcheck/tests/sendmsg.stderr.exp-solaris b/memcheck/tests/sendmsg.stderr.exp-solaris index f00e76e40..3ef45c16a 100644 --- a/memcheck/tests/sendmsg.stderr.exp-solaris +++ b/memcheck/tests/sendmsg.stderr.exp-solaris @@ -3,6 +3,6 @@ Syscall param sendmsg(msg) points to uninitialised byte(s) by 0x........: __xnet_sendmsg (in /...libc...) by 0x........: main (sendmsg.c:46) Address 0x........ is on thread 1's stack - in frame #2, created by main (sendmsg.c:13) + in frame #..., created by main (sendmsg.c:13) sendmsg: 6 diff --git a/memcheck/tests/sendmsg.vgtest b/memcheck/tests/sendmsg.vgtest index f252b62b9..562fc968f 100644 --- a/memcheck/tests/sendmsg.vgtest +++ b/memcheck/tests/sendmsg.vgtest @@ -1,2 +1,3 @@ prog: sendmsg vgopts: -q +stderr_filter: filter_sendmsg diff --git a/none/tests/fdleak_cmsg_supp.supp b/none/tests/fdleak_cmsg_supp.supp index 95f0a31de..cc0daca18 100644 --- a/none/tests/fdleak_cmsg_supp.supp +++ b/none/tests/fdleak_cmsg_supp.supp @@ -52,7 +52,7 @@ sup5 CoreError:FdNotClosed ... - fun:recvmsg + fun:*recvmsg fun:client fun:main } From 4d0f42954087a4b5320a3364f61172dfdfc9e5b8 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 16 May 2025 20:39:42 +0000 Subject: [PATCH 031/412] s390x: disasm-test: add forgotten opcodes SRNMT, LDE, and LDER --- none/tests/s390x/disasm-test/disasm-test.post.exp | 4 ++-- none/tests/s390x/disasm-test/opcode.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/none/tests/s390x/disasm-test/disasm-test.post.exp b/none/tests/s390x/disasm-test/disasm-test.post.exp index 34722229c..0f31f36ca 100644 --- a/none/tests/s390x/disasm-test/disasm-test.post.exp +++ b/none/tests/s390x/disasm-test/disasm-test.post.exp @@ -1,4 +1,4 @@ -Total: 148751 tests generated -Total: 148659 insns verified +Total: 148776 tests generated +Total: 148684 insns verified Total: 0 disassembly mismatches Total: 92 specification exceptions diff --git a/none/tests/s390x/disasm-test/opcode.c b/none/tests/s390x/disasm-test/opcode.c index ef0649133..e98a5e9e5 100644 --- a/none/tests/s390x/disasm-test/opcode.c +++ b/none/tests/s390x/disasm-test/opcode.c @@ -965,6 +965,7 @@ static const char *opcodes[] = { "pfpo", // pfpo "srnm d12(b2)", "srnmb d12(b2)", // fpext + "srnmt d12(b2)", "sfpc r1", // sfasr not implemented "ste f1,d12(x2,b2)", @@ -976,6 +977,8 @@ static const char *opcodes[] = { // Chapter 10: Control Instructions not implemented // Chapter 14: I/O Instructions not implemented // Chapter 18: Hexadecimal-Floating-Point Instructions not implemented + "lder f1,f2", + "lde f1,d12(x2,b2)", // Chapter 19: Binary-Floating-Point Instructions // Register pairs: 0-2 1-3 4-6 5-7 8-10 9-11 12-14 13-15 From 2045aefbb0261bd5844b693e5d390affcffb8749 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 16 May 2025 22:12:39 +0200 Subject: [PATCH 032/412] PR503969: make ltpchecks: flatten the log structure Flatten the directory structure of make ltpchecks logs per PR503969#c9. Individual syscall tests are numbered, so that no testcase naming conflicts should show up. Demo upload: https://builder.sourceware.org/testrun/5b8f868b3e3c84801814dcd4ea963690f94fd2d1 --- auxprogs/ltp-tester.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/auxprogs/ltp-tester.sh b/auxprogs/ltp-tester.sh index 036f196ce..54d807b0c 100755 --- a/auxprogs/ltp-tester.sh +++ b/auxprogs/ltp-tester.sh @@ -9,7 +9,7 @@ fi ORIG_PATH=$PATH SCRIPT_SRC=$(dirname $0) -LOGDIR=${LOGDIR:-$LTP_SRC_DIR/ltp} +LOGDIR=${LOGDIR:-$LTP_SRC_DIR/ltp/tests} DIFFCMD="diff -u" VALGRIND="${VALGRIND:-$LTP_SRC_DIR/../../../vg-in-place}" # For parallel testing, consider IO intensive jobs, take nproc into account @@ -36,11 +36,9 @@ doTest () echo "[$nr/$c] Testing $exe ..." pushd $dir >/dev/null PATH="$ORIG_PATH:$PWD" - t1=$(date +%s) ./$exe >$l/log1std 2>$l/log1err ||: $VALGRIND -q --tool=none --log-file=$l/log2 ./$exe >$l/log2std 2>$l/log2err ||: $VALGRIND -q --tool=memcheck --log-file=$l/log3 ./$exe >$l/log3std 2>$l/log3err ||: - t2=$(date +%s) # We want to make sure that LTP syscall tests give identical # results with and without valgrind. The test logs go to the @@ -56,34 +54,35 @@ doTest () # Check logs, report errors pushd $l >/dev/null if test -s log2; then - echo -e "${exe}: unempty log2:\n$(cat log2)" | tee -a $l/$exe.log + echo -e "${exe}: unempty log2:\n$(cat log2)" | tee -a $LOGDIR/$exe.log rv="FAIL" fi if grep -f $SCRIPT_SRC/ltp-error-patterns.txt log* > error-patterns-found.txt; then - echo -e "${exe}: error string found:\n$(cat error-patterns-found.txt)" | tee -a $l/$exe.log + echo -e "${exe}: error string found:\n$(cat error-patterns-found.txt)" | tee -a $LOGDIR/$exe.log rv="FAIL" fi if ! ${DIFFCMD} log1summary log2summary >/dev/null; then - echo -e "${exe}: ${DIFFCMD} log1summary log2summary:\n$(${DIFFCMD} log1summary log2summary)" | tee -a $l/$exe.log + echo -e "${exe}: ${DIFFCMD} log1summary log2summary:\n$(${DIFFCMD} log1summary log2summary)" | tee -a $LOGDIR/$exe.log rv="FAIL" fi if ! ${DIFFCMD} log2summary log3summary >/dev/null; then - echo -e "${exe}: ${DIFFCMD} log2summary log3summary:\n$(${DIFFCMD} log2summary log3summary)" | tee -a $l/$exe.log + echo -e "${exe}: ${DIFFCMD} log2summary log3summary:\n$(${DIFFCMD} log2summary log3summary)" | tee -a $LOGDIR/$exe.log rv="FAIL" fi # synthetize automake style testlogs for bunsen import - echo ":test-result: $rv" | tee -a $l/$exe.log > $l/$exe.trs - echo "Test time secs: $((t2 - t1))" > $l/test-suite.log + echo ":test-result: $rv" | tee -a $LOGDIR/$exe.log > $LOGDIR/$exe.trs popd >/dev/null popd >/dev/null } cd $LTP_SRC_DIR +echo "See *.log files for details on each test in this directory." > $LOGDIR/test-suite.log + if [ -n "$TESTS" ]; then echo "Running individual syscall tests specified in the TESTS env var ..." mapfile -t files < <(find testcases/kernel/syscalls -executable -and -type f \ From 8187386962598d1393eaf6cf4e032996f5edabb3 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 18 May 2025 15:31:36 +0200 Subject: [PATCH 033/412] Check whether file descriptor is inherited before printing where_opened Inherited file descriptors don't have an ExeContext where they were opened (by the program). So don't try to print the NULL where_opened when reporting double close errors for such file descriptors. Add a testcase none/tests/fdleak_doubleclose0 that crashes valgrind before this fix. https://bugs.kde.org/show_bug.cgi?id=504466 --- coregrind/m_syswrap/syswrap-generic.c | 13 +++++++++---- none/tests/Makefile.am | 3 ++- none/tests/fdleak_doubleclose0.c | 10 ++++++++++ none/tests/fdleak_doubleclose0.stderr.exp | 12 ++++++++++++ none/tests/fdleak_doubleclose0.vgtest | 3 +++ 5 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 none/tests/fdleak_doubleclose0.c create mode 100644 none/tests/fdleak_doubleclose0.stderr.exp create mode 100644 none/tests/fdleak_doubleclose0.vgtest diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 81c8fc028..98cbb172f 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -637,7 +637,8 @@ struct BadCloseExtra { HChar *description; /* Description of the file descriptor might include the pathname */ ExeContext *where_closed; /* record the last close of fd */ - ExeContext *where_opened; /* recordwhere the fd was opened */ + ExeContext *where_opened; /* recordwhere the fd was opened, + NULL if inherited file descriptor */ }; struct FdBadUse { @@ -646,7 +647,8 @@ struct FdBadUse { HChar *description; /* Description of the file descriptor might include the pathname */ ExeContext *where_closed; /* record the last close of fd */ - ExeContext *where_opened; /* recordwhere the fd was opened */ + ExeContext *where_opened; /* recordwhere the fd was opened, + NULL if inherited file descriptor */ }; struct NotClosedExtra { @@ -1197,8 +1199,11 @@ void fd_pp_Error (const Error *err) VG_(pp_ExeContext)( where ); VG_(emit)("%sPreviously closed%s\n", auxpre, auxpost); VG_(pp_ExeContext)(bce->where_closed); - VG_(emit)("%sOriginally opened%s\n", auxpre, auxpost); - VG_(pp_ExeContext)(bce->where_opened); + // Inherited file descriptors where never opened (by the program) + if (bce->where_opened) { + VG_(emit)("%sOriginally opened%s\n", auxpre, auxpost); + VG_(pp_ExeContext)(bce->where_opened); + } } else if (VG_(get_error_kind)(err) == FdNotClosed) { if (xml) VG_(emit)(" FdNotClosed\n"); struct NotClosedExtra *nce = (struct NotClosedExtra *) diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index bebc2f4dd..6305044ca 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -150,6 +150,7 @@ EXTRA_DIST = \ fdleak_creat_xml.stderr.exp fdleak_creat_xml.vgtest \ fdleak_creat_sup.stderr.exp fdleak_creat_sup.supp \ fdleak_creat_sup.vgtest \ + fdleak_doubleclose0.stderr.exp fdleak_doubleclose0.vgtest \ fdleak_dup.stderr.exp fdleak_dup.vgtest \ fdleak_dup_xml.stderr.exp fdleak_dup_xml.vgtest \ fdleak_dup2.stderr.exp fdleak_dup2.vgtest \ @@ -283,7 +284,7 @@ check_PROGRAMS = \ bug492678 \ closeall coolo_strlen \ discard exec-sigmask execve faultstatus fcntl_setown \ - fdleak_cmsg fdleak_creat fdleak_dup fdleak_dup2 \ + fdleak_cmsg fdleak_creat fdleak_doubleclose0 fdleak_dup fdleak_dup2 \ fdleak_fcntl fdleak_ipv4 fdleak_open fdleak_pipe \ fdleak_socketpair \ floored fork fucomip \ diff --git a/none/tests/fdleak_doubleclose0.c b/none/tests/fdleak_doubleclose0.c new file mode 100644 index 000000000..83c89a8c4 --- /dev/null +++ b/none/tests/fdleak_doubleclose0.c @@ -0,0 +1,10 @@ +#include + +int main (int argc, char **argv) +{ + close (0); + close (1); + close (1); + close (0); + return 0; +} diff --git a/none/tests/fdleak_doubleclose0.stderr.exp b/none/tests/fdleak_doubleclose0.stderr.exp new file mode 100644 index 000000000..6487cf8a4 --- /dev/null +++ b/none/tests/fdleak_doubleclose0.stderr.exp @@ -0,0 +1,12 @@ +File descriptor ...: ... is already closed + at 0x........: close (in /...libc...) + by 0x........: main + Previously closed + at 0x........: close (in /...libc...) + by 0x........: main +File descriptor ...: ... is already closed + at 0x........: close (in /...libc...) + by 0x........: main + Previously closed + at 0x........: close (in /...libc...) + by 0x........: main diff --git a/none/tests/fdleak_doubleclose0.vgtest b/none/tests/fdleak_doubleclose0.vgtest new file mode 100644 index 000000000..36d3e36a6 --- /dev/null +++ b/none/tests/fdleak_doubleclose0.vgtest @@ -0,0 +1,3 @@ +prog: fdleak_doubleclose0 +vgopts: -q --track-fds=yes +stderr_filter: filter_fdleak From 382efd0ccbe8447eca4bde0068a205a01d02f90e Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 19 May 2025 08:23:57 +0200 Subject: [PATCH 034/412] Script: move vgstack to configure.ac section with chmod -x Previously wasn't possible to run it in place without doing a chmod -x on it first. --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index caa79c014..a235f1a42 100755 --- a/configure.ac +++ b/configure.ac @@ -5699,7 +5699,6 @@ AC_CONFIG_FILES([ auxprogs/Makefile mpi/Makefile coregrind/Makefile - coregrind/vgstack memcheck/Makefile memcheck/tests/Makefile memcheck/tests/common/Makefile @@ -5791,6 +5790,8 @@ AC_CONFIG_FILES([coregrind/link_tool_exe_darwin], [chmod +x coregrind/link_tool_exe_darwin]) AC_CONFIG_FILES([coregrind/link_tool_exe_solaris], [chmod +x coregrind/link_tool_exe_solaris]) +AC_CONFIG_FILES([coregrind/vgstack], + [chmod +x coregrind/vgstack]) AC_CONFIG_FILES([tests/filter_stderr_basic], [chmod +x tests/filter_stderr_basic]) AC_CONFIG_FILES([tests/filter_discards], From c0791f593265dcb6356a471eebd2594b4619dc7f Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 19 May 2025 08:29:57 +0200 Subject: [PATCH 035/412] .gitignore: add /none/tests/fdleak_doubleclose0 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index be8c1a268..5264bdd29 100644 --- a/.gitignore +++ b/.gitignore @@ -1570,6 +1570,7 @@ /none/tests/fdbaduse /none/tests/fdleak_cmsg /none/tests/fdleak_creat +/none/tests/fdleak_doubleclose0 /none/tests/fdleak_dup /none/tests/fdleak_dup2 /none/tests/fdleak_fcntl From 859d267a456c2921772f0c957bf24f463c51bd93 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Mon, 19 May 2025 11:45:04 +0200 Subject: [PATCH 036/412] PR504341: Prevent LTP setrlimit05 syscall test from crashing valgrind Prevent ltp/testcases/kernel/syscalls/setrlimit/setrlimit05 testcase from crashing valgrind when passing 0xffffffffffff as ARG3 and then trying to dereference it. https://bugs.kde.org/show_bug.cgi?id=504341 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index d6fbbb41b..7bb9a79d1 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 501741 syscall cachestat not wrapped 503969 Make test results of make ltpchecks compatible with bunsen 504265 FreeBSD: missing syscall wrappers for fchroot and setcred +504341 Valgrind killed by LTP syscall testcase setrlimit05 To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index d4653d027..470635f56 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2300,12 +2300,14 @@ PRE(sys_prlimit64) if (ARG4) PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct vki_rlimit64) ); - if (ARG3 && - ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur - > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { - SET_STATUS_Failure( VKI_EINVAL ); - } - else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { + if (ARG3) { + if (ML_(safe_to_deref)( (void*)(Addr)ARG3, sizeof(struct vki_rlimit64) )) { + if (((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur + > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { + SET_STATUS_Failure( VKI_EINVAL ); + } + } + } else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { switch (ARG2) { case VKI_RLIMIT_NOFILE: SET_STATUS_Success( 0 ); From c6c37fd95ad1d89f5f644054d1cccd5ecd385e55 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 19 May 2025 21:42:18 +0200 Subject: [PATCH 037/412] Add fixed bug 504466 double close causes SEGV to NEWS https://bugs.kde.org/show_bug.cgi?id=504466 was fixed by commit 8187386962598d1393eaf6cf4e032996f5edabb3 Check whether file descriptor is inherited before printing where_opened --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 7bb9a79d1..d9f5fa903 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 503969 Make test results of make ltpchecks compatible with bunsen 504265 FreeBSD: missing syscall wrappers for fchroot and setcred 504341 Valgrind killed by LTP syscall testcase setrlimit05 +504466 Double close causes SEGV To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX From f51744ed2d1f07c814b72853ca946da3c94de0f1 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 20 May 2025 12:09:13 +0200 Subject: [PATCH 038/412] PRE(sys_prlimit64): Check ARG3 and ARG4 ML_(safe_to_deref) up front The previous commit 859d267a456c "PR504341: Prevent LTP setrlimit05 syscall test from crashing valgrind" changed the checking logic of the PRE handler changing the if-else control flow. Do the ARG3 and ARG4 ML_(safe_to_deref) checking up front and return EFAULT early so the later checking logic doesn't need to change. https://bugs.kde.org/show_bug.cgi?id=504341 Suggested-by: Matthias --- coregrind/m_syswrap/syswrap-linux.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 470635f56..fa2ab9e9f 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2295,19 +2295,27 @@ PRE(sys_prlimit64) vki_pid_t, pid, unsigned int, resource, const struct rlimit64 *, new_rlim, struct rlimit64 *, old_rlim); - if (ARG3) + if (ARG3) { PRE_MEM_READ( "rlimit64(new_rlim)", ARG3, sizeof(struct vki_rlimit64) ); - if (ARG4) + if (!ML_(safe_to_deref)((void*)(Addr)ARG3, sizeof(struct vki_rlimit64))) { + SET_STATUS_Failure(VKI_EFAULT); + return; + } + } + if (ARG4) { PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct vki_rlimit64) ); - - if (ARG3) { - if (ML_(safe_to_deref)( (void*)(Addr)ARG3, sizeof(struct vki_rlimit64) )) { - if (((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur - > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { - SET_STATUS_Failure( VKI_EINVAL ); - } + if (!ML_(safe_to_deref)((void*)(Addr)ARG4, sizeof(struct vki_rlimit64))) { + SET_STATUS_Failure(VKI_EFAULT); + return; } - } else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { + } + + if (ARG3 && + ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur + > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { + SET_STATUS_Failure( VKI_EINVAL ); + } + else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { switch (ARG2) { case VKI_RLIMIT_NOFILE: SET_STATUS_Success( 0 ); From ebd7dd5ea9504e0d8490507fd2b894647477b085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= Date: Tue, 6 May 2025 06:50:44 -0400 Subject: [PATCH 039/412] Add "yes" argument for the --modify-fds option. Use --modify-fds=yes to restrict the option from affecting the 0/1/2 file descriptors as they're often used for stdin/tdout/stderr redirection. The new possibility is named "yes" because "yes" is used as the default in general. The default behaviour of the --modify-fds option is then such, that highest available file descriptor is returned execept when the lowest stdin/stdout/stderr (0, 1, 2) are available. For example, if we want to redirect stdout to stderr by closing stdout (file descriptor 1) and then calling dup (), file descriptor 1 will be returned and not the highest number available. This is because the following is a common pattern to redirect stdout to stderr: close (1); /* stdout becomes stderr */ ret = dup (2); Add none/tests/track_yes.vgtest and none/tests/track_high.vgtest tests to test --modify-fds=yes/high behave as expected. https://bugs.kde.org/show_bug.cgi?id=502359 --- .gitignore | 1 + NEWS | 1 + coregrind/m_main.c | 10 ++++--- coregrind/m_options.c | 2 +- coregrind/m_syswrap/priv_syswrap-generic.h | 15 ++++++----- docs/xml/manual-core.xml | 6 +++-- include/pub_tool_options.h | 5 ++++ none/tests/Makefile.am | 8 +++--- none/tests/cmdline1.stdout.exp | 2 +- none/tests/cmdline2.stdout.exp | 2 +- none/tests/track_high.stderr.exp | 8 ++++++ none/tests/track_high.vgtest | 4 +++ none/tests/track_std.c | 31 ++++++++++++++++++++++ none/tests/track_yes.stderr.exp | 9 +++++++ none/tests/track_yes.vgtest | 4 +++ 15 files changed, 89 insertions(+), 19 deletions(-) create mode 100644 none/tests/track_high.stderr.exp create mode 100644 none/tests/track_high.vgtest create mode 100644 none/tests/track_std.c create mode 100644 none/tests/track_yes.stderr.exp create mode 100644 none/tests/track_yes.vgtest diff --git a/.gitignore b/.gitignore index 5264bdd29..8cabb96df 100644 --- a/.gitignore +++ b/.gitignore @@ -1675,6 +1675,7 @@ /none/tests/tls /none/tests/track-fds-exec-children /none/tests/track_new +/none/tests/track_std /none/tests/unit_debuglog /none/tests/use_after_close /none/tests/valgrind_cpp_test diff --git a/NEWS b/NEWS index d9f5fa903..1450dfba8 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 504101 Add a "vgstack" script 504177 FILE DESCRIPTORS banner shows when closing some inherited fds 501741 syscall cachestat not wrapped +502359 Add --modify-fds=yes option 503969 Make test results of make ltpchecks compatible with bunsen 504265 FreeBSD: missing syscall wrappers for fchroot and setcred 504341 Valgrind killed by LTP syscall testcase setrlimit05 diff --git a/coregrind/m_main.c b/coregrind/m_main.c index ff82e3a50..4da156fb9 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -115,7 +115,7 @@ static void usage_NORETURN ( int need_help ) " startup exit abexit valgrindabexit all none\n" " --track-fds=no|yes|all track open file descriptors? [no]\n" " all includes reporting inherited file descriptors\n" -" --modify-fds=no|high modify newly open file descriptors? [no]\n" +" --modify-fds=no|yes|high modify newly open file descriptors? [no]\n" " --time-stamp=no|yes add timestamps to log messages? [no]\n" " --log-fd= log messages to file descriptor [2=stderr]\n" " --log-file= log messages to \n" @@ -649,12 +649,14 @@ static void process_option (Clo_Mode mode, } else if VG_STR_CLO(arg, "--modify-fds", tmp_str) { if (VG_(strcmp)(tmp_str, "high") == 0) - VG_(clo_modify_fds) = 1; + VG_(clo_modify_fds) = VG_MODIFY_FD_HIGH; + else if (VG_(strcmp)(tmp_str, "yes") == 0) + VG_(clo_modify_fds) = VG_MODIFY_FD_YES; else if (VG_(strcmp)(tmp_str, "no") == 0) - VG_(clo_modify_fds) = 0; + VG_(clo_modify_fds) = VG_MODIFY_FD_NO; else VG_(fmsg_bad_option)(arg, - "Bad argument, should be 'high' or 'no'\n"); + "Bad argument, should be 'high', 'yes', 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", diff --git a/coregrind/m_options.c b/coregrind/m_options.c index 6f5a4d045..e70ba08e8 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -182,7 +182,7 @@ XArray *VG_(clo_req_tsyms); // array of strings Bool VG_(clo_run_libc_freeres) = True; Bool VG_(clo_run_cxx_freeres) = True; UInt VG_(clo_track_fds) = 0; -UInt VG_(clo_modify_fds) = 0; +UInt VG_(clo_modify_fds) = VG_MODIFY_FD_NO; 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/priv_syswrap-generic.h b/coregrind/m_syswrap/priv_syswrap-generic.h index b24b6b903..eb815840d 100644 --- a/coregrind/m_syswrap/priv_syswrap-generic.h +++ b/coregrind/m_syswrap/priv_syswrap-generic.h @@ -342,13 +342,14 @@ extern SysRes ML_(generic_PRE_sys_mmap) ( TId, UW, UW, UW, UW, UW, Off64 /* Helper macro for POST handlers that return a new file in RES. If possible sets RES (through SET_STATUS_Success) to a new (not yet seem before) file descriptor. */ -#define POST_newFd_RES \ - do { \ - if (VG_(clo_modify_fds) == 1) { \ - int newFd = ML_(get_next_new_fd)(RES); \ - if (newFd != RES) \ - SET_STATUS_Success(newFd); \ - } \ +#define POST_newFd_RES \ + do { \ + if ((VG_(clo_modify_fds) == VG_MODIFY_FD_YES && RES > 2) \ + || (VG_(clo_modify_fds) == VG_MODIFY_FD_HIGH)) { \ + int newFd = ML_(get_next_new_fd)(RES); \ + if (newFd != RES) \ + SET_STATUS_Success(newFd); \ + } \ } while (0) ///////////////////////////////////////////////////////////////// diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml index ffcb8d4bf..7d18d46f3 100644 --- a/docs/xml/manual-core.xml +++ b/docs/xml/manual-core.xml @@ -903,12 +903,14 @@ in most cases. We group the available options by rough categories. - + When enabled, when the program opens a new file descriptor, the highest available file descriptor is returned instead of the - lowest one. + lowest one. Use to restrict the feature from + the 0/1/2 file descriptors as they're often used for stdout/stderr + redirection. diff --git a/include/pub_tool_options.h b/include/pub_tool_options.h index fec61e30f..021f888be 100644 --- a/include/pub_tool_options.h +++ b/include/pub_tool_options.h @@ -419,6 +419,11 @@ extern Bool VG_(clo_keep_debuginfo); /* Track open file descriptors? 0 = No, 1 = Yes, 2 = All (including std) */ extern UInt VG_(clo_track_fds); +/* Whether to adjust file descriptor numbers. Yes does for all nonstd file + descriptors. High does for all file descriptors. */ +#define VG_MODIFY_FD_NO 0 +#define VG_MODIFY_FD_YES 1 +#define VG_MODIFY_FD_HIGH 2 extern UInt VG_(clo_modify_fds); diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 6305044ca..18924b34f 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -272,8 +272,9 @@ EXTRA_DIST = \ fdbaduse.stderr.exp fdbaduse.vgtest \ use_after_close.stderr.exp use_after_close.vgtest \ track_new.stderr.exp track_new.stdout.exp \ - track_new.vgtest track_new.stderr.exp-illumos - + track_new.vgtest track_new.stderr.exp-illumos \ + track_yes.vgtest track_high.vgtest \ + track_yes.stderr.exp track_high.stderr.exp check_PROGRAMS = \ args \ @@ -331,7 +332,8 @@ check_PROGRAMS = \ file_dclose \ fdbaduse \ use_after_close \ - track_new + track_new \ + track_std if HAVE_STATIC_LIBC if ! VGCONF_OS_IS_LINUX diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp index d2f3e5d6a..06a679a11 100644 --- a/none/tests/cmdline1.stdout.exp +++ b/none/tests/cmdline1.stdout.exp @@ -30,7 +30,7 @@ usage: valgrind [options] prog-and-args startup exit abexit valgrindabexit all none --track-fds=no|yes|all track open file descriptors? [no] all includes reporting inherited file descriptors - --modify-fds=no|high modify newly open file descriptors? [no] + --modify-fds=no|yes|high modify newly open file descriptors? [no] --time-stamp=no|yes add timestamps to log messages? [no] --log-fd= log messages to file descriptor [2=stderr] --log-file= log messages to diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index 9a4975746..d7914ae01 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -30,7 +30,7 @@ usage: valgrind [options] prog-and-args startup exit abexit valgrindabexit all none --track-fds=no|yes|all track open file descriptors? [no] all includes reporting inherited file descriptors - --modify-fds=no|high modify newly open file descriptors? [no] + --modify-fds=no|yes|high modify newly open file descriptors? [no] --time-stamp=no|yes add timestamps to log messages? [no] --log-fd= log messages to file descriptor [2=stderr] --log-file= log messages to diff --git a/none/tests/track_high.stderr.exp b/none/tests/track_high.stderr.exp new file mode 100644 index 000000000..f9a605f10 --- /dev/null +++ b/none/tests/track_high.stderr.exp @@ -0,0 +1,8 @@ +FILE DESCRIPTORS: 3 open (1 inherited) at exit. +Open file descriptor ...: ... + ... + +Open file descriptor ...: /dev/null + ... + + diff --git a/none/tests/track_high.vgtest b/none/tests/track_high.vgtest new file mode 100644 index 000000000..c5eb8f546 --- /dev/null +++ b/none/tests/track_high.vgtest @@ -0,0 +1,4 @@ +prog: track_std +vgopts: -q --track-fds=yes --modify-fds=high +stderr_filter: filter_fdleak + diff --git a/none/tests/track_std.c b/none/tests/track_std.c new file mode 100644 index 000000000..2cf01de8f --- /dev/null +++ b/none/tests/track_std.c @@ -0,0 +1,31 @@ +#include +#include +#include +#include + +int +main (void) +{ + char buf[20]; + size_t nbytes; + int ret; + + /* close stdin */ + close (0); + /* open /dev/null as new stdin */ + (void)open ("/dev/null", O_RDONLY); + /* redirect stdout as stderr */ + close (1); + /* stdout becomes stderr */ + ret = dup (2); + + if (ret == 1) { + strcpy(buf, "hello world\n"); + nbytes = strlen(buf); + + /* should come out on stderr */ + write (1, buf, nbytes); + } + + return 0; +} diff --git a/none/tests/track_yes.stderr.exp b/none/tests/track_yes.stderr.exp new file mode 100644 index 000000000..92c790f6c --- /dev/null +++ b/none/tests/track_yes.stderr.exp @@ -0,0 +1,9 @@ +hello world +FILE DESCRIPTORS: 3 open (1 inherited) at exit. +Open file descriptor ...: ... + ... + +Open file descriptor ...: /dev/null + ... + + diff --git a/none/tests/track_yes.vgtest b/none/tests/track_yes.vgtest new file mode 100644 index 000000000..5c55038fd --- /dev/null +++ b/none/tests/track_yes.vgtest @@ -0,0 +1,4 @@ +prog: track_std +vgopts: -q --track-fds=yes --modify-fds=yes +stderr_filter: filter_fdleak + From bcb1146c7d889083a8040941590b2a21f40f8b18 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 22 May 2025 21:38:20 +0200 Subject: [PATCH 040/412] regtest: update none cmdline expecteds for non-linux --- none/tests/cmdline1.stdout.exp-non-linux | 2 +- none/tests/cmdline2.stdout.exp-non-linux | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/none/tests/cmdline1.stdout.exp-non-linux b/none/tests/cmdline1.stdout.exp-non-linux index d36db3976..4049d5ab2 100644 --- a/none/tests/cmdline1.stdout.exp-non-linux +++ b/none/tests/cmdline1.stdout.exp-non-linux @@ -30,7 +30,7 @@ usage: valgrind [options] prog-and-args startup exit abexit valgrindabexit all none --track-fds=no|yes|all track open file descriptors? [no] all includes reporting inherited file descriptors - --modify-fds=no|high modify newly open file descriptors? [no] + --modify-fds=no|yes|high modify newly open file descriptors? [no] --time-stamp=no|yes add timestamps to log messages? [no] --log-fd= log messages to file descriptor [2=stderr] --log-file= log messages to diff --git a/none/tests/cmdline2.stdout.exp-non-linux b/none/tests/cmdline2.stdout.exp-non-linux index 5a44b3bfa..d709ea365 100644 --- a/none/tests/cmdline2.stdout.exp-non-linux +++ b/none/tests/cmdline2.stdout.exp-non-linux @@ -30,7 +30,7 @@ usage: valgrind [options] prog-and-args startup exit abexit valgrindabexit all none --track-fds=no|yes|all track open file descriptors? [no] all includes reporting inherited file descriptors - --modify-fds=no|high modify newly open file descriptors? [no] + --modify-fds=no|yes|high modify newly open file descriptors? [no] --time-stamp=no|yes add timestamps to log messages? [no] --log-fd= log messages to file descriptor [2=stderr] --log-file= log messages to From 432ba029f77a63a27c46d51a28c5f359176cebb8 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 24 May 2025 08:39:40 +0200 Subject: [PATCH 041/412] README_DEVELOPERS: add some platform specific notres for running regtest --- README_DEVELOPERS | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README_DEVELOPERS b/README_DEVELOPERS index 0be02b7da..4444a1750 100644 --- a/README_DEVELOPERS +++ b/README_DEVELOPERS @@ -70,6 +70,44 @@ are also created, for emulating automake-style testsuites, as expected by tools such as bunsen.) +Platform-specific setup for regression tests +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +On some platforms some setup is required otherwise some of the tests +will fail. + +Inherited inotifier file descriptors +------------------------------------ +Seen on openSUSE amd64 KDE, all processes seem to inherit an inotify +file descriptor which interferes with some of the fdleak tests in the +none directory. Here is an example + +lsof | grep inotify | grep bash +bash 13128 paulf 31r a_inode 0,14 0 46 inotify + +I don't know how to turn this off completely. You can close the +file descriptor for the current shell by using + +MY_INOTIFIER=$(lsof 2>&1 | grep $$ | grep inotify | awk '{print $4}' | sed 's/r//') + +if [ -n ${MY_INOTIFIER} ] ; then + exec {MY_INOTIFIER}<&- +fi + +FreeBSD kernel modules and stack guard page +------------------------------------------- +The sctp and mqueuefs kernel modules need to be loaded. As root + +kldload sctp mqueuefs + +Additionally FreeBSD has strange belt and braces thread stack protection +with both the kernel and the allocated thread stack providing guard pages. +This interferes with the memcheck descr_belowsp test. The extra kernel +guard page can be turned off with the following command run as root + +sysctl security.bsd.stack_guard_page=0 + + Running the performance tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To build and run all the performance tests, run "make [--quiet] perf". From 03fe737a1c583c5ec7231b5c146bcfdf7e8cb048 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 24 May 2025 09:44:07 +0200 Subject: [PATCH 042/412] Darwin: removing trailing ... from suppressions They don't serve any purpose --- darwin11.supp | 1 - darwin12.supp | 10 ---------- darwin13.supp | 8 -------- darwin14.supp | 10 ---------- darwin15.supp | 13 ------------- darwin16.supp | 15 --------------- darwin17.supp | 15 --------------- 7 files changed, 72 deletions(-) diff --git a/darwin11.supp b/darwin11.supp index f2fd6f58a..7f8739976 100644 --- a/darwin11.supp +++ b/darwin11.supp @@ -72,7 +72,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } ################ diff --git a/darwin12.supp b/darwin12.supp index d83982498..c3f47c15b 100644 --- a/darwin12.supp +++ b/darwin12.supp @@ -357,7 +357,6 @@ fun:malloc_zone_?alloc ... fun:dyld_register_image_state_change_handler - ... } { @@ -367,7 +366,6 @@ fun:?alloc ... fun:dyld_register_image_state_change_handler - ... } { @@ -378,7 +376,6 @@ ... fun:map_images_nolock fun:map_images - ... } { @@ -389,7 +386,6 @@ ... fun:map_images_nolock fun:map_images - ... } { @@ -399,7 +395,6 @@ fun:malloc_zone_?alloc ... fun:libSystem_initializer - ... } { @@ -409,7 +404,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } { @@ -419,7 +413,6 @@ fun:malloc_zone_?alloc ... fun:libSystem_initializer - ... } { @@ -429,7 +422,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } { @@ -439,7 +431,6 @@ fun:?alloc ... fun:_libxpc_initializer - ... } { @@ -449,7 +440,6 @@ fun:malloc fun:realloc fun:new_sem_from_pool - ... } ##----------------------------------------------------------------------## diff --git a/darwin13.supp b/darwin13.supp index 6ef99e91c..41478738f 100644 --- a/darwin13.supp +++ b/darwin13.supp @@ -31,7 +31,6 @@ fun:_objc_init fun:_os_object_init fun:libSystem_initializer - ... } { @@ -41,7 +40,6 @@ fun:malloc_zone_?alloc ... fun:dyld_register_image_state_change_handler - ... } { @@ -51,7 +49,6 @@ fun:?alloc ... fun:dyld_register_image_state_change_handler - ... } { @@ -62,7 +59,6 @@ ... fun:map_images_nolock fun:map_images - ... } { @@ -73,7 +69,6 @@ ... fun:map_images_nolock fun:map_images - ... } { @@ -83,7 +78,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } { @@ -93,7 +87,6 @@ fun:malloc_zone_?alloc ... fun:libSystem_initializer - ... } { @@ -103,7 +96,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } { diff --git a/darwin14.supp b/darwin14.supp index 63fe2b4e6..8ba4e9d71 100644 --- a/darwin14.supp +++ b/darwin14.supp @@ -32,7 +32,6 @@ fun:_os_object_init fun:libdispatch_init fun:libSystem_initializer - ... } #{ @@ -52,7 +51,6 @@ fun:?alloc ... fun:dyld_register_image_state_change_handler - ... } { @@ -63,7 +61,6 @@ ... fun:map_images_nolock fun:map_images - ... } { @@ -74,7 +71,6 @@ ... fun:map_images_nolock fun:map_images - ... } { @@ -84,7 +80,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } { @@ -94,7 +89,6 @@ fun:malloc_zone_?alloc ... fun:libSystem_initializer - ... } { @@ -104,7 +98,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } #{ @@ -131,7 +124,6 @@ fun:malloc_zone_memalign ... fun:_ZN4dyld24initializeMainExecutableEv - ... } { @@ -141,7 +133,6 @@ fun:?alloc ... fun:libSystem_atfork_child - ... } { @@ -152,7 +143,6 @@ fun:__smakebuf ... fun:printf - ... } ############################################ diff --git a/darwin15.supp b/darwin15.supp index a383d24b6..159e7f66c 100644 --- a/darwin15.supp +++ b/darwin15.supp @@ -32,7 +32,6 @@ fun:_os_object_init fun:libdispatch_init fun:libSystem_initializer - ... } { @@ -41,7 +40,6 @@ fun:malloc_zone_?alloc ... fun:dyld_register_image_state_change_handler - ... } { @@ -51,7 +49,6 @@ fun:?alloc ... fun:dyld_register_image_state_change_handler - ... } { @@ -62,7 +59,6 @@ ... fun:map_images_nolock fun:map_2_images - ... } { @@ -73,7 +69,6 @@ ... fun:map_images_nolock fun:map_2_images - ... } { @@ -83,7 +78,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } { @@ -93,7 +87,6 @@ fun:malloc_zone_?alloc ... fun:libSystem_initializer - ... } { @@ -103,7 +96,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } #{ @@ -130,7 +122,6 @@ fun:malloc_zone_memalign ... fun:_ZN4dyld24initializeMainExecutableEv - ... } { @@ -140,7 +131,6 @@ fun:?alloc ... fun:libSystem_atfork_child - ... } { @@ -151,7 +141,6 @@ fun:__smakebuf ... fun:printf - ... } { @@ -198,7 +187,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } { @@ -208,7 +196,6 @@ fun:malloc_zone_memalign ... fun:_ZN4dyld24initializeMainExecutableEv - ... } diff --git a/darwin16.supp b/darwin16.supp index 18dda6a70..ae31a97a9 100644 --- a/darwin16.supp +++ b/darwin16.supp @@ -32,7 +32,6 @@ fun:_os_object_init fun:libdispatch_init fun:libSystem_initializer - ... } { @@ -41,7 +40,6 @@ fun:malloc_zone_?alloc ... fun:dyld_register_image_state_change_handler - ... } { @@ -51,7 +49,6 @@ fun:?alloc ... fun:dyld_register_image_state_change_handler - ... } { @@ -62,7 +59,6 @@ ... fun:map_images_nolock fun:map_2_images - ... } { @@ -73,7 +69,6 @@ ... fun:map_images_nolock fun:map_2_images - ... } { @@ -83,7 +78,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } { @@ -93,7 +87,6 @@ fun:malloc_zone_?alloc ... fun:libSystem_initializer - ... } { @@ -103,7 +96,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } #{ @@ -130,7 +122,6 @@ fun:malloc_zone_memalign ... fun:_ZN4dyld24initializeMainExecutableEv - ... } { @@ -140,7 +131,6 @@ fun:?alloc ... fun:libSystem_atfork_child - ... } { @@ -151,7 +141,6 @@ fun:__smakebuf ... fun:printf - ... } { @@ -198,7 +187,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } { @@ -208,7 +196,6 @@ fun:malloc_zone_memalign ... fun:_ZN4dyld24initializeMainExecutableEv - ... } @@ -529,7 +516,6 @@ Memcheck:Cond fun:bcmp fun:_ZN16ImageLoaderMachO18validateFirstPagesEPK21linkedit_data_commandiPKhmxRKN11ImageLoader11LinkContextE - ... } { @@ -537,7 +523,6 @@ Memcheck:Value8 fun:bcmp fun:_ZN16ImageLoaderMachO18validateFirstPagesEPK21linkedit_data_commandiPKhmxRKN11ImageLoader11LinkContextE - ... } { diff --git a/darwin17.supp b/darwin17.supp index e58b49422..996688654 100644 --- a/darwin17.supp +++ b/darwin17.supp @@ -32,7 +32,6 @@ fun:_os_object_init fun:libdispatch_init fun:libSystem_initializer - ... } { @@ -41,7 +40,6 @@ fun:malloc_zone_?alloc ... fun:dyld_register_image_state_change_handler - ... } { @@ -51,7 +49,6 @@ fun:?alloc ... fun:dyld_register_image_state_change_handler - ... } { @@ -62,7 +59,6 @@ ... fun:map_images_nolock fun:map_2_images - ... } { @@ -73,7 +69,6 @@ ... fun:map_images_nolock fun:map_2_images - ... } { @@ -83,7 +78,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } { @@ -93,7 +87,6 @@ fun:malloc_zone_?alloc ... fun:libSystem_initializer - ... } { @@ -103,7 +96,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } #{ @@ -130,7 +122,6 @@ fun:malloc_zone_memalign ... fun:_ZN4dyld24initializeMainExecutableEv - ... } { @@ -140,7 +131,6 @@ fun:?alloc ... fun:libSystem_atfork_child - ... } { @@ -151,7 +141,6 @@ fun:__smakebuf ... fun:printf - ... } { @@ -198,7 +187,6 @@ fun:?alloc ... fun:libSystem_initializer - ... } { @@ -208,7 +196,6 @@ fun:malloc_zone_memalign ... fun:_ZN4dyld24initializeMainExecutableEv - ... } @@ -529,7 +516,6 @@ Memcheck:Cond fun:bcmp fun:_ZN16ImageLoaderMachO18validateFirstPagesEPK21linkedit_data_commandiPKhmxRKN11ImageLoader11LinkContextE - ... } { @@ -537,7 +523,6 @@ Memcheck:Value8 fun:bcmp fun:_ZN16ImageLoaderMachO18validateFirstPagesEPK21linkedit_data_commandiPKhmxRKN11ImageLoader11LinkContextE - ... } { From c6b85a3a50f66a55da775f9ad112bb1317e809e1 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 24 May 2025 18:43:03 +0200 Subject: [PATCH 043/412] FreeBSD: change vgdb traces to use PTRACE_CONTINUE rather than Linux PTRACE_CONT --- coregrind/vgdb-invoker-freebsd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/coregrind/vgdb-invoker-freebsd.c b/coregrind/vgdb-invoker-freebsd.c index df34e0a15..607e05991 100644 --- a/coregrind/vgdb-invoker-freebsd.c +++ b/coregrind/vgdb-invoker-freebsd.c @@ -260,7 +260,7 @@ Bool waitstopped (pid_t pid, int signal_expected, const char *msg) ERROR(errno, "PT_LWPINFO failed: signal lost !!!!\n"); signal_queue_sz--; } else { - DEBUG(1, "waitstopped PTRACE_CONT, queuing signal %d" + DEBUG(1, "waitstopped PTRACE_CONTINUE, queuing signal %d" " si_signo %d si_pid %d\n", signal_received, newsiginfo->si_signo, newsiginfo->si_pid); } @@ -270,7 +270,7 @@ Bool waitstopped (pid_t pid, int signal_expected, const char *msg) res = ptrace (PT_CONTINUE, pid, (caddr_t)1, signal_received); } if (res != 0) { - ERROR(errno, "waitstopped PTRACE_CONT\n"); + ERROR(errno, "waitstopped PTRACE_CONTINUE\n"); return False; } } @@ -392,7 +392,7 @@ void restore_and_detach (pid_t pid) if (signal_queue_sz > 0) { int i; for (i = 0; i < signal_queue_sz; i++) { - DEBUG(1, "PTRACE_CONT to transmit queued signal %d\n", + DEBUG(1, "PTRACE_CONTINUE to transmit queued signal %d\n", signal_queue[i].si_signo); res = ptrace (PT_CONTINUE, pid_of_save_regs, (caddr_t)1, signal_queue[i].si_signo); @@ -590,7 +590,7 @@ Bool invoker_invoke_gdbserver (pid_t pid) pid_of_save_regs_continued = False; - /* We PTRACE_CONT-inue pid. + /* We PTRACE_CONTINUE pid. Either gdbserver will be invoked directly (if all threads are interruptible) or gdbserver will be called soon by the scheduler. In the first case, @@ -609,7 +609,7 @@ Bool invoker_invoke_gdbserver (pid_t pid) pid_of_save_regs_continued = True; /* Wait for SIGSTOP generated by m_gdbserver.c give_control_back_to_vgdb */ stopped = waitstopped (pid, SIGSTOP, - "waitpid status after PTRACE_CONT to invoke"); + "waitpid status after PTRACE_CONTINUE to invoke"); if (stopped) { /* Here pid has properly stopped on the break. */ pid_of_save_regs_continued = False; From 7786b075abef51ca3d84b9717915f04b32950b32 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 11 May 2025 15:41:10 +0200 Subject: [PATCH 044/412] Bug 390310 - Output summaries in XML files Original patch contributed by renaultd@free.fr --- coregrind/m_errormgr.c | 15 +- coregrind/m_libcassert.c | 9 +- coregrind/m_libcprint.c | 6 +- coregrind/m_main.c | 6 +- coregrind/m_scheduler/scheduler.c | 2 +- docs/internals/xml-output-protocol6.txt | 246 ++++++++++++++++++ drd/tests/annotate_barrier_xml.stderr.exp | 6 +- ...annotate_trace_memory_xml.stderr.exp-32bit | 6 +- ...te_trace_memory_xml.stderr.exp-32bit-clang | 6 +- ...annotate_trace_memory_xml.stderr.exp-64bit | 6 +- .../annotate_trace_memory_xml.stderr.exp-arm | 6 +- ...nnotate_trace_memory_xml.stderr.exp-mips32 | 6 +- drd/tests/bar_bad_xml.stderr.exp | 5 +- drd/tests/bar_bad_xml.stderr.exp-freebsd | 6 +- drd/tests/bar_bad_xml.stderr.exp-no-barrier | 5 +- drd/tests/bar_bad_xml.stderr.exp-nohang | 6 +- drd/tests/bar_bad_xml.stderr.exp-solaris | 6 +- drd/tests/fp_race_xml.stderr.exp | 6 +- drd/tests/fp_race_xml.stderr.exp-mips32-be | 5 +- drd/tests/fp_race_xml.stderr.exp-mips32-le | 5 +- drd/tests/fp_race_xml.stderr.exp-solaris | 2 +- drd/tests/thread_name_xml.stderr.exp | 6 +- helgrind/tests/filter_xml | 3 +- helgrind/tests/tc06_two_races_xml.stderr.exp | 11 +- .../tc06_two_races_xml.stderr.exp-freebsd | 11 +- memcheck/mc_leakcheck.c | 93 +++++-- memcheck/mc_malloc_wrappers.c | 23 +- memcheck/tests/Makefile.am | 2 +- memcheck/tests/client-msg-as-xml.stderr.exp | 7 +- .../exit_on_first_error_with_xml.stderr.exp | 2 +- memcheck/tests/filter_xml | 9 +- .../freebsd/aligned_alloc_xml.stderr.exp | 8 +- .../delete_sized_mismatch_xml.stderr.exp | 8 +- memcheck/tests/gone_abrt_xml.stderr.exp | 8 +- .../tests/gone_abrt_xml.stderr.exp-freebsd | 10 +- .../tests/gone_abrt_xml.stderr.exp-solaris | 8 +- memcheck/tests/long_namespace_xml.stderr.exp | 8 +- .../long_namespace_xml.stderr.exp-freebsd | 103 ++++++++ memcheck/tests/mismatches_xml.stderr.exp | 8 +- memcheck/tests/mismatches_xml.stderr.exp2 | 8 +- memcheck/tests/posix_memalign_xml.stderr.exp | 8 +- .../tests/realloc_size_zero_xml.stderr.exp | 5 +- ...gned_new_delete_misaligned1_xml.stderr.exp | 8 +- ...gned_new_delete_misaligned2_xml.stderr.exp | 8 +- ...gned_new_delete_misaligned3_xml.stderr.exp | 8 +- memcheck/tests/threadname_xml.stderr.exp | 11 +- memcheck/tests/xml1.stderr.exp | 10 +- memcheck/tests/xml1.stderr.exp-s390x-mvc | 10 +- none/tests/double_close_range_xml.stderr.exp | 5 +- none/tests/fdleak_cmsg_xml.stderr.exp | 5 +- none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le | 2 +- none/tests/fdleak_creat_xml.stderr.exp | 5 +- none/tests/fdleak_dup2_xml.stderr.exp | 5 +- none/tests/fdleak_dup_xml.stderr.exp | 5 +- none/tests/fdleak_fcntl_xml.stderr.exp | 5 +- none/tests/fdleak_ipv4_xml.stderr.exp | 11 +- none/tests/fdleak_ipv4_xml.stderr.exp-nomain | 35 ++- none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le | 11 +- none/tests/fdleak_open_xml.stderr.exp | 5 +- none/tests/fdleak_pipe_xml.stderr.exp | 5 +- none/tests/fdleak_socketpair_xml.stderr.exp | 5 +- .../fdleak_socketpair_xml.stderr.exp-illumos | 5 +- none/tests/file_dclose_xml.stderr.exp | 5 +- none/tests/file_dclose_xml.stderr.exp-nomain | 2 +- none/tests/socket_close_xml.stderr.exp | 5 +- .../tests/socket_close_xml.stderr.exp-ppc64le | 2 +- none/tests/xml-track-fds.stderr.exp | 5 +- 67 files changed, 687 insertions(+), 211 deletions(-) create mode 100644 docs/internals/xml-output-protocol6.txt create mode 100644 memcheck/tests/long_namespace_xml.stderr.exp-freebsd diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c index 2ce919482..8dfeefeed 100644 --- a/coregrind/m_errormgr.c +++ b/coregrind/m_errormgr.c @@ -1116,8 +1116,10 @@ static Bool show_used_suppressions ( void ) any_supp = True; } - if (VG_(clo_xml)) + if (VG_(clo_xml)) { VG_(printf_xml)("\n"); + VG_(printf_xml)("\n"); + } return any_supp; } @@ -1134,10 +1136,19 @@ void VG_(show_all_errors) ( Int verbosity, Bool xml, Int show_error_list) if (verbosity == 0 && show_error_list == 0) return; - /* If we're printing XML, just show the suppressions and stop. */ + /* If we're printing XML, show the suppressions, the summary and stop. */ if (xml) { if (show_error_list > 0) (void)show_used_suppressions(); + VG_(printf_xml)("\n" + " %u\n" + " %u\n" + " %u\n" + " %u\n" + "\n", + n_errs_found, n_err_contexts, + n_errs_suppressed, n_supp_contexts ); + VG_(printf_xml)("\n"); return; } diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c index c6380d4e0..38b064021 100644 --- a/coregrind/m_libcassert.c +++ b/coregrind/m_libcassert.c @@ -498,6 +498,10 @@ static void report_and_quit ( const HChar* report, True, // stack_usage False, // exited_threads startRegsIN); + + if (VG_(clo_xml)) // After flushing outputs + VG_(printf_xml)("\n"); + VG_(printf)( "\n" "Note: see also the FAQ in the source distribution.\n" @@ -535,9 +539,6 @@ void VG_(assert_fail) ( Bool isCore, const HChar* expr, const HChar* file, bugs_to = VG_(details).bug_reports_to; } - if (VG_(clo_xml)) - VG_(printf_xml)("\n"); - // Treat vg_assert2(0, "foo") specially, as a panicky abort if (VG_STREQ(expr, "0")) { VG_(printf)("\n%s: %s:%d (%s): the 'impossible' happened.\n", @@ -567,8 +568,6 @@ __attribute__ ((noreturn)) static void panic ( const HChar* name, const HChar* report, const HChar* str, const UnwindStartRegs* startRegs ) { - if (VG_(clo_xml)) - VG_(printf_xml)("\n"); VG_(printf)("\n%s: the 'impossible' happened:\n %s\n", name, str); report_and_quit(report, startRegs); } diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c index 593889da9..390c0a01a 100644 --- a/coregrind/m_libcprint.c +++ b/coregrind/m_libcprint.c @@ -151,11 +151,7 @@ void VG_(print_preamble)(Bool logging_to_fd) VG_(printf_xml)("\n"); VG_(printf_xml)("\n"); VG_(printf_xml)("\n"); - /* track-fds introduced some new elements. */ - if (VG_(clo_track_fds)) - VG_(printf_xml)("5\n"); - else - VG_(printf_xml)("4\n"); + VG_(printf_xml)("6\n"); VG_(printf_xml)("%s\n", VG_(clo_toolname)); VG_(printf_xml)("\n"); } diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 4da156fb9..128e4298c 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -2309,9 +2309,7 @@ void shutdown_actions_NORETURN( ThreadId tid, // affects what order the messages come. //-------------------------------------------------------------- // First thing in the post-amble is a blank line. - if (VG_(clo_xml)) - VG_(printf_xml)("\n"); - else if (VG_(clo_verbosity) > 0) + if (VG_(clo_verbosity) > 0 && !VG_(clo_xml)) VG_(message)(Vg_UserMsg, "\n"); if (VG_(clo_xml)) { @@ -2353,9 +2351,7 @@ void shutdown_actions_NORETURN( ThreadId tid, } if (VG_(clo_xml)) { - VG_(printf_xml)("\n"); VG_(printf_xml)("\n"); - VG_(printf_xml)("\n"); } VG_(sanity_check_general)( True /*include expensive checks*/ ); diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index 51ba34361..1623dda5a 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -1982,7 +1982,7 @@ Int print_client_message( ThreadId tid, const HChar *format, VG_(get_and_pp_StackTrace)( tid, VG_(clo_backtrace_size) ); if (VG_(clo_xml)) - VG_(printf_xml)( "\n" ); + VG_(printf_xml)( "\n\n" ); return count; } diff --git a/docs/internals/xml-output-protocol6.txt b/docs/internals/xml-output-protocol6.txt new file mode 100644 index 000000000..071ed1182 --- /dev/null +++ b/docs/internals/xml-output-protocol6.txt @@ -0,0 +1,246 @@ +==================================================================== + +11 May 2025 + +Protocol 6 is now always used (unlike protocol 5 which was only +used with--track-fds). The main difference is that the xml output +now contains error summaries. + +==================================================================== + + +Global error summary +-------------------- + +Previously, the non-xml output contained a summary of errors and +suppressions used, like this: + +==3166== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 3 from 3) + +This was not included in the xml output. Starting with protocol 6 it will +be included. The above example would produce + + + 1 + 1 + 3 + 3 + + +Memcheck heap and leak summaries +-------------------------------- + +Memcheck produces two summaries that were not generated for XML. +These are the heap summary, such as + +==80874== HEAP SUMMARY: +==80874== in use at exit: 720 bytes in 5 blocks +==80874== total heap usage: 5 allocs, 0 frees, 720 bytes allocated + +This now generates with --xml=yes + + + + 720 + 5 + + + 5 + 0 + 720 + + + +false + +The final summary is the leak summary. An example of the non-xml output +is as follows: + +==24152== LEAK SUMMARY: +==24152== definitely lost: 48 bytes in 3 blocks +==24152== indirectly lost: 32 bytes in 2 blocks +==24152== possibly lost: 96 bytes in 6 blocks +==24152== still reachable: 64 bytes in 4 blocks +==24152== suppressed: 0 bytes in 0 blocks + +The example above now produces with xml output + + + + 48 + 3 + + + 32 + 2 + + + 96 + 6 + + + 64 + 4 + + + 0 + 0 + + + + +COMMON ELEMENTS +--------------- +BYTES and BLOCKS elements are common to the HEAP and LEAK summaries. + +The BYTES element is + +* INT + +This field indicates the number of bytes of memory that are not deallocated +at exit or user leak check. + +The BLOCKS element is + +* INT + +The block fields contains the number of blocks that have not been deallocated +at exit or user leak check. + + +HEAP SUMMARY +------------ + +The heap summary is contained in a heap_summary element. It contains the +following sub-elements: + +* BYTES AND BLOCKS ELEMENTS + +The second sub-element of heap_summary indicates the total heap usage. + +* ALLOCS FREES AND BYTES ELEMENTS + +The ALLOCS element is + +* INT + +This indicates the total number of allocations during the program run. + +The FREES element is + +* INT + +This indicates the total number of deallocation during the program run. + +The BYTES element is + +* INT + +This indicates the total number of bytes allocated during the program run. + + +ERROR SUMMARY +------------- + +The error summary is contained in an error_summary element. It contains the +following sub-elements: + +* INT + +This field indicates the number of unsuppressed errors that were encountered. + +* INT + +This field indicated the number of unique unsuppressed error contexts. + +* INT + +This is the number of errors that were suppressed. + +* INT + +This is the number of unique error contexts used by the suppressions. + +LEAK SUMMARY +------------ + +The leak summary is contained in a leak_summary element. + +The leak summary sub-elements are: + +* BYTES AND BLOCKS ELEMENTS + +Memory that was definitely lost. + +* BYTES AND BLOCKS ELEMENTS + +Memory that was indirectly lost. + +* BYTES AND BLOCKS ELEMENTS + +Memory that was lost but memcheck cannot determine if it is +definitely lost or still reachable. + +* BYTES BLOCKS AND (optional) REACHABLE_HEURISTIC ELEMENTS + +Memory that was still reachable at exit or the user leak check. + +If the --leak-check-heuristics= option was used then the still_reachable element +may contain further details on the memory and kind of heuristic that the block(s). +correspond to. + +The REACHABLE_HEURISTIC format is + + KIND + INT + INT + + +KIND is one of: + none, stdstring, length64, newarray, multipleinheritance + +* BYTES AND BLOCK ELEMENTS + +Information concerning the amount leaked that was suppressed. + + +Addendum +-------- + +Unfortunately the xml-output-protocol documents were not updated +to reflect some of the memcheck error conditions that were added. +This omission is being rectified here. + +* memcheck error element kind + + Added on 2023-03-10 + + ReallocSizeZero + + realloc() called with a size of zero. + + Added on 2023-09-02 + + InvalidSizeAndAlignment + + an aligned allocation was requested with an invalid size such + as a non-multiple of the alignment + + InvalidAlignment + + an alignment was used that is not allowed such as a non-power + of two + + InvalidSize + + a size of zero was used with an aligned allocation + + MismatchedAllocateDeallocateSize + + the size used for a sized deallocation does not match the + size of the allocated block + + MismatchedAllocateDeallocateAlignment + + the alignment used for a deallocation does not match the + alignment requested when the block was allocated diff --git a/drd/tests/annotate_barrier_xml.stderr.exp b/drd/tests/annotate_barrier_xml.stderr.exp index b34c787e8..702926c18 100644 --- a/drd/tests/annotate_barrier_xml.stderr.exp +++ b/drd/tests/annotate_barrier_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 drd @@ -284,7 +284,6 @@ Done. - FINISHED @@ -323,5 +322,6 @@ Done. ... - +... + diff --git a/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit b/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit index 888084b41..7688aaae7 100644 --- a/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit +++ b/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit @@ -2,7 +2,7 @@ -4 +6 drd @@ -287,7 +287,6 @@ uint64_t Done. - FINISHED @@ -298,5 +297,6 @@ Done. ... - +... + diff --git a/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit-clang b/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit-clang index 13c7a9e5a..057f96054 100644 --- a/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit-clang +++ b/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit-clang @@ -2,7 +2,7 @@ -4 +6 drd @@ -287,7 +287,6 @@ uint64_t Done. - FINISHED @@ -298,5 +297,6 @@ Done. ... - +... + diff --git a/drd/tests/annotate_trace_memory_xml.stderr.exp-64bit b/drd/tests/annotate_trace_memory_xml.stderr.exp-64bit index 8a62b6c46..6f4e8ff4a 100644 --- a/drd/tests/annotate_trace_memory_xml.stderr.exp-64bit +++ b/drd/tests/annotate_trace_memory_xml.stderr.exp-64bit @@ -2,7 +2,7 @@ -4 +6 drd @@ -251,7 +251,6 @@ uint64_t Done. - FINISHED @@ -262,5 +261,6 @@ Done. ... - +... + diff --git a/drd/tests/annotate_trace_memory_xml.stderr.exp-arm b/drd/tests/annotate_trace_memory_xml.stderr.exp-arm index 2af2455ca..146d6574d 100644 --- a/drd/tests/annotate_trace_memory_xml.stderr.exp-arm +++ b/drd/tests/annotate_trace_memory_xml.stderr.exp-arm @@ -2,7 +2,7 @@ -4 +6 drd @@ -299,7 +299,6 @@ uint64_t Done. - FINISHED @@ -310,5 +309,6 @@ Done. ... - +... + diff --git a/drd/tests/annotate_trace_memory_xml.stderr.exp-mips32 b/drd/tests/annotate_trace_memory_xml.stderr.exp-mips32 index 9fc793a41..ef8597835 100644 --- a/drd/tests/annotate_trace_memory_xml.stderr.exp-mips32 +++ b/drd/tests/annotate_trace_memory_xml.stderr.exp-mips32 @@ -2,7 +2,7 @@ -4 +6 drd @@ -323,7 +323,6 @@ uint64_t Done. - FINISHED @@ -334,5 +333,6 @@ Done. ... - +... + diff --git a/drd/tests/bar_bad_xml.stderr.exp b/drd/tests/bar_bad_xml.stderr.exp index 8539f75c7..c6150b899 100644 --- a/drd/tests/bar_bad_xml.stderr.exp +++ b/drd/tests/bar_bad_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 drd @@ -231,5 +231,6 @@ destroy a barrier that was never initialised ... - +... + diff --git a/drd/tests/bar_bad_xml.stderr.exp-freebsd b/drd/tests/bar_bad_xml.stderr.exp-freebsd index 24ac7fe95..460d7f77a 100644 --- a/drd/tests/bar_bad_xml.stderr.exp-freebsd +++ b/drd/tests/bar_bad_xml.stderr.exp-freebsd @@ -2,7 +2,7 @@ -4 +6 drd @@ -251,7 +251,6 @@ destroy a barrier that was never initialised - FINISHED @@ -282,5 +281,6 @@ destroy a barrier that was never initialised ... - +... + diff --git a/drd/tests/bar_bad_xml.stderr.exp-no-barrier b/drd/tests/bar_bad_xml.stderr.exp-no-barrier index 1b7db90d3..26ee071ec 100644 --- a/drd/tests/bar_bad_xml.stderr.exp-no-barrier +++ b/drd/tests/bar_bad_xml.stderr.exp-no-barrier @@ -2,7 +2,7 @@ -4 +6 drd @@ -209,5 +209,6 @@ destroy a barrier that was never initialised ... - +... + diff --git a/drd/tests/bar_bad_xml.stderr.exp-nohang b/drd/tests/bar_bad_xml.stderr.exp-nohang index a47cd603b..14e2fcf45 100644 --- a/drd/tests/bar_bad_xml.stderr.exp-nohang +++ b/drd/tests/bar_bad_xml.stderr.exp-nohang @@ -2,7 +2,7 @@ -4 +6 drd @@ -229,7 +229,6 @@ destroy a barrier that was never initialised - FINISHED @@ -260,5 +259,6 @@ destroy a barrier that was never initialised ... - +... + diff --git a/drd/tests/bar_bad_xml.stderr.exp-solaris b/drd/tests/bar_bad_xml.stderr.exp-solaris index acb965656..59a0c89d5 100644 --- a/drd/tests/bar_bad_xml.stderr.exp-solaris +++ b/drd/tests/bar_bad_xml.stderr.exp-solaris @@ -2,7 +2,7 @@ -4 +6 drd @@ -276,7 +276,6 @@ destroy a barrier that was never initialised - FINISHED @@ -311,5 +310,6 @@ destroy a barrier that was never initialised ... - +... + diff --git a/drd/tests/fp_race_xml.stderr.exp b/drd/tests/fp_race_xml.stderr.exp index 05ffe71e5..17409062b 100644 --- a/drd/tests/fp_race_xml.stderr.exp +++ b/drd/tests/fp_race_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 drd @@ -81,7 +81,6 @@ drd_post_thread_join joiner = 1, joinee = 2, new vc: [ ... ] drd_thread_finished tid = 1 - FINISHED @@ -100,5 +99,6 @@ ... - +... + diff --git a/drd/tests/fp_race_xml.stderr.exp-mips32-be b/drd/tests/fp_race_xml.stderr.exp-mips32-be index 2960a3907..d5bfdd99f 100644 --- a/drd/tests/fp_race_xml.stderr.exp-mips32-be +++ b/drd/tests/fp_race_xml.stderr.exp-mips32-be @@ -2,7 +2,7 @@ -4 +6 drd @@ -154,5 +154,6 @@ ... - +... + diff --git a/drd/tests/fp_race_xml.stderr.exp-mips32-le b/drd/tests/fp_race_xml.stderr.exp-mips32-le index a0edb5e89..d6703d641 100644 --- a/drd/tests/fp_race_xml.stderr.exp-mips32-le +++ b/drd/tests/fp_race_xml.stderr.exp-mips32-le @@ -2,7 +2,7 @@ -4 +6 drd @@ -154,5 +154,6 @@ ... - +... + diff --git a/drd/tests/fp_race_xml.stderr.exp-solaris b/drd/tests/fp_race_xml.stderr.exp-solaris index 05ffe71e5..2063aa4f0 100644 --- a/drd/tests/fp_race_xml.stderr.exp-solaris +++ b/drd/tests/fp_race_xml.stderr.exp-solaris @@ -2,7 +2,7 @@ -4 +6 drd diff --git a/drd/tests/thread_name_xml.stderr.exp b/drd/tests/thread_name_xml.stderr.exp index 36b53604e..0e47f5fff 100644 --- a/drd/tests/thread_name_xml.stderr.exp +++ b/drd/tests/thread_name_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 drd @@ -388,7 +388,6 @@ thread_func instance 10 - FINISHED @@ -439,5 +438,6 @@ thread_func instance 10 ... - +... + diff --git a/helgrind/tests/filter_xml b/helgrind/tests/filter_xml index cc0b71ea0..e9475f04a 100755 --- a/helgrind/tests/filter_xml +++ b/helgrind/tests/filter_xml @@ -40,7 +40,8 @@ my %patterns = ( "0x([0-9a-zA-Z]+)" => "........", "Using Valgrind-([^\\s]*)" => "X.Y.X", "Copyright \\(C\\) ([0-9]{4}-[0-9]{4}).*" => "XXXX-YYYY", - 'pthread_.*(@\*)' => "" + 'pthread_.*(@\*)' => "", + "(.*)" => "..." ); # List of XML sections to be ignored. diff --git a/helgrind/tests/tc06_two_races_xml.stderr.exp b/helgrind/tests/tc06_two_races_xml.stderr.exp index a442a285e..800ef543f 100644 --- a/helgrind/tests/tc06_two_races_xml.stderr.exp +++ b/helgrind/tests/tc06_two_races_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 helgrind @@ -245,7 +245,6 @@ declared at tc06_two_races.c:9 tc06_two_races.c 9 - FINISHED @@ -255,5 +254,11 @@ ... - + + 4 + 4 + 7 + ... + + diff --git a/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd b/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd index 65a79a759..724649cb6 100644 --- a/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd +++ b/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd @@ -2,7 +2,7 @@ -4 +6 helgrind @@ -237,7 +237,6 @@ declared at tc06_two_races.c:9 tc06_two_races.c 9 - FINISHED @@ -247,5 +246,11 @@ ... - + + 4 + 4 + 7 + ... + + diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c index 83a2b74e2..3099a04dd 100644 --- a/memcheck/mc_leakcheck.c +++ b/memcheck/mc_leakcheck.c @@ -1722,7 +1722,9 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp) VG_(XT_delete)(leak_xt); } - if (VG_(clo_verbosity) > 0 && !VG_(clo_xml)) { + UInt (*umsg_or_xml)( const HChar *, ... ) + = VG_(clo_xml) ? VG_(printf_xml) : VG_(umsg); + if (VG_(clo_verbosity) > 0) { HChar d_bytes[31]; HChar d_blocks[31]; # define DBY(new,old) \ @@ -1732,23 +1734,42 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp) MC_(snprintf_delta) (d_blocks, sizeof(d_blocks), (new), (old), \ lcp->deltamode) - VG_(umsg)("LEAK SUMMARY:\n"); - VG_(umsg)(" definitely lost: %'lu%s bytes in %'lu%s blocks\n", + umsg_or_xml(VG_(clo_xml) ? "\n" : "LEAK SUMMARY:\n"); + umsg_or_xml(VG_(clo_xml) ? + " \n" + " %'lu%s\n" + " %'lu%s\n" + " \n" : + " definitely lost: %'lu%s bytes in %'lu%s blocks\n", MC_(bytes_leaked), DBY (MC_(bytes_leaked), old_bytes_leaked), MC_(blocks_leaked), DBL (MC_(blocks_leaked), old_blocks_leaked)); - VG_(umsg)(" indirectly lost: %'lu%s bytes in %'lu%s blocks\n", + umsg_or_xml(VG_(clo_xml) ? + " \n" + " %'lu%s\n" + " %'lu%s\n" + " \n" : + " indirectly lost: %'lu%s bytes in %'lu%s blocks\n", MC_(bytes_indirect), DBY (MC_(bytes_indirect), old_bytes_indirect), MC_(blocks_indirect), DBL (MC_(blocks_indirect), old_blocks_indirect)); - VG_(umsg)(" possibly lost: %'lu%s bytes in %'lu%s blocks\n", + umsg_or_xml(VG_(clo_xml) ? + " \n" + " %'lu%s\n" + " %'lu%s\n" + " \n" : + " possibly lost: %'lu%s bytes in %'lu%s blocks\n", MC_(bytes_dubious), DBY (MC_(bytes_dubious), old_bytes_dubious), MC_(blocks_dubious), DBL (MC_(blocks_dubious), old_blocks_dubious)); - VG_(umsg)(" still reachable: %'lu%s bytes in %'lu%s blocks\n", + umsg_or_xml(VG_(clo_xml) ? + " \n" + " %'lu%s\n" + " %'lu%s\n" : + " still reachable: %'lu%s bytes in %'lu%s blocks\n", MC_(bytes_reachable), DBY (MC_(bytes_reachable), old_bytes_reachable), MC_(blocks_reachable), @@ -1756,15 +1777,21 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp) for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++) if (old_blocks_heuristically_reachable[i] > 0 || MC_(blocks_heuristically_reachable)[i] > 0) { - VG_(umsg)(" of which " + umsg_or_xml(VG_(clo_xml) ? "" : " of which " "reachable via heuristic:\n"); break; } for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++) if (old_blocks_heuristically_reachable[i] > 0 || MC_(blocks_heuristically_reachable)[i] > 0) - VG_(umsg)(" %-19s: " - "%'lu%s bytes in %'lu%s blocks\n", + umsg_or_xml(VG_(clo_xml) ? + " \n" + " %ls\n" + " %'lu%s\n" + " %'lu%s\n" + " \n" : + " %-19s: " + "%'lu%s bytes in %'lu%s blocks\n", pp_heuristic(i), MC_(bytes_heuristically_reachable)[i], DBY (MC_(bytes_heuristically_reachable)[i], @@ -1772,32 +1799,41 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp) MC_(blocks_heuristically_reachable)[i], DBL (MC_(blocks_heuristically_reachable)[i], old_blocks_heuristically_reachable[i])); - VG_(umsg)(" suppressed: %'lu%s bytes in %'lu%s blocks\n", - MC_(bytes_suppressed), - DBY (MC_(bytes_suppressed), old_bytes_suppressed), + if (VG_(clo_xml) && MC_(bytes_reachable)) { + umsg_or_xml(" \n"); + } + umsg_or_xml(VG_(clo_xml) ? + " \n" + " %'lu%s\n" + " %'lu%s\n" + " \n" : + " suppressed: %'lu%s bytes in %'lu%s blocks\n", + MC_(bytes_suppressed), + DBY (MC_(bytes_suppressed), old_bytes_suppressed), MC_(blocks_suppressed), DBL (MC_(blocks_suppressed), old_blocks_suppressed)); if (lcp->mode != LC_Full && (MC_(blocks_leaked) + MC_(blocks_indirect) + MC_(blocks_dubious) + MC_(blocks_reachable)) > 0) { if (lcp->requested_by_monitor_command) - VG_(umsg)("To see details of leaked memory, " - "give 'full' arg to leak_check\n"); + umsg_or_xml(VG_(clo_xml) ? "" : "To see details of leaked memory, " + "give 'full' arg to leak_check\n"); else - VG_(umsg)("Rerun with --leak-check=full to see details " - "of leaked memory\n"); + umsg_or_xml(VG_(clo_xml) ? "" : "Rerun with --leak-check=full to " + "see details of leaked memory\n"); } if (lcp->mode == LC_Full && MC_(blocks_reachable) > 0 && !RiS(Reachable,lcp->show_leak_kinds)) { - VG_(umsg)("Reachable blocks (those to which a pointer " - "was found) are not shown.\n"); + umsg_or_xml(VG_(clo_xml) ? "" : "Reachable blocks (those to which a " + "pointer was found) are not shown.\n"); if (lcp->requested_by_monitor_command) - VG_(umsg)("To see them, add 'reachable any' args to leak_check\n"); + umsg_or_xml(VG_(clo_xml) ? "" : "To see them, add 'reachable any' " + "args to leak_check\n"); else - VG_(umsg)("To see them, rerun with: --leak-check=full " - "--show-leak-kinds=all\n"); + umsg_or_xml(VG_(clo_xml) ? "" : "To see them, rerun with: " + "--leak-check=full --show-leak-kinds=all\n"); } - VG_(umsg)("\n"); + umsg_or_xml(VG_(clo_xml) ? "\n\n" : "\n"); #undef DBL #undef DBY } @@ -2056,11 +2092,17 @@ void MC_(detect_memory_leaks) ( ThreadId tid, LeakCheckParams* lcp) VG_(OSetGen_Destroy) (lr_table); lr_table = NULL; } - if (VG_(clo_verbosity) >= 1 && !VG_(clo_xml)) { - VG_(umsg)("All heap blocks were freed -- no leaks are possible\n"); - VG_(umsg)("\n"); + if (VG_(clo_verbosity) >= 1) { + if (!VG_(clo_xml)) { + VG_(umsg)("All heap blocks were freed -- no leaks are possible\n"); + VG_(umsg)("\n"); + } else + VG_(printf_xml)("true\n\n"); } return; + } else { + if (VG_(clo_verbosity) >= 1 && VG_(clo_xml)) + VG_(printf_xml)("false\n\n"); } // Sanity check -- make sure they don't overlap. One exception is that @@ -2301,4 +2343,3 @@ void MC_(who_points_at) ( Addr address, SizeT szB) /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/ - diff --git a/memcheck/mc_malloc_wrappers.c b/memcheck/mc_malloc_wrappers.c index 48f26902c..584afa50e 100644 --- a/memcheck/mc_malloc_wrappers.c +++ b/memcheck/mc_malloc_wrappers.c @@ -1229,8 +1229,6 @@ void MC_(print_malloc_stats) ( void ) if (VG_(clo_verbosity) == 0) return; - if (VG_(clo_xml)) - return; /* Count memory still in use. */ VG_(HT_ResetIter)(MC_(malloc_list)); @@ -1239,6 +1237,27 @@ void MC_(print_malloc_stats) ( void ) nbytes += (ULong)mc->szB; } + if (VG_(clo_xml)) { + VG_(printf_xml)( + "\n" + " \n" + " %'llu\n" + " %'lu\n" + " \n" + " \n" + " %'lu\n" + " %'lu\n" + " %'llu\n" + " \n" + "\n" + "\n", + nbytes, nblocks, + cmalloc_n_mallocs, + cmalloc_n_frees, cmalloc_bs_mallocd + ); + return; + } + VG_(umsg)( "HEAP SUMMARY:\n" " in use at exit: %'llu bytes in %'lu blocks\n" diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 928ac16e6..db6cd1786 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -257,7 +257,7 @@ EXTRA_DIST = \ leak-segv-jmp.vgtest leak-segv-jmp.stderr.exp \ lks.vgtest lks.stdout.exp lks.supp lks.stderr.exp \ long_namespace_xml.vgtest long_namespace_xml.stdout.exp \ - long_namespace_xml.stderr.exp \ + long_namespace_xml.stderr.exp long_namespace_xml.stderr.exp-freebsd \ long-supps.vgtest long-supps.stderr.exp long-supps.supp \ mallinfo.stderr.exp mallinfo.vgtest \ malloc_free_fill.vgtest \ diff --git a/memcheck/tests/client-msg-as-xml.stderr.exp b/memcheck/tests/client-msg-as-xml.stderr.exp index af97c61ab..609f5826b 100644 --- a/memcheck/tests/client-msg-as-xml.stderr.exp +++ b/memcheck/tests/client-msg-as-xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -81,10 +81,13 @@ +... + ... - +... + diff --git a/memcheck/tests/exit_on_first_error_with_xml.stderr.exp b/memcheck/tests/exit_on_first_error_with_xml.stderr.exp index 3a02ca532..6061fc19a 100644 --- a/memcheck/tests/exit_on_first_error_with_xml.stderr.exp +++ b/memcheck/tests/exit_on_first_error_with_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck diff --git a/memcheck/tests/filter_xml b/memcheck/tests/filter_xml index 9244706c3..2c63cddbc 100755 --- a/memcheck/tests/filter_xml +++ b/memcheck/tests/filter_xml @@ -22,13 +22,20 @@ sed "s/operator delete\[\](void\*, unsigned int/operator delete[](void*, unsigne sed "s/4294967295/18446744073709551615/" | sed "s/malloc_zone_memalign/posix_memalign/" | perl -p -e "s/(m_replacemalloc\/)?vg_replace_malloc.c/vg_replace_malloc.c/" | +perl -0 -p -e "s/.*<\/heap_summary>/...<\/heap_summary>/s" | +perl -0 -p -e "s/.*<\/error_summary>/...<\/error_summary>/s" | +perl -0 -p -e "s/.*<\/leak_summary>/...<\/leak_summary>/s" | perl -0 -p -e "s/.*<\/suppcounts>/...<\/suppcounts>/s" | perl -p -e "s/ diff --git a/memcheck/tests/freebsd/delete_sized_mismatch_xml.stderr.exp b/memcheck/tests/freebsd/delete_sized_mismatch_xml.stderr.exp index 55225906f..f63cdadb9 100644 --- a/memcheck/tests/freebsd/delete_sized_mismatch_xml.stderr.exp +++ b/memcheck/tests/freebsd/delete_sized_mismatch_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -116,12 +116,13 @@ - FINISHED +... + ... @@ -135,5 +136,6 @@ ... - +... + diff --git a/memcheck/tests/gone_abrt_xml.stderr.exp b/memcheck/tests/gone_abrt_xml.stderr.exp index b0faf73bd..9f7b1f52f 100644 --- a/memcheck/tests/gone_abrt_xml.stderr.exp +++ b/memcheck/tests/gone_abrt_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -48,16 +48,18 @@ aborting ... - FINISHED +... + ... - +... + diff --git a/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd b/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd index c97485faf..04643bbff 100644 --- a/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd +++ b/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -48,16 +48,20 @@ aborting ... - FINISHED +... + +... + ... - +... + diff --git a/memcheck/tests/gone_abrt_xml.stderr.exp-solaris b/memcheck/tests/gone_abrt_xml.stderr.exp-solaris index a6c88df27..1c307433f 100644 --- a/memcheck/tests/gone_abrt_xml.stderr.exp-solaris +++ b/memcheck/tests/gone_abrt_xml.stderr.exp-solaris @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -50,16 +50,18 @@ aborting ... - FINISHED +... + ... - +... + diff --git a/memcheck/tests/long_namespace_xml.stderr.exp b/memcheck/tests/long_namespace_xml.stderr.exp index 775fac002..522996592 100644 --- a/memcheck/tests/long_namespace_xml.stderr.exp +++ b/memcheck/tests/long_namespace_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -80,12 +80,13 @@ - FINISHED +... + ... @@ -95,5 +96,6 @@ ... - +... + diff --git a/memcheck/tests/long_namespace_xml.stderr.exp-freebsd b/memcheck/tests/long_namespace_xml.stderr.exp-freebsd new file mode 100644 index 000000000..e4a9b08fc --- /dev/null +++ b/memcheck/tests/long_namespace_xml.stderr.exp-freebsd @@ -0,0 +1,103 @@ + + + + +6 +memcheck + + + ... + ... + ... + ... + + +... +... +memcheck + + + ... + + ./long_namespace_xml + + + + + RUNNING + + + + + 0x........ + ... + InvalidWrite + Invalid write of size 1 + + + 0x........ + ... + _ZN5304abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz5304ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ1fEv + ... + long_namespace_xml.cpp + ... + + + 0x........ + ... + main + ... + long_namespace_xml.cpp + ... + + + Address 0x........ is 1 bytes after a block of size 4 alloc'd + + + 0x........ + ... + malloc + ... + vg_replace_malloc.c + ... + + + 0x........ + ... + _ZN5304abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz5304ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ1fEv + ... + long_namespace_xml.cpp + ... + + + 0x........ + ... + main + ... + long_namespace_xml.cpp + ... + + + + + + FINISHED + + + +... + +... + + + + ... + 0x........ + + + +... + +... + + diff --git a/memcheck/tests/mismatches_xml.stderr.exp b/memcheck/tests/mismatches_xml.stderr.exp index 95c77bf3c..20e9a7ead 100644 --- a/memcheck/tests/mismatches_xml.stderr.exp +++ b/memcheck/tests/mismatches_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -292,12 +292,13 @@ - FINISHED +... + ... @@ -327,5 +328,6 @@ ... - +... + diff --git a/memcheck/tests/mismatches_xml.stderr.exp2 b/memcheck/tests/mismatches_xml.stderr.exp2 index 17972cd06..19eb022f3 100644 --- a/memcheck/tests/mismatches_xml.stderr.exp2 +++ b/memcheck/tests/mismatches_xml.stderr.exp2 @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -380,12 +380,13 @@ - FINISHED +... + ... @@ -423,5 +424,6 @@ ... - +... + diff --git a/memcheck/tests/posix_memalign_xml.stderr.exp b/memcheck/tests/posix_memalign_xml.stderr.exp index ad30c3d10..ce9ded320 100644 --- a/memcheck/tests/posix_memalign_xml.stderr.exp +++ b/memcheck/tests/posix_memalign_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -278,12 +278,13 @@ - FINISHED +... + ... @@ -329,5 +330,6 @@ ... - +... + diff --git a/memcheck/tests/realloc_size_zero_xml.stderr.exp b/memcheck/tests/realloc_size_zero_xml.stderr.exp index 3b6450ff4..db198b7ce 100644 --- a/memcheck/tests/realloc_size_zero_xml.stderr.exp +++ b/memcheck/tests/realloc_size_zero_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -72,7 +72,6 @@ - FINISHED @@ -85,6 +84,4 @@ - - diff --git a/memcheck/tests/sized_aligned_new_delete_misaligned1_xml.stderr.exp b/memcheck/tests/sized_aligned_new_delete_misaligned1_xml.stderr.exp index b8e230165..5a2602b46 100644 --- a/memcheck/tests/sized_aligned_new_delete_misaligned1_xml.stderr.exp +++ b/memcheck/tests/sized_aligned_new_delete_misaligned1_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -454,12 +454,13 @@ - FINISHED +... + ... @@ -521,5 +522,6 @@ ... - +... + diff --git a/memcheck/tests/sized_aligned_new_delete_misaligned2_xml.stderr.exp b/memcheck/tests/sized_aligned_new_delete_misaligned2_xml.stderr.exp index 321ed1dce..a785bd236 100644 --- a/memcheck/tests/sized_aligned_new_delete_misaligned2_xml.stderr.exp +++ b/memcheck/tests/sized_aligned_new_delete_misaligned2_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -58,6 +58,7 @@ new/new[] aligned failed and should throw an exception, but Valgrind + ... cannot throw exceptions and so is aborting instead. Sorry. @@ -95,6 +96,8 @@ +... + ... @@ -104,5 +107,6 @@ ... - +... + diff --git a/memcheck/tests/sized_aligned_new_delete_misaligned3_xml.stderr.exp b/memcheck/tests/sized_aligned_new_delete_misaligned3_xml.stderr.exp index f2fe0134b..f7c23306f 100644 --- a/memcheck/tests/sized_aligned_new_delete_misaligned3_xml.stderr.exp +++ b/memcheck/tests/sized_aligned_new_delete_misaligned3_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -58,6 +58,7 @@ new/new[] aligned failed and should throw an exception, but Valgrind + ... cannot throw exceptions and so is aborting instead. Sorry. @@ -95,6 +96,8 @@ +... + ... @@ -104,5 +107,6 @@ ... - +... + diff --git a/memcheck/tests/threadname_xml.stderr.exp b/memcheck/tests/threadname_xml.stderr.exp index 3f9e593e2..1671b50a2 100644 --- a/memcheck/tests/threadname_xml.stderr.exp +++ b/memcheck/tests/threadname_xml.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -191,6 +191,7 @@ I am in child_fn_1 + 0x........ ... @@ -296,12 +297,15 @@ - FINISHED +... + +... + ... @@ -327,5 +331,6 @@ ... - +... + diff --git a/memcheck/tests/xml1.stderr.exp b/memcheck/tests/xml1.stderr.exp index 3eba80599..8ff61a531 100644 --- a/memcheck/tests/xml1.stderr.exp +++ b/memcheck/tests/xml1.stderr.exp @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -344,12 +344,13 @@ Syscall param exit(status) contains uninitialised byte(s) - FINISHED +... + 0x........ ... @@ -403,6 +404,8 @@ +... + ... @@ -432,5 +435,6 @@ ... - +... + diff --git a/memcheck/tests/xml1.stderr.exp-s390x-mvc b/memcheck/tests/xml1.stderr.exp-s390x-mvc index e1abac28a..d7bf2095e 100644 --- a/memcheck/tests/xml1.stderr.exp-s390x-mvc +++ b/memcheck/tests/xml1.stderr.exp-s390x-mvc @@ -2,7 +2,7 @@ -4 +6 memcheck @@ -344,12 +344,13 @@ Syscall param exit(status) contains uninitialised byte(s) - FINISHED +... + 0x........ ... @@ -403,6 +404,8 @@ +... + ... @@ -432,5 +435,6 @@ ... - +... + diff --git a/none/tests/double_close_range_xml.stderr.exp b/none/tests/double_close_range_xml.stderr.exp index c21a2bcdd..22027dc1a 100644 --- a/none/tests/double_close_range_xml.stderr.exp +++ b/none/tests/double_close_range_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -123,7 +123,6 @@ Double closing range (5, 7). - FINISHED @@ -140,6 +139,4 @@ Double closing range (5, 7). - - diff --git a/none/tests/fdleak_cmsg_xml.stderr.exp b/none/tests/fdleak_cmsg_xml.stderr.exp index 39b739be7..2fbb664b4 100644 --- a/none/tests/fdleak_cmsg_xml.stderr.exp +++ b/none/tests/fdleak_cmsg_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -37,7 +37,6 @@ - FINISHED @@ -150,6 +149,4 @@ ... - - diff --git a/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le b/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le index 6294094eb..1ab6c6fe0 100644 --- a/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le +++ b/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le @@ -2,7 +2,7 @@ -5 +6 none diff --git a/none/tests/fdleak_creat_xml.stderr.exp b/none/tests/fdleak_creat_xml.stderr.exp index fbdc261d6..5c585a224 100644 --- a/none/tests/fdleak_creat_xml.stderr.exp +++ b/none/tests/fdleak_creat_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -36,7 +36,6 @@ - FINISHED @@ -88,6 +87,4 @@ ... - - diff --git a/none/tests/fdleak_dup2_xml.stderr.exp b/none/tests/fdleak_dup2_xml.stderr.exp index 318093bd3..de6ed7833 100644 --- a/none/tests/fdleak_dup2_xml.stderr.exp +++ b/none/tests/fdleak_dup2_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -36,7 +36,6 @@ - FINISHED @@ -126,6 +125,4 @@ ... - - diff --git a/none/tests/fdleak_dup_xml.stderr.exp b/none/tests/fdleak_dup_xml.stderr.exp index 3fc08d342..f56d83767 100644 --- a/none/tests/fdleak_dup_xml.stderr.exp +++ b/none/tests/fdleak_dup_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -36,7 +36,6 @@ - FINISHED @@ -107,6 +106,4 @@ ... - - diff --git a/none/tests/fdleak_fcntl_xml.stderr.exp b/none/tests/fdleak_fcntl_xml.stderr.exp index 4f33dc9e3..81605e2ae 100644 --- a/none/tests/fdleak_fcntl_xml.stderr.exp +++ b/none/tests/fdleak_fcntl_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -36,7 +36,6 @@ - FINISHED @@ -107,6 +106,4 @@ ... - - diff --git a/none/tests/fdleak_ipv4_xml.stderr.exp b/none/tests/fdleak_ipv4_xml.stderr.exp index 38797041a..e55277422 100644 --- a/none/tests/fdleak_ipv4_xml.stderr.exp +++ b/none/tests/fdleak_ipv4_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -101,7 +101,6 @@ - FINISHED @@ -143,5 +142,11 @@ - + + 2 + 2 + 0 + 0 + + diff --git a/none/tests/fdleak_ipv4_xml.stderr.exp-nomain b/none/tests/fdleak_ipv4_xml.stderr.exp-nomain index 8eaa4f20f..e55277422 100644 --- a/none/tests/fdleak_ipv4_xml.stderr.exp-nomain +++ b/none/tests/fdleak_ipv4_xml.stderr.exp-nomain @@ -2,7 +2,7 @@ -5 +6 none @@ -52,6 +52,14 @@ fdleak_ipv4.c 70 + + 0x........ + ... + main + ... + fdleak_ipv4.c + 90 + Previously closed @@ -63,6 +71,14 @@ fdleak_ipv4.c 69 + + 0x........ + ... + main + ... + fdleak_ipv4.c + 90 + Originally opened @@ -74,10 +90,17 @@ fdleak_ipv4.c 68 + + 0x........ + ... + main + ... + fdleak_ipv4.c + 90 + - FINISHED @@ -119,5 +142,11 @@ - + + 2 + 2 + 0 + 0 + + diff --git a/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le index df413b628..27c304f47 100644 --- a/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le +++ b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le @@ -2,7 +2,7 @@ -5 +6 none @@ -101,7 +101,6 @@ - FINISHED @@ -135,5 +134,11 @@ - + + 2 + 2 + 0 + 0 + + diff --git a/none/tests/fdleak_open_xml.stderr.exp b/none/tests/fdleak_open_xml.stderr.exp index 2cde2d190..5e67f9d25 100644 --- a/none/tests/fdleak_open_xml.stderr.exp +++ b/none/tests/fdleak_open_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -36,7 +36,6 @@ - FINISHED @@ -61,6 +60,4 @@ - - diff --git a/none/tests/fdleak_pipe_xml.stderr.exp b/none/tests/fdleak_pipe_xml.stderr.exp index 2abb5a266..2fb93ce90 100644 --- a/none/tests/fdleak_pipe_xml.stderr.exp +++ b/none/tests/fdleak_pipe_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -36,7 +36,6 @@ - FINISHED @@ -78,6 +77,4 @@ - - diff --git a/none/tests/fdleak_socketpair_xml.stderr.exp b/none/tests/fdleak_socketpair_xml.stderr.exp index bdd31860d..6d2e2b41b 100644 --- a/none/tests/fdleak_socketpair_xml.stderr.exp +++ b/none/tests/fdleak_socketpair_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -36,7 +36,6 @@ - FINISHED @@ -78,6 +77,4 @@ - - diff --git a/none/tests/fdleak_socketpair_xml.stderr.exp-illumos b/none/tests/fdleak_socketpair_xml.stderr.exp-illumos index f01a80440..8b578188e 100644 --- a/none/tests/fdleak_socketpair_xml.stderr.exp-illumos +++ b/none/tests/fdleak_socketpair_xml.stderr.exp-illumos @@ -2,7 +2,7 @@ -5 +6 none @@ -36,7 +36,6 @@ - FINISHED @@ -78,6 +77,4 @@ - - diff --git a/none/tests/file_dclose_xml.stderr.exp b/none/tests/file_dclose_xml.stderr.exp index 4e4bd773c..c6a25d510 100644 --- a/none/tests/file_dclose_xml.stderr.exp +++ b/none/tests/file_dclose_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -96,7 +96,6 @@ time passes and we close 3 again - FINISHED @@ -109,6 +108,4 @@ time passes and we close 3 again - - diff --git a/none/tests/file_dclose_xml.stderr.exp-nomain b/none/tests/file_dclose_xml.stderr.exp-nomain index b0cfc10c5..6c5406c03 100644 --- a/none/tests/file_dclose_xml.stderr.exp-nomain +++ b/none/tests/file_dclose_xml.stderr.exp-nomain @@ -2,7 +2,7 @@ -5 +6 none diff --git a/none/tests/socket_close_xml.stderr.exp b/none/tests/socket_close_xml.stderr.exp index 69a2c514e..11c2054ca 100644 --- a/none/tests/socket_close_xml.stderr.exp +++ b/none/tests/socket_close_xml.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -88,7 +88,6 @@ and close the socket again 3 - FINISHED @@ -101,6 +100,4 @@ and close the socket again 3 - - diff --git a/none/tests/socket_close_xml.stderr.exp-ppc64le b/none/tests/socket_close_xml.stderr.exp-ppc64le index 2f2bc9831..1de993059 100644 --- a/none/tests/socket_close_xml.stderr.exp-ppc64le +++ b/none/tests/socket_close_xml.stderr.exp-ppc64le @@ -2,7 +2,7 @@ -5 +6 none diff --git a/none/tests/xml-track-fds.stderr.exp b/none/tests/xml-track-fds.stderr.exp index b06da9d72..2d17ef763 100644 --- a/none/tests/xml-track-fds.stderr.exp +++ b/none/tests/xml-track-fds.stderr.exp @@ -2,7 +2,7 @@ -5 +6 none @@ -36,12 +36,9 @@ - FINISHED - - From 6dd49fc455dbf0310eef9de6067e47fac0ce92b8 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 26 May 2025 08:21:23 +0200 Subject: [PATCH 045/412] regtest PPC: update a few XML expecteds after bug390310 --- drd/tests/bar_bad_xml.stderr.exp | 1 - helgrind/tests/filter_xml | 1 + helgrind/tests/tc06_two_races_xml.stderr.exp | 2 +- .../tc06_two_races_xml.stderr.exp-freebsd | 2 +- none/tests/Makefile.am | 1 + none/tests/fdleak_ipv4_xml.stderr.exp-ppc64be | 128 ++++++++++++++++++ none/tests/file_dclose_xml.stderr.exp-nomain | 3 - 7 files changed, 132 insertions(+), 6 deletions(-) create mode 100644 none/tests/fdleak_ipv4_xml.stderr.exp-ppc64be diff --git a/drd/tests/bar_bad_xml.stderr.exp b/drd/tests/bar_bad_xml.stderr.exp index c6150b899..603492527 100644 --- a/drd/tests/bar_bad_xml.stderr.exp +++ b/drd/tests/bar_bad_xml.stderr.exp @@ -204,7 +204,6 @@ destroy a barrier that has waiting threads destroy a barrier that was never initialised - FINISHED diff --git a/helgrind/tests/filter_xml b/helgrind/tests/filter_xml index e9475f04a..0dc77f7a4 100755 --- a/helgrind/tests/filter_xml +++ b/helgrind/tests/filter_xml @@ -41,6 +41,7 @@ my %patterns = ( "Using Valgrind-([^\\s]*)" => "X.Y.X", "Copyright \\(C\\) ([0-9]{4}-[0-9]{4}).*" => "XXXX-YYYY", 'pthread_.*(@\*)' => "", + "(.*)" => "...", "(.*)" => "..." ); diff --git a/helgrind/tests/tc06_two_races_xml.stderr.exp b/helgrind/tests/tc06_two_races_xml.stderr.exp index 800ef543f..8948505a7 100644 --- a/helgrind/tests/tc06_two_races_xml.stderr.exp +++ b/helgrind/tests/tc06_two_races_xml.stderr.exp @@ -257,7 +257,7 @@ 4 4 - 7 + ... ... diff --git a/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd b/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd index 724649cb6..e8cda5ff6 100644 --- a/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd +++ b/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd @@ -249,7 +249,7 @@ 4 4 - 7 + ... ... diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 18924b34f..ca01f9e42 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -158,6 +158,7 @@ EXTRA_DIST = \ fdleak_fcntl.stderr.exp fdleak_fcntl.vgtest \ fdleak_fcntl_xml.stderr.exp fdleak_fcntl_xml.vgtest \ fdleak_ipv4.stderr.exp fdleak_ipv4.stdout.exp fdleak_ipv4.vgtest \ + fdleak_ipv4_xml.stderr.exp-ppc64be \ fdleak_ipv4_xml.stderr.exp-ppc64le \ fdleak_ipv4_xml.stderr.exp fdleak_ipv4_xml.stdout.exp \ fdleak_ipv4_xml.vgtest fdleak_ipv4_xml.stderr.exp-nomain \ diff --git a/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64be b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64be new file mode 100644 index 000000000..204592a55 --- /dev/null +++ b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64be @@ -0,0 +1,128 @@ + + + + +6 +none + + + Nulgrind, the minimal Valgrind tool + Copyright... + Using Valgrind... + Command: ./fdleak_ipv4 + + +... +... +none + + + + ... + --command-line-only=yes + --memcheck:leak-check=no + --tool=none + --track-fds=yes + --xml=yes + --xml-fd=2 + --child-silent-after-fork=yes + + + ... + + + + + RUNNING + + + + + 0x........ + ... + FdBadClose + 4 + ... + + + 0x........ + ... + client + ... + fdleak_ipv4.c + 70 + + + Previously closed + + + 0x........ + ... + client + ... + fdleak_ipv4.c + 69 + + + Originally opened + + + 0x........ + ... + client + ... + fdleak_ipv4.c + 68 + + + + + + FINISHED + + + + + 0x........ + ... + FdNotClosed + 3 + ... + + + 0x........ + ... + client + ... + fdleak_ipv4.c + 51 + + + 0x........ + ... + main + ... + fdleak_ipv4.c + 90 + + + + + + + 1 + 0x........ + + + + + + + + 2 + 2 + 0 + 0 + + + diff --git a/none/tests/file_dclose_xml.stderr.exp-nomain b/none/tests/file_dclose_xml.stderr.exp-nomain index 6c5406c03..bd424eaed 100644 --- a/none/tests/file_dclose_xml.stderr.exp-nomain +++ b/none/tests/file_dclose_xml.stderr.exp-nomain @@ -80,7 +80,6 @@ time passes and we close 3 again - FINISHED @@ -93,6 +92,4 @@ time passes and we close 3 again - - From 988d80f0e7789b6d04734125ef340db282da7322 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 26 May 2025 22:02:35 +0200 Subject: [PATCH 046/412] regtest warnings: fix unused returns and missing noexcept specifiers GCC 15.1.1 is still giving a -Walloc-size-larger-than= warning for memcheck calloc-overflow.c --- drd/tests/timed_mutex.cpp | 4 ++-- massif/tests/overloaded-new.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drd/tests/timed_mutex.cpp b/drd/tests/timed_mutex.cpp index fa7464ea5..97ac32096 100644 --- a/drd/tests/timed_mutex.cpp +++ b/drd/tests/timed_mutex.cpp @@ -10,7 +10,7 @@ int global; void f() { auto now=std::chrono::steady_clock::now(); - test_mutex.try_lock_until(now + std::chrono::seconds(11)); + (void)test_mutex.try_lock_until(now + std::chrono::seconds(11)); --global; std::this_thread::sleep_for(std::chrono::seconds(1)); test_mutex.unlock(); @@ -23,7 +23,7 @@ int main() std::thread t(f); std::this_thread::sleep_for(std::chrono::seconds(1)); auto now=std::chrono::steady_clock::now(); - test_mutex.try_lock_until(now + std::chrono::seconds(11)); + (void)test_mutex.try_lock_until(now + std::chrono::seconds(11)); ++global; test_mutex.unlock(); t.join(); diff --git a/massif/tests/overloaded-new.cpp b/massif/tests/overloaded-new.cpp index 5ad92894e..edea12b74 100644 --- a/massif/tests/overloaded-new.cpp +++ b/massif/tests/overloaded-new.cpp @@ -19,7 +19,7 @@ __attribute__((noinline)) void* operator new (std::size_t n) return (void*)12345; } -__attribute__((noinline)) void* operator new (std::size_t n, std::nothrow_t const &) +__attribute__((noinline)) void* operator new (std::size_t n, std::nothrow_t const &) noexcept { return (void*)23456; } @@ -29,7 +29,7 @@ __attribute__((noinline)) void* operator new[] (std::size_t n) return (void*)34567; } -__attribute__((noinline)) void* operator new[] (std::size_t n, std::nothrow_t const &) +__attribute__((noinline)) void* operator new[] (std::size_t n, std::nothrow_t const &) noexcept { return (void*)45678; } @@ -54,12 +54,12 @@ __attribute__((noinline)) void* operator new[](std::size_t size, std::align_val_ return (void*)89012; } -__attribute__((noinline)) void operator delete (void* p) +__attribute__((noinline)) void operator delete (void* p) noexcept { } -__attribute__((noinline)) void operator delete[] (void* p) +__attribute__((noinline)) void operator delete[] (void* p) noexcept { } From f8cd77bec1e3050cb101942b9c18f7d30912bda9 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 27 May 2025 12:41:32 +0200 Subject: [PATCH 047/412] regtest warning: suppress -Walloc-size-larger-than= warning in memcheck calloc-overflow.c --- memcheck/tests/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index db6cd1786..860cb2076 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -678,6 +678,7 @@ accounting_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ badfree_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_FREE_NONHEAP_OBJECT@ bug155125_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNUSED_RESULT@ @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ bug472219_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +calloc_overflow_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ malloc_usable_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@ mallinfo_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ From c164b5714172e7678ab258545c2bc0127f21a318 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 28 May 2025 21:07:44 +0000 Subject: [PATCH 048/412] s390x: Remove a fixs390. Add an explanation. --- VEX/priv/host_s390_defs.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/VEX/priv/host_s390_defs.h b/VEX/priv/host_s390_defs.h index dcdb6713e..48fbac764 100644 --- a/VEX/priv/host_s390_defs.h +++ b/VEX/priv/host_s390_defs.h @@ -706,8 +706,18 @@ typedef struct { s390_amode *guest_IA; } xassisted; struct { - /* fixs390: I don't think these are really needed - as the gsp and the offset are fixed no ? */ + /* Note: these fields are needed. Here's why: + These fields are amodes for accessing the host_EvC_COUNTER and + host_EvC_FAILADDR fields in the guest state. + When guest and host architecture are both s390x then we know that + the displacement in evcheck::counter is + offsetof(VexGuestS390XState, host_EvC_COUNTER) and likewise for + the displacement in evcheck::fail_addr. There would be no point + to build these amodes in the first place because we could just + hardwire the displacements in s390_insn_evcheck_emit. + However in a multi-arch setting the amodes point to the + host_EvC_COUNTER/FAILADDR fields in a *different* guest state and + those offsets are not known. So we do need to build the amodes. */ s390_amode *counter; /* dispatch counter */ s390_amode *fail_addr; } evcheck; From f7b087df5ccd4ac1c0803a5dfd168327dc25286c Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 29 May 2025 08:52:28 +0200 Subject: [PATCH 049/412] Bug 504936 - Add FreeBSD amd64 sysarch subcommands AMD64_SET_TLSBASE and AMD64_GET_TLSBASE --- NEWS | 2 ++ VEX/priv/guest_amd64_helpers.c | 3 ++- VEX/pub/libvex_guest_amd64.h | 7 ++++-- coregrind/m_syswrap/syswrap-amd64-freebsd.c | 24 ++++++++++++++++++++- include/vki/vki-freebsd.h | 9 +++++++- memcheck/mc_machine.c | 1 + 6 files changed, 41 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 1450dfba8..7cf33d52e 100644 --- a/NEWS +++ b/NEWS @@ -36,6 +36,8 @@ are not entered into bugzilla tend to get forgotten about or ignored. 504265 FreeBSD: missing syscall wrappers for fchroot and setcred 504341 Valgrind killed by LTP syscall testcase setrlimit05 504466 Double close causes SEGV +504936 Add FreeBSD amd64 sysarch subcommands AMD64_SET_TLSBASE and + AMD64_GET_TLSBASE To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c index b4e37fcbd..8313d58b4 100644 --- a/VEX/priv/guest_amd64_helpers.c +++ b/VEX/priv/guest_amd64_helpers.c @@ -2665,6 +2665,7 @@ void amd64g_dirtyhelper_FINIT ( VexGuestAMD64State* gst ) { Int i; gst->guest_FTOP = 0; + gst->pad1 = 0; for (i = 0; i < 8; i++) { gst->guest_FPTAG[i] = 0; /* empty */ gst->guest_FPREG[i] = 0; /* IEEE754 64-bit zero */ @@ -4831,7 +4832,7 @@ void LibVEX_GuestAMD64_initialise ( /*OUT*/VexGuestAMD64State* vex_state ) vex_state->guest_GS_CONST = 0; vex_state->guest_IP_AT_SYSCALL = 0; - vex_state->pad1 = 0; + vex_state->guest_TLSBASE = 0; } diff --git a/VEX/pub/libvex_guest_amd64.h b/VEX/pub/libvex_guest_amd64.h index 8f6bb560c..9be073a21 100644 --- a/VEX/pub/libvex_guest_amd64.h +++ b/VEX/pub/libvex_guest_amd64.h @@ -170,8 +170,11 @@ typedef been interrupted by a signal. */ ULong guest_IP_AT_SYSCALL; - /* Padding to make it have an 16-aligned size */ - ULong pad3; + /* Used on FreeBSD as part of a mechanism to allow signal handlers + to use TLS. */ + ULong guest_TLSBASE; + + /* Add padding here to make it have an 16-aligned size */ } VexGuestAMD64State; diff --git a/coregrind/m_syswrap/syswrap-amd64-freebsd.c b/coregrind/m_syswrap/syswrap-amd64-freebsd.c index e1316eac3..4c69e762b 100644 --- a/coregrind/m_syswrap/syswrap-amd64-freebsd.c +++ b/coregrind/m_syswrap/syswrap-amd64-freebsd.c @@ -128,13 +128,18 @@ PRE(sys_sysarch) PRE_REG_READ2(int, "sysarch", int, number, void *, args); switch (ARG1) { case VKI_AMD64_SET_FSBASE: - PRINT("sys_amd64_set_fsbase ( %#lx )", ARG2); + case VKI_AMD64_SET_TLSBASE: + PRINT("sys_amd64_set_%ssbase ( %#lx )", (ARG1 == VKI_AMD64_SET_FSBASE ? "f" : "tl"), ARG2); if (ML_(safe_to_deref)((void**)ARG2, sizeof(void*))) { /* On FreeBSD, the syscall loads the %gs selector for us, so do it now. */ tst = VG_(get_ThreadState)(tid); p = (void**)ARG2; tst->arch.vex.guest_FS_CONST = (UWord)*p; + if (ARG1 == VKI_AMD64_SET_TLSBASE) { + tst->arch.vex.guest_TLSBASE = (UWord)*p; + // kernel also calls "set_pcb_flags(pcb, PCB_TLSBASE);" + } /* "do" the syscall ourselves; the kernel never sees it */ SET_STATUS_Success2((ULong)*p, tst->arch.vex.guest_RDX ); } else { @@ -165,6 +170,22 @@ PRE(sys_sysarch) tst = VG_(get_ThreadState)(tid); SET_STATUS_Success2( tst->arch.vex.guest_FPTAG[0], tst->arch.vex.guest_FPTAG[0] ); break; + //case VKI_AMD64_SET_PKRU: + //case VKI_AMD64_CLEAR_PKRU: + case VKI_AMD64_GET_TLSBASE: + PRINT("sys_amd64_get_tlsbase ( %#lx )", ARG2); + PRE_MEM_WRITE( "amd64_get_fsbase(basep)", ARG2, sizeof(void *) ); + if (ML_(safe_to_deref)((void**)ARG2, sizeof(void*))) { + /* "do" the syscall ourselves; the kernel never sees it */ + tst = VG_(get_ThreadState)(tid); + SET_STATUS_Success2( tst->arch.vex.guest_TLSBASE, tst->arch.vex.guest_RDX ); + } else { + SET_STATUS_Failure( VKI_EINVAL ); + } + break; + + PRINT("sys_amd64_set_tlsbase ( %#lx )", ARG2); + break; default: VG_(message) (Vg_UserMsg, "unhandled sysarch cmd %lu", ARG1); VG_(unimplemented) ("unhandled sysarch cmd"); @@ -179,6 +200,7 @@ POST(sys_sysarch) break; case VKI_AMD64_GET_FSBASE: case VKI_AMD64_GET_XFPUSTATE: + case VKI_AMD64_GET_TLSBASE: POST_MEM_WRITE( ARG2, sizeof(void *) ); break; default: diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index 253997999..6be56c27a 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -1857,12 +1857,19 @@ struct vki_ptrace_vm_entry { #define VKI_I386_GET_GSBASE 9 #define VKI_I386_SET_GSBASE 10 #define VKI_I386_GET_XFPUSTATE 11 +#define VKI_I386_SET_PKRU 12 +#define VKI_I386_CLEAR_PKRU 13 #define VKI_AMD64_GET_FSBASE 128 #define VKI_AMD64_SET_FSBASE 129 #define VKI_AMD64_GET_GSBASE 130 #define VKI_AMD64_SET_GSBASE 131 -#define VKI_AMD64_GET_XFPUSTATE 132 +#define VKI_AMD64_GET_XFPUSTATE 132 +#define VKI_AMD64_SET_PKRU 133 +#define VKI_AMD64_CLEAR_PKRU 134 +#define VKI_AMD64_GET_TLSBASE 135 +#define VKI_AMD64_SET_TLSBASE 136 + //---------------------------------------------------------------------- // From sys/module.h diff --git a/memcheck/mc_machine.c b/memcheck/mc_machine.c index 34df0011a..b0026a6bd 100644 --- a/memcheck/mc_machine.c +++ b/memcheck/mc_machine.c @@ -647,6 +647,7 @@ static Int get_otrack_shadow_offset_wrk ( Int offset, Int szB ) if (o == GOF(DFLAG) && sz == 8) return -1; /* slot used for %CH */ if (o == GOF(RIP) && sz == 8) return -1; /* slot unused */ if (o == GOF(IP_AT_SYSCALL) && sz == 8) return -1; /* slot unused */ + if (o == GOF(TLSBASE) && sz == 8) return -1; /* slot unused */ if (o == GOF(IDFLAG) && sz == 8) return -1; /* slot used for %DH */ if (o == GOF(ACFLAG) && sz == 8) return -1; /* slot unused */ if (o == GOF(FS_CONST) && sz == 8) return -1; /* slot unused */ From 2fa8581c4974db57de80de915d16ce299eb9aa84 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 14 May 2025 09:29:33 -0700 Subject: [PATCH 050/412] Use portable syntax for pushsection directive in inline assembly '@' does not work with clang inline assembler, but '%' works with both gcc and clang. Therefore use '%' to make it more portable Fixes :1:41: error: expected '%' or "" Signed-off-by: Khem Raj --- coregrind/vg_preloaded.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c index 5bec51d76..e4c2dbc21 100644 --- a/coregrind/vg_preloaded.c +++ b/coregrind/vg_preloaded.c @@ -55,7 +55,7 @@ /* Note: The "MS" section flags are to remove duplicates. */ #define DEFINE_GDB_PY_SCRIPT(script_name) \ asm("\ -.pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n\ +.pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n\ .byte 1 /* Python */\n\ .asciz \"" script_name "\"\n\ .popsection \n\ From 3a17beb90d7aebe094ff764885a888bad43b1b2c Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 29 May 2025 22:06:21 +0200 Subject: [PATCH 051/412] regtest arm: one fix for building with clang --- memcheck/tests/leak.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/memcheck/tests/leak.h b/memcheck/tests/leak.h index f9a2db290..6b4450327 100644 --- a/memcheck/tests/leak.h +++ b/memcheck/tests/leak.h @@ -152,10 +152,10 @@ /* 32bit arm */ #define CLEAR_CALLER_SAVED_REGS \ do { \ - __asm__ __volatile__ ("mov %r0, $0\n\t"); \ - __asm__ __volatile__ ("mov %r1, $0\n\t"); \ - __asm__ __volatile__ ("mov %r2, $0\n\t"); \ - __asm__ __volatile__ ("mov %r3, $0\n\t"); \ + __asm__ __volatile__ ("mov r0, $0\n\t"); \ + __asm__ __volatile__ ("mov r1, $0\n\t"); \ + __asm__ __volatile__ ("mov r2, $0\n\t"); \ + __asm__ __volatile__ ("mov r3, $0\n\t"); \ } while (0) #elif defined(__aarch64__) /* 64bit arm */ From ad6ca3e69358e440b4841cecf0ebed5aa7351d69 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Wed, 28 May 2025 12:09:44 +0200 Subject: [PATCH 052/412] Hide bad act handler address warning when -q is set When valgrind is run with -q, messages like "Warning: bad act handler address 0xFFFFFFFFFFFFFFFF in rt_sigaction()" should be hidden. https://bugs.kde.org/show_bug.cgi?id=504904 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 7cf33d52e..374b14d0b 100644 --- a/NEWS +++ b/NEWS @@ -36,6 +36,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 504265 FreeBSD: missing syscall wrappers for fchroot and setcred 504341 Valgrind killed by LTP syscall testcase setrlimit05 504466 Double close causes SEGV +504904 Hide "bad act handler address" warnings when -q (quiet) flag is set 504936 Add FreeBSD amd64 sysarch subcommands AMD64_SET_TLSBASE and AMD64_GET_TLSBASE diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index fa2ab9e9f..0106e1661 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4610,14 +4610,18 @@ PRE(sys_rt_sigaction) if (ARG2 != 0 && ! ML_(safe_to_deref)((void *)(Addr)ARG2, sizeof(vki_sigaction_toK_t))) { - VG_(umsg)("Warning: bad act handler address %p in rt_sigaction()\n", - (void *)(Addr)ARG2); + if (VG_(clo_verbosity) >= 1) { + VG_(umsg)("Warning: bad act handler address %p in rt_sigaction()\n", + (void *)(Addr)ARG2); + } SET_STATUS_Failure ( VKI_EFAULT ); } else if ((ARG3 != 0 && ! ML_(safe_to_deref)((void *)(Addr)ARG3, sizeof(vki_sigaction_fromK_t)))) { - VG_(umsg)("Warning: bad oldact handler address %p in rt_sigaction()\n", - (void *)(Addr)ARG3); + if (VG_(clo_verbosity) >= 1) { + VG_(umsg)("Warning: bad oldact handler address %p in rt_sigaction()\n", + (void *)(Addr)ARG3); + } SET_STATUS_Failure ( VKI_EFAULT ); } else { From 4540c465868f18943e649c686e83e33688711887 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Wed, 28 May 2025 14:50:49 +0200 Subject: [PATCH 053/412] Hide "Bad oldset address" warnings when -q (quiet) flag is set When valgrind is run with -q, messages like "Warning: Bad oldset address 0xFFFFFFFFFFFFFFFF in sigprocmask" be hidden. Reproducer: TESTS=rt_sigprocmask02 make ltpchecks https://bugs.kde.org/show_bug.cgi?id=504909 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 374b14d0b..dab995c63 100644 --- a/NEWS +++ b/NEWS @@ -37,6 +37,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 504341 Valgrind killed by LTP syscall testcase setrlimit05 504466 Double close causes SEGV 504904 Hide "bad act handler address" warnings when -q (quiet) flag is set +504909 Hide "Bad oldset address" warnings when -q (quiet) flag is set 504936 Add FreeBSD amd64 sysarch subcommands AMD64_SET_TLSBASE and AMD64_GET_TLSBASE diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 0106e1661..be936ecbe 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4661,14 +4661,18 @@ PRE(sys_rt_sigprocmask) SET_STATUS_Failure( VKI_EINVAL ); else if (ARG2 != 0 && ! ML_(safe_to_deref)((void *)(Addr)ARG2, sizeof(vki_sigset_t))) { - VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n", - (void *)(Addr)ARG2); + if (VG_(clo_verbosity) >= 1) { + VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n", + (void *)(Addr)ARG2); + } SET_STATUS_Failure ( VKI_EFAULT ); } else if (ARG3 != 0 && ! ML_(safe_to_deref)((void *)(Addr)ARG3, sizeof(vki_sigset_t))) { - VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n", - (void *)(Addr)ARG3); + if (VG_(clo_verbosity) >= 1) { + VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n", + (void *)(Addr)ARG3); + } SET_STATUS_Failure ( VKI_EFAULT ); } From 47f2f1df4112e9befe2d0039d7e4f6c957669b6e Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Wed, 28 May 2025 18:04:46 +0200 Subject: [PATCH 054/412] Hide "client tried to modify addresses" warnings when -q (quiet) is set When -q is set, that is when verbosity is 0, the "client tried to modify addresses" warning should be hidden. Also remove the warning from {freebsd,solaris}/scalar.stderr.exp Reproducer: TESTS=munmap03 make -j$(nproc) ltpchecks https://bugs.kde.org/show_bug.cgi?id=504919 --- NEWS | 1 + coregrind/m_syswrap/syswrap-generic.c | 8 +++++--- memcheck/tests/freebsd/scalar.stderr.exp | 1 - memcheck/tests/freebsd/scalar.stderr.exp-x86 | 1 - memcheck/tests/solaris/scalar.stderr.exp | 1 - 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index dab995c63..041d7afdf 100644 --- a/NEWS +++ b/NEWS @@ -38,6 +38,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 504466 Double close causes SEGV 504904 Hide "bad act handler address" warnings when -q (quiet) flag is set 504909 Hide "Bad oldset address" warnings when -q (quiet) flag is set +504919 Hide "client tried to modify addresses" warnings when -q (quiet) set 504936 Add FreeBSD amd64 sysarch subcommands AMD64_SET_TLSBASE and AMD64_GET_TLSBASE diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 98cbb172f..f8d73e197 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -121,9 +121,11 @@ Bool ML_(valid_client_addr)(Addr start, SizeT size, ThreadId tid, syscallname, start, start+size-1, (Int)ret); if (!ret && syscallname != NULL) { - VG_(message)(Vg_UserMsg, "Warning: client syscall %s tried " - "to modify addresses %#lx-%#lx\n", - syscallname, start, start+size-1); + if (VG_(clo_verbosity) >= 1) { + VG_(message)(Vg_UserMsg, "Warning: client syscall %s tried " + "to modify addresses %#lx-%#lx\n", + syscallname, start, start+size-1); + } if (VG_(clo_verbosity) > 1) { VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size)); } diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 59ed18524..24b7ba2bb 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -610,7 +610,6 @@ Syscall param mprotect(len) contains uninitialised byte(s) Syscall param mprotect(prot) contains uninitialised byte(s) ... -Warning: client syscall mprotect tried to modify addresses 0x........-0x........ --------------------------------------------------------- 75: SYS_madvise 3s 0m --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 091a1770d..788dfbd7c 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -610,7 +610,6 @@ Syscall param mprotect(len) contains uninitialised byte(s) Syscall param mprotect(prot) contains uninitialised byte(s) ... -Warning: client syscall mprotect tried to modify addresses 0x........-0x........ --------------------------------------------------------- 75: SYS_madvise 3s 0m --------------------------------------------------------- diff --git a/memcheck/tests/solaris/scalar.stderr.exp b/memcheck/tests/solaris/scalar.stderr.exp index d80bc27d0..e7951dae7 100644 --- a/memcheck/tests/solaris/scalar.stderr.exp +++ b/memcheck/tests/solaris/scalar.stderr.exp @@ -618,7 +618,6 @@ Syscall param shmsys_shmdt(opcode) contains uninitialised byte(s) Syscall param shmsys_shmdt(shmaddr) contains uninitialised byte(s) ... -Warning: client syscall shmdt tried to modify addresses 0x........-0x........ --------------------------------------------------------- 52: SYS_shmsys (SHMGET) 4s 0m --------------------------------------------------------- From ebc73366045855c6cf5069ae6841d3a887bd0ba0 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 30 May 2025 08:31:48 +0200 Subject: [PATCH 055/412] FreeBSD sigprocmask syscall: do not print warnings when -q is set Equivalent to bug504904 and bug504909 --- coregrind/m_syswrap/syswrap-freebsd.c | 22 +++++++++++++------- memcheck/tests/freebsd/scalar.stderr.exp | 3 --- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 3 --- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 8fcfe1090..41b0cc38b 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -3197,13 +3197,17 @@ PRE(sys_sigprocmask) if (ARG2 != 0 && !ML_(safe_to_deref)((void *)(Addr)ARG2, sizeof(vki_sigset_t))) { - VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n", + if (VG_(clo_verbosity) >= 1) { + VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n", (void *)(Addr)ARG2); + } SET_STATUS_Failure ( VKI_EFAULT ); } else if (ARG3 != 0 && !ML_(safe_to_deref)((void *)(Addr)ARG3, sizeof(vki_sigset_t))) { - VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n", - (void *)(Addr)ARG3); + if (VG_(clo_verbosity) >= 1) { + VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n", + (void *)(Addr)ARG3); + } SET_STATUS_Failure ( VKI_EFAULT ); } else { SET_STATUS_from_SysRes(VG_(do_sys_sigprocmask)(tid, ARG1 /*how*/, @@ -3922,14 +3926,18 @@ PRE(sys_sigaction) if (ARG2 != 0 && ! ML_(safe_to_deref)((void *)(Addr)ARG2, sizeof(struct vki_sigaction))) { - VG_(umsg)("Warning: bad act handler address %p in sigaction()\n", - (void *)(Addr)ARG2); + if (VG_(clo_verbosity) >= 1) { + VG_(umsg)("Warning: bad act handler address %p in sigaction()\n", + (void *)(Addr)ARG2); + } SET_STATUS_Failure ( VKI_EFAULT ); } else if ((ARG3 != 0 && ! ML_(safe_to_deref)((void *)(Addr)ARG3, sizeof(struct vki_sigaction)))) { - VG_(umsg)("Warning: bad oact handler address %p in sigaction()\n", - (void *)(Addr)ARG3); + if (VG_(clo_verbosity) >= 1) { + VG_(umsg)("Warning: bad oact handler address %p in sigaction()\n", + (void *)(Addr)ARG3); + } SET_STATUS_Failure ( VKI_EFAULT ); } else { if (ARG2 != 0) { diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 24b7ba2bb..d632beea4 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -2429,7 +2429,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad oldset address 0x........ in sigprocmask --------------------------------------------------------- 340: SYS_sigprocmask 3s 2m --------------------------------------------------------- @@ -2450,7 +2449,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad set handler address 0x........ in sigprocmask --------------------------------------------------------- 341: SYS_sigsuspend 1s 1m --------------------------------------------------------- @@ -3227,7 +3225,6 @@ Syscall param sigaction(oact) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: bad act handler address 0x........ in sigaction() --------------------------------------------------------- 417: SYS_sigreturn 1s 1m --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 788dfbd7c..7a9af94e8 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -2435,7 +2435,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad oldset address 0x........ in sigprocmask --------------------------------------------------------- 340: SYS_sigprocmask 3s 2m --------------------------------------------------------- @@ -2456,7 +2455,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad set handler address 0x........ in sigprocmask --------------------------------------------------------- 341: SYS_sigsuspend 1s 1m --------------------------------------------------------- @@ -3236,7 +3234,6 @@ Syscall param sigaction(oact) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: bad act handler address 0x........ in sigaction() --------------------------------------------------------- 417: SYS_sigreturn 1s 1m --------------------------------------------------------- From 7208eb445f32eefb4397757f004e65882c9a4083 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 30 May 2025 08:47:00 +0200 Subject: [PATCH 056/412] FreeBSD syscalls: change two more warnings sysctl gave me a hard time when I first started working on FreeBSD but that warning should only be without -q change the unhandled kenv warning to a VG_(unimplemented), which will terminate Valgrind rather than just print a warning. There are still a few aio warnings. Really they should be promoted to some kind of fully fledged warning (maybe a core warning). I'm not sure that it's worth the effort as I suspect that aio is not much used. --- coregrind/m_syswrap/syswrap-freebsd.c | 10 +++++++--- memcheck/tests/freebsd/scalar.c | 3 --- memcheck/tests/freebsd/scalar.stderr.exp | 17 ----------------- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 17 ----------------- 4 files changed, 7 insertions(+), 40 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 41b0cc38b..3f4b6ca71 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -2082,8 +2082,10 @@ PRE(sys___sysctl) if (ML_(safe_to_deref)((void*)(Addr)ARG4, sizeof(vki_size_t))) { PRE_MEM_WRITE("sysctl(oldp)", (Addr)ARG3, *(vki_size_t *)ARG4); } else { - VG_(dmsg)("Warning: Bad oldlenp address %p in sysctl\n", - (void *)(Addr)ARG4); + if (VG_(clo_verbosity) >= 1) { + VG_(dmsg)("Warning: Bad oldlenp address %p in sysctl\n", + (void *)(Addr)ARG4); + } SET_STATUS_Failure ( VKI_EFAULT ); } } else { @@ -3691,7 +3693,9 @@ PRE(sys_kenv) case VKI_KENV_DUMP: break; default: - VG_(dmsg)("Warning: Bad action %" FMT_REGWORD "u in kenv\n", ARG1); + VG_(message)(Vg_UserMsg, "unhandled kenv cmd %" FMT_REGWORD "u", ARG1); + VG_(unimplemented) ("unhandled kenv cmd"); + break; } } diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index eddde2f42..bae3d943b 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -1405,9 +1405,6 @@ int main(void) GO(SYS_kenv, "(KENV_DUMP) 4s 0m"); SY(SYS_kenv, x0+3, x0+2, x0+3, x0+4); FAIL; - GO(SYS_kenv, "(bogus) 4s 0m"); - SY(SYS_kenv, x0+20, x0+2, x0+3, x0+4); FAIL; - /* SYS_lchflags 391 */ GO(SYS_lchflags, "2s 1m"); SY(SYS_lchflags, x0+1, x0+2); FAIL; diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index d632beea4..2e6ca39b4 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -1481,7 +1481,6 @@ Syscall param sysctl(oldlenp) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad oldlenp address 0x........ in sysctl --------------------------------------------------------- 202: SYS___sysctl (putnew) 4s 2m --------------------------------------------------------- @@ -2984,22 +2983,6 @@ Syscall param kenv(value) contains uninitialised byte(s) Syscall param kenv(len) contains uninitialised byte(s) ... ---------------------------------------------------------- -390: SYS_kenv (bogus) 4s 0m ---------------------------------------------------------- -Syscall param kenv(action) contains uninitialised byte(s) - ... - -Syscall param kenv(name) contains uninitialised byte(s) - ... - -Syscall param kenv(value) contains uninitialised byte(s) - ... - -Syscall param kenv(len) contains uninitialised byte(s) - ... - -Warning: Bad action 20 in kenv --------------------------------------------------------- 391: SYS_lchflags 2s 1m --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 7a9af94e8..24c7caac0 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -1481,7 +1481,6 @@ Syscall param sysctl(oldlenp) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad oldlenp address 0x........ in sysctl --------------------------------------------------------- 202: SYS___sysctl (putnew) 4s 2m --------------------------------------------------------- @@ -2990,22 +2989,6 @@ Syscall param kenv(value) contains uninitialised byte(s) Syscall param kenv(len) contains uninitialised byte(s) ... ---------------------------------------------------------- -390: SYS_kenv (bogus) 4s 0m ---------------------------------------------------------- -Syscall param kenv(action) contains uninitialised byte(s) - ... - -Syscall param kenv(name) contains uninitialised byte(s) - ... - -Syscall param kenv(value) contains uninitialised byte(s) - ... - -Syscall param kenv(len) contains uninitialised byte(s) - ... - -Warning: Bad action 20 in kenv --------------------------------------------------------- 391: SYS_lchflags 2s 1m --------------------------------------------------------- From b13cc3d1abbdc427534c1d92d63472a97f1ffacc Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 1 Jun 2025 08:09:14 +0200 Subject: [PATCH 057/412] doc: add xml protocol 5 and 6 files to EXTRA_DIST --- docs/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Makefile.am b/docs/Makefile.am index 68a3da561..607e51494 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -76,6 +76,8 @@ EXTRA_DIST = \ internals/why-no-libc.txt \ internals/xml-output.txt \ internals/xml-output-protocol4.txt \ + internals/xml-output-protocol5.txt \ + internals/xml-output-protocol6.txt \ lib/line-wrap.xsl \ lib/vg_basic.css \ lib/vg-fo.xsl \ From b8891a4c5d139b8c327ee20c37066d601fc56b0a Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 3 Jun 2025 13:43:18 +0200 Subject: [PATCH 058/412] ltp tests: Use new LTP 20250530, allow for filtering valgrind output Use fresh LTP 20250530. Allow for filtering valgrind output: In some cases the LTP tests intentionally work with SIGSEGV. This happens e.g. with the mmap18 and select03 testcases. Valgrind detects SIGSEGV and reports that as a failure. Such report can't be suppressed using the suppressions mechanism. That's why this update comes with "output filters". Filters are scripts that read from their stdin, and write filtered output to their stdout. Filters reside in auxprogs/filters. This update comes with 2 filters: For mmap18, and for select03. They are awk scripts. Except for filters, this update also blacklists testcase fork13 because it is slow. It is possible to add comments prefixed with the '#' sign (implicitly - because they don't match any testcase name), so a comment is added too. This update also introduces new default valgrind --vgdb=no switch. It improves valgrind behavior with nftw01 nftw6401 setfsgid04 setfsgid03_16 and symlink03 testcases. These were previously complaining like this: ==22969== could not unlink /tmp/vgdb-pipe-from-vgdb-to-22969-by-root-on ... --- auxprogs/Makefile.am | 4 ++-- auxprogs/filters/mmap18 | 29 ++++++++++++++++++++++++ auxprogs/filters/select03 | 18 +++++++++++++++ auxprogs/ltp-excludes.txt | 2 ++ auxprogs/ltp-tester.sh | 46 ++++++++++++++++++++++----------------- 5 files changed, 77 insertions(+), 22 deletions(-) create mode 100755 auxprogs/filters/mmap18 create mode 100755 auxprogs/filters/select03 diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index 4a10fb1cf..97eb9501e 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -155,8 +155,8 @@ endif endif # Linux Test Project -LTP_VERSION=20250130 -LTP_SHA256_SUM=02e4ec326be54c3fd92968229a468c02c665d168a8a673edc38a891f7395ae10 +LTP_VERSION=20250530 +LTP_SHA256_SUM=27586ba78eac1e40cd422add2842f1ad70f09fea55da3bd6a25e10feb786d4f2 LTP_TAR_NAME=ltp-full-$(LTP_VERSION).tar.xz LTP_URL=https://github.com/linux-test-project/ltp/releases/download/$(LTP_VERSION)/$(LTP_TAR_NAME) LTP_TAR=$(AUX_CHECK_DIR)/$(LTP_TAR_NAME) diff --git a/auxprogs/filters/mmap18 b/auxprogs/filters/mmap18 new file mode 100755 index 000000000..edaf9c15d --- /dev/null +++ b/auxprogs/filters/mmap18 @@ -0,0 +1,29 @@ +#!/bin/awk -f + +# Filter out stuff like the following, since it is expected output for the select03 testcase: + +# mmap18: unempty log2.filtered: +# ==24613== +# ==24613== Process terminating with default action of signal 11 (SIGSEGV): dumping core +# ==24613== Access not within mapped region at address 0x4B3AFF8 +# ==24613== at 0x401F86: check_depth_recursive (mmap18.c:118) +# ==24613== If you believe this happened as a result of a stack +# ==24613== overflow in your program's main thread (unlikely but +# ==24613== possible), you can try to increase the size of the +# ==24613== main thread stack using the --main-stacksize= flag. +# ==24613== The main thread stack size used in this run was 8388608. +# ==24620== +# ==24620== Process terminating with default action of signal 11 (SIGSEGV): dumping core +# ==24620== Access not within mapped region at address 0x4B2EFF8 +# ==24620== at 0x401F86: check_depth_recursive (mmap18.c:118) +# ==24620== If you believe this happened as a result of a stack +# ==24620== overflow in your program's main thread (unlikely but +# ==24620== possible), you can try to increase the size of the +# ==24620== main thread stack using the --main-stacksize= flag. +# ==24620== The main thread stack size used in this run was 8388608. + +skip = 0 +/==[0-9][0-9]*==/ { skip = 1 } +/Process terminating with default action of signal 11/ { skip = 1; skipblock=1 } +/The main thread stack size used in this run was/ { skip = 1; skipblock=0 } +!skip && !skipblock { print } diff --git a/auxprogs/filters/select03 b/auxprogs/filters/select03 new file mode 100755 index 000000000..368a884e7 --- /dev/null +++ b/auxprogs/filters/select03 @@ -0,0 +1,18 @@ +#!/bin/awk -f + +# Filter out stuff like the following, since it is expected output for the select03 testcase: + +# ==22396== +# ==22396== Process terminating with default action of signal 11 (SIGSEGV): dumping core +# ==22396== Bad permissions for mapped region at address 0x483B000 +# ==22396== at 0x4946397: select (in /usr/lib64/libc.so.6) +# ==22396== by 0x4020BA: run (select_var.h:26) +# ==22396== by 0x40B30C: fork_testrun (tst_test.c:1566) +# ==22396== by 0x40D4EF: tst_run_tcases (tst_test.c:1918) +# ==22396== by 0x401D4D: main (tst_test.h:725) + +skip = 0 +/==[0-9][0-9]*==/ { skip = 1 } +/Process terminating with default action of signal 11/ { skip = 1; skipblock=1 } +/by.*main.*tst_test.h/ { skip = 1; skipblock=0 } +!skip && !skipblock { print } diff --git a/auxprogs/ltp-excludes.txt b/auxprogs/ltp-excludes.txt index 236d77942..275fd7485 100644 --- a/auxprogs/ltp-excludes.txt +++ b/auxprogs/ltp-excludes.txt @@ -1,5 +1,7 @@ +# Exclude the following syscall tests because they are too slow: bind06 epoll-ltp +fork13 fork14 futex_cmp_requeue01 futex_cmp_requeue02 diff --git a/auxprogs/ltp-tester.sh b/auxprogs/ltp-tester.sh index 54d807b0c..ba8fd8be4 100755 --- a/auxprogs/ltp-tester.sh +++ b/auxprogs/ltp-tester.sh @@ -11,7 +11,9 @@ ORIG_PATH=$PATH SCRIPT_SRC=$(dirname $0) LOGDIR=${LOGDIR:-$LTP_SRC_DIR/ltp/tests} DIFFCMD="diff -u" -VALGRIND="${VALGRIND:-$LTP_SRC_DIR/../../../vg-in-place}" +# vgdb sensitive testcase: e.g. nftw01 nftw6401 setfsgid04 setfsgid03_16 symlink03 +VGARGS="-q --vgdb=no" +VALGRIND="${VALGRIND:-$LTP_SRC_DIR/../../../vg-in-place} ${VGARGS}" # For parallel testing, consider IO intensive jobs, take nproc into account PARALLEL_JOBS=${PARALLEL_JOBS:-$(nproc)} # TESTS env var may be specified to restrict testing to selected test cases @@ -37,24 +39,27 @@ doTest () pushd $dir >/dev/null PATH="$ORIG_PATH:$PWD" ./$exe >$l/log1std 2>$l/log1err ||: - $VALGRIND -q --tool=none --log-file=$l/log2 ./$exe >$l/log2std 2>$l/log2err ||: - $VALGRIND -q --tool=memcheck --log-file=$l/log3 ./$exe >$l/log3std 2>$l/log3err ||: - - # We want to make sure that LTP syscall tests give identical - # results with and without valgrind. The test logs go to the - # stderr. They aren't identical across individual runs. The - # differences include port numbers, temporary files, test - # output ordering changes and more. They aren't trivially - # comparable. We resort to comparing at least the final - # summary of individual test results - tail -10 $l/log1err | grep -E "^(passed|failed|broken|skipped|warnings)" > $l/log1summary ||: - tail -10 $l/log2err | grep -E "^(passed|failed|broken|skipped|warnings)" > $l/log2summary ||: - tail -10 $l/log3err | grep -E "^(passed|failed|broken|skipped|warnings)" > $l/log3summary ||: + $VALGRIND --tool=none --log-file=$l/log2 ./$exe >$l/log2std 2>$l/log2err ||: + $VALGRIND --tool=memcheck --log-file=$l/log3 ./$exe >$l/log3std 2>$l/log3err ||: + + for i in "$l"/log{1std,1err,2,2std,2err,3,3std,3err}; do + echo "# cat $(basename $i)" >> $LOGDIR/$exe.log + cat $i >> $LOGDIR/$exe.log + done + + echo "# errors" >> $LOGDIR/$exe.log + + # If there is a logfile filter, apply it + if test -f "${SCRIPT_SRC}/filters/${exe}"; then + cat $l/log2 | ${SCRIPT_SRC}/filters/${exe} > $l/log2.filtered + else + cat $l/log2 > $l/log2.filtered + fi # Check logs, report errors pushd $l >/dev/null - if test -s log2; then - echo -e "${exe}: unempty log2:\n$(cat log2)" | tee -a $LOGDIR/$exe.log + if test -s log2.filtered; then + echo -e "${exe}: unempty log2.filtered:\n$(cat log2.filtered)" | tee -a $LOGDIR/$exe.log rv="FAIL" fi @@ -63,17 +68,18 @@ doTest () rv="FAIL" fi - if ! ${DIFFCMD} log1summary log2summary >/dev/null; then - echo -e "${exe}: ${DIFFCMD} log1summary log2summary:\n$(${DIFFCMD} log1summary log2summary)" | tee -a $LOGDIR/$exe.log + if ! ${DIFFCMD} log1err log2err >/dev/null; then + echo -e "${exe}: ${DIFFCMD} log1err log2err:\n$(${DIFFCMD} log1err log2err)" | tee -a $LOGDIR/$exe.log rv="FAIL" fi - if ! ${DIFFCMD} log2summary log3summary >/dev/null; then - echo -e "${exe}: ${DIFFCMD} log2summary log3summary:\n$(${DIFFCMD} log2summary log3summary)" | tee -a $LOGDIR/$exe.log + if ! ${DIFFCMD} log2err log3err >/dev/null; then + echo -e "${exe}: ${DIFFCMD} log2err log3err:\n$(${DIFFCMD} log2err log3err)" | tee -a $LOGDIR/$exe.log rv="FAIL" fi # synthetize automake style testlogs for bunsen import + echo "# result" >> $LOGDIR/$exe.log echo ":test-result: $rv" | tee -a $LOGDIR/$exe.log > $LOGDIR/$exe.trs popd >/dev/null popd >/dev/null From aa28efc1a9c7ac6ffb081f8fa40b17b29d04bf98 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sat, 7 Jun 2025 11:48:01 +0000 Subject: [PATCH 059/412] s390x: Improve none/tests/s390x/cvb.c The result of a CVB insn resides in an 8-byte register of which the most significant 4 bytes ought to unchanged by the insn. We want to check that. So we need to use a variable of type 'long'. Rewrite the code a bit. --- none/tests/s390x/cvb.c | 165 +++++++++++++++----------------- none/tests/s390x/cvb.stdout.exp | 150 ++++++++++++++++------------- 2 files changed, 157 insertions(+), 158 deletions(-) diff --git a/none/tests/s390x/cvb.c b/none/tests/s390x/cvb.c index ce5f9e405..3f928a6b2 100644 --- a/none/tests/s390x/cvb.c +++ b/none/tests/s390x/cvb.c @@ -1,104 +1,89 @@ +#include #include -static unsigned long test[] ={ - 0x000000000000000a, - 0x000000000000001a, - 0x000000000000012a, - 0x000000000000123a, - 0x000000000001234a, - 0x000000000012345a, - 0x000000000123456a, - 0x000000001234567a, - 0x000000012345678a, - 0x000000123456789a, - 0x000001234567890a, - 0x000000000000000b, - 0x000000000000001b, - 0x000000000000012b, - 0x000000000000123b, - 0x000000000001234b, - 0x000000000012345b, - 0x000000000123456b, - 0x000000001234567b, - 0x000000012345678b, - 0x000000123456789b, - 0x000001234567890b, - 0x000000000000000c, - 0x000000000000001c, - 0x000000000000012c, - 0x000000000000123c, - 0x000000000001234c, - 0x000000000012345c, - 0x000000000123456c, - 0x000000001234567c, - 0x000000012345678c, - 0x000000123456789c, - 0x000001234567890c, - 0x000000000000000d, - 0x000000000000001d, - 0x000000000000012d, - 0x000000000000123d, - 0x000000000001234d, - 0x000000000012345d, - 0x000000000123456d, - 0x000000001234567d, - 0x000000012345678d, - 0x000000123456789d, - 0x000001234567890d, - 0x000000000000000e, - 0x000000000000001e, - 0x000000000000012e, - 0x000000000000123e, - 0x000000000001234e, - 0x000000000012345e, - 0x000000000123456e, - 0x000000001234567e, - 0x000000012345678e, - 0x000000123456789e, - 0x000001234567890e, - 0x000000000000000f, - 0x000000000000001f, - 0x000000000000012f, - 0x000000000000123f, - 0x000000000001234f, - 0x000000000012345f, - 0x000000000123456f, - 0x000000001234567f, - 0x000000012345678f, - 0x000000123456789f, - 0x000001234567890f, - /* min and max */ - 0x000002147483647c, - 0x000002147483648d, - -/* fixs390: we also need to check if invalid values cause a fixed-point-devide exception. - Not yet implemented. */ -/* 0x000002147483648c, - 0x000002147483649d, - 0x00000000000000fa, */ - +/* Valid values (excluding sign code) */ +static const unsigned long valid[] = { + 0x0000000000000000, + 0x0000000000000010, + 0x0000000000000120, + 0x0000000000001230, + 0x0000000000012340, + 0x0000000000123450, + 0x0000000001234560, + 0x0000000012345670, + 0x0000000123456780, + 0x0000001234567890, + 0x0000012345678900, }; +/* Boundary values (excluding sign code) */ +static const unsigned long max = 0x0000021474836470; +static const unsigned long min = 0x0000021474836480; + +/* Valid sign codes */ +static const unsigned sign_code_pos[] = { 0xa, 0xc, 0xe, 0xf }; +static const unsigned sign_code_neg[] = { 0xb, 0xd }; + +#define NUM_EL(x) (sizeof(x) / sizeof(*(x))) -static signed int dec_to_hex(unsigned long *addr) +/* The value pointed to by ADDR is valid including sign code. */ +static signed int +dec_to_hex(unsigned long *addr) { - register signed int res asm("2") = 0; - register unsigned long *_addr asm("4") = addr; + long res; + int res1, res2; - asm volatile( - " cvb %0,0(0,%1)" - : "=d" (res) : "d" (_addr) : "memory"); - return res & 0xffffffff; -} + res = 0; + asm volatile("cvb %0,0(0,%1)" + : "+d" (res) : "a" (addr) : "memory"); + + // bits [0:31] ought to be unchanged + // Catch bits that are set but shouldn't be + assert((res >> 32) == 0); + res1 = (int)res; + res = -1; + asm volatile("cvb %0,0(0,%1)" + : "+d" (res) : "a" (addr) : "memory"); + // bits [0:31] ought to be unchanged + // Catch bits that are cleared but shouldn't be + assert((res >> 32) == -1); + res2 = (int)(res & 0xffffffff); + // Successful conversion + assert(res1 == res2); -int main() + return res1; +} + +int main(void) { - int i; + for (int sign_code = 0xa; sign_code <= 0xf; ++sign_code) { + printf("Testing in-range values with sign code 0x%x\n", sign_code); + for (int i = 0; i < NUM_EL(valid); ++i) { + unsigned long value = valid[i] | sign_code; + printf("0x%016lx --> %d\n", value, dec_to_hex(&value)); + } + } + printf("\n"); + + printf("Testing max. value 0x%lx\n", max >> 4); + for (int i = 0; i < NUM_EL(sign_code_pos); ++i) { + unsigned sign_code = sign_code_pos[i]; + unsigned long value = max | sign_code; + printf("0x%016lx --> %d\n", value, dec_to_hex(&value)); + } + printf("\n"); + + printf("Testing min. value 0x%lx\n", min >> 4); + for (int i = 0; i < NUM_EL(sign_code_neg); ++i) { + unsigned sign_code = sign_code_neg[i]; + unsigned long value = min | sign_code; + printf("0x%016lx --> %d\n", value, dec_to_hex(&value)); + } + + /* fixs390: check behaviour for invalid values, out-of-range values and values with invalid sign code */ - for (i = 0; i < sizeof(test) / sizeof(test[0]); i++) - printf("%d\n", dec_to_hex(&test[i])); - return 0; + return 0; } diff --git a/none/tests/s390x/cvb.stdout.exp b/none/tests/s390x/cvb.stdout.exp index 35d6a600f..268ea354d 100644 --- a/none/tests/s390x/cvb.stdout.exp +++ b/none/tests/s390x/cvb.stdout.exp @@ -1,68 +1,82 @@ -0 -1 -12 -123 -1234 -12345 -123456 -1234567 -12345678 -123456789 -1234567890 -0 --1 --12 --123 --1234 --12345 --123456 --1234567 --12345678 --123456789 --1234567890 -0 -1 -12 -123 -1234 -12345 -123456 -1234567 -12345678 -123456789 -1234567890 -0 --1 --12 --123 --1234 --12345 --123456 --1234567 --12345678 --123456789 --1234567890 -0 -1 -12 -123 -1234 -12345 -123456 -1234567 -12345678 -123456789 -1234567890 -0 -1 -12 -123 -1234 -12345 -123456 -1234567 -12345678 -123456789 -1234567890 -2147483647 --2147483648 +Testing in-range values with sign code 0xa +0x000000000000000a --> 0 +0x000000000000001a --> 1 +0x000000000000012a --> 12 +0x000000000000123a --> 123 +0x000000000001234a --> 1234 +0x000000000012345a --> 12345 +0x000000000123456a --> 123456 +0x000000001234567a --> 1234567 +0x000000012345678a --> 12345678 +0x000000123456789a --> 123456789 +0x000001234567890a --> 1234567890 +Testing in-range values with sign code 0xb +0x000000000000000b --> 0 +0x000000000000001b --> -1 +0x000000000000012b --> -12 +0x000000000000123b --> -123 +0x000000000001234b --> -1234 +0x000000000012345b --> -12345 +0x000000000123456b --> -123456 +0x000000001234567b --> -1234567 +0x000000012345678b --> -12345678 +0x000000123456789b --> -123456789 +0x000001234567890b --> -1234567890 +Testing in-range values with sign code 0xc +0x000000000000000c --> 0 +0x000000000000001c --> 1 +0x000000000000012c --> 12 +0x000000000000123c --> 123 +0x000000000001234c --> 1234 +0x000000000012345c --> 12345 +0x000000000123456c --> 123456 +0x000000001234567c --> 1234567 +0x000000012345678c --> 12345678 +0x000000123456789c --> 123456789 +0x000001234567890c --> 1234567890 +Testing in-range values with sign code 0xd +0x000000000000000d --> 0 +0x000000000000001d --> -1 +0x000000000000012d --> -12 +0x000000000000123d --> -123 +0x000000000001234d --> -1234 +0x000000000012345d --> -12345 +0x000000000123456d --> -123456 +0x000000001234567d --> -1234567 +0x000000012345678d --> -12345678 +0x000000123456789d --> -123456789 +0x000001234567890d --> -1234567890 +Testing in-range values with sign code 0xe +0x000000000000000e --> 0 +0x000000000000001e --> 1 +0x000000000000012e --> 12 +0x000000000000123e --> 123 +0x000000000001234e --> 1234 +0x000000000012345e --> 12345 +0x000000000123456e --> 123456 +0x000000001234567e --> 1234567 +0x000000012345678e --> 12345678 +0x000000123456789e --> 123456789 +0x000001234567890e --> 1234567890 +Testing in-range values with sign code 0xf +0x000000000000000f --> 0 +0x000000000000001f --> 1 +0x000000000000012f --> 12 +0x000000000000123f --> 123 +0x000000000001234f --> 1234 +0x000000000012345f --> 12345 +0x000000000123456f --> 123456 +0x000000001234567f --> 1234567 +0x000000012345678f --> 12345678 +0x000000123456789f --> 123456789 +0x000001234567890f --> 1234567890 + +Testing max. value 0x2147483647 +0x000002147483647a --> 2147483647 +0x000002147483647c --> 2147483647 +0x000002147483647e --> 2147483647 +0x000002147483647f --> 2147483647 + +Testing min. value 0x2147483648 +0x000002147483648b --> -2147483648 +0x000002147483648d --> -2147483648 From 67e6e1c4c2fa7847ab7cb14360814599520932c6 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sat, 7 Jun 2025 12:12:56 +0000 Subject: [PATCH 060/412] s390x: Fix thinko, remove a few fixs390's All of VEX's Iops are side effect free. They don't set the condition code. Therefore, when emitting a VCEQ, VPK[L]S or VCH[L] the 'set cc' field is 0. Nothing to fix here. --- VEX/priv/host_s390_defs.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index e26ea09d4..08a34a5fa 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -5813,7 +5813,6 @@ static UChar* s390_emit_VCEQ(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - /* fixs390: m5 = 0 --> condition code not set */ S390_DISASM(XMNM("vceq", vch_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(0)); return emit_VRR_VVVM(p, 0xE700000000f8ULL, v1, v2, v3, m4); @@ -5844,7 +5843,6 @@ static UChar * s390_emit_VPKS(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - /* fixs390: m5 = 0 --> condition code not set */ S390_DISASM(XMNM("vpks", vch_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(0)); return emit_VRR_VVVM(p, 0xE70000000097ULL, v1, v2, v3, m4); @@ -5855,7 +5853,6 @@ static UChar * s390_emit_VPKLS(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - /* fixs390: m5 = 0 --> condition code not set */ S390_DISASM(XMNM("vpkls", vch_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(0)); return emit_VRR_VVVM(p, 0xE70000000095ULL, v1, v2, v3, m4); @@ -5952,7 +5949,6 @@ static UChar * s390_emit_VCH(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - /* fixs390: m5 = 0 --> condition code not set */ S390_DISASM(XMNM("vch", vch_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(0)); return emit_VRR_VVVM(p, 0xE700000000fbULL, v1, v2, v3, m4); @@ -5962,7 +5958,6 @@ static UChar * s390_emit_VCHL(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - /* fixs390: m5 = 0 --> condition code not set */ S390_DISASM(XMNM("vchl", vch_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(0)); return emit_VRR_VVVM(p, 0xE700000000f9ULL, v1, v2, v3, m4); From 9775bc496e4b6f80dec993e5d147356ebbe29fe3 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 17 Jun 2025 13:51:48 +0200 Subject: [PATCH 061/412] Wrap linux specific mseal syscall mseal takes address, size and flags. Flags are reserved for future use. Modern CPUs support memory permissions such as RW and NX bits. The mseal syscall takes address and size parameters to additionally protect memory mapping against modifications. FTR: https://docs.kernel.org/userspace-api/mseal.html Declare a sys_mseal wrapper in priv_syswrap-linux.h and hook it for {amd64,arm,arm64,mips64,nanomips,ppc32,ppc64,riscv64,s390x,x86}-linux using LINX_ with PRE handler in syswrap-linux.c https://bugs.kde.org/show_bug.cgi?id=505228 --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 3 +++ coregrind/m_syswrap/syswrap-amd64-linux.c | 1 + coregrind/m_syswrap/syswrap-arm-linux.c | 1 + coregrind/m_syswrap/syswrap-arm64-linux.c | 1 + coregrind/m_syswrap/syswrap-linux.c | 9 +++++++++ coregrind/m_syswrap/syswrap-mips32-linux.c | 1 + coregrind/m_syswrap/syswrap-mips64-linux.c | 1 + coregrind/m_syswrap/syswrap-nanomips-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc32-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc64-linux.c | 1 + coregrind/m_syswrap/syswrap-riscv64-linux.c | 1 + coregrind/m_syswrap/syswrap-s390x-linux.c | 1 + coregrind/m_syswrap/syswrap-x86-linux.c | 1 + include/vki/vki-scnums-mips32-linux.h | 1 + include/vki/vki-scnums-mips64-linux.h | 1 + include/vki/vki-scnums-shared-linux.h | 1 + 17 files changed, 27 insertions(+) diff --git a/NEWS b/NEWS index 041d7afdf..97e4b3b41 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 504919 Hide "client tried to modify addresses" warnings when -q (quiet) set 504936 Add FreeBSD amd64 sysarch subcommands AMD64_SET_TLSBASE and AMD64_GET_TLSBASE +505228 Wrap linux specific mseal syscall To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 966eae543..ed8cb4ed5 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -355,6 +355,9 @@ DECL_TEMPLATE(linux, sys_pidfd_getfd); // Since Linux 6.6 DECL_TEMPLATE(linux, sys_fchmodat2); +// Since Linux 6.10 +DECL_TEMPLATE(linux, sys_mseal); + /* --------------------------------------------------------------------- Wrappers for sockets and ipc-ery. These are split into standalone procedures because x86-linux hides them inside multiplexors diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index c22683192..292e969fc 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -904,6 +904,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 + LINX_(__NR_mseal, sys_mseal), // 462 }; SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 05cd1e4b6..6d7db0425 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -1075,6 +1075,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 + LINX_(__NR_mseal, sys_mseal), // 462 }; diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index 28cb3647c..2d6b45f91 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -855,6 +855,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 + LINX_(__NR_mseal, sys_mseal), // 462 }; diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index be936ecbe..0db871778 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4296,6 +4296,15 @@ PRE(sys_membarrier) PRE_REG_READ1(int, "membarrier", int, flags); } +PRE(sys_mseal) +{ + /* int mseal(void *addr, size_t len, unsigned long flags) */ + PRINT("sys_mseal ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, )", ARG1, ARG2, ARG3); + PRE_REG_READ3(int, "mseal", void *, addr, vki_size_t, len, int, flags); + if (!ML_(valid_client_addr)(ARG1, ARG2, tid, "mseal")) + SET_STATUS_Failure(VKI_ENOMEM); +} + PRE(sys_syncfs) { *flags |= SfMayBlock; diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index d16a9a4bc..5edae82c3 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -1182,6 +1182,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 + LINX_(__NR_mseal, sys_mseal), // 462 }; SyscallTableEntry* ML_(get_linux_syscall_entry) (UInt sysno) diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index fe1f3db7f..63e4b111e 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -838,6 +838,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY (__NR_cachestat, sys_cachestat), LINX_ (__NR_fchmodat2, sys_fchmodat2), LINXY (__NR_userfaultfd, sys_userfaultfd), + LINX_ (__NR_mseal, sys_mseal), }; SyscallTableEntry * ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index 87153737d..b392ad1ad 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -842,6 +842,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_ (__NR_landlock_restrict_self, sys_landlock_restrict_self), LINXY (__NR_cachestat, sys_cachestat), LINX_ (__NR_fchmodat2, sys_fchmodat2), + LINX_ (__NR_mseal, sys_mseal), }; SyscallTableEntry* ML_(get_linux_syscall_entry) (UInt sysno) diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index bc180b8b1..9d02a0258 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -1081,6 +1081,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 + LINX_ (__NR_mseal, sys_mseal), // 462 }; SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 6e97358e8..94385a4fa 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1048,6 +1048,7 @@ static SyscallTableEntry syscall_table[] = { LINXY (__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 + LINX_ (__NR_mseal, sys_mseal), // 462 }; SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index 7a1ff0751..68ccd0ea4 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -599,6 +599,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_memfd_secret, sys_memfd_secret), /* 447 */ LINXY(__NR_cachestat, sys_cachestat), /* 451 */ LINX_(__NR_fchmodat2, sys_fchmodat2), /* 452 */ + LINX_(__NR_mseal, sys_mseal), /* 462 */ }; SyscallTableEntry* ML_(get_linux_syscall_entry)(UInt sysno) diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index f4ceae461..a6770399d 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -890,6 +890,7 @@ static SyscallTableEntry syscall_table[] = { LINXY (__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 + LINX_ (__NR_mseal, sys_mseal), // 462 }; SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 662780588..4b5b5fb15 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1676,6 +1676,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 + LINX_(__NR_mseal, sys_mseal), // 462 }; SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/include/vki/vki-scnums-mips32-linux.h b/include/vki/vki-scnums-mips32-linux.h index d4f8de15a..53f6499aa 100644 --- a/include/vki/vki-scnums-mips32-linux.h +++ b/include/vki/vki-scnums-mips32-linux.h @@ -460,6 +460,7 @@ #define __NR_set_mempolicy_home_node (__NR_Linux + 450) #define __NR_cachestat (__NR_Linux + 451) #define __NR_fchmodat2 (__NR_Linux + 452) +#define __NR_mseal (__NR_Linux + 462) /* * Offset of the last Linux o32 flavoured syscall */ diff --git a/include/vki/vki-scnums-mips64-linux.h b/include/vki/vki-scnums-mips64-linux.h index c5291e31c..91f578345 100644 --- a/include/vki/vki-scnums-mips64-linux.h +++ b/include/vki/vki-scnums-mips64-linux.h @@ -401,6 +401,7 @@ #define __NR_lsm_get_self_attr (__NR_Linux + 459) #define __NR_lsm_set_self_attr (__NR_Linux + 460) #define __NR_lsm_list_modules (__NR_Linux + 461) +#define __NR_mseal (__NR_Linux + 462) #elif defined(VGABI_N32) diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h index 616f8052d..32ef8ac13 100644 --- a/include/vki/vki-scnums-shared-linux.h +++ b/include/vki/vki-scnums-shared-linux.h @@ -56,5 +56,6 @@ #define __NR_cachestat 451 #define __NR_fchmodat2 452 +#define __NR_mseal 462 #endif From e59f3c959102d6ca9f1791c0023f313a1be34030 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 18 Jun 2025 17:02:06 +0000 Subject: [PATCH 062/412] s390x: Fix a comment --- VEX/priv/host_s390_defs.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/VEX/priv/host_s390_defs.h b/VEX/priv/host_s390_defs.h index 48fbac764..ddbaed5fe 100644 --- a/VEX/priv/host_s390_defs.h +++ b/VEX/priv/host_s390_defs.h @@ -100,13 +100,10 @@ typedef enum { } s390_opnd_t; -/* Naming convention for operand locations: - R - GPR - I - immediate value - M - memory (any Amode may be used) -*/ - -/* An operand that is either in a GPR or is addressable via a BX20 amode */ +/* An operand that is either + R located in a GPR or + M located in memory and addressable via any amode or + I an immediate integer constant */ typedef struct { s390_opnd_t tag; union { From c6a5f3c5a573cefb1b351fd3d8997439525299d3 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 18 Jun 2025 21:10:17 +0000 Subject: [PATCH 063/412] s390x: Robustise LibVEX_GuestS390X_initialise --- VEX/priv/guest_s390_helpers.c | 120 +--------------------------------- 1 file changed, 1 insertion(+), 119 deletions(-) diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index 6e0321fea..335a9060b 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -44,127 +44,9 @@ void LibVEX_GuestS390X_initialise(VexGuestS390XState *state) { -/*------------------------------------------------------------*/ -/*--- Initialise ar registers ---*/ -/*------------------------------------------------------------*/ - - state->guest_a0 = 0; - state->guest_a1 = 0; - state->guest_a2 = 0; - state->guest_a3 = 0; - state->guest_a4 = 0; - state->guest_a5 = 0; - state->guest_a6 = 0; - state->guest_a7 = 0; - state->guest_a8 = 0; - state->guest_a9 = 0; - state->guest_a10 = 0; - state->guest_a11 = 0; - state->guest_a12 = 0; - state->guest_a13 = 0; - state->guest_a14 = 0; - state->guest_a15 = 0; - -/*------------------------------------------------------------*/ -/*--- Initialise vr registers ---*/ -/*------------------------------------------------------------*/ - -#define VRZERO(vr) \ - do { \ - vr.w64[0] = vr.w64[1] = 0ULL; \ - } while(0); - - VRZERO(state->guest_v0) - VRZERO(state->guest_v1) - VRZERO(state->guest_v2) - VRZERO(state->guest_v3) - VRZERO(state->guest_v4) - VRZERO(state->guest_v5) - VRZERO(state->guest_v6) - VRZERO(state->guest_v7) - VRZERO(state->guest_v8) - VRZERO(state->guest_v9) - VRZERO(state->guest_v10) - VRZERO(state->guest_v11) - VRZERO(state->guest_v12) - VRZERO(state->guest_v13) - VRZERO(state->guest_v14) - VRZERO(state->guest_v15) - VRZERO(state->guest_v16) - VRZERO(state->guest_v17) - VRZERO(state->guest_v18) - VRZERO(state->guest_v19) - VRZERO(state->guest_v20) - VRZERO(state->guest_v21) - VRZERO(state->guest_v22) - VRZERO(state->guest_v23) - VRZERO(state->guest_v24) - VRZERO(state->guest_v25) - VRZERO(state->guest_v26) - VRZERO(state->guest_v27) - VRZERO(state->guest_v28) - VRZERO(state->guest_v29) - VRZERO(state->guest_v30) - VRZERO(state->guest_v31) - -#undef VRZERO -/*------------------------------------------------------------*/ -/*--- Initialise gpr registers ---*/ -/*------------------------------------------------------------*/ - - state->guest_r0 = 0; - state->guest_r1 = 0; - state->guest_r2 = 0; - state->guest_r3 = 0; - state->guest_r4 = 0; - state->guest_r5 = 0; - state->guest_r6 = 0; - state->guest_r7 = 0; - state->guest_r8 = 0; - state->guest_r9 = 0; - state->guest_r10 = 0; - state->guest_r11 = 0; - state->guest_r12 = 0; - state->guest_r13 = 0; - state->guest_r14 = 0; - state->guest_r15 = 0; - -/*------------------------------------------------------------*/ -/*--- Initialise S390 miscellaneous registers ---*/ -/*------------------------------------------------------------*/ + __builtin_memset(state, 0x0, sizeof *state); - state->guest_counter = 0; - state->guest_fpc = 0; - state->guest_IA = 0; - -/*------------------------------------------------------------*/ -/*--- Initialise S390 pseudo registers ---*/ -/*------------------------------------------------------------*/ - - state->guest_SYSNO = 0; - -/*------------------------------------------------------------*/ -/*--- Initialise generic pseudo registers ---*/ -/*------------------------------------------------------------*/ - - state->guest_NRADDR = 0; - state->guest_CMSTART = 0; - state->guest_CMLEN = 0; - state->guest_IP_AT_SYSCALL = 0; state->guest_EMNOTE = EmNote_NONE; - state->host_EvC_COUNTER = 0; - state->host_EvC_FAILADDR = 0; - -/*------------------------------------------------------------*/ -/*--- Initialise thunk ---*/ -/*------------------------------------------------------------*/ - - state->guest_CC_OP = 0; - state->guest_CC_DEP1 = 0; - state->guest_CC_DEP2 = 0; - state->guest_CC_NDEP = 0; - - __builtin_memset(state->padding, 0x0, sizeof(state->padding)); } From f7dccaab11b8dc1af2bbcd31dea5bb7a50c6f811 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 29 May 2025 23:41:52 +0200 Subject: [PATCH 064/412] Rewrite DWARF inlined subroutine handling to work cross CU The readdwarf3 parsers cannot read DIEs across CUs. An inlined subroutine refers to an subprogram which has a name (or refers to a declaration of a subprogram that has a name). These subprograms can be (and often are when dwz has been used to compress the DWARF) in a different CU. So a lot of inlined subroutines in backtraces are just called "UnknownInlinedFun". To work around not being able to read DIEs across CUs directly we don't try to immediately resolve the name of the inlined subroutine by following the abstract origin reference to the subprogram, but just record it in the DiInlLoc. We also record all subprogram indexes while parsing in a new DiSubprogram structure and whether the subprogram had a name or had a reference to another subprogram (specification). We have to look under a couple more DIEs. We normally want to skip any DIE that doesn't have an address range when looking for inlined subroutines, but there are various other DIEs that can contain a subprogram (specification). We also want to walk the DIEs from low to high (cooked DIE) index, so we first pass over the main .debug_info, then the .debug_types, and finally the alt .debug_info. That way we can store the DiSubprograms in an array from low to high index and use a binary search to connect the inlined subroutines to the subprogram that contains the name. The code also tracks whether the subprogram is artificial, but this isn't used yet. But should make it possible for a followup patch to remove artificial inlined subroutines from a backtrace. Tested against emacs and libreoffice as packaged in Fedora where the programs and all shared libraries used are processed with dwz. The new code gives a name to every inlined subroutine. Except when the DWARF produced is bad and the DW_AT_subroutine didn't contain an DW_AT_abstract_origin and so no DW_AT_subprogram can be found. https://bugs.kde.org/show_bug.cgi?id=338803 --- NEWS | 1 + coregrind/m_debuginfo/debuginfo.c | 6 +- coregrind/m_debuginfo/priv_storage.h | 29 +- coregrind/m_debuginfo/readdwarf3.c | 379 ++++++++++++++------------- coregrind/m_debuginfo/storage.c | 33 ++- 5 files changed, 264 insertions(+), 184 deletions(-) diff --git a/NEWS b/NEWS index 97e4b3b41..0e0118265 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +338803 Handling of dwz debug alt files or cross-CU is broken 503098 Incorrect NAN-boxing for float registers in RISC-V 503641 close_range syscalls started failing with 3.25.0 503677 duplicated-cond compiler warning in dis_RV64M diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index cd0472090..4ce976a6d 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -2354,7 +2354,7 @@ Bool VG_(get_fnname_inl) ( DiEpoch ep, Addr a, const HChar** buf, ? & iipc->di->inltab[iipc->next_inltab] : NULL; vg_assert (next_inl); - *buf = next_inl->inlinedfn; + *buf = next_inl->inlined.fn; return True; } } @@ -2444,7 +2444,7 @@ Bool VG_(get_fnname_no_cxx_demangle) ( DiEpoch ep, Addr a, const HChar** buf, : NULL; vg_assert (next_inl); // The function we are in is called by next_inl. - *buf = next_inl->inlinedfn; + *buf = next_inl->inlined.fn; return True; } } @@ -2806,7 +2806,7 @@ const HChar* VG_(describe_IP)(DiEpoch ep, Addr eip, const InlIPCursor *iipc) : NULL; vg_assert (next_inl); // The function we are in is called by next_inl. - buf_fn = next_inl->inlinedfn; + buf_fn = next_inl->inlined.fn; know_fnname = True; // INLINED???? diff --git a/coregrind/m_debuginfo/priv_storage.h b/coregrind/m_debuginfo/priv_storage.h index d8cba81c4..868ce2772 100644 --- a/coregrind/m_debuginfo/priv_storage.h +++ b/coregrind/m_debuginfo/priv_storage.h @@ -11,6 +11,8 @@ Copyright (C) 2000-2017 Julian Seward jseward@acm.org + Copyright (C) 2025 Mark J. Wielaard + mark@klomp.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -142,7 +144,10 @@ typedef /* Word 2 */ Addr addr_hi; /* highest address following the inlined fn */ /* Word 3 */ - const HChar* inlinedfn; /* inlined function name */ + union { + UWord subprog; /* subprogram DIE (cooked) reference. */ + const HChar* fn; /* inlined function name (after resolving) */ + } inlined; /* Word 4 and 5 */ UInt fndn_ix; /* index in di->fndnpool of caller source dirname/filename */ @@ -151,6 +156,18 @@ typedef } DiInlLoc; +typedef + struct { + UWord index; /* cooked DIE index. */ + union { + const HChar *fn; /* Name of subprogram. */ + UWord subprog; /* DW_AT_specification of another subprogram. */ + } ref; + Bool isSubprogRef; /* True is ref is a subprog reference. */ + Bool isArtificial; /* True is the subprogram has DW_AT_artificial. */ + } + DiSubprogram; + /* --------------------- CF INFO --------------------- */ /* DiCfSI: a structure to summarise DWARF2/3 CFA info for the code @@ -949,6 +966,12 @@ struct _DebugInfo { UWord inltab_size; SizeT maxinl_codesz; + /* Storage for subprogram attributes. To use in inltab after pass over + all debuginfo to resolve names. */ + DiSubprogram* subtab; + UWord subtab_used; + UWord subtab_size; + /* A set of expandable arrays to store CFI summary info records. The machine specific information (i.e. the DiCfSI_m struct) are stored in cfsi_m_pool, as these are highly duplicated. @@ -1125,10 +1148,12 @@ void ML_(addLineInfo) ( struct _DebugInfo* di, extern void ML_(addInlInfo) ( struct _DebugInfo* di, Addr addr_lo, Addr addr_hi, - const HChar* inlinedfn, + UWord subprog, UInt fndn_ix, Int lineno, UShort level); +extern void ML_(addSubprogram) ( struct _DebugInfo* di, DiSubprogram* sub ); + /* Add a CFI summary record. The supplied DiCfSI_m is copied. */ extern void ML_(addDiCfSI) ( struct _DebugInfo* di, Addr base, UInt len, DiCfSI_m* cfsi_m ); diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c index 735896f7c..745f2c43a 100644 --- a/coregrind/m_debuginfo/readdwarf3.c +++ b/coregrind/m_debuginfo/readdwarf3.c @@ -11,6 +11,8 @@ Copyright (C) 2008-2017 OpenWorks LLP info@open-works.co.uk + Copyright (C) 2025 Mark J. Wielaard + mark@klomp.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -3388,147 +3390,6 @@ typedef } D3InlParser; -/* Return the function name corresponding to absori. - - absori is a 'cooked' reference to a DIE, i.e. absori can be either - in cc->escn_debug_info or in cc->escn_debug_info_alt. - get_inlFnName will uncook absori. - - The returned value is a (permanent) string in DebugInfo's .strchunks. - - LIMITATION: absori must point in the CU of cc. If absori points - in another CU, returns "UnknownInlinedFun". - - Here are the problems to retrieve the fun name if absori is in - another CU: the DIE reading code cannot properly extract data from - another CU, as the abbv code retrieved in the other CU cannot be - translated in an abbreviation. Reading data from the alternate debug - info also gives problems as the string reference is also in the alternate - file, but when reading the alt DIE, the string form is a 'local' string, - but cannot be read in the current CU, but must be read in the alt CU. - See bug 338803 comment#3 and attachment for a failed attempt to handle - these problems (failed because with the patch, only one alt abbrev hash - table is kept, while we must handle all abbreviations in all CUs - referenced by an absori (being a reference to an alt CU, or a previous - or following CU). */ -static const HChar* get_inlFnName (Int absori, CUConst* cc, Bool td3) -{ - Cursor c; - const g_abbv *abbv; - ULong atag, abbv_code; - UInt has_children; - UWord posn; - Bool type_flag, alt_flag; - const HChar *ret = NULL; - FormContents cts; - UInt nf_i; - - /* Some inlined subroutine call dwarf entries do not have the abstract - origin attribute, resulting in absori being 0 (see callers of - get_inlFnName). This is observed at least with gcc 6.3.0 when compiling - valgrind with lto. So, in case we have a 0 absori, do not report an - error, instead, rather return an unknown inlined function. */ - if (absori == 0) { - static Bool absori0_reported = False; - if (!absori0_reported && VG_(clo_verbosity) > 1) { - VG_(message)(Vg_DebugMsg, - "Warning: inlined fn name without absori\n" - "is shown as UnknownInlinedFun\n"); - absori0_reported = True; - } - TRACE_D3(" : absori is not set"); - return ML_(addStr)(cc->di, "UnknownInlinedFun", -1); - } - - posn = uncook_die( cc, absori, &type_flag, &alt_flag); - if (type_flag) - cc->barf("get_inlFnName: uncooked absori in type debug info"); - - /* LIMITATION: check we are in the same CU. - If not, return unknown inlined function name. */ - /* if crossing between alt debug info<>normal info - or posn not in the cu range, - then it is in another CU. */ - if (alt_flag != cc->is_alt_info - || posn < cc->cu_start_offset - || posn >= cc->cu_start_offset + cc->unit_length) { - static Bool reported = False; - if (!reported && VG_(clo_verbosity) > 1) { - VG_(message)(Vg_DebugMsg, - "Warning: cross-CU LIMITATION: some inlined fn names\n" - "might be shown as UnknownInlinedFun\n"); - reported = True; - } - TRACE_D3(" <%lx>: cross-CU LIMITATION", posn); - return ML_(addStr)(cc->di, "UnknownInlinedFun", -1); - } - - init_Cursor (&c, cc->escn_debug_info, posn, cc->barf, - "Overrun get_inlFnName absori"); - - abbv_code = get_ULEB128( &c ); - abbv = get_abbv ( cc, abbv_code, td3); - atag = abbv->atag; - TRACE_D3(" <%lx>: Abbrev Number: %llu (%s)\n", - posn, abbv_code, ML_(pp_DW_TAG)( atag ) ); - - if (atag == 0) - cc->barf("get_inlFnName: invalid zero tag on DIE"); - - has_children = abbv->has_children; - if (has_children != DW_children_no && has_children != DW_children_yes) - cc->barf("get_inlFnName: invalid has_children value"); - - if (atag != DW_TAG_subprogram) - cc->barf("get_inlFnName: absori not a subprogram"); - - nf_i = 0; - while (True) { - DW_AT attr = (DW_AT) abbv->nf[nf_i].at_name; - DW_FORM form = (DW_FORM)abbv->nf[nf_i].at_form; - const name_form *nf = &abbv->nf[nf_i]; - nf_i++; - if (attr == 0 && form == 0) break; - get_Form_contents( &cts, cc, &c, False/*td3*/, nf ); - if (attr == DW_AT_name) { - HChar *fnname; - if (cts.szB >= 0) - cc->barf("get_inlFnName: expecting indirect string"); - fnname = ML_(cur_read_strdup)( cts.u.cur, - "get_inlFnName.1" ); - ret = ML_(addStr)(cc->di, fnname, -1); - ML_(dinfo_free) (fnname); - break; /* Name found, get out of the loop, as this has priority over - DW_AT_specification. */ - } - if (attr == DW_AT_specification) { - UWord cdie; - - if (cts.szB == 0) - cc->barf("get_inlFnName: AT specification missing"); - - /* The recursive call to get_inlFnName will uncook its arg. - So, we need to cook it here, so as to reference the - correct section (e.g. the alt info). */ - cdie = cook_die_using_form(cc, (UWord)cts.u.val, form); - - /* hoping that there is no loop */ - ret = get_inlFnName (cdie, cc, td3); - /* Unclear if having both DW_AT_specification and DW_AT_name is - possible but in any case, we do not break here. - If we find later on a DW_AT_name, it will override the name found - in the DW_AT_specification.*/ - } - } - - if (ret) - return ret; - else { - TRACE_D3("AbsOriFnNameNotFound"); - return ML_(addStr)(cc->di, "AbsOriFnNameNotFound", -1); - } -} - /* Returns True if the (possibly) childrens of the current DIE are interesting to parse. Returns False otherwise. If the current DIE has a sibling, the non interesting children can @@ -3618,8 +3479,8 @@ static Bool parse_inl_DIE ( Addr rangeoff = 0; UInt caller_fndn_ix = 0; Int caller_lineno = 0; - Int inlinedfn_abstract_origin = 0; - // 0 will be interpreted as no abstract origin by get_inlFnName + UWord inlinedfn_abstract_origin = 0; + // 0 will be interpreted as no abstract origin nf_i = 0; while (True) { @@ -3683,7 +3544,7 @@ static Bool parse_inl_DIE ( ip_hi1 += cc->di->text_debug_bias; ML_(addInlInfo) (cc->di, ip_lo, ip_hi1, - get_inlFnName (inlinedfn_abstract_origin, cc, td3), + inlinedfn_abstract_origin, caller_fndn_ix, caller_lineno, level); } @@ -3691,8 +3552,6 @@ static Bool parse_inl_DIE ( /* This inlined call is several address ranges. */ XArray *ranges; Word j; - const HChar *inlfnname = - get_inlFnName (inlinedfn_abstract_origin, cc, td3); /* Ranges are biased for the inline info using the same logic as what is used for biasing ranges for the var info, for which @@ -3709,7 +3568,7 @@ static Bool parse_inl_DIE ( // aMax+1 as range has its last bound included // while ML_(addInlInfo) expects last bound not // included. - inlfnname, + inlinedfn_abstract_origin, caller_fndn_ix, caller_lineno, level); } @@ -3718,11 +3577,82 @@ static Bool parse_inl_DIE ( goto_bad_DIE; } + if (dtag == DW_TAG_subprogram) { + DiSubprogram sub; + sub.index = posn; /* Note posn is already cooked. */ + sub.isArtificial = False; + UWord cdie = 0; + const HChar *fn = NULL; + Bool name_or_spec = False; + nf_i = 0; + while (True) { + DW_AT attr = (DW_AT) abbv->nf[nf_i].at_name; + DW_FORM form = (DW_FORM)abbv->nf[nf_i].at_form; + const name_form *nf = &abbv->nf[nf_i]; + nf_i++; + if (attr == 0 && form == 0) break; + get_Form_contents( &cts, cc, c_die, False/*td3*/, nf ); + if (attr == DW_AT_sibling && cts.szB > 0) { + parser->sibling = cts.u.val; + } + if (attr == DW_AT_artificial && cts.u.val == 1) { + sub.isArtificial = True; + } + if ((attr == DW_AT_specification + || attr == DW_AT_abstract_origin) + && cts.szB > 0 && cts.u.val > 0) { + name_or_spec = True; + cdie = cook_die_using_form(cc, (UWord)cts.u.val, form); + sub.ref.subprog = cdie; + sub.isSubprogRef = True; + } + if (attr == DW_AT_name && cts.szB < 0) { + HChar *fnname; + name_or_spec = True; + fnname = ML_(cur_read_strdup)( cts.u.cur, + ".1" ); + fn = ML_(addStr)(cc->di, fnname, -1); + ML_(dinfo_free) (fnname); + sub.ref.fn = fn; + sub.isSubprogRef = False; + } + } + if (name_or_spec) + ML_(addSubprogram) (cc->di, &sub); + else { + /* Only warn once per debug file. */ + static HChar *last_dbgname; + HChar *dbgname = cc->di->fsm.dbgname + ? cc->di->fsm.dbgname : cc->di->fsm.filename; + if (last_dbgname != dbgname) { + if (VG_(clo_verbosity) >= 1) + VG_(message)(Vg_DebugMsg, "Warning: DW_TAG_subprogram with" + " no DW_AT_name and no DW_AT_specification or" + " DW_AT_abstract_origin in %s\n", dbgname); + last_dbgname = dbgname; + } + } + } + // Only recursively parse the (possible) children for the DIE which - // might maybe contain a DW_TAG_inlined_subroutine: + // might maybe contain a DW_TAG_inlined_subroutine or DW_TAG_subprogram. + // subprograms can also appear without addresses. Bool ret = (unit_has_addrs - || dtag == DW_TAG_lexical_block || dtag == DW_TAG_subprogram - || dtag == DW_TAG_inlined_subroutine || dtag == DW_TAG_namespace); + || dtag == DW_TAG_compile_unit + || dtag == DW_TAG_partial_unit + || dtag == DW_TAG_lexical_block + || dtag == DW_TAG_subprogram + || dtag == DW_TAG_inlined_subroutine + || dtag == DW_TAG_namespace + || dtag == DW_TAG_enumeration_type + || dtag == DW_TAG_class_type + || dtag == DW_TAG_structure_type + || dtag == DW_TAG_union_type + || dtag == DW_TAG_module + || dtag == DW_TAG_with_stmt + || dtag == DW_TAG_catch_block + || dtag == DW_TAG_try_block + || dtag == DW_TAG_entry_point); return ret; bad_DIE: @@ -5609,8 +5539,10 @@ void new_dwarf3_reader_wrk ( } /* Perform three DIE-reading passes. The first pass reads DIEs from - alternate .debug_info (if any), the second pass reads DIEs from - .debug_info, and the third pass reads DIEs from .debug_types. + .debug_info, the second pass reads DIEs from .debug_types (if any), + and the third pass reads DIEs from the alternate .debug_info (if any). + This is in the order that cook_die numbers the DIEs, so the inlined + parser can add subprograms in order. Moving the body of this loop into a separate function would require a large number of arguments to be passed in, so it is kept inline instead. */ @@ -5618,23 +5550,6 @@ void new_dwarf3_reader_wrk ( ULong section_size; if (pass == 0) { - if (!ML_(sli_is_valid)(escn_debug_info_alt)) - continue; - /* Now loop over the Compilation Units listed in the alternate - .debug_info section (see D3SPEC sec 7.5) paras 1 and 2. - Each compilation unit contains a Compilation Unit Header - followed by precisely one DW_TAG_compile_unit or - DW_TAG_partial_unit DIE. */ - init_Cursor( &info, escn_debug_info_alt, 0, barf, - "Overrun whilst reading alternate .debug_info section" ); - section_size = escn_debug_info_alt.szB; - - /* Keep track of the last line table we have seen, - it might turn up again. */ - reset_fndn_ix_table(&fndn_ix_Table, &debug_line_offset, (ULong) -1); - - TRACE_D3("\n------ Parsing alternate .debug_info section ------\n"); - } else if (pass == 1) { /* Now loop over the Compilation Units listed in the .debug_info section (see D3SPEC sec 7.5) paras 1 and 2. Each compilation unit contains a Compilation Unit Header followed by precisely @@ -5648,7 +5563,7 @@ void new_dwarf3_reader_wrk ( reset_fndn_ix_table(&fndn_ix_Table, &debug_line_offset, (ULong) -1); TRACE_D3("\n------ Parsing .debug_info section ------\n"); - } else { + } else if (pass == 1) { if (!ML_(sli_is_valid)(escn_debug_types)) continue; if (!VG_(clo_read_var_info)) @@ -5662,6 +5577,23 @@ void new_dwarf3_reader_wrk ( reset_fndn_ix_table(&fndn_ix_Table, &debug_line_offset, (ULong) -1); TRACE_D3("\n------ Parsing .debug_types section ------\n"); + } else { + if (!ML_(sli_is_valid)(escn_debug_info_alt)) + continue; + /* Now loop over the Compilation Units listed in the alternate + .debug_info section (see D3SPEC sec 7.5) paras 1 and 2. + Each compilation unit contains a Compilation Unit Header + followed by precisely one DW_TAG_compile_unit or + DW_TAG_partial_unit DIE. */ + init_Cursor( &info, escn_debug_info_alt, 0, barf, + "Overrun whilst reading alternate .debug_info section" ); + section_size = escn_debug_info_alt.szB; + + /* Keep track of the last line table we have seen, + it might turn up again. */ + reset_fndn_ix_table(&fndn_ix_Table, &debug_line_offset, (ULong) -1); + + TRACE_D3("\n------ Parsing alternate .debug_info section ------\n"); } abbv_state last_abbv; @@ -5713,22 +5645,22 @@ void new_dwarf3_reader_wrk ( TRACE_D3("\n"); TRACE_D3(" Compilation Unit @ offset 0x%llx:\n", cu_start_offset); /* parse_CU_header initialises the CU's hashtable of abbvs ht_abbvs */ - if (pass == 0) { + if (pass == 2) { parse_CU_Header( &cc, td3, &info, escn_debug_abbv_alt, last_abbv, False, True ); } else { parse_CU_Header( &cc, td3, &info, escn_debug_abbv, - last_abbv, pass == 2, False ); + last_abbv, pass == 1, False ); } - cc.escn_debug_str = pass == 0 ? escn_debug_str_alt + cc.escn_debug_str = pass == 2 ? escn_debug_str_alt : escn_debug_str; cc.escn_debug_ranges = escn_debug_ranges; cc.escn_debug_rnglists = escn_debug_rnglists; cc.escn_debug_loclists = escn_debug_loclists; cc.escn_debug_loc = escn_debug_loc; - cc.escn_debug_line = pass == 0 ? escn_debug_line_alt + cc.escn_debug_line = pass == 2 ? escn_debug_line_alt : escn_debug_line; - cc.escn_debug_info = pass == 0 ? escn_debug_info_alt + cc.escn_debug_info = pass == 2 ? escn_debug_info_alt : escn_debug_info; cc.escn_debug_types = escn_debug_types; cc.escn_debug_info_alt = escn_debug_info_alt; @@ -6161,6 +6093,99 @@ void new_dwarf3_reader_wrk ( } } +static Word search_one_subtab ( DebugInfo* di, UWord index ) +{ + Word mid, + lo = 0, + hi = di->subtab_used-1; + UWord mid_index; + while (True) { + /* current unsearched space is from lo to hi, inclusive. */ + if (lo > hi) return -1; /* not found */ + mid = (lo + hi) / 2; + mid_index = di->subtab[mid].index; + + if (mid_index > index) { hi = mid-1; continue; } + if (mid_index < index) { lo = mid+1; continue; } + vg_assert(index == mid_index); + return mid; + } +} + +/* Report an issue only once, we cannot really give too good an error + message since we don't know the exact DIE that was broken. + So only report once per DebugInfo file. */ +static void report_resolve_subprogram_issue (DebugInfo *di, const HChar *msg) +{ + static HChar *last_dbgname; + HChar *dbgname = di->fsm.dbgname ? di->fsm.dbgname : di->fsm.filename; + if (last_dbgname != dbgname) { + if (VG_(clo_verbosity) >= 1) + VG_(message)(Vg_DebugMsg, "Warning: %s in %s\n", msg, dbgname); + last_dbgname = dbgname; + } +} + +static void resolve_subprograms ( DebugInfo* di ) +{ + for (UWord i = 0; i < di->inltab_used; i++) { + Word s = di->inltab[i].inlined.subprog; + if (s == 0) { + report_resolve_subprogram_issue + (di, "zero subprog, missing DW_AT_abstract_origin in" + " DW_TAG_inlined_subroutine"); + di->inltab[i].inlined.fn = ML_(addStr)(di, "UnknownInlinedFun", -1); + continue; + } + s = search_one_subtab (di, di->inltab[i].inlined.subprog); + if (s == -1) { + report_resolve_subprogram_issue + (di, "subprog not found, DW_TAG_inlined_subroutine points to" + " unknown DW_TAG_subprogram"); + di->inltab[i].inlined.fn = ML_(addStr)(di, "UnknownInlinedFun", -1); + continue; + } + /* We allow two indirections, subprograms with abstract origins. */ + if (di->subtab[s].isSubprogRef) { + s = search_one_subtab (di, di->subtab[s].ref.subprog); + if (s == -1) { + report_resolve_subprogram_issue + (di, "subprog ref not found, DW_TAG_subprogram has an" + " unknown DW_AT_abstract_origin or DW_AT_specification"); + di->inltab[i].inlined.fn = ML_(addStr)(di, + "UnknownInlinedFun", -1); + continue; + } + } + if (di->subtab[s].isSubprogRef) { + s = search_one_subtab (di, di->subtab[s].ref.subprog); + if (s == -1) { + report_resolve_subprogram_issue + (di, "subprog ref to ref not found, DW_TAG_subprogram has an" + " unknown DW_AT_abstract_origin or DW_AT_specification"); + di->inltab[i].inlined.fn = ML_(addStr)(di, + "UnknownInlinedFun", -1); + continue; + } + } + if (di->subtab[s].isSubprogRef) + { + report_resolve_subprogram_issue + (di, "too many subprog indirections for DW_TAG_subprogram" + " with DW_AT_abstract_origin or DW_AT_specification refs"); + di->inltab[i].inlined.fn = ML_(addStr)(di, + "UnknownInlinedFun", -1); + continue; + } + di->inltab[i].inlined.fn = di->subtab[s].ref.fn; + } + + /* We don't need the SubPrograms anymore. */ + ML_(dinfo_free)(di->subtab); + di->subtab = NULL; + di->subtab_used = 0; + di->subtab_size = 0; +} /*------------------------------------------------------------*/ /*--- ---*/ @@ -6232,6 +6257,10 @@ ML_(new_dwarf3_reader) ( d3rd_jmpbuf_valid = False; d3rd_jmpbuf_reason = NULL; + + /* Always call this even after .debug_info reading failed, to make sure + any known inlined subroutine names are resolved and memory freed. */ + resolve_subprograms (di); } diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c index 12ad68130..22fed6d4f 100644 --- a/coregrind/m_debuginfo/storage.c +++ b/coregrind/m_debuginfo/storage.c @@ -11,6 +11,8 @@ Copyright (C) 2000-2017 Julian Seward jseward@acm.org + Copyright (C) 2025 Mark J. Wielaard + mark@klomp.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -697,7 +699,7 @@ static void shrinkInlTab ( struct _DebugInfo* di ) /* Top-level place to call to add a addr-to-inlined fn info. */ void ML_(addInlInfo) ( struct _DebugInfo* di, Addr addr_lo, Addr addr_hi, - const HChar* inlinedfn, + UWord subprog, UInt fndn_ix, Int lineno, UShort level) { @@ -705,9 +707,9 @@ void ML_(addInlInfo) ( struct _DebugInfo* di, # define SHOWLINEINFO \ VG_(message) (Vg_DebugMsg, \ - "addInlInfo: fn %s inlined as addr_lo %#lx,addr_hi %#lx," \ + "addInlInfo: fn %lx inlined as addr_lo %#lx,addr_hi %#lx," \ "caller fndn_ix %u %s:%d\n", \ - inlinedfn, addr_lo, addr_hi, fndn_ix, \ + subprog, addr_lo, addr_hi, fndn_ix, \ ML_(fndn_ix2filename) (di, fndn_ix), lineno) /* Similar paranoia as in ML_(addLineInfo). Unclear if needed. */ @@ -737,7 +739,7 @@ void ML_(addInlInfo) ( struct _DebugInfo* di, // code resulting from inlining of inlinedfn: inl.addr_lo = addr_lo; inl.addr_hi = addr_hi; - inl.inlinedfn = inlinedfn; + inl.inlined.subprog = subprog; // caller: inl.fndn_ix = fndn_ix; inl.lineno = lineno; @@ -749,6 +751,29 @@ void ML_(addInlInfo) ( struct _DebugInfo* di, # undef SHOWLINEINFO } +void ML_(addSubprogram) ( struct _DebugInfo* di, DiSubprogram* sub ) +{ + UInt new_sz, i; + DiSubprogram* new_tab; + + if (di->subtab_used == di->subtab_size) { + new_sz = 2 * di->subtab_size; + if (new_sz == 0) new_sz = 2560; + new_tab = ML_(dinfo_zalloc)( "di.storage.addSubprogram.1", + new_sz * sizeof(DiSubprogram) ); + if (di->subtab != NULL) { + for (i = 0; i < di->subtab_used; i++) + new_tab[i] = di->subtab[i]; + ML_(dinfo_free)(di->subtab); + } + di->subtab = new_tab; + di->subtab_size = new_sz; + } + + di->subtab[di->subtab_used] = *sub; + di->subtab_used++; +} + DiCfSI_m* ML_(get_cfsi_m) (const DebugInfo* di, UInt pos) { UInt cfsi_m_ix; From 4b8dcbb14601cf2bad02e370be825dcb7169bc16 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 20 Jun 2025 20:28:22 +0000 Subject: [PATCH 065/412] Constant folding tweaks. Add constant folding for Iop_8Sto64, Iop_32HIto16, Iop_Or1 and various integer comparison operators. New functions mkFalse and mkTrue. --- VEX/priv/ir_opt.c | 68 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 656537865..6b75119ab 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1262,7 +1262,6 @@ static Bool notBool ( Bool b ) static IRExpr* mkZeroOfPrimopResultType ( IROp op ) { switch (op) { - case Iop_CmpNE32: return IRExpr_Const(IRConst_U1(toBool(0))); case Iop_Xor8: return IRExpr_Const(IRConst_U8(0)); case Iop_Xor16: return IRExpr_Const(IRConst_U16(0)); case Iop_Sub32: @@ -1278,14 +1277,23 @@ static IRExpr* mkZeroOfPrimopResultType ( IROp op ) } } +/* Make a Boolean False value */ +static inline IRExpr* mkFalse(void) +{ + return IRExpr_Const(IRConst_U1(toBool(0))); +} + +/* Make a Boolean True value */ +static inline IRExpr* mkTrue(void) +{ + return IRExpr_Const(IRConst_U1(toBool(1))); +} + /* Make a value containing all 1-bits, which has the same type as the result of the given primop. */ static IRExpr* mkOnesOfPrimopResultType ( IROp op ) { switch (op) { - case Iop_CmpEQ32: - case Iop_CmpEQ64: - return IRExpr_Const(IRConst_U1(toBool(1))); case Iop_Or8: return IRExpr_Const(IRConst_U8(0xFF)); case Iop_Or16: @@ -1440,6 +1448,13 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) e2 = IRExpr_Const(IRConst_U32(u32)); break; } + case Iop_8Sto64: { + ULong u64 = e->Iex.Unop.arg->Iex.Const.con->Ico.U8; + u64 <<= 56; + u64 = (Long)u64 >> 56; /* signed shift */ + e2 = IRExpr_Const(IRConst_U64(u64)); + break; + } case Iop_16Sto32: { UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U16; u32 <<= 16; @@ -1474,6 +1489,12 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) e2 = IRExpr_Const(IRConst_U32( 0xFFFF & e->Iex.Unop.arg->Iex.Const.con->Ico.U16)); break; + case Iop_32HIto16: { + UInt w32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32; + w32 >>= 16; + e2 = IRExpr_Const(IRConst_U16(toUShort(w32))); + break; + } case Iop_32to16: e2 = IRExpr_Const(IRConst_U16(toUShort( 0xFFFF & e->Iex.Unop.arg->Iex.Const.con->Ico.U32))); @@ -1779,6 +1800,11 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) switch (e->Iex.Binop.op) { /* -- Or -- */ + case Iop_Or1: + e2 = IRExpr_Const(IRConst_U1(toBool( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U1 + | e->Iex.Binop.arg2->Iex.Const.con->Ico.U1)))); + break; case Iop_Or8: e2 = IRExpr_Const(IRConst_U8(toUChar( (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8 @@ -2432,14 +2458,31 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } break; + case Iop_ExpCmpNE8: + case Iop_ExpCmpNE16: + case Iop_ExpCmpNE32: + case Iop_ExpCmpNE64: + case Iop_CmpLT32S: + case Iop_CmpLT64S: + case Iop_CmpLE32S: + case Iop_CmpLE64S: + case Iop_CmpLT32U: + case Iop_CmpLT64U: + case Iop_CmpLE32U: + case Iop_CmpLE64U: + case Iop_CmpNE8: + case Iop_CmpNE16: case Iop_CmpNE32: - /* CmpNE32(t,t) ==> 0, for some IRTemp t */ + case Iop_CmpNE64: + /* Integer comparisons for some kind of inequality yield + 'False' when both operands are identical. */ if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) { - e2 = mkZeroOfPrimopResultType(e->Iex.Binop.op); + e2 = mkFalse(); break; } /* CmpNE32(1Uto32(b), 0) ==> b */ - if (isZeroU32(e->Iex.Binop.arg2)) { + if (e->Iex.Binop.op == Iop_CmpNE32 && + isZeroU32(e->Iex.Binop.arg2)) { IRExpr* a1 = chase(env, e->Iex.Binop.arg1); if (a1 && a1->tag == Iex_Unop && a1->Iex.Unop.op == Iop_1Uto32) { @@ -2449,10 +2492,17 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } break; - // in total 32 bits + case Iop_CmpEQ8: + case Iop_CmpEQ16: case Iop_CmpEQ32: - // in total 64 bits case Iop_CmpEQ64: + /* CmpEQ8/16/32/64(t,t) ==> 1, for some IRTemp t */ + if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) { + e2 = mkTrue(); + } + break; + + // in total 64 bits case Iop_CmpEQ8x8: case Iop_CmpEQ16x4: case Iop_CmpEQ32x2: From 3bae961d3fc5c506bbf2e1210ec2fb366eb46f30 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sat, 21 Jun 2025 14:11:47 +0000 Subject: [PATCH 066/412] libvex_ir.h: Fix comment for Iop_DivModU128to64 This IROp uses an I128 dividend and produces an I128 result. Cf. function typeOfPrimop and IR generation for amd64 and s390. --- VEX/pub/libvex_ir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h index 80ef8f27a..803a1317e 100644 --- a/VEX/pub/libvex_ir.h +++ b/VEX/pub/libvex_ir.h @@ -521,7 +521,7 @@ typedef // of which lo half is div and hi half is mod Iop_DivModS64to32, // ditto, signed - Iop_DivModU128to64, // :: V128,I64 -> V128 + Iop_DivModU128to64, // :: I128,I64 -> I128 // of which lo half is div and hi half is mod Iop_DivModS128to64, // ditto, signed From c38e9220c3efb2b11c94e744fe679851a4c63957 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sat, 21 Jun 2025 19:49:02 +0000 Subject: [PATCH 067/412] ir_opt.c bug fix: folloup to 4b8dcbb146 x <= x is True, you silly. --- VEX/priv/ir_opt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 6b75119ab..ee2c5a4a7 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2464,12 +2464,8 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) case Iop_ExpCmpNE64: case Iop_CmpLT32S: case Iop_CmpLT64S: - case Iop_CmpLE32S: - case Iop_CmpLE64S: case Iop_CmpLT32U: case Iop_CmpLT64U: - case Iop_CmpLE32U: - case Iop_CmpLE64U: case Iop_CmpNE8: case Iop_CmpNE16: case Iop_CmpNE32: @@ -2492,11 +2488,16 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } break; + case Iop_CmpLE32U: + case Iop_CmpLE64U: + case Iop_CmpLE32S: + case Iop_CmpLE64S: case Iop_CmpEQ8: case Iop_CmpEQ16: case Iop_CmpEQ32: case Iop_CmpEQ64: /* CmpEQ8/16/32/64(t,t) ==> 1, for some IRTemp t */ + /* CmpLE32U/64U/32S/64S(t,t) ==> 1, for some IRTemp t */ if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) { e2 = mkTrue(); } From 116a1c8242891b5ddcd1ce9704b0ab90143cc968 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 21 Jun 2025 23:04:04 +0200 Subject: [PATCH 068/412] Update DW_TAG_subprogram parsing for clang Clang doesn't give a name for some artificial subprograms. In that case just use "" as the name of the DW_TAG_subprogram. Clang also sometimes generates a DW_TAG_subprogram without any attributes. These aren't really useful for us. So just silently skip them. If we warn about subprograms without a name, specification or abstract origin, also emit the index in the .debug_info section to make it easier to look them up. --- coregrind/m_debuginfo/readdwarf3.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c index 745f2c43a..49c5abb68 100644 --- a/coregrind/m_debuginfo/readdwarf3.c +++ b/coregrind/m_debuginfo/readdwarf3.c @@ -3617,18 +3617,27 @@ static Bool parse_inl_DIE ( sub.isSubprogRef = False; } } + /* Clang doesn't give a name for some artificial subprograms. + Just use "" as the name. */ + if (!name_or_spec && sub.isArtificial) { + name_or_spec = True; + fn = ML_(addStr)(cc->di, "", -1); + sub.ref.fn = fn; + sub.isSubprogRef = False; + } if (name_or_spec) ML_(addSubprogram) (cc->di, &sub); - else { + else if (nf_i > 1 /* Clang produces empty subprograms, no attrs. */ + && VG_(clo_verbosity) >= 1) { /* Only warn once per debug file. */ static HChar *last_dbgname; HChar *dbgname = cc->di->fsm.dbgname ? cc->di->fsm.dbgname : cc->di->fsm.filename; if (last_dbgname != dbgname) { - if (VG_(clo_verbosity) >= 1) - VG_(message)(Vg_DebugMsg, "Warning: DW_TAG_subprogram with" - " no DW_AT_name and no DW_AT_specification or" - " DW_AT_abstract_origin in %s\n", dbgname); + VG_(message)(Vg_DebugMsg, + "Warning: <%lx> DW_TAG_subprogram with no" + " DW_AT_name and no DW_AT_specification or" + " DW_AT_abstract_origin in %s\n", posn, dbgname); last_dbgname = dbgname; } } From 24b634e8ce04de70d4aa6c61a12149df223f9c68 Mon Sep 17 00:00:00 2001 From: Andreas Arnez Date: Wed, 25 Jun 2025 16:35:04 +0200 Subject: [PATCH 069/412] Bug 503241 - s390x: Support z17 changes to the NNPA instruction This adds support for the NNPA enhancements that are implemented with z17. --- coregrind/m_extension/extension-s390x.c | 346 ++++++++++++++---------- 1 file changed, 207 insertions(+), 139 deletions(-) diff --git a/coregrind/m_extension/extension-s390x.c b/coregrind/m_extension/extension-s390x.c index 85b99ad08..98b825d9b 100644 --- a/coregrind/m_extension/extension-s390x.c +++ b/coregrind/m_extension/extension-s390x.c @@ -301,11 +301,17 @@ typedef enum { S390_NNPA_MAX = 0x15, S390_NNPA_LOG = 0x20, S390_NNPA_EXP = 0x21, + S390_NNPA_SQRT = 0x22, + S390_NNPA_INVSQRT = 0x23, S390_NNPA_RELU = 0x31, S390_NNPA_TANH = 0x32, S390_NNPA_SIGMOID = 0x33, S390_NNPA_SOFTMAX = 0x34, + S390_NNPA_GELU = 0x35, S390_NNPA_BATCHNORM = 0x40, + S390_NNPA_MOMENTS = 0x41, + S390_NNPA_LAYERNORM = 0x42, + S390_NNPA_NORM = 0x43, S390_NNPA_MAXPOOL2D = 0x50, S390_NNPA_AVGPOOL2D = 0x51, S390_NNPA_LSTMACT = 0x60, @@ -313,6 +319,9 @@ typedef enum { S390_NNPA_CONVOLUTION = 0x70, S390_NNPA_MATMUL_OP = 0x71, S390_NNPA_MATMUL_OP_BCAST23 = 0x72, + S390_NNPA_MATMUL_OP_BCAST1 = 0x73, + S390_NNPA_TRANSFORM = 0xf0, + S390_NNPA_REDUCE = 0xf1, } s390_nnpa_function_t; /* Suported NNPA functions */ @@ -321,30 +330,51 @@ static const ULong NNPA_functions[] = { S390_SETBIT(S390_NNPA_SUB) | S390_SETBIT(S390_NNPA_MUL) | S390_SETBIT(S390_NNPA_DIV) | S390_SETBIT(S390_NNPA_MIN) | S390_SETBIT(S390_NNPA_MAX) | S390_SETBIT(S390_NNPA_LOG) | - S390_SETBIT(S390_NNPA_EXP) | S390_SETBIT(S390_NNPA_RELU) | + S390_SETBIT(S390_NNPA_EXP) | S390_SETBIT(S390_NNPA_SQRT) | + S390_SETBIT(S390_NNPA_INVSQRT) | S390_SETBIT(S390_NNPA_RELU) | S390_SETBIT(S390_NNPA_TANH) | S390_SETBIT(S390_NNPA_SIGMOID) | - S390_SETBIT(S390_NNPA_SOFTMAX)), - (S390_SETBIT(S390_NNPA_BATCHNORM) | S390_SETBIT(S390_NNPA_MAXPOOL2D) | - S390_SETBIT(S390_NNPA_AVGPOOL2D) | S390_SETBIT(S390_NNPA_LSTMACT) | - S390_SETBIT(S390_NNPA_GRUACT) | S390_SETBIT(S390_NNPA_CONVOLUTION) | - S390_SETBIT(S390_NNPA_MATMUL_OP) | - S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST23)), + S390_SETBIT(S390_NNPA_SOFTMAX) | S390_SETBIT(S390_NNPA_GELU)), + (S390_SETBIT(S390_NNPA_BATCHNORM) | S390_SETBIT(S390_NNPA_MOMENTS) | + S390_SETBIT(S390_NNPA_LAYERNORM) | S390_SETBIT(S390_NNPA_NORM) | + S390_SETBIT(S390_NNPA_MAXPOOL2D) | S390_SETBIT(S390_NNPA_AVGPOOL2D) | + S390_SETBIT(S390_NNPA_LSTMACT) | S390_SETBIT(S390_NNPA_GRUACT) | + S390_SETBIT(S390_NNPA_CONVOLUTION) | S390_SETBIT(S390_NNPA_MATMUL_OP) | + S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST23) | + S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST1)), + 0, + (S390_SETBIT(S390_NNPA_TRANSFORM) | S390_SETBIT(S390_NNPA_REDUCE)), }; /* Supported parameter block formats */ static const ULong NNPA_ipbf[] = { - (S390_SETBIT(0)), + (S390_SETBIT(0) | S390_SETBIT(1)), }; /* Supported data types and data layout formats */ +enum { + S390_NNPA_TYPE_1 = 0, // data type 1 (16 bit) + S390_NNPA_TYPE_BFP32 = 6, + S390_NNPA_TYPE_INT8 = 8, + S390_NNPA_TYPE_INT32 = 10, +}; + +enum { + S390_NNPA_4D_FEATURE_TENSOR = 0, + S390_NNPA_4D_KERNEL_TENSOR = 1, + S390_NNPA_4D_WEIGHTS_TENSOR = 2, + S390_NNPA_4D_GENERIC_TENSOR = 31, +}; + static const ULong NNPA_dtypes_layouts[] = { /* Data types */ - (S390_SETBIT(0) | // data type 1 (16 bit) + (S390_SETBIT(S390_NNPA_TYPE_1) | S390_SETBIT(S390_NNPA_TYPE_BFP32) | + S390_SETBIT(S390_NNPA_TYPE_INT8) | S390_SETBIT(S390_NNPA_TYPE_INT32) | /* Data layout formats */ - S390_SETBIT(32 + 0) | // 4D-feature tensor - S390_SETBIT(32 + 1) // 4D-kernel tensor - ), + S390_SETBIT(32 + S390_NNPA_4D_FEATURE_TENSOR) | + S390_SETBIT(32 + S390_NNPA_4D_KERNEL_TENSOR) | + S390_SETBIT(32 + S390_NNPA_4D_WEIGHTS_TENSOR) | + S390_SETBIT(32 + S390_NNPA_4D_GENERIC_TENSOR)), }; static const ULong NNPA_conversions[] = { @@ -360,10 +390,15 @@ struct s390_NNPA_parms_qaf { UInt mdis; ULong mts; ULong conversions; - ULong reserved2[22]; + ULong reserved2; + UInt mdnis[4]; + struct { + ULong reserved[19]; + } reserved3; }; -struct s390_NNPA_tensor0 { +/* Tensor descriptor, common for all data-layout formats */ +struct s390_NNPA_tensor { UChar layout; UChar dtype; UShort reserved1; @@ -372,21 +407,21 @@ struct s390_NNPA_tensor0 { ULong address; }; -struct s390_NNPA_parms0 { - ULong pbvn : 16; - ULong mvn : 8; - ULong ribm : 24; - ULong reserved0 : 15; - ULong cf : 1; - ULong reserved1[6]; - ULong save_area_address; - struct s390_NNPA_tensor0 out[2]; - struct s390_NNPA_tensor0 reserved2[2]; - struct s390_NNPA_tensor0 in[3]; - ULong reserved3[12]; - UInt param[5]; - UInt reserved4; - ULong reserved5[13]; +/* Parameter block format 0 or 1 */ +struct s390_NNPA_parms { + ULong pbvn : 16; + ULong mvn : 8; + ULong ribm : 24; + ULong reserved0 : 15; + ULong cf : 1; + ULong reserved1[6]; + ULong save_area_address; + struct s390_NNPA_tensor out[2]; + struct s390_NNPA_tensor reserved2[2]; + struct s390_NNPA_tensor in[3]; + ULong reserved3[12]; + UInt param[16]; + ULong reserved4[8]; }; enum { @@ -418,135 +453,145 @@ static const char* const s390_NNPA_errmsg_access[s390_NNPA_message_n] = { struct s390_NNPA_mem_dimensions { UChar layout; - ULong dim[5]; // total dimensions - ULong used[4]; // used dimensions, without padding - ULong step[5]; - ULong last_dim4_size; + ULong dim[4]; + ULong total_size; + ULong used_sticks; // occupied sticks per next-higher dimension + ULong stick_fill; + ULong last_stick_fill; }; -/* Determine the 5 dimensions used to represent the tensor data in memory */ +/* Determine the dimensions used to represent the tensor data in memory */ static enum ExtensionError -NNPA_tensor0_size(const struct s390_NNPA_tensor0* t, - UInt msg_idx, - struct s390_NNPA_mem_dimensions* out_md) +NNPA_tensor_size(const struct s390_NNPA_tensor* t, + UInt msg_idx, + struct s390_NNPA_mem_dimensions* out_md) { struct s390_NNPA_mem_dimensions md; ULong elem_size; + ULong eps; - md.layout = t->layout; - if (t->dtype == 0) + switch (t->dtype) { + case S390_NNPA_TYPE_INT8: + elem_size = 1; + break; + case S390_NNPA_TYPE_1: elem_size = 2; - else + break; + case S390_NNPA_TYPE_BFP32: + case S390_NNPA_TYPE_INT32: + elem_size = 4; + break; + default: return INSN_ERR(s390_NNPA_errmsg_dtype[msg_idx]); + } + eps = 128 / elem_size; + md.layout = t->layout; switch (t->layout) { - case 0: // 4D-feature tensor - md.dim[0] = md.used[0] = t->dim4; - md.dim[1] = md.used[1] = (t->dim1 + 63) / 64; - md.dim[2] = md.used[2] = t->dim3; - md.dim[3] = (t->dim2 + 31) / 32 * 32; - md.used[3] = t->dim2; - md.dim[4] = 64; - md.last_dim4_size = elem_size * (t->dim1 % 64); + case S390_NNPA_4D_FEATURE_TENSOR: + md.dim[0] = t->dim4; + md.dim[1] = (t->dim1 + eps - 1) / eps; + md.used_sticks = t->dim2; + goto common_tensor_dimensions; + case S390_NNPA_4D_KERNEL_TENSOR: + md.dim[0] = (t->dim1 + eps - 1) / eps; + md.dim[1] = t->dim4; + md.used_sticks = t->dim2; + goto common_tensor_dimensions; + case S390_NNPA_4D_WEIGHTS_TENSOR: + elem_size *= 2; + eps /= 2; + md.dim[0] = t->dim4; + md.dim[1] = (t->dim1 + eps - 1) / eps; + md.used_sticks = (t->dim2 + 1) / 2; + common_tensor_dimensions: + md.dim[2] = t->dim3; + md.dim[3] = (md.used_sticks + 31) / 32 * 32; + md.stick_fill = elem_size * (t->dim1 >= eps ? eps : t->dim1); + md.last_stick_fill = elem_size * ((t->dim1 - 1) % eps + 1); break; - case 1: // 4D-kernel tensor - md.dim[0] = md.used[0] = (t->dim1 + 63) / 64; - md.dim[1] = md.used[1] = t->dim4; - md.dim[2] = md.used[2] = t->dim3; - md.dim[3] = (t->dim2 + 31) / 32 * 32; - md.used[3] = t->dim2; - md.dim[4] = 64; - md.last_dim4_size = elem_size * (t->dim1 % 64); + case S390_NNPA_4D_GENERIC_TENSOR: + md.dim[0] = t->dim4; + md.dim[1] = t->dim3; + md.dim[2] = t->dim2; + md.dim[3] = t->dim1; + eps = 1; break; default: return INSN_ERR(s390_NNPA_errmsg_layout[msg_idx]); } - md.step[4] = elem_size * md.dim[4]; - md.step[3] = md.step[4] * md.dim[3]; - md.step[2] = md.step[3] * md.dim[2]; - md.step[1] = md.step[2] * md.dim[1]; - md.step[0] = md.step[1] * md.dim[0]; // total size - *out_md = md; + md.total_size = + elem_size * eps * md.dim[3] * md.dim[2] * md.dim[1] * md.dim[0]; + *out_md = md; return ExtErr_OK; } -/* Determine the size of the non-pad elements in the last dimension */ -static ULong NNPA_mem_dim4_size(const struct s390_NNPA_mem_dimensions* md, - ULong d0, - ULong d1) -{ - switch (md->layout) { - case 0: // 4D-feature tensor - return d1 + 1 == md->dim[1] ? md->last_dim4_size : md->step[4]; - case 1: // 4D-kernel tensor - return d0 + 1 == md->dim[0] ? md->last_dim4_size : md->step[4]; - } - return 0; -} - -static enum ExtensionError NNPA_pre_read_tensor0( - ThreadState* tst, UInt msg_idx, const struct s390_NNPA_tensor0* t) +/* Track a tensor's memory regions with PRE_MEM_READ or POST_MEM_WRITE */ +static enum ExtensionError NNPA_track_tensor(ThreadState* tst, + UInt msg_idx, + const struct s390_NNPA_tensor* t, + Bool do_write) { struct s390_NNPA_mem_dimensions md; enum ExtensionError ret; + ULong addr = t->address; - ret = NNPA_tensor0_size(t, msg_idx, &md); + ret = NNPA_tensor_size(t, msg_idx, &md); if (ret != ExtErr_OK) return ret; - for (ULong d0 = 0; d0 < md.used[0]; d0++) { - for (ULong d1 = 0; d1 < md.used[1]; d1++) { - for (ULong d2 = 0; d2 < md.used[2]; d2++) { - for (ULong d3 = 0; d3 < md.used[3]; d3++) { - ULong addr = t->address + d0 * md.step[1] + d1 * md.step[2] + - d2 * md.step[3] + d3 * md.step[4]; - ULong len = NNPA_mem_dim4_size(&md, d0, d1); - PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], addr, len); + switch (md.layout) { + case S390_NNPA_4D_FEATURE_TENSOR: + case S390_NNPA_4D_KERNEL_TENSOR: + case S390_NNPA_4D_WEIGHTS_TENSOR: + for (ULong d0 = 0; d0 < md.dim[0]; d0++) { + for (ULong d1 = 0; d1 < md.dim[1]; d1++) { + ULong len; + switch (md.layout) { + case S390_NNPA_4D_FEATURE_TENSOR: + case S390_NNPA_4D_WEIGHTS_TENSOR: + len = d1 + 1 == md.dim[1] ? md.last_stick_fill : md.stick_fill; + break; + case S390_NNPA_4D_KERNEL_TENSOR: + len = d0 + 1 == md.dim[0] ? md.last_stick_fill : md.stick_fill; + break; } - } - } - } - return ExtErr_OK; -} - -static UWord NNPA_pre_write_tensor0(ThreadState* tst, - UInt msg_idx, - const struct s390_NNPA_tensor0* t) -{ - struct s390_NNPA_mem_dimensions md; - enum ExtensionError ret; - - ret = NNPA_tensor0_size(t, msg_idx, &md); - if (ret != ExtErr_OK) - return ret; - - PRE_MEM_WRITE(tst, "NNPA(out_tensor)", t->address, md.step[0]); - return ExtErr_OK; -} - -static void NNPA_post_write_tensor0(ThreadState* tst, - UInt msg_idx, - const struct s390_NNPA_tensor0* t) -{ - struct s390_NNPA_mem_dimensions md; - enum ExtensionError ret; - - ret = NNPA_tensor0_size(t, msg_idx, &md); - if (ret != ExtErr_OK) - return; - - for (ULong d0 = 0; d0 < md.used[0]; d0++) { - for (ULong d1 = 0; d1 < md.used[1]; d1++) { - for (ULong d2 = 0; d2 < md.used[2]; d2++) { - for (ULong d3 = 0; d3 < md.used[3]; d3++) { - ULong addr = t->address + d0 * md.step[1] + d1 * md.step[2] + - d2 * md.step[3] + d3 * md.step[4]; - ULong len = NNPA_mem_dim4_size(&md, d0, d1); - POST_MEM_WRITE(tst, addr, len); + for (ULong d2 = 0; d2 < md.dim[2]; d2++) { + for (ULong d3 = 0; d3 < md.used_sticks; d3++) { + if (md.layout == S390_NNPA_4D_WEIGHTS_TENSOR && + d3 == md.used_sticks - 1 && t->dim2 % 2 != 0) { + // even elements only + for (ULong i = 0; i < len - 1; i += 2) { + if (do_write) { + POST_MEM_WRITE(tst, addr + i, 1); + } else { + PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], + addr + i, 1); + } + } + } else if (do_write) { + POST_MEM_WRITE(tst, addr, len); + } else { + PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], addr, + len); + } + addr += 128; + } + addr += 128 * (md.dim[3] - md.used_sticks); } } } + break; + case S390_NNPA_4D_GENERIC_TENSOR: + if (do_write) { + POST_MEM_WRITE(tst, t->address, md.total_size); + } else { + PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], t->address, + md.total_size); + } + break; } + return ExtErr_OK; } static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) @@ -571,16 +616,21 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) NNPA_dtypes_layouts, sizeof(NNPA_dtypes_layouts)); s390_filter_functions(&parms->conversions, sizeof(ULong), NNPA_conversions, sizeof(NNPA_conversions)); + // Clear reserved fields + parms->reserved1 = 0; + parms->reserved2 = 0; + parms->reserved3 = (__typeof__(parms->reserved3)){0}; } else { - struct s390_NNPA_parms0* parms = (void*)parms_addr; - const struct s390_NNPA_parms0 orig_parms = *parms; - ULong save_area_size = 0; - UInt in_tensors; - UInt out_tensors; + struct s390_NNPA_parms* parms = (void*)parms_addr; + const struct s390_NNPA_parms orig_parms = *parms; + ULong save_area_size = 0; + UInt in_tensors; + UInt out_tensors; + enum ExtensionError retval; parms_len = 4096; PRE_MEM_READ(tst, "NNPA(parms)", parms_addr, - sizeof(struct s390_NNPA_parms0)); + sizeof(struct s390_NNPA_parms)); if (parms->cf) { PRE_MEM_READ(tst, "NNPA(parms.csb)", parms_addr + 512, parms_len - 512); @@ -594,28 +644,39 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) case S390_NNPA_DIV: case S390_NNPA_MIN: case S390_NNPA_MAX: + case S390_NNPA_NORM: in_tensors = 2; out_tensors = 1; break; case S390_NNPA_LOG: case S390_NNPA_EXP: + case S390_NNPA_SQRT: + case S390_NNPA_INVSQRT: case S390_NNPA_RELU: case S390_NNPA_TANH: case S390_NNPA_SIGMOID: + case S390_NNPA_GELU: in_tensors = 1; out_tensors = 1; break; case S390_NNPA_SOFTMAX: + case S390_NNPA_REDUCE: in_tensors = 1; out_tensors = 1; save_area_size = 8192; break; case S390_NNPA_BATCHNORM: + case S390_NNPA_LAYERNORM: in_tensors = 3; out_tensors = 1; break; + case S390_NNPA_MOMENTS: + in_tensors = 1; + out_tensors = 2; + break; case S390_NNPA_MAXPOOL2D: case S390_NNPA_AVGPOOL2D: + case S390_NNPA_TRANSFORM: in_tensors = 1; out_tensors = 1; break; @@ -627,6 +688,7 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) case S390_NNPA_CONVOLUTION: case S390_NNPA_MATMUL_OP: case S390_NNPA_MATMUL_OP_BCAST23: + case S390_NNPA_MATMUL_OP_BCAST1: in_tensors = 3; out_tensors = 1; break; @@ -635,16 +697,20 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) } for (UInt i = 0; i < in_tensors; i++) { - enum ExtensionError retval = - NNPA_pre_read_tensor0(tst, s390_NNPA_message_in + i, &parms->in[i]); + retval = NNPA_track_tensor(tst, s390_NNPA_message_in + i, + &parms->in[i], False); if (retval != ExtErr_OK) return retval; } for (UInt i = 0; i < out_tensors; i++) { - enum ExtensionError retval = NNPA_pre_write_tensor0( - tst, s390_NNPA_message_out + i, &parms->out[i]); + UInt msg_idx = s390_NNPA_message_out + i; + struct s390_NNPA_mem_dimensions md; + + retval = NNPA_tensor_size(&parms->out[i], msg_idx, &md); if (retval != ExtErr_OK) return retval; + PRE_MEM_WRITE(tst, s390_NNPA_errmsg_access[msg_idx], + parms->out[i].address, md.total_size); } if (save_area_size != 0) { PRE_MEM_WRITE(tst, "NNPA(save_area)", parms->save_area_address, @@ -653,8 +719,10 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) cc = do_NNPA_insn(&gpr0, parms_addr); if (cc == 0) { for (UInt i = 0; i < out_tensors; i++) { - NNPA_post_write_tensor0(tst, s390_NNPA_message_out + i, - &orig_parms.out[i]); + retval = NNPA_track_tensor(tst, s390_NNPA_message_out + i, + &orig_parms.out[i], True); + if (retval != ExtErr_OK) + return retval; } } } From 2942c04c485076d84a2df8ee6bb901bb0f014c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= Date: Fri, 20 Jun 2025 03:21:41 -0400 Subject: [PATCH 070/412] Add "bad" option for --track-fds. When --track-fds=bad is specified, do not warn about leaked file descriptors and only warn about file decriptors which was not opened or already closed. Update the documentation in docs/xml/manual-core.xml. Add none/tests/track_bad test to test the new option. Adjust none/tests/cmdline1 and none/tests/cmdline2 expected outputs. https://bugs.kde.org/show_bug.cgi?id=493434 --- .gitignore | 1 + NEWS | 1 + coregrind/m_main.c | 12 ++++++-- docs/xml/manual-core.xml | 35 ++++++++++++++++-------- none/tests/Makefile.am | 6 ++-- none/tests/cmdline1.stdout.exp | 8 ++++-- none/tests/cmdline1.stdout.exp-non-linux | 8 ++++-- none/tests/cmdline2.stdout.exp | 8 ++++-- none/tests/cmdline2.stdout.exp-non-linux | 2 +- none/tests/track_bad.c | 34 +++++++++++++++++++++++ none/tests/track_bad.stderr.exp | 28 +++++++++++++++++++ none/tests/track_bad.vgtest | 3 ++ 12 files changed, 123 insertions(+), 23 deletions(-) create mode 100644 none/tests/track_bad.c create mode 100644 none/tests/track_bad.stderr.exp create mode 100644 none/tests/track_bad.vgtest diff --git a/.gitignore b/.gitignore index 8cabb96df..32cedb0d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1676,6 +1676,7 @@ /none/tests/track-fds-exec-children /none/tests/track_new /none/tests/track_std +/none/tests/track_bad /none/tests/unit_debuglog /none/tests/use_after_close /none/tests/valgrind_cpp_test diff --git a/NEWS b/NEWS index 0e0118265..0d9cc798e 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,7 @@ than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. 338803 Handling of dwz debug alt files or cross-CU is broken +493434 Add --track-fds=bad mode (no "leak" tracking) 503098 Incorrect NAN-boxing for float registers in RISC-V 503641 close_range syscalls started failing with 3.25.0 503677 duplicated-cond compiler warning in dis_RV64M diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 128e4298c..f7fd20dba 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -113,8 +113,12 @@ 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 abexit valgrindabexit all none\n" -" --track-fds=no|yes|all track open file descriptors? [no]\n" -" all includes reporting inherited file descriptors\n" +" --track-fds=no|yes|all|bad track open file descriptors? [no]\n" +" all also reports on open inherited file\n" +" descriptors at exit (e.g. stdin/out/err)\n" +" bad only reports on file descriptor usage\n" +" errors and doesn't list open file descriptors\n" +" at exit\n" " --modify-fds=no|yes|high modify newly open file descriptors? [no]\n" " --time-stamp=no|yes add timestamps to log messages? [no]\n" " --log-fd= log messages to file descriptor [2=stderr]\n" @@ -643,6 +647,8 @@ static void process_option (Clo_Mode mode, VG_(clo_track_fds) = 2; else if (VG_(strcmp)(tmp_str, "no") == 0) VG_(clo_track_fds) = 0; + else if (VG_(strcmp)(tmp_str, "bad") == 0) + VG_(clo_track_fds) = 3; else VG_(fmsg_bad_option)(arg, "Bad argument, should be 'yes', 'all' or 'no'\n"); @@ -2324,7 +2330,7 @@ void shutdown_actions_NORETURN( ThreadId tid, } /* Print out file descriptor summary and stats. */ - if (VG_(clo_track_fds)) + if (VG_(clo_track_fds) && VG_(clo_track_fds) < 3) VG_(show_open_fds)("at exit"); /* Call the tool's finalisation function. This makes Memcheck's diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml index 7d18d46f3..9ab09b51b 100644 --- a/docs/xml/manual-core.xml +++ b/docs/xml/manual-core.xml @@ -886,18 +886,31 @@ in most cases. We group the available options by rough categories. - - - - When enabled, Valgrind will print out a list of open file - descriptors on exit or on request, via the gdbserver monitor - command v.info open_fds. 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. Use to - include reporting on stdin, + + + + When enabled, Valgrind will track all file descriptor + usage. It will produce errors for bad file descriptor usage like + closing a file descriptor twice, using a file descriptor + (number) that was never created, or passing an already closed + file descriptor to a system call. It will also print out a list + of open file descriptors on exit. Or on request, via the + gdbserver monitor command v.info open_fds. + + When an error is generated, or when listing the still open + file descriptors at exit, a stack backtrace of where the file + was opened is printed. If the file descriptor has already been + closed, it will also include a backtrace of where it was + previously closed. Any error will include details relating to + the file descriptor such as the file name or socket details. + + Use to also include reporting + on stdin, stdout and - stderr. + stderr (or other inherited file + descriptors) at exit. If option is used, + then exclude reporting on leaked file descriptors at exit and + only produce errors about bad file decriptors usage. diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index ca01f9e42..716ce000d 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -275,7 +275,8 @@ EXTRA_DIST = \ track_new.stderr.exp track_new.stdout.exp \ track_new.vgtest track_new.stderr.exp-illumos \ track_yes.vgtest track_high.vgtest \ - track_yes.stderr.exp track_high.stderr.exp + track_yes.stderr.exp track_high.stderr.exp \ + track_bad.vgtest track_bad.stderr.exp check_PROGRAMS = \ args \ @@ -334,7 +335,8 @@ check_PROGRAMS = \ fdbaduse \ use_after_close \ track_new \ - track_std + track_std \ + track_bad if HAVE_STATIC_LIBC if ! VGCONF_OS_IS_LINUX diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp index 06a679a11..5d3ea0569 100644 --- a/none/tests/cmdline1.stdout.exp +++ b/none/tests/cmdline1.stdout.exp @@ -28,8 +28,12 @@ usage: valgrind [options] prog-and-args --vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none] where event is one of: startup exit abexit valgrindabexit all none - --track-fds=no|yes|all track open file descriptors? [no] - all includes reporting inherited file descriptors + --track-fds=no|yes|all|bad track open file descriptors? [no] + all also reports on open inherited file + descriptors at exit (e.g. stdin/out/err) + bad only reports on file descriptor usage + errors and doesn't list open file descriptors + at exit --modify-fds=no|yes|high modify newly open file descriptors? [no] --time-stamp=no|yes add timestamps to log messages? [no] --log-fd= log messages to file descriptor [2=stderr] diff --git a/none/tests/cmdline1.stdout.exp-non-linux b/none/tests/cmdline1.stdout.exp-non-linux index 4049d5ab2..9b044e78a 100644 --- a/none/tests/cmdline1.stdout.exp-non-linux +++ b/none/tests/cmdline1.stdout.exp-non-linux @@ -28,8 +28,12 @@ usage: valgrind [options] prog-and-args --vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none] where event is one of: startup exit abexit valgrindabexit all none - --track-fds=no|yes|all track open file descriptors? [no] - all includes reporting inherited file descriptors + --track-fds=no|yes|all|bad track open file descriptors? [no] + all also reports on open inherited file + descriptors at exit (e.g. stdin/out/err) + bad only reports on file descriptor usage + errors and doesn't list open file descriptors + at exit --modify-fds=no|yes|high modify newly open file descriptors? [no] --time-stamp=no|yes add timestamps to log messages? [no] --log-fd= log messages to file descriptor [2=stderr] diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index d7914ae01..618c43acb 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -28,8 +28,12 @@ usage: valgrind [options] prog-and-args --vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none] where event is one of: startup exit abexit valgrindabexit all none - --track-fds=no|yes|all track open file descriptors? [no] - all includes reporting inherited file descriptors + --track-fds=no|yes|all|bad track open file descriptors? [no] + all also reports on open inherited file + descriptors at exit (e.g. stdin/out/err) + bad only reports on file descriptor usage + errors and doesn't list open file descriptors + at exit --modify-fds=no|yes|high modify newly open file descriptors? [no] --time-stamp=no|yes add timestamps to log messages? [no] --log-fd= log messages to file descriptor [2=stderr] diff --git a/none/tests/cmdline2.stdout.exp-non-linux b/none/tests/cmdline2.stdout.exp-non-linux index d709ea365..767f1cb9c 100644 --- a/none/tests/cmdline2.stdout.exp-non-linux +++ b/none/tests/cmdline2.stdout.exp-non-linux @@ -28,7 +28,7 @@ usage: valgrind [options] prog-and-args --vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none] where event is one of: startup exit abexit valgrindabexit all none - --track-fds=no|yes|all track open file descriptors? [no] + --track-fds=no|yes|all|bad track open file descriptors? [no] all includes reporting inherited file descriptors --modify-fds=no|yes|high modify newly open file descriptors? [no] --time-stamp=no|yes add timestamps to log messages? [no] diff --git a/none/tests/track_bad.c b/none/tests/track_bad.c new file mode 100644 index 000000000..b1674d648 --- /dev/null +++ b/none/tests/track_bad.c @@ -0,0 +1,34 @@ +#include +#include +#include +#include +#include "fdleak.h" + +int main(void) +{ + char *string = "bad\n"; + int fd = dup(2); + + /* OK. */ + write(fd, string, 4); + close(fd); + + /* Already closed. */ + write(fd, string, 4); + + /* Never created. */ + write(7, string, 4); + + /* Invalid. */ + write(-7, string, 4); + + /* Double double close. */ + close(fd); + + /* Invalid close. */ + close (-7); + + (void) DO( open("/dev/null", O_RDONLY) ); + + return 0; +} diff --git a/none/tests/track_bad.stderr.exp b/none/tests/track_bad.stderr.exp new file mode 100644 index 000000000..620a6b8d2 --- /dev/null +++ b/none/tests/track_bad.stderr.exp @@ -0,0 +1,28 @@ +bad +File descriptor was closed already + at 0x........: write (in /...libc...) + by 0x........: main + Previously closed + at 0x........: close (in /...libc...) + by 0x........: main + Originally opened + at 0x........: dup (in /...libc...) + by 0x........: main +File descriptor 7 was never created + at 0x........: write (in /...libc...) + by 0x........: main +File descriptor -7 Invalid file descriptor + at 0x........: write (in /...libc...) + by 0x........: main +File descriptor ...: ... is already closed + at 0x........: close (in /...libc...) + by 0x........: main + Previously closed + at 0x........: close (in /...libc...) + by 0x........: main + Originally opened + at 0x........: dup (in /...libc...) + by 0x........: main +File descriptor -7 Invalid file descriptor + at 0x........: close (in /...libc...) + by 0x........: main diff --git a/none/tests/track_bad.vgtest b/none/tests/track_bad.vgtest new file mode 100644 index 000000000..77daf8f44 --- /dev/null +++ b/none/tests/track_bad.vgtest @@ -0,0 +1,3 @@ +prog: track_bad +vgopts: -q --track-fds=bad +stderr_filter: filter_fdleak From 57152acfc6a82baa58f0d2fa0409290278bafde7 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 27 Jun 2025 22:36:03 +0200 Subject: [PATCH 071/412] Wrap linux specific syscalls 457 (listmount) and 458 (statmount) The listmount syscall returns a list of mount IDs under the req.mnt_id. This is meant to be used in conjunction with statmount(2) in order to provide a way to iterate and discover mounted file systems. The statmount syscall returns information about a mount, storing it in the buffer pointed to by smbuf. The returned buffer is a struct statmount which is of size bufsize. Declare a sys_{lis,sta}tmount wrapper in priv_syswrap-linux.h and hook it for {amd64,arm,arm64,mips64,nanomips,ppc32,ppc64,riscv64,s390x,x86}-linux using LINXY with PRE and POST handler in syswrap-linux.c Both syscalls need CAP_SYS_ADMIN, to successfully test. Resolves: https://bugs.kde.org/show_bug.cgi?id=502968 --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 4 ++ coregrind/m_syswrap/syswrap-amd64-linux.c | 2 + coregrind/m_syswrap/syswrap-arm-linux.c | 2 + coregrind/m_syswrap/syswrap-arm64-linux.c | 2 + coregrind/m_syswrap/syswrap-linux.c | 53 ++++++++++++++++++++ coregrind/m_syswrap/syswrap-mips32-linux.c | 2 + coregrind/m_syswrap/syswrap-mips64-linux.c | 2 + coregrind/m_syswrap/syswrap-nanomips-linux.c | 2 + coregrind/m_syswrap/syswrap-ppc32-linux.c | 2 + coregrind/m_syswrap/syswrap-ppc64-linux.c | 2 + coregrind/m_syswrap/syswrap-riscv64-linux.c | 2 + coregrind/m_syswrap/syswrap-s390x-linux.c | 2 + coregrind/m_syswrap/syswrap-x86-linux.c | 2 + include/vki/vki-linux.h | 37 ++++++++++++++ include/vki/vki-scnums-shared-linux.h | 2 + 16 files changed, 119 insertions(+) diff --git a/NEWS b/NEWS index 0d9cc798e..c1940b56c 100644 --- a/NEWS +++ b/NEWS @@ -44,6 +44,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 504936 Add FreeBSD amd64 sysarch subcommands AMD64_SET_TLSBASE and AMD64_GET_TLSBASE 505228 Wrap linux specific mseal syscall +502968 Wrap linux specific syscalls 457 (listmount) and 458 (statmount) To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index ed8cb4ed5..9e6cb8981 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -355,6 +355,10 @@ DECL_TEMPLATE(linux, sys_pidfd_getfd); // Since Linux 6.6 DECL_TEMPLATE(linux, sys_fchmodat2); +// Since Linux 6.8 +DECL_TEMPLATE(linux, sys_listmount); +DECL_TEMPLATE(linux, sys_statmount); + // Since Linux 6.10 DECL_TEMPLATE(linux, sys_mseal); diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 292e969fc..22989f9fa 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -904,6 +904,8 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 + LINXY(__NR_statmount, sys_statmount), // 457 + LINXY(__NR_listmount, sys_listmount), // 458 LINX_(__NR_mseal, sys_mseal), // 462 }; diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 6d7db0425..7bd69b681 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -1075,6 +1075,8 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 + LINXY(__NR_statmount, sys_statmount), // 457 + LINXY(__NR_listmount, sys_listmount), // 458 LINX_(__NR_mseal, sys_mseal), // 462 }; diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index 2d6b45f91..40eb65432 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -855,6 +855,8 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 + LINXY(__NR_statmount, sys_statmount), // 457 + LINXY(__NR_listmount, sys_listmount), // 458 LINX_(__NR_mseal, sys_mseal), // 462 }; diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 0db871778..97d386290 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4305,6 +4305,59 @@ PRE(sys_mseal) SET_STATUS_Failure(VKI_ENOMEM); } +PRE(sys_statmount) +{ + // int syscall(SYS_statmount, struct mnt_id_req *req, + // struct statmount *smbuf, size_t bufsize, + // unsigned long flags); + FUSE_COMPATIBLE_MAY_BLOCK(); + PRINT("sys_statmount ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %lu, %#" FMT_REGWORD "x)", ARG1, ARG2, ARG3, ARG4); + PRE_REG_READ4(long, "statmount", struct vki_mnt_id_req *, req, struct vki_statmount *, smbuf, vki_size_t, bufsize, unsigned long, flags); + + struct vki_mnt_id_req *req = (struct vki_mnt_id_req *)(Addr)ARG1; + if (!ML_(safe_to_deref) ((void *)&req->size, sizeof(vki_size_t))) + PRE_MEM_READ("statmount(req)", ARG1, sizeof(struct vki_mnt_id_req)); + else + PRE_MEM_READ("statmount(req)", ARG1, req->size); + + struct vki_statmount *smbuf = (struct vki_statmount *)(Addr)ARG2; + if (!ML_(safe_to_deref) ((void *)&smbuf->size, sizeof(struct vki_statmount))) + PRE_MEM_WRITE("statmount(smbuf)", ARG2, sizeof(struct vki_statmount)); + else + PRE_MEM_WRITE("statmount(smbuf)", ARG2, ARG3); +} + +POST(sys_statmount) +{ + struct vki_statmount *smbuf = (struct vki_statmount *)(Addr)ARG2; + POST_MEM_WRITE((Addr)smbuf, smbuf->size); +} + +PRE(sys_listmount) +{ + // int syscall(SYS_listmount, struct mnt_id_req *req, + // uint64_t *mnt_ids, size_t nr_mnt_ids, + // unsigned long flags); + FUSE_COMPATIBLE_MAY_BLOCK(); + PRINT("sys_listmount ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %lu, %#" FMT_REGWORD "x)", ARG1, ARG2, ARG3, ARG4); + PRE_REG_READ4(long, "listmount", struct vki_mnt_id_req *, req, vki_uint64_t *, mnt_ids, vki_size_t, nr_mnt_ids, unsigned long, flags); + + struct vki_mnt_id_req *req = (struct vki_mnt_id_req *)(Addr)ARG1; + if (!ML_(safe_to_deref) ((void *)&req->size, sizeof(vki_size_t))) + PRE_MEM_READ("listmount(req)", ARG1, sizeof(struct vki_mnt_id_req)); + else + PRE_MEM_READ("listmount(req)", ARG1, req->size); + + PRE_MEM_WRITE("listmount(mnt_ids)", ARG2, ARG3 * sizeof(vki_uint64_t)); +} + +POST(sys_listmount) +{ + if (RES > 0) { + POST_MEM_WRITE(ARG2, RES * sizeof(vki_uint64_t)); + } +} + PRE(sys_syncfs) { *flags |= SfMayBlock; diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 5edae82c3..734f129c8 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -1182,6 +1182,8 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 + LINX_(__NR_statmount, sys_statmount), // 457 + LINX_(__NR_listmount, sys_listmount), // 458 LINX_(__NR_mseal, sys_mseal), // 462 }; diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 63e4b111e..67e5c0b37 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -838,6 +838,8 @@ static SyscallTableEntry syscall_main_table[] = { LINXY (__NR_cachestat, sys_cachestat), LINX_ (__NR_fchmodat2, sys_fchmodat2), LINXY (__NR_userfaultfd, sys_userfaultfd), + LINXY (__NR_statmount, sys_statmount), + LINXY (__NR_listmount, sys_listmount), LINX_ (__NR_mseal, sys_mseal), }; diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index b392ad1ad..a4da2be9b 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -842,6 +842,8 @@ static SyscallTableEntry syscall_main_table[] = { LINX_ (__NR_landlock_restrict_self, sys_landlock_restrict_self), LINXY (__NR_cachestat, sys_cachestat), LINX_ (__NR_fchmodat2, sys_fchmodat2), + LINXY (__NR_statmount, sys_statmount), + LINXY (__NR_listmount, sys_listmount), LINX_ (__NR_mseal, sys_mseal), }; diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index 9d02a0258..b5d45e109 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -1081,6 +1081,8 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 + LINXY (__NR_statmount, sys_statmount), // 457 + LINXY (__NR_listmount, sys_listmount), // 458 LINX_ (__NR_mseal, sys_mseal), // 462 }; diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 94385a4fa..764fb557e 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1048,6 +1048,8 @@ static SyscallTableEntry syscall_table[] = { LINXY (__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 + LINXY (__NR_statmount, sys_statmount), // 457 + LINXY (__NR_listmount, sys_listmount), // 458 LINX_ (__NR_mseal, sys_mseal), // 462 }; diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index 68ccd0ea4..d572672f8 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -599,6 +599,8 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_memfd_secret, sys_memfd_secret), /* 447 */ LINXY(__NR_cachestat, sys_cachestat), /* 451 */ LINX_(__NR_fchmodat2, sys_fchmodat2), /* 452 */ + LINXY(__NR_statmount, sys_statmount), /* 457 */ + LINXY(__NR_listmount, sys_listmount), /* 458 */ LINX_(__NR_mseal, sys_mseal), /* 462 */ }; diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index a6770399d..8202c1922 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -890,6 +890,8 @@ static SyscallTableEntry syscall_table[] = { LINXY (__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 + LINXY (__NR_statmount, sys_statmount), // 457 + LINXY (__NR_listmount, sys_listmount), // 458 LINX_ (__NR_mseal, sys_mseal), // 462 }; diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 4b5b5fb15..45216b45f 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1676,6 +1676,8 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 + LINXY(__NR_statmount, sys_statmount), // 457 + LINXY(__NR_listmount, sys_listmount), // 458 LINX_(__NR_mseal, sys_mseal), // 462 }; diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index 0d2bed6dc..65406fffe 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -5502,6 +5502,43 @@ struct vki__aio_sigset { vki_size_t sigsetsize; }; +//---------------------------------------------------------------------- +// From uapi/linux/mount.h +//---------------------------------------------------------------------- + +struct vki_mnt_id_req { + __vki_u32 size; + __vki_u32 spare; + __vki_u64 mnt_id; + __vki_u64 param; + __vki_u64 mnt_ns_id; +}; + +struct vki_statmount { + __vki_u32 size; /* Total size, including strings */ + __vki_u32 mnt_opts; /* [str] Mount options of the mount */ + __vki_u64 mask; /* What results were written */ + __vki_u32 sb_dev_major; /* Device ID */ + __vki_u32 sb_dev_minor; + __vki_u64 sb_magic; /* ..._SUPER_MAGIC */ + __vki_u32 sb_flags; /* SB_{RDONLY,SYNCHRONOUS,DIRSYNC,LAZYTIME} */ + __vki_u32 fs_type; /* [str] Filesystem type */ + __vki_u64 mnt_id; /* Unique ID of mount */ + __vki_u64 mnt_parent_id; /* Unique ID of parent (for root == mnt_id) */ + __vki_u32 mnt_id_old; /* Reused IDs used in proc/.../mountinfo */ + __vki_u32 mnt_parent_id_old; + __vki_u64 mnt_attr; /* MOUNT_ATTR_... */ + __vki_u64 mnt_propagation; /* MS_{SHARED,SLAVE,PRIVATE,UNBINDABLE} */ + __vki_u64 mnt_peer_group; /* ID of shared peer group */ + __vki_u64 mnt_master; /* Mount receives propagation from this ID */ + __vki_u64 propagate_from; /* Propagation from in current namespace */ + __vki_u32 mnt_root; /* [str] Root of mount relative to root of fs */ + __vki_u32 mnt_point; /* [str] Mountpoint relative to current root */ + __vki_u64 mnt_ns_id; /* ID of the mount namespace */ + __vki_u64 __spare2[49]; + char str[]; /* Variable size part containing strings */ +}; + /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/ diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h index 32ef8ac13..9c20964c5 100644 --- a/include/vki/vki-scnums-shared-linux.h +++ b/include/vki/vki-scnums-shared-linux.h @@ -56,6 +56,8 @@ #define __NR_cachestat 451 #define __NR_fchmodat2 452 +#define __NR_statmount 457 +#define __NR_listmount 458 #define __NR_mseal 462 #endif From 5f832cccbdd28b173deae1056048ed12a67bbfd1 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 28 Jun 2025 09:00:13 +0200 Subject: [PATCH 072/412] Non-Linux regtest: update none cmdline2 stdout expected --- none/tests/cmdline2.stdout.exp-non-linux | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/none/tests/cmdline2.stdout.exp-non-linux b/none/tests/cmdline2.stdout.exp-non-linux index 767f1cb9c..56a92dbf1 100644 --- a/none/tests/cmdline2.stdout.exp-non-linux +++ b/none/tests/cmdline2.stdout.exp-non-linux @@ -29,7 +29,11 @@ usage: valgrind [options] prog-and-args where event is one of: startup exit abexit valgrindabexit all none --track-fds=no|yes|all|bad track open file descriptors? [no] - all includes reporting inherited file descriptors + all also reports on open inherited file + descriptors at exit (e.g. stdin/out/err) + bad only reports on file descriptor usage + errors and doesn't list open file descriptors + at exit --modify-fds=no|yes|high modify newly open file descriptors? [no] --time-stamp=no|yes add timestamps to log messages? [no] --log-fd= log messages to file descriptor [2=stderr] From 6adb4391cb202805cbf60edd5769a207af6fe300 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 28 Jun 2025 18:33:29 +0200 Subject: [PATCH 073/412] mips32: Use LINXY for statmount and listmount commit 57152acfc6a8 "Wrap linux specific syscalls 457 (listmount) and 458 (statmount)" added LINXY wrappers for all arches, except for mips32 where it used LINX_. This was a typo/mistake. Make sure mips32 also uses LINXY wrappers. Suggested-by: Matthias Schwarzott --- coregrind/m_syswrap/syswrap-mips32-linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 734f129c8..4e5e91e15 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -1182,8 +1182,8 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 - LINX_(__NR_statmount, sys_statmount), // 457 - LINX_(__NR_listmount, sys_listmount), // 458 + LINXY(__NR_statmount, sys_statmount), // 457 + LINXY(__NR_listmount, sys_listmount), // 458 LINX_(__NR_mseal, sys_mseal), // 462 }; From 56d870ba62c775ac5a97f95fc6efb49610cdf96e Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 30 Jun 2025 08:27:18 +0000 Subject: [PATCH 074/412] s390x: Add script s390-runone to help debugging small code snippets --- auxprogs/s390-runone | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 auxprogs/s390-runone diff --git a/auxprogs/s390-runone b/auxprogs/s390-runone new file mode 100755 index 000000000..2079a5e46 --- /dev/null +++ b/auxprogs/s390-runone @@ -0,0 +1,85 @@ +#!/bin/sh +# +#----------------------------------------------------------------------- +# Compile a small C program containing a sequence of assembler +# instructions into an executable that does not need a dynamic linker. +# Very handy for debugging new insns or small snippets without going +# through the multi-pass process of figuring out which SB contains the +# code we're interested in. +# +# Here is a template: +# +# int main(void) +# { +# //FIXME: insert test code here: +# asm volatile ("lghi %r1,1"); // __NR_exit +# asm volatile ("lghi %r2,0"); // return code = 0 +# asm volatile ("svc 0"); +# return 0; // shuts up GCC +# } +# +# When running the executable created by this script under valgrind +# there will be only a single super block! Which is exactly what we want +# for debugging. +# +# objdump -d: +# +# 00000000010000b0 <_start>: +# 10000b0: b3 c1 00 0b ldgr %f0,%r11 +# 10000b4: b9 04 00 bf lgr %r11,%r15 +# 10000b8: a7 19 00 01 lghi %r1,1 <--- +# 10000bc: a7 29 00 09 lghi %r2,9 <--- +# 10000c0: 0a 00 svc 0 <--- +# 10000c2: a7 18 00 00 lhi %r1,0 +# 10000c6: b9 14 00 11 lgfr %r1,%r1 +# 10000ca: b9 04 00 21 lgr %r2,%r1 +# 10000ce: b3 cd 00 b0 lgdr %r11,%f0 +# 10000d2: 07 fe br %r14 +# 10000d4: 07 07 nopr %r7 +# 10000d6: 07 07 nopr %r7 +# +# There are only 2 extra insns ahead of our asm code sequence. +# Everything after the svc insn is not reachable. +#----------------------------------------------------------------------- +# + +if [ "x$1" = "x" ]; then + echo "Usage: s390-runone C-file" 1>&2 + echo " or: s390-runone -t" 1>&2 + exit 1 +fi + +if [ "x$1" = "x-t" ]; then + echo 'int main(void)' + echo '{' + echo ' //FIXME: insert test code here:' + echo ' asm volatile ("lghi %r1,1"); // __NR_exit' + echo ' asm volatile ("lghi %r2,0"); // return code = 0' + echo ' asm volatile ("svc 0");' + echo ' return 0; // shuts up GCC' + echo '}' + exit 0 +fi + +file="$1" +base=`basename "$file" .c` +asm="$base.s" +exe="$base" + +if [ "$base" = "$file" ]; then + echo "$file is not a C file" 1>&2 + exit 1 +fi + +# Compile the testprogram to assembler +gcc -S -fno-ident -march=arch14 $file +mv "$asm" "$asm.orig" # save the result + +# Rename main with _start, remove cfi stuff and comment lines +sed 's/main/_start/g' "$asm.orig" | grep -v \.cfi_ | grep -v ^# > "$asm" + +# Link to executable +gcc -static -Wl,--build-id=none -nodefaultlibs -nostartfiles "$asm" -o "$exe" + +echo "$exe created" +exit 0 From c56fbcb7c6e8c821be67c7e8d317116f5deff274 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 30 Jun 2025 19:31:33 +0000 Subject: [PATCH 075/412] s390x: Fix diagnostic for S390_DECODE_UNKNOWN_SPECIAL_INSN When decoding fails the insn bytes (at most 6) are shown. However, "special insns" are 10 bytes with the last 2 bytes being the interesting ones. Print them all. --- VEX/priv/guest_s390_toIR.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index b3ee122c5..f40cd15e8 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -23881,12 +23881,10 @@ s390_decode_and_irgen(const UChar *bytes, UInt insn_length, DisResult *dres) vpanic("s390_decode_and_irgen"); } - vex_printf("%02x%02x", bytes[0], bytes[1]); - if (insn_length > 2) { - vex_printf(" %02x%02x", bytes[2], bytes[3]); - } - if (insn_length > 4) { - vex_printf(" %02x%02x", bytes[4], bytes[5]); + for (unsigned i = 0; i < insn_length; i += 2) { + if (i != 0) + vex_printf(" "); + vex_printf("%02x%02x", bytes[i], bytes[i + 1]); } vex_printf("\n"); } From 924c0eadf1a948292ff1eeab162f85a3b2da3eb0 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 3 Jul 2025 22:06:49 +0200 Subject: [PATCH 076/412] FreeBSD syscall: harden sysctl kern.proc.pathname Add handling for NULL len pointer and not enough space for path. Also extend the bug470713 with a few more checks. Need to add some more inaccessible memory checks. --- coregrind/m_syswrap/syswrap-freebsd.c | 45 ++++++++++++++------- memcheck/tests/freebsd/bug470713.cpp | 42 ++++++++++++++----- memcheck/tests/freebsd/bug470713.stdout.exp | 6 ++- 3 files changed, 66 insertions(+), 27 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 3f4b6ca71..22053da7f 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -1927,29 +1927,40 @@ static void sysctl_kern_usrstack(SizeT* out, SizeT* outlen) *outlen = sizeof(ULong); } -static Bool sysctl_kern_proc_pathname(HChar *out, SizeT *len) +static Int sysctl_kern_proc_pathname(HChar *out, SizeT *len) { const HChar *exe_name = VG_(resolved_exename); + // assert that exe_name is an absolute path + vg_assert(exe_name && exe_name[0] == '/'); if (!len) { - return False; + return VKI_ENOMEM; } + if (!ML_(safe_to_deref)(len, sizeof(len))) { + // ???? check + return VKI_ENOMEM; + } + + SizeT exe_name_length = VG_(strlen)(exe_name)+1; if (!out) { - HChar tmp[VKI_PATH_MAX]; - if (!VG_(realpath)(exe_name, tmp)) { - return False; - } - *len = VG_(strlen)(tmp)+1; - return True; + *len = exe_name_length; + return 0; } - if (!VG_(realpath)(exe_name, out)) { - return False; + if (*len < exe_name_length) { + return VKI_ENOMEM; } - *len = VG_(strlen)(out)+1; - return True; + if (ML_(safe_to_deref)(out, exe_name_length)) { + VG_(strncpy)(out, exe_name, exe_name_length); + } else { + // ???? check + return VKI_EFAULT; + } + + *len = exe_name_length; + return 0; } // SYS___sysctl 202 @@ -2031,7 +2042,7 @@ PRE(sys___sysctl) if (SARG2 == 2 && ML_(safe_to_deref)(name, 2*sizeof(int))) { if (name[0] == 1 && name[1] == 32) { if (sysctl_kern_ps_strings((SizeT*)ARG3, (SizeT*)ARG4)) { - SET_STATUS_Success(0); + SET_STATUS_Success(0); } } } @@ -2043,8 +2054,12 @@ PRE(sys___sysctl) if (name[0] == 1 && name[1] == 14 && name[2] == 12) { vki_pid_t pid = (vki_pid_t)name[3]; if (pid == -1 || pid == VG_(getpid)()) { - sysctl_kern_proc_pathname((HChar *)ARG3, (SizeT *)ARG4); - SET_STATUS_Success(0); + int res = sysctl_kern_proc_pathname((HChar *)ARG3, (SizeT *)ARG4); + if (res == 0) { + SET_STATUS_Success(0); + } else { + SET_STATUS_Failure(res); + } } } } diff --git a/memcheck/tests/freebsd/bug470713.cpp b/memcheck/tests/freebsd/bug470713.cpp index e07dba76b..b49fb1664 100644 --- a/memcheck/tests/freebsd/bug470713.cpp +++ b/memcheck/tests/freebsd/bug470713.cpp @@ -18,29 +18,51 @@ int main(int argc, char **argv) int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; size_t len; - if (sysctl(mib, 4, NULL, &len, NULL, 0) != 0) { - cout << "sysctl failed to get path length: " << std::strerror(errno) << '\n'; + if (argc < 2) + { + std::cout << "ERROR: missing argument, expected \"" << argv[0] << " {absolute path of " << argv[0] << "}\"\n"; return -1; } + if (sysctl(mib, 4, nullptr, &len, nullptr, 0) != 0) { + cout << "ERROR: sysctl failed to get path length: " << std::strerror(errno) << '\n'; + return -1; + } + + // not for regtest, path length may vary + // std::cout << "read length " << len << '\n'; + std::unique_ptr aResult(new char[len]); - if (sysctl(mib, 4, aResult.get(), &len, NULL, 0) != 0) { - cout << "sysctl failed to get path: " << strerror(errno) << '\n'; + if (sysctl(mib, 4, aResult.get(), &len, nullptr, 0) != 0) { + cout << "ERROR: sysctl failed to get path: " << strerror(errno) << '\n'; return -1; } if (string(aResult.get()) == argv[1]) { - cout << "OK\n"; + cout << "OK: got expected pathname\n"; + } else { + cout << "ERROR: aResult " << aResult.get() << " argv[1] " << argv[1] << '\n'; + } + + if (sysctl(mib, 4, aResult.get(), nullptr, nullptr, 0) != 0) { + cout << "OK: sysctl failed with nullptr length: " << strerror(errno) << '\n'; + } else { + cout << "ERROR: nullptr length sysctl succeeded when it should have failed\n"; + } + + size_t bad_len = len - 3U; + if (sysctl(mib, 4, aResult.get(), &bad_len, nullptr, 0) != 0) { + cout << "OK: sysctl failed to get path with bad_len: " << strerror(errno) << '\n'; } else { - cout << "Not OK aResult " << aResult.get() << " argv[1] " << argv[1] << '\n'; + cout << "ERROR: bad_len sysctl succeeded when it should have failed\n"; + return -1; } - if (sysctl(mib, 4, NULL, NULL, NULL, 0) != -1) { - cout << "OK syscall failed\n"; + if (sysctl(mib, 4, nullptr, &len, nullptr, 0) != -1) { + cout << "OK: sysctl failed with nullptr name: " << strerror(errno) << '\n'; return -1; } else { - cout << "sysctl succeeded when it should have failed\n"; + cout << "ERROR: nullptr name sysctl succeeded when it should have failed\n"; } } - diff --git a/memcheck/tests/freebsd/bug470713.stdout.exp b/memcheck/tests/freebsd/bug470713.stdout.exp index 2ba70ed13..76dc05b5a 100644 --- a/memcheck/tests/freebsd/bug470713.stdout.exp +++ b/memcheck/tests/freebsd/bug470713.stdout.exp @@ -1,2 +1,4 @@ -OK -OK syscall failed +OK: got expected pathname +OK: sysctl failed with nullptr length: Cannot allocate memory +OK: sysctl failed to get path with bad_len: Cannot allocate memory +OK: sysctl failed with nullptr name: Cannot allocate memory From 7615845dcd2166d98cb246e1ca7d4496cfcdfc4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= Date: Fri, 4 Jul 2025 07:35:13 -0400 Subject: [PATCH 077/412] Implement fcntl F_CREATED_QUERY Define VKI_F_CREATED_QUERY in vki-linux.h. Recognize it in PRE(sys_fcntl). This fixes ltp tests failures. When running: make ltpchecks TESTS="fcntl40 fcntl40_64 the tests would fail with: fcntl40: unempty log2.filtered: ==1809471== Warning: unimplemented fcntl command: 1028 https://bugs.kde.org/show_bug.cgi?id=506076 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 1 + include/vki/vki-linux.h | 1 + 3 files changed, 3 insertions(+) diff --git a/NEWS b/NEWS index c1940b56c..40fec35cd 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +506076 unimplemented fcntl command: 1028 (F_CREATED_QUERY) 338803 Handling of dwz debug alt files or cross-CU is broken 493434 Add --track-fds=bad mode (no "leak" tracking) 503098 Incorrect NAN-boxing for float registers in RISC-V diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 97d386290..d2d0c7058 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -7100,6 +7100,7 @@ PRE(sys_fcntl) case VKI_F_GETSIG: case VKI_F_GETLEASE: case VKI_F_GETPIPE_SZ: + case VKI_F_CREATED_QUERY: 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); diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index 65406fffe..8c919845b 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -1514,6 +1514,7 @@ struct vki_dirent64 { #define VKI_F_SETLEASE (VKI_F_LINUX_SPECIFIC_BASE + 0) #define VKI_F_GETLEASE (VKI_F_LINUX_SPECIFIC_BASE + 1) +#define VKI_F_CREATED_QUERY (VKI_F_LINUX_SPECIFIC_BASE + 4) #define VKI_F_CANCELLK (VKI_F_LINUX_SPECIFIC_BASE + 5) #define VKI_F_DUPFD_CLOEXEC (VKI_F_LINUX_SPECIFIC_BASE + 6) From cd870f321b2ab0056b1e003afcf455a552642b22 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 4 Jul 2025 23:14:18 +0200 Subject: [PATCH 078/412] Sanity check io_submit addresses before dereferencing The LTP io_submit03 test fails under valgrind memcheck because it tests bad struct iocb attay addresses. Fix this by explicitly checking the struct iocb pointer and each array element pointer are safe to deref in the linux sys_io_submit PRE handler. --- coregrind/m_syswrap/syswrap-linux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index d2d0c7058..f2e1c4979 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2690,12 +2690,15 @@ PRE(sys_io_submit) vki_aio_context_t, ctx_id, long, nr, struct iocb **, iocbpp); PRE_MEM_READ( "io_submit(iocbpp)", ARG3, ARG2*sizeof(struct vki_iocb *) ); - if (ARG3 != 0) { + if (ML_(safe_to_deref)((void *)(Addr)ARG3, ARG2*sizeof(struct vki_iocb *))) { for (i = 0; i < ARG2; i++) { struct vki_iocb *cb = ((struct vki_iocb **)(Addr)ARG3)[i]; struct vki_iovec *iov; PRE_MEM_READ( "io_submit(iocb)", (Addr)cb, sizeof(struct vki_iocb) ); + if (!ML_(safe_to_deref)(&cb->aio_lio_opcode, + sizeof(cb->aio_lio_opcode))) + continue; switch (cb->aio_lio_opcode) { case VKI_IOCB_CMD_PREAD: PRE_MEM_WRITE( "io_submit(PREAD)", cb->aio_buf, cb->aio_nbytes ); From 0dbd164e1767dc29a6e0ea8d2c86b02d6913043b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 5 Jul 2025 00:51:36 +0200 Subject: [PATCH 079/412] Check dup2 oldfd before allowing the syscall The dup201 LTP test fails with TFAIL: dup2(1024, 5) succeeded That is because 1024 here is the soft file limit (so one higher than the max number of fds). Valgrind raises the soft limit a little internally to have a few private fds for itself. So this dup2 call succeeds (and possibly dups and internal valgrind fd into the newfd). We should check the oldfd before allowing the dup2 syscall, like we already check the newfd. --- coregrind/m_syswrap/syswrap-generic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index f8d73e197..50deb1e76 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -3758,6 +3758,8 @@ PRE(sys_dup2) { PRINT("sys_dup2 ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2); PRE_REG_READ2(long, "dup2", unsigned int, oldfd, unsigned int, newfd); + if (!ML_(fd_allowed)(ARG1, "dup2", tid, False)) + SET_STATUS_Failure( VKI_EBADF ); if (!ML_(fd_allowed)(ARG2, "dup2", tid, True)) SET_STATUS_Failure( VKI_EBADF ); } From ce46882e02b38493fe921611cb3ee2d64bde8c30 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 7 Jul 2025 13:51:29 +0000 Subject: [PATCH 080/412] s390x: Minor fix for vbit-test Add a big comment as to why Ity_I1 type values are stored in a 32-bit entity. --- VEX/priv/ir_inject.c | 7 ++++--- memcheck/tests/vbit-test/util.c | 2 +- memcheck/tests/vbit-test/valgrind.c | 6 +++--- memcheck/tests/vbit-test/vbits.h | 14 +++++++++++++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/VEX/priv/ir_inject.c b/VEX/priv/ir_inject.c index 26e8ca278..e62a2d850 100644 --- a/VEX/priv/ir_inject.c +++ b/VEX/priv/ir_inject.c @@ -67,7 +67,8 @@ load_aux(IREndness endian, IRType type, IRExpr *addr) IRExpr_Load(endian, Ity_I64, addr)); } if (type == Ity_I1) { - /* A Boolean value is stored as a 32-bit entity (see store_aux). */ + /* A Boolean value is stored as a 32-bit entity. For an explanation + see comment in vbit-test/vbits.h */ return unop(Iop_32to1, IRExpr_Load(endian, Ity_I32, addr)); } @@ -131,8 +132,8 @@ store_aux(IRSB *irsb, IREndness endian, IRExpr *addr, IRExpr *data) data = unop(Iop_ReinterpD64asI64, data); } if (typeOfIRExpr(irsb->tyenv, data) == Ity_I1) { - /* We cannot store a single bit. So we store it in a 32-bit container. - See also load_aux. */ + /* A Boolean value is stored as a 32-bit entity. For an explanation + see comment in vbit-test/vbits.h */ data = unop(Iop_1Uto32, data); } stmt(irsb, IRStmt_Store(endian, addr, data)); diff --git a/memcheck/tests/vbit-test/util.c b/memcheck/tests/vbit-test/util.c index 63eabc899..3e57cfa70 100644 --- a/memcheck/tests/vbit-test/util.c +++ b/memcheck/tests/vbit-test/util.c @@ -86,7 +86,7 @@ static void print_value(FILE *fp, value_t val, unsigned num_bits) { switch (num_bits) { - case 1: fprintf(fp, "%02x", val.u8); break; + case 1: fprintf(fp, "%01x", val.u32); break; // see comment in vbits.h case 8: fprintf(fp, "%02x", val.u8); break; case 16: fprintf(fp, "%04x", val.u16); break; case 32: fprintf(fp, "%08x", val.u32); break; diff --git a/memcheck/tests/vbit-test/valgrind.c b/memcheck/tests/vbit-test/valgrind.c index c24a06d64..55ff3647d 100644 --- a/memcheck/tests/vbit-test/valgrind.c +++ b/memcheck/tests/vbit-test/valgrind.c @@ -64,7 +64,7 @@ valgrind_set_vbits(opnd_t *opnd) { unsigned rc, num_bytes; - /* 1-bit wide values cannot be read. So we read a 4 bytes here */ + /* 1-bit wide values cannot be read. So we read 4 bytes here */ num_bytes = opnd->type == Ity_I1 ? 4 : sizeof_irtype(opnd->type); rc = VALGRIND_SET_VBITS(&opnd->value, &opnd->vbits.bits, num_bytes); assert(rc == 1); @@ -83,8 +83,8 @@ valgrind_get_vbits(opnd_t *opnd) { unsigned rc, num_bytes; - /* 1-bit wide values cannot be stored. So we store them by writing a - single byte */ + /* 1-bit wide values cannot be stored. So we store them by writing + 4 bytes which is what ir_inject.c expects. */ num_bytes = opnd->type == Ity_I1 ? 4 : sizeof_irtype(opnd->type); opnd->vbits.num_bits = bitsof_irtype(opnd->type); rc = VALGRIND_GET_VBITS(&opnd->value, &opnd->vbits.bits, num_bytes); diff --git a/memcheck/tests/vbit-test/vbits.h b/memcheck/tests/vbit-test/vbits.h index 53ba328aa..7d0002d32 100644 --- a/memcheck/tests/vbit-test/vbits.h +++ b/memcheck/tests/vbit-test/vbits.h @@ -48,7 +48,19 @@ typedef struct { /* A type large enough to hold any IRType'd value. At this point we do not expect to test with specific floating point values. - So we don't need to represent them. */ + So we don't need to represent them. + + NOTE: Values of type Ity_I1 are stored in the u32 variant. This is + inconsistent with the way such values are stored elsewhere in VEX, + namely, in an 8-bit container. Why is that? + The reason is that libvex_ir.h does not provide an Iop_8to1 operator. + However, that would be needed in ir_inject.c when loading a 1-bit value + from memory (see function load_aux there). Instead of today's + return unop(Iop_32to1, IRExpr_Load(endian, Ity_I32, addr)); + we'd like to write + return unop(Iop_8to1, IRExpr_Load(endian, Ity_I8, addr)); + But cannot do. Grrrrr... + */ typedef union { uint8_t u8; uint16_t u16; From 65d7eaf98b2c284d2497cbc33c775199eacd77b1 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 7 Jul 2025 20:05:50 +0200 Subject: [PATCH 081/412] Add vgstack to NEWS --- NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 40fec35cd..fe56ee526 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,12 @@ X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux. * ==================== TOOL CHANGES =================== +* There is a new utility script, "vgstack". It has two + option, -h for minimal help, and -v for the version information. + In normal use pass it the PID of a running Valgrind process + and it will perform a vgdb attach and print the backtrace(s) + of the guest executable. + * ==================== FIXED BUGS ==================== The following bugs have been fixed or resolved. Note that "n-i-bz" From 83c69fddf026be133c38d2b5a43c50eb1ce3e9ce Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 7 Jul 2025 20:17:38 +0000 Subject: [PATCH 082/412] Fix VEX/Makefile-gcc Compile errors because config.h not found. Turns out libvex_inner.h Also missing was priv/host_generic_reg_alloc3.o causing linking to fail. Now fixed. --- VEX/Makefile-gcc | 5 +++++ VEX/pub/libvex_inner.h | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/VEX/Makefile-gcc b/VEX/Makefile-gcc index 0b94e13c5..57e33cdb2 100644 --- a/VEX/Makefile-gcc +++ b/VEX/Makefile-gcc @@ -68,6 +68,7 @@ LIB_OBJS = priv/ir_defs.o \ priv/host_generic_simd128.o \ priv/host_generic_simd256.o \ priv/host_generic_reg_alloc2.o \ + priv/host_generic_reg_alloc3.o \ priv/guest_generic_x87.o \ priv/guest_generic_bb_to_IR.o \ priv/guest_x86_helpers.o \ @@ -347,6 +348,10 @@ priv/host_generic_reg_alloc2.o: $(ALL_HEADERS) priv/host_generic_reg_alloc2.c $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_reg_alloc2.o \ -c priv/host_generic_reg_alloc2.c +priv/host_generic_reg_alloc3.o: $(ALL_HEADERS) priv/host_generic_reg_alloc3.c + $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_reg_alloc3.o \ + -c priv/host_generic_reg_alloc3.c + priv/guest_x86_toIR.o: $(ALL_HEADERS) priv/guest_x86_toIR.c $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_x86_toIR.o \ -c priv/guest_x86_toIR.c diff --git a/VEX/pub/libvex_inner.h b/VEX/pub/libvex_inner.h index 023d1f6a3..f5db06d56 100644 --- a/VEX/pub/libvex_inner.h +++ b/VEX/pub/libvex_inner.h @@ -37,8 +37,6 @@ // For more details, see README_DEVELOPPERS. //-------------------------------------------------------------------- -#include "config.h" - // The code of the inner Valgrind (core or tool code) contains client // requests (e.g. from helgrind.h, memcheck.h, ...) to help the // outer Valgrind finding (relevant) errors in the inner Valgrind. From 71c4e60d7576795942f65234bfcbaa484d21ef08 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 8 Jul 2025 08:14:56 +0200 Subject: [PATCH 083/412] Fix VEX/useful/Makefile-vex This uses hard coded 'make' which may mean Solaris make or BSD make ratheer than the initial invokation (e.g., gmake or some other make that is not first inthe PATH). Use ${MAKE} instead so that the same make is used for the second invokation. --- VEX/useful/Makefile-vex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VEX/useful/Makefile-vex b/VEX/useful/Makefile-vex index 637afc983..31eab20db 100644 --- a/VEX/useful/Makefile-vex +++ b/VEX/useful/Makefile-vex @@ -1,7 +1,7 @@ # Crude makefile to build the "vex" executable from test_main.c vex: test_main.c test_main.h ../pub/*.h ../priv/*.c ../priv/*.h - (cd ..; make -f Makefile-gcc) + (cd ..; ${MAKE} -f Makefile-gcc) cc -I../pub -o vex test_main.c ../libvex.a clean: From e6be4dcf0d816d808ba3e53ec5b6d572a718f731 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 8 Jul 2025 08:27:20 +0200 Subject: [PATCH 084/412] Fix VEX/useful/Makefile-vex again Again a hard coded error, using cc. Replace that with ${CC} so that it uses the default system or user specified compiler. --- VEX/useful/Makefile-vex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VEX/useful/Makefile-vex b/VEX/useful/Makefile-vex index 31eab20db..42d6d66eb 100644 --- a/VEX/useful/Makefile-vex +++ b/VEX/useful/Makefile-vex @@ -2,7 +2,7 @@ vex: test_main.c test_main.h ../pub/*.h ../priv/*.c ../priv/*.h (cd ..; ${MAKE} -f Makefile-gcc) - cc -I../pub -o vex test_main.c ../libvex.a + ${CC} -I../pub -o vex test_main.c ../libvex.a clean: rm -f vex ../priv/*.o From a9203727b159879ce17b1290bfe8cee97730c6ac Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 8 Jul 2025 09:45:47 +0000 Subject: [PATCH 085/412] Refactor IRICB So far there was only one application of IR injection, namely vbit-test. Soonish there will be another. Refactor the IRICB to separate out the structure for the application's payload. --- VEX/priv/ir_inject.c | 23 ++++++++++++++++++----- VEX/pub/libvex.h | 23 +++++++++++++++++++---- memcheck/tests/vbit-test/main.c | 2 +- memcheck/tests/vbit-test/valgrind.c | 4 ++-- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/VEX/priv/ir_inject.c b/VEX/priv/ir_inject.c index e62a2d850..f642c834d 100644 --- a/VEX/priv/ir_inject.c +++ b/VEX/priv/ir_inject.c @@ -46,13 +46,12 @@ /* The IR Injection Control Block. vex_inject_ir will query its contents to construct IR statements for testing purposes. */ -static IRICB iricb; - +static IRICB the_iricb; void LibVEX_InitIRI(const IRICB *iricb_in) { - iricb = *iricb_in; // copy in + the_iricb = *iricb_in; // copy in } @@ -190,9 +189,10 @@ store(IRSB *irsb, IREndness endian, HWord haddr, IRExpr *data) /* Inject IR stmts depending on the data provided in the control block iricb. */ -void -vex_inject_ir(IRSB *irsb, IREndness endian) +static void +vex_inject_ir_vbit(IRSB *irsb, IREndness endian) { + IRICB_vbit_payload iricb = the_iricb.vbit; IRExpr *data, *rounding_mode, *opnd1, *opnd2, *opnd3, *opnd4; rounding_mode = NULL; @@ -321,6 +321,19 @@ vex_inject_ir(IRSB *irsb, IREndness endian) } } +void +vex_inject_ir(IRSB *irsb, IREndness endian) +{ + switch (the_iricb.kind) { + case IRICB_vbit: + vex_inject_ir_vbit(irsb, endian); + break; + + default: + vpanic("unknown IRICB kind"); + } +} + /*---------------------------------------------------------------*/ /*--- end ir_inject.c ---*/ /*---------------------------------------------------------------*/ diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index 2dbfbe770..870747d35 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -960,7 +960,13 @@ extern void LibVEX_ShowStats ( void ); #define NO_ROUNDING_MODE (~0u) -typedef +typedef + enum { + IRICB_vbit, + } + IRICB_t; + +typedef struct { IROp op; // the operation to perform HWord result; // address of the result @@ -976,14 +982,23 @@ typedef UInt rounding_mode; UInt num_operands; // excluding rounding mode, if any /* The following two members describe if this operand has immediate - * operands. There are a few restrictions: - * (1) An operator can have at most one immediate operand. + * operands. There are a few restrictions: + * (1) An operator can have at most one immediate operand. * (2) If there is an immediate operand, it is the right-most operand - * An immediate_index of 0 means there is no immediate operand. + * An immediate_index of 0 means there is no immediate operand. */ UInt immediate_type; // size of immediate Ity_I8, Ity_16 UInt immediate_index; // operand number: 1, 2 } + IRICB_vbit_payload; + +typedef + struct { + IRICB_t kind; + union { + IRICB_vbit_payload vbit; + }; + } IRICB; extern void LibVEX_InitIRI ( const IRICB * ); diff --git a/memcheck/tests/vbit-test/main.c b/memcheck/tests/vbit-test/main.c index db829ddda..d40365219 100644 --- a/memcheck/tests/vbit-test/main.c +++ b/memcheck/tests/vbit-test/main.c @@ -183,7 +183,7 @@ main(int argc, char *argv[]) valgrind_vex_init_for_iri(&iricb); - switch (iricb.num_operands) { + switch (iricb.vbit.num_operands) { case 1: num_unary_tests += test_unary_op(op, data); break; diff --git a/memcheck/tests/vbit-test/valgrind.c b/memcheck/tests/vbit-test/valgrind.c index 55ff3647d..204bf57ac 100644 --- a/memcheck/tests/vbit-test/valgrind.c +++ b/memcheck/tests/vbit-test/valgrind.c @@ -31,7 +31,7 @@ IRICB new_iricb(const irop_t *op, test_data_t *data) { - IRICB cb; + IRICB_vbit_payload cb; cb.op = op->op; cb.result = (HWord)&data->result.value; @@ -52,7 +52,7 @@ new_iricb(const irop_t *op, test_data_t *data) cb.immediate_index = op->immediate_index; cb.immediate_type = op->immediate_type; - return cb; + return (IRICB) { .kind = IRICB_vbit, .vbit = cb }; } From 644d68e9501dd5679194dd5c8e0d3ce24764a1d8 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 9 Jul 2025 20:15:46 +0000 Subject: [PATCH 086/412] Fix operand / result types of Iop_DivU128[E], Iop_ModU128 and their signed counterparts In libvex_ir.h these IROps are described to operate on Ity_I128 operands and produce a like typed result. This contradicts the specification in ir_defs.c (function typeOfprimop) which claims Ity_V128 for operands and result. Above IROps are used exclusively by ppc for the following opcodes: Iop_DivU128 --> vdivuq Vector Divide Unsigned Quadword Iop_DivS128 --> vdivsq Vector Divide Signed Quadword Iop_DivU128E --> vdiveuq Vector Divide Extended Unsigned Quadword Iop_DivS128E --> vdivesq Vector Divide Extended Signed Quadword Iop_ModU128 --> vmoduq Vector Modulo Unsigned Quadword Iop_ModS128 --> vmodsq Vector Modulo Signed Quadword Reading the ISA document, it is clear, that those opcodes perform an integer division / modulo operation. Technically, they work on vector registers, presumably because vector registers are the only resource wide enough to store a quadword. Perhaps that is where the confusion comes from. So Ity_I128 it is. --- VEX/priv/ir_defs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c index 9e7fbf920..ba61758d7 100644 --- a/VEX/priv/ir_defs.c +++ b/VEX/priv/ir_defs.c @@ -3694,10 +3694,12 @@ void typeOfPrimop ( IROp op, case Iop_MulI128by10E: case Iop_MulI128by10ECarry: case Iop_PwExtUSMulQAdd8x16: - case Iop_DivU128: case Iop_DivS128: + BINARY(Ity_V128,Ity_V128, Ity_V128); + + case Iop_DivU128: case Iop_DivS128: case Iop_DivU128E: case Iop_DivS128E: case Iop_ModU128: case Iop_ModS128: - BINARY(Ity_V128,Ity_V128, Ity_V128); + BINARY(Ity_I128,Ity_I128, Ity_I128); case Iop_2xMultU64Add128CarryOut: case Iop_Perm8x16x2: From 1f39c9582bc6ca4470b202c6b61d477ec3abfce7 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 9 Jul 2025 13:04:51 +0200 Subject: [PATCH 087/412] Better report which clone flag are problematic Be explict about which combination of CLONE_VM, CLONE_FS, CLONE_FILES and CLONE_VFORK flags are supported and which combination isn't. https://bugs.kde.org/show_bug.cgi?id=506795 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index fe56ee526..ce162cb18 100644 --- a/NEWS +++ b/NEWS @@ -52,6 +52,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. AMD64_GET_TLSBASE 505228 Wrap linux specific mseal syscall 502968 Wrap linux specific syscalls 457 (listmount) and 458 (statmount) +506795 Better report which clone flags are problematic To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index f2e1c4979..1eaa2621e 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -955,8 +955,17 @@ PRE(sys_clone) "x\n", ARG_FLAGS); VG_(message)(Vg_UserMsg, "\n"); VG_(message)(Vg_UserMsg, "The only supported clone() uses are:\n"); - VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)\n"); - VG_(message)(Vg_UserMsg, " - via the implementation of fork or vfork\n"); + VG_(message)(Vg_UserMsg, + " - via a threads library (VM, FS and FILES flags set)\n"); + VG_(message)(Vg_UserMsg, + " - via the implementation of vfork (VFORK or VFORK and VM flags set)\n"); + VG_(message)(Vg_UserMsg, + " - via plain fork (no VM, FS, FILES, VFORK flags set)\n"); + VG_(message)(Vg_UserMsg, " clone call had %s%s%s%sflags set\n", + cloneflags & VKI_CLONE_VM ? "CLONE_VM " : "", + cloneflags & VKI_CLONE_FS ? "CLONE_FS " : "", + cloneflags & VKI_CLONE_FILES ? "CLONE_FILES " : "", + cloneflags & VKI_CLONE_VFORK ? "CLONE_VFORK " : ""); VG_(unimplemented) ("Valgrind does not support general clone()."); } From aec4871f7c9deed31f5d5606e4f9d07b43a448ec Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 9 Jul 2025 18:27:17 +0200 Subject: [PATCH 088/412] Suppress unimplemented fcntl command warning with -q LTP tests fcntl13 and fcntl13_64 fail because even with -q valgrind emits warnings about unknown (999) fcntl commands. Don't emit that message with -q, just fail with EINVAL. --- coregrind/m_syswrap/syswrap-linux.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 1eaa2621e..a5e1f9d65 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -7202,8 +7202,9 @@ PRE(sys_fcntl) default: PRINT("sys_fcntl[UNKNOWN] ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2, ARG3); - VG_(umsg)("Warning: unimplemented fcntl command: %" FMT_REGWORD "u\n", - ARG2); + if (VG_(clo_verbosity) >= 1) + VG_(umsg)("Warning: unimplemented fcntl command: %" FMT_REGWORD "u\n", + ARG2); SET_STATUS_Failure( VKI_EINVAL ); break; } From 1137bab53c18333e5057e5fc8910b362c4b9c6bd Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 10 Jul 2025 20:20:20 +0200 Subject: [PATCH 089/412] FreeBSD syscall: remove duplicate dead code from sysarch PRE wrapper Probably a copy and paste error. --- coregrind/m_syswrap/syswrap-amd64-freebsd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-amd64-freebsd.c b/coregrind/m_syswrap/syswrap-amd64-freebsd.c index 4c69e762b..21f22b5a8 100644 --- a/coregrind/m_syswrap/syswrap-amd64-freebsd.c +++ b/coregrind/m_syswrap/syswrap-amd64-freebsd.c @@ -183,9 +183,6 @@ PRE(sys_sysarch) SET_STATUS_Failure( VKI_EINVAL ); } break; - - PRINT("sys_amd64_set_tlsbase ( %#lx )", ARG2); - break; default: VG_(message) (Vg_UserMsg, "unhandled sysarch cmd %lu", ARG1); VG_(unimplemented) ("unhandled sysarch cmd"); From b88f40e6557b1f16184230d686490bcffa2bd5eb Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 10 Jul 2025 20:40:43 +0200 Subject: [PATCH 090/412] FreeBSD syscall: make syscall kenv unhandles actions a -v warning Was VG_(unimplemented) which bombs. That's a bit drastic for a syscall intented to be called directly by users. --- coregrind/m_syswrap/syswrap-freebsd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 22053da7f..e6e71c78d 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -3708,8 +3708,10 @@ PRE(sys_kenv) case VKI_KENV_DUMP: break; default: - VG_(message)(Vg_UserMsg, "unhandled kenv cmd %" FMT_REGWORD "u", ARG1); - VG_(unimplemented) ("unhandled kenv cmd"); + if (VG_(clo_verbosity) >= 1) { + VG_(umsg)("Warning: unimplemented kenv action: %" FMT_REGWORD "d\n", + ARG1); + } break; } } From 0888c8b2289b450e87e92852e62d540bcd834b5a Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 10 Jul 2025 23:09:18 +0200 Subject: [PATCH 091/412] Add fcntl14{,_64}, fcntl34{,_64} and fcntl36{,_64} to ltp-excludes.txt These fcntl syscall tests time out and would need at least LTP_TIMEOUT_MUL=5 when run under memcheck, which is several minutes, so exclude them for now. --- auxprogs/ltp-excludes.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/auxprogs/ltp-excludes.txt b/auxprogs/ltp-excludes.txt index 275fd7485..3b52dab8c 100644 --- a/auxprogs/ltp-excludes.txt +++ b/auxprogs/ltp-excludes.txt @@ -16,3 +16,11 @@ setsockopt07 signal05 signal06 timerfd_settime02 +# The following fcntl syscall tests time out, need at least +# LTP_TIMEOUT_MUL=5 when run under memcheck +fcntl14 +fcntl14_64 +fcntl34 +fcntl34_64 +fcntl36 +fcntl36_64 From 300d541a82d9966e833e4db9028011121253a19b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 11 Jul 2025 17:18:47 +0200 Subject: [PATCH 092/412] Check ppoll ufds array is safe to deref before checking fd members LTP ppoll01 provides a bad fds array to ppoll as a testcase. memcheck should warn (through PRE_MEM_READ) this array is bad. But it shouldn't try to derefence anything if is isn't safe. --- coregrind/m_syswrap/syswrap-linux.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index a5e1f9d65..51a47a16f 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2041,6 +2041,8 @@ static void ppoll_pre_helper ( ThreadId tid, SyscallArgLayout* layout, for (i = 0; i < ARG2; i++) { PRE_MEM_READ( "ppoll(ufds.fd)", (Addr)(&ufds[i].fd), sizeof(ufds[i].fd) ); + if (!ML_(safe_to_deref)(&ufds[i].fd, sizeof(ufds[i].fd))) + break; if (ufds[i].fd >= 0) { PRE_MEM_READ( "ppoll(ufds.events)", (Addr)(&ufds[i].events), sizeof(ufds[i].events) ); From e113cde88cb0f588a76d8ceaef2ce2a630d3b9a9 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 11 Jul 2025 17:36:05 +0200 Subject: [PATCH 093/412] Add auxprogs/filters/prctl10 The LTP prctl10 test under memcheck has a child process dumping core. Filter out the normal warning about this. --- auxprogs/filters/prctl10 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 auxprogs/filters/prctl10 diff --git a/auxprogs/filters/prctl10 b/auxprogs/filters/prctl10 new file mode 100755 index 000000000..abed20384 --- /dev/null +++ b/auxprogs/filters/prctl10 @@ -0,0 +1,18 @@ +#!/bin/awk -f + +# Filter out stuff like the following, since it is expected output for the +# prctl10 testcase: + +# ==298306== +# ==298306== Process terminating with default action of signal 11 (SIGSEGV): dumping core +# ==298306== General Protection Fault +# ==298306== at 0x40152B: verify_prctl (prctl10.c:75) +# ==298306== by 0x40A894: fork_testrun.isra.0 (tst_test.c:1617) +# ==298306== by 0x40CC53: tst_run_tcases (tst_test.c:1970) +# ==298306== by 0x4011BD: main (tst_test.h:729) + +skip = 0 +/==[0-9][0-9]*==/ { skip = 1 } +/Process terminating with default action of signal 11/ { skip = 1; skipblock=1 } +/by.*main.*tst_test.h/ { skip = 1; skipblock=0 } +!skip && !skipblock { print } From d7743540064c58d3dcb850804fb29f742757d853 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 11 Jul 2025 19:58:53 +0200 Subject: [PATCH 094/412] linux mseal PRE wrapper should First check for overflow According to https://docs.kernel.org/next/userspace-api/mseal.html mseal returns -EINVAL when Address range (addr + len) overflow. The LTP test mseal02 checks this. So do this check first before checking for valid_client_addr (which returns -ENOMEM). --- coregrind/m_syswrap/syswrap-linux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 51a47a16f..306c3a2f8 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4315,7 +4315,10 @@ PRE(sys_mseal) /* int mseal(void *addr, size_t len, unsigned long flags) */ PRINT("sys_mseal ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, )", ARG1, ARG2, ARG3); PRE_REG_READ3(int, "mseal", void *, addr, vki_size_t, len, int, flags); - if (!ML_(valid_client_addr)(ARG1, ARG2, tid, "mseal")) + /* First check for overflow which produces EINVAL. */ + if ((Addr)ARG1 > ((SizeT)(-1) - (SizeT)ARG2)) { + SET_STATUS_Failure(VKI_EINVAL); + } else if (!ML_(valid_client_addr)(ARG1, ARG2, tid, "mseal")) SET_STATUS_Failure(VKI_ENOMEM); } From 1752297cb1d7f3e112104f377d8ee5b99d55408b Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sat, 12 Jul 2025 13:32:14 +0000 Subject: [PATCH 095/412] Add program to double-check VEX constant folding. BZ 506211 Using IR injection. Essentially: - prepare input values for an IROp - create an IRExpr for the IRop - constant fold the expression - make sure the result is an IRConst with the expected value Only IROps with integer operands and result are supported. No vector and floating point IROps. Maximum bit width is 64. Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- .gitignore | 12 + Makefile.am | 1 + VEX/priv/ir_inject.c | 75 +++++ VEX/priv/ir_opt.c | 5 + VEX/pub/libvex.h | 15 + VEX/pub/libvex_ir.h | 3 + configure.ac | 1 + none/tests/iropt-test/Makefile.am | 83 +++++ none/tests/iropt-test/binary.c | 315 ++++++++++++++++++ none/tests/iropt-test/filter_stderr | 4 + none/tests/iropt-test/irops.tab | 246 ++++++++++++++ .../iropt-test/iropt-test-sec.stderr.exp | 0 none/tests/iropt-test/iropt-test-sec.vgtest | 4 + none/tests/iropt-test/iropt-test.stderr.exp | 0 none/tests/iropt-test/iropt-test.vgtest | 4 + none/tests/iropt-test/main.c | 135 ++++++++ none/tests/iropt-test/unary.c | 229 +++++++++++++ none/tests/iropt-test/util.c | 106 ++++++ none/tests/iropt-test/valgrind.c | 92 +++++ none/tests/iropt-test/vtest.h | 91 +++++ 20 files changed, 1421 insertions(+) create mode 100644 none/tests/iropt-test/Makefile.am create mode 100644 none/tests/iropt-test/binary.c create mode 100755 none/tests/iropt-test/filter_stderr create mode 100644 none/tests/iropt-test/irops.tab create mode 100644 none/tests/iropt-test/iropt-test-sec.stderr.exp create mode 100644 none/tests/iropt-test/iropt-test-sec.vgtest create mode 100644 none/tests/iropt-test/iropt-test.stderr.exp create mode 100644 none/tests/iropt-test/iropt-test.vgtest create mode 100644 none/tests/iropt-test/main.c create mode 100644 none/tests/iropt-test/unary.c create mode 100644 none/tests/iropt-test/util.c create mode 100644 none/tests/iropt-test/valgrind.c create mode 100644 none/tests/iropt-test/vtest.h diff --git a/.gitignore b/.gitignore index 32cedb0d7..e4ddf5dc6 100644 --- a/.gitignore +++ b/.gitignore @@ -2244,6 +2244,18 @@ /none/tests/riscv64/integer /none/tests/riscv64/muldiv +# /none/tests/iropt-test/ +/none/tests/iropt-test/*.dSYM +/none/tests/iropt-test/*.stderr.diff* +/none/tests/iropt-test/*.stderr.out +/none/tests/iropt-test/*.stdout.diff* +/none/tests/iropt-test/*.stdout.out +/none/tests/iropt-test/.deps +/none/tests/iropt-test/Makefile +/none/tests/iropt-test/Makefile.in +/none/tests/iropt-test/iropt-test +/none/tests/iropt-test/iropt-test-sec + # /none/tests/s390x/disasm-test/ /none/tests/s390x/disasm-test/*.dSYM /none/tests/s390x/disasm-test/*.stderr.diff* diff --git a/Makefile.am b/Makefile.am index e67356b5a..a3150abb1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,6 +34,7 @@ SUBDIRS = \ gdbserver_tests \ memcheck/tests/vbit-test \ none/tests/s390x/disasm-test \ + none/tests/iropt-test \ auxprogs \ mpi \ solaris \ diff --git a/VEX/priv/ir_inject.c b/VEX/priv/ir_inject.c index f642c834d..750bb588d 100644 --- a/VEX/priv/ir_inject.c +++ b/VEX/priv/ir_inject.c @@ -33,6 +33,7 @@ #include "main_util.h" /* Convenience macros for readibility */ +#define mkU1(v) IRExpr_Const(IRConst_U1(v)) #define mkU8(v) IRExpr_Const(IRConst_U8(v)) #define mkU16(v) IRExpr_Const(IRConst_U16(v)) #define mkU32(v) IRExpr_Const(IRConst_U32(v)) @@ -321,6 +322,76 @@ vex_inject_ir_vbit(IRSB *irsb, IREndness endian) } } + +static void +vex_inject_ir_iropt(IRSB *irsb, IREndness endian) +{ + IRICB_iropt_payload iricb = the_iricb.iropt; + IRExpr *opnd1, *opnd2, *expr; + ULong val1, val2; + + val1 = *(ULong *)iricb.opnd1; + switch (iricb.t_opnd1) { + case Ity_I1: opnd1 = mkU1(val1); break; + case Ity_I8: opnd1 = mkU8(val1); break; + case Ity_I16: opnd1 = mkU16(val1); break; + case Ity_I32: opnd1 = mkU32(val1); break; + case Ity_I64: opnd1 = mkU64(val1); break; + default: + vpanic("unsupported type"); + } + + switch (iricb.num_operands) { + case 1: + expr = unop(iricb.op, opnd1); + break; + + case 2: + val2 = *(ULong *)iricb.opnd2; + switch (iricb.t_opnd2) { + case Ity_I1: opnd2 = mkU1(val2); break; + case Ity_I8: opnd2 = mkU8(val2); break; + case Ity_I16: opnd2 = mkU16(val2); break; + case Ity_I32: opnd2 = mkU32(val2); break; + case Ity_I64: opnd2 = mkU64(val2); break; + default: + vpanic("unsupported type"); + } + expr = binop(iricb.op, opnd1, opnd2); + break; + + default: + vpanic("unsupported operator"); + } + + /* Make sure the expression gets folded ! */ + IRExpr *env[1] = { 0 }; + IRExpr *res = foldIRExpr(env, expr); + + if (res->tag != Iex_Const) { + vex_printf("*** "); + ppIROp(iricb.op); + vex_printf(": not folded: result = "); + ppIRExpr(res); + vex_printf("\n"); + *(ULong *)iricb.result = 0; // whatever + return; + } + + /* Store the folded result in the IRICB. We're only handling integers + up to 64-bit wide. */ + switch (iricb.t_result) { + case Ity_I1: *(ULong *)iricb.result = res->Iex.Const.con->Ico.U1; break; + case Ity_I8: *(ULong *)iricb.result = res->Iex.Const.con->Ico.U8; break; + case Ity_I16: *(ULong *)iricb.result = res->Iex.Const.con->Ico.U16; break; + case Ity_I32: *(ULong *)iricb.result = res->Iex.Const.con->Ico.U32; break; + case Ity_I64: *(ULong *)iricb.result = res->Iex.Const.con->Ico.U64; break; + default: + vpanic("unsupported type"); + } +} + + void vex_inject_ir(IRSB *irsb, IREndness endian) { @@ -329,6 +400,10 @@ vex_inject_ir(IRSB *irsb, IREndness endian) vex_inject_ir_vbit(irsb, endian); break; + case IRICB_iropt: + vex_inject_ir_iropt(irsb, endian); + break; + default: vpanic("unknown IRICB kind"); } diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index ee2c5a4a7..9a3f39c2c 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2610,6 +2610,11 @@ static IRExpr* fold_Expr ( IRExpr** env, IRExpr* e ) return env == NULL ? e : fold_Expr_WRK(env, e); } +IRExpr* foldIRExpr ( IRExpr** env, IRExpr* e ) +{ + return fold_Expr(env, e); +} + /* Apply the subst to a simple 1-level expression -- guaranteed to be 1-level due to previous flattening pass. */ diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index 870747d35..de19e1ebf 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -963,6 +963,7 @@ extern void LibVEX_ShowStats ( void ); typedef enum { IRICB_vbit, + IRICB_iropt, } IRICB_t; @@ -992,11 +993,25 @@ typedef } IRICB_vbit_payload; +typedef + struct { + IROp op; // the operation to perform + HWord result; // address of the result + HWord opnd1; // address of 1st operand + HWord opnd2; // address of 2nd operand + IRType t_result; // type of result + IRType t_opnd1; // type of 1st operand + IRType t_opnd2; // type of 2nd operand + UInt num_operands; + } + IRICB_iropt_payload; + typedef struct { IRICB_t kind; union { IRICB_vbit_payload vbit; + IRICB_iropt_payload iropt; }; } IRICB; diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h index 803a1317e..983cd50bc 100644 --- a/VEX/pub/libvex_ir.h +++ b/VEX/pub/libvex_ir.h @@ -2405,6 +2405,9 @@ extern IRExpr* deepCopyIRExpr ( const IRExpr* ); /* Pretty-print an IRExpr. */ extern void ppIRExpr ( const IRExpr* ); +/* Fold an IRExpr. Return folded result. */ +extern IRExpr* foldIRExpr ( IRExpr**, IRExpr* ); + /* NULL-terminated IRExpr vector constructors, suitable for use as arg lists in clean/dirty helper calls. */ extern IRExpr** mkIRExprVec_0 ( void ); diff --git a/configure.ac b/configure.ac index a235f1a42..d64782728 100755 --- a/configure.ac +++ b/configure.ac @@ -5757,6 +5757,7 @@ AC_CONFIG_FILES([ none/tests/arm64/Makefile none/tests/s390x/Makefile none/tests/s390x/disasm-test/Makefile + none/tests/iropt-test/Makefile none/tests/mips32/Makefile none/tests/mips64/Makefile none/tests/nanomips/Makefile diff --git a/none/tests/iropt-test/Makefile.am b/none/tests/iropt-test/Makefile.am new file mode 100644 index 000000000..f4d1e9afa --- /dev/null +++ b/none/tests/iropt-test/Makefile.am @@ -0,0 +1,83 @@ +include $(top_srcdir)/Makefile.all.am + +EXTRA_DIST = iropt-test.vgtest iropt-test.stderr.exp \ + iropt-test-sec.vgtest iropt-test-sec.stderr.exp \ + irops.tab + +dist_noinst_SCRIPTS = filter_stderr + +#---------------------------------------------------------------------------- +# Headers +#---------------------------------------------------------------------------- + +pkginclude_HEADERS = +noinst_HEADERS = vtest.h + +#---------------------------------------------------------------------------- +# iropt_test +#---------------------------------------------------------------------------- + +noinst_PROGRAMS = iropt-test + +if VGCONF_HAVE_PLATFORM_SEC +noinst_PROGRAMS += iropt-test-sec +endif + +if VGCONF_OS_IS_DARWIN +noinst_DSYMS = $(noinst_PROGRAMS) +endif + +SOURCES = \ + main.c \ + unary.c \ + binary.c \ + util.c \ + valgrind.c + +# The link flags for this are tricky, because we want to build it for +# both the primary and secondary platforms, and add +# "-Wl,-read_only_relocs -Wl,suppress" to whichever of those is x86-darwin, +# if any. Hence there's a double-nested conditional that adds to the +# LDFLAGS in both cases. + +iropt_test_SOURCES = $(SOURCES) +iropt_test_CPPFLAGS = $(AM_CPPFLAGS_PRI) \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/memcheck \ + -I$(top_srcdir)/VEX/pub +iropt_test_CFLAGS = $(AM_CFLAGS_PRI) -fhosted +iropt_test_DEPENDENCIES = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a +iropt_test_LDADD = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a +iropt_test_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ +# If there is no secondary platform, and the platforms include x86-darwin, +# then the primary platform must be x86-darwin. Hence: +if ! VGCONF_HAVE_PLATFORM_SEC +if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN +iropt_test_LDFLAGS += -Wl,-read_only_relocs -Wl,suppress +endif +endif + +if VGCONF_HAVE_PLATFORM_SEC +iropt_test_sec_SOURCES = $(SOURCES) +iropt_test_sec_CPPFLAGS = $(AM_CPPFLAGS_SEC) \ + $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/memcheck \ + -I$(top_srcdir)/VEX/pub +iropt_test_sec_CFLAGS = $(AM_CFLAGS_SEC) -fhosted \ + $(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) +iropt_test_sec_DEPENDENCIES = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@) +iropt_test_sec_LDADD = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@) +iropt_test_sec_LDFLAGS = $(AM_CFLAGS_SEC) @LIB_UBSAN@ \ + $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) +endif +# If there is a secondary platform, and the platforms include x86-darwin, +# then the primary platform must be amd64-darwin and the secondary platform +# must be x86-darwin. Hence: +if VGCONF_HAVE_PLATFORM_SEC +if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN +iropt_test_sec_LDFLAGS += -Wl,-read_only_relocs -Wl,suppress +endif +endif diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c new file mode 100644 index 000000000..c3f36c188 --- /dev/null +++ b/none/tests/iropt-test/binary.c @@ -0,0 +1,315 @@ +/* -*- mode: C; c-basic-offset: 3; -*- */ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2025 Florian Krohm + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + The GNU General Public License is contained in the file COPYING. +*/ + +#include // printf +#include // UINT64_MAX +#include "vtest.h" + +static void check_result(const irop_t *, const test_data_t *); +static void run_tests(const irop_t *, test_data_t *, unsigned, uint64_t *, + unsigned, uint64_t *); +static int is_shift_op(IROp); + + +void +test_binary_op(const irop_t *op, test_data_t *data) +{ + opnd_t *opnd_l = &data->opnds[0]; + + switch (opnd_l->type) { + case Ity_I1: { + uint64_t values[] = { 0, 1 }; + + run_tests(op, data, NUM_EL(values), values, NUM_EL(values), values); + break; + } + + case Ity_I8: { + uint64_t values[] = { 0, 1, 2, UINT8_MAX - 1, UINT8_MAX }; + uint64_t shifts[] = { 0, 1, 2, 6, 7 }; + + if (is_shift_op(op->op)) + run_tests(op, data, NUM_EL(values), values, NUM_EL(shifts), shifts); + else + run_tests(op, data, NUM_EL(values), values, NUM_EL(values), values); + break; + } + + case Ity_I16: { + uint64_t values[] = { 0, 1, 2, UINT16_MAX - 1, UINT16_MAX }; + uint64_t shifts[] = { 0, 1, 2, 14, 15 }; + + if (is_shift_op(op->op)) + run_tests(op, data, NUM_EL(values), values, NUM_EL(shifts), shifts); + else + run_tests(op, data, NUM_EL(values), values, NUM_EL(values), values); + break; + } + + case Ity_I32: { + uint64_t values[] = { 0, 1, 2, UINT32_MAX - 1, UINT32_MAX }; + uint64_t shifts[] = { 0, 1, 2, 30, 31 }; + + if (is_shift_op(op->op)) + run_tests(op, data, NUM_EL(values), values, NUM_EL(shifts), shifts); + else + run_tests(op, data, NUM_EL(values), values, NUM_EL(values), values); + break; + } + + case Ity_I64: { + uint64_t values[] = { 0, 1, 2, UINT64_MAX - 1, UINT64_MAX }; + uint64_t shifts[] = { 0, 1, 2, 62, 63 }; + + if (is_shift_op(op->op)) + run_tests(op, data, NUM_EL(values), values, NUM_EL(shifts), shifts); + else + run_tests(op, data, NUM_EL(values), values, NUM_EL(values), values); + break; + } + + default: + panic(__func__); + } +} + + +static void +run_tests(const irop_t *op, test_data_t *data, unsigned num_val_l, + uint64_t *values_l, unsigned num_val_r, uint64_t *values_r) +{ + opnd_t *opnd_l = &data->opnds[0]; + opnd_t *opnd_r = &data->opnds[1]; + + for (unsigned i = 0; i < num_val_l; ++i) { + opnd_l->value = values_l[i]; + for (unsigned j = 0; j < num_val_r; ++j) { + opnd_r->value = values_r[j]; + + valgrind_execute_test(op, data); + check_result(op, data); + } + } +} + + +/* Check the result of a binary operation. */ +static void +check_result(const irop_t *op, const test_data_t *data) +{ + uint64_t result = data->result.value; + uint64_t opnd_l = data->opnds[0].value; + uint64_t opnd_r = data->opnds[1].value; + uint64_t expected; + + switch (op->op) { + case Iop_Add8: + case Iop_Add16: + case Iop_Add32: + case Iop_Add64: + expected = opnd_l + opnd_r; + break; + + case Iop_Sub8: + case Iop_Sub16: + case Iop_Sub32: + case Iop_Sub64: + expected = opnd_l - opnd_r; + break; + + case Iop_MullS32: + expected = (int64_t)(int32_t)opnd_l * (int64_t)(int32_t)opnd_r; + break; + + case Iop_Shl32: + expected = opnd_l << opnd_r; + break; + + case Iop_Shl64: + expected = opnd_l << opnd_r; + break; + + case Iop_Shr32: + expected = opnd_l >> opnd_r; + break; + + case Iop_Shr64: + expected = opnd_l >> opnd_r; + break; + + case Iop_Sar32: + expected = ((int64_t)(opnd_l << 32) >> 32) >> opnd_r; + break; + + case Iop_Sar64: + expected = (int64_t)opnd_l >> opnd_r; + break; + + case Iop_Or1: + case Iop_Or8: + case Iop_Or16: + case Iop_Or32: + case Iop_Or64: + expected = opnd_l | opnd_r; + break; + + case Iop_And1: + case Iop_And8: + case Iop_And16: + case Iop_And32: + case Iop_And64: + expected = opnd_l & opnd_r; + break; + + case Iop_Xor8: + case Iop_Xor16: + case Iop_Xor32: + case Iop_Xor64: + expected = opnd_l ^ opnd_r; + break; + + case Iop_CmpEQ8: + case Iop_CmpEQ16: + case Iop_CmpEQ32: + case Iop_CmpEQ64: +// case Iop_CasCmpEQ8: +// case Iop_CasCmpEQ16: +// case Iop_CasCmpEQ32: +// case Iop_CasCmpEQ64: + expected = opnd_l == opnd_r; + break; + + case Iop_CmpNE8: +// case Iop_CmpNE16: + case Iop_CmpNE32: + case Iop_CmpNE64: + case Iop_CasCmpNE8: +// case Iop_CasCmpNE16: + case Iop_CasCmpNE32: + case Iop_CasCmpNE64: + case Iop_ExpCmpNE8: +// case Iop_ExpCmpNE16: + case Iop_ExpCmpNE32: + case Iop_ExpCmpNE64: + expected = opnd_l != opnd_r; + break; + + case Iop_CmpLT32U: + case Iop_CmpLT64U: + expected = opnd_l < opnd_r; + break; + + case Iop_CmpLT32S: { + int32_t opnd_ls = (int32_t)(opnd_l & UINT32_MAX); + int32_t opnd_rs = (int32_t)(opnd_r & UINT32_MAX); + expected = opnd_ls < opnd_rs; + break; + } + + case Iop_CmpLT64S: + expected = (int64_t)opnd_l < (int64_t)opnd_r; + break; + + case Iop_CmpLE32U: + case Iop_CmpLE64U: + expected = opnd_l <= opnd_r; + break; + + case Iop_CmpLE32S: { + int32_t opnd_ls = (int32_t)(opnd_l & UINT32_MAX); + int32_t opnd_rs = (int32_t)(opnd_r & UINT32_MAX); + expected = opnd_ls <= opnd_rs; + break; + } + + case Iop_CmpLE64S: + expected = (int64_t)opnd_l <= (int64_t)opnd_r; + break; + + case Iop_CmpORD32S: { + int32_t opnd_ls = (int32_t)(opnd_l & UINT32_MAX); + int32_t opnd_rs = (int32_t)(opnd_r & UINT32_MAX); + expected = (opnd_ls < opnd_rs) ? 8 : (opnd_ls > opnd_rs) ? 4 : 2; + break; + } + + case Iop_Max32U: + opnd_l &= UINT32_MAX; + opnd_r &= UINT32_MAX; + expected = opnd_l > opnd_r ? opnd_l : opnd_r; + break; + + case Iop_32HLto64: + expected = (opnd_l << 32) | opnd_r; + break; + + default: + panic("%s: operator %s not handled\n", __func__, op->name); + } + + /* Truncate to width of result type */ + switch (bitsof_irtype(op->result_type)) { + case 1: expected &= 0x1; break; + case 8: expected &= UINT8_MAX; break; + case 16: expected &= UINT16_MAX; break; + case 32: expected &= UINT32_MAX; break; + case 64: expected &= UINT64_MAX; break; + default: + panic(__func__); + } + + if (verbose > 1) { + printf("expected: value = "); + print_value(stdout, expected, bitsof_irtype(data->result.type)); + printf("\n"); + } + + int ok = 1; + switch (data->result.type) { + case Ity_I1: ok = result == expected; break; + case Ity_I8: ok = result == expected; break; + case Ity_I16: ok = result == expected; break; + case Ity_I32: ok = result == expected; break; + case Ity_I64: ok = result == expected; break; + default: + panic(__func__); + } + + if (! ok) + complain(op, data, expected); +} + + +static int +is_shift_op(IROp op) +{ + switch (op) { + case Iop_Shl8: case Iop_Shl16: case Iop_Shl32: case Iop_Shl64: + case Iop_Shr8: case Iop_Shr16: case Iop_Shr32: case Iop_Shr64: + case Iop_Sar8: case Iop_Sar16: case Iop_Sar32: case Iop_Sar64: + return 1; + default: + return 0; + } +} diff --git a/none/tests/iropt-test/filter_stderr b/none/tests/iropt-test/filter_stderr new file mode 100755 index 000000000..5337954d0 --- /dev/null +++ b/none/tests/iropt-test/filter_stderr @@ -0,0 +1,4 @@ +#!/bin/sh + +# Nothing to filter. +sed 's/BLA/BLA/' diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab new file mode 100644 index 000000000..a849289cd --- /dev/null +++ b/none/tests/iropt-test/irops.tab @@ -0,0 +1,246 @@ +/* -*- mode: C; c-basic-offset: 3; -*- */ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2025 Florian Krohm + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + The GNU General Public License is contained in the file COPYING. +*/ + +#define OPNAME(op) #op, Iop_##op + +/* Definition of IROps: + - no IROps having floating point operands or result + - no IROPs having vector operands or results (V128, V256) + - no IROPs having integer operands or results with more than 64 bit +*/ + // UNARY + { OPNAME(Not1), Ity_I1, 1, Ity_I1, }, + { OPNAME(Not8), Ity_I8, 1, Ity_I8, }, + { OPNAME(Not16), Ity_I16, 1, Ity_I16, }, + { OPNAME(Not32), Ity_I32, 1, Ity_I32, }, + { OPNAME(Not64), Ity_I64, 1, Ity_I64, }, + + { OPNAME(1Uto8), Ity_I8, 1, Ity_I1, }, +// { OPNAME(1Uto16), Ity_I16, 1, Ity_I1, }, // missing in libvex_ir.h + { OPNAME(1Uto32), Ity_I32, 1, Ity_I1, }, + { OPNAME(1Uto64), Ity_I64, 1, Ity_I1, }, + { OPNAME(1Sto8), Ity_I8, 1, Ity_I1, }, + { OPNAME(1Sto16), Ity_I16, 1, Ity_I1, }, + { OPNAME(1Sto32), Ity_I32, 1, Ity_I1, }, + { OPNAME(1Sto64), Ity_I64, 1, Ity_I1, }, + + { OPNAME(8Uto16), Ity_I16, 1, Ity_I8, }, + { OPNAME(8Uto32), Ity_I32, 1, Ity_I8, }, + { OPNAME(8Uto64), Ity_I64, 1, Ity_I8, }, + { OPNAME(8Sto16), Ity_I16, 1, Ity_I8, }, + { OPNAME(8Sto32), Ity_I32, 1, Ity_I8, }, + { OPNAME(8Sto64), Ity_I64, 1, Ity_I8, }, + + { OPNAME(16Uto32), Ity_I32, 1, Ity_I16, }, + { OPNAME(16Uto64), Ity_I64, 1, Ity_I16, }, + { OPNAME(16Sto32), Ity_I32, 1, Ity_I16, }, + { OPNAME(16Sto64), Ity_I64, 1, Ity_I16, }, + + { OPNAME(32Uto64), Ity_I64, 1, Ity_I32, }, + { OPNAME(32Sto64), Ity_I64, 1, Ity_I32, }, + +// { OPNAME(8to1), Ity_I1, 1, Ity_I8, }, // missing in libvex_ir.h +// { OPNAME(16to1), Ity_I1, 1, Ity_I16, }, // missing in libvex_ir.h + { OPNAME(16to8), Ity_I8, 1, Ity_I16, }, + { OPNAME(16HIto8), Ity_I8, 1, Ity_I16, }, + + { OPNAME(32to1), Ity_I1, 1, Ity_I32, }, + { OPNAME(32to8), Ity_I8, 1, Ity_I32, }, + { OPNAME(32to16), Ity_I16, 1, Ity_I32, }, + { OPNAME(32HIto16), Ity_I16, 1, Ity_I32, }, + + { OPNAME(64to1), Ity_I1, 1, Ity_I64, }, + { OPNAME(64to8), Ity_I8, 1, Ity_I64, }, + { OPNAME(64to16), Ity_I16, 1, Ity_I64, }, + { OPNAME(64to32), Ity_I32, 1, Ity_I64, }, + { OPNAME(64HIto32), Ity_I32, 1, Ity_I64, }, + +// { OPNAME(128to64), Ity_I64, 1, Ity_I128, }, // 128 bit +// { OPNAME(128HIto64), Ity_I64, 1, Ity_I128, }, // 128 bit + + // BINARY + { OPNAME(Add8), Ity_I8, 2, Ity_I8, Ity_I8 }, +// { OPNAME(Add16), Ity_I16, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(Add32), Ity_I32, 2, Ity_I32, Ity_I32 }, + { OPNAME(Add64), Ity_I64, 2, Ity_I64, Ity_I64 }, + + { OPNAME(Sub8), Ity_I8, 2, Ity_I8, Ity_I8 }, +// { OPNAME(Sub16), Ity_I16, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(Sub32), Ity_I32, 2, Ity_I32, Ity_I32 }, + { OPNAME(Sub64), Ity_I64, 2, Ity_I64, Ity_I64 }, + +// { OPNAME(Mul8), Ity_I8, 2, Ity_I8, Ity_I8 }, +// { OPNAME(Mul16), Ity_I16, 2, Ity_I16, Ity_I16 }, +// { OPNAME(Mul32), Ity_I32, 2, Ity_I32, Ity_I32 }, +// { OPNAME(Mul64), Ity_I64, 2, Ity_I64, Ity_I64 }, + +// { OPNAME(MullU8), Ity_I16, 2, Ity_I8, Ity_I8 }, // no folding yet +// { OPNAME(MullU16), Ity_I32, 2, Ity_I16, Ity_I16 }, // no folding yet +// { OPNAME(MullU32), Ity_I64, 2, Ity_I32, Ity_I32 }, // no folding yet +// { OPNAME(MullU64), Ity_I128, 2, Ity_I64, Ity_I64 }, // 128 bit + +// { OPNAME(MullS8), Ity_I16, 2, Ity_I8, Ity_I8 }, // no folding yet +// { OPNAME(MullS16), Ity_I32, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(MullS32), Ity_I64, 2, Ity_I32, Ity_I32 }, +// { OPNAME(MullS64), Ity_I128, 2, Ity_I64, Ity_I64 }, // 128 bit + +// { OPNAME(DivU32), Ity_I32, 2, Ity_I32, Ity_I32 }, // no folding yet +// { OPNAME(DivU64), Ity_I64, 2, Ity_I64, Ity_I64 }, // no folding yet +// { OPNAME(DivU128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit + +// { OPNAME(DivS32), Ity_I32, 2, Ity_I32, Ity_I32 }, // no folding yet +// { OPNAME(DivS64), Ity_I64, 2, Ity_I64, Ity_I64 }, // no folding yet +// { OPNAME(DivS128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit + +// { OPNAME(DivU32E), Ity_I32, 2, Ity_I32, Ity_I32 }, // semantics ? +// { OPNAME(DivU64E), Ity_I32, 2, Ity_I32, Ity_I32 }, // semantics ? +// { OPNAME(DivU128E), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit + +// { OPNAME(DivS32E), Ity_I32, 2, Ity_I32, Ity_I32 }, // semantics ? +// { OPNAME(DivS64E), Ity_I32, 2, Ity_I32, Ity_I32 }, // semantics ? +// { OPNAME(DivS128E), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit + +// { OPNAME(DivModU32to32), Ity_I64, 2, Ity_I32, Ity_I64 }, // no folding yet +// { OPNAME(DivModU64to32), Ity_I64, 2, Ity_I32, Ity_I64 }, // no folding yet +// { OPNAME(DivModU64to64), Ity_I64, 2, Ity_I64, Ity_I128 }, // 128 bit +// { OPNAME(DivModU128to64), Ity_I128, 2, Ity_I64, Ity_I128 }, // 128 bit + +// { OPNAME(DivModS32to32), Ity_I64, 2, Ity_I32, Ity_I32 }, // no folding yet +// { OPNAME(DivModS32to32), Ity_I64, 2, Ity_I32, Ity_I64 }, // no folding yet +// { OPNAME(DivModS64to64), Ity_I64, 2, Ity_I64, Ity_I128 }, // 128 bit +// { OPNAME(DivModU128to64), Ity_I128, 2, Ity_I64, Ity_I128 }, // 128 bit + +// { OPNAME(ModU128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit +// { OPNAME(ModS128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit + +// { OPNAME(Shl8), Ity_I8, 2, Ity_I8, Ity_I8 }, // no folding yet +// { OPNAME(Shl16), Ity_I16, 2, Ity_I16, Ity_I8 }, // no folding yet + { OPNAME(Shl32), Ity_I32, 2, Ity_I32, Ity_I8 }, + { OPNAME(Shl64), Ity_I64, 2, Ity_I64, Ity_I8 }, + +// { OPNAME(Shr8), Ity_I8, 2, Ity_I8, Ity_I8 }, // no folding yet +// { OPNAME(Shr16), Ity_I16, 2, Ity_I16, Ity_I8 }, // no folding yet + { OPNAME(Shr32), Ity_I32, 2, Ity_I32, Ity_I8 }, + { OPNAME(Shr64), Ity_I64, 2, Ity_I64, Ity_I8 }, + +// { OPNAME(Sar8), Ity_I8, 2, Ity_I8, Ity_I8 }, // no folding yet +// { OPNAME(Sar16), Ity_I16, 2, Ity_I16, Ity_I8 }, // no folding yet + { OPNAME(Sar32), Ity_I32, 2, Ity_I32, Ity_I8 }, + { OPNAME(Sar64), Ity_I64, 2, Ity_I64, Ity_I8 }, + + { OPNAME(Or1), Ity_I1, 2, Ity_I1, Ity_I1 }, + { OPNAME(Or8), Ity_I8, 2, Ity_I8, Ity_I8 }, + { OPNAME(Or16), Ity_I16, 2, Ity_I16, Ity_I16 }, + { OPNAME(Or32), Ity_I32, 2, Ity_I32, Ity_I32 }, + { OPNAME(Or64), Ity_I64, 2, Ity_I64, Ity_I64 }, + + { OPNAME(And1), Ity_I1, 2, Ity_I1, Ity_I1 }, + { OPNAME(And8), Ity_I8, 2, Ity_I8, Ity_I8 }, + { OPNAME(And16), Ity_I16, 2, Ity_I16, Ity_I16 }, + { OPNAME(And32), Ity_I32, 2, Ity_I32, Ity_I32 }, + { OPNAME(And64), Ity_I64, 2, Ity_I64, Ity_I64 }, + +// { OPNAME(Xor1), Ity_I1, 2, Ity_I1, Ity_I1 }, // missing in libvex_ir.h + { OPNAME(Xor8), Ity_I8, 2, Ity_I8, Ity_I8 }, + { OPNAME(Xor16), Ity_I16, 2, Ity_I16, Ity_I16 }, + { OPNAME(Xor32), Ity_I32, 2, Ity_I32, Ity_I32 }, + { OPNAME(Xor64), Ity_I64, 2, Ity_I64, Ity_I64 }, + +// { OPNAME(CmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8 }, // no folding yet +// { OPNAME(CmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(CmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32 }, + { OPNAME(CmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64 }, + + { OPNAME(CmpNE8), Ity_I1, 2, Ity_I8, Ity_I8 }, +// { OPNAME(CmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(CmpNE32), Ity_I1, 2, Ity_I32, Ity_I32 }, + { OPNAME(CmpNE64), Ity_I1, 2, Ity_I64, Ity_I64 }, + + { OPNAME(CmpLT32U), Ity_I1, 2, Ity_I32, Ity_I32 }, + { OPNAME(CmpLT64U), Ity_I1, 2, Ity_I64, Ity_I64 }, + + { OPNAME(CmpLT32S), Ity_I1, 2, Ity_I32, Ity_I32 }, + { OPNAME(CmpLT64S), Ity_I1, 2, Ity_I64, Ity_I64 }, + + { OPNAME(CmpLE32U), Ity_I1, 2, Ity_I32, Ity_I32 }, + { OPNAME(CmpLE64U), Ity_I1, 2, Ity_I64, Ity_I64 }, + + { OPNAME(CmpLE32S), Ity_I1, 2, Ity_I32, Ity_I32 }, + { OPNAME(CmpLE64S), Ity_I1, 2, Ity_I64, Ity_I64 }, + +// { OPNAME(CasCmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8 }, // no folding yet +// { OPNAME(CasCmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16 }, // no folding yet +// { OPNAME(CasCmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32 }, // no folding yet +// { OPNAME(CasCmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64 }, // no folding yet + + { OPNAME(CasCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8 }, +// { OPNAME(CasCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(CasCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32 }, + { OPNAME(CasCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64 }, + + { OPNAME(ExpCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8 }, +// { OPNAME(ExpCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(ExpCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32 }, + { OPNAME(ExpCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64 }, + +// { OPNAME(CmpORD32U), Ity_I32, 2, Ity_I32, Ity_I32 }, // no folding yet +// { OPNAME(CmpORD64U), Ity_I64, 2, Ity_I64, Ity_I64 }, // no folding yet + + { OPNAME(CmpORD32S), Ity_I32, 2, Ity_I32, Ity_I32 }, +// { OPNAME(CmpORD64S), Ity_I64, 2, Ity_I64, Ity_I64 }, // no folding yet + + { OPNAME(CmpNEZ8), Ity_I1, 1, Ity_I8 }, +// { OPNAME(CmpNEZ16), Ity_I1, 1, Ity_I16 }, // no folding yet + { OPNAME(CmpNEZ32), Ity_I1, 1, Ity_I32 }, + { OPNAME(CmpNEZ64), Ity_I1, 1, Ity_I64 }, + + { OPNAME(CmpwNEZ32), Ity_I32, 1, Ity_I32 }, + { OPNAME(CmpwNEZ64), Ity_I64, 1, Ity_I64 }, + +// { OPNAME(Left8), Ity_I8, 1, Ity_I8 }, // no folding yet +// { OPNAME(Left16), Ity_I16, 1, Ity_I16 }, // no folding yet + { OPNAME(Left32), Ity_I32, 1, Ity_I32 }, + { OPNAME(Left64), Ity_I64, 1, Ity_I64 }, + + { OPNAME(Max32U), Ity_I32, 2, Ity_I32, Ity_I32 }, + +// { OPNAME(Clz32), Ity_I32, 1, Ity_I32 }, // deprecated, undefined behaviour +// { OPNAME(Clz64), Ity_I64, 1, Ity_I64 }, // deprecated, undefined behaviour + +// { OPNAME(Ctz32), Ity_I32, 1, Ity_I32 }, // deprecated, undefined behaviour +// { OPNAME(Ctz64), Ity_I64, 1, Ity_I64 }, // deprecated, undefined behaviour + +// { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32 }, // no folding yet +// { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64 }, // no folding yet + +// { OPNAME(CtzNat32), Ity_I32, 1, Ity_I32 }, // no folding yet +// { OPNAME(CtzNat64), Ity_I64, 1, Ity_I64 }, // no folding yet + +// { OPNAME(PopCount32), Ity_I32, 1, Ity_I32 }, // no folding yet +// { OPNAME(PopCount64), Ity_I64, 1, Ity_I64 }, // no folding yet + +// { OPNAME(8HLto16), Ity_I16, 2, Ity_I8, Ity_I8 }, // no folding yet +// { OPNAME(16HLto32), Ity_I32, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(32HLto64), Ity_I64, 2, Ity_I32, Ity_I32 }, +// { OPNAME(64HLto128), Ity_I128, 2, Ity_I64, Ity_I64 }, // 128 bit diff --git a/none/tests/iropt-test/iropt-test-sec.stderr.exp b/none/tests/iropt-test/iropt-test-sec.stderr.exp new file mode 100644 index 000000000..e69de29bb diff --git a/none/tests/iropt-test/iropt-test-sec.vgtest b/none/tests/iropt-test/iropt-test-sec.vgtest new file mode 100644 index 000000000..e8d4cc702 --- /dev/null +++ b/none/tests/iropt-test/iropt-test-sec.vgtest @@ -0,0 +1,4 @@ +prog: iropt-test +prereq: test -x iropt-test-sec +vgopts: -q --vex-guest-chase=no + diff --git a/none/tests/iropt-test/iropt-test.stderr.exp b/none/tests/iropt-test/iropt-test.stderr.exp new file mode 100644 index 000000000..e69de29bb diff --git a/none/tests/iropt-test/iropt-test.vgtest b/none/tests/iropt-test/iropt-test.vgtest new file mode 100644 index 000000000..8becafdf8 --- /dev/null +++ b/none/tests/iropt-test/iropt-test.vgtest @@ -0,0 +1,4 @@ +prog: iropt-test +#args: -v -v +vgopts: -q --vex-guest-chase=no + diff --git a/none/tests/iropt-test/main.c b/none/tests/iropt-test/main.c new file mode 100644 index 000000000..28b8d23e4 --- /dev/null +++ b/none/tests/iropt-test/main.c @@ -0,0 +1,135 @@ +/* -*- mode: C; c-basic-offset: 3; -*- */ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2025 Florian Krohm + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + The GNU General Public License is contained in the file COPYING. +*/ + +#include // assert +#include // printf +#include // malloc +#include // memset +#include "valgrind.h" // RUNNING_ON_VALGRIND +#include "vtest.h" + +/* Table of IROps. */ +static irop_t irops[] = { + #include "irops.tab" +}; + +static void check_irops_table(void); +static test_data_t *new_test_data(const irop_t *); + +int verbose = 0; + + +int +main(int argc, char *argv[]) +{ + assert(sizeof(long long) == 8); + + for (int i = 1; i < argc; ++i) { + if (strcmp(argv[i], "-v") == 0) + ++verbose; + else if (strcmp(argv[i], "--help") == 0) { + printf("\niropt-test [ -v | --help ]\n"); + printf("\n\t -v verbose mode; shows IROps being tested\n"); + printf("\n\t -v -v verbose mode, extreme edition\n\n"); + return 0; + } else { + printf("%s ? Nothing happens.\n", argv[i]); + return 1; + } + } + + if (! RUNNING_ON_VALGRIND) { + fprintf(stderr, "*** This program needs to run under valgrind.\n"); + return 1; + } + + check_irops_table(); + + setbuf(stdout, NULL); // make stdout unbuffered + + for (unsigned i = 0; i < NUM_EL(irops); ++i) { + const irop_t *op = irops +i; + + if (verbose) + printf("\nTesting operator %s\n", op->name); + + test_data_t *data = new_test_data(op); + + IRICB iricb = new_iricb(op, data); + + valgrind_vex_init_for_iri(&iricb); + + switch (op->num_opnds) { + case 1: + test_unary_op(op, data); + break; + + case 2: + test_binary_op(op, data); + break; + + default: + panic("operator %s not handled", op->name); + } + + free(data); + } + + return 0; +} + + +static void +check_irops_table(void) +{ + for (unsigned i = 0; i < sizeof irops / sizeof *irops; ++i) { + const irop_t *op = irops +i; + + IRType t_res, t_opnd1, t_opnd2, t_opnd3, t_opnd4; + + typeOfPrimop(op->op, &t_res, &t_opnd1, &t_opnd2, &t_opnd3, &t_opnd4); + + if (op->result_type != t_res || + op->opnd1_type != t_opnd1 || + (op->num_opnds == 2 && op->opnd2_type != t_opnd2)) + fprintf(stderr, "%s: type mismatch\n", op->name); + } +} + + +static test_data_t * +new_test_data(const irop_t *op) +{ + test_data_t *data = malloc(sizeof *data); + + memset(data, 0x0, sizeof *data); // initialise + + data->result.type = op->result_type; + + data->opnds[0].type = op->opnd1_type; + if (op->num_opnds > 1) + data->opnds[1].type = op->opnd2_type; + + return data; +} diff --git a/none/tests/iropt-test/unary.c b/none/tests/iropt-test/unary.c new file mode 100644 index 000000000..51ad51505 --- /dev/null +++ b/none/tests/iropt-test/unary.c @@ -0,0 +1,229 @@ +/* -*- mode: C; c-basic-offset: 3; -*- */ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2025 Florian Krohm + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + The GNU General Public License is contained in the file COPYING. +*/ + +#include // printf +#include // UINT64_MAX +#include "vtest.h" + +static void check_result(const irop_t *, const test_data_t *); +static void run_tests(const irop_t *, test_data_t *, unsigned, uint64_t *); + + +void +test_unary_op(const irop_t *op, test_data_t *data) +{ + opnd_t *opnd = &data->opnds[0]; + + switch (opnd->type) { + case Ity_I1: { + uint64_t values[] = { 0, 1 }; + + run_tests(op, data, NUM_EL(values), values); + break; + } + + case Ity_I8: { + uint64_t values[] = { 0, 1, 2, UINT8_MAX - 1, UINT8_MAX }; + + run_tests(op, data, NUM_EL(values), values); + break; + } + + case Ity_I16: { + uint64_t values[] = { 0, 1, 2, UINT16_MAX - 1, UINT16_MAX, + /* and for the benefit of Iop_16HIto8: */ + 1 << 8, 2 << 8, UINT8_MAX << 8 + }; + + run_tests(op, data, NUM_EL(values), values); + break; + } + + case Ity_I32: { + uint64_t values[] = { 0, 1, 2, UINT32_MAX - 1, UINT32_MAX, + /* and for the benefit of Iop_32HIto16: */ + 1 << 16, 2 << 16, (uint64_t)UINT16_MAX << 16 + }; + run_tests(op, data, NUM_EL(values), values); + break; + } + + case Ity_I64: { + uint64_t values[] = { 0, 1, 2, UINT64_MAX - 1, UINT64_MAX, + /* and for the benefit of Iop_64HIto32: */ + (uint64_t)1 << 32, (uint64_t)2 << 32, (uint64_t)UINT32_MAX << 32 + }; + run_tests(op, data, NUM_EL(values), values); + break; + } + + default: + panic(__func__); + } +} + + +static void +run_tests(const irop_t *op, test_data_t *data, unsigned num_val, + uint64_t *values) +{ + opnd_t *opnd = &data->opnds[0]; + + for (unsigned i = 0; i < num_val; ++i) { + opnd->value = values[i]; + + valgrind_execute_test(op, data); + check_result(op, data); + } +} + + +/* Check the result of a unary operation. */ +static void +check_result(const irop_t *op, const test_data_t *data) +{ + uint64_t result = data->result.value; + uint64_t opnd = data->opnds[0].value; + uint64_t expected; + + switch (op->op) { + case Iop_Not1: expected = ~opnd & 0x1; break; + case Iop_Not8: expected = ~opnd & UINT8_MAX; break; + case Iop_Not16: expected = ~opnd & UINT16_MAX; break; + case Iop_Not32: expected = ~opnd & UINT32_MAX; break; + case Iop_Not64: expected = ~opnd & UINT64_MAX; break; + + case Iop_1Uto8: expected = opnd; break; +// case Iop_1Uto16: expected = opnd; break; + case Iop_1Uto32: expected = opnd; break; + case Iop_1Uto64: expected = opnd; break; + + case Iop_1Sto8: + expected = sign_extend(opnd, 1) & UINT8_MAX; + break; + case Iop_1Sto16: + expected = sign_extend(opnd, 1) & UINT16_MAX; + break; + case Iop_1Sto32: + expected = sign_extend(opnd, 1) & UINT32_MAX; + break; + case Iop_1Sto64: + expected = sign_extend(opnd, 1) & UINT64_MAX; + break; + + case Iop_8Uto16: expected = opnd; break; + case Iop_8Uto32: expected = opnd; break; + case Iop_8Uto64: expected = opnd; break; + + case Iop_8Sto16: + expected = sign_extend(opnd, 8) & UINT16_MAX; + break; + case Iop_8Sto32: + expected = sign_extend(opnd, 8) & UINT32_MAX; + break; + case Iop_8Sto64: + expected = sign_extend(opnd, 8) & UINT64_MAX; + break; + + case Iop_16Uto32: expected = opnd; break; + case Iop_16Uto64: expected = opnd; break; + + case Iop_16Sto32: + expected = sign_extend(opnd, 16) & UINT32_MAX; + break; + case Iop_16Sto64: + expected = sign_extend(opnd, 16) & UINT64_MAX; + break; + + case Iop_32Uto64: expected = opnd; break; + + case Iop_32Sto64: + expected = sign_extend(opnd, 32) & UINT64_MAX; + break; + +// case Iop_8to1: expected = opnd & 0x1; break; +// case Iop_16to1: expected = opnd & 0x1; break; + case Iop_16to8: expected = opnd & UINT8_MAX; break; + case Iop_16HIto8: expected = opnd >> 8; break; + break; + + case Iop_32to1: expected = opnd & 0x1; break; + case Iop_32to8: expected = opnd & UINT8_MAX; break; + case Iop_32to16: expected = opnd & UINT16_MAX; break; + case Iop_32HIto16: expected = opnd >> 16; break; + + case Iop_64to1: expected = opnd & 0x1; break; + case Iop_64to8: expected = opnd & UINT8_MAX; break; + case Iop_64to16: expected = opnd & UINT16_MAX; break; + case Iop_64to32: expected = opnd & UINT32_MAX; break; + case Iop_64HIto32: expected = opnd >> 32; break; + + case Iop_CmpNEZ8: +// case Iop_CmpNEZ16: + case Iop_CmpNEZ32: + case Iop_CmpNEZ64: + expected = opnd != 0; + break; + + case Iop_CmpwNEZ32: expected = opnd == 0 ? 0 : UINT32_MAX; break; + case Iop_CmpwNEZ64: expected = opnd == 0 ? 0 : UINT64_MAX; break; + +// case Iop_Left8: +// case Iop_Left16: + case Iop_Left32: { + int32_t opnd_s = (int32_t)opnd; + expected = (opnd_s | -opnd_s) & UINT32_MAX; + break; + } + + case Iop_Left64: { + int64_t opnd_s = (int64_t)opnd; + expected = (opnd_s | -opnd_s) & UINT64_MAX; + break; + } + + default: + panic("%s: operator %s not handled\n", __func__, op->name); + } + + if (verbose > 1) { + printf("expected: value = "); + print_value(stdout, expected, bitsof_irtype(data->result.type)); + printf("\n"); + } + + int ok = 1; + switch (data->result.type) { + case Ity_I1: ok = result == expected; break; + case Ity_I8: ok = result == expected; break; + case Ity_I16: ok = result == expected; break; + case Ity_I32: ok = result == expected; break; + case Ity_I64: ok = result == expected; break; + default: + panic(__func__); + } + + if (! ok) + complain(op, data, expected); +} diff --git a/none/tests/iropt-test/util.c b/none/tests/iropt-test/util.c new file mode 100644 index 000000000..80e58570f --- /dev/null +++ b/none/tests/iropt-test/util.c @@ -0,0 +1,106 @@ +/* -*- mode: C; c-basic-offset: 3; -*- */ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2025 Florian Krohm + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + The GNU General Public License is contained in the file COPYING. +*/ + +#include // fprintf +#include // exit +#include // va_list +#include // PRIx... +#include "vtest.h" + + +/* Something bad happened. Cannot continue. */ +void __attribute__((noreturn)) +panic(const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + fprintf(stderr, "*** OOPS: "); + vfprintf(stderr, fmt, args); + fputc('\n', stderr); + va_end(args); + exit(1); +} + + +/* Issue a complaint because the result of an operation differs from what + was expected. */ +void +complain(const irop_t *op, const test_data_t *data, uint64_t expected) +{ + fprintf(stderr, "*** Incorrect result for operator %s\n", op->name); + + for (unsigned i = 0; i < op->num_opnds; ++i) { + fprintf(stderr, " opnd %u: ", i); + print_opnd(stderr, &data->opnds[i]); + fprintf(stderr, "\n"); + } + fprintf(stderr, " result: "); + print_opnd(stderr, &data->result); + fprintf(stderr, "\n"); + fprintf(stderr, " expect: "); + print_value(stderr, expected, bitsof_irtype(op->result_type)); + fprintf(stderr, "\n"); +} + + +void +print_value(FILE *fp, uint64_t val, unsigned num_bits) +{ + switch (num_bits) { + case 1: fprintf(fp, "%01" PRIx64, val); break; + case 8: fprintf(fp, "%02" PRIx64, val); break; + case 16: fprintf(fp, "%04" PRIx64, val); break; + case 32: fprintf(fp, "%08" PRIx64, val); break; + case 64: fprintf(fp, "%016" PRIx64, val); break; + case 128: + case 256: + /* fall through */ + default: + panic("%s: num_bits = %u", __func__, num_bits); + } +} + + +void +print_opnd(FILE *fp, const opnd_t *opnd) +{ + fprintf(fp, "value = "); + print_value(fp, opnd->value, bitsof_irtype(opnd->type)); +} + + +unsigned +bitsof_irtype(IRType ty) +{ + switch (ty) { + case Ity_I1: return 1; + case Ity_I8: return 8; + case Ity_I16: return 16; + case Ity_I32: return 32; + case Ity_I64: return 64; + default: + panic(__func__); + } +} diff --git a/none/tests/iropt-test/valgrind.c b/none/tests/iropt-test/valgrind.c new file mode 100644 index 000000000..e482909b1 --- /dev/null +++ b/none/tests/iropt-test/valgrind.c @@ -0,0 +1,92 @@ +/* -*- mode: C; c-basic-offset: 3; -*- */ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2025 Florian Krohm + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + The GNU General Public License is contained in the file COPYING. +*/ + +#include // memset +#include "valgrind.h" // VALGRIND_VEX_INJECT_IR +#include "vtest.h" + + +/* Return a completely initialised control block */ +IRICB +new_iricb(const irop_t *op, test_data_t *data) +{ + IRICB_iropt_payload cb; + + memset(&cb, 0x0, sizeof cb); + + cb.op = op->op; + cb.result = (HWord)&data->result.value; + cb.opnd1 = (HWord)&data->opnds[0].value; + cb.opnd2 = (HWord)&data->opnds[1].value; + cb.t_result = data->result.type; + cb.t_opnd1 = data->opnds[0].type; + cb.t_opnd2 = data->opnds[1].type; + + cb.num_operands = op->num_opnds; + + return (IRICB) { .kind = IRICB_iropt, .iropt = cb }; +} + + +/* Insert a client request that will initialize VEX for IR injection */ +void +valgrind_vex_init_for_iri(IRICB *cb) +{ + VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__VEX_INIT_FOR_IRI, cb, 0,0,0,0); +} + + +/* Insert a special opcode that will cause VEX to inject an IR stmt based + on the information passed in the IRICB (in valgrind_vex_init_for_iri). */ +static void +valgrind_vex_inject_ir(void) +{ + VALGRIND_VEX_INJECT_IR(); +} + + +/* Execute the test under valgrind. Well, yes, we're not really executing + it here, just preparing for it... */ +void +valgrind_execute_test(const irop_t *op, test_data_t *data) +{ + if (verbose > 1) + printf("---------- Running a test\n"); + + for (unsigned i = 0; i < op->num_opnds; ++i) { + if (verbose > 1) { + printf("opnd #%u: ", i); + print_opnd(stdout, &data->opnds[i]); + printf("\n"); + } + } + + valgrind_vex_inject_ir(); + + if (verbose > 1) { + printf("result: "); + print_opnd(stdout, &data->result); + printf("\n"); + } +} diff --git a/none/tests/iropt-test/vtest.h b/none/tests/iropt-test/vtest.h new file mode 100644 index 000000000..d9c1ddaae --- /dev/null +++ b/none/tests/iropt-test/vtest.h @@ -0,0 +1,91 @@ +/* -*- mode: C; c-basic-offset: 3; -*- */ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2025 Florian Krohm + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + The GNU General Public License is contained in the file COPYING. +*/ + +#ifndef VTEST_H +#define VTEST_H + +/* Main header file for the iropt tester */ + +#include // uint64_t +#include // FILE +#include "libvex.h" // IROp + +/* Everything we want to know about an IROp */ +typedef struct { + const char *name; + IROp op; + IRType result_type; + unsigned num_opnds; + IRType opnd1_type; + IRType opnd2_type; +} irop_t; + + +/* The maximum number of input operands */ +#define MAX_OPERANDS 2 + +/* An operand of an IROp (also used for the result) */ +typedef struct { + IRType type; + uint64_t value; +} opnd_t; + + +/* Carries the data needed to execute and evaluate a test. I.e. + inputs and result. */ +typedef struct { + opnd_t result; + opnd_t opnds[MAX_OPERANDS]; +} test_data_t; + + +/* Convenience macros */ +#define NUM_EL(x) (sizeof x / sizeof *(x)) + +/* Sign-extend VAL which is NUM_BITS wide to 64 bit */ +#define sign_extend(val, num_bits) \ + ((int64_t)((val) << (64 - (num_bits))) >> (64 - (num_bits))) + + +/* Function prototypes */ +void print_opnd(FILE *, const opnd_t *); +void print_value(FILE *, uint64_t, unsigned); + +void test_unary_op(const irop_t *, test_data_t *); +void test_binary_op(const irop_t *, test_data_t *); + +void valgrind_vex_init_for_iri(IRICB *); +void valgrind_execute_test(const irop_t *, test_data_t *); + +IRICB new_iricb(const irop_t *, test_data_t *); + +void panic(const char *, ...) __attribute__((noreturn)); +void complain(const irop_t *, const test_data_t *, uint64_t expected); + +unsigned bitsof_irtype(IRType); + +/* Exported variables */ +extern int verbose; + +#endif // VTEST_H From 7cbcd30804fc5fa412ae516ea05cbdb57ea8952a Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 12 Jul 2025 16:21:29 +0200 Subject: [PATCH 096/412] FreeBSD syscall: improve kenv wrapper and add a test for it --- .gitignore | 1 + coregrind/m_syswrap/syswrap-freebsd.c | 30 ++++- include/vki/vki-freebsd.h | 10 +- memcheck/tests/freebsd/Makefile.am | 4 + memcheck/tests/freebsd/kenv.cpp | 130 +++++++++++++++++++ memcheck/tests/freebsd/kenv.stderr.exp | 55 ++++++++ memcheck/tests/freebsd/kenv.vgtest | 1 + memcheck/tests/freebsd/scalar.stderr.exp | 11 +- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 11 +- 9 files changed, 238 insertions(+), 15 deletions(-) create mode 100644 memcheck/tests/freebsd/kenv.cpp create mode 100644 memcheck/tests/freebsd/kenv.stderr.exp create mode 100644 memcheck/tests/freebsd/kenv.vgtest diff --git a/.gitignore b/.gitignore index e4ddf5dc6..19c2a9300 100644 --- a/.gitignore +++ b/.gitignore @@ -1445,6 +1445,7 @@ /memcheck/tests/freebsd/getrlimitusage /memcheck/tests/freebsd/inlinfo /memcheck/tests/freebsd/inlinfo_nested.so +/memcheck/tests/freebsd/kenv /memcheck/tests/freebsd/kqueue /memcheck/tests/freebsd/kqueuex /memcheck/tests/freebsd/linkat diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index e6e71c78d..4ce860976 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -3697,19 +3697,39 @@ PRE(sys_nmount) PRE(sys_kenv) { PRINT("sys_kenv ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", ARG1,ARG2,ARG3,ARG4); - PRE_REG_READ4(int, "kenv", - int, action, const char *, name, char *, value, int, len); switch (ARG1) { case VKI_KENV_GET: + // read from arg1, write to arg2 + PRE_REG_READ4(int, "kenv", + int, action, const char *, name, char *, value, int, len); + PRE_MEM_RASCIIZ("kenv(name)", ARG2); + PRE_MEM_WRITE("kenv(value)", ARG3, ARG4); + break; case VKI_KENV_SET: + PRE_REG_READ3(int, "kenv", + int, action, const char *, name, char *, value); + PRE_MEM_RASCIIZ("kenv(name)", ARG2); + PRE_MEM_RASCIIZ("kenv(value)", ARG3); + break; case VKI_KENV_UNSET: + PRE_REG_READ2(int, "kenv", int, action, const char *, name); PRE_MEM_RASCIIZ("kenv(name)", ARG2); - /* FALLTHROUGH */ + break; case VKI_KENV_DUMP: + case VKI_KENV_DUMP_LOADER: + case VKI_KENV_DUMP_STATIC: + PRRSN; + PRA1("kenv",int,action); + // ARG2 name is ignored + PRA3("kenv",char*,value); + PRA4("kenv",int,len); + if (ARG3) { + PRE_MEM_WRITE("kenv(value)", ARG3, ARG4); + } break; default: if (VG_(clo_verbosity) >= 1) { - VG_(umsg)("Warning: unimplemented kenv action: %" FMT_REGWORD "d\n", + VG_(umsg)("Warning: bad or unimplemented kenv action: %" FMT_REGWORD "d\n", ARG1); } break; @@ -3724,7 +3744,7 @@ POST(sys_kenv) POST_MEM_WRITE(ARG3, ARG4); break; case VKI_KENV_DUMP: - if (ARG3 != (Addr)NULL) { + if (ARG3) { POST_MEM_WRITE(ARG3, ARG4); } break; diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index 6be56c27a..63ffbe7e5 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -2228,10 +2228,12 @@ struct vki_kinfo_file { //---------------------------------------------------------------------- // From sys/kenv.h //---------------------------------------------------------------------- -#define VKI_KENV_GET 0 -#define VKI_KENV_SET 1 -#define VKI_KENV_UNSET 2 -#define VKI_KENV_DUMP 3 +#define VKI_KENV_GET 0 +#define VKI_KENV_SET 1 +#define VKI_KENV_UNSET 2 +#define VKI_KENV_DUMP 3 +#define VKI_KENV_DUMP_LOADER 4 +#define VKI_KENV_DUMP_STATIC 5 //---------------------------------------------------------------------- // From sys/sysctl.h (and related) diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index 091d05678..db1e2aca5 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -70,6 +70,8 @@ EXTRA_DIST = \ getfsstat.supp \ getfsstat.stderr.exp-x86 \ getrlimitusage.vgtest getrlimitusage.stderr.exp \ + kenv.vgtest \ + kenv.stderr.exp \ kqueue.vgtest \ kqueue.stderr.exp \ kqueue.stdout.exp \ @@ -156,6 +158,7 @@ check_PROGRAMS = \ fexecve \ file_locking_wait6 \ get_set_context get_set_login getfh \ + kenv \ kqueue linkat memalign misc \ openpty \ pdfork_pdkill getfsstat inlinfo inlinfo_nested.so \ @@ -236,6 +239,7 @@ extattr_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_BUT_SET_VARIABLE@ @FLAG_W_NO_U get_set_login_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ getfh_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ getfsstat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +kenv_SOURCES = kenv.cpp linkat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ memalign_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ misc_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ diff --git a/memcheck/tests/freebsd/kenv.cpp b/memcheck/tests/freebsd/kenv.cpp new file mode 100644 index 000000000..5f029370f --- /dev/null +++ b/memcheck/tests/freebsd/kenv.cpp @@ -0,0 +1,130 @@ +#include +#include +#include +#include +#include +#include +#include + +static long x0; + +int main(int argc, char** argv) +{ + long *px{static_cast(malloc(2*sizeof(long)))}; + x0 = px[0]; + try + { + const size_t bufSize{1024}; + auto buf{std::make_unique(bufSize)}; + std::string name{"bootfile"}; + int res{kenv(KENV_GET, name.c_str(), buf.get(), bufSize)}; + + if (res == -1) + { + throw std::runtime_error("kenv get non-root"); + } + + if (argc > 1) + { + std::cout << buf << '\n'; + } + + res = kenv(42*42, name.c_str(), buf.get(), bufSize); + if (res == 0) + { + throw std::runtime_error("kenv get bogus action succeeded"); + } + if (errno != EINVAL) + { + std::stringstream ss; + ss << "kenv get bogus action wrong errno, expected " << EINVAL << " got " << errno; + throw std::runtime_error(ss.str()); + } + + res = kenv(KENV_GET, "zyxxy", buf.get(), bufSize); + if (res == 0) + { + throw std::runtime_error("kenv get bogus name succeeded"); + } + if (errno != ENOENT) + { + std::stringstream ss; + ss << "kenv get bogus name wrong errno, expected " << ENOENT << " got " << errno; + throw std::runtime_error(ss.str()); + } + + res = kenv(KENV_DUMP, "this does not matter", nullptr, -1); + if (res == -1) + { + throw std::runtime_error("kenv dump to get size non-root"); + } + if (argc > 1) + { + std::cout << "dump size " << res << '\n'; + } + auto dump_buf{std::make_unique(res)}; + char* uninitCharStar; + res = kenv(KENV_DUMP, uninitCharStar, dump_buf.get(), res); + + if (argc > 1) + { + // the buffer contains nul separated eleements, this will just print the first + std::cout << dump_buf << '\n'; + } + + if (0 == geteuid()) + { + res = kenv(KENV_SET, "this", const_cast("that"), 5); + if (res == -1) + { + throw std::runtime_error("kenv set root"); + } + res = kenv(KENV_SET, "this", const_cast("thing"), 6); + if (res == -1) + { + throw std::runtime_error("kenv set root"); + } + res = kenv(KENV_UNSET, "this", const_cast("yes we have no bananas"), 42); + if (res == -1) + { + throw std::runtime_error("kenv set root"); + } + } + else + { + // now try some things that will fail + int uninitInt; + res = kenv(KENV_SET, "this", const_cast("that"), uninitInt); + if (res != -1) + { + throw std::runtime_error("kenv set non-root succeeded"); + } + if (errno != EPERM) + { + std::stringstream ss; + ss << "kenv get bogus action wrong errno, expected " << EPERM << " got " << errno; + throw std::runtime_error(ss.str()); + } + + // checks all the args + kenv(KENV_GET+x0, name.c_str()+x0, buf.get()+x0, 1024+x0); + + // now some memory errors + char* freeName{new char[32]}; + sprintf(freeName, "%s", "blah"); + delete [] freeName; + kenv(KENV_GET, freeName, buf.get(), 32); + char* freeBuf{new char[32]}; + delete [] freeBuf; + kenv(KENV_GET, name.c_str(), freeBuf, 32); + int res{kenv(KENV_GET, name.c_str(), buf.get(), 2*bufSize)}; + } + + } + catch (std::exception& e) + { + std::cout << "FAILED: " << e.what() << '\n'; + exit(-1); + } + free(px); +} diff --git a/memcheck/tests/freebsd/kenv.stderr.exp b/memcheck/tests/freebsd/kenv.stderr.exp new file mode 100644 index 000000000..c356c7c83 --- /dev/null +++ b/memcheck/tests/freebsd/kenv.stderr.exp @@ -0,0 +1,55 @@ + +Warning: bad or unimplemented kenv action: 1764 +Syscall param kenv(action) contains uninitialised byte(s) + at 0x........: kenv (in /...libc...) + by 0x........: main (kenv.cpp:110) + +Syscall param kenv(name) contains uninitialised byte(s) + at 0x........: kenv (in /...libc...) + by 0x........: main (kenv.cpp:110) + +Syscall param kenv(value) contains uninitialised byte(s) + at 0x........: kenv (in /...libc...) + by 0x........: main (kenv.cpp:110) + +Syscall param kenv(len) contains uninitialised byte(s) + at 0x........: kenv (in /...libc...) + by 0x........: main (kenv.cpp:110) + +Syscall param kenv(name) points to unaddressable byte(s) + at 0x........: kenv (in /...libc...) + by 0x........: main (kenv.cpp:116) + Address 0x........ is 0 bytes inside a block of size 32 free'd + at 0x........: ...operator delete[]... (vg_replace_malloc.c:...) + by 0x........: main (kenv.cpp:115) + Block was alloc'd at + at 0x........: ...operator new[]... (vg_replace_malloc.c:...) + by 0x........: main (kenv.cpp:113) + +Syscall param kenv(value) points to unaddressable byte(s) + at 0x........: kenv (in /...libc...) + by 0x........: main (kenv.cpp:119) + Address 0x........ is 0 bytes inside a block of size 32 free'd + at 0x........: ...operator delete[]... (vg_replace_malloc.c:...) + by 0x........: main (kenv.cpp:118) + Block was alloc'd at + at 0x........: ...operator new[]... (vg_replace_malloc.c:...) + by 0x........: main (kenv.cpp:117) + +Syscall param kenv(value) points to unaddressable byte(s) + at 0x........: kenv (in /...libc...) + by 0x........: main (kenv.cpp:120) + Address 0x........ is 0 bytes after a block of size 1,024 alloc'd + at 0x........: ...operator new[]... (vg_replace_malloc.c:...) + by 0x........: main (kenv.cpp:18) + + +HEAP SUMMARY: + in use at exit: 0 bytes in 0 blocks + total heap usage: 5 allocs, 5 frees, 4,765 bytes allocated + +For a detailed leak analysis, rerun with: --leak-check=full + +Use --track-origins=yes to see where uninitialised values come from +For lists of detected and suppressed errors, rerun with: -s +ERROR SUMMARY: 7 errors from 7 contexts (suppressed: 0 from 0) diff --git a/memcheck/tests/freebsd/kenv.vgtest b/memcheck/tests/freebsd/kenv.vgtest new file mode 100644 index 000000000..763cd16a2 --- /dev/null +++ b/memcheck/tests/freebsd/kenv.vgtest @@ -0,0 +1 @@ +prog: kenv diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 2e6ca39b4..ae8adcd1b 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -2968,21 +2968,26 @@ Syscall param kenv(name) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +Syscall param kenv(value) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 390: SYS_kenv (KENV_DUMP) 4s 0m --------------------------------------------------------- Syscall param kenv(action) contains uninitialised byte(s) ... -Syscall param kenv(name) contains uninitialised byte(s) - ... - Syscall param kenv(value) contains uninitialised byte(s) ... Syscall param kenv(len) contains uninitialised byte(s) ... +Syscall param kenv(value) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 391: SYS_lchflags 2s 1m --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 24c7caac0..47beb3dce 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -2974,21 +2974,26 @@ Syscall param kenv(name) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +Syscall param kenv(value) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 390: SYS_kenv (KENV_DUMP) 4s 0m --------------------------------------------------------- Syscall param kenv(action) contains uninitialised byte(s) ... -Syscall param kenv(name) contains uninitialised byte(s) - ... - Syscall param kenv(value) contains uninitialised byte(s) ... Syscall param kenv(len) contains uninitialised byte(s) ... +Syscall param kenv(value) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 391: SYS_lchflags 2s 1m --------------------------------------------------------- From 1e2300f192b24f8701a4793a28a07d1ca8aff05e Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 12 Jul 2025 20:20:06 +0200 Subject: [PATCH 097/412] FreeBSD regtest: small cleanup of kenv test Suppress uninitialised warning Remove res variable that was copied and pasted --- memcheck/tests/freebsd/Makefile.am | 1 + memcheck/tests/freebsd/kenv.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index db1e2aca5..5608b77d5 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -240,6 +240,7 @@ get_set_login_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ getfh_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ getfsstat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ kenv_SOURCES = kenv.cpp +kenv_CXXFLAGS = ${AM_CXXFLAGS} @FLAG_W_NO_UNINITIALIZED@ linkat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ memalign_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ misc_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ diff --git a/memcheck/tests/freebsd/kenv.cpp b/memcheck/tests/freebsd/kenv.cpp index 5f029370f..ed8216185 100644 --- a/memcheck/tests/freebsd/kenv.cpp +++ b/memcheck/tests/freebsd/kenv.cpp @@ -117,7 +117,7 @@ int main(int argc, char** argv) char* freeBuf{new char[32]}; delete [] freeBuf; kenv(KENV_GET, name.c_str(), freeBuf, 32); - int res{kenv(KENV_GET, name.c_str(), buf.get(), 2*bufSize)}; + kenv(KENV_GET, name.c_str(), buf.get(), 2*bufSize); } } From 13f376e083f6479a0028d91d076108779e332cd9 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 12 Jul 2025 20:31:31 +0200 Subject: [PATCH 098/412] FreeBSD regtst: add filter for kenv test The size of the kernel environment depends on the FreeBSD version. So add a filter for the total of all alocations. --- memcheck/tests/freebsd/Makefile.am | 2 +- memcheck/tests/freebsd/filter_kenv | 10 ++++++++++ memcheck/tests/freebsd/kenv.vgtest | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 memcheck/tests/freebsd/filter_kenv diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index 5608b77d5..d96cde1b1 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -4,7 +4,7 @@ include $(top_srcdir)/Makefile.tool-tests.am dist_noinst_SCRIPTS = filter_stderr filter_pts dump_stdout filter_sigwait \ filter_scalar filter_realpathat filter_fstat filter_eventfd2 \ toucher1 toucher2 filter_getfsstat filter_context filter_frame \ - filter_supp + filter_supp filter_kenv EXTRA_DIST = \ access.vgtest \ diff --git a/memcheck/tests/freebsd/filter_kenv b/memcheck/tests/freebsd/filter_kenv new file mode 100755 index 000000000..c6bb6837a --- /dev/null +++ b/memcheck/tests/freebsd/filter_kenv @@ -0,0 +1,10 @@ +#! /bin/sh + +../filter_stderr "$@" | + +# want to run without -q to see invalid action message +# but the size of the kernel environment depends +# on the FreeBSD version, so we want to filter the size of +# KENV_DUMP allocation + +gsed 's/4,765 bytes allocated/XXX bytes allocated' diff --git a/memcheck/tests/freebsd/kenv.vgtest b/memcheck/tests/freebsd/kenv.vgtest index 763cd16a2..5c54fefd5 100644 --- a/memcheck/tests/freebsd/kenv.vgtest +++ b/memcheck/tests/freebsd/kenv.vgtest @@ -1 +1,2 @@ prog: kenv +stderr_filter: filter_kenv From 293a6f431fb4edde5fac64ff99671a208598f8e6 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 12 Jul 2025 21:45:10 +0200 Subject: [PATCH 099/412] FreeBSD regtest: more kenv churn Haste makes Waste. Filter was broken (and thererfore the expected not correct either). --- memcheck/tests/freebsd/filter_kenv | 2 +- memcheck/tests/freebsd/kenv.stderr.exp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/memcheck/tests/freebsd/filter_kenv b/memcheck/tests/freebsd/filter_kenv index c6bb6837a..029d3c73f 100755 --- a/memcheck/tests/freebsd/filter_kenv +++ b/memcheck/tests/freebsd/filter_kenv @@ -7,4 +7,4 @@ # on the FreeBSD version, so we want to filter the size of # KENV_DUMP allocation -gsed 's/4,765 bytes allocated/XXX bytes allocated' +gsed 's/ [^ ]* bytes allocated/ XXX bytes allocated/' diff --git a/memcheck/tests/freebsd/kenv.stderr.exp b/memcheck/tests/freebsd/kenv.stderr.exp index c356c7c83..faf3ccc8a 100644 --- a/memcheck/tests/freebsd/kenv.stderr.exp +++ b/memcheck/tests/freebsd/kenv.stderr.exp @@ -46,7 +46,7 @@ Syscall param kenv(value) points to unaddressable byte(s) HEAP SUMMARY: in use at exit: 0 bytes in 0 blocks - total heap usage: 5 allocs, 5 frees, 4,765 bytes allocated + total heap usage: 5 allocs, 5 frees, XXX bytes allocated For a detailed leak analysis, rerun with: --leak-check=full From 36e090c39cbacf34425e199e77691c4e9d708fc2 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 12 Jul 2025 22:23:05 +0200 Subject: [PATCH 100/412] Bug 506499 - Unhandled syscall 592 (exterrctl - FreeBSD) Also add wrapers for inotify_add_watch_at and inotify_rm_watch No specific tests for these yet. --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-freebsd.h | 4 ++ coregrind/m_syswrap/syswrap-freebsd.c | 56 ++++++++++++++++++-- include/vki/vki-scnums-freebsd.h | 4 ++ memcheck/tests/freebsd/scalar.c | 53 ++++++++++++++++++ memcheck/tests/freebsd/scalar.stderr.exp | 41 ++++++++++++++ memcheck/tests/freebsd/scalar.stderr.exp-x86 | 41 ++++++++++++++ 7 files changed, 196 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index ce162cb18..73488cbc1 100644 --- a/NEWS +++ b/NEWS @@ -52,6 +52,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. AMD64_GET_TLSBASE 505228 Wrap linux specific mseal syscall 502968 Wrap linux specific syscalls 457 (listmount) and 458 (statmount) +506499 Unhandled syscall 592 (exterrctl - FreeBSD 506795 Better report which clone flags are problematic To see details of a given bug, visit diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index f8d404239..f16831933 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -543,6 +543,10 @@ DECL_TEMPLATE(freebsd, sys_getrlimitusage) // 589 DECL_TEMPLATE(freebsd, sys_fchroot) // 590 DECL_TEMPLATE(freebsd, sys_setcred) // 591 +DECL_TEMPLATE(freebsd, sys_exterrctl) // 592 +DECL_TEMPLATE(freebsd, sys_inotify_add_watch_at) // 593 +DECL_TEMPLATE(freebsd, sys_inotify_rm_watch) // 594 + DECL_TEMPLATE(freebsd, sys_fake_sigreturn) #endif // PRIV_SYSWRAP_FREEBSD_H diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 4ce860976..79e30f7d3 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -4864,8 +4864,8 @@ PRE(sys_kmq_notify) // int kmq_unlink(const char *path); PRE(sys_kmq_unlink) { - PRINT("sys_kmq_unlink ( %#" FMT_REGWORD "x(%s) )", ARG1,(char *)ARG1); - PRE_REG_READ1(int, "mq_unlink", const char *, name); + PRINT("sys_kmq_unlink ( %#" FMT_REGWORD "x(%s) )", ARG1,(HChar *)ARG1); + PRE_REG_READ1(int, "mq_unlink", const HChar *, name); PRE_MEM_RASCIIZ( "mq_unlink(name)", ARG1 ); } @@ -7054,7 +7054,7 @@ POST(sys_getrlimitusage) // int fchroot(int fd); PRE(sys_fchroot) { - PRINT("sys_fchroot(%ld)", ARG1); + PRINT("sys_fchroot(%" FMT_REGWORD "d)", ARG1); PRE_REG_READ1(int, "fchroot", int, fd); /* Be strict. */ @@ -7066,11 +7066,55 @@ PRE(sys_fchroot) // int setcred(u_int flags, const struct setcred *wcred, size_t size); PRE(sys_setcred) { - PRINT("sys_setcred(%ld, %#" FMT_REGWORD "x, %lu)", ARG1, ARG2, ARG3); + PRINT("sys_setcred(%" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u)", ARG1, ARG2, ARG3); PRE_REG_READ3(int, "setcred", u_int, flags, const struct setcred*, wcred, size_t, size); PRE_MEM_READ("setcred(wcred)", ARG2, sizeof(struct vki_setcred)); } +// SYS_exterrctl +// int exterrctl(u_int op, u_int flags, _In_reads_bytes_(4) void *ptr +PRE(sys_exterrctl) +{ + PRINT("sys_exterrctl(%" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x)", + ARG1, ARG2, ARG3); + PRE_REG_READ3(int, "exterrctl", u_int, op, u_int, flags, void*, ptr); + // the void* points to struct uexterror which at the time of writing has 10 fields + // but this syscall just turns this feature on and off and it's only th first 4 bytes + // for the version that gets checked + PRE_MEM_READ("exterrctl(ptr)", ARG3, 4); +} + +// SYS_inotify_add_watch_at +// int inotify_add_watch_at(int fd, int dfd, _In_z_ const char *path, uint32_t mask); +PRE(sys_inotify_add_watch_at) +{ + PRINT("sys_inotify_add_watch_at(%" FMT_REGWORD "d, %" FMT_REGWORD "d, %" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x)", SARG1, SARG2, ARG3, (HChar*)ARG3, ARG4); + PRE_REG_READ4(int, "inotify_add_watch_at", int, fd, int, dfd, const char*, path, uint32_t, mask); + PRE_MEM_RASCIIZ("inotify_add_watch_at(path)", ARG3); + if (!ML_(fd_allowed)(ARG1, "inotify_add_watch_at", tid, False)) { + SET_STATUS_Failure( VKI_EBADF ); + } + if (ARG2 != VKI_AT_FDCWD) { + if (!ML_(fd_allowed)(ARG2, "inotify_add_watch_at", tid, False)) { + SET_STATUS_Failure( VKI_EBADF ); + } + } +} + +// SYS_inotify_rm_watch +// int inotify_rm_watch(int fd, int wd); +PRE(sys_inotify_rm_watch) +{ + PRINT("sys_inotify_rm_watch(%" FMT_REGWORD "d, %" FMT_REGWORD "d)", SARG1, SARG2); + PRE_REG_READ2(int, "sys_inotify_rm_watch", int, fd, int, wd); + if (!ML_(fd_allowed)(ARG1, "inotify_rm_watch", tid, False)) { + SET_STATUS_Failure( VKI_EBADF ); + } + // PJF I don't think that this can be AT_FDCWD + if (!ML_(fd_allowed)(ARG2, "inotify_rm_watch", tid, False)) { + SET_STATUS_Failure( VKI_EBADF ); + } +} #undef PRE #undef POST @@ -7768,6 +7812,10 @@ const SyscallTableEntry ML_(syscall_table)[] = { BSDX_(__NR_fchroot, sys_fchroot), // 590 BSDX_(__NR_setcred, sys_setcred), // 591 + BSDX_(__NR_exterrctl, sys_exterrctl), // 592 + BSDX_(__NR_inotify_add_watch_at, sys_inotify_add_watch_at), // 593 + BSDX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 593 + BSDX_(__NR_fake_sigreturn, sys_fake_sigreturn), // 1000, fake sigreturn }; diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h index a92abb9a1..a15140285 100644 --- a/include/vki/vki-scnums-freebsd.h +++ b/include/vki/vki-scnums-freebsd.h @@ -630,6 +630,10 @@ #define __NR_fchroot 590 #define __NR_setcred 591 +#define __NR_exterrctl 592 +#define __NR_inotify_add_watch_at 593 +#define __NR_inotify_rm_watch 594 + #define __NR_fake_sigreturn 1000 #endif /* VKI_UNISTD_FREEBSD_H */ diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index bae3d943b..ce76ffdb2 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -2479,6 +2479,59 @@ int main(void) FAKE_SY("\n"); #endif +#if defined(SYS_exterrctl) + GO(SYS_exterrctl, "3s, 1m"); + SY(SYS_exterrctl, x0, x0+1, x0+1); +#else + FAKE_GO("592: SYS_exterrctl 3s, 1m"); + FAKE_SY("Syscall param exterrctl(op) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param exterrctl(flags) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param exterrctl(ptr) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param exterrctl(ptr) points to unaddressable byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\ Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); + FAKE_SY("\n"); +#endif + +#if defined(SYS_inotify_add_watch_at) + GO(SYS_inotify_add_watch_at, "3s, 1m"); + SY(SYS_inotify_add_watch_at, x0, x0+1, x0+1); +#else + FAKE_GO("593:SYS_inotify_add_watch_at 3s, 1m"); + FAKE_SY("Syscall param inotify_add_watch_at(fd) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param inotify_add_watch_at(dfd) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param inotify_add_watch_at(path) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param inotify_add_watch_at(path) points to unaddressable byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); + FAKE_SY("\n"); +#endif + +#if defined(SYS_inotify_rm_watch) + GO(SYS_inotify_rm_watch, "2s, 0m"); + SY(SYS_inotify_rm_watch, x0+1000, x0+1000); +#else + FAKE_GO("594: SYS_inotify_rm_watch 2s, 0m"); + FAKE_SY("Syscall param sys_inotify_rm_watch(fd) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param sys_inotify_rm_watch(wd) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); +#endif + /* SYS_exit 1 */ GO(SYS_exit, "1s 0m"); SY(SYS_exit, x0); FAIL; diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index ae8adcd1b..dbe79c6e8 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -5746,6 +5746,47 @@ Syscall param setcred(wcred) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +592: SYS_exterrctl 3s, 1m +--------------------------------------------------------- +Syscall param exterrctl(op) contains uninitialised byte(s) + ... + +Syscall param exterrctl(flags) contains uninitialised byte(s) + ... + +Syscall param exterrctl(ptr) contains uninitialised byte(s) + ... + +Syscall param exterrctl(ptr) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +--------------------------------------------------------- +593:SYS_inotify_add_watch_at 3s, 1m +--------------------------------------------------------- +Syscall param inotify_add_watch_at(fd) contains uninitialised byte(s) + ... + +Syscall param inotify_add_watch_at(dfd) contains uninitialised byte(s) + ... + +Syscall param inotify_add_watch_at(path) contains uninitialised byte(s) + ... + +Syscall param inotify_add_watch_at(path) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +--------------------------------------------------------- +594: SYS_inotify_rm_watch 2s, 0m +--------------------------------------------------------- +Syscall param sys_inotify_rm_watch(fd) contains uninitialised byte(s) + ... + +Syscall param sys_inotify_rm_watch(wd) contains uninitialised byte(s) + ... + --------------------------------------------------------- 1: SYS_exit 1s 0m --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 47beb3dce..ea5abb9c6 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -5818,6 +5818,47 @@ Syscall param setcred(wcred) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +592: SYS_exterrctl 3s, 1m +--------------------------------------------------------- +Syscall param exterrctl(op) contains uninitialised byte(s) + ... + +Syscall param exterrctl(flags) contains uninitialised byte(s) + ... + +Syscall param exterrctl(ptr) contains uninitialised byte(s) + ... + +Syscall param exterrctl(ptr) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +--------------------------------------------------------- +593:SYS_inotify_add_watch_at 3s, 1m +--------------------------------------------------------- +Syscall param inotify_add_watch_at(fd) contains uninitialised byte(s) + ... + +Syscall param inotify_add_watch_at(dfd) contains uninitialised byte(s) + ... + +Syscall param inotify_add_watch_at(path) contains uninitialised byte(s) + ... + +Syscall param inotify_add_watch_at(path) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +--------------------------------------------------------- +594: SYS_inotify_rm_watch 2s, 0m +--------------------------------------------------------- +Syscall param sys_inotify_rm_watch(fd) contains uninitialised byte(s) + ... + +Syscall param sys_inotify_rm_watch(wd) contains uninitialised byte(s) + ... + --------------------------------------------------------- 1: SYS_exit 1s 0m --------------------------------------------------------- From b72dac4e4c0f52e0074794aa91464b54ddf87d77 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 13 Jul 2025 00:31:26 +0200 Subject: [PATCH 101/412] ltp-excludes.txt: Add tests that use unsupported clone flags Add clone08, close_range02 and kcmp03. --- auxprogs/ltp-excludes.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/auxprogs/ltp-excludes.txt b/auxprogs/ltp-excludes.txt index 3b52dab8c..b03111e20 100644 --- a/auxprogs/ltp-excludes.txt +++ b/auxprogs/ltp-excludes.txt @@ -24,3 +24,8 @@ fcntl34 fcntl34_64 fcntl36 fcntl36_64 +# Tests fail because valgrind only supports a limited number +# of clone flags. +clone08 +close_range02 +kcmp03 From a223c042d48601381e8045ab13fb9ab3396a3545 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 13 Jul 2025 10:47:04 +0200 Subject: [PATCH 102/412] Reformat wcpncpy in vg_replace_strmem.c --- shared/vg_replace_strmem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c index 71f15c85f..6fed7a2f2 100644 --- a/shared/vg_replace_strmem.c +++ b/shared/vg_replace_strmem.c @@ -2386,9 +2386,9 @@ static inline void my_exit ( int x ) /*---------------------- wcpncpy ----------------------*/ - // This is a wchar_t equivalent to strncpy. We don't - // have wchar_t available here, but in the GNU C Library - // wchar_t is always 32 bits wide. + // This is a wchar_t equivalent to strncpy. We don't + // have wchar_t available here, but in the GNU C Library + // wchar_t is always 32 bits wide. #define WCPNCPY(soname, fnname) \ Int* VG_REPLACE_FUNCTION_EZU(20500,soname,fnname) \ @@ -2420,7 +2420,7 @@ static inline void my_exit ( int x ) *dst++ = 0; \ } \ \ - return dst_orig + (src - src_orig); \ + return dst_orig + (src - src_orig); \ } #if defined(VGO_linux) || defined(VGO_freebsd) || defined(VGO_solaris) From 5e119bbb53d3a7f7a64d6368624594d9da4f82bb Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 14 Jul 2025 11:42:28 +0200 Subject: [PATCH 103/412] Add VEX/useful/vec to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 19c2a9300..767b3044b 100644 --- a/.gitignore +++ b/.gitignore @@ -2525,6 +2525,9 @@ none/tests/freebsd/bug499212 # /VEX/switchback/ /VEX/switchback/switchback +# /VEX/useful/ +/VEX/useful/vex + *.vgtest*.trs *.vgtest*.log /test-suite-overall.log From e2029bca2b45470a084f2ac4c3e1e3d07cd4c99e Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 14 Jul 2025 10:21:44 +0000 Subject: [PATCH 104/412] iropt-test: Reorder IROps. --- none/tests/iropt-test/irops.tab | 58 +++++++++++++++++---------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index a849289cd..b22434dab 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -79,6 +79,36 @@ // { OPNAME(128to64), Ity_I64, 1, Ity_I128, }, // 128 bit // { OPNAME(128HIto64), Ity_I64, 1, Ity_I128, }, // 128 bit + { OPNAME(CmpNEZ8), Ity_I1, 1, Ity_I8 }, +// { OPNAME(CmpNEZ16), Ity_I1, 1, Ity_I16 }, // no folding yet + { OPNAME(CmpNEZ32), Ity_I1, 1, Ity_I32 }, + { OPNAME(CmpNEZ64), Ity_I1, 1, Ity_I64 }, + + { OPNAME(CmpwNEZ32), Ity_I32, 1, Ity_I32 }, + { OPNAME(CmpwNEZ64), Ity_I64, 1, Ity_I64 }, + +// { OPNAME(Left8), Ity_I8, 1, Ity_I8 }, // no folding yet +// { OPNAME(Left16), Ity_I16, 1, Ity_I16 }, // no folding yet + { OPNAME(Left32), Ity_I32, 1, Ity_I32 }, + { OPNAME(Left64), Ity_I64, 1, Ity_I64 }, + +// { OPNAME(Clz32), Ity_I32, 1, Ity_I32 }, // deprecated, undefined behaviour +// { OPNAME(Clz64), Ity_I64, 1, Ity_I64 }, // deprecated, undefined behaviour + +// { OPNAME(Ctz32), Ity_I32, 1, Ity_I32 }, // deprecated, undefined behaviour +// { OPNAME(Ctz64), Ity_I64, 1, Ity_I64 }, // deprecated, undefined behaviour + +// { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32 }, // no folding yet +// { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64 }, // no folding yet + +// { OPNAME(CtzNat32), Ity_I32, 1, Ity_I32 }, // no folding yet +// { OPNAME(CtzNat64), Ity_I64, 1, Ity_I64 }, // no folding yet + +// { OPNAME(PopCount32), Ity_I32, 1, Ity_I32 }, // no folding yet +// { OPNAME(PopCount64), Ity_I64, 1, Ity_I64 }, // no folding yet + + + // BINARY { OPNAME(Add8), Ity_I8, 2, Ity_I8, Ity_I8 }, // { OPNAME(Add16), Ity_I16, 2, Ity_I16, Ity_I16 }, // no folding yet @@ -210,36 +240,8 @@ { OPNAME(CmpORD32S), Ity_I32, 2, Ity_I32, Ity_I32 }, // { OPNAME(CmpORD64S), Ity_I64, 2, Ity_I64, Ity_I64 }, // no folding yet - { OPNAME(CmpNEZ8), Ity_I1, 1, Ity_I8 }, -// { OPNAME(CmpNEZ16), Ity_I1, 1, Ity_I16 }, // no folding yet - { OPNAME(CmpNEZ32), Ity_I1, 1, Ity_I32 }, - { OPNAME(CmpNEZ64), Ity_I1, 1, Ity_I64 }, - - { OPNAME(CmpwNEZ32), Ity_I32, 1, Ity_I32 }, - { OPNAME(CmpwNEZ64), Ity_I64, 1, Ity_I64 }, - -// { OPNAME(Left8), Ity_I8, 1, Ity_I8 }, // no folding yet -// { OPNAME(Left16), Ity_I16, 1, Ity_I16 }, // no folding yet - { OPNAME(Left32), Ity_I32, 1, Ity_I32 }, - { OPNAME(Left64), Ity_I64, 1, Ity_I64 }, - { OPNAME(Max32U), Ity_I32, 2, Ity_I32, Ity_I32 }, -// { OPNAME(Clz32), Ity_I32, 1, Ity_I32 }, // deprecated, undefined behaviour -// { OPNAME(Clz64), Ity_I64, 1, Ity_I64 }, // deprecated, undefined behaviour - -// { OPNAME(Ctz32), Ity_I32, 1, Ity_I32 }, // deprecated, undefined behaviour -// { OPNAME(Ctz64), Ity_I64, 1, Ity_I64 }, // deprecated, undefined behaviour - -// { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32 }, // no folding yet -// { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64 }, // no folding yet - -// { OPNAME(CtzNat32), Ity_I32, 1, Ity_I32 }, // no folding yet -// { OPNAME(CtzNat64), Ity_I64, 1, Ity_I64 }, // no folding yet - -// { OPNAME(PopCount32), Ity_I32, 1, Ity_I32 }, // no folding yet -// { OPNAME(PopCount64), Ity_I64, 1, Ity_I64 }, // no folding yet - // { OPNAME(8HLto16), Ity_I16, 2, Ity_I8, Ity_I8 }, // no folding yet // { OPNAME(16HLto32), Ity_I32, 2, Ity_I16, Ity_I16 }, // no folding yet { OPNAME(32HLto64), Ity_I64, 2, Ity_I32, Ity_I32 }, From 1831258a9ec588dd921327d56708e93a08456f32 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 14 Jul 2025 13:11:01 +0000 Subject: [PATCH 105/412] Enable folding for Iop_Left8/16 In iropt-test add independent implementation of the "Left" operator for checking purposes. --- VEX/priv/ir_opt.c | 16 +++++++++++ none/tests/iropt-test/irops.tab | 4 +-- none/tests/iropt-test/unary.c | 49 ++++++++++++++++++++++++--------- 3 files changed, 54 insertions(+), 15 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 9a3f39c2c..52b8e0957 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1633,6 +1633,22 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) break; } + case Iop_Left8: { + UChar u8 = e->Iex.Unop.arg->Iex.Const.con->Ico.U8; + Char s8 = (Char)(u8 & 0xFF); + s8 = (s8 | (-s8)); + e2 = IRExpr_Const( IRConst_U8( (UChar)s8 )); + break; + } + + case Iop_Left16: { + UShort u16 = e->Iex.Unop.arg->Iex.Const.con->Ico.U16; + Short s16 = (Short)(u16 & 0xFFFF); + s16 = (s16 | (-s16)); + e2 = IRExpr_Const( IRConst_U16( (UShort)s16 )); + break; + } + case Iop_Left32: { UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32; Int s32 = (Int)(u32 & 0xFFFFFFFF); diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index b22434dab..45b0e728c 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -87,8 +87,8 @@ { OPNAME(CmpwNEZ32), Ity_I32, 1, Ity_I32 }, { OPNAME(CmpwNEZ64), Ity_I64, 1, Ity_I64 }, -// { OPNAME(Left8), Ity_I8, 1, Ity_I8 }, // no folding yet -// { OPNAME(Left16), Ity_I16, 1, Ity_I16 }, // no folding yet + { OPNAME(Left8), Ity_I8, 1, Ity_I8 }, + { OPNAME(Left16), Ity_I16, 1, Ity_I16 }, { OPNAME(Left32), Ity_I32, 1, Ity_I32 }, { OPNAME(Left64), Ity_I64, 1, Ity_I64 }, diff --git a/none/tests/iropt-test/unary.c b/none/tests/iropt-test/unary.c index 51ad51505..537c29a72 100644 --- a/none/tests/iropt-test/unary.c +++ b/none/tests/iropt-test/unary.c @@ -28,6 +28,7 @@ static void check_result(const irop_t *, const test_data_t *); static void run_tests(const irop_t *, test_data_t *, unsigned, uint64_t *); +static uint64_t left(uint64_t, unsigned); void @@ -189,19 +190,10 @@ check_result(const irop_t *op, const test_data_t *data) case Iop_CmpwNEZ32: expected = opnd == 0 ? 0 : UINT32_MAX; break; case Iop_CmpwNEZ64: expected = opnd == 0 ? 0 : UINT64_MAX; break; -// case Iop_Left8: -// case Iop_Left16: - case Iop_Left32: { - int32_t opnd_s = (int32_t)opnd; - expected = (opnd_s | -opnd_s) & UINT32_MAX; - break; - } - - case Iop_Left64: { - int64_t opnd_s = (int64_t)opnd; - expected = (opnd_s | -opnd_s) & UINT64_MAX; - break; - } + case Iop_Left8: expected = left(opnd, 8); break; + case Iop_Left16: expected = left(opnd, 16); break; + case Iop_Left32: expected = left(opnd, 32); break; + case Iop_Left64: expected = left(opnd, 64); break; default: panic("%s: operator %s not handled\n", __func__, op->name); @@ -227,3 +219,34 @@ check_result(const irop_t *op, const test_data_t *data) if (! ok) complain(op, data, expected); } + + +/* An implementation for Iop_Left/8/16/32/64. + The semantics of those operators are defined in Section 2.5 of + https://valgrind.org/docs/memcheck2005.pdf as follows: + + Iop_Left(v) is the same as v, except that all bits to the left of the + rightmost 1-bit in v are set. */ +static uint64_t +left(uint64_t val, unsigned width) +{ + uint64_t ret = 0; + + /* Find the rightmost 1-bit, then sign-extend. */ + for (unsigned bit = 0; bit < width; ++bit) { + if (val & ((uint64_t)1 << bit)) { + ret = (int64_t)((uint64_t)val << (63 - bit)) >> (63 - bit); + break; + } + } + + /* Truncate to desired width */ + switch (width) { + case 8: return ret & UINT8_MAX; + case 16: return ret & UINT16_MAX; + case 32: return ret & UINT32_MAX; + case 64: return ret & UINT64_MAX; + default: + panic(__func__); + } +} From ca10852231e27b430588c51c8d0d492e054f4f37 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 14 Jul 2025 16:32:06 +0000 Subject: [PATCH 106/412] Add folding for Iop_PopCount32/64 and Iop_CmpNEZ16 (BZ 506211) Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- VEX/priv/ir_opt.c | 42 +++++++++++++++++++++++++++++++++ none/tests/iropt-test/irops.tab | 6 ++--- none/tests/iropt-test/unary.c | 21 ++++++++++++++++- 3 files changed, 65 insertions(+), 4 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 52b8e0957..f0458cb28 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1346,6 +1346,31 @@ static UInt fold_Clz32 ( UInt value ) return 0; } +/* Helpers for folding PopCount32/64. + https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan + As many iterations as 1-bits present. +*/ +static UInt fold_PopCount64 ( ULong value ) +{ + UInt count; + + for (count = 0; value != 0; ++count) { + value &= value - 1; // clear the least significant 1-bit + } + return count; +} + +static UInt fold_PopCount32 ( UInt value ) +{ + UInt count; + + for (count = 0; value != 0; ++count) { + value &= value - 1; // clear the least significant 1-bit + } + return count; +} + + /* V64 holds 8 summary-constant bits in V128/V256 style. Convert to the corresponding real constant. */ //XXX re-check this before use @@ -1604,6 +1629,12 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) (0xFF & e->Iex.Unop.arg->Iex.Const.con->Ico.U8) ))); break; + case Iop_CmpNEZ16: + e2 = IRExpr_Const(IRConst_U1(toBool( + 0 != + (0xFFFF & e->Iex.Unop.arg->Iex.Const.con->Ico.U16) + ))); + break; case Iop_CmpNEZ32: e2 = IRExpr_Const(IRConst_U1(toBool( 0 != @@ -1678,6 +1709,17 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) break; } + case Iop_PopCount32: { + UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32; + e2 = IRExpr_Const(IRConst_U32(fold_PopCount32(u32))); + break; + } + case Iop_PopCount64: { + ULong u64 = e->Iex.Unop.arg->Iex.Const.con->Ico.U64; + e2 = IRExpr_Const(IRConst_U64(fold_PopCount64(u64))); + break; + } + /* For these vector ones, can't fold all cases, but at least do the most obvious one. Could do better here using summarise/desummarise of vector constants, but too diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index 45b0e728c..e73ec46a8 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -80,7 +80,7 @@ // { OPNAME(128HIto64), Ity_I64, 1, Ity_I128, }, // 128 bit { OPNAME(CmpNEZ8), Ity_I1, 1, Ity_I8 }, -// { OPNAME(CmpNEZ16), Ity_I1, 1, Ity_I16 }, // no folding yet + { OPNAME(CmpNEZ16), Ity_I1, 1, Ity_I16 }, { OPNAME(CmpNEZ32), Ity_I1, 1, Ity_I32 }, { OPNAME(CmpNEZ64), Ity_I1, 1, Ity_I64 }, @@ -104,8 +104,8 @@ // { OPNAME(CtzNat32), Ity_I32, 1, Ity_I32 }, // no folding yet // { OPNAME(CtzNat64), Ity_I64, 1, Ity_I64 }, // no folding yet -// { OPNAME(PopCount32), Ity_I32, 1, Ity_I32 }, // no folding yet -// { OPNAME(PopCount64), Ity_I64, 1, Ity_I64 }, // no folding yet + { OPNAME(PopCount32), Ity_I32, 1, Ity_I32 }, + { OPNAME(PopCount64), Ity_I64, 1, Ity_I64 }, diff --git a/none/tests/iropt-test/unary.c b/none/tests/iropt-test/unary.c index 537c29a72..44af3203d 100644 --- a/none/tests/iropt-test/unary.c +++ b/none/tests/iropt-test/unary.c @@ -29,6 +29,7 @@ static void check_result(const irop_t *, const test_data_t *); static void run_tests(const irop_t *, test_data_t *, unsigned, uint64_t *); static uint64_t left(uint64_t, unsigned); +static uint32_t popcount(uint64_t); void @@ -181,7 +182,7 @@ check_result(const irop_t *op, const test_data_t *data) case Iop_64HIto32: expected = opnd >> 32; break; case Iop_CmpNEZ8: -// case Iop_CmpNEZ16: + case Iop_CmpNEZ16: case Iop_CmpNEZ32: case Iop_CmpNEZ64: expected = opnd != 0; @@ -195,6 +196,11 @@ check_result(const irop_t *op, const test_data_t *data) case Iop_Left32: expected = left(opnd, 32); break; case Iop_Left64: expected = left(opnd, 64); break; + case Iop_PopCount32: + case Iop_PopCount64: + expected = popcount(opnd); + break; + default: panic("%s: operator %s not handled\n", __func__, op->name); } @@ -250,3 +256,16 @@ left(uint64_t val, unsigned width) panic(__func__); } } + + +/* Naive implementation of counting 1-bits */ +static uint32_t +popcount(uint64_t value) +{ + uint32_t count; + + for (count = 0; value != 0; value >>= 1) { + count += value & 1; + } + return count; +} From 2ddc8484eb7905b6badfe5288c375d38a06aae89 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 14 Jul 2025 20:48:34 +0200 Subject: [PATCH 107/412] Solaris gitignore: wildcard diff files --- .gitignore | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 767b3044b..69e182f75 100644 --- a/.gitignore +++ b/.gitignore @@ -1105,7 +1105,7 @@ /memcheck/tests/amd64-linux/Makefile.in # /memcheck/tests/amd64-solaris/ -/memcheck/tests/amd64-solaris/*.stderr.diff +/memcheck/tests/amd64-solaris/*.stderr.diff* /memcheck/tests/amd64-solaris/*.stderr.out /memcheck/tests/amd64-solaris/*.stdout.diff /memcheck/tests/amd64-solaris/*.stdout.out @@ -1274,7 +1274,7 @@ /memcheck/tests/s390x/vstrs # /memcheck/tests/solaris/ -/memcheck/tests/solaris/*.stderr.diff +/memcheck/tests/solaris/*.stderr.diff* /memcheck/tests/solaris/*.stderr.out /memcheck/tests/solaris/*.stdout.diff /memcheck/tests/solaris/*.stdout.out @@ -1392,7 +1392,7 @@ /memcheck/tests/x86-linux/shm # /memcheck/tests/x86-solaris/ -/memcheck/tests/x86-solaris/*.stderr.diff +/memcheck/tests/x86-solaris/*.stderr.diff* /memcheck/tests/x86-solaris/*.stderr.out /memcheck/tests/x86-solaris/*.stdout.diff /memcheck/tests/x86-solaris/*.stdout.out @@ -1793,11 +1793,11 @@ /none/tests/amd64-linux/map_32bits # /none/tests/amd64-solaris/ -/none/tests/amd64-solaris/*.stderr.diff +/none/tests/amd64-solaris/*.stderr.diff* /none/tests/amd64-solaris/*.stderr.out /none/tests/amd64-solaris/*.stdout.diff /none/tests/amd64-solaris/*.stdout.out -/none/tests/amd64-solaris/*.post.diff +/none/tests/amd64-solaris/*.post.diff* /none/tests/amd64-solaris/*.post.out /none/tests/amd64-solaris/.deps /none/tests/amd64-solaris/Makefile @@ -2434,11 +2434,11 @@ none/tests/freebsd/bug499212 /none/tests/x86-linux/sigcontext # /none/tests/x86-solaris/ -/none/tests/x86-solaris/*.stderr.diff +/none/tests/x86-solaris/*.stderr.diff* /none/tests/x86-solaris/*.stderr.out /none/tests/x86-solaris/*.stdout.diff /none/tests/x86-solaris/*.stdout.out -/none/tests/x86-solaris/*.post.diff +/none/tests/x86-solaris/*.post.diff* /none/tests/x86-solaris/*.post.out /none/tests/x86-solaris/.deps /none/tests/x86-solaris/Makefile From 806abab0557a53546d9498926f699fd679b9f0f1 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 14 Jul 2025 23:23:23 +0200 Subject: [PATCH 108/412] Reject any attempt to set the handler for SIGKILL/STOP Even though resetting SIGKILL or SIGSTOP to SIG_DFL would be a noop it isn't allowed. Just always return EINVAL if an attempt is made to set the signal handler for SIGKILL or SIGSTOP. There is an LTP test for this signal01. https://bugs.kde.org/show_bug.cgi?id=506930 --- NEWS | 1 + coregrind/m_signals.c | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 73488cbc1..49403da01 100644 --- a/NEWS +++ b/NEWS @@ -54,6 +54,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 502968 Wrap linux specific syscalls 457 (listmount) and 458 (statmount) 506499 Unhandled syscall 592 (exterrctl - FreeBSD 506795 Better report which clone flags are problematic +506930 valgrind allows SIGKILL being reset to SIG_DFL To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index f0e6b8e7c..cccbb5683 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -1317,10 +1317,8 @@ SysRes VG_(do_sys_sigaction) ( Int signo, || new_act->ksa_handler == VKI_SIG_IGN) ) goto bad_signo_reserved; - /* Reject attempts to set a handler (or set ignore) for SIGKILL. */ - if ( (signo == VKI_SIGKILL || signo == VKI_SIGSTOP) - && new_act - && new_act->ksa_handler != VKI_SIG_DFL) + /* Reject any attempt to set the handler for SIGKILL/STOP. */ + if ( (signo == VKI_SIGKILL || signo == VKI_SIGSTOP) && new_act ) goto bad_sigkill_or_sigstop; /* If the client supplied non-NULL old_act, copy the relevant SCSS From 969bccaaca7aab2614def013ac1f37de37fbce86 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 15 Jul 2025 00:00:44 +0200 Subject: [PATCH 109/412] Handle SIGSYS and SIGSTKFLT when defined Both signals were already partially handled. But calculate_SKSS_from_SCSS only handled SIGSYS on freebsd. default_action didn't handle SIGSTKFLT. And sync_signalhandler didn't expect to have to handle SIGSYS. This fixes LTP tests kill11 and waitpid01. https://bugs.kde.org/show_bug.cgi?id=506890 --- coregrind/m_signals.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index cccbb5683..523f4d7fc 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -855,7 +855,7 @@ void calculate_SKSS_from_SCSS ( SKSS* dst ) case VKI_SIGFPE: case VKI_SIGILL: case VKI_SIGTRAP: -#if defined(VGO_freebsd) +#if defined(VKI_SIGSYS) case VKI_SIGSYS: #endif /* For these, we always want to catch them and report, even @@ -1832,6 +1832,9 @@ static void default_action(const vki_siginfo_t *info, ThreadId tid) case VKI_SIGPIPE: /* term */ case VKI_SIGALRM: /* term */ case VKI_SIGTERM: /* term */ +# if defined(VKI_SIGSTKFLT) + case VKI_SIGSTKFLT: /* term */ +# endif case VKI_SIGUSR1: /* term */ case VKI_SIGUSR2: /* term */ case VKI_SIGIO: /* term */ @@ -3004,6 +3007,9 @@ void sync_signalhandler ( Int sigNo, || sigNo == VKI_SIGBUS || sigNo == VKI_SIGFPE || sigNo == VKI_SIGILL +#if defined(VKI_SIGSYS) + || sigNo == VKI_SIGSYS +#endif || sigNo == VKI_SIGTRAP); info->si_code = sanitize_si_code(info->si_code); From cad20f3e7d42e6371896e2492f0fc3a081314238 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 15 Jul 2025 23:49:36 +0200 Subject: [PATCH 110/412] Support mmap MAP_FIXED_NOREPLACE if defined Define VKI_MAP_FIXED_NOREPLACE for amd64-linux, arm-linux, arm64-linux, mips32-linux, mips64-linux, riscv64-linux and x86-linux. If it is defined then ML_(generic_PRE_sys_mmap) will also interpret VKI_MAP_FIXED_NOREPLACE as an MFixed hint. If the aspace manager doesn't find a MAP_FIXED_NOREPLACE ok, then fail with EEXIST. If the actual kernel mmap request fails and MAP_FIXED_NOREPLACE is set also immediately fail with EEXIST without retrying. This fixes the LTP mmap17 testcase. https://bugs.kde.org/show_bug.cgi?id=418756 --- NEWS | 3 ++- coregrind/m_syswrap/syswrap-generic.c | 19 ++++++++++++++++++- include/vki/vki-amd64-linux.h | 1 + include/vki/vki-arm-linux.h | 1 + include/vki/vki-arm64-linux.h | 1 + include/vki/vki-mips32-linux.h | 1 + include/vki/vki-mips64-linux.h | 1 + include/vki/vki-riscv64-linux.h | 1 + include/vki/vki-x86-linux.h | 1 + 9 files changed, 27 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 49403da01..796d9716e 100644 --- a/NEWS +++ b/NEWS @@ -29,8 +29,8 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. -506076 unimplemented fcntl command: 1028 (F_CREATED_QUERY) 338803 Handling of dwz debug alt files or cross-CU is broken +418756 MAP_FIXED_NOREPLACE mmap flag unsupported 493434 Add --track-fds=bad mode (no "leak" tracking) 503098 Incorrect NAN-boxing for float registers in RISC-V 503641 close_range syscalls started failing with 3.25.0 @@ -52,6 +52,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. AMD64_GET_TLSBASE 505228 Wrap linux specific mseal syscall 502968 Wrap linux specific syscalls 457 (listmount) and 458 (statmount) +506076 unimplemented fcntl command: 1028 (F_CREATED_QUERY) 506499 Unhandled syscall 592 (exterrctl - FreeBSD 506795 Better report which clone flags are problematic 506930 valgrind allows SIGKILL being reset to SIG_DFL diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 50deb1e76..50415a2fa 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -2678,7 +2678,12 @@ ML_(generic_PRE_sys_mmap) ( ThreadId tid, (fixed/hint/any), and ask aspacem what we should do. */ mreq.start = arg1; mreq.len = arg2; - if (arg4 & VKI_MAP_FIXED) { + if ((arg4 & VKI_MAP_FIXED) +#if defined(VKI_MAP_FIXED_NOREPLACE) + || (arg4 & VKI_MAP_FIXED_NOREPLACE) +#endif + ) + { mreq.rkind = MFixed; } else #if defined(VGO_solaris) && defined(VKI_MAP_ALIGN) @@ -2710,6 +2715,11 @@ ML_(generic_PRE_sys_mmap) ( ThreadId tid, advised = VG_(am_get_advisory)( &mreq, True/*client*/, &mreq_ok ); if (!mreq_ok) { /* Our request was bounced, so we'd better fail. */ +#if defined(VKI_MAP_FIXED_NOREPLACE) + if (arg4 & VKI_MAP_FIXED_NOREPLACE) { + return VG_(mk_SysRes_Error)( VKI_EEXIST ); + } +#endif return VG_(mk_SysRes_Error)( VKI_EINVAL ); } @@ -2744,6 +2754,13 @@ ML_(generic_PRE_sys_mmap) ( ThreadId tid, } # endif +# if defined(VKI_MAP_FIXED_NOREPLACE) + /* FIXED_NOREPLACE is fatal, no retries. */ + if ((arg4 & VKI_MAP_FIXED_NOREPLACE) && sr_isError(sres)) { + return VG_(mk_SysRes_Error)( VKI_EEXIST ); + } +# endif + /* A refinement: it may be that the kernel refused aspacem's choice of address. If we were originally asked for a hinted mapping, there is still a last chance: try again at any address. diff --git a/include/vki/vki-amd64-linux.h b/include/vki/vki-amd64-linux.h index 12cd65ac7..bbcf4ab4e 100644 --- a/include/vki/vki-amd64-linux.h +++ b/include/vki/vki-amd64-linux.h @@ -236,6 +236,7 @@ struct vki_sigcontext { #define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */ #define VKI_MAP_32BIT 0x40 /* only give out 32bit addresses */ #define VKI_MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */ //---------------------------------------------------------------------- // From linux-2.6.9/include/asm-x86_64/fcntl.h diff --git a/include/vki/vki-arm-linux.h b/include/vki/vki-arm-linux.h index 7e0001c0c..a72268ca4 100644 --- a/include/vki/vki-arm-linux.h +++ b/include/vki/vki-arm-linux.h @@ -233,6 +233,7 @@ struct vki_sigcontext { #define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */ #define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */ #define VKI_MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */ //---------------------------------------------------------------------- // From linux-2.6.8.1/include/asm-i386/fcntl.h diff --git a/include/vki/vki-arm64-linux.h b/include/vki/vki-arm64-linux.h index 2fc97e614..1b005c775 100644 --- a/include/vki/vki-arm64-linux.h +++ b/include/vki/vki-arm64-linux.h @@ -215,6 +215,7 @@ struct vki_sigcontext { #define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */ #define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */ #define VKI_MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */ //---------------------------------------------------------------------- // From linux-3.10.5/uapi/include/asm-generic/fcntl.h diff --git a/include/vki/vki-mips32-linux.h b/include/vki/vki-mips32-linux.h index 2d752e2cc..584b5dd72 100644 --- a/include/vki/vki-mips32-linux.h +++ b/include/vki/vki-mips32-linux.h @@ -300,6 +300,7 @@ struct vki_sigcontext { #define VKI_MAP_LOCKED 0x8000 /* pages are locked */ #define VKI_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ #define VKI_MAP_NONBLOCK 0x20000 /* do not block on IO */ +#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */ //---------------------------------------------------------------------- diff --git a/include/vki/vki-mips64-linux.h b/include/vki/vki-mips64-linux.h index 527b0dae6..9171b6fb0 100644 --- a/include/vki/vki-mips64-linux.h +++ b/include/vki/vki-mips64-linux.h @@ -306,6 +306,7 @@ struct vki_sigcontext { #define VKI_MAP_LOCKED 0x8000 /* pages are locked */ #define VKI_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ #define VKI_MAP_NONBLOCK 0x20000 /* do not block on IO */ +#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */ //---------------------------------------------------------------------- // From linux-2.6.35.9/include/asm-mips/fcntl.h diff --git a/include/vki/vki-riscv64-linux.h b/include/vki/vki-riscv64-linux.h index 5cc98b6ab..0ad826c02 100644 --- a/include/vki/vki-riscv64-linux.h +++ b/include/vki/vki-riscv64-linux.h @@ -186,6 +186,7 @@ typedef struct vki_sigaltstack { //---------------------------------------------------------------------- #define VKI_MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */ //---------------------------------------------------------------------- // From linux-6.0/include/uapi/linux/mman.h diff --git a/include/vki/vki-x86-linux.h b/include/vki/vki-x86-linux.h index 5a5f9e5d8..d00de22b4 100644 --- a/include/vki/vki-x86-linux.h +++ b/include/vki/vki-x86-linux.h @@ -271,6 +271,7 @@ struct vki_sigcontext { #define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */ #define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */ #define VKI_MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */ //---------------------------------------------------------------------- // From linux-2.6.8.1/include/asm-i386/fcntl.h From 9000b0e5540c98f80cceb341423d24b1f5200722 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 16 Jul 2025 07:09:37 +0200 Subject: [PATCH 111/412] Change [a]sync_sighandler to [a]sync_signalhandler in comments and in one "if (0)" VG_(printf). --- coregrind/m_signals.c | 4 ++-- coregrind/m_syswrap/syswrap-main.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index 523f4d7fc..a51840c0a 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -178,7 +178,7 @@ else if thread is blocked in a syscall marked SfMayBlock - then signals may be delivered to async_sighandler, since we + then signals may be delivered to async_signalhandler, since we temporarily unblocked them for the duration of the syscall, by using the real (SCSS) mask for this thread @@ -2999,7 +2999,7 @@ void sync_signalhandler ( Int sigNo, Bool from_user; if (0) - VG_(printf)("sync_sighandler(%d, %p, %p)\n", sigNo, info, uc); + VG_(printf)("sync_signalhandler(%d, %p, %p)\n", sigNo, info, uc); vg_assert(info != NULL); vg_assert(info->si_signo == sigNo); diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c index 1a7f038d4..5919698f0 100644 --- a/coregrind/m_syswrap/syswrap-main.c +++ b/coregrind/m_syswrap/syswrap-main.c @@ -2512,7 +2512,7 @@ void VG_(client_syscall) ( ThreadId tid, UInt trc ) /* do_syscall_for_client may not return if the syscall was interrupted by a signal. In that case, flow of control is - first to m_signals.async_sighandler, which calls + first to m_signals.async_signalhandler, which calls VG_(fixup_guest_state_after_syscall_interrupted), which fixes up the guest state, and possibly calls VG_(post_syscall). Once that's done, control drops back @@ -2723,9 +2723,9 @@ void VG_(post_syscall) (ThreadId tid) However, the syscall may get interrupted by an async-signal. In that case do_syscall_for_client/VG_(do_syscall6) do not - return. Instead we wind up in m_signals.async_sighandler. We need + return. Instead we wind up in m_signals.async_signalhandler. We need to fix up the guest state to make it look like the syscall was - interrupted for guest. So async_sighandler calls here, and this + interrupted for guest. So async_signalhandler calls here, and this does the fixup. Note that from here we wind up calling VG_(post_syscall) too. */ From 21bc095a32ad715a5857d11111703a34eca62b79 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 16 Jul 2025 11:51:15 +0000 Subject: [PATCH 112/412] iropt-test: Also test with random inputs; reorg the code a bit New utility functions: get_random_value and get_selected_values Add command line option -rNUM to specify the number of random tests per operator. --- none/tests/iropt-test/binary.c | 116 +++++++++++++----------- none/tests/iropt-test/iropt-test.vgtest | 3 +- none/tests/iropt-test/main.c | 9 +- none/tests/iropt-test/unary.c | 74 +++++++-------- none/tests/iropt-test/util.c | 55 +++++++++++ none/tests/iropt-test/vtest.h | 3 + 6 files changed, 163 insertions(+), 97 deletions(-) diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c index c3f36c188..ec4fa21d1 100644 --- a/none/tests/iropt-test/binary.c +++ b/none/tests/iropt-test/binary.c @@ -27,90 +27,96 @@ #include "vtest.h" static void check_result(const irop_t *, const test_data_t *); -static void run_tests(const irop_t *, test_data_t *, unsigned, uint64_t *, - unsigned, uint64_t *); +static void run_tests(const irop_t *, test_data_t *); +static void run_shift_tests(const irop_t *, test_data_t *); static int is_shift_op(IROp); void test_binary_op(const irop_t *op, test_data_t *data) { - opnd_t *opnd_l = &data->opnds[0]; - - switch (opnd_l->type) { - case Ity_I1: { - uint64_t values[] = { 0, 1 }; - - run_tests(op, data, NUM_EL(values), values, NUM_EL(values), values); - break; - } + if (is_shift_op(op->op)) + run_shift_tests(op, data); + else + run_tests(op, data); +} - case Ity_I8: { - uint64_t values[] = { 0, 1, 2, UINT8_MAX - 1, UINT8_MAX }; - uint64_t shifts[] = { 0, 1, 2, 6, 7 }; - if (is_shift_op(op->op)) - run_tests(op, data, NUM_EL(values), values, NUM_EL(shifts), shifts); - else - run_tests(op, data, NUM_EL(values), values, NUM_EL(values), values); - break; - } +static void +run_selected_tests(const irop_t *op, test_data_t *data) +{ + opnd_t *opnd_l = &data->opnds[0]; + opnd_t *opnd_r = &data->opnds[1]; + unsigned num_val_l, num_val_r; + const uint64_t *values_l = get_selected_values(opnd_l->type, &num_val_l); + const uint64_t *values_r = get_selected_values(opnd_r->type, &num_val_r); - case Ity_I16: { - uint64_t values[] = { 0, 1, 2, UINT16_MAX - 1, UINT16_MAX }; - uint64_t shifts[] = { 0, 1, 2, 14, 15 }; + for (unsigned i = 0; i < num_val_l; ++i) { + opnd_l->value = values_l[i]; + for (unsigned j = 0; j < num_val_r; ++j) { + opnd_r->value = values_r[j]; - if (is_shift_op(op->op)) - run_tests(op, data, NUM_EL(values), values, NUM_EL(shifts), shifts); - else - run_tests(op, data, NUM_EL(values), values, NUM_EL(values), values); - break; + valgrind_execute_test(op, data); + check_result(op, data); + } } +} - case Ity_I32: { - uint64_t values[] = { 0, 1, 2, UINT32_MAX - 1, UINT32_MAX }; - uint64_t shifts[] = { 0, 1, 2, 30, 31 }; - - if (is_shift_op(op->op)) - run_tests(op, data, NUM_EL(values), values, NUM_EL(shifts), shifts); - else - run_tests(op, data, NUM_EL(values), values, NUM_EL(values), values); - break; - } - case Ity_I64: { - uint64_t values[] = { 0, 1, 2, UINT64_MAX - 1, UINT64_MAX }; - uint64_t shifts[] = { 0, 1, 2, 62, 63 }; +/* Test with pseudo-random numbers */ +static void +run_random_tests(const irop_t *op, test_data_t *data) +{ + opnd_t *opnd_l = &data->opnds[0]; + opnd_t *opnd_r = &data->opnds[1]; - if (is_shift_op(op->op)) - run_tests(op, data, NUM_EL(values), values, NUM_EL(shifts), shifts); - else - run_tests(op, data, NUM_EL(values), values, NUM_EL(values), values); - break; - } + for (unsigned i = 0; i < num_random_tests; ++i) { + opnd_l->value = get_random_value(opnd_l->type); + opnd_r->value = get_random_value(opnd_r->type); - default: - panic(__func__); + valgrind_execute_test(op, data); + check_result(op, data); } } +/* OP is a shift operator. */ static void -run_tests(const irop_t *op, test_data_t *data, unsigned num_val_l, - uint64_t *values_l, unsigned num_val_r, uint64_t *values_r) +run_shift_tests(const irop_t *op, test_data_t *data) { opnd_t *opnd_l = &data->opnds[0]; opnd_t *opnd_r = &data->opnds[1]; + unsigned num_shiftee; + const uint64_t *shiftee = get_selected_values(opnd_l->type, &num_shiftee); + unsigned max_shift_amount = bitsof_irtype(opnd_r->type) - 1; - for (unsigned i = 0; i < num_val_l; ++i) { - opnd_l->value = values_l[i]; - for (unsigned j = 0; j < num_val_r; ++j) { - opnd_r->value = values_r[j]; + /* Shift selected values with all possible shift amounts */ + for (unsigned i = 0; i < num_shiftee; ++i) { + opnd_l->value = shiftee[i]; + for (unsigned j = 0; j < max_shift_amount; ++j) { + opnd_r->value = j; valgrind_execute_test(op, data); check_result(op, data); } } + + /* Shift random values with random shift amounts */ + for (unsigned i = 0; i < num_random_tests; ++i) { + opnd_l->value = get_random_value(opnd_l->type); + opnd_r->value = get_random_value(opnd_r->type) & max_shift_amount; + + valgrind_execute_test(op, data); + check_result(op, data); + } +} + + +static void +run_tests(const irop_t *op, test_data_t *data) +{ + run_selected_tests(op, data); + run_random_tests(op, data); } diff --git a/none/tests/iropt-test/iropt-test.vgtest b/none/tests/iropt-test/iropt-test.vgtest index 8becafdf8..de31de604 100644 --- a/none/tests/iropt-test/iropt-test.vgtest +++ b/none/tests/iropt-test/iropt-test.vgtest @@ -1,4 +1,5 @@ prog: iropt-test -#args: -v -v +#args: -v -v -r10 +args: -r100 vgopts: -q --vex-guest-chase=no diff --git a/none/tests/iropt-test/main.c b/none/tests/iropt-test/main.c index 28b8d23e4..2622515e5 100644 --- a/none/tests/iropt-test/main.c +++ b/none/tests/iropt-test/main.c @@ -38,18 +38,23 @@ static void check_irops_table(void); static test_data_t *new_test_data(const irop_t *); int verbose = 0; +unsigned num_random_tests; int main(int argc, char *argv[]) { assert(sizeof(long long) == 8); + assert(RAND_MAX == INT32_MAX); for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-v") == 0) ++verbose; - else if (strcmp(argv[i], "--help") == 0) { + else if (strncmp(argv[i], "-r", 2) == 0) { + num_random_tests = atoi(argv[i] + 2); + } else if (strcmp(argv[i], "--help") == 0) { printf("\niropt-test [ -v | --help ]\n"); + printf("\n\t -rNUM number of random tests per IRop\n"); printf("\n\t -v verbose mode; shows IROps being tested\n"); printf("\n\t -v -v verbose mode, extreme edition\n\n"); return 0; @@ -72,7 +77,7 @@ main(int argc, char *argv[]) const irop_t *op = irops +i; if (verbose) - printf("\nTesting operator %s\n", op->name); + printf("Testing operator %s\n", op->name); test_data_t *data = new_test_data(op); diff --git a/none/tests/iropt-test/unary.c b/none/tests/iropt-test/unary.c index 44af3203d..bb2613848 100644 --- a/none/tests/iropt-test/unary.c +++ b/none/tests/iropt-test/unary.c @@ -23,11 +23,13 @@ */ #include // printf +#include // rand #include // UINT64_MAX #include "vtest.h" static void check_result(const irop_t *, const test_data_t *); -static void run_tests(const irop_t *, test_data_t *, unsigned, uint64_t *); +static void run_selected_tests(const irop_t *, test_data_t *); +static void run_random_tests(const irop_t *, test_data_t *); static uint64_t left(uint64_t, unsigned); static uint32_t popcount(uint64_t); @@ -38,47 +40,25 @@ test_unary_op(const irop_t *op, test_data_t *data) opnd_t *opnd = &data->opnds[0]; switch (opnd->type) { - case Ity_I1: { - uint64_t values[] = { 0, 1 }; - - run_tests(op, data, NUM_EL(values), values); - break; - } - + case Ity_I1: case Ity_I8: { - uint64_t values[] = { 0, 1, 2, UINT8_MAX - 1, UINT8_MAX }; - - run_tests(op, data, NUM_EL(values), values); - break; - } - - case Ity_I16: { - uint64_t values[] = { 0, 1, 2, UINT16_MAX - 1, UINT16_MAX, - /* and for the benefit of Iop_16HIto8: */ - 1 << 8, 2 << 8, UINT8_MAX << 8 - }; - - run_tests(op, data, NUM_EL(values), values); - break; - } - - case Ity_I32: { - uint64_t values[] = { 0, 1, 2, UINT32_MAX - 1, UINT32_MAX, - /* and for the benefit of Iop_32HIto16: */ - 1 << 16, 2 << 16, (uint64_t)UINT16_MAX << 16 - }; - run_tests(op, data, NUM_EL(values), values); + /* Exhaustive */ + unsigned max = (1 << bitsof_irtype(opnd->type)) - 1; + for (unsigned i = 0; i <= max; ++i) { + opnd->value = i; + + valgrind_execute_test(op, data); + check_result(op, data); + } break; } - case Ity_I64: { - uint64_t values[] = { 0, 1, 2, UINT64_MAX - 1, UINT64_MAX, - /* and for the benefit of Iop_64HIto32: */ - (uint64_t)1 << 32, (uint64_t)2 << 32, (uint64_t)UINT32_MAX << 32 - }; - run_tests(op, data, NUM_EL(values), values); + case Ity_I16: + case Ity_I32: + case Ity_I64: + run_selected_tests(op, data); + run_random_tests(op, data); break; - } default: panic(__func__); @@ -87,10 +67,11 @@ test_unary_op(const irop_t *op, test_data_t *data) static void -run_tests(const irop_t *op, test_data_t *data, unsigned num_val, - uint64_t *values) +run_selected_tests(const irop_t *op, test_data_t *data) { opnd_t *opnd = &data->opnds[0]; + unsigned num_val; + const uint64_t *values = get_selected_values(opnd->type, &num_val); for (unsigned i = 0; i < num_val; ++i) { opnd->value = values[i]; @@ -101,6 +82,21 @@ run_tests(const irop_t *op, test_data_t *data, unsigned num_val, } +/* Test with pseudo-random numbers */ +static void +run_random_tests(const irop_t *op, test_data_t *data) +{ + opnd_t *opnd = &data->opnds[0]; + + for (unsigned i = 0; i < num_random_tests; ++i) { + opnd->value = get_random_value(opnd->type); + + valgrind_execute_test(op, data); + check_result(op, data); + } +} + + /* Check the result of a unary operation. */ static void check_result(const irop_t *op, const test_data_t *data) diff --git a/none/tests/iropt-test/util.c b/none/tests/iropt-test/util.c index 80e58570f..072ff90c3 100644 --- a/none/tests/iropt-test/util.c +++ b/none/tests/iropt-test/util.c @@ -104,3 +104,58 @@ bitsof_irtype(IRType ty) panic(__func__); } } + + +uint64_t +get_random_value(IRType type) +{ + uint64_t val = rand(); + + switch (type) { + case Ity_I1: return val & 0x1; + case Ity_I8: return val & UINT8_MAX; + case Ity_I16: return val & UINT16_MAX; + case Ity_I32: return val & UINT32_MAX; + case Ity_I64: + /* Note, that RAND_MAX == INT32_MAX. Therefore, simply concatenating + two rand() values would never produce a value with MSB == 1 */ + val <<= (32 + 1); + val |= rand() << 1; + val |= rand() & 0x1; + return val; + + default: + panic(__func__); + } +} + + +const uint64_t * +get_selected_values(IRType type, unsigned *num_val) +{ + static const uint64_t values_1bit[] = { 0, 1 }; + static const uint64_t values_8bit[] = { 0, 1, 2, + UINT8_MAX - 1, UINT8_MAX }; + static const uint64_t values_16bit[] = { 0, 1, 2, + UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1, + UINT16_MAX - 1, UINT16_MAX }; + static const uint64_t values_32bit[] = { 0, 1, 2, + UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1, + UINT16_MAX - 1, UINT16_MAX, UINT16_MAX + 1, + UINT32_MAX - 1, UINT32_MAX }; + static const uint64_t values_64bit[] = { 0, 1, 2, + UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1, + UINT16_MAX - 1, UINT16_MAX, UINT16_MAX + 1, + UINT32_MAX - 1, UINT32_MAX, UINT32_MAX + 1, + UINT64_MAX - 1, UINT64_MAX }; + + switch (type) { + case Ity_I1: *num_val = NUM_EL(values_1bit); return values_1bit; + case Ity_I8: *num_val = NUM_EL(values_8bit); return values_8bit; + case Ity_I16: *num_val = NUM_EL(values_16bit); return values_16bit; + case Ity_I32: *num_val = NUM_EL(values_32bit); return values_32bit; + case Ity_I64: *num_val = NUM_EL(values_64bit); return values_64bit; + default: + panic(__func__); + } +} diff --git a/none/tests/iropt-test/vtest.h b/none/tests/iropt-test/vtest.h index d9c1ddaae..47b397f68 100644 --- a/none/tests/iropt-test/vtest.h +++ b/none/tests/iropt-test/vtest.h @@ -84,8 +84,11 @@ void panic(const char *, ...) __attribute__((noreturn)); void complain(const irop_t *, const test_data_t *, uint64_t expected); unsigned bitsof_irtype(IRType); +uint64_t get_random_value(IRType); +const uint64_t *get_selected_values(IRType, unsigned *); /* Exported variables */ extern int verbose; +extern unsigned num_random_tests; #endif // VTEST_H From c164cf37aca7661f76440e14d817dcfeb4c4fc82 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 16 Jul 2025 14:54:44 +0000 Subject: [PATCH 113/412] Constant folding for Iop_ClzNat32/64. (BZ 506211) Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- VEX/priv/ir_opt.c | 30 ++++++++++++++++++++++++++++++ none/tests/iropt-test/irops.tab | 4 ++-- none/tests/iropt-test/unary.c | 18 ++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index f0458cb28..140899480 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1346,6 +1346,25 @@ static UInt fold_Clz32 ( UInt value ) return 0; } +/* Helpers for folding ClzNat32/64. */ +static UInt fold_ClzNat64 ( ULong value ) +{ + UInt i; + for (i = 0; i < 64; ++i) { + if (0ULL != (value & (((ULong)1) << (63 - i)))) return i; + } + return 64; +} + +static UInt fold_ClzNat32 ( UInt value ) +{ + UInt i; + for (i = 0; i < 32; ++i) { + if (0 != (value & (((UInt)1) << (31 - i)))) return i; + } + return 32; +} + /* Helpers for folding PopCount32/64. https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan As many iterations as 1-bits present. @@ -1709,6 +1728,17 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) break; } + case Iop_ClzNat32: { + UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32; + e2 = IRExpr_Const(IRConst_U32(fold_ClzNat32(u32))); + break; + } + case Iop_ClzNat64: { + ULong u64 = e->Iex.Unop.arg->Iex.Const.con->Ico.U64; + e2 = IRExpr_Const(IRConst_U64(fold_ClzNat64(u64))); + break; + } + case Iop_PopCount32: { UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32; e2 = IRExpr_Const(IRConst_U32(fold_PopCount32(u32))); diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index e73ec46a8..1d06919d1 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -98,8 +98,8 @@ // { OPNAME(Ctz32), Ity_I32, 1, Ity_I32 }, // deprecated, undefined behaviour // { OPNAME(Ctz64), Ity_I64, 1, Ity_I64 }, // deprecated, undefined behaviour -// { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32 }, // no folding yet -// { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64 }, // no folding yet + { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32 }, + { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64 }, // { OPNAME(CtzNat32), Ity_I32, 1, Ity_I32 }, // no folding yet // { OPNAME(CtzNat64), Ity_I64, 1, Ity_I64 }, // no folding yet diff --git a/none/tests/iropt-test/unary.c b/none/tests/iropt-test/unary.c index bb2613848..6d664a1b8 100644 --- a/none/tests/iropt-test/unary.c +++ b/none/tests/iropt-test/unary.c @@ -32,6 +32,7 @@ static void run_selected_tests(const irop_t *, test_data_t *); static void run_random_tests(const irop_t *, test_data_t *); static uint64_t left(uint64_t, unsigned); static uint32_t popcount(uint64_t); +static uint32_t clz(uint64_t, unsigned); void @@ -197,6 +198,9 @@ check_result(const irop_t *op, const test_data_t *data) expected = popcount(opnd); break; + case Iop_ClzNat32: expected = clz(opnd, 32); break; + case Iop_ClzNat64: expected = clz(opnd, 64); break; + default: panic("%s: operator %s not handled\n", __func__, op->name); } @@ -265,3 +269,17 @@ popcount(uint64_t value) } return count; } + + +static uint32_t +clz(uint64_t value, unsigned num_bits) +{ + unsigned last_seen_1bit = 0; + + for (int i = 1; i <= num_bits; ++i) { + if (value & 0x1) + last_seen_1bit = i; + value >>= 1; + } + return num_bits - last_seen_1bit; +} From 0593738843903c7c2d6299bf2a47f63ebc08e947 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 16 Jul 2025 17:43:34 +0000 Subject: [PATCH 114/412] Constant folding for Iop_CtzNat32/64. (BZ 506211) Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- VEX/priv/ir_opt.c | 35 +++++++++++++++++++++++++++++++++ none/tests/iropt-test/irops.tab | 4 ++-- none/tests/iropt-test/unary.c | 23 ++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 140899480..c37ff08a7 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1365,6 +1365,30 @@ static UInt fold_ClzNat32 ( UInt value ) return 32; } +/* Helpers for folding CtzNat32/64. */ +static UInt fold_CtzNat_WRK ( ULong value, UInt num_bits ) +{ + UInt count = 0; + + for (UInt i = 1; i <= num_bits; ++i) { + if (value & 0x1) + return count; + value >>= 1; + ++count; + } + return count; +} + +static UInt fold_CtzNat64 ( ULong value ) +{ + return fold_CtzNat_WRK(value, 64); +} + +static UInt fold_CtzNat32 ( UInt value ) +{ + return fold_CtzNat_WRK(value, 32); +} + /* Helpers for folding PopCount32/64. https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan As many iterations as 1-bits present. @@ -1739,6 +1763,17 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) break; } + case Iop_CtzNat32: { + UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32; + e2 = IRExpr_Const(IRConst_U32(fold_CtzNat32(u32))); + break; + } + case Iop_CtzNat64: { + ULong u64 = e->Iex.Unop.arg->Iex.Const.con->Ico.U64; + e2 = IRExpr_Const(IRConst_U64(fold_CtzNat64(u64))); + break; + } + case Iop_PopCount32: { UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32; e2 = IRExpr_Const(IRConst_U32(fold_PopCount32(u32))); diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index 1d06919d1..02afa6423 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -101,8 +101,8 @@ { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32 }, { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64 }, -// { OPNAME(CtzNat32), Ity_I32, 1, Ity_I32 }, // no folding yet -// { OPNAME(CtzNat64), Ity_I64, 1, Ity_I64 }, // no folding yet + { OPNAME(CtzNat32), Ity_I32, 1, Ity_I32 }, + { OPNAME(CtzNat64), Ity_I64, 1, Ity_I64 }, { OPNAME(PopCount32), Ity_I32, 1, Ity_I32 }, { OPNAME(PopCount64), Ity_I64, 1, Ity_I64 }, diff --git a/none/tests/iropt-test/unary.c b/none/tests/iropt-test/unary.c index 6d664a1b8..e6554cef6 100644 --- a/none/tests/iropt-test/unary.c +++ b/none/tests/iropt-test/unary.c @@ -33,6 +33,7 @@ static void run_random_tests(const irop_t *, test_data_t *); static uint64_t left(uint64_t, unsigned); static uint32_t popcount(uint64_t); static uint32_t clz(uint64_t, unsigned); +static uint32_t ctz(uint64_t, unsigned); void @@ -201,6 +202,9 @@ check_result(const irop_t *op, const test_data_t *data) case Iop_ClzNat32: expected = clz(opnd, 32); break; case Iop_ClzNat64: expected = clz(opnd, 64); break; + case Iop_CtzNat32: expected = ctz(opnd, 32); break; + case Iop_CtzNat64: expected = ctz(opnd, 64); break; + default: panic("%s: operator %s not handled\n", __func__, op->name); } @@ -283,3 +287,22 @@ clz(uint64_t value, unsigned num_bits) } return num_bits - last_seen_1bit; } + + +static uint32_t +ctz(uint64_t value, unsigned num_bits ) +{ + unsigned count = 0; + unsigned num_nibbles = num_bits / 4; + + for (unsigned i = 0; i < num_nibbles; ++i) { + UInt nibble = value & 0xF; + if ((nibble & 0x1) == 0x1) return count; + if ((nibble & 0x2) == 0x2) return count + 1; + if ((nibble & 0x4) == 0x4) return count + 2; + if ((nibble & 0x8) == 0x8) return count + 3; + count += 4; + value >>= 4; + } + return count; +} From 943e7070f3b8dd6f903779640f4f75db6b972e83 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 16 Jul 2025 20:01:54 +0000 Subject: [PATCH 115/412] Constant folding for various binary IRops. (BZ 506211) Iop_Add16, Iop_Sub16, Iop_CmpEQ8/16, Iop_CasCmpEQ8/16/32/64, Iop_CmpNE16, Iop_CasCmpNE16, Iop_ExpCmpNE16 Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- VEX/priv/ir_opt.c | 31 +++++++++++++++++++++++++++++++ none/tests/iropt-test/binary.c | 14 +++++++------- none/tests/iropt-test/irops.tab | 22 +++++++++++----------- 3 files changed, 49 insertions(+), 18 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index c37ff08a7..91b266aa1 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2019,6 +2019,11 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8 + e->Iex.Binop.arg2->Iex.Const.con->Ico.U8)))); break; + case Iop_Add16: + e2 = IRExpr_Const(IRConst_U16(toUShort( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16 + + e->Iex.Binop.arg2->Iex.Const.con->Ico.U16)))); + break; case Iop_Add32: e2 = IRExpr_Const(IRConst_U32( (e->Iex.Binop.arg1->Iex.Const.con->Ico.U32 @@ -2036,6 +2041,11 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8 - e->Iex.Binop.arg2->Iex.Const.con->Ico.U8)))); break; + case Iop_Sub16: + e2 = IRExpr_Const(IRConst_U16(toUShort( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16 + - e->Iex.Binop.arg2->Iex.Const.con->Ico.U16)))); + break; case Iop_Sub32: e2 = IRExpr_Const(IRConst_U32( (e->Iex.Binop.arg1->Iex.Const.con->Ico.U32 @@ -2153,12 +2163,26 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } /* -- CmpEQ -- */ + case Iop_CmpEQ8: + case Iop_CasCmpEQ8: + e2 = IRExpr_Const(IRConst_U1(toBool( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8 + == e->Iex.Binop.arg2->Iex.Const.con->Ico.U8)))); + break; + case Iop_CmpEQ16: + case Iop_CasCmpEQ16: + e2 = IRExpr_Const(IRConst_U1(toBool( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16 + == e->Iex.Binop.arg2->Iex.Const.con->Ico.U16)))); + break; case Iop_CmpEQ32: + case Iop_CasCmpEQ32: e2 = IRExpr_Const(IRConst_U1(toBool( (e->Iex.Binop.arg1->Iex.Const.con->Ico.U32 == e->Iex.Binop.arg2->Iex.Const.con->Ico.U32)))); break; case Iop_CmpEQ64: + case Iop_CasCmpEQ64: e2 = IRExpr_Const(IRConst_U1(toBool( (e->Iex.Binop.arg1->Iex.Const.con->Ico.U64 == e->Iex.Binop.arg2->Iex.Const.con->Ico.U64)))); @@ -2172,6 +2196,13 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) ((0xFF & e->Iex.Binop.arg1->Iex.Const.con->Ico.U8) != (0xFF & e->Iex.Binop.arg2->Iex.Const.con->Ico.U8))))); break; + case Iop_CmpNE16: + case Iop_CasCmpNE16: + case Iop_ExpCmpNE16: + e2 = IRExpr_Const(IRConst_U1(toBool( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16 + != e->Iex.Binop.arg2->Iex.Const.con->Ico.U16)))); + break; case Iop_CmpNE32: case Iop_CasCmpNE32: case Iop_ExpCmpNE32: diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c index ec4fa21d1..894213a56 100644 --- a/none/tests/iropt-test/binary.c +++ b/none/tests/iropt-test/binary.c @@ -199,23 +199,23 @@ check_result(const irop_t *op, const test_data_t *data) case Iop_CmpEQ16: case Iop_CmpEQ32: case Iop_CmpEQ64: -// case Iop_CasCmpEQ8: -// case Iop_CasCmpEQ16: -// case Iop_CasCmpEQ32: -// case Iop_CasCmpEQ64: + case Iop_CasCmpEQ8: + case Iop_CasCmpEQ16: + case Iop_CasCmpEQ32: + case Iop_CasCmpEQ64: expected = opnd_l == opnd_r; break; case Iop_CmpNE8: -// case Iop_CmpNE16: + case Iop_CmpNE16: case Iop_CmpNE32: case Iop_CmpNE64: case Iop_CasCmpNE8: -// case Iop_CasCmpNE16: + case Iop_CasCmpNE16: case Iop_CasCmpNE32: case Iop_CasCmpNE64: case Iop_ExpCmpNE8: -// case Iop_ExpCmpNE16: + case Iop_ExpCmpNE16: case Iop_ExpCmpNE32: case Iop_ExpCmpNE64: expected = opnd_l != opnd_r; diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index 02afa6423..a9f57a4ce 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -111,12 +111,12 @@ // BINARY { OPNAME(Add8), Ity_I8, 2, Ity_I8, Ity_I8 }, -// { OPNAME(Add16), Ity_I16, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(Add16), Ity_I16, 2, Ity_I16, Ity_I16 }, { OPNAME(Add32), Ity_I32, 2, Ity_I32, Ity_I32 }, { OPNAME(Add64), Ity_I64, 2, Ity_I64, Ity_I64 }, { OPNAME(Sub8), Ity_I8, 2, Ity_I8, Ity_I8 }, -// { OPNAME(Sub16), Ity_I16, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(Sub16), Ity_I16, 2, Ity_I16, Ity_I16 }, { OPNAME(Sub32), Ity_I32, 2, Ity_I32, Ity_I32 }, { OPNAME(Sub64), Ity_I64, 2, Ity_I64, Ity_I64 }, @@ -197,13 +197,13 @@ { OPNAME(Xor32), Ity_I32, 2, Ity_I32, Ity_I32 }, { OPNAME(Xor64), Ity_I64, 2, Ity_I64, Ity_I64 }, -// { OPNAME(CmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8 }, // no folding yet -// { OPNAME(CmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(CmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8 }, + { OPNAME(CmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16 }, { OPNAME(CmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32 }, { OPNAME(CmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64 }, { OPNAME(CmpNE8), Ity_I1, 2, Ity_I8, Ity_I8 }, -// { OPNAME(CmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(CmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, { OPNAME(CmpNE32), Ity_I1, 2, Ity_I32, Ity_I32 }, { OPNAME(CmpNE64), Ity_I1, 2, Ity_I64, Ity_I64 }, @@ -219,18 +219,18 @@ { OPNAME(CmpLE32S), Ity_I1, 2, Ity_I32, Ity_I32 }, { OPNAME(CmpLE64S), Ity_I1, 2, Ity_I64, Ity_I64 }, -// { OPNAME(CasCmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8 }, // no folding yet -// { OPNAME(CasCmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16 }, // no folding yet -// { OPNAME(CasCmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32 }, // no folding yet -// { OPNAME(CasCmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64 }, // no folding yet + { OPNAME(CasCmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8 }, + { OPNAME(CasCmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16 }, + { OPNAME(CasCmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32 }, + { OPNAME(CasCmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64 }, { OPNAME(CasCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8 }, -// { OPNAME(CasCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(CasCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, { OPNAME(CasCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32 }, { OPNAME(CasCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64 }, { OPNAME(ExpCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8 }, -// { OPNAME(ExpCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(ExpCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, { OPNAME(ExpCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32 }, { OPNAME(ExpCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64 }, From 92b886de45265ca15e87f67d4245d77f292de80e Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 17 Jul 2025 07:04:03 +0000 Subject: [PATCH 116/412] Constant folding for Iop_Shl8/16, Iop_Shr8/16 and Iop_Sar8/16. (BZ 506211) Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- VEX/priv/ir_opt.c | 56 +++++++++++++++++++++++++++++++++ none/tests/iropt-test/binary.c | 16 +++++++--- none/tests/iropt-test/irops.tab | 12 +++---- 3 files changed, 73 insertions(+), 11 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 91b266aa1..4653704d3 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2093,6 +2093,22 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } /* -- Shl -- */ + case Iop_Shl8: + vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8); + shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8; + if (shift >= 0 && shift <= 7) + e2 = IRExpr_Const(IRConst_U8(toUChar( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8 + << shift)))); + break; + case Iop_Shl16: + vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8); + shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8; + if (shift >= 0 && shift <= 15) + e2 = IRExpr_Const(IRConst_U16(toUShort( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16 + << shift)))); + break; case Iop_Shl32: vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8); shift = (Int)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U8); @@ -2111,6 +2127,28 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) break; /* -- Sar -- */ + case Iop_Sar8: { + Int s8; + vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8); + s8 = (Char)(e->Iex.Binop.arg1->Iex.Const.con->Ico.U8); + shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8; + if (shift >= 0 && shift <= 7) { + s8 >>=/*signed*/ shift; + e2 = IRExpr_Const(IRConst_U8(toUChar(s8))); + } + break; + } + case Iop_Sar16: { + Int s16; + vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8); + s16 = (Short)(e->Iex.Binop.arg1->Iex.Const.con->Ico.U16); + shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8; + if (shift >= 0 && shift <= 15) { + s16 >>=/*signed*/ shift; + e2 = IRExpr_Const(IRConst_U16(toUShort(s16))); + } + break; + } case Iop_Sar32: { /* paranoid ... */ /*signed*/ Int s32; @@ -2137,6 +2175,24 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } /* -- Shr -- */ + case Iop_Shr8: { + vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8); + shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8; + if (shift >= 0 && shift <= 7) + e2 = IRExpr_Const(IRConst_U8(toUChar( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8 + >> shift)))); + break; + } + case Iop_Shr16: { + vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8); + shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8; + if (shift >= 0 && shift <= 15) + e2 = IRExpr_Const(IRConst_U16(toUShort( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16 + >> shift)))); + break; + } case Iop_Shr32: { /* paranoid ... */ /*unsigned*/ UInt u32; diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c index 894213a56..2c815c813 100644 --- a/none/tests/iropt-test/binary.c +++ b/none/tests/iropt-test/binary.c @@ -148,20 +148,26 @@ check_result(const irop_t *op, const test_data_t *data) expected = (int64_t)(int32_t)opnd_l * (int64_t)(int32_t)opnd_r; break; + case Iop_Shl8: + case Iop_Shl16: case Iop_Shl32: - expected = opnd_l << opnd_r; - break; - case Iop_Shl64: expected = opnd_l << opnd_r; break; + case Iop_Shr8: + case Iop_Shr16: case Iop_Shr32: + case Iop_Shr64: expected = opnd_l >> opnd_r; break; - case Iop_Shr64: - expected = opnd_l >> opnd_r; + case Iop_Sar8: + expected = ((int64_t)(opnd_l << 56) >> 56) >> opnd_r; + break; + + case Iop_Sar16: + expected = ((int64_t)(opnd_l << 48) >> 48) >> opnd_r; break; case Iop_Sar32: diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index a9f57a4ce..efae871fb 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -164,18 +164,18 @@ // { OPNAME(ModU128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit // { OPNAME(ModS128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit -// { OPNAME(Shl8), Ity_I8, 2, Ity_I8, Ity_I8 }, // no folding yet -// { OPNAME(Shl16), Ity_I16, 2, Ity_I16, Ity_I8 }, // no folding yet + { OPNAME(Shl8), Ity_I8, 2, Ity_I8, Ity_I8 }, + { OPNAME(Shl16), Ity_I16, 2, Ity_I16, Ity_I8 }, { OPNAME(Shl32), Ity_I32, 2, Ity_I32, Ity_I8 }, { OPNAME(Shl64), Ity_I64, 2, Ity_I64, Ity_I8 }, -// { OPNAME(Shr8), Ity_I8, 2, Ity_I8, Ity_I8 }, // no folding yet -// { OPNAME(Shr16), Ity_I16, 2, Ity_I16, Ity_I8 }, // no folding yet + { OPNAME(Shr8), Ity_I8, 2, Ity_I8, Ity_I8 }, + { OPNAME(Shr16), Ity_I16, 2, Ity_I16, Ity_I8 }, { OPNAME(Shr32), Ity_I32, 2, Ity_I32, Ity_I8 }, { OPNAME(Shr64), Ity_I64, 2, Ity_I64, Ity_I8 }, -// { OPNAME(Sar8), Ity_I8, 2, Ity_I8, Ity_I8 }, // no folding yet -// { OPNAME(Sar16), Ity_I16, 2, Ity_I16, Ity_I8 }, // no folding yet + { OPNAME(Sar8), Ity_I8, 2, Ity_I8, Ity_I8 }, + { OPNAME(Sar16), Ity_I16, 2, Ity_I16, Ity_I8 }, { OPNAME(Sar32), Ity_I32, 2, Ity_I32, Ity_I8 }, { OPNAME(Sar64), Ity_I64, 2, Ity_I64, Ity_I8 }, From bd1e857cd493f4d1e64c3f5ae1061650644c666b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 16 Jul 2025 02:45:39 +0200 Subject: [PATCH 117/412] Check mmap fd is valid, if used, and fail early with EBADF if not mmap should fail with EBADF if the given fd is bad (or used by valgrind itself) when used (flags does not contain MAP_ANONYMOUS). Check both with ML_(fd_allowed) (which might only warn) and fcntl (VKI_F_GETFD) to see if the file descriptor is valid. Fail early so the address space manager and the actual mmap call don't do unnecessary work (and might fail with a different error code). This fixes the LTP mmap08 testcase. https://bugs.kde.org/show_bug.cgi?id=506970 --- NEWS | 1 + coregrind/m_syswrap/syswrap-generic.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/NEWS b/NEWS index 796d9716e..868d4218f 100644 --- a/NEWS +++ b/NEWS @@ -56,6 +56,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506499 Unhandled syscall 592 (exterrctl - FreeBSD 506795 Better report which clone flags are problematic 506930 valgrind allows SIGKILL being reset to SIG_DFL +506970 mmap needs an EBADF fd_allowed check To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 50415a2fa..7ad280980 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -2653,6 +2653,17 @@ ML_(generic_PRE_sys_mmap) ( ThreadId tid, VG_(core_panic)("can't use ML_(generic_PRE_sys_mmap) on Darwin"); # endif + /* fd (arg4) is only used when flags (arg4) does not contain + MAP_ANONYMOUS. ML_(fd_allowed) might just warn (with --track-fds) + and not fail, unless it is a Valgrind owned file descriptor. + So also check with fcntl (F_GETFD) to know if it really is a bad + fd. Fail early in that case with EBADF. */ + if (!(arg4 & VKI_MAP_ANONYMOUS) + && (!ML_(fd_allowed)(arg5, "mmap", tid, False) + || VG_(fcntl) (arg5, VKI_F_GETFD, 0) < 0)) { + return VG_(mk_SysRes_Error)( VKI_EBADF ); + } + if (arg2 == 0) { /* SuSV3 says: If len is zero, mmap() shall fail and no mapping shall be established. */ From a4d893c6ef133fdf8255860aa8ca0a8460e105b1 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Thu, 17 Jul 2025 09:16:53 +0200 Subject: [PATCH 118/412] Wrap linux specific syscall 22 (ustat) The ustat syscall comes from pre-git linux history. It is deprecated in favor of statfs. But in some cases it may still be used. int ustat(dev_t dev, struct ustat *ubuf); returns information about a mounted filesystem. dev is a device number identifying a device containing a mounted filesystem. ubuf is a pointer to a ustat structure. Declare a sys_ustat wrapper in priv_syswrap-linux.h and hook it for {amd64,arm,arm64,mips64,nanomips,ppc32,ppc64,riscv64,\ s390x,x86}-linux using LINXY with PRE and POST handler in syswrap-linux.c https://bugs.kde.org/show_bug.cgi?id=506928 --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 1 + coregrind/m_syswrap/syswrap-amd64-linux.c | 2 +- coregrind/m_syswrap/syswrap-arm-linux.c | 2 +- coregrind/m_syswrap/syswrap-linux.c | 13 +++++++++++++ coregrind/m_syswrap/syswrap-mips32-linux.c | 2 +- coregrind/m_syswrap/syswrap-mips64-linux.c | 9 +-------- coregrind/m_syswrap/syswrap-ppc32-linux.c | 2 +- coregrind/m_syswrap/syswrap-ppc64-linux.c | 2 +- coregrind/m_syswrap/syswrap-s390x-linux.c | 2 +- coregrind/m_syswrap/syswrap-x86-linux.c | 2 +- include/vki/vki-linux.h | 19 +++++++++++++++++++ 12 files changed, 42 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index 868d4218f..e61b56baf 100644 --- a/NEWS +++ b/NEWS @@ -55,6 +55,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506076 unimplemented fcntl command: 1028 (F_CREATED_QUERY) 506499 Unhandled syscall 592 (exterrctl - FreeBSD 506795 Better report which clone flags are problematic +506928 Wrap (deprecated) linux specific ustat syscall 506930 valgrind allows SIGKILL being reset to SIG_DFL 506970 mmap needs an EBADF fd_allowed check diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 9e6cb8981..ce10a35f6 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -40,6 +40,7 @@ extern void ML_(call_on_new_stack_0_1) ( Addr stack, Addr retaddr, // Linux-specific (but non-arch-specific) syscalls +DECL_TEMPLATE(linux, sys_ustat); DECL_TEMPLATE(linux, sys_clone) DECL_TEMPLATE(linux, sys_mount); DECL_TEMPLATE(linux, sys_oldumount); diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 22989f9fa..c80286f00 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -633,7 +633,7 @@ static SyscallTableEntry syscall_table[] = { // (__NR_uselib, sys_uselib), // 134 LINX_(__NR_personality, sys_personality), // 135 - // (__NR_ustat, sys_ustat), // 136 + LINXY(__NR_ustat, sys_ustat), // 136 GENXY(__NR_statfs, sys_statfs), // 137 GENXY(__NR_fstatfs, sys_fstatfs), // 138 // (__NR_sysfs, sys_sysfs), // 139 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 7bd69b681..c5fb08dcc 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -621,7 +621,7 @@ static SyscallTableEntry syscall_main_table[] = { //zz GENX_(__NR_umask, sys_umask), // 60 GENX_(__NR_chroot, sys_chroot), // 61 -//zz // (__NR_ustat, sys_ustat) // 62 SVr4 -- deprecated + LINXY(__NR_ustat, sys_ustat), // 62 SVr4 -- deprecated GENXY(__NR_dup2, sys_dup2), // 63 GENX_(__NR_getppid, sys_getppid), // 64 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 306c3a2f8..bd563d989 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -14204,6 +14204,19 @@ POST(sys_userfaultfd) } } +PRE(sys_ustat) +{ + FUSE_COMPATIBLE_MAY_BLOCK(); + PRINT("sys_ustat ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG2); + PRE_REG_READ2(long, "ustat", __vki_u32, dev, struct vki_ustat *, ubuf); + PRE_MEM_WRITE( "ustat(ubuf)", ARG2, sizeof(struct vki_ustat) ); +} + +POST(sys_ustat) +{ + POST_MEM_WRITE( ARG2, sizeof(struct vki_ustat) ); +} + #undef PRE #undef POST diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 4e5e91e15..684bda4b9 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -826,7 +826,7 @@ static SyscallTableEntry syscall_main_table[] = { //.. // (__NR_oldolduname, sys_olduname), // 59 GENX_ (__NR_umask, sys_umask), // 60 GENX_ (__NR_chroot, sys_chroot), // 61 - //.. // (__NR_ustat, sys_ustat) // 62 + LINXY (__NR_ustat, sys_ustat), // 62 GENXY (__NR_dup2, sys_dup2), // 63 GENX_ (__NR_getppid, sys_getppid), // 64 GENX_ (__NR_getpgrp, sys_getpgrp), // 65 diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 67e5c0b37..8e2dcbe93 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -216,7 +216,6 @@ SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ) DECL_TEMPLATE (mips_linux, sys_set_thread_area); DECL_TEMPLATE (mips_linux, sys_vmsplice); -DECL_TEMPLATE (mips_linux, sys_ustat); DECL_TEMPLATE (mips_linux, sys_sysfs); DECL_TEMPLATE (mips_linux, sys_swapon); DECL_TEMPLATE (mips_linux, sys_swapoff); @@ -248,12 +247,6 @@ PRE(sys_sched_rr_get_interval) *flags |= SfMayBlock; } -PRE(sys_ustat) -{ - PRINT("sys_ustat ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG2); - PRE_REG_READ2(long, "ustat", int, flags, const void *, path); -} - PRE(sys_swapon) { PRINT("sys_swapon ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", ARG1, ARG2); @@ -649,7 +642,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_ (__NR_utime, sys_utime), GENX_ (__NR_mknod, sys_mknod), LINX_ (__NR_personality, sys_personality), - PLAX_ (__NR_ustat, sys_ustat), + LINXY (__NR_ustat, sys_ustat), GENXY (__NR_statfs, sys_statfs), GENXY (__NR_fstatfs, sys_fstatfs), PLAX_ (__NR_sysfs, sys_sysfs), diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index b5d45e109..d2b59786c 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -685,7 +685,7 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_umask, sys_umask), // 60 GENX_(__NR_chroot, sys_chroot), // 61 -//.. // (__NR_ustat, sys_ustat) // 62 SVr4 -- deprecated + LINXY(__NR_ustat, sys_ustat), // 62 SVr4 -- deprecated GENXY(__NR_dup2, sys_dup2), // 63 GENX_(__NR_getppid, sys_getppid), // 64 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 764fb557e..3d6c2e4ed 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -674,7 +674,7 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_umask, sys_umask), // 60 GENX_(__NR_chroot, sys_chroot), // 61 -// _____(__NR_ustat, sys_ustat), // 62 + LINXY(__NR_ustat, sys_ustat), // 62 GENXY(__NR_dup2, sys_dup2), // 63 GENX_(__NR_getppid, sys_getppid), // 64 diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index 8202c1922..65a26a02d 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -485,7 +485,7 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_umask, sys_umask), // 60 GENX_(__NR_chroot, sys_chroot), // 61 -// ?????(__NR_ustat, sys_ustat), /* deprecated in favor of statfs */ // 62 + LINXY(__NR_ustat, sys_ustat), /* deprecated in favor of statfs */ // 62 GENXY(__NR_dup2, sys_dup2), // 63 GENX_(__NR_getppid, sys_getppid), // 64 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 45216b45f..0b8373ffa 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1230,7 +1230,7 @@ static SyscallTableEntry syscall_table[] = { //zz GENX_(__NR_umask, sys_umask), // 60 GENX_(__NR_chroot, sys_chroot), // 61 -//zz // (__NR_ustat, sys_ustat) // 62 SVr4 -- deprecated + LINXY(__NR_ustat, sys_ustat), // 62 SVr4 -- deprecated GENXY(__NR_dup2, sys_dup2), // 63 GENX_(__NR_getppid, sys_getppid), // 64 diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index 8c919845b..c31035cbb 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -171,6 +171,25 @@ typedef struct { typedef int __vki_kernel_key_t; typedef int __vki_kernel_mqd_t; +//---------------------------------------------------------------------- +// From pre-git history /include/linux/types.h +//---------------------------------------------------------------------- + +struct vki_ustat { +#if defined(VGA_mips32) || defined(VGA_mips64) || defined(VGA_nanomips) + long f_tfree; +#else + int f_tfree; +#endif +#if defined(VGA_s390x) + unsigned int f_tinode; +#else + unsigned long f_tinode; +#endif + char f_fname[6]; + char f_fpack[6]; +}; + //---------------------------------------------------------------------- // From linux-2.6.8.1/include/linux/types.h //---------------------------------------------------------------------- From c84404c4f8ba52edd9bd3c68fae316510adc1a90 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 17 Jul 2025 12:23:22 +0000 Subject: [PATCH 119/412] Constant folding for Iop_CmpORD.. and Iop_8HLto16, Iop16HLto32. (BZ 506211) Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- VEX/priv/ir_opt.c | 56 +++++++++++++++++++++++++++++++++ none/tests/iropt-test/binary.c | 41 +++++++++++++++++++----- none/tests/iropt-test/irops.tab | 10 +++--- 3 files changed, 94 insertions(+), 13 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 4653704d3..8e4d95692 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2339,8 +2339,64 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) e2 = IRExpr_Const(IRConst_U32(r)); break; } + case Iop_CmpORD64S: { + /* very paranoid */ + ULong u64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64; + ULong u64b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U64; + Long s64a = (Long)u64a; + Long s64b = (Long)u64b; + Int r = 0x2; /* EQ */ + if (s64a < s64b) { + r = 0x8; /* LT */ + } + else if (s64a > s64b) { + r = 0x4; /* GT */ + } + e2 = IRExpr_Const(IRConst_U64(r)); + break; + } + case Iop_CmpORD32U: { + UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32; + UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32; + Int r = 0x2; /* EQ */ + if (u32a < u32b) { + r = 0x8; /* LT */ + } + else if (u32a > u32b) { + r = 0x4; /* GT */ + } + e2 = IRExpr_Const(IRConst_U32(r)); + break; + } + case Iop_CmpORD64U: { + ULong u64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64; + ULong u64b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U64; + Int r = 0x2; /* EQ */ + if (u64a < u64b) { + r = 0x8; /* LT */ + } + else if (u64a > u64b) { + r = 0x4; /* GT */ + } + e2 = IRExpr_Const(IRConst_U64(r)); + break; + } /* -- nHLto2n -- */ + case Iop_8HLto16: + e2 = IRExpr_Const(IRConst_U16(toUShort( + (((UInt)(e->Iex.Binop.arg1 + ->Iex.Const.con->Ico.U8)) << 8) + | ((UInt)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U8))) + )); + break; + case Iop_16HLto32: + e2 = IRExpr_Const(IRConst_U32( + (((UInt)(e->Iex.Binop.arg1 + ->Iex.Const.con->Ico.U16)) << 16) + | ((UInt)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U16)) + )); + break; case Iop_32HLto64: e2 = IRExpr_Const(IRConst_U64( (((ULong)(e->Iex.Binop.arg1 diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c index 2c815c813..1ec2d77e3 100644 --- a/none/tests/iropt-test/binary.c +++ b/none/tests/iropt-test/binary.c @@ -233,9 +233,11 @@ check_result(const irop_t *op, const test_data_t *data) break; case Iop_CmpLT32S: { - int32_t opnd_ls = (int32_t)(opnd_l & UINT32_MAX); - int32_t opnd_rs = (int32_t)(opnd_r & UINT32_MAX); - expected = opnd_ls < opnd_rs; + uint32_t u32l = opnd_l & UINT32_MAX; + uint32_t u32r = opnd_r & UINT32_MAX; + int32_t s32l = (int32_t)u32l; + int32_t s32r = (int32_t)u32r; + expected = s32l < s32r; break; } @@ -249,9 +251,11 @@ check_result(const irop_t *op, const test_data_t *data) break; case Iop_CmpLE32S: { - int32_t opnd_ls = (int32_t)(opnd_l & UINT32_MAX); - int32_t opnd_rs = (int32_t)(opnd_r & UINT32_MAX); - expected = opnd_ls <= opnd_rs; + uint32_t u32l = opnd_l & UINT32_MAX; + uint32_t u32r = opnd_r & UINT32_MAX; + int32_t s32l = (int32_t)u32l; + int32_t s32r = (int32_t)u32r; + expected = s32l <= s32r; break; } @@ -259,9 +263,22 @@ check_result(const irop_t *op, const test_data_t *data) expected = (int64_t)opnd_l <= (int64_t)opnd_r; break; + case Iop_CmpORD32U: + case Iop_CmpORD64U: + expected = (opnd_l < opnd_r) ? 8 : (opnd_l > opnd_r) ? 4 : 2; + break; + case Iop_CmpORD32S: { - int32_t opnd_ls = (int32_t)(opnd_l & UINT32_MAX); - int32_t opnd_rs = (int32_t)(opnd_r & UINT32_MAX); + uint32_t u32l = opnd_l & UINT32_MAX; + uint32_t u32r = opnd_r & UINT32_MAX; + int32_t s32l = (int32_t)u32l; + int32_t s32r = (int32_t)u32r; + expected = (s32l < s32r) ? 8 : (s32l > s32r) ? 4 : 2; + break; + } + case Iop_CmpORD64S: { + int64_t opnd_ls = (int64_t)opnd_l; + int64_t opnd_rs = (int64_t)opnd_r; expected = (opnd_ls < opnd_rs) ? 8 : (opnd_ls > opnd_rs) ? 4 : 2; break; } @@ -272,6 +289,14 @@ check_result(const irop_t *op, const test_data_t *data) expected = opnd_l > opnd_r ? opnd_l : opnd_r; break; + case Iop_8HLto16: + expected = (opnd_l << 8) | opnd_r; + break; + + case Iop_16HLto32: + expected = (opnd_l << 16) | opnd_r; + break; + case Iop_32HLto64: expected = (opnd_l << 32) | opnd_r; break; diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index efae871fb..68f8cc886 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -234,15 +234,15 @@ { OPNAME(ExpCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32 }, { OPNAME(ExpCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64 }, -// { OPNAME(CmpORD32U), Ity_I32, 2, Ity_I32, Ity_I32 }, // no folding yet -// { OPNAME(CmpORD64U), Ity_I64, 2, Ity_I64, Ity_I64 }, // no folding yet + { OPNAME(CmpORD32U), Ity_I32, 2, Ity_I32, Ity_I32 }, + { OPNAME(CmpORD64U), Ity_I64, 2, Ity_I64, Ity_I64 }, { OPNAME(CmpORD32S), Ity_I32, 2, Ity_I32, Ity_I32 }, -// { OPNAME(CmpORD64S), Ity_I64, 2, Ity_I64, Ity_I64 }, // no folding yet + { OPNAME(CmpORD64S), Ity_I64, 2, Ity_I64, Ity_I64 }, { OPNAME(Max32U), Ity_I32, 2, Ity_I32, Ity_I32 }, -// { OPNAME(8HLto16), Ity_I16, 2, Ity_I8, Ity_I8 }, // no folding yet -// { OPNAME(16HLto32), Ity_I32, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(8HLto16), Ity_I16, 2, Ity_I8, Ity_I8 }, + { OPNAME(16HLto32), Ity_I32, 2, Ity_I16, Ity_I16 }, { OPNAME(32HLto64), Ity_I64, 2, Ity_I32, Ity_I32 }, // { OPNAME(64HLto128), Ity_I128, 2, Ity_I64, Ity_I64 }, // 128 bit From a3b172bd1235f9b74736a7f12a4a4072037b7900 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 17 Jul 2025 14:04:50 +0000 Subject: [PATCH 120/412] Constant folding for various multiplication IROps. (BZ 506211) Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- VEX/priv/ir_opt.c | 57 +++++++++++++++++++++++++++++++++ none/tests/iropt-test/binary.c | 42 ++++++++++++++++++++++++ none/tests/iropt-test/irops.tab | 20 ++++++------ 3 files changed, 109 insertions(+), 10 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 8e4d95692..fa0b76a96 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2067,6 +2067,16 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } /* -- Mul -- */ + case Iop_Mul8: + e2 = IRExpr_Const(IRConst_U8(toUChar( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8 + * e->Iex.Binop.arg2->Iex.Const.con->Ico.U8)))); + break; + case Iop_Mul16: + e2 = IRExpr_Const(IRConst_U16(toUShort( + (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16 + * e->Iex.Binop.arg2->Iex.Const.con->Ico.U16)))); + break; case Iop_Mul32: e2 = IRExpr_Const(IRConst_U32( (e->Iex.Binop.arg1->Iex.Const.con->Ico.U32 @@ -2078,6 +2088,53 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) * e->Iex.Binop.arg2->Iex.Const.con->Ico.U64))); break; + case Iop_MullU8: { + UChar u8a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U8; + UChar u8b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8; + Int res = u8a * u8b; /* Compiler will promote to int */ + e2 = IRExpr_Const(IRConst_U16(toUShort(res))); + break; + } + case Iop_MullU16: { + UShort u16a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U16; + UShort u16b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U16; + Int res = u16a * u16b; /* Compiler will promote to int */ + e2 = IRExpr_Const(IRConst_U32(res)); + break; + } + case Iop_MullU32: { + UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32; + UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32; + ULong res = (ULong)u32a * (ULong)u32b; + e2 = IRExpr_Const(IRConst_U64(res)); + break; + } + case Iop_MullS8: { + /* very paranoid */ + UChar u8a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U8; + UChar u8b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8; + Char s8a = (Char)u8a; + Char s8b = (Char)u8b; + Short s16a = (Short)s8a; + Short s16b = (Short)s8b; + Int sres = s16a * s16b; + UShort ures = toUShort(sres); + e2 = IRExpr_Const(IRConst_U16(ures)); + break; + } + case Iop_MullS16: { + /* very paranoid */ + UShort u16a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U16; + UShort u16b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U16; + Short s16a = (Short)u16a; + Short s16b = (Short)u16b; + Int s32a = (Int)s16a; + Int s32b = (Int)s16b; + Int sres = s32a * s32b; + UInt ures = (UInt)sres; + e2 = IRExpr_Const(IRConst_U32(ures)); + break; + } case Iop_MullS32: { /* very paranoid */ UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32; diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c index 1ec2d77e3..96e71a068 100644 --- a/none/tests/iropt-test/binary.c +++ b/none/tests/iropt-test/binary.c @@ -144,6 +144,48 @@ check_result(const irop_t *op, const test_data_t *data) expected = opnd_l - opnd_r; break; + case Iop_Mul8: + case Iop_MullU8: { + uint8_t u8l = opnd_l; + uint8_t u8r = opnd_r; + expected = u8l * u8r; + break; + } + case Iop_Mul16: + case Iop_MullU16: { + uint16_t u16l = opnd_l; + uint16_t u16r = opnd_r; + expected = u16l * u16r; + break; + } + case Iop_Mul32: + case Iop_MullU32: { + uint32_t u32l = opnd_l; + uint32_t u32r = opnd_r; + expected = (uint64_t)u32l * (uint64_t)u32r; + break; + } + + case Iop_Mul64: + expected = opnd_l * opnd_r; + break; + + case Iop_MullS8: { + uint8_t u8l = opnd_l; + uint8_t u8r = opnd_r; + int8_t s8l = (int8_t)u8l; + int8_t s8r = (int8_t)u8r; + expected = (int16_t)s8l * (int16_t)s8r; + break; + } + case Iop_MullS16: { + uint16_t u16l = opnd_l; + uint16_t u16r = opnd_r; + int16_t s16l = (int16_t)u16l; + int16_t s16r = (int16_t)u16r; + expected = (int32_t)s16l * (int32_t)s16r; + break; + } case Iop_MullS32: expected = (int64_t)(int32_t)opnd_l * (int64_t)(int32_t)opnd_r; break; diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index 68f8cc886..5fb201663 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -120,18 +120,18 @@ { OPNAME(Sub32), Ity_I32, 2, Ity_I32, Ity_I32 }, { OPNAME(Sub64), Ity_I64, 2, Ity_I64, Ity_I64 }, -// { OPNAME(Mul8), Ity_I8, 2, Ity_I8, Ity_I8 }, -// { OPNAME(Mul16), Ity_I16, 2, Ity_I16, Ity_I16 }, -// { OPNAME(Mul32), Ity_I32, 2, Ity_I32, Ity_I32 }, -// { OPNAME(Mul64), Ity_I64, 2, Ity_I64, Ity_I64 }, - -// { OPNAME(MullU8), Ity_I16, 2, Ity_I8, Ity_I8 }, // no folding yet -// { OPNAME(MullU16), Ity_I32, 2, Ity_I16, Ity_I16 }, // no folding yet -// { OPNAME(MullU32), Ity_I64, 2, Ity_I32, Ity_I32 }, // no folding yet + { OPNAME(Mul8), Ity_I8, 2, Ity_I8, Ity_I8 }, + { OPNAME(Mul16), Ity_I16, 2, Ity_I16, Ity_I16 }, + { OPNAME(Mul32), Ity_I32, 2, Ity_I32, Ity_I32 }, + { OPNAME(Mul64), Ity_I64, 2, Ity_I64, Ity_I64 }, + + { OPNAME(MullU8), Ity_I16, 2, Ity_I8, Ity_I8 }, + { OPNAME(MullU16), Ity_I32, 2, Ity_I16, Ity_I16 }, + { OPNAME(MullU32), Ity_I64, 2, Ity_I32, Ity_I32 }, // { OPNAME(MullU64), Ity_I128, 2, Ity_I64, Ity_I64 }, // 128 bit -// { OPNAME(MullS8), Ity_I16, 2, Ity_I8, Ity_I8 }, // no folding yet -// { OPNAME(MullS16), Ity_I32, 2, Ity_I16, Ity_I16 }, // no folding yet + { OPNAME(MullS8), Ity_I16, 2, Ity_I8, Ity_I8 }, + { OPNAME(MullS16), Ity_I32, 2, Ity_I16, Ity_I16 }, { OPNAME(MullS32), Ity_I64, 2, Ity_I32, Ity_I32 }, // { OPNAME(MullS64), Ity_I128, 2, Ity_I64, Ity_I64 }, // 128 bit From c322bf33df88d1e8813434f7beeba909831a6a79 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 17 Jul 2025 20:38:54 +0200 Subject: [PATCH 121/412] iropt regtest: use mrand32() instead of rand() On illumos rand() has a RAND_MAX of 32k only. That's not enough to generate 64bit values easily. So use mrand48() which genrerates the full range of 32bit int values. --- none/tests/iropt-test/main.c | 2 +- none/tests/iropt-test/util.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/none/tests/iropt-test/main.c b/none/tests/iropt-test/main.c index 2622515e5..9f1cc5083 100644 --- a/none/tests/iropt-test/main.c +++ b/none/tests/iropt-test/main.c @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { assert(sizeof(long long) == 8); - assert(RAND_MAX == INT32_MAX); + srand48(42L); for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-v") == 0) diff --git a/none/tests/iropt-test/util.c b/none/tests/iropt-test/util.c index 072ff90c3..18b671114 100644 --- a/none/tests/iropt-test/util.c +++ b/none/tests/iropt-test/util.c @@ -109,7 +109,7 @@ bitsof_irtype(IRType ty) uint64_t get_random_value(IRType type) { - uint64_t val = rand(); + uint64_t val = mrand48(); switch (type) { case Ity_I1: return val & 0x1; @@ -117,11 +117,8 @@ get_random_value(IRType type) case Ity_I16: return val & UINT16_MAX; case Ity_I32: return val & UINT32_MAX; case Ity_I64: - /* Note, that RAND_MAX == INT32_MAX. Therefore, simply concatenating - two rand() values would never produce a value with MSB == 1 */ - val <<= (32 + 1); - val |= rand() << 1; - val |= rand() & 0x1; + val <<= 32; + val |= mrand48(); return val; default: From 4ecf8d2832530de0904803c772126aabcf8fb075 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 17 Jul 2025 20:39:12 +0000 Subject: [PATCH 122/412] Constant folding for various division IROps. (BZ 506211) Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- VEX/priv/ir_opt.c | 48 +++++++++++++++++++++++++++++++++ none/tests/iropt-test/binary.c | 41 ++++++++++++++++++++++++++++ none/tests/iropt-test/irops.tab | 16 +++++------ 3 files changed, 97 insertions(+), 8 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index fa0b76a96..ebea8ba0e 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2149,6 +2149,54 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) break; } + /* -- Div -- */ + case Iop_DivS32: { + Int s32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32; + Int s32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32; + if (s32b != 0) + e2 = IRExpr_Const(IRConst_U32(s32a / s32b)); + break; + } + case Iop_DivS64: { + Long s64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64; + Long s64b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U64; + if (s64b != 0) + e2 = IRExpr_Const(IRConst_U64(s64a / s64b)); + break; + } + case Iop_DivU32: { + UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32; + UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32; + if (u32b != 0) + e2 = IRExpr_Const(IRConst_U32(u32a / u32b)); + break; + } + case Iop_DivU64: { + ULong u64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64; + ULong u64b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U64; + if (u64b != 0) + e2 = IRExpr_Const(IRConst_U64(u64a / u64b)); + break; + } + case Iop_DivS32E: { + Int s32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32; + Int s32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32; + if (s32b != 0) { + Long s64a = (Long)s32a << 32; + e2 = IRExpr_Const(IRConst_U32(toUInt(s64a / s32b))); + } + break; + } + case Iop_DivU32E: { + UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32; + UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32; + if (u32b != 0) { + ULong u64a = (ULong)u32a << 32; + e2 = IRExpr_Const(IRConst_U32(toUInt(u64a / u32b))); + } + break; + } + /* -- Shl -- */ case Iop_Shl8: vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8); diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c index 96e71a068..62c9faeb3 100644 --- a/none/tests/iropt-test/binary.c +++ b/none/tests/iropt-test/binary.c @@ -30,6 +30,7 @@ static void check_result(const irop_t *, const test_data_t *); static void run_tests(const irop_t *, test_data_t *); static void run_shift_tests(const irop_t *, test_data_t *); static int is_shift_op(IROp); +static int is_division_op(IROp); void @@ -56,6 +57,8 @@ run_selected_tests(const irop_t *op, test_data_t *data) for (unsigned j = 0; j < num_val_r; ++j) { opnd_r->value = values_r[j]; + if (is_division_op(op->op) && opnd_r->value == 0) continue; + valgrind_execute_test(op, data); check_result(op, data); } @@ -74,6 +77,8 @@ run_random_tests(const irop_t *op, test_data_t *data) opnd_l->value = get_random_value(opnd_l->type); opnd_r->value = get_random_value(opnd_r->type); + if (is_division_op(op->op) && opnd_r->value == 0) continue; + valgrind_execute_test(op, data); check_result(op, data); } @@ -190,6 +195,27 @@ check_result(const irop_t *op, const test_data_t *data) expected = (int64_t)(int32_t)opnd_l * (int64_t)(int32_t)opnd_r; break; + case Iop_DivU32: + case Iop_DivU64: + expected = opnd_l / opnd_r; + break; + + case Iop_DivS32: + expected = (int32_t)opnd_l / (int32_t)opnd_r; + break; + + case Iop_DivS64: + expected = (int64_t)opnd_l / (int64_t)opnd_r; + break; + + case Iop_DivU32E: + expected = (opnd_l << 32) / opnd_r; + break; + + case Iop_DivS32E: + expected = (int64_t)(opnd_l << 32) / (int32_t)opnd_r; + break; + case Iop_Shl8: case Iop_Shl16: case Iop_Shl32: @@ -392,3 +418,18 @@ is_shift_op(IROp op) return 0; } } + + +static int +is_division_op(IROp op) +{ + switch (op) { + case Iop_DivU32: case Iop_DivU64: + case Iop_DivS32: case Iop_DivS64: + case Iop_DivU32E: + case Iop_DivS32E: + return 1; + default: + return 0; + } +} diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index 5fb201663..f2ffd007c 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -135,20 +135,20 @@ { OPNAME(MullS32), Ity_I64, 2, Ity_I32, Ity_I32 }, // { OPNAME(MullS64), Ity_I128, 2, Ity_I64, Ity_I64 }, // 128 bit -// { OPNAME(DivU32), Ity_I32, 2, Ity_I32, Ity_I32 }, // no folding yet -// { OPNAME(DivU64), Ity_I64, 2, Ity_I64, Ity_I64 }, // no folding yet + { OPNAME(DivU32), Ity_I32, 2, Ity_I32, Ity_I32 }, + { OPNAME(DivU64), Ity_I64, 2, Ity_I64, Ity_I64 }, // { OPNAME(DivU128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit -// { OPNAME(DivS32), Ity_I32, 2, Ity_I32, Ity_I32 }, // no folding yet -// { OPNAME(DivS64), Ity_I64, 2, Ity_I64, Ity_I64 }, // no folding yet + { OPNAME(DivS32), Ity_I32, 2, Ity_I32, Ity_I32 }, + { OPNAME(DivS64), Ity_I64, 2, Ity_I64, Ity_I64 }, // { OPNAME(DivS128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit -// { OPNAME(DivU32E), Ity_I32, 2, Ity_I32, Ity_I32 }, // semantics ? -// { OPNAME(DivU64E), Ity_I32, 2, Ity_I32, Ity_I32 }, // semantics ? + { OPNAME(DivU32E), Ity_I32, 2, Ity_I32, Ity_I32 }, +// { OPNAME(DivU64E), Ity_I64, 2, Ity_I64, Ity_I64 }, // 128 bit // { OPNAME(DivU128E), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit -// { OPNAME(DivS32E), Ity_I32, 2, Ity_I32, Ity_I32 }, // semantics ? -// { OPNAME(DivS64E), Ity_I32, 2, Ity_I32, Ity_I32 }, // semantics ? + { OPNAME(DivS32E), Ity_I32, 2, Ity_I32, Ity_I32 }, +// { OPNAME(DivS64E), Ity_I32, 2, Ity_I32, Ity_I32 }, // 128 bit // { OPNAME(DivS128E), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit // { OPNAME(DivModU32to32), Ity_I64, 2, Ity_I32, Ity_I64 }, // no folding yet From baac076edfde2870ee6cc69390f3bca9d4f7d974 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 18 Jul 2025 13:21:26 +0200 Subject: [PATCH 123/412] FreeBSD: fix check for mmap flags On FreeBSD, mmap also has MAP_STACK and MAP_GUARD that can be mapped without a backing file referred to by fd. As a result during ld.so startup and thread creation mmap for stacks was failing. So no guest could be load and execute, with errors like ld-elf.so.1: /home/paulf/scratch/valgrind_nightly/nightly/valgrind-new/.in_place/vgpreload_core-amd64-freebsd.so: mmap of entire address space failed: Bad file descriptor --- coregrind/m_syswrap/syswrap-generic.c | 18 ++++++++++++++++-- include/vki/vki-freebsd.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 7ad280980..1b3b5e80d 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -2653,12 +2653,26 @@ ML_(generic_PRE_sys_mmap) ( ThreadId tid, VG_(core_panic)("can't use ML_(generic_PRE_sys_mmap) on Darwin"); # endif - /* fd (arg4) is only used when flags (arg4) does not contain - MAP_ANONYMOUS. ML_(fd_allowed) might just warn (with --track-fds) +#if !defined(VKI_MAP_GUARD) +// on platforms without MAP_GUARD the compiler should optimise away +// the term using it below as it will always be true +#define VKI_MAP_GUARD 0 +#endif + +#if !defined(VKI_MAP_STACK) +// as above +#define VKI_MAP_STACK 0 +#endif + + /* fd (arg5) is only used when flags (arg4) does not contain + MAP_ANONYMOUS (or, on FreeBSD, MAP_GUARD and MAP_STACK). + ML_(fd_allowed) might just warn (with --track-fds) and not fail, unless it is a Valgrind owned file descriptor. So also check with fcntl (F_GETFD) to know if it really is a bad fd. Fail early in that case with EBADF. */ if (!(arg4 & VKI_MAP_ANONYMOUS) + && !(arg4 & VKI_MAP_GUARD) + && !(arg4 & VKI_MAP_STACK) && (!ML_(fd_allowed)(arg5, "mmap", tid, False) || VG_(fcntl) (arg5, VKI_F_GETFD, 0) < 0)) { return VG_(mk_SysRes_Error)( VKI_EBADF ); diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index 63ffbe7e5..1a371245f 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -1526,6 +1526,7 @@ typedef enum vki_idtype { #define VKI_MAP_STACK 0x400 #define VKI_MAP_ANON 0x1000 /* don't use a file */ #define VKI_MAP_ANONYMOUS VKI_MAP_ANON +#define VKI_MAP_GUARD 0x00002000 #define VKI_MAP_ALIGNED(n) ((n) << VKI_MAP_ALIGNMENT_SHIFT) #define VKI_MAP_ALIGNMENT_SHIFT 24 From 7fb17b67f40eb8197c45b5f575daf4fa77d16faa Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 19 Jul 2025 15:10:31 +0200 Subject: [PATCH 124/412] Bug 505673 - Valgrind crashes with an internal error and SIGBUS when the guest tries to open its own file with O_WRONLY|O_CREAT|O_TRUNC This is all quite messy. It affects open() openat() and openat2() (the last of which is Linux only). On Linux we also need to check for /proc/self/exe and /proc/PID/exe. On Linux there are also a couple of RESOLVE flags for openat2() that mean _don't_ check /proc magic links. In the general case we need to have some reference to check whether the filename matches the guest filename. So I've added that as VG_(resolved_exename) (which I was already using on FreeBSD). The pathname also needs to be canonicalised. It may be a relative path, symlink or use RESOLVE_IN_ROOT. That uses VG_(realpath) (again which was already present for FreBSD). On illumos the man page says that opening running binaries for writing failes with errno set to ETXTBSY but that's not what the open functions do - they just open the file. So I've done nothing for illumos or Solaris. Maybe I'll open an illumos ticket. I haven't tried on Darwin. The Linux open functions with /proc/self/exe and /proc/PID/exe were just calling dup on the fd that we hold for the client exe. That means that we were ignoring any other flags. That has now changed. If the open doesn't fail because the WRONLY/RDWR flags are set then the syscall gets called from the PRE wrapper using VG_(resolved_exename) instewad of the /proc pathname. I haven't tried to handle all of the Linux openat2 RESOLVE* flags. RESOLVE_NO_MAGICLINKS is handled and I see the LTS test openat202 now passing, so this should also fix Bug 506910. I'm not sure that VG_(realpath) handles all forms of weird path resolution on Linux (on FreeBSD it uses a syscall so that should work OK). --- .gitignore | 2 + NEWS | 2 + coregrind/m_initimg/initimg-freebsd.c | 3 + coregrind/m_initimg/initimg-linux.c | 63 ++++- coregrind/m_libcfile.c | 20 +- coregrind/m_syswrap/syswrap-freebsd.c | 33 +++ coregrind/m_syswrap/syswrap-generic.c | 48 +++- coregrind/m_syswrap/syswrap-linux.c | 222 +++++++++++++----- coregrind/pub_core_libcfile.h | 3 +- include/pub_tool_libcfile.h | 2 - .../tests/x86-linux/scalar_openat2.stderr.exp | 6 +- none/tests/freebsd/Makefile.am | 6 +- none/tests/freebsd/open_client.cpp | 108 +++++++++ none/tests/freebsd/open_client.stderr.exp | 0 none/tests/freebsd/open_client.vgtest | 3 + none/tests/linux/Makefile.am | 3 + none/tests/linux/open_client.cpp | 191 +++++++++++++++ none/tests/linux/open_client.stderr.exp | 0 none/tests/linux/open_client.vgtest | 2 + 19 files changed, 643 insertions(+), 74 deletions(-) create mode 100644 none/tests/freebsd/open_client.cpp create mode 100644 none/tests/freebsd/open_client.stderr.exp create mode 100644 none/tests/freebsd/open_client.vgtest create mode 100644 none/tests/linux/open_client.cpp create mode 100644 none/tests/linux/open_client.stderr.exp create mode 100644 none/tests/linux/open_client.vgtest diff --git a/.gitignore b/.gitignore index 69e182f75..44454d08b 100644 --- a/.gitignore +++ b/.gitignore @@ -1895,6 +1895,7 @@ /none/tests/linux/mremap4 /none/tests/linux/mremap5 /none/tests/linux/mremap6 +/none/tests/linux/open_client /none/tests/linux/pthread-stack /none/tests/linux/stack-overflow @@ -2328,6 +2329,7 @@ none/tests/freebsd/bug499212 /none/tests/freebsd/swapcontext /none/tests/freebsd/fexecve /none/tests/freebsd/hello_world +/none/tests/freebsd/open_client /none/tests/freebsd/proc_pid_file /none/tests/freebsd/sanity_level_thread /none/tests/freebsd/usrstack diff --git a/NEWS b/NEWS index e61b56baf..af8810364 100644 --- a/NEWS +++ b/NEWS @@ -52,6 +52,8 @@ are not entered into bugzilla tend to get forgotten about or ignored. AMD64_GET_TLSBASE 505228 Wrap linux specific mseal syscall 502968 Wrap linux specific syscalls 457 (listmount) and 458 (statmount) +505673 Valgrind crashes with an internal error and SIGBUS when + the guest tries to open its own file with O_WRONLY|O_CREAT|O_TRUNC 506076 unimplemented fcntl command: 1028 (F_CREATED_QUERY) 506499 Unhandled syscall 592 (exterrctl - FreeBSD 506795 Better report which clone flags are problematic diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index cb98eb914..5c167e3fb 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -334,6 +334,9 @@ static const struct auxv *find_auxv(const UWord* sp) return (const struct auxv *)sp; } +/* + * @todo PJF Make this multi-platform + */ static Bool try_get_interp(const HChar* args_exe, HChar* interp_out) { HChar hdr[4096]; diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c index 483b7a3dd..bcca59da7 100644 --- a/coregrind/m_initimg/initimg-linux.c +++ b/coregrind/m_initimg/initimg-linux.c @@ -385,9 +385,59 @@ struct auxv *find_auxv(UWord* sp) return (struct auxv *)sp; } +/* + * @todo PJF Make this multi-platform + */ +static Bool try_get_interp(const HChar* args_exe, HChar* interp_out) +{ + HChar hdr[4096]; + Int len = sizeof hdr; + SysRes res; + Int fd; + HChar* end; + HChar* cp; + HChar* interp; + + res = VG_(open)(args_exe, VKI_O_RDONLY, 0); + if (sr_isError(res)) { + return False; + } else { + fd = sr_Res(res); + } + + res = VG_(pread)(fd, hdr, len, 0); + + if (sr_isError(res)) { + VG_(close)(fd); + return False; + } else { + len = sr_Res(res); + } + + if (0 != VG_(memcmp)(hdr, "#!", 2)) { + VG_(close)(fd); + return False; + } + + end = hdr + len; + interp = hdr + 2; + while (interp < end && (*interp == ' ' || *interp == '\t')) + interp++; + + for (cp = interp; cp < end && !VG_(isspace)(*cp); cp++) + ; + + *cp = '\0'; + + VG_(sprintf)(interp_out, "%s", interp); + + VG_(close)(fd); + return True; +} + static Addr setup_client_stack( void* init_sp, - HChar** orig_envp, + HChar** orig_envp, const ExeInfo* info, UInt** client_auxv, Addr clstack_end, @@ -953,6 +1003,17 @@ Addr setup_client_stack( void* init_sp, vg_assert((strtab-stringbase) == stringsize); + if (VG_(resolved_exename) == NULL) { + const HChar *exe_name = VG_(find_executable)(VG_(args_the_exename)); + HChar interp_name[VKI_PATH_MAX]; + if (try_get_interp(exe_name, interp_name)) { + exe_name = interp_name; + } + HChar resolved_name[VKI_PATH_MAX]; + VG_(realpath)(exe_name, resolved_name); + VG_(resolved_exename) = VG_(strdup)("initimg-linux.sre.1", resolved_name); + } + /* client_SP is pointing at client's argc/argv */ if (0) VG_(printf)("startup SP = %#lx\n", client_SP); diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 767f34522..ff1ead4e7 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -674,15 +674,18 @@ Int VG_(fstat) ( Int fd, struct vg_stat* vgbuf ) # endif } -#if defined(VGO_freebsd) /* extend this to other OSes as and when needed */ SysRes VG_(lstat) ( const HChar* file_name, struct vg_stat* vgbuf ) { SysRes res; VG_(memset)(vgbuf, 0, sizeof(*vgbuf)); -#if (__FreeBSD_version < 1200031) +#if !defined(VGO_freebsd) || (__FreeBSD_version < 1200031) +#if defined(VGO_freebsd) struct vki_freebsd11_stat buf; +#else + struct vki_stat buf; +#endif res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf); #else struct vki_stat buf; @@ -693,7 +696,6 @@ SysRes VG_(lstat) ( const HChar* file_name, struct vg_stat* vgbuf ) } return res; } -#endif #undef TRANSLATE_TO_vg_stat #undef TRANSLATE_statx_TO_vg_stat @@ -1803,7 +1805,6 @@ const HChar *VG_(dirname)(const HChar *path) return buf; } -#if defined(VGO_freebsd) /* * I did look at nicking this from FreeBSD, it's fairly easy to port * but I was put off by the copyright and 3-clause licence @@ -1819,7 +1820,7 @@ Bool VG_(realpath)(const HChar *path, HChar *resolved) { vg_assert(path); vg_assert(resolved); -#if (__FreeBSD_version >= 1300080) +#if defined(VGO_freebsd) && (__FreeBSD_version >= 1300080) return !sr_isError(VG_(do_syscall5)(__NR___realpathat, VKI_AT_FDCWD, (RegWord)path, (RegWord)resolved, VKI_PATH_MAX, 0)); #else // poor man's realpath @@ -1847,7 +1848,13 @@ Bool VG_(realpath)(const HChar *path, HChar *resolved) if (resolved_name[0] == '.' && resolved_name[1] == '/') { resolved_name += 2; } - VG_(snprintf)(resolved, VKI_PATH_MAX, "%s/%s", VG_(get_startup_wd)(), resolved_name); + HChar wd[VKI_PATH_MAX]; +#if defined(VGO_linux) || defined(VGO_solaris) + res = VG_(do_syscall2)(__NR_getcwd, (UWord)wd, VKI_PATH_MAX); +#elif defined(VGO_freebsd) + res = VG_(do_syscall2)(__NR___getcwd, (UWord)wd, VKI_PATH_MAX); +#endif + VG_(snprintf)(resolved, VKI_PATH_MAX, "%s/%s", wd, resolved_name); } else { VG_(snprintf)(resolved, VKI_PATH_MAX, "%s", resolved_name); } @@ -1855,7 +1862,6 @@ Bool VG_(realpath)(const HChar *path, HChar *resolved) return True; #endif } -#endif /*--------------------------------------------------------------------*/ diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 79e30f7d3..df223a2a0 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -5347,6 +5347,39 @@ PRE(sys_freebsd11_mknodat) // int openat(int fd, const char *path, int flags, ...); PRE(sys_openat) { + // check that we are not trying to open the client exe for writing + if ((ARG3 & VKI_O_WRONLY) || + (ARG3 & VKI_O_RDWR)) { + vg_assert(VG_(resolved_exename) && VG_(resolved_exename)[0] == '/'); + Int fd = ARG1; + const HChar* path = (const HChar*)ARG2; + if (ML_(safe_to_deref)(path, 1)) { // we need something like a "ML_(safe_to_deref_path)" that does a binary search for the addressable length, and maybe nul + if (fd == VKI_AT_FDCWD) { + HChar tmp[VKI_PATH_MAX]; + if (VG_(realpath)(path, tmp)) { + if (!VG_(strcmp)(tmp, VG_(resolved_exename))) { + SET_STATUS_Failure( VKI_ETXTBSY ); + } + } + } else { + const HChar* dirname; + if (VG_(resolve_filename)(fd, &dirname) == False) { + goto no_client_write; // let the OS do the error handling + } + HChar tmp1[VKI_PATH_MAX]; + VG_(snprintf)(tmp1, VKI_PATH_MAX, "%s/%s", dirname, path); + tmp1[VKI_PATH_MAX - 1] = '\0'; + //VG_(free)((void*)dirname); + HChar tmp2[VKI_PATH_MAX]; + if (VG_(realpath)(tmp1, tmp2)) { + if (!VG_(strcmp)(tmp2, VG_(resolved_exename))) { + SET_STATUS_Failure( VKI_ETXTBSY ); + } + } + } + } + } +no_client_write: if (ARG3 & VKI_O_CREAT) { // 4-arg version PRINT("sys_openat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %" FMT_REGWORD "u )",ARG1,ARG2,(char*)ARG2,ARG3,ARG4); diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 1b3b5e80d..727766869 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -4602,8 +4602,23 @@ Bool ML_(handle_self_exe_open)(SyscallStatus *status, const HChar *filename, } #endif // defined(VGO_linux) +// int open(const char *path, int flags, mode_t mode); PRE(sys_open) { +#if defined(VGO_linux) + HChar name[30]; // large enough + Bool proc_self_exe = False; + + /* Check for /proc/self/exe or /proc//exe case + * first so that we can then use the later checks. */ + VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)()); + if (ML_(safe_to_deref)( (void*)(Addr)ARG1, 1 ) + && (VG_(strcmp)((HChar *)(Addr)ARG1, name) == 0 + || VG_(strcmp)((HChar *)(Addr)ARG1, "/proc/self/exe") == 0)) { + proc_self_exe = True; + } +#endif + if (ARG2 & VKI_O_CREAT) { // 3-arg version PRINT("sys_open ( %#" FMT_REGWORD "x(%s), %ld, %ld )",ARG1, @@ -4619,13 +4634,39 @@ PRE(sys_open) } PRE_MEM_RASCIIZ( "open(filename)", ARG1 ); + // check that we are not trying to open the client exe for writing + if ((ARG2 & VKI_O_WRONLY) || + (ARG2 & VKI_O_RDWR)) { +#if defined(VGO_linux) + if (proc_self_exe) { + + SET_STATUS_Failure( VKI_ETXTBSY ); + return; + } else { +#endif + vg_assert(VG_(resolved_exename)); + const HChar* path = (const HChar*)ARG1; + if (ML_(safe_to_deref)(path, 1)) { + // we need something like a "ML_(safe_to_deref_path)" that does a binary search for the addressable length, and maybe nul + HChar tmp[VKI_PATH_MAX]; + if (VG_(realpath)(path, tmp)) { + if (!VG_(strcmp)(tmp, VG_(resolved_exename))) { + SET_STATUS_Failure( VKI_ETXTBSY ); + return; + } + } + } +#if defined(VGO_linux) + } +#endif + } + #if defined(VGO_linux) /* Handle the case where the open is of /proc/self/cmdline or /proc//cmdline, and just give it a copy of the fd for the fake file we cooked up at startup (in m_main). Also, seek the cloned fd back to the start. */ { - HChar name[30]; // large enough HChar* arg1s = (HChar*) (Addr)ARG1; SysRes sres; @@ -4648,6 +4689,11 @@ PRE(sys_open) if (ML_(handle_auxv_open)(status, (const HChar *)(Addr)ARG1, ARG2) || ML_(handle_self_exe_open)(status, (const HChar *)(Addr)ARG1, ARG2)) return; + + if (proc_self_exe) { + // do the syscall with VG_(resolved_exename) + SET_STATUS_from_SysRes(VG_(do_syscall3)(SYSNO, (Word)VG_(resolved_exename), ARG2, ARG3)); + } #endif // defined(VGO_linux) /* Otherwise handle normally */ diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index bd563d989..e16d293cd 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -5966,25 +5966,89 @@ PRE(sys_openat) { HChar name[30]; // large enough SysRes sres; + Bool proc_self_exe = False; + + /* Check for /proc/self/exe or /proc//exe case + * first so that we can then use the later checks. */ + 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)) { + proc_self_exe = True; + } if (ARG3 & VKI_O_CREAT) { // 4-arg version PRINT("sys_openat ( %ld, %#" FMT_REGWORD "x(%s), %ld, %ld )", SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3, SARG4); PRE_REG_READ4(long, "openat", - int, dfd, const char *, filename, int, flags, int, mode); + int, dirfd, const char *, pathname, int, flags, int, mode); } else { // 3-arg version PRINT("sys_openat ( %ld, %#" FMT_REGWORD "x(%s), %ld )", SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3); PRE_REG_READ3(long, "openat", - int, dfd, const char *, filename, int, flags); + int, dirfd, const char *, pathname, int, flags); } - PRE_MEM_RASCIIZ( "openat(filename)", ARG2 ); + PRE_MEM_RASCIIZ( "openat(pathname)", ARG2 ); - /* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD, - filename is relative to cwd. When comparing dfd against AT_FDCWD, + // check that we are not trying to open the client exe for writing + if ((ARG3 & VKI_O_WRONLY) || + (ARG3 & VKI_O_RDWR)) { + if (proc_self_exe) { + SET_STATUS_Failure( VKI_ETXTBSY ); + return; + } else { + vg_assert(VG_(resolved_exename)); + if (!VG_(strncmp)(VG_(resolved_exename), "#!", 2)) { + goto no_client_write; + } + Int fd = ARG1; + const HChar* path = (const HChar*)ARG2; + if (ML_(safe_to_deref)(path, 1)) { + // we need something like a "ML_(safe_to_deref_path)" that does a binary search for the addressable length, and maybe nul + if (path[0] == '/') { + // ignore fd + HChar tmp[VKI_PATH_MAX]; + if (VG_(realpath)(path, tmp)) { + if (!VG_(strcmp)(tmp, VG_(resolved_exename))) { + SET_STATUS_Failure( VKI_ETXTBSY ); + return; + } + } + } else { + if (fd == VKI_AT_FDCWD) { + HChar tmp[VKI_PATH_MAX]; + if (VG_(realpath)(path, tmp)) { + if (!VG_(strcmp)(tmp, VG_(resolved_exename))) { + SET_STATUS_Failure( VKI_ETXTBSY ); + } + } + } else { + const HChar* dirname; + if (VG_(resolve_filename)(fd, &dirname) == False) { + goto no_client_write; // let the OS do the error handling + } + HChar tmp1[VKI_PATH_MAX]; + VG_(snprintf)(tmp1, VKI_PATH_MAX, "%s/%s", dirname, path); + tmp1[VKI_PATH_MAX - 1] = '\0'; + HChar tmp2[VKI_PATH_MAX]; + if (VG_(realpath)(tmp1, tmp2)) { + if (!VG_(strcmp)(tmp2, VG_(resolved_exename))) { + SET_STATUS_Failure( VKI_ETXTBSY ); + return; + } + } + } + } + } + } + } +no_client_write: + + /* For absolute filenames, dirfd is ignored. If dirfd is AT_FDCWD, + filename is relative to cwd. When comparing dirfd against AT_FDCWD, be sure only to compare the bottom 32 bits. */ if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) && *(Char *)(Addr)ARG2 != '/' @@ -6027,20 +6091,10 @@ PRE(sys_openat) return; } - /* And for /proc/self/exe or /proc//exe case. */ + if (proc_self_exe) { - 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; + // do the syscall with VG_(resolved_exename) + SET_STATUS_from_SysRes(VG_(do_syscall4)(SYSNO, ARG1, (Word)VG_(resolved_exename), ARG3, ARG4)); } /* Otherwise handle normally */ @@ -13900,43 +13954,109 @@ PRE(sys_openat2) { HChar name[30]; // large enough SysRes sres; - struct vki_open_how * how; + struct vki_open_how* how = (struct vki_open_how *)ARG3; + Bool proc_self_exe = False; + Bool can_deref_how = how && ML_(safe_to_deref)(how, sizeof(*how)); + + // ARG4 is supposed to be sizeof(struct vki_open_how) + // but we can't trust it + if (can_deref_how) { + // check that we are not trying to open the client exe for writing + // this doesn't handle all of the RESOLVE options, there may be cases + // like RESOLVE_NO_XDEV and RESOLVE_BENEATH where the path is + // invalid and we might return the wrong errno + if (how->vki_resolve != VKI_RESOLVE_IN_ROOT && + how->vki_resolve != VKI_RESOLVE_NO_MAGICLINKS) { + /* Check for /proc/self/exe or /proc//exe case + * first so that we can then use the later checks. */ + 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)) { + proc_self_exe = True; + } + } + } PRINT("sys_openat2 ( %ld, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %ld )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, SARG4); PRE_REG_READ4(long, "openat2", - int, dfd, const char *, filename, struct vki_open_how *, how, vki_size_t, size); + int, dirfd, const char *, pathname, struct vki_open_how *, how, vki_size_t, size); - PRE_MEM_RASCIIZ( "openat2(filename)", ARG2 ); + PRE_MEM_RASCIIZ( "openat2(pathname)", ARG2 ); PRE_MEM_READ( "openat2(how)", ARG3, sizeof(struct vki_open_how)); - /* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD, - filename is relative to cwd. When comparing dfd against AT_FDCWD, + if (can_deref_how && + ((how->vki_flags & VKI_O_WRONLY) || + (how->vki_flags & VKI_O_RDWR))) { + if (proc_self_exe) { + SET_STATUS_Failure( VKI_ETXTBSY ); + return; + } else { + vg_assert(VG_(resolved_exename)); + if (!VG_(strncmp)(VG_(resolved_exename), "#!", 2)) { + goto no_client_write; + } + Int fd = ARG1; + const HChar* path = (const HChar*)ARG2; + if (ML_(safe_to_deref)(path, 1)) { + // we need something like a "ML_(safe_to_deref_path)" that does a binary search for the addressable length, and maybe nul + if (path[0] == '/' && how->vki_resolve != VKI_RESOLVE_IN_ROOT) { + // absolute path, ignore fd + HChar tmp[VKI_PATH_MAX]; + if (VG_(realpath)(path, tmp)) { + if (!VG_(strcmp)(tmp, VG_(resolved_exename))) { + SET_STATUS_Failure( VKI_ETXTBSY ); + return; + } + } + } else { + // relative or rooted path + // or RESOLVE_IN_ROOT + if (how->vki_resolve == VKI_RESOLVE_IN_ROOT) { + while (*path == '/' && *path != '\0') { + ++path; + } + } + if (fd == VKI_AT_FDCWD) { + HChar tmp[VKI_PATH_MAX]; + if (VG_(realpath)(path, tmp)) { + if (!VG_(strcmp)(tmp, VG_(resolved_exename))) { + SET_STATUS_Failure( VKI_ETXTBSY ); + return; + } + } + } else { + // build absolute path from fd and path + const HChar* dirname; + if (VG_(resolve_filename)(fd, &dirname) == False) { + goto no_client_write; // let the OS do the error handling + } + HChar tmp1[VKI_PATH_MAX]; + VG_(snprintf)(tmp1, VKI_PATH_MAX, "%s/%s", dirname, path); + tmp1[VKI_PATH_MAX - 1] = '\0'; + HChar tmp2[VKI_PATH_MAX]; + if (VG_(realpath)(tmp1, tmp2)) { + if (!VG_(strcmp)(tmp2, VG_(resolved_exename))) { + SET_STATUS_Failure( VKI_ETXTBSY ); + return; + } + } + } + } + } + } + } + no_client_write: + + /* For absolute filenames, dirfd is ignored. If dirfd is AT_FDCWD, + filename is relative to cwd. When comparing dirfd against AT_FDCWD, be sure only to compare the bottom 32 bits. */ if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) && *(Char *)(Addr)ARG2 != '/' && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "openat2", tid, False)) + && !ML_(fd_allowed)(ARG1, "openat", tid, False)) SET_STATUS_Failure( VKI_EBADF ); - - how = (struct vki_open_how *)ARG3; - - if (how && ML_(safe_to_deref) (how, sizeof(struct vki_open_how))) { - if (how->vki_mode) { - if (!(how->vki_flags & ((vki_uint64_t)VKI_O_CREAT | VKI_O_TMPFILE))) { - SET_STATUS_Failure( VKI_EINVAL ); - } - } - if (how->vki_resolve & ~((vki_uint64_t)VKI_RESOLVE_NO_XDEV | - VKI_RESOLVE_NO_MAGICLINKS | - VKI_RESOLVE_NO_SYMLINKS | - VKI_RESOLVE_BENEATH | - VKI_RESOLVE_IN_ROOT | - VKI_RESOLVE_CACHED)) { - SET_STATUS_Failure( VKI_EINVAL ); - } - } - /* Handle the case where the open is of /proc/self/cmdline or /proc//cmdline, and just give it a copy of the fd for the fake file we cooked up at startup (in m_main). Also, seek the @@ -13972,20 +14092,10 @@ PRE(sys_openat2) return; } - /* And for /proc/self/exe or /proc//exe case. */ + if (proc_self_exe) { - 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; + // do the syscall with VG_(resolved_exename) + SET_STATUS_from_SysRes(VG_(do_syscall4)(SYSNO, ARG1, (Word)VG_(resolved_exename), ARG3, ARG4)); } /* Otherwise handle normally */ diff --git a/coregrind/pub_core_libcfile.h b/coregrind/pub_core_libcfile.h index dc243bf7f..8411ad368 100644 --- a/coregrind/pub_core_libcfile.h +++ b/coregrind/pub_core_libcfile.h @@ -110,9 +110,8 @@ extern Int VG_(mkstemp) ( const HChar* part_of_name, /*OUT*/HChar* fullname ); return if the working directory couldn't be found. */ extern void VG_(record_startup_wd) ( void ); -#if defined(VGO_freebsd) +/* Resolves a path to a canonical absolute path */ extern Bool VG_(realpath)(const HChar *path, HChar *resolved); -#endif #endif // __PUB_CORE_LIBCFILE_H diff --git a/include/pub_tool_libcfile.h b/include/pub_tool_libcfile.h index ff4c0d3a5..5b912d31c 100644 --- a/include/pub_tool_libcfile.h +++ b/include/pub_tool_libcfile.h @@ -81,9 +81,7 @@ extern Int VG_(pipe) ( Int fd[2] ); extern Off64T VG_(lseek) ( Int fd, Off64T offset, Int whence ); extern SysRes VG_(stat) ( const HChar* file_name, struct vg_stat* buf ); -#if defined(VGO_freebsd) extern SysRes VG_(lstat) ( const HChar* file_name, struct vg_stat* buf ); -#endif extern Int VG_(fstat) ( Int fd, struct vg_stat* buf ); extern SysRes VG_(dup) ( Int oldfd ); extern SysRes VG_(dup2) ( Int oldfd, Int newfd ); diff --git a/memcheck/tests/x86-linux/scalar_openat2.stderr.exp b/memcheck/tests/x86-linux/scalar_openat2.stderr.exp index 367da9dbf..c666f9fb4 100644 --- a/memcheck/tests/x86-linux/scalar_openat2.stderr.exp +++ b/memcheck/tests/x86-linux/scalar_openat2.stderr.exp @@ -1,11 +1,11 @@ ----------------------------------------------------- 437: __NR_openat2 4s 2m ----------------------------------------------------- -Syscall param openat2(dfd) contains uninitialised byte(s) +Syscall param openat2(dirfd) contains uninitialised byte(s) ... by 0x........: main (scalar_openat2.c:15) -Syscall param openat2(filename) contains uninitialised byte(s) +Syscall param openat2(pathname) contains uninitialised byte(s) ... by 0x........: main (scalar_openat2.c:15) @@ -17,7 +17,7 @@ Syscall param openat2(size) contains uninitialised byte(s) ... by 0x........: main (scalar_openat2.c:15) -Syscall param openat2(filename) points to unaddressable byte(s) +Syscall param openat2(pathname) points to unaddressable byte(s) ... by 0x........: main (scalar_openat2.c:15) Address 0x........ is not stack'd, malloc'd or (recently) free'd diff --git a/none/tests/freebsd/Makefile.am b/none/tests/freebsd/Makefile.am index 5d209c6d2..0bbbffdad 100644 --- a/none/tests/freebsd/Makefile.am +++ b/none/tests/freebsd/Makefile.am @@ -53,6 +53,8 @@ EXTRA_DIST = \ ksh_test.ksh \ ksh_test.stderr.exp \ ksh_test.stdout.exp \ + open_client.vgtest \ + open_client.stderr.exp \ sanity_level_thread.vgtest \ sanity_level_thread.stderr.exp \ swapcontext.vgtest \ @@ -69,7 +71,7 @@ EXTRA_DIST = \ usrstack.stdout.exp check_PROGRAMS = \ - auxv bug452274 bug498317 bug499212 fexecve hello_world osrel \ + auxv bug452274 bug498317 bug499212 fexecve hello_world open_client osrel \ proc_pid_file sanity_level_thread swapcontext umtx_shm_creat usrstack AM_CFLAGS += $(AM_FLAG_M3264_PRI) @@ -80,7 +82,7 @@ osrel_CFLAGS = ${AM_CFLAGS} swapcontext_CFLAGS = ${AM_CFLAGS} hello_world_SOURCES = hello_world.cpp - +open_client_SOURCES = open_client.cpp proc_pid_file_SOURCES = proc_pid_file.cpp sanity_level_thread_SOURCES = sanity_level_thread.cpp diff --git a/none/tests/freebsd/open_client.cpp b/none/tests/freebsd/open_client.cpp new file mode 100644 index 000000000..454c0a3dc --- /dev/null +++ b/none/tests/freebsd/open_client.cpp @@ -0,0 +1,108 @@ +// For Bug 505673 +// Valgrind crashes with an internal error and SIGBUS when the guest tries to open its own file with O_WRONLY|O_CREAT|O_TRUNC +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char** argv) +{ + std::vector flags{O_WRONLY|O_CREAT|O_TRUNC, O_WRONLY, O_RDWR}; + + // On FreeBSD libc open uses syscall openat (at least on 14.2) + for (auto f : flags) + { + int res = open(argv[0], f, 0666); + if (-1 != res) + { + throw std::runtime_error("open should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } + + // repeat the above, but with syscall SYS_open + for (auto f : flags) + { + int res = syscall(SYS_open, argv[0], f, 0666); + if (-1 != res) + { + throw std::runtime_error("open should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } + + int dotdot; + if ((dotdot = open("..", O_DIRECTORY | O_RDONLY)) == -1) + { + throw std::runtime_error("failed to open ,."); + } + else + { + for (auto f : flags) + { + int res = openat(dotdot, "freebsd/open_client", f, 0666); + if (-1 != res) + { + throw std::runtime_error("open should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } + } + close(dotdot); + + chdir(".."); + + // check that relative paths work + for (auto f : flags) + { + int res = open("freebsd/open_client", f, 0666); + if (-1 != res) + { + throw std::runtime_error("open should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } + + for (auto f : flags) + { + int res = syscall(SYS_open, "freebsd/open_client", f, 0666); + if (-1 != res) + { + throw std::runtime_error("open should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } +} diff --git a/none/tests/freebsd/open_client.stderr.exp b/none/tests/freebsd/open_client.stderr.exp new file mode 100644 index 000000000..e69de29bb diff --git a/none/tests/freebsd/open_client.vgtest b/none/tests/freebsd/open_client.vgtest new file mode 100644 index 000000000..12b148de4 --- /dev/null +++ b/none/tests/freebsd/open_client.vgtest @@ -0,0 +1,3 @@ +prog: open_client +vgopts: -q + diff --git a/none/tests/linux/Makefile.am b/none/tests/linux/Makefile.am index dbb535902..c81ffff54 100644 --- a/none/tests/linux/Makefile.am +++ b/none/tests/linux/Makefile.am @@ -17,6 +17,7 @@ EXTRA_DIST = \ mremap4.stderr.exp mremap4.vgtest \ mremap5.stderr.exp mremap5.vgtest \ mremap6.stderr.exp mremap6.vgtest \ + open_client.stderr.exp open_client.vgtest \ pthread-stack.stderr.exp pthread-stack.vgtest \ stack-overflow.stderr.exp stack-overflow.vgtest @@ -32,6 +33,7 @@ check_PROGRAMS = \ mremap4 \ mremap5 \ mremap6 \ + open_client \ pthread-stack \ stack-overflow @@ -45,6 +47,7 @@ AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) # Special needs clonev_LDADD = -lpthread +open_client_SOURCES = open_client.cpp pthread_stack_LDADD = -lpthread stack_overflow_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ \ diff --git a/none/tests/linux/open_client.cpp b/none/tests/linux/open_client.cpp new file mode 100644 index 000000000..4b336e7f0 --- /dev/null +++ b/none/tests/linux/open_client.cpp @@ -0,0 +1,191 @@ +// For Bug 505673 +// Valgrind crashes with an internal error and SIGBUS when the guest tries to open its own file with O_WRONLY|O_CREAT|O_TRUNC +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char** argv) +{ + std::vector<__u64> flags{O_WRONLY|O_CREAT|O_TRUNC, O_WRONLY, O_RDWR}; + auto pid = getpid(); + auto ppe = std::string("/proc/") + std::to_string(pid) + "/exe"; + std::vector names{argv[0], "/proc/self/exe", ppe}; + int dotdot; + + for (const auto& n : names) + { + for (auto f : flags) + { + int res = open(n.c_str(), f, 0666); + if (-1 != res) + { + throw std::runtime_error("open should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } + + for (auto f : flags) + { + int res = syscall(SYS_open, n.c_str(), f, 0666); + + if (-1 != res) + { + throw std::runtime_error("open should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } + } + + if ((dotdot = open("..", O_DIRECTORY | O_RDONLY)) == -1) + { + throw std::runtime_error("failed to open ,."); + } + else + { + for (auto f : flags) + { + int res = openat(dotdot, "linux/open_client", f, 0666); + if (-1 != res) + { + throw std::runtime_error("open should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } + } + +#if defined(SYS_openat2) + for (const auto& n : names) + { + for (auto f : flags) + { + struct open_how oh = { .flags=f, .mode=((f&static_cast<__u64>(O_CREAT))?0666UL:0UL), .resolve=0 }; + int res = syscall(SYS_openat2, AT_FDCWD, n.c_str(), &oh, sizeof(oh)); + if (-1 != res) + { + throw std::runtime_error("openat2 should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } + } + + for (auto f : flags) + { + struct open_how oh = { .flags=f, .mode=((f&static_cast<__u64>(O_CREAT))?0666UL:0UL), .resolve=0 }; + int res = syscall(SYS_openat2, dotdot, "linux/open_client", &oh, sizeof(oh)); + if (-1 != res) + { + throw std::runtime_error("openat2 should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } + + for (auto f : flags) + { + struct open_how oh = { .flags=f, .mode=((f&static_cast<__u64>(O_CREAT))?0666UL:0UL), .resolve=RESOLVE_IN_ROOT }; + int res = syscall(SYS_openat2, dotdot, "/linux/open_client", &oh, sizeof(oh)); + if (-1 != res) + { + throw std::runtime_error("openat2 should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } +#endif + + close(dotdot); + + chdir(".."); + + // check that relative paths work + for (auto f : flags) + { + int res = open("linux/open_client", f, 0666); + if (-1 != res) + { + throw std::runtime_error("open should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } + + for (auto f : flags) + { + int res = syscall(SYS_open, "linux/open_client", f, 0666); + if (-1 != res) + { + throw std::runtime_error("open should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } + +#if defined(SYS_openat2) + for (auto f : flags) + { + struct open_how oh = { .flags=f, .mode=((f&static_cast<__u64>(O_CREAT))?0666UL:0UL), .resolve=0 }; + int res = syscall(SYS_openat2, AT_FDCWD, "linux/open_client", &oh, sizeof(oh)); + if (-1 != res) + { + throw std::runtime_error("openat2 should have failed"); + } + else + { + if (errno != ETXTBSY) + { + throw std::runtime_error("errno should be ETXTBSY"); + } + } + } +#endif +} diff --git a/none/tests/linux/open_client.stderr.exp b/none/tests/linux/open_client.stderr.exp new file mode 100644 index 000000000..e69de29bb diff --git a/none/tests/linux/open_client.vgtest b/none/tests/linux/open_client.vgtest new file mode 100644 index 000000000..6b930efe6 --- /dev/null +++ b/none/tests/linux/open_client.vgtest @@ -0,0 +1,2 @@ +prog: open_client +vgopts: -q From 088ac305a2f27b4d8d5822bace59742719cc84d5 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 19 Jul 2025 18:17:35 +0200 Subject: [PATCH 125/412] Bug 506910 - openat2 with RESOLVE_NO_MAGICLINKS succeeds on /proc/self/exe Previous change did most of the work but need to return without setting SfMayBlock. Add a testcase covering /proc/self/exe and /proc/PID/exe. --- .gitignore | 1 + NEWS | 1 + coregrind/m_syswrap/syswrap-generic.c | 1 + coregrind/m_syswrap/syswrap-linux.c | 3 +- none/tests/linux/Makefile.am | 3 ++ none/tests/linux/bug506910.cpp | 44 +++++++++++++++++++++++++++ none/tests/linux/bug506910.stderr.exp | 2 ++ none/tests/linux/bug506910.vgtest | 1 + 8 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 none/tests/linux/bug506910.cpp create mode 100644 none/tests/linux/bug506910.stderr.exp create mode 100644 none/tests/linux/bug506910.vgtest diff --git a/.gitignore b/.gitignore index 44454d08b..0da54a7eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1885,6 +1885,7 @@ /none/tests/linux/brk-overflow1 /none/tests/linux/brk-overflow2 /none/tests/linux/bug498317 +/none/tests/linux/bug506910 /none/tests/linux/clonev /none/tests/linux/Makefile /none/tests/linux/Makefile.in diff --git a/NEWS b/NEWS index af8810364..29e2274ea 100644 --- a/NEWS +++ b/NEWS @@ -58,6 +58,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506499 Unhandled syscall 592 (exterrctl - FreeBSD 506795 Better report which clone flags are problematic 506928 Wrap (deprecated) linux specific ustat syscall +506910 openat2 with RESOLVE_NO_MAGICLINKS succeeds on /proc/self/exe 506930 valgrind allows SIGKILL being reset to SIG_DFL 506970 mmap needs an EBADF fd_allowed check diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 727766869..280b1ccb6 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -4693,6 +4693,7 @@ PRE(sys_open) if (proc_self_exe) { // do the syscall with VG_(resolved_exename) SET_STATUS_from_SysRes(VG_(do_syscall3)(SYSNO, (Word)VG_(resolved_exename), ARG2, ARG3)); + return; } #endif // defined(VGO_linux) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index e16d293cd..d1cfdad69 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -6095,6 +6095,7 @@ PRE(sys_openat) // do the syscall with VG_(resolved_exename) SET_STATUS_from_SysRes(VG_(do_syscall4)(SYSNO, ARG1, (Word)VG_(resolved_exename), ARG3, ARG4)); + return; } /* Otherwise handle normally */ @@ -14093,9 +14094,9 @@ PRE(sys_openat2) } if (proc_self_exe) { - // do the syscall with VG_(resolved_exename) SET_STATUS_from_SysRes(VG_(do_syscall4)(SYSNO, ARG1, (Word)VG_(resolved_exename), ARG3, ARG4)); + return; } /* Otherwise handle normally */ diff --git a/none/tests/linux/Makefile.am b/none/tests/linux/Makefile.am index c81ffff54..c20b2d2d0 100644 --- a/none/tests/linux/Makefile.am +++ b/none/tests/linux/Makefile.am @@ -8,6 +8,7 @@ EXTRA_DIST = \ brk-overflow1.stderr.exp brk-overflow1.vgtest \ brk-overflow2.stderr.exp brk-overflow2.vgtest \ bug498317.stderr.exp bug498317.supp bug498317.vgtest \ + bug506910.stderr.exp bug506910.vgtest \ clonev.stdout.exp clonev.stderr.exp clonev.vgtest \ membarrier.stderr.exp membarrier.vgtest \ mremap.stderr.exp mremap.stderr.exp-glibc27 mremap.stdout.exp \ @@ -26,6 +27,7 @@ check_PROGRAMS = \ brk-overflow1 \ brk-overflow2 \ bug498317 \ + bug506910 \ clonev \ mremap \ mremap2 \ @@ -46,6 +48,7 @@ AM_CFLAGS += $(AM_FLAG_M3264_PRI) AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) # Special needs +bug506910_SOURCES = bug506910.cpp clonev_LDADD = -lpthread open_client_SOURCES = open_client.cpp pthread_stack_LDADD = -lpthread diff --git a/none/tests/linux/bug506910.cpp b/none/tests/linux/bug506910.cpp new file mode 100644 index 000000000..2dbadf56a --- /dev/null +++ b/none/tests/linux/bug506910.cpp @@ -0,0 +1,44 @@ +// For Bug 5056910 +// openat2 with RESOLVE_NO_MAGICLINKS succeeds on /proc/self/exe +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char** argv) +{ + auto pid = getpid(); + auto ppe = std::string("/proc/") + std::to_string(pid) + "/exe"; +#if defined(SYS_openat2) + struct open_how oh = { .flags=O_RDONLY, .mode=0UL, .resolve=RESOLVE_NO_MAGICLINKS }; + int res = syscall(SYS_openat2, AT_FDCWD, "/proc/self/exe", &oh, sizeof(oh)); + if (-1 != res) + { + throw std::runtime_error("openat2 should have failed"); + } + else + { + if (errno != ELOOP) + { + throw std::runtime_error("errno should be ELOOP"); + } + } + + res = syscall(SYS_openat2, AT_FDCWD, ppe.c_str(), &oh, sizeof(oh)); + if (-1 != res) + { + throw std::runtime_error("openat2 should have failed"); + } + else + { + if (errno != ELOOP) + { + throw std::runtime_error("errno should be ELOOP"); + } + } +#endif +} diff --git a/none/tests/linux/bug506910.stderr.exp b/none/tests/linux/bug506910.stderr.exp new file mode 100644 index 000000000..139597f9c --- /dev/null +++ b/none/tests/linux/bug506910.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/linux/bug506910.vgtest b/none/tests/linux/bug506910.vgtest new file mode 100644 index 000000000..28e3f2975 --- /dev/null +++ b/none/tests/linux/bug506910.vgtest @@ -0,0 +1 @@ +prog: bug506910 From 3c78edc2da61abfdbb494ec0437ca7ecafc3f278 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 19 Jul 2025 22:13:15 +0200 Subject: [PATCH 126/412] Linux arm64 and riscv64: for build for VG_(lstat) These 'new' architectures don't have 'old' syscalls like __NR_lstat so use __NR_newfstatat instead. Also modify the oen_client testcase so that it checks for the 'old' open syscall. --- coregrind/m_libcfile.c | 25 +++++++++++++++++++++---- none/tests/linux/open_client.cpp | 4 ++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index ff1ead4e7..6addb8761 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -680,17 +680,34 @@ SysRes VG_(lstat) ( const HChar* file_name, struct vg_stat* vgbuf ) SysRes res; VG_(memset)(vgbuf, 0, sizeof(*vgbuf)); -#if !defined(VGO_freebsd) || (__FreeBSD_version < 1200031) -#if defined(VGO_freebsd) - struct vki_freebsd11_stat buf; +#if defined(VGO_linux) + +struct vki_stat buf; + +#if defined(__NR_newfstatat) + res = VG_(do_syscall4)(__NR_newfstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW); #else - struct vki_stat buf; + res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf); #endif + +#elif defined(VGO_freebsd) + +#if (__FreeBSD_version < 1200031) + struct vki_freebsd11_stat buf; res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf); #else struct vki_stat buf; res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW); #endif + +#else + + /* check this on illumos and Darwin */ + struct vki_stat buf; + res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf); + +#endif + if (!sr_isError(res)) { TRANSLATE_TO_vg_stat(vgbuf, &buf); } diff --git a/none/tests/linux/open_client.cpp b/none/tests/linux/open_client.cpp index 4b336e7f0..2052286d4 100644 --- a/none/tests/linux/open_client.cpp +++ b/none/tests/linux/open_client.cpp @@ -36,6 +36,7 @@ int main(int argc, char** argv) } } +#if defined(SYS_open) for (auto f : flags) { int res = syscall(SYS_open, n.c_str(), f, 0666); @@ -52,6 +53,7 @@ int main(int argc, char** argv) } } } +#endif } if ((dotdot = open("..", O_DIRECTORY | O_RDONLY)) == -1) @@ -154,6 +156,7 @@ int main(int argc, char** argv) } } +#if defined(SYS_open) for (auto f : flags) { int res = syscall(SYS_open, "linux/open_client", f, 0666); @@ -169,6 +172,7 @@ int main(int argc, char** argv) } } } +#endif #if defined(SYS_openat2) for (auto f : flags) From 769ca880912f26f3b6033bfe08e7417580b02c25 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 19 Jul 2025 22:19:08 +0200 Subject: [PATCH 127/412] Just set filename ARG to handle /proc/self/exe in open, openat and openat2 This simplifies the logic a little and makes reasoning about how the PRE handler works slightly simpler. --- coregrind/m_syswrap/syswrap-generic.c | 3 +-- coregrind/m_syswrap/syswrap-linux.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 280b1ccb6..7ac86fbbc 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -4692,8 +4692,7 @@ PRE(sys_open) if (proc_self_exe) { // do the syscall with VG_(resolved_exename) - SET_STATUS_from_SysRes(VG_(do_syscall3)(SYSNO, (Word)VG_(resolved_exename), ARG2, ARG3)); - return; + ARG1 = (Word)VG_(resolved_exename); } #endif // defined(VGO_linux) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index d1cfdad69..552fceee8 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -6094,8 +6094,7 @@ PRE(sys_openat) if (proc_self_exe) { // do the syscall with VG_(resolved_exename) - SET_STATUS_from_SysRes(VG_(do_syscall4)(SYSNO, ARG1, (Word)VG_(resolved_exename), ARG3, ARG4)); - return; + ARG2 = (Word)VG_(resolved_exename); } /* Otherwise handle normally */ @@ -14095,8 +14094,7 @@ PRE(sys_openat2) if (proc_self_exe) { // do the syscall with VG_(resolved_exename) - SET_STATUS_from_SysRes(VG_(do_syscall4)(SYSNO, ARG1, (Word)VG_(resolved_exename), ARG3, ARG4)); - return; + ARG2 = (Word)VG_(resolved_exename); } /* Otherwise handle normally */ From c9f166b67728202906ff8f52a9e5c90ff25543fc Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 20 Jul 2025 07:46:47 +0200 Subject: [PATCH 128/412] Linux regtest: fix build of tests on old systems without openat2 --- none/tests/linux/Makefile.am | 10 +++++++--- none/tests/linux/bug506910.vgtest | 1 + none/tests/linux/open_client.vgtest | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/none/tests/linux/Makefile.am b/none/tests/linux/Makefile.am index c20b2d2d0..7bfcedc86 100644 --- a/none/tests/linux/Makefile.am +++ b/none/tests/linux/Makefile.am @@ -27,7 +27,6 @@ check_PROGRAMS = \ brk-overflow1 \ brk-overflow2 \ bug498317 \ - bug506910 \ clonev \ mremap \ mremap2 \ @@ -35,10 +34,13 @@ check_PROGRAMS = \ mremap4 \ mremap5 \ mremap6 \ - open_client \ pthread-stack \ stack-overflow +if HAVE_OPENAT2 + check_PROGRAMS += bug506910 open_client +endif + if HAVE_NR_MEMBARRIER check_PROGRAMS += membarrier endif @@ -48,9 +50,11 @@ AM_CFLAGS += $(AM_FLAG_M3264_PRI) AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) # Special needs +if HAVE_OPENAT2 bug506910_SOURCES = bug506910.cpp -clonev_LDADD = -lpthread open_client_SOURCES = open_client.cpp +endif +clonev_LDADD = -lpthread pthread_stack_LDADD = -lpthread stack_overflow_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ \ diff --git a/none/tests/linux/bug506910.vgtest b/none/tests/linux/bug506910.vgtest index 28e3f2975..b23362548 100644 --- a/none/tests/linux/bug506910.vgtest +++ b/none/tests/linux/bug506910.vgtest @@ -1 +1,2 @@ +prereq: test -x bug506910 prog: bug506910 diff --git a/none/tests/linux/open_client.vgtest b/none/tests/linux/open_client.vgtest index 6b930efe6..05eba98bb 100644 --- a/none/tests/linux/open_client.vgtest +++ b/none/tests/linux/open_client.vgtest @@ -1,2 +1,3 @@ +prereq: test -x open_client prog: open_client vgopts: -q From 5ae51164205ea47d20c3c7c215d563daf43b7ca1 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 20 Jul 2025 09:59:51 +0200 Subject: [PATCH 129/412] FreeBSD regtest: filter leak from memcheck/tests/gone_abrt_xml On amd64 there is a suppressed reachable that shows up in the leak summary. On arm64 there is no leak. So add a filter for leaks in xml files. --- memcheck/tests/Makefile.am | 1 + memcheck/tests/filter_xml_leak | 5 +++++ memcheck/tests/gone_abrt_xml.stderr.exp-freebsd | 2 -- memcheck/tests/gone_abrt_xml.vgtest | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100755 memcheck/tests/filter_xml_leak diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 860cb2076..aceed97b2 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -82,6 +82,7 @@ dist_noinst_SCRIPTS = \ filter_leak_cpp_interior \ filter_libc_variants \ filter_xml \ + filter_xml_leak \ filter_strchr \ filter_varinfo3 \ filter_memcheck \ diff --git a/memcheck/tests/filter_xml_leak b/memcheck/tests/filter_xml_leak new file mode 100755 index 000000000..31418f48d --- /dev/null +++ b/memcheck/tests/filter_xml_leak @@ -0,0 +1,5 @@ +#!/bin/sh + +./filter_xml "$@" | + +sed -e '/...<\/leak_summary>/,+1d' diff --git a/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd b/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd index 04643bbff..6f8d7ec92 100644 --- a/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd +++ b/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd @@ -55,8 +55,6 @@ aborting ... ... -... - diff --git a/memcheck/tests/gone_abrt_xml.vgtest b/memcheck/tests/gone_abrt_xml.vgtest index dc18192d1..6e2c5d504 100644 --- a/memcheck/tests/gone_abrt_xml.vgtest +++ b/memcheck/tests/gone_abrt_xml.vgtest @@ -1,5 +1,5 @@ prog: ../../gdbserver_tests/gone args: abort vgopts: --xml=yes --xml-fd=2 --log-file=/dev/null -stderr_filter: filter_xml +stderr_filter: filter_xml_leak cleanup: rm -f vgcore.* From 282fd0d3eb2b8d0b289b35311b05db4acddfdc14 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 20 Jul 2025 10:19:00 +0200 Subject: [PATCH 130/412] FreeBSD regtest: make memcheck/tests/freebsd/setcred consistent on arm64 and amd64 Was getting different errors due to the contents of junk pointers. --- memcheck/tests/freebsd/setcred.cpp | 9 +++++++-- memcheck/tests/freebsd/setcred.stderr.exp | 19 +++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/memcheck/tests/freebsd/setcred.cpp b/memcheck/tests/freebsd/setcred.cpp index 7553599df..464de08ef 100644 --- a/memcheck/tests/freebsd/setcred.cpp +++ b/memcheck/tests/freebsd/setcred.cpp @@ -1,14 +1,18 @@ #include #include +#include + +static long x0; int main() { + long *px{static_cast(malloc(2*sizeof(long)))}; + x0 = px[0]; struct setcred cred1; struct setcred* cred2; int flags1{0}; int flags2; size_t size1{sizeof(cred1)}; - size_t size2; std::memset(&cred1, 250, sizeof(cred1)); @@ -19,7 +23,7 @@ int main() setcred(flags1, nullptr, size1); // uninit - setcred(flags2, cred2, size2); + setcred(flags2, (struct setcred*)x0, size1+x0); cred2 = new struct setcred; @@ -27,5 +31,6 @@ int main() setcred(flags1, cred2, size1); delete cred2; + free(px); } diff --git a/memcheck/tests/freebsd/setcred.stderr.exp b/memcheck/tests/freebsd/setcred.stderr.exp index 1d9cecf8e..629ceacf8 100644 --- a/memcheck/tests/freebsd/setcred.stderr.exp +++ b/memcheck/tests/freebsd/setcred.stderr.exp @@ -1,30 +1,29 @@ Syscall param setcred(wcred) points to unaddressable byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:19) + by 0x........: main (setcred.cpp:23) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param setcred(flags) contains uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:22) + by 0x........: main (setcred.cpp:26) Syscall param setcred(wcred) contains uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:22) + by 0x........: main (setcred.cpp:26) Syscall param setcred(size) contains uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:22) + by 0x........: main (setcred.cpp:26) -Syscall param setcred(wcred) points to uninitialised byte(s) +Syscall param setcred(wcred) points to unaddressable byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:22) - Address 0x........ is on thread 1's stack - in frame #2, created by __libc_start1 (???:) + by 0x........: main (setcred.cpp:26) + Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param setcred(wcred) points to uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:27) + by 0x........: main (setcred.cpp:31) Address 0x........ is 0 bytes inside a block of size 48 alloc'd at 0x........: ...operator new... (vg_replace_malloc.c:...) - by 0x........: main (setcred.cpp:24) + by 0x........: main (setcred.cpp:28) From 42a1a2e601dd2860405a3475aeefbdfea144bd58 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 20 Jul 2025 08:39:40 +0000 Subject: [PATCH 131/412] fdleak.h: Mark close_inherited as possible unused because it is. Avoids compiler warning for track_bad.c --- none/tests/fdleak.h | 1 + 1 file changed, 1 insertion(+) diff --git a/none/tests/fdleak.h b/none/tests/fdleak.h index f0a6eac49..54c4895db 100644 --- a/none/tests/fdleak.h +++ b/none/tests/fdleak.h @@ -26,6 +26,7 @@ * - For Ubuntu 8.04, see also * https://bugs.launchpad.net/ubuntu/+source/seahorse/+bug/235184 */ +__attribute__((unused)) static void close_inherited (void) { struct stat sb; int i; int max_fds = sysconf (_SC_OPEN_MAX); From 1c9d639ecedbb98c01d1bbf30c43d119487ab0b4 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 20 Jul 2025 08:58:46 +0000 Subject: [PATCH 132/412] s390x: Fix crash when constant folding is disabled (BZ 507173) Followup to 942a48c1d which fixed the register usage of conditional moves for s390_insn_get_reg_usage. A similar fix is needed for s390_insn_map_regs considering the case when the condition is S390_CC_NEVER. Fixes https://bugs.kde.org/show_bug.cgi?id=507173 --- NEWS | 1 + VEX/priv/host_s390_defs.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 29e2274ea..d52bba0c2 100644 --- a/NEWS +++ b/NEWS @@ -61,6 +61,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506910 openat2 with RESOLVE_NO_MAGICLINKS succeeds on /proc/self/exe 506930 valgrind allows SIGKILL being reset to SIG_DFL 506970 mmap needs an EBADF fd_allowed check +507173 s390x: Crash when constant folding is disabled To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index 08a34a5fa..1ee1696b3 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -1118,8 +1118,10 @@ s390_insn_map_regs(HRegRemap *m, s390_insn *insn) break; case S390_INSN_COND_MOVE: - insn->variant.cond_move.dst = lookupHRegRemap(m, insn->variant.cond_move.dst); - s390_opnd_RMI_map_regs(m, &insn->variant.cond_move.src); + if (insn->variant.cond_move.cond != S390_CC_NEVER) { + insn->variant.cond_move.dst = lookupHRegRemap(m, insn->variant.cond_move.dst); + s390_opnd_RMI_map_regs(m, &insn->variant.cond_move.src); + } break; case S390_INSN_LOAD_IMMEDIATE: From d50def295ed7393d0e824030d602c9f7ff54371e Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 20 Jul 2025 09:05:23 +0000 Subject: [PATCH 133/412] Sort NEWS entries. --- NEWS | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index d52bba0c2..636bf61dd 100644 --- a/NEWS +++ b/NEWS @@ -32,16 +32,17 @@ are not entered into bugzilla tend to get forgotten about or ignored. 338803 Handling of dwz debug alt files or cross-CU is broken 418756 MAP_FIXED_NOREPLACE mmap flag unsupported 493434 Add --track-fds=bad mode (no "leak" tracking) +501741 syscall cachestat not wrapped +502359 Add --modify-fds=yes option +502968 Wrap linux specific syscalls 457 (listmount) and 458 (statmount) 503098 Incorrect NAN-boxing for float registers in RISC-V 503641 close_range syscalls started failing with 3.25.0 503677 duplicated-cond compiler warning in dis_RV64M 503817 s390x: fix 'ordered comparison of pointer with integer zero' compiler warnings 503914 mount syscall param filesystemtype may be NULL +503969 Make test results of make ltpchecks compatible with bunsen 504101 Add a "vgstack" script 504177 FILE DESCRIPTORS banner shows when closing some inherited fds -501741 syscall cachestat not wrapped -502359 Add --modify-fds=yes option -503969 Make test results of make ltpchecks compatible with bunsen 504265 FreeBSD: missing syscall wrappers for fchroot and setcred 504341 Valgrind killed by LTP syscall testcase setrlimit05 504466 Double close causes SEGV @@ -51,14 +52,13 @@ are not entered into bugzilla tend to get forgotten about or ignored. 504936 Add FreeBSD amd64 sysarch subcommands AMD64_SET_TLSBASE and AMD64_GET_TLSBASE 505228 Wrap linux specific mseal syscall -502968 Wrap linux specific syscalls 457 (listmount) and 458 (statmount) 505673 Valgrind crashes with an internal error and SIGBUS when the guest tries to open its own file with O_WRONLY|O_CREAT|O_TRUNC 506076 unimplemented fcntl command: 1028 (F_CREATED_QUERY) 506499 Unhandled syscall 592 (exterrctl - FreeBSD 506795 Better report which clone flags are problematic -506928 Wrap (deprecated) linux specific ustat syscall 506910 openat2 with RESOLVE_NO_MAGICLINKS succeeds on /proc/self/exe +506928 Wrap (deprecated) linux specific ustat syscall 506930 valgrind allows SIGKILL being reset to SIG_DFL 506970 mmap needs an EBADF fd_allowed check 507173 s390x: Crash when constant folding is disabled From aff0606d38fdb75829f084795c39be0d6123f047 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 20 Jul 2025 18:56:44 +0200 Subject: [PATCH 134/412] FreeBSD regtest: add a testcase for exterrctl This is a function for libc internal use only, so this test doesn't really add much compared to the scalar test. --- .gitignore | 1 + configure.ac | 5 ++++- memcheck/tests/freebsd/Makefile.am | 9 +++++++++ memcheck/tests/freebsd/exterrctl.cpp | 20 +++++++++++++++++++ memcheck/tests/freebsd/exterrctl.stderr.exp | 22 +++++++++++++++++++++ memcheck/tests/freebsd/exterrctl.vgtest | 3 +++ 6 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 memcheck/tests/freebsd/exterrctl.cpp create mode 100644 memcheck/tests/freebsd/exterrctl.stderr.exp create mode 100644 memcheck/tests/freebsd/exterrctl.vgtest diff --git a/.gitignore b/.gitignore index 0da54a7eb..0283b8d5b 100644 --- a/.gitignore +++ b/.gitignore @@ -1434,6 +1434,7 @@ /memcheck/tests/freebsd/eventfd1 /memcheck/tests/freebsd/eventfd2 /memcheck/tests/freebsd/extattr +/memcheck/tests/freebsd/exterrctl /memcheck/tests/freebsd/fbsd278566 /memcheck/tests/freebsd/fchroot /memcheck/tests/freebsd/fexecve diff --git a/configure.ac b/configure.ac index d64782728..804493c2f 100755 --- a/configure.ac +++ b/configure.ac @@ -5008,7 +5008,8 @@ AC_CHECK_FUNCS([ \ getrlimitusage \ timer_delete \ fchroot \ - setcred + setcred \ + exterrctl ]) # AC_CHECK_LIB adds any library found to the variable LIBS, and links these @@ -5070,6 +5071,8 @@ AM_CONDITIONAL([HAVE_FCHROOT], [test x$ac_cv_func_fchroot = xyes]) AM_CONDITIONAL([HAVE_SETCRED], [test x$ac_cv_func_setcred = xyes]) +AM_CONDITIONAL([HAVE_EXTERRCTL], + [test x$ac_cv_func_exterrctl = xyes]) if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \ -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \ diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index d96cde1b1..0f00d67a4 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -51,6 +51,8 @@ EXTRA_DIST = \ eventfd2.stderr.exp \ extattr.vgtest \ extattr.stderr.exp \ + exterrctl.vgtest \ + exterrctl.stderr.exp \ fbsd278566.vgtest \ fbsd278566.stderr.exp \ fchroot.vgtest \ @@ -183,6 +185,10 @@ if HAVE_AIO_READV check_PROGRAMS += aiov endif +if HAVE_EXTERRCTL +check_PROGRAMS += exterrctl +endif + if HAVE_FCHROOT check_PROGRAMS += fchroot fchroot_SOURCES = fchroot.cpp @@ -236,6 +242,9 @@ delete_sized_mismatch_CXXFLAGS = ${AM_CXXFLAGS} --std=c++14 delete_sized_mismatch_SOURCES = delete_sized_mismatch.cpp errno_aligned_allocs_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ extattr_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_BUT_SET_VARIABLE@ @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +if HAVE_EXTERRCTL +exterrctl_SOURCES = exterrctl.cpp +endif get_set_login_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ getfh_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ getfsstat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ diff --git a/memcheck/tests/freebsd/exterrctl.cpp b/memcheck/tests/freebsd/exterrctl.cpp new file mode 100644 index 000000000..c93af3315 --- /dev/null +++ b/memcheck/tests/freebsd/exterrctl.cpp @@ -0,0 +1,20 @@ +#include +#include + +static long x0; + +int main() +{ + // int exterrctl(u_int op, u_int flags, void *ptr); + // op should be 0 or EXTERRCTLF_FORCE (1) + // flags EXTERRCTL_ENABLE EXTERRCTL_DISABLE EXTERRCTL_UD (1 2 3) + // see sys/sys/_uexterror.h for ptr + long *px{static_cast(malloc(2*sizeof(long)))}; + x0 = px[0]; + + char *foo = new char [48+128]; + delete [] foo; + + exterrctl(x0, x0+2, x0+foo); +} + diff --git a/memcheck/tests/freebsd/exterrctl.stderr.exp b/memcheck/tests/freebsd/exterrctl.stderr.exp new file mode 100644 index 000000000..59c7f2dc1 --- /dev/null +++ b/memcheck/tests/freebsd/exterrctl.stderr.exp @@ -0,0 +1,22 @@ +Syscall param exterrctl(op) contains uninitialised byte(s) + at 0x........: exterrctl (in /...libc...) + by 0x........: main (exterrctl.cpp:18) + +Syscall param exterrctl(flags) contains uninitialised byte(s) + at 0x........: exterrctl (in /...libc...) + by 0x........: main (exterrctl.cpp:18) + +Syscall param exterrctl(ptr) contains uninitialised byte(s) + at 0x........: exterrctl (in /...libc...) + by 0x........: main (exterrctl.cpp:18) + +Syscall param exterrctl(ptr) points to unaddressable byte(s) + at 0x........: exterrctl (in /...libc...) + by 0x........: main (exterrctl.cpp:18) + Address 0x........ is 0 bytes inside a block of size 176 free'd + at 0x........: ...operator delete[]... (vg_replace_malloc.c:...) + by 0x........: main (exterrctl.cpp:16) + Block was alloc'd at + at 0x........: ...operator new[]... (vg_replace_malloc.c:...) + by 0x........: main (exterrctl.cpp:15) + diff --git a/memcheck/tests/freebsd/exterrctl.vgtest b/memcheck/tests/freebsd/exterrctl.vgtest new file mode 100644 index 000000000..53d929be8 --- /dev/null +++ b/memcheck/tests/freebsd/exterrctl.vgtest @@ -0,0 +1,3 @@ +prereq: test -x ./exterrctl +prog: exterrctl +vgopts: -q From 4832fda1122a8919eb70f97dc7b0ad67d14db618 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 20 Jul 2025 19:08:46 +0200 Subject: [PATCH 135/412] FreeBSD compiler warnings Fix a few warnings that I now get with clang 19 on FreeBSD 15. --- coregrind/m_syswrap/syswrap-freebsd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index df223a2a0..ac371e125 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -3730,7 +3730,7 @@ PRE(sys_kenv) default: if (VG_(clo_verbosity) >= 1) { VG_(umsg)("Warning: bad or unimplemented kenv action: %" FMT_REGWORD "d\n", - ARG1); + SARG1); } break; } @@ -7087,7 +7087,7 @@ POST(sys_getrlimitusage) // int fchroot(int fd); PRE(sys_fchroot) { - PRINT("sys_fchroot(%" FMT_REGWORD "d)", ARG1); + PRINT("sys_fchroot(%" FMT_REGWORD "d)", SARG1); PRE_REG_READ1(int, "fchroot", int, fd); /* Be strict. */ @@ -7099,7 +7099,7 @@ PRE(sys_fchroot) // int setcred(u_int flags, const struct setcred *wcred, size_t size); PRE(sys_setcred) { - PRINT("sys_setcred(%" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u)", ARG1, ARG2, ARG3); + PRINT("sys_setcred(%" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u)", ARG1, ARG2, ARG3); PRE_REG_READ3(int, "setcred", u_int, flags, const struct setcred*, wcred, size_t, size); PRE_MEM_READ("setcred(wcred)", ARG2, sizeof(struct vki_setcred)); } From c430ffabb27cc6f4b18a6ad1a71185e0e47b3c6a Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 20 Jul 2025 17:58:10 +0000 Subject: [PATCH 136/412] Fix compiler warnings on ppc due to unused s390 specific variables. --- coregrind/m_debuginfo/debuginfo.c | 44 +++++++++++++------------------ 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 4ce976a6d..63ed32608 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -3554,7 +3554,6 @@ Bool VG_(use_CF_info) ( /*MOD*/D3UnwindRegs* uregsHere, # endif # if defined(VGA_s390x) - const Bool is_s390x = True; const Addr old_S390X_F0 = uregsHere->f0; const Addr old_S390X_F1 = uregsHere->f1; const Addr old_S390X_F2 = uregsHere->f2; @@ -3563,16 +3562,9 @@ Bool VG_(use_CF_info) ( /*MOD*/D3UnwindRegs* uregsHere, const Addr old_S390X_F5 = uregsHere->f5; const Addr old_S390X_F6 = uregsHere->f6; const Addr old_S390X_F7 = uregsHere->f7; +# define SAVE_TO_PREV(p,reg) do { p = reg; } while (0) # else - const Bool is_s390x = False; - const Addr old_S390X_F0 = 0; - const Addr old_S390X_F1 = 0; - const Addr old_S390X_F2 = 0; - const Addr old_S390X_F3 = 0; - const Addr old_S390X_F4 = 0; - const Addr old_S390X_F5 = 0; - const Addr old_S390X_F6 = 0; - const Addr old_S390X_F7 = 0; +# define SAVE_TO_PREV(p,reg) do { vg_assert(0); } while (0) # endif # define COMPUTE(_prev, _here, _how, _off) \ @@ -3604,29 +3596,29 @@ Bool VG_(use_CF_info) ( /*MOD*/D3UnwindRegs* uregsHere, if (!ok) return False; \ break; \ case CFIR_S390X_F0: \ - if (is_s390x) { _prev = old_S390X_F0; break; } \ - vg_assert(0+0-0); \ + SAVE_TO_PREV(_prev, old_S390X_F0); \ + break; \ case CFIR_S390X_F1: \ - if (is_s390x) { _prev = old_S390X_F1; break; } \ - vg_assert(0+1-1); \ + SAVE_TO_PREV(_prev, old_S390X_F1); \ + break; \ case CFIR_S390X_F2: \ - if (is_s390x) { _prev = old_S390X_F2; break; } \ - vg_assert(0+2-2); \ + SAVE_TO_PREV(_prev, old_S390X_F2); \ + break; \ case CFIR_S390X_F3: \ - if (is_s390x) { _prev = old_S390X_F3; break; } \ - vg_assert(0+3-3); \ + SAVE_TO_PREV(_prev, old_S390X_F3); \ + break; \ case CFIR_S390X_F4: \ - if (is_s390x) { _prev = old_S390X_F4; break; } \ - vg_assert(0+4-4); \ + SAVE_TO_PREV(_prev, old_S390X_F4); \ + break; \ case CFIR_S390X_F5: \ - if (is_s390x) { _prev = old_S390X_F5; break; } \ - vg_assert(0+5-5); \ + SAVE_TO_PREV(_prev, old_S390X_F5); \ + break; \ case CFIR_S390X_F6: \ - if (is_s390x) { _prev = old_S390X_F6; break; } \ - vg_assert(0+6-6); \ + SAVE_TO_PREV(_prev, old_S390X_F6); \ + break; \ case CFIR_S390X_F7: \ - if (is_s390x) { _prev = old_S390X_F7; break; } \ - vg_assert(0+7-7); \ + SAVE_TO_PREV(_prev, old_S390X_F7); \ + break; \ default: \ vg_assert(0*0); \ } \ From 1a1f03a87af2d45e9a11b7230957fdb814b32c8a Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 21 Jul 2025 07:07:23 +0200 Subject: [PATCH 137/412] gdbserver regtest: remove extra lines containing syscall_cancel.S Should fix some fails that we see on Tom's Fedora 42 nightly. --- gdbserver_tests/filter_gdb.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in index 98f28d13c..ccd48212d 100755 --- a/gdbserver_tests/filter_gdb.in +++ b/gdbserver_tests/filter_gdb.in @@ -149,6 +149,9 @@ s/__libc_do_syscall ().*/0x........ in syscall .../ # extra source code line /libc-do-syscall.S/d +# variation of the previous extra source code line +/syscall_cancel.S/d + # anonymise kill syscall. s/in kill ().*$/in syscall .../ From 2228bc1ce20265ff084d2b24b81461d849f72bdf Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 21 Jul 2025 08:01:13 +0200 Subject: [PATCH 138/412] FreeBSD regtest: remove stray backslash in a string in scalar test --- memcheck/tests/freebsd/scalar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index ce76ffdb2..9c67888f9 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -2495,7 +2495,7 @@ int main(void) FAKE_SY("\n"); FAKE_SY("Syscall param exterrctl(ptr) points to unaddressable byte(s)\n"); FAKE_SY(" ...\n"); - FAKE_SY("\ Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); + FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); FAKE_SY("\n"); #endif From 4810c14b5d636e758660a7cae931fa82071b86eb Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 23 Jul 2025 20:20:54 +0000 Subject: [PATCH 139/412] tests/x86_amd_features.c: also recognise GenuineIntel Enables running certain testcases on hardware that identifies itself as "GenuineIntel". --- tests/x86_amd64_features.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/x86_amd64_features.c b/tests/x86_amd64_features.c index 488f155b6..5a95e06df 100644 --- a/tests/x86_amd64_features.c +++ b/tests/x86_amd64_features.c @@ -148,7 +148,8 @@ static Bool go(char* cpu) assert( !(cmask != 0 && dmask != 0 && bmask != 0) ); assert( !(cmask == 0 && dmask == 0 && bmask == 0) ); - if (require_amd && !vendorStringEquals("AuthenticAMD")) + if (require_amd && !vendorStringEquals("AuthenticAMD") && + !vendorStringEquals("GenuineIntel")) return FEATURE_NOT_PRESENT; // regardless of what that feature actually is From 714b71ea5dc552d297b8759e18a9006ff3802d18 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 24 Jul 2025 09:43:04 +0000 Subject: [PATCH 140/412] tests/x86_amd_features.c: followup to 4810c14b5d Do not rely on hardware identifying itself in a particular way. Enable lzcnt for non-AMD hardware. --- tests/x86_amd64_features.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/x86_amd64_features.c b/tests/x86_amd64_features.c index 5a95e06df..955cca13b 100644 --- a/tests/x86_amd64_features.c +++ b/tests/x86_amd64_features.c @@ -102,7 +102,6 @@ static Bool go(char* cpu) } else if ( strcmp( cpu, "x86-lzcnt" ) == 0 ) { level = 0x80000001; cmask = 1 << 5; - require_amd = True; #if defined(VGA_amd64) } else if ( strcmp( cpu, "amd64-sse3" ) == 0 ) { level = 1; @@ -119,7 +118,6 @@ static Bool go(char* cpu) } else if ( strcmp( cpu, "amd64-lzcnt" ) == 0 ) { level = 0x80000001; cmask = 1 << 5; - require_amd = True; } else if ( strcmp( cpu, "amd64-sse42" ) == 0 ) { level = 1; cmask = 1 << 20; @@ -148,8 +146,7 @@ static Bool go(char* cpu) assert( !(cmask != 0 && dmask != 0 && bmask != 0) ); assert( !(cmask == 0 && dmask == 0 && bmask == 0) ); - if (require_amd && !vendorStringEquals("AuthenticAMD") && - !vendorStringEquals("GenuineIntel")) + if (require_amd && !vendorStringEquals("AuthenticAMD")) return FEATURE_NOT_PRESENT; // regardless of what that feature actually is From 13eb7509bf22b67ccca1b521e10f2984985d1b5d Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 24 Jul 2025 22:41:11 +0200 Subject: [PATCH 141/412] README_DEVELOPERS: add some description of scalar tests --- README_DEVELOPERS | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README_DEVELOPERS b/README_DEVELOPERS index 4444a1750..5bcb8ea87 100644 --- a/README_DEVELOPERS +++ b/README_DEVELOPERS @@ -196,7 +196,18 @@ Make sure that the test runs and passes. The last file to change is .gitignore in the top directory. Add a new entry, for example "/tool/tests/newtest". -Check for mistakes in Makefile.am. In the top directory run +The 'scalar' tests are something of a special case. Scalar in this sense +refers to the registers (or stack slots) used to pas in arguments. These tests +directly use the 'syscall' syscall via a macro, SY. They make little effort +to use the sysall in a realistic manner. Rather, the objective is to +exhaustively test all of the arguemnts and referenced memory of syscalls. +A second macro, GO, is used precede the syscall (and subsequent errors) +with a header. The GO string includes the name of the syscall, a count of +expected scalar errors and a count of memory errors. + +When your test is done check for mistakes in Makefile.am. +In the top directory run + make post-regtest-checks You should only see From 0369a3b9c7dd216b660615d91ae3836f69d674fa Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 24 Jul 2025 22:44:09 +0200 Subject: [PATCH 142/412] README_DEVELOPERS: more on scalar test One typo and add an example. --- README_DEVELOPERS | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/README_DEVELOPERS b/README_DEVELOPERS index 5bcb8ea87..a3360580e 100644 --- a/README_DEVELOPERS +++ b/README_DEVELOPERS @@ -197,13 +197,27 @@ The last file to change is .gitignore in the top directory. Add a new entry, for example "/tool/tests/newtest". The 'scalar' tests are something of a special case. Scalar in this sense -refers to the registers (or stack slots) used to pas in arguments. These tests +refers to the registers (or stack slots) used to pass in arguments. These tests directly use the 'syscall' syscall via a macro, SY. They make little effort to use the sysall in a realistic manner. Rather, the objective is to exhaustively test all of the arguemnts and referenced memory of syscalls. +The variable 'x0' is a long integer, containing the value of 0 but +also uninitialised. It can be used on its own or with some other value +to ensure that all of the syscall arguemts are uninitialised. A second macro, GO, is used precede the syscall (and subsequent errors) with a header. The GO string includes the name of the syscall, a count of -expected scalar errors and a count of memory errors. +expected scalar errors and a count of memory errors. The tests are usually +followed by the FAIL macro, which ensures that the syscall failed. +An example scalar test is + + /* SYS_link 9 */ + GO(SYS_link, "2s 2m"); + SY(SYS_link, x0, x0); FAIL; + + +This syscall takes two strings so the expected errors are +2 scalar (for the pointer arguments) and 2 memory (for +the strings themselves). When your test is done check for mistakes in Makefile.am. In the top directory run From 359e33acaf8cded1312e75709b91d4f8156ae574 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 24 Jul 2025 22:45:01 +0200 Subject: [PATCH 143/412] FreeBSD syscall: improve sigwait and sigwaitinfo wrapper. Both take two pointers. We were allowing null pointers for all of them. Only the 2nd argument of sigwaitinfo, info, is allowed to be NULL. Update the scalar test with some NULL arguments for these syscalls. --- coregrind/m_syswrap/syswrap-freebsd.c | 23 ++++++++---------- memcheck/tests/freebsd/scalar.c | 10 +++++++- memcheck/tests/freebsd/scalar.stderr.exp | 30 ++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 14 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index ac371e125..08c4ec3c3 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -3317,9 +3317,7 @@ PRE(sys_sigwaitinfo) ARG1,ARG2); PRE_REG_READ2(int, "sigwaitinfo", const vki_sigset_t *, set, vki_siginfo_t *, info); - if (ARG1 != 0) { - PRE_MEM_READ( "sigwaitinfo(set)", ARG1, sizeof(vki_sigset_t)); - } + PRE_MEM_READ( "sigwaitinfo(set)", ARG1, sizeof(vki_sigset_t)); if (ARG2 != 0) { PRE_MEM_WRITE( "sigwaitinfo(info)", ARG2, sizeof(vki_siginfo_t) ); } @@ -4099,21 +4097,20 @@ PRE(sys_sigwait) ARG1,ARG2); PRE_REG_READ2(int, "sigwait", const vki_sigset_t *, set, int *, sig); - if (ARG1 != 0) { - PRE_MEM_READ( "sigwait(set)", ARG1, sizeof(vki_sigset_t)); - vki_sigset_t* set = (vki_sigset_t*)ARG1; - if (ML_(safe_to_deref)(set, sizeof(vki_sigset_t))) { - *flags |= SfMayBlock; - } - } - if (ARG2 != 0) { - PRE_MEM_WRITE( "sigwait(sig)", ARG2, sizeof(int)); + PRE_MEM_READ( "sigwait(set)", ARG1, sizeof(vki_sigset_t)); + vki_sigset_t* set = (vki_sigset_t*)ARG1; + if (ML_(safe_to_deref)(set, sizeof(vki_sigset_t))) { + *flags |= SfMayBlock; } + PRE_MEM_WRITE( "sigwait(sig)", ARG2, sizeof(int)); } +// sigwait doesn't follow the norm of returning -1 on error +// instead it returns errno if there is an error POST(sys_sigwait) { - if (RES == 0 && ARG2 != 0) { + if (RES == 0) + { POST_MEM_WRITE( ARG2, sizeof(int)); } } diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index 9c67888f9..234e649f7 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -1271,7 +1271,11 @@ int main(void) /* SYS_sigwaitinfo 346 */ GO(SYS_sigwaitinfo, "2s 2m"); - SY(SYS_sigwaitinfo, x0+1, x0+2, x0+3); FAIL; + SY(SYS_sigwaitinfo, x0+1, x0+2); FAIL; + + GO(SYS_sigwaitinfo, "(NULL info) 2s 1m"); + SY(SYS_sigwaitinfo, x0, x0); FAIL; + /* SYS___acl_get_file 347 */ GO(SYS___acl_get_file, "3s 2m"); @@ -1549,6 +1553,10 @@ int main(void) SY(SYS_sigwait, x0+1, x0+2); SUCC; assert(res == EFAULT); + GO(SYS_sigwait, "(NULL ags) 2s 2m"); + SY(SYS_sigwait, x0, x0); SUCC; + assert(res == EFAULT); + // thr_create 430 /* SYS_thr_exit 431 */ diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index dbe79c6e8..ae9c15f6a 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -2509,6 +2509,19 @@ Syscall param sigwaitinfo(info) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +346: SYS_sigwaitinfo (NULL info) 2s 1m +--------------------------------------------------------- +Syscall param sigwaitinfo(set) contains uninitialised byte(s) + ... + +Syscall param sigwaitinfo(info) contains uninitialised byte(s) + ... + +Syscall param sigwaitinfo(set) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 347: SYS___acl_get_file 3s 2m --------------------------------------------------------- @@ -3360,6 +3373,23 @@ Syscall param sigwait(sig) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +429: SYS_sigwait (NULL ags) 2s 2m +--------------------------------------------------------- +Syscall param sigwait(set) contains uninitialised byte(s) + ... + +Syscall param sigwait(sig) contains uninitialised byte(s) + ... + +Syscall param sigwait(set) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param sigwait(sig) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 431: SYS_thr_exit other --------------------------------------------------------- From 1b5773d82046701f66697f68599acf0753db0402 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 25 Jul 2025 07:48:25 +0200 Subject: [PATCH 144/412] FreeBSD regtest: update 32bit scalar expected --- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index ea5abb9c6..51ae7e94c 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -2515,6 +2515,19 @@ Syscall param sigwaitinfo(info) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +346: SYS_sigwaitinfo (NULL info) 2s 1m +--------------------------------------------------------- +Syscall param sigwaitinfo(set) contains uninitialised byte(s) + ... + +Syscall param sigwaitinfo(info) contains uninitialised byte(s) + ... + +Syscall param sigwaitinfo(set) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 347: SYS___acl_get_file 3s 2m --------------------------------------------------------- @@ -3369,6 +3382,23 @@ Syscall param sigwait(sig) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +429: SYS_sigwait (NULL ags) 2s 2m +--------------------------------------------------------- +Syscall param sigwait(set) contains uninitialised byte(s) + ... + +Syscall param sigwait(sig) contains uninitialised byte(s) + ... + +Syscall param sigwait(set) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param sigwait(sig) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 431: SYS_thr_exit other --------------------------------------------------------- From 5a159cf245ff4fec2fd148c899ce7a0380ca3d04 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 25 Jul 2025 21:11:57 +0000 Subject: [PATCH 145/412] iropt-test: Refactor code Refactor code in preparation for running each testcase twice: once with constant folding and once without. - remove function print_opnd - remove function complain - factor out function get_expected_value - checking the result moved to valgrind_execute_test - make IRICB a static global in valgrind.c - new_iricb now returns a pointer to it --- none/tests/iropt-test/binary.c | 41 ++++++---------------------- none/tests/iropt-test/main.c | 4 +-- none/tests/iropt-test/unary.c | 38 ++++++-------------------- none/tests/iropt-test/util.c | 29 -------------------- none/tests/iropt-test/valgrind.c | 47 +++++++++++++++++++++++++------- none/tests/iropt-test/vtest.h | 6 ++-- 6 files changed, 58 insertions(+), 107 deletions(-) diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c index 62c9faeb3..0d40a4da3 100644 --- a/none/tests/iropt-test/binary.c +++ b/none/tests/iropt-test/binary.c @@ -26,7 +26,7 @@ #include // UINT64_MAX #include "vtest.h" -static void check_result(const irop_t *, const test_data_t *); +static uint64_t get_expected_value(const irop_t *, const test_data_t *); static void run_tests(const irop_t *, test_data_t *); static void run_shift_tests(const irop_t *, test_data_t *); static int is_shift_op(IROp); @@ -59,8 +59,7 @@ run_selected_tests(const irop_t *op, test_data_t *data) if (is_division_op(op->op) && opnd_r->value == 0) continue; - valgrind_execute_test(op, data); - check_result(op, data); + valgrind_execute_test(op, data, get_expected_value(op, data)); } } } @@ -79,8 +78,7 @@ run_random_tests(const irop_t *op, test_data_t *data) if (is_division_op(op->op) && opnd_r->value == 0) continue; - valgrind_execute_test(op, data); - check_result(op, data); + valgrind_execute_test(op, data, get_expected_value(op, data)); } } @@ -101,8 +99,7 @@ run_shift_tests(const irop_t *op, test_data_t *data) for (unsigned j = 0; j < max_shift_amount; ++j) { opnd_r->value = j; - valgrind_execute_test(op, data); - check_result(op, data); + valgrind_execute_test(op, data, get_expected_value(op, data)); } } @@ -111,8 +108,7 @@ run_shift_tests(const irop_t *op, test_data_t *data) opnd_l->value = get_random_value(opnd_l->type); opnd_r->value = get_random_value(opnd_r->type) & max_shift_amount; - valgrind_execute_test(op, data); - check_result(op, data); + valgrind_execute_test(op, data, get_expected_value(op, data)); } } @@ -125,11 +121,10 @@ run_tests(const irop_t *op, test_data_t *data) } -/* Check the result of a binary operation. */ -static void -check_result(const irop_t *op, const test_data_t *data) +/* Compute the expected result of a binary operation. */ +static uint64_t +get_expected_value(const irop_t *op, const test_data_t *data) { - uint64_t result = data->result.value; uint64_t opnd_l = data->opnds[0].value; uint64_t opnd_r = data->opnds[1].value; uint64_t expected; @@ -384,25 +379,7 @@ check_result(const irop_t *op, const test_data_t *data) panic(__func__); } - if (verbose > 1) { - printf("expected: value = "); - print_value(stdout, expected, bitsof_irtype(data->result.type)); - printf("\n"); - } - - int ok = 1; - switch (data->result.type) { - case Ity_I1: ok = result == expected; break; - case Ity_I8: ok = result == expected; break; - case Ity_I16: ok = result == expected; break; - case Ity_I32: ok = result == expected; break; - case Ity_I64: ok = result == expected; break; - default: - panic(__func__); - } - - if (! ok) - complain(op, data, expected); + return expected; } diff --git a/none/tests/iropt-test/main.c b/none/tests/iropt-test/main.c index 9f1cc5083..8fcf9fb45 100644 --- a/none/tests/iropt-test/main.c +++ b/none/tests/iropt-test/main.c @@ -81,9 +81,9 @@ main(int argc, char *argv[]) test_data_t *data = new_test_data(op); - IRICB iricb = new_iricb(op, data); + IRICB *iricb = new_iricb(op, data); - valgrind_vex_init_for_iri(&iricb); + valgrind_vex_init_for_iri(iricb); switch (op->num_opnds) { case 1: diff --git a/none/tests/iropt-test/unary.c b/none/tests/iropt-test/unary.c index e6554cef6..fa961f28a 100644 --- a/none/tests/iropt-test/unary.c +++ b/none/tests/iropt-test/unary.c @@ -27,9 +27,9 @@ #include // UINT64_MAX #include "vtest.h" -static void check_result(const irop_t *, const test_data_t *); static void run_selected_tests(const irop_t *, test_data_t *); static void run_random_tests(const irop_t *, test_data_t *); +static uint64_t get_expected_value(const irop_t *, const test_data_t *); static uint64_t left(uint64_t, unsigned); static uint32_t popcount(uint64_t); static uint32_t clz(uint64_t, unsigned); @@ -49,8 +49,7 @@ test_unary_op(const irop_t *op, test_data_t *data) for (unsigned i = 0; i <= max; ++i) { opnd->value = i; - valgrind_execute_test(op, data); - check_result(op, data); + valgrind_execute_test(op, data, get_expected_value(op, data)); } break; } @@ -78,8 +77,7 @@ run_selected_tests(const irop_t *op, test_data_t *data) for (unsigned i = 0; i < num_val; ++i) { opnd->value = values[i]; - valgrind_execute_test(op, data); - check_result(op, data); + valgrind_execute_test(op, data, get_expected_value(op, data)); } } @@ -93,17 +91,15 @@ run_random_tests(const irop_t *op, test_data_t *data) for (unsigned i = 0; i < num_random_tests; ++i) { opnd->value = get_random_value(opnd->type); - valgrind_execute_test(op, data); - check_result(op, data); + valgrind_execute_test(op, data, get_expected_value(op, data)); } } -/* Check the result of a unary operation. */ -static void -check_result(const irop_t *op, const test_data_t *data) +/* Compute the expected result of a unary operation. */ +static uint64_t +get_expected_value(const irop_t *op, const test_data_t *data) { - uint64_t result = data->result.value; uint64_t opnd = data->opnds[0].value; uint64_t expected; @@ -209,25 +205,7 @@ check_result(const irop_t *op, const test_data_t *data) panic("%s: operator %s not handled\n", __func__, op->name); } - if (verbose > 1) { - printf("expected: value = "); - print_value(stdout, expected, bitsof_irtype(data->result.type)); - printf("\n"); - } - - int ok = 1; - switch (data->result.type) { - case Ity_I1: ok = result == expected; break; - case Ity_I8: ok = result == expected; break; - case Ity_I16: ok = result == expected; break; - case Ity_I32: ok = result == expected; break; - case Ity_I64: ok = result == expected; break; - default: - panic(__func__); - } - - if (! ok) - complain(op, data, expected); + return expected; } diff --git a/none/tests/iropt-test/util.c b/none/tests/iropt-test/util.c index 18b671114..f34936611 100644 --- a/none/tests/iropt-test/util.c +++ b/none/tests/iropt-test/util.c @@ -44,27 +44,6 @@ panic(const char *fmt, ...) } -/* Issue a complaint because the result of an operation differs from what - was expected. */ -void -complain(const irop_t *op, const test_data_t *data, uint64_t expected) -{ - fprintf(stderr, "*** Incorrect result for operator %s\n", op->name); - - for (unsigned i = 0; i < op->num_opnds; ++i) { - fprintf(stderr, " opnd %u: ", i); - print_opnd(stderr, &data->opnds[i]); - fprintf(stderr, "\n"); - } - fprintf(stderr, " result: "); - print_opnd(stderr, &data->result); - fprintf(stderr, "\n"); - fprintf(stderr, " expect: "); - print_value(stderr, expected, bitsof_irtype(op->result_type)); - fprintf(stderr, "\n"); -} - - void print_value(FILE *fp, uint64_t val, unsigned num_bits) { @@ -83,14 +62,6 @@ print_value(FILE *fp, uint64_t val, unsigned num_bits) } -void -print_opnd(FILE *fp, const opnd_t *opnd) -{ - fprintf(fp, "value = "); - print_value(fp, opnd->value, bitsof_irtype(opnd->type)); -} - - unsigned bitsof_irtype(IRType ty) { diff --git a/none/tests/iropt-test/valgrind.c b/none/tests/iropt-test/valgrind.c index e482909b1..004c8a09a 100644 --- a/none/tests/iropt-test/valgrind.c +++ b/none/tests/iropt-test/valgrind.c @@ -26,9 +26,10 @@ #include "valgrind.h" // VALGRIND_VEX_INJECT_IR #include "vtest.h" +static IRICB iricb; /* Return a completely initialised control block */ -IRICB +IRICB * new_iricb(const irop_t *op, test_data_t *data) { IRICB_iropt_payload cb; @@ -45,7 +46,10 @@ new_iricb(const irop_t *op, test_data_t *data) cb.num_operands = op->num_opnds; - return (IRICB) { .kind = IRICB_iropt, .iropt = cb }; + iricb.kind = IRICB_iropt; + iricb.iropt = cb; + + return &iricb; } @@ -69,24 +73,47 @@ valgrind_vex_inject_ir(void) /* Execute the test under valgrind. Well, yes, we're not really executing it here, just preparing for it... */ void -valgrind_execute_test(const irop_t *op, test_data_t *data) +valgrind_execute_test(const irop_t *op, test_data_t *data, uint64_t expected) { - if (verbose > 1) + if (verbose > 1) { printf("---------- Running a test\n"); - for (unsigned i = 0; i < op->num_opnds; ++i) { - if (verbose > 1) { - printf("opnd #%u: ", i); - print_opnd(stdout, &data->opnds[i]); + for (unsigned i = 0; i < op->num_opnds; ++i) { + const opnd_t *opnd = data->opnds + i; + printf("opnd %u: value = ", i); + print_value(stdout, opnd->value, bitsof_irtype(opnd->type)); printf("\n"); } } valgrind_vex_inject_ir(); + uint64_t result = data->result.value; + unsigned num_result_bits = bitsof_irtype(data->result.type); if (verbose > 1) { - printf("result: "); - print_opnd(stdout, &data->result); + printf("result: value = "); + print_value(stdout, result, num_result_bits); printf("\n"); + printf("expected: value = "); + print_value(stdout, expected, num_result_bits); + printf("\n"); + } + + /* Check result */ + if (result != expected) { + fprintf(stderr, "*** Incorrect result for operator %s\n", op->name); + + for (unsigned i = 0; i < op->num_opnds; ++i) { + const opnd_t *opnd = data->opnds + i; + fprintf(stderr, " opnd %u: ", i); + print_value(stderr, opnd->value, bitsof_irtype(opnd->type)); + fprintf(stderr, "\n"); + } + fprintf(stderr, " result: "); + print_value(stderr, result, num_result_bits); + fprintf(stderr, "\n"); + fprintf(stderr, " expect: "); + print_value(stderr, expected, num_result_bits); + fprintf(stderr, "\n"); } } diff --git a/none/tests/iropt-test/vtest.h b/none/tests/iropt-test/vtest.h index 47b397f68..f31f3c3ce 100644 --- a/none/tests/iropt-test/vtest.h +++ b/none/tests/iropt-test/vtest.h @@ -69,19 +69,17 @@ typedef struct { /* Function prototypes */ -void print_opnd(FILE *, const opnd_t *); void print_value(FILE *, uint64_t, unsigned); void test_unary_op(const irop_t *, test_data_t *); void test_binary_op(const irop_t *, test_data_t *); void valgrind_vex_init_for_iri(IRICB *); -void valgrind_execute_test(const irop_t *, test_data_t *); +void valgrind_execute_test(const irop_t *, test_data_t *, uint64_t); -IRICB new_iricb(const irop_t *, test_data_t *); +IRICB *new_iricb(const irop_t *, test_data_t *); void panic(const char *, ...) __attribute__((noreturn)); -void complain(const irop_t *, const test_data_t *, uint64_t expected); unsigned bitsof_irtype(IRType); uint64_t get_random_value(IRType); From 6d4745a6c9c0596f664a4b1b4c7c5ac815fde7d4 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 25 Jul 2025 21:20:47 +0000 Subject: [PATCH 146/412] iropt-test: .vgtest tweaks --- none/tests/iropt-test/iropt-test-sec.vgtest | 3 ++- none/tests/iropt-test/iropt-test.vgtest | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/none/tests/iropt-test/iropt-test-sec.vgtest b/none/tests/iropt-test/iropt-test-sec.vgtest index e8d4cc702..38ada4655 100644 --- a/none/tests/iropt-test/iropt-test-sec.vgtest +++ b/none/tests/iropt-test/iropt-test-sec.vgtest @@ -1,4 +1,5 @@ prog: iropt-test prereq: test -x iropt-test-sec +#args: -v -v -r10 +args: -r100 vgopts: -q --vex-guest-chase=no - diff --git a/none/tests/iropt-test/iropt-test.vgtest b/none/tests/iropt-test/iropt-test.vgtest index de31de604..9136b105c 100644 --- a/none/tests/iropt-test/iropt-test.vgtest +++ b/none/tests/iropt-test/iropt-test.vgtest @@ -2,4 +2,3 @@ prog: iropt-test #args: -v -v -r10 args: -r100 vgopts: -q --vex-guest-chase=no - From b7ce61bec4c7c86cec0b2896d62c8b3a73015610 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 28 Jul 2025 09:51:55 +0000 Subject: [PATCH 147/412] README_DEVELOPERS: change a few path names for consistency --- README_DEVELOPERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README_DEVELOPERS b/README_DEVELOPERS index a3360580e..fc5a80129 100644 --- a/README_DEVELOPERS +++ b/README_DEVELOPERS @@ -271,12 +271,12 @@ without too much problem by following these steps: export VALGRIND_LIB=$DIR/.in_place VALGRIND_LIB is where the default.supp and vgpreload_ libraries - are found (which is under /usr/libexec/valgrind for an installed + are found (which is under /usr/local/libexec/valgrind for an installed version). (2) Run gdb on the tool executable. Eg: - gdb /usr/local/lib/valgrind/lackey-ppc32-linux + gdb /usr/local/libexec/valgrind/lackey-ppc32-linux or From d34c697d35ba405efd1a20eaa705f63d0a5d2b1e Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 30 Jul 2025 14:08:32 +0000 Subject: [PATCH 148/412] s390: New Principles of Operations is out --- README.s390 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.s390 b/README.s390 index 528eafc5c..d2236d29f 100644 --- a/README.s390 +++ b/README.s390 @@ -42,6 +42,6 @@ Reading Material (1) ELF ABI s390x Supplement https://github.com/IBM/s390x-abi/releases (2) z/Architecture Principles of Operation - https://publibfp.dhe.ibm.com/epubs/pdf/a227832d.pdf + https://www.ibm.com/docs/en/module_1678991624569/pdf/SA22-7832-14.pdf (3) Collection of z/Architecture publications https://linux.mainframe.blog/zarchitecture-principles-of-operation/ From d2fea8d23e85ed573094f6d945b224f3e730e90c Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 30 Jul 2025 14:44:40 +0000 Subject: [PATCH 149/412] Fix a panic message. That code snippet is executed for both Iend_BE and Iend_LE. --- memcheck/mc_translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c index 05e6d59af..b4e499cc0 100644 --- a/memcheck/mc_translate.c +++ b/memcheck/mc_translate.c @@ -6064,7 +6064,7 @@ void do_shadow_Store ( MCEnv* mce, case Ity_I32: c = IRConst_U32 (V_BITS32_DEFINED); break; case Ity_I16: c = IRConst_U16 (V_BITS16_DEFINED); break; case Ity_I8: c = IRConst_U8 (V_BITS8_DEFINED); break; - default: VG_(tool_panic)("memcheck:do_shadow_Store(LE)"); + default: VG_(tool_panic)("memcheck:do_shadow_Store"); } vdata = IRExpr_Const( c ); } From bc66a6e865d952ac51ffb0e63c127ce7cd977b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= Date: Tue, 29 Jul 2025 09:49:26 -0400 Subject: [PATCH 150/412] Add fd_allowed and POST_newFd_RES to all syscalls that use or return fds This makes sure all file descriptors that take a file descriptor check that the file descriptor is valid. Also makes sure that the --modify-fds=high option affects all sycalls that return a file descriptor. https://bugs.kde.org/show_bug.cgi?id=493430 --- NEWS | 1 + coregrind/m_syswrap/syswrap-generic.c | 23 ++++++++++ coregrind/m_syswrap/syswrap-linux.c | 61 +++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) diff --git a/NEWS b/NEWS index 636bf61dd..00c785dfd 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 338803 Handling of dwz debug alt files or cross-CU is broken 418756 MAP_FIXED_NOREPLACE mmap flag unsupported +493430 Review all syscalls that use or return (new) file descriptors 493434 Add --track-fds=bad mode (no "leak" tracking) 501741 syscall cachestat not wrapped 502359 Add --modify-fds=yes option diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 7ac86fbbc..c7d58bc10 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -2944,6 +2944,8 @@ PRE(sys_fsync) *flags |= SfMayBlock; PRINT("sys_fsync ( %" FMT_REGWORD "u )", ARG1); PRE_REG_READ1(long, "fsync", unsigned int, fd); + if ( !ML_(fd_allowed)(ARG1, "fsync", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_fdatasync) @@ -2951,6 +2953,8 @@ PRE(sys_fdatasync) *flags |= SfMayBlock; PRINT("sys_fdatasync ( %" FMT_REGWORD "u )", ARG1); PRE_REG_READ1(long, "fdatasync", unsigned int, fd); + if ( !ML_(fd_allowed)(ARG1, "fdatasync", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_msync) @@ -3215,6 +3219,8 @@ PRE(sys_fstatfs) PRE_REG_READ2(long, "fstatfs", unsigned int, fd, struct statfs *, buf); PRE_MEM_WRITE( "fstatfs(buf)", ARG2, sizeof(struct vki_statfs) ); + if ( !ML_(fd_allowed)(ARG1, "fstatfs", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } POST(sys_fstatfs) @@ -3230,6 +3236,8 @@ PRE(sys_fstatfs64) PRE_REG_READ3(long, "fstatfs64", unsigned int, fd, vki_size_t, size, struct statfs64 *, buf); PRE_MEM_WRITE( "fstatfs64(buf)", ARG3, ARG2 ); + if ( !ML_(fd_allowed)(ARG1, "fstatfs64", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } POST(sys_fstatfs64) { @@ -3288,6 +3296,8 @@ PRE(sys_flock) *flags |= SfMayBlock; PRINT("sys_flock ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2 ); PRE_REG_READ2(long, "flock", unsigned int, fd, unsigned int, operation); + if ( !ML_(fd_allowed)(ARG1, "flock", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } // Pre_read a char** argument. @@ -3818,6 +3828,8 @@ PRE(sys_fchdir) FUSE_COMPATIBLE_MAY_BLOCK(); PRINT("sys_fchdir ( %" FMT_REGWORD "u )", ARG1); PRE_REG_READ1(long, "fchdir", unsigned int, fd); + if ( !ML_(fd_allowed)(ARG1, "fchdir", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_fchown) @@ -3827,6 +3839,8 @@ PRE(sys_fchown) FMT_REGWORD "u )", ARG1, ARG2, ARG3); PRE_REG_READ3(long, "fchown", unsigned int, fd, vki_uid_t, owner, vki_gid_t, group); + if ( !ML_(fd_allowed)(ARG1, "fchown", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_fchmod) @@ -3834,6 +3848,8 @@ PRE(sys_fchmod) FUSE_COMPATIBLE_MAY_BLOCK(); PRINT("sys_fchmod ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2); PRE_REG_READ2(long, "fchmod", unsigned int, fildes, vki_mode_t, mode); + if ( !ML_(fd_allowed)(ARG1, "fchmod", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } #if !defined(VGP_nanomips_linux) && !defined (VGO_freebsd) @@ -3910,6 +3926,8 @@ PRE(sys_ftruncate) *flags |= SfMayBlock; PRINT("sys_ftruncate ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2); PRE_REG_READ2(long, "ftruncate", unsigned int, fd, unsigned long, length); + if ( !ML_(fd_allowed)(ARG1, "ftruncate", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_truncate) @@ -3936,6 +3954,8 @@ PRE(sys_ftruncate64) PRE_REG_READ2(long, "ftruncate64", unsigned int,fd, UWord,length); #endif + if ( !ML_(fd_allowed)(ARG1, "ftruncate64", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_truncate64) @@ -4801,6 +4821,9 @@ PRE(sys_poll) PRE_MEM_READ( "poll(ufds.fd)", (Addr)(&ufds[i].fd), sizeof(ufds[i].fd) ); if (ML_(safe_to_deref)(&ufds[i].fd, sizeof(ufds[i].fd)) && ufds[i].fd >= 0) { + if (!ML_(fd_allowed)(ufds[i].fd, "poll(ufds.fd)", tid, False)) { + /* do nothing? Just let fd_allowed produce a warning? */ + } PRE_MEM_READ( "poll(ufds.events)", (Addr)(&ufds[i].events), sizeof(ufds[i].events) ); } diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 552fceee8..572a42925 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2518,6 +2518,8 @@ PRE(sys_fadvise64) PRE_REG_READ5(long, "fadvise64", int, fd, vki_u32, MERGE64_FIRST(offset), vki_u32, MERGE64_SECOND(offset), vki_size_t, len, int, advice); + if ( !ML_(fd_allowed)(SARG1, "fadvise64", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_fadvise64_64) @@ -2527,6 +2529,8 @@ PRE(sys_fadvise64_64) PRE_REG_READ6(long, "fadvise64_64", int, fd, vki_u32, MERGE64_FIRST(offset), vki_u32, MERGE64_SECOND(offset), vki_u32, MERGE64_FIRST(len), vki_u32, MERGE64_SECOND(len), int, advice); + if ( !ML_(fd_allowed)(SARG1, "fadvise64_64", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } /* --------------------------------------------------------------------- @@ -2861,6 +2865,8 @@ PRE(sys_fanotify_mark) int, dfd, const char *, pathname); if (ARG5) PRE_MEM_RASCIIZ( "fanotify_mark(path)", ARG5); + if ( !ML_(fd_allowed)(SARG1, "fanotify_mark", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); #else # error Unexpected word size #endif @@ -2897,6 +2903,7 @@ PRE(sys_inotify_init1) POST(sys_inotify_init1) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "inotify_init", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -2943,6 +2950,7 @@ PRE(sys_mq_open) POST(sys_mq_open) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "mq_open", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -3373,6 +3381,7 @@ PRE(sys_timerfd_create) } POST(sys_timerfd_create) { + POST_newFd_RES; if (linux_kernel_2_6_22()) { /* 2.6.22 kernel: timerfd system call. */ @@ -3615,6 +3624,9 @@ PRE(sys_fchown16) FMT_REGWORD "u )", ARG1, ARG2, ARG3); PRE_REG_READ3(long, "fchown16", unsigned int, fd, vki_old_uid_t, owner, vki_old_gid_t, group); + if ( !ML_(fd_allowed)(ARG1, "fchown16", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); + } /* --------------------------------------------------------------------- @@ -3709,6 +3721,9 @@ PRE(sys_fgetxattr) int, fd, char *, name, void *, value, vki_size_t, size); PRE_MEM_RASCIIZ( "fgetxattr(name)", ARG2 ); PRE_MEM_WRITE( "fgetxattr(value)", ARG3, ARG4 ); + if ( !ML_(fd_allowed)(SARG1, "fgetxattr", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); + } POST(sys_fgetxattr) { @@ -3756,6 +3771,9 @@ PRE(sys_flistxattr) PRE_REG_READ3(ssize_t, "flistxattr", int, fd, char *, list, vki_size_t, size); PRE_MEM_WRITE( "flistxattr(list)", ARG2, ARG3 ); + if ( !ML_(fd_allowed)(ARG1, "flistxattr", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); + } POST(sys_flistxattr) { @@ -3789,6 +3807,9 @@ PRE(sys_fremovexattr) PRINT("sys_fremovexattr ( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2); PRE_REG_READ2(long, "fremovexattr", int, fd, char *, name); PRE_MEM_RASCIIZ( "fremovexattr(name)", ARG2 ); + if ( !ML_(fd_allowed)(SARG1, "fremovexattr", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); + } /* --------------------------------------------------------------------- @@ -4151,6 +4172,7 @@ PRE(sys_perf_event_open) POST(sys_perf_event_open) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "perf_event_open", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -4229,6 +4251,7 @@ PRE(sys_memfd_create) POST(sys_memfd_create) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "memfd_create", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -4255,6 +4278,7 @@ POST(sys_landlock_create_ruleset) { /* Returns either the abi version or a file descriptor. */ if (ARG3 != VKI_LANDLOCK_CREATE_RULESET_VERSION) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "landlock_create_ruleset", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -4295,6 +4319,7 @@ PRE(sys_memfd_secret) POST(sys_memfd_secret) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "memfd_secret", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -4626,6 +4651,7 @@ PRE(sys_signalfd) } POST(sys_signalfd) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "signalfd", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -4647,6 +4673,7 @@ PRE(sys_signalfd4) } POST(sys_signalfd4) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "signalfd4", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -6143,6 +6170,8 @@ PRE(sys_fchownat) int, dfd, const char *, path, vki_uid_t, owner, vki_gid_t, group); PRE_MEM_RASCIIZ( "fchownat(path)", ARG2 ); + if ( !ML_(fd_allowed)(SARG1, "fchownat", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_futimesat) @@ -6156,6 +6185,9 @@ PRE(sys_futimesat) PRE_MEM_RASCIIZ( "futimesat(filename)", ARG2 ); if (ARG3 != 0) PRE_MEM_READ( "futimesat(tvp)", ARG3, 2 * sizeof(struct vki_timeval) ); + if ( !ML_(fd_allowed)(SARG1, "futimesat", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); + } PRE(sys_utimensat) @@ -6345,6 +6377,9 @@ PRE(sys_fchmodat) PRE_REG_READ3(long, "fchmodat", int, dfd, const char *, path, vki_mode_t, mode); PRE_MEM_RASCIIZ( "fchmodat(path)", ARG2 ); + if ( !ML_(fd_allowed)(SARG1, "fchmodat", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); + } PRE(sys_cachestat) @@ -6377,6 +6412,8 @@ PRE(sys_fchmodat2) int, dfd, const char *, path, vki_mode_t, mode, unsigned int, flags); PRE_MEM_RASCIIZ( "fchmodat2(pathname)", ARG2 ); + if ( !ML_(fd_allowed)(SARG1, "fchmodat2", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_faccessat) @@ -6387,6 +6424,9 @@ PRE(sys_faccessat) PRE_REG_READ3(long, "faccessat", int, dfd, const char *, pathname, int, mode); PRE_MEM_RASCIIZ( "faccessat(pathname)", ARG2 ); + if ( !ML_(fd_allowed)(SARG1, "faccessat", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); + } PRE(sys_faccessat2) @@ -6397,6 +6437,8 @@ PRE(sys_faccessat2) PRE_REG_READ4(long, "faccessat2", int, dfd, const char *, pathname, int, mode, int, flags); PRE_MEM_RASCIIZ( "faccessat2(pathname)", ARG2 ); + if ( !ML_(fd_allowed)(SARG1, "faccessat2", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_name_to_handle_at) @@ -6441,6 +6483,7 @@ PRE(sys_open_by_handle_at) POST(sys_open_by_handle_at) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "open_by_handle_at", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -7014,6 +7057,8 @@ PRE(sys_finit_module) PRE_REG_READ3(long, "finit_module", int, fd, const char *, params, int, flags); PRE_MEM_RASCIIZ("finit_module(params)", ARG2); + if ( !ML_(fd_allowed)(ARG1, "finit_module", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_delete_module) @@ -7284,6 +7329,7 @@ POST(sys_fcntl) { vg_assert(SUCCESS); if (ARG2 == VKI_F_DUPFD) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "fcntl(DUPFD)", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -7293,6 +7339,7 @@ POST(sys_fcntl) } } else if (ARG2 == VKI_F_DUPFD_CLOEXEC) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "fcntl(DUPFD_CLOEXEC)", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -7398,6 +7445,7 @@ POST(sys_fcntl64) { vg_assert(SUCCESS); if (ARG2 == VKI_F_DUPFD) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "fcntl64(DUPFD)", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -7407,6 +7455,7 @@ POST(sys_fcntl64) } } else if (ARG2 == VKI_F_DUPFD_CLOEXEC) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "fcntl64(DUPFD_CLOEXEC)", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -13521,6 +13570,7 @@ POST(sys_bpf) case VKI_BPF_MAP_GET_FD_BY_ID: case VKI_BPF_BTF_GET_FD_BY_ID: case VKI_BPF_RAW_TRACEPOINT_OPEN: + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "bpf", tid, True)) { VG_(close)(RES); SET_STATUS_Failure(VKI_EMFILE); @@ -13543,6 +13593,7 @@ POST(sys_bpf) break; case VKI_BPF_PROG_LOAD: /* Return a file descriptor for loaded program, write into log_buf. */ + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "bpf", tid, True)) { VG_(close)(RES); SET_STATUS_Failure(VKI_EMFILE); @@ -13571,6 +13622,7 @@ POST(sys_bpf) break; case VKI_BPF_BTF_LOAD: /* Return a file descriptor for BTF data, write into btf_log_buf. */ + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "bpf", tid, True)) { VG_(close)(RES); SET_STATUS_Failure(VKI_EMFILE); @@ -13729,6 +13781,7 @@ PRE(sys_io_uring_setup) POST(sys_io_uring_setup) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "io_uring_setup", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -14104,6 +14157,7 @@ PRE(sys_openat2) POST(sys_openat2) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "openat2", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -14120,6 +14174,7 @@ PRE(sys_pidfd_open) POST(sys_pidfd_open) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "pidfd", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -14138,6 +14193,7 @@ PRE(sys_pidfd_getfd) POST(sys_pidfd_getfd) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "pidfd_getfd", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -14167,6 +14223,7 @@ PRE(sys_open_tree) POST(sys_open_tree) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "open_tree", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -14219,6 +14276,7 @@ PRE(sys_fsopen) POST(sys_fsopen) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "fsopen", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -14239,6 +14297,7 @@ PRE(sys_fsmount) POST(sys_fsmount) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "fsmount", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -14284,6 +14343,7 @@ PRE(sys_fspick) POST(sys_fspick) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "fspick", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -14304,6 +14364,7 @@ PRE(sys_userfaultfd) POST(sys_userfaultfd) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "userfaultfd", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); From ab551753fad6a87acbb8a87a80ed5f5578bfd29c Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 18 Jul 2025 17:11:49 +0200 Subject: [PATCH 151/412] Implement and override mallinfo2 Implement and override mallinfo2. Add a testcase covering mallinfo2. Exclude irrelevant LTP tests trying to cover mallinfo2. https://bugs.kde.org/show_bug.cgi?id=506967 --- .gitignore | 1 + NEWS | 1 + auxprogs/ltp-excludes.txt | 5 + configure.ac | 1 + coregrind/m_mallocfree.c | 35 +++++ coregrind/m_replacemalloc/vg_replace_malloc.c | 28 ++++ coregrind/m_scheduler/scheduler.c | 1 + coregrind/pub_core_mallocfree.h | 16 +++ coregrind/pub_core_replacemalloc.h | 1 + memcheck/tests/Makefile.am | 3 + memcheck/tests/mallinfo2.c | 133 ++++++++++++++++++ memcheck/tests/mallinfo2.stderr.exp | 11 ++ memcheck/tests/mallinfo2.vgtest | 3 + 13 files changed, 239 insertions(+) create mode 100644 memcheck/tests/mallinfo2.c create mode 100644 memcheck/tests/mallinfo2.stderr.exp create mode 100644 memcheck/tests/mallinfo2.vgtest diff --git a/.gitignore b/.gitignore index 0283b8d5b..e48a2ab0e 100644 --- a/.gitignore +++ b/.gitignore @@ -943,6 +943,7 @@ /memcheck/tests/Makefile /memcheck/tests/Makefile.in /memcheck/tests/mallinfo +/memcheck/tests/mallinfo2 /memcheck/tests/malloc1 /memcheck/tests/malloc2 /memcheck/tests/malloc3 diff --git a/NEWS b/NEWS index 00c785dfd..fe9de908f 100644 --- a/NEWS +++ b/NEWS @@ -61,6 +61,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506910 openat2 with RESOLVE_NO_MAGICLINKS succeeds on /proc/self/exe 506928 Wrap (deprecated) linux specific ustat syscall 506930 valgrind allows SIGKILL being reset to SIG_DFL +506967 Implement and override mallinfo2 506970 mmap needs an EBADF fd_allowed check 507173 s390x: Crash when constant folding is disabled diff --git a/auxprogs/ltp-excludes.txt b/auxprogs/ltp-excludes.txt index b03111e20..0d00bab8a 100644 --- a/auxprogs/ltp-excludes.txt +++ b/auxprogs/ltp-excludes.txt @@ -29,3 +29,8 @@ fcntl36_64 clone08 close_range02 kcmp03 +# Test fails because it tests something valgrind doesn't support: +# We don't have fastbins so smblks & fsmblks are always 0. Also we +# don't have a separate mmap allocator so set hblks & hblkhd to 0. +mallinfo02 +mallinfo2_01 diff --git a/configure.ac b/configure.ac index 804493c2f..6183179db 100755 --- a/configure.ac +++ b/configure.ac @@ -4952,6 +4952,7 @@ AC_CHECK_FUNCS([ \ getaddrinfo \ klogctl \ mallinfo \ + mallinfo2 \ memchr \ memfd_create \ memset \ diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index dbbcb9396..e7c80af71 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -2433,6 +2433,41 @@ void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi ) mi->keepcost = 0; // may want some value in here } +// The aforementioned older function, mallinfo(), is deprecated since the type +// used for the fields is too small. +void VG_(mallinfo2) ( ThreadId tid, struct vg_mallinfo2* mi ) +{ + UWord i, free_blocks, free_blocks_size; + Arena* a = arenaId_to_ArenaP(VG_AR_CLIENT); + + // Traverse free list and calculate free blocks statistics. + // This may seem slow but glibc works the same way. + free_blocks_size = free_blocks = 0; + for (i = 0; i < N_MALLOC_LISTS; i++) { + Block* b = a->freelist[i]; + if (b == NULL) continue; + for (;;) { + free_blocks++; + free_blocks_size += (UWord)get_pszB(a, b); + b = get_next_b(b); + if (b == a->freelist[i]) break; + } + } + + // We don't have fastbins so smblks & fsmblks are always 0. Also we don't + // have a separate mmap allocator so set hblks & hblkhd to 0. + mi->arena = a->stats__bytes_mmaped; + mi->ordblks = free_blocks + VG_(free_queue_length); + mi->smblks = 0; + mi->hblks = 0; + mi->hblkhd = 0; + mi->usmblks = 0; + mi->fsmblks = 0; + mi->uordblks = a->stats__bytes_on_loan - VG_(free_queue_volume); + mi->fordblks = free_blocks_size + VG_(free_queue_volume); + mi->keepcost = 0; // may want some value in here +} + SizeT VG_(arena_redzone_size) ( ArenaId aid ) { ensure_mm_init (VG_AR_CLIENT); diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index aff2d27b3..808096152 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -103,6 +103,7 @@ 10190 PANIC 10200 MALLOC_STATS 10210 MALLINFO + 10215 MALLINFO2 10220 DEFAULT_ZONE 10230 CREATE_ZONE 10240 ZONE_FROM_PTR @@ -2523,6 +2524,33 @@ static void panic(const char *str) #endif +/*---------------------- mallinfo2 ----------------------*/ + +// mi must be static; if it is auto then Memcheck thinks it is +// uninitialised when used by the caller of this function, because Memcheck +// doesn't know that the call to mallinfo2 fills in mi. +#define MALLINFO2(soname, fnname) \ + \ + struct vg_mallinfo2 VG_REPLACE_FUNCTION_EZU(10215,soname,fnname) ( void ); \ + struct vg_mallinfo2 VG_REPLACE_FUNCTION_EZU(10215,soname,fnname) ( void ) \ + { \ + static struct vg_mallinfo2 mi; \ + DO_INIT; \ + MALLOC_TRACE("mallinfo2()\n"); \ + (void)VALGRIND_NON_SIMD_CALL1( info.mallinfo2, &mi ); \ + return mi; \ + } + +#if defined(VGO_linux) + MALLINFO2(VG_Z_LIBC_SONAME, mallinfo2); + MALLINFO2(SO_SYN_MALLOC, mallinfo2); + +#elif defined(VGO_darwin) + //MALLINFO2(VG_Z_LIBC_SONAME, mallinfo2); + +#endif + + /*------------------ Darwin zone stuff ------------------*/ #if defined(VGO_darwin) diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index 1623dda5a..1e77944cd 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -2147,6 +2147,7 @@ void do_client_request ( ThreadId tid ) info->tl_malloc_usable_size = VG_(tdict).tool_malloc_usable_size; info->mallinfo = VG_(mallinfo); + info->mallinfo2 = VG_(mallinfo2); info->clo_trace_malloc = VG_(clo_trace_malloc); info->clo_realloc_zero_bytes_frees = VG_(clo_realloc_zero_bytes_frees); diff --git a/coregrind/pub_core_mallocfree.h b/coregrind/pub_core_mallocfree.h index df9648cea..3ae9eb486 100644 --- a/coregrind/pub_core_mallocfree.h +++ b/coregrind/pub_core_mallocfree.h @@ -106,6 +106,21 @@ struct vg_mallinfo { int keepcost; /* top-most, releasable (via malloc_trim) space */ }; +/* This struct definition MUST match the system one. */ +/* SVID2/XPG mallinfo structure */ +struct vg_mallinfo2 { + SizeT arena; /* total space allocated from system */ + SizeT ordblks; /* number of non-inuse chunks */ + SizeT smblks; /* unused -- always zero */ + SizeT hblks; /* number of mmapped regions */ + SizeT hblkhd; /* total space in mmapped regions */ + SizeT usmblks; /* unused -- always zero */ + SizeT fsmblks; /* unused -- always zero */ + SizeT uordblks; /* total allocated space */ + SizeT fordblks; /* total non-inuse space */ + SizeT keepcost; /* top-most, releasable (via malloc_trim) space */ +}; + extern void* VG_(arena_malloc) ( ArenaId arena, const HChar* cc, SizeT nbytes ); extern void VG_(arena_free) ( ArenaId arena, void* ptr ); extern void* VG_(arena_calloc) ( ArenaId arena, const HChar* cc, @@ -132,6 +147,7 @@ extern SizeT VG_(arena_malloc_usable_size) ( ArenaId aid, void* payload ); extern SizeT VG_(arena_redzone_size) ( ArenaId aid ); extern void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi ); +extern void VG_(mallinfo2) ( ThreadId tid, struct vg_mallinfo2* mi ); // VG_(arena_perm_malloc) is for permanent allocation of small blocks. // See VG_(perm_malloc) in pub_tool_mallocfree.h for more details. diff --git a/coregrind/pub_core_replacemalloc.h b/coregrind/pub_core_replacemalloc.h index f26884c4f..4f9c5bb1a 100644 --- a/coregrind/pub_core_replacemalloc.h +++ b/coregrind/pub_core_replacemalloc.h @@ -54,6 +54,7 @@ struct vg_mallocfunc_info { void* (*tl_realloc) (ThreadId tid, void* p, SizeT size); SizeT (*tl_malloc_usable_size) (ThreadId tid, void* payload); void (*mallinfo) (ThreadId tid, struct vg_mallinfo* mi); + void (*mallinfo2) (ThreadId tid, struct vg_mallinfo2* mi); Bool clo_trace_malloc; Bool clo_realloc_zero_bytes_frees; }; diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index aceed97b2..91d58b48b 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -261,6 +261,7 @@ EXTRA_DIST = \ long_namespace_xml.stderr.exp long_namespace_xml.stderr.exp-freebsd \ long-supps.vgtest long-supps.stderr.exp long-supps.supp \ mallinfo.stderr.exp mallinfo.vgtest \ + mallinfo2.stderr.exp mallinfo2.vgtest \ malloc_free_fill.vgtest \ malloc_free_fill.stderr.exp \ malloc_usable.stderr.exp malloc_usable.vgtest \ @@ -521,6 +522,7 @@ check_PROGRAMS = \ leak-segv-jmp \ long-supps \ mallinfo \ + mallinfo2 \ malloc_free_fill \ malloc_usable malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \ match-overrun \ @@ -682,6 +684,7 @@ bug472219_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ calloc_overflow_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ malloc_usable_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@ mallinfo_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations +mallinfo2_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ sbfragment_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations strchr_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ diff --git a/memcheck/tests/mallinfo2.c b/memcheck/tests/mallinfo2.c new file mode 100644 index 000000000..23667a5b1 --- /dev/null +++ b/memcheck/tests/mallinfo2.c @@ -0,0 +1,133 @@ +#include "tests/malloc.h" +#include +#include +#include // getopt() +#include "../config.h" + + +static int s_quiet = 0; + + +#if defined(HAVE_MALLINFO2) +static size_t check(size_t min, size_t max) +{ + struct mallinfo2 mi; + size_t used; + + mi = mallinfo2(); + + if (! s_quiet) + { + printf("arena = %d\n", mi.arena); /* non-mmapped space allocated from system */ + printf("ordblks = %d\n", mi.ordblks); /* number of free chunks */ + printf("smblks = %d\n", mi.smblks); /* number of fastbin blocks */ + printf("hblks = %d\n", mi.hblks); /* number of mmapped regions */ + printf("hblkhd = %d\n", mi.hblkhd); /* space in mmapped regions */ + printf("usmblks = %d\n", mi.usmblks); /* maximum total allocated space */ + printf("fsmblks = %d\n", mi.fsmblks); /* space available in freed fastbin blocks */ + printf("uordblks = %d\n", mi.uordblks); /* total allocated space */ + printf("fordblks = %d\n", mi.fordblks); /* total free space */ + printf("keepcost = %d\n", mi.keepcost); /* top-most, releasable (via malloc_trim) space */ + printf("(min = %zu, max = %zu)\n", min, max); + printf("\n"); + } + + // size checks + used = mi.uordblks + mi.hblkhd; + if (used < min) + exit(1); + + if (used > max) + exit(2); + + // used should be reasonably close to min + // define "reasonably" as within 20% + if (used/5*4 > min) + exit(3); + + // sanity checks + if ((mi.ordblks == 0) != (mi.fordblks == 0)) + exit(10); + + if ((mi.smblks == 0) != (mi.fsmblks == 0)) + exit(11); + + if ((mi.hblks == 0) != (mi.hblkhd == 0)) + exit(12); + + if (mi.keepcost > mi.fordblks) + exit(13); + + if (mi.fsmblks > mi.fordblks) + exit(14); + + // arena should be reasonably close to fordblks + uordblks + if (mi.arena < mi.fordblks + mi.uordblks) + exit(15); + + if (mi.arena/5*4 > mi.fordblks + mi.uordblks) + exit(16); + + return used; +} +#else +static size_t check(size_t min, size_t max) +{ + if (! s_quiet) + { + printf("mallinfo() is not supported on this platform.\n"); + printf("\n"); + } + return 0; +} +#endif + +int main(int argc, char** argv) +{ + void* ptr[40]; + int i; + size_t min, max; + int optchar; + + while ((optchar = getopt(argc, argv, "q")) != EOF) + { + switch (optchar) + { + case 'q': + s_quiet = 1; + break; + default: + fprintf(stderr, "Usage: %s [-q].\n", argv[0]); + return 1; + } + } + + min = 0; + for (i = 1; i <= 40; i++) + { + int size = i * i * 8; + min += size; + ptr[i - 1] = malloc(size); + }; + + max = check(min, (size_t)-1); + + for (i = 1; i <= 20; i++) + { + int size = i * i * 8; + min -= size; + max -= size; + free(ptr[i - 1]); + }; + + check(min, max); + + for ( ; i <= 40; i++) + { + free(ptr[i - 1]); + } + + fprintf(stderr, "Success.\n"); + + return 0; +} diff --git a/memcheck/tests/mallinfo2.stderr.exp b/memcheck/tests/mallinfo2.stderr.exp new file mode 100644 index 000000000..65f7e5b13 --- /dev/null +++ b/memcheck/tests/mallinfo2.stderr.exp @@ -0,0 +1,11 @@ + +Success. + +HEAP SUMMARY: + in use at exit: ... bytes in ... blocks + total heap usage: ... allocs, ... frees, ... bytes allocated + +For a detailed leak analysis, rerun with: --leak-check=full + +For lists of detected and suppressed errors, rerun with: -s +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) diff --git a/memcheck/tests/mallinfo2.vgtest b/memcheck/tests/mallinfo2.vgtest new file mode 100644 index 000000000..ba7692072 --- /dev/null +++ b/memcheck/tests/mallinfo2.vgtest @@ -0,0 +1,3 @@ +prog: mallinfo2 +args: -q +stderr_filter: filter_allocs From 2ab7b57c9785de7809d3e34386c5fb4978756123 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 31 Jul 2025 18:34:31 +0200 Subject: [PATCH 152/412] memcheck/tests/mallinfo2.c use %zu to print mallinfo2 fields --- memcheck/tests/mallinfo2.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/memcheck/tests/mallinfo2.c b/memcheck/tests/mallinfo2.c index 23667a5b1..8cdaa789e 100644 --- a/memcheck/tests/mallinfo2.c +++ b/memcheck/tests/mallinfo2.c @@ -18,16 +18,16 @@ static size_t check(size_t min, size_t max) if (! s_quiet) { - printf("arena = %d\n", mi.arena); /* non-mmapped space allocated from system */ - printf("ordblks = %d\n", mi.ordblks); /* number of free chunks */ - printf("smblks = %d\n", mi.smblks); /* number of fastbin blocks */ - printf("hblks = %d\n", mi.hblks); /* number of mmapped regions */ - printf("hblkhd = %d\n", mi.hblkhd); /* space in mmapped regions */ - printf("usmblks = %d\n", mi.usmblks); /* maximum total allocated space */ - printf("fsmblks = %d\n", mi.fsmblks); /* space available in freed fastbin blocks */ - printf("uordblks = %d\n", mi.uordblks); /* total allocated space */ - printf("fordblks = %d\n", mi.fordblks); /* total free space */ - printf("keepcost = %d\n", mi.keepcost); /* top-most, releasable (via malloc_trim) space */ + printf("arena = %zu\n", mi.arena); /* non-mmapped space allocated from system */ + printf("ordblks = %zu\n", mi.ordblks); /* number of free chunks */ + printf("smblks = %zu\n", mi.smblks); /* number of fastbin blocks */ + printf("hblks = %zu\n", mi.hblks); /* number of mmapped regions */ + printf("hblkhd = %zu\n", mi.hblkhd); /* space in mmapped regions */ + printf("usmblks = %zu\n", mi.usmblks); /* maximum total allocated space */ + printf("fsmblks = %zu\n", mi.fsmblks); /* space available in freed fastbin blocks */ + printf("uordblks = %zu\n", mi.uordblks); /* total allocated space */ + printf("fordblks = %zu\n", mi.fordblks); /* total free space */ + printf("keepcost = %zu\n", mi.keepcost); /* top-most, releasable (via malloc_trim) space */ printf("(min = %zu, max = %zu)\n", min, max); printf("\n"); } From 96dfb3b4753a93db3fa0eed1c8bf73c568d3984a Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 31 Jul 2025 20:45:29 +0000 Subject: [PATCH 153/412] amd64 specific changes for BZ 507033 Rework code to use Iop_ClzNat64 instead of the deprecated Iop_Clz64. Likewise for Iop_Ctz64. Part of fixing https://bugs.kde.org/show_bug.cgi?id=507033 --- VEX/priv/guest_amd64_toIR.c | 39 ++++++++++++++++---------------- VEX/priv/host_amd64_isel.c | 4 ++-- memcheck/tests/vbit-test/irops.c | 8 +++---- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c index 57a8a434b..c98b55c06 100644 --- a/VEX/priv/guest_amd64_toIR.c +++ b/VEX/priv/guest_amd64_toIR.c @@ -5075,14 +5075,14 @@ static IRTemp gen_LZCNT ( IRType ty, IRTemp src ) binop(Iop_Shl64, mkexpr(src64), mkU8(64 - 8 * sizeofIRType(ty)))); - // Clz64 has undefined semantics when its input is zero, so - // special-case around that. + /* Guard against 0 input value. Use ClzNat64 operator for all other + values */ IRTemp res64 = newTemp(Ity_I64); assign(res64, IRExpr_ITE( binop(Iop_CmpEQ64, mkexpr(src64x), mkU64(0)), mkU64(8 * sizeofIRType(ty)), - unop(Iop_Clz64, mkexpr(src64x)) + unop(Iop_ClzNat64, mkexpr(src64x)) )); IRTemp res = newTemp(ty); @@ -5103,14 +5103,14 @@ static IRTemp gen_TZCNT ( IRType ty, IRTemp src ) IRTemp src64 = newTemp(Ity_I64); assign(src64, widenUto64( mkexpr(src) )); - // Ctz64 has undefined semantics when its input is zero, so - // special-case around that. + /* Guard against 0 input value. Use CtzNat64 operator for all other + values */ IRTemp res64 = newTemp(Ity_I64); assign(res64, IRExpr_ITE( binop(Iop_CmpEQ64, mkexpr(src64), mkU64(0)), mkU64(8 * sizeofIRType(ty)), - unop(Iop_Ctz64, mkexpr(src64)) + unop(Iop_CtzNat64, mkexpr(src64)) )); IRTemp res = newTemp(ty); @@ -8421,30 +8421,28 @@ ULong dis_bs_E_G ( const VexAbiInfo* vbi, elimination of previous stores to this field work better. */ stmt( IRStmt_Put( OFFB_CC_NDEP, mkU64(0) )); - /* Result: iff source value is zero, we can't use - Iop_Clz64/Iop_Ctz64 as they have no defined result in that case. - But anyway, amd64 semantics say the result is undefined in - such situations. Hence handle the zero case specially. */ + /* amd64 semantics say the result is undefined iff source value is + zero. Hence handle the zero case specially. */ /* Bleh. What we compute: bsf64: if src == 0 then {dst is unchanged} - else Ctz64(src) + else CtzNat64(src) bsr64: if src == 0 then {dst is unchanged} - else 63 - Clz64(src) + else 63 - ClzNat64(src) bsf32: if src == 0 then {dst is unchanged} - else Ctz64(32Uto64(src)) + else CtzNat64(32Uto64(src)) bsr32: if src == 0 then {dst is unchanged} - else 63 - Clz64(32Uto64(src)) + else 63 - ClzNat64(32Uto64(src)) bsf16: if src == 0 then {dst is unchanged} - else Ctz64(32Uto64(16Uto32(src))) + else CtzNat64(32Uto64(16Uto32(src))) bsr16: if src == 0 then {dst is unchanged} - else 63 - Clz64(32Uto64(16Uto32(src))) + else 63 - ClzNat64(32Uto64(16Uto32(src))) */ /* The main computation, guarding against zero. */ @@ -8452,10 +8450,10 @@ ULong dis_bs_E_G ( const VexAbiInfo* vbi, IRExpr_ITE( mkexpr(srcB), /* src != 0 */ - fwds ? unop(Iop_Ctz64, mkexpr(src64)) + fwds ? unop(Iop_CtzNat64, mkexpr(src64)) : binop(Iop_Sub64, mkU64(63), - unop(Iop_Clz64, mkexpr(src64))), + unop(Iop_ClzNat64, mkexpr(src64))), /* src == 0 -- leave dst unchanged */ widenUto64( getIRegG( sz, pfx, modrm ) ) ) @@ -18606,8 +18604,9 @@ static Long dis_PEXTRQ ( const VexAbiInfo* vbi, Prefix pfx, static IRExpr* math_CTZ32(IRExpr *exp) { - /* Iop_Ctz32 isn't implemented by the amd64 back end, so use Iop_Ctz64. */ - return unop(Iop_64to32, unop(Iop_Ctz64, unop(Iop_32Uto64, exp))); + /* Iop_CtzNat32 isn't implemented by the amd64 back end, so use + Iop_CtzNat64. */ + return unop(Iop_64to32, unop(Iop_CtzNat64, unop(Iop_32Uto64, exp))); } static Long dis_PCMPISTRI_3A ( UChar modrm, UInt regNoL, UInt regNoR, diff --git a/VEX/priv/host_amd64_isel.c b/VEX/priv/host_amd64_isel.c index 21d20c77f..f0e21ab98 100644 --- a/VEX/priv/host_amd64_isel.c +++ b/VEX/priv/host_amd64_isel.c @@ -1628,14 +1628,14 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, const IRExpr* e ) addInstr(env, AMD64Instr_Sh64(Ash_SAR, 63, dst)); return dst; } - case Iop_Ctz64: { + case Iop_CtzNat64: { /* Count trailing zeroes, implemented by amd64 'bsfq' */ HReg dst = newVRegI(env); HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); addInstr(env, AMD64Instr_Bsfr64(True,src,dst)); return dst; } - case Iop_Clz64: { + case Iop_ClzNat64: { /* Count leading zeroes. Do 'bsrq' to establish the index of the highest set bit, and subtract that value from 63. */ diff --git a/memcheck/tests/vbit-test/irops.c b/memcheck/tests/vbit-test/irops.c index 33c78fef1..1794191a7 100644 --- a/memcheck/tests/vbit-test/irops.c +++ b/memcheck/tests/vbit-test/irops.c @@ -108,13 +108,13 @@ static irop_t irops[] = { { DEFOP(Iop_MullU16, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_MullU32, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 1 }, // mips asserts { DEFOP(Iop_MullU64, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32, mips assert - { DEFOP(Iop_Clz64, UNDEF_ALL), .s390x = 0, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32 asserts + { DEFOP(Iop_Clz64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32 asserts { DEFOP(Iop_Clz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 }, - { DEFOP(Iop_Ctz64, UNDEF_ALL), .s390x = 0, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, + { DEFOP(Iop_Ctz64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_Ctz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, - { DEFOP(Iop_ClzNat64, UNDEF_ALL), .s390x = 1, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, // ppc32 asserts + { DEFOP(Iop_ClzNat64, UNDEF_ALL), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, // ppc32 asserts { DEFOP(Iop_ClzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, - { DEFOP(Iop_CtzNat64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, + { DEFOP(Iop_CtzNat64, UNDEF_ALL), .s390x = 0, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_CtzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_PopCount64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_PopCount32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, From 42bff04db954b8a214334ad67256c32e88ddc7cf Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 31 Jul 2025 20:56:34 +0000 Subject: [PATCH 154/412] x86 specific changes for BZ 507033 Rework code to use Iop_ClzNat32 instead of the deprecated Iop_Clz32. Likewise for Iop_Ctz32. Part of fixing https://bugs.kde.org/show_bug.cgi?id=507033 --- VEX/priv/guest_x86_toIR.c | 24 +++++++++++------------- VEX/priv/host_x86_isel.c | 4 ++-- memcheck/tests/vbit-test/irops.c | 8 ++++---- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/VEX/priv/guest_x86_toIR.c b/VEX/priv/guest_x86_toIR.c index 7b31bd769..11617914d 100644 --- a/VEX/priv/guest_x86_toIR.c +++ b/VEX/priv/guest_x86_toIR.c @@ -3418,14 +3418,14 @@ static IRTemp gen_LZCNT ( IRType ty, IRTemp src ) binop(Iop_Shl32, mkexpr(src32), mkU8(32 - 8 * sizeofIRType(ty)))); - // Clz32 has undefined semantics when its input is zero, so - // special-case around that. + /* Guard against 0 input value. Use ClzNat32 operator for all other + values */ IRTemp res32 = newTemp(Ity_I32); assign(res32, IRExpr_ITE( binop(Iop_CmpEQ32, mkexpr(src32x), mkU32(0)), mkU32(8 * sizeofIRType(ty)), - unop(Iop_Clz32, mkexpr(src32x)) + unop(Iop_ClzNat32, mkexpr(src32x)) )); IRTemp res = newTemp(ty); @@ -6512,18 +6512,16 @@ UInt dis_bs_E_G ( UChar sorb, Int sz, Int delta, Bool fwds ) elimination of previous stores to this field work better. */ stmt( IRStmt_Put( OFFB_CC_NDEP, mkU32(0) )); - /* Result: iff source value is zero, we can't use - Iop_Clz32/Iop_Ctz32 as they have no defined result in that case. - But anyway, Intel x86 semantics say the result is undefined in - such situations. Hence handle the zero case specially. */ + /* Intel x86 semantics say the result is undefined iff source value is + zero. Hence handle the zero case specially. */ /* Bleh. What we compute: - bsf32: if src == 0 then 0 else Ctz32(src) - bsr32: if src == 0 then 0 else 31 - Clz32(src) + bsf32: if src == 0 then 0 else CtzNat32(src) + bsr32: if src == 0 then 0 else 31 - ClzNat32(src) - bsf16: if src == 0 then 0 else Ctz32(16Uto32(src)) - bsr16: if src == 0 then 0 else 31 - Clz32(16Uto32(src)) + bsf16: if src == 0 then 0 else CtzNat32(16Uto32(src)) + bsr16: if src == 0 then 0 else 31 - ClzNat32(16Uto32(src)) First, widen src to 32 bits if it is not already. @@ -6540,10 +6538,10 @@ UInt dis_bs_E_G ( UChar sorb, Int sz, Int delta, Bool fwds ) IRExpr_ITE( mkexpr(srcB), /* src != 0 */ - fwds ? unop(Iop_Ctz32, mkexpr(src32)) + fwds ? unop(Iop_CtzNat32, mkexpr(src32)) : binop(Iop_Sub32, mkU32(31), - unop(Iop_Clz32, mkexpr(src32))), + unop(Iop_ClzNat32, mkexpr(src32))), /* src == 0 -- leave dst unchanged */ widenUto32( getIReg( sz, gregOfRM(modrm) ) ) ) diff --git a/VEX/priv/host_x86_isel.c b/VEX/priv/host_x86_isel.c index e89b14532..d35df8fc4 100644 --- a/VEX/priv/host_x86_isel.c +++ b/VEX/priv/host_x86_isel.c @@ -1306,14 +1306,14 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, const IRExpr* e ) addInstr(env, X86Instr_Sh32(Xsh_SAR, 31, dst)); return dst; } - case Iop_Ctz32: { + case Iop_CtzNat32: { /* Count trailing zeroes, implemented by x86 'bsfl' */ HReg dst = newVRegI(env); HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); addInstr(env, X86Instr_Bsfr32(True,src,dst)); return dst; } - case Iop_Clz32: { + case Iop_ClzNat32: { /* Count leading zeroes. Do 'bsrl' to establish the index of the highest set bit, and subtract that value from 31. */ diff --git a/memcheck/tests/vbit-test/irops.c b/memcheck/tests/vbit-test/irops.c index 1794191a7..e104c18ac 100644 --- a/memcheck/tests/vbit-test/irops.c +++ b/memcheck/tests/vbit-test/irops.c @@ -109,13 +109,13 @@ static irop_t irops[] = { { DEFOP(Iop_MullU32, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 1 }, // mips asserts { DEFOP(Iop_MullU64, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32, mips assert { DEFOP(Iop_Clz64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32 asserts - { DEFOP(Iop_Clz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 }, + { DEFOP(Iop_Clz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 }, { DEFOP(Iop_Ctz64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, - { DEFOP(Iop_Ctz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, + { DEFOP(Iop_Ctz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_ClzNat64, UNDEF_ALL), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, // ppc32 asserts - { DEFOP(Iop_ClzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, + { DEFOP(Iop_ClzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_CtzNat64, UNDEF_ALL), .s390x = 0, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, - { DEFOP(Iop_CtzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, + { DEFOP(Iop_CtzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_PopCount64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_PopCount32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_CmpLT32S, UNDEF_ALL), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 }, From a5c48217e94a0fb7bac909a2ff13813ac10f5c37 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 31 Jul 2025 21:28:39 +0000 Subject: [PATCH 155/412] nanomips specific changes for BZ 507033 Rework code to use Iop_ClzNat32 instead of the deprecated Iop_Clz32. Iop_Clz32 is used to implement the CLZ insn which behaves naturally when the input is 0: CLZ(0) == 32 So it seems as if using Iop_Clz32 is wrong because it has undefined behaviour when the input value is 0. However, the VEX pipeline does this: CLZ insn --ir--> Iop_Clz32 --isel--> NMun_CLZ --emit--> CLZ So it all works out. Essentially the semantics of Iop_Clz32 were redefined to be like Iop_ClzNat32. In IR generation we can drop the special handling for CLO(0) because Iop_ClzNat32 takes care of that. Part of fixing https://bugs.kde.org/show_bug.cgi?id=507033 --- VEX/priv/guest_nanomips_toIR.c | 10 ++-------- VEX/priv/host_nanomips_isel.c | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/VEX/priv/guest_nanomips_toIR.c b/VEX/priv/guest_nanomips_toIR.c index 3827ac3fc..fddc1afa4 100644 --- a/VEX/priv/guest_nanomips_toIR.c +++ b/VEX/priv/guest_nanomips_toIR.c @@ -864,23 +864,17 @@ static void nano_pool32Axf_4(DisResult *dres, UInt cins) { UChar rs = (cins >> 16) & 0x1F; UChar rt = (cins >> 21) & 0x1F; - IRTemp t1; switch ((cins >> 9) & 0x7F) { case nano_POOL32Axf4_CLO: { /* clo */ DIP("clo r%u, r%u", rt, rs); - t1 = newTemp(Ity_I1); - assign(t1, binop(Iop_CmpEQ32, getIReg(rs), mkU32(0xffffffff))); - putIReg(rt, IRExpr_ITE(mkexpr(t1), - mkU32(0x00000020), - unop(Iop_Clz32, - unop(Iop_Not32, getIReg(rs))))); + putIReg(rt, unop(Iop_ClzNat32, unop(Iop_Not32, getIReg(rs)))); break; } case nano_POOL32Axf4_CLZ: { /* clz */ DIP("clz r%u, r%u", rt, rs); - putIReg(rt, unop(Iop_Clz32, getIReg(rs))); + putIReg(rt, unop(Iop_ClzNat32, getIReg(rs))); break; } } diff --git a/VEX/priv/host_nanomips_isel.c b/VEX/priv/host_nanomips_isel.c index c4a8f4fe3..05e4cc512 100644 --- a/VEX/priv/host_nanomips_isel.c +++ b/VEX/priv/host_nanomips_isel.c @@ -815,7 +815,7 @@ static HReg iselWordExpr_R_wrk(ISelEnv * env, IRExpr * e) return r_dst; } - case Iop_Clz32: { + case Iop_ClzNat32: { HReg r_dst = newVRegI(env); HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg); addInstr(env, NANOMIPSInstr_Unary(NMun_CLZ, r_dst, r_src)); From 34dff50cf304d1d4f0d5a1ad3f55f8b3d85ae701 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 1 Aug 2025 14:04:24 +0200 Subject: [PATCH 156/412] Wrap linux specific syscall sysfs The sysfs syscall is deprecated, but in some cases it may still be used. The Linux Test Project covers it. The (obsolete) sysfs() system call returns information about the filesystem types currently present in the kernel. The specific form of the sysfs() call and the information returned depends on the option in effect: 1 Translate the filesystem identifier string fsname into a filesystem type index. 2 Translate the filesystem type index fs_index into a null- terminated filesystem identifier string. This string will be written to the buffer pointed to by buf. Make sure that buf has enough space to accept the string. 3 Return the total number of filesystem types currently present in the kernel. Declare a sys_sysfs wrapper in priv_syswrap-linux.h and hook it for {amd64,arm,mips32,mips64,ppc32,ppc64,s390x,x86}-linux using LINXY with PRE and POST handler in syswrap-linux.c https://bugs.kde.org/show_bug.cgi?id=506929 --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 1 + coregrind/m_syswrap/syswrap-amd64-linux.c | 2 +- coregrind/m_syswrap/syswrap-arm-linux.c | 2 +- coregrind/m_syswrap/syswrap-linux.c | 36 ++++++++++++++++++++++ coregrind/m_syswrap/syswrap-mips32-linux.c | 2 +- coregrind/m_syswrap/syswrap-mips64-linux.c | 10 +----- coregrind/m_syswrap/syswrap-ppc32-linux.c | 2 +- coregrind/m_syswrap/syswrap-ppc64-linux.c | 2 +- coregrind/m_syswrap/syswrap-s390x-linux.c | 2 +- coregrind/m_syswrap/syswrap-x86-linux.c | 2 +- 11 files changed, 46 insertions(+), 16 deletions(-) diff --git a/NEWS b/NEWS index fe9de908f..32bea9353 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506795 Better report which clone flags are problematic 506910 openat2 with RESOLVE_NO_MAGICLINKS succeeds on /proc/self/exe 506928 Wrap (deprecated) linux specific ustat syscall +506929 Wrap (deprecated) linux sysfs syscall 506930 valgrind allows SIGKILL being reset to SIG_DFL 506967 Implement and override mallinfo2 506970 mmap needs an EBADF fd_allowed check diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index ce10a35f6..1d5135fc5 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -61,6 +61,7 @@ DECL_TEMPLATE(linux, sys_vmsplice); DECL_TEMPLATE(linux, sys_readahead); DECL_TEMPLATE(linux, sys_move_pages); DECL_TEMPLATE(linux, sys_cachestat); +DECL_TEMPLATE(linux, sys_sysfs); // clone is similar enough between linux variants to have a generic // version, but which will call an extern defined in syswrap--linux.c diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index c80286f00..f15c3dac7 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -636,7 +636,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_ustat, sys_ustat), // 136 GENXY(__NR_statfs, sys_statfs), // 137 GENXY(__NR_fstatfs, sys_fstatfs), // 138 - // (__NR_sysfs, sys_sysfs), // 139 + LINXY(__NR_sysfs, sys_sysfs), // 139 GENX_(__NR_getpriority, sys_getpriority), // 140 GENX_(__NR_setpriority, sys_setpriority), // 141 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index c5fb08dcc..4ba9801ce 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -711,7 +711,7 @@ static SyscallTableEntry syscall_main_table[] = { GENX_(__NR_fchdir, sys_fchdir), // 133 //zz // (__NR_bdflush, sys_bdflush), // 134 */Linux //zz -//zz // (__NR_sysfs, sys_sysfs), // 135 SVr4 + LINXY(__NR_sysfs, sys_sysfs), // 135 SVr4 LINX_(__NR_personality, sys_personality), // 136 // GENX_(__NR_afs_syscall, sys_ni_syscall), // 137 LINX_(__NR_setfsuid, sys_setfsuid16), // 138 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 572a42925..66e5ca62e 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4407,6 +4407,42 @@ PRE(sys_syncfs) PRE_REG_READ1(long, "syncfs", unsigned int, fd); } +PRE(sys_sysfs) +{ + FUSE_COMPATIBLE_MAY_BLOCK(); + switch (ARG1) { + case 1: + PRINT("sys_sysfs ( %lu, %lu )", ARG1, ARG2); + PRE_REG_READ2(long, "sysfs", int, flags, const void *, path); + PRE_MEM_RASCIIZ("sysfs(path)", ARG2); + break; + case 2: + PRINT("sys_sysfs ( %lu, %lu, %#" FMT_REGWORD "x )", + ARG1, ARG2, ARG3); + PRE_REG_READ3(long, "sysfs", int, flags, int, desc, void *, path); + PRE_MEM_WRITE("sysfs(path)", ARG3, 1); + break; + case 3: + PRINT("sys_sysfs ( %lu )", ARG1); + PRE_REG_READ1(long, "sysfs", int, flags); + break; + default: + if (VG_(clo_verbosity) >= 1) { + VG_(message)(Vg_DebugMsg, + "WARNING: unhandled sysfs option %lu\n", ARG1); + } + break; + } +} + +POST(sys_sysfs) +{ + if (ARG1 == 2) { + // For option 2, getting the fsname, there is no way to know how big the buffer needs to be. + POST_MEM_WRITE(ARG3, VG_(strlen)((void *)ARG3)); + } +} + PRE(sys_statx) { FUSE_COMPATIBLE_MAY_BLOCK(); diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 684bda4b9..13cb5d05b 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -899,7 +899,7 @@ static SyscallTableEntry syscall_main_table[] = { GENX_ (__NR_getpgid, sys_getpgid), // 132 GENX_ (__NR_fchdir, sys_fchdir), // 133 //.. // (__NR_bdflush, sys_bdflush), // 134 - //.. // (__NR_sysfs, sys_sysfs), // 135 + LINXY (__NR_sysfs, sys_sysfs), // 135 LINX_ (__NR_personality, sys_personality), // 136 //.. GENX_(__NR_afs_syscall, sys_ni_syscall), // 137 LINX_ (__NR_setfsuid, sys_setfsuid), // 138 diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 8e2dcbe93..bdfb20383 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -216,7 +216,6 @@ SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ) DECL_TEMPLATE (mips_linux, sys_set_thread_area); DECL_TEMPLATE (mips_linux, sys_vmsplice); -DECL_TEMPLATE (mips_linux, sys_sysfs); DECL_TEMPLATE (mips_linux, sys_swapon); DECL_TEMPLATE (mips_linux, sys_swapoff); DECL_TEMPLATE (mips_linux, sys_setdomainname); @@ -259,13 +258,6 @@ PRE(sys_swapoff) PRE_REG_READ1(long, "swapoff", const void *, path); } -PRE(sys_sysfs) -{ - PRINT("sys_sysfs ( %ld, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", - SARG1, ARG2, ARG3); - PRE_REG_READ3(long, "sysfs", int, flags, int, desc, const void *, path); -} - /* Very much MIPS specific */ PRE(sys_cacheflush) { @@ -645,7 +637,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY (__NR_ustat, sys_ustat), GENXY (__NR_statfs, sys_statfs), GENXY (__NR_fstatfs, sys_fstatfs), - PLAX_ (__NR_sysfs, sys_sysfs), + LINXY (__NR_sysfs, sys_sysfs), GENX_ (__NR_getpriority, sys_getpriority), GENX_ (__NR_setpriority, sys_setpriority), LINXY (__NR_sched_setparam, sys_sched_setparam), diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index d2b59786c..00d0f56d7 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -774,7 +774,7 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_fchdir, sys_fchdir), // 133 //.. // (__NR_bdflush, sys_bdflush), // 134 */Linux //.. -//.. // (__NR_sysfs, sys_sysfs), // 135 SVr4 + LINXY(__NR_sysfs, sys_sysfs), // 135 SVr4 LINX_(__NR_personality, sys_personality), // 136 //.. GENX_(__NR_afs_syscall, sys_ni_syscall), // 137 LINX_(__NR_setfsuid, sys_setfsuid), // 138 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 3d6c2e4ed..87a4c4db9 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -762,7 +762,7 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_fchdir, sys_fchdir), // 133 // _____(__NR_bdflush, sys_bdflush), // 134 -// _____(__NR_sysfs, sys_sysfs), // 135 + LINXY(__NR_sysfs, sys_sysfs), // 135 LINX_(__NR_personality, sys_personality), // 136 // _____(__NR_afs_syscall, sys_afs_syscall), // 137 LINX_(__NR_setfsuid, sys_setfsuid), // 138 diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index 65a26a02d..ad35a4ebc 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -573,7 +573,7 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_fchdir, sys_fchdir), // 133 // ?????(__NR_bdflush, ), // 134 -// ?????(__NR_sysfs, ), // 135 + LINXY(__NR_sysfs, sys_sysfs), // 135 LINX_(__NR_personality, sys_personality), // 136 GENX_(137, sys_ni_syscall), /* unimplemented (by the kernel) */ // 137 GENX_(138, sys_ni_syscall), /* unimplemented (by the kernel) */ // 138 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 0b8373ffa..9b8c9d861 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1320,7 +1320,7 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_fchdir, sys_fchdir), // 133 //zz // (__NR_bdflush, sys_bdflush), // 134 */Linux //zz -//zz // (__NR_sysfs, sys_sysfs), // 135 SVr4 + LINXY(__NR_sysfs, sys_sysfs), // 135 SVr4 LINX_(__NR_personality, sys_personality), // 136 GENX_(__NR_afs_syscall, sys_ni_syscall), // 137 LINX_(__NR_setfsuid, sys_setfsuid16), // 138 From a2c294b3b19ef4af391014e7b3cbc5ec75b2bd68 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 1 Aug 2025 15:35:04 +0200 Subject: [PATCH 157/412] Fix execveat() with AT_FDCWD and relative path, add more checks This update does address two closely related problems: 1) In case execveat() is called with a special file descriptor value of AT_FDCWD (-100), it should accept this special value, and interpret the provided pathname as relative to the current working directory of the calling process (like execve(2)) instead of failing with EBADF, as it does without this patch. Covered by LTP testcase execveat01. https://bugs.kde.org/show_bug.cgi?id=506806 2) Add checks preventing execveat() of symlinked programs in case AT_SYMLINK_NOFOLLOW was specified. Add checks preventing execveat() from passing in case invalid flag was specified. Covered by LTP testcase execveat02. https://bugs.kde.org/show_bug.cgi?id=506813 --- NEWS | 2 ++ coregrind/m_syswrap/syswrap-linux.c | 45 ++++++++++++++--------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/NEWS b/NEWS index 32bea9353..cf879c8d2 100644 --- a/NEWS +++ b/NEWS @@ -58,6 +58,8 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506076 unimplemented fcntl command: 1028 (F_CREATED_QUERY) 506499 Unhandled syscall 592 (exterrctl - FreeBSD 506795 Better report which clone flags are problematic +506806 Fix execveat() with AT_FDCWD and relative path +506813 The execveat wrapper needs to do more checking 506910 openat2 with RESOLVE_NO_MAGICLINKS succeeds on /proc/self/exe 506928 Wrap (deprecated) linux specific ustat syscall 506929 Wrap (deprecated) linux sysfs syscall diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 66e5ca62e..c81d941a7 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -13893,12 +13893,12 @@ PRE(sys_execveat) return; #endif + Int arg_1 = (Int) ARG1; const HChar *path = (const HChar*) ARG2; Addr arg_2 = ARG3; Addr arg_3 = ARG4; const HChar *buf; HChar *abs_path = NULL; - Bool check_at_symlink = False; Bool check_pathptr = True; if (ML_(safe_to_deref) (path, 1)) { @@ -13906,8 +13906,12 @@ PRE(sys_execveat) * and just pass the pathname, try to determine * the absolute path otherwise. */ if (path[0] != '/') { - /* Check dirfd is a valid fd. */ - if (!ML_(fd_allowed)(ARG1, "execveat", tid, False)) { + /* Check dirfd is a valid fd. + * BUT: allow special value of AT_FDCWD (-101) per the execveat(2) man page: + * If pathname is relative and dirfd is the special value AT_FDCWD, + * then pathname is interpreted relative to the current working directory + * of the calling process (like execve(2)). */ + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "execveat", tid, False)) { SET_STATUS_Failure( VKI_EBADF ); return; } @@ -13915,38 +13919,33 @@ PRE(sys_execveat) set then dirfd describes the whole path. */ if (path[0] == '\0') { if (ARG5 & VKI_AT_EMPTY_PATH) { - if (VG_(resolve_filename)(ARG1, &buf)) { + if (VG_(resolve_filename)(arg_1, &buf)) { path = buf; check_pathptr = False; } } - } - else if (ARG1 == VKI_AT_FDCWD) { - check_at_symlink = True; - } else - if (ARG5 & VKI_AT_SYMLINK_NOFOLLOW) - check_at_symlink = True; - else if (VG_(resolve_filename)(ARG1, &buf)) { + } else if (VG_(resolve_filename)(arg_1, &buf)) { abs_path = VG_(malloc)("execveat", (VG_(strlen)(buf) + 1 + VG_(strlen)(path) + 1)); VG_(sprintf)(abs_path, "%s/%s", buf, path); path = abs_path; check_pathptr = False; - } - else - path = NULL; - if (check_at_symlink) { - struct vg_stat statbuf; - SysRes statres; - - statres = VG_(stat)(path, &statbuf); - if (sr_isError(statres) || VKI_S_ISLNK(statbuf.mode)) { - SET_STATUS_Failure( VKI_ELOOP ); - return; - } } } + if (ARG5 & VKI_AT_SYMLINK_NOFOLLOW) { + struct vg_stat statbuf; + SysRes statres; + statres = VG_(stat)(path, &statbuf); + if (sr_isError(statres) || VKI_S_ISLNK(statbuf.mode)) { + SET_STATUS_Failure( VKI_ELOOP ); + return; + } + } + if(ARG5 & ~(VKI_AT_SYMLINK_NOFOLLOW | VKI_AT_EMPTY_PATH)) { + SET_STATUS_Failure( VKI_EINVAL ); + return; + } } else { SET_STATUS_Failure(VKI_EFAULT); return; From 697efef3720d5c78c7957ba107fb2f3307f53fd8 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sat, 2 Aug 2025 12:43:54 +0000 Subject: [PATCH 158/412] mips specific changes for BZ 507033 Rework code to use Iop_ClzNat32 instead of the deprecated Iop_Clz32. Likewise for Iop_Clz64. For Iop_Clz32 a CLZ insn will be emitted which behaves naturally when its input is 0. That is: CLZ(0) == 32. Similarly, for Iop_Clz64 a DCLZ will be emitted with DCLZ(0) == 64. That means we can replace Iop_Clz32/64 with Iop_ClzNat32/64 and remove any IR that handles the input-is-zero case. See also commit a5c48217e94. Part of fixing https://bugs.kde.org/show_bug.cgi?id=507033 --- VEX/priv/guest_mips_toIR.c | 74 +++++++------------------------- VEX/priv/host_mips_isel.c | 6 +-- memcheck/tests/vbit-test/irops.c | 8 ++-- 3 files changed, 23 insertions(+), 65 deletions(-) diff --git a/VEX/priv/guest_mips_toIR.c b/VEX/priv/guest_mips_toIR.c index 1285edad0..e42fc2782 100644 --- a/VEX/priv/guest_mips_toIR.c +++ b/VEX/priv/guest_mips_toIR.c @@ -17086,14 +17086,10 @@ static UInt disInstr_MIPS_WRK_Special(UInt cins, const VexArchInfo* archinfo, IRTemp tmpRs32 = newTemp(Ity_I32); assign(tmpRs32, mkNarrowTo32(ty, getIReg(rs))); - assign(tmpClz32, unop(Iop_Clz32, mkexpr(tmpRs32))); + assign(tmpClz32, unop(Iop_ClzNat32, mkexpr(tmpRs32))); putIReg(rd, mkWidenFrom32(ty, mkexpr(tmpClz32), True)); } else { - t1 = newTemp(Ity_I1); - assign(t1, binop(Iop_CmpEQ32, getIReg(rs), mkU32(0))); - putIReg(rd, IRExpr_ITE(mkexpr(t1), - mkU32(0x00000020), - unop(Iop_Clz32, getIReg(rs)))); + putIReg(rd, unop(Iop_ClzNat32, getIReg(rs))); } } else { ILLEGAL_INSTRUCTON; @@ -17126,21 +17122,14 @@ static UInt disInstr_MIPS_WRK_Special(UInt cins, const VexArchInfo* archinfo, IRTemp tmpRs32 = newTemp(Ity_I32); assign(tmpRs32, mkNarrowTo32(ty, getIReg(rs))); - t1 = newTemp(Ity_I1); - assign(t1, binop(Iop_CmpEQ32, mkexpr(tmpRs32), mkU32(0xffffffff))); - assign(tmpClo32, IRExpr_ITE(mkexpr(t1), - mkU32(0x00000020), - unop(Iop_Clz32, unop(Iop_Not32, mkexpr(tmpRs32))))); + assign(tmpClo32, unop(Iop_ClzNat32, + unop(Iop_Not32, mkexpr(tmpRs32)))); putIReg(rd, mkWidenFrom32(ty, mkexpr(tmpClo32), True)); break; } else { - t1 = newTemp(Ity_I1); - assign(t1, binop(Iop_CmpEQ32, getIReg(rs), mkU32(0xffffffff))); - putIReg(rd, IRExpr_ITE(mkexpr(t1), - mkU32(0x00000020), - unop(Iop_Clz32, - unop(Iop_Not32, getIReg(rs))))); + putIReg(rd, unop(Iop_ClzNat32, + unop(Iop_Not32, getIReg(rs)))); } } else { ILLEGAL_INSTRUCTON; @@ -17188,11 +17177,7 @@ static UInt disInstr_MIPS_WRK_Special(UInt cins, const VexArchInfo* archinfo, case 1: DIP("dclz r%u, r%u", rd, rs); - t1 = newTemp(Ity_I1); - assign(t1, binop(Iop_CmpEQ64, getIReg(rs), mkU64(0))); - putIReg(rd, IRExpr_ITE(mkexpr(t1), - mkU64(0x00000040), - unop(Iop_Clz64, getIReg(rs)))); + putIReg(rd, unop(Iop_ClzNat64, getIReg(rs))); break; } @@ -17225,13 +17210,8 @@ static UInt disInstr_MIPS_WRK_Special(UInt cins, const VexArchInfo* archinfo, case 1: DIP("dclo r%u, r%u", rd, rs); - t1 = newTemp(Ity_I1); - assign(t1, binop(Iop_CmpEQ64, getIReg(rs), - mkU64(0xffffffffffffffffULL))); - putIReg(rd, IRExpr_ITE(mkexpr(t1), - mkU64(0x40), - unop(Iop_Clz64, unop(Iop_Not64, - getIReg(rs))))); + putIReg(rd, unop(Iop_ClzNat64, + unop(Iop_Not64, getIReg(rs)))); break; } @@ -18772,14 +18752,10 @@ static UInt disInstr_MIPS_WRK_Special2(UInt cins, const VexArchInfo* archinfo, IRTemp tmpRs32 = newTemp(Ity_I32); assign(tmpRs32, mkNarrowTo32(ty, getIReg(rs))); - assign(tmpClz32, unop(Iop_Clz32, mkexpr(tmpRs32))); + assign(tmpClz32, unop(Iop_ClzNat32, mkexpr(tmpRs32))); putIReg(rd, mkWidenFrom32(ty, mkexpr(tmpClz32), True)); } else { - t1 = newTemp(Ity_I1); - assign(t1, binop(Iop_CmpEQ32, getIReg(rs), mkU32(0))); - putIReg(rd, IRExpr_ITE(mkexpr(t1), - mkU32(0x00000020), - unop(Iop_Clz32, getIReg(rs)))); + putIReg(rd, unop(Iop_ClzNat32, getIReg(rs))); } break; @@ -18793,43 +18769,25 @@ static UInt disInstr_MIPS_WRK_Special2(UInt cins, const VexArchInfo* archinfo, IRTemp tmpRs32 = newTemp(Ity_I32); assign(tmpRs32, mkNarrowTo32(ty, getIReg(rs))); - t1 = newTemp(Ity_I1); - assign(t1, binop(Iop_CmpEQ32, mkexpr(tmpRs32), mkU32(0xffffffff))); - assign(tmpClo32, IRExpr_ITE(mkexpr(t1), - mkU32(0x00000020), - unop(Iop_Clz32, unop(Iop_Not32, mkexpr(tmpRs32))))); + assign(tmpClo32, unop(Iop_ClzNat32, + unop(Iop_Not32, mkexpr(tmpRs32)))); putIReg(rd, mkWidenFrom32(ty, mkexpr(tmpClo32), True)); break; } else { - t1 = newTemp(Ity_I1); - assign(t1, binop(Iop_CmpEQ32, getIReg(rs), mkU32(0xffffffff))); - putIReg(rd, IRExpr_ITE(mkexpr(t1), - mkU32(0x00000020), - unop(Iop_Clz32, - unop(Iop_Not32, getIReg(rs))))); + putIReg(rd, unop(Iop_ClzNat32, unop(Iop_Not32, getIReg(rs)))); break; } } case 0x24: /* Count Leading Zeros in Doubleword - DCLZ; MIPS64 */ DIP("dclz r%u, r%u", rd, rs); - t1 = newTemp(Ity_I1); - assign(t1, binop(Iop_CmpEQ64, getIReg(rs), mkU64(0))); - putIReg(rd, IRExpr_ITE(mkexpr(t1), - mkU64(0x00000040), - unop(Iop_Clz64, getIReg(rs)))); + putIReg(rd, unop(Iop_ClzNat64, getIReg(rs))); break; case 0x25: /* Count Leading Ones in Doubleword - DCLO; MIPS64 */ DIP("dclo r%u, r%u", rd, rs); - t1 = newTemp(Ity_I1); - assign(t1, binop(Iop_CmpEQ64, getIReg(rs), - mkU64(0xffffffffffffffffULL))); - putIReg(rd, IRExpr_ITE(mkexpr(t1), - mkU64(0x40), - unop(Iop_Clz64, unop(Iop_Not64, - getIReg(rs))))); + putIReg(rd, unop(Iop_ClzNat64, unop(Iop_Not64, getIReg(rs)))); break; default: diff --git a/VEX/priv/host_mips_isel.c b/VEX/priv/host_mips_isel.c index 33e4f5216..2bdfa4a64 100644 --- a/VEX/priv/host_mips_isel.c +++ b/VEX/priv/host_mips_isel.c @@ -2155,13 +2155,13 @@ static HReg iselWordExpr_R_wrk(ISelEnv * env, IRExpr * e) return r_dst; } - case Iop_Clz64: + case Iop_ClzNat64: vassert(mode64); /* fallthrough */ - case Iop_Clz32: { + case Iop_ClzNat32: { HReg r_dst = newVRegI(env); HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg); - MIPSUnaryOp op = (op_unop == Iop_Clz64) ? Mun_DCLZ : Mun_CLZ; + MIPSUnaryOp op = (op_unop == Iop_ClzNat64) ? Mun_DCLZ : Mun_CLZ; addInstr(env, MIPSInstr_Unary(op, r_dst, r_src)); return r_dst; } diff --git a/memcheck/tests/vbit-test/irops.c b/memcheck/tests/vbit-test/irops.c index e104c18ac..fdea8919e 100644 --- a/memcheck/tests/vbit-test/irops.c +++ b/memcheck/tests/vbit-test/irops.c @@ -108,12 +108,12 @@ static irop_t irops[] = { { DEFOP(Iop_MullU16, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_MullU32, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 1 }, // mips asserts { DEFOP(Iop_MullU64, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32, mips assert - { DEFOP(Iop_Clz64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32 asserts - { DEFOP(Iop_Clz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 }, + { DEFOP(Iop_Clz64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, // ppc32 asserts + { DEFOP(Iop_Clz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_Ctz64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_Ctz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, - { DEFOP(Iop_ClzNat64, UNDEF_ALL), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, // ppc32 asserts - { DEFOP(Iop_ClzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, + { DEFOP(Iop_ClzNat64, UNDEF_ALL), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32 asserts + { DEFOP(Iop_ClzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 }, { DEFOP(Iop_CtzNat64, UNDEF_ALL), .s390x = 0, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_CtzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_PopCount64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, From 8436a7c61c07563bdc9fb1686c82821e74784dcf Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sat, 2 Aug 2025 13:14:31 +0000 Subject: [PATCH 159/412] ARM specific changes for BZ 507033 Rework code to use Iop_ClzNat32 instead of the deprecated Iop_Clz32. Iop_Clz32 --isel--> ARMun_CLZ --emit--> CLZ insn with CLZ(0) == 32 Hence, any workaround for a zero input value can be removed. Part of fixing https://bugs.kde.org/show_bug.cgi?id=507033 --- VEX/priv/guest_arm_toIR.c | 12 ++---------- VEX/priv/host_arm_isel.c | 9 +-------- memcheck/tests/vbit-test/irops.c | 4 ++-- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/VEX/priv/guest_arm_toIR.c b/VEX/priv/guest_arm_toIR.c index 2bedccd14..673e87628 100644 --- a/VEX/priv/guest_arm_toIR.c +++ b/VEX/priv/guest_arm_toIR.c @@ -17100,11 +17100,7 @@ DisResult disInstr_ARM_WRK ( IRTemp arg = newTemp(Ity_I32); IRTemp res = newTemp(Ity_I32); assign(arg, getIRegA(rM)); - assign(res, IRExpr_ITE( - binop(Iop_CmpEQ32, mkexpr(arg), mkU32(0)), - mkU32(32), - unop(Iop_Clz32, mkexpr(arg)) - )); + assign(res, unop(Iop_ClzNat32, mkexpr(arg))); putIRegA(rD, mkexpr(res), condT, Ijk_Boring); DIP("clz%s r%u, r%u\n", nCC(INSN_COND), rD, rM); goto decode_success; @@ -22730,11 +22726,7 @@ DisResult disInstr_THUMB_WRK ( IRTemp arg = newTemp(Ity_I32); IRTemp res = newTemp(Ity_I32); assign(arg, getIRegT(rM1)); - assign(res, IRExpr_ITE( - binop(Iop_CmpEQ32, mkexpr(arg), mkU32(0)), - mkU32(32), - unop(Iop_Clz32, mkexpr(arg)) - )); + assign(res, unop(Iop_ClzNat32, mkexpr(arg))); putIRegT(rD, mkexpr(res), condT); DIP("clz r%u, r%u\n", rD, rM1); goto decode_success; diff --git a/VEX/priv/host_arm_isel.c b/VEX/priv/host_arm_isel.c index d19efe5c3..4b76a6170 100644 --- a/VEX/priv/host_arm_isel.c +++ b/VEX/priv/host_arm_isel.c @@ -1870,14 +1870,7 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, IRExpr* e ) //zz addInstr(env, X86Instr_Sh32(Xsh_SAR, 31, dst)); //zz return dst; //zz } -//zz case Iop_Ctz32: { -//zz /* Count trailing zeroes, implemented by x86 'bsfl' */ -//zz HReg dst = newVRegI(env); -//zz HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); -//zz addInstr(env, X86Instr_Bsfr32(True,src,dst)); -//zz return dst; -//zz } - case Iop_Clz32: { + case Iop_ClzNat32: { /* Count leading zeroes; easy on ARM. */ HReg dst = newVRegI(env); HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); diff --git a/memcheck/tests/vbit-test/irops.c b/memcheck/tests/vbit-test/irops.c index fdea8919e..2f0ea8a6a 100644 --- a/memcheck/tests/vbit-test/irops.c +++ b/memcheck/tests/vbit-test/irops.c @@ -109,11 +109,11 @@ static irop_t irops[] = { { DEFOP(Iop_MullU32, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 1 }, // mips asserts { DEFOP(Iop_MullU64, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32, mips assert { DEFOP(Iop_Clz64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, // ppc32 asserts - { DEFOP(Iop_Clz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, + { DEFOP(Iop_Clz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_Ctz64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_Ctz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_ClzNat64, UNDEF_ALL), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32 asserts - { DEFOP(Iop_ClzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 }, + { DEFOP(Iop_ClzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 }, { DEFOP(Iop_CtzNat64, UNDEF_ALL), .s390x = 0, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_CtzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_PopCount64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, From 75501e34e32124ba8916d84ce9317a29e7266000 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sat, 2 Aug 2025 13:22:50 +0000 Subject: [PATCH 160/412] ARM64 specific changes for BZ 507033 Replace the deprecated Iop_Clz64 with Iop_ClzNat64 which have the same semantics for non-zero inputs. Part of fixing https://bugs.kde.org/show_bug.cgi?id=507033 --- VEX/priv/guest_arm64_toIR.c | 4 ++-- VEX/priv/host_arm64_isel.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VEX/priv/guest_arm64_toIR.c b/VEX/priv/guest_arm64_toIR.c index e6b92c7a0..f5b445489 100644 --- a/VEX/priv/guest_arm64_toIR.c +++ b/VEX/priv/guest_arm64_toIR.c @@ -3504,12 +3504,12 @@ Bool dis_ARM64_data_processing_register(/*MB_OUT*/DisResult* dres, if (is64) { assign(dst, IRExpr_ITE(binop(Iop_CmpEQ64, mkexpr(srcZ), mkU64(0)), mkU64(isCLS ? 63 : 64), - unop(Iop_Clz64, mkexpr(srcZ)))); + unop(Iop_ClzNat64, mkexpr(srcZ)))); putIReg64orZR(dd, mkexpr(dst)); } else { assign(dst, IRExpr_ITE(binop(Iop_CmpEQ64, mkexpr(srcZ), mkU64(0)), mkU64(isCLS ? 31 : 32), - unop(Iop_Clz64, mkexpr(srcZ)))); + unop(Iop_ClzNat64, mkexpr(srcZ)))); putIReg32orZR(dd, unop(Iop_64to32, mkexpr(dst))); } DIP("cl%c %s, %s\n", isCLS ? 's' : 'z', diff --git a/VEX/priv/host_arm64_isel.c b/VEX/priv/host_arm64_isel.c index 34c526559..190d8c8f1 100644 --- a/VEX/priv/host_arm64_isel.c +++ b/VEX/priv/host_arm64_isel.c @@ -2048,7 +2048,7 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, IRExpr* e ) addInstr(env, ARM64Instr_Unary(dst, src, ARM64un_NOT)); return dst; } - case Iop_Clz64: { + case Iop_ClzNat64: { HReg dst = newVRegI(env); HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); addInstr(env, ARM64Instr_Unary(dst, src, ARM64un_CLZ)); From 112f1080b7c21e37dfce0a2e589d0dc7aa115afa Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 5 Aug 2025 22:29:14 +0200 Subject: [PATCH 161/412] Add bug 503241 s390x: Support z17 changes to the NNPA instruction to NEWS This was added in commit 24b634e8ce04de70d4aa6c61a12149df223f9c68 https://bugs.kde.org/show_bug.cgi?id=503241 --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index cf879c8d2..ef5af7c66 100644 --- a/NEWS +++ b/NEWS @@ -37,6 +37,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 502359 Add --modify-fds=yes option 502968 Wrap linux specific syscalls 457 (listmount) and 458 (statmount) 503098 Incorrect NAN-boxing for float registers in RISC-V +503241 s390x: Support z17 changes to the NNPA instruction 503641 close_range syscalls started failing with 3.25.0 503677 duplicated-cond compiler warning in dis_RV64M 503817 s390x: fix 'ordered comparison of pointer with integer zero' compiler warnings From 03ea5d11d3832fb83a434408a5ea7049392fd4bd Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 5 Aug 2025 18:06:08 +0200 Subject: [PATCH 162/412] Allow for patching LTP sources Sometimes there's an upstream LTP patch that helps testing valgrind, but it's not yet part of the official LTP tarball. In such cases it's helpful to be able to patch the LTP sources. Attached patch allows for that. It comes with a real life example patch: LTP commit b62b831cf. --- NEWS | 1 + auxprogs/Makefile.am | 1 + auxprogs/ltp-apply-patches.sh | 15 +++++++ ...-powerpc-syscall-defs-don-t-leak-to-.patch | 41 +++++++++++++++++++ auxprogs/ltp-patches/README | 5 +++ 5 files changed, 63 insertions(+) create mode 100755 auxprogs/ltp-apply-patches.sh create mode 100644 auxprogs/ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch create mode 100644 auxprogs/ltp-patches/README diff --git a/NEWS b/NEWS index ef5af7c66..cecbd6db7 100644 --- a/NEWS +++ b/NEWS @@ -68,6 +68,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506967 Implement and override mallinfo2 506970 mmap needs an EBADF fd_allowed check 507173 s390x: Crash when constant folding is disabled +507897 Allow for patching LTP sources To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index 97eb9501e..5542111db 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -199,6 +199,7 @@ $(LTP_SRC_DIR): $(LTP_TAR) echo "$(LTP_SHA256_SUM) $(LTP_TAR)" | @SHA256SUM@ --check - (cd $(AUX_CHECK_DIR) && \ tar Jxf $(LTP_TAR_NAME) && \ + $(abs_top_srcdir)/auxprogs/ltp-apply-patches.sh $(LTP_SRC_DIR) && \ cd $(LTP_SRC_DIR) && \ ./configure CC="${CC}" CXX="${CXX}" CFLAGS="$(LTP_CFLAGS)" && \ ${MAKE} -j $(nproc) -C testcases/kernel/syscalls) diff --git a/auxprogs/ltp-apply-patches.sh b/auxprogs/ltp-apply-patches.sh new file mode 100755 index 000000000..150dd2a9b --- /dev/null +++ b/auxprogs/ltp-apply-patches.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -xe + +LTP_SRC_DIR=$1 +cd $(dirname $(readlink -f $0)) +echo "applying LTP patches ..." +if compgen -G "ltp-patches/*.patch"; then + for i in ltp-patches/*.patch; do + patch -d "$LTP_SRC_DIR" -p1 < "$i" + done + echo "applying LTP patches finished" +else + echo "no patches found, nothing to do" +fi diff --git a/auxprogs/ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch b/auxprogs/ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch new file mode 100644 index 000000000..bd1fb1dd6 --- /dev/null +++ b/auxprogs/ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch @@ -0,0 +1,41 @@ +From a90b2aac69028bd6b9e0fcc1e36760639b937b99 Mon Sep 17 00:00:00 2001 +From: Martin Cermak +Date: Mon, 4 Aug 2025 21:46:52 +0200 +Subject: [PATCH] Make sure 32-bit powerpc syscall defs don't leak to 64-bit + powerpc systems + +generate_syscalls.sh generates the syscalls.h header at the configure +time. At the moment, that header has a set of 32-bit syscalls defined +with the __powerpc__ gate, plus another set of 64-bit syscalls defined +with the __powerpc64__ gate. For 32-bit powerpc systems that's fine. +But for a 64-bit powerpc system this means that both sets of syscalls +become defined, which isn't right. + +Thing is that on a 64-bit powerpc system, both __powerpc__ and +__powerpc64__ are defined compiler macros, while on a 32-bit powerpc +system, only the former is defined while the latter is not. + +That said, the correct gate for a 32-bit only powerpc code is: + #if defined(__powerpc__) && !defined(__powerpc64__) + +Without this patch, e.g. __NR_clock_gettime64 def leaks to +64-bit powerpc systems, which is wrong. This patch fixes it. +--- + include/lapi/syscalls/generate_syscalls.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/lapi/syscalls/generate_syscalls.sh b/include/lapi/syscalls/generate_syscalls.sh +index b17c72ddf..19f280dfb 100755 +--- a/include/lapi/syscalls/generate_syscalls.sh ++++ b/include/lapi/syscalls/generate_syscalls.sh +@@ -78,6 +78,7 @@ while IFS= read -r arch; do + parisc) echo "#ifdef __hppa__" ;; + loongarch64) echo "#ifdef __loongarch__" ;; + arm64) echo "#ifdef __aarch64__" ;; ++ powerpc) echo "#if defined(__powerpc__) && !defined(__powerpc64__)" ;; + *) echo "#ifdef __${arch}__" ;; + esac + +-- +2.48.1 + diff --git a/auxprogs/ltp-patches/README b/auxprogs/ltp-patches/README new file mode 100644 index 000000000..89df4bff1 --- /dev/null +++ b/auxprogs/ltp-patches/README @@ -0,0 +1,5 @@ +This directory contains LTP patches that are not included in the official LTP +tarball. After a new version of LTP is adopted for Valgrind testing, this patch +set should be reviewed and cleaned up. Patch filenames are expected to have the +.patch suffix. + From 90d4ed67ff52b859bf1f2d8cbea8816ca705d6f6 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 5 Aug 2025 17:36:29 +0200 Subject: [PATCH 163/412] Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD The fchmodat and fchmodat2 syscall wrappers should accept special value AT_FDCWD as a valid file descriptor. https://bugs.kde.org/show_bug.cgi?id=507873 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 31 ++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index cecbd6db7..6b21446ec 100644 --- a/NEWS +++ b/NEWS @@ -68,6 +68,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506967 Implement and override mallinfo2 506970 mmap needs an EBADF fd_allowed check 507173 s390x: Crash when constant folding is disabled +507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD 507897 Allow for patching LTP sources To see details of a given bug, visit diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index c81d941a7..96d22e6f4 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -6407,15 +6407,21 @@ POST(sys_readlinkat) PRE(sys_fchmodat) { + Int arg_1 = (Int) ARG1; + const HChar *path = (const HChar*) ARG2; FUSE_COMPATIBLE_MAY_BLOCK(); - PRINT("sys_fchmodat ( %ld, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", - SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3); + PRINT("sys_fchmodat ( %d, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", + arg_1, ARG2, path, ARG3); PRE_REG_READ3(long, "fchmodat", int, dfd, const char *, path, vki_mode_t, mode); PRE_MEM_RASCIIZ( "fchmodat(path)", ARG2 ); - if ( !ML_(fd_allowed)(SARG1, "fchmodat", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); - + if (ML_(safe_to_deref) (path, 1)) { + // If pathname is relative and dirfd is the special value AT_FDCWD, then pathname is interpreted ... + if (path[0] != '/') + if ( arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "fchmodat", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); + // If pathname is absolute, then dirfd is ignored + } } PRE(sys_cachestat) @@ -6440,16 +6446,23 @@ POST(sys_cachestat) PRE(sys_fchmodat2) { + Int arg_1 = (Int) ARG1; + const HChar *path = (const HChar*) ARG2; FUSE_COMPATIBLE_MAY_BLOCK(); - PRINT("sys_fchmodat2 ( %ld, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %" + PRINT("sys_fchmodat2 ( %d, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %" FMT_REGWORD "u )", - SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4); + arg_1, ARG2, path, ARG3, ARG4); PRE_REG_READ4(long, "fchmodat2", int, dfd, const char *, path, vki_mode_t, mode, unsigned int, flags); PRE_MEM_RASCIIZ( "fchmodat2(pathname)", ARG2 ); - if ( !ML_(fd_allowed)(SARG1, "fchmodat2", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); + if (ML_(safe_to_deref) (path, 1)) { + // If pathname is relative and dirfd is the special value AT_FDCWD, then pathname is interpreted ... + if (path[0] != '/') + if ( arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "fchmodat2", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); + // If pathname is absolute, then dirfd is ignored + } } PRE(sys_faccessat) From bdbce5686e4204d678814fa861d153c5bc5252f8 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 5 Aug 2025 16:54:54 +0200 Subject: [PATCH 164/412] The futimesat syscall wrapper doesn't handle AT_FDCWD Update futimesat syscall wrapper so that it doesn't consider the special value AT_FDCWD (-100) an invalid file descriptor. https://bugs.kde.org/show_bug.cgi?id=507868 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 6b21446ec..a38078277 100644 --- a/NEWS +++ b/NEWS @@ -68,6 +68,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506967 Implement and override mallinfo2 506970 mmap needs an EBADF fd_allowed check 507173 s390x: Crash when constant folding is disabled +507868 futimesat doesn't handle AT_FDCWD 507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD 507897 Allow for patching LTP sources diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 96d22e6f4..1033d2409 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -6213,16 +6213,23 @@ PRE(sys_fchownat) PRE(sys_futimesat) { FUSE_COMPATIBLE_MAY_BLOCK(); - PRINT("sys_futimesat ( %ld, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", - SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3); + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*) ARG2; + PRINT("sys_futimesat ( %d, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", + arg_1, ARG2, path, ARG3); PRE_REG_READ3(long, "futimesat", int, dfd, char *, filename, struct timeval *, tvp); if (ARG2 != 0) PRE_MEM_RASCIIZ( "futimesat(filename)", ARG2 ); if (ARG3 != 0) PRE_MEM_READ( "futimesat(tvp)", ARG3, 2 * sizeof(struct vki_timeval) ); - if ( !ML_(fd_allowed)(SARG1, "futimesat", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); + if (ML_(safe_to_deref) (path, 1)) { + /* If pathname is relative and dirfd is the special value AT_FDCWD, then pathname is interpreted ... */ + if (path[0] != '/') + if ( arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "futimesat", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); + /* If pathname is absolute, then dirfd is ignored. */ + } } From 835317da7bbc290805dd747503e370f733c39189 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 7 Aug 2025 00:21:42 +0200 Subject: [PATCH 165/412] Distribute auxprogs scripts and data files Make sure pybuild.sh, ltp-tester.sh, ltp-apply-patches.sh, s390-check-opcodes.pl, s390-runone scripts, ltp filters, ltp patches and pylintrc are added to the dist. This makes sure users can run the scripts and make ltpchecks not just from a git checkout, but also from a release or snapshots tar. Also use the ustar format to package files, the path under valgrind-x.yy.z/auxprogs/ltp-patches might be larger than 99 chars. automake 1.18 already defaults to the ustar format. --- auxprogs/Makefile.am | 20 ++++++++++++++++++-- configure.ac | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index 5542111db..4f9f100c0 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -2,27 +2,43 @@ include $(top_srcdir)/Makefile.all.am dist_noinst_SCRIPTS = \ change-copyright-year \ + pybuild.sh \ dump_insn_ppc.sh \ gen-mdg \ gsl19test \ + ltp-tester.sh \ + ltp-apply-patches.sh \ make_or_upd_vgversion_h \ nightly-build-summary \ + s390-check-opcodes.pl \ + s390-runone \ update-demangler \ posixtestsuite-1.5.1-diff-results +LTP_FILTERS = \ + filters/mmap18 \ + filters/prctl10 \ + filters/select03 + +LTP_PATCHES = \ + ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch + EXTRA_DIST = \ docs/valgrind-listener-manpage.xml \ docs/valgrind-di-server-manpage.xml \ + pylintrc \ gsl-1.6.patch \ gsl-1.6.supp \ gsl-1.6.out.x86.exp \ - ltp-tester.sh \ ltp-excludes.txt \ ltp-error-patterns.txt \ posixtestsuite-1.5.1-diff.txt \ ppcfround.c \ ppc64shifts.c \ - primes.c + primes.c \ + ltp-patches/README \ + $(LTP_FILTERS) \ + $(LTP_PATCHES) #---------------------------------------------------------------------------- # valgrind_listener (built for the primary target only) diff --git a/configure.ac b/configure.ac index 6183179db..0d5633fc0 100755 --- a/configure.ac +++ b/configure.ac @@ -35,7 +35,7 @@ AC_SUBST(VG_DATE, v_rel_date) AC_CONFIG_SRCDIR(coregrind/m_main.c) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects]) +AM_INIT_AUTOMAKE([foreign dist-bzip2 tar-ustar subdir-objects]) AM_MAINTAINER_MODE From efae8bf8b8927f714c2d2ea2d757d0a71a7dc9ad Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 8 Aug 2025 23:38:33 +0200 Subject: [PATCH 166/412] Review the vmsplice syscall wrapper Reuse the vmsplice syscall wrapper in coregrind/m_syswrap/syswrap-linux.c for mips64 as well. And make sure arm64-linux and riscv64-linux also use the POST vmsplice wrapper. --- NEWS | 1 + coregrind/m_syswrap/syswrap-arm64-linux.c | 2 +- coregrind/m_syswrap/syswrap-mips64-linux.c | 11 +---------- coregrind/m_syswrap/syswrap-nanomips-linux.c | 2 +- coregrind/m_syswrap/syswrap-riscv64-linux.c | 2 +- 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index a38078277..1b2e3871c 100644 --- a/NEWS +++ b/NEWS @@ -71,6 +71,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 507868 futimesat doesn't handle AT_FDCWD 507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD 507897 Allow for patching LTP sources +508029 Review the vmsplice syscall wrapper To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index 40eb65432..f6f63a52e 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -623,7 +623,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_pselect6, sys_pselect6), // 72 LINXY(__NR_ppoll, sys_ppoll), // 73 LINXY(__NR_signalfd4, sys_signalfd4), // 74 - LINX_(__NR_vmsplice, sys_vmsplice), // 75 + LINXY(__NR_vmsplice, sys_vmsplice), // 75 LINX_(__NR_splice, sys_splice), // 76 LINX_(__NR_tee, sys_tee), // 77 LINXY(__NR_readlinkat, sys_readlinkat), // 78 diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index bdfb20383..5234ccc37 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -215,7 +215,6 @@ SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ) file, but that requires even more macro magic. */ DECL_TEMPLATE (mips_linux, sys_set_thread_area); -DECL_TEMPLATE (mips_linux, sys_vmsplice); DECL_TEMPLATE (mips_linux, sys_swapon); DECL_TEMPLATE (mips_linux, sys_swapoff); DECL_TEMPLATE (mips_linux, sys_setdomainname); @@ -230,14 +229,6 @@ DECL_TEMPLATE (mips_linux, sys_rt_sigreturn); DECL_TEMPLATE (mips_linux, sys_pipe); DECL_TEMPLATE (mips_linux, sys_fadvise64); -PRE(sys_vmsplice) -{ - PRINT("sys_vmsplice ( %ld, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %ld )", - SARG1, ARG2, ARG3, SARG4); - PRE_REG_READ4(long, "sys_vmsplice", int, fdin, struct vki_iovec *, v, - vki_size_t, len, int, flags); -} - PRE(sys_sched_rr_get_interval) { PRINT("sys_sched_rr_get_interval ( %ld, %#" FMT_REGWORD "x)", SARG1, ARG2); @@ -765,7 +756,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_ (__NR_splice, sys_splice), LINX_ (__NR_sync_file_range, sys_sync_file_range), LINX_ (__NR_tee, sys_tee), - PLAX_ (__NR_vmsplice, sys_vmsplice), + LINXY (__NR_vmsplice, sys_vmsplice), LINX_ (__NR_set_robust_list, sys_set_robust_list), LINXY (__NR_get_robust_list, sys_get_robust_list), LINXY (__NR_epoll_pwait, sys_epoll_pwait), diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index a4da2be9b..17b39a89c 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -628,7 +628,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY (__NR_pselect6, sys_pselect6), LINXY (__NR_ppoll, sys_ppoll), LINXY (__NR_signalfd4, sys_signalfd4), - LINX_ (__NR_vmsplice, sys_vmsplice), + LINXY (__NR_vmsplice, sys_vmsplice), LINX_ (__NR_splice, sys_splice), LINX_ (__NR_tee, sys_tee), LINXY (__NR_readlinkat, sys_readlinkat), diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index d572672f8..c3ab78ef5 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -383,7 +383,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_pselect6, sys_pselect6), /* 72 */ LINXY(__NR_ppoll, sys_ppoll), /* 73 */ LINXY(__NR_signalfd4, sys_signalfd4), /* 74 */ - LINX_(__NR_vmsplice, sys_vmsplice), /* 75 */ + LINXY(__NR_vmsplice, sys_vmsplice), /* 75 */ LINX_(__NR_splice, sys_splice), /* 76 */ LINX_(__NR_tee, sys_tee), /* 77 */ LINXY(__NR_readlinkat, sys_readlinkat), /* 78 */ From 4363549490ecaeaa6c3048beeb8c5edcec33ec06 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 8 Aug 2025 23:46:53 +0200 Subject: [PATCH 167/412] Add several missing syscall hooks to ppc64-linux Specifically: sys_getrlimit sys_mincore sys_tkill sys_unshare sys_splice sys_tee sys_vmsplice sys_fanotify_init sys_fanotify_mark sys_kcmp sys_bpf https://bugs.kde.org/show_bug.cgi?id=508030 --- NEWS | 1 + coregrind/m_syswrap/syswrap-ppc64-linux.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 1b2e3871c..9b4696002 100644 --- a/NEWS +++ b/NEWS @@ -72,6 +72,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD 507897 Allow for patching LTP sources 508029 Review the vmsplice syscall wrapper +508030 Add several missing syscall hooks to ppc64-linux To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 87a4c4db9..bb5cb4f7b 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -691,7 +691,7 @@ static SyscallTableEntry syscall_table[] = { // _____(__NR_sethostname, sys_sethostname), // 74 GENX_(__NR_setrlimit, sys_setrlimit), // 75 -// _____(__NR_getrlimit, sys_getrlimit), // 76 + GENXY(__NR_getrlimit, sys_getrlimit), // 76 GENXY(__NR_getrusage, sys_getrusage), // 77 GENXY(__NR_gettimeofday, sys_gettimeofday), // 78 // _____(__NR_settimeofday, sys_settimeofday), // 79 @@ -847,9 +847,9 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_fcntl64, sys_fcntl64), // 204 !!!!?? 32bit only */ GENX_(__NR_madvise, sys_madvise), // 205 -// _____(__NR_mincore, sys_mincore), // 206 + GENXY(__NR_mincore, sys_mincore), // 206 LINX_(__NR_gettid, sys_gettid), // 207 -// _____(__NR_tkill, sys_tkill), // 208 + LINXY(__NR_tkill, sys_tkill), // 208 LINX_(__NR_setxattr, sys_setxattr), // 209 LINX_(__NR_lsetxattr, sys_lsetxattr), // 210 @@ -934,6 +934,10 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_pselect6, sys_pselect6), // 280 LINXY(__NR_ppoll, sys_ppoll), // 281 + LINX_(__NR_unshare, sys_unshare), // 282 + LINX_(__NR_splice, sys_splice), // 283 + LINX_(__NR_tee, sys_tee), // 284 + LINXY(__NR_vmsplice, sys_vmsplice), // 285 LINXY(__NR_openat, sys_openat), // 286 LINX_(__NR_mkdirat, sys_mkdirat), // 287 @@ -972,6 +976,8 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_preadv, sys_preadv), // 320 LINX_(__NR_pwritev, sys_pwritev), // 321 LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 322 + LINXY(__NR_fanotify_init, sys_fanotify_init), // 323 + LINX_(__NR_fanotify_mark, sys_fanotify_mark), // 324 LINXY(__NR_prlimit64, sys_prlimit64), // 325 LINXY(__NR_socket, sys_socket), // 326 @@ -1001,6 +1007,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 351 LINX_(__NR_process_vm_writev, sys_process_vm_writev),// 352 + LINX_(__NR_kcmp, sys_kcmp), // 354 LINX_(__NR_sched_setattr, sys_sched_setattr), // 355 LINXY(__NR_sched_getattr, sys_sched_getattr), // 356 @@ -1008,6 +1015,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_getrandom, sys_getrandom), // 359 LINXY(__NR_memfd_create, sys_memfd_create), // 360 + LINXY(__NR_bpf, sys_bpf), // 361 LINX_(__NR_execveat, sys_execveat), // 362 From f15d7a7997e6fce003edfce7eaf1a730cd67a4a5 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Mon, 11 Aug 2025 11:17:58 +0200 Subject: [PATCH 168/412] faccessat and faccessat2 should do better checks Do more fine-grained checks within sys_faccessat and sys_faccessat2 syscall wrappers. Allow passing special value of VKI_AT_FDCWD as a file descriptor. Check for valid flags. https://bugs.kde.org/show_bug.cgi?id=507853 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 9b4696002..8d3c33ab2 100644 --- a/NEWS +++ b/NEWS @@ -68,6 +68,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506967 Implement and override mallinfo2 506970 mmap needs an EBADF fd_allowed check 507173 s390x: Crash when constant folding is disabled +507853 faccessat and faccessat2 should handle AT_FDCWD and absolute paths 507868 futimesat doesn't handle AT_FDCWD 507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD 507897 Allow for patching LTP sources diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 1033d2409..ead6d9d59 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -6475,26 +6475,34 @@ PRE(sys_fchmodat2) PRE(sys_faccessat) { FUSE_COMPATIBLE_MAY_BLOCK(); - PRINT("sys_faccessat ( %ld, %#" FMT_REGWORD "x(%s), %ld )", - SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3); + Int arg_1 = (Int) ARG1; + const HChar *path = (const HChar*) ARG2; + Int arg_3 = (Int) ARG3; + PRINT("sys_faccessat ( %d, %#" FMT_REGWORD "x(%s), %d )", + arg_1, ARG2, path, arg_3); PRE_REG_READ3(long, "faccessat", int, dfd, const char *, pathname, int, mode); PRE_MEM_RASCIIZ( "faccessat(pathname)", ARG2 ); - if ( !ML_(fd_allowed)(SARG1, "faccessat", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); - + if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) + if ( arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "faccessat", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_faccessat2) { FUSE_COMPATIBLE_MAY_BLOCK(); - PRINT("sys_faccessat2 ( %ld, %#" FMT_REGWORD "x(%s), %ld, %ld )", - SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3, SARG4); + Int arg_1 = (Int) ARG1; + const HChar *path = (const HChar*) ARG2; + Int arg_3 = (Int) ARG3; + Int arg_4 = (Int) ARG4; + PRINT("sys_faccessat2 ( %d, %#" FMT_REGWORD "x(%s), %d, %d )", + arg_1, ARG2, path, arg_3, arg_4); PRE_REG_READ4(long, "faccessat2", int, dfd, const char *, pathname, int, mode, int, flags); PRE_MEM_RASCIIZ( "faccessat2(pathname)", ARG2 ); - if ( !ML_(fd_allowed)(SARG1, "faccessat2", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); + if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) + if ( arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "faccessat2", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_name_to_handle_at) From 05aa735a5b5bf4312538b440dbc0dd9568358a7d Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 8 Aug 2025 22:31:42 +0200 Subject: [PATCH 169/412] Fix mips32 FTBFS Define __NR_statmount and __NR_listmount. This update makes the source buildable on the mips32 arch. https://bugs.kde.org/show_bug.cgi?id=508027 --- NEWS | 1 + include/vki/vki-scnums-mips32-linux.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 8d3c33ab2..1a0cee4c8 100644 --- a/NEWS +++ b/NEWS @@ -72,6 +72,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 507868 futimesat doesn't handle AT_FDCWD 507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD 507897 Allow for patching LTP sources +508027 Fix mips32 FTBFS 508029 Review the vmsplice syscall wrapper 508030 Add several missing syscall hooks to ppc64-linux diff --git a/include/vki/vki-scnums-mips32-linux.h b/include/vki/vki-scnums-mips32-linux.h index 53f6499aa..62b423395 100644 --- a/include/vki/vki-scnums-mips32-linux.h +++ b/include/vki/vki-scnums-mips32-linux.h @@ -460,6 +460,8 @@ #define __NR_set_mempolicy_home_node (__NR_Linux + 450) #define __NR_cachestat (__NR_Linux + 451) #define __NR_fchmodat2 (__NR_Linux + 452) +#define __NR_statmount (__NR_Linux + 457) +#define __NR_listmount (__NR_Linux + 458) #define __NR_mseal (__NR_Linux + 462) /* * Offset of the last Linux o32 flavoured syscall From a2f8e48b19cb3ae6a2984354f4cadbc23cf631cb Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 11 Aug 2025 18:39:28 +0000 Subject: [PATCH 170/412] Fix VALGRIND_CLO_CHANGE behaviour (BZ 508093) Command line flags that modify variable vex_control did not have the desired effect when processed dynamically via VALGRIND_CLO_CHANGE. The fix is to call the new function LibVEX_set_VexControl in process_dynamic_option. Fixes https://bugs.kde.org/show_bug.cgi?id=508093 --- NEWS | 3 +++ VEX/priv/main_main.c | 5 +++++ VEX/pub/libvex.h | 2 ++ coregrind/m_main.c | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/NEWS b/NEWS index 1a0cee4c8..c754435d2 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux. * ==================== CORE CHANGES =================== +* New VEX API function LibVEX_set_VexControl + * ================== PLATFORM CHANGES ================= * ==================== TOOL CHANGES =================== @@ -75,6 +77,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508027 Fix mips32 FTBFS 508029 Review the vmsplice syscall wrapper 508030 Add several missing syscall hooks to ppc64-linux +508093 VALGRIND_CLO_CHANGE does not update vex_control To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index 0520fd747..619cace2e 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -206,6 +206,11 @@ void LibVEX_default_VexControl ( /*OUT*/ VexControl* vcon ) vcon->regalloc_version = 3; } +void LibVEX_set_VexControl ( VexControl vcon ) +{ + __builtin_memcpy(&vex_control, &vcon, sizeof vex_control); +} + /* Exported to library client. */ diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index de19e1ebf..177969978 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -581,6 +581,8 @@ typedef extern void LibVEX_default_VexControl ( /*OUT*/ VexControl* vcon ); +extern +void LibVEX_set_VexControl ( VexControl ); /*-------------------------------------------------------*/ /*--- Storage management control ---*/ diff --git a/coregrind/m_main.c b/coregrind/m_main.c index f7fd20dba..c94e5e053 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -939,6 +939,10 @@ void VG_(process_dynamic_option) (Clo_Mode mode, HChar *value) struct process_option_state dummy; process_option (mode, value, &dummy); // No need to handle a process_option_state once valgrind has started. + + /* Update vex_control in case VALGRIND_CLO_CHANGE was used to modify a + VexControl member. */ + LibVEX_set_VexControl(VG_(clo_vex_control)); } /* Peer at previously set up VG_(args_for_valgrind) and do some From e1597e1ef5ca0ca5748cd037a57831a1d7c35070 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 12 Aug 2025 21:27:14 +0000 Subject: [PATCH 171/412] iropt-test tweak No need to run random tests for binary IROps with 1-bit wide operands. --- none/tests/iropt-test/binary.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c index 0d40a4da3..896d57630 100644 --- a/none/tests/iropt-test/binary.c +++ b/none/tests/iropt-test/binary.c @@ -72,6 +72,9 @@ run_random_tests(const irop_t *op, test_data_t *data) opnd_t *opnd_l = &data->opnds[0]; opnd_t *opnd_r = &data->opnds[1]; + /* 1-bit wide operands are tested exhaustively. Skip random tests. */ + if (opnd_l->type == Ity_I1 && opnd_r->type == Ity_I1) return; + for (unsigned i = 0; i < num_random_tests; ++i) { opnd_l->value = get_random_value(opnd_l->type); opnd_r->value = get_random_value(opnd_r->type); From 679e7bced9cd4de1651574c34f524818115bcde3 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 12 Aug 2025 21:52:18 +0000 Subject: [PATCH 172/412] New command line flag --vex-iropt-fold-expr Defaults to "yes". Add VexControl::iropt_fold_expr and observe it in fold_Expr_WRK. This flag will be used shortly in the iropt-test program. Users are not expected to use it which is why I'm not announcing it in NEWS. --- VEX/priv/ir_opt.c | 2 ++ VEX/priv/main_globals.c | 2 +- VEX/priv/main_main.c | 1 + VEX/pub/libvex.h | 3 +++ coregrind/m_main.c | 3 +++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index ebea8ba0e..fa2877f6b 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1462,6 +1462,8 @@ static IRExpr* chase1 ( IRExpr** env, IRExpr* e ) __attribute__((noinline)) static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) { + if (UNLIKELY(vex_control.iropt_fold_expr == False)) return e; + Int shift; IRExpr* e2 = e; /* e2 is the result of folding e, if possible */ diff --git a/VEX/priv/main_globals.c b/VEX/priv/main_globals.c index 9167e8131..c0536bea7 100644 --- a/VEX/priv/main_globals.c +++ b/VEX/priv/main_globals.c @@ -57,7 +57,7 @@ Int vex_debuglevel = 0; Int vex_traceflags = 0; /* Max # guest insns per bb */ -VexControl vex_control = { 0,0,VexRegUpd_INVALID,0,0,False,0 }; +VexControl vex_control = { 0,0,VexRegUpd_INVALID,0,0,False,0,False }; diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index 619cace2e..3e64ad7de 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -204,6 +204,7 @@ void LibVEX_default_VexControl ( /*OUT*/ VexControl* vcon ) vcon->guest_max_insns = 60; vcon->guest_chase = True; vcon->regalloc_version = 3; + vcon->iropt_fold_expr = True; } void LibVEX_set_VexControl ( VexControl vcon ) diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index 177969978..da295f85f 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -572,6 +572,9 @@ typedef - '3': current, faster implementation; perhaps producing slightly worse spilling decisions. */ UInt regalloc_version; + /* When false constant folding and algebric simplification is disabled. + This is used in the iropt tester. */ + Bool iropt_fold_expr; } VexControl; diff --git a/coregrind/m_main.c b/coregrind/m_main.c index c94e5e053..87c75d2ac 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -294,6 +294,7 @@ static void usage_NORETURN ( int need_help ) " --vex-iropt-verbosity=<0..9> [0]\n" " --vex-iropt-level=<0..2> [2]\n" " --vex-iropt-unroll-thresh=<0..400> [120]\n" +" --vex-iropt-fold-expr=no|yes [yes]\n" " --vex-guest-max-insns=<1..100> [50]\n" " --vex-guest-chase=no|yes [yes]\n" " Precise exception control. Possible values for 'mode' are as follows\n" @@ -761,6 +762,8 @@ static void process_option (Clo_Mode mode, VG_(clo_vex_control).iropt_level, 0, 2) {} else if VG_BINT_CLO(arg, "--vex-regalloc-version", VG_(clo_vex_control).regalloc_version, 2, 3) {} + else if VG_BOOL_CLOM(cloPD, arg, "--vex-iropt-fold-expr", + VG_(clo_vex_control).iropt_fold_expr) {} else if (VG_STRINDEX_CLO(arg, "--vex-iropt-register-updates", pxStrings, ix) From 49dccafc3b661692de2d14ce14cf807940bd2d8c Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 13 Aug 2025 07:52:21 +0000 Subject: [PATCH 173/412] Fix none/tests/cmdline2 breakage introduced in 679e7bced9 --- none/tests/cmdline2.stdout.exp | 1 + none/tests/cmdline2.stdout.exp-non-linux | 1 + 2 files changed, 2 insertions(+) diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index 618c43acb..2ed4fc02e 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -206,6 +206,7 @@ usage: valgrind [options] prog-and-args --vex-iropt-verbosity=<0..9> [0] --vex-iropt-level=<0..2> [2] --vex-iropt-unroll-thresh=<0..400> [120] + --vex-iropt-fold-expr=no|yes [yes] --vex-guest-max-insns=<1..100> [50] --vex-guest-chase=no|yes [yes] Precise exception control. Possible values for 'mode' are as follows diff --git a/none/tests/cmdline2.stdout.exp-non-linux b/none/tests/cmdline2.stdout.exp-non-linux index 56a92dbf1..19c282b7f 100644 --- a/none/tests/cmdline2.stdout.exp-non-linux +++ b/none/tests/cmdline2.stdout.exp-non-linux @@ -204,6 +204,7 @@ usage: valgrind [options] prog-and-args --vex-iropt-verbosity=<0..9> [0] --vex-iropt-level=<0..2> [2] --vex-iropt-unroll-thresh=<0..400> [120] + --vex-iropt-fold-expr=no|yes [yes] --vex-guest-max-insns=<1..100> [50] --vex-guest-chase=no|yes [yes] Precise exception control. Possible values for 'mode' are as follows From b306e8ef2771b03aad6440268c1940886d045576 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Wed, 13 Aug 2025 09:03:13 +0200 Subject: [PATCH 174/412] PRE(sys_fchownat) not handling VKI_AT_FDCWD Multiple `make ltpchecks` failures seem tp be caused by PRE(sys_fchownat) not handling VKI_AT_FDCWD properly. This specifically impacts aarch64 test results these days. https://bugs.kde.org/show_bug.cgi?id=508154 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index c754435d2..b5f8eeafe 100644 --- a/NEWS +++ b/NEWS @@ -78,6 +78,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508029 Review the vmsplice syscall wrapper 508030 Add several missing syscall hooks to ppc64-linux 508093 VALGRIND_CLO_CHANGE does not update vex_control +508154 PRE(sys_fchownat) not handling VKI_AT_FDCWD To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index ead6d9d59..e6a57e2ad 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -6199,15 +6199,18 @@ PRE(sys_mknodat) PRE(sys_fchownat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*) ARG2; FUSE_COMPATIBLE_MAY_BLOCK(); - PRINT("sys_fchownat ( %ld, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" - FMT_REGWORD "x )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4); + PRINT("sys_fchownat ( %d, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" + FMT_REGWORD "x )", arg_1, ARG2, path, ARG3, ARG4); PRE_REG_READ4(long, "fchownat", int, dfd, const char *, path, vki_uid_t, owner, vki_gid_t, group); PRE_MEM_RASCIIZ( "fchownat(path)", ARG2 ); - if ( !ML_(fd_allowed)(SARG1, "fchownat", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); + if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) + if ( (arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "fchownat", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } PRE(sys_futimesat) From 981db2c7289d4318a6c5a83eedf3607b27377d05 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 14 Aug 2025 15:35:21 +0000 Subject: [PATCH 175/412] s390: Fix code generation for Iop_16Uto32(0x...:I16) Using LHI is wrong as it sign-extends. Use IILF instead. This has been wrong since day #1. Found by iropt-test. --- VEX/priv/host_s390_defs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index 1ee1696b3..c79aa11c0 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -9258,7 +9258,10 @@ s390_widen_emit(UChar *buf, const s390_insn *insn, UInt from_size, case 2: if (insn->size == 4) { /* 16 --> 32 */ - return s390_emit_LHI(buf, r1, value); + if (sign_extend) + return s390_emit_LHI(buf, r1, value); + else + return s390_emit_IILF(buf, r1, value); } if (insn->size == 8) { /* 16 --> 64 */ if (sign_extend) From 78fe3625f6b8ed4de28527d71c4a98d70e5b3035 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 18 Aug 2025 15:30:47 +0200 Subject: [PATCH 176/412] Add ppc64le linux hardwire for ld64.so.2 strcmp When dlopen is used we might end up in an assembly powerpc/strcmp.S variant that is optimized in a way memcheck cannot proof correct. We try to intercept strcmp in ld.so, but might fail when strcmp is called before our interception code is loaded. Having an hardwire for ld.so strcmp (earlier intercept) would solve this. https://bugs.kde.org/show_bug.cgi?id=508145 --- coregrind/m_redir.c | 6 +++++ coregrind/m_trampoline.S | 45 +++++++++++++++++++++++++++++++++ coregrind/pub_core_trampoline.h | 1 + 3 files changed, 52 insertions(+) diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c index 63172b971..857f910cb 100644 --- a/coregrind/m_redir.c +++ b/coregrind/m_redir.c @@ -1508,6 +1508,12 @@ void VG_(redir_initialise) ( void ) NULL /* not mandatory - so why bother at all? */ /* glibc-2.5 (FC6, ppc64) seems fine without it */ ); + + add_hardwired_spec( + "ld64.so.2", "strcmp", + (Addr)&VG_(ppc64_linux_REDIR_FOR_strcmp), + NULL + ); } # elif defined(VGP_arm_linux) diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S index 2c2cc0dc2..af25c8f7a 100644 --- a/coregrind/m_trampoline.S +++ b/coregrind/m_trampoline.S @@ -604,6 +604,51 @@ VG_(ppc64_linux_REDIR_FOR_strchr): .L1end: + /* this function is written using the "dotless" ABI convention */ + .align 2 + .globl VG_(ppc64_linux_REDIR_FOR_strcmp) +#if !defined VGP_ppc64be_linux || _CALL_ELF == 2 + /* Little Endian uses ELF version 2 */ + .type VG_(ppc64_linux_REDIR_FOR_strcmp),@function +VG_(ppc64_linux_REDIR_FOR_strcmp): +#else + /* Big Endian uses ELF version 1 */ + .section ".opd","aw" + .align 3 +VG_(ppc64_linux_REDIR_FOR_strcmp): + .quad .L.VG_(ppc64_linux_REDIR_FOR_strcmp),.TOC.@tocbase,0 + .previous + .size VG_(ppc64_linux_REDIR_FOR_strcmp), \ + .LFE0-.L.VG_(ppc64_linux_REDIR_FOR_strcmp) + .type VG_(ppc64_linux_REDIR_FOR_strcmp), @function + +.L.VG_(ppc64_linux_REDIR_FOR_strcmp): +#endif +#if _CALL_ELF == 2 +0: addis 2,12,.TOC.-0b@ha + addi 2,2,.TOC.-0b@l + .localentry VG_(ppc64_linux_REDIR_FOR_strcmp), .-VG_(ppc64_linux_REDIR_FOR_strcmp) +#endif +.LFB0: + .cfi_startproc + li 10,0 +.L3: + lbzx 8,3,10 + lbzx 9,4,10 + cmpwi 0,8,0 + beq 0,.L2 + cmpw 0,8,9 + addi 10,10,1 + beq 0,.L3 +.L2: + subf 3,9,8 + extsw 3,3 + blr + .long 0 + .byte 0,0,0,0,0,0,0,0 + .cfi_endproc +.LFE0: + .global VG_(trampoline_stuff_end) VG_(trampoline_stuff_end): diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h index 11d791df7..92b4fc67b 100644 --- a/coregrind/pub_core_trampoline.h +++ b/coregrind/pub_core_trampoline.h @@ -97,6 +97,7 @@ extern void* VG_(ppc32_linux_REDIR_FOR_strchr)( void*, Int ); #if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux) extern Addr VG_(ppc64_linux_SUBST_FOR_rt_sigreturn); extern UInt VG_(ppc64_linux_REDIR_FOR_strlen)( void* ); +extern UInt VG_(ppc64_linux_REDIR_FOR_strcmp)( void*, void* ); extern void* VG_(ppc64_linux_REDIR_FOR_strchr)( void*, Int ); /* A label (sans dot) marking the ultra-magical return stub via which all redirected and wrapped functions are made to "return" on From e3820cea9796baea40781374e60cce4efe79384a Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 18 Aug 2025 20:51:09 +0200 Subject: [PATCH 177/412] Bug 507970 - -Wcalloc-transposed-args warnings in valgrind-di-server.c --- NEWS | 1 + auxprogs/valgrind-di-server.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index b5f8eeafe..d5aaee976 100644 --- a/NEWS +++ b/NEWS @@ -74,6 +74,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 507868 futimesat doesn't handle AT_FDCWD 507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD 507897 Allow for patching LTP sources +507970 -Wcalloc-transposed-args warnings in valgrind-di-server.c 508027 Fix mips32 FTBFS 508029 Review the vmsplice syscall wrapper 508030 Add several missing syscall hooks to ppc64-linux diff --git a/auxprogs/valgrind-di-server.c b/auxprogs/valgrind-di-server.c index a7607c069..a16800237 100644 --- a/auxprogs/valgrind-di-server.c +++ b/auxprogs/valgrind-di-server.c @@ -413,10 +413,10 @@ static ULong read_ULong_le ( UChar* src ) static Frame* mk_Frame_asciiz ( const char* tag, const char* str ) { assert(strlen(tag) == 4); - Frame* f = calloc(sizeof(Frame), 1); + Frame* f = calloc(1, sizeof(Frame)); size_t n_str = strlen(str); f->n_data = 4 + n_str + 1; - f->data = calloc(f->n_data, 1); + f->data = calloc(1, f->n_data); memcpy(&f->data[0], tag, 4); memcpy(&f->data[4], str, n_str); assert(f->data[4 + n_str] == 0); @@ -462,9 +462,9 @@ static Bool parse_Frame_asciiz ( Frame* fr, const HChar* tag, static Frame* mk_Frame_le64 ( const HChar* tag, ULong n1 ) { assert(strlen(tag) == 4); - Frame* f = calloc(sizeof(Frame), 1); + Frame* f = calloc(1, sizeof(Frame)); f->n_data = 4 + 1*8; - f->data = calloc(f->n_data, 1); + f->data = calloc(1, f->n_data); memcpy(&f->data[0], tag, 4); write_ULong_le(&f->data[4 + 0*8], n1); return f; @@ -473,9 +473,9 @@ static Frame* mk_Frame_le64 ( const HChar* tag, ULong n1 ) static Frame* mk_Frame_le64_le64 ( const HChar* tag, ULong n1, ULong n2 ) { assert(strlen(tag) == 4); - Frame* f = calloc(sizeof(Frame), 1); + Frame* f = calloc(1, sizeof(Frame)); f->n_data = 4 + 2*8; - f->data = calloc(f->n_data, 1); + f->data = calloc(1, f->n_data); memcpy(&f->data[0], tag, 4); write_ULong_le(&f->data[4 + 0*8], n1); write_ULong_le(&f->data[4 + 1*8], n2); @@ -503,9 +503,9 @@ static Frame* mk_Frame_le64_le64_le64_bytes ( /*OUT*/UChar** data ) { assert(strlen(tag) == 4); - Frame* f = calloc(sizeof(Frame), 1); + Frame* f = calloc(1, sizeof(Frame)); f->n_data = 4 + 3*8 + n_data; - f->data = calloc(f->n_data, 1); + f->data = calloc(1, f->n_data); memcpy(&f->data[0], tag, 4); write_ULong_le(&f->data[4 + 0*8], n1); write_ULong_le(&f->data[4 + 1*8], n2); @@ -706,9 +706,9 @@ static Bool handle_transaction ( int conn_no ) // Reject obviously-insane length fields. if (rd_len > 4*1024*1024) goto fail; assert(req == NULL); - req = calloc(sizeof(Frame), 1); + req = calloc(1, sizeof(Frame)); req->n_data = rd_len; - req->data = calloc(rd_len, 1); + req->data = calloc(1, rd_len); if (rd_len > 0) { Int r = my_read(sd, req->data, req->n_data); if (r != rd_len) goto fail; From 27873587a6e67e37b5692924036d9889b0f044de Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 19 Aug 2025 16:37:50 +0200 Subject: [PATCH 178/412] Bug 507721 - Wire up illumos and Solaris mallinfo --- NEWS | 1 + configure.ac | 10 +++++++++ coregrind/m_mallocfree.c | 2 ++ coregrind/m_replacemalloc/vg_replace_malloc.c | 8 +++---- coregrind/m_scheduler/scheduler.c | 5 ++++- coregrind/pub_core_mallocfree.h | 21 +++++++++++++++++++ coregrind/pub_core_replacemalloc.h | 4 ++++ memcheck/tests/Makefile.am | 7 +++++++ 8 files changed, 52 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index d5aaee976..e2c49a0ff 100644 --- a/NEWS +++ b/NEWS @@ -70,6 +70,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506967 Implement and override mallinfo2 506970 mmap needs an EBADF fd_allowed check 507173 s390x: Crash when constant folding is disabled +507721 Wire up illumos and Solaris mallinfo 507853 faccessat and faccessat2 should handle AT_FDCWD and absolute paths 507868 futimesat doesn't handle AT_FDCWD 507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD diff --git a/configure.ac b/configure.ac index 0d5633fc0..ee623b050 100755 --- a/configure.ac +++ b/configure.ac @@ -4943,6 +4943,12 @@ AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([rt], [clock_gettime]) AC_CHECK_LIB([rt], [timer_delete]) +if test "$VGCONF_OS" = "solaris" ; then +# for mallinfo +saved_LDFLAGS="$LDFLAGS" +LDFLAGS="$saved_LDFLAGS -lmalloc" +fi + AC_CHECK_FUNCS([ \ aligned_alloc \ clock_gettime\ @@ -5013,6 +5019,10 @@ AC_CHECK_FUNCS([ \ exterrctl ]) +if test "$VGCONF_OS" = "solaris" ; then +LDFLAGS="$saved_LDFLAGS" +fi + # AC_CHECK_LIB adds any library found to the variable LIBS, and links these # libraries with any shared object and/or executable. This is NOT what we # want for e.g. vgpreload_core-x86-linux.so diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index e7c80af71..a84bbeb3a 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -2433,6 +2433,7 @@ void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi ) mi->keepcost = 0; // may want some value in here } +#if defined(VGO_linux) // The aforementioned older function, mallinfo(), is deprecated since the type // used for the fields is too small. void VG_(mallinfo2) ( ThreadId tid, struct vg_mallinfo2* mi ) @@ -2467,6 +2468,7 @@ void VG_(mallinfo2) ( ThreadId tid, struct vg_mallinfo2* mi ) mi->fordblks = free_blocks_size + VG_(free_queue_volume); mi->keepcost = 0; // may want some value in here } +#endif SizeT VG_(arena_redzone_size) ( ArenaId aid ) { diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 808096152..02134d672 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -2518,8 +2518,9 @@ static void panic(const char *str) MALLINFO(VG_Z_LIBC_SONAME, mallinfo); MALLINFO(SO_SYN_MALLOC, mallinfo); -#elif defined(VGO_darwin) - //MALLINFO(VG_Z_LIBC_SONAME, mallinfo); +#elif defined(VGO_solaris) + MALLINFO(VG_Z_LIBC_SONAME, mallinfo); + MALLINFO(SO_SYN_MALLOC, mallinfo); #endif @@ -2545,9 +2546,6 @@ static void panic(const char *str) MALLINFO2(VG_Z_LIBC_SONAME, mallinfo2); MALLINFO2(SO_SYN_MALLOC, mallinfo2); -#elif defined(VGO_darwin) - //MALLINFO2(VG_Z_LIBC_SONAME, mallinfo2); - #endif diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index 1e77944cd..4862f2506 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -2145,9 +2145,12 @@ void do_client_request ( ThreadId tid ) info->tl___builtin_vec_delete = VG_(tdict).tool___builtin_vec_delete; info->tl___builtin_vec_delete_aligned = VG_(tdict).tool___builtin_vec_delete_aligned; info->tl_malloc_usable_size = VG_(tdict).tool_malloc_usable_size; - +#if defined(VGO_linux) || defined(VGO_solaris) info->mallinfo = VG_(mallinfo); +#endif +#if defined(VGO_linux) info->mallinfo2 = VG_(mallinfo2); +#endif info->clo_trace_malloc = VG_(clo_trace_malloc); info->clo_realloc_zero_bytes_frees = VG_(clo_realloc_zero_bytes_frees); diff --git a/coregrind/pub_core_mallocfree.h b/coregrind/pub_core_mallocfree.h index 3ae9eb486..1ab3a9f08 100644 --- a/coregrind/pub_core_mallocfree.h +++ b/coregrind/pub_core_mallocfree.h @@ -91,6 +91,7 @@ typedef Int ArenaId; # error Unknown platform #endif +#if defined(VGO_linux) /* This struct definition MUST match the system one. */ /* SVID2/XPG mallinfo structure */ struct vg_mallinfo { @@ -120,6 +121,22 @@ struct vg_mallinfo2 { SizeT fordblks; /* total non-inuse space */ SizeT keepcost; /* top-most, releasable (via malloc_trim) space */ }; +#elif defined(VGO_solaris) + +struct vg_mallinfo { + unsigned long arena; /* total space in arena */ + unsigned long ordblks; /* number of ordinary blocks */ + unsigned long smblks; /* number of small blocks */ + unsigned long hblks; /* number of holding blocks */ + unsigned long hblkhd; /* space in holding block headers */ + unsigned long usmblks; /* space in small blocks in use */ + unsigned long fsmblks; /* space in free small blocks */ + unsigned long uordblks; /* space in ordinary blocks in use */ + unsigned long fordblks; /* space in free ordinary blocks */ + unsigned long keepcost; /* cost of enabling keep option */ +}; + +#endif extern void* VG_(arena_malloc) ( ArenaId arena, const HChar* cc, SizeT nbytes ); extern void VG_(arena_free) ( ArenaId arena, void* ptr ); @@ -146,8 +163,12 @@ extern SizeT VG_(arena_malloc_usable_size) ( ArenaId aid, void* payload ); extern SizeT VG_(arena_redzone_size) ( ArenaId aid ); +#if defined(VGO_linux) || defined(VGO_solaris) extern void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi ); +#endif +#if defined(VGO_linux) extern void VG_(mallinfo2) ( ThreadId tid, struct vg_mallinfo2* mi ); +#endif // VG_(arena_perm_malloc) is for permanent allocation of small blocks. // See VG_(perm_malloc) in pub_tool_mallocfree.h for more details. diff --git a/coregrind/pub_core_replacemalloc.h b/coregrind/pub_core_replacemalloc.h index 4f9c5bb1a..0c81e7c55 100644 --- a/coregrind/pub_core_replacemalloc.h +++ b/coregrind/pub_core_replacemalloc.h @@ -53,8 +53,12 @@ struct vg_mallocfunc_info { void (*tl___builtin_vec_delete_aligned)(ThreadId tid, void* p, SizeT n); void* (*tl_realloc) (ThreadId tid, void* p, SizeT size); SizeT (*tl_malloc_usable_size) (ThreadId tid, void* payload); +#if defined(VGO_linux) || defined(VGO_solaris) void (*mallinfo) (ThreadId tid, struct vg_mallinfo* mi); +#endif +#if defined(VGO_linux) void (*mallinfo2) (ThreadId tid, struct vg_mallinfo2* mi); +#endif Bool clo_trace_malloc; Bool clo_realloc_zero_bytes_frees; }; diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 91d58b48b..349cdaf15 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -684,9 +684,16 @@ bug472219_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ calloc_overflow_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ malloc_usable_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@ mallinfo_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations +if VGCONF_OS_IS_SOLARIS +mallinfo_LDADD = -lmalloc +endif mallinfo2_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ sbfragment_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations +if VGCONF_OS_IS_SOLARIS +sbfragment_LDADD = -lmalloc +endif + strchr_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ big_debuginfo_symbol_SOURCES = big_debuginfo_symbol.cpp From 7c63587b7f6a2cdbd073d92c0a45f197ed993e0a Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 19 Aug 2025 21:11:25 +0000 Subject: [PATCH 179/412] s390: Fix code generation for Iop_MullS8/16 and Iop_MullU8/16 Multiplication is performed using 4-byte values. There were two bugs: (1) Iop_MullS8/16 operands weren't sign-extended (2) No shifting and OR'ing required to access the result. r11[32:63] has it. Found by iropt-test. --- VEX/priv/host_s390_isel.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c index 2b075c930..ecce74d78 100644 --- a/VEX/priv/host_s390_isel.c +++ b/VEX/priv/host_s390_isel.c @@ -1254,7 +1254,17 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr) goto do_multiply; case Iop_MullS8: + arg1 = IRExpr_Unop(Iop_8Sto32, arg1); + arg2 = IRExpr_Unop(Iop_8Sto32, arg2); + is_signed_multiply = True; + goto do_multiply; + case Iop_MullS16: + arg1 = IRExpr_Unop(Iop_16Sto32, arg1); + arg2 = IRExpr_Unop(Iop_16Sto32, arg2); + is_signed_multiply = True; + goto do_multiply; + case Iop_MullS32: is_signed_multiply = True; goto do_multiply; @@ -1278,9 +1288,16 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr) /* Multiply */ addInstr(env, s390_insn_mul(arg_size, r10, r11, op2, is_signed_multiply)); + res = newVRegI(env); + if (arg_size == 1 || arg_size == 2) { + /* For 8-bit and 16-bit multiplication the result is in + r11[32:63] */ + addInstr(env, s390_insn_move(size, res, r11)); + return res; + } + /* The result is in registers r10 and r11. Combine them into a SIZE-bit value into the destination register. */ - res = newVRegI(env); addInstr(env, s390_insn_move(arg_size, res, r10)); value = s390_opnd_imm(arg_size * 8); addInstr(env, s390_insn_alu(size, S390_ALU_LSH, res, value)); From e3f078d8470ce8c08e97c4a34092616896dfcd9f Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 19 Aug 2025 21:24:54 +0000 Subject: [PATCH 180/412] s390: Support Iop_ExpCmpNE8 and Iop_ExpCmpNE16. Easy as pie and fewer special cases for iropt-test. --- VEX/priv/host_s390_isel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c index ecce74d78..499c28b87 100644 --- a/VEX/priv/host_s390_isel.c +++ b/VEX/priv/host_s390_isel.c @@ -3638,12 +3638,14 @@ s390_isel_cc(ISelEnv *env, IRExpr *cond) case Iop_CmpNE8: case Iop_CasCmpNE8: + case Iop_ExpCmpNE8: op = S390_ZERO_EXTEND_8; result = S390_CC_NE; goto do_compare_ze; case Iop_CmpEQ16: case Iop_CasCmpEQ16: + case Iop_ExpCmpNE16: op = S390_ZERO_EXTEND_16; result = S390_CC_E; goto do_compare_ze; From cd643b0c5e7647b038f2c7c3c48447698e653789 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 19 Aug 2025 21:54:35 +0000 Subject: [PATCH 181/412] s390: Support Iop_Mul8/16/32/64. Easy as pie and fewer special cases for iropt-test. --- VEX/priv/host_s390_isel.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c index 499c28b87..99e2e7a52 100644 --- a/VEX/priv/host_s390_isel.c +++ b/VEX/priv/host_s390_isel.c @@ -1243,10 +1243,17 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr) s390_opnd_RMI op2, value, opnd; s390_insn *insn; Bool is_commutative, is_signed_multiply, is_signed_divide; + Bool is_single_multiply = False; is_commutative = True; switch (expr->Iex.Binop.op) { + case Iop_Mul8: + case Iop_Mul16: + case Iop_Mul32: + case Iop_Mul64: + is_single_multiply = True; + /* fall through */ case Iop_MullU8: case Iop_MullU16: case Iop_MullU32: @@ -1271,7 +1278,7 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr) do_multiply: { HReg r10, r11; - UInt arg_size = size / 2; + UInt arg_size = is_single_multiply ? size : size / 2; order_commutative_operands(arg1, arg2); @@ -1296,6 +1303,12 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr) return res; } + /* For Iop_Mul64 the result is in r11[0:63] */ + if (expr->Iex.Binop.op == Iop_Mul64) { + addInstr(env, s390_insn_move(size, res, r11)); + return res; + } + /* The result is in registers r10 and r11. Combine them into a SIZE-bit value into the destination register. */ addInstr(env, s390_insn_move(arg_size, res, r10)); From 5e6d3d6ce41a124999ef76518689a0e4384a92c4 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 20 Aug 2025 07:11:11 +0200 Subject: [PATCH 182/412] FreeBSD: fix build after adding mallinfo support for illumos --- coregrind/m_mallocfree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index a84bbeb3a..a42b1e737 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -2372,6 +2372,7 @@ SizeT VG_(arena_malloc_usable_size) ( ArenaId aid, void* ptr ) return get_pszB(a, b); } +#if defined(VGO_linux) || defined(VGO_solaris) // Implementation of mallinfo(). There is no recent standard that defines // the behavior of mallinfo(). The meaning of the fields in struct mallinfo @@ -2432,6 +2433,7 @@ void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi ) mi->fordblks = free_blocks_size + VG_(free_queue_volume); mi->keepcost = 0; // may want some value in here } +#endif #if defined(VGO_linux) // The aforementioned older function, mallinfo(), is deprecated since the type From 957d7350cf28cc3ff177c13e45ed23c51cb53f10 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 20 Aug 2025 11:21:36 +0000 Subject: [PATCH 183/412] s390: Fix handling of Iop_ExpCmpNE16 Bug was introduced by yours truly in e3f078d847. --- VEX/priv/host_s390_isel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c index 99e2e7a52..c4e9ee764 100644 --- a/VEX/priv/host_s390_isel.c +++ b/VEX/priv/host_s390_isel.c @@ -3658,13 +3658,13 @@ s390_isel_cc(ISelEnv *env, IRExpr *cond) case Iop_CmpEQ16: case Iop_CasCmpEQ16: - case Iop_ExpCmpNE16: op = S390_ZERO_EXTEND_16; result = S390_CC_E; goto do_compare_ze; case Iop_CmpNE16: case Iop_CasCmpNE16: + case Iop_ExpCmpNE16: op = S390_ZERO_EXTEND_16; result = S390_CC_NE; goto do_compare_ze; From 55007723f3b03a1ce4edf1803d270e30e34af5d9 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 20 Aug 2025 20:22:37 +0200 Subject: [PATCH 184/412] FreeBSD regtest: fix a minor typo --- none/tests/freebsd/open_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/none/tests/freebsd/open_client.cpp b/none/tests/freebsd/open_client.cpp index 454c0a3dc..54fb63b0e 100644 --- a/none/tests/freebsd/open_client.cpp +++ b/none/tests/freebsd/open_client.cpp @@ -49,7 +49,7 @@ int main(int argc, char** argv) int dotdot; if ((dotdot = open("..", O_DIRECTORY | O_RDONLY)) == -1) { - throw std::runtime_error("failed to open ,."); + throw std::runtime_error("failed to open .."); } else { From 40c8447eb91026e4dddbbd58de7364b82cad3b20 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 20 Aug 2025 20:40:07 +0200 Subject: [PATCH 185/412] FreeBSD regtest: add a test for readlinkat --- .gitignore | 1 + none/tests/freebsd/Makefile.am | 8 +++- none/tests/freebsd/readlinkat.cpp | 56 ++++++++++++++++++++++++ none/tests/freebsd/readlinkat.stderr.exp | 0 none/tests/freebsd/readlinkat.vgtest | 4 ++ 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 none/tests/freebsd/readlinkat.cpp create mode 100644 none/tests/freebsd/readlinkat.stderr.exp create mode 100644 none/tests/freebsd/readlinkat.vgtest diff --git a/.gitignore b/.gitignore index e48a2ab0e..569a8fd5c 100644 --- a/.gitignore +++ b/.gitignore @@ -2329,6 +2329,7 @@ /none/tests/freebsd/bug498317 none/tests/freebsd/bug499212 /none/tests/freebsd/osrel +/none/tests/freebsd/readlinkat /none/tests/freebsd/swapcontext /none/tests/freebsd/fexecve /none/tests/freebsd/hello_world diff --git a/none/tests/freebsd/Makefile.am b/none/tests/freebsd/Makefile.am index 0bbbffdad..a575f4097 100644 --- a/none/tests/freebsd/Makefile.am +++ b/none/tests/freebsd/Makefile.am @@ -55,6 +55,8 @@ EXTRA_DIST = \ ksh_test.stdout.exp \ open_client.vgtest \ open_client.stderr.exp \ + readlinkat.vgtest \ + readlinkat.stderr.exp \ sanity_level_thread.vgtest \ sanity_level_thread.stderr.exp \ swapcontext.vgtest \ @@ -71,8 +73,9 @@ EXTRA_DIST = \ usrstack.stdout.exp check_PROGRAMS = \ - auxv bug452274 bug498317 bug499212 fexecve hello_world open_client osrel \ - proc_pid_file sanity_level_thread swapcontext umtx_shm_creat usrstack + auxv bug452274 bug498317 bug499212 fexecve hello_world open_client \ + osrel proc_pid_file readlinkat sanity_level_thread swapcontext \ + umtx_shm_creat usrstack AM_CFLAGS += $(AM_FLAG_M3264_PRI) AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) @@ -84,6 +87,7 @@ swapcontext_CFLAGS = ${AM_CFLAGS} hello_world_SOURCES = hello_world.cpp open_client_SOURCES = open_client.cpp proc_pid_file_SOURCES = proc_pid_file.cpp +readlinkat_SOURCES = readlinkat.cpp sanity_level_thread_SOURCES = sanity_level_thread.cpp sanity_level_thread_LDFLAGS = ${AM_LDFLAGS} -pthread diff --git a/none/tests/freebsd/readlinkat.cpp b/none/tests/freebsd/readlinkat.cpp new file mode 100644 index 000000000..8b33a8b63 --- /dev/null +++ b/none/tests/freebsd/readlinkat.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +#include +#include +#include + +int main() +{ + char path[MAXPATHLEN]; + char linkedPath[MAXPATHLEN]; + char currentDirectory[MAXPATHLEN]; + char parentDirectory[MAXPATHLEN]; + + getcwd(currentDirectory, MAXPATHLEN); + + ssize_t res = readlinkat(AT_FDCWD, "readlinkat_link.cpp", linkedPath, MAXPATHLEN); + if (res == -1) + { + std::cerr << "Error: readlinkat test 1 failed\n"; + } + if (!strcmp(linkedPath, "readlink.cpp")) + { + std::cerr << "Error: readlinkat test 1 unexpected resolved path - " << linkedPath << '\n'; + } + + int dotdot; + if ((dotdot = open("..", O_DIRECTORY | O_RDONLY)) == -1) + { + throw std::runtime_error("failed to open ."); + } + else + { + res = readlinkat(dotdot, "freebsd/readlinkat_link.cpp", linkedPath, MAXPATHLEN); + if (res == -1) + { + std::cerr << "Error: readlinkat test 2 failed\n"; + } + if (!strcmp(linkedPath, "readlink.cpp")) + { + std::cerr << "Error: readlinkat test 2 unexpected resolved path - " << linkedPath << '\n'; + } + } + close(dotdot); + + chdir(".."); + res = readlinkat(AT_FDCWD, "freebsd/readlinkat_link.cpp", linkedPath, MAXPATHLEN); + if (res == -1) + { + std::cerr << "Error: readlinkat test 3 failed\n"; + } + if (!strcmp(linkedPath, "readlink.cpp")) + { + std::cerr << "Error: readlinkat test 3 unexpected resolved path - " << linkedPath << '\n'; + } +} diff --git a/none/tests/freebsd/readlinkat.stderr.exp b/none/tests/freebsd/readlinkat.stderr.exp new file mode 100644 index 000000000..e69de29bb diff --git a/none/tests/freebsd/readlinkat.vgtest b/none/tests/freebsd/readlinkat.vgtest new file mode 100644 index 000000000..4942f8ca9 --- /dev/null +++ b/none/tests/freebsd/readlinkat.vgtest @@ -0,0 +1,4 @@ +prereq: rm -f readlinkat_link.cpp && ln -s readlinkat.cpp readlinkat_link.cpp +prog: readlinkat +vgopts: -q +post: rm -f readlinkat_link.cpp From a411cd675ddece58abb814212b227077a4e35a7d Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 20 Aug 2025 22:22:51 +0200 Subject: [PATCH 186/412] FreeBSD regtest: add an absolute path test to readlinkat test --- none/tests/freebsd/readlinkat.cpp | 32 ++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/none/tests/freebsd/readlinkat.cpp b/none/tests/freebsd/readlinkat.cpp index 8b33a8b63..25c142f4d 100644 --- a/none/tests/freebsd/readlinkat.cpp +++ b/none/tests/freebsd/readlinkat.cpp @@ -7,21 +7,24 @@ int main() { - char path[MAXPATHLEN]; char linkedPath[MAXPATHLEN]; char currentDirectory[MAXPATHLEN]; - char parentDirectory[MAXPATHLEN]; getcwd(currentDirectory, MAXPATHLEN); + std::string absolutePath{currentDirectory}; + absolutePath += "/readlinkat_link.cpp"; ssize_t res = readlinkat(AT_FDCWD, "readlinkat_link.cpp", linkedPath, MAXPATHLEN); if (res == -1) { std::cerr << "Error: readlinkat test 1 failed\n"; } - if (!strcmp(linkedPath, "readlink.cpp")) + else { - std::cerr << "Error: readlinkat test 1 unexpected resolved path - " << linkedPath << '\n'; + if (!strcmp(linkedPath, "readlink.cpp")) + { + std::cerr << "Error: readlinkat test 1 unexpected resolved path - " << linkedPath << '\n'; + } } int dotdot; @@ -32,13 +35,16 @@ int main() else { res = readlinkat(dotdot, "freebsd/readlinkat_link.cpp", linkedPath, MAXPATHLEN); - if (res == -1) + if (res == -1) { std::cerr << "Error: readlinkat test 2 failed\n"; } - if (!strcmp(linkedPath, "readlink.cpp")) + else { - std::cerr << "Error: readlinkat test 2 unexpected resolved path - " << linkedPath << '\n'; + if (!strcmp(linkedPath, "readlink.cpp")) + { + std::cerr << "Error: readlinkat test 2 unexpected resolved path - " << linkedPath << '\n'; + } } } close(dotdot); @@ -53,4 +59,16 @@ int main() { std::cerr << "Error: readlinkat test 3 unexpected resolved path - " << linkedPath << '\n'; } + + int uninit; + res = readlinkat(uninit, absolutePath.c_str(), linkedPath, MAXPATHLEN); + if (res == -1) + { + std::cerr << "Error: readlinkat test 4 failed\n"; + } + if (!strcmp(linkedPath, "readlink.cpp")) + { + std::cerr << "Error: readlinkat test 4 unexpected resolved path - " << linkedPath << '\n'; + } + } From acfcc69db73e1ded855441037ad52674f8ad7288 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 21 Aug 2025 08:44:04 +0200 Subject: [PATCH 187/412] FreeeBSD readme: add a section on Capsicum mode --- README.freebsd | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/README.freebsd b/README.freebsd index 799543fe3..ef850513e 100644 --- a/README.freebsd +++ b/README.freebsd @@ -186,6 +186,50 @@ git history. You can also look at https://docs.freebsd.org/en/books/porters-handbook/versions/ +Capsicum enabled applications +----------------------------- +Valgrind will not work well with Capsicum enabled applications. As an example, +if you run + +valgrind --tool=massif echo hello + +you will get something like this in the output: + +==66088== +==66088== WARNING: Valgrind may not operate correctly in capability mode. +==66088== Please consider disabling capability by using the RUNNING_ON_VALGRIND mechanism. +==66088== See http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq +hello +==66088== +==66088== Error: can not open xtree output file `/home/paulf/massif.out.66088' + +Additionally capabilities mode can affect how the kernel uses syscall +parameters. An example of this is the fd argument of the *at() syscall +family. In capability mode fd must not be AT_FDCWD. The consequence +of this is that we ought do adapt the syscall parameter checking depending +on whether the guest is running in capability mode or not. Since we do not +recommend running Capsicum enabled applications under Valgrind the checks +are not adapted to to capability mode. Not to mention that adding checks +for this would add a lot of complexity to these syscall wrappers + +One way that you might conditionally disable capabilities in your code as the +above warning suggests is to do as follows. + +#if !defined(NDEBUG) +#include +#endif + +void do_capsicum_setup(void); // contains capabilities code + +#if !defined(NDEBUG) + if (!RUNNING_ON_VALGRIND) + { +#endif + do_capsicum_setup(); +#if !defined(NDEBUG) + } +#endif + Feedback ~~~~~~~~ From 08eee2a7062704a51448d58284f54c86740be91f Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 21 Aug 2025 10:14:08 +0000 Subject: [PATCH 188/412] iropt-test: Fix executable name for secondary platform. --- none/tests/iropt-test/iropt-test-sec.vgtest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/none/tests/iropt-test/iropt-test-sec.vgtest b/none/tests/iropt-test/iropt-test-sec.vgtest index 38ada4655..82da4ab07 100644 --- a/none/tests/iropt-test/iropt-test-sec.vgtest +++ b/none/tests/iropt-test/iropt-test-sec.vgtest @@ -1,4 +1,4 @@ -prog: iropt-test +prog: iropt-test-sec prereq: test -x iropt-test-sec #args: -v -v -r10 args: -r100 From 4532e0dc98bd88cc6267b07849b95b16c511bca4 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 21 Aug 2025 12:06:39 +0000 Subject: [PATCH 189/412] vbit-test: Remove preprocessor atrocity to determine endianess. Use new function host_is_big_endian instead. --- memcheck/tests/vbit-test/util.c | 23 ++----------- memcheck/tests/vbit-test/vbits.c | 59 +++++++++++--------------------- memcheck/tests/vbit-test/vtest.h | 4 +++ 3 files changed, 26 insertions(+), 60 deletions(-) diff --git a/memcheck/tests/vbit-test/util.c b/memcheck/tests/vbit-test/util.c index 3e57cfa70..48869c12b 100644 --- a/memcheck/tests/vbit-test/util.c +++ b/memcheck/tests/vbit-test/util.c @@ -25,25 +25,6 @@ #include // fprintf #include // exit #include // assert -#if defined(__APPLE__) -#include -#define __BYTE_ORDER BYTE_ORDER -#define __LITTLE_ENDIAN LITTLE_ENDIAN -#elif defined(__sun) -#define __LITTLE_ENDIAN 1234 -#define __BIG_ENDIAN 4321 -# if defined(_LITTLE_ENDIAN) -# define __BYTE_ORDER __LITTLE_ENDIAN -# else -# define __BYTE_ORDER __BIG_ENDIAN -# endif -#elif defined(__linux__) -#include -#else -#define __BYTE_ORDER BYTE_ORDER -#define __LITTLE_ENDIAN LITTLE_ENDIAN -#include -#endif #include #include "vtest.h" @@ -92,7 +73,7 @@ print_value(FILE *fp, value_t val, unsigned num_bits) case 32: fprintf(fp, "%08x", val.u32); break; case 64: fprintf(fp, "%016"PRIx64, val.u64); break; case 128: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { fprintf(fp, "%016"PRIx64, val.u128[1]); fprintf(fp, "%016"PRIx64, val.u128[0]); } else { @@ -101,7 +82,7 @@ print_value(FILE *fp, value_t val, unsigned num_bits) } break; case 256: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { fprintf(fp, "%016"PRIx64, val.u256[3]); fprintf(fp, "%016"PRIx64, val.u256[2]); fprintf(fp, "%016"PRIx64, val.u256[1]); diff --git a/memcheck/tests/vbit-test/vbits.c b/memcheck/tests/vbit-test/vbits.c index ca4bc72bd..88247cde1 100644 --- a/memcheck/tests/vbit-test/vbits.c +++ b/memcheck/tests/vbit-test/vbits.c @@ -24,25 +24,6 @@ #include // fprintf #include // assert -#if defined(__APPLE__) -#include -#define __BYTE_ORDER BYTE_ORDER -#define __LITTLE_ENDIAN LITTLE_ENDIAN -#elif defined(__sun) -#define __LITTLE_ENDIAN 1234 -#define __BIG_ENDIAN 4321 -# if defined(_LITTLE_ENDIAN) -# define __BYTE_ORDER __LITTLE_ENDIAN -# else -# define __BYTE_ORDER __BIG_ENDIAN -# endif -#elif defined(__linux__) -#include -#else -#include -#define __BYTE_ORDER BYTE_ORDER -#define __LITTLE_ENDIAN LITTLE_ENDIAN -#endif #include #include "vbits.h" #include "vtest.h" @@ -79,7 +60,7 @@ print_vbits(FILE *fp, vbits_t v) case 32: fprintf(fp, "%08x", v.bits.u32); break; case 64: fprintf(fp, "%016"PRIx64, v.bits.u64); break; case 128: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { fprintf(fp, "%016"PRIx64, v.bits.u128[1]); fprintf(fp, "%016"PRIx64, v.bits.u128[0]); } else { @@ -88,7 +69,7 @@ print_vbits(FILE *fp, vbits_t v) } break; case 256: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { fprintf(fp, "%016"PRIx64, v.bits.u256[3]); fprintf(fp, "%016"PRIx64, v.bits.u256[2]); fprintf(fp, "%016"PRIx64, v.bits.u256[1]); @@ -340,7 +321,7 @@ undefined_vbits_Narrow256_AtoB(unsigned int src_num_bits, } } } - if (__BYTE_ORDER == __LITTLE_ENDIAN) + if (! host_is_big_endian()) new.bits.u128[1] = new_value; else /* Big endian, swap the upper and lower 32-bits of new_value */ @@ -396,7 +377,7 @@ undefined_vbits_Narrow256_AtoB(unsigned int src_num_bits, } } } - if (__BYTE_ORDER == __LITTLE_ENDIAN) + if (! host_is_big_endian()) new.bits.u128[0] = new_value; else /* Big endian, swap the upper and lower 32-bits of new_value */ @@ -472,12 +453,12 @@ truncate_vbits(vbits_t v, unsigned num_bits) if (v.num_bits <= 64) bits = get_bits64(v); else if (v.num_bits == 128) - if (__BYTE_ORDER == __LITTLE_ENDIAN) + if (! host_is_big_endian()) bits = v.bits.u128[0]; else bits = v.bits.u128[1]; else if (v.num_bits == 256) - if (__BYTE_ORDER == __LITTLE_ENDIAN) + if (! host_is_big_endian()) bits = v.bits.u256[0]; else bits = v.bits.u256[3]; @@ -499,7 +480,7 @@ truncate_vbits(vbits_t v, unsigned num_bits) if (num_bits == 128) { assert(v.num_bits == 256); /* From 256 bits to 128 */ - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { new.bits.u128[0] = v.bits.u256[0]; new.bits.u128[1] = v.bits.u256[1]; } else { @@ -539,7 +520,7 @@ left_vbits(vbits_t v, unsigned num_bits) case 32: new.bits.u32 = bits & ~0u; break; case 64: new.bits.u64 = bits & ~0ll; break; case 128: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { new.bits.u128[0] = bits; if (bits & (1ull << 63)) { // MSB is set new.bits.u128[1] = ~0ull; @@ -556,7 +537,7 @@ left_vbits(vbits_t v, unsigned num_bits) } break; case 256: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { new.bits.u256[0] = bits; if (bits & (1ull << 63)) { // MSB is set new.bits.u256[1] = ~0ull; @@ -587,7 +568,7 @@ left_vbits(vbits_t v, unsigned num_bits) } if (v.num_bits == 128) { - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { if (v.bits.u128[1] != 0) { new.bits.u128[0] = v.bits.u128[0]; new.bits.u128[1] = left64(v.bits.u128[1]); @@ -616,7 +597,7 @@ left_vbits(vbits_t v, unsigned num_bits) assert(num_bits == 256); - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { uint64_t b1 = new.bits.u128[1]; uint64_t b0 = new.bits.u128[0]; @@ -725,7 +706,7 @@ concat_vbits(vbits_t v1, vbits_t v2) case 32: new.bits.u64 = v1.bits.u32; new.bits.u64 = (new.bits.u64 << 32) | v2.bits.u32; break; case 64: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { new.bits.u128[0] = v2.bits.u64; new.bits.u128[1] = v1.bits.u64; } else { @@ -734,7 +715,7 @@ concat_vbits(vbits_t v1, vbits_t v2) } break; case 128: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { new.bits.u256[0] = v2.bits.u128[0]; new.bits.u256[1] = v2.bits.u128[1]; new.bits.u256[2] = v1.bits.u128[0]; @@ -765,13 +746,13 @@ upper_vbits(vbits_t v) case 32: new.bits.u16 = v.bits.u32 >> 16; break; case 64: new.bits.u32 = v.bits.u64 >> 32; break; case 128: - if (__BYTE_ORDER == __LITTLE_ENDIAN) + if (! host_is_big_endian()) new.bits.u64 = v.bits.u128[1]; else new.bits.u64 = v.bits.u128[0]; break; case 256: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { new.bits.u128[0] = v.bits.u256[2]; new.bits.u128[1] = v.bits.u256[3]; } else { @@ -806,7 +787,7 @@ zextend_vbits(vbits_t v, unsigned num_bits) case 32: new.bits.u32 = bits; break; case 64: new.bits.u64 = bits; break; case 128: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { new.bits.u128[0] = bits; new.bits.u128[1] = 0; } else { @@ -815,7 +796,7 @@ zextend_vbits(vbits_t v, unsigned num_bits) } break; case 256: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { new.bits.u256[0] = bits; new.bits.u256[1] = 0; new.bits.u256[2] = 0; @@ -836,7 +817,7 @@ zextend_vbits(vbits_t v, unsigned num_bits) if (v.num_bits == 128) { assert(num_bits == 256); - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { new.bits.u256[0] = v.bits.u128[0]; new.bits.u256[1] = v.bits.u128[1]; new.bits.u256[2] = 0; @@ -892,7 +873,7 @@ onehot_vbits(unsigned bitno, unsigned num_bits) case 32: new.bits.u32 = 1u << bitno; break; case 64: new.bits.u64 = 1ull << bitno; break; case 128: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { if (bitno < 64) { new.bits.u128[0] = 1ull << bitno; new.bits.u128[1] = 0; @@ -911,7 +892,7 @@ onehot_vbits(unsigned bitno, unsigned num_bits) } break; case 256: - if (__BYTE_ORDER == __LITTLE_ENDIAN) { + if (! host_is_big_endian()) { if (bitno < 64) { new.bits.u256[0] = 1ull << bitno; new.bits.u256[1] = 0; diff --git a/memcheck/tests/vbit-test/vtest.h b/memcheck/tests/vbit-test/vtest.h index 5f2b2e03f..16f7bf43f 100644 --- a/memcheck/tests/vbit-test/vtest.h +++ b/memcheck/tests/vbit-test/vtest.h @@ -250,6 +250,10 @@ static __inline__ unsigned bitsof_irtype(IRType type) return type == Ity_I1 ? 1 : sizeof_irtype(type) * 8; } +static __inline__ int host_is_big_endian(void) +{ + return ((*(UShort *)(&(UInt){ 0x11223344 })) == 0x1122); +} /* Exported variables */ extern int verbose; From 3d3a4a6a3509452721bb39dc337553e32c2636cb Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 21 Aug 2025 21:31:58 +0000 Subject: [PATCH 190/412] iropt-test: Fix an unwanted integer wrap-around. --- none/tests/iropt-test/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/none/tests/iropt-test/util.c b/none/tests/iropt-test/util.c index f34936611..4ce30e2a5 100644 --- a/none/tests/iropt-test/util.c +++ b/none/tests/iropt-test/util.c @@ -114,7 +114,7 @@ get_selected_values(IRType type, unsigned *num_val) static const uint64_t values_64bit[] = { 0, 1, 2, UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1, UINT16_MAX - 1, UINT16_MAX, UINT16_MAX + 1, - UINT32_MAX - 1, UINT32_MAX, UINT32_MAX + 1, + UINT32_MAX - 1, UINT32_MAX, (uint64_t)UINT32_MAX + 1, UINT64_MAX - 1, UINT64_MAX }; switch (type) { From 3e8790f5af6b4d7f0daf3d40c2abbae990f29d3e Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 22 Aug 2025 08:58:08 +0200 Subject: [PATCH 191/412] FreeBSD regtest: update kenv test so that it builds with GCC Was missing the memory header for std::make_unique, and GCC doesn't like using smart pointers with cout so use get(). --- memcheck/tests/freebsd/kenv.cpp | 5 +++-- memcheck/tests/freebsd/kenv.stderr.exp | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/memcheck/tests/freebsd/kenv.cpp b/memcheck/tests/freebsd/kenv.cpp index ed8216185..0217ad32a 100644 --- a/memcheck/tests/freebsd/kenv.cpp +++ b/memcheck/tests/freebsd/kenv.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -26,7 +27,7 @@ int main(int argc, char** argv) if (argc > 1) { - std::cout << buf << '\n'; + std::cout << buf.get() << '\n'; } res = kenv(42*42, name.c_str(), buf.get(), bufSize); @@ -69,7 +70,7 @@ int main(int argc, char** argv) if (argc > 1) { // the buffer contains nul separated eleements, this will just print the first - std::cout << dump_buf << '\n'; + std::cout << dump_buf.get() << '\n'; } if (0 == geteuid()) diff --git a/memcheck/tests/freebsd/kenv.stderr.exp b/memcheck/tests/freebsd/kenv.stderr.exp index faf3ccc8a..fc6b63868 100644 --- a/memcheck/tests/freebsd/kenv.stderr.exp +++ b/memcheck/tests/freebsd/kenv.stderr.exp @@ -2,46 +2,46 @@ Warning: bad or unimplemented kenv action: 1764 Syscall param kenv(action) contains uninitialised byte(s) at 0x........: kenv (in /...libc...) - by 0x........: main (kenv.cpp:110) + by 0x........: main (kenv.cpp:111) Syscall param kenv(name) contains uninitialised byte(s) at 0x........: kenv (in /...libc...) - by 0x........: main (kenv.cpp:110) + by 0x........: main (kenv.cpp:111) Syscall param kenv(value) contains uninitialised byte(s) at 0x........: kenv (in /...libc...) - by 0x........: main (kenv.cpp:110) + by 0x........: main (kenv.cpp:111) Syscall param kenv(len) contains uninitialised byte(s) at 0x........: kenv (in /...libc...) - by 0x........: main (kenv.cpp:110) + by 0x........: main (kenv.cpp:111) Syscall param kenv(name) points to unaddressable byte(s) at 0x........: kenv (in /...libc...) - by 0x........: main (kenv.cpp:116) + by 0x........: main (kenv.cpp:117) Address 0x........ is 0 bytes inside a block of size 32 free'd at 0x........: ...operator delete[]... (vg_replace_malloc.c:...) - by 0x........: main (kenv.cpp:115) + by 0x........: main (kenv.cpp:116) Block was alloc'd at at 0x........: ...operator new[]... (vg_replace_malloc.c:...) - by 0x........: main (kenv.cpp:113) + by 0x........: main (kenv.cpp:114) Syscall param kenv(value) points to unaddressable byte(s) at 0x........: kenv (in /...libc...) - by 0x........: main (kenv.cpp:119) + by 0x........: main (kenv.cpp:120) Address 0x........ is 0 bytes inside a block of size 32 free'd at 0x........: ...operator delete[]... (vg_replace_malloc.c:...) - by 0x........: main (kenv.cpp:118) + by 0x........: main (kenv.cpp:119) Block was alloc'd at at 0x........: ...operator new[]... (vg_replace_malloc.c:...) - by 0x........: main (kenv.cpp:117) + by 0x........: main (kenv.cpp:118) Syscall param kenv(value) points to unaddressable byte(s) at 0x........: kenv (in /...libc...) - by 0x........: main (kenv.cpp:120) + by 0x........: main (kenv.cpp:121) Address 0x........ is 0 bytes after a block of size 1,024 alloc'd at 0x........: ...operator new[]... (vg_replace_malloc.c:...) - by 0x........: main (kenv.cpp:18) + by 0x........: main (kenv.cpp:19) HEAP SUMMARY: From 25b9956679338c2150a7ea089be53e1f6a6f3150 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 22 Aug 2025 17:48:23 +0000 Subject: [PATCH 192/412] iropt-test: Run tests with and without constant folding. That way we can check whether the result of constant folding matches the value computed by the insn sequence that is generated to implement a specific IROp. Bugs were found for all architectures. s390 has been fixed. The other architectures are currently disabled. - irops.tab modified to enable only those IROps that are actually implemented for a given architecture. Architectures considered here are amd64, x86, ppc32, ppc64be/le - IRICB_iropt_payload amended to store both the folded and unfolded result - In valgrind_execute_test call IR injection twice: with and without constant folding enabled (--vex-iropt-fold-expr=yes/no) --- VEX/priv/ir_inject.c | 26 ++--- VEX/pub/libvex.h | 3 +- none/tests/iropt-test/irops.tab | 191 ++++++++++++++++++------------- none/tests/iropt-test/main.c | 76 +++++++++++- none/tests/iropt-test/valgrind.c | 64 ++++++++--- none/tests/iropt-test/vtest.h | 4 +- 6 files changed, 253 insertions(+), 111 deletions(-) diff --git a/VEX/priv/ir_inject.c b/VEX/priv/ir_inject.c index 750bb588d..04228538f 100644 --- a/VEX/priv/ir_inject.c +++ b/VEX/priv/ir_inject.c @@ -31,6 +31,7 @@ #include "libvex_ir.h" #include "libvex.h" #include "main_util.h" +#include "main_globals.h" // vex_control /* Convenience macros for readibility */ #define mkU1(v) IRExpr_Const(IRConst_U1(v)) @@ -364,31 +365,28 @@ vex_inject_ir_iropt(IRSB *irsb, IREndness endian) vpanic("unsupported operator"); } + if (! vex_control.iropt_fold_expr) { + store(irsb, endian, iricb.result_nofold, expr); + return; + } + /* Make sure the expression gets folded ! */ IRExpr *env[1] = { 0 }; IRExpr *res = foldIRExpr(env, expr); +// vex_printf("FOLDED RESULT "); ppIRExpr(res); vex_printf("\n"); + if (res->tag != Iex_Const) { vex_printf("*** "); ppIROp(iricb.op); vex_printf(": not folded: result = "); ppIRExpr(res); vex_printf("\n"); - *(ULong *)iricb.result = 0; // whatever - return; - } - - /* Store the folded result in the IRICB. We're only handling integers - up to 64-bit wide. */ - switch (iricb.t_result) { - case Ity_I1: *(ULong *)iricb.result = res->Iex.Const.con->Ico.U1; break; - case Ity_I8: *(ULong *)iricb.result = res->Iex.Const.con->Ico.U8; break; - case Ity_I16: *(ULong *)iricb.result = res->Iex.Const.con->Ico.U16; break; - case Ity_I32: *(ULong *)iricb.result = res->Iex.Const.con->Ico.U32; break; - case Ity_I64: *(ULong *)iricb.result = res->Iex.Const.con->Ico.U64; break; - default: - vpanic("unsupported type"); +// *(ULong *)iricb.result_fold = 0; // whatever +// return; + res = mkU32(0); // whatever } + store(irsb, endian, iricb.result_fold, res); } diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index da295f85f..e580160d3 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -1001,7 +1001,8 @@ typedef typedef struct { IROp op; // the operation to perform - HWord result; // address of the result + HWord result_fold; // address of the result (with folding) + HWord result_nofold; // address of the result (without folding) HWord opnd1; // address of 1st operand HWord opnd2; // address of 2nd operand IRType t_result; // type of result diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index f2ffd007c..c65ff4cfb 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -24,6 +24,35 @@ #define OPNAME(op) #op, Iop_##op +#define A(x) ARCH_##x + +#define ARCH_ppc32 0x0001 +#define ARCH_ppc64be 0x0002 +#define ARCH_ppc64le 0x0004 +#define ARCH_ppc64 (ARCH_ppc64be | ARCH_ppc64le) +#define ARCH_ppc (ARCH_ppc32 | ARCH_ppc64) +#define ARCH_amd64 0x0008 +#define ARCH_x86 0x0010 +#define ARCH_s390 0x0020 +#define ARCH_ALL 0x003F // OR of all above + +/* FIXME: Add support for mips, arm, and riscv. + When doing so ARCH_ALL needs to be adjusted */ +#if 0 +#define ARCH_mips32 0x0040 +#define ARCH_mips64 0x0080 +#define ARCH_mips (mips32 | mips64) +#define ARCH_nanomips 0x0100 +#define ARCH_arm 0x0200 +#define ARCH_arm64 0x0400 +#define ARCH_riscv64 0x0800 +#endif + +#define ONLY(x) .enabled_arch = A(x) +#define ONLY2(x1,x2) .enabled_arch = A(x1) | A(x2) +#define EXCEPT(x) .enabled_arch = ARCH_ALL & ~A(x) +#define EXCEPT2(x1,x2) .enabled_arch = ARCH_ALL & ~(A(x1) | A(x2)) + /* Definition of IROps: - no IROps having floating point operands or result - no IROPs having vector operands or results (V128, V256) @@ -39,7 +68,8 @@ { OPNAME(1Uto8), Ity_I8, 1, Ity_I1, }, // { OPNAME(1Uto16), Ity_I16, 1, Ity_I1, }, // missing in libvex_ir.h { OPNAME(1Uto32), Ity_I32, 1, Ity_I1, }, - { OPNAME(1Uto64), Ity_I64, 1, Ity_I1, }, + { OPNAME(1Uto64), Ity_I64, 1, Ity_I1, EXCEPT2(ppc32,x86) }, + { OPNAME(1Sto8), Ity_I8, 1, Ity_I1, }, { OPNAME(1Sto16), Ity_I16, 1, Ity_I1, }, { OPNAME(1Sto32), Ity_I32, 1, Ity_I1, }, @@ -47,15 +77,16 @@ { OPNAME(8Uto16), Ity_I16, 1, Ity_I8, }, { OPNAME(8Uto32), Ity_I32, 1, Ity_I8, }, - { OPNAME(8Uto64), Ity_I64, 1, Ity_I8, }, + { OPNAME(8Uto64), Ity_I64, 1, Ity_I8, EXCEPT2(ppc32, x86) }, + { OPNAME(8Sto16), Ity_I16, 1, Ity_I8, }, { OPNAME(8Sto32), Ity_I32, 1, Ity_I8, }, - { OPNAME(8Sto64), Ity_I64, 1, Ity_I8, }, + { OPNAME(8Sto64), Ity_I64, 1, Ity_I8, EXCEPT2(ppc32, x86) }, { OPNAME(16Uto32), Ity_I32, 1, Ity_I16, }, - { OPNAME(16Uto64), Ity_I64, 1, Ity_I16, }, + { OPNAME(16Uto64), Ity_I64, 1, Ity_I16, EXCEPT(ppc32) }, { OPNAME(16Sto32), Ity_I32, 1, Ity_I16, }, - { OPNAME(16Sto64), Ity_I64, 1, Ity_I16, }, + { OPNAME(16Sto64), Ity_I64, 1, Ity_I16, EXCEPT2(ppc32, x86) }, { OPNAME(32Uto64), Ity_I64, 1, Ity_I32, }, { OPNAME(32Sto64), Ity_I64, 1, Ity_I32, }, @@ -70,19 +101,20 @@ { OPNAME(32to16), Ity_I16, 1, Ity_I32, }, { OPNAME(32HIto16), Ity_I16, 1, Ity_I32, }, - { OPNAME(64to1), Ity_I1, 1, Ity_I64, }, - { OPNAME(64to8), Ity_I8, 1, Ity_I64, }, - { OPNAME(64to16), Ity_I16, 1, Ity_I64, }, + { OPNAME(64to1), Ity_I1, 1, Ity_I64, EXCEPT2(ppc32, x86) }, + { OPNAME(64to8), Ity_I8, 1, Ity_I64, EXCEPT2(ppc32, x86) }, + { OPNAME(64to16), Ity_I16, 1, Ity_I64, EXCEPT2(ppc32, x86) }, + { OPNAME(64to32), Ity_I32, 1, Ity_I64, }, { OPNAME(64HIto32), Ity_I32, 1, Ity_I64, }, // { OPNAME(128to64), Ity_I64, 1, Ity_I128, }, // 128 bit // { OPNAME(128HIto64), Ity_I64, 1, Ity_I128, }, // 128 bit - { OPNAME(CmpNEZ8), Ity_I1, 1, Ity_I8 }, - { OPNAME(CmpNEZ16), Ity_I1, 1, Ity_I16 }, - { OPNAME(CmpNEZ32), Ity_I1, 1, Ity_I32 }, - { OPNAME(CmpNEZ64), Ity_I1, 1, Ity_I64 }, + { OPNAME(CmpNEZ8), Ity_I1, 1, Ity_I8, }, + { OPNAME(CmpNEZ16), Ity_I1, 1, Ity_I16, EXCEPT(ppc) }, + { OPNAME(CmpNEZ32), Ity_I1, 1, Ity_I32, }, + { OPNAME(CmpNEZ64), Ity_I1, 1, Ity_I64, }, { OPNAME(CmpwNEZ32), Ity_I32, 1, Ity_I32 }, { OPNAME(CmpwNEZ64), Ity_I64, 1, Ity_I64 }, @@ -98,16 +130,14 @@ // { OPNAME(Ctz32), Ity_I32, 1, Ity_I32 }, // deprecated, undefined behaviour // { OPNAME(Ctz64), Ity_I64, 1, Ity_I64 }, // deprecated, undefined behaviour - { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32 }, - { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64 }, - - { OPNAME(CtzNat32), Ity_I32, 1, Ity_I32 }, - { OPNAME(CtzNat64), Ity_I64, 1, Ity_I64 }, - - { OPNAME(PopCount32), Ity_I32, 1, Ity_I32 }, - { OPNAME(PopCount64), Ity_I64, 1, Ity_I64 }, + { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32, ONLY2(ppc, x86) }, + { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64, EXCEPT2(ppc32, x86) }, + { OPNAME(CtzNat32), Ity_I32, 1, Ity_I32, ONLY2(ppc, x86) }, + { OPNAME(CtzNat64), Ity_I64, 1, Ity_I64, ONLY2(ppc64, amd64) }, + { OPNAME(PopCount32), Ity_I32, 1, Ity_I32, ONLY(ppc) }, + { OPNAME(PopCount64), Ity_I64, 1, Ity_I64, ONLY(ppc64) }, // BINARY { OPNAME(Add8), Ity_I8, 2, Ity_I8, Ity_I8 }, @@ -118,37 +148,37 @@ { OPNAME(Sub8), Ity_I8, 2, Ity_I8, Ity_I8 }, { OPNAME(Sub16), Ity_I16, 2, Ity_I16, Ity_I16 }, { OPNAME(Sub32), Ity_I32, 2, Ity_I32, Ity_I32 }, - { OPNAME(Sub64), Ity_I64, 2, Ity_I64, Ity_I64 }, + { OPNAME(Sub64), Ity_I64, 2, Ity_I64, Ity_I64, EXCEPT(ppc32) }, - { OPNAME(Mul8), Ity_I8, 2, Ity_I8, Ity_I8 }, - { OPNAME(Mul16), Ity_I16, 2, Ity_I16, Ity_I16 }, - { OPNAME(Mul32), Ity_I32, 2, Ity_I32, Ity_I32 }, - { OPNAME(Mul64), Ity_I64, 2, Ity_I64, Ity_I64 }, + { OPNAME(Mul8), Ity_I8, 2, Ity_I8, Ity_I8, ONLY(s390) }, + { OPNAME(Mul16), Ity_I16, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, + { OPNAME(Mul32), Ity_I32, 2, Ity_I32, Ity_I32, }, + { OPNAME(Mul64), Ity_I64, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, x86) }, - { OPNAME(MullU8), Ity_I16, 2, Ity_I8, Ity_I8 }, - { OPNAME(MullU16), Ity_I32, 2, Ity_I16, Ity_I16 }, - { OPNAME(MullU32), Ity_I64, 2, Ity_I32, Ity_I32 }, -// { OPNAME(MullU64), Ity_I128, 2, Ity_I64, Ity_I64 }, // 128 bit + { OPNAME(MullU8), Ity_I16, 2, Ity_I8, Ity_I8, EXCEPT(ppc) }, + { OPNAME(MullU16), Ity_I32, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, + { OPNAME(MullU32), Ity_I64, 2, Ity_I32, Ity_I32, }, +// { OPNAME(MullU64), Ity_I128, 2, Ity_I64, Ity_I64, }, // 128 bit - { OPNAME(MullS8), Ity_I16, 2, Ity_I8, Ity_I8 }, - { OPNAME(MullS16), Ity_I32, 2, Ity_I16, Ity_I16 }, - { OPNAME(MullS32), Ity_I64, 2, Ity_I32, Ity_I32 }, -// { OPNAME(MullS64), Ity_I128, 2, Ity_I64, Ity_I64 }, // 128 bit + { OPNAME(MullS8), Ity_I16, 2, Ity_I8, Ity_I8, EXCEPT(ppc) }, + { OPNAME(MullS16), Ity_I32, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, + { OPNAME(MullS32), Ity_I64, 2, Ity_I32, Ity_I32, }, +// { OPNAME(MullS64), Ity_I128, 2, Ity_I64, Ity_I64, }, // 128 bit - { OPNAME(DivU32), Ity_I32, 2, Ity_I32, Ity_I32 }, - { OPNAME(DivU64), Ity_I64, 2, Ity_I64, Ity_I64 }, + { OPNAME(DivU32), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) }, + { OPNAME(DivU64), Ity_I64, 2, Ity_I64, Ity_I64, ONLY(ppc64) }, // { OPNAME(DivU128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit - { OPNAME(DivS32), Ity_I32, 2, Ity_I32, Ity_I32 }, - { OPNAME(DivS64), Ity_I64, 2, Ity_I64, Ity_I64 }, + { OPNAME(DivS32), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) }, + { OPNAME(DivS64), Ity_I64, 2, Ity_I64, Ity_I64, ONLY(ppc64) }, // { OPNAME(DivS128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit - { OPNAME(DivU32E), Ity_I32, 2, Ity_I32, Ity_I32 }, -// { OPNAME(DivU64E), Ity_I64, 2, Ity_I64, Ity_I64 }, // 128 bit + { OPNAME(DivU32E), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) }, +// { OPNAME(DivU64E), Ity_I64, 2, Ity_I64, Ity_I64, }, // 128 bit // { OPNAME(DivU128E), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit - { OPNAME(DivS32E), Ity_I32, 2, Ity_I32, Ity_I32 }, -// { OPNAME(DivS64E), Ity_I32, 2, Ity_I32, Ity_I32 }, // 128 bit + { OPNAME(DivS32E), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) }, +// { OPNAME(DivS64E), Ity_I32, 2, Ity_I32, Ity_I32, }, // 128 bit // { OPNAME(DivS128E), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit // { OPNAME(DivModU32to32), Ity_I64, 2, Ity_I32, Ity_I64 }, // no folding yet @@ -167,17 +197,17 @@ { OPNAME(Shl8), Ity_I8, 2, Ity_I8, Ity_I8 }, { OPNAME(Shl16), Ity_I16, 2, Ity_I16, Ity_I8 }, { OPNAME(Shl32), Ity_I32, 2, Ity_I32, Ity_I8 }, - { OPNAME(Shl64), Ity_I64, 2, Ity_I64, Ity_I8 }, + { OPNAME(Shl64), Ity_I64, 2, Ity_I64, Ity_I8, EXCEPT(ppc32) }, { OPNAME(Shr8), Ity_I8, 2, Ity_I8, Ity_I8 }, { OPNAME(Shr16), Ity_I16, 2, Ity_I16, Ity_I8 }, { OPNAME(Shr32), Ity_I32, 2, Ity_I32, Ity_I8 }, - { OPNAME(Shr64), Ity_I64, 2, Ity_I64, Ity_I8 }, + { OPNAME(Shr64), Ity_I64, 2, Ity_I64, Ity_I8, EXCEPT(ppc32) }, { OPNAME(Sar8), Ity_I8, 2, Ity_I8, Ity_I8 }, { OPNAME(Sar16), Ity_I16, 2, Ity_I16, Ity_I8 }, { OPNAME(Sar32), Ity_I32, 2, Ity_I32, Ity_I8 }, - { OPNAME(Sar64), Ity_I64, 2, Ity_I64, Ity_I8 }, + { OPNAME(Sar64), Ity_I64, 2, Ity_I64, Ity_I8, EXCEPT(ppc32) }, { OPNAME(Or1), Ity_I1, 2, Ity_I1, Ity_I1 }, { OPNAME(Or8), Ity_I8, 2, Ity_I8, Ity_I8 }, @@ -197,52 +227,51 @@ { OPNAME(Xor32), Ity_I32, 2, Ity_I32, Ity_I32 }, { OPNAME(Xor64), Ity_I64, 2, Ity_I64, Ity_I64 }, - { OPNAME(CmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8 }, - { OPNAME(CmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16 }, - { OPNAME(CmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32 }, - { OPNAME(CmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64 }, - - { OPNAME(CmpNE8), Ity_I1, 2, Ity_I8, Ity_I8 }, - { OPNAME(CmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, - { OPNAME(CmpNE32), Ity_I1, 2, Ity_I32, Ity_I32 }, - { OPNAME(CmpNE64), Ity_I1, 2, Ity_I64, Ity_I64 }, + { OPNAME(CmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT(ppc) }, + { OPNAME(CmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, + { OPNAME(CmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32, }, + { OPNAME(CmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT(ppc32) }, - { OPNAME(CmpLT32U), Ity_I1, 2, Ity_I32, Ity_I32 }, - { OPNAME(CmpLT64U), Ity_I1, 2, Ity_I64, Ity_I64 }, + { OPNAME(CmpNE8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT(ppc) }, + { OPNAME(CmpNE16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, + { OPNAME(CmpNE32), Ity_I1, 2, Ity_I32, Ity_I32, }, + { OPNAME(CmpNE64), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT(ppc32) }, - { OPNAME(CmpLT32S), Ity_I1, 2, Ity_I32, Ity_I32 }, - { OPNAME(CmpLT64S), Ity_I1, 2, Ity_I64, Ity_I64 }, + { OPNAME(CmpLT32U), Ity_I1, 2, Ity_I32, Ity_I32, }, + { OPNAME(CmpLT64U), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, x86) }, - { OPNAME(CmpLE32U), Ity_I1, 2, Ity_I32, Ity_I32 }, - { OPNAME(CmpLE64U), Ity_I1, 2, Ity_I64, Ity_I64 }, + { OPNAME(CmpLT32S), Ity_I1, 2, Ity_I32, Ity_I32, }, + { OPNAME(CmpLT64S), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, x86) }, - { OPNAME(CmpLE32S), Ity_I1, 2, Ity_I32, Ity_I32 }, - { OPNAME(CmpLE64S), Ity_I1, 2, Ity_I64, Ity_I64 }, + { OPNAME(CmpLE32U), Ity_I1, 2, Ity_I32, Ity_I32, }, + { OPNAME(CmpLE64U), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, x86) }, - { OPNAME(CasCmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8 }, - { OPNAME(CasCmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16 }, - { OPNAME(CasCmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32 }, - { OPNAME(CasCmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64 }, + { OPNAME(CmpLE32S), Ity_I1, 2, Ity_I32, Ity_I32, }, + { OPNAME(CmpLE64S), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, x86) }, - { OPNAME(CasCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8 }, - { OPNAME(CasCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, - { OPNAME(CasCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32 }, - { OPNAME(CasCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64 }, + { OPNAME(CasCmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT(ppc) }, + { OPNAME(CasCmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, + { OPNAME(CasCmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32, EXCEPT(ppc) }, + { OPNAME(CasCmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64, ONLY2(s390, amd64) }, - { OPNAME(ExpCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8 }, - { OPNAME(ExpCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16 }, - { OPNAME(ExpCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32 }, - { OPNAME(ExpCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64 }, + { OPNAME(CasCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT(ppc) }, + { OPNAME(CasCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, + { OPNAME(CasCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32, EXCEPT(ppc) }, + { OPNAME(CasCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64, ONLY2(s390, amd64) }, - { OPNAME(CmpORD32U), Ity_I32, 2, Ity_I32, Ity_I32 }, - { OPNAME(CmpORD64U), Ity_I64, 2, Ity_I64, Ity_I64 }, + { OPNAME(ExpCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8, ONLY(s390) }, + { OPNAME(ExpCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16, ONLY2(s390, x86) }, + { OPNAME(ExpCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32, EXCEPT(ppc) }, + { OPNAME(ExpCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64, ONLY2(s390, amd64) }, - { OPNAME(CmpORD32S), Ity_I32, 2, Ity_I32, Ity_I32 }, - { OPNAME(CmpORD64S), Ity_I64, 2, Ity_I64, Ity_I64 }, + { OPNAME(CmpORD32U), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) }, + { OPNAME(CmpORD32S), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) }, + { OPNAME(CmpORD64U), Ity_I64, 2, Ity_I64, Ity_I64, ONLY(ppc64) }, + { OPNAME(CmpORD64S), Ity_I64, 2, Ity_I64, Ity_I64, ONLY(ppc64) }, { OPNAME(Max32U), Ity_I32, 2, Ity_I32, Ity_I32 }, - { OPNAME(8HLto16), Ity_I16, 2, Ity_I8, Ity_I8 }, - { OPNAME(16HLto32), Ity_I32, 2, Ity_I16, Ity_I16 }, - { OPNAME(32HLto64), Ity_I64, 2, Ity_I32, Ity_I32 }, -// { OPNAME(64HLto128), Ity_I128, 2, Ity_I64, Ity_I64 }, // 128 bit + { OPNAME(8HLto16), Ity_I16, 2, Ity_I8, Ity_I8, EXCEPT(ppc) }, + { OPNAME(16HLto32), Ity_I32, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, + { OPNAME(32HLto64), Ity_I64, 2, Ity_I32, Ity_I32, }, +// { OPNAME(64HLto128), Ity_I128, 2, Ity_I64, Ity_I64, }, // 128 bit diff --git a/none/tests/iropt-test/main.c b/none/tests/iropt-test/main.c index 8fcf9fb45..29bc1c71f 100644 --- a/none/tests/iropt-test/main.c +++ b/none/tests/iropt-test/main.c @@ -36,6 +36,7 @@ static irop_t irops[] = { static void check_irops_table(void); static test_data_t *new_test_data(const irop_t *); +static int is_enabled(const irop_t *); int verbose = 0; unsigned num_random_tests; @@ -44,6 +45,10 @@ unsigned num_random_tests; int main(int argc, char *argv[]) { +// FIXME: temporarily until ppc,amd64,x86 have been fixed +#if !defined(__s390x__) + return 0; +#endif assert(sizeof(long long) == 8); srand48(42L); @@ -76,6 +81,8 @@ main(int argc, char *argv[]) for (unsigned i = 0; i < NUM_EL(irops); ++i) { const irop_t *op = irops +i; + if (! is_enabled(op)) continue; + if (verbose) printf("Testing operator %s\n", op->name); @@ -130,7 +137,8 @@ new_test_data(const irop_t *op) memset(data, 0x0, sizeof *data); // initialise - data->result.type = op->result_type; + data->result_fold.type = op->result_type; + data->result_nofold.type = op->result_type; data->opnds[0].type = op->opnd1_type; if (op->num_opnds > 1) @@ -138,3 +146,69 @@ new_test_data(const irop_t *op) return data; } + + +static int +is_enabled(const irop_t *op) +{ + /* For convenience of specification in irops.tab a zero value + means that the IROp is implemented. */ + if (op->enabled_arch == 0) return 1; + +#ifdef __x86_64__ + return op->enabled_arch & ARCH_amd64; +#endif +#ifdef __i386__ + return op->enabled_arch & ARCH_x86; +#endif +#ifdef __s390x__ + return op->enabled_arch & ARCH_s390; +#endif +#ifdef __powerpc__ /* defined for both 32-bit and 64-bit */ +#define MIN_POWER_ISA "../../../tests/min_power_isa" + int rc; + + switch (op->op) { + case Iop_DivS64E: + case Iop_DivU64E: + case Iop_DivU32E: + case Iop_DivS32E: + /* IROps require a processor that supports ISA 2.06 (Power 7) + or newer */ + rc = system(MIN_POWER_ISA " 2.06 ") / 256; + break; + + case Iop_DivU128: + case Iop_DivS128: + case Iop_DivU128E: + case Iop_DivS128E: + case Iop_ModU128: + case Iop_ModS128: + /* IROps require a processor that supports ISA 3.10 (Power 10) + or newer */ + rc = system(MIN_POWER_ISA " 3.1 ") / 256; + break; + + default: + rc = 0; + break; + } + + /* MIN_POWER_ISA returns 0 if the underlying HW supports the specified + ISA or newer. Returns 1 if the HW does not support the specified ISA. + Returns 2 on error. */ + switch (rc) { + case 0: +#ifdef __powerpc64__ + return op->enabled_arch & ARCH_ppc64; +#endif + return op->enabled_arch & ARCH_ppc32; + case 1: + return 0; + default: + panic("min_power_isa() return code is invalid.\n"); + } +#endif + + return 0; +} diff --git a/none/tests/iropt-test/valgrind.c b/none/tests/iropt-test/valgrind.c index 004c8a09a..d6ac5f222 100644 --- a/none/tests/iropt-test/valgrind.c +++ b/none/tests/iropt-test/valgrind.c @@ -26,6 +26,8 @@ #include "valgrind.h" // VALGRIND_VEX_INJECT_IR #include "vtest.h" +#define host_is_big_endian() ((*(short *)(&(int){ 0x11223344 })) == 0x1122) + static IRICB iricb; /* Return a completely initialised control block */ @@ -37,10 +39,11 @@ new_iricb(const irop_t *op, test_data_t *data) memset(&cb, 0x0, sizeof cb); cb.op = op->op; - cb.result = (HWord)&data->result.value; + cb.result_fold = (HWord)&data->result_fold.value; + cb.result_nofold = (HWord)&data->result_nofold.value; cb.opnd1 = (HWord)&data->opnds[0].value; cb.opnd2 = (HWord)&data->opnds[1].value; - cb.t_result = data->result.type; + cb.t_result = data->result_fold.type; cb.t_opnd1 = data->opnds[0].type; cb.t_opnd2 = data->opnds[1].type; @@ -80,39 +83,74 @@ valgrind_execute_test(const irop_t *op, test_data_t *data, uint64_t expected) for (unsigned i = 0; i < op->num_opnds; ++i) { const opnd_t *opnd = data->opnds + i; - printf("opnd %u: value = ", i); + printf("opnd %u: value = ", i); print_value(stdout, opnd->value, bitsof_irtype(opnd->type)); printf("\n"); } } + VALGRIND_CLO_CHANGE("--vex-iropt-fold-expr=yes"); + valgrind_vex_inject_ir(); + VALGRIND_CLO_CHANGE("--vex-iropt-fold-expr=no"); valgrind_vex_inject_ir(); - uint64_t result = data->result.value; - unsigned num_result_bits = bitsof_irtype(data->result.type); + uint64_t result_fold = data->result_fold.value; + uint64_t result_nofold = data->result_nofold.value; + unsigned num_result_bits = bitsof_irtype(data->result_fold.type); + +// printf("NOFOLD RESULT = %016lx\n", result_nofold); + + if (host_is_big_endian()) { + switch (num_result_bits) { + case 8: + result_fold >>= 56; + result_nofold >>= 56; + break; + case 16: + result_fold >>= 48; + result_nofold >>= 48; + break; + case 1: /* See comment in vbit-test/vbits.h */ + case 32: + result_fold >>= 32; + result_nofold >>= 32; + break; + case 64: + break; + default: + panic("%s: #bits = %u not handled\n", __func__, num_result_bits); + } + } + if (verbose > 1) { - printf("result: value = "); - print_value(stdout, result, num_result_bits); + printf("result fold: value = "); + print_value(stdout, result_fold, num_result_bits); + printf("\n"); + printf("result nofold: value = "); + print_value(stdout, result_nofold, num_result_bits); printf("\n"); - printf("expected: value = "); + printf("expected: value = "); print_value(stdout, expected, num_result_bits); printf("\n"); } /* Check result */ - if (result != expected) { + if (result_fold != result_nofold || result_fold != expected) { fprintf(stderr, "*** Incorrect result for operator %s\n", op->name); for (unsigned i = 0; i < op->num_opnds; ++i) { const opnd_t *opnd = data->opnds + i; - fprintf(stderr, " opnd %u: ", i); + fprintf(stderr, " opnd %u: ", i); print_value(stderr, opnd->value, bitsof_irtype(opnd->type)); fprintf(stderr, "\n"); } - fprintf(stderr, " result: "); - print_value(stderr, result, num_result_bits); + fprintf(stderr, " result fold: "); + print_value(stderr, result_fold, num_result_bits); + fprintf(stderr, "\n"); + fprintf(stderr, " result nofold: "); + print_value(stderr, result_nofold, num_result_bits); fprintf(stderr, "\n"); - fprintf(stderr, " expect: "); + fprintf(stderr, " result expected: "); print_value(stderr, expected, num_result_bits); fprintf(stderr, "\n"); } diff --git a/none/tests/iropt-test/vtest.h b/none/tests/iropt-test/vtest.h index f31f3c3ce..cee5ddacb 100644 --- a/none/tests/iropt-test/vtest.h +++ b/none/tests/iropt-test/vtest.h @@ -39,6 +39,7 @@ typedef struct { unsigned num_opnds; IRType opnd1_type; IRType opnd2_type; + unsigned enabled_arch; } irop_t; @@ -55,7 +56,8 @@ typedef struct { /* Carries the data needed to execute and evaluate a test. I.e. inputs and result. */ typedef struct { - opnd_t result; + opnd_t result_fold; + opnd_t result_nofold; opnd_t opnds[MAX_OPERANDS]; } test_data_t; From b1f204f636746be3a9042cc3eb8355d51dfb051b Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 23 Aug 2025 12:42:24 +0200 Subject: [PATCH 193/412] FreeBSD syscalls: fd handling (part 1) For Bug 507720 - Review syscalls returning file descriptors (other platforms) Some more recording of fd opens and closes Lots of checks for the directory fd of *at() syscalls Fixed a few bugs in pdfork and pdkill (and updated the testcase). Updated a few message strings. Started improving readlinkat - needs more work. --- coregrind/m_syswrap/syswrap-freebsd.c | 292 +++++++++++++----- coregrind/m_syswrap/syswrap-linux.c | 1 + memcheck/tests/freebsd/pdfork_pdkill.c | 6 + .../tests/freebsd/pdfork_pdkill.stderr.exp | 16 +- memcheck/tests/freebsd/scalar.stderr.exp | 14 +- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 14 +- 6 files changed, 249 insertions(+), 94 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 08c4ec3c3..5ae7b4856 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -899,6 +899,8 @@ PRE(sys_fchflags) { PRINT("sys_fchflags ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1,ARG2); PRE_REG_READ2(int, "fchflags", int, fd, unsigned long, flags); + if (!ML_(fd_allowed)(ARG1, "fchflags", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_sync 36 @@ -988,6 +990,8 @@ PRE(sys_ioctl) PRINT("sys_ioctl ( %" FMT_REGWORD "u, 0x%" FMT_REGWORD "x, %#" FMT_REGWORD "x )",ARG1,ARG2,ARG3); PRE_REG_READ3(int, "ioctl", int, fd, unsigned long, request, unsigned long, arg); + if (!ML_(fd_allowed)(ARG1, "ioctl", tid, False)) + SET_STATUS_Failure(VKI_EBADF); switch (ARG2 /* request */) { /* Handle specific ioctls which pass structures which may have pointers to other @@ -1401,9 +1405,8 @@ PRE(sys_fcntl) I_die_here; } - if (!ML_(fd_allowed)(ARG1, "fcntl", tid, False)) { + if (!ML_(fd_allowed)(ARG1, "fcntl", tid, False)) SET_STATUS_Failure (VKI_EBADF); - } } POST(sys_fcntl) @@ -1811,6 +1814,8 @@ PRE(sys_freebsd11_fstat) { PRINT("sys_freebsd11_fstat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",SARG1,ARG2); PRE_REG_READ2(int, "fstat", int, fd, struct stat *, sb); + if (!ML_(fd_allowed)(ARG1, "freebsd11_fstat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE( "fstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) ); } @@ -1852,6 +1857,8 @@ PRE(sys_fpathconf) { PRINT("sys_fpathconf ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )",ARG1,ARG2); PRE_REG_READ2(long, "fpathconf", int, fd, int, name); + if (!ML_(fd_allowed)(ARG1, "fpathconf", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_getrlimit 194 @@ -1871,6 +1878,8 @@ PRE(sys_freebsd11_getdirentries) int, fd, char *, buf, int, nbytes, long *, basep); + if (!ML_(fd_allowed)(ARG1, "getdirentries", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE( "getdirentries(buf)", ARG2, ARG3 ); if (ARG4) { PRE_MEM_WRITE( "getdirentries(basep)", ARG4, sizeof(long) ); @@ -2142,8 +2151,10 @@ PRE(sys_undelete) // int futimes(int fd, const struct timeval *times); PRE(sys_futimes) { - PRINT("sys_lutimes ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1,ARG2); + PRINT("sys_futimes ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1,ARG2); PRE_REG_READ2(long, "futimes", int, fd, struct timeval *, times); + if (!ML_(fd_allowed)(ARG1, "futimes", tid, False)) + SET_STATUS_Failure(VKI_EBADF); if (ARG2 != 0) { PRE_MEM_READ( "futimes(times)", ARG2, sizeof(struct vki_timeval) ); } @@ -2962,23 +2973,21 @@ PRE(sys_aio_cancel) if (ARG2) { PRE_MEM_READ("aio_cancel(iocb)", ARG2, sizeof(struct vki_aiocb)); } - if (!ML_(fd_allowed)(ARG1, "aio_cancel", tid, False)) { + if (!ML_(fd_allowed)(ARG1, "aio_cancel", tid, False)) SET_STATUS_Failure(VKI_EBADF); - } else { - if (ARG2) { - if (ML_(safe_to_deref)((struct vki_aiocb *)ARG2, sizeof(struct vki_aiocb))) { - // struct vki_aiocb *iocb = (struct vki_aiocb *)ARG2; - // @todo PJF cancel only requests associated with - // fildes and iocb - // Do I need to remove pending reads from iocb(v)_table - // or should the user always call aio_return even after - // aio_cancel? - } else { - SET_STATUS_Failure(VKI_EINVAL); - } + if (ARG2) { + if (ML_(safe_to_deref)((struct vki_aiocb *)ARG2, sizeof(struct vki_aiocb))) { + // struct vki_aiocb *iocb = (struct vki_aiocb *)ARG2; + // @todo PJF cancel only requests associated with + // fildes and iocb + // Do I need to remove pending reads from iocb(v)_table + // or should the user always call aio_return even after + // aio_cancel? } else { - // @todo PJF cancel all requests associated with fildes, see above + SET_STATUS_Failure(VKI_EINVAL); } + } else { + // @todo PJF cancel all requests associated with fildes, see above } } @@ -3367,6 +3376,8 @@ PRE(sys___acl_get_fd) PRINT("sys___acl_get_fd ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1,ARG2,ARG3); PRE_REG_READ3(int, "acl_get_fd", int, fd, int, type, struct vki_acl *, aclp); + if (!ML_(fd_allowed)(ARG1, "__acl_get_fd", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE( "acl_get_file(aclp)", ARG3, sizeof(struct vki_acl) ); } @@ -3385,6 +3396,8 @@ PRE(sys___acl_set_fd) PRINT("sys___acl_set_fd ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1,ARG2,ARG3); PRE_REG_READ3(int, "acl_set_fd", int, filedes, int, type, struct vki_acl *, aclp); + if (!ML_(fd_allowed)(ARG1, "__acl_set_fd", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_READ( "acl_get_file(aclp)", ARG3, sizeof(struct vki_acl) ); } @@ -3404,6 +3417,8 @@ PRE(sys___acl_delete_fd) PRINT("sys___acl_delete_fd ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1,ARG2); PRE_REG_READ2(int, "acl_delete_fd", int, filedes, int, acltype); + if (!ML_(fd_allowed)(ARG1, "__acl_delete_fd", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS___acl_aclcheck_file 353 @@ -3424,6 +3439,8 @@ PRE(sys___acl_aclcheck_fd) PRINT("sys___acl_aclcheck_fd ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1,ARG2,ARG3); PRE_REG_READ3(int, "acl_aclcheck_fd", int, fd, int, type, struct vki_acl *, aclp); + if (!ML_(fd_allowed)(ARG1, "__acl_aclcheck_fd", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_READ( "acl_aclcheck_fd(aclp)", ARG3, sizeof(struct vki_acl) ); } @@ -3581,6 +3598,8 @@ PRE(sys_freebsd11_kevent) int, fd, const struct vki_kevent_freebsd11 *, changelist, int, nchanges, struct vki_kevent_freebsd11 *, eventlist, int, nevents, struct timespec *, timeout); + if (!ML_(fd_allowed)(ARG1, "freebsd11_kevent", tid, False)) + SET_STATUS_Failure(VKI_EBADF); if (ARG2 != 0 && ARG3 != 0) { PRE_MEM_READ( "kevent(changelist)", ARG2, sizeof(struct vki_kevent_freebsd11)*ARG3 ); } @@ -3613,6 +3632,8 @@ PRE(sys_extattr_set_fd) { PRINT("sys_extattr_set_fd ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1,SARG2,ARG3,ARG4,ARG5); PRE_REG_READ5(int, "extattr_set_fd", int, fd, int, attrnamespace, const char *,attrname, const void *,data, size_t, nbytes); + if (!ML_(fd_allowed)(ARG1, "extattr_set_fd", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "extattr_set_fd(attrname)", ARG3 ); PRE_MEM_READ("extattr_set_fd(data)", ARG4, ARG5); } @@ -3624,6 +3645,8 @@ PRE(sys_extattr_get_fd) { PRINT("sys_extattr_get_fd ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1,SARG2,ARG3,ARG4,ARG5); PRE_REG_READ5(int, "extattr_get_fd", int, fd, int, attrnamespace, const char *,attrname, const void *,data, size_t, nbytes); + if (!ML_(fd_allowed)(ARG1, "extattr_get_fd", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "extattr_get_fd(attrname)", ARG3 ); PRE_MEM_WRITE("extattr_get_fd(data)", ARG4, ARG5); } @@ -3639,6 +3662,8 @@ PRE(sys_extattr_delete_fd) { PRINT("sys_extattr_delete_fd ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1,SARG2,ARG3); PRE_REG_READ3(int, "extattr_delete_fd", int, fd, int, attrnamespace, const char *,attrname); + if (!ML_(fd_allowed)(ARG1, "extattr_delete_fd", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "extattr_delete_fd(attrname)", ARG3 ); } @@ -4228,6 +4253,8 @@ PRE(sys_extattr_list_fd) { PRINT("extattr_list_fd ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1, SARG2, ARG3, ARG4); PRE_REG_READ4(ssize_t, "extattr_list_fd", int, id, int, attrnamespace, void *,data, size_t, nbytes); + if (!ML_(fd_allowed)(ARG1, "extattr_list_fd", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE("extattr_list_fd(data)", ARG3, ARG4); } @@ -5157,9 +5184,14 @@ POST(sys_cpuset) // int faccessat(int fd, const char *path, int mode, int flag); PRE(sys_faccessat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_faccessat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ3(int, "faccessat", int, fd, const char *, path, int, flag); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "faccessat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "faccessat(path)", ARG2 ); } @@ -5167,9 +5199,14 @@ PRE(sys_faccessat) // int fchmodat(int fd, const char *path, mode_t mode, int flag); PRE(sys_fchmodat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_fchmodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ4(int, "fchmodat", int, fd, const char *, path, vki_mode_t, mode, int, flag); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "fchmodat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "fchmodat(path)", ARG2 ); } @@ -5177,8 +5214,13 @@ PRE(sys_fchmodat) // int fchownat(int fd, const char *path, uid_t owner, gid_t group, int flag); PRE(sys_fchownat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_fchownat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x, %" FMT_REGWORD "d )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4, SARG5); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "fchownat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_REG_READ5(int, "fchownat", int, fd, const char *, path, vki_uid_t, owner, vki_gid_t, group, int, flag); @@ -5267,11 +5309,16 @@ PRE(sys_fexecve) // int fstatat(int fd, const char *path, struct stat *sb, int flag); PRE(sys_freebsd11_fstatat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_freebsd11_fstatat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ4(int, "fstatat", int, fd, const char *, path, struct freebsd11_stat *, buf, int, flag); - PRE_MEM_RASCIIZ( "fstatat(path)", ARG2 ); - PRE_MEM_WRITE( "fstatat(sb)", ARG3, sizeof(struct vki_freebsd11_stat) ); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "freebsd11_fstatat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); + PRE_MEM_RASCIIZ( "freebsd11_fstatat(path)", ARG2 ); + PRE_MEM_WRITE( "freebsd11_fstatat(sb)", ARG3, sizeof(struct vki_freebsd11_stat) ); } POST(sys_freebsd11_fstatat) @@ -5286,6 +5333,8 @@ PRE(sys_futimesat) PRINT("sys_futimesat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ3(int, "futimesat", int, fd, const char *, path, struct timeval *, times); + if (!ML_(fd_allowed)(ARG1, "futimesat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); if (ARG2 != 0) { PRE_MEM_RASCIIZ( "futimesat(path)", ARG2 ); } @@ -5298,12 +5347,17 @@ PRE(sys_futimesat) // int linkat(int fd1, const char *name1, int fd2, const char *name2, int flag); PRE(sys_linkat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; *flags |= SfMayBlock; PRINT("sys_linkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )",ARG1,ARG2,(char*)ARG2,ARG3,ARG4,(char*)ARG4,ARG5); PRE_REG_READ5(int, "linkat", int, fd1, const char *, name1, int, fd2, const char *, name2, int, flag); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "linkat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "linkat(name1)", ARG2); PRE_MEM_RASCIIZ( "linkat(name2)", ARG4); } @@ -5312,10 +5366,15 @@ PRE(sys_linkat) // int mkdirat(int fd, const char *path, mode_t mode); PRE(sys_mkdirat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; *flags |= SfMayBlock; PRINT("sys_mkdirat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ3(int, "mkdirat", int, fd, const char *, path, unsigned int, mode); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "mkdirat", tid, False)) + SET_STATUS_Failure(VKI_EBADF);; PRE_MEM_RASCIIZ( "mkdirat(path)", ARG2 ); } @@ -5323,8 +5382,13 @@ PRE(sys_mkdirat) // int mkfifoat(int fd, const char *path, mode_t mode); PRE(sys_mkfifoat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_mkfifoat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x )", SARG1,ARG2,(HChar*)ARG2,ARG3 ); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "mkfifoat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_REG_READ3(int, "mkfifoat", int, fd, const char *, path, vki_mode_t, mode); PRE_MEM_RASCIIZ( "mkfifoat(path)", ARG2 ); @@ -5334,10 +5398,15 @@ PRE(sys_mkfifoat) // int mknodat(int fd, const char *path, mode_t mode, dev_t dev); PRE(sys_freebsd11_mknodat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_freebsd11_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4 ); - PRE_REG_READ4(long, "mknodat", + PRE_REG_READ4(long, "freebsd11_mknodat", int, dfd, const char *, pathname, int, mode, unsigned, dev); - PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 ); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "freebsd11_mknodat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); + PRE_MEM_RASCIIZ( "freebsd11_mknodat(pathname)", ARG2 ); } // SYS_openat 499 @@ -5388,12 +5457,21 @@ PRE(sys_openat) PRE_REG_READ3(int, "openat", int, fd, const char *, path, int, flags); } + Int arg_1 = (Int) ARG1; + const HChar *path = (const HChar*)ARG2; + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "openat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); - if (ARG1 != (unsigned)VKI_AT_FDCWD && !ML_(fd_allowed)(ARG1, "openat", tid, False)) { - SET_STATUS_Failure( VKI_EBADF ); - } else { - PRE_MEM_RASCIIZ( "openat(path)", ARG2 ); - } + /* For absolute filenames, dirfd is ignored. If dirfd is AT_FDCWD, + filename is relative to cwd. When comparing dirfd against AT_FDCWD, + be sure only to compare the bottom 32 bits. */ + if (ML_(safe_to_deref)((void*)(Addr)ARG2, 1) + && *(Char *)(Addr)ARG2 != '/' + && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) + && !ML_(fd_allowed)(ARG1, "openat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); + PRE_MEM_RASCIIZ("openat(path)", ARG2); /* Otherwise handle normally */ *flags |= SfMayBlock; @@ -5413,53 +5491,54 @@ POST(sys_openat) } } +// @todo PJF make this generic? // SYS_readlinkat 500 // ssize_t readlinkat(int fd, const char *restrict path, char *restrict buf, // size_t bufsize); PRE(sys_readlinkat) { - Word saved = SYSNO; Bool curproc_file = False; + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_readlinkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %llu )", ARG1,ARG2,(char*)ARG2,ARG3,(ULong)ARG4); PRE_REG_READ4(ssize_t, "readlinkat", int, fd, const char *, path, char *, buf, int, bufsize); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "readlinkat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 ); - PRE_MEM_WRITE( "readlinkat(buf)", ARG3,ARG4 ); + PRE_MEM_WRITE("readlinkat(buf)", ARG3, ARG4); - if (VG_(have_slash_proc) == True && (Int)ARG1 == VKI_AT_FDCWD) { + if (VG_(have_slash_proc) == True) { /* * Handle the case where readlinkat is looking at /proc/curproc/file or * /proc//file. */ + // @todo PJF there is still the case where fd refers to / or /proc or /proc/pid + // or /proc/curproc and path is relative pid/file, curproc/file or just file do_readlink((const HChar *)ARG2, (HChar *)ARG3, (SizeT)ARG4, status, &curproc_file); } - - // @todo PJF there is still the case where fd refers to /proc or /proc/pid - // or /proc/curproc and path is relative pid/file, curptoc/file or just file - - if (!curproc_file) { - /* Normal case */ - SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, ARG2, ARG3, ARG4)); - } - if (SUCCESS && RES > 0) { - POST_MEM_WRITE( ARG3, RES ); - } } POST(sys_readlinkat) { - POST_MEM_WRITE( ARG3, RES ); + POST_MEM_WRITE(ARG3, RES); } // SYS_renameat 501 // int renameat(int fromfd, const char *from, int tofd, const char *to); PRE(sys_renameat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_renameat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s) )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4,(char*)ARG4); PRE_REG_READ4(int, "renameat", int, fromfd, const char *, from, int, tofd, const char *, to); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "renameat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "renameat(oldpath)", ARG2 ); PRE_MEM_RASCIIZ( "renameat(newpath)", ARG4 ); } @@ -5468,10 +5547,15 @@ PRE(sys_renameat) // int symlinkat(const char *name1, int fd, const char *name2); PRE(sys_symlinkat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; *flags |= SfMayBlock; PRINT("sys_symlinkat ( %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s) )",ARG1,(char*)ARG1,ARG2,ARG3,(char*)ARG3); PRE_REG_READ3(int, "symlinkat", const char *, name1, int, fd, const char *, name2); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "symlinkat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "symlinkat(name1)", ARG1 ); PRE_MEM_RASCIIZ( "symlinkat(name2)", ARG3 ); } @@ -5481,8 +5565,11 @@ PRE(sys_symlinkat) PRE(sys_unlinkat) { *flags |= SfMayBlock; + Int arg_1 = (Int)ARG1; PRINT("sys_unlinkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u ", ARG1, ARG2, (char*)ARG2, ARG3); + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "unlinkat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_REG_READ3(int, "unlinkat", int, fd, const char *, path, int, flag); PRE_MEM_RASCIIZ( "unlinkat(path)", ARG2 ); } @@ -5678,6 +5765,8 @@ PRE(sys_cap_rights_get) { PRINT("sys_cap_rights_get ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, SARG2, ARG3); PRE_REG_READ3(long, "cap_rights_get", int, version, int, fd, vki_cap_rights_t*, rights); + if (!ML_(fd_allowed)(ARG1, "cap_rights_get", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE("cap_rights_get(rights)", ARG3, sizeof(vki_cap_rights_t)); } @@ -5771,7 +5860,21 @@ PRE(sys_pdfork) POST(sys_pdfork) { if (ARG1) { - POST_MEM_WRITE( ARG1, sizeof(int) ); + POST_MEM_WRITE(ARG1, sizeof(int)); + Int* fdp = (Int*)ARG1; + if ((VG_(clo_modify_fds) == VG_MODIFY_FD_YES && *fdp > 2) + || (VG_(clo_modify_fds) == VG_MODIFY_FD_HIGH)) { + int newFd = ML_(get_next_new_fd)(*fdp); + if (newFd == *fdp) { + // PJF ugh the pdfork syscall succeeded + // but our fdup failed + // how can I clean up the mess? I presume that the child will still run + SET_STATUS_Failure(-1); + } + } + if (VG_(clo_track_fds)) { + ML_(record_fd_open_nameless)(tid, *fdp); + } } } @@ -5781,13 +5884,15 @@ PRE(sys_pdkill) { PRINT("sys_pdkill ( %" FMT_REGWORD "u, %" FMT_REGWORD "d )", ARG1, SARG2); PRE_REG_READ2(int, "pdkill", int, fd, int, signum); + if (!ML_(fd_allowed)(ARG1, "pdkill", tid, False)) + SET_STATUS_Failure(VKI_EBADF); if (!ML_(client_signal_OK)(ARG2)) { SET_STATUS_Failure( VKI_EINVAL ); return; } - /* Ther was some code here to check if the kill is to this process + /* There was some code here to check if the kill is to this process * * But it was totally wrong * @@ -5806,7 +5911,7 @@ PRE(sys_pdkill) * The kill functions operate on pids, not tids. * * One last thing, I don't see how pdkill could do a self - * kill 9. It neads an fd which implied pdfork whichimplies + * kill 9. It needs an fd which implies pdfork which implies * that the fd/pid are for a child process */ @@ -5820,7 +5925,6 @@ PRE(sys_pdkill) /* This kill might have given us a pending signal. Ask for a check once the syscall is done. */ *flags |= SfPollAfter; - } // SYS_pdgetpid 520 @@ -5830,6 +5934,8 @@ PRE(sys_pdgetpid) PRINT("pdgetpid ( %" FMT_REGWORD "d, %#lx )", SARG1, ARG2); PRE_REG_READ2(int, "pdgetpid", int, fd, pid_t*, pidp); + if (!ML_(fd_allowed)(ARG1, "pdgetpid", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE( "pdgetpid(pidp))", ARG2, sizeof(vki_pid_t) ); } @@ -6009,6 +6115,8 @@ PRE(sys_cap_rights_limit) PRINT("sys_cap_rights_limit ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, ARG2); PRE_REG_READ2(int, "cap_rights_limit", int, fd, const cap_rights_t *, rights); + if (!ML_(fd_allowed)(ARG1, "cap_rights_limit", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_READ( "cap_rights_limit(rights)", ARG2, sizeof(struct vki_cap_rights) ); } @@ -6019,6 +6127,8 @@ PRE(sys_cap_ioctls_limit) PRINT("cap_ioctls_limit ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", ARG1, ARG2, ARG3); PRE_REG_READ3(int, "cap_ioctls_limit", int, fd, unsigned long*, rights, vki_size_t, ncmds); + if (!ML_(fd_allowed)(ARG1, "cap_ioctls_limit", tid, False)) + SET_STATUS_Failure(VKI_EBADF); // "can be up to 256" taking that to not be inclusive if (ARG3 < 256 ) { PRE_MEM_READ( "cap_ioctls_limit(cmds))", ARG2, ARG3*sizeof(unsigned long) ); @@ -6032,6 +6142,8 @@ PRE(sys_cap_ioctls_get) { PRINT("sys_cap_ioctls_get ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1, ARG2, ARG3); PRE_REG_READ3(int, "cap_ioctls_get", int, fd, unsigned long *, cmds, size_t, maxcmds); + if (!ML_(fd_allowed)(ARG1, "cap_ioctls_get", tid, False)) + SET_STATUS_Failure(VKI_EBADF); if (ARG3 < 256) { PRE_MEM_WRITE("cap_ioctls_get(cmds)", ARG2, ARG3*sizeof(unsigned long)); } @@ -6044,7 +6156,6 @@ POST(sys_cap_ioctls_get) } } - // SYS_cap_fcntls_limit 536 //int cap_fcntls_limit(int fd, uint32_t fcntlrights); PRE(sys_cap_fcntls_limit) @@ -6052,6 +6163,8 @@ PRE(sys_cap_fcntls_limit) PRINT("cap_fcntls_limit ( %" FMT_REGWORD "d, %" FMT_REGWORD "u )", SARG1, ARG2); PRE_REG_READ2(long, "cap_fcntls_limit", int, fd, vki_uint32_t, fcntlrights); + if (!ML_(fd_allowed)(ARG1, "cap_fcntls_limit", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_cap_fcntls_get 537 @@ -6060,6 +6173,8 @@ PRE(sys_cap_fcntls_get) { PRINT("sys_cap_fcntls_get ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, ARG2); PRE_REG_READ2(int, "cap_fcntls_get", int, fd, uint32_t *, fcntlrightsp); + if (!ML_(fd_allowed)(ARG1, "cap_fcntls_get", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE("cap_fcntls_get(fcntlrightsp)", ARG2, sizeof(uint32_t)); } @@ -6075,6 +6190,8 @@ PRE(sys_bindat) PRINT("sys_bindat ( %" FMT_REGWORD "d, %" FMT_REGWORD "dx, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1, SARG2, ARG3, ARG4); PRE_REG_READ4(int, "bindat", int, fd, int, s, const struct vki_sockaddr *, name, vki_socklen_t, namelen); + if (!ML_(fd_allowed)(ARG1, "bindat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_READ("bindat(name)", ARG3, ARG4); } @@ -6085,6 +6202,8 @@ PRE(sys_connectat) PRINT("sys_connectat ( %" FMT_REGWORD "d, %" FMT_REGWORD "dx, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1, SARG2, ARG3, ARG4); PRE_REG_READ4(int, "connectat", int, fd, int, s, const struct vki_sockaddr *, name, vki_socklen_t, namelen); + if (!ML_(fd_allowed)(ARG1, "connectat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_READ("connectat(name)", ARG3, ARG4); } @@ -6095,6 +6214,8 @@ PRE(sys_chflagsat) PRINT("sys_chglagsat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %" FMT_REGWORD "d )", SARG1, ARG2, ARG3, SARG4); PRE_REG_READ4(int, "chflagsat", int, fd, const char *, path, unsigned long, flags, int, atflag); + if (!ML_(fd_allowed)(ARG1, "chflagsat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ("chflagsat(path)", ARG2); } @@ -6221,6 +6342,8 @@ PRE(sys_futimens) { PRINT("sys_futimens ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, ARG2); PRE_REG_READ2(int, "futimens", int, fd, const struct timespec *, times); + if (!ML_(fd_allowed)(ARG1, "futimens", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_READ("futimens(times)", ARG2, 2*sizeof(struct vki_timespec)); } @@ -6233,6 +6356,8 @@ PRE(sys_utimensat) SARG1, ARG2, ARG3, SARG4); PRE_REG_READ4(int, "utimensat", int, fd, const char *,path, const struct timespec *, times, int, flag); + if (!ML_(fd_allowed)(ARG1, "utimensat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ("utimensat(path)", ARG2); PRE_MEM_READ("utimensat(times)", ARG3, 2*sizeof(struct vki_timespec)); } @@ -6243,6 +6368,8 @@ PRE(sys_fdatasync) { PRINT("sys_fdatasync ( %" FMT_REGWORD "d )",SARG1); PRE_REG_READ1(int, "fdatasync", int, fd); + if (!ML_(fd_allowed)(ARG1, "fdatasync", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_fstat 551 @@ -6263,9 +6390,14 @@ POST(sys_fstat) // int fstatat(int fd, const char *path, struct stat *sb, int flag); PRE(sys_fstatat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_fstatat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %" FMT_REGWORD "d )", SARG1,ARG2,(char*)ARG2,ARG3,SARG4); PRE_REG_READ4(int, "fstatat", int, fd, const char *, path, struct stat *, sb, int, flag); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "fstatat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "fstatat(path)", ARG2 ); PRE_MEM_WRITE( "fstatat(sb)", ARG3, sizeof(struct vki_stat) ); } @@ -6299,6 +6431,8 @@ PRE(sys_getdirentries) int, fd, char *, buf, size_t, nbytes, off_t *, basep); + if (!ML_(fd_allowed)(ARG1, "getdirentries", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE( "getdirentries(buf)", ARG2, ARG3 ); if (ARG4) { PRE_MEM_WRITE("getdirentries(basep)", ARG4, sizeof (vki_off_t)); @@ -6338,6 +6472,8 @@ PRE(sys_fstatfs) PRINT("sys_fstatfs ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",SARG1,ARG2); PRE_REG_READ2(int, "fstatfs", int, fd, struct vki_statfs *, buf); + if (!ML_(fd_allowed)(ARG1, "fstatfs", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE( "fstatfs(buf)", ARG2, sizeof(struct vki_statfs) ); } @@ -6446,8 +6582,13 @@ POST(sys_getrandom) // int getfhat(int fd, const char *path, fhandle_t *fhp, int flag); PRE(sys_getfhat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_getfhat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "x, %" FMT_REGWORD "d ", SARG1, ARG2, ARG3, SARG4); PRE_REG_READ4(int, "getfhat", int, fd, const char*, path, vki_fhandle_t*, fhp, int, flag); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "getfhat", tid, False)) + SET_STATUS_Failure(VKI_EBADF);; PRE_MEM_RASCIIZ( "getfhat(path)", ARG2 ); PRE_MEM_WRITE("getfhat(fhp)", ARG3, sizeof(vki_fhandle_t)); } @@ -6496,10 +6637,15 @@ POST(sys_fhreadlink) // int funlinkat(int dfd, const char *path, int fd, int flag); PRE(sys_funlinkat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; *flags |= SfMayBlock; PRINT("sys_funlinkat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %" FMT_REGWORD"u )", SARG1, ARG2, (char*)ARG2, ARG4, ARG5); PRE_REG_READ4(int, "funlinkat", int, dfd, const char *, path, int, fd, int, flag); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "funlinkat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "funlinkat(path)", ARG2 ); } @@ -6523,17 +6669,16 @@ PRE(sys_copy_file_range) valgrind itself uses some, so make sure someone didn't put in one of our own... */ if (!ML_(fd_allowed)(ARG1, "copy_file_range(infd)", tid, False) || - !ML_(fd_allowed)(ARG3, "copy_file_range(infd)", tid, False)) { + !ML_(fd_allowed)(ARG3, "copy_file_range(infd)", tid, False)) SET_STATUS_Failure( VKI_EBADF ); - } else { - /* Now see if the offsets are defined. PRE_MEM_READ will - double check it can dereference them. */ - if (ARG2 != 0) { - PRE_MEM_READ( "copy_file_range(inoffp)", ARG2, sizeof(vki_off_t)); - } - if (ARG4 != 0) { - PRE_MEM_READ( "copy_file_range(outoffp)", ARG4, sizeof(vki_off_t)); - } + + /* Now see if the offsets are defined. PRE_MEM_READ will + double check it can dereference them. */ + if (ARG2 != 0) { + PRE_MEM_READ( "copy_file_range(inoffp)", ARG2, sizeof(vki_off_t)); + } + if (ARG4 != 0) { + PRE_MEM_READ( "copy_file_range(outoffp)", ARG4, sizeof(vki_off_t)); } } @@ -6677,10 +6822,15 @@ PRE(sys_sigfastblock) // int flags) PRE(sys___realpathat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys___realpathat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %" FMT_REGWORD "u %" FMT_REGWORD "d )", SARG1,ARG2,(const char*)ARG2,ARG3,ARG4,SARG5 ); PRE_REG_READ5(int, "__realpathat", int, fd, const char *, path, char *, buf, vki_size_t, size, int, flags); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "__realpathat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ("__realpathat(path)", (Addr)ARG2); PRE_MEM_WRITE("__realpathat(buf)", (Addr)ARG3, ARG4); } @@ -6879,6 +7029,8 @@ PRE(sys_fspacectl) { PRINT("fspacectl ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, SARG2, ARG3, SARG4, ARG5); PRE_REG_READ5(int, "fspacectl", int, fd, int, cmd, const struct spacectl_range *, rqsr, int, flags, struct spacectl_range *, rmsr); + if (!ML_(fd_allowed)(ARG1, "fspacectl", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_READ("fspacectl(rqsr)", (Addr)ARG3, sizeof(struct vki_spacectl_range)); if (ARG5) { PRE_MEM_WRITE("fspacectl(rmsr)", (Addr)ARG5, sizeof(struct vki_spacectl_range)); @@ -6964,9 +7116,8 @@ PRE(sys_timerfd_gettime) struct vki_itimerspec*, curr_value); if (!ML_(fd_allowed)(ARG1, "timerfd_gettime", tid, False)) SET_STATUS_Failure(VKI_EBADF); - else - PRE_MEM_WRITE("timerfd_gettime(curr_value)", - ARG2, sizeof(struct vki_itimerspec)); + PRE_MEM_WRITE("timerfd_gettime(curr_value)", + ARG2, sizeof(struct vki_itimerspec)); } POST(sys_timerfd_gettime) @@ -6989,15 +7140,12 @@ PRE(sys_timerfd_settime) struct vki_itimerspec*, old_value); if (!ML_(fd_allowed)(ARG1, "timerfd_settime", tid, False)) SET_STATUS_Failure(VKI_EBADF); - else + PRE_MEM_READ("timerfd_settime(new_value)", + ARG3, sizeof(struct vki_itimerspec)); + if (ARG4) { - PRE_MEM_READ("timerfd_settime(new_value)", - ARG3, sizeof(struct vki_itimerspec)); - if (ARG4) - { - PRE_MEM_WRITE("timerfd_settime(old_value)", - ARG4, sizeof(struct vki_itimerspec)); - } + PRE_MEM_WRITE("timerfd_settime(old_value)", + ARG4, sizeof(struct vki_itimerspec)); } } @@ -7118,17 +7266,17 @@ PRE(sys_exterrctl) // int inotify_add_watch_at(int fd, int dfd, _In_z_ const char *path, uint32_t mask); PRE(sys_inotify_add_watch_at) { + Int arg_2 = (Int)ARG2; + const HChar *path = (const HChar*)ARG3; PRINT("sys_inotify_add_watch_at(%" FMT_REGWORD "d, %" FMT_REGWORD "d, %" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x)", SARG1, SARG2, ARG3, (HChar*)ARG3, ARG4); PRE_REG_READ4(int, "inotify_add_watch_at", int, fd, int, dfd, const char*, path, uint32_t, mask); PRE_MEM_RASCIIZ("inotify_add_watch_at(path)", ARG3); if (!ML_(fd_allowed)(ARG1, "inotify_add_watch_at", tid, False)) { SET_STATUS_Failure( VKI_EBADF ); } - if (ARG2 != VKI_AT_FDCWD) { - if (!ML_(fd_allowed)(ARG2, "inotify_add_watch_at", tid, False)) { - SET_STATUS_Failure( VKI_EBADF ); - } - } + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_2 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_2, "inotify_add_watch_at", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_inotify_rm_watch diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index e6a57e2ad..984acaefe 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -6398,6 +6398,7 @@ POST(sys_readlinkat) HChar name[30]; // large enough Word saved = SYSNO; + // @todo PJF why is this done in POST and not in PRE? /* * Handle the case where readlinkat is looking at /proc/self/exe or * /proc//exe. diff --git a/memcheck/tests/freebsd/pdfork_pdkill.c b/memcheck/tests/freebsd/pdfork_pdkill.c index db3e81bb4..8d83642ba 100644 --- a/memcheck/tests/freebsd/pdfork_pdkill.c +++ b/memcheck/tests/freebsd/pdfork_pdkill.c @@ -77,6 +77,10 @@ int main(int argc, char *argv[]) { pid_t pid; pdgetpid(fd, &pid); pdkill(fd, 9); + int res_close = close(fd); + if (-1 == res_close) { + perror("close"); + } } else { fprintf(stderr, "parent: child exited\n"); } @@ -94,6 +98,8 @@ int main(int argc, char *argv[]) { free(pbadpid); pdgetpid(anotherfd, pbadpid); pdfork(&anotherfd, badflag); + pdkill(*badfd, 9); + close(*badfd); } return EXIT_SUCCESS; diff --git a/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp b/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp index bab0469ba..2105d362b 100644 --- a/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp +++ b/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp @@ -1,32 +1,32 @@ parent: kill fd 3 Syscall param pdfork(fdp) points to unaddressable byte(s) ... - by 0x........: main (pdfork_pdkill.c:88) + by 0x........: main (pdfork_pdkill.c:92) Address 0x........ is 0 bytes inside a block of size 4 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (pdfork_pdkill.c:87) + by 0x........: main (pdfork_pdkill.c:91) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (pdfork_pdkill.c:86) + by 0x........: main (pdfork_pdkill.c:90) parent after 1st bad pdfork Syscall param pdgetpid(fd) contains uninitialised byte(s) ... - by 0x........: main (pdfork_pdkill.c:95) + by 0x........: main (pdfork_pdkill.c:99) Syscall param pdgetpid(pidp)) points to unaddressable byte(s) ... - by 0x........: main (pdfork_pdkill.c:95) + by 0x........: main (pdfork_pdkill.c:99) Address 0x........ is 0 bytes inside a block of size 4 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (pdfork_pdkill.c:94) + by 0x........: main (pdfork_pdkill.c:98) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (pdfork_pdkill.c:93) + by 0x........: main (pdfork_pdkill.c:97) Syscall param pdfork(flags) contains uninitialised byte(s) ... - by 0x........: main (pdfork_pdkill.c:96) + by 0x........: main (pdfork_pdkill.c:100) FILE DESCRIPTORS: 3 open (3 inherited) at exit. Open file descriptor ... diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index ae9c15f6a..85f2db45a 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -4189,11 +4189,11 @@ Syscall param fstatat(buf) contains uninitialised byte(s) Syscall param fstatat(flag) contains uninitialised byte(s) ... -Syscall param fstatat(path) points to unaddressable byte(s) +Syscall param freebsd11_fstatat(path) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param fstatat(sb) points to unaddressable byte(s) +Syscall param freebsd11_fstatat(sb) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -4278,19 +4278,19 @@ Syscall param mkfifoat(path) points to unaddressable byte(s) --------------------------------------------------------- 498: SYS_freebsd11_mknodat 4s 1m --------------------------------------------------------- -Syscall param mknodat(dfd) contains uninitialised byte(s) +Syscall param freebsd11_mknodat(dfd) contains uninitialised byte(s) ... -Syscall param mknodat(pathname) contains uninitialised byte(s) +Syscall param freebsd11_mknodat(pathname) contains uninitialised byte(s) ... -Syscall param mknodat(mode) contains uninitialised byte(s) +Syscall param freebsd11_mknodat(mode) contains uninitialised byte(s) ... -Syscall param mknodat(dev) contains uninitialised byte(s) +Syscall param freebsd11_mknodat(dev) contains uninitialised byte(s) ... -Syscall param mknodat(pathname) points to unaddressable byte(s) +Syscall param freebsd11_mknodat(pathname) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 51ae7e94c..40d091995 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -4228,11 +4228,11 @@ Syscall param fstatat(buf) contains uninitialised byte(s) Syscall param fstatat(flag) contains uninitialised byte(s) ... -Syscall param fstatat(path) points to unaddressable byte(s) +Syscall param freebsd11_fstatat(path) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param fstatat(sb) points to unaddressable byte(s) +Syscall param freebsd11_fstatat(sb) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -4317,19 +4317,19 @@ Syscall param mkfifoat(path) points to unaddressable byte(s) --------------------------------------------------------- 498: SYS_freebsd11_mknodat 4s 1m --------------------------------------------------------- -Syscall param mknodat(dfd) contains uninitialised byte(s) +Syscall param freebsd11_mknodat(dfd) contains uninitialised byte(s) ... -Syscall param mknodat(pathname) contains uninitialised byte(s) +Syscall param freebsd11_mknodat(pathname) contains uninitialised byte(s) ... -Syscall param mknodat(mode) contains uninitialised byte(s) +Syscall param freebsd11_mknodat(mode) contains uninitialised byte(s) ... -Syscall param mknodat(dev) contains uninitialised byte(s) +Syscall param freebsd11_mknodat(dev) contains uninitialised byte(s) ... -Syscall param mknodat(pathname) points to unaddressable byte(s) +Syscall param freebsd11_mknodat(pathname) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd From 52dddd460b0778f862c062c82d8d2819f740c268 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 23 Aug 2025 14:19:33 +0200 Subject: [PATCH 194/412] FreeBSD syscalls: fd handling (part 2) amd64 and x86 files --- coregrind/m_syswrap/syswrap-amd64-freebsd.c | 52 ++++++++++------- coregrind/m_syswrap/syswrap-freebsd.c | 2 + coregrind/m_syswrap/syswrap-x86-freebsd.c | 64 ++++++++++++--------- 3 files changed, 68 insertions(+), 50 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-amd64-freebsd.c b/coregrind/m_syswrap/syswrap-amd64-freebsd.c index 21f22b5a8..71d1bc8b9 100644 --- a/coregrind/m_syswrap/syswrap-amd64-freebsd.c +++ b/coregrind/m_syswrap/syswrap-amd64-freebsd.c @@ -268,17 +268,16 @@ PRE(sys_preadv) int, iovcnt, vki_off_t, offset); if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) { SET_STATUS_Failure( VKI_EBADF ); - } else { - if ((Int)ARG3 > 0) { - PRE_MEM_READ( "preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec) ); - } + } + if ((Int)ARG3 > 0) { + PRE_MEM_READ( "preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec) ); + } - if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) { - vec = (struct vki_iovec *)(Addr)ARG2; - for (i = 0; i < (Int)ARG3; i++) { - VG_(sprintf)(buf, "preadv(iov[%d])", i); - PRE_MEM_WRITE(buf, (Addr)vec[i].iov_base, vec[i].iov_len); - } + if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) { + vec = (struct vki_iovec *)(Addr)ARG2; + for (i = 0; i < (Int)ARG3; i++) { + VG_(sprintf)(buf, "preadv(iov[%d])", i); + PRE_MEM_WRITE(buf, (Addr)vec[i].iov_base, vec[i].iov_len); } } } @@ -323,16 +322,15 @@ PRE(sys_pwritev) vki_off_t, offset); if (!ML_(fd_allowed)(ARG1, "pwritev", tid, False)) { SET_STATUS_Failure( VKI_EBADF ); - } else { - if ((Int)ARG3 >= 0) { - PRE_MEM_READ( "pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) ); - } - if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) { - vec = (struct vki_iovec *)(Addr)ARG2; - for (i = 0; i < (Int)ARG3; i++) { - VG_(sprintf)(buf, "pwritev(iov[%d])", i); - PRE_MEM_READ(buf, (Addr)vec[i].iov_base, vec[i].iov_len ); - } + } + if ((Int)ARG3 >= 0) { + PRE_MEM_READ( "pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) ); + } + if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) { + vec = (struct vki_iovec *)(Addr)ARG2; + for (i = 0; i < (Int)ARG3; i++) { + VG_(sprintf)(buf, "pwritev(iov[%d])", i); + PRE_MEM_READ(buf, (Addr)vec[i].iov_base, vec[i].iov_len ); } } } @@ -349,7 +347,8 @@ PRE(sys_sendfile) PRE_REG_READ7(int, "sendfile", int, fd, int, s, vki_off_t, offset, size_t, nbytes, void *, hdtr, vki_off_t *, sbytes, int, flags); - + if (!ML_(fd_allowed)(ARG1, "sendfile", tid, False)) + SET_STATUS_Failure( VKI_EBADF ); if (ARG5 != 0) { PRE_MEM_READ("sendfile(hdtr)", ARG5, sizeof(struct vki_sf_hdtr)); } @@ -761,6 +760,8 @@ PRE(sys_lseek) PRE_REG_READ3(long, "lseek", unsigned int, fd, unsigned long, offset, unsigned int, whence); + if (!ML_(fd_allowed)(ARG1, "lseek", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_truncate 479 @@ -782,6 +783,8 @@ PRE(sys_ftruncate) PRINT("sys_ftruncate ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1,ARG2); PRE_REG_READ2(long, "ftruncate", unsigned int, fd, unsigned long, length); + if (!ML_(fd_allowed)(ARG1, "ftruncate", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_cpuset_setid 485 @@ -855,6 +858,8 @@ PRE(sys_posix_fallocate) PRE_REG_READ3(long, "posix_fallocate", int, fd, vki_off_t, offset, vki_off_t, len); + if (!ML_(fd_allowed)(ARG1, "posix_fallocate", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_posix_fadvise 531 @@ -867,7 +872,8 @@ PRE(sys_posix_fadvise) int, fd, off_t, offset, off_t, len, int, advice); - // @todo PJF advice can be 0 to 5 inclusive + if (!ML_(fd_allowed)(ARG1, "posix_fadvise", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_wait6 532 @@ -981,6 +987,8 @@ PRE(sys_mknodat) PRE_REG_READ4(long, "mknodat", int, fd, const char *, path, vki_mode_t, mode, vki_dev_t, dev); PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 ); + if (!ML_(fd_allowed)(ARG1, "mknodat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_cpuset_getdomain 561 diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 5ae7b4856..d92a1a46c 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -3847,6 +3847,8 @@ PRE(sys_freebsd11_fstatfs) PRINT("sys_fstatfs ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )",ARG1,ARG2); PRE_REG_READ2(int, "fstatfs", unsigned int, fd, struct statfs *, buf); + if (!ML_(fd_allowed)(ARG1, "freebsd11_fstatfs", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE( "fstatfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) ); } diff --git a/coregrind/m_syswrap/syswrap-x86-freebsd.c b/coregrind/m_syswrap/syswrap-x86-freebsd.c index 0ad3dda26..421d7c575 100644 --- a/coregrind/m_syswrap/syswrap-x86-freebsd.c +++ b/coregrind/m_syswrap/syswrap-x86-freebsd.c @@ -679,18 +679,16 @@ PRE(sys_preadv) int, fd, const struct iovec *, iov, int, iovcnt, vki_uint32_t, MERGE64_FIRST(offset), vki_uint32_t, MERGE64_SECOND(offset)); - if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) { - SET_STATUS_Failure( VKI_EBADF ); - } else { - if ((Int)ARG3 > 0) - PRE_MEM_READ( "preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec) ); - - if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) { - vec = (struct vki_iovec *)(Addr)ARG2; - for (i = 0; i < (Int)ARG3; i++) - PRE_MEM_WRITE( "preadv(iov[...])", - (Addr)vec[i].iov_base, vec[i].iov_len ); - } + if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) + SET_STATUS_Failure(VKI_EBADF); + if ((Int)ARG3 > 0) + PRE_MEM_READ( "preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec) ); + + if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) { + vec = (struct vki_iovec *)(Addr)ARG2; + for (i = 0; i < (Int)ARG3; i++) + PRE_MEM_WRITE( "preadv(iov[...])", + (Addr)vec[i].iov_base, vec[i].iov_len ); } } @@ -728,17 +726,15 @@ PRE(sys_pwritev) int, iovcnt, vki_uint32_t, MERGE64_FIRST(offset), vki_uint32_t, MERGE64_SECOND(offset)); - if (!ML_(fd_allowed)(ARG1, "pwritev", tid, False)) { + if (!ML_(fd_allowed)(ARG1, "pwritev", tid, False)) SET_STATUS_Failure( VKI_EBADF ); - } else { - if ((Int)ARG3 >= 0) - PRE_MEM_READ( "pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) ); - if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) { - vec = (struct vki_iovec *)(Addr)ARG2; - for (i = 0; i < (Int)ARG3; i++) - PRE_MEM_READ( "pwritev(iov[...])", - (Addr)vec[i].iov_base, vec[i].iov_len ); - } + if ((Int)ARG3 >= 0) + PRE_MEM_READ( "pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) ); + if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) { + vec = (struct vki_iovec *)(Addr)ARG2; + for (i = 0; i < (Int)ARG3; i++) + PRE_MEM_READ( "pwritev(iov[...])", + (Addr)vec[i].iov_base, vec[i].iov_len ); } } @@ -754,7 +750,8 @@ PRE(sys_sendfile) int, fd, int, s, unsigned int, offset_low, unsigned int, offset_high, size_t, nbytes, void *, hdtr, vki_off_t *, sbytes, int, flags); - + if (!ML_(fd_allowed)(ARG1, "sendfile", tid, False)) + SET_STATUS_Failure( VKI_EBADF ); if (ARG6 != 0) PRE_MEM_READ("sendfile(hdtr)", ARG6, sizeof(struct vki_sf_hdtr)); @@ -1091,8 +1088,7 @@ PRE(sys_pread) if (!ML_(fd_allowed)(ARG1, "pread", tid, False)) SET_STATUS_Failure( VKI_EBADF ); - else - PRE_MEM_WRITE( "pread(buf)", ARG2, ARG3 ); + PRE_MEM_WRITE( "pread(buf)", ARG2, ARG3 ); } POST(sys_pread) @@ -1120,8 +1116,7 @@ PRE(sys_pwrite) ok = True; if (!ok) SET_STATUS_Failure( VKI_EBADF ); - else - PRE_MEM_READ( "pwrite(buf)", ARG2, ARG3 ); + PRE_MEM_READ( "pwrite(buf)", ARG2, ARG3 ); } // SYS_mmap 477 @@ -1147,10 +1142,12 @@ PRE(sys_lseek) { PRINT("sys_lseek ( %" FMT_REGWORD "d, %llu, %" FMT_REGWORD "d )", SARG1,MERGE64(ARG2,ARG3),SARG4); PRE_REG_READ4(long, "lseek", - unsigned int, fd, + int, fildes, vki_uint32_t, MERGE64_FIRST(offset), vki_uint32_t, MERGE64_SECOND(offset), unsigned int, whence); + if (!ML_(fd_allowed)(ARG1, "lseek", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_truncate 479 @@ -1175,6 +1172,8 @@ PRE(sys_ftruncate) PRE_REG_READ3(int, "ftruncate", int, fd, vki_uint32_t, MERGE64_FIRST(length), vki_uint32_t, MERGE64_SECOND(length)); + if (!ML_(fd_allowed)(ARG1, "ftruncate", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_cpuset_setid 485 @@ -1258,6 +1257,8 @@ PRE(sys_posix_fallocate) vki_uint32_t, MERGE64_SECOND(offset), vki_uint32_t, MERGE64_FIRST(len), vki_uint32_t, MERGE64_SECOND(len)); + if (!ML_(fd_allowed)(ARG1, "posix_fallocate", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_posix_fadvise 531 @@ -1272,6 +1273,8 @@ PRE(sys_posix_fadvise) vki_uint32_t, MERGE64_FIRST(len), vki_uint32_t, MERGE64_SECOND(len), int, advice); + if (!ML_(fd_allowed)(ARG1, "posix_fadvise", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_wait6 532 @@ -1385,10 +1388,15 @@ POST(sys_procctl) // int mknodat(int fd, const char *path, mode_t mode, dev_t dev); PRE(sys_mknodat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4 ); PRE_REG_READ5(long, "mknodat", int, fd, const char *, path, vki_mode_t, mode, vki_uint32_t, MERGE64_FIRST(dev), vki_uint32_t, MERGE64_SECOND(idev)) PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 ); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "mknodat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_cpuset_getdomain 561 From 4a420cccbea43c2458d0181270f31efdc30eb52a Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 23 Aug 2025 15:42:47 +0200 Subject: [PATCH 195/412] FreeBSD syscalls: fd handling (part 3) arm64 file --- coregrind/m_syswrap/syswrap-arm64-freebsd.c | 64 ++++++++++++--------- coregrind/m_syswrap/syswrap-x86-freebsd.c | 4 +- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-arm64-freebsd.c b/coregrind/m_syswrap/syswrap-arm64-freebsd.c index d90cf212b..fe3107f50 100644 --- a/coregrind/m_syswrap/syswrap-arm64-freebsd.c +++ b/coregrind/m_syswrap/syswrap-arm64-freebsd.c @@ -202,20 +202,19 @@ PRE(sys_preadv) SARG1, ARG2, SARG3, SARG4); PRE_REG_READ4(ssize_t, "preadv", int, fd, const struct iovec*, iov, int, iovcnt, vki_off_t, offset); - if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) { + if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) SET_STATUS_Failure(VKI_EBADF); - } else { - if ((Int)ARG3 > 0) { - PRE_MEM_READ("preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec)); - } + } + if ((Int)ARG3 > 0) { + PRE_MEM_READ("preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec)); + } - if (ML_(safe_to_deref)((struct vki_iovec*)ARG2, - ARG3 * sizeof(struct vki_iovec))) { - vec = (struct vki_iovec*)(Addr)ARG2; - for (i = 0; i < (Int)ARG3; i++) { - VG_(sprintf)(buf, "preadv(iov[%d])", i); - PRE_MEM_WRITE(buf, (Addr)vec[i].iov_base, vec[i].iov_len); - } + if (ML_(safe_to_deref)((struct vki_iovec*)ARG2, + ARG3 * sizeof(struct vki_iovec))) { + vec = (struct vki_iovec*)(Addr)ARG2; + for (i = 0; i < (Int)ARG3; i++) { + VG_(sprintf)(buf, "preadv(iov[%d])", i); + PRE_MEM_WRITE(buf, (Addr)vec[i].iov_base, vec[i].iov_len); } } } @@ -259,17 +258,16 @@ PRE(sys_pwritev) iovcnt, vki_off_t, offset); if (!ML_(fd_allowed)(ARG1, "pwritev", tid, False)) { SET_STATUS_Failure(VKI_EBADF); - } else { - if ((Int)ARG3 >= 0) { - PRE_MEM_READ("pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec)); - } - if (ML_(safe_to_deref)((struct vki_iovec*)ARG2, - ARG3 * sizeof(struct vki_iovec))) { - vec = (struct vki_iovec*)(Addr)ARG2; - for (i = 0; i < (Int)ARG3; i++) { - VG_(sprintf)(buf, "pwritev(iov[%d])", i); - PRE_MEM_READ(buf, (Addr)vec[i].iov_base, vec[i].iov_len); - } + } + if ((Int)ARG3 >= 0) { + PRE_MEM_READ("pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec)); + } + if (ML_(safe_to_deref)((struct vki_iovec*)ARG2, + ARG3 * sizeof(struct vki_iovec))) { + vec = (struct vki_iovec*)(Addr)ARG2; + for (i = 0; i < (Int)ARG3; i++) { + VG_(sprintf)(buf, "pwritev(iov[%d])", i); + PRE_MEM_READ(buf, (Addr)vec[i].iov_base, vec[i].iov_len); } } } @@ -287,7 +285,8 @@ PRE(sys_sendfile) SARG1, SARG2, ARG3, ARG4, ARG5, ARG6, SARG7); PRE_REG_READ7(int, "sendfile", int, fd, int, s, vki_off_t, offset, size_t, nbytes, void*, hdtr, vki_off_t*, sbytes, int, flags); - + if (!ML_(fd_allowed)(ARG1, "sendfile", tid, False)) + SET_STATUS_Failure(VKI_EBADF); if (ARG5 != 0) { PRE_MEM_READ("sendfile(hdtr)", ARG5, sizeof(struct vki_sf_hdtr)); } @@ -659,9 +658,8 @@ PRE(sys_pread) if (!ML_(fd_allowed)(ARG1, "read", tid, False)) { SET_STATUS_Failure(VKI_EBADF); - } else { - PRE_MEM_WRITE("pread(buf)", ARG2, ARG3); } + PRE_MEM_WRITE("pread(buf)", ARG2, ARG3); } POST(sys_pread) @@ -721,6 +719,8 @@ PRE(sys_lseek) ARG1, ARG2, ARG3); PRE_REG_READ3(long, "lseek", unsigned int, fd, unsigned long, offset, unsigned int, whence); + if (!ML_(fd_allowed)(ARG1, "lseek", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_truncate 479 @@ -741,6 +741,8 @@ PRE(sys_ftruncate) *flags |= SfMayBlock; PRINT("sys_ftruncate ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2); PRE_REG_READ2(long, "ftruncate", unsigned int, fd, unsigned long, length); + if (!ML_(fd_allowed)(ARG1, "ftruncate", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_cpuset_setid 485 @@ -814,6 +816,8 @@ PRE(sys_posix_fallocate) SARG1, ARG2, ARG3); PRE_REG_READ3(long, "posix_fallocate", int, fd, vki_off_t, offset, vki_off_t, len); + if (!ML_(fd_allowed)(ARG1, "posix_fallocate", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_posix_fadvise 531 @@ -825,7 +829,8 @@ PRE(sys_posix_fadvise) SARG1, ARG2, ARG3, SARG4); PRE_REG_READ4(long, "posix_fadvise", int, fd, off_t, offset, off_t, len, int, advice); - // @todo PJF advice can be 0 to 5 inclusive + if (!ML_(fd_allowed)(ARG1, "posix_faadvise", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_wait6 532 @@ -945,12 +950,17 @@ POST(sys_procctl) // int mknodat(int fd, const char *path, mode_t mode, dev_t dev); PRE(sys_mknodat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1, ARG2, (char*)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "mknodat", int, fd, const char*, path, vki_mode_t, mode, vki_dev_t, dev); PRE_MEM_RASCIIZ("mknodat(pathname)", ARG2); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "mknodat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } // SYS_cpuset_getdomain 561 diff --git a/coregrind/m_syswrap/syswrap-x86-freebsd.c b/coregrind/m_syswrap/syswrap-x86-freebsd.c index 421d7c575..5ea0524c7 100644 --- a/coregrind/m_syswrap/syswrap-x86-freebsd.c +++ b/coregrind/m_syswrap/syswrap-x86-freebsd.c @@ -1388,8 +1388,8 @@ POST(sys_procctl) // int mknodat(int fd, const char *path, mode_t mode, dev_t dev); PRE(sys_mknodat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4 ); PRE_REG_READ5(long, "mknodat", int, fd, const char *, path, vki_mode_t, mode, vki_uint32_t, MERGE64_FIRST(dev), vki_uint32_t, MERGE64_SECOND(idev)) From 260728c1a31259c108ceb5d662a3ee30f44d5b9d Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 23 Aug 2025 17:55:27 +0200 Subject: [PATCH 196/412] FreeBSD regtest: cleanup fd handling Build error on arm64 and update scalar expected. scalar not looking right for x86 --- coregrind/m_syswrap/syswrap-arm64-freebsd.c | 1 - memcheck/tests/freebsd/scalar.stderr.exp | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/coregrind/m_syswrap/syswrap-arm64-freebsd.c b/coregrind/m_syswrap/syswrap-arm64-freebsd.c index fe3107f50..6054c641e 100644 --- a/coregrind/m_syswrap/syswrap-arm64-freebsd.c +++ b/coregrind/m_syswrap/syswrap-arm64-freebsd.c @@ -204,7 +204,6 @@ PRE(sys_preadv) iovcnt, vki_off_t, offset); if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) SET_STATUS_Failure(VKI_EBADF); - } if ((Int)ARG3 > 0) { PRE_MEM_READ("preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec)); } diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 85f2db45a..882433a92 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -2065,6 +2065,10 @@ Syscall param preadv(iovcnt) contains uninitialised byte(s) Syscall param preadv(offset) contains uninitialised byte(s) ... +Syscall param preadv(iov) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 290: SYS_pwritev 4s 0m --------------------------------------------------------- @@ -2080,6 +2084,10 @@ Syscall param pwritev(iovcnt) contains uninitialised byte(s) Syscall param pwritev(offset) contains uninitialised byte(s) ... +Syscall param pwritev(vector) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 298: SYS_fhopen 2s 1m --------------------------------------------------------- From 57804a8edbe7b05293f55f1a79585b6b88f8db5f Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 23 Aug 2025 21:31:13 +0200 Subject: [PATCH 197/412] FreeBSD regtest: get pdfork_pdkill to pass on arm64 arm64 was giving a few conditional jump errors (suppressed) and a pdfork was succeeding with uninit flags whilst it was failing on amd64. Made sure that it has bad flags (-1) but still uninit. --- memcheck/tests/freebsd/Makefile.am | 1 + memcheck/tests/freebsd/pdfork_pdkill.c | 3 +++ memcheck/tests/freebsd/pdfork_pdkill.stderr.exp | 14 +++++++++----- memcheck/tests/freebsd/pdfork_pdkill.vgtest | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index 0f00d67a4..bb5de145c 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -91,6 +91,7 @@ EXTRA_DIST = \ openpty.stderr.exp \ pdfork_pdkill.vgtest \ pdfork_pdkill.stderr.exp \ + pdfork_pdkill.supp \ realpathat.vgtest \ realpathat.stderr.exp \ revoke.vgtest \ diff --git a/memcheck/tests/freebsd/pdfork_pdkill.c b/memcheck/tests/freebsd/pdfork_pdkill.c index 8d83642ba..8347a1153 100644 --- a/memcheck/tests/freebsd/pdfork_pdkill.c +++ b/memcheck/tests/freebsd/pdfork_pdkill.c @@ -94,6 +94,9 @@ int main(int argc, char *argv[]) { fprintf(stderr, "parent after 1st bad pdfork\n"); int anotherfd; int badflag; + // without this the last pdfork succeeds on arm64 + badflag = -1 + anotherfd; + badflag -=anotherfd; pid_t* pbadpid = malloc(sizeof(pid_t)); free(pbadpid); pdgetpid(anotherfd, pbadpid); diff --git a/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp b/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp index 2105d362b..f5c911ae4 100644 --- a/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp +++ b/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp @@ -12,21 +12,25 @@ Syscall param pdfork(fdp) points to unaddressable byte(s) parent after 1st bad pdfork Syscall param pdgetpid(fd) contains uninitialised byte(s) ... - by 0x........: main (pdfork_pdkill.c:99) + by 0x........: main (pdfork_pdkill.c:101) Syscall param pdgetpid(pidp)) points to unaddressable byte(s) ... - by 0x........: main (pdfork_pdkill.c:99) + by 0x........: main (pdfork_pdkill.c:101) Address 0x........ is 0 bytes inside a block of size 4 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (pdfork_pdkill.c:98) + by 0x........: main (pdfork_pdkill.c:100) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (pdfork_pdkill.c:97) + by 0x........: main (pdfork_pdkill.c:99) + +Conditional jump or move depends on uninitialised value(s) + ... + by 0x........: main (pdfork_pdkill.c:101) Syscall param pdfork(flags) contains uninitialised byte(s) ... - by 0x........: main (pdfork_pdkill.c:100) + by 0x........: main (pdfork_pdkill.c:102) FILE DESCRIPTORS: 3 open (3 inherited) at exit. Open file descriptor ... diff --git a/memcheck/tests/freebsd/pdfork_pdkill.vgtest b/memcheck/tests/freebsd/pdfork_pdkill.vgtest index 066c16716..a109ef6e1 100644 --- a/memcheck/tests/freebsd/pdfork_pdkill.vgtest +++ b/memcheck/tests/freebsd/pdfork_pdkill.vgtest @@ -1,4 +1,4 @@ prog: pdfork_pdkill args: 10 2 -vgopts: -q --track-fds=all --child-silent-after-fork=yes +vgopts: -q --track-fds=all --child-silent-after-fork=yes --suppressions=pdfork_pdkill.supp stderr_filter: filter_pts From 97e8c786205902f3e505da02935550fda394aa65 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 23 Aug 2025 21:35:48 +0200 Subject: [PATCH 198/412] FreeeBSD regtest: add the suppression for pdfork_pdkill --- memcheck/tests/freebsd/pdfork_pdkill.supp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 memcheck/tests/freebsd/pdfork_pdkill.supp diff --git a/memcheck/tests/freebsd/pdfork_pdkill.supp b/memcheck/tests/freebsd/pdfork_pdkill.supp new file mode 100644 index 000000000..5d25403bb --- /dev/null +++ b/memcheck/tests/freebsd/pdfork_pdkill.supp @@ -0,0 +1,22 @@ +{ + arm64 suppression 1 + Memcheck:Cond + fun:pdkill + fun:main +} + +{ + arm64 suppression 2 + Memcheck:Cond + fun:__sys_pdfork + fun:main +} + + +{ + arm64 suppression 3 + Memcheck:Cond + fun:_close + fun:main +} + From 216be4adee6ee06770d7a49b1be76e73d7c12508 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 23 Aug 2025 23:54:16 +0200 Subject: [PATCH 199/412] FreeBSD regtest: pdfork_pdkill again x86 needs some filtering, and I think arm64 will need an expected --- memcheck/tests/freebsd/pdfork_pdkill.c | 2 ++ memcheck/tests/freebsd/pdfork_pdkill.stderr.exp | 14 +++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/memcheck/tests/freebsd/pdfork_pdkill.c b/memcheck/tests/freebsd/pdfork_pdkill.c index 8347a1153..819773a4b 100644 --- a/memcheck/tests/freebsd/pdfork_pdkill.c +++ b/memcheck/tests/freebsd/pdfork_pdkill.c @@ -94,6 +94,8 @@ int main(int argc, char *argv[]) { fprintf(stderr, "parent after 1st bad pdfork\n"); int anotherfd; int badflag; + anotherfd = 2 + badflag; + anotherfd -= badflag; // without this the last pdfork succeeds on arm64 badflag = -1 + anotherfd; badflag -=anotherfd; diff --git a/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp b/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp index f5c911ae4..163d46603 100644 --- a/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp +++ b/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp @@ -12,25 +12,21 @@ Syscall param pdfork(fdp) points to unaddressable byte(s) parent after 1st bad pdfork Syscall param pdgetpid(fd) contains uninitialised byte(s) ... - by 0x........: main (pdfork_pdkill.c:101) + by 0x........: main (pdfork_pdkill.c:104) Syscall param pdgetpid(pidp)) points to unaddressable byte(s) ... - by 0x........: main (pdfork_pdkill.c:101) + by 0x........: main (pdfork_pdkill.c:104) Address 0x........ is 0 bytes inside a block of size 4 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (pdfork_pdkill.c:100) + by 0x........: main (pdfork_pdkill.c:103) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (pdfork_pdkill.c:99) - -Conditional jump or move depends on uninitialised value(s) - ... - by 0x........: main (pdfork_pdkill.c:101) + by 0x........: main (pdfork_pdkill.c:102) Syscall param pdfork(flags) contains uninitialised byte(s) ... - by 0x........: main (pdfork_pdkill.c:102) + by 0x........: main (pdfork_pdkill.c:105) FILE DESCRIPTORS: 3 open (3 inherited) at exit. Open file descriptor ... From a43676d2e4eec7523a63484801e9c29ba1978659 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 24 Aug 2025 00:05:51 +0200 Subject: [PATCH 200/412] FreeBSD regtest: updates to scalar for x86 Now that there better checks of fds a couple of syscalls using rubbish values for fd which were above the max files limit. That changed the syscall return code causing an assert. Also some left over updates to the expected from previous changes. --- memcheck/tests/freebsd/scalar.c | 4 ++-- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index 234e649f7..0709d1873 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -1989,13 +1989,13 @@ int main(void) SY(SYS_posix_fallocate, x0+99999, x0+10, x0+20); SUCC; #else GO(SYS_posix_fallocate, "5s 0m"); - SY(SYS_posix_fallocate, x0+99999, x0, x0+10, x0, x0+20); SUCC; + SY(SYS_posix_fallocate, x0+9999, x0, x0+10, x0, x0+20); SUCC; #endif assert(res == EBADF); /* SYS_posix_fadvise 531 */ GO(SYS_posix_fadvise, "4s 0m"); - SY(SYS_posix_fadvise, x0+99999, x0+10, x0+20, x0); SUCC; + SY(SYS_posix_fadvise, x0+9999, x0+10, x0+20, x0); SUCC; assert(res == EBADF); /* SYS_wait6 532 */ diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 40d091995..20d8d3ca7 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -2068,6 +2068,10 @@ Syscall param preadv(offset_low) contains uninitialised byte(s) Syscall param preadv(offset_high) contains uninitialised byte(s) ... +Syscall param preadv(iov) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 290: SYS_pwritev 5s 0m --------------------------------------------------------- @@ -2086,6 +2090,10 @@ Syscall param pwritev(offset_low) contains uninitialised byte(s) Syscall param pwritev(offset_high) contains uninitialised byte(s) ... +Syscall param pwritev(vector) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 298: SYS_fhopen 2s 1m --------------------------------------------------------- @@ -3957,7 +3965,7 @@ Syscall param mmap(offset_high) contains uninitialised byte(s) --------------------------------------------------------- 478: SYS_lseek 4s 0m --------------------------------------------------------- -Syscall param lseek(fd) contains uninitialised byte(s) +Syscall param lseek(fildes) contains uninitialised byte(s) ... Syscall param lseek(offset_low) contains uninitialised byte(s) From ffc66d9dcdc2b646b8551873df40ad78d64974cd Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 23 Aug 2025 21:58:25 +0200 Subject: [PATCH 201/412] FreeBSD regtest: pdfork_pdfill last fix (hopefully) Now passes on amd64 arm64 and x86 --- memcheck/tests/freebsd/pdfork_pdkill.supp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/memcheck/tests/freebsd/pdfork_pdkill.supp b/memcheck/tests/freebsd/pdfork_pdkill.supp index 5d25403bb..cd3ad7479 100644 --- a/memcheck/tests/freebsd/pdfork_pdkill.supp +++ b/memcheck/tests/freebsd/pdfork_pdkill.supp @@ -2,14 +2,12 @@ arm64 suppression 1 Memcheck:Cond fun:pdkill - fun:main } { arm64 suppression 2 Memcheck:Cond fun:__sys_pdfork - fun:main } @@ -17,6 +15,11 @@ arm64 suppression 3 Memcheck:Cond fun:_close - fun:main +} + +{ + arm64 suppression 4 + Memcheck:Cond + fun:pdgetpid } From a139ed0b3c0af09bf0bcc698072225eb4021a920 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 24 Aug 2025 11:25:51 +0200 Subject: [PATCH 202/412] illumos syscalls: fd handling (part 4) Almost everything looked OK. Added a couple of POST_newFd_RES macro uses. There are a few functions that create fds other than via RES (like pipe). For these I think that we need to add a POST_newFd(fd) macro, plus in a few places refactor so that RES is available to set the status after ML_(get_next_new_fd). --- coregrind/m_syswrap/syswrap-solaris.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c index a5d34bc5d..f620e85bd 100644 --- a/coregrind/m_syswrap/syswrap-solaris.c +++ b/coregrind/m_syswrap/syswrap-solaris.c @@ -2326,10 +2326,8 @@ PRE(sys_readlinkat) if (dfd != VKI_AT_FDCWD && ML_(safe_to_deref)((void *) ARG2, 1) && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(dfd, "readlinkat", tid, False)) { + && !ML_(fd_allowed)(dfd, "readlinkat", tid, False)) SET_STATUS_Failure(VKI_EBADF); - return; - } /* Handle the case where readlinkat is looking at /proc/self/path/a.out or /proc//path/a.out. */ @@ -2564,6 +2562,7 @@ PRE(sys_mknodat) POST(sys_mknodat) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "mknodat", tid, True)) { VG_(close)(RES); SET_STATUS_Failure(VKI_EMFILE); @@ -7786,6 +7785,7 @@ POST(sys_port) Int opcode = ARG1 & VKI_PORT_CODE_MASK; switch (opcode) { case VKI_PORT_CREATE: + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "port", tid, True)) { VG_(close)(RES); SET_STATUS_Failure(VKI_EMFILE); From 011310876e30ce799ac518b2055a300f7ef53c01 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 24 Aug 2025 16:11:25 +0200 Subject: [PATCH 203/412] Darwin: add VG_(resolved_exename) Possibly not needed. On Linux it's used to check that the guest exe doen't get opend with a write flag. macOS seems happy to allow that. --- coregrind/m_initimg/initimg-darwin.c | 62 ++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/coregrind/m_initimg/initimg-darwin.c b/coregrind/m_initimg/initimg-darwin.c index 57fbd0bf7..ca71295f2 100644 --- a/coregrind/m_initimg/initimg-darwin.c +++ b/coregrind/m_initimg/initimg-darwin.c @@ -259,6 +259,57 @@ static HChar *copy_str(HChar **tab, const HChar *str) return orig; } +/* + * @todo PJF Make this multi-platform + */ +static Bool try_get_interp(const HChar* args_exe, HChar* interp_out) +{ + HChar hdr[4096]; + Int len = sizeof hdr; + SysRes res; + Int fd; + HChar* end; + HChar* cp; + HChar* interp; + + res = VG_(open)(args_exe, VKI_O_RDONLY, 0); + if (sr_isError(res)) { + return False; + } else { + fd = sr_Res(res); + } + + res = VG_(pread)(fd, hdr, len, 0); + + if (sr_isError(res)) { + VG_(close)(fd); + return False; + } else { + len = sr_Res(res); + } + + if (0 != VG_(memcmp)(hdr, "#!", 2)) { + VG_(close)(fd); + return False; + } + + end = hdr + len; + interp = hdr + 2; + while (interp < end && (*interp == ' ' || *interp == '\t')) + interp++; + + for (cp = interp; cp < end && !VG_(isspace)(*cp); cp++) + ; + + *cp = '\0'; + + VG_(sprintf)(interp_out, "%s", interp); + + VG_(close)(fd); + return True; +} + + /* ---------------------------------------------------------------- @@ -449,6 +500,17 @@ Addr setup_client_stack( void* init_sp, vg_assert((strtab-stringbase) == stringsize); + if (VG_(resolved_exename) == NULL) { + const HChar *exe_name = VG_(find_executable)(VG_(args_the_exename)); + HChar interp_name[VKI_PATH_MAX]; + if (try_get_interp(exe_name, interp_name)) { + exe_name = interp_name; + } + HChar resolved_name[VKI_PATH_MAX]; + VG_(realpath)(exe_name, resolved_name); + VG_(resolved_exename) = VG_(strdup)("initimg-darwin.sre.1", resolved_name); + } + /* client_SP is pointing at client's argc/argv */ if (0) VG_(printf)("startup SP = %#lx\n", client_SP); From 5deb5b45d10bf6f431bc7119aa184636cd802abf Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 24 Aug 2025 16:16:24 +0200 Subject: [PATCH 204/412] Darwin syscalls: fd handling (part 4) Most already done. --- coregrind/m_syswrap/syswrap-darwin.c | 49 ++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index 8aaf8fc83..a9fed60de 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -1940,6 +1940,7 @@ PRE(kqueue) POST(kqueue) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "kqueue", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -1970,6 +1971,7 @@ PRE(guarded_kqueue_np) POST(guarded_kqueue_np) { + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "guarded_kqueue_np", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -2410,6 +2412,8 @@ PRE(__pthread_fchdir) { PRINT("__pthread_fchdir ( %lu )", ARG1); PRE_REG_READ1(long, "__pthread_fchdir", unsigned int, fd); + if (!ML_(fd_allowed)(ARG1, "__pthread_chdir", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } @@ -2525,6 +2529,8 @@ PRE(fgetxattr) PRE_REG_READ6(vki_ssize_t, "fgetxattr", int, fd, char *, name, void *, value, vki_size_t, size, uint32_t, position, int, options); + if (!ML_(fd_allowed)(ARG1, "fgetxattr", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ("getxattr(name)", ARG2); PRE_MEM_WRITE( "getxattr(value)", ARG3, ARG4); } @@ -2556,7 +2562,8 @@ PRE(fsetxattr) PRE_REG_READ6(int, "fsetxattr", int,"fd", char *,"name", void *,"value", vki_size_t,"size", uint32_t,"position", int,"options" ); - + if (!ML_(fd_allowed)(ARG1, "fsetxattr", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "fsetxattr(name)", ARG2 ); PRE_MEM_READ( "fsetxattr(value)", ARG3, ARG4 ); } @@ -2579,6 +2586,8 @@ PRE(fremovexattr) SARG1, ARG2, (HChar*)ARG2, SARG3 ); PRE_REG_READ3(int, "fremovexattr", int, "fd", char*, "attrname", int, "options"); + if (!ML_(fd_allowed)(ARG1, "fremovextattr", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "removexattr(attrname)", ARG2 ); } @@ -2610,6 +2619,8 @@ PRE(flistxattr) PRE_REG_READ4 (long, "flistxattr", int, "fd", char *,"namebuf", vki_size_t,"size", int,"options" ); + if (!ML_(fd_allowed)(ARG1, "flistxtattr", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE( "flistxattr(namebuf)", ARG2, ARG3 ); *flags |= SfMayBlock; } @@ -2681,6 +2692,7 @@ PRE(shm_open) POST(shm_open) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "shm_open", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -9846,7 +9858,7 @@ POST(getattrlistbulk) PRE(faccessat) { - uint32_t fd = ARG1; + Int fd = ARG1; PRINT("faccessat(fd:%d, path:%#lx(%s), amode:%#lx, flag:%#lx)", fd, ARG2, ARG2 ? (HChar*)ARG2 : "null", ARG3, ARG4); PRE_REG_READ4(int, "faccessat", @@ -9860,7 +9872,7 @@ PRE(faccessat) PRE(fstatat64) { - uint32_t fd = ARG1; + Int fd = ARG1; PRINT("fstatat64(fd:%d, path:%#lx(%s), ub:%#lx, flag:%#lx)", fd, ARG2, ARG2 ? (HChar*)ARG2 : "null", ARG3, ARG4); PRE_REG_READ4(int, "fstatat64", @@ -9880,24 +9892,28 @@ POST(fstatat64) PRE(readlinkat) { Word saved = SYSNO; - + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("readlinkat ( %ld, %#lx(%s), %#lx, %ld )", SARG1, ARG2, (HChar*)ARG2, ARG3, SARG4); PRE_REG_READ4(long, "readlinkat", int, dfd, const char *, path, char *, buf, int, bufsiz); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "readlinkat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 ); PRE_MEM_WRITE( "readlinkat(buf)", ARG3,ARG4 ); /* - * Refer to coregrind/m_syswrap/syswrap-linux.c + * Linux needs to jump through hoops to check for accesses to things liks + * /proc/PID/self + * Darwin does not have proc so no need here */ - { - /* Normal case */ - SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, ARG2, ARG3, ARG4)); - } - - if (SUCCESS && RES > 0) - POST_MEM_WRITE( ARG3, RES ); +} + +POST(readlinkat) +{ + POST_MEM_WRITE( ARG3, RES ); } PRE(bsdthread_ctl) @@ -10008,6 +10024,7 @@ PRE(openat) POST(openat) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "openat", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -10019,9 +10036,14 @@ POST(openat) PRE(mkdirat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("mkdirat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ3(int, "mkdirat", int, fd, const char *, path, unsigned int, mode); + if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) + if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "symlinkat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_RASCIIZ( "mkdirat(path)", ARG2 ); *flags |= SfMayBlock; } @@ -10491,6 +10513,7 @@ PRE(openat_nocancel) POST(openat_nocancel) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "openat_nocancel", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); @@ -11100,7 +11123,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { #endif MACX_(__NR_faccessat, faccessat), // 466 MACXY(__NR_fstatat64, fstatat64), // 470 - MACX_(__NR_readlinkat, readlinkat), // 473 + MACXY(__NR_readlinkat, readlinkat), // 473 MACX_(__NR_bsdthread_ctl, bsdthread_ctl), // 478 MACXY(__NR_csrctl, csrctl), // 483 MACX_(__NR_guarded_open_dprotected_np, guarded_open_dprotected_np), // 484 From b61816e4fe6b8884fb75f936599c57898ed49a17 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 24 Aug 2025 16:20:18 +0200 Subject: [PATCH 205/412] Darwin: fix a warning, unused local --- coregrind/m_syswrap/syswrap-darwin.c | 1 - 1 file changed, 1 deletion(-) diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index a9fed60de..ba90495bb 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -9891,7 +9891,6 @@ POST(fstatat64) PRE(readlinkat) { - Word saved = SYSNO; Int arg_1 = (Int)ARG1; const HChar *path = (const HChar*)ARG2; PRINT("readlinkat ( %ld, %#lx(%s), %#lx, %ld )", From d9e9cba1cccbad4a9f29098625c56f7a9fe23ad5 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 24 Aug 2025 18:34:04 +0200 Subject: [PATCH 206/412] Darwin regtest: turn off ada mangling test On Darwin clang adds an underscore to mangle C functions which interferes with this testcase which tries to fake ada mangling in C. --- memcheck/tests/bug445235_ada_demangle.vgtest | 3 +++ 1 file changed, 3 insertions(+) diff --git a/memcheck/tests/bug445235_ada_demangle.vgtest b/memcheck/tests/bug445235_ada_demangle.vgtest index d8d263351..09f77b78b 100644 --- a/memcheck/tests/bug445235_ada_demangle.vgtest +++ b/memcheck/tests/bug445235_ada_demangle.vgtest @@ -1,2 +1,5 @@ +# on macOS the C compiler adds more manging which fouls up +# this test which relies on faking ada mangling in a C binary +prereq: ! ../../tests/os_test darwin prog: bug445235_ada_demangle vgopts: -q From 9798921801d56080ffd18747fd4fb283c9c0bdba Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 24 Aug 2025 21:36:35 +0200 Subject: [PATCH 207/412] Add 507720 to NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index e2c49a0ff..c39e4f9f1 100644 --- a/NEWS +++ b/NEWS @@ -70,6 +70,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506967 Implement and override mallinfo2 506970 mmap needs an EBADF fd_allowed check 507173 s390x: Crash when constant folding is disabled +507720 Review syscalls returning file descriptors (other platforms) 507721 Wire up illumos and Solaris mallinfo 507853 faccessat and faccessat2 should handle AT_FDCWD and absolute paths 507868 futimesat doesn't handle AT_FDCWD From 7991d02a61a1f0aa4cf3784d8afbf42f97f3925e Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 24 Aug 2025 20:26:58 +0000 Subject: [PATCH 208/412] PPC specific changes for BC 507033 Replace the deprecated Iop_Clz64 with Iop_ClzNat64. This is safe to do because insn selection does not distinguish between Iop_Clz64 and Iop_ClzNat64: Iop_Clz64 / Iop_ClzNat64 --isel--> Pun_CLZ64 --emit-->cntlzd The cntlzd insn has "natural" semantics and a 0 operand is not special. Part of fixing https://bugs.kde.org/show_bug.cgi?id=507033 --- VEX/priv/guest_ppc_toIR.c | 4 ++-- VEX/priv/host_ppc_isel.c | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c index 18716dd04..eafc557cc 100644 --- a/VEX/priv/guest_ppc_toIR.c +++ b/VEX/priv/guest_ppc_toIR.c @@ -21285,7 +21285,7 @@ dis_vector_logical_mask_bits ( UInt prefix, UInt theInstr, UInt opc2, ) ) ) ); assign( clz[0], - unop( Iop_Clz64, + unop( Iop_ClzNat64, mkexpr( extracted_bits[0] ) ) ); assign( extracted_bits[1], @@ -21300,7 +21300,7 @@ dis_vector_logical_mask_bits ( UInt prefix, UInt theInstr, UInt opc2, mkexpr( cnt_extract_bits[1] ) ) ) ) ); assign( clz[1], - unop( Iop_Clz64, + unop( Iop_ClzNat64, mkexpr( extracted_bits[1] ) ) ); putVReg( vRT_addr, binop( Iop_64HLtoV128, diff --git a/VEX/priv/host_ppc_isel.c b/VEX/priv/host_ppc_isel.c index ff87ae7ed..2fad3c59e 100644 --- a/VEX/priv/host_ppc_isel.c +++ b/VEX/priv/host_ppc_isel.c @@ -2069,14 +2069,14 @@ static HReg iselWordExpr_R_wrk ( ISelEnv* env, const IRExpr* e, } break; - case Iop_Clz32: case Iop_ClzNat32: - case Iop_Clz64: case Iop_ClzNat64: { + case Iop_ClzNat32: + case Iop_ClzNat64: { // cntlz is available even in the most basic (earliest) ppc // variants, so it's safe to generate it unconditionally. HReg r_src, r_dst; - PPCUnaryOp op_clz = (op_unop == Iop_Clz32 || op_unop == Iop_ClzNat32) + PPCUnaryOp op_clz = (op_unop == Iop_ClzNat32) ? Pun_CLZ32 : Pun_CLZ64; - if ((op_unop == Iop_Clz64 || op_unop == Iop_ClzNat64) && !mode64) + if ((op_unop == Iop_ClzNat64) && !mode64) goto irreducible; /* Count leading zeroes. */ r_dst = newVRegI(env); @@ -2085,9 +2085,7 @@ static HReg iselWordExpr_R_wrk ( ISelEnv* env, const IRExpr* e, return r_dst; } - //case Iop_Ctz32: case Iop_CtzNat32: - //case Iop_Ctz64: case Iop_CtzNat64: { // Generate code using Clz, because we can't assume the host has @@ -2095,7 +2093,7 @@ static HReg iselWordExpr_R_wrk ( ISelEnv* env, const IRExpr* e, // creating a Ctz in ir_opt.c from smaller fragments. PPCUnaryOp op_clz = Pun_CLZ64; Int WS = 64; - if (op_unop == Iop_Ctz32 || op_unop == Iop_CtzNat32) { + if (op_unop == Iop_CtzNat32) { op_clz = Pun_CLZ32; WS = 32; } From 6d248d12c24e691b139399e03863d5d4cb6ca697 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 24 Aug 2025 20:46:25 +0000 Subject: [PATCH 209/412] Remove deprecated IROps Iop_Clz32, Iop_Clz64, Iop_Ctz32, and Iop_Ctz64 Part of fixing https://bugs.kde.org/show_bug.cgi?id=507033 --- NEWS | 3 +++ VEX/priv/ir_defs.c | 8 ------- VEX/priv/ir_opt.c | 38 -------------------------------- VEX/pub/libvex_ir.h | 7 ------ VEX/useful/test_main.c | 4 ---- memcheck/mc_translate.c | 16 +++++++------- memcheck/tests/vbit-test/irops.c | 4 ---- none/tests/iropt-test/irops.tab | 6 ----- 8 files changed, 11 insertions(+), 75 deletions(-) diff --git a/NEWS b/NEWS index c39e4f9f1..853ba47d2 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux. * New VEX API function LibVEX_set_VexControl +* The deprecated IROps: Iop_Clz32/64 and Iop_Ctz32/64 have been removed + * ================== PLATFORM CHANGES ================= * ==================== TOOL CHANGES =================== @@ -69,6 +71,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506930 valgrind allows SIGKILL being reset to SIG_DFL 506967 Implement and override mallinfo2 506970 mmap needs an EBADF fd_allowed check +507033 Remove deprecated Iop_Clz32/64 and Iop_Ctz32/64 507173 s390x: Crash when constant folding is disabled 507720 Review syscalls returning file descriptors (other platforms) 507721 Wire up illumos and Solaris mallinfo diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c index ba61758d7..79b7cce64 100644 --- a/VEX/priv/ir_defs.c +++ b/VEX/priv/ir_defs.c @@ -190,11 +190,6 @@ void ppIROp ( IROp op ) case Iop_MullU32: vex_printf("MullU32"); return; case Iop_MullU64: vex_printf("MullU64"); return; - case Iop_Clz64: vex_printf("Clz64"); return; - case Iop_Clz32: vex_printf("Clz32"); return; - case Iop_Ctz64: vex_printf("Ctz64"); return; - case Iop_Ctz32: vex_printf("Ctz32"); return; - case Iop_ClzNat64: vex_printf("ClzNat64"); return; case Iop_ClzNat32: vex_printf("ClzNat32"); return; case Iop_CtzNat64: vex_printf("CtzNat64"); return; @@ -1416,7 +1411,6 @@ Bool primopMightTrap ( IROp op ) case Iop_ExpCmpNE16: case Iop_ExpCmpNE32: case Iop_ExpCmpNE64: case Iop_MullS8: case Iop_MullS16: case Iop_MullS32: case Iop_MullS64: case Iop_MullU8: case Iop_MullU16: case Iop_MullU32: case Iop_MullU64: - case Iop_Clz64: case Iop_Clz32: case Iop_Ctz64: case Iop_Ctz32: case Iop_ClzNat64: case Iop_ClzNat32: case Iop_CtzNat64: case Iop_CtzNat32: case Iop_PopCount64: case Iop_PopCount32: case Iop_CmpLT32S: case Iop_CmpLT64S: case Iop_CmpLE32S: case Iop_CmpLE64S: @@ -3292,12 +3286,10 @@ void typeOfPrimop ( IROp op, case Iop_MullU64: case Iop_MullS64: BINARY(Ity_I64,Ity_I64, Ity_I128); - case Iop_Clz32: case Iop_Ctz32: case Iop_ClzNat32: case Iop_CtzNat32: case Iop_PopCount32: UNARY(Ity_I32, Ity_I32); - case Iop_Clz64: case Iop_Ctz64: case Iop_ClzNat64: case Iop_CtzNat64: case Iop_PopCount64: UNARY(Ity_I64, Ity_I64); diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index fa2877f6b..100f6396f 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1321,31 +1321,6 @@ static IRExpr* mkOnesOfPrimopResultType ( IROp op ) } } -/* Helpers for folding Clz32/64. */ -static UInt fold_Clz64 ( ULong value ) -{ - UInt i; - vassert(value != 0ULL); /* no defined semantics for arg==0 */ - for (i = 0; i < 64; ++i) { - if (0ULL != (value & (((ULong)1) << (63 - i)))) return i; - } - vassert(0); - /*NOTREACHED*/ - return 0; -} - -static UInt fold_Clz32 ( UInt value ) -{ - UInt i; - vassert(value != 0); /* no defined semantics for arg==0 */ - for (i = 0; i < 32; ++i) { - if (0 != (value & (((UInt)1) << (31 - i)))) return i; - } - vassert(0); - /*NOTREACHED*/ - return 0; -} - /* Helpers for folding ClzNat32/64. */ static UInt fold_ClzNat64 ( ULong value ) { @@ -1741,19 +1716,6 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) break; } - case Iop_Clz32: { - UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32; - if (u32 != 0) - e2 = IRExpr_Const(IRConst_U32(fold_Clz32(u32))); - break; - } - case Iop_Clz64: { - ULong u64 = e->Iex.Unop.arg->Iex.Const.con->Ico.U64; - if (u64 != 0ULL) - e2 = IRExpr_Const(IRConst_U64(fold_Clz64(u64))); - break; - } - case Iop_ClzNat32: { UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32; e2 = IRExpr_Const(IRConst_U32(fold_ClzNat32(u32))); diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h index 983cd50bc..750ba0701 100644 --- a/VEX/pub/libvex_ir.h +++ b/VEX/pub/libvex_ir.h @@ -462,13 +462,6 @@ typedef Iop_MullU8, Iop_MullU16, Iop_MullU32, Iop_MullU64, /* Counting bits */ - /* Ctz64/Ctz32/Clz64/Clz32 are UNDEFINED when given arguments of zero. - You must ensure they are never given a zero argument. As of - 2018-Nov-14 they are deprecated. Try to use the Nat variants - immediately below, if you can. - */ - Iop_Clz64, Iop_Clz32, /* count leading zeroes */ - Iop_Ctz64, Iop_Ctz32, /* count trailing zeros */ /* Count leading/trailing zeroes, with "natural" semantics for the case where the input is zero: then the result is the number of bits in the word. */ diff --git a/VEX/useful/test_main.c b/VEX/useful/test_main.c index 85168e704..ba4e25017 100644 --- a/VEX/useful/test_main.c +++ b/VEX/useful/test_main.c @@ -2022,10 +2022,6 @@ IRExpr* expr2vbits_Unop ( MCEnv* mce, IROp op, IRAtom* atom ) case Iop_2xm1F64: return mkPCastTo(mce, Ity_I64, vatom); - case Iop_Clz32: - case Iop_Ctz32: - return mkPCastTo(mce, Ity_I32, vatom); - case Iop_32Sto64: case Iop_32Uto64: case Iop_V128to64: diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c index b4e499cc0..dfaf10c2b 100644 --- a/memcheck/mc_translate.c +++ b/memcheck/mc_translate.c @@ -2424,14 +2424,14 @@ IRAtom* expensiveCountTrailingZeroes ( MCEnv* mce, IROp czop, tl_assert(sameKindedAtoms(atom,vatom)); switch (czop) { - case Iop_Ctz32: case Iop_CtzNat32: + case Iop_CtzNat32: ty = Ity_I32; xorOp = Iop_Xor32; subOp = Iop_Sub32; andOp = Iop_And32; one = mkU32(1); break; - case Iop_Ctz64: case Iop_CtzNat64: + case Iop_CtzNat64: ty = Ity_I64; xorOp = Iop_Xor64; subOp = Iop_Sub64; @@ -2499,14 +2499,14 @@ IRAtom* expensiveCountLeadingZeroes ( MCEnv* mce, IROp czop, tl_assert(sameKindedAtoms(atom,vatom)); switch (czop) { - case Iop_Clz32: case Iop_ClzNat32: + case Iop_ClzNat32: ty = Ity_I32; shrOp = Iop_Shr32; notOp = Iop_Not32; andOp = Iop_And32; mkRight = mkRight32; break; - case Iop_Clz64: case Iop_ClzNat64: + case Iop_ClzNat64: ty = Ity_I64; shrOp = Iop_Shr64; notOp = Iop_Not64; @@ -5316,12 +5316,12 @@ IRExpr* expr2vbits_Unop ( MCEnv* mce, IROp op, IRAtom* atom ) case Iop_NegF16: return mkPCastTo(mce, Ity_I16, vatom); - case Iop_Ctz32: case Iop_CtzNat32: - case Iop_Ctz64: case Iop_CtzNat64: + case Iop_CtzNat32: + case Iop_CtzNat64: return expensiveCountTrailingZeroes(mce, op, atom, vatom); - case Iop_Clz32: case Iop_ClzNat32: - case Iop_Clz64: case Iop_ClzNat64: + case Iop_ClzNat32: + case Iop_ClzNat64: return expensiveCountLeadingZeroes(mce, op, atom, vatom); // PopCount32: this is slightly pessimistic. It is true that the diff --git a/memcheck/tests/vbit-test/irops.c b/memcheck/tests/vbit-test/irops.c index 2f0ea8a6a..aec2670b8 100644 --- a/memcheck/tests/vbit-test/irops.c +++ b/memcheck/tests/vbit-test/irops.c @@ -108,10 +108,6 @@ static irop_t irops[] = { { DEFOP(Iop_MullU16, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_MullU32, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 1 }, // mips asserts { DEFOP(Iop_MullU64, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32, mips assert - { DEFOP(Iop_Clz64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, // ppc32 asserts - { DEFOP(Iop_Clz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 }, - { DEFOP(Iop_Ctz64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, - { DEFOP(Iop_Ctz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, { DEFOP(Iop_ClzNat64, UNDEF_ALL), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32 asserts { DEFOP(Iop_ClzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 }, { DEFOP(Iop_CtzNat64, UNDEF_ALL), .s390x = 0, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index c65ff4cfb..4163edfcd 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -124,12 +124,6 @@ { OPNAME(Left32), Ity_I32, 1, Ity_I32 }, { OPNAME(Left64), Ity_I64, 1, Ity_I64 }, -// { OPNAME(Clz32), Ity_I32, 1, Ity_I32 }, // deprecated, undefined behaviour -// { OPNAME(Clz64), Ity_I64, 1, Ity_I64 }, // deprecated, undefined behaviour - -// { OPNAME(Ctz32), Ity_I32, 1, Ity_I32 }, // deprecated, undefined behaviour -// { OPNAME(Ctz64), Ity_I64, 1, Ity_I64 }, // deprecated, undefined behaviour - { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32, ONLY2(ppc, x86) }, { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64, EXCEPT2(ppc32, x86) }, From a528bccf165c448ce10ecbf40d1c017373f4c3a6 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 25 Aug 2025 21:48:53 +0200 Subject: [PATCH 210/412] FreeBSD: fix guest stack creation for self-hosting See https://bugs.kde.org/show_bug.cgi?id=508638 Not fully resolved, making progress. --- coregrind/m_aspacemgr/aspacemgr-linux.c | 26 ++++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index bae4f781a..4e5efaafe 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -1726,19 +1726,6 @@ Addr VG_(am_startup) ( Addr sp_at_startup ) // so we can't use these syscalls. Maybe one day when all supported platforms // have them. -#if 0 - // this block implements what is described above - // note this needs - // #include "pub_core_libcproc.h" - SizeT kern_maxssiz; - SizeT kern_sgrowsiz; - SizeT sysctl_size = sizeof(SizeT); - VG_(sysctlbyname)("kern.maxssiz", &kern_maxssiz, &sysctl_size, NULL, 0); - VG_(sysctlbyname)("kern.sgrowsiz", &kern_sgrowsiz, &sysctl_size, NULL, 0); - VG_(printf)("maxssiz %lx\n", kern_maxssiz); - //suggested_clstack_end = aspacem_maxAddr - (kern_maxssiz - kern_sgrowsiz) + VKI_PAGE_SIZE; -#endif - // on amd64 we have oodles of space and just shove the new stack somewhere out of the way // x86 is far more constrained, and we put the new stack just below the stack passed in to V // except that it has stack space and the growth stack guard below it as decribed above @@ -1748,7 +1735,18 @@ Addr VG_(am_startup) ( Addr sp_at_startup ) suggested_clstack_end = aspacem_maxAddr - 64*1024*1024UL + VKI_PAGE_SIZE; #else - suggested_clstack_end = aspacem_maxAddr; + //suggested_clstack_end = aspacem_maxAddr; + // this block implements what is described above + // note this needs + // #include "pub_core_libcproc.h" + SizeT kern_maxssiz; + SizeT kern_sgrowsiz; + SizeT sysctl_size = sizeof(SizeT); + VG_(sysctlbyname)("kern.maxssiz", &kern_maxssiz, &sysctl_size, NULL, 0); + VG_(sysctlbyname)("kern.sgrowsiz", &kern_sgrowsiz, &sysctl_size, NULL, 0); + //VG_(printf)("maxssiz %lx\n", kern_maxssiz); + suggested_clstack_end = aspacem_maxAddr - (kern_maxssiz - kern_sgrowsiz) + VKI_PAGE_SIZE; + #endif // --- Solaris ------------------------------------------ From 017c4b5e9fa1e3f01a19c5f9b9f4b8d918acea98 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 26 Aug 2025 07:38:32 +0200 Subject: [PATCH 211/412] FreeBSD regtest: turn off uninitilised warnings for readlinkat test --- none/tests/freebsd/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/none/tests/freebsd/Makefile.am b/none/tests/freebsd/Makefile.am index a575f4097..5c46d27d3 100644 --- a/none/tests/freebsd/Makefile.am +++ b/none/tests/freebsd/Makefile.am @@ -88,6 +88,7 @@ hello_world_SOURCES = hello_world.cpp open_client_SOURCES = open_client.cpp proc_pid_file_SOURCES = proc_pid_file.cpp readlinkat_SOURCES = readlinkat.cpp +readlinkat_CXXFLAGS = ${AM_CXXFLAGS} @FLAG_W_NO_UNINITIALIZED@ sanity_level_thread_SOURCES = sanity_level_thread.cpp sanity_level_thread_LDFLAGS = ${AM_LDFLAGS} -pthread From 8afbe743fadde2126848656f48a8236232c93f3b Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 26 Aug 2025 08:42:56 +0200 Subject: [PATCH 212/412] FreeBSD 64bit: client stack changes Just use system max stack size, but with a lower limit of 64Mb Add some -d -d traces --- coregrind/m_aspacemgr/aspacemgr-linux.c | 28 ++++++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index 4e5efaafe..785d75c70 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -1735,17 +1735,29 @@ Addr VG_(am_startup) ( Addr sp_at_startup ) suggested_clstack_end = aspacem_maxAddr - 64*1024*1024UL + VKI_PAGE_SIZE; #else - //suggested_clstack_end = aspacem_maxAddr; - // this block implements what is described above - // note this needs - // #include "pub_core_libcproc.h" + SizeT kern_maxssiz; - SizeT kern_sgrowsiz; + //SizeT kern_sgrowsiz; SizeT sysctl_size = sizeof(SizeT); VG_(sysctlbyname)("kern.maxssiz", &kern_maxssiz, &sysctl_size, NULL, 0); - VG_(sysctlbyname)("kern.sgrowsiz", &kern_sgrowsiz, &sysctl_size, NULL, 0); - //VG_(printf)("maxssiz %lx\n", kern_maxssiz); - suggested_clstack_end = aspacem_maxAddr - (kern_maxssiz - kern_sgrowsiz) + VKI_PAGE_SIZE; + if (kern_maxssiz < 64*1024*1024UL) { + kern_maxssiz = 64*1024*1024UL; + VG_(debugLog)(2, "aspacem", + " max stack size (maxssiz) set to lower limit, 64Mb\n"); + } + //VG_(sysctlbyname)("kern.sgrowsiz", &kern_sgrowsiz, &sysctl_size, NULL, 0); + // initially this was aspacem_maxAddr - (kern_maxssiz - kern_sgrowsiz) + VKI_PAGE_SIZE + // but we're not using / respecting the stack grow size (yet) + suggested_clstack_end = aspacem_maxAddr - (kern_maxssiz) + VKI_PAGE_SIZE; + VG_(debugLog)(2, "aspacem", + " max stack size (maxssiz) = 0x%lx\n", + kern_maxssiz); + //VG_(debugLog)(2, "aspacem", + // " stack grow size (sgrowsiz) = 0x%lx\n", + // kern_sgrowsiz); + VG_(debugLog)(2, "aspacem", + " suggested client stack end (aspacem_maxAddr - (kern_maxssiz) + VKI_PAGE_SIZE) = 0x%lx\n", + suggested_clstack_end); #endif From 7613f71848a903e578c207d2bc84e762f258042f Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 26 Aug 2025 13:13:49 +0200 Subject: [PATCH 213/412] Linux syscall: copy and paste error in openat2 fd_allowed check --- coregrind/m_syswrap/syswrap-linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 984acaefe..ff87ddf71 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -14175,7 +14175,7 @@ PRE(sys_openat2) if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) && *(Char *)(Addr)ARG2 != '/' && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "openat", tid, False)) + && !ML_(fd_allowed)(ARG1, "openat2", tid, False)) SET_STATUS_Failure( VKI_EBADF ); /* Handle the case where the open is of /proc/self/cmdline or /proc//cmdline, and just give it a copy of the fd for the From 17978c5520903586aa069bd5e5fde9105658c953 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 26 Aug 2025 13:32:07 +0200 Subject: [PATCH 214/412] Bug 508638 - Self-hosting not working on FreeBSD --- NEWS | 1 + coregrind/m_syswrap/syswrap-amd64-freebsd.c | 7 +++-- coregrind/m_syswrap/syswrap-freebsd.c | 30 +++++++++++++++------ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 853ba47d2..66912d73b 100644 --- a/NEWS +++ b/NEWS @@ -85,6 +85,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508030 Add several missing syscall hooks to ppc64-linux 508093 VALGRIND_CLO_CHANGE does not update vex_control 508154 PRE(sys_fchownat) not handling VKI_AT_FDCWD +508638 Self-hosting not working on FreeBSD To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-amd64-freebsd.c b/coregrind/m_syswrap/syswrap-amd64-freebsd.c index 71d1bc8b9..4d3c17848 100644 --- a/coregrind/m_syswrap/syswrap-amd64-freebsd.c +++ b/coregrind/m_syswrap/syswrap-amd64-freebsd.c @@ -983,12 +983,15 @@ POST(sys_procctl) // int mknodat(int fd, const char *path, mode_t mode, dev_t dev); PRE(sys_mknodat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4 ); PRE_REG_READ4(long, "mknodat", int, fd, const char *, path, vki_mode_t, mode, vki_dev_t, dev); PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 ); - if (!ML_(fd_allowed)(ARG1, "mknodat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) + if ((arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "mknodat", tid, False) ) + SET_STATUS_Failure(VKI_EBADF); } // SYS_cpuset_getdomain 561 diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index d92a1a46c..7fc96c7c5 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -5332,11 +5332,14 @@ POST(sys_freebsd11_fstatat) // int futimesat(int fd, const char *path, const struct timeval times[2]); PRE(sys_futimesat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_futimesat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ3(int, "futimesat", int, fd, const char *, path, struct timeval *, times); - if (!ML_(fd_allowed)(ARG1, "futimesat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) + if ((arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "futimesat", tid, False) ) + SET_STATUS_Failure(VKI_EBADF); if (ARG2 != 0) { PRE_MEM_RASCIIZ( "futimesat(path)", ARG2 ); } @@ -6189,11 +6192,15 @@ POST(sys_cap_fcntls_get) // int bindat(int fd, int s, const struct sockaddr *addr, socklen_t addrlen); PRE(sys_bindat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_bindat ( %" FMT_REGWORD "d, %" FMT_REGWORD "dx, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1, SARG2, ARG3, ARG4); PRE_REG_READ4(int, "bindat", int, fd, int, s, const struct vki_sockaddr *, name, vki_socklen_t, namelen); - if (!ML_(fd_allowed)(ARG1, "bindat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) + if ((arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "bindat", tid, False) ) + SET_STATUS_Failure(VKI_EBADF); + PRE_MEM_READ("bindat(name)", ARG3, ARG4); } @@ -6201,11 +6208,14 @@ PRE(sys_bindat) // int connectat(int fd, int s, const struct sockaddr *name, socklen_t namelen); PRE(sys_connectat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_connectat ( %" FMT_REGWORD "d, %" FMT_REGWORD "dx, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1, SARG2, ARG3, ARG4); PRE_REG_READ4(int, "connectat", int, fd, int, s, const struct vki_sockaddr *, name, vki_socklen_t, namelen); - if (!ML_(fd_allowed)(ARG1, "connectat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) + if ((arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "connectat", tid, False) ) + SET_STATUS_Failure(VKI_EBADF); PRE_MEM_READ("connectat(name)", ARG3, ARG4); } @@ -6213,11 +6223,15 @@ PRE(sys_connectat) // int chflagsat(int fd, const char *path, unsigned long flags, int atflag); PRE(sys_chflagsat) { + Int arg_1 = (Int)ARG1; + const HChar *path = (const HChar*)ARG2; PRINT("sys_chglagsat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %" FMT_REGWORD "d )", SARG1, ARG2, ARG3, SARG4); PRE_REG_READ4(int, "chflagsat", int, fd, const char *, path, unsigned long, flags, int, atflag); - if (!ML_(fd_allowed)(ARG1, "chflagsat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) + if ((arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "chflagsat", tid, False) ) + SET_STATUS_Failure(VKI_EBADF); + PRE_MEM_RASCIIZ("chflagsat(path)", ARG2); } From 456b68ece180a49595a238a4f1105105cd7025ca Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 26 Aug 2025 21:56:55 +0200 Subject: [PATCH 215/412] Linux syscalls: add checks for remaining *at() directory fd args --- coregrind/m_syswrap/syswrap-linux.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index ff87ddf71..d1e7c7529 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -114,6 +114,18 @@ static VgSchedReturnCode thread_wrapper(Word /*ThreadId*/ tidW) return ret; } +/* + * Used by *at() functions that take a firectory fd as a root for relative paths + * I did want to put this in pub_core_syswrap.h but that's difficult as + * it pulls in several dependent headers resulting in one that can't + * be accessed every place that uses this pub_core_syswrap.h + */ +static inline void fd_at_check_allowed(Int fd, const HChar* path, const HChar* function_name, ThreadId tid, SyscallStatus* status) +{ + if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) + if ((fd != VKI_AT_FDCWD) && !ML_(fd_allowed)(fd, function_name, tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); +} /* --------------------------------------------------------------------- clone-related stuff @@ -6182,6 +6194,7 @@ PRE(sys_mkdirat) *flags |= SfMayBlock; PRINT("sys_mkdirat ( %ld, %#" FMT_REGWORD "x(%s), %ld )", SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3); + fd_at_check_allowed(SARG1, (const HChar*)ARG2, "mkdirat", tid, status); PRE_REG_READ3(long, "mkdirat", int, dfd, const char *, pathname, int, mode); PRE_MEM_RASCIIZ( "mkdirat(pathname)", ARG2 ); @@ -6192,6 +6205,7 @@ PRE(sys_mknodat) FUSE_COMPATIBLE_MAY_BLOCK(); PRINT("sys_mknodat ( %ld, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4 ); + fd_at_check_allowed(SARG1, (const HChar*)ARG2, "mknodat", tid, status); PRE_REG_READ4(long, "mknodat", int, dfd, const char *, pathname, int, mode, unsigned, dev); PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 ); @@ -6243,6 +6257,7 @@ PRE(sys_utimensat) FMT_REGWORD "x )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "utimensat", int, dfd, char *, filename, struct timespec *, utimes, int, flags); + fd_at_check_allowed(SARG1, (const HChar*)ARG2, "utimensat", tid, status); if (ARG2 != 0) PRE_MEM_RASCIIZ( "utimensat(filename)", ARG2 ); if (ARG3 != 0) { @@ -6274,6 +6289,7 @@ PRE(sys_utimensat_time64) SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "utimensat_time64", int, dfd, char *, filename, struct timespec *, utimes, int, flags); + fd_at_check_allowed(SARG1, (const HChar*)ARG2, "utimensat_time64", tid, status); if (ARG2 != 0) PRE_MEM_RASCIIZ( "utimensat_time64(filename)", ARG2 ); if (ARG3 != 0) { @@ -6305,6 +6321,7 @@ PRE(sys_newfstatat) SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3); PRE_REG_READ3(long, "fstatat", int, dfd, char *, file_name, struct stat *, buf); + fd_at_check_allowed(SARG1, (const HChar*)ARG2, "newfstatat", tid, status); // See the comment about Rust in PRE(sys_statx). When glibc does support // statx rust uses that instead of the system call, but glibc's statx is // implemented in terms of fstatat, so the filename being NULL is @@ -6327,6 +6344,7 @@ PRE(sys_unlinkat) PRINT("sys_unlinkat ( %ld, %#" FMT_REGWORD "x(%s) )", SARG1, ARG2, (HChar*)(Addr)ARG2); PRE_REG_READ2(long, "unlinkat", int, dfd, const char *, pathname); + fd_at_check_allowed(SARG1, (const HChar*)ARG2, "unlinkat", tid, status); PRE_MEM_RASCIIZ( "unlinkat(pathname)", ARG2 ); } @@ -6339,6 +6357,7 @@ PRE(sys_renameat) PRE_REG_READ4(long, "renameat", int, olddfd, const char *, oldpath, int, newdfd, const char *, newpath); + fd_at_check_allowed(SARG1, (const HChar*)ARG2, "renameat", tid, status); PRE_MEM_RASCIIZ( "renameat(oldpath)", ARG2 ); PRE_MEM_RASCIIZ( "renameat(newpath)", ARG4 ); } @@ -6367,6 +6386,7 @@ PRE(sys_linkat) int, olddfd, const char *, oldpath, int, newdfd, const char *, newpath, int, flags); + fd_at_check_allowed(SARG1, (const HChar*)ARG2, "linkat", tid, status); PRE_MEM_RASCIIZ( "linkat(oldpath)", ARG2); PRE_MEM_RASCIIZ( "linkat(newpath)", ARG4); } @@ -6378,6 +6398,7 @@ PRE(sys_symlinkat) "x(%s) )", ARG1, (HChar*)(Addr)ARG1, SARG2, ARG3, (HChar*)(Addr)ARG3); PRE_REG_READ3(long, "symlinkat", const char *, oldpath, int, newdfd, const char *, newpath); + fd_at_check_allowed(SARG1, (const HChar*)ARG2, "symlinkat", tid, status); PRE_MEM_RASCIIZ( "symlinkat(oldpath)", ARG1 ); PRE_MEM_RASCIIZ( "symlinkat(newpath)", ARG3 ); } @@ -6389,6 +6410,7 @@ PRE(sys_readlinkat) FMT_REGWORD "u )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "readlinkat", int, dfd, const char *, path, char *, buf, vki_size_t, bufsiz); + fd_at_check_allowed(SARG1, (const HChar*)ARG2, "readlinkat", tid, status); PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 ); PRE_MEM_WRITE( "readlinkat(buf)", ARG3,ARG4 ); } @@ -13915,7 +13937,7 @@ POST(sys_io_uring_register) PRE(sys_execveat) { - PRINT("sys_execveat ( %lu, %#lx(%s), %#lx, %#lx, %lu", ARG1, ARG2, (char*)ARG2, ARG3, ARG4, ARG5); + PRINT("sys_execveat ( %lu, %#lx(%s), %#lx, %#lx, %lu", ARG1, ARG2, (char*)ARG2, ARG3, ARG4, ARG5); PRE_REG_READ5(vki_off_t, "execveat", int, fd, char *, filename, char **, argv, char **, envp, int, flags); PRE_MEM_RASCIIZ( "execveat(filename)", ARG2); From eed1c55a03c5fb3e4c48573a51ef040d094cd6ba Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 26 Aug 2025 22:11:50 +0200 Subject: [PATCH 216/412] Typo in comment. I did correct it, but didn't save before pushing. --- coregrind/m_syswrap/syswrap-linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index d1e7c7529..48c4048aa 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -115,7 +115,7 @@ static VgSchedReturnCode thread_wrapper(Word /*ThreadId*/ tidW) } /* - * Used by *at() functions that take a firectory fd as a root for relative paths + * Used by *at() functions that take a directory fd as a root for relative paths * I did want to put this in pub_core_syswrap.h but that's difficult as * it pulls in several dependent headers resulting in one that can't * be accessed every place that uses this pub_core_syswrap.h From 7389eabaf3190f6525c890a72aa4fccbc592d25a Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 26 Aug 2025 20:52:26 +0000 Subject: [PATCH 217/412] Fix Iop_ClzNat32/64 and Iop_CtzNat32/64 on x86 and amd64. Handle the special case of 0 operand. Fixes https://bugs.kde.org/show_bug.cgi?id=507033 --- VEX/priv/host_amd64_isel.c | 10 ++++++++++ VEX/priv/host_x86_isel.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/VEX/priv/host_amd64_isel.c b/VEX/priv/host_amd64_isel.c index f0e21ab98..113dc1bf3 100644 --- a/VEX/priv/host_amd64_isel.c +++ b/VEX/priv/host_amd64_isel.c @@ -1633,6 +1633,11 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, const IRExpr* e ) HReg dst = newVRegI(env); HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); addInstr(env, AMD64Instr_Bsfr64(True,src,dst)); + /* Patch the result in case there was a 0 operand. */ + IRExpr *cond = unop(Iop_CmpNEZ64, e->Iex.Unop.arg); + AMD64CondCode cc = iselCondCode_C(env, cond); + HReg ifz = iselIntExpr_R(env, IRExpr_Const(IRConst_U64(64))); + addInstr(env, AMD64Instr_CMov64(cc ^ 1, ifz, dst)); return dst; } case Iop_ClzNat64: { @@ -1647,6 +1652,11 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, const IRExpr* e ) AMD64RMI_Imm(63), dst)); addInstr(env, AMD64Instr_Alu64R(Aalu_SUB, AMD64RMI_Reg(tmp), dst)); + /* Patch the result in case there was a 0 operand. */ + IRExpr *cond = unop(Iop_CmpNEZ64, e->Iex.Unop.arg); + AMD64CondCode cc = iselCondCode_C(env, cond); + HReg ifz = iselIntExpr_R(env, IRExpr_Const(IRConst_U64(64))); + addInstr(env, AMD64Instr_CMov64(cc ^ 1, ifz, dst)); return dst; } diff --git a/VEX/priv/host_x86_isel.c b/VEX/priv/host_x86_isel.c index d35df8fc4..b80d1116a 100644 --- a/VEX/priv/host_x86_isel.c +++ b/VEX/priv/host_x86_isel.c @@ -1311,6 +1311,11 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, const IRExpr* e ) HReg dst = newVRegI(env); HReg src = iselIntExpr_R(env, e->Iex.Unop.arg); addInstr(env, X86Instr_Bsfr32(True,src,dst)); + /* Patch the result in case there was a 0 operand. */ + IRExpr *cond = unop(Iop_CmpNEZ32, e->Iex.Unop.arg); + X86CondCode cc = iselCondCode(env, cond); + X86RM *ifz = iselIntExpr_RM(env, IRExpr_Const(IRConst_U32(32))); + addInstr(env, X86Instr_CMov32(cc ^ 1, ifz, dst)); return dst; } case Iop_ClzNat32: { @@ -1325,6 +1330,11 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, const IRExpr* e ) X86RMI_Imm(31), dst)); addInstr(env, X86Instr_Alu32R(Xalu_SUB, X86RMI_Reg(tmp), dst)); + /* Patch the result in case there was a 0 operand. */ + IRExpr *cond = unop(Iop_CmpNEZ32, e->Iex.Unop.arg); + X86CondCode cc = iselCondCode(env, cond); + X86RM *ifz = iselIntExpr_RM(env, IRExpr_Const(IRConst_U32(32))); + addInstr(env, X86Instr_CMov32(cc ^ 1, ifz, dst)); return dst; } From b933af5d68a622f082dab40ef90499bc38d7a525 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 26 Aug 2025 21:02:09 +0000 Subject: [PATCH 218/412] iropt-test: Enable for x86 and amd64. --- none/tests/iropt-test/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/none/tests/iropt-test/main.c b/none/tests/iropt-test/main.c index 29bc1c71f..d446fd78f 100644 --- a/none/tests/iropt-test/main.c +++ b/none/tests/iropt-test/main.c @@ -45,8 +45,8 @@ unsigned num_random_tests; int main(int argc, char *argv[]) { -// FIXME: temporarily until ppc,amd64,x86 have been fixed -#if !defined(__s390x__) +// FIXME: temporarily until ppc has been fixed +#if !defined(__s390x__) && !defined(__i386__) && !defined(__x86_64__) return 0; #endif assert(sizeof(long long) == 8); From 2a898f1d601a1fddc5437b3e2adc357eced40497 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 28 Aug 2025 21:33:43 +0200 Subject: [PATCH 219/412] Bug 507869 - Various at syscalls don't check dirfd argument --- NEWS | 1 + coregrind/m_syswrap/syswrap-arm-linux.c | 5 +++++ coregrind/m_syswrap/syswrap-linux.c | 11 +++++++++++ coregrind/m_syswrap/syswrap-mips32-linux.c | 5 +++++ coregrind/m_syswrap/syswrap-ppc32-linux.c | 5 +++++ coregrind/m_syswrap/syswrap-x86-linux.c | 5 +++++ 6 files changed, 32 insertions(+) diff --git a/NEWS b/NEWS index 66912d73b..46f466cca 100644 --- a/NEWS +++ b/NEWS @@ -77,6 +77,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 507721 Wire up illumos and Solaris mallinfo 507853 faccessat and faccessat2 should handle AT_FDCWD and absolute paths 507868 futimesat doesn't handle AT_FDCWD +507869 Various at syscalls don't check dirfd argument 507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD 507897 Allow for patching LTP sources 507970 -Wcalloc-transposed-args warnings in valgrind-di-server.c diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 4ba9801ce..1fca10183 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -284,6 +284,11 @@ PRE(sys_fstatat64) SARG1, ARG2, (HChar*)ARG2, ARG3); PRE_REG_READ3(long, "fstatat64", int, dfd, char *, file_name, struct stat64 *, buf); + if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) + && *(Char *)(Addr)ARG2 != '/' + && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) + && !ML_(fd_allowed)(ARG1, "fstatat64", tid, False)) + SET_STATUS_Failure( VKI_EBADF ); PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 ); PRE_MEM_WRITE( "fstatat64(buf)", ARG3, sizeof(struct vki_stat64) ); } diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 48c4048aa..f876f839b 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -6372,6 +6372,17 @@ PRE(sys_renameat2) int, olddfd, const char *, oldpath, int, newdfd, const char *, newpath, unsigned int, flags); + if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) + && *(Char *)(Addr)ARG2 != '/' + && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) + && !ML_(fd_allowed)(ARG1, "renameat2(olddfd)", tid, False)) + SET_STATUS_Failure( VKI_EBADF ); + if (ML_(safe_to_deref)( (void*)(Addr)ARG4, 1 ) + && *(Char *)(Addr)ARG4 != '/' + && ((Int)ARG3) != ((Int)VKI_AT_FDCWD) + && !ML_(fd_allowed)(ARG3, "renameat2(newsfd)", tid, False)) + SET_STATUS_Failure( VKI_EBADF ); + PRE_MEM_RASCIIZ( "renameat2(oldpath)", ARG2 ); PRE_MEM_RASCIIZ( "renameat2(newpath)", ARG4 ); } diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 13cb5d05b..59c7d4e97 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -551,6 +551,11 @@ PRE(sys_fstatat64) SARG1, ARG2, (HChar*)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "fstatat64", int, dfd, char *, file_name, struct stat64 *, buf, int, flags); + if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) + && *(Char *)(Addr)ARG2 != '/' + && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) + && !ML_(fd_allowed)(ARG1, "fstatat64", tid, False)) + SET_STATUS_Failure( VKI_EBADF ); PRE_MEM_RASCIIZ ("fstatat64(file_name)", ARG2); PRE_MEM_WRITE ("fstatat64(buf)", ARG3, sizeof (struct vki_stat64)); } diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index 00d0f56d7..b6c3401b8 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -315,6 +315,11 @@ PRE(sys_fstatat64) ARG3); PRE_REG_READ3(long, "fstatat64", int, dfd, char *, file_name, struct stat64 *, buf); + if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) + && *(Char *)(Addr)ARG2 != '/' + && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) + && !ML_(fd_allowed)(ARG1, "fstatat64", tid, False)) + SET_STATUS_Failure( VKI_EBADF ); PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 ); PRE_MEM_WRITE( "fstatat64(buf)", ARG3, sizeof(struct vki_stat64) ); } diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 9b8c9d861..867c31d06 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1032,6 +1032,11 @@ PRE(sys_fstatat64) SARG1, ARG2, (HChar*)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "fstatat64", int, dfd, char *, file_name, struct stat64 *, buf, int, flags); + if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) + && *(Char *)(Addr)ARG2 != '/' + && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) + && !ML_(fd_allowed)(ARG1, "fstatat64", tid, False)) + SET_STATUS_Failure( VKI_EBADF ); PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 ); PRE_MEM_WRITE( "fstatat64(buf)", ARG3, sizeof(struct vki_stat64) ); } From bbf3cf234eacc97a652437c4f5e626c43b1bc76d Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 28 Aug 2025 20:17:29 +0000 Subject: [PATCH 220/412] iropt-test: Constant folding for Iop_DivModU64to32 and Iop_DivModS64to32 Function get_selected_values has been tweaked to return more "interesting" values for test generation. Namely those that, when interpreted as a signed integer, are boundary (or near boundary) values. Also a bit of reorg because for the DivMod.. IROps we need to be a bit more careful when generating testcases that do not trap or where the result does not fit in 32 bit. Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- VEX/priv/ir_opt.c | 33 ++++++++++++++++++ none/tests/iropt-test/binary.c | 61 +++++++++++++++++++++++++++------ none/tests/iropt-test/irops.tab | 4 +-- none/tests/iropt-test/main.c | 2 +- none/tests/iropt-test/util.c | 16 +++++++-- 5 files changed, 99 insertions(+), 17 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 100f6396f..5056b677b 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2161,6 +2161,39 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) break; } + /* -- DivMod -- */ + case Iop_DivModU64to32: { + ULong u64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64; + UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32; + if (u32b != 0) { + ULong q = u64a / u32b; + /* Can q be represented in 32 bit? */ + if (q <= 0xFFFFFFFF) { + UInt r = u64a % u32b; + e2 = IRExpr_Const(IRConst_U64(((ULong)r << 32) | (UInt)q)); + } + } + break; + } + case Iop_DivModS64to32: { + Long s64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64; + Int s32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32; + if (s32b != 0) { + /* Division may trap when result overflows i.e. when + attempting: INT64_MAX / -1 */ + if (e->Iex.Binop.arg1->Iex.Const.con->Ico.U64 == (1ULL << 63) + && s32b == -1) + break; + Long q = s64a / s32b; + /* Can q be represented in 32 bit? */ + if (q >= (-2147483647-1) && q <= 2147483647) { + Int r = s64a % s32b; + e2 = IRExpr_Const(IRConst_U64(((ULong)r << 32) | (UInt)q)); + } + } + break; + } + /* -- Shl -- */ case Iop_Shl8: vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8); diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c index 896d57630..1fbe1341f 100644 --- a/none/tests/iropt-test/binary.c +++ b/none/tests/iropt-test/binary.c @@ -30,7 +30,7 @@ static uint64_t get_expected_value(const irop_t *, const test_data_t *); static void run_tests(const irop_t *, test_data_t *); static void run_shift_tests(const irop_t *, test_data_t *); static int is_shift_op(IROp); -static int is_division_op(IROp); +static int ok_to_run(IROp op, uint64_t, uint64_t); void @@ -57,9 +57,8 @@ run_selected_tests(const irop_t *op, test_data_t *data) for (unsigned j = 0; j < num_val_r; ++j) { opnd_r->value = values_r[j]; - if (is_division_op(op->op) && opnd_r->value == 0) continue; - - valgrind_execute_test(op, data, get_expected_value(op, data)); + if (ok_to_run(op->op, opnd_l->value, opnd_r->value)) + valgrind_execute_test(op, data, get_expected_value(op, data)); } } } @@ -75,13 +74,15 @@ run_random_tests(const irop_t *op, test_data_t *data) /* 1-bit wide operands are tested exhaustively. Skip random tests. */ if (opnd_l->type == Ity_I1 && opnd_r->type == Ity_I1) return; - for (unsigned i = 0; i < num_random_tests; ++i) { + unsigned num_tests = 0; + while (num_tests < num_random_tests) { opnd_l->value = get_random_value(opnd_l->type); opnd_r->value = get_random_value(opnd_r->type); - if (is_division_op(op->op) && opnd_r->value == 0) continue; - - valgrind_execute_test(op, data, get_expected_value(op, data)); + if (ok_to_run(op->op, opnd_l->value, opnd_r->value)) { + valgrind_execute_test(op, data, get_expected_value(op, data)); + ++num_tests; + } } } @@ -214,6 +215,20 @@ get_expected_value(const irop_t *op, const test_data_t *data) expected = (int64_t)(opnd_l << 32) / (int32_t)opnd_r; break; + case Iop_DivModU64to32: { + uint64_t q = opnd_l / opnd_r; + uint64_t r = opnd_l % opnd_r; + expected = (r << 32) | q; + break; + } + + case Iop_DivModS64to32: { + int64_t q = (int64_t)opnd_l / (int32_t)opnd_r; + int32_t r = (int64_t)opnd_l % (int32_t)opnd_r; + expected = ((uint64_t)r << 32) | (uint32_t)q; + break; + } + case Iop_Shl8: case Iop_Shl16: case Iop_Shl32: @@ -401,15 +416,39 @@ is_shift_op(IROp op) static int -is_division_op(IROp op) +ok_to_run(IROp op, uint64_t o1, uint64_t o2) { switch (op) { + /* Division by zero -- not good */ case Iop_DivU32: case Iop_DivU64: case Iop_DivS32: case Iop_DivS64: case Iop_DivU32E: case Iop_DivS32E: - return 1; + return o2 != 0; + + /* Check that result can be represented */ + case Iop_DivModU64to32: { + uint64_t dividend = o1; + uint32_t divisor = o2; + + if (divisor == 0) return 0; + uint64_t q = dividend / divisor; // always safe + return q <= UINT32_MAX; + } + + case Iop_DivModS64to32: { + int64_t dividend = o1; + int32_t divisor = o2; + + if (divisor == 0) return 0; + /* Division may trap on overflow */ + if (divisor == -1 && o1 == (0x1ULL << 63)) // INT64_MIN + return 0; + int64_t q = dividend / divisor; + return q <= INT32_MAX && q >= INT32_MIN; + } + default: - return 0; + return 1; } } diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index 4163edfcd..9f833b5cb 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -176,12 +176,12 @@ // { OPNAME(DivS128E), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit // { OPNAME(DivModU32to32), Ity_I64, 2, Ity_I32, Ity_I64 }, // no folding yet -// { OPNAME(DivModU64to32), Ity_I64, 2, Ity_I32, Ity_I64 }, // no folding yet + { OPNAME(DivModU64to32), Ity_I64, 2, Ity_I64, Ity_I32, EXCEPT(ppc) }, // { OPNAME(DivModU64to64), Ity_I64, 2, Ity_I64, Ity_I128 }, // 128 bit // { OPNAME(DivModU128to64), Ity_I128, 2, Ity_I64, Ity_I128 }, // 128 bit // { OPNAME(DivModS32to32), Ity_I64, 2, Ity_I32, Ity_I32 }, // no folding yet -// { OPNAME(DivModS32to32), Ity_I64, 2, Ity_I32, Ity_I64 }, // no folding yet + { OPNAME(DivModS64to32), Ity_I64, 2, Ity_I64, Ity_I32, EXCEPT(ppc) }, // { OPNAME(DivModS64to64), Ity_I64, 2, Ity_I64, Ity_I128 }, // 128 bit // { OPNAME(DivModU128to64), Ity_I128, 2, Ity_I64, Ity_I128 }, // 128 bit diff --git a/none/tests/iropt-test/main.c b/none/tests/iropt-test/main.c index d446fd78f..1ca97e9c0 100644 --- a/none/tests/iropt-test/main.c +++ b/none/tests/iropt-test/main.c @@ -125,7 +125,7 @@ check_irops_table(void) if (op->result_type != t_res || op->opnd1_type != t_opnd1 || (op->num_opnds == 2 && op->opnd2_type != t_opnd2)) - fprintf(stderr, "%s: type mismatch\n", op->name); + panic("%s: type mismatch\n", op->name); } } diff --git a/none/tests/iropt-test/util.c b/none/tests/iropt-test/util.c index 4ce30e2a5..275c2b4cb 100644 --- a/none/tests/iropt-test/util.c +++ b/none/tests/iropt-test/util.c @@ -103,18 +103,28 @@ get_selected_values(IRType type, unsigned *num_val) { static const uint64_t values_1bit[] = { 0, 1 }; static const uint64_t values_8bit[] = { 0, 1, 2, - UINT8_MAX - 1, UINT8_MAX }; + INT8_MAX - 1, INT8_MAX, (uint8_t)INT8_MIN, (uint8_t)INT8_MIN + 1, + UINT8_MAX - 1, UINT8_MAX }; static const uint64_t values_16bit[] = { 0, 1, 2, + INT8_MAX - 1, INT8_MAX, (uint8_t)INT8_MIN, (uint8_t)INT8_MIN + 1, UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1, + INT16_MAX - 1, INT16_MAX, (uint16_t)INT16_MIN, (uint16_t)INT16_MIN + 1, UINT16_MAX - 1, UINT16_MAX }; static const uint64_t values_32bit[] = { 0, 1, 2, - UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1, + INT8_MAX - 1, INT8_MAX, (uint8_t)INT8_MIN, (uint8_t)INT8_MIN + 1, + UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1, + INT16_MAX - 1, INT16_MAX, (uint16_t)INT16_MIN, (uint16_t)INT16_MIN + 1, UINT16_MAX - 1, UINT16_MAX, UINT16_MAX + 1, + INT32_MAX - 1, INT32_MAX, (uint32_t)INT32_MIN, (uint32_t)INT32_MIN + 1, UINT32_MAX - 1, UINT32_MAX }; static const uint64_t values_64bit[] = { 0, 1, 2, - UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1, + INT8_MAX - 1, INT8_MAX, (uint8_t)INT8_MIN, (uint8_t)INT8_MIN + 1, + UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1, + INT16_MAX - 1, INT16_MAX, (uint16_t)INT16_MIN, (uint16_t)INT16_MIN + 1, UINT16_MAX - 1, UINT16_MAX, UINT16_MAX + 1, + INT32_MAX - 1, INT32_MAX, (uint32_t)INT32_MIN, (uint32_t)INT32_MIN + 1, UINT32_MAX - 1, UINT32_MAX, (uint64_t)UINT32_MAX + 1, + INT64_MAX - 1, INT64_MAX, (uint64_t)INT64_MIN, (uint64_t)INT64_MIN + 1, UINT64_MAX - 1, UINT64_MAX }; switch (type) { From 9f5d3d32b5bd5bc546eea74a8f75e53d4a228519 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 29 Aug 2025 07:59:28 +0200 Subject: [PATCH 221/412] Linux FreeBSD and Darwin: refactor *at syscall dirfd checks I haven't done Solaris. The code there is less messy because Solaris doesn't use a negative value for AT_FDCWD, meaning no explicit or implicit cast from unsigned word to signed int is needed before comparing to the int dirfd parameter. --- coregrind/m_syswrap/priv_syswrap-generic.h | 11 ++ coregrind/m_syswrap/syswrap-amd64-freebsd.c | 6 +- coregrind/m_syswrap/syswrap-arm-linux.c | 5 +- coregrind/m_syswrap/syswrap-arm64-freebsd.c | 6 +- coregrind/m_syswrap/syswrap-darwin.c | 36 +---- coregrind/m_syswrap/syswrap-freebsd.c | 149 ++++---------------- coregrind/m_syswrap/syswrap-generic.c | 6 + coregrind/m_syswrap/syswrap-linux.c | 114 ++++----------- coregrind/m_syswrap/syswrap-mips32-linux.c | 6 +- coregrind/m_syswrap/syswrap-ppc32-linux.c | 6 +- coregrind/m_syswrap/syswrap-x86-freebsd.c | 6 +- coregrind/m_syswrap/syswrap-x86-linux.c | 6 +- 12 files changed, 81 insertions(+), 276 deletions(-) diff --git a/coregrind/m_syswrap/priv_syswrap-generic.h b/coregrind/m_syswrap/priv_syswrap-generic.h index eb815840d..9dbc1e6f2 100644 --- a/coregrind/m_syswrap/priv_syswrap-generic.h +++ b/coregrind/m_syswrap/priv_syswrap-generic.h @@ -59,6 +59,17 @@ extern Bool ML_(fd_allowed)(Int fd, const HChar *syscallname, ThreadId tid, Bool isNewFD); +// used bye "*at" syscalls that take a directory fd for use +// with relative paths. Need to check that +// 1. the path is relative +// 2. the directory is not the specail value VKI_AT_FDCWD +// 3. the directory fd is allowd (as above) +extern +void ML_(fd_at_check_allowed)(Int fd, const HChar* path, + const HChar* function_name, ThreadId tid, + SyscallStatus* status); + + extern void ML_(record_fd_close) (ThreadId tid, Int fd); extern Int ML_(get_fd_count) (void); extern void ML_(record_fd_close_range) (ThreadId tid, Int fd); diff --git a/coregrind/m_syswrap/syswrap-amd64-freebsd.c b/coregrind/m_syswrap/syswrap-amd64-freebsd.c index 4d3c17848..b2fc6114f 100644 --- a/coregrind/m_syswrap/syswrap-amd64-freebsd.c +++ b/coregrind/m_syswrap/syswrap-amd64-freebsd.c @@ -983,15 +983,11 @@ POST(sys_procctl) // int mknodat(int fd, const char *path, mode_t mode, dev_t dev); PRE(sys_mknodat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4 ); PRE_REG_READ4(long, "mknodat", int, fd, const char *, path, vki_mode_t, mode, vki_dev_t, dev); PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 ); - if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) - if ((arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "mknodat", tid, False) ) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mknodat", tid, status); } // SYS_cpuset_getdomain 561 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 1fca10183..1aae03c02 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -284,10 +284,7 @@ PRE(sys_fstatat64) SARG1, ARG2, (HChar*)ARG2, ARG3); PRE_REG_READ3(long, "fstatat64", int, dfd, char *, file_name, struct stat64 *, buf); - if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && *(Char *)(Addr)ARG2 != '/' - && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "fstatat64", tid, False)) + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat64", tid, status); SET_STATUS_Failure( VKI_EBADF ); PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 ); PRE_MEM_WRITE( "fstatat64(buf)", ARG3, sizeof(struct vki_stat64) ); diff --git a/coregrind/m_syswrap/syswrap-arm64-freebsd.c b/coregrind/m_syswrap/syswrap-arm64-freebsd.c index 6054c641e..fe2d16194 100644 --- a/coregrind/m_syswrap/syswrap-arm64-freebsd.c +++ b/coregrind/m_syswrap/syswrap-arm64-freebsd.c @@ -949,17 +949,13 @@ POST(sys_procctl) // int mknodat(int fd, const char *path, mode_t mode, dev_t dev); PRE(sys_mknodat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1, ARG2, (char*)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "mknodat", int, fd, const char*, path, vki_mode_t, mode, vki_dev_t, dev); PRE_MEM_RASCIIZ("mknodat(pathname)", ARG2); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "mknodat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mknodat", tid, status); } // SYS_cpuset_getdomain 561 diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index ba90495bb..761965d61 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -9858,29 +9858,21 @@ POST(getattrlistbulk) PRE(faccessat) { - Int fd = ARG1; PRINT("faccessat(fd:%d, path:%#lx(%s), amode:%#lx, flag:%#lx)", fd, ARG2, ARG2 ? (HChar*)ARG2 : "null", ARG3, ARG4); PRE_REG_READ4(int, "faccessat", int, fd, user_addr_t, path, int, amode, int, flag); - - if (fd != VKI_AT_FDCWD && !ML_(fd_allowed)(fd, "faccessat", tid, False)) { - SET_STATUS_Failure( VKI_EBADF ); - } + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "faccessat", tid, status); PRE_MEM_RASCIIZ( "faccessat(path)", ARG2 ); } PRE(fstatat64) { - Int fd = ARG1; PRINT("fstatat64(fd:%d, path:%#lx(%s), ub:%#lx, flag:%#lx)", fd, ARG2, ARG2 ? (HChar*)ARG2 : "null", ARG3, ARG4); PRE_REG_READ4(int, "fstatat64", int, fd, user_addr_t, path, user_addr_t, ub, int, flag); - - if (fd != VKI_AT_FDCWD && !ML_(fd_allowed)(fd, "fstatat64", tid, False)) { - SET_STATUS_Failure( VKI_EBADF ); - } + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat64", tid, status); PRE_MEM_RASCIIZ( "fstatat64(path)", ARG2 ); PRE_MEM_WRITE( "fstatat64(ub)", ARG3, sizeof(struct vki_stat64) ); } @@ -9891,15 +9883,11 @@ POST(fstatat64) PRE(readlinkat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("readlinkat ( %ld, %#lx(%s), %#lx, %ld )", SARG1, ARG2, (HChar*)ARG2, ARG3, SARG4); PRE_REG_READ4(long, "readlinkat", int, dfd, const char *, path, char *, buf, int, bufsiz); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "readlinkat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "readlinkat", tid, status); PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 ); PRE_MEM_WRITE( "readlinkat(buf)", ARG3,ARG4 ); @@ -10010,11 +9998,7 @@ PRE(openat) /* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD, filename is relative to cwd. When comparing dfd against AT_FDCWD, be sure only to compare the bottom 32 bits. */ - if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && *(Char *)(Addr)ARG2 != '/' - && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "openat", tid, False)) - SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "openat", tid, status); /* Otherwise handle normally */ *flags |= SfMayBlock; @@ -10035,14 +10019,10 @@ POST(openat) PRE(mkdirat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("mkdirat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ3(int, "mkdirat", int, fd, const char *, path, unsigned int, mode); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "symlinkat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mkdirat", tid, status); PRE_MEM_RASCIIZ( "mkdirat(path)", ARG2 ); *flags |= SfMayBlock; } @@ -10500,11 +10480,7 @@ PRE(openat_nocancel) /* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD, filename is relative to cwd. When comparing dfd against AT_FDCWD, be sure only to compare the bottom 32 bits. */ - if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && *(Char *)(Addr)ARG2 != '/' - && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "openat_nocancel", tid, False)) - SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "openat_nocancel", tid, status); /* Otherwise handle normally */ *flags |= SfMayBlock; diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 7fc96c7c5..8934b76ad 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -5186,14 +5186,10 @@ POST(sys_cpuset) // int faccessat(int fd, const char *path, int mode, int flag); PRE(sys_faccessat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_faccessat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ3(int, "faccessat", int, fd, const char *, path, int, flag); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "faccessat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "faccessat", tid, status); PRE_MEM_RASCIIZ( "faccessat(path)", ARG2 ); } @@ -5201,14 +5197,10 @@ PRE(sys_faccessat) // int fchmodat(int fd, const char *path, mode_t mode, int flag); PRE(sys_fchmodat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_fchmodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ4(int, "fchmodat", int, fd, const char *, path, vki_mode_t, mode, int, flag); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "fchmodat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fchmodat", tid, status); PRE_MEM_RASCIIZ( "fchmodat(path)", ARG2 ); } @@ -5216,13 +5208,9 @@ PRE(sys_fchmodat) // int fchownat(int fd, const char *path, uid_t owner, gid_t group, int flag); PRE(sys_fchownat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_fchownat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x, %" FMT_REGWORD "d )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4, SARG5); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "fchownat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fchownat", tid, status); PRE_REG_READ5(int, "fchownat", int, fd, const char *, path, vki_uid_t, owner, vki_gid_t, group, int, flag); @@ -5311,14 +5299,10 @@ PRE(sys_fexecve) // int fstatat(int fd, const char *path, struct stat *sb, int flag); PRE(sys_freebsd11_fstatat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_freebsd11_fstatat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ4(int, "fstatat", int, fd, const char *, path, struct freebsd11_stat *, buf, int, flag); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "freebsd11_fstatat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "freebsd11_fstatat", tid, status); PRE_MEM_RASCIIZ( "freebsd11_fstatat(path)", ARG2 ); PRE_MEM_WRITE( "freebsd11_fstatat(sb)", ARG3, sizeof(struct vki_freebsd11_stat) ); } @@ -5332,14 +5316,10 @@ POST(sys_freebsd11_fstatat) // int futimesat(int fd, const char *path, const struct timeval times[2]); PRE(sys_futimesat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_futimesat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ3(int, "futimesat", int, fd, const char *, path, struct timeval *, times); - if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) - if ((arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "futimesat", tid, False) ) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "futimesat", tid, status); if (ARG2 != 0) { PRE_MEM_RASCIIZ( "futimesat(path)", ARG2 ); } @@ -5352,17 +5332,13 @@ PRE(sys_futimesat) // int linkat(int fd1, const char *name1, int fd2, const char *name2, int flag); PRE(sys_linkat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; *flags |= SfMayBlock; PRINT("sys_linkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )",ARG1,ARG2,(char*)ARG2,ARG3,ARG4,(char*)ARG4,ARG5); PRE_REG_READ5(int, "linkat", int, fd1, const char *, name1, int, fd2, const char *, name2, int, flag); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "linkat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "linkat", tid, status); PRE_MEM_RASCIIZ( "linkat(name1)", ARG2); PRE_MEM_RASCIIZ( "linkat(name2)", ARG4); } @@ -5371,15 +5347,11 @@ PRE(sys_linkat) // int mkdirat(int fd, const char *path, mode_t mode); PRE(sys_mkdirat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; *flags |= SfMayBlock; PRINT("sys_mkdirat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3); PRE_REG_READ3(int, "mkdirat", int, fd, const char *, path, unsigned int, mode); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "mkdirat", tid, False)) - SET_STATUS_Failure(VKI_EBADF);; + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mkdirat", tid, status); PRE_MEM_RASCIIZ( "mkdirat(path)", ARG2 ); } @@ -5387,13 +5359,9 @@ PRE(sys_mkdirat) // int mkfifoat(int fd, const char *path, mode_t mode); PRE(sys_mkfifoat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_mkfifoat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x )", SARG1,ARG2,(HChar*)ARG2,ARG3 ); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "mkfifoat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mkfifoat", tid, status); PRE_REG_READ3(int, "mkfifoat", int, fd, const char *, path, vki_mode_t, mode); PRE_MEM_RASCIIZ( "mkfifoat(path)", ARG2 ); @@ -5403,14 +5371,10 @@ PRE(sys_mkfifoat) // int mknodat(int fd, const char *path, mode_t mode, dev_t dev); PRE(sys_freebsd11_mknodat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_freebsd11_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4 ); PRE_REG_READ4(long, "freebsd11_mknodat", int, dfd, const char *, pathname, int, mode, unsigned, dev); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "freebsd11_mknodat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "freebsd11_mknodat", tid, status); PRE_MEM_RASCIIZ( "freebsd11_mknodat(pathname)", ARG2 ); } @@ -5462,20 +5426,7 @@ PRE(sys_openat) PRE_REG_READ3(int, "openat", int, fd, const char *, path, int, flags); } - Int arg_1 = (Int) ARG1; - const HChar *path = (const HChar*)ARG2; - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "openat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); - - /* For absolute filenames, dirfd is ignored. If dirfd is AT_FDCWD, - filename is relative to cwd. When comparing dirfd against AT_FDCWD, - be sure only to compare the bottom 32 bits. */ - if (ML_(safe_to_deref)((void*)(Addr)ARG2, 1) - && *(Char *)(Addr)ARG2 != '/' - && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "openat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "openat", tid, status); PRE_MEM_RASCIIZ("openat(path)", ARG2); /* Otherwise handle normally */ @@ -5502,16 +5453,12 @@ POST(sys_openat) // size_t bufsize); PRE(sys_readlinkat) { - Bool curproc_file = False; - Int arg_1 = (Int)ARG1; const HChar *path = (const HChar*)ARG2; PRINT("sys_readlinkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %llu )", ARG1,ARG2,(char*)ARG2,ARG3,(ULong)ARG4); PRE_REG_READ4(ssize_t, "readlinkat", int, fd, const char *, path, char *, buf, int, bufsize); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "readlinkat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "readlinkat", tid, status); PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 ); PRE_MEM_WRITE("readlinkat(buf)", ARG3, ARG4); @@ -5535,15 +5482,12 @@ POST(sys_readlinkat) // int renameat(int fromfd, const char *from, int tofd, const char *to); PRE(sys_renameat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_renameat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s) )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4,(char*)ARG4); PRE_REG_READ4(int, "renameat", int, fromfd, const char *, from, int, tofd, const char *, to); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "renameat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "renameat(fromfd)", tid, status); + ML_(fd_at_check_allowed)(SARG3, (const HChar*)ARG4, "renameat(tofd)", tid, status); PRE_MEM_RASCIIZ( "renameat(oldpath)", ARG2 ); PRE_MEM_RASCIIZ( "renameat(newpath)", ARG4 ); } @@ -5552,15 +5496,11 @@ PRE(sys_renameat) // int symlinkat(const char *name1, int fd, const char *name2); PRE(sys_symlinkat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; *flags |= SfMayBlock; PRINT("sys_symlinkat ( %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s) )",ARG1,(char*)ARG1,ARG2,ARG3,(char*)ARG3); PRE_REG_READ3(int, "symlinkat", const char *, name1, int, fd, const char *, name2); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "symlinkat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "symlinkat", tid, status); PRE_MEM_RASCIIZ( "symlinkat(name1)", ARG1 ); PRE_MEM_RASCIIZ( "symlinkat(name2)", ARG3 ); } @@ -5569,12 +5509,9 @@ PRE(sys_symlinkat) // int unlinkat(int fd, const char *path, int flag); PRE(sys_unlinkat) { - *flags |= SfMayBlock; - Int arg_1 = (Int)ARG1; PRINT("sys_unlinkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u ", ARG1, ARG2, (char*)ARG2, ARG3); - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "unlinkat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "unlinkat", tid, status); PRE_REG_READ3(int, "unlinkat", int, fd, const char *, path, int, flag); PRE_MEM_RASCIIZ( "unlinkat(path)", ARG2 ); } @@ -6192,15 +6129,10 @@ POST(sys_cap_fcntls_get) // int bindat(int fd, int s, const struct sockaddr *addr, socklen_t addrlen); PRE(sys_bindat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_bindat ( %" FMT_REGWORD "d, %" FMT_REGWORD "dx, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1, SARG2, ARG3, ARG4); PRE_REG_READ4(int, "bindat", int, fd, int, s, const struct vki_sockaddr *, name, vki_socklen_t, namelen); - if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) - if ((arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "bindat", tid, False) ) - SET_STATUS_Failure(VKI_EBADF); - + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "bindat", tid, status); PRE_MEM_READ("bindat(name)", ARG3, ARG4); } @@ -6208,14 +6140,10 @@ PRE(sys_bindat) // int connectat(int fd, int s, const struct sockaddr *name, socklen_t namelen); PRE(sys_connectat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_connectat ( %" FMT_REGWORD "d, %" FMT_REGWORD "dx, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1, SARG2, ARG3, ARG4); PRE_REG_READ4(int, "connectat", int, fd, int, s, const struct vki_sockaddr *, name, vki_socklen_t, namelen); - if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) - if ((arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "connectat", tid, False) ) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "connectat", tid, status); PRE_MEM_READ("connectat(name)", ARG3, ARG4); } @@ -6223,15 +6151,10 @@ PRE(sys_connectat) // int chflagsat(int fd, const char *path, unsigned long flags, int atflag); PRE(sys_chflagsat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_chglagsat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %" FMT_REGWORD "d )", SARG1, ARG2, ARG3, SARG4); PRE_REG_READ4(int, "chflagsat", int, fd, const char *, path, unsigned long, flags, int, atflag); - if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) - if ((arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "chflagsat", tid, False) ) - SET_STATUS_Failure(VKI_EBADF); - + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "chflagsat", tid, status); PRE_MEM_RASCIIZ("chflagsat(path)", ARG2); } @@ -6372,8 +6295,7 @@ PRE(sys_utimensat) SARG1, ARG2, ARG3, SARG4); PRE_REG_READ4(int, "utimensat", int, fd, const char *,path, const struct timespec *, times, int, flag); - if (!ML_(fd_allowed)(ARG1, "utimensat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "utimensat", tid, status); PRE_MEM_RASCIIZ("utimensat(path)", ARG2); PRE_MEM_READ("utimensat(times)", ARG3, 2*sizeof(struct vki_timespec)); } @@ -6406,14 +6328,10 @@ POST(sys_fstat) // int fstatat(int fd, const char *path, struct stat *sb, int flag); PRE(sys_fstatat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_fstatat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %" FMT_REGWORD "d )", SARG1,ARG2,(char*)ARG2,ARG3,SARG4); PRE_REG_READ4(int, "fstatat", int, fd, const char *, path, struct stat *, sb, int, flag); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "fstatat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat", tid, status); PRE_MEM_RASCIIZ( "fstatat(path)", ARG2 ); PRE_MEM_WRITE( "fstatat(sb)", ARG3, sizeof(struct vki_stat) ); } @@ -6598,13 +6516,9 @@ POST(sys_getrandom) // int getfhat(int fd, const char *path, fhandle_t *fhp, int flag); PRE(sys_getfhat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_getfhat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "x, %" FMT_REGWORD "d ", SARG1, ARG2, ARG3, SARG4); PRE_REG_READ4(int, "getfhat", int, fd, const char*, path, vki_fhandle_t*, fhp, int, flag); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "getfhat", tid, False)) - SET_STATUS_Failure(VKI_EBADF);; + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "getfhat", tid, status); PRE_MEM_RASCIIZ( "getfhat(path)", ARG2 ); PRE_MEM_WRITE("getfhat(fhp)", ARG3, sizeof(vki_fhandle_t)); } @@ -6653,15 +6567,11 @@ POST(sys_fhreadlink) // int funlinkat(int dfd, const char *path, int fd, int flag); PRE(sys_funlinkat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; *flags |= SfMayBlock; PRINT("sys_funlinkat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %" FMT_REGWORD"u )", SARG1, ARG2, (char*)ARG2, ARG4, ARG5); PRE_REG_READ4(int, "funlinkat", int, dfd, const char *, path, int, fd, int, flag); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "funlinkat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "funlinkat", tid, status); PRE_MEM_RASCIIZ( "funlinkat(path)", ARG2 ); } @@ -6838,15 +6748,11 @@ PRE(sys_sigfastblock) // int flags) PRE(sys___realpathat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys___realpathat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %" FMT_REGWORD "u %" FMT_REGWORD "d )", SARG1,ARG2,(const char*)ARG2,ARG3,ARG4,SARG5 ); PRE_REG_READ5(int, "__realpathat", int, fd, const char *, path, char *, buf, vki_size_t, size, int, flags); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "__realpathat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "__realpathat", tid, status); PRE_MEM_RASCIIZ("__realpathat(path)", (Addr)ARG2); PRE_MEM_WRITE("__realpathat(buf)", (Addr)ARG3, ARG4); } @@ -7282,17 +7188,10 @@ PRE(sys_exterrctl) // int inotify_add_watch_at(int fd, int dfd, _In_z_ const char *path, uint32_t mask); PRE(sys_inotify_add_watch_at) { - Int arg_2 = (Int)ARG2; - const HChar *path = (const HChar*)ARG3; PRINT("sys_inotify_add_watch_at(%" FMT_REGWORD "d, %" FMT_REGWORD "d, %" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x)", SARG1, SARG2, ARG3, (HChar*)ARG3, ARG4); PRE_REG_READ4(int, "inotify_add_watch_at", int, fd, int, dfd, const char*, path, uint32_t, mask); PRE_MEM_RASCIIZ("inotify_add_watch_at(path)", ARG3); - if (!ML_(fd_allowed)(ARG1, "inotify_add_watch_at", tid, False)) { - SET_STATUS_Failure( VKI_EBADF ); - } - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_2 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_2, "inotify_add_watch_at", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "inotify_add_watch_at", tid, status); } // SYS_inotify_rm_watch diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index c7d58bc10..c8c421c95 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -1794,6 +1794,12 @@ Bool ML_(fd_allowed)(Int fd, const HChar *syscallname, ThreadId tid, return allowed; } +void ML_(fd_at_check_allowed)(Int fd, const HChar* path, const HChar* function_name, ThreadId tid, SyscallStatus* status) +{ + if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) + if ((fd != VKI_AT_FDCWD) && !ML_(fd_allowed)(fd, function_name, tid, False)) + SET_STATUS_Failure(VKI_EBADF); +} /* --------------------------------------------------------------------- Deal with a bunch of socket-related syscalls diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index f876f839b..f5723f8cd 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -114,19 +114,6 @@ static VgSchedReturnCode thread_wrapper(Word /*ThreadId*/ tidW) return ret; } -/* - * Used by *at() functions that take a directory fd as a root for relative paths - * I did want to put this in pub_core_syswrap.h but that's difficult as - * it pulls in several dependent headers resulting in one that can't - * be accessed every place that uses this pub_core_syswrap.h - */ -static inline void fd_at_check_allowed(Int fd, const HChar* path, const HChar* function_name, ThreadId tid, SyscallStatus* status) -{ - if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) - if ((fd != VKI_AT_FDCWD) && !ML_(fd_allowed)(fd, function_name, tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); -} - /* --------------------------------------------------------------------- clone-related stuff ------------------------------------------------------------------ */ @@ -6125,11 +6112,7 @@ PRE(sys_openat) /* For absolute filenames, dirfd is ignored. If dirfd is AT_FDCWD, filename is relative to cwd. When comparing dirfd against AT_FDCWD, be sure only to compare the bottom 32 bits. */ - if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && *(Char *)(Addr)ARG2 != '/' - && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "openat", tid, False)) - SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "openat", tid, status); /* Handle the case where the open is of /proc/self/cmdline or /proc//cmdline, and just give it a copy of the fd for the @@ -6194,7 +6177,7 @@ PRE(sys_mkdirat) *flags |= SfMayBlock; PRINT("sys_mkdirat ( %ld, %#" FMT_REGWORD "x(%s), %ld )", SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3); - fd_at_check_allowed(SARG1, (const HChar*)ARG2, "mkdirat", tid, status); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mkdirat", tid, status); PRE_REG_READ3(long, "mkdirat", int, dfd, const char *, pathname, int, mode); PRE_MEM_RASCIIZ( "mkdirat(pathname)", ARG2 ); @@ -6205,7 +6188,7 @@ PRE(sys_mknodat) FUSE_COMPATIBLE_MAY_BLOCK(); PRINT("sys_mknodat ( %ld, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4 ); - fd_at_check_allowed(SARG1, (const HChar*)ARG2, "mknodat", tid, status); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mknodat", tid, status); PRE_REG_READ4(long, "mknodat", int, dfd, const char *, pathname, int, mode, unsigned, dev); PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 ); @@ -6213,41 +6196,28 @@ PRE(sys_mknodat) PRE(sys_fchownat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*) ARG2; FUSE_COMPATIBLE_MAY_BLOCK(); - PRINT("sys_fchownat ( %d, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" - FMT_REGWORD "x )", arg_1, ARG2, path, ARG3, ARG4); + PRINT("sys_fchownat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" + FMT_REGWORD "x )", SARG1, ARG2, (HChar*)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "fchownat", int, dfd, const char *, path, vki_uid_t, owner, vki_gid_t, group); PRE_MEM_RASCIIZ( "fchownat(path)", ARG2 ); - if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) - if ( (arg_1 != VKI_AT_FDCWD) && !ML_(fd_allowed)(arg_1, "fchownat", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fchownat", tid, status); } PRE(sys_futimesat) { FUSE_COMPATIBLE_MAY_BLOCK(); - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*) ARG2; - PRINT("sys_futimesat ( %d, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", - arg_1, ARG2, path, ARG3); + PRINT("sys_futimesat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", + SARG1, ARG2, (HChar*)ARG2, ARG3); PRE_REG_READ3(long, "futimesat", int, dfd, char *, filename, struct timeval *, tvp); if (ARG2 != 0) PRE_MEM_RASCIIZ( "futimesat(filename)", ARG2 ); if (ARG3 != 0) PRE_MEM_READ( "futimesat(tvp)", ARG3, 2 * sizeof(struct vki_timeval) ); - if (ML_(safe_to_deref) (path, 1)) { - /* If pathname is relative and dirfd is the special value AT_FDCWD, then pathname is interpreted ... */ - if (path[0] != '/') - if ( arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "futimesat", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); - /* If pathname is absolute, then dirfd is ignored. */ - } - + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "futimesat", tid, status); } PRE(sys_utimensat) @@ -6257,7 +6227,7 @@ PRE(sys_utimensat) FMT_REGWORD "x )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "utimensat", int, dfd, char *, filename, struct timespec *, utimes, int, flags); - fd_at_check_allowed(SARG1, (const HChar*)ARG2, "utimensat", tid, status); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "utimensat", tid, status); if (ARG2 != 0) PRE_MEM_RASCIIZ( "utimensat(filename)", ARG2 ); if (ARG3 != 0) { @@ -6289,7 +6259,7 @@ PRE(sys_utimensat_time64) SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "utimensat_time64", int, dfd, char *, filename, struct timespec *, utimes, int, flags); - fd_at_check_allowed(SARG1, (const HChar*)ARG2, "utimensat_time64", tid, status); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "utimensat_time64", tid, status); if (ARG2 != 0) PRE_MEM_RASCIIZ( "utimensat_time64(filename)", ARG2 ); if (ARG3 != 0) { @@ -6321,7 +6291,7 @@ PRE(sys_newfstatat) SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3); PRE_REG_READ3(long, "fstatat", int, dfd, char *, file_name, struct stat *, buf); - fd_at_check_allowed(SARG1, (const HChar*)ARG2, "newfstatat", tid, status); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "newfstatat", tid, status); // See the comment about Rust in PRE(sys_statx). When glibc does support // statx rust uses that instead of the system call, but glibc's statx is // implemented in terms of fstatat, so the filename being NULL is @@ -6344,7 +6314,7 @@ PRE(sys_unlinkat) PRINT("sys_unlinkat ( %ld, %#" FMT_REGWORD "x(%s) )", SARG1, ARG2, (HChar*)(Addr)ARG2); PRE_REG_READ2(long, "unlinkat", int, dfd, const char *, pathname); - fd_at_check_allowed(SARG1, (const HChar*)ARG2, "unlinkat", tid, status); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "unlinkat", tid, status); PRE_MEM_RASCIIZ( "unlinkat(pathname)", ARG2 ); } @@ -6357,7 +6327,7 @@ PRE(sys_renameat) PRE_REG_READ4(long, "renameat", int, olddfd, const char *, oldpath, int, newdfd, const char *, newpath); - fd_at_check_allowed(SARG1, (const HChar*)ARG2, "renameat", tid, status); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "renameat", tid, status); PRE_MEM_RASCIIZ( "renameat(oldpath)", ARG2 ); PRE_MEM_RASCIIZ( "renameat(newpath)", ARG4 ); } @@ -6372,17 +6342,8 @@ PRE(sys_renameat2) int, olddfd, const char *, oldpath, int, newdfd, const char *, newpath, unsigned int, flags); - if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && *(Char *)(Addr)ARG2 != '/' - && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "renameat2(olddfd)", tid, False)) - SET_STATUS_Failure( VKI_EBADF ); - if (ML_(safe_to_deref)( (void*)(Addr)ARG4, 1 ) - && *(Char *)(Addr)ARG4 != '/' - && ((Int)ARG3) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG3, "renameat2(newsfd)", tid, False)) - SET_STATUS_Failure( VKI_EBADF ); - + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "renameat2(olddirfd)", tid, status); + ML_(fd_at_check_allowed)(SARG3, (const HChar*)ARG4, "renameat2(newdirfd)", tid, status); PRE_MEM_RASCIIZ( "renameat2(oldpath)", ARG2 ); PRE_MEM_RASCIIZ( "renameat2(newpath)", ARG4 ); } @@ -6397,7 +6358,7 @@ PRE(sys_linkat) int, olddfd, const char *, oldpath, int, newdfd, const char *, newpath, int, flags); - fd_at_check_allowed(SARG1, (const HChar*)ARG2, "linkat", tid, status); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "linkat", tid, status); PRE_MEM_RASCIIZ( "linkat(oldpath)", ARG2); PRE_MEM_RASCIIZ( "linkat(newpath)", ARG4); } @@ -6409,7 +6370,7 @@ PRE(sys_symlinkat) "x(%s) )", ARG1, (HChar*)(Addr)ARG1, SARG2, ARG3, (HChar*)(Addr)ARG3); PRE_REG_READ3(long, "symlinkat", const char *, oldpath, int, newdfd, const char *, newpath); - fd_at_check_allowed(SARG1, (const HChar*)ARG2, "symlinkat", tid, status); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "symlinkat", tid, status); PRE_MEM_RASCIIZ( "symlinkat(oldpath)", ARG1 ); PRE_MEM_RASCIIZ( "symlinkat(newpath)", ARG3 ); } @@ -6421,7 +6382,7 @@ PRE(sys_readlinkat) FMT_REGWORD "u )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "readlinkat", int, dfd, const char *, path, char *, buf, vki_size_t, bufsiz); - fd_at_check_allowed(SARG1, (const HChar*)ARG2, "readlinkat", tid, status); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "readlinkat", tid, status); PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 ); PRE_MEM_WRITE( "readlinkat(buf)", ARG3,ARG4 ); } @@ -6459,13 +6420,7 @@ PRE(sys_fchmodat) PRE_REG_READ3(long, "fchmodat", int, dfd, const char *, path, vki_mode_t, mode); PRE_MEM_RASCIIZ( "fchmodat(path)", ARG2 ); - if (ML_(safe_to_deref) (path, 1)) { - // If pathname is relative and dirfd is the special value AT_FDCWD, then pathname is interpreted ... - if (path[0] != '/') - if ( arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "fchmodat", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); - // If pathname is absolute, then dirfd is ignored - } + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fchmodat", tid, status); } PRE(sys_cachestat) @@ -6490,23 +6445,15 @@ POST(sys_cachestat) PRE(sys_fchmodat2) { - Int arg_1 = (Int) ARG1; - const HChar *path = (const HChar*) ARG2; FUSE_COMPATIBLE_MAY_BLOCK(); - PRINT("sys_fchmodat2 ( %d, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %" + PRINT("sys_fchmodat2 ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %" FMT_REGWORD "u )", - arg_1, ARG2, path, ARG3, ARG4); + SARG1, ARG2, (const HChar*)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "fchmodat2", int, dfd, const char *, path, vki_mode_t, mode, unsigned int, flags); PRE_MEM_RASCIIZ( "fchmodat2(pathname)", ARG2 ); - if (ML_(safe_to_deref) (path, 1)) { - // If pathname is relative and dirfd is the special value AT_FDCWD, then pathname is interpreted ... - if (path[0] != '/') - if ( arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "fchmodat2", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); - // If pathname is absolute, then dirfd is ignored - } + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fchmodat2", tid, status); } PRE(sys_faccessat) @@ -6520,9 +6467,7 @@ PRE(sys_faccessat) PRE_REG_READ3(long, "faccessat", int, dfd, const char *, pathname, int, mode); PRE_MEM_RASCIIZ( "faccessat(pathname)", ARG2 ); - if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) - if ( arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "faccessat", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "faccessat", tid, status); } PRE(sys_faccessat2) @@ -6537,9 +6482,7 @@ PRE(sys_faccessat2) PRE_REG_READ4(long, "faccessat2", int, dfd, const char *, pathname, int, mode, int, flags); PRE_MEM_RASCIIZ( "faccessat2(pathname)", ARG2 ); - if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/')) - if ( arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "faccessat2", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "faccessat2", tid, status); } PRE(sys_name_to_handle_at) @@ -14205,11 +14148,8 @@ PRE(sys_openat2) /* For absolute filenames, dirfd is ignored. If dirfd is AT_FDCWD, filename is relative to cwd. When comparing dirfd against AT_FDCWD, be sure only to compare the bottom 32 bits. */ - if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && *(Char *)(Addr)ARG2 != '/' - && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "openat2", tid, False)) - SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "openat2", tid, status); + /* Handle the case where the open is of /proc/self/cmdline or /proc//cmdline, and just give it a copy of the fd for the fake file we cooked up at startup (in m_main). Also, seek the diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 59c7d4e97..09d292ea8 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -551,11 +551,7 @@ PRE(sys_fstatat64) SARG1, ARG2, (HChar*)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "fstatat64", int, dfd, char *, file_name, struct stat64 *, buf, int, flags); - if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && *(Char *)(Addr)ARG2 != '/' - && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "fstatat64", tid, False)) - SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat64", tid, status); PRE_MEM_RASCIIZ ("fstatat64(file_name)", ARG2); PRE_MEM_WRITE ("fstatat64(buf)", ARG3, sizeof (struct vki_stat64)); } diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index b6c3401b8..cb4410795 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -315,11 +315,7 @@ PRE(sys_fstatat64) ARG3); PRE_REG_READ3(long, "fstatat64", int, dfd, char *, file_name, struct stat64 *, buf); - if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && *(Char *)(Addr)ARG2 != '/' - && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "fstatat64", tid, False)) - SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat64", tid, status); PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 ); PRE_MEM_WRITE( "fstatat64(buf)", ARG3, sizeof(struct vki_stat64) ); } diff --git a/coregrind/m_syswrap/syswrap-x86-freebsd.c b/coregrind/m_syswrap/syswrap-x86-freebsd.c index 5ea0524c7..483ca67ec 100644 --- a/coregrind/m_syswrap/syswrap-x86-freebsd.c +++ b/coregrind/m_syswrap/syswrap-x86-freebsd.c @@ -1388,15 +1388,11 @@ POST(sys_procctl) // int mknodat(int fd, const char *path, mode_t mode, dev_t dev); PRE(sys_mknodat) { - Int arg_1 = (Int)ARG1; - const HChar *path = (const HChar*)ARG2; PRINT("sys_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4 ); PRE_REG_READ5(long, "mknodat", int, fd, const char *, path, vki_mode_t, mode, vki_uint32_t, MERGE64_FIRST(dev), vki_uint32_t, MERGE64_SECOND(idev)) PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 ); - if ((ML_(safe_to_deref)(path, 1)) && (path[0] != '/')) - if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "mknodat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mknodat", tid, status); } // SYS_cpuset_getdomain 561 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 867c31d06..45c76a6db 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1032,11 +1032,7 @@ PRE(sys_fstatat64) SARG1, ARG2, (HChar*)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "fstatat64", int, dfd, char *, file_name, struct stat64 *, buf, int, flags); - if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && *(Char *)(Addr)ARG2 != '/' - && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "fstatat64", tid, False)) - SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat64", tid, status); PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 ); PRE_MEM_WRITE( "fstatat64(buf)", ARG3, sizeof(struct vki_stat64) ); } From b35918dd1eed60066d097c62a1f5fec6cb51e354 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 29 Aug 2025 08:22:17 +0200 Subject: [PATCH 222/412] FreeBSD: fix build error Deleteted wrong variable when doing *at() syscall refactoring. --- coregrind/m_syswrap/syswrap-freebsd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 8934b76ad..1a3bbe214 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -5453,7 +5453,7 @@ POST(sys_openat) // size_t bufsize); PRE(sys_readlinkat) { - const HChar *path = (const HChar*)ARG2; + Bool curproc_file = False; PRINT("sys_readlinkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %llu )", ARG1,ARG2,(char*)ARG2,ARG3,(ULong)ARG4); PRE_REG_READ4(ssize_t, "readlinkat", From dce474600fc193325fe889b0a6975012fd356dfe Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 29 Aug 2025 08:22:17 +0200 Subject: [PATCH 223/412] regtest: add vgtest and expected for memcheck duplicate_align_size_errors The cpp file and .gitignore change were done at the same time as the aligned size checks, but I missed out the expected vgtest and Makefile.am changes. There were also a couple of unused variables in the cpp file. --- memcheck/tests/Makefile.am | 5 ++++ .../tests/duplicate_align_size_errors.cpp | 2 -- .../duplicate_align_size_errors.stderr.exp | 30 +++++++++++++++++++ .../tests/duplicate_align_size_errors.vgtest | 5 ++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 memcheck/tests/duplicate_align_size_errors.stderr.exp create mode 100644 memcheck/tests/duplicate_align_size_errors.vgtest diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 349cdaf15..fb3f9ddae 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -162,6 +162,8 @@ EXTRA_DIST = \ cxx17_aligned_new.stderr.exp cxx17_aligned_new.vgtest \ cxx17_aligned_new.stderr.exp_32 \ cxx17_aligned_new.stdout.exp \ + duplicate_align_size_errors.stderr.exp \ + duplicate_align_size_errors.vgtest \ sized_aligned_new_delete_args.stderr.exp \ sized_aligned_new_delete_args.vgtest \ sized_aligned_new_delete_misaligned1.stderr.exp \ @@ -613,6 +615,7 @@ endif if HAVE_ALIGNED_CXX_ALLOC check_PROGRAMS += cxx17_aligned_new sized_aligned_new_delete_args \ + duplicate_align_size_errors \ new_aligned_delete_default \ sized_aligned_new_delete_misaligned1 \ sized_aligned_new_delete_misaligned2 \ @@ -704,6 +707,8 @@ bug340392_CFLAGS = $(AM_CFLAGS) -O3 @FLAG_W_NO_MAYBE_UNINITIALIZED@ if HAVE_ALIGNED_CXX_ALLOC cxx17_aligned_new_SOURCES = cxx17_aligned_new.cpp cxx17_aligned_new_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 @FLAG_W_NO_MISMATCHED_NEW_DELETE@ +duplicate_align_size_errors_SOURCES = duplicate_align_size_errors.cpp +duplicate_align_size_errors_CXXFLAFGS = ${AM_CXXFLAGS} -std=c++17 new_aligned_delete_default_SOURCES = new_aligned_delete_default.cpp new_aligned_delete_default_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 sized_aligned_new_delete_args_SOURCES = sized_aligned_new_delete_args.cpp diff --git a/memcheck/tests/duplicate_align_size_errors.cpp b/memcheck/tests/duplicate_align_size_errors.cpp index 3e0af0d16..58f64a7cd 100644 --- a/memcheck/tests/duplicate_align_size_errors.cpp +++ b/memcheck/tests/duplicate_align_size_errors.cpp @@ -6,9 +6,7 @@ int main() { - std::align_val_t misalign(static_cast(63U)); std::align_val_t zeroalign(static_cast(0U)); - std::align_val_t onealign(static_cast(1U)); std::align_val_t align(static_cast(64U)); std::align_val_t alignx2(static_cast(128U)); std::size_t size(32); diff --git a/memcheck/tests/duplicate_align_size_errors.stderr.exp b/memcheck/tests/duplicate_align_size_errors.stderr.exp new file mode 100644 index 000000000..4eb84f433 --- /dev/null +++ b/memcheck/tests/duplicate_align_size_errors.stderr.exp @@ -0,0 +1,30 @@ +Invalid alignment value: 0 (should be non-zero and a power of 2) + at 0x........: operator new(unsigned long, std::align_val_t, std::nothrow_t const&) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:19) + +Invalid alignment value: 0 (should be non-zero and a power of 2) + at 0x........: operator delete(void*, std::align_val_t, std::nothrow_t const&) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:20) + +Invalid size value: 100 alignment value: 64 (size should be a multiple of alignment) + at 0x........: aligned_alloc (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:25) + +aligned_alloc() invalid size value: 0 + at 0x........: aligned_alloc (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:33) + +Mismatched new/delete size value: 33 + at 0x........: operator delete(void*, unsigned long, std::align_val_t) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:43) + Address 0x........ is 0 bytes inside a block of size 32 alloc'd + at 0x........: operator new(unsigned long, std::align_val_t) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:42) + +Mismatched new[]/delete[] alignment alloc value: 64 dealloc value: 128 + at 0x........: operator delete[](void*, unsigned long, std::align_val_t) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:48) + Address 0x........ is 0 bytes inside a block of size 32 alloc'd + at 0x........: operator new[](unsigned long, std::align_val_t) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:47) + diff --git a/memcheck/tests/duplicate_align_size_errors.vgtest b/memcheck/tests/duplicate_align_size_errors.vgtest new file mode 100644 index 000000000..44362003d --- /dev/null +++ b/memcheck/tests/duplicate_align_size_errors.vgtest @@ -0,0 +1,5 @@ +prog: duplicate_align_size_errors +prereq: test -e ./duplicate_align_size_errors +vgopts: --show-mismatched-frees=yes -q +#stderr_filter: filter_size_t + From 3399c455fa5068dbf1d10f150160ea67fff85477 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Thu, 28 Aug 2025 22:30:25 +0200 Subject: [PATCH 224/412] Bug 508869 - x86-linux: simplify scalar test output --- NEWS | 1 + memcheck/tests/x86-linux/Makefile.am | 1 + memcheck/tests/x86-linux/filter_scalar | 7 + memcheck/tests/x86-linux/scalar.stderr.exp | 1572 ++++++++++---------- memcheck/tests/x86-linux/scalar.vgtest | 1 + 5 files changed, 796 insertions(+), 786 deletions(-) create mode 100755 memcheck/tests/x86-linux/filter_scalar diff --git a/NEWS b/NEWS index 46f466cca..0d0ed35ba 100644 --- a/NEWS +++ b/NEWS @@ -87,6 +87,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508093 VALGRIND_CLO_CHANGE does not update vex_control 508154 PRE(sys_fchownat) not handling VKI_AT_FDCWD 508638 Self-hosting not working on FreeBSD +508869 x86-linux: simplify scalar test output To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/memcheck/tests/x86-linux/Makefile.am b/memcheck/tests/x86-linux/Makefile.am index e8de590b3..434b1c085 100644 --- a/memcheck/tests/x86-linux/Makefile.am +++ b/memcheck/tests/x86-linux/Makefile.am @@ -2,6 +2,7 @@ include $(top_srcdir)/Makefile.tool-tests.am dist_noinst_SCRIPTS = \ + filter_scalar \ filter_scalar_exit_group \ filter_stderr diff --git a/memcheck/tests/x86-linux/filter_scalar b/memcheck/tests/x86-linux/filter_scalar new file mode 100755 index 000000000..5f0d3da05 --- /dev/null +++ b/memcheck/tests/x86-linux/filter_scalar @@ -0,0 +1,7 @@ +#! /bin/sh + +# remove line numbers as they just cause larger patches +sed "s/\(scalar.c\):[0-9]*)/\1)/" | + +../filter_stderr "$@" + diff --git a/memcheck/tests/x86-linux/scalar.stderr.exp b/memcheck/tests/x86-linux/scalar.stderr.exp index a2255991e..c878e4465 100644 --- a/memcheck/tests/x86-linux/scalar.stderr.exp +++ b/memcheck/tests/x86-linux/scalar.stderr.exp @@ -12,23 +12,23 @@ ----------------------------------------------------- Syscall param (syscallno) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:52) + by 0x........: main (scalar.c) Syscall param read(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:52) + by 0x........: main (scalar.c) Syscall param read(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:52) + by 0x........: main (scalar.c) Syscall param read(count) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:52) + by 0x........: main (scalar.c) Syscall param read(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:52) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -36,19 +36,19 @@ Syscall param read(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param write(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:56) + by 0x........: main (scalar.c) Syscall param write(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:56) + by 0x........: main (scalar.c) Syscall param write(count) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:56) + by 0x........: main (scalar.c) Syscall param write(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:56) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -56,15 +56,15 @@ Syscall param write(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param open(filename) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:60) + by 0x........: main (scalar.c) Syscall param open(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:60) + by 0x........: main (scalar.c) Syscall param open(filename) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:60) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -72,33 +72,33 @@ Syscall param open(filename) points to unaddressable byte(s) ----------------------------------------------------- Syscall param open(mode) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:66) + by 0x........: main (scalar.c) ----------------------------------------------------- 6: __NR_close 1s 0m ----------------------------------------------------- Syscall param close(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:70) + by 0x........: main (scalar.c) ----------------------------------------------------- 7: __NR_waitpid 3s 1m ----------------------------------------------------- Syscall param waitpid(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:74) + by 0x........: main (scalar.c) Syscall param waitpid(status) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:74) + by 0x........: main (scalar.c) Syscall param waitpid(options) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:74) + by 0x........: main (scalar.c) Syscall param waitpid(status) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:74) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -106,15 +106,15 @@ Syscall param waitpid(status) points to unaddressable byte(s) ----------------------------------------------------- Syscall param creat(pathname) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:78) + by 0x........: main (scalar.c) Syscall param creat(mode) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:78) + by 0x........: main (scalar.c) Syscall param creat(pathname) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:78) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -122,20 +122,20 @@ Syscall param creat(pathname) points to unaddressable byte(s) ----------------------------------------------------- Syscall param link(oldpath) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:82) + by 0x........: main (scalar.c) Syscall param link(newpath) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:82) + by 0x........: main (scalar.c) Syscall param link(oldpath) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:82) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param link(newpath) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:82) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -143,11 +143,11 @@ Syscall param link(newpath) points to unaddressable byte(s) ----------------------------------------------------- Syscall param unlink(pathname) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:86) + by 0x........: main (scalar.c) Syscall param unlink(pathname) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:86) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -155,24 +155,24 @@ Syscall param unlink(pathname) points to unaddressable byte(s) ----------------------------------------------------- Syscall param execve(filename) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:90) + by 0x........: main (scalar.c) Syscall param execve(argv) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:90) + by 0x........: main (scalar.c) Syscall param execve(envp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:90) + by 0x........: main (scalar.c) Syscall param execve(filename) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:90) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param execve(argv) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:90) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -180,24 +180,24 @@ Syscall param execve(argv) points to unaddressable byte(s) ----------------------------------------------------- Syscall param execve(filename) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:93) + by 0x........: main (scalar.c) Syscall param execve(argv) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:93) + by 0x........: main (scalar.c) Syscall param execve(envp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:93) + by 0x........: main (scalar.c) Syscall param execve(filename) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:93) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param execve(argv) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:93) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -205,30 +205,30 @@ Syscall param execve(argv) points to unaddressable byte(s) ----------------------------------------------------- Syscall param execve(filename) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:97) + by 0x........: main (scalar.c) Syscall param execve(argv) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:97) + by 0x........: main (scalar.c) Syscall param execve(envp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:97) + by 0x........: main (scalar.c) Syscall param execve(filename) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:97) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param execve(argv) points to uninitialised byte(s) ... - by 0x........: main (scalar.c:97) + by 0x........: main (scalar.c) Address 0x........ is on thread 1's stack - in frame #1, created by main (scalar.c:29) + in frame #1, created by main (scalar.c) Syscall param execve(argv[0]) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:97) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -236,30 +236,30 @@ Syscall param execve(argv[0]) points to unaddressable byte(s) ----------------------------------------------------- Syscall param execve(filename) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:100) + by 0x........: main (scalar.c) Syscall param execve(argv) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:100) + by 0x........: main (scalar.c) Syscall param execve(envp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:100) + by 0x........: main (scalar.c) Syscall param execve(filename) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:100) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param execve(envp) points to uninitialised byte(s) ... - by 0x........: main (scalar.c:100) + by 0x........: main (scalar.c) Address 0x........ is on thread 1's stack - in frame #1, created by main (scalar.c:29) + in frame #1, created by main (scalar.c) Syscall param execve(envp[i]) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:100) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -267,11 +267,11 @@ Syscall param execve(envp[i]) points to unaddressable byte(s) ----------------------------------------------------- Syscall param chdir(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:104) + by 0x........: main (scalar.c) Syscall param chdir(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:104) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -279,11 +279,11 @@ Syscall param chdir(path) points to unaddressable byte(s) ----------------------------------------------------- Syscall param time(t) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:108) + by 0x........: main (scalar.c) Syscall param time(t) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:108) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -291,19 +291,19 @@ Syscall param time(t) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mknod(pathname) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:112) + by 0x........: main (scalar.c) Syscall param mknod(mode) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:112) + by 0x........: main (scalar.c) Syscall param mknod(dev) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:112) + by 0x........: main (scalar.c) Syscall param mknod(pathname) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:112) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -311,15 +311,15 @@ Syscall param mknod(pathname) points to unaddressable byte(s) ----------------------------------------------------- Syscall param chmod(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:116) + by 0x........: main (scalar.c) Syscall param chmod(mode) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:116) + by 0x........: main (scalar.c) Syscall param chmod(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:116) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -336,15 +336,15 @@ Syscall param chmod(path) points to unaddressable byte(s) ----------------------------------------------------- Syscall param lseek(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:132) + by 0x........: main (scalar.c) Syscall param lseek(offset) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:132) + by 0x........: main (scalar.c) Syscall param lseek(whence) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:132) + by 0x........: main (scalar.c) ----------------------------------------------------- 20: __NR_getpid 0s 0m @@ -354,32 +354,32 @@ Syscall param lseek(whence) contains uninitialised byte(s) ----------------------------------------------------- Syscall param mount(source) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:140) + by 0x........: main (scalar.c) Syscall param mount(target) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:140) + by 0x........: main (scalar.c) Syscall param mount(type) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:140) + by 0x........: main (scalar.c) Syscall param mount(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:140) + by 0x........: main (scalar.c) Syscall param mount(data) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:140) + by 0x........: main (scalar.c) Syscall param mount(target) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:140) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param mount(type) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:140) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -387,11 +387,11 @@ Syscall param mount(type) points to unaddressable byte(s) ----------------------------------------------------- Syscall param umount(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:144) + by 0x........: main (scalar.c) Syscall param umount(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:144) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -399,7 +399,7 @@ Syscall param umount(path) points to unaddressable byte(s) ----------------------------------------------------- Syscall param setuid16(uid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:148) + by 0x........: main (scalar.c) ----------------------------------------------------- 24: __NR_getuid 0s 0m @@ -412,23 +412,23 @@ Syscall param setuid16(uid) contains uninitialised byte(s) ----------------------------------------------------- Syscall param ptrace(request) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:161) + by 0x........: main (scalar.c) Syscall param ptrace(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:161) + by 0x........: main (scalar.c) Syscall param ptrace(addr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:161) + by 0x........: main (scalar.c) Syscall param ptrace(data) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:161) + by 0x........: main (scalar.c) Syscall param ptrace(getregs) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:161) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -436,7 +436,7 @@ Syscall param ptrace(getregs) points to unaddressable byte(s) ----------------------------------------------------- Syscall param alarm(seconds) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:165) + by 0x........: main (scalar.c) ----------------------------------------------------- 28: __NR_oldfstat n/a @@ -449,20 +449,20 @@ Syscall param alarm(seconds) contains uninitialised byte(s) ----------------------------------------------------- Syscall param utime(filename) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:177) + by 0x........: main (scalar.c) Syscall param utime(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:177) + by 0x........: main (scalar.c) Syscall param utime(filename) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:177) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param utime(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:177) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -476,15 +476,15 @@ Syscall param utime(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param access(pathname) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:189) + by 0x........: main (scalar.c) Syscall param access(mode) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:189) + by 0x........: main (scalar.c) Syscall param access(pathname) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:189) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -492,7 +492,7 @@ Syscall param access(pathname) points to unaddressable byte(s) ----------------------------------------------------- Syscall param nice(inc) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:193) + by 0x........: main (scalar.c) ----------------------------------------------------- 35: __NR_ftime ni @@ -505,31 +505,31 @@ Syscall param nice(inc) contains uninitialised byte(s) ----------------------------------------------------- Syscall param kill(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:205) + by 0x........: main (scalar.c) Syscall param kill(signal) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:205) + by 0x........: main (scalar.c) ----------------------------------------------------- 38: __NR_rename 2s 2m ----------------------------------------------------- Syscall param rename(oldpath) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:209) + by 0x........: main (scalar.c) Syscall param rename(newpath) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:209) + by 0x........: main (scalar.c) Syscall param rename(oldpath) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:209) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param rename(newpath) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:209) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -537,15 +537,15 @@ Syscall param rename(newpath) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mkdir(pathname) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:213) + by 0x........: main (scalar.c) Syscall param mkdir(mode) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:213) + by 0x........: main (scalar.c) Syscall param mkdir(pathname) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:213) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -553,11 +553,11 @@ Syscall param mkdir(pathname) points to unaddressable byte(s) ----------------------------------------------------- Syscall param rmdir(pathname) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:217) + by 0x........: main (scalar.c) Syscall param rmdir(pathname) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:217) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -565,21 +565,21 @@ Syscall param rmdir(pathname) points to unaddressable byte(s) ----------------------------------------------------- Syscall param dup(oldfd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:221) + by 0x........: main (scalar.c) ----------------------------------------------------- 42: __NR_pipe 1s 1m ----------------------------------------------------- Syscall param pipe(filedes) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:225) + by 0x........: main (scalar.c) More than 100 errors detected. Subsequent errors will still be recorded, but in less detail than before. Syscall param pipe(filedes) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:225) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -587,11 +587,11 @@ Syscall param pipe(filedes) points to unaddressable byte(s) ----------------------------------------------------- Syscall param times(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:229) + by 0x........: main (scalar.c) Syscall param times(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:229) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -602,14 +602,14 @@ Syscall param times(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param brk(end_data_segment) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:237) + by 0x........: main (scalar.c) ----------------------------------------------------- 46: __NR_setgid 1s 0m ----------------------------------------------------- Syscall param setgid16(gid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:241) + by 0x........: main (scalar.c) ----------------------------------------------------- 47: __NR_getgid 0s 0m @@ -628,11 +628,11 @@ Syscall param setgid16(gid) contains uninitialised byte(s) ----------------------------------------------------- Syscall param acct(filename) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:261) + by 0x........: main (scalar.c) Syscall param acct(filename) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:261) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -640,15 +640,15 @@ Syscall param acct(filename) points to unaddressable byte(s) ----------------------------------------------------- Syscall param umount2(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:265) + by 0x........: main (scalar.c) Syscall param umount2(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:265) + by 0x........: main (scalar.c) Syscall param umount2(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:265) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -659,19 +659,19 @@ Syscall param umount2(path) points to unaddressable byte(s) ----------------------------------------------------- Syscall param ioctl(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:274) + by 0x........: main (scalar.c) Syscall param ioctl(request) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:274) + by 0x........: main (scalar.c) Syscall param ioctl(arg) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:274) + by 0x........: main (scalar.c) Syscall param ioctl(TCSET{S,SW,SF}) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:274) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -679,49 +679,49 @@ Syscall param ioctl(TCSET{S,SW,SF}) points to unaddressable byte(s) ----------------------------------------------------- Syscall param fcntl(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:280) + by 0x........: main (scalar.c) Syscall param fcntl(cmd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:280) + by 0x........: main (scalar.c) ----------------------------------------------------- 55: __NR_fcntl (DUPFD) 1s 0m ----------------------------------------------------- Syscall param fcntl(arg) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:286) + by 0x........: main (scalar.c) ----------------------------------------------------- 55: __NR_fcntl (GETLK) 1s 5m ----------------------------------------------------- Syscall param fcntl(lock) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:292) + by 0x........: main (scalar.c) Syscall param fcntl(lock->l_type) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:292) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param fcntl(lock->l_whence) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:292) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param fcntl(lock->l_start) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:292) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param fcntl(lock->l_len) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:292) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param fcntl(lock->l_pid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:292) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -732,11 +732,11 @@ Syscall param fcntl(lock->l_pid) points to unaddressable byte(s) ----------------------------------------------------- Syscall param setpgid(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:300) + by 0x........: main (scalar.c) Syscall param setpgid(pgid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:300) + by 0x........: main (scalar.c) ----------------------------------------------------- 58: __NR_ulimit ni @@ -749,18 +749,18 @@ Syscall param setpgid(pgid) contains uninitialised byte(s) ----------------------------------------------------- Syscall param umask(mask) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:312) + by 0x........: main (scalar.c) ----------------------------------------------------- 61: __NR_chroot 1s 1m ----------------------------------------------------- Syscall param chroot(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:316) + by 0x........: main (scalar.c) Syscall param chroot(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:316) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -771,11 +771,11 @@ Syscall param chroot(path) points to unaddressable byte(s) ----------------------------------------------------- Syscall param dup2(oldfd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:324) + by 0x........: main (scalar.c) Syscall param dup2(newfd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:324) + by 0x........: main (scalar.c) ----------------------------------------------------- 64: __NR_getppid 0s 0m @@ -791,43 +791,43 @@ Syscall param dup2(newfd) contains uninitialised byte(s) ----------------------------------------------------- Syscall param sigaction(signum) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:340) + by 0x........: main (scalar.c) Syscall param sigaction(act) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:340) + by 0x........: main (scalar.c) Syscall param sigaction(oldact) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:340) + by 0x........: main (scalar.c) Syscall param sigaction(act->sa_handler) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:340) + by 0x........: main (scalar.c) Address 0x........ is 0 bytes after a block of size 4 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (scalar.c:31) + by 0x........: main (scalar.c) Syscall param sigaction(act->sa_mask) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:340) + by 0x........: main (scalar.c) Address 0x........ is 4 bytes after a block of size 4 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (scalar.c:31) + by 0x........: main (scalar.c) Syscall param sigaction(act->sa_flags) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:340) + by 0x........: main (scalar.c) Address 0x........ is 8 bytes after a block of size 4 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (scalar.c:31) + by 0x........: main (scalar.c) Syscall param sigaction(oldact) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:340) + by 0x........: main (scalar.c) Address 0x........ is 0 bytes after a block of size 4 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (scalar.c:31) + by 0x........: main (scalar.c) ----------------------------------------------------- 68: __NR_sgetmask n/a @@ -840,22 +840,22 @@ Syscall param sigaction(oldact) points to unaddressable byte(s) ----------------------------------------------------- Syscall param setreuid16(ruid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:352) + by 0x........: main (scalar.c) Syscall param setreuid16(euid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:352) + by 0x........: main (scalar.c) ----------------------------------------------------- 71: __NR_setregid 2s 0m ----------------------------------------------------- Syscall param setregid16(rgid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:356) + by 0x........: main (scalar.c) Syscall param setregid16(egid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:356) + by 0x........: main (scalar.c) ----------------------------------------------------- 72: __NR_sigsuspend ignore @@ -865,11 +865,11 @@ Syscall param setregid16(egid) contains uninitialised byte(s) ----------------------------------------------------- Syscall param sigpending(set) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:365) + by 0x........: main (scalar.c) Syscall param sigpending(set) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:365) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -880,15 +880,15 @@ Syscall param sigpending(set) points to unaddressable byte(s) ----------------------------------------------------- Syscall param setrlimit(resource) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:373) + by 0x........: main (scalar.c) Syscall param setrlimit(rlim) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:373) + by 0x........: main (scalar.c) Syscall param setrlimit(rlim) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:373) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -896,15 +896,15 @@ Syscall param setrlimit(rlim) points to unaddressable byte(s) ----------------------------------------------------- Syscall param old_getrlimit(resource) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:377) + by 0x........: main (scalar.c) Syscall param old_getrlimit(rlim) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:377) + by 0x........: main (scalar.c) Syscall param old_getrlimit(rlim) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:377) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -912,15 +912,15 @@ Syscall param old_getrlimit(rlim) points to unaddressable byte(s) ----------------------------------------------------- Syscall param getrusage(who) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:381) + by 0x........: main (scalar.c) Syscall param getrusage(usage) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:381) + by 0x........: main (scalar.c) Syscall param getrusage(usage) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:381) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -928,20 +928,20 @@ Syscall param getrusage(usage) points to unaddressable byte(s) ----------------------------------------------------- Syscall param gettimeofday(tv) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:385) + by 0x........: main (scalar.c) Syscall param gettimeofday(tz) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:385) + by 0x........: main (scalar.c) Syscall param gettimeofday(tv) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:385) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param gettimeofday(tz) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:385) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -949,20 +949,20 @@ Syscall param gettimeofday(tz) points to unaddressable byte(s) ----------------------------------------------------- Syscall param settimeofday(tv) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:389) + by 0x........: main (scalar.c) Syscall param settimeofday(tz) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:389) + by 0x........: main (scalar.c) Syscall param settimeofday(tv) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:389) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param settimeofday(tz) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:389) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -970,15 +970,15 @@ Syscall param settimeofday(tz) points to unaddressable byte(s) ----------------------------------------------------- Syscall param getgroups16(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:393) + by 0x........: main (scalar.c) Syscall param getgroups16(list) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:393) + by 0x........: main (scalar.c) Syscall param getgroups16(list) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:393) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -986,15 +986,15 @@ Syscall param getgroups16(list) points to unaddressable byte(s) ----------------------------------------------------- Syscall param setgroups16(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:397) + by 0x........: main (scalar.c) Syscall param setgroups16(list) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:397) + by 0x........: main (scalar.c) Syscall param setgroups16(list) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:397) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1002,32 +1002,32 @@ Syscall param setgroups16(list) points to unaddressable byte(s) ----------------------------------------------------- Syscall param old_select(args) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:403) + by 0x........: main (scalar.c) Syscall param old_select(args) points to uninitialised byte(s) ... - by 0x........: main (scalar.c:403) + by 0x........: main (scalar.c) Address 0x........ is on thread 1's stack - in frame #1, created by main (scalar.c:29) + in frame #1, created by main (scalar.c) Syscall param old_select(readfds) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:403) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param old_select(writefds) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:403) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param old_select(exceptfds) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:403) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param old_select(timeout) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:403) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1035,20 +1035,20 @@ Syscall param old_select(timeout) points to unaddressable byte(s) ----------------------------------------------------- Syscall param symlink(oldpath) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:408) + by 0x........: main (scalar.c) Syscall param symlink(newpath) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:408) + by 0x........: main (scalar.c) Syscall param symlink(oldpath) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:408) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param symlink(newpath) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:408) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1059,24 +1059,24 @@ Syscall param symlink(newpath) points to unaddressable byte(s) ----------------------------------------------------- Syscall param readlink(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:416) + by 0x........: main (scalar.c) Syscall param readlink(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:416) + by 0x........: main (scalar.c) Syscall param readlink(bufsiz) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:416) + by 0x........: main (scalar.c) Syscall param readlink(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:416) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param readlink(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:416) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1096,39 +1096,39 @@ Syscall param readlink(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param old_mmap(args) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:438) + by 0x........: main (scalar.c) Syscall param old_mmap(args) points to uninitialised byte(s) ... - by 0x........: main (scalar.c:438) + by 0x........: main (scalar.c) Address 0x........ is on thread 1's stack - in frame #1, created by main (scalar.c:29) + in frame #1, created by main (scalar.c) ----------------------------------------------------- 91: __NR_munmap 2s 0m ----------------------------------------------------- Syscall param munmap(start) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:443) + by 0x........: main (scalar.c) Syscall param munmap(length) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:443) + by 0x........: main (scalar.c) ----------------------------------------------------- 92: __NR_truncate 2s 1m ----------------------------------------------------- Syscall param truncate(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:447) + by 0x........: main (scalar.c) Syscall param truncate(length) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:447) + by 0x........: main (scalar.c) Syscall param truncate(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:447) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1136,63 +1136,63 @@ Syscall param truncate(path) points to unaddressable byte(s) ----------------------------------------------------- Syscall param ftruncate(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:451) + by 0x........: main (scalar.c) Syscall param ftruncate(length) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:451) + by 0x........: main (scalar.c) ----------------------------------------------------- 94: __NR_fchmod 2s 0m ----------------------------------------------------- Syscall param fchmod(fildes) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:455) + by 0x........: main (scalar.c) Syscall param fchmod(mode) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:455) + by 0x........: main (scalar.c) ----------------------------------------------------- 95: __NR_fchown 3s 0m ----------------------------------------------------- Syscall param fchown16(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:459) + by 0x........: main (scalar.c) Syscall param fchown16(owner) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:459) + by 0x........: main (scalar.c) Syscall param fchown16(group) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:459) + by 0x........: main (scalar.c) ----------------------------------------------------- 96: __NR_getpriority 2s 0m ----------------------------------------------------- Syscall param getpriority(which) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:463) + by 0x........: main (scalar.c) Syscall param getpriority(who) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:463) + by 0x........: main (scalar.c) ----------------------------------------------------- 97: __NR_setpriority 3s 0m ----------------------------------------------------- Syscall param setpriority(which) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:467) + by 0x........: main (scalar.c) Syscall param setpriority(who) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:467) + by 0x........: main (scalar.c) Syscall param setpriority(prio) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:467) + by 0x........: main (scalar.c) ----------------------------------------------------- 98: __NR_profil ni @@ -1202,20 +1202,20 @@ Syscall param setpriority(prio) contains uninitialised byte(s) ----------------------------------------------------- Syscall param statfs(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:475) + by 0x........: main (scalar.c) Syscall param statfs(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:475) + by 0x........: main (scalar.c) Syscall param statfs(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:475) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param statfs(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:475) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1223,15 +1223,15 @@ Syscall param statfs(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param fstatfs(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:479) + by 0x........: main (scalar.c) Syscall param fstatfs(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:479) + by 0x........: main (scalar.c) Syscall param fstatfs(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:479) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1239,15 +1239,15 @@ Syscall param fstatfs(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param ioperm(from) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:483) + by 0x........: main (scalar.c) Syscall param ioperm(num) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:483) + by 0x........: main (scalar.c) Syscall param ioperm(turn_on) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:483) + by 0x........: main (scalar.c) ----------------------------------------------------- 102: __NR_socketcall XXX @@ -1257,19 +1257,19 @@ Syscall param ioperm(turn_on) contains uninitialised byte(s) ----------------------------------------------------- Syscall param syslog(type) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:491) + by 0x........: main (scalar.c) Syscall param syslog(bufp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:491) + by 0x........: main (scalar.c) Syscall param syslog(len) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:491) + by 0x........: main (scalar.c) Syscall param syslog(bufp) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:491) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1277,34 +1277,34 @@ Syscall param syslog(bufp) points to unaddressable byte(s) ----------------------------------------------------- Syscall param setitimer(which) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:495) + by 0x........: main (scalar.c) Syscall param setitimer(value) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:495) + by 0x........: main (scalar.c) Syscall param setitimer(ovalue) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:495) + by 0x........: main (scalar.c) Syscall param setitimer(&value->it_interval) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:495) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param setitimer(&value->it_value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:495) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param setitimer(&ovalue->it_interval) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:495) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param setitimer(&ovalue->it_value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:495) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1312,20 +1312,20 @@ Syscall param setitimer(&ovalue->it_value) points to unaddressable byte(s) ----------------------------------------------------- Syscall param getitimer(which) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:499) + by 0x........: main (scalar.c) Syscall param getitimer(value) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:499) + by 0x........: main (scalar.c) Syscall param getitimer(&value->it_interval) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:499) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param getitimer(&value->it_value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:499) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1333,20 +1333,20 @@ Syscall param getitimer(&value->it_value) points to unaddressable byte(s) ----------------------------------------------------- Syscall param stat(file_name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:503) + by 0x........: main (scalar.c) Syscall param stat(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:503) + by 0x........: main (scalar.c) Syscall param stat(file_name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:503) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param stat(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:503) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1354,20 +1354,20 @@ Syscall param stat(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param lstat(file_name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:507) + by 0x........: main (scalar.c) Syscall param lstat(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:507) + by 0x........: main (scalar.c) Syscall param lstat(file_name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:507) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param lstat(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:507) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1375,15 +1375,15 @@ Syscall param lstat(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param fstat(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:511) + by 0x........: main (scalar.c) Syscall param fstat(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:511) + by 0x........: main (scalar.c) Syscall param fstat(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:511) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1394,7 +1394,7 @@ Syscall param fstat(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param iopl(level) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:519) + by 0x........: main (scalar.c) ----------------------------------------------------- 111: __NR_vhangup 0s 0m @@ -1410,28 +1410,28 @@ Syscall param iopl(level) contains uninitialised byte(s) ----------------------------------------------------- Syscall param wait4(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:535) + by 0x........: main (scalar.c) Syscall param wait4(status) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:535) + by 0x........: main (scalar.c) Syscall param wait4(options) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:535) + by 0x........: main (scalar.c) Syscall param wait4(rusage) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:535) + by 0x........: main (scalar.c) Syscall param wait4(status) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:535) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param wait4(rusage) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:535) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1442,11 +1442,11 @@ Syscall param wait4(rusage) points to unaddressable byte(s) ----------------------------------------------------- Syscall param sysinfo(info) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:543) + by 0x........: main (scalar.c) Syscall param sysinfo(info) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:543) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1454,34 +1454,34 @@ Syscall param sysinfo(info) points to unaddressable byte(s) ----------------------------------------------------- Syscall param ipc(call) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:550) + by 0x........: main (scalar.c) Syscall param ipc(first) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:550) + by 0x........: main (scalar.c) Syscall param ipc(second) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:550) + by 0x........: main (scalar.c) Syscall param ipc(third) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:550) + by 0x........: main (scalar.c) Syscall param ipc(ptr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:550) + by 0x........: main (scalar.c) Syscall param ipc(fifth) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:550) + by 0x........: main (scalar.c) ----------------------------------------------------- 118: __NR_fsync 1s 0m ----------------------------------------------------- Syscall param fsync(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:554) + by 0x........: main (scalar.c) ----------------------------------------------------- 119: __NR_sigreturn n/a @@ -1491,37 +1491,37 @@ Syscall param fsync(fd) contains uninitialised byte(s) ----------------------------------------------------- Syscall param clone(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:565) + by 0x........: main (scalar.c) Syscall param clone(child_stack) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:565) + by 0x........: main (scalar.c) Syscall param clone(parent_tidptr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:565) + by 0x........: main (scalar.c) Syscall param clone(parent_tidptr) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:565) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param clone(tlsinfo) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:565) + by 0x........: main (scalar.c) Syscall param clone(tlsinfo) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:565) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param clone(child_tidptr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:565) + by 0x........: main (scalar.c) Syscall param clone(child_tidptr) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:565) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1532,11 +1532,11 @@ Syscall param clone(child_tidptr) points to unaddressable byte(s) ----------------------------------------------------- Syscall param uname(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:576) + by 0x........: main (scalar.c) Syscall param uname(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:576) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1544,19 +1544,19 @@ Syscall param uname(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param modify_ldt(func) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:580) + by 0x........: main (scalar.c) Syscall param modify_ldt(ptr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:580) + by 0x........: main (scalar.c) Syscall param modify_ldt(bytecount) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:580) + by 0x........: main (scalar.c) Syscall param modify_ldt(ptr) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:580) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1567,44 +1567,44 @@ Syscall param modify_ldt(ptr) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mprotect(addr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:589) + by 0x........: main (scalar.c) Syscall param mprotect(len) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:589) + by 0x........: main (scalar.c) Syscall param mprotect(prot) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:589) + by 0x........: main (scalar.c) ----------------------------------------------------- 126: __NR_sigprocmask 3s 2m ----------------------------------------------------- Syscall param sigprocmask(how) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:593) + by 0x........: main (scalar.c) Syscall param sigprocmask(set) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:593) + by 0x........: main (scalar.c) Syscall param sigprocmask(oldset) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:593) + by 0x........: main (scalar.c) Syscall param sigprocmask(set) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:593) + by 0x........: main (scalar.c) Address 0x........ is 0 bytes after a block of size 4 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (scalar.c:31) + by 0x........: main (scalar.c) Syscall param sigprocmask(oldset) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:593) + by 0x........: main (scalar.c) Address 0x........ is 0 bytes after a block of size 4 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (scalar.c:31) + by 0x........: main (scalar.c) ----------------------------------------------------- 127: __NR_create_module ni @@ -1614,24 +1614,24 @@ Syscall param sigprocmask(oldset) points to unaddressable byte(s) ----------------------------------------------------- Syscall param init_module(umod) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:601) + by 0x........: main (scalar.c) Syscall param init_module(len) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:601) + by 0x........: main (scalar.c) Syscall param init_module(uargs) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:601) + by 0x........: main (scalar.c) Syscall param init_module(umod) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:601) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param init_module(uargs) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:601) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1645,23 +1645,23 @@ Syscall param init_module(uargs) points to unaddressable byte(s) ----------------------------------------------------- Syscall param quotactl(cmd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:613) + by 0x........: main (scalar.c) Syscall param quotactl(special) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:613) + by 0x........: main (scalar.c) Syscall param quotactl(id) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:613) + by 0x........: main (scalar.c) Syscall param quotactl(addr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:613) + by 0x........: main (scalar.c) Syscall param quotactl(special) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:613) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1669,14 +1669,14 @@ Syscall param quotactl(special) points to unaddressable byte(s) ----------------------------------------------------- Syscall param getpgid(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:617) + by 0x........: main (scalar.c) ----------------------------------------------------- 133: __NR_fchdir 1s 0m ----------------------------------------------------- Syscall param fchdir(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:621) + by 0x........: main (scalar.c) ----------------------------------------------------- 134: __NR_bdflush n/a @@ -1689,7 +1689,7 @@ Syscall param fchdir(fd) contains uninitialised byte(s) ----------------------------------------------------- Syscall param personality(persona) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:633) + by 0x........: main (scalar.c) ----------------------------------------------------- 137: __NR_afs_syscall ni @@ -1699,41 +1699,41 @@ Syscall param personality(persona) contains uninitialised byte(s) ----------------------------------------------------- Syscall param setfsuid16(uid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:641) + by 0x........: main (scalar.c) ----------------------------------------------------- 139: __NR_setfsgid 1s 0m ----------------------------------------------------- Syscall param setfsgid16(gid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:645) + by 0x........: main (scalar.c) ----------------------------------------------------- 140: __NR__llseek 5s 1m ----------------------------------------------------- Syscall param llseek(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:649) + by 0x........: main (scalar.c) Syscall param llseek(offset_high) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:649) + by 0x........: main (scalar.c) Syscall param llseek(offset_low) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:649) + by 0x........: main (scalar.c) Syscall param llseek(result) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:649) + by 0x........: main (scalar.c) Syscall param llseek(whence) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:649) + by 0x........: main (scalar.c) Syscall param llseek(result) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:649) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1741,19 +1741,19 @@ Syscall param llseek(result) points to unaddressable byte(s) ----------------------------------------------------- Syscall param getdents(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:653) + by 0x........: main (scalar.c) Syscall param getdents(dirp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:653) + by 0x........: main (scalar.c) Syscall param getdents(count) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:653) + by 0x........: main (scalar.c) Syscall param getdents(dirp) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:653) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1761,42 +1761,42 @@ Syscall param getdents(dirp) points to unaddressable byte(s) ----------------------------------------------------- Syscall param select(n) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:657) + by 0x........: main (scalar.c) Syscall param select(readfds) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:657) + by 0x........: main (scalar.c) Syscall param select(writefds) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:657) + by 0x........: main (scalar.c) Syscall param select(exceptfds) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:657) + by 0x........: main (scalar.c) Syscall param select(timeout) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:657) + by 0x........: main (scalar.c) Syscall param select(readfds) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:657) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param select(writefds) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:657) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param select(exceptfds) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:657) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param select(timeout) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:657) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1804,30 +1804,30 @@ Syscall param select(timeout) points to unaddressable byte(s) ----------------------------------------------------- Syscall param flock(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:661) + by 0x........: main (scalar.c) Syscall param flock(operation) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:661) + by 0x........: main (scalar.c) ----------------------------------------------------- 144: __NR_msync 3s 1m ----------------------------------------------------- Syscall param msync(start) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:665) + by 0x........: main (scalar.c) Syscall param msync(length) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:665) + by 0x........: main (scalar.c) Syscall param msync(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:665) + by 0x........: main (scalar.c) Syscall param msync(start) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:665) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1835,19 +1835,19 @@ Syscall param msync(start) points to unaddressable byte(s) ----------------------------------------------------- Syscall param readv(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:669) + by 0x........: main (scalar.c) Syscall param readv(vector) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:669) + by 0x........: main (scalar.c) Syscall param readv(count) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:669) + by 0x........: main (scalar.c) Syscall param readv(vector) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:669) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1855,19 +1855,19 @@ Syscall param readv(vector) points to unaddressable byte(s) ----------------------------------------------------- Syscall param writev(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:673) + by 0x........: main (scalar.c) Syscall param writev(vector) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:673) + by 0x........: main (scalar.c) Syscall param writev(count) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:673) + by 0x........: main (scalar.c) Syscall param writev(vector) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:673) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1875,25 +1875,25 @@ Syscall param writev(vector) points to unaddressable byte(s) ----------------------------------------------------- Syscall param getsid(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:677) + by 0x........: main (scalar.c) ----------------------------------------------------- 148: __NR_fdatasync 1s 0m ----------------------------------------------------- Syscall param fdatasync(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:681) + by 0x........: main (scalar.c) ----------------------------------------------------- 149: __NR__sysctl 1s 1m ----------------------------------------------------- Syscall param sysctl(args) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:685) + by 0x........: main (scalar.c) Syscall param sysctl(args) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:685) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1901,29 +1901,29 @@ Syscall param sysctl(args) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mlock(addr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:689) + by 0x........: main (scalar.c) Syscall param mlock(len) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:689) + by 0x........: main (scalar.c) ----------------------------------------------------- 151: __NR_munlock 2s 0m ----------------------------------------------------- Syscall param munlock(addr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:693) + by 0x........: main (scalar.c) Syscall param munlock(len) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:693) + by 0x........: main (scalar.c) ----------------------------------------------------- 152: __NR_mlockall 1s 0m ----------------------------------------------------- Syscall param mlockall(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:697) + by 0x........: main (scalar.c) ----------------------------------------------------- 153: __NR_munlockall 0s 0m @@ -1933,15 +1933,15 @@ Syscall param mlockall(flags) contains uninitialised byte(s) ----------------------------------------------------- Syscall param sched_setparam(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:705) + by 0x........: main (scalar.c) Syscall param sched_setparam(p) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:705) + by 0x........: main (scalar.c) Syscall param sched_setparam(p) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:705) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1949,15 +1949,15 @@ Syscall param sched_setparam(p) points to unaddressable byte(s) ----------------------------------------------------- Syscall param sched_getparam(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:709) + by 0x........: main (scalar.c) Syscall param sched_getparam(p) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:709) + by 0x........: main (scalar.c) Syscall param sched_getparam(p) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:709) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1965,19 +1965,19 @@ Syscall param sched_getparam(p) points to unaddressable byte(s) ----------------------------------------------------- Syscall param sched_setscheduler(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:713) + by 0x........: main (scalar.c) Syscall param sched_setscheduler(policy) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:713) + by 0x........: main (scalar.c) Syscall param sched_setscheduler(p) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:713) + by 0x........: main (scalar.c) Syscall param sched_setscheduler(p) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:713) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -1985,7 +1985,7 @@ Syscall param sched_setscheduler(p) points to unaddressable byte(s) ----------------------------------------------------- Syscall param sched_getscheduler(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:717) + by 0x........: main (scalar.c) ----------------------------------------------------- 158: __NR_sched_yield 0s 0m @@ -1995,14 +1995,14 @@ Syscall param sched_getscheduler(pid) contains uninitialised byte(s) ----------------------------------------------------- Syscall param sched_get_priority_max(policy) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:725) + by 0x........: main (scalar.c) ----------------------------------------------------- 160:__NR_sched_get_priority_min 1s 0m ----------------------------------------------------- Syscall param sched_get_priority_min(policy) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:729) + by 0x........: main (scalar.c) ----------------------------------------------------- 161:__NR_sched_rr_get_interval n/a @@ -2012,20 +2012,20 @@ Syscall param sched_get_priority_min(policy) contains uninitialised byte(s) ----------------------------------------------------- Syscall param nanosleep(req) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:737) + by 0x........: main (scalar.c) Syscall param nanosleep(rem) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:737) + by 0x........: main (scalar.c) Syscall param nanosleep(req) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:737) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param nanosleep(rem) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:737) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2033,67 +2033,67 @@ Syscall param nanosleep(rem) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mremap(old_addr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:741) + by 0x........: main (scalar.c) Syscall param mremap(old_size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:741) + by 0x........: main (scalar.c) Syscall param mremap(new_size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:741) + by 0x........: main (scalar.c) Syscall param mremap(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:741) + by 0x........: main (scalar.c) Syscall param mremap(new_addr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:741) + by 0x........: main (scalar.c) ----------------------------------------------------- 164: __NR_setresuid 3s 0m ----------------------------------------------------- Syscall param setresuid16(ruid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:745) + by 0x........: main (scalar.c) Syscall param setresuid16(euid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:745) + by 0x........: main (scalar.c) Syscall param setresuid16(suid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:745) + by 0x........: main (scalar.c) ----------------------------------------------------- 165: __NR_getresuid 3s 3m ----------------------------------------------------- Syscall param getresuid16(ruid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:749) + by 0x........: main (scalar.c) Syscall param getresuid16(euid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:749) + by 0x........: main (scalar.c) Syscall param getresuid16(suid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:749) + by 0x........: main (scalar.c) Syscall param getresuid16(ruid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:749) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param getresuid16(euid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:749) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param getresuid16(suid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:749) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2107,24 +2107,24 @@ Syscall param getresuid16(suid) points to unaddressable byte(s) ----------------------------------------------------- Syscall param poll(ufds) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:761) + by 0x........: main (scalar.c) Syscall param poll(nfds) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:761) + by 0x........: main (scalar.c) Syscall param poll(timeout) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:761) + by 0x........: main (scalar.c) Syscall param poll(ufds.fd) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:761) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param poll(ufds.revents) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:761) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2135,44 +2135,44 @@ Syscall param poll(ufds.revents) points to unaddressable byte(s) ----------------------------------------------------- Syscall param setresgid16(rgid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:769) + by 0x........: main (scalar.c) Syscall param setresgid16(egid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:769) + by 0x........: main (scalar.c) Syscall param setresgid16(sgid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:769) + by 0x........: main (scalar.c) ----------------------------------------------------- 171: __NR_getresgid 3s 3m ----------------------------------------------------- Syscall param getresgid16(rgid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:773) + by 0x........: main (scalar.c) Syscall param getresgid16(egid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:773) + by 0x........: main (scalar.c) Syscall param getresgid16(sgid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:773) + by 0x........: main (scalar.c) Syscall param getresgid16(rgid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:773) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param getresgid16(egid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:773) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param getresgid16(sgid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:773) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2180,43 +2180,43 @@ Syscall param getresgid16(sgid) points to unaddressable byte(s) ----------------------------------------------------- Syscall param prctl(option) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:777) + by 0x........: main (scalar.c) Syscall param prctl(arg2) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:777) + by 0x........: main (scalar.c) Syscall param prctl(arg3) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:777) + by 0x........: main (scalar.c) Syscall param prctl(arg4) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:777) + by 0x........: main (scalar.c) Syscall param prctl(arg5) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:777) + by 0x........: main (scalar.c) ----------------------------------------------------- 172: __NR_prctl 2s 0m ----------------------------------------------------- Syscall param prctl(option) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:782) + by 0x........: main (scalar.c) Syscall param prctl(set-name) points to uninitialised byte(s) ... - by 0x........: main (scalar.c:782) + by 0x........: main (scalar.c) Address 0x........ is on thread 1's stack - in frame #1, created by main (scalar.c:29) + in frame #1, created by main (scalar.c) ----------------------------------------------------- 172: __NR_prctl 1s 0m ----------------------------------------------------- Syscall param prctl(option) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:787) + by 0x........: main (scalar.c) ----------------------------------------------------- 173: __NR_rt_sigreturn n/a @@ -2226,75 +2226,75 @@ Syscall param prctl(option) contains uninitialised byte(s) ----------------------------------------------------- Syscall param rt_sigaction(signum) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:795) + by 0x........: main (scalar.c) Syscall param rt_sigaction(act) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:795) + by 0x........: main (scalar.c) Syscall param rt_sigaction(oldact) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:795) + by 0x........: main (scalar.c) Syscall param rt_sigaction(sigsetsize) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:795) + by 0x........: main (scalar.c) Syscall param rt_sigaction(act->sa_handler) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:795) + by 0x........: main (scalar.c) Address 0x........ is 4 bytes after a block of size 4 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (scalar.c:31) + by 0x........: main (scalar.c) Syscall param rt_sigaction(act->sa_mask) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:795) + by 0x........: main (scalar.c) Address 0x........ is 16 bytes after a block of size 4 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (scalar.c:31) + by 0x........: main (scalar.c) Syscall param rt_sigaction(act->sa_flags) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:795) + by 0x........: main (scalar.c) Address 0x........ is 8 bytes after a block of size 4 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (scalar.c:31) + by 0x........: main (scalar.c) Syscall param rt_sigaction(oldact) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:795) + by 0x........: main (scalar.c) Address 0x........ is 4 bytes after a block of size 4 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (scalar.c:31) + by 0x........: main (scalar.c) ----------------------------------------------------- 175: __NR_rt_sigprocmask 4s 2m ----------------------------------------------------- Syscall param rt_sigprocmask(how) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:799) + by 0x........: main (scalar.c) Syscall param rt_sigprocmask(set) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:799) + by 0x........: main (scalar.c) Syscall param rt_sigprocmask(oldset) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:799) + by 0x........: main (scalar.c) Syscall param rt_sigprocmask(sigsetsize) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:799) + by 0x........: main (scalar.c) Syscall param rt_sigprocmask(set) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:799) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param rt_sigprocmask(oldset) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:799) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2302,15 +2302,15 @@ Syscall param rt_sigprocmask(oldset) points to unaddressable byte(s) ----------------------------------------------------- Syscall param rt_sigpending(set) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:803) + by 0x........: main (scalar.c) Syscall param rt_sigpending(sigsetsize) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:803) + by 0x........: main (scalar.c) Syscall param rt_sigpending(set) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:803) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2318,33 +2318,33 @@ Syscall param rt_sigpending(set) points to unaddressable byte(s) ----------------------------------------------------- Syscall param rt_sigtimedwait(set) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:807) + by 0x........: main (scalar.c) Syscall param rt_sigtimedwait(info) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:807) + by 0x........: main (scalar.c) Syscall param rt_sigtimedwait(timeout) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:807) + by 0x........: main (scalar.c) Syscall param rt_sigtimedwait(sigsetsize) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:807) + by 0x........: main (scalar.c) Syscall param rt_sigtimedwait(set) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:807) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param rt_sigtimedwait(info) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:807) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param rt_sigtimedwait(timeout) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:807) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2352,19 +2352,19 @@ Syscall param rt_sigtimedwait(timeout) points to unaddressable byte(s) ----------------------------------------------------- Syscall param rt_sigqueueinfo(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:811) + by 0x........: main (scalar.c) Syscall param rt_sigqueueinfo(sig) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:811) + by 0x........: main (scalar.c) Syscall param rt_sigqueueinfo(uinfo) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:811) + by 0x........: main (scalar.c) Syscall param rt_sigqueueinfo(uinfo) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:811) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2372,15 +2372,15 @@ Syscall param rt_sigqueueinfo(uinfo) points to unaddressable byte(s) ----------------------------------------------------- Syscall param rt_sigsuspend(mask) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:815) + by 0x........: main (scalar.c) Syscall param rt_sigsuspend(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:815) + by 0x........: main (scalar.c) Syscall param rt_sigsuspend(mask) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:815) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2388,27 +2388,27 @@ Syscall param rt_sigsuspend(mask) points to unaddressable byte(s) ----------------------------------------------------- Syscall param pread64(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:819) + by 0x........: main (scalar.c) Syscall param pread64(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:819) + by 0x........: main (scalar.c) Syscall param pread64(count) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:819) + by 0x........: main (scalar.c) Syscall param pread64(offset_low) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:819) + by 0x........: main (scalar.c) Syscall param pread64(offset_high) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:819) + by 0x........: main (scalar.c) Syscall param pread64(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:819) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2416,27 +2416,27 @@ Syscall param pread64(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param pwrite64(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:823) + by 0x........: main (scalar.c) Syscall param pwrite64(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:823) + by 0x........: main (scalar.c) Syscall param pwrite64(count) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:823) + by 0x........: main (scalar.c) Syscall param pwrite64(offset_low) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:823) + by 0x........: main (scalar.c) Syscall param pwrite64(offset_high) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:823) + by 0x........: main (scalar.c) Syscall param pwrite64(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:823) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2444,19 +2444,19 @@ Syscall param pwrite64(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param chown16(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:827) + by 0x........: main (scalar.c) Syscall param chown16(owner) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:827) + by 0x........: main (scalar.c) Syscall param chown16(group) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:827) + by 0x........: main (scalar.c) Syscall param chown16(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:827) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2464,15 +2464,15 @@ Syscall param chown16(path) points to unaddressable byte(s) ----------------------------------------------------- Syscall param getcwd(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:831) + by 0x........: main (scalar.c) Syscall param getcwd(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:831) + by 0x........: main (scalar.c) Syscall param getcwd(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:831) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2480,20 +2480,20 @@ Syscall param getcwd(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param capget(header) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:835) + by 0x........: main (scalar.c) Syscall param capget(data) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:835) + by 0x........: main (scalar.c) Syscall param capget(header) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:835) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param capget(data) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:835) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2501,20 +2501,20 @@ Syscall param capget(data) points to unaddressable byte(s) ----------------------------------------------------- Syscall param capset(header) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:839) + by 0x........: main (scalar.c) Syscall param capset(data) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:839) + by 0x........: main (scalar.c) Syscall param capset(header) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:839) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param capset(data) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:839) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2522,58 +2522,58 @@ Syscall param capset(data) points to unaddressable byte(s) ----------------------------------------------------- Syscall param sigaltstack(ss) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:853) + by 0x........: main (scalar.c) Syscall param sigaltstack(oss) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:853) + by 0x........: main (scalar.c) Syscall param sigaltstack(ss->ss_sp) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:853) + by 0x........: main (scalar.c) Address 0x........ is on thread 1's stack - in frame #1, created by main (scalar.c:29) + in frame #1, created by main (scalar.c) Syscall param sigaltstack(ss->ss_size) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:853) + by 0x........: main (scalar.c) Address 0x........ is on thread 1's stack - in frame #1, created by main (scalar.c:29) + in frame #1, created by main (scalar.c) Syscall param sigaltstack(ss->ss_flags) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:853) + by 0x........: main (scalar.c) Address 0x........ is on thread 1's stack - in frame #1, created by main (scalar.c:29) + in frame #1, created by main (scalar.c) Syscall param sigaltstack(oss) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:853) + by 0x........: main (scalar.c) Address 0x........ is on thread 1's stack - in frame #1, created by main (scalar.c:29) + in frame #1, created by main (scalar.c) ----------------------------------------------------- 187: __NR_sendfile 4s 1m ----------------------------------------------------- Syscall param sendfile(out_fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:858) + by 0x........: main (scalar.c) Syscall param sendfile(in_fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:858) + by 0x........: main (scalar.c) Syscall param sendfile(offset) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:858) + by 0x........: main (scalar.c) Syscall param sendfile(count) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:858) + by 0x........: main (scalar.c) Syscall param sendfile(offset) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:858) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2581,46 +2581,46 @@ Syscall param sendfile(offset) points to unaddressable byte(s) ----------------------------------------------------- Syscall param getpmsg(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:864) + by 0x........: main (scalar.c) Syscall param getpmsg(ctrl) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:864) + by 0x........: main (scalar.c) Syscall param getpmsg(data) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:864) + by 0x........: main (scalar.c) Syscall param getpmsg(bandp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:864) + by 0x........: main (scalar.c) Syscall param getpmsg(flagsp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:864) + by 0x........: main (scalar.c) ----------------------------------------------------- 189: __NR_putpmsg 5s 0m ----------------------------------------------------- Syscall param putpmsg(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:870) + by 0x........: main (scalar.c) Syscall param putpmsg(ctrl) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:870) + by 0x........: main (scalar.c) Syscall param putpmsg(data) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:870) + by 0x........: main (scalar.c) Syscall param putpmsg(band) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:870) + by 0x........: main (scalar.c) Syscall param putpmsg(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:870) + by 0x........: main (scalar.c) ----------------------------------------------------- 190: __NR_vfork other @@ -2630,15 +2630,15 @@ Syscall param putpmsg(flags) contains uninitialised byte(s) ----------------------------------------------------- Syscall param getrlimit(resource) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:878) + by 0x........: main (scalar.c) Syscall param getrlimit(rlim) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:878) + by 0x........: main (scalar.c) Syscall param getrlimit(rlim) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:878) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2646,46 +2646,46 @@ Syscall param getrlimit(rlim) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mmap2(start) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:882) + by 0x........: main (scalar.c) Syscall param mmap2(length) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:882) + by 0x........: main (scalar.c) Syscall param mmap2(prot) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:882) + by 0x........: main (scalar.c) Syscall param mmap2(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:882) + by 0x........: main (scalar.c) Syscall param mmap2(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:882) + by 0x........: main (scalar.c) Syscall param mmap2(offset) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:882) + by 0x........: main (scalar.c) ----------------------------------------------------- 193: __NR_truncate64 3s 1m ----------------------------------------------------- Syscall param truncate64(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:886) + by 0x........: main (scalar.c) Syscall param truncate64(length_low) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:886) + by 0x........: main (scalar.c) Syscall param truncate64(length_high) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:886) + by 0x........: main (scalar.c) Syscall param truncate64(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:886) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2693,35 +2693,35 @@ Syscall param truncate64(path) points to unaddressable byte(s) ----------------------------------------------------- Syscall param ftruncate64(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:890) + by 0x........: main (scalar.c) Syscall param ftruncate64(length_low) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:890) + by 0x........: main (scalar.c) Syscall param ftruncate64(length_high) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:890) + by 0x........: main (scalar.c) ----------------------------------------------------- 195: __NR_stat64 2s 2m ----------------------------------------------------- Syscall param stat64(file_name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:894) + by 0x........: main (scalar.c) Syscall param stat64(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:894) + by 0x........: main (scalar.c) Syscall param stat64(file_name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:894) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param stat64(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:894) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2729,20 +2729,20 @@ Syscall param stat64(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param lstat64(file_name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:898) + by 0x........: main (scalar.c) Syscall param lstat64(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:898) + by 0x........: main (scalar.c) Syscall param lstat64(file_name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:898) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param lstat64(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:898) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2750,15 +2750,15 @@ Syscall param lstat64(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param fstat64(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:902) + by 0x........: main (scalar.c) Syscall param fstat64(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:902) + by 0x........: main (scalar.c) Syscall param fstat64(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:902) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2766,19 +2766,19 @@ Syscall param fstat64(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param lchown(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:906) + by 0x........: main (scalar.c) Syscall param lchown(owner) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:906) + by 0x........: main (scalar.c) Syscall param lchown(group) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:906) + by 0x........: main (scalar.c) Syscall param lchown(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:906) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2798,37 +2798,37 @@ Syscall param lchown(path) points to unaddressable byte(s) ----------------------------------------------------- Syscall param setreuid(ruid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:926) + by 0x........: main (scalar.c) Syscall param setreuid(euid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:926) + by 0x........: main (scalar.c) ----------------------------------------------------- 204: __NR_setregid32 2s 0m ----------------------------------------------------- Syscall param setregid(rgid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:930) + by 0x........: main (scalar.c) Syscall param setregid(egid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:930) + by 0x........: main (scalar.c) ----------------------------------------------------- 205: __NR_getgroups32 2s 1m ----------------------------------------------------- Syscall param getgroups(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:934) + by 0x........: main (scalar.c) Syscall param getgroups(list) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:934) + by 0x........: main (scalar.c) Syscall param getgroups(list) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:934) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2836,15 +2836,15 @@ Syscall param getgroups(list) points to unaddressable byte(s) ----------------------------------------------------- Syscall param setgroups(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:938) + by 0x........: main (scalar.c) Syscall param setgroups(list) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:938) + by 0x........: main (scalar.c) Syscall param setgroups(list) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:938) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2852,59 +2852,59 @@ Syscall param setgroups(list) points to unaddressable byte(s) ----------------------------------------------------- Syscall param fchown(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:942) + by 0x........: main (scalar.c) Syscall param fchown(owner) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:942) + by 0x........: main (scalar.c) Syscall param fchown(group) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:942) + by 0x........: main (scalar.c) ----------------------------------------------------- 208: __NR_setresuid32 3s 0m ----------------------------------------------------- Syscall param setresuid(ruid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:946) + by 0x........: main (scalar.c) Syscall param setresuid(euid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:946) + by 0x........: main (scalar.c) Syscall param setresuid(suid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:946) + by 0x........: main (scalar.c) ----------------------------------------------------- 209: __NR_getresuid32 3s 3m ----------------------------------------------------- Syscall param getresuid(ruid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:950) + by 0x........: main (scalar.c) Syscall param getresuid(euid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:950) + by 0x........: main (scalar.c) Syscall param getresuid(suid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:950) + by 0x........: main (scalar.c) Syscall param getresuid(ruid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:950) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param getresuid(euid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:950) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param getresuid(suid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:950) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2912,44 +2912,44 @@ Syscall param getresuid(suid) points to unaddressable byte(s) ----------------------------------------------------- Syscall param setresgid(rgid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:954) + by 0x........: main (scalar.c) Syscall param setresgid(egid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:954) + by 0x........: main (scalar.c) Syscall param setresgid(sgid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:954) + by 0x........: main (scalar.c) ----------------------------------------------------- 211: __NR_getresgid32 3s 3m ----------------------------------------------------- Syscall param getresgid(rgid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:958) + by 0x........: main (scalar.c) Syscall param getresgid(egid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:958) + by 0x........: main (scalar.c) Syscall param getresgid(sgid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:958) + by 0x........: main (scalar.c) Syscall param getresgid(rgid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:958) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param getresgid(egid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:958) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param getresgid(sgid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:958) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2957,19 +2957,19 @@ Syscall param getresgid(sgid) points to unaddressable byte(s) ----------------------------------------------------- Syscall param chown(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:962) + by 0x........: main (scalar.c) Syscall param chown(owner) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:962) + by 0x........: main (scalar.c) Syscall param chown(group) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:962) + by 0x........: main (scalar.c) Syscall param chown(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:962) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -2977,28 +2977,28 @@ Syscall param chown(path) points to unaddressable byte(s) ----------------------------------------------------- Syscall param setuid(uid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:966) + by 0x........: main (scalar.c) ----------------------------------------------------- 214: __NR_setgid32 1s 0m ----------------------------------------------------- Syscall param setgid(gid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:970) + by 0x........: main (scalar.c) ----------------------------------------------------- 215: __NR_setfsuid32 1s 0m ----------------------------------------------------- Syscall param setfsuid(uid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:974) + by 0x........: main (scalar.c) ----------------------------------------------------- 216: __NR_setfsgid32 1s 0m ----------------------------------------------------- Syscall param setfsgid(gid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:978) + by 0x........: main (scalar.c) ----------------------------------------------------- 217: __NR_pivot_root n/a @@ -3008,19 +3008,19 @@ Syscall param setfsgid(gid) contains uninitialised byte(s) ----------------------------------------------------- Syscall param mincore(start) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:986) + by 0x........: main (scalar.c) Syscall param mincore(length) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:986) + by 0x........: main (scalar.c) Syscall param mincore(vec) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:986) + by 0x........: main (scalar.c) Syscall param mincore(vec) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:986) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3028,34 +3028,34 @@ Syscall param mincore(vec) points to unaddressable byte(s) ----------------------------------------------------- Syscall param madvise(start) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:990) + by 0x........: main (scalar.c) Syscall param madvise(length) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:990) + by 0x........: main (scalar.c) Syscall param madvise(advice) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:990) + by 0x........: main (scalar.c) ----------------------------------------------------- 220: __NR_getdents64 3s 1m ----------------------------------------------------- Syscall param getdents64(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:994) + by 0x........: main (scalar.c) Syscall param getdents64(dirp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:994) + by 0x........: main (scalar.c) Syscall param getdents64(count) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:994) + by 0x........: main (scalar.c) Syscall param getdents64(dirp) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:994) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3063,25 +3063,25 @@ Syscall param getdents64(dirp) points to unaddressable byte(s) ----------------------------------------------------- Syscall param fcntl64(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1001) + by 0x........: main (scalar.c) Syscall param fcntl64(cmd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1001) + by 0x........: main (scalar.c) ----------------------------------------------------- 221: __NR_fcntl64 (DUPFD) 1s 0m ----------------------------------------------------- Syscall param fcntl64(arg) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1005) + by 0x........: main (scalar.c) ----------------------------------------------------- 221: __NR_fcntl64 (GETLK) 1s 0m ----------------------------------------------------- Syscall param fcntl64(lock) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1011) + by 0x........: main (scalar.c) ----------------------------------------------------- 222: 222 ni @@ -3100,37 +3100,37 @@ Syscall param fcntl64(lock) contains uninitialised byte(s) ----------------------------------------------------- Syscall param setxattr(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1031) + by 0x........: main (scalar.c) Syscall param setxattr(name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1031) + by 0x........: main (scalar.c) Syscall param setxattr(value) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1031) + by 0x........: main (scalar.c) Syscall param setxattr(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1031) + by 0x........: main (scalar.c) Syscall param setxattr(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1031) + by 0x........: main (scalar.c) Syscall param setxattr(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1031) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param setxattr(name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1031) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param setxattr(value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1031) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3138,37 +3138,37 @@ Syscall param setxattr(value) points to unaddressable byte(s) ----------------------------------------------------- Syscall param lsetxattr(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1035) + by 0x........: main (scalar.c) Syscall param lsetxattr(name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1035) + by 0x........: main (scalar.c) Syscall param lsetxattr(value) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1035) + by 0x........: main (scalar.c) Syscall param lsetxattr(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1035) + by 0x........: main (scalar.c) Syscall param lsetxattr(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1035) + by 0x........: main (scalar.c) Syscall param lsetxattr(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1035) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param lsetxattr(name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1035) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param lsetxattr(value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1035) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3176,32 +3176,32 @@ Syscall param lsetxattr(value) points to unaddressable byte(s) ----------------------------------------------------- Syscall param fsetxattr(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1039) + by 0x........: main (scalar.c) Syscall param fsetxattr(name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1039) + by 0x........: main (scalar.c) Syscall param fsetxattr(value) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1039) + by 0x........: main (scalar.c) Syscall param fsetxattr(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1039) + by 0x........: main (scalar.c) Syscall param fsetxattr(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1039) + by 0x........: main (scalar.c) Syscall param fsetxattr(name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1039) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param fsetxattr(value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1039) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3209,33 +3209,33 @@ Syscall param fsetxattr(value) points to unaddressable byte(s) ----------------------------------------------------- Syscall param getxattr(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1043) + by 0x........: main (scalar.c) Syscall param getxattr(name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1043) + by 0x........: main (scalar.c) Syscall param getxattr(value) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1043) + by 0x........: main (scalar.c) Syscall param getxattr(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1043) + by 0x........: main (scalar.c) Syscall param getxattr(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1043) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param getxattr(name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1043) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param getxattr(value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1043) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3243,33 +3243,33 @@ Syscall param getxattr(value) points to unaddressable byte(s) ----------------------------------------------------- Syscall param lgetxattr(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1047) + by 0x........: main (scalar.c) Syscall param lgetxattr(name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1047) + by 0x........: main (scalar.c) Syscall param lgetxattr(value) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1047) + by 0x........: main (scalar.c) Syscall param lgetxattr(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1047) + by 0x........: main (scalar.c) Syscall param lgetxattr(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1047) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param lgetxattr(name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1047) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param lgetxattr(value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1047) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3277,28 +3277,28 @@ Syscall param lgetxattr(value) points to unaddressable byte(s) ----------------------------------------------------- Syscall param fgetxattr(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1051) + by 0x........: main (scalar.c) Syscall param fgetxattr(name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1051) + by 0x........: main (scalar.c) Syscall param fgetxattr(value) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1051) + by 0x........: main (scalar.c) Syscall param fgetxattr(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1051) + by 0x........: main (scalar.c) Syscall param fgetxattr(name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1051) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param fgetxattr(value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1051) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3306,24 +3306,24 @@ Syscall param fgetxattr(value) points to unaddressable byte(s) ----------------------------------------------------- Syscall param listxattr(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1055) + by 0x........: main (scalar.c) Syscall param listxattr(list) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1055) + by 0x........: main (scalar.c) Syscall param listxattr(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1055) + by 0x........: main (scalar.c) Syscall param listxattr(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1055) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param listxattr(list) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1055) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3331,24 +3331,24 @@ Syscall param listxattr(list) points to unaddressable byte(s) ----------------------------------------------------- Syscall param llistxattr(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1059) + by 0x........: main (scalar.c) Syscall param llistxattr(list) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1059) + by 0x........: main (scalar.c) Syscall param llistxattr(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1059) + by 0x........: main (scalar.c) Syscall param llistxattr(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1059) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param llistxattr(list) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1059) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3356,19 +3356,19 @@ Syscall param llistxattr(list) points to unaddressable byte(s) ----------------------------------------------------- Syscall param flistxattr(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1063) + by 0x........: main (scalar.c) Syscall param flistxattr(list) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1063) + by 0x........: main (scalar.c) Syscall param flistxattr(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1063) + by 0x........: main (scalar.c) Syscall param flistxattr(list) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1063) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3376,20 +3376,20 @@ Syscall param flistxattr(list) points to unaddressable byte(s) ----------------------------------------------------- Syscall param removexattr(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1067) + by 0x........: main (scalar.c) Syscall param removexattr(name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1067) + by 0x........: main (scalar.c) Syscall param removexattr(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1067) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param removexattr(name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1067) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3397,20 +3397,20 @@ Syscall param removexattr(name) points to unaddressable byte(s) ----------------------------------------------------- Syscall param lremovexattr(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1071) + by 0x........: main (scalar.c) Syscall param lremovexattr(name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1071) + by 0x........: main (scalar.c) Syscall param lremovexattr(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1071) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param lremovexattr(name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1071) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3418,15 +3418,15 @@ Syscall param lremovexattr(name) points to unaddressable byte(s) ----------------------------------------------------- Syscall param fremovexattr(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1075) + by 0x........: main (scalar.c) Syscall param fremovexattr(name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1075) + by 0x........: main (scalar.c) Syscall param fremovexattr(name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1075) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3437,23 +3437,23 @@ Syscall param fremovexattr(name) points to unaddressable byte(s) ----------------------------------------------------- Syscall param sendfile64(out_fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1083) + by 0x........: main (scalar.c) Syscall param sendfile64(in_fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1083) + by 0x........: main (scalar.c) Syscall param sendfile64(offset) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1083) + by 0x........: main (scalar.c) Syscall param sendfile64(count) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1083) + by 0x........: main (scalar.c) Syscall param sendfile64(offset) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1083) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3461,28 +3461,28 @@ Syscall param sendfile64(offset) points to unaddressable byte(s) ----------------------------------------------------- Syscall param futex(futex) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1091) + by 0x........: main (scalar.c) Syscall param futex(op) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1091) + by 0x........: main (scalar.c) Syscall param futex(val) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1091) + by 0x........: main (scalar.c) Syscall param futex(utime) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1091) + by 0x........: main (scalar.c) Syscall param futex(futex) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1091) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param futex(timeout) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1091) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3490,19 +3490,19 @@ Syscall param futex(timeout) points to unaddressable byte(s) ----------------------------------------------------- Syscall param sched_setaffinity(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1095) + by 0x........: main (scalar.c) Syscall param sched_setaffinity(len) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1095) + by 0x........: main (scalar.c) Syscall param sched_setaffinity(mask) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1095) + by 0x........: main (scalar.c) Syscall param sched_setaffinity(mask) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1095) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3510,19 +3510,19 @@ Syscall param sched_setaffinity(mask) points to unaddressable byte(s) ----------------------------------------------------- Syscall param sched_getaffinity(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1099) + by 0x........: main (scalar.c) Syscall param sched_getaffinity(len) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1099) + by 0x........: main (scalar.c) Syscall param sched_getaffinity(mask) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1099) + by 0x........: main (scalar.c) Syscall param sched_getaffinity(mask) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1099) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3530,11 +3530,11 @@ Syscall param sched_getaffinity(mask) points to unaddressable byte(s) ----------------------------------------------------- Syscall param set_thread_area(u_info) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1103) + by 0x........: main (scalar.c) Syscall param set_thread_area(u_info) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1103) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Warning: bad u_info address 0x........ in set_thread_area @@ -3543,11 +3543,11 @@ Warning: bad u_info address 0x........ in set_thread_area ----------------------------------------------------- Syscall param get_thread_area(u_info) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1107) + by 0x........: main (scalar.c) Syscall param get_thread_area(u_info) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1107) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Warning: bad u_info address 0x........ in get_thread_area @@ -3556,15 +3556,15 @@ Warning: bad u_info address 0x........ in get_thread_area ----------------------------------------------------- Syscall param io_setup(nr_events) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1111) + by 0x........: main (scalar.c) Syscall param io_setup(ctxp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1111) + by 0x........: main (scalar.c) Syscall param io_setup(ctxp) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1111) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3572,39 +3572,39 @@ Syscall param io_setup(ctxp) points to unaddressable byte(s) ----------------------------------------------------- Syscall param io_destroy(ctx) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1124) + by 0x........: main (scalar.c) ----------------------------------------------------- 247: __NR_io_getevents 5s 2m ----------------------------------------------------- Syscall param io_getevents(ctx_id) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1129) + by 0x........: main (scalar.c) Syscall param io_getevents(min_nr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1129) + by 0x........: main (scalar.c) Syscall param io_getevents(nr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1129) + by 0x........: main (scalar.c) Syscall param io_getevents(events) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1129) + by 0x........: main (scalar.c) Syscall param io_getevents(timeout) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1129) + by 0x........: main (scalar.c) Syscall param io_getevents(events) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1129) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param io_getevents(timeout) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1129) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3612,19 +3612,19 @@ Syscall param io_getevents(timeout) points to unaddressable byte(s) ----------------------------------------------------- Syscall param io_submit(ctx_id) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1133) + by 0x........: main (scalar.c) Syscall param io_submit(nr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1133) + by 0x........: main (scalar.c) Syscall param io_submit(iocbpp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1133) + by 0x........: main (scalar.c) Syscall param io_submit(iocbpp) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1133) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3632,24 +3632,24 @@ Syscall param io_submit(iocbpp) points to unaddressable byte(s) ----------------------------------------------------- Syscall param io_cancel(ctx_id) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1137) + by 0x........: main (scalar.c) Syscall param io_cancel(iocb) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1137) + by 0x........: main (scalar.c) Syscall param io_cancel(result) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1137) + by 0x........: main (scalar.c) Syscall param io_cancel(iocb) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1137) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param io_cancel(result) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1137) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3666,23 +3666,23 @@ Syscall param io_cancel(result) points to unaddressable byte(s) ----------------------------------------------------- Syscall param lookup_dcookie(cookie_low) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1153) + by 0x........: main (scalar.c) Syscall param lookup_dcookie(cookie_high) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1153) + by 0x........: main (scalar.c) Syscall param lookup_dcookie(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1153) + by 0x........: main (scalar.c) Syscall param lookup_dcookie(len) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1153) + by 0x........: main (scalar.c) Syscall param lookup_dcookie(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1153) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3690,30 +3690,30 @@ Syscall param lookup_dcookie(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param epoll_create(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1157) + by 0x........: main (scalar.c) ----------------------------------------------------- 255: __NR_epoll_ctl 4s 1m ----------------------------------------------------- Syscall param epoll_ctl(epfd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1161) + by 0x........: main (scalar.c) Syscall param epoll_ctl(op) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1161) + by 0x........: main (scalar.c) Syscall param epoll_ctl(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1161) + by 0x........: main (scalar.c) Syscall param epoll_ctl(event) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1161) + by 0x........: main (scalar.c) Syscall param epoll_ctl(event) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1161) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3721,23 +3721,23 @@ Syscall param epoll_ctl(event) points to unaddressable byte(s) ----------------------------------------------------- Syscall param epoll_wait(epfd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1165) + by 0x........: main (scalar.c) Syscall param epoll_wait(events) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1165) + by 0x........: main (scalar.c) Syscall param epoll_wait(maxevents) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1165) + by 0x........: main (scalar.c) Syscall param epoll_wait(timeout) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1165) + by 0x........: main (scalar.c) Syscall param epoll_wait(events) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1165) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3748,41 +3748,41 @@ Syscall param epoll_wait(events) points to unaddressable byte(s) ----------------------------------------------------- Syscall param set_tid_address(tidptr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1173) + by 0x........: main (scalar.c) ----------------------------------------------------- 259: __NR_timer_create 3s 2m ----------------------------------------------------- Syscall param timer_create(clockid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1177) + by 0x........: main (scalar.c) Syscall param timer_create(evp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1177) + by 0x........: main (scalar.c) Syscall param timer_create(timerid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1177) + by 0x........: main (scalar.c) Syscall param timer_create(evp.sigev_value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1177) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param timer_create(evp.sigev_signo) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1177) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param timer_create(evp.sigev_notify) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1177) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param timer_create(timerid) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1177) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3790,28 +3790,28 @@ Syscall param timer_create(timerid) points to unaddressable byte(s) ----------------------------------------------------- Syscall param timer_settime(timerid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1181) + by 0x........: main (scalar.c) Syscall param timer_settime(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1181) + by 0x........: main (scalar.c) Syscall param timer_settime(value) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1181) + by 0x........: main (scalar.c) Syscall param timer_settime(ovalue) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1181) + by 0x........: main (scalar.c) Syscall param timer_settime(value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1181) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param timer_settime(ovalue) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1181) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3819,15 +3819,15 @@ Syscall param timer_settime(ovalue) points to unaddressable byte(s) ----------------------------------------------------- Syscall param timer_gettime(timerid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1185) + by 0x........: main (scalar.c) Syscall param timer_gettime(value) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1185) + by 0x........: main (scalar.c) Syscall param timer_gettime(value) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1185) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3835,29 +3835,29 @@ Syscall param timer_gettime(value) points to unaddressable byte(s) ----------------------------------------------------- Syscall param timer_getoverrun(timerid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1189) + by 0x........: main (scalar.c) ----------------------------------------------------- 263: __NR_timer_delete 1s 0m ----------------------------------------------------- Syscall param timer_delete(timerid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1193) + by 0x........: main (scalar.c) ----------------------------------------------------- 264: __NR_clock_settime 2s 1m ----------------------------------------------------- Syscall param clock_settime(clk_id) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1197) + by 0x........: main (scalar.c) Syscall param clock_settime(tp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1197) + by 0x........: main (scalar.c) Syscall param clock_settime(tp) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1197) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3865,15 +3865,15 @@ Syscall param clock_settime(tp) points to unaddressable byte(s) ----------------------------------------------------- Syscall param clock_gettime(clk_id) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1201) + by 0x........: main (scalar.c) Syscall param clock_gettime(tp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1201) + by 0x........: main (scalar.c) Syscall param clock_gettime(tp) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1201) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3881,15 +3881,15 @@ Syscall param clock_gettime(tp) points to unaddressable byte(s) ----------------------------------------------------- Syscall param clock_getres(clk_id) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1205) + by 0x........: main (scalar.c) Syscall param clock_getres(res) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1205) + by 0x........: main (scalar.c) Syscall param clock_getres(res) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1205) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3900,24 +3900,24 @@ Syscall param clock_getres(res) points to unaddressable byte(s) ----------------------------------------------------- Syscall param statfs64(path) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1213) + by 0x........: main (scalar.c) Syscall param statfs64(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1213) + by 0x........: main (scalar.c) Syscall param statfs64(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1213) + by 0x........: main (scalar.c) Syscall param statfs64(path) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1213) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param statfs64(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1213) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3925,19 +3925,19 @@ Syscall param statfs64(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param fstatfs64(fd) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1217) + by 0x........: main (scalar.c) Syscall param fstatfs64(size) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1217) + by 0x........: main (scalar.c) Syscall param fstatfs64(buf) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1217) + by 0x........: main (scalar.c) Syscall param fstatfs64(buf) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1217) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3948,25 +3948,25 @@ Syscall param fstatfs64(buf) points to unaddressable byte(s) ----------------------------------------------------- Syscall param utimes(filename) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1225) + by 0x........: main (scalar.c) Syscall param utimes(tvp) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1225) + by 0x........: main (scalar.c) Syscall param utimes(filename) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1225) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param utimes(tvp[0]) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1225) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param utimes(tvp[1]) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1225) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -3989,33 +3989,33 @@ Syscall param utimes(tvp[1]) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mq_open(name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1249) + by 0x........: main (scalar.c) Syscall param mq_open(oflag) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1249) + by 0x........: main (scalar.c) Syscall param mq_open(mode) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1249) + by 0x........: main (scalar.c) Syscall param mq_open(attr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1249) + by 0x........: main (scalar.c) Syscall param mq_open(name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1249) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param mq_open(attr->mq_maxmsg) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1249) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param mq_open(attr->mq_msgsize) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1249) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -4023,11 +4023,11 @@ Syscall param mq_open(attr->mq_msgsize) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mq_unlink(name) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1253) + by 0x........: main (scalar.c) Syscall param mq_unlink(name) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1253) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -4035,32 +4035,32 @@ Syscall param mq_unlink(name) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mq_timedsend(mqdes) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1257) + by 0x........: main (scalar.c) Syscall param mq_timedsend(msg_ptr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1257) + by 0x........: main (scalar.c) Syscall param mq_timedsend(msg_len) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1257) + by 0x........: main (scalar.c) Syscall param mq_timedsend(msg_prio) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1257) + by 0x........: main (scalar.c) Syscall param mq_timedsend(abs_timeout) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1257) + by 0x........: main (scalar.c) Syscall param mq_timedsend(msg_ptr) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1257) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param mq_timedsend(abs_timeout) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1257) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -4068,37 +4068,37 @@ Syscall param mq_timedsend(abs_timeout) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mq_timedreceive(mqdes) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1261) + by 0x........: main (scalar.c) Syscall param mq_timedreceive(msg_ptr) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1261) + by 0x........: main (scalar.c) Syscall param mq_timedreceive(msg_len) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1261) + by 0x........: main (scalar.c) Syscall param mq_timedreceive(msg_prio) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1261) + by 0x........: main (scalar.c) Syscall param mq_timedreceive(abs_timeout) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1261) + by 0x........: main (scalar.c) Syscall param mq_timedreceive(msg_ptr) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1261) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param mq_timedreceive(msg_prio) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1261) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param mq_timedreceive(abs_timeout) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1261) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -4106,15 +4106,15 @@ Syscall param mq_timedreceive(abs_timeout) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mq_notify(mqdes) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1265) + by 0x........: main (scalar.c) Syscall param mq_notify(notification) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1265) + by 0x........: main (scalar.c) Syscall param mq_notify(notification) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1265) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -4122,24 +4122,24 @@ Syscall param mq_notify(notification) points to unaddressable byte(s) ----------------------------------------------------- Syscall param mq_getsetattr(mqdes) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1269) + by 0x........: main (scalar.c) Syscall param mq_getsetattr(mqstat) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1269) + by 0x........: main (scalar.c) Syscall param mq_getsetattr(omqstat) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1269) + by 0x........: main (scalar.c) Syscall param mq_getsetattr(mqstat->mq_flags) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1269) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param mq_getsetattr(omqstat) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1269) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -4150,43 +4150,43 @@ Syscall param mq_getsetattr(omqstat) points to unaddressable byte(s) ----------------------------------------------------- Syscall param epoll_create1(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1277) + by 0x........: main (scalar.c) ----------------------------------------------------- 347:__NR_process_vm_readv 6s 2m ----------------------------------------------------- Syscall param process_vm_readv(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1281) + by 0x........: main (scalar.c) Syscall param process_vm_readv(lvec) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1281) + by 0x........: main (scalar.c) Syscall param process_vm_readv(liovcnt) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1281) + by 0x........: main (scalar.c) Syscall param process_vm_readv(rvec) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1281) + by 0x........: main (scalar.c) Syscall param process_vm_readv(riovcnt) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1281) + by 0x........: main (scalar.c) Syscall param process_vm_readv(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1281) + by 0x........: main (scalar.c) Syscall param process_vm_readv(lvec) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1281) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param process_vm_readv(rvec) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1281) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -4194,36 +4194,36 @@ Syscall param process_vm_readv(rvec) points to unaddressable byte(s) ----------------------------------------------------- Syscall param process_vm_writev(pid) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1285) + by 0x........: main (scalar.c) Syscall param process_vm_writev(lvec) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1285) + by 0x........: main (scalar.c) Syscall param process_vm_writev(liovcnt) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1285) + by 0x........: main (scalar.c) Syscall param process_vm_writev(rvec) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1285) + by 0x........: main (scalar.c) Syscall param process_vm_writev(riovcnt) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1285) + by 0x........: main (scalar.c) Syscall param process_vm_writev(flags) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1285) + by 0x........: main (scalar.c) Syscall param process_vm_writev(lvec) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1285) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param process_vm_writev(rvec) points to unaddressable byte(s) ... - by 0x........: main (scalar.c:1285) + by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- @@ -4239,5 +4239,5 @@ it at http://valgrind.org/support/bug_reports.html. ----------------------------------------------------- Syscall param exit(status) contains uninitialised byte(s) ... - by 0x........: main (scalar.c:1293) + by 0x........: main (scalar.c) diff --git a/memcheck/tests/x86-linux/scalar.vgtest b/memcheck/tests/x86-linux/scalar.vgtest index 53e87e8d7..81e72b047 100644 --- a/memcheck/tests/x86-linux/scalar.vgtest +++ b/memcheck/tests/x86-linux/scalar.vgtest @@ -2,4 +2,5 @@ prog: scalar # Do not run under root prereq: [ `id -u` -ne 0 ] vgopts: -q --error-limit=no +stderr_filter: filter_scalar args: < scalar.c From 446ee179cec7dae91534bb781ef3defae26a4e10 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sat, 23 Aug 2025 13:37:46 +0200 Subject: [PATCH 225/412] Bug 508777 - amd64-linux: add minimal scalar test --- .gitignore | 1 + NEWS | 1 + memcheck/tests/amd64-linux/Makefile.am | 9 ++- memcheck/tests/amd64-linux/filter_scalar | 7 +++ memcheck/tests/amd64-linux/scalar.c | 58 +++++++++++++++++ memcheck/tests/amd64-linux/scalar.h | 65 ++++++++++++++++++++ memcheck/tests/amd64-linux/scalar.stderr.exp | 62 +++++++++++++++++++ memcheck/tests/amd64-linux/scalar.vgtest | 6 ++ 8 files changed, 207 insertions(+), 2 deletions(-) create mode 100755 memcheck/tests/amd64-linux/filter_scalar create mode 100644 memcheck/tests/amd64-linux/scalar.c create mode 100644 memcheck/tests/amd64-linux/scalar.h create mode 100644 memcheck/tests/amd64-linux/scalar.stderr.exp create mode 100644 memcheck/tests/amd64-linux/scalar.vgtest diff --git a/.gitignore b/.gitignore index 569a8fd5c..80924f997 100644 --- a/.gitignore +++ b/.gitignore @@ -1102,6 +1102,7 @@ /memcheck/tests/amd64-linux/defcfaexpr /memcheck/tests/amd64-linux/int3-amd64 /memcheck/tests/amd64-linux/reallocarray +/memcheck/tests/amd64-linux/scalar /memcheck/tests/amd64-linux/Makefile /memcheck/tests/amd64-linux/Makefile.in diff --git a/NEWS b/NEWS index 0d0ed35ba..b3bce5400 100644 --- a/NEWS +++ b/NEWS @@ -87,6 +87,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508093 VALGRIND_CLO_CHANGE does not update vex_control 508154 PRE(sys_fchownat) not handling VKI_AT_FDCWD 508638 Self-hosting not working on FreeBSD +508777 amd64-linux: add minimal scalar test 508869 x86-linux: simplify scalar test output To see details of a given bug, visit diff --git a/memcheck/tests/amd64-linux/Makefile.am b/memcheck/tests/amd64-linux/Makefile.am index 26e8c8ed5..a3b5df5a6 100644 --- a/memcheck/tests/amd64-linux/Makefile.am +++ b/memcheck/tests/amd64-linux/Makefile.am @@ -2,7 +2,9 @@ include $(top_srcdir)/Makefile.tool-tests.am dist_noinst_SCRIPTS = \ - filter_stderr filter_defcfaexpr + filter_defcfaexpr filter_scalar filter_stderr + +noinst_HEADERS = scalar.h EXTRA_DIST = \ access_below_sp_1.vgtest \ @@ -11,12 +13,14 @@ EXTRA_DIST = \ access_below_sp_2.stderr.exp access_below_sp_2.stdout.exp \ defcfaexpr.vgtest defcfaexpr.stderr.exp \ int3-amd64.vgtest int3-amd64.stderr.exp int3-amd64.stdout.exp \ + scalar.stderr.exp scalar.vgtest \ reallocarray.vgtest reallocarray.stderr.exp check_PROGRAMS = \ access_below_sp \ defcfaexpr \ - int3-amd64 + int3-amd64 \ + scalar if HAVE_REALLOCARRAY check_PROGRAMS += reallocarray @@ -29,3 +33,4 @@ AM_CCASFLAGS += @FLAG_M64@ defcfaexpr_SOURCES = defcfaexpr.S defcfaexpr_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@ reallocarray_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ +scalar_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ diff --git a/memcheck/tests/amd64-linux/filter_scalar b/memcheck/tests/amd64-linux/filter_scalar new file mode 100755 index 000000000..ee19ffaf2 --- /dev/null +++ b/memcheck/tests/amd64-linux/filter_scalar @@ -0,0 +1,7 @@ +#! /bin/sh + +# remove line numbers as they just cause larger patches +sed "/: main /s/\(scalar.c\):[0-9]*)/\1)/" | + +../filter_stderr "$@" + diff --git a/memcheck/tests/amd64-linux/scalar.c b/memcheck/tests/amd64-linux/scalar.c new file mode 100644 index 000000000..703d46860 --- /dev/null +++ b/memcheck/tests/amd64-linux/scalar.c @@ -0,0 +1,58 @@ +#define _GNU_SOURCE + +#include "../../memcheck.h" +#include "scalar.h" +#include + +// Here we are trying to trigger every syscall error (scalar errors and +// memory errors) for every syscall. We do this by passing a lot of bogus +// arguments, mostly 0 and 1 (often it's 1 because NULL ptr args often aren't +// checked for memory errors, or in order to have a non-zero length used +// with some buffer). So most of the syscalls don't actually succeed and do +// anything. +// +// Occasionally we have to be careful not to cause Valgrind to seg fault in +// its pre-syscall wrappers; it does so because it can't know in general +// when memory is unaddressable, and so tries to dereference it when doing +// PRE_MEM_READ/PRE_MEM_WRITE calls. (Note that Memcheck will +// always issue an error message immediately before these seg faults occur). +// +// The output has numbers like "3s 2m" for each syscall. "s" is short for +// "scalar", ie. the argument itself is undefined. "m" is short for "memory", +// ie. the argument points to memory which is unaddressable. + +int main(void) +{ + // uninitialised, but we know px[0] is 0x0 + long* px = malloc(sizeof(long)); + long x0 = px[0]; + long res; + + // All __NR_xxx numbers are taken from amd64 + + /* Check the syscall number 0 and 1 two trivial generic syscalls. */ + + /* __NR_read 0 */ + /* Nb: here we are also getting an error from the syscall arg itself. */ + GO(__NR_read, "1+3s 1m"); + SY(__NR_read + x0, x0, x0, x0 + 1); FAIL; + + /* __NR_write 1 */ + GO(__NR_write, "3s 1m"); + SY(__NR_write, x0, x0, x0 + 1); FAIL; + + // __NR_exit 60 + GO(__NR_exit, "below"); + // (see below) + + // no such syscall... + GO(9999, "1e"); + SY(9999); FAIL; + + // __NR_exit 1 + GO(__NR_exit, "1s 0m"); + SY(__NR_exit, x0); FAIL; + + assert(0); +} + diff --git a/memcheck/tests/amd64-linux/scalar.h b/memcheck/tests/amd64-linux/scalar.h new file mode 100644 index 000000000..52f742e4a --- /dev/null +++ b/memcheck/tests/amd64-linux/scalar.h @@ -0,0 +1,65 @@ +#include "../../../include/vki/vki-scnums-x86-linux.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef __THROW +#define __THROW +#endif + +// Since we use vki_unistd.h, we can't include . So we have to +// declare this ourselves. +extern long int syscall (long int __sysno, ...) __THROW; + +// Thorough syscall scalar arg checking. Also serves as thorough checking +// for (very) basic syscall use. Generally not trying to do anything +// meaningful with the syscalls. + +#define GO(__NR_xxx, s) \ + fprintf(stderr, "-----------------------------------------------------\n" \ + "%3d:%20s %s\n" \ + "-----------------------------------------------------\n", \ + __NR_xxx, #__NR_xxx, s); + +#define SY res = syscall + +#define FAIL assert(-1 == res); +#define SUCC assert(-1 != res); +#define SUCC_OR_FAIL /* no test */ + +#define FAILx(E) \ + do { \ + int myerrno = errno; \ + if (-1 == res) { \ + if (E == myerrno) { \ + /* as expected */ \ + } else { \ + fprintf(stderr, "Expected error %s (%d), got %d\n", #E, E, myerrno); \ + exit(1); \ + } \ + } else { \ + fprintf(stderr, "Expected error %s (%d), got success\n", #E, E); \ + exit(1); \ + } \ + } while (0); + +#define SUCC_OR_FAILx(E) \ + do { \ + int myerrno = errno; \ + if (-1 == res) { \ + if (E == myerrno) { \ + /* as expected */ \ + } else { \ + fprintf(stderr, "Expected error %s (%d), got %d\n", #E, E, myerrno); \ + exit(1); \ + } \ + } \ + } while (0); diff --git a/memcheck/tests/amd64-linux/scalar.stderr.exp b/memcheck/tests/amd64-linux/scalar.stderr.exp new file mode 100644 index 000000000..8f7c3073c --- /dev/null +++ b/memcheck/tests/amd64-linux/scalar.stderr.exp @@ -0,0 +1,62 @@ +----------------------------------------------------- + 0: __NR_read 1+3s 1m +----------------------------------------------------- +Syscall param (syscallno) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param read(fd) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param read(buf) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param read(count) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param read(buf) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +----------------------------------------------------- + 1: __NR_write 3s 1m +----------------------------------------------------- +Syscall param write(fd) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param write(buf) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param write(count) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param write(buf) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +----------------------------------------------------- + 60: __NR_exit below +----------------------------------------------------- +----------------------------------------------------- +9999: 9999 1e +----------------------------------------------------- +WARNING: unhandled amd64-linux syscall: 9999 +You may be able to write your own handler. +Read the file README_MISSING_SYSCALL_OR_IOCTL. +Nevertheless we consider this a bug. Please report +it at http://valgrind.org/support/bug_reports.html. +----------------------------------------------------- + 60: __NR_exit 1s 0m +----------------------------------------------------- +Syscall param exit(status) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + diff --git a/memcheck/tests/amd64-linux/scalar.vgtest b/memcheck/tests/amd64-linux/scalar.vgtest new file mode 100644 index 000000000..81e72b047 --- /dev/null +++ b/memcheck/tests/amd64-linux/scalar.vgtest @@ -0,0 +1,6 @@ +prog: scalar +# Do not run under root +prereq: [ `id -u` -ne 0 ] +vgopts: -q --error-limit=no +stderr_filter: filter_scalar +args: < scalar.c From 405fb0daaf329068a5219ef4c0e645cea872cf75 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sat, 23 Aug 2025 13:37:46 +0200 Subject: [PATCH 226/412] Bug 508778 - syscall-wrapper waitid warns about infop=null This is used by e.g. Qt: https://github.com/qt/qtbase/blob/e17798560b107b7abd5f2cf472d942e8ac4213ff/src/3rdparty/forkfd/forkfd_linux.c#L128 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 6 ++- memcheck/tests/amd64-linux/scalar.c | 7 +++ memcheck/tests/amd64-linux/scalar.stderr.exp | 56 ++++++++++++++++++++ memcheck/tests/x86-linux/scalar.c | 7 +++ memcheck/tests/x86-linux/scalar.stderr.exp | 56 ++++++++++++++++++++ 6 files changed, 131 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index b3bce5400..0d6e10ee9 100644 --- a/NEWS +++ b/NEWS @@ -88,6 +88,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508154 PRE(sys_fchownat) not handling VKI_AT_FDCWD 508638 Self-hosting not working on FreeBSD 508777 amd64-linux: add minimal scalar test +508778 syscall-wrapper waitid warns about infop=null 508869 x86-linux: simplify scalar test output To see details of a given bug, visit diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index f5723f8cd..a740912f8 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4087,13 +4087,15 @@ PRE(sys_waitid) PRE_REG_READ5(int32_t, "sys_waitid", int, which, vki_pid_t, pid, struct vki_siginfo *, infop, int, options, struct vki_rusage *, ru); - PRE_MEM_WRITE( "waitid(infop)", ARG3, sizeof(struct vki_siginfo) ); + if (ARG3 != 0) + PRE_MEM_WRITE( "waitid(infop)", ARG3, sizeof(struct vki_siginfo) ); if (ARG5 != 0) PRE_MEM_WRITE( "waitid(ru)", ARG5, sizeof(struct vki_rusage) ); } POST(sys_waitid) { - POST_MEM_WRITE( ARG3, sizeof(struct vki_siginfo) ); + if (ARG3 != 0) + POST_MEM_WRITE( ARG3, sizeof(struct vki_siginfo) ); if (ARG5 != 0) POST_MEM_WRITE( ARG5, sizeof(struct vki_rusage) ); } diff --git a/memcheck/tests/amd64-linux/scalar.c b/memcheck/tests/amd64-linux/scalar.c index 703d46860..5167fde2d 100644 --- a/memcheck/tests/amd64-linux/scalar.c +++ b/memcheck/tests/amd64-linux/scalar.c @@ -45,6 +45,13 @@ int main(void) GO(__NR_exit, "below"); // (see below) + // __NR_waitid 247 + GO(__NR_waitid, "5s 0m"); + SY(__NR_waitid, x0, x0, x0, x0, x0); FAIL; + + GO(__NR_waitid, "(infop,ru) 5s 2m"); + SY(__NR_waitid, x0, x0, x0 + 1, x0, x0 + 1); FAIL; + // no such syscall... GO(9999, "1e"); SY(9999); FAIL; diff --git a/memcheck/tests/amd64-linux/scalar.stderr.exp b/memcheck/tests/amd64-linux/scalar.stderr.exp index 8f7c3073c..12f6fcba3 100644 --- a/memcheck/tests/amd64-linux/scalar.stderr.exp +++ b/memcheck/tests/amd64-linux/scalar.stderr.exp @@ -45,6 +45,62 @@ Syscall param write(buf) points to unaddressable byte(s) ----------------------------------------------------- 60: __NR_exit below ----------------------------------------------------- +----------------------------------------------------- +247: __NR_waitid 5s 0m +----------------------------------------------------- +Syscall param sys_waitid(which) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(infop) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(options) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(ru) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +----------------------------------------------------- +247: __NR_waitid (infop,ru) 5s 2m +----------------------------------------------------- +Syscall param sys_waitid(which) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(infop) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(options) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(ru) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param waitid(infop) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param waitid(ru) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + ----------------------------------------------------- 9999: 9999 1e ----------------------------------------------------- diff --git a/memcheck/tests/x86-linux/scalar.c b/memcheck/tests/x86-linux/scalar.c index fe36a47ef..5141f0496 100644 --- a/memcheck/tests/x86-linux/scalar.c +++ b/memcheck/tests/x86-linux/scalar.c @@ -1272,6 +1272,13 @@ int main(void) GO(__NR_sys_kexec_load, "ni"); SY(__NR_sys_kexec_load); FAIL; + // __NR_waitid 284 + GO(__NR_waitid, "5s 0m"); + SY(__NR_waitid, x0, x0, x0, x0, x0); FAIL; + + GO(__NR_waitid, "(infop,ru) 5s 2m"); + SY(__NR_waitid, x0, x0, x0 + 1, x0, x0 + 2); FAIL; + // __NR_epoll_create1 329 GO(__NR_epoll_create1, "1s 0m"); SY(__NR_epoll_create1, x0); SUCC_OR_FAIL; diff --git a/memcheck/tests/x86-linux/scalar.stderr.exp b/memcheck/tests/x86-linux/scalar.stderr.exp index c878e4465..b75507547 100644 --- a/memcheck/tests/x86-linux/scalar.stderr.exp +++ b/memcheck/tests/x86-linux/scalar.stderr.exp @@ -4145,6 +4145,62 @@ Syscall param mq_getsetattr(omqstat) points to unaddressable byte(s) ----------------------------------------------------- 283: __NR_sys_kexec_load ni ----------------------------------------------------- +----------------------------------------------------- +284: __NR_waitid 5s 0m +----------------------------------------------------- +Syscall param sys_waitid(which) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(infop) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(options) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(ru) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +----------------------------------------------------- +284: __NR_waitid (infop,ru) 5s 2m +----------------------------------------------------- +Syscall param sys_waitid(which) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(infop) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(options) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param sys_waitid(ru) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param waitid(infop) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param waitid(ru) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + ----------------------------------------------------- 329: __NR_epoll_create1 1s 0m ----------------------------------------------------- From 700e78f257ad161b4bd040de2d6bd9f1de4ff0b2 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sat, 23 Aug 2025 13:37:46 +0200 Subject: [PATCH 227/412] Bug 508779 - PRE(sys_prlimit64): reorder check for memory validity so all errors are displayed and not just the first --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 14 +- memcheck/tests/amd64-linux/scalar.c | 22 ++++ memcheck/tests/amd64-linux/scalar.stderr.exp | 128 +++++++++++++++++++ memcheck/tests/x86-linux/scalar.c | 14 ++ memcheck/tests/x86-linux/scalar.stderr.exp | 96 ++++++++++++++ 6 files changed, 267 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 0d6e10ee9..b1f4d8d11 100644 --- a/NEWS +++ b/NEWS @@ -89,6 +89,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508638 Self-hosting not working on FreeBSD 508777 amd64-linux: add minimal scalar test 508778 syscall-wrapper waitid warns about infop=null +508779 PRE(sys_prlimit64): reorder check for memory validity 508869 x86-linux: simplify scalar test output To see details of a given bug, visit diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index a740912f8..785031c10 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2307,17 +2307,15 @@ PRE(sys_prlimit64) struct rlimit64 *, old_rlim); if (ARG3) { PRE_MEM_READ( "rlimit64(new_rlim)", ARG3, sizeof(struct vki_rlimit64) ); - if (!ML_(safe_to_deref)((void*)(Addr)ARG3, sizeof(struct vki_rlimit64))) { - SET_STATUS_Failure(VKI_EFAULT); - return; - } } if (ARG4) { PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct vki_rlimit64) ); - if (!ML_(safe_to_deref)((void*)(Addr)ARG4, sizeof(struct vki_rlimit64))) { - SET_STATUS_Failure(VKI_EFAULT); - return; - } + } + + if ((ARG3 && !ML_(safe_to_deref)((void*)(Addr)ARG3, sizeof(struct vki_rlimit64))) + || (ARG4 && !ML_(safe_to_deref)((void*)(Addr)ARG4, sizeof(struct vki_rlimit64)))) { + SET_STATUS_Failure(VKI_EFAULT); + return; } if (ARG3 && diff --git a/memcheck/tests/amd64-linux/scalar.c b/memcheck/tests/amd64-linux/scalar.c index 5167fde2d..fe133d8d2 100644 --- a/memcheck/tests/amd64-linux/scalar.c +++ b/memcheck/tests/amd64-linux/scalar.c @@ -3,6 +3,7 @@ #include "../../memcheck.h" #include "scalar.h" #include +#include // Here we are trying to trigger every syscall error (scalar errors and // memory errors) for every syscall. We do this by passing a lot of bogus @@ -45,6 +46,14 @@ int main(void) GO(__NR_exit, "below"); // (see below) + // __NR_getrlimit 97 + GO(__NR_getrlimit, "2s 1m"); + SY(__NR_getrlimit, x0, x0); FAIL; + + // __NR_setrlimit 160 + GO(__NR_setrlimit, "2s 1m"); + SY(__NR_setrlimit, x0, x0); FAILx(EFAULT); + // __NR_waitid 247 GO(__NR_waitid, "5s 0m"); SY(__NR_waitid, x0, x0, x0, x0, x0); FAIL; @@ -52,6 +61,19 @@ int main(void) GO(__NR_waitid, "(infop,ru) 5s 2m"); SY(__NR_waitid, x0, x0, x0 + 1, x0, x0 + 1); FAIL; + // __NR_prlimit64 302 + GO(__NR_prlimit64, "(nop) 4s 0m"); + SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0, x0); SUCC; + + GO(__NR_prlimit64, "(set) 4s 1m"); + SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0 + 1, x0); FAILx(EFAULT); + + GO(__NR_prlimit64, "(get) 4s 1m"); + SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0, x0 + 1); FAILx(EFAULT); + + GO(__NR_prlimit64, "(get+set) 4s 2m"); + SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0 + 1, x0 + 1); FAILx(EFAULT); + // no such syscall... GO(9999, "1e"); SY(9999); FAIL; diff --git a/memcheck/tests/amd64-linux/scalar.stderr.exp b/memcheck/tests/amd64-linux/scalar.stderr.exp index 12f6fcba3..1757cc3eb 100644 --- a/memcheck/tests/amd64-linux/scalar.stderr.exp +++ b/memcheck/tests/amd64-linux/scalar.stderr.exp @@ -45,6 +45,38 @@ Syscall param write(buf) points to unaddressable byte(s) ----------------------------------------------------- 60: __NR_exit below ----------------------------------------------------- +----------------------------------------------------- + 97: __NR_getrlimit 2s 1m +----------------------------------------------------- +Syscall param getrlimit(resource) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param getrlimit(rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param getrlimit(rlim) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +----------------------------------------------------- +160: __NR_setrlimit 2s 1m +----------------------------------------------------- +Syscall param setrlimit(resource) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param setrlimit(rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param setrlimit(rlim) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + ----------------------------------------------------- 247: __NR_waitid 5s 0m ----------------------------------------------------- @@ -101,6 +133,102 @@ Syscall param waitid(ru) points to unaddressable byte(s) by 0x........: main (scalar.c) Address 0x........ is not stack'd, malloc'd or (recently) free'd +----------------------------------------------------- +302: __NR_prlimit64 (nop) 4s 0m +----------------------------------------------------- +Syscall param prlimit64(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(resource) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(new_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(old_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +----------------------------------------------------- +302: __NR_prlimit64 (set) 4s 1m +----------------------------------------------------- +Syscall param prlimit64(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(resource) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(new_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(old_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param rlimit64(new_rlim) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +----------------------------------------------------- +302: __NR_prlimit64 (get) 4s 1m +----------------------------------------------------- +Syscall param prlimit64(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(resource) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(new_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(old_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param rlimit64(old_rlim) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +----------------------------------------------------- +302: __NR_prlimit64 (get+set) 4s 2m +----------------------------------------------------- +Syscall param prlimit64(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(resource) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(new_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(old_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param rlimit64(new_rlim) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param rlimit64(old_rlim) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + ----------------------------------------------------- 9999: 9999 1e ----------------------------------------------------- diff --git a/memcheck/tests/x86-linux/scalar.c b/memcheck/tests/x86-linux/scalar.c index 5141f0496..e6ff44fe0 100644 --- a/memcheck/tests/x86-linux/scalar.c +++ b/memcheck/tests/x86-linux/scalar.c @@ -7,6 +7,7 @@ #include #include // MREMAP_FIXED #include +#include // Here we are trying to trigger every syscall error (scalar errors and // memory errors) for every syscall. We do this by passing a lot of bogus @@ -1283,6 +1284,19 @@ int main(void) GO(__NR_epoll_create1, "1s 0m"); SY(__NR_epoll_create1, x0); SUCC_OR_FAIL; + // __NR_prlimit64 340 + GO(__NR_prlimit64, "(nop) 4s 0m"); + SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0, x0); SUCC; + + GO(__NR_prlimit64, "(set) 4s 1m"); + SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0 + 1, x0); FAILx(EFAULT); + + GO(__NR_prlimit64, "(get) 4s 1m"); + SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0, x0 + 1); FAILx(EFAULT); + + GO(__NR_prlimit64, "(get+set) 4s 2m"); + SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0 + 1, x0 + 1); FAILx(EFAULT); + // __NR_process_vm_readv 347 GO(__NR_process_vm_readv, "6s 2m"); SY(__NR_process_vm_readv, x0, x0, x0+1, x0, x0+1, x0); FAIL; diff --git a/memcheck/tests/x86-linux/scalar.stderr.exp b/memcheck/tests/x86-linux/scalar.stderr.exp index b75507547..3cbb0c6ff 100644 --- a/memcheck/tests/x86-linux/scalar.stderr.exp +++ b/memcheck/tests/x86-linux/scalar.stderr.exp @@ -4208,6 +4208,102 @@ Syscall param epoll_create1(flags) contains uninitialised byte(s) ... by 0x........: main (scalar.c) +----------------------------------------------------- +340: __NR_prlimit64 (nop) 4s 0m +----------------------------------------------------- +Syscall param prlimit64(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(resource) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(new_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(old_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +----------------------------------------------------- +340: __NR_prlimit64 (set) 4s 1m +----------------------------------------------------- +Syscall param prlimit64(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(resource) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(new_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(old_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param rlimit64(new_rlim) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +----------------------------------------------------- +340: __NR_prlimit64 (get) 4s 1m +----------------------------------------------------- +Syscall param prlimit64(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(resource) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(new_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(old_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param rlimit64(old_rlim) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +----------------------------------------------------- +340: __NR_prlimit64 (get+set) 4s 2m +----------------------------------------------------- +Syscall param prlimit64(pid) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(resource) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(new_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param prlimit64(old_rlim) contains uninitialised byte(s) + ... + by 0x........: main (scalar.c) + +Syscall param rlimit64(new_rlim) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param rlimit64(old_rlim) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + ----------------------------------------------------- 347:__NR_process_vm_readv 6s 2m ----------------------------------------------------- From be8ca2b326f53b97d6ff031f7165fa2c8906dedb Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 29 Aug 2025 21:28:05 +0000 Subject: [PATCH 228/412] iropt-test: Prepare IROp table for mips. Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- none/tests/iropt-test/irops.tab | 75 +++++++++++++++++---------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index 9f833b5cb..954654b7c 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -34,14 +34,14 @@ #define ARCH_amd64 0x0008 #define ARCH_x86 0x0010 #define ARCH_s390 0x0020 -#define ARCH_ALL 0x003F // OR of all above +#define ARCH_mips32 0x0040 +#define ARCH_mips64 0x0080 +#define ARCH_mipsx (ARCH_mips32 | ARCH_mips64) // ARCH_mips does not work +#define ARCH_ALL 0x00FF // OR of all above -/* FIXME: Add support for mips, arm, and riscv. +/* FIXME: Add support for nanomips, arm, and riscv. When doing so ARCH_ALL needs to be adjusted */ #if 0 -#define ARCH_mips32 0x0040 -#define ARCH_mips64 0x0080 -#define ARCH_mips (mips32 | mips64) #define ARCH_nanomips 0x0100 #define ARCH_arm 0x0200 #define ARCH_arm64 0x0400 @@ -52,6 +52,7 @@ #define ONLY2(x1,x2) .enabled_arch = A(x1) | A(x2) #define EXCEPT(x) .enabled_arch = ARCH_ALL & ~A(x) #define EXCEPT2(x1,x2) .enabled_arch = ARCH_ALL & ~(A(x1) | A(x2)) +#define EXCEPT3(x1,x2,x3) .enabled_arch = ARCH_ALL & ~(A(x1) | A(x2) | A(x3)) /* Definition of IROps: - no IROps having floating point operands or result @@ -68,7 +69,7 @@ { OPNAME(1Uto8), Ity_I8, 1, Ity_I1, }, // { OPNAME(1Uto16), Ity_I16, 1, Ity_I1, }, // missing in libvex_ir.h { OPNAME(1Uto32), Ity_I32, 1, Ity_I1, }, - { OPNAME(1Uto64), Ity_I64, 1, Ity_I1, EXCEPT2(ppc32,x86) }, + { OPNAME(1Uto64), Ity_I64, 1, Ity_I1, EXCEPT3(ppc32,x86,mips32) }, { OPNAME(1Sto8), Ity_I8, 1, Ity_I1, }, { OPNAME(1Sto16), Ity_I16, 1, Ity_I1, }, @@ -92,6 +93,7 @@ { OPNAME(32Sto64), Ity_I64, 1, Ity_I32, }, // { OPNAME(8to1), Ity_I1, 1, Ity_I8, }, // missing in libvex_ir.h + // { OPNAME(16to1), Ity_I1, 1, Ity_I16, }, // missing in libvex_ir.h { OPNAME(16to8), Ity_I8, 1, Ity_I16, }, { OPNAME(16HIto8), Ity_I8, 1, Ity_I16, }, @@ -103,8 +105,7 @@ { OPNAME(64to1), Ity_I1, 1, Ity_I64, EXCEPT2(ppc32, x86) }, { OPNAME(64to8), Ity_I8, 1, Ity_I64, EXCEPT2(ppc32, x86) }, - { OPNAME(64to16), Ity_I16, 1, Ity_I64, EXCEPT2(ppc32, x86) }, - + { OPNAME(64to16), Ity_I16, 1, Ity_I64, EXCEPT3(ppc32, x86, mips32) }, { OPNAME(64to32), Ity_I32, 1, Ity_I64, }, { OPNAME(64HIto32), Ity_I32, 1, Ity_I64, }, @@ -124,8 +125,8 @@ { OPNAME(Left32), Ity_I32, 1, Ity_I32 }, { OPNAME(Left64), Ity_I64, 1, Ity_I64 }, - { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32, ONLY2(ppc, x86) }, - { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64, EXCEPT2(ppc32, x86) }, + { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32, EXCEPT2(amd64, s390) }, + { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64, EXCEPT3(ppc32, x86, mips32) }, { OPNAME(CtzNat32), Ity_I32, 1, Ity_I32, ONLY2(ppc, x86) }, { OPNAME(CtzNat64), Ity_I64, 1, Ity_I64, ONLY2(ppc64, amd64) }, @@ -145,7 +146,7 @@ { OPNAME(Sub64), Ity_I64, 2, Ity_I64, Ity_I64, EXCEPT(ppc32) }, { OPNAME(Mul8), Ity_I8, 2, Ity_I8, Ity_I8, ONLY(s390) }, - { OPNAME(Mul16), Ity_I16, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, + { OPNAME(Mul16), Ity_I16, 2, Ity_I16, Ity_I16, EXCEPT2(ppc, mipsx) }, { OPNAME(Mul32), Ity_I32, 2, Ity_I32, Ity_I32, }, { OPNAME(Mul64), Ity_I64, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, x86) }, @@ -159,12 +160,12 @@ { OPNAME(MullS32), Ity_I64, 2, Ity_I32, Ity_I32, }, // { OPNAME(MullS64), Ity_I128, 2, Ity_I64, Ity_I64, }, // 128 bit - { OPNAME(DivU32), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) }, - { OPNAME(DivU64), Ity_I64, 2, Ity_I64, Ity_I64, ONLY(ppc64) }, + { OPNAME(DivU32), Ity_I32, 2, Ity_I32, Ity_I32, ONLY2(ppc, mipsx) }, + { OPNAME(DivU64), Ity_I64, 2, Ity_I64, Ity_I64, ONLY2(ppc64, mips64) }, // { OPNAME(DivU128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit - { OPNAME(DivS32), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) }, - { OPNAME(DivS64), Ity_I64, 2, Ity_I64, Ity_I64, ONLY(ppc64) }, + { OPNAME(DivS32), Ity_I32, 2, Ity_I32, Ity_I32, ONLY2(ppc, mipsx) }, + { OPNAME(DivS64), Ity_I64, 2, Ity_I64, Ity_I64, ONLY2(ppc64, mips64) }, // { OPNAME(DivS128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit { OPNAME(DivU32E), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) }, @@ -175,30 +176,30 @@ // { OPNAME(DivS64E), Ity_I32, 2, Ity_I32, Ity_I32, }, // 128 bit // { OPNAME(DivS128E), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit -// { OPNAME(DivModU32to32), Ity_I64, 2, Ity_I32, Ity_I64 }, // no folding yet - { OPNAME(DivModU64to32), Ity_I64, 2, Ity_I64, Ity_I32, EXCEPT(ppc) }, +// { OPNAME(DivModU32to32), Ity_I64, 2, Ity_I32, Ity_I64 }, // mips no folding yet + { OPNAME(DivModU64to32), Ity_I64, 2, Ity_I64, Ity_I32, EXCEPT2(ppc, mipsx) }, // { OPNAME(DivModU64to64), Ity_I64, 2, Ity_I64, Ity_I128 }, // 128 bit // { OPNAME(DivModU128to64), Ity_I128, 2, Ity_I64, Ity_I128 }, // 128 bit -// { OPNAME(DivModS32to32), Ity_I64, 2, Ity_I32, Ity_I32 }, // no folding yet - { OPNAME(DivModS64to32), Ity_I64, 2, Ity_I64, Ity_I32, EXCEPT(ppc) }, +// { OPNAME(DivModS32to32), Ity_I64, 2, Ity_I32, Ity_I32 }, // mips no folding yet + { OPNAME(DivModS64to32), Ity_I64, 2, Ity_I64, Ity_I32, EXCEPT2(ppc, mipsx) }, // { OPNAME(DivModS64to64), Ity_I64, 2, Ity_I64, Ity_I128 }, // 128 bit // { OPNAME(DivModU128to64), Ity_I128, 2, Ity_I64, Ity_I128 }, // 128 bit // { OPNAME(ModU128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit // { OPNAME(ModS128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit - { OPNAME(Shl8), Ity_I8, 2, Ity_I8, Ity_I8 }, - { OPNAME(Shl16), Ity_I16, 2, Ity_I16, Ity_I8 }, + { OPNAME(Shl8), Ity_I8, 2, Ity_I8, Ity_I8, EXCEPT(mipsx) }, + { OPNAME(Shl16), Ity_I16, 2, Ity_I16, Ity_I8, EXCEPT(mipsx) }, { OPNAME(Shl32), Ity_I32, 2, Ity_I32, Ity_I8 }, { OPNAME(Shl64), Ity_I64, 2, Ity_I64, Ity_I8, EXCEPT(ppc32) }, - { OPNAME(Shr8), Ity_I8, 2, Ity_I8, Ity_I8 }, + { OPNAME(Shr8), Ity_I8, 2, Ity_I8, Ity_I8, EXCEPT(mipsx) }, { OPNAME(Shr16), Ity_I16, 2, Ity_I16, Ity_I8 }, { OPNAME(Shr32), Ity_I32, 2, Ity_I32, Ity_I8 }, { OPNAME(Shr64), Ity_I64, 2, Ity_I64, Ity_I8, EXCEPT(ppc32) }, - { OPNAME(Sar8), Ity_I8, 2, Ity_I8, Ity_I8 }, + { OPNAME(Sar8), Ity_I8, 2, Ity_I8, Ity_I8, EXCEPT(mipsx) }, { OPNAME(Sar16), Ity_I16, 2, Ity_I16, Ity_I8 }, { OPNAME(Sar32), Ity_I32, 2, Ity_I32, Ity_I8 }, { OPNAME(Sar64), Ity_I64, 2, Ity_I64, Ity_I8, EXCEPT(ppc32) }, @@ -226,36 +227,36 @@ { OPNAME(CmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32, }, { OPNAME(CmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT(ppc32) }, - { OPNAME(CmpNE8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT(ppc) }, - { OPNAME(CmpNE16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, + { OPNAME(CmpNE8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT2(ppc, mipsx) }, + { OPNAME(CmpNE16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT2(ppc, mipsx) }, { OPNAME(CmpNE32), Ity_I1, 2, Ity_I32, Ity_I32, }, - { OPNAME(CmpNE64), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT(ppc32) }, + { OPNAME(CmpNE64), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, mips32) }, { OPNAME(CmpLT32U), Ity_I1, 2, Ity_I32, Ity_I32, }, - { OPNAME(CmpLT64U), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, x86) }, + { OPNAME(CmpLT64U), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT3(ppc32, x86, mips32) }, { OPNAME(CmpLT32S), Ity_I1, 2, Ity_I32, Ity_I32, }, - { OPNAME(CmpLT64S), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, x86) }, + { OPNAME(CmpLT64S), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT3(ppc32, x86, mips32) }, { OPNAME(CmpLE32U), Ity_I1, 2, Ity_I32, Ity_I32, }, - { OPNAME(CmpLE64U), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, x86) }, + { OPNAME(CmpLE64U), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT3(ppc32, x86, mipsx) }, { OPNAME(CmpLE32S), Ity_I1, 2, Ity_I32, Ity_I32, }, - { OPNAME(CmpLE64S), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, x86) }, + { OPNAME(CmpLE64S), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT3(ppc32, x86, mips32) }, - { OPNAME(CasCmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT(ppc) }, - { OPNAME(CasCmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, + { OPNAME(CasCmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT2(ppc, mipsx) }, + { OPNAME(CasCmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT2(ppc, mipsx) }, { OPNAME(CasCmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32, EXCEPT(ppc) }, - { OPNAME(CasCmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64, ONLY2(s390, amd64) }, + { OPNAME(CasCmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc, x86) }, - { OPNAME(CasCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT(ppc) }, - { OPNAME(CasCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT(ppc) }, - { OPNAME(CasCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32, EXCEPT(ppc) }, + { OPNAME(CasCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT2(ppc, mipsx) }, + { OPNAME(CasCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT2(ppc, mipsx) }, + { OPNAME(CasCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32, EXCEPT2(ppc, mipsx) }, { OPNAME(CasCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64, ONLY2(s390, amd64) }, { OPNAME(ExpCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8, ONLY(s390) }, { OPNAME(ExpCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16, ONLY2(s390, x86) }, - { OPNAME(ExpCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32, EXCEPT(ppc) }, + { OPNAME(ExpCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32, EXCEPT2(ppc, mipsx) }, { OPNAME(ExpCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64, ONLY2(s390, amd64) }, { OPNAME(CmpORD32U), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) }, From 773544211c10a81773200864ba2b57cea7886e9e Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sat, 30 Aug 2025 11:28:03 +0000 Subject: [PATCH 229/412] iropt-test: Constant folding for DivModU32to32 and DivModS32to32 Needed for Mips. Mips is still disabled in iropt-test because there are miscompares between the folded the result and the result computed by the insn sequence that implements the IROp. Several IRops are affected. Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211 --- VEX/priv/ir_opt.c | 25 +++++++++++++++++++++++++ none/tests/iropt-test/binary.c | 25 +++++++++++++++++++++++++ none/tests/iropt-test/irops.tab | 4 ++-- none/tests/iropt-test/main.c | 5 ++++- 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 5056b677b..925524e15 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2193,6 +2193,31 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } break; } + case Iop_DivModU32to32: { + UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32; + UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32; + if (u32b != 0) { + UInt q = u32a / u32b; + UInt r = u32a % u32b; + e2 = IRExpr_Const(IRConst_U64(((ULong)r << 32) | q)); + } + break; + } + case Iop_DivModS32to32: { + Int s32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32; + Int s32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32; + if (s32b != 0) { + /* Division may trap when result overflows i.e. when + attempting: INT32_MAX / -1 */ + if (e->Iex.Binop.arg1->Iex.Const.con->Ico.U32 == (1UL << 31) + && s32b == -1) + break; + Int q = s32a / s32b; + Int r = s32a % s32b; + e2 = IRExpr_Const(IRConst_U64(((ULong)(UInt)r << 32) | (UInt)q)); + } + break; + } /* -- Shl -- */ case Iop_Shl8: diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c index 1fbe1341f..d8d3618b2 100644 --- a/none/tests/iropt-test/binary.c +++ b/none/tests/iropt-test/binary.c @@ -215,6 +215,20 @@ get_expected_value(const irop_t *op, const test_data_t *data) expected = (int64_t)(opnd_l << 32) / (int32_t)opnd_r; break; + case Iop_DivModU32to32: { + uint32_t q = opnd_l / opnd_r; + uint32_t r = opnd_l % opnd_r; + expected = ((uint64_t)r << 32) | q; + break; + } + + case Iop_DivModS32to32: { + int32_t q = (int32_t)opnd_l / (int32_t)opnd_r; + int32_t r = (int32_t)opnd_l % (int32_t)opnd_r; + expected = ((uint64_t)r << 32) | (uint32_t)q; + break; + } + case Iop_DivModU64to32: { uint64_t q = opnd_l / opnd_r; uint64_t r = opnd_l % opnd_r; @@ -424,6 +438,7 @@ ok_to_run(IROp op, uint64_t o1, uint64_t o2) case Iop_DivS32: case Iop_DivS64: case Iop_DivU32E: case Iop_DivS32E: + case Iop_DivModU32to32: return o2 != 0; /* Check that result can be represented */ @@ -448,6 +463,16 @@ ok_to_run(IROp op, uint64_t o1, uint64_t o2) return q <= INT32_MAX && q >= INT32_MIN; } + case Iop_DivModS32to32: { + int32_t divisor = o2; + + if (divisor == 0) return 0; + /* Division may trap on overflow */ + if (divisor == -1 && o1 == (0x1UL << 31)) // INT32_MIN + return 0; + return 1; + } + default: return 1; } diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index 954654b7c..882ba59ba 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -176,12 +176,12 @@ // { OPNAME(DivS64E), Ity_I32, 2, Ity_I32, Ity_I32, }, // 128 bit // { OPNAME(DivS128E), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit -// { OPNAME(DivModU32to32), Ity_I64, 2, Ity_I32, Ity_I64 }, // mips no folding yet + { OPNAME(DivModU32to32), Ity_I64, 2, Ity_I32, Ity_I32, ONLY(mipsx) }, { OPNAME(DivModU64to32), Ity_I64, 2, Ity_I64, Ity_I32, EXCEPT2(ppc, mipsx) }, // { OPNAME(DivModU64to64), Ity_I64, 2, Ity_I64, Ity_I128 }, // 128 bit // { OPNAME(DivModU128to64), Ity_I128, 2, Ity_I64, Ity_I128 }, // 128 bit -// { OPNAME(DivModS32to32), Ity_I64, 2, Ity_I32, Ity_I32 }, // mips no folding yet + { OPNAME(DivModS32to32), Ity_I64, 2, Ity_I32, Ity_I32, ONLY(mipsx) }, { OPNAME(DivModS64to32), Ity_I64, 2, Ity_I64, Ity_I32, EXCEPT2(ppc, mipsx) }, // { OPNAME(DivModS64to64), Ity_I64, 2, Ity_I64, Ity_I128 }, // 128 bit // { OPNAME(DivModU128to64), Ity_I128, 2, Ity_I64, Ity_I128 }, // 128 bit diff --git a/none/tests/iropt-test/main.c b/none/tests/iropt-test/main.c index 1ca97e9c0..64ad44d87 100644 --- a/none/tests/iropt-test/main.c +++ b/none/tests/iropt-test/main.c @@ -45,7 +45,7 @@ unsigned num_random_tests; int main(int argc, char *argv[]) { -// FIXME: temporarily until ppc has been fixed +// FIXME: temporarily until ppc and mips have been fixed #if !defined(__s390x__) && !defined(__i386__) && !defined(__x86_64__) return 0; #endif @@ -164,6 +164,9 @@ is_enabled(const irop_t *op) #ifdef __s390x__ return op->enabled_arch & ARCH_s390; #endif +#ifdef __mips__ + return op->enabled_arch & ((__mips == 64) ? ARCH_mips64 : ARCH_mips32); +#endif #ifdef __powerpc__ /* defined for both 32-bit and 64-bit */ #define MIN_POWER_ISA "../../../tests/min_power_isa" int rc; From 88fb0079cfabcba839b1f63f947910748db79b76 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sat, 30 Aug 2025 13:39:04 +0000 Subject: [PATCH 230/412] libvex_ir.h: Clarify semantics of division and modulo operation. --- VEX/pub/libvex_ir.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h index 750ba0701..8c68fab44 100644 --- a/VEX/pub/libvex_ir.h +++ b/VEX/pub/libvex_ir.h @@ -492,7 +492,13 @@ typedef Iop_CmpORD32S, Iop_CmpORD64S, /* Division */ - /* TODO: clarify semantics wrt rounding, negative values, whatever */ + /* Semantics of division as per C standard: + If the value of the divisor is zero, the behaviour is undefined. + When integers are divided, the result of division is the algebraic + quotient with any fractional part discarded. In other words: + truncation towards zero. If the quotient a/b is representable, + the expression (a/b)*b + a%b shall equal a; otherwise, the behaviour + of division and modulo operation is undefined. */ Iop_DivU32, // :: I32,I32 -> I32 (simple div, no mod) Iop_DivS32, // ditto, signed Iop_DivU64, // :: I64,I64 -> I64 (simple div, no mod) From 66ab1212649a9e4f2a3bdce187ef8cfc44da7b10 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 30 Aug 2025 22:05:12 +0200 Subject: [PATCH 231/412] FreeBSD realpathat syscall: fix length of written memory and add a testcase There were no tests for /proc/currrproc/file and the length written in post was out by one --- .gitignore | 1 + coregrind/m_syswrap/syswrap-freebsd.c | 52 +++++++-------------- none/tests/freebsd/Makefile.am | 6 ++- none/tests/freebsd/readlinkat2.cpp | 57 +++++++++++++++++++++++ none/tests/freebsd/readlinkat2.stderr.exp | 0 none/tests/freebsd/readlinkat2.vgtest | 4 ++ 6 files changed, 85 insertions(+), 35 deletions(-) create mode 100644 none/tests/freebsd/readlinkat2.cpp create mode 100644 none/tests/freebsd/readlinkat2.stderr.exp create mode 100644 none/tests/freebsd/readlinkat2.vgtest diff --git a/.gitignore b/.gitignore index 80924f997..4eb477c08 100644 --- a/.gitignore +++ b/.gitignore @@ -2331,6 +2331,7 @@ none/tests/freebsd/bug499212 /none/tests/freebsd/osrel /none/tests/freebsd/readlinkat +/none/tests/freebsd/readlinkat2 /none/tests/freebsd/swapcontext /none/tests/freebsd/fexecve /none/tests/freebsd/hello_world diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 1a3bbe214..6679e58fb 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -1183,7 +1183,8 @@ PRE(sys_revoke) // SYS_symlink 57 // generic -static void do_readlink(const HChar* path, HChar *buf, SizeT bufsize, SyscallStatus* status, Bool* curproc_file) +// returns whether caller needs to set SfMayBlock in flags +static Bool do_readlink(const HChar* path, HChar *buf, SizeT bufsize, SyscallStatus* status) { HChar name[30]; VG_(sprintf)(name, "/proc/%d/file", VG_(getpid)()); @@ -1191,43 +1192,32 @@ static void do_readlink(const HChar* path, HChar *buf, SizeT bufsize, SyscallSta && (VG_(strcmp)(path, name) == 0 || VG_(strcmp)(path, "/proc/curproc/file") == 0)) { vg_assert(VG_(resolved_exename)); - Int len = VG_(snprintf)(buf, bufsize, "%s", VG_(resolved_exename)); + Int len = VG_(snprintf)(buf, bufsize, "%s", VG_(resolved_exename)) + 1; SET_STATUS_Success(len); - *curproc_file = True; + return False; } + return True; } // SYS_readlink 58 // ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsiz); PRE(sys_readlink) { - FUSE_COMPATIBLE_MAY_BLOCK(); - Word saved = SYSNO; - Bool curproc_file = False; - PRINT("sys_readlink ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %llu )", ARG1, (char*)(Addr)ARG1, ARG2, (ULong)ARG3); PRE_REG_READ3(long, "readlink", const char *, path, char *, buf, int, bufsiz); - PRE_MEM_RASCIIZ( "readlink(path)", ARG1 ); - PRE_MEM_WRITE( "readlink(buf)", ARG2,ARG3 ); + PRE_MEM_RASCIIZ("readlink(path)", ARG1); + PRE_MEM_WRITE("readlink(buf)", ARG2, ARG3); - if (VG_(have_slash_proc) == True) - { - /* - * Handle the case where readlink is looking at /proc/curproc/file or - * /proc//file - */ - do_readlink((const HChar *)ARG1, (HChar *)ARG2, (SizeT)ARG3, status, &curproc_file); + if (VG_(have_slash_proc) == False || do_readlink((const HChar *)ARG1, (HChar *)ARG2, (SizeT)ARG3, status)) { + *flags |= SfMayBlock; } +} - if (!curproc_file) { - /* Normal case */ - SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, ARG1, ARG2, ARG3)); - } - if (SUCCESS && RES > 0) { - POST_MEM_WRITE( ARG2, RES ); - } +POST(sys_readlink) +{ + POST_MEM_WRITE(ARG2, RES); } // SYS_execve 59 @@ -5447,29 +5437,23 @@ POST(sys_openat) } } -// @todo PJF make this generic? // SYS_readlinkat 500 // ssize_t readlinkat(int fd, const char *restrict path, char *restrict buf, // size_t bufsize); PRE(sys_readlinkat) { - Bool curproc_file = False; - - PRINT("sys_readlinkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %llu )", ARG1,ARG2,(char*)ARG2,ARG3,(ULong)ARG4); + PRINT("sys_readlinkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %llu )", + ARG1, ARG2, (char*)ARG2, ARG3, (ULong)ARG4); PRE_REG_READ4(ssize_t, "readlinkat", int, fd, const char *, path, char *, buf, int, bufsize); ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "readlinkat", tid, status); PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 ); PRE_MEM_WRITE("readlinkat(buf)", ARG3, ARG4); - if (VG_(have_slash_proc) == True) { - /* - * Handle the case where readlinkat is looking at /proc/curproc/file or - * /proc//file. - */ + if (VG_(have_slash_proc) == False || do_readlink((const HChar *)ARG2, (HChar *)ARG3, (SizeT)ARG4, status)) { // @todo PJF there is still the case where fd refers to / or /proc or /proc/pid // or /proc/curproc and path is relative pid/file, curproc/file or just file - do_readlink((const HChar *)ARG2, (HChar *)ARG3, (SizeT)ARG4, status, &curproc_file); + *flags |= SfMayBlock; } } @@ -7294,7 +7278,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { BSDX_(__NR_revoke, sys_revoke), // 56 GENX_(__NR_symlink, sys_symlink), // 57 - BSDX_(__NR_readlink, sys_readlink), // 58 + BSDXY(__NR_readlink, sys_readlink), // 58 GENX_(__NR_execve, sys_execve), // 59 GENX_(__NR_umask, sys_umask), // 60 diff --git a/none/tests/freebsd/Makefile.am b/none/tests/freebsd/Makefile.am index 5c46d27d3..66ef0c47c 100644 --- a/none/tests/freebsd/Makefile.am +++ b/none/tests/freebsd/Makefile.am @@ -57,6 +57,8 @@ EXTRA_DIST = \ open_client.stderr.exp \ readlinkat.vgtest \ readlinkat.stderr.exp \ + readlinkat2.vgtest \ + readlinkat2.stderr.exp \ sanity_level_thread.vgtest \ sanity_level_thread.stderr.exp \ swapcontext.vgtest \ @@ -74,7 +76,7 @@ EXTRA_DIST = \ check_PROGRAMS = \ auxv bug452274 bug498317 bug499212 fexecve hello_world open_client \ - osrel proc_pid_file readlinkat sanity_level_thread swapcontext \ + osrel proc_pid_file readlinkat readlinkat2 sanity_level_thread swapcontext \ umtx_shm_creat usrstack AM_CFLAGS += $(AM_FLAG_M3264_PRI) @@ -89,6 +91,8 @@ open_client_SOURCES = open_client.cpp proc_pid_file_SOURCES = proc_pid_file.cpp readlinkat_SOURCES = readlinkat.cpp readlinkat_CXXFLAGS = ${AM_CXXFLAGS} @FLAG_W_NO_UNINITIALIZED@ +readlinkat2_SOURCES = readlinkat2.cpp +readlinkat2_CXXFLAGS = ${AM_CXXFLAGS} @FLAG_W_NO_UNINITIALIZED@ sanity_level_thread_SOURCES = sanity_level_thread.cpp sanity_level_thread_LDFLAGS = ${AM_LDFLAGS} -pthread diff --git a/none/tests/freebsd/readlinkat2.cpp b/none/tests/freebsd/readlinkat2.cpp new file mode 100644 index 000000000..0aef71d7f --- /dev/null +++ b/none/tests/freebsd/readlinkat2.cpp @@ -0,0 +1,57 @@ +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char** argv) +{ + char linkedPath[MAXPATHLEN]; + char selfAbsolutePath[MAXPATHLEN]; + auto pid{getpid()}; + std::string pidString{std::to_string(pid)}; + std::string procPidFile{std::string("/proc/") + pidString + "/file"}; + realpath(argv[0], selfAbsolutePath); + std::string selfAbsolutePathString(selfAbsolutePath); + + ssize_t res = readlinkat(AT_FDCWD, "/proc/curproc/file", linkedPath, MAXPATHLEN); + if (res == -1) + { + std::cerr << "Error: readlinkat test 1 failed\n"; + } + else + { + if (selfAbsolutePathString != linkedPath) + { + std::cerr << "Error: readlinkat test 1 unexpected resolved path - " << linkedPath << '\n'; + } + } + + res = readlinkat(AT_FDCWD, procPidFile.c_str(), linkedPath, MAXPATHLEN); + if (res == -1) + { + std::cerr << "Error: readlinkat test 2 failed\n"; + } + else + { + if (selfAbsolutePathString != linkedPath) + { + std::cerr << "Error: readlinkat test 2 unexpected resolved path - " << linkedPath << '\n'; + } + } + + // @todo PJF do some tests with cwd as /proc /proc/PID and /proc/curproc + // and a rlative path to 'file' + // not yet implemented in Valgrind + chdir("/proc"); + + // @todo PJF do some tests as above but with fd as /proc /proc/PID and /proc/curproc + int slash; + if ((slash = open("/", O_DIRECTORY | O_RDONLY)) == -1) + { + throw std::runtime_error("failed to open /"); + } + close(slash); +} diff --git a/none/tests/freebsd/readlinkat2.stderr.exp b/none/tests/freebsd/readlinkat2.stderr.exp new file mode 100644 index 000000000..e69de29bb diff --git a/none/tests/freebsd/readlinkat2.vgtest b/none/tests/freebsd/readlinkat2.vgtest new file mode 100644 index 000000000..1decb1ee0 --- /dev/null +++ b/none/tests/freebsd/readlinkat2.vgtest @@ -0,0 +1,4 @@ +# FreeBSD doesn't always have a /proc filesystem +prereq: test -d /proc +prog: readlinkat2 +vgopts: -q From d2dc973f136d2c66e8320bd871a9acf832605662 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 31 Aug 2025 08:02:00 +0200 Subject: [PATCH 232/412] illumos syscalls: refactor *at directory fd checks Mainly to reduyce the amount of copied and pasted code. Slight improvements to messages to syscalls that have two directory fds. --- coregrind/m_syswrap/syswrap-solaris.c | 101 ++++--------------- memcheck/tests/solaris/syscall_at.stderr.exp | 8 +- 2 files changed, 21 insertions(+), 88 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c index f620e85bd..a4f243f8a 100644 --- a/coregrind/m_syswrap/syswrap-solaris.c +++ b/coregrind/m_syswrap/syswrap-solaris.c @@ -1812,18 +1812,8 @@ PRE(sys_linkat) PRE_MEM_RASCIIZ("linkat(path2)", ARG4); /* Be strict but ignore fd1/fd2 for absolute path1/path2. */ - if (fd1 != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(fd1, "linkat", tid, False)) { - SET_STATUS_Failure(VKI_EBADF); - } - if (fd2 != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG4, 1) - && ((HChar *) ARG4)[0] != '/' - && !ML_(fd_allowed)(fd2, "linkat", tid, False)) { - SET_STATUS_Failure(VKI_EBADF); - } + ML_(fd_at_check_allowed)(fd1, (const HChar*)ARG2, "linkat(efd)", tid, status); + ML_(fd_at_check_allowed)(fd2, (const HChar*)ARG4, "linkat(nfd)", tid, status); *flags |= SfMayBlock; } @@ -1844,11 +1834,7 @@ PRE(sys_symlinkat) PRE_MEM_RASCIIZ("symlinkat(path2)", ARG3); /* Be strict but ignore fd for absolute path2. */ - if (fd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG3, 1) - && ((HChar *) ARG3)[0] != '/' - && !ML_(fd_allowed)(fd, "symlinkat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(fd, (const HChar*)ARG3, "symlinkat", tid, status); *flags |= SfMayBlock; } @@ -2323,11 +2309,7 @@ PRE(sys_readlinkat) PRE_MEM_WRITE("readlinkat(buf)", ARG3, ARG4); /* Be strict but ignore dfd for absolute path. */ - if (dfd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(dfd, "readlinkat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(dfd, (const HChar*)ARG2, "readlinkat", tid, status); /* Handle the case where readlinkat is looking at /proc/self/path/a.out or /proc//path/a.out. */ @@ -2386,11 +2368,7 @@ PRE(sys_frealpathat) PRE_MEM_WRITE("frealpathat(buf)", ARG3, ARG4); /* Be strict but ignore fd for absolute path. */ - if (fd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(fd, "frealpathat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "frealpathat", tid, status); } POST(sys_frealpathat) @@ -2529,11 +2507,7 @@ PRE(sys_faccessat) PRE_MEM_RASCIIZ("faccessat(path)", ARG2); /* Be strict but ignore fd for absolute path. */ - if (fd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(fd, "faccessat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "faccessat", tid, status); } PRE(sys_mknodat) @@ -2551,11 +2525,7 @@ PRE(sys_mknodat) PRE_MEM_RASCIIZ("mknodat(fname)", ARG2); /* Be strict but ignore fd for absolute path. */ - if (fd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(fd, "mknodat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "mknodat", tid, status); *flags |= SfMayBlock; } @@ -3593,11 +3563,7 @@ PRE(sys_fchownat) PRE_MEM_RASCIIZ("fchownat(path)", ARG2); /* Be strict but ignore fd for absolute path. */ - if (fd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(fd, "fchownat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "fchownat", tid, status); } PRE(sys_fdsync) @@ -4141,18 +4107,8 @@ PRE(sys_renameat) PRE_MEM_RASCIIZ("renameat(new)", ARG4); /* Be strict but ignore fromfd/tofd for absolute old/new. */ - if (fromfd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(fromfd, "renameat", tid, False)) { - SET_STATUS_Failure(VKI_EBADF); - } - if (tofd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG4, 1) - && ((HChar *) ARG4)[0] != '/' - && !ML_(fd_allowed)(tofd, "renameat", tid, False)) { - SET_STATUS_Failure(VKI_EBADF); - } + ML_(fd_at_check_allowed)(fromfd, (const HChar*)ARG2, "renameat(fromfd)", tid, status); + ML_(fd_at_check_allowed)(tofd, (const HChar*)ARG4, "renameat(tofd)", tid, status); } PRE(sys_unlinkat) @@ -4171,11 +4127,7 @@ PRE(sys_unlinkat) PRE_MEM_RASCIIZ("unlinkat(pathname)", ARG2); /* Be strict but ignore dfd for absolute pathname. */ - if (dfd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(dfd, "unlinkat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(dfd, (const HChar*)ARG2, "unlinkat", tid, status); } PRE(sys_fstatat) @@ -4199,11 +4151,7 @@ PRE(sys_fstatat) PRE_MEM_WRITE("fstatat(buf)", ARG3, sizeof(struct vki_stat)); /* Be strict but ignore fildes for absolute path. */ - if (fd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(fd, "fstatat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "fstatat", tid, status); } POST(sys_fstatat) @@ -4237,6 +4185,7 @@ PRE(sys_openat) PRE_MEM_RASCIIZ("openat(filename)", ARG2); + // @todo PJF use ML_(fd_at_check) and not return early here /* Be strict but ignore fildes for absolute pathname. */ if (fd != VKI_AT_FDCWD && ML_(safe_to_deref)((void *) ARG2, 1) @@ -5055,11 +5004,7 @@ PRE(sys_fchmodat) PRE_MEM_RASCIIZ("fchmodat(path)", ARG2); /* Be strict but ignore fd for absolute path. */ - if (fd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(fd, "fchmodat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "fchmodat", tid, status); } PRE(sys_mkdirat) @@ -5077,11 +5022,7 @@ PRE(sys_mkdirat) PRE_MEM_RASCIIZ("mkdirat(path)", ARG2); /* Be strict but ignore fd for absolute path. */ - if (fd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(fd, "mkdirat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "mkdirat", tid, status); } static void do_statvfs_post(struct vki_statvfs *stats, ThreadId tid) @@ -5273,11 +5214,7 @@ PRE(sys_utimesys) PRE_MEM_READ("utimesys(times)", ARG4, 2 * sizeof(vki_timespec_t)); /* Be strict but ignore fd for absolute path. */ - if (fd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG3, 1) - && ((HChar *) ARG3)[0] != '/' - && !ML_(fd_allowed)(fd, "utimesys", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(fd, (const HChar*)ARG3, "utimesys", tid, status); break; } default: @@ -5309,11 +5246,7 @@ PRE(sys_utimensat) PRE_MEM_READ("utimensat(times)", ARG3, 2 * sizeof(vki_timespec_t)); /* Be strict but ignore fd for absolute path. */ - if (fd != VKI_AT_FDCWD - && ML_(safe_to_deref)((void *) ARG2, 1) - && ((HChar *) ARG2)[0] != '/' - && !ML_(fd_allowed)(fd, "utimensat", tid, False)) - SET_STATUS_Failure(VKI_EBADF); + ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "utimensat", tid, status); } #endif /* SOLARIS_UTIMENSAT_SYSCALL */ diff --git a/memcheck/tests/solaris/syscall_at.stderr.exp b/memcheck/tests/solaris/syscall_at.stderr.exp index b49fda289..59815bfa9 100644 --- a/memcheck/tests/solaris/syscall_at.stderr.exp +++ b/memcheck/tests/solaris/syscall_at.stderr.exp @@ -1,12 +1,12 @@ -Warning: invalid file descriptor 159879507 in syscall linkat() -Warning: invalid file descriptor 159879508 in syscall linkat() +Warning: invalid file descriptor 159879507 in syscall linkat(efd)() +Warning: invalid file descriptor 159879508 in syscall linkat(nfd)() Warning: invalid file descriptor 646349138 in syscall symlinkat() Warning: invalid file descriptor 70680914 in syscall readlinkat() Warning: invalid file descriptor 68362578 in syscall faccessat() Warning: invalid file descriptor 70685266 in syscall fchownat() -Warning: invalid file descriptor 70717779 in syscall renameat() -Warning: invalid file descriptor 70717780 in syscall renameat() +Warning: invalid file descriptor 70717779 in syscall renameat(fromfd)() +Warning: invalid file descriptor 70717780 in syscall renameat(tofd)() Warning: invalid file descriptor 123765074 in syscall unlinkat() Warning: invalid file descriptor 1112625490 in syscall fstatat() Warning: invalid file descriptor 151224658 in syscall openat() From 5f753c39ea6285fec27cc68cbaf6a629c5051f23 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 31 Aug 2025 08:21:23 +0200 Subject: [PATCH 233/412] Bug 507866 - fanotify_mark dirfd isn't checked --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index b1f4d8d11..d9ac8bdcb 100644 --- a/NEWS +++ b/NEWS @@ -76,6 +76,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 507720 Review syscalls returning file descriptors (other platforms) 507721 Wire up illumos and Solaris mallinfo 507853 faccessat and faccessat2 should handle AT_FDCWD and absolute paths +507866 fanotify_mark dirfd isn't checked 507868 futimesat doesn't handle AT_FDCWD 507869 Various at syscalls don't check dirfd argument 507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 785031c10..a511ccfe2 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2862,11 +2862,12 @@ PRE(sys_fanotify_mark) int, dfd, const char *, pathname); if (ARG5) PRE_MEM_RASCIIZ( "fanotify_mark(path)", ARG5); - if ( !ML_(fd_allowed)(SARG1, "fanotify_mark", tid, False) ) - SET_STATUS_Failure( VKI_EBADF ); #else # error Unexpected word size #endif + if ( !ML_(fd_allowed)(SARG1, "fanotify_mark[fanotify_fd]", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG4, (const HChar*)ARG5, "mkdirat[firfd]", tid, status); } /* --------------------------------------------------------------------- From d9ed6b6f29d217ce9b2c4ccebcc255574d4d55b5 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 31 Aug 2025 10:44:49 +0200 Subject: [PATCH 234/412] Bug 507867 - perf_event_open group_fd isn't checked --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 9 +++++++++ include/vki/vki-linux.h | 2 ++ 3 files changed, 12 insertions(+) diff --git a/NEWS b/NEWS index d9ac8bdcb..8b7f688f3 100644 --- a/NEWS +++ b/NEWS @@ -77,6 +77,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 507721 Wire up illumos and Solaris mallinfo 507853 faccessat and faccessat2 should handle AT_FDCWD and absolute paths 507866 fanotify_mark dirfd isn't checked +507867 perf_event_open group_fd isn't checked 507868 futimesat doesn't handle AT_FDCWD 507869 Various at syscalls don't check dirfd argument 507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index a511ccfe2..fef23763f 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4155,6 +4155,8 @@ PRE(sys_stime) PRE(sys_perf_event_open) { + // int syscall(SYS_perf_event_open, struct perf_event_attr *attr, + // pid_t pid, int cpu, int group_fd, unsigned long flags); struct vki_perf_event_attr *attr; PRINT("sys_perf_event_open ( %#" FMT_REGWORD "x, %ld, %ld, %ld, %#" FMT_REGWORD "x )", ARG1, SARG2, SARG3, SARG4, ARG5); @@ -4167,6 +4169,13 @@ PRE(sys_perf_event_open) (Addr)&attr->size, sizeof(attr->size) ); PRE_MEM_READ( "perf_event_open(attr)", (Addr)attr, attr->size ); + if ((ARG5 & VKI_PERF_FLAG_FD_NO_GROUP) != VKI_PERF_FLAG_FD_NO_GROUP) { + if ((Int)SARG4 != -1) { + if (!ML_(fd_allowed)(SARG4, "perf_event_open", tid, False)) { + SET_STATUS_Failure(VKI_EBADF); + } + } + } } POST(sys_perf_event_open) diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index c31035cbb..1e04bdd48 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -3223,6 +3223,8 @@ struct vki_perf_event_attr { #define VKI_PERF_EVENT_IOC_ID _VKI_IOR('$', 7, __vki_u64 *) #define VKI_PERF_EVENT_IOC_SET_BPF _VKI_IOW('$', 8, __vki_u32) +#define VKI_PERF_FLAG_FD_NO_GROUP (1UL << 0) + /*--------------------------------------------------------------------*/ // From linux-2.6.32.4/include/linux/getcpu.h /*--------------------------------------------------------------------*/ From 128017143a942263542a1d87132f3bae782ce645 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 31 Aug 2025 16:32:20 +0200 Subject: [PATCH 235/412] Bug 508958 - FreeBSD: add getgroups and setgroups wrappers --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-freebsd.h | 7 +- coregrind/m_syswrap/syswrap-freebsd.c | 23 +++++- include/vki/vki-scnums-freebsd.h | 16 ++++ memcheck/tests/freebsd/scalar.c | 83 ++++++++++++++++---- memcheck/tests/freebsd/scalar.stderr.exp | 26 ++++++ memcheck/tests/freebsd/scalar.stderr.exp-x86 | 26 ++++++ 7 files changed, 160 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index 8b7f688f3..2f77a2dd6 100644 --- a/NEWS +++ b/NEWS @@ -93,6 +93,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508778 syscall-wrapper waitid warns about infop=null 508779 PRE(sys_prlimit64): reorder check for memory validity 508869 x86-linux: simplify scalar test output +508958 FreeBSD: add getgroups and setgroups wrappers To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index f16831933..65f69e85a 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -107,8 +107,8 @@ DECL_TEMPLATE(freebsd, sys_sbrk) // 69 // generic mprotect 74 // generic madvise 75 // generic mincore 78 -// generic getgroups 79 -// generic setgroups 80 +// generic freebsd14_getgroups 79 +// generic freebsd14_setgroups 80 // generic getpgrp 81 // generic setpgid 82 // generic setitimer 83 @@ -547,6 +547,9 @@ DECL_TEMPLATE(freebsd, sys_exterrctl) // 592 DECL_TEMPLATE(freebsd, sys_inotify_add_watch_at) // 593 DECL_TEMPLATE(freebsd, sys_inotify_rm_watch) // 594 +// generic getgroups 595 +// generic setgroups 596 + DECL_TEMPLATE(freebsd, sys_fake_sigreturn) #endif // PRIV_SYSWRAP_FREEBSD_H diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 6679e58fb..bf7c96a8f 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -7304,9 +7304,17 @@ const SyscallTableEntry ML_(syscall_table)[] = { // obsol vhangup 76 // obsol vlimit 77 GENXY(__NR_mincore, sys_mincore), // 78 - GENXY(__NR_getgroups, sys_getgroups), // 79 - - GENX_(__NR_setgroups, sys_setgroups), // 80 + #if defined(__NR_freebsd14_getgroups) + GENXY(__NR_freebsd14_getgroups, sys_getgroups), // 79 + #else + GENXY(__NR_getgroups, sys_getgroups), // 79 + #endif + + #if defined(__NR_freebsd14_setgroups) + GENX_(__NR_freebsd14_setgroups, sys_setgroups), // 80 + #else + GENX_(__NR_setgroups, sys_setgroups), // 80 + #endif GENX_(__NR_getpgrp, sys_getpgrp), // 81 GENX_(__NR_setpgid, sys_setpgid), // 82 GENXY(__NR_setitimer, sys_setitimer), // 83 @@ -7891,7 +7899,14 @@ const SyscallTableEntry ML_(syscall_table)[] = { BSDX_(__NR_exterrctl, sys_exterrctl), // 592 BSDX_(__NR_inotify_add_watch_at, sys_inotify_add_watch_at), // 593 - BSDX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 593 + BSDX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 594 + +#if defined(__NR_freebsd14_setgroups) + GENX_(__NR_setgroups, sys_setgroups), // 595 +#endif +#if defined(__NR_freebsd14_getgroups) + GENXY(__NR_getgroups, sys_getgroups), // 596 +#endif BSDX_(__NR_fake_sigreturn, sys_fake_sigreturn), // 1000, fake sigreturn diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h index a15140285..50df8136a 100644 --- a/include/vki/vki-scnums-freebsd.h +++ b/include/vki/vki-scnums-freebsd.h @@ -28,6 +28,7 @@ #define VKI_UNISTD_FREEBSD_H #include "config.h" +#include // this is the syscall format used by e.g., libc functions like 'write' // this is the one used 99.999% of the time @@ -129,8 +130,16 @@ /* obs vhangup 76 */ /* obs vlimit 77 */ #define __NR_mincore 78 +#if defined(SYS_freebsd_getgroups) +#define __NR_freebsd14_getgroups 79 +#else #define __NR_getgroups 79 +#endif +#if defined(SYS_freebsd14_setgroups) +#define __NR_freebsd14_setgroups 80 +#else #define __NR_setgroups 80 +#endif #define __NR_getpgrp 81 #define __NR_setpgid 82 #define __NR_setitimer 83 @@ -634,6 +643,13 @@ #define __NR_inotify_add_watch_at 593 #define __NR_inotify_rm_watch 594 +#if defined(SYS_freebsd_getgroups) +#define __NR_getgroups 595 +#endif +#if defined(SYS_freebsd_setgroups) +#define __NR_setgroups 596 +#endif + #define __NR_fake_sigreturn 1000 #endif /* VKI_UNISTD_FREEBSD_H */ diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index 0709d1873..c3e700f27 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -348,13 +348,23 @@ int main(void) GO(SYS_mincore, "3s 1m"); SY(SYS_mincore, x0, x0+40960, x0); FAIL; - /* SYS_getgroups 79 */ + /* SYS_freeebsd14_getgroups 79 */ +#if defined(SYS_freebsd14_getgroups) + GO(SYS_freebsd14_getgroups, "2s 1m"); + SY(SYS_freebsd14_getgroups, x0+1, x0+1); FAIL; +#else GO(SYS_getgroups, "2s 1m"); SY(SYS_getgroups, x0+1, x0+1); FAIL; +#endif - /* SYS_setgroups 80 */ + /* SYS_freebsd14_setgroups 80 */ +#if defined(SYS_freebsd14_getgroups) + GO(SYS_freebsd14_getgroups, "2s 1m"); + SY(SYS_freebsd14_getgroups, x0+1, x0+1); FAIL; +#else GO(SYS_setgroups, "2s 1m"); SY(SYS_setgroups, x0+1, x0+1); FAIL; +#endif /* SYS_getpgrp 81 */ GO(SYS_getpgrp, "0s 0m"); @@ -2169,7 +2179,7 @@ int main(void) // __FreeBSD_version 1201522 // __FreeBSD_version 1300045 - /* SYS___sysctlbyname 570 */ + /* SYS___sysctlbyname 570 */ GO(SYS___sysctlbyname, "(getoldlen) 3s 2m"); SY(SYS___sysctlbyname, x0, x0+1, NULL, x0+1, NULL, x0); FAIL; @@ -2180,7 +2190,7 @@ int main(void) SY(SYS___sysctlbyname, x0, x0+1, NULL, NULL, x0+1, x0+2); FAIL; // FreeBSD 13 (and any backports) - /* SYS_shm_open2 571 */ + /* SYS_shm_open2 571 */ #if defined(SYS_shm_open2) GO(SYS_shm_open2, " 5s 2m"); SY(SYS_shm_open2, x0+0xf00c, x0+1, x0+2, x0+3, x0+4); FAIL; @@ -2235,7 +2245,7 @@ int main(void) FAKE_SY("\n"); #endif - /* SYS___realpathat 574 */ + /* SYS___realpathat 574 */ #if defined(SYS___realpathat) GO(SYS___realpathat, " 5s 2m"); SY(SYS___realpathat, x0+0xffff, x0, x0, x0+100, x0+2); FAIL; @@ -2266,14 +2276,14 @@ int main(void) FAKE_SY("\n"); #endif - /* SYS_close_range 575 */ + /* SYS_close_range 575 */ #if defined(SYS_close_range) GO(SYS_close_range, "3s 0m"); SY(SYS_close_range, x0+5, x0+10, x0+12345); FAIL; #else #endif - /* SYS___specialfd 577 */ + /* SYS___specialfd 577 */ #if defined(SYS___specialfd) GO(SYS___specialfd, "3s 1m"); SY(SYS___specialfd, x0+0xf000, x0+1, x0+10); FAIL; @@ -2294,7 +2304,7 @@ int main(void) FAKE_SY("\n"); #endif - /* SYS_aio_writev 578 */ + /* SYS_aio_writev 578 */ #if defined(SYS_aio_writev) GO(SYS_aio_writev, "1s 1m"); SY(SYS_aio_writev, x0+1); FAIL; @@ -2309,7 +2319,7 @@ int main(void) FAKE_SY("\n"); #endif - /* SYS_aio_readv 579 */ + /* SYS_aio_readv 579 */ #if defined(SYS_aio_readv) GO(SYS_aio_readv, "1s 1m"); SY(SYS_aio_readv, x0+1); FAIL; @@ -2325,7 +2335,7 @@ int main(void) #endif // FreeBSD 15 (and any backports) - /* SYS_kqueuex 583 */ + /* SYS_kqueuex 583 */ #if defined(SYS_kqueuex) GO(SYS_kqueuex, " 1s 0m"); SY(SYS_kqueuex, x0+123); FAIL; @@ -2336,7 +2346,7 @@ int main(void) FAKE_SY("\n"); #endif - /* SYS_membarrier 584 */ + /* SYS_membarrier 584 */ #if defined(SYS_membarrier) GO(SYS_membarrier, " 3s 0m"); SY(SYS_membarrier, x0+123, x0+456, x0+789); FAIL; @@ -2353,7 +2363,7 @@ int main(void) FAKE_SY("\n"); #endif - /* SYS_timerfd_create 585 */ + /* SYS_timerfd_create 585 */ #if defined(SYS_timerfd_create) GO(SYS_timerfd_create, " 2s 0m"); SY(SYS_timerfd_create, x0+123, x0+23456); FAIL; @@ -2367,7 +2377,7 @@ int main(void) FAKE_SY("\n"); #endif - /* SYS_timerfd_gettime 586 */ + /* SYS_timerfd_gettime 586 */ #if defined(SYS_timerfd_gettime) GO(SYS_timerfd_gettime, " 2s 1m"); SY(SYS_timerfd_gettime, x0+100, x0); FAIL; @@ -2385,7 +2395,7 @@ int main(void) FAKE_SY("\n"); #endif - /* SYS_timerfd_settime 587 */ + /* SYS_timerfd_settime 587 */ #if defined(SYS_timerfd_settime) GO(SYS_timerfd_settime, "4s 2m"); SY(SYS_timerfd_settime, x0+321, x0, x0+10, x0+5); FAIL; @@ -2413,7 +2423,7 @@ int main(void) FAKE_SY("\n"); #endif - /* SYS_kcmp 588 */ + /* SYS_kcmp 588 */ #if defined(SYS_kcmp) GO(SYS_kcmp, "5s 0m"); SY(SYS_kcmp, x0+1, x0+2, x0+3, x0+4, x0+5); @@ -2436,7 +2446,7 @@ int main(void) FAKE_SY("\n"); #endif - /* SYS_getrlimitusage 589 */ + /* SYS_getrlimitusage 589 */ #if defined(SYS_getrlimitusage) GO(SYS_getrlimitusage, "3s, 1m"); SY(SYS_getrlimitusage, x0+3, x0, x0+2); @@ -2457,6 +2467,7 @@ int main(void) FAKE_SY("\n"); #endif + /* SYS_fchroot 590 */ #if defined(SYS_fchroot) GO(SYS_fchroot, "1s, 0m"); SY(SYS_fchroot, x0+1000); @@ -2467,6 +2478,7 @@ int main(void) FAKE_SY("\n"); #endif + /* SYS_setcred 591 */ #if defined(SYS_setcred) GO(SYS_setcred, "3s, 1m"); SY(SYS_setcred, x0+100, x0+3, x0+50); @@ -2487,6 +2499,7 @@ int main(void) FAKE_SY("\n"); #endif + /* SYS_wxterrctl 592 */ #if defined(SYS_exterrctl) GO(SYS_exterrctl, "3s, 1m"); SY(SYS_exterrctl, x0, x0+1, x0+1); @@ -2507,6 +2520,7 @@ int main(void) FAKE_SY("\n"); #endif + /* SYS_inotify_add_watch_at 593 */ #if defined(SYS_inotify_add_watch_at) GO(SYS_inotify_add_watch_at, "3s, 1m"); SY(SYS_inotify_add_watch_at, x0, x0+1, x0+1); @@ -2527,6 +2541,7 @@ int main(void) FAKE_SY("\n"); #endif + /* SYS_inotify_rm_watch 594 */ #if defined(SYS_inotify_rm_watch) GO(SYS_inotify_rm_watch, "2s, 0m"); SY(SYS_inotify_rm_watch, x0+1000, x0+1000); @@ -2540,6 +2555,42 @@ int main(void) FAKE_SY("\n"); #endif + /* SYS_getgroups 595 */ +#if defined(SYS_freebsd14_getgroups) + GO(SYS_getgroups, "2s 1m"); + SY(SYS_getgroups, x0+1, x0+1); FAIL; +#else + FAKE_GO("595: SYS_getgroups 2s 1m"); + FAKE_SY("Syscall param getgroups(size) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param getgroups(list) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param getgroups(list) points to unaddressable byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); + FAKE_SY("\n"); +#endif + + /* SYS_setgroups 596 */ +#if defined(SYS_freebsd14_getgroups) + GO(SYS_getgroups, "2s 1m"); + SY(SYS_getgroups, x0+1, x0+1); FAIL; +#else + FAKE_GO("596: SYS_setgroups 2s 1m"); + FAKE_SY("Syscall param setgroups(size) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param setgroups(list) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param setgroups(list) points to unaddressable byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); + FAKE_SY("\n"); +#endif + /* SYS_exit 1 */ GO(SYS_exit, "1s 0m"); SY(SYS_exit, x0); FAIL; diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 882433a92..166552caf 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -5825,6 +5825,32 @@ Syscall param sys_inotify_rm_watch(fd) contains uninitialised byte(s) Syscall param sys_inotify_rm_watch(wd) contains uninitialised byte(s) ... +--------------------------------------------------------- +595: SYS_getgroups 2s 1m +--------------------------------------------------------- +Syscall param getgroups(size) contains uninitialised byte(s) + ... + +Syscall param getgroups(list) contains uninitialised byte(s) + ... + +Syscall param getgroups(list) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +--------------------------------------------------------- +596: SYS_setgroups 2s 1m +--------------------------------------------------------- +Syscall param setgroups(size) contains uninitialised byte(s) + ... + +Syscall param setgroups(list) contains uninitialised byte(s) + ... + +Syscall param setgroups(list) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 1: SYS_exit 1s 0m --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 20d8d3ca7..52c7ce8c3 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -5897,6 +5897,32 @@ Syscall param sys_inotify_rm_watch(fd) contains uninitialised byte(s) Syscall param sys_inotify_rm_watch(wd) contains uninitialised byte(s) ... +--------------------------------------------------------- +595: SYS_getgroups 2s 1m +--------------------------------------------------------- +Syscall param getgroups(size) contains uninitialised byte(s) + ... + +Syscall param getgroups(list) contains uninitialised byte(s) + ... + +Syscall param getgroups(list) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +--------------------------------------------------------- +596: SYS_setgroups 2s 1m +--------------------------------------------------------- +Syscall param setgroups(size) contains uninitialised byte(s) + ... + +Syscall param setgroups(list) contains uninitialised byte(s) + ... + +Syscall param setgroups(list) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 1: SYS_exit 1s 0m --------------------------------------------------------- From d7fc1bc7c4b0c07e78504f569e6df898aaed7ba4 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 31 Aug 2025 16:40:30 +0200 Subject: [PATCH 236/412] FreeBSD syscalls: new getgroups and setgroups Wasn't quite right for FreeBSD 15. --- include/vki/vki-scnums-freebsd.h | 6 +++--- memcheck/tests/freebsd/filter_scalar | 1 + memcheck/tests/freebsd/scalar.c | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h index 50df8136a..1f2df9be4 100644 --- a/include/vki/vki-scnums-freebsd.h +++ b/include/vki/vki-scnums-freebsd.h @@ -130,7 +130,7 @@ /* obs vhangup 76 */ /* obs vlimit 77 */ #define __NR_mincore 78 -#if defined(SYS_freebsd_getgroups) +#if defined(SYS_freebsd14_getgroups) #define __NR_freebsd14_getgroups 79 #else #define __NR_getgroups 79 @@ -643,10 +643,10 @@ #define __NR_inotify_add_watch_at 593 #define __NR_inotify_rm_watch 594 -#if defined(SYS_freebsd_getgroups) +#if defined(SYS_freebsd14_getgroups) #define __NR_getgroups 595 #endif -#if defined(SYS_freebsd_setgroups) +#if defined(SYS_freebsd14_setgroups) #define __NR_setgroups 596 #endif diff --git a/memcheck/tests/freebsd/filter_scalar b/memcheck/tests/freebsd/filter_scalar index 5461dce87..1e4f2d753 100755 --- a/memcheck/tests/freebsd/filter_scalar +++ b/memcheck/tests/freebsd/filter_scalar @@ -15,6 +15,7 @@ sed '/at 0x........: syscall (in \/...libc...)/d' | sed 's/SYS_freebsd12/ SYS/' | sed 's/SYS_freebsd13/ SYS/' | +sed 's/SYS_freebsd14/ SYS/' | # get rid of error limit message diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index c3e700f27..eeacaaf04 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -359,8 +359,8 @@ int main(void) /* SYS_freebsd14_setgroups 80 */ #if defined(SYS_freebsd14_getgroups) - GO(SYS_freebsd14_getgroups, "2s 1m"); - SY(SYS_freebsd14_getgroups, x0+1, x0+1); FAIL; + GO(SYS_freebsd14_setgroups, "2s 1m"); + SY(SYS_freebsd14_setgroups, x0+1, x0+1); FAIL; #else GO(SYS_setgroups, "2s 1m"); SY(SYS_setgroups, x0+1, x0+1); FAIL; @@ -2575,8 +2575,8 @@ int main(void) /* SYS_setgroups 596 */ #if defined(SYS_freebsd14_getgroups) - GO(SYS_getgroups, "2s 1m"); - SY(SYS_getgroups, x0+1, x0+1); FAIL; + GO(SYS_setgroups, "2s 1m"); + SY(SYS_setgroups, x0+1, x0+1); FAIL; #else FAKE_GO("596: SYS_setgroups 2s 1m"); FAKE_SY("Syscall param setgroups(size) contains uninitialised byte(s)\n"); From 002d595cfe4a2e68e9c5fb0e92683b877074e1ae Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 31 Aug 2025 18:34:11 +0200 Subject: [PATCH 237/412] FreeBSD suppression: add a DRD suppression for exterrctl --- freebsd-drd.supp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/freebsd-drd.supp b/freebsd-drd.supp index c0767aadf..b9b0d5de7 100644 --- a/freebsd-drd.supp +++ b/freebsd-drd.supp @@ -223,3 +223,9 @@ drd:ConflictingAccess fun:thr_new } + +{ + DRD-FREEBSD15-EXTERRCTL + drd:ConflictingAccess + fun:exterrctl +} From 730322b65603ef7664f04b99376143f84e4b5aba Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 3 Sep 2025 14:38:41 +0000 Subject: [PATCH 238/412] VEX: Remove functions isZeroU32 and isZeroU64 This was forgotten when function isZeroU was added. --- VEX/priv/ir_opt.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 925524e15..6d34a1750 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1176,25 +1176,6 @@ Bool debug_only_hack_sameIRExprs_might_assert ( IRExpr* e1, IRExpr* e2 ) } -/* Is this literally IRExpr_Const(IRConst_U32(0)) ? */ -static Bool isZeroU32 ( IRExpr* e ) -{ - return toBool( e->tag == Iex_Const - && e->Iex.Const.con->tag == Ico_U32 - && e->Iex.Const.con->Ico.U32 == 0); -} - -/* Is this literally IRExpr_Const(IRConst_U64(0)) ? - Currently unused; commented out to avoid compiler warning */ -#if 0 -static Bool isZeroU64 ( IRExpr* e ) -{ - return toBool( e->tag == Iex_Const - && e->Iex.Const.con->tag == Ico_U64 - && e->Iex.Const.con->Ico.U64 == 0); -} -#endif - /* Is this literally IRExpr_Const(IRConst_V128(0)) ? */ static Bool isZeroV128 ( IRExpr* e ) { @@ -2871,7 +2852,7 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } /* CmpNE32(1Uto32(b), 0) ==> b */ if (e->Iex.Binop.op == Iop_CmpNE32 && - isZeroU32(e->Iex.Binop.arg2)) { + isZeroU(e->Iex.Binop.arg2)) { IRExpr* a1 = chase(env, e->Iex.Binop.arg1); if (a1 && a1->tag == Iex_Unop && a1->Iex.Unop.op == Iop_1Uto32) { @@ -5867,7 +5848,7 @@ static IRExpr* fold_IRExpr_Binop ( IROp op, IRExpr* a1, IRExpr* a2 ) case Iop_CmpNE32: /* Since X has type Ity_I1 we can simplify: CmpNE32(1Uto32(X),0)) ==> X */ - if (is_Unop(a1, Iop_1Uto32) && isZeroU32(a2)) + if (is_Unop(a1, Iop_1Uto32) && isZeroU(a2)) return a1->Iex.Unop.arg; break; From 7270e04ab8eb73d5787a9f1209edf40b309bc686 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 3 Sep 2025 14:48:39 +0000 Subject: [PATCH 239/412] VEX: Fix function mkOnesOfPrimopResultType This function may be called with Iop_Max32U as argument which isn't handled. --- VEX/priv/ir_opt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 6d34a1750..86f3fad27 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1280,6 +1280,7 @@ static IRExpr* mkOnesOfPrimopResultType ( IROp op ) case Iop_Or16: return IRExpr_Const(IRConst_U16(0xFFFF)); case Iop_Or32: + case Iop_Max32U: return IRExpr_Const(IRConst_U32(0xFFFFFFFF)); case Iop_CmpEQ8x8: case Iop_CmpEQ16x4: From fe08b27ec036f67d2cdb52e6ca56a0624c8a89c4 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 3 Sep 2025 15:00:56 +0000 Subject: [PATCH 240/412] ir_opt.c: Algebraic simplification for Iop_Add. The simplification rules for IopAdd32/64 also apply for Iop_Add8/16. --- VEX/priv/ir_opt.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 86f3fad27..84bc4e021 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2625,37 +2625,31 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) break; case Iop_Add8: - /* Add8(t,t) ==> t << 1. - Memcheck doesn't understand that - x+x produces a defined least significant bit, and it seems - simplest just to get rid of the problem by rewriting it - out, since the opportunity to do so exists. */ - if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) { - e2 = IRExpr_Binop(Iop_Shl8, e->Iex.Binop.arg1, - IRExpr_Const(IRConst_U8(1))); - break; - } - break; - - /* NB no Add16(t,t) case yet as no known test case exists */ - + case Iop_Add16: case Iop_Add32: case Iop_Add64: - /* Add32/Add64(x,0) ==> x */ + /* Add8/Add16/Add32/Add64(x,0) ==> x */ if (isZeroU(e->Iex.Binop.arg2)) { e2 = e->Iex.Binop.arg1; break; } - /* Add32/Add64(0,x) ==> x */ + /* Add8/Add16/Add32/Add64(0,x) ==> x */ if (isZeroU(e->Iex.Binop.arg1)) { e2 = e->Iex.Binop.arg2; break; } - /* Add32/Add64(t,t) ==> t << 1. Same rationale as for Add8. */ + /* Add8/Add16/Add32/Add64(t,t) ==> t << 1. + Memcheck doesn't understand that + x+x produces a defined least significant bit, and it seems + simplest just to get rid of the problem by rewriting it + out, since the opportunity to do so exists. */ if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) { - e2 = IRExpr_Binop( - e->Iex.Binop.op == Iop_Add32 ? Iop_Shl32 : Iop_Shl64, - e->Iex.Binop.arg1, IRExpr_Const(IRConst_U8(1))); + IROp add_op = e->Iex.Binop.op; + IROp shift_op = (add_op == Iop_Add64) ? Iop_Shl64 : + (add_op == Iop_Add32) ? Iop_Shl32 : + (add_op == Iop_Add16) ? Iop_Shl16 : Iop_Shl8; + e2 = IRExpr_Binop(shift_op, e->Iex.Binop.arg1, + IRExpr_Const(IRConst_U8(1))); break; } break; From c93dba5adbd5d4862111459bc90174d76639ecc6 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 3 Sep 2025 15:03:08 +0000 Subject: [PATCH 241/412] ir_opt.c: Algebraic simplification for Iop_Sub. The simplification rules for IopSub32/64 also apply for Iop_Sub8/16. --- VEX/priv/ir_opt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 84bc4e021..b362be007 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2654,19 +2654,22 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } break; + case Iop_Sub8: + case Iop_Sub16: case Iop_Sub32: case Iop_Sub64: - /* Sub32/Sub64(x,0) ==> x */ + /* Sub8/Sub16/Sub32/Sub64(x,0) ==> x */ if (isZeroU(e->Iex.Binop.arg2)) { e2 = e->Iex.Binop.arg1; break; } - /* Sub32/Sub64(t,t) ==> 0, for some IRTemp t */ + /* Sub8/Sub16/Sub32/Sub64(t,t) ==> 0, for some IRTemp t */ if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) { e2 = mkZeroOfPrimopResultType(e->Iex.Binop.op); break; } break; + case Iop_Sub8x16: /* Sub8x16(x,0) ==> x */ if (isZeroV128(e->Iex.Binop.arg2)) { From 98d3c055b97b980a78c7d18560a11f64aeca981c Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 3 Sep 2025 15:07:52 +0000 Subject: [PATCH 242/412] ir_opt.c: Algebraic simplification for Iop_Shl/Shr/Sar. The simplification rules for 32-bit and 64-bit operands also apply for 8-bit and 16-bit operands. --- VEX/priv/ir_opt.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index b362be007..f38a7be64 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2571,31 +2571,34 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) /* other cases (identities, etc) */ switch (e->Iex.Binop.op) { + case Iop_Shl8: + case Iop_Shl16: case Iop_Shl32: case Iop_Shl64: + case Iop_Shr8: + case Iop_Shr16: + case Iop_Shr32: case Iop_Shr64: + case Iop_Sar8: + case Iop_Sar16: + case Iop_Sar32: case Iop_Sar64: - /* Shl32/Shl64/Shr64/Sar64(x,0) ==> x */ + /* Shl8/Shl16/Shl32/Shl64(x,0) ==> x + Shr8/Shr16/Shr32/Shr64(x,0) ==> x + Sar8/Sar16/Sar32/Sar64(x,0) ==> x */ if (isZeroU(e->Iex.Binop.arg2)) { e2 = e->Iex.Binop.arg1; break; } - /* Shl32/Shl64/Shr64(0,x) ==> 0 */ + /* Shl8/Shl16/Shl32/Shl64(0,x) ==> 0 + Shr8/Shr16/Shr32/Shr64(0,x) ==> 0 + Sar8/Sar16/Sar32/Sar64(0,x) ==> 0 */ if (isZeroU(e->Iex.Binop.arg1)) { e2 = e->Iex.Binop.arg1; break; } break; - case Iop_Sar32: - case Iop_Shr32: - /* Shr32/Sar32(x,0) ==> x */ - if (isZeroU(e->Iex.Binop.arg2)) { - e2 = e->Iex.Binop.arg1; - break; - } - break; - case Iop_Or8: case Iop_Or16: case Iop_Or32: From a7fe47937b088aff567f9de7c0a4275a6ca6e139 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 3 Sep 2025 15:09:50 +0000 Subject: [PATCH 243/412] ir_opt.c: Algebraic simplification for Iop_Or1. Adapt function mkOnesOfPrimopResultType accordingly. --- VEX/priv/ir_opt.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index f38a7be64..1e4ba670e 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1275,6 +1275,8 @@ static inline IRExpr* mkTrue(void) static IRExpr* mkOnesOfPrimopResultType ( IROp op ) { switch (op) { + case Iop_Or1: + return IRExpr_Const(IRConst_U1(0x1)); case Iop_Or8: return IRExpr_Const(IRConst_U8(0xFF)); case Iop_Or16: @@ -2599,23 +2601,24 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } break; + case Iop_Or1: case Iop_Or8: case Iop_Or16: case Iop_Or32: case Iop_Or64: case Iop_Max32U: - /* Or8/Or16/Or32/Or64/Max32U(x,0) ==> x */ + /* Or1/Or8/Or16/Or32/Or64/Max32U(x,0) ==> x */ if (isZeroU(e->Iex.Binop.arg2)) { e2 = e->Iex.Binop.arg1; break; } - /* Or8/Or16/Or32/Or64/Max32U(0,x) ==> x */ + /* Or1/Or8/Or16/Or32/Or64/Max32U(0,x) ==> x */ if (isZeroU(e->Iex.Binop.arg1)) { e2 = e->Iex.Binop.arg2; break; } - /* Or8/Or16/Or32/Or64/Max32U(x,1---1b) ==> 1---1b */ - /* Or8/Or16/Or32/Or64/Max32U(1---1b,x) ==> 1---1b */ + /* Or1/Or8/Or16/Or32/Or64/Max32U(x,1---1b) ==> 1---1b */ + /* Or1/Or8/Or16/Or32/Or64/Max32U(1---1b,x) ==> 1---1b */ if (isOnesU(e->Iex.Binop.arg1) || isOnesU(e->Iex.Binop.arg2)) { e2 = mkOnesOfPrimopResultType(e->Iex.Binop.op); break; From b6ab5a762d094cfb61696cdbad5413ef0366c496 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 3 Sep 2025 18:29:43 +0200 Subject: [PATCH 244/412] Remove fdleak.h CLOSE_INHERITED_FDS workaround This workaround was necessary with very old perl implementations (from 2008) which might execute programs with some non-standard file descriptors not closed. The macro would close all file descriptors 3 or higher so --track-fds wouldn't report on them. More recently --track-fds also reports on bad file descriptor usage. First only double or bad close calls were reported. This would cause lots of warnings for the close_inherited file descriptor loop because almost all of those file descriptors were never opened, so --track-fds would report those. To work around that an fstat call was added before the close to make sure the file descriptor existed. This fstat workaround in close_inherited only worked because fstat didn't have a fd_allowed check. Which is a bug that should be fixed. On some systems fstat actually calls the fstatat syscall and that did recently got the fd_allowed check, so on systems that use fstatat for fstat various fdleak tests started failing. We could test for and use close_range, which is smart enough to not warn about never opened file descriptors in the range. But it seems simpler to just get rid of the CLOSE_INHERITED_FDS macro because the problematic perl implementation is now so old that nobody uses it anymore. --- none/tests/fdleak.h | 25 ------------------------- none/tests/fdleak_cmsg.c | 2 +- none/tests/fdleak_creat.c | 2 +- none/tests/fdleak_dup.c | 2 +- none/tests/fdleak_dup2.c | 2 +- none/tests/fdleak_fcntl.c | 2 +- none/tests/fdleak_ipv4.c | 2 +- none/tests/fdleak_open.c | 2 +- none/tests/fdleak_pipe.c | 2 +- none/tests/fdleak_socketpair.c | 2 +- none/tests/file_dclose.c | 2 +- none/tests/rlimit64_nofile.c | 2 +- none/tests/rlimit_nofile.c | 2 +- none/tests/socket_close.c | 2 +- 14 files changed, 13 insertions(+), 38 deletions(-) diff --git a/none/tests/fdleak.h b/none/tests/fdleak.h index 54c4895db..9225dd3da 100644 --- a/none/tests/fdleak.h +++ b/none/tests/fdleak.h @@ -17,29 +17,4 @@ res; \ }) -/* - * The macro below closes file descriptors inherited from the process - * that forked the current process. Close these file descriptors right - * after the start of main() in order to get consistent results across - * different releases. Known behavior: - * - Fedora Core 1's Perl opens /dev/pts/2 as fd 10. - * - For Ubuntu 8.04, see also - * https://bugs.launchpad.net/ubuntu/+source/seahorse/+bug/235184 - */ -__attribute__((unused)) -static void close_inherited (void) { - struct stat sb; - int i; int max_fds = sysconf (_SC_OPEN_MAX); - if (max_fds < 0) - max_fds = 1024; /* Fallback if sysconf fails, returns -1. */ - - /* Only leave 0 (stdin), 1 (stdout) and 2 (stderr) open. */ - for (i = 3; i < max_fds; i++) - if (fstat (i, &sb) != -1) /* Test if the file descriptor exists first. */ - close(i); -} -#define CLOSE_INHERITED_FDS close_inherited () -/* Note that the following would be nicer, but close_range is fairly new. */ -// #define CLOSE_INHERITED_FDS close_range (3, ~0U, 0) - #endif /* _FDLEAK_H_ */ diff --git a/none/tests/fdleak_cmsg.c b/none/tests/fdleak_cmsg.c index d4300bcf2..638bca3d2 100644 --- a/none/tests/fdleak_cmsg.c +++ b/none/tests/fdleak_cmsg.c @@ -159,7 +159,7 @@ int main (int argc, char **argv) { int pid, status; - CLOSE_INHERITED_FDS; + pid = getpid(); sprintf(filea, "/tmp/data1.%d", pid); diff --git a/none/tests/fdleak_creat.c b/none/tests/fdleak_creat.c index 3c7c40174..e3fc03397 100644 --- a/none/tests/fdleak_creat.c +++ b/none/tests/fdleak_creat.c @@ -7,7 +7,7 @@ int main (int argc, char **argv) { char filename[24]; - CLOSE_INHERITED_FDS; + sprintf(filename, "/tmp/file.%ld", (long) getpid()); (void) DO( creat(filename, 0) ); diff --git a/none/tests/fdleak_dup.c b/none/tests/fdleak_dup.c index f526121e2..c4fedbee3 100644 --- a/none/tests/fdleak_dup.c +++ b/none/tests/fdleak_dup.c @@ -6,7 +6,7 @@ int main (int argc, char **argv) { int s; - CLOSE_INHERITED_FDS; + s = DO( open("/dev/null", O_RDONLY) ); (void) DO( dup(s) ); diff --git a/none/tests/fdleak_dup2.c b/none/tests/fdleak_dup2.c index 96a7271c6..02d641649 100644 --- a/none/tests/fdleak_dup2.c +++ b/none/tests/fdleak_dup2.c @@ -7,7 +7,7 @@ int main (int argc, char **argv) int s1; int s2; - CLOSE_INHERITED_FDS; + s1 = DO( open("/dev/null", O_RDONLY) ); s2 = DO( open("/dev/null", O_RDONLY) ); diff --git a/none/tests/fdleak_fcntl.c b/none/tests/fdleak_fcntl.c index c57a2608b..909c26092 100644 --- a/none/tests/fdleak_fcntl.c +++ b/none/tests/fdleak_fcntl.c @@ -7,7 +7,7 @@ int main (int argc, char **argv) { int s1; - CLOSE_INHERITED_FDS; + s1 = DO( open("/dev/null", O_RDONLY) ); (void) DO( fcntl(s1, F_DUPFD, s1) ); diff --git a/none/tests/fdleak_ipv4.c b/none/tests/fdleak_ipv4.c index 05f297762..8313ef75d 100644 --- a/none/tests/fdleak_ipv4.c +++ b/none/tests/fdleak_ipv4.c @@ -80,7 +80,7 @@ int main (int argc, char **argv) { int pid, status; - CLOSE_INHERITED_FDS; + if ((pid = fork()) == 0) { server(); diff --git a/none/tests/fdleak_open.c b/none/tests/fdleak_open.c index cf6a35e97..7b0255363 100644 --- a/none/tests/fdleak_open.c +++ b/none/tests/fdleak_open.c @@ -4,7 +4,7 @@ int main (int argc, char **argv) { - CLOSE_INHERITED_FDS; + (void) DO( open("/dev/null", O_RDONLY) ); diff --git a/none/tests/fdleak_pipe.c b/none/tests/fdleak_pipe.c index 82ff24e88..0a2d7102c 100644 --- a/none/tests/fdleak_pipe.c +++ b/none/tests/fdleak_pipe.c @@ -5,7 +5,7 @@ int main (int argc, char **argv) { int fds[2]; - CLOSE_INHERITED_FDS; + (void) DO( pipe(fds) ); diff --git a/none/tests/fdleak_socketpair.c b/none/tests/fdleak_socketpair.c index 620592004..bd3a9b8a3 100644 --- a/none/tests/fdleak_socketpair.c +++ b/none/tests/fdleak_socketpair.c @@ -8,7 +8,7 @@ int main (int argc, char **argv) { int fds[2]; - CLOSE_INHERITED_FDS; + (void) DO( socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, fds) ); diff --git a/none/tests/file_dclose.c b/none/tests/file_dclose.c index b3f864ef9..3b7b127bb 100644 --- a/none/tests/file_dclose.c +++ b/none/tests/file_dclose.c @@ -20,7 +20,7 @@ closefile (const char *f, int fd) int main () { - CLOSE_INHERITED_FDS; + const char *TMPFILE = "file_dclose.tmp"; int fd; diff --git a/none/tests/rlimit64_nofile.c b/none/tests/rlimit64_nofile.c index 54c3edf73..d94f78dc9 100644 --- a/none/tests/rlimit64_nofile.c +++ b/none/tests/rlimit64_nofile.c @@ -15,7 +15,7 @@ int main(int argc, char **argv) struct rlimit64 newrlim; int fd; - CLOSE_INHERITED_FDS; + if (getrlimit64(RLIMIT_NOFILE, &oldrlim) < 0) { diff --git a/none/tests/rlimit_nofile.c b/none/tests/rlimit_nofile.c index 4410c3e48..084f94b3b 100644 --- a/none/tests/rlimit_nofile.c +++ b/none/tests/rlimit_nofile.c @@ -14,7 +14,7 @@ int main(int argc, char **argv) struct rlimit newrlim; int fd; - CLOSE_INHERITED_FDS; + if (getrlimit(RLIMIT_NOFILE, &oldrlim) < 0) { diff --git a/none/tests/socket_close.c b/none/tests/socket_close.c index 59d70c000..7a632940b 100644 --- a/none/tests/socket_close.c +++ b/none/tests/socket_close.c @@ -26,7 +26,7 @@ void open_socket() int main () { - CLOSE_INHERITED_FDS; + open_socket(); From 8ea8b0c69b6d7cad0a05537f4b37d766c5c794ee Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 3 Sep 2025 19:20:24 +0200 Subject: [PATCH 245/412] Add fd_allowed check to fstat (sys_newfstat) Makes sure that with --track-fds fstat is also checked. --- coregrind/m_syswrap/syswrap-generic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index c8c421c95..ce4c11c26 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -3865,6 +3865,8 @@ PRE(sys_newfstat) PRINT("sys_newfstat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1, ARG2); PRE_REG_READ2(long, "fstat", unsigned int, fd, struct stat *, buf); PRE_MEM_WRITE( "fstat(buf)", ARG2, sizeof(struct vki_stat) ); + if ( !ML_(fd_allowed)(ARG1, "fstat", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } POST(sys_newfstat) From 6902553f902e6845d92824383425aac022690bb8 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 4 Sep 2025 13:01:52 +0000 Subject: [PATCH 246/412] ir_opt.c: Fix mkZeroOfPrimopResultType In c93dba5adbd5d I forgot to adjust mkZeroOfPrimopResultType. This function needs to go. See also 7270e04ab8eb7. I should be able to query IROp properties easily and for all IRops. E.g. instead of calling mkZeroOfPrimopResultType I want this: mkZero(irop->result_type) --- VEX/priv/ir_opt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 1e4ba670e..9ed002ea4 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1243,7 +1243,9 @@ static Bool notBool ( Bool b ) static IRExpr* mkZeroOfPrimopResultType ( IROp op ) { switch (op) { + case Iop_Sub8: case Iop_Xor8: return IRExpr_Const(IRConst_U8(0)); + case Iop_Sub16: case Iop_Xor16: return IRExpr_Const(IRConst_U16(0)); case Iop_Sub32: case Iop_Xor32: return IRExpr_Const(IRConst_U32(0)); From fc9bb3a0e4c1325b0ff428cddacea0947e945c67 Mon Sep 17 00:00:00 2001 From: Romain Geissler Date: Thu, 4 Sep 2025 12:10:12 +0000 Subject: [PATCH 247/412] Fix compilation of tests/arm64/bug484935.c when using fat LTO. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121719 Fix this error: /tmp/ccfnh7KQ.s: Assembler messages: /tmp/ccfnh7KQ.s:175: Error: symbol `loop' is already defined --- NEWS | 1 + memcheck/tests/arm64/bug484935.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 2f77a2dd6..5131a1b2e 100644 --- a/NEWS +++ b/NEWS @@ -94,6 +94,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508779 PRE(sys_prlimit64): reorder check for memory validity 508869 x86-linux: simplify scalar test output 508958 FreeBSD: add getgroups and setgroups wrappers +509103 Fix tests/arm64/bug484935.c build with "-O2 -flto -ffat-lto-objects" To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/memcheck/tests/arm64/bug484935.c b/memcheck/tests/arm64/bug484935.c index ff96f078a..6ece70720 100644 --- a/memcheck/tests/arm64/bug484935.c +++ b/memcheck/tests/arm64/bug484935.c @@ -28,9 +28,9 @@ void* load_memory_content(void** ptr) "LDR x2, [%1, #16]\n" "mov %0, x0\n" "mov x3, #2000\n" - "loop:" + "1:\n" " subs x3, x3, #1\n" - " b.ne loop\n" + " b.ne 1b\n" : "=r"(result) : "r"(ptr) : "x0", "x1", "x2", "x3"); From 2183b9df6c15f7e1768f19bcd1f89ea2c5e05553 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 4 Sep 2025 21:17:43 +0200 Subject: [PATCH 248/412] FreeBSD regtest: clean up compat syscall messages Old syscalls never die. They just become freebsdXX_syscall. And I forget to rename all their arguments. --- coregrind/m_syswrap/priv_syswrap-freebsd.h | 2 +- coregrind/m_syswrap/syswrap-freebsd.c | 94 ++++++++++---------- memcheck/tests/freebsd/scalar.stderr.exp | 94 ++++++++++---------- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 94 ++++++++++---------- 4 files changed, 142 insertions(+), 142 deletions(-) diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index 65f69e85a..b30cce4e8 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -81,7 +81,7 @@ DECL_TEMPLATE(freebsd, sys_fchflags) // 35 // generic kill 37 // generic getppid 39 // generic dup 41 -DECL_TEMPLATE(freebsd, sys_pipe) // 42 +DECL_TEMPLATE(freebsd, sys_freebsd10_pipe) // 42 // generic getegid 43 // generic profil redirect to ni_syscall 44 // sys_ktrace refirect to ni_syscall 45 diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index bf7c96a8f..0c68acdc8 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -918,15 +918,15 @@ PRE(sys_fchflags) // Pipe on freebsd doesn't have args, and uses dual returns! // SYS_freebsd10_pipe 42 // int pipe(void); -PRE(sys_pipe) +PRE(sys_freebsd10_pipe) { - PRINT("%s", "sys_pipe ()"); + PRINT("%s", "sys_freebsd10_pipe ()"); } -POST(sys_pipe) +POST(sys_freebsd10_pipe) { - if (!ML_(fd_allowed)(RES, "pipe", tid, True) || - !ML_(fd_allowed)(RESHI, "pipe", tid, True)) { + if (!ML_(fd_allowed)(RES, "freebsd10_pipe", tid, True) || + !ML_(fd_allowed)(RESHI, "freebsd10_pipe", tid, True)) { VG_(close)(RES); VG_(close)(RESHI); SET_STATUS_Failure( VKI_EMFILE ); @@ -1788,9 +1788,9 @@ PRE(sys_seteuid) PRE(sys_freebsd11_stat) { PRINT("sys_freebsd11_stat ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",ARG1,(char *)ARG1,ARG2); - PRE_REG_READ2(int, "stat", char *, path, struct freebsd11_stat *, sb); - PRE_MEM_RASCIIZ( "stat(path)", ARG1 ); - PRE_MEM_WRITE( "stat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) ); + PRE_REG_READ2(int, "freebsd11_stat", char *, path, struct freebsd11_stat *, sb); + PRE_MEM_RASCIIZ( "freebsd11_stat(path)", ARG1 ); + PRE_MEM_WRITE( "freebsd11_stat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) ); } POST(sys_freebsd11_stat) @@ -1803,10 +1803,10 @@ POST(sys_freebsd11_stat) PRE(sys_freebsd11_fstat) { PRINT("sys_freebsd11_fstat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",SARG1,ARG2); - PRE_REG_READ2(int, "fstat", int, fd, struct stat *, sb); + PRE_REG_READ2(int, "freebsd11_fstat", int, fd, struct stat *, sb); if (!ML_(fd_allowed)(ARG1, "freebsd11_fstat", tid, False)) SET_STATUS_Failure(VKI_EBADF); - PRE_MEM_WRITE( "fstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) ); + PRE_MEM_WRITE( "freebsd11_fstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) ); } POST(sys_freebsd11_fstat) @@ -1819,9 +1819,9 @@ POST(sys_freebsd11_fstat) PRE(sys_freebsd11_lstat) { PRINT("sys_freebsd11_lstat ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",ARG1,(char *)ARG1,ARG2); - PRE_REG_READ2(sb, "lstat", const char *, path, struct freebsd11_stat *, sb); - PRE_MEM_RASCIIZ( "lstat(path)", ARG1 ); - PRE_MEM_WRITE( "lstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) ); + PRE_REG_READ2(sb, "freebsd11_lstat", const char *, path, struct freebsd11_stat *, sb); + PRE_MEM_RASCIIZ( "freebsd11_lstat(path)", ARG1 ); + PRE_MEM_WRITE( "freebsd11_lstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) ); } POST(sys_freebsd11_lstat) @@ -1864,15 +1864,15 @@ PRE(sys_freebsd11_getdirentries) { *flags |= SfMayBlock; PRINT("sys_freebsd11_getdirentries ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", ARG1,ARG2,ARG3); - PRE_REG_READ4(int, "getdirentries", + PRE_REG_READ4(int, "freebsd11_getdirentries", int, fd, char *, buf, int, nbytes, long *, basep); - if (!ML_(fd_allowed)(ARG1, "getdirentries", tid, False)) + if (!ML_(fd_allowed)(ARG1, "freebsd11_getdirentries", tid, False)) SET_STATUS_Failure(VKI_EBADF); - PRE_MEM_WRITE( "getdirentries(buf)", ARG2, ARG3 ); + PRE_MEM_WRITE( "freebsd11_getdirentries(buf)", ARG2, ARG3 ); if (ARG4) { - PRE_MEM_WRITE( "getdirentries(basep)", ARG4, sizeof(long) ); + PRE_MEM_WRITE( "freebsd11_getdirentries(basep)", ARG4, sizeof(long) ); } } @@ -2171,7 +2171,7 @@ PRE(sys_freebsd7___semctl) PRINT("sys_freebsd7___semctl ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )",ARG1,ARG2,ARG3,ARG4); PRE_REG_READ4(int, "semctl", int, semid, int, semnum, int, cmd, union vki_semun *, arg); - PRE_MEM_READ("sys_freebsd7___semctl(arg)", ARG4, sizeof(union vki_semun)); + PRE_MEM_READ("freebsd7___semctl(arg)", ARG4, sizeof(union vki_semun)); semun = (union vki_semun*)ARG4; if (ML_(safe_to_deref)(semun, sizeof(*semun))) { ARG4 = (RegWord)semun; @@ -2222,15 +2222,15 @@ PRE(sys_freebsd7_msgctl) { PRINT("sys_freebsd7_msgctl ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1,SARG2,ARG3 ); - PRE_REG_READ3(int, "msgctl", int, msqid, int, cmd, struct msqid_ds_old *, buf); + PRE_REG_READ3(int, "freebsd7_msgctl", int, msqid, int, cmd, struct msqid_ds_old *, buf); switch (ARG2 /* cmd */) { case VKI_IPC_STAT: - PRE_MEM_WRITE( "msgctl(IPC_STAT, buf)", + PRE_MEM_WRITE( "freebsd7_msgctl(IPC_STAT, buf)", ARG3, sizeof(struct vki_msqid_ds_old) ); break; case VKI_IPC_SET: - PRE_MEM_READ( "msgctl(IPC_SET, buf)", + PRE_MEM_READ( "freebsd7_msgctl(IPC_SET, buf)", ARG3, sizeof(struct vki_msqid_ds_old) ); break; } @@ -2312,15 +2312,15 @@ POST(sys_shmat) PRE(sys_freebsd7_shmctl) { PRINT("sys_freebsd7_shmctl ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",SARG1,SARG2,ARG3); - PRE_REG_READ3(int, "shmctl", + PRE_REG_READ3(int, "freebsd7_shmctl", int, shmid, int, cmd, struct vki_shmid_ds_old *, buf); switch (ARG2 /* cmd */) { case VKI_IPC_STAT: - PRE_MEM_WRITE( "shmctl7(IPC_STAT, buf)", + PRE_MEM_WRITE( "freebsd7_shmctl7(IPC_STAT, buf)", ARG3, sizeof(struct vki_shmid_ds_old) ); break; case VKI_IPC_SET: - PRE_MEM_READ( "shmctl7(IPC_SET, buf)", + PRE_MEM_READ( "freebsd7_shmctl7(IPC_SET, buf)", ARG3, sizeof(struct vki_shmid_ds_old) ); break; } @@ -2764,9 +2764,9 @@ POST(sys_fhopen) PRE(sys_freebsd11_fhstat) { PRINT("sys_freebsd11_fhstat ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",ARG1,ARG2); - PRE_REG_READ2(int, "fhstat", struct fhandle *, fhp, struct freebd11_stat *, sb); - PRE_MEM_READ( "fhstat(fhp)", ARG1, sizeof(struct vki_fhandle) ); - PRE_MEM_WRITE( "fhstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) ); + PRE_REG_READ2(int, "freebsd11_fhstat", struct fhandle *, fhp, struct freebd11_stat *, sb); + PRE_MEM_READ( "freebsd11_fhstat(fhp)", ARG1, sizeof(struct vki_fhandle) ); + PRE_MEM_WRITE( "freebsd11_fhstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) ); } POST(sys_freebsd11_fhstat) @@ -3584,23 +3584,23 @@ POST(sys_kqueue) PRE(sys_freebsd11_kevent) { PRINT("sys_freebsd11_kevent ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )\n", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6); - PRE_REG_READ6(int, "kevent", + PRE_REG_READ6(int, "freebsd11_kevent", int, fd, const struct vki_kevent_freebsd11 *, changelist, int, nchanges, struct vki_kevent_freebsd11 *, eventlist, int, nevents, struct timespec *, timeout); if (!ML_(fd_allowed)(ARG1, "freebsd11_kevent", tid, False)) SET_STATUS_Failure(VKI_EBADF); if (ARG2 != 0 && ARG3 != 0) { - PRE_MEM_READ( "kevent(changelist)", ARG2, sizeof(struct vki_kevent_freebsd11)*ARG3 ); + PRE_MEM_READ( "freebsd11_kevent(changelist)", ARG2, sizeof(struct vki_kevent_freebsd11)*ARG3 ); } if (ARG4 != 0 && ARG5 != 0) { - PRE_MEM_WRITE( "kevent(eventlist)", ARG4, sizeof(struct vki_kevent_freebsd11)*ARG5); + PRE_MEM_WRITE( "freebsd11_kevent(eventlist)", ARG4, sizeof(struct vki_kevent_freebsd11)*ARG5); } if (ARG5 != 0) { *flags |= SfMayBlock; } if (ARG6 != 0) { - PRE_MEM_READ( "kevent(timeout)", + PRE_MEM_READ( "freebsd11_kevent(timeout)", ARG6, sizeof(struct vki_timespec)); } } @@ -3803,8 +3803,8 @@ POST(sys_uuidgen) PRE(sys_freebsd11_getfsstat) { PRINT("sys_freebsd11_getfsstat ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %" FMT_REGWORD "u )",ARG1,ARG2,ARG3); - PRE_REG_READ3(int, "getfsstat", struct vki_freebsd11_statfs *, buf, long, bufsize, int, mode); - PRE_MEM_WRITE( "getfsstat(buf)", ARG1, ARG2 ); + PRE_REG_READ3(int, "freebsd11_getfsstat", struct vki_freebsd11_statfs *, buf, long, bufsize, int, mode); + PRE_MEM_WRITE( "freebsd11_getfsstat(buf)", ARG1, ARG2 ); } POST(sys_freebsd11_getfsstat) @@ -3819,10 +3819,10 @@ POST(sys_freebsd11_getfsstat) // int statfs(const char *path, struct statfs *buf); PRE(sys_freebsd11_statfs) { - PRINT("sys_statfs ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",ARG1,(char *)ARG1,ARG2); - PRE_REG_READ2(int, "statfs", const char *, path, struct statfs *, buf); - PRE_MEM_RASCIIZ( "statfs(path)", ARG1 ); - PRE_MEM_WRITE( "statfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) ); + PRINT("sys_freebsd11_statfs ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",ARG1,(char *)ARG1,ARG2); + PRE_REG_READ2(int, "freebsd11_statfs", const char *, path, struct statfs *, buf); + PRE_MEM_RASCIIZ( "freebsd11_statfs(path)", ARG1 ); + PRE_MEM_WRITE( "freebsd11_statfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) ); } POST(sys_freebsd11_statfs) @@ -3834,12 +3834,12 @@ POST(sys_freebsd11_statfs) // int fstatfs(int fd, struct statfs *buf); PRE(sys_freebsd11_fstatfs) { - PRINT("sys_fstatfs ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )",ARG1,ARG2); - PRE_REG_READ2(int, "fstatfs", + PRINT("sys_freebsd11_fstatfs ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )",ARG1,ARG2); + PRE_REG_READ2(int, "freebsd11_fstatfs", unsigned int, fd, struct statfs *, buf); if (!ML_(fd_allowed)(ARG1, "freebsd11_fstatfs", tid, False)) SET_STATUS_Failure(VKI_EBADF); - PRE_MEM_WRITE( "fstatfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) ); + PRE_MEM_WRITE( "freebsd11_fstatfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) ); } POST(sys_freebsd11_fstatfs) @@ -3851,11 +3851,11 @@ POST(sys_freebsd11_fstatfs) // int fhstatfs(const fhandle_t *fhp, struct statfs *buf); PRE(sys_freebsd11_fhstatfs) { - PRINT("sys_fhstatfs ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",ARG1,ARG2); - PRE_REG_READ2(int, "fhstatfs", + PRINT("sys_freebsd11_fhstatfs ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",ARG1,ARG2); + PRE_REG_READ2(int, "freebsd11_fhstatfs", struct fhandle *, fhp, struct statfs *, buf); - PRE_MEM_READ( "fhstatfs(fhp)", ARG1, sizeof(struct vki_fhandle) ); - PRE_MEM_WRITE( "fhstatfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) ); + PRE_MEM_READ( "freebsd11_fhstatfs(fhp)", ARG1, sizeof(struct vki_fhandle) ); + PRE_MEM_WRITE( "freebsd11_fhstatfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) ); } POST(sys_freebsd11_fhstatfs) @@ -4052,8 +4052,8 @@ POST(sys_swapcontext) PRE(sys_freebsd13_swapoff) { PRINT("sys_freebsd13_swapoff ( %#" FMT_REGWORD "x(%s) )", ARG1,(char *)ARG1); - PRE_REG_READ1(int, "swapoff", const char *, special); - PRE_MEM_RASCIIZ( "swapoff(special)", ARG1 ); + PRE_REG_READ1(int, "freebsd13_swapoff", const char *, special); + PRE_MEM_RASCIIZ( "freebsd13_swapoff(special)", ARG1 ); } // SYS___acl_get_link 425 @@ -7257,7 +7257,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { #if defined(VGP_arm64_freebsd) GENX_(__NR_freebsd10_pipe, sys_ni_syscall), // 42 #else - BSDXY(__NR_freebsd10_pipe, sys_pipe), // 42 + BSDXY(__NR_freebsd10_pipe, sys_freebsd10_pipe), // 42 #endif GENX_(__NR_getegid, sys_getegid), // 43 diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 166552caf..86ead33ff 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -1317,47 +1317,47 @@ Syscall param seteuid(uid) contains uninitialised byte(s) --------------------------------------------------------- 188: SYS_freebsd11_stat 2s 2m --------------------------------------------------------- -Syscall param stat(path) contains uninitialised byte(s) +Syscall param freebsd11_stat(path) contains uninitialised byte(s) ... -Syscall param stat(sb) contains uninitialised byte(s) +Syscall param freebsd11_stat(sb) contains uninitialised byte(s) ... -Syscall param stat(path) points to unaddressable byte(s) +Syscall param freebsd11_stat(path) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param stat(sb) points to unaddressable byte(s) +Syscall param freebsd11_stat(sb) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd --------------------------------------------------------- 189: SYS_freebsd11_fstat 2s 1m --------------------------------------------------------- -Syscall param fstat(fd) contains uninitialised byte(s) +Syscall param freebsd11_fstat(fd) contains uninitialised byte(s) ... -Syscall param fstat(sb) contains uninitialised byte(s) +Syscall param freebsd11_fstat(sb) contains uninitialised byte(s) ... -Syscall param fstat(sb) points to unaddressable byte(s) +Syscall param freebsd11_fstat(sb) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd --------------------------------------------------------- 190: SYS_freebsd11_lstat 2s 2m --------------------------------------------------------- -Syscall param lstat(path) contains uninitialised byte(s) +Syscall param freebsd11_lstat(path) contains uninitialised byte(s) ... -Syscall param lstat(sb) contains uninitialised byte(s) +Syscall param freebsd11_lstat(sb) contains uninitialised byte(s) ... -Syscall param lstat(path) points to unaddressable byte(s) +Syscall param freebsd11_lstat(path) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param lstat(sb) points to unaddressable byte(s) +Syscall param freebsd11_lstat(sb) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -1412,23 +1412,23 @@ Syscall param setrlimit(rlim) points to unaddressable byte(s) --------------------------------------------------------- 196:SYS_freebsd11_getdirentries 4s 2m --------------------------------------------------------- -Syscall param getdirentries(fd) contains uninitialised byte(s) +Syscall param freebsd11_getdirentries(fd) contains uninitialised byte(s) ... -Syscall param getdirentries(buf) contains uninitialised byte(s) +Syscall param freebsd11_getdirentries(buf) contains uninitialised byte(s) ... -Syscall param getdirentries(nbytes) contains uninitialised byte(s) +Syscall param freebsd11_getdirentries(nbytes) contains uninitialised byte(s) ... -Syscall param getdirentries(basep) contains uninitialised byte(s) +Syscall param freebsd11_getdirentries(basep) contains uninitialised byte(s) ... -Syscall param getdirentries(buf) points to unaddressable byte(s) +Syscall param freebsd11_getdirentries(buf) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param getdirentries(basep) points to unaddressable byte(s) +Syscall param freebsd11_getdirentries(basep) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -1593,7 +1593,7 @@ Syscall param semctl(cmd) contains uninitialised byte(s) Syscall param semctl(arg) contains uninitialised byte(s) ... -Syscall param sys_freebsd7___semctl(arg) points to unaddressable byte(s) +Syscall param freebsd7___semctl(arg) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -1636,32 +1636,32 @@ Syscall param semop(nops) contains uninitialised byte(s) --------------------------------------------------------- 224: SYS_freebsd7_msgctl (set) 3s 1m --------------------------------------------------------- -Syscall param msgctl(msqid) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s) ... -Syscall param msgctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s) ... -Syscall param msgctl(buf) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s) ... -Syscall param msgctl(IPC_SET, buf) points to unaddressable byte(s) +Syscall param freebsd7_msgctl(IPC_SET, buf) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd --------------------------------------------------------- 224: SYS_freebsd7_msgctl (stat) 3s 1m --------------------------------------------------------- -Syscall param msgctl(msqid) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s) ... -Syscall param msgctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s) ... -Syscall param msgctl(buf) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s) ... -Syscall param msgctl(IPC_STAT, buf) points to unaddressable byte(s) +Syscall param freebsd7_msgctl(IPC_STAT, buf) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -1734,25 +1734,25 @@ Syscall param shmat(flag) contains uninitialised byte(s) --------------------------------------------------------- 229: SYS_freebsd7_shmctl 3s 0m --------------------------------------------------------- -Syscall param shmctl(shmid) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s) ... -Syscall param shmctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s) ... -Syscall param shmctl(buf) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s) ... --------------------------------------------------------- 229: SYS_freebsd7_shmctl (bogus cmd) 3s 0m --------------------------------------------------------- -Syscall param shmctl(shmid) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s) ... -Syscall param shmctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s) ... -Syscall param shmctl(buf) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s) ... --------------------------------------------------------- @@ -2837,33 +2837,33 @@ Syscall param getresgid(sgid) points to unaddressable byte(s) --------------------------------------------------------- 363: SYS_freebsd11_kevent 6s 3m --------------------------------------------------------- -Syscall param kevent(fd) contains uninitialised byte(s) +Syscall param freebsd11_kevent(fd) contains uninitialised byte(s) ... -Syscall param kevent(changelist) contains uninitialised byte(s) +Syscall param freebsd11_kevent(changelist) contains uninitialised byte(s) ... -Syscall param kevent(nchanges) contains uninitialised byte(s) +Syscall param freebsd11_kevent(nchanges) contains uninitialised byte(s) ... -Syscall param kevent(eventlist) contains uninitialised byte(s) +Syscall param freebsd11_kevent(eventlist) contains uninitialised byte(s) ... -Syscall param kevent(nevents) contains uninitialised byte(s) +Syscall param freebsd11_kevent(nevents) contains uninitialised byte(s) ... -Syscall param kevent(timeout) contains uninitialised byte(s) +Syscall param freebsd11_kevent(timeout) contains uninitialised byte(s) ... -Syscall param kevent(changelist) points to unaddressable byte(s) +Syscall param freebsd11_kevent(changelist) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param kevent(eventlist) points to unaddressable byte(s) +Syscall param freebsd11_kevent(eventlist) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param kevent(timeout) points to unaddressable byte(s) +Syscall param freebsd11_kevent(timeout) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -3070,16 +3070,16 @@ Syscall param sendfile(sbytes) points to unaddressable byte(s) --------------------------------------------------------- 395: SYS_freebsd11_getfsstat 3s 1m --------------------------------------------------------- -Syscall param getfsstat(buf) contains uninitialised byte(s) +Syscall param freebsd11_getfsstat(buf) contains uninitialised byte(s) ... -Syscall param getfsstat(bufsize) contains uninitialised byte(s) +Syscall param freebsd11_getfsstat(bufsize) contains uninitialised byte(s) ... -Syscall param getfsstat(mode) contains uninitialised byte(s) +Syscall param freebsd11_getfsstat(mode) contains uninitialised byte(s) ... -Syscall param getfsstat(buf) points to unaddressable byte(s) +Syscall param freebsd11_getfsstat(buf) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -3284,10 +3284,10 @@ Syscall param swapcontext(oucp) points to unaddressable byte(s) --------------------------------------------------------- 424: SYS_swapoff 1s 1m --------------------------------------------------------- -Syscall param swapoff(special) contains uninitialised byte(s) +Syscall param freebsd13_swapoff(special) contains uninitialised byte(s) ... -Syscall param swapoff(special) points to unaddressable byte(s) +Syscall param freebsd13_swapoff(special) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 52c7ce8c3..6d53f9387 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -1317,47 +1317,47 @@ Syscall param seteuid(uid) contains uninitialised byte(s) --------------------------------------------------------- 188: SYS_freebsd11_stat 2s 2m --------------------------------------------------------- -Syscall param stat(path) contains uninitialised byte(s) +Syscall param freebsd11_stat(path) contains uninitialised byte(s) ... -Syscall param stat(sb) contains uninitialised byte(s) +Syscall param freebsd11_stat(sb) contains uninitialised byte(s) ... -Syscall param stat(path) points to unaddressable byte(s) +Syscall param freebsd11_stat(path) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param stat(sb) points to unaddressable byte(s) +Syscall param freebsd11_stat(sb) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd --------------------------------------------------------- 189: SYS_freebsd11_fstat 2s 1m --------------------------------------------------------- -Syscall param fstat(fd) contains uninitialised byte(s) +Syscall param freebsd11_fstat(fd) contains uninitialised byte(s) ... -Syscall param fstat(sb) contains uninitialised byte(s) +Syscall param freebsd11_fstat(sb) contains uninitialised byte(s) ... -Syscall param fstat(sb) points to unaddressable byte(s) +Syscall param freebsd11_fstat(sb) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd --------------------------------------------------------- 190: SYS_freebsd11_lstat 2s 2m --------------------------------------------------------- -Syscall param lstat(path) contains uninitialised byte(s) +Syscall param freebsd11_lstat(path) contains uninitialised byte(s) ... -Syscall param lstat(sb) contains uninitialised byte(s) +Syscall param freebsd11_lstat(sb) contains uninitialised byte(s) ... -Syscall param lstat(path) points to unaddressable byte(s) +Syscall param freebsd11_lstat(path) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param lstat(sb) points to unaddressable byte(s) +Syscall param freebsd11_lstat(sb) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -1412,23 +1412,23 @@ Syscall param setrlimit(rlim) points to unaddressable byte(s) --------------------------------------------------------- 196:SYS_freebsd11_getdirentries 4s 2m --------------------------------------------------------- -Syscall param getdirentries(fd) contains uninitialised byte(s) +Syscall param freebsd11_getdirentries(fd) contains uninitialised byte(s) ... -Syscall param getdirentries(buf) contains uninitialised byte(s) +Syscall param freebsd11_getdirentries(buf) contains uninitialised byte(s) ... -Syscall param getdirentries(nbytes) contains uninitialised byte(s) +Syscall param freebsd11_getdirentries(nbytes) contains uninitialised byte(s) ... -Syscall param getdirentries(basep) contains uninitialised byte(s) +Syscall param freebsd11_getdirentries(basep) contains uninitialised byte(s) ... -Syscall param getdirentries(buf) points to unaddressable byte(s) +Syscall param freebsd11_getdirentries(buf) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param getdirentries(basep) points to unaddressable byte(s) +Syscall param freebsd11_getdirentries(basep) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -1593,7 +1593,7 @@ Syscall param semctl(cmd) contains uninitialised byte(s) Syscall param semctl(arg) contains uninitialised byte(s) ... -Syscall param sys_freebsd7___semctl(arg) points to unaddressable byte(s) +Syscall param freebsd7___semctl(arg) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -1636,32 +1636,32 @@ Syscall param semop(nops) contains uninitialised byte(s) --------------------------------------------------------- 224: SYS_freebsd7_msgctl (set) 3s 1m --------------------------------------------------------- -Syscall param msgctl(msqid) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s) ... -Syscall param msgctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s) ... -Syscall param msgctl(buf) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s) ... -Syscall param msgctl(IPC_SET, buf) points to unaddressable byte(s) +Syscall param freebsd7_msgctl(IPC_SET, buf) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd --------------------------------------------------------- 224: SYS_freebsd7_msgctl (stat) 3s 1m --------------------------------------------------------- -Syscall param msgctl(msqid) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s) ... -Syscall param msgctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s) ... -Syscall param msgctl(buf) contains uninitialised byte(s) +Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s) ... -Syscall param msgctl(IPC_STAT, buf) points to unaddressable byte(s) +Syscall param freebsd7_msgctl(IPC_STAT, buf) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -1734,25 +1734,25 @@ Syscall param shmat(flag) contains uninitialised byte(s) --------------------------------------------------------- 229: SYS_freebsd7_shmctl 3s 0m --------------------------------------------------------- -Syscall param shmctl(shmid) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s) ... -Syscall param shmctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s) ... -Syscall param shmctl(buf) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s) ... --------------------------------------------------------- 229: SYS_freebsd7_shmctl (bogus cmd) 3s 0m --------------------------------------------------------- -Syscall param shmctl(shmid) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s) ... -Syscall param shmctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s) ... -Syscall param shmctl(buf) contains uninitialised byte(s) +Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s) ... --------------------------------------------------------- @@ -2843,33 +2843,33 @@ Syscall param getresgid(sgid) points to unaddressable byte(s) --------------------------------------------------------- 363: SYS_freebsd11_kevent 6s 3m --------------------------------------------------------- -Syscall param kevent(fd) contains uninitialised byte(s) +Syscall param freebsd11_kevent(fd) contains uninitialised byte(s) ... -Syscall param kevent(changelist) contains uninitialised byte(s) +Syscall param freebsd11_kevent(changelist) contains uninitialised byte(s) ... -Syscall param kevent(nchanges) contains uninitialised byte(s) +Syscall param freebsd11_kevent(nchanges) contains uninitialised byte(s) ... -Syscall param kevent(eventlist) contains uninitialised byte(s) +Syscall param freebsd11_kevent(eventlist) contains uninitialised byte(s) ... -Syscall param kevent(nevents) contains uninitialised byte(s) +Syscall param freebsd11_kevent(nevents) contains uninitialised byte(s) ... -Syscall param kevent(timeout) contains uninitialised byte(s) +Syscall param freebsd11_kevent(timeout) contains uninitialised byte(s) ... -Syscall param kevent(changelist) points to unaddressable byte(s) +Syscall param freebsd11_kevent(changelist) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param kevent(eventlist) points to unaddressable byte(s) +Syscall param freebsd11_kevent(eventlist) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param kevent(timeout) points to unaddressable byte(s) +Syscall param freebsd11_kevent(timeout) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -3079,16 +3079,16 @@ Syscall param sendfile(sbytes) points to unaddressable byte(s) --------------------------------------------------------- 395: SYS_freebsd11_getfsstat 3s 1m --------------------------------------------------------- -Syscall param getfsstat(buf) contains uninitialised byte(s) +Syscall param freebsd11_getfsstat(buf) contains uninitialised byte(s) ... -Syscall param getfsstat(bufsize) contains uninitialised byte(s) +Syscall param freebsd11_getfsstat(bufsize) contains uninitialised byte(s) ... -Syscall param getfsstat(mode) contains uninitialised byte(s) +Syscall param freebsd11_getfsstat(mode) contains uninitialised byte(s) ... -Syscall param getfsstat(buf) points to unaddressable byte(s) +Syscall param freebsd11_getfsstat(buf) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -3293,10 +3293,10 @@ Syscall param swapcontext(oucp) points to unaddressable byte(s) --------------------------------------------------------- 424: SYS_swapoff 1s 1m --------------------------------------------------------- -Syscall param swapoff(special) contains uninitialised byte(s) +Syscall param freebsd13_swapoff(special) contains uninitialised byte(s) ... -Syscall param swapoff(special) points to unaddressable byte(s) +Syscall param freebsd13_swapoff(special) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd From b06af3d21fe9630a77fd2f9fc2c0e712f5cb78eb Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 5 Sep 2025 08:11:15 +0200 Subject: [PATCH 249/412] Solaris syscall: add ML_(fd_allowed) check for fstat --- coregrind/m_syswrap/syswrap-solaris.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c index a4f243f8a..519d92d39 100644 --- a/coregrind/m_syswrap/syswrap-solaris.c +++ b/coregrind/m_syswrap/syswrap-solaris.c @@ -2344,6 +2344,8 @@ PRE(sys_fstat) PRINT("sys_fstat ( %ld, %#lx )", SARG1, ARG2); PRE_REG_READ2(long, "fstat", int, fildes, struct stat *, buf); PRE_MEM_WRITE("fstat(buf)", ARG2, sizeof(struct vki_stat)); + if (!ML_(fd_allowed)(ARG1, "fstat", tid, False)) + SET_STATUS_Failure(VKI_EBADF); } POST(sys_fstat) From afd1f088e8a3c8258399a30d73d572b60676cbc5 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 5 Sep 2025 08:21:32 +0200 Subject: [PATCH 250/412] FreeBSD syscall: add ML_(fd_allowed) check for fstat Also PRE(sys_cap_rights_get) was checking the wrong arg with ML_(fd_allowed). ARG1 is a version number in the syscall, ARG2 is the fd. --- coregrind/m_syswrap/syswrap-freebsd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 0c68acdc8..594298420 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -5691,7 +5691,7 @@ PRE(sys_cap_rights_get) { PRINT("sys_cap_rights_get ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, SARG2, ARG3); PRE_REG_READ3(long, "cap_rights_get", int, version, int, fd, vki_cap_rights_t*, rights); - if (!ML_(fd_allowed)(ARG1, "cap_rights_get", tid, False)) + if (!ML_(fd_allowed)(ARG2, "cap_rights_get", tid, False)) SET_STATUS_Failure(VKI_EBADF); PRE_MEM_WRITE("cap_rights_get(rights)", ARG3, sizeof(vki_cap_rights_t)); } @@ -6301,6 +6301,8 @@ PRE(sys_fstat) PRINT("sys_fstat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",SARG1,ARG2); PRE_REG_READ2(int, "fstat", int, fd, struct stat *, sb); PRE_MEM_WRITE( "fstat(sb)", ARG2, sizeof(struct vki_stat) ); + if ( !ML_(fd_allowed)(ARG1, "fstat", tid, False) ) + SET_STATUS_Failure( VKI_EBADF ); } POST(sys_fstat) From 8ec7405afb8fe610c46582e74d7572e5a6f4cd6c Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 5 Sep 2025 09:04:16 +0200 Subject: [PATCH 251/412] Bug 509107 - memcheck/tests/duplicate_align_size_errors.cpp fails --- NEWS | 1 + memcheck/tests/Makefile.am | 1 + ...cate_align_size_errors.stderr.exp-memalign | 26 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 memcheck/tests/duplicate_align_size_errors.stderr.exp-memalign diff --git a/NEWS b/NEWS index 5131a1b2e..7d087dfb6 100644 --- a/NEWS +++ b/NEWS @@ -95,6 +95,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508869 x86-linux: simplify scalar test output 508958 FreeBSD: add getgroups and setgroups wrappers 509103 Fix tests/arm64/bug484935.c build with "-O2 -flto -ffat-lto-objects" +509107 memcheck/tests/duplicate_align_size_errors.cpp fails To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index fb3f9ddae..1a41734bd 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -163,6 +163,7 @@ EXTRA_DIST = \ cxx17_aligned_new.stderr.exp_32 \ cxx17_aligned_new.stdout.exp \ duplicate_align_size_errors.stderr.exp \ + duplicate_align_size_errors.stderr.exp-memalign \ duplicate_align_size_errors.vgtest \ sized_aligned_new_delete_args.stderr.exp \ sized_aligned_new_delete_args.vgtest \ diff --git a/memcheck/tests/duplicate_align_size_errors.stderr.exp-memalign b/memcheck/tests/duplicate_align_size_errors.stderr.exp-memalign new file mode 100644 index 000000000..250b05070 --- /dev/null +++ b/memcheck/tests/duplicate_align_size_errors.stderr.exp-memalign @@ -0,0 +1,26 @@ +Invalid alignment value: 0 (should be non-zero and a power of 2) + at 0x........: operator new(unsigned long, std::align_val_t, std::nothrow_t const&) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:19) + +Invalid alignment value: 0 (should be non-zero and a power of 2) + at 0x........: operator delete(void*, std::align_val_t, std::nothrow_t const&) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:20) + +memalign() invalid size value: 0 + at 0x........: memalign (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:33) + +Mismatched new/delete size value: 33 + at 0x........: operator delete(void*, unsigned long, std::align_val_t) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:43) + Address 0x........ is 0 bytes inside a block of size 32 alloc'd + at 0x........: operator new(unsigned long, std::align_val_t) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:42) + +Mismatched new[]/delete[] alignment alloc value: 64 dealloc value: 128 + at 0x........: operator delete[](void*, unsigned long, std::align_val_t) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:48) + Address 0x........ is 0 bytes inside a block of size 32 alloc'd + at 0x........: operator new[](unsigned long, std::align_val_t) (vg_replace_malloc.c:...) + by 0x........: main (duplicate_align_size_errors.cpp:47) + From eda53a2d243a904ac9f44c34d68699a4ec4800b8 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 5 Sep 2025 09:15:36 +0200 Subject: [PATCH 252/412] FreeBSD regtest: update fake freebsd7 output for amrm64 First attempt --- memcheck/tests/freebsd/scalar.c | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index eeacaaf04..177d1dac3 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -832,16 +832,16 @@ int main(void) #endif #else FAKE_GO("220: SYS_freebsd7___semctl (IPC_STAT) 4s 1m"); - FAKE_SY("Syscall param semctl(semid) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_semctl(semid) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param semctl(semnum) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_semctl(semnum) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param semctl(cmd) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_semctl(cmd) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param semctl(arg) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_semctl(arg) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); FAKE_SY("Syscall param sys_freebsd7___semctl(arg) points to unaddressable byte(s)\n"); @@ -849,10 +849,10 @@ int main(void) FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); FAKE_SY("\n"); FAKE_GO("220: SYS_freebsd7___semctl (bogus cmd) 3s 0m"); - FAKE_SY("Syscall param semctl(semid) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_semctl(semid) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param semctl(semnum) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_semctl(semnum) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); FAKE_SY("Syscall param semctl(cmd) contains uninitialised byte(s)\n"); @@ -881,31 +881,31 @@ int main(void) #endif #else FAKE_GO("224: SYS_freebsd7_msgctl (set) 3s 1m"); - FAKE_SY("Syscall param msgctl(msqid) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param msgctl(cmd) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param msgctl(buf) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param msgctl(IPC_SET, buf) points to unaddressable byte(s)\n"); + FAKE_SY("Syscall param freebsd7_msgctl(IPC_SET, buf) points to unaddressable byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); FAKE_SY("\n"); FAKE_GO("224: SYS_freebsd7_msgctl (stat) 3s 1m"); - FAKE_SY("Syscall param msgctl(msqid) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param msgctl(cmd) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param msgctl(buf) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param msgctl(IPC_STAT, buf) points to unaddressable byte(s)\n"); + FAKE_SY("Syscall param freebsd7_msgctl(IPC_STAT, buf) points to unaddressable byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); FAKE_SY("\n"); @@ -938,24 +938,24 @@ int main(void) #endif #else FAKE_GO("229: SYS_freebsd7_shmctl 3s 0m"); - FAKE_SY("Syscall param shmctl(shmid) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param shmctl(cmd) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param shmctl(buf) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); FAKE_GO("229: SYS_freebsd7_shmctl (bogus cmd) 3s 0m"); - FAKE_SY("Syscall param shmctl(shmid) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param shmctl(cmd) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param shmctl(buf) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); From 874ac37ebf4119263d041a05527daf60d72f8450 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 5 Sep 2025 09:15:36 +0200 Subject: [PATCH 253/412] FreeBSD regtest and syscall message --- coregrind/m_syswrap/syswrap-freebsd.c | 4 ++-- memcheck/tests/freebsd/scalar.c | 10 +++++----- memcheck/tests/freebsd/scalar.stderr.exp | 14 +++++++------- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 14 +++++++------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 594298420..ef4712391 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -2169,7 +2169,7 @@ PRE(sys_freebsd7___semctl) case VKI_GETALL: case VKI_SETALL: PRINT("sys_freebsd7___semctl ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )",ARG1,ARG2,ARG3,ARG4); - PRE_REG_READ4(int, "semctl", + PRE_REG_READ4(int, "freebsd7___semctl", int, semid, int, semnum, int, cmd, union vki_semun *, arg); PRE_MEM_READ("freebsd7___semctl(arg)", ARG4, sizeof(union vki_semun)); semun = (union vki_semun*)ARG4; @@ -2180,7 +2180,7 @@ PRE(sys_freebsd7___semctl) break; default: PRINT("sys_freebsd7___semctl ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" FMT_REGWORD "u )",ARG1,ARG2,ARG3); - PRE_REG_READ3(long, "semctl", + PRE_REG_READ3(long, "freebsd7___semctl", int, semid, int, semnum, int, cmd); break; } diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index 177d1dac3..62b192374 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -835,16 +835,16 @@ int main(void) FAKE_SY("Syscall param freebsd7_semctl(semid) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param freebsd7_semctl(semnum) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param freebsd7_semctl(cmd) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); FAKE_SY("Syscall param freebsd7_semctl(arg) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param sys_freebsd7___semctl(arg) points to unaddressable byte(s)\n"); + FAKE_SY("Syscall param freebsd7___semctl(arg) points to unaddressable byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); FAKE_SY("\n"); @@ -852,10 +852,10 @@ int main(void) FAKE_SY("Syscall param freebsd7_semctl(semid) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param freebsd7_semctl(semnum) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param semctl(cmd) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); #endif diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 86ead33ff..857ffceee 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -1581,16 +1581,16 @@ Syscall param poll(ufds.events) points to uninitialised byte(s) --------------------------------------------------------- 220: SYS_freebsd7___semctl (IPC_STAT) 4s 1m --------------------------------------------------------- -Syscall param semctl(semid) contains uninitialised byte(s) +Syscall param freebsd7___semctl(semid) contains uninitialised byte(s) ... -Syscall param semctl(semnum) contains uninitialised byte(s) +Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s) ... -Syscall param semctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s) ... -Syscall param semctl(arg) contains uninitialised byte(s) +Syscall param freebsd7___semctl(arg) contains uninitialised byte(s) ... Syscall param freebsd7___semctl(arg) points to unaddressable byte(s) @@ -1600,13 +1600,13 @@ Syscall param freebsd7___semctl(arg) points to unaddressable byte(s) --------------------------------------------------------- 220: SYS_freebsd7___semctl (bogus cmd) 3s 0m --------------------------------------------------------- -Syscall param semctl(semid) contains uninitialised byte(s) +Syscall param freebsd7___semctl(semid) contains uninitialised byte(s) ... -Syscall param semctl(semnum) contains uninitialised byte(s) +Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s) ... -Syscall param semctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s) ... --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 6d53f9387..9b650198b 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -1581,16 +1581,16 @@ Syscall param poll(ufds.events) points to uninitialised byte(s) --------------------------------------------------------- 220: SYS_freebsd7___semctl (IPC_STAT) 4s 1m --------------------------------------------------------- -Syscall param semctl(semid) contains uninitialised byte(s) +Syscall param freebsd7___semctl(semid) contains uninitialised byte(s) ... -Syscall param semctl(semnum) contains uninitialised byte(s) +Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s) ... -Syscall param semctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s) ... -Syscall param semctl(arg) contains uninitialised byte(s) +Syscall param freebsd7___semctl(arg) contains uninitialised byte(s) ... Syscall param freebsd7___semctl(arg) points to unaddressable byte(s) @@ -1600,13 +1600,13 @@ Syscall param freebsd7___semctl(arg) points to unaddressable byte(s) --------------------------------------------------------- 220: SYS_freebsd7___semctl (bogus cmd) 3s 0m --------------------------------------------------------- -Syscall param semctl(semid) contains uninitialised byte(s) +Syscall param freebsd7___semctl(semid) contains uninitialised byte(s) ... -Syscall param semctl(semnum) contains uninitialised byte(s) +Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s) ... -Syscall param semctl(cmd) contains uninitialised byte(s) +Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s) ... --------------------------------------------------------- From 63f69be1415b5a2968b67f4ce9cebb3deeb01f5d Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 5 Sep 2025 12:57:44 +0200 Subject: [PATCH 254/412] FreeBSD regtest: arm64 scalar Right number of underscores in freebsd7 compat syscall fakes --- memcheck/tests/freebsd/scalar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index 62b192374..b4200f0ae 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -832,7 +832,7 @@ int main(void) #endif #else FAKE_GO("220: SYS_freebsd7___semctl (IPC_STAT) 4s 1m"); - FAKE_SY("Syscall param freebsd7_semctl(semid) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7___semctl(semid) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); FAKE_SY("Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s)\n"); @@ -841,7 +841,7 @@ int main(void) FAKE_SY("Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param freebsd7_semctl(arg) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7___semctl(arg) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); FAKE_SY("Syscall param freebsd7___semctl(arg) points to unaddressable byte(s)\n"); @@ -849,7 +849,7 @@ int main(void) FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); FAKE_SY("\n"); FAKE_GO("220: SYS_freebsd7___semctl (bogus cmd) 3s 0m"); - FAKE_SY("Syscall param freebsd7_semctl(semid) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param freebsd7___semctl(semid) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); FAKE_SY("Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s)\n"); From 56f778b6dd438c139323d3734f914e2a7010be1c Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 6 Sep 2025 09:16:17 +0200 Subject: [PATCH 255/412] posix_memalign wrapper - remove newline from malloc trace --- coregrind/m_replacemalloc/vg_replace_malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 02134d672..9e0591abf 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -2188,7 +2188,7 @@ extern int * __error(void) __attribute__((weak)); DO_INIT; \ TRIGGER_MEMCHECK_ERROR_IF_UNDEFINED(size); \ VERIFY_ALIGNMENT(&aligned_alloc_info); \ - MALLOC_TRACE("posix_memalign(al %llu, size %llu)\n", \ + MALLOC_TRACE("posix_memalign(al %llu, size %llu)", \ (ULong)alignment, (ULong)size ); \ /* Test whether the alignment argument is valid. It must be \ a power of two multiple of sizeof (void *). */ \ From 3c7a8f435f7a1f5cc64c23c5f03348e0ce29a98e Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 6 Sep 2025 13:52:47 +0200 Subject: [PATCH 256/412] FreeBSD memalign wrapper: size of 0 now allowed memalign, the random allocator function amongst allocators --- coregrind/m_replacemalloc/vg_replace_malloc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 9e0591abf..96edc5bfe 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -1840,7 +1840,10 @@ extern int * __error(void) __attribute__((weak)); * * FreeBSD, undocumented, just calls aligned_alloc * with size rounded up to a multiple - * of aligment + * of aligment (unless the alignment is 0 in which case + * it just calls malloc [prior to Feb 2023 this wasn't + * handled correctly resulting in a division-by-zero crash + * in the size roundup code]) * * jemalloc mininum alignment is 1, must be a power of 2 * it looks like excessively large alignment causes ENOMEM @@ -1924,7 +1927,7 @@ extern int * __error(void) __attribute__((weak)); #define VG_MEMALIGN_NO_ALIGN_ZERO 0 #endif -#if defined(MUSL_LIBC) +#if defined(MUSL_LIBC) || defined(VGO_freebsd) #define VG_MEMALIGN_NO_SIZE_ZERO 0 #else #define VG_MEMALIGN_NO_SIZE_ZERO 1 From 68f06cbe97ba4d36ab94ad5f3a199d91c2298e5c Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 6 Sep 2025 16:49:10 +0200 Subject: [PATCH 257/412] Solaris 11: fix for VG_(lstat) This function was using SYS_lstat. It works OK with illumos but not Solaris 11+ which has removed that syscall. Instead do like Linux and FreeBSD, use SYS_fstatat with the flag for no follow link. --- coregrind/m_libcfile.c | 13 ++++++++++++- include/vki/vki-solaris.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 6addb8761..ea8a56b9c 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -700,9 +700,20 @@ struct vki_stat buf; res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW); #endif +#elif defined(VGO_solaris) + + struct vki_stat buf; +#if defined(SOLARIS_OLD_SYSCALLS) + // illumos + res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf); +#else + // Solaris 11+ + res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW); +#endif + #else - /* check this on illumos and Darwin */ + /* check this on Darwin */ struct vki_stat buf; res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf); diff --git a/include/vki/vki-solaris.h b/include/vki/vki-solaris.h index 9c96ed19e..18d976700 100644 --- a/include/vki/vki-solaris.h +++ b/include/vki/vki-solaris.h @@ -100,6 +100,7 @@ typedef uint32_t vki_u32; #include #define VKI_SEEK_SET SEEK_SET +#define VKI_AT_SYMLINK_NOFOLLOW AT_SYMLINK_NOFOLLOW #include From 7a5f3be6915cd28665346b21b07d02b3f1508bdb Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 6 Sep 2025 20:56:25 +0200 Subject: [PATCH 258/412] aligned_alloc wrapper: handle size and aligned values of 0 --- coregrind/m_replacemalloc/vg_replace_malloc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 96edc5bfe..1df4419ca 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -2299,7 +2299,13 @@ extern int * __error(void) __attribute__((weak)); #define VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR 0 #endif -#if defined(MUSL_LIBC) +#if defined(VGO_freebsd) || defined(VGO_solaris) +#define VG_ALIGNED_ALLOC_NO_ALIGN_ZERO 1 +#else +#define VG_ALIGNED_ALLOC_NO_ALIGN_ZERO 0 +#endif + +#if defined(VGO_freebsd) || defined(MUSL_LIBC) #define VG_ALIGNED_ALLOC_NO_SIZE_ZERO 0 #else #define VG_ALIGNED_ALLOC_NO_SIZE_ZERO 1 @@ -2364,8 +2370,9 @@ extern int * __error(void) __attribute__((weak)); VERIFY_ALIGNMENT(&aligned_alloc_info); \ MALLOC_TRACE("aligned_alloc(al %llu, size %llu)", \ (ULong)alignment, (ULong)size ); \ - if ((VG_ALIGNED_ALLOC_NO_SIZE_ZERO && (alignment == 0)) \ - || (VG_ALIGNED_ALLOC_SIZE_MULTIPLE_ALIGN && (size % alignment != 0)) \ + if ((VG_ALIGNED_ALLOC_NO_SIZE_ZERO && (size == 0)) \ + || (VG_ALIGNED_ALLOC_NO_ALIGN_ZERO && (alignment == 0)) \ + || (VG_ALIGNED_ALLOC_SIZE_MULTIPLE_ALIGN && alignment && (size % alignment != 0)) \ || (VG_ALIGNED_ALLOC_ALIGN_POWER_TWO && (alignment & (alignment - 1)) != 0) \ || (VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR && (alignment % 4 != 0))) { \ SET_ERRNO_EINVAL; \ From b68bf7603565676f8e7ee2f18f8dc6f84eef1dc7 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 7 Sep 2025 09:50:33 +0200 Subject: [PATCH 259/412] aligned_alloc wrapper: musl seems to be the only one to accept an alignment of zero --- coregrind/m_replacemalloc/vg_replace_malloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 1df4419ca..d88f55f8b 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -2299,16 +2299,16 @@ extern int * __error(void) __attribute__((weak)); #define VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR 0 #endif -#if defined(VGO_freebsd) || defined(VGO_solaris) -#define VG_ALIGNED_ALLOC_NO_ALIGN_ZERO 1 +#if defined(VGO_solaris) +#define VG_ALIGNED_ALLOC_NO_SIZE_ZERO 1 #else -#define VG_ALIGNED_ALLOC_NO_ALIGN_ZERO 0 +#define VG_ALIGNED_ALLOC_NO_SIZE_ZERO 0 #endif -#if defined(VGO_freebsd) || defined(MUSL_LIBC) -#define VG_ALIGNED_ALLOC_NO_SIZE_ZERO 0 +#if defined(MUSL_LIBC) +#define VG_ALIGNED_ALLOC_NO_ALIGN_ZERO 0 #else -#define VG_ALIGNED_ALLOC_NO_SIZE_ZERO 1 +#define VG_ALIGNED_ALLOC_NO_ALIGN_ZERO 1 #endif #if defined (VGO_linux) && !defined(MUSL_LIBC) && !defined(HAVE_GNU_LIBC_C17_ALIGNED_ALLOC) From 66f0174466cd0d97d1b123ac8152797fb34aeb8c Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 7 Sep 2025 22:01:34 +0200 Subject: [PATCH 260/412] Bug 509139 - Update BadSize error messages --- NEWS | 1 + coregrind/m_replacemalloc/vg_replace_malloc.c | 2 + memcheck/mc_errors.c | 45 +++++++------------ memcheck/mc_include.h | 2 +- memcheck/mc_main.c | 11 ++--- .../tests/duplicate_align_size_errors.cpp | 2 +- .../duplicate_align_size_errors.stderr.exp | 2 +- ...cate_align_size_errors.stderr.exp-memalign | 2 +- .../tests/freebsd/aligned_allocs_supp.supp | 2 +- .../freebsd/errno_aligned_allocs.stderr.exp | 2 +- memcheck/tests/linux/memalign.stderr.exp | 2 +- memcheck/tests/linux/memalign.stderr.exp-musl | 2 +- memcheck/tests/posix_memalign.stderr.exp | 2 +- memcheck/tests/posix_memalign_supp.supp | 6 +-- memcheck/tests/posix_memalign_xml.stderr.exp | 2 +- memcheck/tests/solaris/memalign.stderr.exp | 2 +- 16 files changed, 38 insertions(+), 49 deletions(-) diff --git a/NEWS b/NEWS index 7d087dfb6..85b7a17b1 100644 --- a/NEWS +++ b/NEWS @@ -96,6 +96,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508958 FreeBSD: add getgroups and setgroups wrappers 509103 Fix tests/arm64/bug484935.c build with "-O2 -flto -ffat-lto-objects" 509107 memcheck/tests/duplicate_align_size_errors.cpp fails +509139 Update BadSize error messages To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index d88f55f8b..0438fbdf0 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -1073,6 +1073,8 @@ extern int * __error(void) __attribute__((weak)); #if defined(VGO_linux) + FREE_ALIGNED_SIZED(VG_Z_LIBC_SONAME, free_aligned_sized, free, FreeAlignedSized ); + FREE_ALIGNED_SIZED(SO_SYN_MALLOC, free_aligned_sized, free, FreeAlignedSized ); #elif defined(VGO_freebsd) FREE_ALIGNED_SIZED(VG_Z_LIBC_SONAME, free_aligned_sized, free, FreeAlignedSized ); diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c index a708b3f85..657a11285 100644 --- a/memcheck/mc_errors.c +++ b/memcheck/mc_errors.c @@ -77,7 +77,7 @@ typedef Err_FishyValue, Err_ReallocSizeZero, Err_BadAlign, - Err_BadSize, + Err_UnsafeZeroSize, Err_SizeMismatch, Err_AlignMismatch, } @@ -177,9 +177,7 @@ struct _MC_Error { struct { AddrInfo ai; - SizeT size; - const HChar *func; - } BadSize; + } UnsafeZeroSize; // Call to strcpy, memcpy, etc, with overlapping blocks. struct { @@ -799,15 +797,13 @@ void MC_(pp_Error) ( const Error* err ) } break; - case Err_BadSize: + case Err_UnsafeZeroSize: if (xml) { emit( " InvalidSize\n" ); - emit( " %s invalid size value: %lu\n", - extra->Err.BadSize.func, extra->Err.BadSize.size ); + emit( " Unsafe allocation with size of zero is implementation-defined\n"); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); } else { - emit( "%s invalid size value: %lu\n", - extra->Err.BadSize.func, extra->Err.BadSize.size ); + emit( "Unsafe allocation with size of zero is implementation-defined\n"); VG_(pp_ExeContext)( VG_(get_error_where)(err) ); } break; @@ -1028,13 +1024,10 @@ void MC_(record_bad_alignment) ( ThreadId tid, SizeT align, SizeT size, const HC VG_(maybe_record_error)( tid, Err_BadAlign, /*addr*/0, /*s*/NULL, &extra ); } -void MC_(record_bad_size) ( ThreadId tid, SizeT size, const HChar *function ) +void MC_(record_unsafe_zero_size) ( ThreadId tid ) { - MC_Error extra; tl_assert(VG_INVALID_THREADID != tid); - extra.Err.BadSize.size= size; - extra.Err.BadSize.func = function; - VG_(maybe_record_error)( tid, Err_BadSize, /*addr*/0, /*s*/NULL, &extra ); + VG_(maybe_record_error)( tid, Err_UnsafeZeroSize, /*addr*/0, /*s*/NULL, /*extra*/NULL ); } void MC_(record_illegal_mempool_error) ( ThreadId tid, Addr a ) @@ -1222,6 +1215,7 @@ Bool MC_(eq_Error) ( VgRes res, const Error* e1, const Error* e2 ) case Err_Overlap: case Err_Cond: case Err_ReallocSizeZero: + case Err_UnsafeZeroSize: return True; case Err_FishyValue: @@ -1253,11 +1247,6 @@ Bool MC_(eq_Error) ( VgRes res, const Error* e1, const Error* e2 ) extra2->Err.BadAlign.dealloc_align; } - case Err_BadSize: - // sized delete mismatch - return extra1->Err.BadSize.size == - extra2->Err.BadSize.size; - case Err_SizeMismatch: return extra1->Err.SizeMismatch.size == extra2->Err.SizeMismatch.size; @@ -1418,7 +1407,7 @@ UInt MC_(update_Error_extra)( const Error* err ) // we make it consistent with the others. case Err_Leak: case Err_BadAlign: - case Err_BadSize: + case Err_UnsafeZeroSize: case Err_SizeMismatch: case Err_AlignMismatch: return sizeof(MC_Error); @@ -1578,10 +1567,10 @@ typedef MempoolSupp, // Memory pool suppression. FishyValueSupp, // Fishy value suppression. ReallocSizeZeroSupp, // realloc size 0 suppression - BadAlignSupp, // Alignment not 2 - BadSizeSupp, // aligned alloc with size 0 - SizeMismatch, // Sized deallocation did not match allocation size - AlignMismatch, // Aligned deallocation did not match aligned allocation + BadAlignSupp, // Alignment not 2 + UnsafeZeroSizeSupp, // aligned alloc with size 0 + SizeMismatch, // Sized deallocation did not match allocation size + AlignMismatch, // Aligned deallocation did not match aligned allocation } MC_SuppKind; @@ -1614,7 +1603,7 @@ Bool MC_(is_recognised_suppression) ( const HChar* name, Supp* su ) else if (VG_STREQ(name, "FishyValue")) skind = FishyValueSupp; else if (VG_STREQ(name, "ReallocZero")) skind = ReallocSizeZeroSupp; else if (VG_STREQ(name, "BadAlign")) skind = BadAlignSupp; - else if (VG_STREQ(name, "BadSize")) skind = BadSizeSupp; + else if (VG_STREQ(name, "UnsafeZeroSize")) skind = UnsafeZeroSizeSupp; else if (VG_STREQ(name, "SizeMismatch")) skind = SizeMismatch; else if (VG_STREQ(name, "AlignMismatch")) skind = AlignMismatch; else @@ -1800,8 +1789,8 @@ Bool MC_(error_matches_suppression) ( const Error* err, const Supp* su ) case BadAlignSupp: return (ekind == Err_BadAlign); - case BadSizeSupp: - return (ekind == Err_BadSize); + case UnsafeZeroSizeSupp: + return (ekind == Err_UnsafeZeroSize); case SizeMismatch: return (ekind == Err_SizeMismatch); @@ -1835,7 +1824,7 @@ const HChar* MC_(get_error_name) ( const Error* err ) case Err_FishyValue: return "FishyValue"; case Err_ReallocSizeZero: return "ReallocZero"; case Err_BadAlign: return "BadAlign"; - case Err_BadSize: return "BadSize"; + case Err_UnsafeZeroSize: return "UnsafeZeroSize"; case Err_SizeMismatch: return "SizeMismatch"; case Err_AlignMismatch: return "AlignMismatch"; case Err_Addr: { diff --git a/memcheck/mc_include.h b/memcheck/mc_include.h index acc595a74..7cc5febe0 100644 --- a/memcheck/mc_include.h +++ b/memcheck/mc_include.h @@ -559,7 +559,7 @@ void MC_(record_illegal_mempool_error) ( ThreadId tid, Addr a ); void MC_(record_freemismatch_error) ( ThreadId tid, MC_Chunk* mc ); void MC_(record_realloc_size_zero) ( ThreadId tid, Addr a ); void MC_(record_bad_alignment) ( ThreadId tid, SizeT align, SizeT size, const HChar *msg); -void MC_(record_bad_size) ( ThreadId tid, SizeT align, const HChar *function); +void MC_(record_unsafe_zero_size) ( ThreadId tid); void MC_(record_overlap_error) ( ThreadId tid, const HChar* function, Addr src, Addr dst, SizeT szB ); diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index 626d481d2..c7409156b 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -7231,7 +7231,7 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret ) } // size zero not allowed on all platforms (e.g. Illumos) if (aligned_alloc_info->size == 0) { - MC_(record_bad_size) ( tid, aligned_alloc_info->size, "memalign()" ); + MC_(record_unsafe_zero_size) ( tid ); } break; case AllocKindPosixMemalign: @@ -7243,7 +7243,7 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret ) MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , 0U, " (should be non-zero, a power of 2 and a multiple of sizeof(void*))" ); } if (aligned_alloc_info->size == 0) { - MC_(record_bad_size) ( tid, aligned_alloc_info->size, "posix_memalign()" ); + MC_(record_unsafe_zero_size) ( tid); } break; case AllocKindAlignedAlloc: @@ -7257,7 +7257,7 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret ) MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , aligned_alloc_info->size, " (size should be a multiple of alignment)" ); } if (aligned_alloc_info->size == 0) { - MC_(record_bad_size) ( tid, aligned_alloc_info->size, "aligned_alloc()" ); + MC_(record_unsafe_zero_size) ( tid ); } break; case AllocKindDeleteSized: @@ -7279,7 +7279,7 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret ) } break; case AllocKindFreeAlignedSized: - // same alignment checks as aligned_alloc + // same alignment checks as aligned_alloc, but allow a size of 0 if ((aligned_alloc_info->orig_alignment & (aligned_alloc_info->orig_alignment - 1)) != 0) { MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , 0U, " (should be a power of 2)" ); } @@ -7287,9 +7287,6 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret ) aligned_alloc_info->size % aligned_alloc_info->orig_alignment != 0U) { MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , aligned_alloc_info->size, " (size should be a multiple of alignment)" ); } - if (aligned_alloc_info->size == 0) { - MC_(record_bad_size) ( tid, aligned_alloc_info->size, "free_aligned_sized()" ); - } mc = VG_(HT_lookup) ( MC_(malloc_list), (UWord)aligned_alloc_info->mem ); if (mc && aligned_alloc_info->orig_alignment != mc->alignB) { MC_(record_align_mismatch_error) ( tid, mc, aligned_alloc_info->orig_alignment, False, "aligned_alloc/free_aligned_sized"); diff --git a/memcheck/tests/duplicate_align_size_errors.cpp b/memcheck/tests/duplicate_align_size_errors.cpp index 58f64a7cd..15c675958 100644 --- a/memcheck/tests/duplicate_align_size_errors.cpp +++ b/memcheck/tests/duplicate_align_size_errors.cpp @@ -29,7 +29,7 @@ int main() mem = nullptr; } - // Err.BadSize + // Err.UnsafeZeroSize mem = aligned_alloc(64U, 0U); if (mem) { diff --git a/memcheck/tests/duplicate_align_size_errors.stderr.exp b/memcheck/tests/duplicate_align_size_errors.stderr.exp index 4eb84f433..871c1c920 100644 --- a/memcheck/tests/duplicate_align_size_errors.stderr.exp +++ b/memcheck/tests/duplicate_align_size_errors.stderr.exp @@ -10,7 +10,7 @@ Invalid size value: 100 alignment value: 64 (size should be a multiple of alignm at 0x........: aligned_alloc (vg_replace_malloc.c:...) by 0x........: main (duplicate_align_size_errors.cpp:25) -aligned_alloc() invalid size value: 0 +Unsafe allocation with size of zero is implementation-defined at 0x........: aligned_alloc (vg_replace_malloc.c:...) by 0x........: main (duplicate_align_size_errors.cpp:33) diff --git a/memcheck/tests/duplicate_align_size_errors.stderr.exp-memalign b/memcheck/tests/duplicate_align_size_errors.stderr.exp-memalign index 250b05070..16ecf7714 100644 --- a/memcheck/tests/duplicate_align_size_errors.stderr.exp-memalign +++ b/memcheck/tests/duplicate_align_size_errors.stderr.exp-memalign @@ -6,7 +6,7 @@ Invalid alignment value: 0 (should be non-zero and a power of 2) at 0x........: operator delete(void*, std::align_val_t, std::nothrow_t const&) (vg_replace_malloc.c:...) by 0x........: main (duplicate_align_size_errors.cpp:20) -memalign() invalid size value: 0 +Unsafe allocation with size of zero is implementation-defined at 0x........: memalign (vg_replace_malloc.c:...) by 0x........: main (duplicate_align_size_errors.cpp:33) diff --git a/memcheck/tests/freebsd/aligned_allocs_supp.supp b/memcheck/tests/freebsd/aligned_allocs_supp.supp index 56676481e..122766f9c 100644 --- a/memcheck/tests/freebsd/aligned_allocs_supp.supp +++ b/memcheck/tests/freebsd/aligned_allocs_supp.supp @@ -14,7 +14,7 @@ { aligned_alloc bad size - Memcheck:BadSize + Memcheck:UnsafeZeroSize fun:aligned_alloc fun:main } diff --git a/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp b/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp index c555d9bdd..93c66c70b 100644 --- a/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp +++ b/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp @@ -11,7 +11,7 @@ Invalid alignment value: 40 (should be non-zero, a power of 2 and a multiple of at 0x........: posix_memalign (vg_replace_malloc.c:...) by 0x........: main (errno_aligned_allocs.c:20) -aligned_alloc() invalid size value: 0 +Unsafe allocation with size of zero is implementation-defined at 0x........: aligned_alloc (vg_replace_malloc.c:...) by 0x........: main (errno_aligned_allocs.c:60) diff --git a/memcheck/tests/linux/memalign.stderr.exp b/memcheck/tests/linux/memalign.stderr.exp index ae9dc6e35..630af58f1 100644 --- a/memcheck/tests/linux/memalign.stderr.exp +++ b/memcheck/tests/linux/memalign.stderr.exp @@ -34,7 +34,7 @@ Invalid alignment value: 4097 (should be power of 2) at 0x........: memalign (vg_replace_malloc.c:...) by 0x........: main (memalign.c:78) -memalign() invalid size value: 0 +Unsafe allocation with size of zero is implementation-defined at 0x........: memalign (vg_replace_malloc.c:...) by 0x........: main (memalign.c:87) diff --git a/memcheck/tests/linux/memalign.stderr.exp-musl b/memcheck/tests/linux/memalign.stderr.exp-musl index 6d3d3ac98..61e9177e8 100644 --- a/memcheck/tests/linux/memalign.stderr.exp-musl +++ b/memcheck/tests/linux/memalign.stderr.exp-musl @@ -34,7 +34,7 @@ Invalid alignment value: 4097 (should be power of 2) at 0x........: memalign (vg_replace_malloc.c:...) by 0x........: main (memalign.c:145) -memalign() invalid size value: 0 +Unsafe allocation with size of zero is implementation-defined at 0x........: memalign (vg_replace_malloc.c:...) by 0x........: main (memalign.c:155) diff --git a/memcheck/tests/posix_memalign.stderr.exp b/memcheck/tests/posix_memalign.stderr.exp index 3f8075f63..1c4701370 100644 --- a/memcheck/tests/posix_memalign.stderr.exp +++ b/memcheck/tests/posix_memalign.stderr.exp @@ -1,4 +1,4 @@ -posix_memalign() invalid size value: 0 +Unsafe allocation with size of zero is implementation-defined at 0x........: posix_memalign (vg_replace_malloc.c:...) by 0x........: main (posix_memalign.c:32) diff --git a/memcheck/tests/posix_memalign_supp.supp b/memcheck/tests/posix_memalign_supp.supp index a38ba23b0..23572e40f 100644 --- a/memcheck/tests/posix_memalign_supp.supp +++ b/memcheck/tests/posix_memalign_supp.supp @@ -1,7 +1,7 @@ { posix_memalign size - Memcheck:BadSize + Memcheck:UnsafeZeroSize fun:posix_memalign fun:main } @@ -15,8 +15,8 @@ # Darwin uses zones { - posix_memalign size - Memcheck:BadSize + posix_memalign zero size + Memcheck:UnsafeZeroSize fun:malloc_zone_memalign fun:posix_memalign fun:main diff --git a/memcheck/tests/posix_memalign_xml.stderr.exp b/memcheck/tests/posix_memalign_xml.stderr.exp index ce9ded320..9941ebc66 100644 --- a/memcheck/tests/posix_memalign_xml.stderr.exp +++ b/memcheck/tests/posix_memalign_xml.stderr.exp @@ -32,7 +32,7 @@ 0x........ ... InvalidSize - posix_memalign() invalid size value: 0 + Unsafe allocation with size of zero is implementation-defined 0x........ diff --git a/memcheck/tests/solaris/memalign.stderr.exp b/memcheck/tests/solaris/memalign.stderr.exp index dd2441252..fa9e333a5 100644 --- a/memcheck/tests/solaris/memalign.stderr.exp +++ b/memcheck/tests/solaris/memalign.stderr.exp @@ -1,4 +1,4 @@ -memalign() invalid size value: 0 +Unsafe allocation with size of zero is implementation-defined at 0x........: memalign (vg_replace_malloc.c:...) by 0x........: main (memalign.c:29) From 4cfbb3aaa6db1a4d5ee4c9c5d61ed94315570f8c Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 8 Sep 2025 07:31:02 +0200 Subject: [PATCH 261/412] Bug 509258 - FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-freebsd.h | 3 ++ coregrind/m_syswrap/syswrap-freebsd.c | 41 +++++++++++++++++++--- include/vki/vki-scnums-freebsd.h | 3 ++ 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 85b7a17b1..0158a23af 100644 --- a/NEWS +++ b/NEWS @@ -97,6 +97,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509103 Fix tests/arm64/bug484935.c build with "-O2 -flto -ffat-lto-objects" 509107 memcheck/tests/duplicate_align_size_errors.cpp fails 509139 Update BadSize error messages +509258 FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index b30cce4e8..8ac3b8e92 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -550,6 +550,9 @@ DECL_TEMPLATE(freebsd, sys_inotify_rm_watch) // 594 // generic getgroups 595 // generic setgroups 596 +DECL_TEMPLATE(freebsd, sys_jail_attach_jd) // 597 +DECL_TEMPLATE(freebsd, sys_jail_remove_jd) // 598 + DECL_TEMPLATE(freebsd, sys_fake_sigreturn) #endif // PRIV_SYSWRAP_FREEBSD_H diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index ef4712391..eb8a16058 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -7148,7 +7148,7 @@ PRE(sys_fchroot) SET_STATUS_Failure(VKI_EBADF); } -// SYS_setcred +// SYS_setcred 591 // int setcred(u_int flags, const struct setcred *wcred, size_t size); PRE(sys_setcred) { @@ -7157,7 +7157,7 @@ PRE(sys_setcred) PRE_MEM_READ("setcred(wcred)", ARG2, sizeof(struct vki_setcred)); } -// SYS_exterrctl +// SYS_exterrctl 592 // int exterrctl(u_int op, u_int flags, _In_reads_bytes_(4) void *ptr PRE(sys_exterrctl) { @@ -7170,7 +7170,7 @@ PRE(sys_exterrctl) PRE_MEM_READ("exterrctl(ptr)", ARG3, 4); } -// SYS_inotify_add_watch_at +// SYS_inotify_add_watch_at 593 // int inotify_add_watch_at(int fd, int dfd, _In_z_ const char *path, uint32_t mask); PRE(sys_inotify_add_watch_at) { @@ -7180,12 +7180,12 @@ PRE(sys_inotify_add_watch_at) ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "inotify_add_watch_at", tid, status); } -// SYS_inotify_rm_watch +// SYS_inotify_rm_watch 594 // int inotify_rm_watch(int fd, int wd); PRE(sys_inotify_rm_watch) { PRINT("sys_inotify_rm_watch(%" FMT_REGWORD "d, %" FMT_REGWORD "d)", SARG1, SARG2); - PRE_REG_READ2(int, "sys_inotify_rm_watch", int, fd, int, wd); + PRE_REG_READ2(int, "inotify_rm_watch", int, fd, int, wd); if (!ML_(fd_allowed)(ARG1, "inotify_rm_watch", tid, False)) { SET_STATUS_Failure( VKI_EBADF ); } @@ -7195,6 +7195,34 @@ PRE(sys_inotify_rm_watch) } } +// __NR_setgroups 595 +// generic + +// __NR_getgroups 596 +// generic + +// __NR_jail_attach_jd 597 +// int jail_attach_jd(int fd); +PRE(sys_jail_attach_jd) +{ + PRINT("sys_jail_attach_jd(%" FMT_REGWORD"d)", SARG1); + PRE_REG_READ1(int, "jail_attach_jd", int, fd); + + if (!ML_(fd_allowed)(ARG1, "jail_attach_id", tid, False)) + SET_STATUS_Failure(VKI_EBADF); +} + +// __NR_jail_remove_jd 598 +// int jail_remove_jd(int fd); +PRE(sys_jail_remove_jd) +{ + PRINT("sys_jail_remove_jd(%" FMT_REGWORD"d)", SARG1); + PRE_REG_READ1(int, "jail_remove_jd", int, fd); + + if (!ML_(fd_allowed)(ARG1, "jail_remove_id", tid, False)) + SET_STATUS_Failure(VKI_EBADF); +} + #undef PRE #undef POST @@ -7910,6 +7938,9 @@ const SyscallTableEntry ML_(syscall_table)[] = { GENXY(__NR_getgroups, sys_getgroups), // 596 #endif + BSDX_(__NR_jail_attach_jd, sys_jail_attach_jd), // 597 + BSDX_(__NR_jail_remove_jd, sys_jail_remove_jd), // 598 + BSDX_(__NR_fake_sigreturn, sys_fake_sigreturn), // 1000, fake sigreturn }; diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h index 1f2df9be4..8af22bde7 100644 --- a/include/vki/vki-scnums-freebsd.h +++ b/include/vki/vki-scnums-freebsd.h @@ -650,6 +650,9 @@ #define __NR_setgroups 596 #endif +#define __NR_jail_attach_jd 597 +#define __NR_jail_remove_jd 598 + #define __NR_fake_sigreturn 1000 #endif /* VKI_UNISTD_FREEBSD_H */ From 818e7661ecac5e0fb60f19f28ad64cd3bff6cdd9 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Wed, 3 Sep 2025 16:02:26 +0200 Subject: [PATCH 262/412] Wrap the remap_file_pages syscall The remap_file_pages() system call is used to create a nonlinear mapping, that is, a mapping in which the pages of the file are mapped into a nonsequential order in memory. It is deprecated but in some cases it may still be used. LTP remap_file_pages01 and remap_file_pages02 test-cover it. Declare a remap_file_pages wrapper in priv_syswrap-linux.h and hook it for {amd64,arm,arm64,mips64,ppc32,ppc64,riscv64,s390x\ ,x86}- linux using LINX_ with PRE handler in syswrap-linux.c https://bugs.kde.org/show_bug.cgi?id=309554 --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 1 + coregrind/m_syswrap/syswrap-amd64-linux.c | 2 +- coregrind/m_syswrap/syswrap-arm-linux.c | 2 +- coregrind/m_syswrap/syswrap-arm64-linux.c | 2 +- coregrind/m_syswrap/syswrap-linux.c | 13 +++++++++++++ coregrind/m_syswrap/syswrap-mips64-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc32-linux.c | 2 +- coregrind/m_syswrap/syswrap-ppc64-linux.c | 2 +- coregrind/m_syswrap/syswrap-riscv64-linux.c | 1 + coregrind/m_syswrap/syswrap-s390x-linux.c | 2 +- coregrind/m_syswrap/syswrap-x86-linux.c | 2 +- include/vki/vki-scnums-riscv64-linux.h | 1 + 13 files changed, 25 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 0158a23af..8c4479100 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +309554 Wrap syscall remap_file_pages (216) 338803 Handling of dwz debug alt files or cross-CU is broken 418756 MAP_FIXED_NOREPLACE mmap flag unsupported 493430 Review all syscalls that use or return (new) file descriptors diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 1d5135fc5..2fe8fd59d 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -110,6 +110,7 @@ DECL_TEMPLATE(linux, sys_epoll_ctl); DECL_TEMPLATE(linux, sys_epoll_wait); DECL_TEMPLATE(linux, sys_epoll_pwait); DECL_TEMPLATE(linux, sys_epoll_pwait2); +DECL_TEMPLATE(linux, sys_remap_file_pages); DECL_TEMPLATE(linux, sys_eventfd); DECL_TEMPLATE(linux, sys_eventfd2); diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index f15c3dac7..bb970b47d 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -729,7 +729,7 @@ static SyscallTableEntry syscall_table[] = { // (__NR_epoll_ctl_old, sys_ni_syscall), // 214 // (__NR_epoll_wait_old, sys_ni_syscall), // 215 - // (__NR_remap_file_pages, sys_remap_file_pages)// 216 + LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 216 GENXY(__NR_getdents64, sys_getdents64), // 217 LINX_(__NR_set_tid_address, sys_set_tid_address),// 218 // (__NR_restart_syscall, sys_restart_syscall),// 219 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 1aae03c02..043a4095c 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -860,7 +860,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 255 LINXY(__NR_epoll_wait, sys_epoll_wait), // 256 -//zz // (__NR_remap_file_pages, sys_remap_file_pages), // 257 */Linux + LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 257 */Linux LINX_(__NR_set_tid_address, sys_set_tid_address), // 258 LINXY(__NR_timer_create, sys_timer_create), // 259 diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index f6f63a52e..71d1123d0 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -782,7 +782,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_munlockall, sys_munlockall), // 231 GENXY(__NR_mincore, sys_mincore), // 232 GENX_(__NR_madvise, sys_madvise), // 233 - // (__NR_remap_file_pages, sys_ni_syscall) // 234 + LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 234 LINX_(__NR_mbind, sys_mbind), // 235 LINXY(__NR_get_mempolicy, sys_get_mempolicy), // 236 LINX_(__NR_set_mempolicy, sys_set_mempolicy), // 237 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index fef23763f..e1450d886 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2241,6 +2241,19 @@ POST(sys_epoll_pwait2) epoll_post_helper (tid, arrghs, status); } +PRE(sys_remap_file_pages) +{ + /* int remap_file_pages(void addr[.size], size_t size, + int prot, size_t pgoff, int flags); */ + Int arg_3 = (Int) ARG3; + Int arg_5 = (Int) ARG5; + PRINT("sys_remap_file_pages ( %#" FMT_REGWORD "x, %lu, %d, %lu, %d", + ARG1, ARG2, arg_3, ARG4, arg_5); + PRE_REG_READ5(int, "remap_file_pages", void *, addr, vki_size_t, + size_t, int, prot, vki_size_t, pgoff, int, flags); + PRE_MEM_READ("sys_remap_file_pages(addr)", ARG1, ARG2); +} + PRE(sys_eventfd) { PRINT("sys_eventfd ( %" FMT_REGWORD "u )", ARG1); diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 5234ccc37..26ece232b 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -701,6 +701,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY (__NR_epoll_create1, sys_epoll_create1), LINX_ (__NR_epoll_ctl, sys_epoll_ctl), LINXY (__NR_epoll_wait, sys_epoll_wait), + LINX_ (__NR_remap_file_pages, sys_remap_file_pages), PLAX_(__NR_rt_sigreturn,sys_rt_sigreturn), #if defined(VGABI_N32) LINXY(__NR_fcntl64, sys_fcntl64), diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index cb4410795..d8dbe7de6 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -902,7 +902,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 237 LINXY(__NR_epoll_wait, sys_epoll_wait), // 238 -//.. // (__NR_remap_file_pages, sys_remap_file_pages), // 239 */Linux + LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 239 */Linux LINXY(__NR_timer_create, sys_timer_create), // 240 LINXY(__NR_timer_settime, sys_timer_settime), // 241 LINXY(__NR_timer_gettime, sys_timer_gettime), // 242 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index bb5cb4f7b..3e7a14e40 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -884,7 +884,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_epoll_create, sys_epoll_create), // 236 LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 237 LINXY(__NR_epoll_wait, sys_epoll_wait), // 238 -// _____(__NR_remap_file_pages, sys_remap_file_pages), // 239 + LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 239 LINXY(__NR_timer_create, sys_timer_create), // 240 LINXY(__NR_timer_settime, sys_timer_settime), // 241 diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index c3ab78ef5..987205319 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -537,6 +537,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_munlockall, sys_munlockall), /* 231 */ GENXY(__NR_mincore, sys_mincore), /* 232 */ GENX_(__NR_madvise, sys_madvise), /* 233 */ + LINX_(__NR_remap_file_pages, sys_remap_file_pages), /* 234 */ LINX_(__NR_mbind, sys_mbind), /* 235 */ LINXY(__NR_get_mempolicy, sys_get_mempolicy), /* 236 */ LINX_(__NR_set_mempolicy, sys_set_mempolicy), /* 237 */ diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index ad35a4ebc..8ab81d593 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -731,7 +731,7 @@ static SyscallTableEntry syscall_table[] = { GENXY(__NR_statfs64, sys_statfs64), // 265 GENXY(__NR_fstatfs64, sys_fstatfs64), // 266 -// ?????(__NR_remap_file_pages, ), + LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 267 GENX_(268, sys_ni_syscall), /* unimplemented (by the kernel) */ // 268 GENX_(269, sys_ni_syscall), /* unimplemented (by the kernel) */ // 269 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 45c76a6db..7e68c4e0e 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1468,7 +1468,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 255 LINXY(__NR_epoll_wait, sys_epoll_wait), // 256 -//zz // (__NR_remap_file_pages, sys_remap_file_pages), // 257 */Linux + LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 257 */Linux LINX_(__NR_set_tid_address, sys_set_tid_address), // 258 LINXY(__NR_timer_create, sys_timer_create), // 259 diff --git a/include/vki/vki-scnums-riscv64-linux.h b/include/vki/vki-scnums-riscv64-linux.h index 17b6839f8..f084cf44e 100644 --- a/include/vki/vki-scnums-riscv64-linux.h +++ b/include/vki/vki-scnums-riscv64-linux.h @@ -261,6 +261,7 @@ #define __NR_munlockall 231 #define __NR_mincore 232 #define __NR_madvise 233 +#define __NR_remap_file_pages 234 #define __NR_mbind 235 #define __NR_get_mempolicy 236 #define __NR_set_mempolicy 237 From a2b8fcbad704523be08744356e8cae8b9867828c Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 9 Sep 2025 21:05:37 +0200 Subject: [PATCH 263/412] Bug 388526 -Inconsistent severity in message text: "WARNING: Serious error" --- NEWS | 1 + coregrind/m_debuginfo/storage.c | 17 +++++------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index 8c4479100..38c00488b 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 309554 Wrap syscall remap_file_pages (216) 338803 Handling of dwz debug alt files or cross-CU is broken +388526 Inconsistent severity in message text: "WARNING: Serious error" 418756 MAP_FIXED_NOREPLACE mmap flag unsupported 493430 Review all syscalls that use or return (new) file descriptors 493434 Add --track-fds=bad mode (no "leak" tracking) diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c index 22fed6d4f..1db726be8 100644 --- a/coregrind/m_debuginfo/storage.c +++ b/coregrind/m_debuginfo/storage.c @@ -69,19 +69,12 @@ void ML_(symerr) ( const DebugInfo* di, Bool serious, const HChar* msg ) return; if (serious) { - - VG_(message)(Vg_DebugMsg, "WARNING: Serious error when " - "reading debug info\n"); - if (True || VG_(clo_verbosity) < 2) { - /* Need to show what the file name is, at verbosity levels 2 - or below, since that won't already have been shown */ - VG_(message)(Vg_DebugMsg, - "When reading debug info from %s:\n", - (di && di->fsm.filename) ? di->fsm.filename - : "???"); - } + VG_(message)(Vg_DebugMsg, + "WARNING: Serious problem when reading debug info from %s:\n", + (di && di->fsm.filename) ? di->fsm.filename : "???"); + VG_(message)(Vg_DebugMsg, + "WARNING: Valgrind will continue to execute but error messages may be degraded.\n"); VG_(message)(Vg_DebugMsg, "%s\n", msg); - } else { /* !serious */ if (VG_(clo_verbosity) >= 2) From 40f492a2a7327921faf5d29560f6d63378658687 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 9 Sep 2025 20:45:32 +0000 Subject: [PATCH 264/412] ir_opt.c: Algebraic simplification for multiplication and division. New functions isOneU and mkOneOfPrimopResultType. Adjust function mkZeroOfPrimopResultType. --- VEX/priv/ir_opt.c | 104 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 9ed002ea4..95a881a08 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1215,6 +1215,20 @@ static Bool isZeroU ( IRExpr* e ) } } +/* Is this an integer constant with value 1 ? */ +static Bool isOneU ( const IRExpr* e ) +{ + if (e->tag != Iex_Const) return False; + switch (e->Iex.Const.con->tag) { + case Ico_U1: return toBool( e->Iex.Const.con->Ico.U1 == 1); + case Ico_U8: return toBool( e->Iex.Const.con->Ico.U8 == 1); + case Ico_U16: return toBool( e->Iex.Const.con->Ico.U16 == 1); + case Ico_U32: return toBool( e->Iex.Const.con->Ico.U32 == 1); + case Ico_U64: return toBool( e->Iex.Const.con->Ico.U64 == 1); + default: vpanic("isOneU"); + } +} + /* Is this an integer constant with value 1---1b ? */ static Bool isOnesU ( IRExpr* e ) { @@ -1244,11 +1258,25 @@ static IRExpr* mkZeroOfPrimopResultType ( IROp op ) { switch (op) { case Iop_Sub8: + case Iop_Mul8: case Iop_Xor8: return IRExpr_Const(IRConst_U8(0)); case Iop_Sub16: + case Iop_Mul16: + case Iop_MullU8: + case Iop_MullS8: case Iop_Xor16: return IRExpr_Const(IRConst_U16(0)); + case Iop_MullU16: + case Iop_MullS16: + case Iop_Mul32: + case Iop_DivU32: + case Iop_DivS32: case Iop_Sub32: case Iop_Xor32: return IRExpr_Const(IRConst_U32(0)); + case Iop_MullU32: + case Iop_MullS32: + case Iop_Mul64: + case Iop_DivU64: + case Iop_DivS64: case Iop_And64: case Iop_Sub64: case Iop_Xor64: return IRExpr_Const(IRConst_U64(0)); @@ -1256,7 +1284,24 @@ static IRExpr* mkZeroOfPrimopResultType ( IROp op ) case Iop_AndV128: return IRExpr_Const(IRConst_V128(0)); case Iop_XorV256: case Iop_AndV256: return IRExpr_Const(IRConst_V256(0)); - default: vpanic("mkZeroOfPrimopResultType: bad primop"); + default: ppIROp(op); vpanic("mkZeroOfPrimopResultType: bad primop"); + } +} + +/* Make an integer value of 1, which has the same type as the + result of the given primop. */ +static IRExpr* mkOneOfPrimopResultType ( IROp op ) +{ + switch (op) { + case Iop_DivU32: + case Iop_DivS32: + return IRExpr_Const(IRConst_U32(1)); + case Iop_DivU64: + case Iop_DivS64: + return IRExpr_Const(IRConst_U64(1)); + default: + ppIROp(op); + vpanic("mkOneOfPrimopResultType: bad primop"); } } @@ -2571,6 +2616,7 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } } else { + IROp widen_op = Iop_INVALID; /* other cases (identities, etc) */ switch (e->Iex.Binop.op) { @@ -2686,6 +2732,62 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) } break; + case Iop_Mul8: + case Iop_Mul16: + case Iop_Mul32: + case Iop_Mul64: + widen_op = Iop_INVALID; + goto common_mulopt; + + case Iop_MullU8: widen_op = Iop_8Uto16; goto common_mulopt; + case Iop_MullS8: widen_op = Iop_8Sto16; goto common_mulopt; + case Iop_MullU16: widen_op = Iop_16Uto32; goto common_mulopt; + case Iop_MullS16: widen_op = Iop_16Sto32; goto common_mulopt; + case Iop_MullU32: widen_op = Iop_32Uto64; goto common_mulopt; + case Iop_MullS32: widen_op = Iop_32Sto64; goto common_mulopt; + + common_mulopt: + /* Multiplying x with 0 ==> 0 */ + if (isZeroU(e->Iex.Binop.arg1) || isZeroU(e->Iex.Binop.arg2)) { + e2 = mkZeroOfPrimopResultType(e->Iex.Binop.op); + break; + } + /* Multiplying x with 1 ==> x */ + if (isOneU(e->Iex.Binop.arg1)) { + e2 = (widen_op == Iop_INVALID) ? e->Iex.Binop.arg2 + : IRExpr_Unop(widen_op, e->Iex.Binop.arg2); + break; + } + if (isOneU(e->Iex.Binop.arg2)) { + e2 = (widen_op == Iop_INVALID) ? e->Iex.Binop.arg1 + : IRExpr_Unop(widen_op, e->Iex.Binop.arg1); + break; + } + break; + + case Iop_DivU32: + case Iop_DivS32: + case Iop_DivU64: + case Iop_DivS64: + /* Dividing x by 1 ==> x */ + if (isOneU(e->Iex.Binop.arg2)) { + e2 = e->Iex.Binop.arg1; + break; + } + /* Dividing x by x ==> 1 */ + if (! isZeroU(e->Iex.Binop.arg2)) { + if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) { + e2 = mkOneOfPrimopResultType(e->Iex.Binop.op); + break; + } + } + /* Dividing 0 by x ==> 0 */ + if (isZeroU(e->Iex.Binop.arg1)) { + e2 = mkZeroOfPrimopResultType(e->Iex.Binop.op); + break; + } + break; + case Iop_And1: case Iop_And8: case Iop_And16: From 6c6d09e102f5436c4aad672ccfb0544826de3fbe Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 9 Sep 2025 21:51:33 +0000 Subject: [PATCH 265/412] VEX: Minor non-functional change For the benefit of editors and for consistency: The left brace of a function body goes to column #1. --- VEX/priv/ir_defs.c | 108 ++++++++++++++++++++++++++++--------------- VEX/priv/ir_opt.c | 12 +++-- VEX/priv/main_main.c | 3 +- 3 files changed, 82 insertions(+), 41 deletions(-) diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c index 79b7cce64..afb14fcc5 100644 --- a/VEX/priv/ir_defs.c +++ b/VEX/priv/ir_defs.c @@ -2351,20 +2351,23 @@ IRRegArray* mkIRRegArray ( Int base, IRType elemTy, Int nElems ) /* Constructors -- IRExpr */ -IRExpr* IRExpr_Binder ( Int binder ) { +IRExpr* IRExpr_Binder ( Int binder ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); e->tag = Iex_Binder; e->Iex.Binder.binder = binder; return e; } -IRExpr* IRExpr_Get ( Int off, IRType ty ) { +IRExpr* IRExpr_Get ( Int off, IRType ty ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); e->tag = Iex_Get; e->Iex.Get.offset = off; e->Iex.Get.ty = ty; return e; } -IRExpr* IRExpr_GetI ( IRRegArray* descr, IRExpr* ix, Int bias ) { +IRExpr* IRExpr_GetI ( IRRegArray* descr, IRExpr* ix, Int bias ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); e->tag = Iex_GetI; e->Iex.GetI.descr = descr; @@ -2372,14 +2375,16 @@ IRExpr* IRExpr_GetI ( IRRegArray* descr, IRExpr* ix, Int bias ) { e->Iex.GetI.bias = bias; return e; } -IRExpr* IRExpr_RdTmp ( IRTemp tmp ) { +IRExpr* IRExpr_RdTmp ( IRTemp tmp ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); e->tag = Iex_RdTmp; e->Iex.RdTmp.tmp = tmp; return e; } IRExpr* IRExpr_Qop ( IROp op, IRExpr* arg1, IRExpr* arg2, - IRExpr* arg3, IRExpr* arg4 ) { + IRExpr* arg3, IRExpr* arg4 ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); IRQop* qop = LibVEX_Alloc_inline(sizeof(IRQop)); qop->op = op; @@ -2392,7 +2397,8 @@ IRExpr* IRExpr_Qop ( IROp op, IRExpr* arg1, IRExpr* arg2, return e; } IRExpr* IRExpr_Triop ( IROp op, IRExpr* arg1, - IRExpr* arg2, IRExpr* arg3 ) { + IRExpr* arg2, IRExpr* arg3 ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); IRTriop* triop = LibVEX_Alloc_inline(sizeof(IRTriop)); triop->op = op; @@ -2403,7 +2409,8 @@ IRExpr* IRExpr_Triop ( IROp op, IRExpr* arg1, e->Iex.Triop.details = triop; return e; } -IRExpr* IRExpr_Binop ( IROp op, IRExpr* arg1, IRExpr* arg2 ) { +IRExpr* IRExpr_Binop ( IROp op, IRExpr* arg1, IRExpr* arg2 ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); e->tag = Iex_Binop; e->Iex.Binop.op = op; @@ -2418,7 +2425,8 @@ IRExpr* IRExpr_Unop ( IROp op, IRExpr* arg ) { e->Iex.Unop.arg = arg; return e; } -IRExpr* IRExpr_Load ( IREndness end, IRType ty, IRExpr* addr ) { +IRExpr* IRExpr_Load ( IREndness end, IRType ty, IRExpr* addr ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); e->tag = Iex_Load; e->Iex.Load.end = end; @@ -2427,13 +2435,15 @@ IRExpr* IRExpr_Load ( IREndness end, IRType ty, IRExpr* addr ) { vassert(end == Iend_LE || end == Iend_BE); return e; } -IRExpr* IRExpr_Const ( IRConst* con ) { +IRExpr* IRExpr_Const ( IRConst* con ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); e->tag = Iex_Const; e->Iex.Const.con = con; return e; } -IRExpr* IRExpr_CCall ( IRCallee* cee, IRType retty, IRExpr** args ) { +IRExpr* IRExpr_CCall ( IRCallee* cee, IRType retty, IRExpr** args ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); e->tag = Iex_CCall; e->Iex.CCall.cee = cee; @@ -2441,7 +2451,8 @@ IRExpr* IRExpr_CCall ( IRCallee* cee, IRType retty, IRExpr** args ) { e->Iex.CCall.args = args; return e; } -IRExpr* IRExpr_ITE ( IRExpr* cond, IRExpr* iftrue, IRExpr* iffalse ) { +IRExpr* IRExpr_ITE ( IRExpr* cond, IRExpr* iftrue, IRExpr* iffalse ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); e->tag = Iex_ITE; e->Iex.ITE.cond = cond; @@ -2449,12 +2460,14 @@ IRExpr* IRExpr_ITE ( IRExpr* cond, IRExpr* iftrue, IRExpr* iffalse ) { e->Iex.ITE.iffalse = iffalse; return e; } -IRExpr* IRExpr_VECRET ( void ) { +IRExpr* IRExpr_VECRET ( void ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); e->tag = Iex_VECRET; return e; } -IRExpr* IRExpr_GSPTR ( void ) { +IRExpr* IRExpr_GSPTR ( void ) +{ IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr)); e->tag = Iex_GSPTR; return e; @@ -2464,25 +2477,29 @@ IRExpr* IRExpr_GSPTR ( void ) { /* Constructors for NULL-terminated IRExpr expression vectors, suitable for use as arg lists in clean/dirty helper calls. */ -IRExpr** mkIRExprVec_0 ( void ) { +IRExpr** mkIRExprVec_0 ( void ) +{ IRExpr** vec = LibVEX_Alloc_inline(1 * sizeof(IRExpr*)); vec[0] = NULL; return vec; } -IRExpr** mkIRExprVec_1 ( IRExpr* arg1 ) { +IRExpr** mkIRExprVec_1 ( IRExpr* arg1 ) +{ IRExpr** vec = LibVEX_Alloc_inline(2 * sizeof(IRExpr*)); vec[0] = arg1; vec[1] = NULL; return vec; } -IRExpr** mkIRExprVec_2 ( IRExpr* arg1, IRExpr* arg2 ) { +IRExpr** mkIRExprVec_2 ( IRExpr* arg1, IRExpr* arg2 ) +{ IRExpr** vec = LibVEX_Alloc_inline(3 * sizeof(IRExpr*)); vec[0] = arg1; vec[1] = arg2; vec[2] = NULL; return vec; } -IRExpr** mkIRExprVec_3 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3 ) { +IRExpr** mkIRExprVec_3 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3 ) +{ IRExpr** vec = LibVEX_Alloc_inline(4 * sizeof(IRExpr*)); vec[0] = arg1; vec[1] = arg2; @@ -2491,7 +2508,8 @@ IRExpr** mkIRExprVec_3 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3 ) { return vec; } IRExpr** mkIRExprVec_4 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, - IRExpr* arg4 ) { + IRExpr* arg4 ) +{ IRExpr** vec = LibVEX_Alloc_inline(5 * sizeof(IRExpr*)); vec[0] = arg1; vec[1] = arg2; @@ -2501,7 +2519,8 @@ IRExpr** mkIRExprVec_4 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, return vec; } IRExpr** mkIRExprVec_5 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, - IRExpr* arg4, IRExpr* arg5 ) { + IRExpr* arg4, IRExpr* arg5 ) +{ IRExpr** vec = LibVEX_Alloc_inline(6 * sizeof(IRExpr*)); vec[0] = arg1; vec[1] = arg2; @@ -2512,7 +2531,8 @@ IRExpr** mkIRExprVec_5 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, return vec; } IRExpr** mkIRExprVec_6 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, - IRExpr* arg4, IRExpr* arg5, IRExpr* arg6 ) { + IRExpr* arg4, IRExpr* arg5, IRExpr* arg6 ) +{ IRExpr** vec = LibVEX_Alloc_inline(7 * sizeof(IRExpr*)); vec[0] = arg1; vec[1] = arg2; @@ -2525,7 +2545,8 @@ IRExpr** mkIRExprVec_6 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, } IRExpr** mkIRExprVec_7 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, IRExpr* arg4, IRExpr* arg5, IRExpr* arg6, - IRExpr* arg7 ) { + IRExpr* arg7 ) +{ IRExpr** vec = LibVEX_Alloc_inline(8 * sizeof(IRExpr*)); vec[0] = arg1; vec[1] = arg2; @@ -2539,7 +2560,8 @@ IRExpr** mkIRExprVec_7 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, } IRExpr** mkIRExprVec_8 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, IRExpr* arg4, IRExpr* arg5, IRExpr* arg6, - IRExpr* arg7, IRExpr* arg8 ) { + IRExpr* arg7, IRExpr* arg8 ) +{ IRExpr** vec = LibVEX_Alloc_inline(9 * sizeof(IRExpr*)); vec[0] = arg1; vec[1] = arg2; @@ -2554,7 +2576,8 @@ IRExpr** mkIRExprVec_8 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, } IRExpr** mkIRExprVec_9 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, IRExpr* arg4, IRExpr* arg5, IRExpr* arg6, - IRExpr* arg7, IRExpr* arg8, IRExpr* arg9 ) { + IRExpr* arg7, IRExpr* arg8, IRExpr* arg9 ) +{ IRExpr** vec = LibVEX_Alloc_inline(10 * sizeof(IRExpr*)); vec[0] = arg1; vec[1] = arg2; @@ -2573,7 +2596,8 @@ IRExpr** mkIRExprVec_13 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, IRExpr* arg7, IRExpr* arg8, IRExpr* arg9, IRExpr* arg10, IRExpr* arg11, IRExpr* arg12, IRExpr* arg13 - ) { + ) +{ IRExpr** vec = LibVEX_Alloc_inline(14 * sizeof(IRExpr*)); vec[0] = arg1; vec[1] = arg2; @@ -2595,7 +2619,8 @@ IRExpr** mkIRExprVec_13 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3, /* Constructors -- IRDirty */ -IRDirty* emptyIRDirty ( void ) { +IRDirty* emptyIRDirty ( void ) +{ IRDirty* d = LibVEX_Alloc_inline(sizeof(IRDirty)); d->cee = NULL; d->guard = NULL; @@ -2614,7 +2639,8 @@ IRDirty* emptyIRDirty ( void ) { IRCAS* mkIRCAS ( IRTemp oldHi, IRTemp oldLo, IREndness end, IRExpr* addr, IRExpr* expdHi, IRExpr* expdLo, - IRExpr* dataHi, IRExpr* dataLo ) { + IRExpr* dataHi, IRExpr* dataLo ) +{ IRCAS* cas = LibVEX_Alloc_inline(sizeof(IRCAS)); cas->oldHi = oldHi; cas->oldLo = oldLo; @@ -2678,7 +2704,8 @@ IRStmt* IRStmt_NoOp ( void ) static_closure.tag = Ist_NoOp; return &static_closure; } -IRStmt* IRStmt_IMark ( Addr addr, UInt len, UChar delta ) { +IRStmt* IRStmt_IMark ( Addr addr, UInt len, UChar delta ) +{ IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt)); s->tag = Ist_IMark; s->Ist.IMark.addr = addr; @@ -2686,7 +2713,8 @@ IRStmt* IRStmt_IMark ( Addr addr, UInt len, UChar delta ) { s->Ist.IMark.delta = delta; return s; } -IRStmt* IRStmt_AbiHint ( IRExpr* base, Int len, IRExpr* nia ) { +IRStmt* IRStmt_AbiHint ( IRExpr* base, Int len, IRExpr* nia ) +{ IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt)); s->tag = Ist_AbiHint; s->Ist.AbiHint.base = base; @@ -2694,27 +2722,31 @@ IRStmt* IRStmt_AbiHint ( IRExpr* base, Int len, IRExpr* nia ) { s->Ist.AbiHint.nia = nia; return s; } -IRStmt* IRStmt_Put ( Int off, IRExpr* data ) { +IRStmt* IRStmt_Put ( Int off, IRExpr* data ) +{ IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt)); s->tag = Ist_Put; s->Ist.Put.offset = off; s->Ist.Put.data = data; return s; } -IRStmt* IRStmt_PutI ( IRPutI* details ) { +IRStmt* IRStmt_PutI ( IRPutI* details ) +{ IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt)); s->tag = Ist_PutI; s->Ist.PutI.details = details; return s; } -IRStmt* IRStmt_WrTmp ( IRTemp tmp, IRExpr* data ) { +IRStmt* IRStmt_WrTmp ( IRTemp tmp, IRExpr* data ) +{ IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt)); s->tag = Ist_WrTmp; s->Ist.WrTmp.tmp = tmp; s->Ist.WrTmp.data = data; return s; } -IRStmt* IRStmt_Store ( IREndness end, IRExpr* addr, IRExpr* data ) { +IRStmt* IRStmt_Store ( IREndness end, IRExpr* addr, IRExpr* data ) +{ IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt)); s->tag = Ist_Store; s->Ist.Store.end = end; @@ -2732,20 +2764,23 @@ IRStmt* IRStmt_StoreG ( IREndness end, IRExpr* addr, IRExpr* data, return s; } IRStmt* IRStmt_LoadG ( IREndness end, IRLoadGOp cvt, IRTemp dst, - IRExpr* addr, IRExpr* alt, IRExpr* guard ) { + IRExpr* addr, IRExpr* alt, IRExpr* guard ) +{ IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt)); s->tag = Ist_LoadG; s->Ist.LoadG.details = mkIRLoadG(end, cvt, dst, addr, alt, guard); return s; } -IRStmt* IRStmt_CAS ( IRCAS* cas ) { +IRStmt* IRStmt_CAS ( IRCAS* cas ) +{ IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt)); s->tag = Ist_CAS; s->Ist.CAS.details = cas; return s; } IRStmt* IRStmt_LLSC ( IREndness end, - IRTemp result, IRExpr* addr, IRExpr* storedata ) { + IRTemp result, IRExpr* addr, IRExpr* storedata ) +{ IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt)); s->tag = Ist_LLSC; s->Ist.LLSC.end = end; @@ -2769,7 +2804,8 @@ IRStmt* IRStmt_MBE ( IRMBusEvent event ) return s; } IRStmt* IRStmt_Exit ( IRExpr* guard, IRJumpKind jk, IRConst* dst, - Int offsIP ) { + Int offsIP ) +{ IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt)); s->tag = Ist_Exit; s->Ist.Exit.guard = guard; diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 95a881a08..ff3bf10c8 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -3601,7 +3601,8 @@ static IRSB* cprop_BB_WRK ( IRSB* in, Bool mustRetainNoOps, Bool doFolding ) } -IRSB* cprop_BB ( IRSB* in ) { +IRSB* cprop_BB ( IRSB* in ) +{ return cprop_BB_WRK(in, /*mustRetainNoOps=*/False, /*doFolding=*/True); } @@ -5935,10 +5936,12 @@ static IRExpr* atbSubst_Temp ( ATmpInfo* env, IRTemp tmp ) 'single-shot', so once a binding is used, it is marked as no longer available, by setting its .bindee field to NULL. */ -static inline Bool is_Unop ( IRExpr* e, IROp op ) { +static inline Bool is_Unop ( IRExpr* e, IROp op ) +{ return e->tag == Iex_Unop && e->Iex.Unop.op == op; } -static inline Bool is_Binop ( IRExpr* e, IROp op ) { +static inline Bool is_Binop ( IRExpr* e, IROp op ) +{ return e->tag == Iex_Binop && e->Iex.Binop.op == op; } @@ -7382,7 +7385,8 @@ IRSB* do_iropt_BB( return bb; } -IRSB* do_minimal_initial_iropt_BB(IRSB* bb0) { +IRSB* do_minimal_initial_iropt_BB(IRSB* bb0) +{ /* First flatten the block out, since all other phases assume flat code. */ IRSB* bb = flatten_BB ( bb0 ); diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index 3e64ad7de..db78238ae 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -1681,7 +1681,8 @@ void LibVEX_default_VexAbiInfo ( /*OUT*/VexAbiInfo* vbi ) } -static IRType arch_word_size (VexArch arch) { +static IRType arch_word_size (VexArch arch) +{ switch (arch) { case VexArchX86: case VexArchARM: From ba81960352892d52ec7a1efc381697a8656b12e7 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 10 Sep 2025 21:53:22 +0200 Subject: [PATCH 266/412] Helgrind regtest: use older C++ dialect for bug392331.cpp Old versions of GCC (like 6.3) claim some C++17 support but apparently not CTAD https://en.cppreference.com/w/cpp/language/class_template_argument_deduction.html So, go backwards and explicitly give the std::mutex template type for the locks. --- helgrind/tests/bug392331.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helgrind/tests/bug392331.cpp b/helgrind/tests/bug392331.cpp index ff26883b7..bd6cc5a23 100644 --- a/helgrind/tests/bug392331.cpp +++ b/helgrind/tests/bug392331.cpp @@ -16,7 +16,7 @@ bool processed = false; void worker_thread() { // Wait until main() sends data - std::unique_lock lk(m); + std::unique_lock lk(m); cv.wait(lk, []{return ready;}); // after the wait, we own the lock. @@ -40,7 +40,7 @@ int main() data = "Example data"; // send data to the worker thread { - std::lock_guard lk(m); + std::lock_guard lk(m); ready = true; std::cout << "main() signals data ready for processing\n"; } @@ -48,7 +48,7 @@ int main() // wait for the worker { - std::unique_lock lk(m); + std::unique_lock lk(m); cv.wait(lk, []{return processed;}); } std::cout << "Back in main(), data = " << data << '\n'; From e22b4d14a959238b71aa7b9af2e8f4fa43d46fc8 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 10 Sep 2025 21:30:08 +0000 Subject: [PATCH 267/412] ir_opt.c: Fix algebraic simplification for division. x / x ==> 1 IFF x is not 0. But that cannot be decided at JIT time. Remove mkOneOfPrimopResultType as it is no longer needed. --- VEX/priv/ir_opt.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index ff3bf10c8..f3954fc60 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1288,23 +1288,6 @@ static IRExpr* mkZeroOfPrimopResultType ( IROp op ) } } -/* Make an integer value of 1, which has the same type as the - result of the given primop. */ -static IRExpr* mkOneOfPrimopResultType ( IROp op ) -{ - switch (op) { - case Iop_DivU32: - case Iop_DivS32: - return IRExpr_Const(IRConst_U32(1)); - case Iop_DivU64: - case Iop_DivS64: - return IRExpr_Const(IRConst_U64(1)); - default: - ppIROp(op); - vpanic("mkOneOfPrimopResultType: bad primop"); - } -} - /* Make a Boolean False value */ static inline IRExpr* mkFalse(void) { @@ -2774,13 +2757,13 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) e2 = e->Iex.Binop.arg1; break; } - /* Dividing x by x ==> 1 */ - if (! isZeroU(e->Iex.Binop.arg2)) { - if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) { - e2 = mkOneOfPrimopResultType(e->Iex.Binop.op); - break; - } - } + + /* Dividing x by x ==> 1 + DON'T. The reason is that we cannot decide at JIT time whether + e->Iex.Binop.arg2 might evaluate to zero. Suppose it does. + Then we would be rewriting 0 / 0 ==> 1 and that is clearly + wrong. */ + /* Dividing 0 by x ==> 0 */ if (isZeroU(e->Iex.Binop.arg1)) { e2 = mkZeroOfPrimopResultType(e->Iex.Binop.op); From 4247bab4b0880b5f69621e7ec407b9b0436d158e Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 11 Sep 2025 07:18:52 +0200 Subject: [PATCH 268/412] configure: add check for C++ constexpr if For old compilers like GCC 6.3 that suppoert -std=c++17 but not constexpr if, which is a 17 feature. --- configure.ac | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/configure.ac b/configure.ac index ee623b050..21e905fe8 100755 --- a/configure.ac +++ b/configure.ac @@ -1993,6 +1993,31 @@ AC_LANG(C) AM_CONDITIONAL(HAVE_CXX17, test x$ac_have_cxx_17 = xyes) +AC_MSG_CHECKING([that C++ compiler supports constexpr if]) +AC_LANG(C++) +safe_CXXFLAGS=$CXXFLAGS +CXXFLAGS=-std=c++17 + +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +void f() +{ + if constexpr (true) + ; +} +])], +[ +ac_have_constexpr_if=yes +AC_MSG_RESULT([yes]) +], [ +ac_have_constexpr_if=no +AC_MSG_RESULT([no]) + ]) +CXXFLAGS=$safe_CXXFLAGS +AC_LANG(C) + +AM_CONDITIONAL(HAVE_CONSTEXPR_IF, test x$ac_have_constexpr_if = xyes) + + AC_MSG_CHECKING([that C++ compiler can include header file]) AC_LANG(C++) safe_CXXFLAGS=$CXXFLAGS From fb70453688f869ea553fe3ad4dd4adc0194d25b4 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 11 Sep 2025 07:22:58 +0200 Subject: [PATCH 269/412] configure: forgot the makefile that uses HAVE_CONSTEXPR_IF --- none/tests/arm64/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/none/tests/arm64/Makefile.am b/none/tests/arm64/Makefile.am index 95a74e2b8..4fa101d77 100644 --- a/none/tests/arm64/Makefile.am +++ b/none/tests/arm64/Makefile.am @@ -55,7 +55,7 @@ if HAVE_SHA3 check_PROGRAMS += sha512_v82 endif -if HAVE_CXX17 +if HAVE_CONSTEXPR_IF check_PROGRAMS += fcvta_s_u frinta_frintn endif From 909e93e343c7fbe37036cc164c62e365a2e0bc5b Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 11 Sep 2025 07:39:29 +0200 Subject: [PATCH 270/412] configure: add check for C++17 std::align_val_t Again for older compilers that claim C++17 but lack some features --- configure.ac | 23 +++++++++++++++++++++++ memcheck/tests/Makefile.am | 7 ++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 21e905fe8..9c6a4710d 100755 --- a/configure.ac +++ b/configure.ac @@ -1993,6 +1993,8 @@ AC_LANG(C) AM_CONDITIONAL(HAVE_CXX17, test x$ac_have_cxx_17 = xyes) +# Compiler may announce C++17 support as above but may lack +# some features AC_MSG_CHECKING([that C++ compiler supports constexpr if]) AC_LANG(C++) safe_CXXFLAGS=$CXXFLAGS @@ -2017,6 +2019,27 @@ AC_LANG(C) AM_CONDITIONAL(HAVE_CONSTEXPR_IF, test x$ac_have_constexpr_if = xyes) +AC_MSG_CHECKING([that C++ compiler supports std::align_val_t]) +AC_LANG(C++) +safe_CXXFLAGS=$CXXFLAGS +CXXFLAGS=-std=c++17 + +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +#include +std::align_val_t a; +])], +[ +ac_have_align_val_t=yes +AC_MSG_RESULT([yes]) +], [ +ac_have_align_val_t=no +AC_MSG_RESULT([no]) + ]) +CXXFLAGS=$safe_CXXFLAGS +AC_LANG(C) + +AM_CONDITIONAL(HAVE_ALIGN_VAL_T, test x$ac_have_align_val_t = xyes) + AC_MSG_CHECKING([that C++ compiler can include header file]) AC_LANG(C++) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 1a41734bd..3f193972d 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -635,9 +635,14 @@ check_PROGRAMS += reach_thread_register endif if HAVE_FSIZED_DEALLOCATION -check_PROGRAMS += sized_delete new_delete_mismatch_size +check_PROGRAMS += sized_delete endif +if HAVE_ALIGN_VAL_T +check_PROGRAMS += new_delete_mismatch_size +endif + + if HAVE_GNU_STPNCPY check_PROGRAMS += stpncpy endif From 51f5a56a66949b3fceab96a304598547c0f7ae08 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 11 Sep 2025 21:42:00 +0200 Subject: [PATCH 271/412] doc: Add a HOWTO for building tcmalloc to test C23 functions --- docs/internals/c23-functions-HOWTO.txt | 63 ++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 docs/internals/c23-functions-HOWTO.txt diff --git a/docs/internals/c23-functions-HOWTO.txt b/docs/internals/c23-functions-HOWTO.txt new file mode 100644 index 000000000..d3eecda2d --- /dev/null +++ b/docs/internals/c23-functions-HOWTO.txt @@ -0,0 +1,63 @@ +How to test new C23 functions +----------------------------- + +C23 adds some new 'free' functions, 'free_sized' which offers the possibility +of faster deallocation by providing the size of the allocation and +'free_aligned_sized', the same with the allocation alignment thrown in. +Here is roughly the draft that corresponds to the final standard +https://open-std.org/JTC1/SC22/WG14/www/docs/n3220.pdf. + +Memcheck does have support for these functions (and detects errors +when there is a mismatch between the size or alignment at allocation +and at deallocation). It seems as though library implementers are +being rather slow in providing implementations of these functions. +At the time of writing (Sept 2025) only tcmalloc seems to have done so. +snmalloc (not tested) does refer to free_sized in its source. + +Building tcmalloc +----------------- +There are 2 versions of tcmalloc (not counting the one used internally +by Google). One is part of Google perftools (pperf package on Fedora, +google-perftools package on FreeBSD). That's not the one that we want +(it's more oriented to some performance with options for performance +profiling of CPU and heap). The one that we want is just tcmalloc. +https://github.com/google/tcmalloc + +You will need to clone the above repo. tcmalloc uses bazel as its +build failure system. Helpfully you can't even build a usable +tcmalloc library out of the box. I had to apply this patch + +diff --git a/tcmalloc/BUILD b/tcmalloc/BUILD +index 6698b88c..69b2f531 100644 +--- a/tcmalloc/BUILD ++++ b/tcmalloc/BUILD +@@ -1578,3 +1578,11 @@ cc_library( + ], + deps = ["@com_google_absl//absl/base:core_headers"], + ) ++ ++cc_binary( ++ name = "libtcmalloc.so", ++ deps = [":tcmalloc"], ++ linkshared = 1, ++ copts = TCMALLOC_DEFAULT_COPTS, ++) ++ + +(found in the GH issues) and then run + +bazel build //tcmalloc:libtcmalloc.so + +Building a test executable +-------------------------- + +Assuming that you cloned tcmalloc in your home directory and that +you have a test harness called test.cpp you should be able to build +it with tcmalloc using + + g++ -g -o test test.cpp -I ${HOME}/tcmalloc/tcmalloc \ + -I ${HOME}/tcmalloc/bazel-tcmalloc/external/abseil-cpp+/ \ + -I tcmalloc/ -L ${HOME}/tcmalloc/bazel-bin/tcmalloc/ \ + -ltcmalloc -Wl,-rpath,${HOME}/tcmalloc/bazel-bin/tcmalloc + + I haven't tried to use LD_PRELOAD to simply replace libc.so for allocation. From e2378bed941bd1f0dbcc94ceecc91f23b6678f87 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 12 Sep 2025 09:21:17 +0200 Subject: [PATCH 272/412] FreeBSD regtest scalar: clean up inotify_rm_watch messages Had copied and pasted a 'sys_' prefix. --- memcheck/tests/freebsd/scalar.c | 4 ++-- memcheck/tests/freebsd/scalar.stderr.exp | 4 ++-- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index b4200f0ae..64d751e55 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -2547,10 +2547,10 @@ int main(void) SY(SYS_inotify_rm_watch, x0+1000, x0+1000); #else FAKE_GO("594: SYS_inotify_rm_watch 2s, 0m"); - FAKE_SY("Syscall param sys_inotify_rm_watch(fd) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param inotify_rm_watch(fd) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); - FAKE_SY("Syscall param sys_inotify_rm_watch(wd) contains uninitialised byte(s)\n"); + FAKE_SY("Syscall param inotify_rm_watch(wd) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); #endif diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 857ffceee..96715bfce 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -5819,10 +5819,10 @@ Syscall param inotify_add_watch_at(path) points to unaddressable byte(s) --------------------------------------------------------- 594: SYS_inotify_rm_watch 2s, 0m --------------------------------------------------------- -Syscall param sys_inotify_rm_watch(fd) contains uninitialised byte(s) +Syscall param inotify_rm_watch(fd) contains uninitialised byte(s) ... -Syscall param sys_inotify_rm_watch(wd) contains uninitialised byte(s) +Syscall param inotify_rm_watch(wd) contains uninitialised byte(s) ... --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 9b650198b..d2407017f 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -5891,10 +5891,10 @@ Syscall param inotify_add_watch_at(path) points to unaddressable byte(s) --------------------------------------------------------- 594: SYS_inotify_rm_watch 2s, 0m --------------------------------------------------------- -Syscall param sys_inotify_rm_watch(fd) contains uninitialised byte(s) +Syscall param inotify_rm_watch(fd) contains uninitialised byte(s) ... -Syscall param sys_inotify_rm_watch(wd) contains uninitialised byte(s) +Syscall param inotify_rm_watch(wd) contains uninitialised byte(s) ... --------------------------------------------------------- From c35d1db65eb728758ef63282fa77fd79d7ad0102 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 12 Sep 2025 09:49:02 +0200 Subject: [PATCH 273/412] FreeBSD regtest: add a prereq test to none/tests/freebsd/proc_pid_file This test only passes if /proc has been mounted. Don't run the test if there is no /proc. --- none/tests/freebsd/proc_pid_file.vgtest | 1 + 1 file changed, 1 insertion(+) diff --git a/none/tests/freebsd/proc_pid_file.vgtest b/none/tests/freebsd/proc_pid_file.vgtest index 0361a5982..bcbae3ad3 100644 --- a/none/tests/freebsd/proc_pid_file.vgtest +++ b/none/tests/freebsd/proc_pid_file.vgtest @@ -1,3 +1,4 @@ +prereq: test -d /proc prog: proc_pid_file vgopts: -q From 4b9d06bcde9935b3eae0307ec07fc1437a76e903 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 12 Sep 2025 07:52:55 +0200 Subject: [PATCH 274/412] Wrap the futex_waitv syscall Wrap the futex2/futex_waitv syscall: sys_futex_waitv(struct futex_waitv __user *, waiters, unsigned int, nr_futexes, unsigned int, flags, struct __kernel_timespec __user *, timeout, clockid_t, clockid) sys_futex_waitv - Wait on a list of futexes @waiters: List of futexes to wait on @nr_futexes: Length of futexv @flags: Flag for timeout (monotonic/realtime) @timeout: Optional absolute timeout. @clockid: Clock to be used for the timeout, realtime or monotonic. Given an array of `struct futex_waitv`, wait on each uaddr. The thread wakes if a futex_wake() is performed at any uaddr. The syscall returns immediately if any waiter has *uaddr != val. *timeout is an optional timeout value for the operation. Each waiter has individual flags. The `flags` argument for the syscall should be used solely for specifying the timeout as realtime, if needed. Flags for private futexes, sizes, etc. should be used on the individual flags of each waiter. Returns the array index of one of the woken futexes. No further information is provided. Declare a futex_waitv wrapper in priv_syswrap-linux.h and hook it for {amd64,arm,arm64,mips64,ppc32,ppc64,riscv64,s390x\ ,x86}- linux using LINX_ with PRE handler in syswrap-linux.c https://bugs.kde.org/show_bug.cgi?id=506816 --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 1 + coregrind/m_syswrap/syswrap-amd64-linux.c | 1 + coregrind/m_syswrap/syswrap-arm-linux.c | 1 + coregrind/m_syswrap/syswrap-arm64-linux.c | 1 + coregrind/m_syswrap/syswrap-linux.c | 12 ++++++++++++ coregrind/m_syswrap/syswrap-mips32-linux.c | 1 + coregrind/m_syswrap/syswrap-mips64-linux.c | 1 + coregrind/m_syswrap/syswrap-nanomips-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc32-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc64-linux.c | 1 + coregrind/m_syswrap/syswrap-riscv64-linux.c | 1 + coregrind/m_syswrap/syswrap-s390x-linux.c | 1 + coregrind/m_syswrap/syswrap-x86-linux.c | 1 + include/vki/vki-linux.h | 13 +++++++++++++ include/vki/vki-scnums-32bit-linux.h | 1 + include/vki/vki-scnums-amd64-linux.h | 1 + include/vki/vki-scnums-arm-linux.h | 1 + include/vki/vki-scnums-arm64-linux.h | 1 + include/vki/vki-scnums-ppc32-linux.h | 3 +++ include/vki/vki-scnums-ppc64-linux.h | 1 + include/vki/vki-scnums-riscv64-linux.h | 1 + include/vki/vki-scnums-s390x-linux.h | 1 + include/vki/vki-scnums-x86-linux.h | 1 + 24 files changed, 49 insertions(+) diff --git a/NEWS b/NEWS index 38c00488b..ff7d0ffc8 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506795 Better report which clone flags are problematic 506806 Fix execveat() with AT_FDCWD and relative path 506813 The execveat wrapper needs to do more checking +506816 futex2, futex_waitv WARNING: unhandled amd64-linux syscall: 449 506910 openat2 with RESOLVE_NO_MAGICLINKS succeeds on /proc/self/exe 506928 Wrap (deprecated) linux specific ustat syscall 506929 Wrap (deprecated) linux sysfs syscall diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 2fe8fd59d..1706af786 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -465,6 +465,7 @@ DECL_TEMPLATE(linux, sys_mq_timedreceive_time64); DECL_TEMPLATE(linux, sys_semtimedop_time64); DECL_TEMPLATE(linux, sys_rt_sigtimedwait_time64); DECL_TEMPLATE(linux, sys_futex_time64); +DECL_TEMPLATE(linux, sys_futex_waitv); DECL_TEMPLATE(linux, sys_sched_rr_get_interval_time64); // Some arch specific functions called from syswrap-linux.c diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index bb970b47d..c0d3637f7 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -901,6 +901,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + LINX_(__NR_futex_waitv, sys_futex_waitv), // 449 LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 043a4095c..42f795210 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -1070,6 +1070,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_futex_waitv, sys_futex_waitv), // 449 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index 71d1123d0..fd6ac23f7 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -852,6 +852,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + LINX_(__NR_futex_waitv, sys_futex_waitv), // 449 LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index e1450d886..cbb692db9 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -1854,6 +1854,18 @@ POST(sys_futex_time64) futex_post_helper (tid, arrghs, status); } +PRE(sys_futex_waitv) +{ + /* asmlinkage long sys_futex_waitv(struct futex_waitv __user *waiters, + * unsigned int nr_futexes, unsigned int flags, + * struct __kernel_timespec __user *timeout, clockid_t clockid); */ + *flags |= SfMayBlock; + PRINT("sys_futex_waitv ( %#" FMT_REGWORD "x, %ld, %ld, %#" FMT_REGWORD "x, %d )", + ARG1, SARG2, SARG3, ARG4, ARG5); + PRE_MEM_READ("sys_futex_waitv(waiters)", ARG1, sizeof(struct vki_futex_waitv) * ARG2); + PRE_MEM_READ("sys_futex_waitv(timeout)", ARG4, sizeof(struct vki__kernel_timespec)); +} + PRE(sys_set_robust_list) { PRINT("sys_set_robust_list ( %#" FMT_REGWORD "x, %" diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 09d292ea8..3020d15fe 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -1180,6 +1180,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 + LINX_(__NR_futex_waitv, sys_futex_waitv), // 449 LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 26ece232b..ec6e3fa14 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -818,6 +818,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY (__NR_statmount, sys_statmount), LINXY (__NR_listmount, sys_listmount), LINX_ (__NR_mseal, sys_mseal), + LINX_ (__NR_futex_waitv, sys_futex_waitv), }; SyscallTableEntry * ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index 17b39a89c..592d93d8f 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -845,6 +845,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY (__NR_statmount, sys_statmount), LINXY (__NR_listmount, sys_listmount), LINX_ (__NR_mseal, sys_mseal), + LINX_ (__NR_futex_waitv, sys_futex_waitv), }; SyscallTableEntry* ML_(get_linux_syscall_entry) (UInt sysno) diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index d8dbe7de6..2a7612ccc 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -1080,6 +1080,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 + LINX_(__NR_futex_waitv, sys_futex_waitv), // 449 LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 LINXY (__NR_statmount, sys_statmount), // 457 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 3e7a14e40..5b1b0c1af 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1054,6 +1054,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 + LINX_ (__NR_futex_waitv, sys_futex_waitv), // 449 LINXY (__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 LINXY (__NR_statmount, sys_statmount), // 457 diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index 987205319..a0655706b 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -598,6 +598,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), /* 445 */ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), /* 446 */ LINXY(__NR_memfd_secret, sys_memfd_secret), /* 447 */ + LINX_(__NR_futex_waitv, sys_futex_waitv), /* 449 */ LINXY(__NR_cachestat, sys_cachestat), /* 451 */ LINX_(__NR_fchmodat2, sys_fchmodat2), /* 452 */ LINXY(__NR_statmount, sys_statmount), /* 457 */ diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index 8ab81d593..5a68f14db 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -888,6 +888,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + LINX_ (__NR_futex_waitv, sys_futex_waitv), // 449 LINXY (__NR_cachestat, sys_cachestat), // 451 LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 LINXY (__NR_statmount, sys_statmount), // 457 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 7e68c4e0e..fb6adff11 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1675,6 +1675,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + LINX_(__NR_futex_waitv, sys_futex_waitv), // 449 LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 LINXY(__NR_statmount, sys_statmount), // 457 diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index 1e04bdd48..1b32295bf 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -1415,6 +1415,19 @@ struct vki_robust_list_head { struct vki_robust_list __user *list_op_pending; }; +/* Introduced in linux commit bf69bad38cf63d980e8a603f8d1bd1f85b5ed3d9 */ +struct vki_futex_waitv { + __vki_u64 val; + __vki_u64 uaddr; + __vki_u32 flags; + __vki_u32 __reserved; +}; + +struct vki__kernel_timespec { + long long tv_sec; + long long tv_nsec; +}; + //---------------------------------------------------------------------- // From linux-2.6.8.1/include/linux/errno.h //---------------------------------------------------------------------- diff --git a/include/vki/vki-scnums-32bit-linux.h b/include/vki/vki-scnums-32bit-linux.h index f276ddaed..ca0ff79bd 100644 --- a/include/vki/vki-scnums-32bit-linux.h +++ b/include/vki/vki-scnums-32bit-linux.h @@ -45,5 +45,6 @@ #define __NR_rt_sigtimedwait_time64 421 #define __NR_futex_time64 422 #define __NR_sched_rr_get_interval_time64 423 +#define __NR_futex_waitv 449 #endif diff --git a/include/vki/vki-scnums-amd64-linux.h b/include/vki/vki-scnums-amd64-linux.h index 65134734a..5e218a3ae 100644 --- a/include/vki/vki-scnums-amd64-linux.h +++ b/include/vki/vki-scnums-amd64-linux.h @@ -414,6 +414,7 @@ #define __NR_statx 332 #define __NR_io_pgetevents 333 #define __NR_rseq 334 +#define __NR_futex_waitv 449 #endif /* __VKI_SCNUMS_AMD64_LINUX_H */ diff --git a/include/vki/vki-scnums-arm-linux.h b/include/vki/vki-scnums-arm-linux.h index 485db8b26..44803bcb8 100644 --- a/include/vki/vki-scnums-arm-linux.h +++ b/include/vki/vki-scnums-arm-linux.h @@ -433,6 +433,7 @@ #define __NR_pkey_free 396 #define __NR_statx 397 #define __NR_rseq 398 +#define __NR_futex_waitv 449 diff --git a/include/vki/vki-scnums-arm64-linux.h b/include/vki/vki-scnums-arm64-linux.h index 08d569004..e2ac07625 100644 --- a/include/vki/vki-scnums-arm64-linux.h +++ b/include/vki/vki-scnums-arm64-linux.h @@ -325,6 +325,7 @@ #define __NR_statx 291 #define __NR_io_pgetevents 292 #define __NR_rseq 293 +#define __NR_futex_waitv 449 #undef __NR_syscalls #define __NR_syscalls 294 diff --git a/include/vki/vki-scnums-ppc32-linux.h b/include/vki/vki-scnums-ppc32-linux.h index 08fa77df0..d3ca94ebb 100644 --- a/include/vki/vki-scnums-ppc32-linux.h +++ b/include/vki/vki-scnums-ppc32-linux.h @@ -4,6 +4,8 @@ /*--- vki-scnums-ppc32-linux.h ---*/ /*--------------------------------------------------------------------*/ + + /* This file is part of Valgrind, a dynamic binary instrumentation framework. @@ -416,6 +418,7 @@ #define __NR_pkey_free 385 #define __NR_pkey_mprotect 386 #define __NR_rseq 387 +#define __NR_futex_waitv 449 #endif /* __VKI_SCNUMS_PPC32_LINUX_H */ diff --git a/include/vki/vki-scnums-ppc64-linux.h b/include/vki/vki-scnums-ppc64-linux.h index 6d8b2b508..4b42c60b5 100644 --- a/include/vki/vki-scnums-ppc64-linux.h +++ b/include/vki/vki-scnums-ppc64-linux.h @@ -409,6 +409,7 @@ #define __NR_pkey_mprotect 386 #define __NR_rseq 387 #define __NR_io_pgetevents 388 +#define __NR_futex_waitv 449 #endif /* __VKI_SCNUMS_PPC64_LINUX_H */ diff --git a/include/vki/vki-scnums-riscv64-linux.h b/include/vki/vki-scnums-riscv64-linux.h index f084cf44e..f30636f41 100644 --- a/include/vki/vki-scnums-riscv64-linux.h +++ b/include/vki/vki-scnums-riscv64-linux.h @@ -309,6 +309,7 @@ #define __NR_close_range 436 #define __NR_faccessat2 439 #define __NR_memfd_secret 447 +#define __NR_futex_waitv 449 #define __NR_fcntl __NR3264_fcntl #define __NR_statfs __NR3264_statfs diff --git a/include/vki/vki-scnums-s390x-linux.h b/include/vki/vki-scnums-s390x-linux.h index efb36b991..ad3647d23 100644 --- a/include/vki/vki-scnums-s390x-linux.h +++ b/include/vki/vki-scnums-s390x-linux.h @@ -346,6 +346,7 @@ #define __NR_kexec_file_load 381 #define __NR_io_pgetevents 382 #define __NR_rseq 383 +#define __NR_futex_waitv 449 #define NR_syscalls 384 diff --git a/include/vki/vki-scnums-x86-linux.h b/include/vki/vki-scnums-x86-linux.h index 5019321d3..4807c5daa 100644 --- a/include/vki/vki-scnums-x86-linux.h +++ b/include/vki/vki-scnums-x86-linux.h @@ -429,6 +429,7 @@ #define __NR_msgsnd 400 #define __NR_msgrcv 401 #define __NR_msgctl 402 +#define __NR_futex_waitv 449 #endif /* __VKI_SCNUMS_X86_LINUX_H */ From c2a174a4839b7cc16c29c46522b62c97d0ccacac Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 12 Sep 2025 14:10:01 +0000 Subject: [PATCH 275/412] s390: Improve guest_s390x_spechelper for S390_CC_OP_TEST_UNDER_MASK_8 Add missing cases. Tweak debug message. --- VEX/priv/guest_s390_helpers.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index 335a9060b..13ba153e0 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -1700,9 +1700,9 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args, # if 0 vex_printf("spec request:\n"); - vex_printf(" %s ", function_name); + vex_printf(" %s", function_name); for (i = 0; i < arity; i++) { - vex_printf(" "); + vex_printf(" [%u]: ", i); ppIRExpr(args[i]); } vex_printf("\n"); @@ -2049,6 +2049,22 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args, if (cond == 14 || cond == 14 - 2) { /* not all bits set */ return unop(Iop_1Uto32, binop(Iop_CmpNE64, cc_dep1, cc_dep2)); } + if (cond == 4 || cond == 4 + 2) { /* not all zero and not all one */ + return unop(Iop_1Uto32, binop(Iop_And1, + binop(Iop_CmpNE64, cc_dep1, cc_dep2), + binop(Iop_CmpNE64, cc_dep1, mkU64(0)))); + } + if (cond == 9 || cond == 9 + 2) { /* selected bits all 1 or all 0 */ + return unop(Iop_1Uto32, binop(Iop_Or1, + binop(Iop_CmpEQ64, cc_dep1, cc_dep2), + binop(Iop_CmpEQ64, cc_dep1, mkU64(0)))); + } + if (cond == 0 || cond == 0 + 2) { + return mkU32(0); + } + if (cond == 15 || cond == 15 - 2) { + return mkU32(1); + } goto missed; } From f278166485ffc98dc6f6d305e8726731ed972a35 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 12 Sep 2025 14:40:36 +0000 Subject: [PATCH 276/412] s390: Fix a confusing variable name. The mask is 8 bit wide here. --- VEX/priv/guest_s390_helpers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index 13ba153e0..d8aa191ca 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -2025,13 +2025,13 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args, cc_dep1 = the value to be tested, ANDed with the mask cc_dep2 = an 8-bit mask; expected to be a constant here */ if (cc_op == S390_CC_OP_TEST_UNDER_MASK_8) { - ULong mask16; + ULong mask8; if (! isC64(cc_dep2)) goto missed; - mask16 = cc_dep2->Iex.Const.con->Ico.U64; + mask8 = cc_dep2->Iex.Const.con->Ico.U64; - if (mask16 == 0) { /* cc == 0 */ + if (mask8 == 0) { /* cc == 0 */ if (cond & 0x8) return mkU32(1); return mkU32(0); } From 0d5ccba57365afe2810974119940d83a0c77c463 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 12 Sep 2025 21:06:25 +0200 Subject: [PATCH 277/412] docs: add internals files to EXTRA_DIST --- docs/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/Makefile.am b/docs/Makefile.am index 607e51494..8672e8dd2 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -46,10 +46,12 @@ EXTRA_DIST = \ internals/arm_thumb_notes_gdbserver.txt \ internals/avx-notes.txt \ internals/BIG_APP_NOTES.txt \ + internals/c23-functions-HOWTO.txt \ internals/Darwin-debug.txt \ internals/Darwin-notes.txt \ internals/SPEC-notes.txt \ internals/directory-structure.txt \ + internals/git-HOWTO.txt \ internals/howto_BUILD_KDE42.txt \ internals/howto_oprofile.txt \ internals/m_replacemalloc.txt \ @@ -66,6 +68,7 @@ EXTRA_DIST = \ internals/qemu-riscv64-linux-HOWTO.txt \ internals/register-uses.txt \ internals/s390-opcodes.csv \ + internals/svn-HOWTO.txt \ internals/release-HOWTO.txt \ internals/segments-seginfos.txt \ internals/t-chaining-notes.txt \ From a7e6c9e3383fc38d658e606d7378f542d2566229 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 12 Sep 2025 21:46:04 +0200 Subject: [PATCH 278/412] NEWS: add description of changes to UnsafeZeroSize errors --- NEWS | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/NEWS b/NEWS index ff7d0ffc8..1d09fa811 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,40 @@ X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux. and it will perform a vgdb attach and print the backtrace(s) of the guest executable. +* Memcheck handling of aligned allocation functions with a + size of zero has changed. + + Firstly, 'free_aligned_sized' with a size of + zero is no longer considered an error. This was intended so + that deallocation had the same behaviour as allocation. In + practice, platforms that allow aligned allocation with a + size of zero will already generate an error at allocation. + Other platforms will get an 'Invalid free' error. The case + where the allocation and deallocation sizes are different + with the deallocation size being zero is already covered by + "Mismatched [alloc/dealloc] size" errors. + + Secondly, the three C aligned allocation functions memalign, + aligned_alloc and posix_memalign have a different error + message if used with a size of zero. Previously the error + was "[function] invalid size value: [number]". This was an + overstatement of the issue. The problem is that such usage + is not portable across platforms. memalign and aligned_alloc + are poorly documented, saying things like "Behavior is undefined + if size is not an integral multiple of alignment.". Clearly + this does not include negative integers though it does not say + so explicitly. Does that include zero? posix_memalign is well documented + but says that using a size of 0 is implementation-defined. These + functions now produce an error + "Unsafe allocation with size of zero is implementation-defined". + + The associated suppression name has also changed from "BadSize" to + "UnsafeZeroSize". + + Checks for C23 free_sized and free_aligned_sized have been added to + Linux. Almost no libraries support these functions yes, with + the exception being Google tcmalloc. + * ==================== FIXED BUGS ==================== The following bugs have been fixed or resolved. Note that "n-i-bz" From 1cdfe37b4e3bf2abe0d770818ef5cebf98a7c0f9 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 12 Sep 2025 21:56:14 +0200 Subject: [PATCH 279/412] Suppresson name: keep 'BadSize' for backwards compatibility --- memcheck/mc_errors.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c index 657a11285..e34d4e9df 100644 --- a/memcheck/mc_errors.c +++ b/memcheck/mc_errors.c @@ -1603,7 +1603,8 @@ Bool MC_(is_recognised_suppression) ( const HChar* name, Supp* su ) else if (VG_STREQ(name, "FishyValue")) skind = FishyValueSupp; else if (VG_STREQ(name, "ReallocZero")) skind = ReallocSizeZeroSupp; else if (VG_STREQ(name, "BadAlign")) skind = BadAlignSupp; - else if (VG_STREQ(name, "UnsafeZeroSize")) skind = UnsafeZeroSizeSupp; + else if (VG_STREQ(name, "BadSize") || // old name for error before it got downgraded + VG_STREQ(name, "UnsafeZeroSize")) skind = UnsafeZeroSizeSupp; else if (VG_STREQ(name, "SizeMismatch")) skind = SizeMismatch; else if (VG_STREQ(name, "AlignMismatch")) skind = AlignMismatch; else From 11c0cb9765b68e2d384201cb58d7307c1acd17a1 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 13 Sep 2025 12:51:17 +0200 Subject: [PATCH 280/412] Darwin syscall: fix build with fd checks Missed a couple of places where there is a fd variable used in macros and function calls. --- coregrind/m_syswrap/syswrap-darwin.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index 761965d61..d6df8b996 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -9858,6 +9858,7 @@ POST(getattrlistbulk) PRE(faccessat) { + Int fd = ARG1; PRINT("faccessat(fd:%d, path:%#lx(%s), amode:%#lx, flag:%#lx)", fd, ARG2, ARG2 ? (HChar*)ARG2 : "null", ARG3, ARG4); PRE_REG_READ4(int, "faccessat", @@ -9868,6 +9869,7 @@ PRE(faccessat) PRE(fstatat64) { + Int fd = ARG1; PRINT("fstatat64(fd:%d, path:%#lx(%s), ub:%#lx, flag:%#lx)", fd, ARG2, ARG2 ? (HChar*)ARG2 : "null", ARG3, ARG4); PRE_REG_READ4(int, "fstatat64", From 84fc611c3e0223811ed2baf84075633e0a9860fd Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 13 Sep 2025 12:52:22 +0200 Subject: [PATCH 281/412] regtest: fix typo in Makefile.am This was causing build failures on macOS 10.13 --- memcheck/tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 3f193972d..6e3105a59 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -714,7 +714,7 @@ if HAVE_ALIGNED_CXX_ALLOC cxx17_aligned_new_SOURCES = cxx17_aligned_new.cpp cxx17_aligned_new_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 @FLAG_W_NO_MISMATCHED_NEW_DELETE@ duplicate_align_size_errors_SOURCES = duplicate_align_size_errors.cpp -duplicate_align_size_errors_CXXFLAFGS = ${AM_CXXFLAGS} -std=c++17 +duplicate_align_size_errors_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 new_aligned_delete_default_SOURCES = new_aligned_delete_default.cpp new_aligned_delete_default_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 sized_aligned_new_delete_args_SOURCES = sized_aligned_new_delete_args.cpp From 1362d79430a6661435e9451feeeba710f6366029 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 13 Sep 2025 23:52:34 +0200 Subject: [PATCH 282/412] regtest: use filter for operator new/delete on 32bit systems Size is unsigned long on 64 bit systems and unsigned int on 32 bit systems which shows up in the demangled names in the callstacks. --- memcheck/tests/duplicate_align_size_errors.vgtest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcheck/tests/duplicate_align_size_errors.vgtest b/memcheck/tests/duplicate_align_size_errors.vgtest index 44362003d..3e1d321d6 100644 --- a/memcheck/tests/duplicate_align_size_errors.vgtest +++ b/memcheck/tests/duplicate_align_size_errors.vgtest @@ -1,5 +1,5 @@ prog: duplicate_align_size_errors prereq: test -e ./duplicate_align_size_errors vgopts: --show-mismatched-frees=yes -q -#stderr_filter: filter_size_t +stderr_filter: filter_size_t From 5f5f92788f185a36c3a317c293ac7e266ee38ef0 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 13 Sep 2025 23:57:24 +0200 Subject: [PATCH 283/412] FreeBSD x86 regtest: add an expected for memcheck timerfd test Size differences in error messages. Hardly worth the bother to filter. --- memcheck/tests/freebsd/Makefile.am | 1 + memcheck/tests/freebsd/timerfd.stderr.exp-x86 | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 memcheck/tests/freebsd/timerfd.stderr.exp-x86 diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index bb5de145c..3bac5e73c 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -139,6 +139,7 @@ EXTRA_DIST = \ supponlyobj.supp \ timerfd.vgtest \ timerfd.stderr.exp \ + timerfd.stderr.exp-x86 \ timerfd.stdout.exp \ timing_safe.vgtest \ timing_safe.stderr.exp \ diff --git a/memcheck/tests/freebsd/timerfd.stderr.exp-x86 b/memcheck/tests/freebsd/timerfd.stderr.exp-x86 new file mode 100644 index 000000000..708e50b16 --- /dev/null +++ b/memcheck/tests/freebsd/timerfd.stderr.exp-x86 @@ -0,0 +1,40 @@ +Syscall param timerfd_create(clockid) contains uninitialised byte(s) + at 0x........: timerfd_create (in /...libc...) + by 0x........: main (timerfd.c:115) + +Syscall param timerfd_create(flags) contains uninitialised byte(s) + at 0x........: timerfd_create (in /...libc...) + by 0x........: main (timerfd.c:115) + +Syscall param timerfd_gettime(curr_value) points to unaddressable byte(s) + at 0x........: timerfd_gettime (in /...libc...) + by 0x........: main (timerfd.c:124) + Address 0x........ is 0 bytes after a block of size 14 alloc'd + at 0x........: malloc (vg_replace_malloc.c:...) + by 0x........: main (timerfd.c:108) + +Syscall param timerfd_settime(flags) contains uninitialised byte(s) + at 0x........: timerfd_settime (in /...libc...) + by 0x........: main (timerfd.c:130) + +Syscall param timerfd_settime(old_value) points to unaddressable byte(s) + at 0x........: timerfd_settime (in /...libc...) + by 0x........: main (timerfd.c:134) + Address 0x........ is 0 bytes after a block of size 14 alloc'd + at 0x........: malloc (vg_replace_malloc.c:...) + by 0x........: main (timerfd.c:109) + +Syscall param timerfd_gettime(fd) contains uninitialised byte(s) + at 0x........: timerfd_gettime (in /...libc...) + by 0x........: main (timerfd.c:139) + +Syscall param timerfd_settime(fd) contains uninitialised byte(s) + at 0x........: timerfd_settime (in /...libc...) + by 0x........: main (timerfd.c:141) + +FILE DESCRIPTORS: 4 open (3 inherited) at exit. +Open file descriptor 3: + at 0x........: timerfd_create (in /...libc...) + by 0x........: main (timerfd.c:115) + + From 9e83bd224f473d44b80c10afe3e5d59724f51985 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 13 Sep 2025 22:08:03 +0200 Subject: [PATCH 284/412] Bug 380269 - [PATCH] No multithreading in macOS Sierra (10.12) The patches were mostly applied, and now everything is. --- coregrind/m_syswrap/syswrap-amd64-darwin.c | 8 +++++--- coregrind/m_syswrap/syswrap-darwin.c | 16 +++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-amd64-darwin.c b/coregrind/m_syswrap/syswrap-amd64-darwin.c index 6227352ee..b2eb17f77 100644 --- a/coregrind/m_syswrap/syswrap-amd64-darwin.c +++ b/coregrind/m_syswrap/syswrap-amd64-darwin.c @@ -476,15 +476,14 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, /* For whatever reason, tst->os_state.pthread appear to have a constant offset of 96 on 10.7, but zero on 10.6 and 10.5. No idea why. */ -# if DARWIN_VERS <= DARWIN_10_6 +# if DARWIN_VERS <= DARWIN_10_6 || DARWIN_VERS == DARWIN_10_13 UWord magic_delta = 0; # elif DARWIN_VERS == DARWIN_10_7 || DARWIN_VERS == DARWIN_10_8 UWord magic_delta = 0x60; # elif DARWIN_VERS == DARWIN_10_9 \ || DARWIN_VERS == DARWIN_10_10 \ || DARWIN_VERS == DARWIN_10_11 \ - || DARWIN_VERS == DARWIN_10_12 \ - || DARWIN_VERS == DARWIN_10_13 + || DARWIN_VERS == DARWIN_10_12 UWord magic_delta = 0xE0; # else # error "magic_delta: to be computed on new OS version" @@ -528,6 +527,9 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, vex->guest_R8 = reuse; vex->guest_R9 = 0; vex->guest_RSP = sp; +#if DARWIN_VERS >= DARWIN_10_12 + vex->guest_GS_CONST = self + pthread_tsd_offset; +#endif stacksize = 512*1024; // wq stacks are always DEFAULT_STACK_SIZE stack = VG_PGROUNDUP(sp) - stacksize; diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index d6df8b996..2e1ba1da8 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -2085,18 +2085,18 @@ PRE(bsdthread_register) pthread_starter = ARG1; wqthread_starter = ARG2; pthread_structsize = ARG3; - #if DARWIN_VERS >= DARWIN_10_12 - typedef struct { +#if DARWIN_VERS >= DARWIN_10_12 + typedef struct { uint64_t version; uint64_t dispatch_queue_offset; uint64_t main_qos; uint32_t tsd_offset; uint32_t return_to_kernel_offset; uint32_t mach_thread_self_offset; - } __attribute__ ((packed)) _pthread_registration_data; + } __attribute__ ((packed)) _pthread_registration_data; - pthread_tsd_offset = ((_pthread_registration_data*) ARG4)->tsd_offset; - #endif + pthread_tsd_offset = ((_pthread_registration_data*) ARG4)->tsd_offset; +#endif ARG1 = (Word)&pthread_hijack_asm; ARG2 = (Word)&wqthread_hijack_asm; } @@ -2142,6 +2142,7 @@ PRE(workq_ops) // GrP fixme need anything here? // GrP fixme may block? break; + case VKI_WQOPS_THREAD_KEVENT_RETURN: case VKI_WQOPS_THREAD_RETURN: { // The interesting case. The kernel will do one of two things: // 1. Return normally. We continue; libc proceeds to stop the thread. @@ -2171,10 +2172,6 @@ PRE(workq_ops) // JRS uh, looks like it queues up a bunch of threads, or some such? *flags |= SfMayBlock; // the kernel sources take a spinlock, so play safe break; - case VKI_WQOPS_THREAD_KEVENT_RETURN: - // RK fixme need anything here? - // perhaps similar to VKI_WQOPS_THREAD_RETURN above? - break; case VKI_WQOPS_SET_EVENT_MANAGER_PRIORITY: // RK fixme this just sets scheduling priorities - don't think we need // to do anything here @@ -10487,6 +10484,7 @@ PRE(openat_nocancel) /* Otherwise handle normally */ *flags |= SfMayBlock; } + POST(openat_nocancel) { vg_assert(SUCCESS); From 26e55a92249edd375248f935eb0e0760aa4342f1 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sat, 13 Sep 2025 21:05:15 +0000 Subject: [PATCH 285/412] s390: Improve guest_s390x_spechelper for S390_CC_OP_TEST_UNDER_MASK_16 Add missing cases. #fixs390 -= 1 --- VEX/priv/guest_s390_helpers.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index d8aa191ca..5bfd5eb3f 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -2114,6 +2114,17 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args, if (cond == 14) { /* not all bits set */ return unop(Iop_1Uto32, binop(Iop_CmpNE64, val, mkU64(mask))); } + if (cond == 9) { /* selected bits all 1 or all 0 */ + return unop(Iop_1Uto32, binop(Iop_Or1, + binop(Iop_CmpEQ64, cc_dep1, cc_dep2), + binop(Iop_CmpEQ64, cc_dep1, mkU64(0)))); + } + if (cond == 6) { /* not all zero and not all one */ + return unop(Iop_1Uto32, binop(Iop_And1, + binop(Iop_CmpNE64, cc_dep1, cc_dep2), + binop(Iop_CmpNE64, cc_dep1, mkU64(0)))); + } + if (cond == 0) return mkU32(0); IRExpr *masked_msb = binop(Iop_And64, val, mkU64(msb)); @@ -2158,8 +2169,22 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args, binop(Iop_CmpEQ64, masked_msb, mkU64(0)), binop(Iop_CmpEQ64, val, mkU64(mask)))); } - // fixs390: handle cond = 5,6,9,10 (the missing cases) - // vex_printf("TUM mask = 0x%llx\n", mask16); + if (cond == 5) { /* cc == 1 || cc == 3 */ + /* mixed and leftmost bit zero or all bits set */ + IRExpr *cc1 = binop(Iop_And1, + binop(Iop_CmpEQ64, masked_msb, mkU64(0)), + binop(Iop_CmpNE64, val, mkU64(0))); + IRExpr *cc3 = binop(Iop_CmpEQ64, val, mkU64(mask)); + return unop(Iop_1Uto32, binop(Iop_Or1, cc1, cc3)); + } + if (cond == 10) { /* cc == 0 || cc == 2 */ + /* all bits zero or mixed and leftmost bit one */ + IRExpr *cc0 = binop(Iop_CmpEQ64, val, mkU64(0)); + IRExpr *cc2 = binop(Iop_And1, + binop(Iop_CmpNE64, masked_msb, mkU64(0)), + binop(Iop_CmpNE64, val, mkU64(mask))); + return unop(Iop_1Uto32, binop(Iop_Or1, cc0, cc2)); + } goto missed; } From 1c123a757c2d4afcf31aab5268587ebaad7c656d Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 14 Sep 2025 17:36:26 +0200 Subject: [PATCH 286/412] build warning: silence a warning and correct a comment referring to the wrong system header --- coregrind/m_syswrap/syswrap-linux.c | 4 ++-- include/vki/vki-freebsd.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index cbb692db9..9333dfde1 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -1860,8 +1860,8 @@ PRE(sys_futex_waitv) * unsigned int nr_futexes, unsigned int flags, * struct __kernel_timespec __user *timeout, clockid_t clockid); */ *flags |= SfMayBlock; - PRINT("sys_futex_waitv ( %#" FMT_REGWORD "x, %ld, %ld, %#" FMT_REGWORD "x, %d )", - ARG1, SARG2, SARG3, ARG4, ARG5); + PRINT("sys_futex_waitv ( %#" FMT_REGWORD "x, %ld, %ld, %#" FMT_REGWORD "x, %" FMT_REGWORD "d )", + ARG1, SARG2, SARG3, ARG4, SARG5); PRE_MEM_READ("sys_futex_waitv(waiters)", ARG1, sizeof(struct vki_futex_waitv) * ARG2); PRE_MEM_READ("sys_futex_waitv(timeout)", ARG4, sizeof(struct vki__kernel_timespec)); } diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index 1a371245f..ee4748c28 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -3268,7 +3268,7 @@ union vki_ccb { #define VKI_CAMIOCOMMAND _VKI_IOWR(VKI_CAM_VERSION, 2, union vki_ccb) //---------------------------------------------------------------------- -// From cam/scsi/scsi_all.h +// From sys/ucred,h //---------------------------------------------------------------------- struct vki_setcred { vki_uid_t sc_uid; /* effective user id */ From 7fba6571c830e218585271a0b8ba842120756dd7 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 16 Sep 2025 01:03:38 +0200 Subject: [PATCH 287/412] Add bug 508145 to NEWS Fixed in commit 78fe3625f6b8 Add ppc64le linux hardwire for ld64.so.2 strcmp --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 1d09fa811..04a30c9b9 100644 --- a/NEWS +++ b/NEWS @@ -124,6 +124,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 508029 Review the vmsplice syscall wrapper 508030 Add several missing syscall hooks to ppc64-linux 508093 VALGRIND_CLO_CHANGE does not update vex_control +508145 ppc64le needs ld.so hardwire for strcmp 508154 PRE(sys_fchownat) not handling VKI_AT_FDCWD 508638 Self-hosting not working on FreeBSD 508777 amd64-linux: add minimal scalar test From 6ac493c0ea305b2f7645c86ae0b0318db0fbf3e3 Mon Sep 17 00:00:00 2001 From: Andreas Arnez Date: Mon, 15 Sep 2025 15:39:11 +0200 Subject: [PATCH 288/412] Bug 509517 - s390x: Fix even/odd lane confusion for VME etc. Fix the swapping of even/odd IROps generation in guest_s390_toIR.c for VME, VMO, VMLE, VMLO, VMAE, VMAO, VMALE, and VMALO. Adjust the code generation for the according IROps to match the documentation in libvex_ir.h. --- VEX/priv/guest_s390_toIR.c | 64 +++++++++++++++++++------------------- VEX/priv/host_s390_defs.c | 24 +++++++------- VEX/priv/host_s390_defs.h | 4 +-- VEX/priv/host_s390_isel.c | 12 +++---- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index f40cd15e8..1f18fee66 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -18431,25 +18431,25 @@ s390_irgen_VMH(UChar v1, UChar v2, UChar v3, UChar m4) } static const HChar * -s390_irgen_VME(UChar v1, UChar v2, UChar v3, UChar m4) +s390_irgen_VMO(UChar v1, UChar v2, UChar v3, UChar m4) { - s390_insn_assert("vme", m4 <= 2); + s390_insn_assert("vmo", m4 <= 2); const IROp ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8, Iop_MullEven32Sx4 }; put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); - return "vme"; + return "vmo"; } static const HChar * -s390_irgen_VMLE(UChar v1, UChar v2, UChar v3, UChar m4) +s390_irgen_VMLO(UChar v1, UChar v2, UChar v3, UChar m4) { - s390_insn_assert("vmle", m4 <= 2); + s390_insn_assert("vmlo", m4 <= 2); const IROp ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8, Iop_MullEven32Ux4 }; put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); - return "vmle"; + return "vmlo"; } static const HChar * @@ -18853,43 +18853,43 @@ s390_irgen_VSRD(UChar v1, UChar v2, UChar v3, UChar i4) } static const HChar * -s390_irgen_VMO(UChar v1, UChar v2, UChar v3, UChar m4) +s390_irgen_VME(UChar v1, UChar v2, UChar v3, UChar m4) { - s390_insn_assert("vmo", m4 <= 2); + s390_insn_assert("vme", m4 <= 2); const IROp ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8, Iop_MullEven32Sx4 }; UChar shifts[] = { 8, 16, 32 }; IRExpr* result = binop(ops[m4], - binop(Iop_ShlV128, get_vr_qw(v2), mkU8(shifts[m4])), - binop(Iop_ShlV128, get_vr_qw(v3), mkU8(shifts[m4])) + binop(Iop_ShrV128, get_vr_qw(v2), mkU8(shifts[m4])), + binop(Iop_ShrV128, get_vr_qw(v3), mkU8(shifts[m4])) ); put_vr_qw(v1, result); - return "vmo"; + return "vme"; } static const HChar * -s390_irgen_VMLO(UChar v1, UChar v2, UChar v3, UChar m4) +s390_irgen_VMLE(UChar v1, UChar v2, UChar v3, UChar m4) { - s390_insn_assert("vmlo", m4 <= 2); + s390_insn_assert("vmle", m4 <= 2); const IROp ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8, Iop_MullEven32Ux4 }; UChar shifts[] = { 8, 16, 32 }; IRExpr* result = binop(ops[m4], - binop(Iop_ShlV128, get_vr_qw(v2), mkU8(shifts[m4])), - binop(Iop_ShlV128, get_vr_qw(v3), mkU8(shifts[m4])) + binop(Iop_ShrV128, get_vr_qw(v2), mkU8(shifts[m4])), + binop(Iop_ShrV128, get_vr_qw(v3), mkU8(shifts[m4])) ); put_vr_qw(v1, result); - return "vmlo"; + return "vmle"; } static const HChar * -s390_irgen_VMAE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) +s390_irgen_VMAO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { - s390_insn_assert("vmae", m5 <= 2); + s390_insn_assert("vmao", m5 <= 2); const IROp mul_ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8, Iop_MullEven32Sx4 }; @@ -18899,13 +18899,13 @@ s390_irgen_VMAE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) IRExpr* result = binop(add_ops[m5], mul_result, get_vr_qw(v4)); put_vr_qw(v1, result); - return "vmae"; + return "vmao"; } static const HChar * -s390_irgen_VMALE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) +s390_irgen_VMALO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { - s390_insn_assert("vmale", m5 <= 2); + s390_insn_assert("vmalo", m5 <= 2); const IROp mul_ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8, Iop_MullEven32Ux4 }; @@ -18915,13 +18915,13 @@ s390_irgen_VMALE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) IRExpr* result = binop(add_ops[m5], mul_result, get_vr_qw(v4)); put_vr_qw(v1, result); - return "vmale"; + return "vmalo"; } static const HChar * -s390_irgen_VMAO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) +s390_irgen_VMAE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { - s390_insn_assert("vmao", m5 <= 2); + s390_insn_assert("vmae", m5 <= 2); const IROp mul_ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8, Iop_MullEven32Sx4 }; @@ -18930,18 +18930,18 @@ s390_irgen_VMAO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) IRExpr* mul_result = binop(mul_ops[m5], - binop(Iop_ShlV128, get_vr_qw(v2), mkU8(shifts[m5])), - binop(Iop_ShlV128, get_vr_qw(v3), mkU8(shifts[m5]))); + binop(Iop_ShrV128, get_vr_qw(v2), mkU8(shifts[m5])), + binop(Iop_ShrV128, get_vr_qw(v3), mkU8(shifts[m5]))); IRExpr* result = binop(add_ops[m5], mul_result, get_vr_qw(v4)); put_vr_qw(v1, result); - return "vmao"; + return "vmae"; } static const HChar * -s390_irgen_VMALO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) +s390_irgen_VMALE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { - s390_insn_assert("vmalo", m5 <= 2); + s390_insn_assert("vmale", m5 <= 2); const IROp mul_ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8, Iop_MullEven32Ux4 }; @@ -18949,16 +18949,16 @@ s390_irgen_VMALO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) UChar shifts[] = { 8, 16, 32 }; IRExpr* mul_result = binop(mul_ops[m5], - binop(Iop_ShlV128, + binop(Iop_ShrV128, get_vr_qw(v2), mkU8(shifts[m5])), - binop(Iop_ShlV128, + binop(Iop_ShrV128, get_vr_qw(v3), mkU8(shifts[m5])) ); IRExpr* result = binop(add_ops[m5], mul_result, get_vr_qw(v4)); put_vr_qw(v1, result); - return "vmalo"; + return "vmale"; } static const HChar * diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index c79aa11c0..a3b91071d 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -6083,21 +6083,21 @@ s390_emit_VML(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4) } static UChar * -s390_emit_VME(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4) +s390_emit_VMO(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - S390_DISASM(XMNM("vme", va_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4)); + S390_DISASM(XMNM("vmo", va_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4)); - return emit_VRR_VVVM(p, 0xE700000000a6ULL, v1, v2, v3, m4); + return emit_VRR_VVVM(p, 0xE700000000a7ULL, v1, v2, v3, m4); } static UChar * -s390_emit_VMLE(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4) +s390_emit_VMLO(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - S390_DISASM(XMNM("vmle", va_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4)); + S390_DISASM(XMNM("vmlo", va_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4)); - return emit_VRR_VVVM(p, 0xE700000000a4ULL, v1, v2, v3, m4); + return emit_VRR_VVVM(p, 0xE700000000a5ULL, v1, v2, v3, m4); } static UChar * @@ -8208,8 +8208,8 @@ s390_insn_as_string(const s390_insn *insn) case S390_VEC_INT_MUL_HIGHS: op = "v-vintmulhis"; break; case S390_VEC_INT_MUL_HIGHU: op = "v-vintmulhiu"; break; case S390_VEC_INT_MUL_LOW: op = "v-vintmullo"; break; - case S390_VEC_INT_MUL_EVENS: op = "v-vintmulevens"; break; - case S390_VEC_INT_MUL_EVENU: op = "v-vintmulevenu"; break; + case S390_VEC_INT_MUL_ODDS: op = "v-vintmulodds"; break; + case S390_VEC_INT_MUL_ODDU: op = "v-vintmuloddu"; break; case S390_VEC_ELEM_SHL_V: op = "v-velemshl"; break; case S390_VEC_ELEM_SHRA_V: op = "v-vshrav"; break; case S390_VEC_ELEM_SHRL_V: op = "v-vshrlv"; break; @@ -11523,10 +11523,10 @@ s390_insn_vec_binop_emit(UChar *buf, const s390_insn *insn) return s390_emit_VMLH(buf, v1, v2, v3, s390_getM_from_size(size)); case S390_VEC_INT_MUL_LOW: return s390_emit_VML(buf, v1, v2, v3, s390_getM_from_size(size)); - case S390_VEC_INT_MUL_EVENS: - return s390_emit_VME(buf, v1, v2, v3, s390_getM_from_size(size)); - case S390_VEC_INT_MUL_EVENU: - return s390_emit_VMLE(buf, v1, v2, v3, s390_getM_from_size(size)); + case S390_VEC_INT_MUL_ODDS: + return s390_emit_VMO(buf, v1, v2, v3, s390_getM_from_size(size)); + case S390_VEC_INT_MUL_ODDU: + return s390_emit_VMLO(buf, v1, v2, v3, s390_getM_from_size(size)); case S390_VEC_ELEM_SHL_V: return s390_emit_VESLV(buf, v1, v2, v3, s390_getM_from_size(size)); case S390_VEC_ELEM_SHRA_V: diff --git a/VEX/priv/host_s390_defs.h b/VEX/priv/host_s390_defs.h index ddbaed5fe..87726c3e5 100644 --- a/VEX/priv/host_s390_defs.h +++ b/VEX/priv/host_s390_defs.h @@ -382,8 +382,8 @@ typedef enum { S390_VEC_INT_MUL_HIGHS, S390_VEC_INT_MUL_HIGHU, S390_VEC_INT_MUL_LOW, - S390_VEC_INT_MUL_EVENS, - S390_VEC_INT_MUL_EVENU, + S390_VEC_INT_MUL_ODDS, + S390_VEC_INT_MUL_ODDU, S390_VEC_ELEM_SHL_V, S390_VEC_ELEM_SHRA_V, S390_VEC_ELEM_SHRL_V, diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c index c4e9ee764..cf0a0a7ee 100644 --- a/VEX/priv/host_s390_isel.c +++ b/VEX/priv/host_s390_isel.c @@ -4503,27 +4503,27 @@ s390_isel_vec_expr_wrk(ISelEnv *env, IRExpr *expr) case Iop_MullEven8Sx16: size = 1; - vec_binop = S390_VEC_INT_MUL_EVENS; + vec_binop = S390_VEC_INT_MUL_ODDS; goto Iop_VV_wrk; case Iop_MullEven8Ux16: size = 1; - vec_binop = S390_VEC_INT_MUL_EVENU; + vec_binop = S390_VEC_INT_MUL_ODDU; goto Iop_VV_wrk; case Iop_MullEven16Sx8: size = 2; - vec_binop = S390_VEC_INT_MUL_EVENS; + vec_binop = S390_VEC_INT_MUL_ODDS; goto Iop_VV_wrk; case Iop_MullEven16Ux8: size = 2; - vec_binop = S390_VEC_INT_MUL_EVENU; + vec_binop = S390_VEC_INT_MUL_ODDU; goto Iop_VV_wrk; case Iop_MullEven32Sx4: size = 4; - vec_binop = S390_VEC_INT_MUL_EVENS; + vec_binop = S390_VEC_INT_MUL_ODDS; goto Iop_VV_wrk; case Iop_MullEven32Ux4: size = 4; - vec_binop = S390_VEC_INT_MUL_EVENU; + vec_binop = S390_VEC_INT_MUL_ODDU; goto Iop_VV_wrk; case Iop_Shl8x16: From 5deca19cc5fe426f5477396fab0838c3a655ffcc Mon Sep 17 00:00:00 2001 From: Andreas Arnez Date: Wed, 10 Sep 2025 19:05:40 +0200 Subject: [PATCH 289/412] Bug 509517 - s390x: Add even/odd-lane memcheck test for VME etc. Add an s390x-specific memcheck test case for the correct handling of even/odd lanes with various vector insns. The test fails before applying the fix for Bug 509517 and succeeds afterwards. --- .gitignore | 1 + NEWS | 1 + memcheck/tests/s390x/Makefile.am | 2 +- memcheck/tests/s390x/vme.c | 101 ++++++++++++++++++++++++++++ memcheck/tests/s390x/vme.stderr.exp | 30 +++++++++ memcheck/tests/s390x/vme.stdout.exp | 0 memcheck/tests/s390x/vme.vgtest | 2 + 7 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 memcheck/tests/s390x/vme.c create mode 100644 memcheck/tests/s390x/vme.stderr.exp create mode 100644 memcheck/tests/s390x/vme.stdout.exp create mode 100644 memcheck/tests/s390x/vme.vgtest diff --git a/.gitignore b/.gitignore index 4eb477c08..9fb56ba0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1270,6 +1270,7 @@ /memcheck/tests/s390x/cu42 /memcheck/tests/s390x/ltgjhe /memcheck/tests/s390x/tmxx +/memcheck/tests/s390x/vme /memcheck/tests/s390x/vstrc /memcheck/tests/s390x/vfae /memcheck/tests/s390x/vistr diff --git a/NEWS b/NEWS index 04a30c9b9..7940ab4a0 100644 --- a/NEWS +++ b/NEWS @@ -136,6 +136,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509107 memcheck/tests/duplicate_align_size_errors.cpp fails 509139 Update BadSize error messages 509258 FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers +509517 s390x: Even/odd lane confusion in various vector insns To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/memcheck/tests/s390x/Makefile.am b/memcheck/tests/s390x/Makefile.am index 32a898ca5..580fc1ee9 100644 --- a/memcheck/tests/s390x/Makefile.am +++ b/memcheck/tests/s390x/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/Makefile.tool-tests.am dist_noinst_SCRIPTS = filter_stderr -INSN_TESTS = cdsg cli cu21 cu42 ltgjhe tmxx vstrc vfae vistr vstrs +INSN_TESTS = cdsg cli cu21 cu42 ltgjhe tmxx vstrc vfae vistr vstrs vme check_PROGRAMS = $(INSN_TESTS) diff --git a/memcheck/tests/s390x/vme.c b/memcheck/tests/s390x/vme.c new file mode 100644 index 000000000..1e29b0988 --- /dev/null +++ b/memcheck/tests/s390x/vme.c @@ -0,0 +1,101 @@ +#define VECTOR __attribute__((vector_size(16))) + +typedef unsigned char VECTOR uchar_v; + +volatile char tmp; +static const char use_idx[] = "01234567890abcdefghijklmnopqrstu"; + +static void depend_on(uchar_v v) +{ + int val = 0; + for (int i = 0; i < 16; i++) + val += v[i]; + tmp = use_idx[val & 31]; +} + +static void pretend_write(uchar_v* v) { __asm__("" : "=m"(*v) : :); } + +enum evenodd { even, odd }; + +static uchar_v +init_vec(uchar_v v, unsigned char es, enum evenodd e, unsigned char val) +{ + int mask = 1 << es; + int last = (mask - 1) & 15; + + for (int i = 0; i < 16; i++) { + if ((i & mask) == (e == even ? 0 : mask)) + v[i] = ((i & last) == last) ? val : 0; + } + return v; +} + +#define GEN_TEST2(mnem, es) \ + static void test_##mnem##_##es(uchar_v x, enum evenodd e) \ + { \ + uchar_v res; \ + uchar_v a = init_vec(x, es, e, 2); \ + uchar_v b = init_vec(x, es, e, 3); \ + __asm__(#mnem " %[v1],%[v2],%[v3]," #es \ + : [v1] "=v"(res) \ + : [v2] "v"(a), [v3] "v"(b)); \ + depend_on(res); \ + } + +#define GEN_TEST3(mnem, es) \ + static void test_##mnem##_##es(uchar_v x, enum evenodd e) \ + { \ + uchar_v z = { 0 }; \ + uchar_v res; \ + uchar_v a = init_vec(x, es, e, 2); \ + uchar_v b = init_vec(x, es, e, 3); \ + uchar_v c = init_vec(z, es, e, 4); \ + __asm__(#mnem " %[v1],%[v2],%[v3],%[v4]," #es \ + : [v1] "=v"(res) \ + : [v2] "v"(a), [v3] "v"(b), [v4] "v"(c)); \ + depend_on(res); \ + } + +GEN_TEST2(vme, 0) +GEN_TEST2(vme, 1) +GEN_TEST2(vme, 2) +GEN_TEST2(vmo, 2) +GEN_TEST2(vmle, 1) +GEN_TEST2(vmlo, 2) + +GEN_TEST3(vmae, 0) +GEN_TEST3(vmale, 1) +GEN_TEST3(vmao, 2) +GEN_TEST3(vmalo, 2) + +static void do_valid(uchar_v x) +{ + test_vme_0(x, even); + test_vme_1(x, even); + test_vme_2(x, even); + test_vmo_2(x, odd); + test_vmle_1(x, even); + test_vmlo_2(x, odd); + test_vmae_0(x, even); + test_vmale_1(x, even); + test_vmao_2(x, odd); + test_vmalo_2(x, odd); +} + +static void do_invalid(uchar_v x) +{ + test_vme_0(x, odd); + test_vme_1(x, odd); + test_vme_2(x, odd); + test_vmo_2(x, even); + test_vmale_1(x, odd); +} + +int main(void) +{ + uchar_v x; + pretend_write(&x); + do_valid(x); + do_invalid(x); + return 0; +} diff --git a/memcheck/tests/s390x/vme.stderr.exp b/memcheck/tests/s390x/vme.stderr.exp new file mode 100644 index 000000000..a66b80b5d --- /dev/null +++ b/memcheck/tests/s390x/vme.stderr.exp @@ -0,0 +1,30 @@ +Use of uninitialised value of size 8 + at 0x........: depend_on (vme.c:13) + by 0x........: test_vme_0 (vme.c:59) + by 0x........: do_invalid (vme.c:87) + by 0x........: main (vme.c:99) + +Use of uninitialised value of size 8 + at 0x........: depend_on (vme.c:13) + by 0x........: test_vme_1 (vme.c:60) + by 0x........: do_invalid (vme.c:88) + by 0x........: main (vme.c:99) + +Use of uninitialised value of size 8 + at 0x........: depend_on (vme.c:13) + by 0x........: test_vme_2 (vme.c:61) + by 0x........: do_invalid (vme.c:89) + by 0x........: main (vme.c:99) + +Use of uninitialised value of size 8 + at 0x........: depend_on (vme.c:13) + by 0x........: test_vmo_2 (vme.c:62) + by 0x........: do_invalid (vme.c:90) + by 0x........: main (vme.c:99) + +Use of uninitialised value of size 8 + at 0x........: depend_on (vme.c:13) + by 0x........: test_vmale_1 (vme.c:67) + by 0x........: do_invalid (vme.c:91) + by 0x........: main (vme.c:99) + diff --git a/memcheck/tests/s390x/vme.stdout.exp b/memcheck/tests/s390x/vme.stdout.exp new file mode 100644 index 000000000..e69de29bb diff --git a/memcheck/tests/s390x/vme.vgtest b/memcheck/tests/s390x/vme.vgtest new file mode 100644 index 000000000..b35858ea6 --- /dev/null +++ b/memcheck/tests/s390x/vme.vgtest @@ -0,0 +1,2 @@ +prog: vme +vgopts: -q From c70ec7acc0c628c47b188e84f1fe8dc4a130c6ec Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 14 Sep 2025 10:03:28 +0000 Subject: [PATCH 290/412] FreeBSD regtest: correct scalar inotify_add_watch_at The syscall has 4 args and I had only used 3 in scalar.c. --- memcheck/tests/freebsd/scalar.c | 4 ++-- memcheck/tests/freebsd/scalar.stderr.exp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index 64d751e55..b31df32fc 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -2522,8 +2522,8 @@ int main(void) /* SYS_inotify_add_watch_at 593 */ #if defined(SYS_inotify_add_watch_at) - GO(SYS_inotify_add_watch_at, "3s, 1m"); - SY(SYS_inotify_add_watch_at, x0, x0+1, x0+1); + GO(SYS_inotify_add_watch_at, "4s, 1m"); + SY(SYS_inotify_add_watch_at, x0+99, x0+100, x0+1, x0+999999); #else FAKE_GO("593:SYS_inotify_add_watch_at 3s, 1m"); FAKE_SY("Syscall param inotify_add_watch_at(fd) contains uninitialised byte(s)\n"); diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 96715bfce..638e87bd6 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -5801,7 +5801,7 @@ Syscall param exterrctl(ptr) points to unaddressable byte(s) Address 0x........ is not stack'd, malloc'd or (recently) free'd --------------------------------------------------------- -593:SYS_inotify_add_watch_at 3s, 1m +593:SYS_inotify_add_watch_at 4s, 1m --------------------------------------------------------- Syscall param inotify_add_watch_at(fd) contains uninitialised byte(s) ... @@ -5812,6 +5812,9 @@ Syscall param inotify_add_watch_at(dfd) contains uninitialised byte(s) Syscall param inotify_add_watch_at(path) contains uninitialised byte(s) ... +Syscall param inotify_add_watch_at(mask) contains uninitialised byte(s) + ... + Syscall param inotify_add_watch_at(path) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd From a073f682147ba820f1148923562cedbbcc91cdb3 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 16 Sep 2025 21:40:41 +0200 Subject: [PATCH 291/412] FreeBSD regtest: scalar inotify_add_watch_at for other platforms --- memcheck/tests/freebsd/scalar.c | 5 ++++- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index b31df32fc..d327609ac 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -2525,7 +2525,7 @@ int main(void) GO(SYS_inotify_add_watch_at, "4s, 1m"); SY(SYS_inotify_add_watch_at, x0+99, x0+100, x0+1, x0+999999); #else - FAKE_GO("593:SYS_inotify_add_watch_at 3s, 1m"); + FAKE_GO("593:SYS_inotify_add_watch_at 4s, 1m"); FAKE_SY("Syscall param inotify_add_watch_at(fd) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); @@ -2535,6 +2535,9 @@ int main(void) FAKE_SY("Syscall param inotify_add_watch_at(path) contains uninitialised byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY("\n"); + FAKE_SY("Syscall param inotify_add_watch_at(mask) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); FAKE_SY("Syscall param inotify_add_watch_at(path) points to unaddressable byte(s)\n"); FAKE_SY(" ...\n"); FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index d2407017f..7304090f5 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -5873,7 +5873,7 @@ Syscall param exterrctl(ptr) points to unaddressable byte(s) Address 0x........ is not stack'd, malloc'd or (recently) free'd --------------------------------------------------------- -593:SYS_inotify_add_watch_at 3s, 1m +593:SYS_inotify_add_watch_at 4s, 1m --------------------------------------------------------- Syscall param inotify_add_watch_at(fd) contains uninitialised byte(s) ... @@ -5884,6 +5884,9 @@ Syscall param inotify_add_watch_at(dfd) contains uninitialised byte(s) Syscall param inotify_add_watch_at(path) contains uninitialised byte(s) ... +Syscall param inotify_add_watch_at(mask) contains uninitialised byte(s) + ... + Syscall param inotify_add_watch_at(path) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd From b72730dc84c82bd83004b93ba68973143fc2bedc Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 17 Sep 2025 09:29:18 +0200 Subject: [PATCH 292/412] FreeBSD regtest: updaus auxv test for new AT_* values added for FreeBSD 15 They don't seem to be used on amd64 though. --- none/tests/freebsd/auxv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/none/tests/freebsd/auxv.c b/none/tests/freebsd/auxv.c index c49e606ea..6712053da 100644 --- a/none/tests/freebsd/auxv.c +++ b/none/tests/freebsd/auxv.c @@ -48,7 +48,10 @@ Elf_AuxStr aux_map[] = { {"AT_KPRELOAD", 34}, {"AT_USRSTACKBASE", 35}, {"AT_USRSTACKLIM", 36}, -// {"AT_COUNT", 37}, + {"AT_CHERI_STATS", 37}, + {"AT_HWCAP3", 38}, + {"AT_HWCAP4", 39}, +// {"AT_COUNT", 40}, }; int main(int argc, char* argv[], char* envp[]) From 210e0923477e86b7654ba7740908f8deb2f0d8de Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 17 Sep 2025 08:33:48 +0200 Subject: [PATCH 293/412] FreeBSD auxv: add new values for FreeBSD 15 --- coregrind/m_initimg/initimg-freebsd.c | 1 + include/vki/vki-freebsd.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index 5c167e3fb..3e0d07544 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -762,6 +762,7 @@ static Addr setup_client_stack(const void* init_sp, #if defined(VGP_arm64_freebsd) // FreeBSD 11+ also have HWCAP and HWCAP2 // but they aren't used on amd64 + // FreeBSD 15 adds HWCAP3 and HWCAP4 case VKI_AT_HWCAP: #define ARM64_SUPPORTED_HWCAP (VKI_HWCAP_ATOMICS \ | VKI_HWCAP_AES \ diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index ee4748c28..bd49381a2 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -2468,6 +2468,10 @@ struct vki_ps_strings { /* added in FreeBSD 14 */ #define VKI_AT_USRSTACKBASE 35 #define VKI_AT_USRSTACKLIM 36 +/* added in FreeBSD 15 */ +#define AT_CHERI_STATS 37 +#define AT_HWCAP3 38 +#define AT_HWCAP4 39 /* AT_COUNT depends on the FreeBSD version, not currently used */ From da6a1ecf537291df169d9933c9687616ef7703c7 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 17 Sep 2025 12:39:33 +0200 Subject: [PATCH 294/412] gitignore: wildcard memcheck/tests/linux stderr diffs Otherwise we may musl expected diff files in git status --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9fb56ba0b..d548fb7ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1177,7 +1177,7 @@ /memcheck/tests/darwin/scalar_vfork # /memcheck/tests/linux/ -/memcheck/tests/linux/*.stderr.diff +/memcheck/tests/linux/*.stderr.diff* /memcheck/tests/linux/*.stderr.out /memcheck/tests/linux/*.stdout.diff /memcheck/tests/linux/*.stdout.out From 1a38f5d9bb9a8ac77d869f9053ae62ab44813ff7 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 17 Sep 2025 12:52:07 +0200 Subject: [PATCH 295/412] Linux clang: fix 2 build warnings and 1 error in tests clang++ not supporting sized deallocation by default is a bit annoying. --- drd/tests/Makefile.am | 3 ++- memcheck/tests/Makefile.am | 1 + memcheck/tests/linux/Makefile.am | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drd/tests/Makefile.am b/drd/tests/Makefile.am index 7fa1611a9..bf5daf247 100755 --- a/drd/tests/Makefile.am +++ b/drd/tests/Makefile.am @@ -578,7 +578,8 @@ endif tsan_unittest_SOURCES = tsan_unittest.cpp tsan_unittest_CXXFLAGS = $(AM_CXXFLAGS) \ - -DTHREAD_WRAPPERS='"tsan_thread_wrappers_pthread.h"' + -DTHREAD_WRAPPERS='"tsan_thread_wrappers_pthread.h"' \ + @FLAG_W_NO_UNUSED_BUT_SET_VARIABLE@ unit_bitmap_CFLAGS = $(AM_CFLAGS) -O2 \ -DENABLE_DRD_CONSISTENCY_CHECKS \ diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 6e3105a59..c1779a7bb 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -727,6 +727,7 @@ sized_aligned_new_delete_misaligned3_SOURCES = sized_aligned_new_delete_misalign sized_aligned_new_delete_misaligned3_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 @FLAG_W_NO_UNUSED_VARIABLE@ if COMPILER_IS_CLANG cxx17_aligned_new_CXXFLAGS += -fsized-deallocation +duplicate_align_size_errors_CXXFLAGS += -fsized-deallocation sized_aligned_new_delete_args_CXXFLAGS += -fsized-deallocation sized_aligned_new_delete_misaligned1_CXXFLAGS += -fsized-deallocation sized_aligned_new_delete_misaligned2_CXXFLAGS += -fsized-deallocation diff --git a/memcheck/tests/linux/Makefile.am b/memcheck/tests/linux/Makefile.am index 13d6a05af..e28866fc1 100644 --- a/memcheck/tests/linux/Makefile.am +++ b/memcheck/tests/linux/Makefile.am @@ -143,6 +143,8 @@ dlclose_leak_LDFLAGS = $(AM_FLAG_M3264_PRI) \ -Wl,-rpath,$(top_builddir)/memcheck/tests/linux enomem_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_USE_AFTER_FREE@ +memalign_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ + if HAVE_STRLCAT strlcat_strlcpy_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_STRINGOP_OVERFLOW@ endif From 9abd7285af899e8be9d6ea4f600f8343dfe7c86b Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 17 Sep 2025 20:05:09 +0200 Subject: [PATCH 296/412] FreeBSD regtest: clean up none auxv test I got fed up with this changing all the time, needing endless expecteds for x86, amd65, arm64, and each FreeBSD version So now I'm generating the expected on the fly, doing the same auxv filtering as previously plus swapping unsupported AT_ values with AT_IGNORE / number 01. The awk script will still need occasional maintenance but it should be less frequent. --- none/tests/freebsd/Makefile.am | 11 ++----- none/tests/freebsd/auxv.stderr.exp | 18 ----------- none/tests/freebsd/auxv.stderr.exp-32on64 | 28 ----------------- none/tests/freebsd/auxv.stderr.exp-arm64 | 30 ------------------- none/tests/freebsd/auxv.stderr.exp-freebsd13 | 26 ---------------- none/tests/freebsd/auxv.stderr.exp-freebsd131 | 27 ----------------- none/tests/freebsd/auxv.stderr.exp-freebsd14 | 29 ------------------ none/tests/freebsd/auxv.vgtest | 2 ++ none/tests/freebsd/auxv_script.stderr.exp | 29 ------------------ .../freebsd/auxv_script.stderr.exp-arm64 | 30 ------------------- none/tests/freebsd/auxv_script.vgtest | 2 ++ none/tests/freebsd/filter_pre_auxv | 12 ++++++++ 12 files changed, 18 insertions(+), 226 deletions(-) delete mode 100644 none/tests/freebsd/auxv.stderr.exp delete mode 100644 none/tests/freebsd/auxv.stderr.exp-32on64 delete mode 100644 none/tests/freebsd/auxv.stderr.exp-arm64 delete mode 100644 none/tests/freebsd/auxv.stderr.exp-freebsd13 delete mode 100644 none/tests/freebsd/auxv.stderr.exp-freebsd131 delete mode 100644 none/tests/freebsd/auxv.stderr.exp-freebsd14 delete mode 100644 none/tests/freebsd/auxv_script.stderr.exp delete mode 100644 none/tests/freebsd/auxv_script.stderr.exp-arm64 create mode 100755 none/tests/freebsd/filter_pre_auxv diff --git a/none/tests/freebsd/Makefile.am b/none/tests/freebsd/Makefile.am index 66ef0c47c..235386527 100644 --- a/none/tests/freebsd/Makefile.am +++ b/none/tests/freebsd/Makefile.am @@ -1,19 +1,12 @@ include $(top_srcdir)/Makefile.tool-tests.am -dist_noinst_SCRIPTS = filter_stderr test.sh filter_452274 filter_auxv filter_fdleak auxv_script +dist_noinst_SCRIPTS = filter_stderr test.sh filter_452274 filter_auxv \ + filter_pre_auxv filter_fdleak auxv_script EXTRA_DIST = \ auxv.vgtest \ - auxv.stderr.exp \ - auxv.stderr.exp-32on64 \ - auxv.stderr.exp-freebsd13 \ - auxv.stderr.exp-freebsd131 \ - auxv.stderr.exp-freebsd14 \ - auxv.stderr.exp-arm64 \ auxv_script.vgtest \ - auxv_script.stderr.exp \ - auxv_script.stderr.exp-arm64 \ bug452274.vgtest \ bug452274.stderr.exp \ bug498317.vgtest bug498317.stderr.exp \ diff --git a/none/tests/freebsd/auxv.stderr.exp b/none/tests/freebsd/auxv.stderr.exp deleted file mode 100644 index e106f06af..000000000 --- a/none/tests/freebsd/auxv.stderr.exp +++ /dev/null @@ -1,18 +0,0 @@ -val: AT_PHDR int: 03 ptr: 0x........ -val: AT_PHENT int: 04 ptr: 0x........ -val: AT_PHNUM int: 05 ptr: 0x........ -val: AT_PAGESZ int: 06 ptr: 0x........ -val: AT_FLAGS int: 08 ptr: 0x........ -val: AT_ENTRY int: 09 ptr: 0x........ -val: AT_BASE int: 07 ptr: 0x........ -val: AT_EHDRFLAGS int: 24 ptr: 0x........ -val: AT_EXECPATH int: 15 ptr: 0x........ -EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv -val: AT_OSRELDATE int: 18 ptr: 0x........ -val: AT_CANARY int: 16 ptr: 0x........ -val: AT_CANARYLEN int: 17 ptr: 0x........ -val: AT_NCPUS int: 19 ptr: 0x........ -val: AT_PAGESIZES int: 20 ptr: 0x........ -val: AT_PAGESIZESLEN int: 21 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_STACKPROT int: 23 ptr: 0x........ diff --git a/none/tests/freebsd/auxv.stderr.exp-32on64 b/none/tests/freebsd/auxv.stderr.exp-32on64 deleted file mode 100644 index db7060abc..000000000 --- a/none/tests/freebsd/auxv.stderr.exp-32on64 +++ /dev/null @@ -1,28 +0,0 @@ -val: AT_PHDR int: 03 ptr: 0x........ -val: AT_PHENT int: 04 ptr: 0x........ -val: AT_PHNUM int: 05 ptr: 0x........ -val: AT_PAGESZ int: 06 ptr: 0x........ -val: AT_FLAGS int: 08 ptr: 0x........ -val: AT_ENTRY int: 09 ptr: 0x........ -val: AT_BASE int: 07 ptr: 0x........ -val: AT_EHDRFLAGS int: 24 ptr: 0x........ -val: AT_EXECPATH int: 15 ptr: 0x........ -EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv -val: AT_OSRELDATE int: 18 ptr: 0x........ -val: AT_CANARY int: 16 ptr: 0x........ -val: AT_CANARYLEN int: 17 ptr: 0x........ -val: AT_NCPUS int: 19 ptr: 0x........ -val: AT_PAGESIZES int: 20 ptr: 0x........ -val: AT_PAGESIZESLEN int: 21 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_STACKPROT int: 23 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_ARGC int: 28 ptr: 0x........ -val: AT_ARGV int: 29 ptr: 0x........ -ARGV: ./auxv -val: AT_ENVC int: 30 ptr: 0x........ -val: AT_ENVV int: 31 ptr: 0x........ -val: AT_PS_STRINGS int: 32 ptr: 0x........ -PS_STRINGS ARGV: ./auxv -val: AT_USRSTACKBASE int: 35 ptr: 0x........ -val: AT_USRSTACKLIM int: 36 ptr: 0x........ diff --git a/none/tests/freebsd/auxv.stderr.exp-arm64 b/none/tests/freebsd/auxv.stderr.exp-arm64 deleted file mode 100644 index 738a284dc..000000000 --- a/none/tests/freebsd/auxv.stderr.exp-arm64 +++ /dev/null @@ -1,30 +0,0 @@ -val: AT_PHDR int: 03 ptr: 0x........ -val: AT_PHENT int: 04 ptr: 0x........ -val: AT_PHNUM int: 05 ptr: 0x........ -val: AT_PAGESZ int: 06 ptr: 0x........ -val: AT_FLAGS int: 08 ptr: 0x........ -val: AT_ENTRY int: 09 ptr: 0x........ -val: AT_BASE int: 07 ptr: 0x........ -val: AT_EHDRFLAGS int: 24 ptr: 0x........ -val: AT_EXECPATH int: 15 ptr: 0x........ -EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv -val: AT_OSRELDATE int: 18 ptr: 0x........ -val: AT_CANARY int: 16 ptr: 0x........ -val: AT_CANARYLEN int: 17 ptr: 0x........ -val: AT_NCPUS int: 19 ptr: 0x........ -val: AT_PAGESIZES int: 20 ptr: 0x........ -val: AT_PAGESIZESLEN int: 21 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_STACKPROT int: 23 ptr: 0x........ -val: AT_HWCAP int: 25 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_ARGC int: 28 ptr: 0x........ -val: AT_ARGV int: 29 ptr: 0x........ -ARGV: ./auxv -val: AT_ENVC int: 30 ptr: 0x........ -val: AT_ENVV int: 31 ptr: 0x........ -val: AT_PS_STRINGS int: 32 ptr: 0x........ -PS_STRINGS ARGV: ./auxv -val: AT_USRSTACKBASE int: 35 ptr: 0x........ -val: AT_USRSTACKLIM int: 36 ptr: 0x........ diff --git a/none/tests/freebsd/auxv.stderr.exp-freebsd13 b/none/tests/freebsd/auxv.stderr.exp-freebsd13 deleted file mode 100644 index 1740ed9b4..000000000 --- a/none/tests/freebsd/auxv.stderr.exp-freebsd13 +++ /dev/null @@ -1,26 +0,0 @@ -val: AT_PHDR int: 03 ptr: 0x........ -val: AT_PHENT int: 04 ptr: 0x........ -val: AT_PHNUM int: 05 ptr: 0x........ -val: AT_PAGESZ int: 06 ptr: 0x........ -val: AT_FLAGS int: 08 ptr: 0x........ -val: AT_ENTRY int: 09 ptr: 0x........ -val: AT_BASE int: 07 ptr: 0x........ -val: AT_EHDRFLAGS int: 24 ptr: 0x........ -val: AT_EXECPATH int: 15 ptr: 0x........ -EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv -val: AT_OSRELDATE int: 18 ptr: 0x........ -val: AT_CANARY int: 16 ptr: 0x........ -val: AT_CANARYLEN int: 17 ptr: 0x........ -val: AT_NCPUS int: 19 ptr: 0x........ -val: AT_PAGESIZES int: 20 ptr: 0x........ -val: AT_PAGESIZESLEN int: 21 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_STACKPROT int: 23 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_ARGC int: 28 ptr: 0x........ -val: AT_ARGV int: 29 ptr: 0x........ -ARGV: ./auxv -val: AT_ENVC int: 30 ptr: 0x........ -val: AT_ENVV int: 31 ptr: 0x........ -val: AT_PS_STRINGS int: 32 ptr: 0x........ -PS_STRINGS ARGV: ./auxv diff --git a/none/tests/freebsd/auxv.stderr.exp-freebsd131 b/none/tests/freebsd/auxv.stderr.exp-freebsd131 deleted file mode 100644 index 7010bfa9c..000000000 --- a/none/tests/freebsd/auxv.stderr.exp-freebsd131 +++ /dev/null @@ -1,27 +0,0 @@ -val: AT_PHDR int: 03 ptr: 0x........ -val: AT_PHENT int: 04 ptr: 0x........ -val: AT_PHNUM int: 05 ptr: 0x........ -val: AT_PAGESZ int: 06 ptr: 0x........ -val: AT_FLAGS int: 08 ptr: 0x........ -val: AT_ENTRY int: 09 ptr: 0x........ -val: AT_BASE int: 07 ptr: 0x........ -val: AT_EHDRFLAGS int: 24 ptr: 0x........ -val: AT_EXECPATH int: 15 ptr: 0x........ -EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv -val: AT_OSRELDATE int: 18 ptr: 0x........ -val: AT_CANARY int: 16 ptr: 0x........ -val: AT_CANARYLEN int: 17 ptr: 0x........ -val: AT_NCPUS int: 19 ptr: 0x........ -val: AT_PAGESIZES int: 20 ptr: 0x........ -val: AT_PAGESIZESLEN int: 21 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_STACKPROT int: 23 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_ARGC int: 28 ptr: 0x........ -val: AT_ARGV int: 29 ptr: 0x........ -ARGV: ./auxv -val: AT_ENVC int: 30 ptr: 0x........ -val: AT_ENVV int: 31 ptr: 0x........ -val: AT_PS_STRINGS int: 32 ptr: 0x........ -PS_STRINGS ARGV: ./auxv -val: AT_IGNORE int: 01 ptr: 0x........ diff --git a/none/tests/freebsd/auxv.stderr.exp-freebsd14 b/none/tests/freebsd/auxv.stderr.exp-freebsd14 deleted file mode 100644 index dcca09f63..000000000 --- a/none/tests/freebsd/auxv.stderr.exp-freebsd14 +++ /dev/null @@ -1,29 +0,0 @@ -val: AT_PHDR int: 03 ptr: 0x........ -val: AT_PHENT int: 04 ptr: 0x........ -val: AT_PHNUM int: 05 ptr: 0x........ -val: AT_PAGESZ int: 06 ptr: 0x........ -val: AT_FLAGS int: 08 ptr: 0x........ -val: AT_ENTRY int: 09 ptr: 0x........ -val: AT_BASE int: 07 ptr: 0x........ -val: AT_EHDRFLAGS int: 24 ptr: 0x........ -val: AT_EXECPATH int: 15 ptr: 0x........ -EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv -val: AT_OSRELDATE int: 18 ptr: 0x........ -val: AT_CANARY int: 16 ptr: 0x........ -val: AT_CANARYLEN int: 17 ptr: 0x........ -val: AT_NCPUS int: 19 ptr: 0x........ -val: AT_PAGESIZES int: 20 ptr: 0x........ -val: AT_PAGESIZESLEN int: 21 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_STACKPROT int: 23 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_ARGC int: 28 ptr: 0x........ -val: AT_ARGV int: 29 ptr: 0x........ -ARGV: ./auxv -val: AT_ENVC int: 30 ptr: 0x........ -val: AT_ENVV int: 31 ptr: 0x........ -val: AT_PS_STRINGS int: 32 ptr: 0x........ -PS_STRINGS ARGV: ./auxv -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_USRSTACKBASE int: 35 ptr: 0x........ -val: AT_USRSTACKLIM int: 36 ptr: 0x........ diff --git a/none/tests/freebsd/auxv.vgtest b/none/tests/freebsd/auxv.vgtest index 098f30134..a2643a079 100644 --- a/none/tests/freebsd/auxv.vgtest +++ b/none/tests/freebsd/auxv.vgtest @@ -1,4 +1,6 @@ +prereq: ./auxv 2>&1 | ./filter_pre_auxv > auxv.stderr.exp prog: auxv vgopts: -q stderr_filter: filter_auxv +post: rm auxv.stderr.exp diff --git a/none/tests/freebsd/auxv_script.stderr.exp b/none/tests/freebsd/auxv_script.stderr.exp deleted file mode 100644 index dcca09f63..000000000 --- a/none/tests/freebsd/auxv_script.stderr.exp +++ /dev/null @@ -1,29 +0,0 @@ -val: AT_PHDR int: 03 ptr: 0x........ -val: AT_PHENT int: 04 ptr: 0x........ -val: AT_PHNUM int: 05 ptr: 0x........ -val: AT_PAGESZ int: 06 ptr: 0x........ -val: AT_FLAGS int: 08 ptr: 0x........ -val: AT_ENTRY int: 09 ptr: 0x........ -val: AT_BASE int: 07 ptr: 0x........ -val: AT_EHDRFLAGS int: 24 ptr: 0x........ -val: AT_EXECPATH int: 15 ptr: 0x........ -EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv -val: AT_OSRELDATE int: 18 ptr: 0x........ -val: AT_CANARY int: 16 ptr: 0x........ -val: AT_CANARYLEN int: 17 ptr: 0x........ -val: AT_NCPUS int: 19 ptr: 0x........ -val: AT_PAGESIZES int: 20 ptr: 0x........ -val: AT_PAGESIZESLEN int: 21 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_STACKPROT int: 23 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_ARGC int: 28 ptr: 0x........ -val: AT_ARGV int: 29 ptr: 0x........ -ARGV: ./auxv -val: AT_ENVC int: 30 ptr: 0x........ -val: AT_ENVV int: 31 ptr: 0x........ -val: AT_PS_STRINGS int: 32 ptr: 0x........ -PS_STRINGS ARGV: ./auxv -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_USRSTACKBASE int: 35 ptr: 0x........ -val: AT_USRSTACKLIM int: 36 ptr: 0x........ diff --git a/none/tests/freebsd/auxv_script.stderr.exp-arm64 b/none/tests/freebsd/auxv_script.stderr.exp-arm64 deleted file mode 100644 index 738a284dc..000000000 --- a/none/tests/freebsd/auxv_script.stderr.exp-arm64 +++ /dev/null @@ -1,30 +0,0 @@ -val: AT_PHDR int: 03 ptr: 0x........ -val: AT_PHENT int: 04 ptr: 0x........ -val: AT_PHNUM int: 05 ptr: 0x........ -val: AT_PAGESZ int: 06 ptr: 0x........ -val: AT_FLAGS int: 08 ptr: 0x........ -val: AT_ENTRY int: 09 ptr: 0x........ -val: AT_BASE int: 07 ptr: 0x........ -val: AT_EHDRFLAGS int: 24 ptr: 0x........ -val: AT_EXECPATH int: 15 ptr: 0x........ -EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv -val: AT_OSRELDATE int: 18 ptr: 0x........ -val: AT_CANARY int: 16 ptr: 0x........ -val: AT_CANARYLEN int: 17 ptr: 0x........ -val: AT_NCPUS int: 19 ptr: 0x........ -val: AT_PAGESIZES int: 20 ptr: 0x........ -val: AT_PAGESIZESLEN int: 21 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_STACKPROT int: 23 ptr: 0x........ -val: AT_HWCAP int: 25 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_IGNORE int: 01 ptr: 0x........ -val: AT_ARGC int: 28 ptr: 0x........ -val: AT_ARGV int: 29 ptr: 0x........ -ARGV: ./auxv -val: AT_ENVC int: 30 ptr: 0x........ -val: AT_ENVV int: 31 ptr: 0x........ -val: AT_PS_STRINGS int: 32 ptr: 0x........ -PS_STRINGS ARGV: ./auxv -val: AT_USRSTACKBASE int: 35 ptr: 0x........ -val: AT_USRSTACKLIM int: 36 ptr: 0x........ diff --git a/none/tests/freebsd/auxv_script.vgtest b/none/tests/freebsd/auxv_script.vgtest index ccd450a9a..b2afe075e 100644 --- a/none/tests/freebsd/auxv_script.vgtest +++ b/none/tests/freebsd/auxv_script.vgtest @@ -1,4 +1,6 @@ +prereq: ./auxv_script 2>&1 | ./filter_pre_auxv > auxv_script.stderr.exp prog: auxv_script vgopts: -q stderr_filter: filter_auxv +post: rm auxv_script.stderr.exp diff --git a/none/tests/freebsd/filter_pre_auxv b/none/tests/freebsd/filter_pre_auxv new file mode 100755 index 000000000..37c63683a --- /dev/null +++ b/none/tests/freebsd/filter_pre_auxv @@ -0,0 +1,12 @@ +#!/bin/sh + +# filters all auxv values that are not supported by Valgrind + +./filter_auxv | + +awk '/AT_TIMEKEEP/{$2="AT_IGNORE";$4="01"}{print}' | +awk '/AT_HWCAP2/{$2="AT_IGNORE";$4="01"}{print}' | +awk '/AT_HWCAP3/{$2="AT_IGNORE";$4="01"}{print}' | +awk '/AT_HWCAP4/{$2="AT_IGNORE";$4="01"}{print}' | +awk '/AT_BSDFLAGS/{$2="AT_IGNORE";$4="01"}{print}' | +awk '/AT_KPRELOAD/{$2="AT_IGNORE";$4="01"}{print}' From ed007b52d1aea3d1b0993093ce46e87daa063f78 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 14 Sep 2025 12:00:46 +0000 Subject: [PATCH 297/412] FreeBSD DRD: add suppression for _malloc_postfork For FreeBSD 15 --- freebsd-drd.supp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/freebsd-drd.supp b/freebsd-drd.supp index b9b0d5de7..980d0db46 100644 --- a/freebsd-drd.supp +++ b/freebsd-drd.supp @@ -223,9 +223,17 @@ drd:ConflictingAccess fun:thr_new } - { DRD-FREEBSD15-EXTERRCTL drd:ConflictingAccess fun:exterrctl } +{ + DRD-FREEBSD15-_MALLOC_POSTFORK + drd:ConflictingAccess + obj:*/lib*/libc.so.7 + obj:*/lib*/libc.so.7 + obj:*/lib*/libc.so.7 + fun:_malloc_postfork +} + From ccf065e7077459d902f6ad221c21b0771bedbb1a Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Wed, 17 Sep 2025 16:27:09 +0200 Subject: [PATCH 298/412] Run the LTP tests with LTP_QUIET Introduce a new LTP_QUIET env var which suppresses certain types of LTP log messages, specifically TCONF, TWARN, TINFO, and TDEBUG. This helps us keep the test logs briefer, while still keeping the important information in the logs. This update avoids several false positives, specifically with the following testcases: eventfd2_03, shmctl05, mlock03, poll02, prctl09, setsockopt10, and select02. This update also adds a brief summary for the LTP testsuite, something like the following: > ... > [6/7] Testing select02 ... > [7/7] Testing setsockopt10 ... > > Brief LTP test results summary > ----------------------------------------- > PASS: 6 > FAIL: 1 > ----------------------------------------- > > TESTING FINISHED, logs in ... Also fix the way -j param spec in auxprogs/Makefile.am. https://bugs.kde.org/show_bug.cgi?id=509590 --- NEWS | 1 + auxprogs/Makefile.am | 10 ++- .../0002-Introduce-LTP_QUIET-env-var.patch | 73 +++++++++++++++++++ auxprogs/ltp-tester.sh | 7 ++ 4 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 auxprogs/ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch diff --git a/NEWS b/NEWS index 7940ab4a0..32d8acec9 100644 --- a/NEWS +++ b/NEWS @@ -137,6 +137,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509139 Update BadSize error messages 509258 FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers 509517 s390x: Even/odd lane confusion in various vector insns +509590 Run the LTP tests with LTP_QUIET To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index 4f9f100c0..e7ff5a5da 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -21,7 +21,8 @@ LTP_FILTERS = \ filters/select03 LTP_PATCHES = \ - ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch + ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch \ + ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch EXTRA_DIST = \ docs/valgrind-listener-manpage.xml \ @@ -211,14 +212,15 @@ $(GSL_SRC_DIR)/gsl-patched: $(GSL_TAR) autoreconf -f -i -Wnone) touch $@ -$(LTP_SRC_DIR): $(LTP_TAR) +$(LTP_SRC_DIR): $(LTP_TAR) ltp-apply-patches.sh $(LTP_PATCHES) echo "$(LTP_SHA256_SUM) $(LTP_TAR)" | @SHA256SUM@ --check - (cd $(AUX_CHECK_DIR) && \ tar Jxf $(LTP_TAR_NAME) && \ $(abs_top_srcdir)/auxprogs/ltp-apply-patches.sh $(LTP_SRC_DIR) && \ cd $(LTP_SRC_DIR) && \ ./configure CC="${CC}" CXX="${CXX}" CFLAGS="$(LTP_CFLAGS)" && \ - ${MAKE} -j $(nproc) -C testcases/kernel/syscalls) + ${MAKE} clean && \ + ${MAKE} -C testcases/kernel/syscalls) touch $@ # We need make check -k because @@ -228,7 +230,7 @@ $(GSL_BUILD_DIR)/gsl-build: $(GSL_SRC_DIR)/gsl-patched mkdir -p $(GSL_BUILD_DIR) (cd $(GSL_BUILD_DIR) && \ $(GSL_SRC_DIR)/configure CC="${CC}" CXX="${CXX}" CFLAGS="$(GSL_CFLAGS)" && \ - ${MAKE} -j $(nproc) && \ + ${MAKE} && \ ${MAKE} check -k || true) touch $@ diff --git a/auxprogs/ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch b/auxprogs/ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch new file mode 100644 index 000000000..a77162bfc --- /dev/null +++ b/auxprogs/ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch @@ -0,0 +1,73 @@ +From 183df3240f8e7ca38fbe2fd472c31c9417ae7eb2 Mon Sep 17 00:00:00 2001 +From: Martin Cermak +Date: Tue, 16 Sep 2025 15:46:40 +0200 +Subject: [PATCH] Introduce LTP_QUIET env var + +Introduce LTP_QUIET env variable. When set to 1 or y, it will +suppress printing TCONF, TWARN, TINFO, and TDEBUG messages. +--- + lib/tst_test.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/lib/tst_test.c b/lib/tst_test.c +index 92872cc89..609a7b075 100644 +--- a/lib/tst_test.c ++++ b/lib/tst_test.c +@@ -68,6 +68,7 @@ static int iterations = 1; + static float duration = -1; + static float timeout_mul = -1; + static int reproducible_output; ++static int quiet_output; + + struct context { + int32_t lib_pid; +@@ -307,15 +308,19 @@ static void print_result(const char *file, const int lineno, int ttype, + res = "TBROK"; + break; + case TCONF: ++ if (quiet_output) return; + res = "TCONF"; + break; + case TWARN: ++ if (quiet_output) return; + res = "TWARN"; + break; + case TINFO: ++ if (quiet_output) return; + res = "TINFO"; + break; + case TDEBUG: ++ if (quiet_output) return; + res = "TDEBUG"; + break; + default: +@@ -670,6 +675,7 @@ static void print_help(void) + fprintf(stderr, "LTP_DEV_FS_TYPE Filesystem used for testing (default: %s)\n", DEFAULT_FS_TYPE); + fprintf(stderr, "LTP_ENABLE_DEBUG Print debug messages (set 1 or y)\n"); + fprintf(stderr, "LTP_REPRODUCIBLE_OUTPUT Values 1 or y discard the actual content of the messages printed by the test\n"); ++ fprintf(stderr, "LTP_QUIET Values 1 or y will suppress printing TCONF, TWARN, TINFO, and TDEBUG messages\n"); + fprintf(stderr, "LTP_SINGLE_FS_TYPE Specifies filesystem instead all supported (for .all_filesystems)\n"); + fprintf(stderr, "LTP_FORCE_SINGLE_FS_TYPE Testing only. The same as LTP_SINGLE_FS_TYPE but ignores test skiplist.\n"); + fprintf(stderr, "LTP_TIMEOUT_MUL Timeout multiplier (must be a number >=1)\n"); +@@ -1361,6 +1367,7 @@ static void do_setup(int argc, char *argv[]) + { + char *tdebug_env = getenv("LTP_ENABLE_DEBUG"); + char *reproducible_env = getenv("LTP_REPRODUCIBLE_OUTPUT"); ++ char *quiet_env = getenv("LTP_QUIET"); + + if (!tst_test) + tst_brk(TBROK, "No tests to run"); +@@ -1391,6 +1398,10 @@ static void do_setup(int argc, char *argv[]) + (!strcmp(reproducible_env, "1") || !strcmp(reproducible_env, "y"))) + reproducible_output = 1; + ++ if (quiet_env && ++ (!strcmp(quiet_env, "1") || !strcmp(quiet_env, "y"))) ++ quiet_output = 1; ++ + assert_test_fn(); + + TCID = tcid = get_tcid(argv); +-- +2.48.1 + diff --git a/auxprogs/ltp-tester.sh b/auxprogs/ltp-tester.sh index ba8fd8be4..a95c603c5 100755 --- a/auxprogs/ltp-tester.sh +++ b/auxprogs/ltp-tester.sh @@ -21,6 +21,7 @@ PARALLEL_JOBS=${PARALLEL_JOBS:-$(nproc)} # https://lore.kernel.org/ltp/20250505195003.GB137650@pevik/T/#t export LTP_COLORIZE_OUTPUT=0 export LTP_REPRODUCIBLE_OUTPUT=1 +export LTP_QUIET=1 # Initialize LOGDIR for bunsen upload (https://sourceware.org/bunsen/) mkdir -p $LOGDIR; rm -rf ${LOGDIR:?}/* @@ -110,4 +111,10 @@ done wait +echo -e "\nBrief LTP test results summary" +echo "-----------------------------------------" +find $LOGDIR -type f -name '*.trs' -exec grep -F ':test-result:' '{}' ';' |\ + sort -r | uniq -c | awk '{print $NF": "$1}' +echo -e "-----------------------------------------\n" + echo "TESTING FINISHED, logs in $LOGDIR" From c31e15cf6ae7cc53622aaca16fec57af0629632e Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 18 Sep 2025 17:36:40 +0200 Subject: [PATCH 299/412] Add ltp-patch to correct scanf address format for mmap04 --- auxprogs/Makefile.am | 3 +- ...-the-scanf-address-format-is-at-leas.patch | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 auxprogs/ltp-patches/0003-mmap04-Make-sure-the-scanf-address-format-is-at-leas.patch diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index e7ff5a5da..0ce348ef5 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -22,7 +22,8 @@ LTP_FILTERS = \ LTP_PATCHES = \ ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch \ - ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch + ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch \ + ltp-patches/0003-mmap04-Make-sure-the-scanf-address-format-is-at-leas.patch EXTRA_DIST = \ docs/valgrind-listener-manpage.xml \ diff --git a/auxprogs/ltp-patches/0003-mmap04-Make-sure-the-scanf-address-format-is-at-leas.patch b/auxprogs/ltp-patches/0003-mmap04-Make-sure-the-scanf-address-format-is-at-leas.patch new file mode 100644 index 000000000..7956999b3 --- /dev/null +++ b/auxprogs/ltp-patches/0003-mmap04-Make-sure-the-scanf-address-format-is-at-leas.patch @@ -0,0 +1,39 @@ +From 6c3a6a6f625b58e8dc611cc12bc6015dc8dd5b32 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Thu, 18 Sep 2025 17:16:05 +0200 +Subject: [PATCH] mmap04: Make sure the scanf address format is at least 8 hex + chars + +The addresses in /proc/self/maps are at least 8 hex chars. Zeros are +added to the front of the address when shorter (both on 32bit and +64bit systems). + +Under valgrind the mmaps used in kernel/syscalls/mmap/mmap04.c come +out very low in the address space and might be shorter than 8 hex +chars. This causes the scanf to fail: +mmap04.c:62: TBROK: Expected 1 conversions got 0 FILE '/proc/self/maps' + +Fix this by using "%08" PRIxPTR when creating the fmt used. + +Signed-off-by: Mark Wielaard +--- + testcases/kernel/syscalls/mmap/mmap04.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/testcases/kernel/syscalls/mmap/mmap04.c b/testcases/kernel/syscalls/mmap/mmap04.c +index 4a050b7b50da..5b28180df29b 100644 +--- a/testcases/kernel/syscalls/mmap/mmap04.c ++++ b/testcases/kernel/syscalls/mmap/mmap04.c +@@ -58,7 +58,8 @@ static void run(unsigned int i) + + addr2 = SAFE_MMAP(addr1 + pagesize, pagesize, tc->prot, tc->flags | MAP_FIXED, -1, 0); + +- sprintf(fmt, "%" PRIxPTR "-%%*x %%s", (uintptr_t)addr2); ++ /* A /proc/self/maps address is at least 8 hex (left zero padded) */ ++ sprintf(fmt, "%08" PRIxPTR "-%%*x %%s", (uintptr_t)addr2); + SAFE_FILE_LINES_SCANF("/proc/self/maps", fmt, perms); + + if (!strcmp(perms, tc->exp_perms)) { +-- +2.51.0 + From 553ada14844625f43a1ec445addfa1ab88ee0e26 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Wed, 17 Sep 2025 16:08:05 +0200 Subject: [PATCH 300/412] Wrap the quotactl_fd syscall SYSCALL_DEFINE4(quotactl_fd, unsigned int, fd, unsigned int, cmd, qid_t, id, void __user *, addr) The quotactl_fd works in a similar way to quotactl. They both manipulate disk quotas. They differ in how the target file system is specified. While quotactl takes path, quotactl_fd takes a file descriptor. Declare a quotactl_fd wrapper in priv_syswrap-linux.h and hook it for {amd64,arm,arm64,mips64,ppc32,ppc64,riscv64,s390x,x86}-linux using LINX_ with PRE handler in syswrap-linux.c https://bugs.kde.org/show_bug.cgi?id=509567 --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 1 + coregrind/m_syswrap/syswrap-amd64-linux.c | 1 + coregrind/m_syswrap/syswrap-arm-linux.c | 6 +++--- coregrind/m_syswrap/syswrap-arm64-linux.c | 1 + coregrind/m_syswrap/syswrap-linux.c | 16 ++++++++++++++++ coregrind/m_syswrap/syswrap-mips32-linux.c | 1 + coregrind/m_syswrap/syswrap-mips64-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc32-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc64-linux.c | 1 + coregrind/m_syswrap/syswrap-riscv64-linux.c | 1 + coregrind/m_syswrap/syswrap-s390x-linux.c | 1 + coregrind/m_syswrap/syswrap-x86-linux.c | 1 + include/vki/vki-scnums-shared-linux.h | 1 + 14 files changed, 31 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 32d8acec9..3114eb4fe 100644 --- a/NEWS +++ b/NEWS @@ -138,6 +138,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509258 FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers 509517 s390x: Even/odd lane confusion in various vector insns 509590 Run the LTP tests with LTP_QUIET +509567 unhandled amd64-linux syscall: 443 (quotactl_fd) To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 1706af786..49a4c222b 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -254,6 +254,7 @@ DECL_TEMPLATE(linux, sys_munlockall); DECL_TEMPLATE(linux, sys_pipe); DECL_TEMPLATE(linux, sys_pipe2); DECL_TEMPLATE(linux, sys_quotactl); +DECL_TEMPLATE(linux, sys_quotactl_fd); DECL_TEMPLATE(linux, sys_waitid); // Posix, but in Darwin utime is a libc function that calls syscall utimes. diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index c0d3637f7..88c84b841 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -895,6 +895,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 42f795210..5567146eb 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -1067,15 +1067,15 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_close_range, sys_close_range), // 436 LINXY(__NR_openat2, sys_openat2), // 437 LINXY(__NR_pidfd_getfd, sys_pidfd_getfd), // 438 - LINX_(__NR_faccessat2, sys_faccessat2), // 439 - + LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 - LINX_(__NR_futex_waitv, sys_futex_waitv), // 449 + LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 + LINX_(__NR_futex_waitv, sys_futex_waitv), // 449 LINXY(__NR_cachestat, sys_cachestat), // 451 LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 LINXY(__NR_statmount, sys_statmount), // 457 diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index fd6ac23f7..ada952cca 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -846,6 +846,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 9333dfde1..0d5aa7965 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4103,6 +4103,22 @@ PRE(sys_quotactl) PRE_MEM_RASCIIZ( "quotactl(special)", ARG2 ); } +PRE(sys_quotactl_fd) +{ + // SYSCALL_DEFINE4(quotactl_fd, + // unsigned int, fd, + // unsigned int, cmd, + // qid_t, id, + // void __user *, addr) + PRINT("sys_quotactl (0x%" FMT_REGWORD "x, 0x%#" FMT_REGWORD "x, 0x%" + FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1, ARG2, ARG3, ARG4); + PRE_REG_READ4(long, "quotactl_fd", + unsigned int, fd, unsigned int, cmd, vki_qid_t, id, + void *, addr); + if (!ML_(fd_allowed)(ARG1, "quotactl_fd", tid, False)) + SET_STATUS_Failure( VKI_EBADF ); +} + PRE(sys_waitid) { *flags |= SfMayBlock; diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 3020d15fe..ba5a8bb17 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -1177,6 +1177,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index ec6e3fa14..095be9b6a 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -819,6 +819,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY (__NR_listmount, sys_listmount), LINX_ (__NR_mseal, sys_mseal), LINX_ (__NR_futex_waitv, sys_futex_waitv), + LINX_ (__NR_quotactl_fd, sys_quotactl_fd), }; SyscallTableEntry * ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index 2a7612ccc..a0e11d5ed 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -1075,6 +1075,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_ (__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 5b1b0c1af..d5e2f523c 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1049,6 +1049,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_ (__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index a0655706b..5134bd171 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -594,6 +594,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_pidfd_getfd, sys_pidfd_getfd), /* 438 */ LINX_(__NR_faccessat2, sys_faccessat2), /* 439 */ LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), /* 441 */ + LINX_(__NR_quotactl_fd, sys_quotactl_fd), /* 443 */ LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), /* 444 */ LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), /* 445 */ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), /* 446 */ diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index 5a68f14db..4d794ce81 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -881,6 +881,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index fb6adff11..f129317a8 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1668,6 +1668,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h index 9c20964c5..c5f33e935 100644 --- a/include/vki/vki-scnums-shared-linux.h +++ b/include/vki/vki-scnums-shared-linux.h @@ -48,6 +48,7 @@ #define __NR_epoll_pwait2 441 +#define __NR_quotactl_fd 443 #define __NR_landlock_create_ruleset 444 #define __NR_landlock_add_rule 445 #define __NR_landlock_restrict_self 446 From 08b891ffbc0667e7354ecdc6a3032b923ce85e22 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 18 Sep 2025 22:03:08 +0200 Subject: [PATCH 301/412] configure.ac: Add no-dist-gzip to AM_INIT_AUTOMAKE options We only distribute the tar.bz2 so don't produce the tar.gz unnecessarily. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9c6a4710d..1740008a6 100755 --- a/configure.ac +++ b/configure.ac @@ -35,7 +35,7 @@ AC_SUBST(VG_DATE, v_rel_date) AC_CONFIG_SRCDIR(coregrind/m_main.c) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([foreign dist-bzip2 tar-ustar subdir-objects]) +AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip tar-ustar subdir-objects]) AM_MAINTAINER_MODE From dbf880ca15d14202adb5edc93c827b3a987e136f Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 18 Sep 2025 21:06:31 +0000 Subject: [PATCH 302/412] s390-runone overhaul Rewritten in perl. Command line options added. Minimise assembler file by throwing out any function prologue stuff GCC might stick into a function. Also remove insns following the svc as they are not reachable. Error handling: capture errors/warnings from the assembler. Why all this? https://bugs.kde.org/show_bug.cgi?id=509572 --- auxprogs/s390-runone | 246 +++++++++++++++++++++++++++++++++---------- 1 file changed, 189 insertions(+), 57 deletions(-) diff --git a/auxprogs/s390-runone b/auxprogs/s390-runone index 2079a5e46..f8d0288dd 100755 --- a/auxprogs/s390-runone +++ b/auxprogs/s390-runone @@ -1,5 +1,9 @@ -#!/bin/sh -# +#!/usr/bin/env perl + +use strict; +use warnings; +use Getopt::Long; + #----------------------------------------------------------------------- # Compile a small C program containing a sequence of assembler # instructions into an executable that does not need a dynamic linker. @@ -7,79 +11,207 @@ # through the multi-pass process of figuring out which SB contains the # code we're interested in. # -# Here is a template: +# Step #1: s390-runone -t bla.c +# +# Creates a template which looks like so: # # int main(void) # { +# asm volatile ("csch"); // begin mark: do not remove # //FIXME: insert test code here: # asm volatile ("lghi %r1,1"); // __NR_exit # asm volatile ("lghi %r2,0"); // return code = 0 -# asm volatile ("svc 0"); -# return 0; // shuts up GCC +# asm volatile ("svc 0"); // terminate process +# asm volatile ("csch"); // end mark: do not remove +# return 0; # } # -# When running the executable created by this script under valgrind -# there will be only a single super block! Which is exactly what we want -# for debugging. +# Step #2: Replace the FIXME line with one or more asm statements. +# Skip this step if you used --insn=... in step #1. +# +# Step #3: s390-runone --build bla.c +# +# Compiles and links "bla.c" into an executable "bla" which does not +# require the dynamic loader and which contains only those insns between +# the two marker insns (csch). # # objdump -d: # # 00000000010000b0 <_start>: -# 10000b0: b3 c1 00 0b ldgr %f0,%r11 -# 10000b4: b9 04 00 bf lgr %r11,%r15 -# 10000b8: a7 19 00 01 lghi %r1,1 <--- -# 10000bc: a7 29 00 09 lghi %r2,9 <--- -# 10000c0: 0a 00 svc 0 <--- -# 10000c2: a7 18 00 00 lhi %r1,0 -# 10000c6: b9 14 00 11 lgfr %r1,%r1 -# 10000ca: b9 04 00 21 lgr %r2,%r1 -# 10000ce: b3 cd 00 b0 lgdr %r11,%f0 -# 10000d2: 07 fe br %r14 -# 10000d4: 07 07 nopr %r7 -# 10000d6: 07 07 nopr %r7 +# 10000b0: a7 19 00 01 lghi %r1,1 +# 10000b4: a7 29 00 00 lghi %r2,0 +# 10000b8: 0a 00 svc 0 # -# There are only 2 extra insns ahead of our asm code sequence. -# Everything after the svc insn is not reachable. #----------------------------------------------------------------------- # -if [ "x$1" = "x" ]; then - echo "Usage: s390-runone C-file" 1>&2 - echo " or: s390-runone -t" 1>&2 - exit 1 -fi - -if [ "x$1" = "x-t" ]; then - echo 'int main(void)' - echo '{' - echo ' //FIXME: insert test code here:' - echo ' asm volatile ("lghi %r1,1"); // __NR_exit' - echo ' asm volatile ("lghi %r2,0"); // return code = 0' - echo ' asm volatile ("svc 0");' - echo ' return 0; // shuts up GCC' - echo '}' - exit 0 -fi - -file="$1" -base=`basename "$file" .c` -asm="$base.s" -exe="$base" - -if [ "$base" = "$file" ]; then - echo "$file is not a C file" 1>&2 - exit 1 -fi +&main; + +sub usage { + my $text =< sub { $template = 1; $build = 0; }, + "build|b" => sub { $template = 0; $build = 1; }, + "help|h" => \$help, + "insn|i=s" => \$insn, + "arch|a=s" => \$arch + ) or usage(); + + usage() if ($help); + + my $num_arg = $#ARGV + 1; + my $file = ""; + + if ($num_arg != 1) { + fatal("Missing file name") if ($build); + } else { + $file = $ARGV[0]; + } + + my $rc = 0; + if ($template) { + write_template($file, $insn); + } elsif ($build) { + $rc = build_exe($file, $arch); + } else { + print "Nothing happens\n"; + } + exit $rc; +} + +sub write_template +{ + my ($file, $insn) = @_; + my $asm; + + if ($insn eq "") { + $asm = "//FIXME: insert test code here:"; + } else { + $asm = "asm volatile (\"$insn\");"; + } + + my $template = <$file") || fatal("Cannot open '$file': $!\n"); + print OUT $template; + close(OUT); + } else { + print $template; + } +} + +sub build_exe +{ + my ($file, $arch) = @_; + + my $base = `basename "$file" .c`; + chomp($base); + my $asm = "$base.s"; + my $exe = "$base"; # Compile the testprogram to assembler -gcc -S -fno-ident -march=arch14 $file -mv "$asm" "$asm.orig" # save the result + my $stderr = `gcc -S -fno-ident -march=$arch $file 2>&1`; + if ($? != 0) { + error("GCC: Compilation failed\n $stderr"); + return 1; + } + `mv "$asm" "$asm.orig"`; # save before massaging + +# Massage assembler file: +# - rename main ---> _start +# - remove cfi stuff +# - remove comment lines +# - remove insns preceeding 1st mark (csch) +# - remove insns succeeding 2nd mark (csch) + + my $in_main = 0; + my $mark_seen = 0; + my $output = ""; + open(IN, "$asm.orig") || fatal("Cannot open '$file': $!\n"); + while (my $line = ) { + chomp($line); + next if ($line =~ /^#/); # comment + next if ($line =~ /\.cfi_/); # cfi stuff + if ($in_main == 0) { + $in_main = 1 if ($line =~ /^main:/); + } else { + if ($mark_seen == 0) { + if ($line =~ /csch/) { + $mark_seen = 1; + next; + } + next if ($line =~ /^\t[a-z]/); # skip insn + } else { + if ($line =~ /csch/) { + $mark_seen = 0; + next; + } + } + } + $line =~ s/main/_start/g; + $output .= "$line\n"; + } + open(OUT, ">$asm") || fatal("Cannot open '$asm': $!\n"); + print OUT $output; + close(OUT); + + # Assemble file and link to executable + my $gcc = "gcc -static -Wa,--fatal-warnings -Wl,--build-id=none" + . " -nodefaultlibs -nostartfiles"; + $stderr = `$gcc "$asm" -o "$exe" 2>&1`; -# Rename main with _start, remove cfi stuff and comment lines -sed 's/main/_start/g' "$asm.orig" | grep -v \.cfi_ | grep -v ^# > "$asm" + if ($? != 0) { + error("GCC: Linking executable failed"); + for my $line (split /\n/,$stderr) { + print STDERR "$line\n" if ($line !~ /treating warnings as errors/); + } + return 1; + } +} -# Link to executable -gcc -static -Wl,--build-id=none -nodefaultlibs -nostartfiles "$asm" -o "$exe" +sub error +{ + print STDERR "*** $_[0]\n"; +} -echo "$exe created" -exit 0 +sub fatal +{ + error($_[0]); + exit 1; +} From c38c9171e504e6ac51c036aee72c817e76679a7b Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 18 Sep 2025 21:35:32 +0000 Subject: [PATCH 303/412] VEX core constification. --- VEX/priv/ir_opt.c | 44 ++++++++++++++++++++++---------------------- VEX/priv/main_util.c | 8 ++++---- VEX/priv/main_util.h | 4 ++-- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index f3954fc60..4a2e3dcb7 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -198,7 +198,7 @@ static HashHW* newHHW ( void ) /* Look up key in the map. */ -static Bool lookupHHW ( HashHW* h, /*OUT*/HWord* val, HWord key ) +static Bool lookupHHW ( const HashHW* h, /*OUT*/HWord* val, HWord key ) { Int i; /* vex_printf("lookupHHW(%llx)\n", key ); */ @@ -264,7 +264,7 @@ static void addToHHW ( HashHW* h, HWord key, HWord val ) /* Non-critical helper, heuristic for reducing the number of tmp-tmp copies made by flattening. If in doubt return False. */ -static Bool isFlat ( IRExpr* e ) +static Bool isFlat ( const IRExpr* e ) { if (e->tag == Iex_Get) return True; @@ -550,7 +550,7 @@ static IRSB* flatten_BB ( IRSB* in ) /* Extract the min/max offsets from a guest state array descriptor. */ inline -static void getArrayBounds ( IRRegArray* descr, +static void getArrayBounds ( const IRRegArray* descr, UInt* minoff, UInt* maxoff ) { *minoff = descr->base; @@ -572,7 +572,7 @@ static UInt mk_key_GetPut ( Int offset, IRType ty ) return (minoff << 16) | maxoff; } -static UInt mk_key_GetIPutI ( IRRegArray* descr ) +static UInt mk_key_GetIPutI ( const IRRegArray* descr ) { UInt minoff, maxoff; getArrayBounds( descr, &minoff, &maxoff ); @@ -1041,17 +1041,17 @@ static UInt num_nodes_visited; slower out of line general case. Saves a few insns. */ __attribute__((noinline)) -static Bool sameIRExprs_aux2 ( IRExpr** env, IRExpr* e1, IRExpr* e2 ); +static Bool sameIRExprs_aux2 ( IRExpr** env, const IRExpr* e1, const IRExpr* e2 ); inline -static Bool sameIRExprs_aux ( IRExpr** env, IRExpr* e1, IRExpr* e2 ) +static Bool sameIRExprs_aux ( IRExpr** env, const IRExpr* e1, const IRExpr* e2 ) { if (e1->tag != e2->tag) return False; return sameIRExprs_aux2(env, e1, e2); } __attribute__((noinline)) -static Bool sameIRExprs_aux2 ( IRExpr** env, IRExpr* e1, IRExpr* e2 ) +static Bool sameIRExprs_aux2 ( IRExpr** env, const IRExpr* e1, const IRExpr* e2 ) { if (num_nodes_visited++ > NODE_LIMIT) return False; @@ -1129,7 +1129,7 @@ static Bool sameIRExprs_aux2 ( IRExpr** env, IRExpr* e1, IRExpr* e2 ) } inline -static Bool sameIRExprs ( IRExpr** env, IRExpr* e1, IRExpr* e2 ) +static Bool sameIRExprs ( IRExpr** env, const IRExpr* e1, const IRExpr* e2 ) { Bool same; @@ -1158,8 +1158,8 @@ static Bool sameIRExprs ( IRExpr** env, IRExpr* e1, IRExpr* e2 ) --vex-iropt-level > 0, that is, vex_control.iropt_verbosity > 0. Bad because it duplicates functionality from typeOfIRExpr. See comment on the single use point below for rationale. */ -static -Bool debug_only_hack_sameIRExprs_might_assert ( IRExpr* e1, IRExpr* e2 ) +static Bool +debug_only_hack_sameIRExprs_might_assert ( const IRExpr* e1, const IRExpr* e2 ) { if (e1->tag != e2->tag) return False; switch (e1->tag) { @@ -1177,7 +1177,7 @@ Bool debug_only_hack_sameIRExprs_might_assert ( IRExpr* e1, IRExpr* e2 ) /* Is this literally IRExpr_Const(IRConst_V128(0)) ? */ -static Bool isZeroV128 ( IRExpr* e ) +static Bool isZeroV128 ( const IRExpr* e ) { return toBool( e->tag == Iex_Const && e->Iex.Const.con->tag == Ico_V128 @@ -1185,7 +1185,7 @@ static Bool isZeroV128 ( IRExpr* e ) } /* Is this literally IRExpr_Const(IRConst_V128(1...1)) ? */ -static Bool isOnesV128 ( IRExpr* e ) +static Bool isOnesV128 ( const IRExpr* e ) { return toBool( e->tag == Iex_Const && e->Iex.Const.con->tag == Ico_V128 @@ -1193,7 +1193,7 @@ static Bool isOnesV128 ( IRExpr* e ) } /* Is this literally IRExpr_Const(IRConst_V256(0)) ? */ -static Bool isZeroV256 ( IRExpr* e ) +static Bool isZeroV256 ( const IRExpr* e ) { return toBool( e->tag == Iex_Const && e->Iex.Const.con->tag == Ico_V256 @@ -1201,7 +1201,7 @@ static Bool isZeroV256 ( IRExpr* e ) } /* Is this an integer constant with value 0 ? */ -static Bool isZeroU ( IRExpr* e ) +static Bool isZeroU ( const IRExpr* e ) { if (e->tag != Iex_Const) return False; switch (e->Iex.Const.con->tag) { @@ -1230,7 +1230,7 @@ static Bool isOneU ( const IRExpr* e ) } /* Is this an integer constant with value 1---1b ? */ -static Bool isOnesU ( IRExpr* e ) +static Bool isOnesU ( const IRExpr* e ) { if (e->tag != Iex_Const) return False; switch (e->Iex.Const.con->tag) { @@ -3199,7 +3199,7 @@ static IRExpr* subst_Expr ( IRExpr** env, IRExpr* ex ) As a result of this, the stmt may wind up being turned into a no-op. */ static IRStmt* subst_and_maybe_fold_Stmt ( Bool doFolding, - IRExpr** env, IRStmt* st ) + IRExpr** env, const IRStmt* st ) { # if 0 vex_printf("\nsubst and maybe fold stmt\n"); @@ -3607,7 +3607,7 @@ static void addUses_Temp ( Bool* set, IRTemp tmp ) set[(Int)tmp] = True; } -static void addUses_Expr ( Bool* set, IRExpr* e ) +static void addUses_Expr ( Bool* set, const IRExpr* e ) { Int i; switch (e->tag) { @@ -3657,7 +3657,7 @@ static void addUses_Expr ( Bool* set, IRExpr* e ) } } -static void addUses_Stmt ( Bool* set, IRStmt* st ) +static void addUses_Stmt ( Bool* set, const IRStmt* st ) { Int i; IRDirty* d; @@ -3737,7 +3737,7 @@ static void addUses_Stmt ( Bool* set, IRStmt* st ) /* Is this literally IRExpr_Const(IRConst_U1(False)) ? */ -static Bool isZeroU1 ( IRExpr* e ) +static Bool isZeroU1 ( const IRExpr* e ) { return toBool( e->tag == Iex_Const && e->Iex.Const.con->tag == Ico_U1 @@ -3745,7 +3745,7 @@ static Bool isZeroU1 ( IRExpr* e ) } /* Is this literally IRExpr_Const(IRConst_U1(True)) ? */ -static Bool isOneU1 ( IRExpr* e ) +static Bool isOneU1 ( const IRExpr* e ) { return toBool( e->tag == Iex_Const && e->Iex.Const.con->tag == Ico_U1 @@ -3937,8 +3937,8 @@ GSAliasing getAliasingRelation_IC ( IRRegArray* descr1, IRExpr* ix1, static GSAliasing getAliasingRelation_II ( - IRRegArray* descr1, IRExpr* ix1, Int bias1, - IRRegArray* descr2, IRExpr* ix2, Int bias2 + IRRegArray* descr1, const IRExpr* ix1, Int bias1, + IRRegArray* descr2, const IRExpr* ix2, Int bias2 ) { UInt minoff1, maxoff1, minoff2, maxoff2; diff --git a/VEX/priv/main_util.c b/VEX/priv/main_util.c index fffe4b426..2c713274d 100644 --- a/VEX/priv/main_util.c +++ b/VEX/priv/main_util.c @@ -632,9 +632,9 @@ UInt vex_sprintf ( HChar* buf, const HChar *format, ... ) /*--- Misaligned memory access support ---*/ /*---------------------------------------------------------*/ -UInt read_misaligned_UInt_LE ( void* addr ) +UInt read_misaligned_UInt_LE ( const void* addr ) { - UChar* p = (UChar*)addr; + const UChar* p = addr; UInt w = 0; w = (w << 8) | p[3]; w = (w << 8) | p[2]; @@ -643,9 +643,9 @@ UInt read_misaligned_UInt_LE ( void* addr ) return w; } -ULong read_misaligned_ULong_LE ( void* addr ) +ULong read_misaligned_ULong_LE ( const void* addr ) { - UChar* p = (UChar*)addr; + const UChar* p = addr; ULong w = 0; w = (w << 8) | p[7]; w = (w << 8) | p[6]; diff --git a/VEX/priv/main_util.h b/VEX/priv/main_util.h index 7fd304dd1..01b623fe7 100644 --- a/VEX/priv/main_util.h +++ b/VEX/priv/main_util.h @@ -195,8 +195,8 @@ static inline void* LibVEX_Alloc_inline ( SizeT nbytes ) /* Misaligned memory access support. */ -extern UInt read_misaligned_UInt_LE ( void* addr ); -extern ULong read_misaligned_ULong_LE ( void* addr ); +extern UInt read_misaligned_UInt_LE ( const void* addr ); +extern ULong read_misaligned_ULong_LE ( const void* addr ); extern void write_misaligned_UInt_LE ( void* addr, UInt w ); extern void write_misaligned_ULong_LE ( void* addr, ULong w ); From 2a5901e823f5f1090a21a365a771f58653026f25 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 18 Sep 2025 21:48:12 +0000 Subject: [PATCH 304/412] VEX: Remove isZeroU1 and isOneU1 Use isZeroU / isOneU instead. One function to rule them all. --- VEX/priv/ir_opt.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 4a2e3dcb7..4b07b27fc 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -3736,23 +3736,6 @@ static void addUses_Stmt ( Bool* set, const IRStmt* st ) } -/* Is this literally IRExpr_Const(IRConst_U1(False)) ? */ -static Bool isZeroU1 ( const IRExpr* e ) -{ - return toBool( e->tag == Iex_Const - && e->Iex.Const.con->tag == Ico_U1 - && e->Iex.Const.con->Ico.U1 == False ); -} - -/* Is this literally IRExpr_Const(IRConst_U1(True)) ? */ -static Bool isOneU1 ( const IRExpr* e ) -{ - return toBool( e->tag == Iex_Const - && e->Iex.Const.con->tag == Ico_U1 - && e->Iex.Const.con->Ico.U1 == True ); -} - - /* Note, this destructively modifies the given IRSB. */ /* Scan backwards through statements, carrying a set of IRTemps which @@ -3790,7 +3773,7 @@ static Bool isOneU1 ( const IRExpr* e ) continue; /* take note of any unconditional exits */ if (st->tag == Ist_Exit - && isOneU1(st->Ist.Exit.guard)) + && isOneU(st->Ist.Exit.guard)) i_unconditional_exit = i; if (st->tag == Ist_WrTmp && set[(Int)(st->Ist.WrTmp.tmp)] == False) { @@ -3805,7 +3788,7 @@ static Bool isOneU1 ( const IRExpr* e ) else if (st->tag == Ist_Dirty && st->Ist.Dirty.details->guard - && isZeroU1(st->Ist.Dirty.details->guard)) { + && isZeroU(st->Ist.Dirty.details->guard)) { /* This is a dirty helper which will never get called. Delete it. */ bb->stmts[i] = IRStmt_NoOp(); From c8b8f8a491b250b8b716c0460705f827ffaa2f6c Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 19 Sep 2025 15:15:39 +0000 Subject: [PATCH 305/412] s390: disasm-test: Fix a few opcode specs. Namely: eedtr, eextr, esdtr, esxtr, iedtr, iextr, rrdtr, rrxtr Wrong register class was used. binutils 2.44 let that slide by. 2.45 does not. --- none/tests/s390x/disasm-test/opcode.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/none/tests/s390x/disasm-test/opcode.c b/none/tests/s390x/disasm-test/opcode.c index e98a5e9e5..df8ca7e8c 100644 --- a/none/tests/s390x/disasm-test/opcode.c +++ b/none/tests/s390x/disasm-test/opcode.c @@ -1157,12 +1157,12 @@ static const char *opcodes[] = { "dxtr f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13}", "ddtra f1,f2,f3,m4", "dxtra f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},m4", - "eedtr f1,f2", - "eextr f1,f2:{0,1,4,5,8,9,12,13}", - "esdtr f1,f2", - "esxtr f1,f2:{0,1,4,5,8,9,12,13}", - "iedtr f1,f3,f2", - "iextr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},f2", + "eedtr r1,f2", + "eextr r1,f2:{0,1,4,5,8,9,12,13}", + "esdtr r1,f2", + "esxtr r1,f2:{0,1,4,5,8,9,12,13}", + "iedtr f1,f3,r2", + "iextr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},r2", "ltdtr f1,f2", "ltxtr f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13}", // fidtr not implemented @@ -1177,8 +1177,8 @@ static const char *opcodes[] = { "mxtra f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},m4", "qadtr f1,f3,f2,m4", "qaxtr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},m4", - "rrdtr f1,f3,f2,m4", - "rrxtr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},f2,m4", + "rrdtr f1,f3,r2,m4", + "rrxtr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},r2,m4", "sldt f1,f3,d12(x2,b2)", "slxt f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},d12(x2,b2)", "srdt f1,f3,d12(x2,b2)", From 53c66de8857300172c62827a4fc06e28685892a0 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 19 Sep 2025 11:47:14 +0200 Subject: [PATCH 306/412] Add missing ppc64-linux and s390x-linux syswraps existing on other arches This update adds following ppc64le and s390x syswraps: - sys_msgctl - sys_semctl - sys_semtimedop - sys_sethostname - sys_shmctl - sys_sigpending - sys_stime This update adds following ppc64le syswraps: - sys_setns This update adds following s390x syswraps: - sys_bpf Blacklist the shmctl05, as it is a long running one. It does pass on all architectures afaics, but needs a relatively high LTP_TIMEOUT_MUL setting. So, let's skip that one. https://bugs.kde.org/show_bug.cgi?id=509642 https://bugs.kde.org/show_bug.cgi?id=509643 --- NEWS | 2 ++ auxprogs/ltp-excludes.txt | 4 ++++ coregrind/m_syswrap/syswrap-ppc64-linux.c | 14 +++++++++----- coregrind/m_syswrap/syswrap-s390x-linux.c | 9 +++++++-- include/vki/vki-scnums-ppc64-linux.h | 4 ++++ include/vki/vki-scnums-s390x-linux.h | 5 +++++ 6 files changed, 31 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 3114eb4fe..f768e5ca5 100644 --- a/NEWS +++ b/NEWS @@ -139,6 +139,8 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509517 s390x: Even/odd lane confusion in various vector insns 509590 Run the LTP tests with LTP_QUIET 509567 unhandled amd64-linux syscall: 443 (quotactl_fd) +509642 Add missing ppc64-linux syswraps +509643 Add missing s390x-linux syswraps To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/auxprogs/ltp-excludes.txt b/auxprogs/ltp-excludes.txt index 0d00bab8a..3a3d7e44d 100644 --- a/auxprogs/ltp-excludes.txt +++ b/auxprogs/ltp-excludes.txt @@ -34,3 +34,7 @@ kcmp03 # don't have a separate mmap allocator so set hblks & hblkhd to 0. mallinfo02 mallinfo2_01 +# The shmctl05 testcase is a long running one. It does pass with +# LTP_TIMEOUT_MUL set to some relatively high value. Let's just +# skip it here. +shmctl05 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index d5e2f523c..974a4995f 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -630,7 +630,7 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_setuid, sys_setuid), // 23 GENX_(__NR_getuid, sys_getuid), // 24 -// _____(__NR_stime, sys_stime), // 25 + LINX_(__NR_stime, sys_stime), // 25 PLAXY(__NR_ptrace, sys_ptrace), // 26 GENX_(__NR_alarm, sys_alarm), // 27 // _____(__NR_oldfstat, sys_oldfstat), // 28 @@ -687,14 +687,14 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_setreuid, sys_setreuid), // 70 GENX_(__NR_setregid, sys_setregid), // 71 // _____(__NR_sigsuspend, sys_sigsuspend), // 72 -// _____(__NR_sigpending, sys_sigpending), // 73 -// _____(__NR_sethostname, sys_sethostname), // 74 + LINXY(__NR_sigpending, sys_sigpending), // 73 + GENX_(__NR_sethostname, sys_sethostname), // 74 GENX_(__NR_setrlimit, sys_setrlimit), // 75 GENXY(__NR_getrlimit, sys_getrlimit), // 76 GENXY(__NR_getrusage, sys_getrusage), // 77 GENXY(__NR_gettimeofday, sys_gettimeofday), // 78 -// _____(__NR_settimeofday, sys_settimeofday), // 79 + GENX_(__NR_settimeofday, sys_settimeofday), // 79 GENXY(__NR_getgroups, sys_getgroups), // 80 GENX_(__NR_setgroups, sys_setgroups), // 81 @@ -1005,6 +1005,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_syncfs, sys_syncfs), // 348 LINXY(__NR_sendmmsg, sys_sendmmsg), // 349 + LINX_(__NR_setns, sys_setns), // 350 LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 351 LINX_(__NR_process_vm_writev, sys_process_vm_writev),// 352 LINX_(__NR_kcmp, sys_kcmp), // 354 @@ -1031,7 +1032,10 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_rseq, sys_ni_syscall), // 387 LINX_(__NR_io_pgetevents, sys_io_pgetevents), // 388 - + LINX_(__NR_semtimedop, sys_semtimedop), // 392 + LINXY(__NR_semctl, sys_semctl), // 394 + LINXY(__NR_shmctl, sys_shmctl), // 396 + LINXY(__NR_msgctl, sys_msgctl), // 402 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 diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index 4d794ce81..8f7159751 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -498,8 +498,8 @@ static SyscallTableEntry syscall_table[] = { GENX_(70, sys_ni_syscall), /* unimplemented (by the kernel) */ // 70 GENX_(71, sys_ni_syscall), /* unimplemented (by the kernel) */ // 71 // ?????(__NR_sigsuspend, ), // 72 -// ?????(__NR_sigpending, ), // 73 -// ?????(__NR_sethostname, ), // 74 + LINXY(__NR_sigpending, sys_sigpending), // 73 + GENX_(__NR_sethostname, sys_sethostname), // 74 GENX_(__NR_setrlimit, sys_setrlimit), // 75 GENXY(76, sys_getrlimit), /* see also 191 */ // 76 @@ -832,6 +832,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_getrandom, sys_getrandom), // 349 LINXY(__NR_memfd_create, sys_memfd_create), // 350 + LINXY(__NR_bpf, sys_bpf), // 351 LINX_(__NR_execveat, sys_execveat), // 354 @@ -864,6 +865,10 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_rseq, sys_ni_syscall), // 381 LINX_(__NR_io_pgetevents, sys_io_pgetevents), // 382 + LINX_(__NR_semtimedop, sys_semtimedop), // 392 + LINXY(__NR_semctl, sys_semctl), // 394 + LINXY(__NR_shmctl, sys_shmctl), // 396 + LINXY(__NR_msgctl, sys_msgctl), // 402 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 diff --git a/include/vki/vki-scnums-ppc64-linux.h b/include/vki/vki-scnums-ppc64-linux.h index 4b42c60b5..85e2d7a70 100644 --- a/include/vki/vki-scnums-ppc64-linux.h +++ b/include/vki/vki-scnums-ppc64-linux.h @@ -409,6 +409,10 @@ #define __NR_pkey_mprotect 386 #define __NR_rseq 387 #define __NR_io_pgetevents 388 +#define __NR_semtimedop 392 +#define __NR_semctl 394 +#define __NR_shmctl 396 +#define __NR_msgctl 402 #define __NR_futex_waitv 449 #endif /* __VKI_SCNUMS_PPC64_LINUX_H */ diff --git a/include/vki/vki-scnums-s390x-linux.h b/include/vki/vki-scnums-s390x-linux.h index ad3647d23..22d94ee4d 100644 --- a/include/vki/vki-scnums-s390x-linux.h +++ b/include/vki/vki-scnums-s390x-linux.h @@ -314,6 +314,7 @@ #define __NR_seccomp 348 #define __NR_getrandom 349 #define __NR_memfd_create 350 +#define __NR_bpf 351 #define __NR_execveat 354 @@ -346,6 +347,10 @@ #define __NR_kexec_file_load 381 #define __NR_io_pgetevents 382 #define __NR_rseq 383 +#define __NR_semtimedop 392 +#define __NR_semctl 394 +#define __NR_shmctl 396 +#define __NR_msgctl 402 #define __NR_futex_waitv 449 #define NR_syscalls 384 From 3d224b85acd061419dd0276e345c402198178d1d Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 19 Sep 2025 15:25:00 +0000 Subject: [PATCH 307/412] s390: Tweak disasm-test Remove stdout.exp file as it is not needed. The mandatory .stderr.exp file was not empty even though disasm-test does not write anything to stderr. Annoying! ../filter_stderr was doing it. Adjust filter_stderr accordingly and let .stderr.exp reflect the actual output. --- none/tests/s390x/disasm-test/disasm-test.stderr.exp | 2 -- none/tests/s390x/disasm-test/disasm-test.stdout.exp | 0 none/tests/s390x/disasm-test/filter_stderr | 3 ++- 3 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 none/tests/s390x/disasm-test/disasm-test.stdout.exp diff --git a/none/tests/s390x/disasm-test/disasm-test.stderr.exp b/none/tests/s390x/disasm-test/disasm-test.stderr.exp index 139597f9c..e69de29bb 100644 --- a/none/tests/s390x/disasm-test/disasm-test.stderr.exp +++ b/none/tests/s390x/disasm-test/disasm-test.stderr.exp @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/disasm-test/disasm-test.stdout.exp b/none/tests/s390x/disasm-test/disasm-test.stdout.exp deleted file mode 100644 index e69de29bb..000000000 diff --git a/none/tests/s390x/disasm-test/filter_stderr b/none/tests/s390x/disasm-test/filter_stderr index f4c67057e..17cc8adf5 100755 --- a/none/tests/s390x/disasm-test/filter_stderr +++ b/none/tests/s390x/disasm-test/filter_stderr @@ -1,3 +1,4 @@ #!/bin/sh -../../filter_stderr "$@" +# Nothing to filter. +true From 1bed301999ee962d3b57869053b64a064ae8d6ba Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 19 Sep 2025 16:06:39 +0000 Subject: [PATCH 308/412] Fix none/tests/s390x/disasm-test/Makefile.am Remove disasm-test.stdout.exp from Makefile.am. This was fogotten in 3d224b85ac. --- none/tests/s390x/disasm-test/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/none/tests/s390x/disasm-test/Makefile.am b/none/tests/s390x/disasm-test/Makefile.am index 9d3ee3a29..5629d7d52 100644 --- a/none/tests/s390x/disasm-test/Makefile.am +++ b/none/tests/s390x/disasm-test/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/Makefile.all.am -EXTRA_DIST = disasm-test.vgtest disasm-test.stderr.exp disasm-test.stdout.exp \ +EXTRA_DIST = disasm-test.vgtest disasm-test.stderr.exp \ disasm-test.post.exp dist_noinst_SCRIPTS = filter_stderr From 2604bb753a9ff461550e0d4d0c1ebd3ab6488d6d Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 19 Sep 2025 09:31:39 +0200 Subject: [PATCH 309/412] Wrap the setdomainname syscall The setdomainname() call sets the domain name to the value given in the character array name. The len argument specifies the number of bytes in name. (Thus, name does not require a terminating null byte.) Declare a setdomainname wrapper in priv_syswrap-linux.h and hook it for {amd64,arm,arm64,mips64,ppc32,ppc64,riscv64,s390x,x86}-linux using LINX_ with PRE handler in syswrap-linux.c https://bugs.kde.org/show_bug.cgi?id=369030 --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 1 + coregrind/m_syswrap/syswrap-amd64-linux.c | 2 +- coregrind/m_syswrap/syswrap-arm-linux.c | 2 +- coregrind/m_syswrap/syswrap-arm64-linux.c | 2 +- coregrind/m_syswrap/syswrap-linux.c | 7 +++++++ coregrind/m_syswrap/syswrap-mips32-linux.c | 2 +- coregrind/m_syswrap/syswrap-mips64-linux.c | 9 +-------- coregrind/m_syswrap/syswrap-nanomips-linux.c | 9 +-------- coregrind/m_syswrap/syswrap-ppc32-linux.c | 2 +- coregrind/m_syswrap/syswrap-ppc64-linux.c | 2 +- coregrind/m_syswrap/syswrap-riscv64-linux.c | 1 + coregrind/m_syswrap/syswrap-s390x-linux.c | 2 +- coregrind/m_syswrap/syswrap-x86-linux.c | 2 +- include/vki/vki-scnums-riscv64-linux.h | 1 + 15 files changed, 21 insertions(+), 24 deletions(-) diff --git a/NEWS b/NEWS index f768e5ca5..66a9f29a2 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 309554 Wrap syscall remap_file_pages (216) 338803 Handling of dwz debug alt files or cross-CU is broken +369030 Wrap linux syscall: 171 (setdomainname) 388526 Inconsistent severity in message text: "WARNING: Serious error" 418756 MAP_FIXED_NOREPLACE mmap flag unsupported 493430 Review all syscalls that use or return (new) file descriptors diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 49a4c222b..752bdf737 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -62,6 +62,7 @@ DECL_TEMPLATE(linux, sys_readahead); DECL_TEMPLATE(linux, sys_move_pages); DECL_TEMPLATE(linux, sys_cachestat); DECL_TEMPLATE(linux, sys_sysfs); +DECL_TEMPLATE(linux, sys_setdomainname); // clone is similar enough between linux variants to have a generic // version, but which will call an extern defined in syswrap--linux.c diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 88c84b841..8b2c95037 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -675,7 +675,7 @@ static SyscallTableEntry syscall_table[] = { // (__NR_reboot, sys_reboot), // 169 GENX_(__NR_sethostname, sys_sethostname), // 170 - // (__NR_setdomainname, sys_setdomainname), // 171 + LINX_(__NR_setdomainname, sys_setdomainname), // 171 GENX_(__NR_iopl, sys_iopl), // 172 LINX_(__NR_ioperm, sys_ioperm), // 173 GENX_(__NR_create_module, sys_ni_syscall), // 174 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 5567146eb..e4f5e4c09 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -694,7 +694,7 @@ static SyscallTableEntry syscall_main_table[] = { PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux LINX_(__NR_clone, sys_clone), // 120 -//zz // (__NR_setdomainname, sys_setdomainname), // 121 */*(?) + LINX_(__NR_setdomainname, sys_setdomainname), // 121 GENXY(__NR_uname, sys_newuname), // 122 // PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 LINXY(__NR_adjtimex, sys_adjtimex), // 124 diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index ada952cca..e1a8a883f 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -710,7 +710,7 @@ static SyscallTableEntry syscall_main_table[] = { GENX_(__NR_setgroups, sys_setgroups), // 159 GENXY(__NR_uname, sys_newuname), // 160 GENX_(__NR_sethostname, sys_sethostname), // 161 - // (__NR_setdomainname, sys_ni_syscall), // 162 + LINX_(__NR_setdomainname, sys_setdomainname), // 162 GENXY(__NR_getrlimit, sys_old_getrlimit), // 163 GENX_(__NR_setrlimit, sys_setrlimit), // 164 GENXY(__NR_getrusage, sys_getrusage), // 165 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 0d5aa7965..547417698 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -1653,6 +1653,13 @@ POST(sys_sendfile64) } } +PRE(sys_setdomainname) +{ + PRINT ("sys_setdomainname ( %#" FMT_REGWORD "x, %ld )", ARG1, SARG2); + PRE_REG_READ2 (long, "setdomainname", const void *, name, int, len); + PRE_MEM_READ("setdomainname(name)", ARG1, ARG2); +} + static void pre_read_timespec64 (ThreadId tid, const char *msg, UWord arg) { struct vki_timespec64 *ts64 = (void *)(Addr)arg; diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index ba5a8bb17..d1f5dfce3 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -886,7 +886,7 @@ static SyscallTableEntry syscall_main_table[] = { GENX_ (__NR_fsync, sys_fsync), // 118 PLAX_ (__NR_sigreturn, sys_sigreturn), // 119 LINX_ (__NR_clone, sys_clone), // 120 - //.. // (__NR_setdomainname, sys_setdomainname), // 121 + LINX_ (__NR_setdomainname, sys_setdomainname), // 121 GENXY (__NR_uname, sys_newuname), // 122 //.. PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 LINXY (__NR_adjtimex, sys_adjtimex), // 124 diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 095be9b6a..64fb647b1 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -217,7 +217,6 @@ SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ) DECL_TEMPLATE (mips_linux, sys_set_thread_area); DECL_TEMPLATE (mips_linux, sys_swapon); DECL_TEMPLATE (mips_linux, sys_swapoff); -DECL_TEMPLATE (mips_linux, sys_setdomainname); DECL_TEMPLATE (mips_linux, sys_sethostname); DECL_TEMPLATE (mips_linux, sys_reboot); DECL_TEMPLATE (mips_linux, sys_cacheflush); @@ -273,12 +272,6 @@ PRE(sys_reboot) *flags |= SfMayBlock; } -PRE(sys_setdomainname) -{ - PRINT ("sys_setdomainname ( %#" FMT_REGWORD "x, %ld )", ARG1, SARG2); - PRE_REG_READ2 (long, "setdomainname", const void *, name, int, len); -} - PRE(sys_sethostname) { PRINT ("sys_sethostname ( %#" FMT_REGWORD "x, %ld )", ARG1, SARG2); @@ -658,7 +651,7 @@ static SyscallTableEntry syscall_main_table[] = { PLAX_ (__NR_swapoff, sys_swapoff), PLAX_ (__NR_reboot, sys_reboot), PLAX_ (__NR_sethostname, sys_sethostname), - PLAX_ (__NR_setdomainname, sys_setdomainname), + LINX_ (__NR_setdomainname, sys_setdomainname), GENX_ (__NR_create_module, sys_ni_syscall), LINX_ (__NR_init_module, sys_init_module), LINX_ (__NR_delete_module, sys_delete_module), diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index 592d93d8f..94e4ce4d4 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -382,7 +382,6 @@ DECL_TEMPLATE (mips_linux, sys_set_thread_area); DECL_TEMPLATE (mips_linux, sys_ptrace); DECL_TEMPLATE (mips_linux, sys_unshare); DECL_TEMPLATE (mips_linux, sys_reboot); -DECL_TEMPLATE (mips_linux, sys_setdomainname); DECL_TEMPLATE (mips_linux, sys_sethostname); DECL_TEMPLATE (mips_linux, sys_swapon); DECL_TEMPLATE (mips_linux, sys_swapoff); @@ -514,12 +513,6 @@ PRE(sys_reboot) *flags |= SfMayBlock; } -PRE(sys_setdomainname) -{ - PRINT ("sys_setdomainname ( %#lx, %ld )", ARG1, SARG2); - PRE_REG_READ2 (long, "setdomainname", const void *, name, int, len); -} - PRE(sys_sethostname) { PRINT ("sys_sethostname ( %#lx, %ld )", ARG1, SARG2); @@ -712,7 +705,7 @@ static SyscallTableEntry syscall_main_table[] = { GENX_ (__NR_setgroups, sys_setgroups), GENXY (__NR_uname, sys_newuname), PLAX_ (__NR_sethostname, sys_sethostname), - PLAX_ (__NR_setdomainname, sys_setdomainname), + LINX_ (__NR_setdomainname, sys_setdomainname), GENXY (__NR_getrusage, sys_getrusage), GENX_ (__NR_umask, sys_umask), LINXY (__NR_prctl, sys_prctl), diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index a0e11d5ed..94010bcee 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -757,7 +757,7 @@ static SyscallTableEntry syscall_table[] = { PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux //.. LINX_(__NR_clone, sys_clone), // 120 -//.. // (__NR_setdomainname, sys_setdomainname), // 121 */*(?) + LINX_(__NR_setdomainname, sys_setdomainname), // 121 GENXY(__NR_uname, sys_newuname), // 122 //.. PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 LINXY(__NR_adjtimex, sys_adjtimex), // 124 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 974a4995f..da81c0757 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -745,7 +745,7 @@ static SyscallTableEntry syscall_table[] = { // _____(__NR_sigreturn, sys_sigreturn), // 119 LINX_(__NR_clone, sys_clone), // 120 -// _____(__NR_setdomainname, sys_setdomainname), // 121 + LINX_(__NR_setdomainname, sys_setdomainname), // 121 GENXY(__NR_uname, sys_newuname), // 122 // _____(__NR_modify_ldt, sys_modify_ldt), // 123 LINXY(__NR_adjtimex, sys_adjtimex), // 124 diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index 5134bd171..dc175e3ec 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -468,6 +468,7 @@ static SyscallTableEntry syscall_main_table[] = { GENX_(__NR_setgroups, sys_setgroups), /* 159 */ GENXY(__NR_uname, sys_newuname), /* 160 */ GENX_(__NR_sethostname, sys_sethostname), /* 161 */ + LINX_(__NR_setdomainname, sys_setdomainname), /* 162 */ GENXY(__NR_getrlimit, sys_getrlimit), /* 163 */ GENX_(__NR_setrlimit, sys_setrlimit), /* 164 */ GENXY(__NR_getrusage, sys_getrusage), /* 165 */ diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index 8f7159751..fba3d96fb 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -556,7 +556,7 @@ static SyscallTableEntry syscall_table[] = { PLAX_(__NR_sigreturn, sys_sigreturn), // 119 LINX_(__NR_clone, sys_clone), // 120 -// ?????(__NR_setdomainname, ), // 121 + LINX_(__NR_setdomainname, sys_setdomainname), // 121 GENXY(__NR_uname, sys_newuname), // 122 GENX_(123, sys_ni_syscall), /* unimplemented (by the kernel) */ // 123 // ?????(__NR_adjtimex, ), // 124 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index f129317a8..7d2d495a9 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1302,7 +1302,7 @@ static SyscallTableEntry syscall_table[] = { PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux LINX_(__NR_clone, sys_clone), // 120 -//zz // (__NR_setdomainname, sys_setdomainname), // 121 */*(?) + LINX_(__NR_setdomainname, sys_setdomainname), // 121 GENXY(__NR_uname, sys_newuname), // 122 PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 LINXY(__NR_adjtimex, sys_adjtimex), // 124 diff --git a/include/vki/vki-scnums-riscv64-linux.h b/include/vki/vki-scnums-riscv64-linux.h index f30636f41..6130ce37f 100644 --- a/include/vki/vki-scnums-riscv64-linux.h +++ b/include/vki/vki-scnums-riscv64-linux.h @@ -192,6 +192,7 @@ #define __NR_setgroups 159 #define __NR_uname 160 #define __NR_sethostname 161 +#define __NR_setdomainname 162 #define __NR_getrlimit 163 #define __NR_setrlimit 164 #define __NR_getrusage 165 From 3e30bd17b037f4f402a020f8674b1ae576c5cfcc Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 19 Sep 2025 19:57:07 +0200 Subject: [PATCH 310/412] FreeBSD regtest: add syscall 9999 to scalar This provokes an unhandled syscall message, as is done on other platforms. Update filter since scalar runs on all FreeBSD platforms. --- coregrind/pub_core_aspacemgr.h | 2 +- memcheck/tests/freebsd/filter_scalar | 1 + memcheck/tests/freebsd/scalar.c | 5 +++++ memcheck/tests/freebsd/scalar.stderr.exp | 8 ++++++++ memcheck/tests/freebsd/scalar.stderr.exp-x86 | 8 ++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/coregrind/pub_core_aspacemgr.h b/coregrind/pub_core_aspacemgr.h index b867108a2..56c5b8dd1 100644 --- a/coregrind/pub_core_aspacemgr.h +++ b/coregrind/pub_core_aspacemgr.h @@ -340,7 +340,7 @@ extern Bool VG_(am_relocate_nooverlap_client)( /*OUT*/Bool* need_discard, #else # define VG_STACK_GUARD_SZB 8192 // 2 pages #endif -# define VG_DEFAULT_STACK_ACTIVE_SZB 1048576 // (4096 * 256) = 1Mb +# define VG_DEFAULT_STACK_ACTIVE_SZB 1048576 // (4096 * 256) = 1Mb typedef struct _VgStack VgStack; diff --git a/memcheck/tests/freebsd/filter_scalar b/memcheck/tests/freebsd/filter_scalar index 1e4f2d753..2741038d1 100755 --- a/memcheck/tests/freebsd/filter_scalar +++ b/memcheck/tests/freebsd/filter_scalar @@ -16,6 +16,7 @@ sed '/at 0x........: syscall (in \/...libc...)/d' | sed 's/SYS_freebsd12/ SYS/' | sed 's/SYS_freebsd13/ SYS/' | sed 's/SYS_freebsd14/ SYS/' | +sed 's/arm64-freebsd/amd64-freebsd/' | # get rid of error limit message diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index d327609ac..acb4b662e 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -2594,6 +2594,11 @@ int main(void) FAKE_SY("\n"); #endif + // no such syscall... + GO(9999, "1e"); + SY(9999); FAIL; + + /* SYS_exit 1 */ GO(SYS_exit, "1s 0m"); SY(SYS_exit, x0); FAIL; diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 638e87bd6..2acb864e7 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -5854,6 +5854,14 @@ Syscall param setgroups(list) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +9999: 9999 1e +--------------------------------------------------------- +WARNING: unhandled amd64-freebsd syscall: 9999 +You may be able to write your own handler. +Read the file README_MISSING_SYSCALL_OR_IOCTL. +Nevertheless we consider this a bug. Please report +it at http://valgrind.org/support/bug_reports.html. --------------------------------------------------------- 1: SYS_exit 1s 0m --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 7304090f5..957ffb205 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -5926,6 +5926,14 @@ Syscall param setgroups(list) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +9999: 9999 1e +--------------------------------------------------------- +WARNING: unhandled x86-freebsd syscall: 9999 +You may be able to write your own handler. +Read the file README_MISSING_SYSCALL_OR_IOCTL. +Nevertheless we consider this a bug. Please report +it at http://valgrind.org/support/bug_reports.html. --------------------------------------------------------- 1: SYS_exit 1s 0m --------------------------------------------------------- From 0aecd4fe70e1522314866c48b6de20b6ea2f08a3 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 19 Sep 2025 17:25:30 +0200 Subject: [PATCH 311/412] Wrap the mount_setattr syscall 442 int syscall(SYS_mount_setattr, int dirfd, const char *pathname, unsigned int flags, struct mount_attr *attr, size_t size); The mount_setattr() system call changes the mount properties of a mount or an entire mount tree. If pathname is a relative pathname, then it is interpreted relative to the directory referred to by the file descriptor dirfd. If dirfd is the special value AT_FDCWD, then pathname is interpreted relative to the current working directory of the calling process. If pathname is the empty string and AT_EMPTY_PATH is specified in flags, then the mount properties of the mount identified by dirfd are changed Declare a mount_setattr wrapper in priv_syswrap-linux.h and hook it for {amd64,arm,arm64,mips64,ppc32,ppc64,riscv64,s390x,x86}-linux using LINX_ with PRE handler in syswrap-linux.c Part of this update also is a fix of the sys_move_mount wrapper. Specifically there was a typo mount_moce vs. move_mount, and also there was a problem in handling VKI_AT_FDCWD special fd value in the check for to_fd and to_pathname. https://bugs.kde.org/show_bug.cgi?id=509566 --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 3 ++ coregrind/m_syswrap/syswrap-amd64-linux.c | 1 + coregrind/m_syswrap/syswrap-arm-linux.c | 1 + coregrind/m_syswrap/syswrap-arm64-linux.c | 1 + coregrind/m_syswrap/syswrap-linux.c | 34 ++++++++++++--------- coregrind/m_syswrap/syswrap-mips32-linux.c | 1 + coregrind/m_syswrap/syswrap-mips64-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc32-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc64-linux.c | 1 + coregrind/m_syswrap/syswrap-riscv64-linux.c | 1 + coregrind/m_syswrap/syswrap-s390x-linux.c | 1 + coregrind/m_syswrap/syswrap-x86-linux.c | 1 + include/vki/vki-scnums-shared-linux.h | 1 + 14 files changed, 34 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index 66a9f29a2..ecd58cc50 100644 --- a/NEWS +++ b/NEWS @@ -138,6 +138,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509139 Update BadSize error messages 509258 FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers 509517 s390x: Even/odd lane confusion in various vector insns +509566 Wrap amd64-linux syscall: 442 (mount_setattr) 509590 Run the LTP tests with LTP_QUIET 509567 unhandled amd64-linux syscall: 443 (quotactl_fd) 509642 Add missing ppc64-linux syswraps diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 752bdf737..53aa1b582 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -346,6 +346,9 @@ DECL_TEMPLATE(linux, sys_pidfd_open); DECL_TEMPLATE(linux, sys_close_range); DECL_TEMPLATE(linux, sys_openat2); +// Linux-specific (new in Linux 5.12) +DECL_TEMPLATE(linux, sys_mount_setattr) + // Linux-specific (new in Linux 5.13) DECL_TEMPLATE(linux, sys_landlock_create_ruleset) DECL_TEMPLATE(linux, sys_landlock_add_rule) diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 8b2c95037..4a3bad55f 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -895,6 +895,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index e4f5e4c09..f55ed05e6 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -1069,6 +1069,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_pidfd_getfd, sys_pidfd_getfd), // 438 LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index e1a8a883f..b28b4598c 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -846,6 +846,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 547417698..d891ac6da 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -1025,6 +1025,18 @@ PRE(sys_mount) PRE_MEM_RASCIIZ( "mount(type)", ARG3); } +PRE(sys_mount_setattr) +{ + // int syscall(SYS_mount_setattr, int dirfd, const char *pathname, + // unsigned int flags, struct mount_attr *attr, size_t size); + *flags |= SfMayBlock; + PRINT("sys_mount_setattr ( %d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" + FMT_REGWORD "x, %" FMT_REGWORD "u )", (Int)ARG1, ARG2, + ARG3, ARG4, ARG5); + PRE_MEM_READ("mount(attr)", ARG5, ARG6); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mount_setattr(dirfd)", tid, status); +} + PRE(sys_oldumount) { PRINT("sys_oldumount( %#" FMT_REGWORD "x )", ARG1); @@ -2897,9 +2909,9 @@ PRE(sys_fanotify_mark) #else # error Unexpected word size #endif - if ( !ML_(fd_allowed)(SARG1, "fanotify_mark[fanotify_fd]", tid, False) ) + if ( !ML_(fd_allowed)(SARG1, "fanotify_mark(fanotify_fd)", tid, False) ) SET_STATUS_Failure( VKI_EBADF ); - ML_(fd_at_check_allowed)(SARG4, (const HChar*)ARG5, "mkdirat[firfd]", tid, status); + ML_(fd_at_check_allowed)(SARG4, (const HChar*)ARG5, "fanotify_mark(dirfd)", tid, status); } /* --------------------------------------------------------------------- @@ -14340,27 +14352,19 @@ PRE(sys_move_mount) "%ld, %#" FMT_REGWORD "x(%s), %ld", SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3, ARG4, (HChar*)(Addr)ARG4, SARG5); - PRE_REG_READ5(long, "mount_move", + PRE_REG_READ5(long, "move_mount", int, from_dfd, const char *, from_pathname, int, to_dfd, const char*, to_pathname, int, flags); - PRE_MEM_RASCIIZ( "mount_move(from_pathname)", ARG2); + PRE_MEM_RASCIIZ( "move_mount(from_pathname)", ARG2); /* For absolute filenames, from_dfd is ignored. If from_dfd is AT_FDCWD, from_pathname is relative to cwd. When comparing from_dfd against AT_FDCWD, be sure only to compare the bottom 32 bits. */ - if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && *(Char *)(Addr)ARG2 != '/' - && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG1, "mount_move", tid, False)) - SET_STATUS_Failure( VKI_EBADF ); - PRE_MEM_RASCIIZ( "mount_move(from_pathname)", ARG4); + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "move_mount(from_dfd)", tid, status); + PRE_MEM_RASCIIZ( "move_mount(to_pathname)", ARG4); /* For absolute filenames, to_dfd is ignored. If to_dfd is AT_FDCWD, to_pathname is relative to cwd. When comparing to_dfd against AT_FDCWD, be sure only to compare the bottom 32 bits. */ - if (ML_(safe_to_deref)( (void*)(Addr)ARG4, 1 ) - && *(Char *)(Addr)ARG4 != '/' - && ((Int)ARG4) != ((Int)VKI_AT_FDCWD) - && !ML_(fd_allowed)(ARG3, "mount_move", tid, False)) - SET_STATUS_Failure( VKI_EBADF ); + ML_(fd_at_check_allowed)(SARG3, (const HChar*)ARG4, "move_mount(to_dfd)", tid, status); } /* int fsopen (const char *fs_name, unsigned int flags) */ diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index d1f5dfce3..c4d7a6620 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -1176,6 +1176,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_ (__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 64fb647b1..45af0a3fd 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -646,6 +646,7 @@ static SyscallTableEntry syscall_main_table[] = { GENX_ (__NR_acct, sys_acct), GENX_ (__NR_settimeofday, sys_settimeofday), LINX_ (__NR_mount, sys_mount), + LINX_ (__NR_mount_setattr, sys_mount_setattr), LINX_ (__NR_umount2, sys_umount), PLAX_ (__NR_swapon, sys_swapon), PLAX_ (__NR_swapoff, sys_swapoff), diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index 94010bcee..8bb0a04f5 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -1075,6 +1075,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_ (__NR_mount_setattr, sys_mount_setattr), // 442 LINX_ (__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index da81c0757..0f5111728 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1053,6 +1053,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_ (__NR_mount_setattr, sys_mount_setattr), // 442 LINX_ (__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index dc175e3ec..d806b92b8 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -595,6 +595,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_pidfd_getfd, sys_pidfd_getfd), /* 438 */ LINX_(__NR_faccessat2, sys_faccessat2), /* 439 */ LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), /* 441 */ + LINX_(__NR_mount_setattr, sys_mount_setattr), /* 442 */ LINX_(__NR_quotactl_fd, sys_quotactl_fd), /* 443 */ LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), /* 444 */ LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), /* 445 */ diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index fba3d96fb..643549c64 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -886,6 +886,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 7d2d495a9..42a69cb96 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1668,6 +1668,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h index c5f33e935..518131a1f 100644 --- a/include/vki/vki-scnums-shared-linux.h +++ b/include/vki/vki-scnums-shared-linux.h @@ -48,6 +48,7 @@ #define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 #define __NR_quotactl_fd 443 #define __NR_landlock_create_ruleset 444 #define __NR_landlock_add_rule 445 From 9a1dbff3812a71ea556b9d80056a11ca8ff88023 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 19 Sep 2025 22:06:27 +0000 Subject: [PATCH 312/412] s390: Add bfp-emit.pl (BZ 509572) For a BFP insn X in the guest code the same insn will be emitted in the jitted code. This does not hold universally but for most BFP insns it does. bfp-emit.pl contains a complete list of all BFP insns as of Principles of Operations SA22-7832-14. It tests all insns for which the above observation is true and ensures the emitted insn matches the insn in the guest code. Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 --- none/tests/s390x/Makefile.am | 3 +- none/tests/s390x/bfp-emit.pl | 483 ++++++++++++ none/tests/s390x/bfp-emit.post.exp | 1050 ++++++++++++++++++++++++++ none/tests/s390x/bfp-emit.stderr.exp | 2 + none/tests/s390x/bfp-emit.vgtest | 3 + 5 files changed, 1540 insertions(+), 1 deletion(-) create mode 100755 none/tests/s390x/bfp-emit.pl create mode 100644 none/tests/s390x/bfp-emit.post.exp create mode 100644 none/tests/s390x/bfp-emit.stderr.exp create mode 100644 none/tests/s390x/bfp-emit.vgtest diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 88ee52e7a..98ef178e7 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/Makefile.tool-tests.am -dist_noinst_SCRIPTS = filter_stderr +dist_noinst_SCRIPTS = filter_stderr bfp-emit.pl INSN_TESTS = clc clcle cvb cvd icm lpr tcxb lam_stam xc mvst add sub mul \ and or xor insert div srst fold_And16 flogr sub_EI add_EI \ @@ -34,6 +34,7 @@ EXTRA_DIST = \ $(addsuffix .stderr.exp,$(INSN_TESTS)) \ $(addsuffix .stdout.exp,$(INSN_TESTS)) \ $(addsuffix .vgtest,$(INSN_TESTS)) \ + bfp-emit.vgtest bfp-emit.stderr.exp bfp-emit.post.exp \ ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ ecag.stdout.exp-z16 \ diff --git a/none/tests/s390x/bfp-emit.pl b/none/tests/s390x/bfp-emit.pl new file mode 100755 index 000000000..4128a5d02 --- /dev/null +++ b/none/tests/s390x/bfp-emit.pl @@ -0,0 +1,483 @@ +#!/usr/bin/env perl + +#-------------------------------------------------------------------- +# For a subset of the available BFP insns the following is true: +# +# For a BFP insn X in the guest code the very same insn will be +# emitted in the jitted code. +# +# This is because IR optimisers do not touch floating point IROps. +# Meaning: if we can show that for insn X the same insn X is emitted +# we do not need to proof read results of floating point computations. +# Exceptions are: checking order of operands for non-commutative +# operators and condition code computation. This is done elsewhere. +# +# Here we do the following: +# Craft a tiny program using insns X. Run valgrind on it, trace IR +# generation and assembly. Check the output making sure that insn X +# appears once in the "Frontend" section and once in the "Assembly" +# section. +# +# Below is a complete list of all BFP insns as of SA22-7832-14. +#-------------------------------------------------------------------- + +use strict; +use warnings; +use Cwd 'abs_path'; + +my $rootdir = get_rootdir(); +my $runone = "$rootdir/auxprogs/s390-runone"; +my $valgrind = "$rootdir/coregrind/valgrind"; +my $valargs = "-q --tool=none --trace-notbelow=0 --trace-flags=10000001"; + + +# Instructions that are always mapped independent of any rounding mode +# or whatever. +my %insn_map = ( + # l[cnp]dfr cannot be disinguished from l[cnp]dbr because they + # use the same IROp. + "lcdfr" => "lcdbr", + "lndfr" => "lndbr", + "lpdfr" => "lpdbr", + + # The "and signal" part is currently ignored + "kebr" => "cebr", + "kdbr" => "cdbr", + "kxbr" => "cxbr", + + # c[fg][edx]br and c[fg][edx]bra differ only in the presence of an m4 + # field. That field cannot be represented in VEX IR and is therefore + # ignored and assumed to be zero. + "cfebra" => "cfebr", + "cfdbra" => "cfdbr", + "cfxbra" => "cfxbr", + "cgebra" => "cgebr", + "cgdbra" => "cgdbr", + "cgxbra" => "cgxbr", + + # cdfbra 32-bit int --> 64-bit BFP Iop_I32StoF64 has no rounding + # cxfbra 32-bit int --> 128-bit BFP Iop_I32StoF128 has no rounding mode + # cxgbra 64-bit int --> 128-bit BFP Iop_I64StoF128 has no rounding mode + "cdfbra" => "cdfbr", + "cxfbra" => "cxfbr", + "cxgbra" => "cxgbr", + + # fi[edx]br and fi[edx]bra differ only in the presence of an m4 field. + # That field cannot be represented in VEX IR and is therefore ignored + # and assumed to be zero. + "fiebra" => "fiebr", + "fidbra" => "fidbr", + "fixbra" => "fixbr", +); + +&main; + +sub main +{ + if ($#ARGV == 0 && $ARGV[0] eq "--check-prereq") { + my $stdout = `as --version`; + # GNU assembler (GNU Binutils for Ubuntu) 2.38 + $stdout = (split /\n/, $stdout)[0]; + $stdout =~ s/^[^0-9]+//; + my @v = split /\./, $stdout; + exit 0 if ($v[0] > 2 || ($v[0] == 2 && $v[1] >= 44)); + exit 1; + } + + #----------------------------------------------------------------------- + # POP Chapter 9: Floating-Point Overview and Support Instructions + #----------------------------------------------------------------------- + + # CONVERT BFP TO HFP not implemented + # CONVERT HFP TO BFP not implemented + # COPY SIGN insn not mapped one-to-one + # EXTRACT FPC just guest state access + # LOAD just guest state access + + header("LOAD COMPLEMENT"); + test_insn("lcdfr %f0,%f1", \&mapper); + + # LOAD FPC just guest state access + # LOAD FPC AND SIGNAL not implemented + + header("LOAD FPR FROM GR"); + test_insn("ldgr %f0,%r1"); + + header("LOAD GR FROM FPR"); + test_insn("lgdr %r0,%f1"); + + header("LOAD NEGATIVE"); + test_insn("lndfr %f0,%f1", \&mapper); + + header("LOAD POSITIVE"); + test_insn("lpdfr %f0,%f1", \&mapper); + + header("LOAD ZERO"); + test_insn("lzer %f0"); + test_insn("lzdr %f0"); + # test_insn("lzxr %f0") insn not mapped one-to-one + + # PFPO insn not mapped one-to-one + # SET BFP ROUNDING MODE insn not mapped one-to-one + # SET DFP ROUNDING MODE insn not mapped one-to-one + # SET FPC just guest state access + # SET FPC AND SIGNAL not implemented + # STORE insn not mapped one-to-one + # STORE FPC just store + guest state access + + #---------------------------------------------------------------------- + # POP Chapter 19: Binary-Floating-Point Instructions + #---------------------------------------------------------------------- + + header("ADD"); + test_insn("aebr %f0,%f1"); + test_insn("adbr %f0,%f1"); + test_insn("axbr %f0,%f1"); + + header("COMPARE"); + test_insn("cebr %f0,%f1"); + test_insn("cdbr %f0,%f1"); + test_insn("cxbr %f0,%f1"); + + header("COMPARE AND SIGNAL"); + test_insn("kebr %f0,%f1", \&mapper); + test_insn("kdbr %f0,%f1", \&mapper); + test_insn("kxbr %f0,%f1", \&mapper); + + header("CONVERT FROM FIXED"); + test_insn("cefbr %f0,%r1"); + test_insn("cdfbr %f0,%r1"); + test_insn("cxfbr %f0,%r1"); + test_insn("cegbr %f0,%r1"); + test_insn("cdgbr %f0,%r1"); + test_insn("cxgbr %f0,%r1"); + foreach my $mode (0, 1, 3, 4, 5, 6, 7) + { + test_insn("cefbra %f0,$mode,%r1,0", \&mapper); + test_insn("cdfbra %f0,$mode,%r1,0", \&mapper); + test_insn("cxfbra %f0,$mode,%r1,0", \&mapper); + test_insn("cegbra %f0,$mode,%r1,0", \&mapper); + test_insn("cdgbra %f0,$mode,%r1,0", \&mapper); + test_insn("cxgbra %f0,$mode,%r1,0", \&mapper); + } + + header("CONVERT FROM LOGICAL"); + # cdlfbr 32-bit uint --> 64-bit BFP Iop_I32UtoF64 has no rounding mode + # cxlfbr 32-bit uint --> 128-bit BFP Iop_I32UtoF128 has no rounding mode + # cxlgbr 64-bit uint --> 128-bit BFP Iop_I64UtoF128 has no rounding mode + # For those rounding mode 4 is chosen when emitting. + foreach my $mode (0, 1, 3, 4, 5, 6, 7) + { + test_insn("celfbr %f0,$mode,%r1,0", \&mapper); + test_insn("cdlfbr %f0,$mode,%r1,0", \&mapper); + test_insn("cxlfbr %f0,$mode,%r1,0", \&mapper); + test_insn("celgbr %f0,$mode,%r1,0", \&mapper); + test_insn("cdlgbr %f0,$mode,%r1,0", \&mapper); + test_insn("cxlgbr %f0,$mode,%r1,0", \&mapper); + } + + header("CONVERT TO FIXED"); + foreach my $mode (0, 1, 3, 4, 5, 6, 7) + { + test_insn("cfebr %r0,$mode,%f1"); + test_insn("cfdbr %r0,$mode,%f1"); + test_insn("cfxbr %r0,$mode,%f1"); + test_insn("cgebr %r0,$mode,%f1"); + test_insn("cgdbr %r0,$mode,%f1"); + test_insn("cgxbr %r0,$mode,%f1"); + } + foreach my $mode (0, 1, 3, 4, 5, 6, 7) + { + test_insn("cfebra %r0,$mode,%f1,0", \&mapper); + test_insn("cfdbra %r0,$mode,%f1,0", \&mapper); + test_insn("cfxbra %r0,$mode,%f1,0", \&mapper); + test_insn("cgebra %r0,$mode,%f1,0", \&mapper); + test_insn("cgdbra %r0,$mode,%f1,0", \&mapper); + test_insn("cgxbra %r0,$mode,%f1,0", \&mapper); + } + + header("CONVERT TO LOGICAL"); + foreach my $mode (0, 1, 3, 4, 5, 6, 7) + { + test_insn("clfebr %r0,$mode,%f1,0"); + test_insn("clfdbr %r0,$mode,%f1,0"); + test_insn("clfxbr %r0,$mode,%f1,0"); + test_insn("clgebr %r0,$mode,%f1,0"); + test_insn("clgdbr %r0,$mode,%f1,0"); + test_insn("clgxbr %r0,$mode,%f1,0"); + } + + header("DIVIDE"); + test_insn("debr %f0,%f1"); + test_insn("ddbr %f0,%f1"); + test_insn("dxbr %f0,%f1"); + + # echo "DIVIDE TO INTEGER" not implemented + # echo "LOAD AND TEST" insn not mapped one-to-one + + header("LOAD COMPLEMENT"); + test_insn("lcebr %f0,%f1"); + test_insn("lcdbr %f0,%f1"); + test_insn("lcxbr %f0,%f1"); + + header("LOAD FP INTEGER"); + foreach my $mode (0, 1, 3, 4, 5, 6, 7) + { + test_insn("fiebr %f0,$mode,%f1"); + test_insn("fidbr %f0,$mode,%f1"); + test_insn("fixbr %f0,$mode,%f1"); + } + foreach my $mode (0, 1, 3, 4, 5, 6, 7) + { + test_insn("fiebra %f0,$mode,%f1,0", \&mapper); + test_insn("fidbra %f0,$mode,%f1,0", \&mapper); + test_insn("fixbra %f0,$mode,%f1,0", \&mapper); + } + + header("LOAD LENGTHENED"); + test_insn("ldebr %f0,%f1"); + test_insn("lxdbr %f0,%f1"); + test_insn("lxebr %f0,%f1"); + + header("LOAD NEGATIVE"); + test_insn("lnebr %f0,%f1"); + test_insn("lndbr %f0,%f1"); + #test_insn("lnxbr %f0,%f1"); insn not mapped one-to-one + + header("LOAD POSITIVE"); + test_insn("lpebr %f0,%f1"); + test_insn("lpdbr %f0,%f1"); + test_insn("lpxbr %f0,%f1"); + + header("LOAD ROUNDED"); + test_insn("ledbr %f0,%f1"); + test_insn("ldxbr %f0,%f1"); + test_insn("lexbr %f0,%f1"); + foreach my $mode (0, 1, 3, 4, 5, 6, 7) + { + test_insn("ledbra %f0,$mode,%f1,0", \&mapper); + test_insn("ldxbra %f0,$mode,%f1,0", \&mapper); + test_insn("lexbra %f0,$mode,%f1,0", \&mapper); + } + + header("MULTIPLY"); + test_insn("meebr %f0,%f1"); + test_insn("mdbr %f0,%f1"); + test_insn("mxbr %f0,%f1"); + # mdebr not implemented + # mxdbr not implemented + + header("MULTIPLY AND ADD"); + test_insn("maebr %f0,%f1,%f2"); + test_insn("madbr %f0,%f1,%f2"); + + header("MULTIPLY AND SUBTRACT"); + test_insn("msebr %f0,%f1,%f2"); + test_insn("msdbr %f0,%f1,%f2"); + + header("SQUARE ROOT"); + test_insn("sqebr %f0,%f1"); + test_insn("sqdbr %f0,%f1"); + test_insn("sqxbr %f0,%f1"); + + header("SUBTRACT"); + test_insn("sebr %f0,%f1"); + test_insn("sdbr %f0,%f1"); + test_insn("sxbr %f0,%f1"); + + # TEST DATA CLASS insn not mapped one-to-one + exit 0; +} + +sub mapper +{ + my ($mnm, @opnds) = @_; + + my $mapped = $insn_map{$mnm}; + if ($mapped) { + return $mapped; + } + + $mapped = $mnm; + if ($opnds[1] eq "0") { + if ($mnm eq "cefbra" || + $mnm eq "cegbra" || $mnm eq "cdgbra" || + $mnm eq "ledbra" || $mnm eq "ldxbra" || $mnm eq "lexbra") { + $mapped =~ s/a//; + } + } + return $mapped; +} + +sub test_insn +{ + my ($insn) = @_; + my ($mnm, @opnds) = disect_insn($insn); + print "Testing: $insn\n"; + + my $exe = "xxbfp-$mnm"; + my $cfile = "$exe.c"; + + # Create template + `$runone --template --insn=\"$insn\" > $cfile`; + + # Compile + my $stderr = `$runone --build $cfile 2>&1`; + if ($? != 0) { + error("runone failed\n$stderr"); + return; + } + + # Run valgrind + my $stdout = `$valgrind $valargs ./$exe 2>&1`; + + # Parse the output from valgrind + # Need to find the "interesting" insns in the stream. There isexactly + # one such insn in the "frontend" part and in the "assembly" part. + # + # Let + # - U be the unmodified mnemonic + # - M be the mapped mnemonic + # - F be the mnemonic in the "frontend" section + # - A be the mnemonic in the "frontend" section + # + # There are 4 cases to distinguish: + # 1) F == U and A == U e.g aebr + # 2) F == U and A == M e.g. kebr (F == kebr , A == cebr) + # 3) F == M and A == U does not occur + # 4) F == M and A == M e.g. cefbra with rounding mode == 0 --> cefbr + # + my $mapped = $mnm; + if (scalar @_ == 2) { + my $mapfunc = $_[1]; + $mapped = $mapfunc->($mnm, @opnds); + } + + my $U = $mnm; + my $M = $mapped; + + my $output = ""; + my $in_frontend = 0; + my $in_assembly = 0; + my $frontend_insn = ""; + my $assembly_insn = ""; + my @lines = split /\n/,$stdout; + for my $line (@lines) { + if ($line =~ /Front end/) { + $in_frontend = 1; +# $output .= "$line\n"; + next; + } elsif ($line =~ /Assembly/) { + $in_frontend = 0; + $in_assembly = 1; +# $output .= "$line\n"; + next; + } + if ($in_frontend) { + # insns begin in column #1 and are in lower case + if ($line =~ /^[a-z]/) { + my $F = $line; + $F =~ s/\s.*//; + if ($F eq $U || $F eq $M) { + $output .= "Frontend: $line\n"; + } + } + next; + } + if ($in_assembly) { + # Skip v-insns + next if ($line =~ /^v-/); + # insns begin in column #1 and are in lower case + if ($line =~ /^[a-z]/) { + my $A = $line; + $A =~ s/\s.*//; + if ($A eq $U || $A eq $M) { + $output .= "Assembly: $line\n"; + } + } + next; + } + } + print "$output"; + + # Check result + my $rc = check_valgrind_output($mnm, $output); + + # Remove files + if ($rc == 0) { + unlink ($exe, $cfile, "$exe.s", "$exe.s.orig"); + } +} + +sub check_valgrind_output +{ + return 0; + my ($mnm, $stdout) = @_; + + my @lines = split /\n/,$stdout; + my $num_lines = scalar @lines; + + if ($num_lines != 4) { + error("$mnm: Expected 4 lines; found $num_lines"); + for my $line (@lines) { + print "LINE |$line|\n"; + } + return 1; + } + if ($lines[0] !~ "Front end") { + error("$mnm: Unrecognised line |$lines[0]|"); + return 1; + } + if ($lines[2] !~ "Assembly") { + error("$mnm: Unrecognised line |$lines[2]|"); + return 1; + } + return 0; +} + +sub disect_insn +{ + my ($insn) = @_; + my ($mnm, $opnd_string) = ($insn, ""); + + if ($insn =~ /^([a-zA-Z][a-zA-A0-9]*)\s+(.*)$/) { + $mnm = $1; + $opnd_string = $2; + } + + my @opnds = split /\s*,\s*/, $opnd_string; + + return ($mnm, @opnds); +} + +sub get_rootdir +{ + my $dir = "."; + while (abs_path($dir) ne "/") { + if (-e "$dir/AUTHORS") { + return abs_path($dir); + } + $dir = "$dir/.."; + } + fatal("Coud not determine root directory. \"AUTHORS\" file not found\n"); +} + +sub header +{ + my ($txt) = @_; + + print "============================================================\n"; + print "$txt\n"; + print "============================================================\n"; +} + +sub error +{ + print STDERR "*** $_[0]\n"; +} + +sub fatal +{ + error($_[0]); + exit 1; +} diff --git a/none/tests/s390x/bfp-emit.post.exp b/none/tests/s390x/bfp-emit.post.exp new file mode 100644 index 000000000..b0a9ab36f --- /dev/null +++ b/none/tests/s390x/bfp-emit.post.exp @@ -0,0 +1,1050 @@ +============================================================ +LOAD COMPLEMENT +============================================================ +Testing: lcdfr %f0,%f1 +Frontend: lcdfr %f0,%f1 +Assembly: lcdbr %f6,%f7 +============================================================ +LOAD FPR FROM GR +============================================================ +Testing: ldgr %f0,%r1 +Frontend: ldgr %f0,%r1 +Assembly: ldgr %f7,%r5 +============================================================ +LOAD GR FROM FPR +============================================================ +Testing: lgdr %r0,%f1 +Frontend: lgdr %r0,%f1 +Assembly: lgdr %r5,%f7 +============================================================ +LOAD NEGATIVE +============================================================ +Testing: lndfr %f0,%f1 +Frontend: lndfr %f0,%f1 +Assembly: lndbr %f6,%f7 +============================================================ +LOAD POSITIVE +============================================================ +Testing: lpdfr %f0,%f1 +Frontend: lpdfr %f0,%f1 +Assembly: lpdbr %f6,%f7 +============================================================ +LOAD ZERO +============================================================ +Testing: lzer %f0 +Frontend: lzer %f0 +Assembly: lzer %f7 +Testing: lzdr %f0 +Frontend: lzdr %f0 +Assembly: lzdr %f7 +============================================================ +ADD +============================================================ +Testing: aebr %f0,%f1 +Frontend: aebr %f0,%f1 +Assembly: aebr %f7,%f6 +Testing: adbr %f0,%f1 +Frontend: adbr %f0,%f1 +Assembly: adbr %f7,%f6 +Testing: axbr %f0,%f1 +Frontend: axbr %f0,%f1 +Assembly: axbr %f12,%f13 +============================================================ +COMPARE +============================================================ +Testing: cebr %f0,%f1 +Frontend: cebr %f0,%f1 +Assembly: cebr %f7,%f6 +Testing: cdbr %f0,%f1 +Frontend: cdbr %f0,%f1 +Assembly: cdbr %f7,%f6 +Testing: cxbr %f0,%f1 +Frontend: cxbr %f0,%f1 +Assembly: cxbr %f12,%f13 +============================================================ +COMPARE AND SIGNAL +============================================================ +Testing: kebr %f0,%f1 +Frontend: kebr %f0,%f1 +Assembly: cebr %f7,%f6 +Testing: kdbr %f0,%f1 +Frontend: kdbr %f0,%f1 +Assembly: cdbr %f7,%f6 +Testing: kxbr %f0,%f1 +Frontend: kxbr %f0,%f1 +Assembly: cxbr %f12,%f13 +============================================================ +CONVERT FROM FIXED +============================================================ +Testing: cefbr %f0,%r1 +Frontend: cefbr %f0,%r1 +Assembly: cefbr %f7,%r4 +Testing: cdfbr %f0,%r1 +Frontend: cdfbr %f0,%r1 +Assembly: cdfbr %f7,%r5 +Testing: cxfbr %f0,%r1 +Frontend: cxfbr %f0,%r1 +Assembly: cxfbr %f12,%r5 +Testing: cegbr %f0,%r1 +Frontend: cegbr %f0,%r1 +Assembly: cegbr %f7,%r4 +Testing: cdgbr %f0,%r1 +Frontend: cdgbr %f0,%r1 +Assembly: cdgbr %f7,%r4 +Testing: cxgbr %f0,%r1 +Frontend: cxgbr %f0,%r1 +Assembly: cxgbr %f12,%r5 +Testing: cefbra %f0,0,%r1,0 +Frontend: cefbr %f0,%r1 +Assembly: cefbr %f7,%r4 +Testing: cdfbra %f0,0,%r1,0 +Frontend: cdfbr %f0,%r1 +Assembly: cdfbr %f7,%r5 +Testing: cxfbra %f0,0,%r1,0 +Frontend: cxfbr %f0,%r1 +Assembly: cxfbr %f12,%r5 +Testing: cegbra %f0,0,%r1,0 +Frontend: cegbr %f0,%r1 +Assembly: cegbr %f7,%r4 +Testing: cdgbra %f0,0,%r1,0 +Frontend: cdgbr %f0,%r1 +Assembly: cdgbr %f7,%r4 +Testing: cxgbra %f0,0,%r1,0 +Frontend: cxgbr %f0,%r1 +Assembly: cxgbr %f12,%r5 +Testing: cefbra %f0,1,%r1,0 +Frontend: cefbra %f0,1,%r1,0 +Assembly: cefbra %f7,1,%r5,0 +Testing: cdfbra %f0,1,%r1,0 +Frontend: cdfbra %f0,1,%r1,0 +Assembly: cdfbr %f7,%r5 +Testing: cxfbra %f0,1,%r1,0 +Frontend: cxfbra %f0,1,%r1,0 +Assembly: cxfbr %f12,%r5 +Testing: cegbra %f0,1,%r1,0 +Frontend: cegbra %f0,1,%r1,0 +Assembly: cegbra %f7,1,%r5,0 +Testing: cdgbra %f0,1,%r1,0 +Frontend: cdgbra %f0,1,%r1,0 +Assembly: cdgbra %f7,1,%r5,0 +Testing: cxgbra %f0,1,%r1,0 +Frontend: cxgbra %f0,1,%r1,0 +Assembly: cxgbr %f12,%r5 +Testing: cefbra %f0,3,%r1,0 +Frontend: cefbra %f0,3,%r1,0 +Assembly: cefbra %f7,3,%r5,0 +Testing: cdfbra %f0,3,%r1,0 +Frontend: cdfbra %f0,3,%r1,0 +Assembly: cdfbr %f7,%r5 +Testing: cxfbra %f0,3,%r1,0 +Frontend: cxfbra %f0,3,%r1,0 +Assembly: cxfbr %f12,%r5 +Testing: cegbra %f0,3,%r1,0 +Frontend: cegbra %f0,3,%r1,0 +Assembly: cegbra %f7,3,%r5,0 +Testing: cdgbra %f0,3,%r1,0 +Frontend: cdgbra %f0,3,%r1,0 +Assembly: cdgbra %f7,3,%r5,0 +Testing: cxgbra %f0,3,%r1,0 +Frontend: cxgbra %f0,3,%r1,0 +Assembly: cxgbr %f12,%r5 +Testing: cefbra %f0,4,%r1,0 +Frontend: cefbra %f0,4,%r1,0 +Assembly: cefbra %f7,4,%r5,0 +Testing: cdfbra %f0,4,%r1,0 +Frontend: cdfbra %f0,4,%r1,0 +Assembly: cdfbr %f7,%r5 +Testing: cxfbra %f0,4,%r1,0 +Frontend: cxfbra %f0,4,%r1,0 +Assembly: cxfbr %f12,%r5 +Testing: cegbra %f0,4,%r1,0 +Frontend: cegbra %f0,4,%r1,0 +Assembly: cegbra %f7,4,%r5,0 +Testing: cdgbra %f0,4,%r1,0 +Frontend: cdgbra %f0,4,%r1,0 +Assembly: cdgbra %f7,4,%r5,0 +Testing: cxgbra %f0,4,%r1,0 +Frontend: cxgbra %f0,4,%r1,0 +Assembly: cxgbr %f12,%r5 +Testing: cefbra %f0,5,%r1,0 +Frontend: cefbra %f0,5,%r1,0 +Assembly: cefbra %f7,5,%r5,0 +Testing: cdfbra %f0,5,%r1,0 +Frontend: cdfbra %f0,5,%r1,0 +Assembly: cdfbr %f7,%r5 +Testing: cxfbra %f0,5,%r1,0 +Frontend: cxfbra %f0,5,%r1,0 +Assembly: cxfbr %f12,%r5 +Testing: cegbra %f0,5,%r1,0 +Frontend: cegbra %f0,5,%r1,0 +Assembly: cegbra %f7,5,%r5,0 +Testing: cdgbra %f0,5,%r1,0 +Frontend: cdgbra %f0,5,%r1,0 +Assembly: cdgbra %f7,5,%r5,0 +Testing: cxgbra %f0,5,%r1,0 +Frontend: cxgbra %f0,5,%r1,0 +Assembly: cxgbr %f12,%r5 +Testing: cefbra %f0,6,%r1,0 +Frontend: cefbra %f0,6,%r1,0 +Assembly: cefbra %f7,6,%r5,0 +Testing: cdfbra %f0,6,%r1,0 +Frontend: cdfbra %f0,6,%r1,0 +Assembly: cdfbr %f7,%r5 +Testing: cxfbra %f0,6,%r1,0 +Frontend: cxfbra %f0,6,%r1,0 +Assembly: cxfbr %f12,%r5 +Testing: cegbra %f0,6,%r1,0 +Frontend: cegbra %f0,6,%r1,0 +Assembly: cegbra %f7,6,%r5,0 +Testing: cdgbra %f0,6,%r1,0 +Frontend: cdgbra %f0,6,%r1,0 +Assembly: cdgbra %f7,6,%r5,0 +Testing: cxgbra %f0,6,%r1,0 +Frontend: cxgbra %f0,6,%r1,0 +Assembly: cxgbr %f12,%r5 +Testing: cefbra %f0,7,%r1,0 +Frontend: cefbra %f0,7,%r1,0 +Assembly: cefbra %f7,7,%r5,0 +Testing: cdfbra %f0,7,%r1,0 +Frontend: cdfbra %f0,7,%r1,0 +Assembly: cdfbr %f7,%r5 +Testing: cxfbra %f0,7,%r1,0 +Frontend: cxfbra %f0,7,%r1,0 +Assembly: cxfbr %f12,%r5 +Testing: cegbra %f0,7,%r1,0 +Frontend: cegbra %f0,7,%r1,0 +Assembly: cegbra %f7,7,%r5,0 +Testing: cdgbra %f0,7,%r1,0 +Frontend: cdgbra %f0,7,%r1,0 +Assembly: cdgbra %f7,7,%r5,0 +Testing: cxgbra %f0,7,%r1,0 +Frontend: cxgbra %f0,7,%r1,0 +Assembly: cxgbr %f12,%r5 +============================================================ +CONVERT FROM LOGICAL +============================================================ +Testing: celfbr %f0,0,%r1,0 +Frontend: celfbr %f0,0,%r1,0 +Assembly: celfbr %f7,0,%r4,0 +Testing: cdlfbr %f0,0,%r1,0 +Frontend: cdlfbr %f0,0,%r1,0 +Assembly: cdlfbr %f7,4,%r5,0 +Testing: cxlfbr %f0,0,%r1,0 +Frontend: cxlfbr %f0,0,%r1,0 +Assembly: cxlfbr %f12,4,%r5,0 +Testing: celgbr %f0,0,%r1,0 +Frontend: celgbr %f0,0,%r1,0 +Assembly: celgbr %f7,0,%r4,0 +Testing: cdlgbr %f0,0,%r1,0 +Frontend: cdlgbr %f0,0,%r1,0 +Assembly: cdlgbr %f7,0,%r4,0 +Testing: cxlgbr %f0,0,%r1,0 +Frontend: cxlgbr %f0,0,%r1,0 +Assembly: cxlgbr %f12,4,%r5,0 +Testing: celfbr %f0,1,%r1,0 +Frontend: celfbr %f0,1,%r1,0 +Assembly: celfbr %f7,1,%r5,0 +Testing: cdlfbr %f0,1,%r1,0 +Frontend: cdlfbr %f0,1,%r1,0 +Assembly: cdlfbr %f7,4,%r5,0 +Testing: cxlfbr %f0,1,%r1,0 +Frontend: cxlfbr %f0,1,%r1,0 +Assembly: cxlfbr %f12,4,%r5,0 +Testing: celgbr %f0,1,%r1,0 +Frontend: celgbr %f0,1,%r1,0 +Assembly: celgbr %f7,1,%r5,0 +Testing: cdlgbr %f0,1,%r1,0 +Frontend: cdlgbr %f0,1,%r1,0 +Assembly: cdlgbr %f7,1,%r5,0 +Testing: cxlgbr %f0,1,%r1,0 +Frontend: cxlgbr %f0,1,%r1,0 +Assembly: cxlgbr %f12,4,%r5,0 +Testing: celfbr %f0,3,%r1,0 +Frontend: celfbr %f0,3,%r1,0 +Assembly: celfbr %f7,3,%r5,0 +Testing: cdlfbr %f0,3,%r1,0 +Frontend: cdlfbr %f0,3,%r1,0 +Assembly: cdlfbr %f7,4,%r5,0 +Testing: cxlfbr %f0,3,%r1,0 +Frontend: cxlfbr %f0,3,%r1,0 +Assembly: cxlfbr %f12,4,%r5,0 +Testing: celgbr %f0,3,%r1,0 +Frontend: celgbr %f0,3,%r1,0 +Assembly: celgbr %f7,3,%r5,0 +Testing: cdlgbr %f0,3,%r1,0 +Frontend: cdlgbr %f0,3,%r1,0 +Assembly: cdlgbr %f7,3,%r5,0 +Testing: cxlgbr %f0,3,%r1,0 +Frontend: cxlgbr %f0,3,%r1,0 +Assembly: cxlgbr %f12,4,%r5,0 +Testing: celfbr %f0,4,%r1,0 +Frontend: celfbr %f0,4,%r1,0 +Assembly: celfbr %f7,4,%r5,0 +Testing: cdlfbr %f0,4,%r1,0 +Frontend: cdlfbr %f0,4,%r1,0 +Assembly: cdlfbr %f7,4,%r5,0 +Testing: cxlfbr %f0,4,%r1,0 +Frontend: cxlfbr %f0,4,%r1,0 +Assembly: cxlfbr %f12,4,%r5,0 +Testing: celgbr %f0,4,%r1,0 +Frontend: celgbr %f0,4,%r1,0 +Assembly: celgbr %f7,4,%r5,0 +Testing: cdlgbr %f0,4,%r1,0 +Frontend: cdlgbr %f0,4,%r1,0 +Assembly: cdlgbr %f7,4,%r5,0 +Testing: cxlgbr %f0,4,%r1,0 +Frontend: cxlgbr %f0,4,%r1,0 +Assembly: cxlgbr %f12,4,%r5,0 +Testing: celfbr %f0,5,%r1,0 +Frontend: celfbr %f0,5,%r1,0 +Assembly: celfbr %f7,5,%r5,0 +Testing: cdlfbr %f0,5,%r1,0 +Frontend: cdlfbr %f0,5,%r1,0 +Assembly: cdlfbr %f7,4,%r5,0 +Testing: cxlfbr %f0,5,%r1,0 +Frontend: cxlfbr %f0,5,%r1,0 +Assembly: cxlfbr %f12,4,%r5,0 +Testing: celgbr %f0,5,%r1,0 +Frontend: celgbr %f0,5,%r1,0 +Assembly: celgbr %f7,5,%r5,0 +Testing: cdlgbr %f0,5,%r1,0 +Frontend: cdlgbr %f0,5,%r1,0 +Assembly: cdlgbr %f7,5,%r5,0 +Testing: cxlgbr %f0,5,%r1,0 +Frontend: cxlgbr %f0,5,%r1,0 +Assembly: cxlgbr %f12,4,%r5,0 +Testing: celfbr %f0,6,%r1,0 +Frontend: celfbr %f0,6,%r1,0 +Assembly: celfbr %f7,6,%r5,0 +Testing: cdlfbr %f0,6,%r1,0 +Frontend: cdlfbr %f0,6,%r1,0 +Assembly: cdlfbr %f7,4,%r5,0 +Testing: cxlfbr %f0,6,%r1,0 +Frontend: cxlfbr %f0,6,%r1,0 +Assembly: cxlfbr %f12,4,%r5,0 +Testing: celgbr %f0,6,%r1,0 +Frontend: celgbr %f0,6,%r1,0 +Assembly: celgbr %f7,6,%r5,0 +Testing: cdlgbr %f0,6,%r1,0 +Frontend: cdlgbr %f0,6,%r1,0 +Assembly: cdlgbr %f7,6,%r5,0 +Testing: cxlgbr %f0,6,%r1,0 +Frontend: cxlgbr %f0,6,%r1,0 +Assembly: cxlgbr %f12,4,%r5,0 +Testing: celfbr %f0,7,%r1,0 +Frontend: celfbr %f0,7,%r1,0 +Assembly: celfbr %f7,7,%r5,0 +Testing: cdlfbr %f0,7,%r1,0 +Frontend: cdlfbr %f0,7,%r1,0 +Assembly: cdlfbr %f7,4,%r5,0 +Testing: cxlfbr %f0,7,%r1,0 +Frontend: cxlfbr %f0,7,%r1,0 +Assembly: cxlfbr %f12,4,%r5,0 +Testing: celgbr %f0,7,%r1,0 +Frontend: celgbr %f0,7,%r1,0 +Assembly: celgbr %f7,7,%r5,0 +Testing: cdlgbr %f0,7,%r1,0 +Frontend: cdlgbr %f0,7,%r1,0 +Assembly: cdlgbr %f7,7,%r5,0 +Testing: cxlgbr %f0,7,%r1,0 +Frontend: cxlgbr %f0,7,%r1,0 +Assembly: cxlgbr %f12,4,%r5,0 +============================================================ +CONVERT TO FIXED +============================================================ +Testing: cfebr %r0,0,%f1 +Frontend: cfebr %r0,0,%f1 +Assembly: cfebr %r5,0,%f7 +Testing: cfdbr %r0,0,%f1 +Frontend: cfdbr %r0,0,%f1 +Assembly: cfdbr %r5,0,%f7 +Testing: cfxbr %r0,0,%f1 +Frontend: cfxbr %r0,0,%f1 +Assembly: cfxbr %r5,0,%f13 +Testing: cgebr %r0,0,%f1 +Frontend: cgebr %r0,0,%f1 +Assembly: cgebr %r5,0,%f7 +Testing: cgdbr %r0,0,%f1 +Frontend: cgdbr %r0,0,%f1 +Assembly: cgdbr %r5,0,%f7 +Testing: cgxbr %r0,0,%f1 +Frontend: cgxbr %r0,0,%f1 +Assembly: cgxbr %r5,0,%f13 +Testing: cfebr %r0,1,%f1 +Frontend: cfebr %r0,1,%f1 +Assembly: cfebr %r5,1,%f7 +Testing: cfdbr %r0,1,%f1 +Frontend: cfdbr %r0,1,%f1 +Assembly: cfdbr %r5,1,%f7 +Testing: cfxbr %r0,1,%f1 +Frontend: cfxbr %r0,1,%f1 +Assembly: cfxbr %r5,1,%f13 +Testing: cgebr %r0,1,%f1 +Frontend: cgebr %r0,1,%f1 +Assembly: cgebr %r5,1,%f7 +Testing: cgdbr %r0,1,%f1 +Frontend: cgdbr %r0,1,%f1 +Assembly: cgdbr %r5,1,%f7 +Testing: cgxbr %r0,1,%f1 +Frontend: cgxbr %r0,1,%f1 +Assembly: cgxbr %r5,1,%f13 +Testing: cfebr %r0,3,%f1 +Frontend: cfebr %r0,3,%f1 +Assembly: cfebr %r5,3,%f7 +Testing: cfdbr %r0,3,%f1 +Frontend: cfdbr %r0,3,%f1 +Assembly: cfdbr %r5,3,%f7 +Testing: cfxbr %r0,3,%f1 +Frontend: cfxbr %r0,3,%f1 +Assembly: cfxbr %r5,3,%f13 +Testing: cgebr %r0,3,%f1 +Frontend: cgebr %r0,3,%f1 +Assembly: cgebr %r5,3,%f7 +Testing: cgdbr %r0,3,%f1 +Frontend: cgdbr %r0,3,%f1 +Assembly: cgdbr %r5,3,%f7 +Testing: cgxbr %r0,3,%f1 +Frontend: cgxbr %r0,3,%f1 +Assembly: cgxbr %r5,3,%f13 +Testing: cfebr %r0,4,%f1 +Frontend: cfebr %r0,4,%f1 +Assembly: cfebr %r5,4,%f7 +Testing: cfdbr %r0,4,%f1 +Frontend: cfdbr %r0,4,%f1 +Assembly: cfdbr %r5,4,%f7 +Testing: cfxbr %r0,4,%f1 +Frontend: cfxbr %r0,4,%f1 +Assembly: cfxbr %r5,4,%f13 +Testing: cgebr %r0,4,%f1 +Frontend: cgebr %r0,4,%f1 +Assembly: cgebr %r5,4,%f7 +Testing: cgdbr %r0,4,%f1 +Frontend: cgdbr %r0,4,%f1 +Assembly: cgdbr %r5,4,%f7 +Testing: cgxbr %r0,4,%f1 +Frontend: cgxbr %r0,4,%f1 +Assembly: cgxbr %r5,4,%f13 +Testing: cfebr %r0,5,%f1 +Frontend: cfebr %r0,5,%f1 +Assembly: cfebr %r5,5,%f7 +Testing: cfdbr %r0,5,%f1 +Frontend: cfdbr %r0,5,%f1 +Assembly: cfdbr %r5,5,%f7 +Testing: cfxbr %r0,5,%f1 +Frontend: cfxbr %r0,5,%f1 +Assembly: cfxbr %r5,5,%f13 +Testing: cgebr %r0,5,%f1 +Frontend: cgebr %r0,5,%f1 +Assembly: cgebr %r5,5,%f7 +Testing: cgdbr %r0,5,%f1 +Frontend: cgdbr %r0,5,%f1 +Assembly: cgdbr %r5,5,%f7 +Testing: cgxbr %r0,5,%f1 +Frontend: cgxbr %r0,5,%f1 +Assembly: cgxbr %r5,5,%f13 +Testing: cfebr %r0,6,%f1 +Frontend: cfebr %r0,6,%f1 +Assembly: cfebr %r5,6,%f7 +Testing: cfdbr %r0,6,%f1 +Frontend: cfdbr %r0,6,%f1 +Assembly: cfdbr %r5,6,%f7 +Testing: cfxbr %r0,6,%f1 +Frontend: cfxbr %r0,6,%f1 +Assembly: cfxbr %r5,6,%f13 +Testing: cgebr %r0,6,%f1 +Frontend: cgebr %r0,6,%f1 +Assembly: cgebr %r5,6,%f7 +Testing: cgdbr %r0,6,%f1 +Frontend: cgdbr %r0,6,%f1 +Assembly: cgdbr %r5,6,%f7 +Testing: cgxbr %r0,6,%f1 +Frontend: cgxbr %r0,6,%f1 +Assembly: cgxbr %r5,6,%f13 +Testing: cfebr %r0,7,%f1 +Frontend: cfebr %r0,7,%f1 +Assembly: cfebr %r5,7,%f7 +Testing: cfdbr %r0,7,%f1 +Frontend: cfdbr %r0,7,%f1 +Assembly: cfdbr %r5,7,%f7 +Testing: cfxbr %r0,7,%f1 +Frontend: cfxbr %r0,7,%f1 +Assembly: cfxbr %r5,7,%f13 +Testing: cgebr %r0,7,%f1 +Frontend: cgebr %r0,7,%f1 +Assembly: cgebr %r5,7,%f7 +Testing: cgdbr %r0,7,%f1 +Frontend: cgdbr %r0,7,%f1 +Assembly: cgdbr %r5,7,%f7 +Testing: cgxbr %r0,7,%f1 +Frontend: cgxbr %r0,7,%f1 +Assembly: cgxbr %r5,7,%f13 +Testing: cfebra %r0,0,%f1,0 +Frontend: cfebr %r0,0,%f1 +Assembly: cfebr %r5,0,%f7 +Testing: cfdbra %r0,0,%f1,0 +Frontend: cfdbr %r0,0,%f1 +Assembly: cfdbr %r5,0,%f7 +Testing: cfxbra %r0,0,%f1,0 +Frontend: cfxbr %r0,0,%f1 +Assembly: cfxbr %r5,0,%f13 +Testing: cgebra %r0,0,%f1,0 +Frontend: cgebr %r0,0,%f1 +Assembly: cgebr %r5,0,%f7 +Testing: cgdbra %r0,0,%f1,0 +Frontend: cgdbr %r0,0,%f1 +Assembly: cgdbr %r5,0,%f7 +Testing: cgxbra %r0,0,%f1,0 +Frontend: cgxbr %r0,0,%f1 +Assembly: cgxbr %r5,0,%f13 +Testing: cfebra %r0,1,%f1,0 +Frontend: cfebr %r0,1,%f1 +Assembly: cfebr %r5,1,%f7 +Testing: cfdbra %r0,1,%f1,0 +Frontend: cfdbr %r0,1,%f1 +Assembly: cfdbr %r5,1,%f7 +Testing: cfxbra %r0,1,%f1,0 +Frontend: cfxbr %r0,1,%f1 +Assembly: cfxbr %r5,1,%f13 +Testing: cgebra %r0,1,%f1,0 +Frontend: cgebr %r0,1,%f1 +Assembly: cgebr %r5,1,%f7 +Testing: cgdbra %r0,1,%f1,0 +Frontend: cgdbr %r0,1,%f1 +Assembly: cgdbr %r5,1,%f7 +Testing: cgxbra %r0,1,%f1,0 +Frontend: cgxbr %r0,1,%f1 +Assembly: cgxbr %r5,1,%f13 +Testing: cfebra %r0,3,%f1,0 +Frontend: cfebr %r0,3,%f1 +Assembly: cfebr %r5,3,%f7 +Testing: cfdbra %r0,3,%f1,0 +Frontend: cfdbr %r0,3,%f1 +Assembly: cfdbr %r5,3,%f7 +Testing: cfxbra %r0,3,%f1,0 +Frontend: cfxbr %r0,3,%f1 +Assembly: cfxbr %r5,3,%f13 +Testing: cgebra %r0,3,%f1,0 +Frontend: cgebr %r0,3,%f1 +Assembly: cgebr %r5,3,%f7 +Testing: cgdbra %r0,3,%f1,0 +Frontend: cgdbr %r0,3,%f1 +Assembly: cgdbr %r5,3,%f7 +Testing: cgxbra %r0,3,%f1,0 +Frontend: cgxbr %r0,3,%f1 +Assembly: cgxbr %r5,3,%f13 +Testing: cfebra %r0,4,%f1,0 +Frontend: cfebr %r0,4,%f1 +Assembly: cfebr %r5,4,%f7 +Testing: cfdbra %r0,4,%f1,0 +Frontend: cfdbr %r0,4,%f1 +Assembly: cfdbr %r5,4,%f7 +Testing: cfxbra %r0,4,%f1,0 +Frontend: cfxbr %r0,4,%f1 +Assembly: cfxbr %r5,4,%f13 +Testing: cgebra %r0,4,%f1,0 +Frontend: cgebr %r0,4,%f1 +Assembly: cgebr %r5,4,%f7 +Testing: cgdbra %r0,4,%f1,0 +Frontend: cgdbr %r0,4,%f1 +Assembly: cgdbr %r5,4,%f7 +Testing: cgxbra %r0,4,%f1,0 +Frontend: cgxbr %r0,4,%f1 +Assembly: cgxbr %r5,4,%f13 +Testing: cfebra %r0,5,%f1,0 +Frontend: cfebr %r0,5,%f1 +Assembly: cfebr %r5,5,%f7 +Testing: cfdbra %r0,5,%f1,0 +Frontend: cfdbr %r0,5,%f1 +Assembly: cfdbr %r5,5,%f7 +Testing: cfxbra %r0,5,%f1,0 +Frontend: cfxbr %r0,5,%f1 +Assembly: cfxbr %r5,5,%f13 +Testing: cgebra %r0,5,%f1,0 +Frontend: cgebr %r0,5,%f1 +Assembly: cgebr %r5,5,%f7 +Testing: cgdbra %r0,5,%f1,0 +Frontend: cgdbr %r0,5,%f1 +Assembly: cgdbr %r5,5,%f7 +Testing: cgxbra %r0,5,%f1,0 +Frontend: cgxbr %r0,5,%f1 +Assembly: cgxbr %r5,5,%f13 +Testing: cfebra %r0,6,%f1,0 +Frontend: cfebr %r0,6,%f1 +Assembly: cfebr %r5,6,%f7 +Testing: cfdbra %r0,6,%f1,0 +Frontend: cfdbr %r0,6,%f1 +Assembly: cfdbr %r5,6,%f7 +Testing: cfxbra %r0,6,%f1,0 +Frontend: cfxbr %r0,6,%f1 +Assembly: cfxbr %r5,6,%f13 +Testing: cgebra %r0,6,%f1,0 +Frontend: cgebr %r0,6,%f1 +Assembly: cgebr %r5,6,%f7 +Testing: cgdbra %r0,6,%f1,0 +Frontend: cgdbr %r0,6,%f1 +Assembly: cgdbr %r5,6,%f7 +Testing: cgxbra %r0,6,%f1,0 +Frontend: cgxbr %r0,6,%f1 +Assembly: cgxbr %r5,6,%f13 +Testing: cfebra %r0,7,%f1,0 +Frontend: cfebr %r0,7,%f1 +Assembly: cfebr %r5,7,%f7 +Testing: cfdbra %r0,7,%f1,0 +Frontend: cfdbr %r0,7,%f1 +Assembly: cfdbr %r5,7,%f7 +Testing: cfxbra %r0,7,%f1,0 +Frontend: cfxbr %r0,7,%f1 +Assembly: cfxbr %r5,7,%f13 +Testing: cgebra %r0,7,%f1,0 +Frontend: cgebr %r0,7,%f1 +Assembly: cgebr %r5,7,%f7 +Testing: cgdbra %r0,7,%f1,0 +Frontend: cgdbr %r0,7,%f1 +Assembly: cgdbr %r5,7,%f7 +Testing: cgxbra %r0,7,%f1,0 +Frontend: cgxbr %r0,7,%f1 +Assembly: cgxbr %r5,7,%f13 +============================================================ +CONVERT TO LOGICAL +============================================================ +Testing: clfebr %r0,0,%f1,0 +Frontend: clfebr %r0,0,%f1,0 +Assembly: clfebr %r5,0,%f7,0 +Testing: clfdbr %r0,0,%f1,0 +Frontend: clfdbr %r0,0,%f1,0 +Assembly: clfdbr %r5,0,%f7,0 +Testing: clfxbr %r0,0,%f1,0 +Frontend: clfxbr %r0,0,%f1,0 +Assembly: clfxbr %r5,0,%f13,0 +Testing: clgebr %r0,0,%f1,0 +Frontend: clgebr %r0,0,%f1,0 +Assembly: clgebr %r5,0,%f7,0 +Testing: clgdbr %r0,0,%f1,0 +Frontend: clgdbr %r0,0,%f1,0 +Assembly: clgdbr %r5,0,%f7,0 +Testing: clgxbr %r0,0,%f1,0 +Frontend: clgxbr %r0,0,%f1,0 +Assembly: clgxbr %r5,0,%f13,0 +Testing: clfebr %r0,1,%f1,0 +Frontend: clfebr %r0,1,%f1,0 +Assembly: clfebr %r5,1,%f7,0 +Testing: clfdbr %r0,1,%f1,0 +Frontend: clfdbr %r0,1,%f1,0 +Assembly: clfdbr %r5,1,%f7,0 +Testing: clfxbr %r0,1,%f1,0 +Frontend: clfxbr %r0,1,%f1,0 +Assembly: clfxbr %r5,1,%f13,0 +Testing: clgebr %r0,1,%f1,0 +Frontend: clgebr %r0,1,%f1,0 +Assembly: clgebr %r5,1,%f7,0 +Testing: clgdbr %r0,1,%f1,0 +Frontend: clgdbr %r0,1,%f1,0 +Assembly: clgdbr %r5,1,%f7,0 +Testing: clgxbr %r0,1,%f1,0 +Frontend: clgxbr %r0,1,%f1,0 +Assembly: clgxbr %r5,1,%f13,0 +Testing: clfebr %r0,3,%f1,0 +Frontend: clfebr %r0,3,%f1,0 +Assembly: clfebr %r5,3,%f7,0 +Testing: clfdbr %r0,3,%f1,0 +Frontend: clfdbr %r0,3,%f1,0 +Assembly: clfdbr %r5,3,%f7,0 +Testing: clfxbr %r0,3,%f1,0 +Frontend: clfxbr %r0,3,%f1,0 +Assembly: clfxbr %r5,3,%f13,0 +Testing: clgebr %r0,3,%f1,0 +Frontend: clgebr %r0,3,%f1,0 +Assembly: clgebr %r5,3,%f7,0 +Testing: clgdbr %r0,3,%f1,0 +Frontend: clgdbr %r0,3,%f1,0 +Assembly: clgdbr %r5,3,%f7,0 +Testing: clgxbr %r0,3,%f1,0 +Frontend: clgxbr %r0,3,%f1,0 +Assembly: clgxbr %r5,3,%f13,0 +Testing: clfebr %r0,4,%f1,0 +Frontend: clfebr %r0,4,%f1,0 +Assembly: clfebr %r5,4,%f7,0 +Testing: clfdbr %r0,4,%f1,0 +Frontend: clfdbr %r0,4,%f1,0 +Assembly: clfdbr %r5,4,%f7,0 +Testing: clfxbr %r0,4,%f1,0 +Frontend: clfxbr %r0,4,%f1,0 +Assembly: clfxbr %r5,4,%f13,0 +Testing: clgebr %r0,4,%f1,0 +Frontend: clgebr %r0,4,%f1,0 +Assembly: clgebr %r5,4,%f7,0 +Testing: clgdbr %r0,4,%f1,0 +Frontend: clgdbr %r0,4,%f1,0 +Assembly: clgdbr %r5,4,%f7,0 +Testing: clgxbr %r0,4,%f1,0 +Frontend: clgxbr %r0,4,%f1,0 +Assembly: clgxbr %r5,4,%f13,0 +Testing: clfebr %r0,5,%f1,0 +Frontend: clfebr %r0,5,%f1,0 +Assembly: clfebr %r5,5,%f7,0 +Testing: clfdbr %r0,5,%f1,0 +Frontend: clfdbr %r0,5,%f1,0 +Assembly: clfdbr %r5,5,%f7,0 +Testing: clfxbr %r0,5,%f1,0 +Frontend: clfxbr %r0,5,%f1,0 +Assembly: clfxbr %r5,5,%f13,0 +Testing: clgebr %r0,5,%f1,0 +Frontend: clgebr %r0,5,%f1,0 +Assembly: clgebr %r5,5,%f7,0 +Testing: clgdbr %r0,5,%f1,0 +Frontend: clgdbr %r0,5,%f1,0 +Assembly: clgdbr %r5,5,%f7,0 +Testing: clgxbr %r0,5,%f1,0 +Frontend: clgxbr %r0,5,%f1,0 +Assembly: clgxbr %r5,5,%f13,0 +Testing: clfebr %r0,6,%f1,0 +Frontend: clfebr %r0,6,%f1,0 +Assembly: clfebr %r5,6,%f7,0 +Testing: clfdbr %r0,6,%f1,0 +Frontend: clfdbr %r0,6,%f1,0 +Assembly: clfdbr %r5,6,%f7,0 +Testing: clfxbr %r0,6,%f1,0 +Frontend: clfxbr %r0,6,%f1,0 +Assembly: clfxbr %r5,6,%f13,0 +Testing: clgebr %r0,6,%f1,0 +Frontend: clgebr %r0,6,%f1,0 +Assembly: clgebr %r5,6,%f7,0 +Testing: clgdbr %r0,6,%f1,0 +Frontend: clgdbr %r0,6,%f1,0 +Assembly: clgdbr %r5,6,%f7,0 +Testing: clgxbr %r0,6,%f1,0 +Frontend: clgxbr %r0,6,%f1,0 +Assembly: clgxbr %r5,6,%f13,0 +Testing: clfebr %r0,7,%f1,0 +Frontend: clfebr %r0,7,%f1,0 +Assembly: clfebr %r5,7,%f7,0 +Testing: clfdbr %r0,7,%f1,0 +Frontend: clfdbr %r0,7,%f1,0 +Assembly: clfdbr %r5,7,%f7,0 +Testing: clfxbr %r0,7,%f1,0 +Frontend: clfxbr %r0,7,%f1,0 +Assembly: clfxbr %r5,7,%f13,0 +Testing: clgebr %r0,7,%f1,0 +Frontend: clgebr %r0,7,%f1,0 +Assembly: clgebr %r5,7,%f7,0 +Testing: clgdbr %r0,7,%f1,0 +Frontend: clgdbr %r0,7,%f1,0 +Assembly: clgdbr %r5,7,%f7,0 +Testing: clgxbr %r0,7,%f1,0 +Frontend: clgxbr %r0,7,%f1,0 +Assembly: clgxbr %r5,7,%f13,0 +============================================================ +DIVIDE +============================================================ +Testing: debr %f0,%f1 +Frontend: debr %f0,%f1 +Assembly: debr %f7,%f6 +Testing: ddbr %f0,%f1 +Frontend: ddbr %f0,%f1 +Assembly: ddbr %f7,%f6 +Testing: dxbr %f0,%f1 +Frontend: dxbr %f0,%f1 +Assembly: dxbr %f12,%f13 +============================================================ +LOAD COMPLEMENT +============================================================ +Testing: lcebr %f0,%f1 +Frontend: lcebr %f0,%f1 +Assembly: lcebr %f6,%f7 +Testing: lcdbr %f0,%f1 +Frontend: lcdbr %f0,%f1 +Assembly: lcdbr %f6,%f7 +Testing: lcxbr %f0,%f1 +Frontend: lcxbr %f0,%f1 +Assembly: lcxbr %f12,%f13 +============================================================ +LOAD FP INTEGER +============================================================ +Testing: fiebr %f0,0,%f1 +Frontend: fiebr %f0,0,%f1 +Assembly: fiebr %f6,0,%f7 +Testing: fidbr %f0,0,%f1 +Frontend: fidbr %f0,0,%f1 +Assembly: fidbr %f6,0,%f7 +Testing: fixbr %f0,0,%f1 +Frontend: fixbr %f0,0,%f1 +Assembly: fixbr %f0,0,%f4 +Testing: fiebr %f0,1,%f1 +Frontend: fiebr %f0,1,%f1 +Assembly: fiebr %f6,1,%f7 +Testing: fidbr %f0,1,%f1 +Frontend: fidbr %f0,1,%f1 +Assembly: fidbr %f6,1,%f7 +Testing: fixbr %f0,1,%f1 +Frontend: fixbr %f0,1,%f1 +Assembly: fixbr %f0,1,%f4 +Testing: fiebr %f0,3,%f1 +Frontend: fiebr %f0,3,%f1 +Assembly: fiebr %f6,3,%f7 +Testing: fidbr %f0,3,%f1 +Frontend: fidbr %f0,3,%f1 +Assembly: fidbr %f6,3,%f7 +Testing: fixbr %f0,3,%f1 +Frontend: fixbr %f0,3,%f1 +Assembly: fixbr %f0,3,%f4 +Testing: fiebr %f0,4,%f1 +Frontend: fiebr %f0,4,%f1 +Assembly: fiebr %f6,4,%f7 +Testing: fidbr %f0,4,%f1 +Frontend: fidbr %f0,4,%f1 +Assembly: fidbr %f6,4,%f7 +Testing: fixbr %f0,4,%f1 +Frontend: fixbr %f0,4,%f1 +Assembly: fixbr %f0,4,%f4 +Testing: fiebr %f0,5,%f1 +Frontend: fiebr %f0,5,%f1 +Assembly: fiebr %f6,5,%f7 +Testing: fidbr %f0,5,%f1 +Frontend: fidbr %f0,5,%f1 +Assembly: fidbr %f6,5,%f7 +Testing: fixbr %f0,5,%f1 +Frontend: fixbr %f0,5,%f1 +Assembly: fixbr %f0,5,%f4 +Testing: fiebr %f0,6,%f1 +Frontend: fiebr %f0,6,%f1 +Assembly: fiebr %f6,6,%f7 +Testing: fidbr %f0,6,%f1 +Frontend: fidbr %f0,6,%f1 +Assembly: fidbr %f6,6,%f7 +Testing: fixbr %f0,6,%f1 +Frontend: fixbr %f0,6,%f1 +Assembly: fixbr %f0,6,%f4 +Testing: fiebr %f0,7,%f1 +Frontend: fiebr %f0,7,%f1 +Assembly: fiebr %f6,7,%f7 +Testing: fidbr %f0,7,%f1 +Frontend: fidbr %f0,7,%f1 +Assembly: fidbr %f6,7,%f7 +Testing: fixbr %f0,7,%f1 +Frontend: fixbr %f0,7,%f1 +Assembly: fixbr %f0,7,%f4 +Testing: fiebra %f0,0,%f1,0 +Frontend: fiebr %f0,0,%f1 +Assembly: fiebr %f6,0,%f7 +Testing: fidbra %f0,0,%f1,0 +Frontend: fidbr %f0,0,%f1 +Assembly: fidbr %f6,0,%f7 +Testing: fixbra %f0,0,%f1,0 +Frontend: fixbr %f0,0,%f1 +Assembly: fixbr %f0,0,%f4 +Testing: fiebra %f0,1,%f1,0 +Frontend: fiebr %f0,1,%f1 +Assembly: fiebr %f6,1,%f7 +Testing: fidbra %f0,1,%f1,0 +Frontend: fidbr %f0,1,%f1 +Assembly: fidbr %f6,1,%f7 +Testing: fixbra %f0,1,%f1,0 +Frontend: fixbr %f0,1,%f1 +Assembly: fixbr %f0,1,%f4 +Testing: fiebra %f0,3,%f1,0 +Frontend: fiebr %f0,3,%f1 +Assembly: fiebr %f6,3,%f7 +Testing: fidbra %f0,3,%f1,0 +Frontend: fidbr %f0,3,%f1 +Assembly: fidbr %f6,3,%f7 +Testing: fixbra %f0,3,%f1,0 +Frontend: fixbr %f0,3,%f1 +Assembly: fixbr %f0,3,%f4 +Testing: fiebra %f0,4,%f1,0 +Frontend: fiebr %f0,4,%f1 +Assembly: fiebr %f6,4,%f7 +Testing: fidbra %f0,4,%f1,0 +Frontend: fidbr %f0,4,%f1 +Assembly: fidbr %f6,4,%f7 +Testing: fixbra %f0,4,%f1,0 +Frontend: fixbr %f0,4,%f1 +Assembly: fixbr %f0,4,%f4 +Testing: fiebra %f0,5,%f1,0 +Frontend: fiebr %f0,5,%f1 +Assembly: fiebr %f6,5,%f7 +Testing: fidbra %f0,5,%f1,0 +Frontend: fidbr %f0,5,%f1 +Assembly: fidbr %f6,5,%f7 +Testing: fixbra %f0,5,%f1,0 +Frontend: fixbr %f0,5,%f1 +Assembly: fixbr %f0,5,%f4 +Testing: fiebra %f0,6,%f1,0 +Frontend: fiebr %f0,6,%f1 +Assembly: fiebr %f6,6,%f7 +Testing: fidbra %f0,6,%f1,0 +Frontend: fidbr %f0,6,%f1 +Assembly: fidbr %f6,6,%f7 +Testing: fixbra %f0,6,%f1,0 +Frontend: fixbr %f0,6,%f1 +Assembly: fixbr %f0,6,%f4 +Testing: fiebra %f0,7,%f1,0 +Frontend: fiebr %f0,7,%f1 +Assembly: fiebr %f6,7,%f7 +Testing: fidbra %f0,7,%f1,0 +Frontend: fidbr %f0,7,%f1 +Assembly: fidbr %f6,7,%f7 +Testing: fixbra %f0,7,%f1,0 +Frontend: fixbr %f0,7,%f1 +Assembly: fixbr %f0,7,%f4 +============================================================ +LOAD LENGTHENED +============================================================ +Testing: ldebr %f0,%f1 +Frontend: ldebr %f0,%f1 +Assembly: ldebr %f6,%f7 +Testing: lxdbr %f0,%f1 +Frontend: lxdbr %f0,%f1 +Assembly: lxdbr %f12,%f7 +Testing: lxebr %f0,%f1 +Frontend: lxebr %f0,%f1 +Assembly: lxebr %f12,%f7 +============================================================ +LOAD NEGATIVE +============================================================ +Testing: lnebr %f0,%f1 +Frontend: lnebr %f0,%f1 +Assembly: lnebr %f6,%f7 +Testing: lndbr %f0,%f1 +Frontend: lndbr %f0,%f1 +Assembly: lndbr %f6,%f7 +============================================================ +LOAD POSITIVE +============================================================ +Testing: lpebr %f0,%f1 +Frontend: lpebr %f0,%f1 +Assembly: lpebr %f6,%f7 +Testing: lpdbr %f0,%f1 +Frontend: lpdbr %f0,%f1 +Assembly: lpdbr %f6,%f7 +Testing: lpxbr %f0,%f1 +Frontend: lpxbr %f0,%f1 +Assembly: lpxbr %f12,%f13 +============================================================ +LOAD ROUNDED +============================================================ +Testing: ledbr %f0,%f1 +Frontend: ledbr %f0,%f1 +Assembly: ledbr %f6,%f7 +Testing: ldxbr %f0,%f1 +Frontend: ldxbr %f0,%f1 +Assembly: ldxbr %f12,%f13 +Testing: lexbr %f0,%f1 +Frontend: lexbr %f0,%f1 +Assembly: lexbr %f12,%f13 +Testing: ledbra %f0,0,%f1,0 +Frontend: ledbr %f0,%f1 +Assembly: ledbr %f6,%f7 +Testing: ldxbra %f0,0,%f1,0 +Frontend: ldxbr %f0,%f1 +Assembly: ldxbr %f12,%f13 +Testing: lexbra %f0,0,%f1,0 +Frontend: lexbr %f0,%f1 +Assembly: lexbr %f12,%f13 +Testing: ledbra %f0,1,%f1,0 +Frontend: ledbra %f0,1,%f1,0 +Assembly: ledbra %f6,1,%f7,0 +Testing: ldxbra %f0,1,%f1,0 +Frontend: ldxbra %f0,1,%f1,0 +Assembly: ldxbra %f12,1,%f13,0 +Testing: lexbra %f0,1,%f1,0 +Frontend: lexbra %f0,1,%f1,0 +Assembly: lexbra %f12,1,%f13,0 +Testing: ledbra %f0,3,%f1,0 +Frontend: ledbra %f0,3,%f1,0 +Assembly: ledbra %f6,3,%f7,0 +Testing: ldxbra %f0,3,%f1,0 +Frontend: ldxbra %f0,3,%f1,0 +Assembly: ldxbra %f12,3,%f13,0 +Testing: lexbra %f0,3,%f1,0 +Frontend: lexbra %f0,3,%f1,0 +Assembly: lexbra %f12,3,%f13,0 +Testing: ledbra %f0,4,%f1,0 +Frontend: ledbra %f0,4,%f1,0 +Assembly: ledbra %f6,4,%f7,0 +Testing: ldxbra %f0,4,%f1,0 +Frontend: ldxbra %f0,4,%f1,0 +Assembly: ldxbra %f12,4,%f13,0 +Testing: lexbra %f0,4,%f1,0 +Frontend: lexbra %f0,4,%f1,0 +Assembly: lexbra %f12,4,%f13,0 +Testing: ledbra %f0,5,%f1,0 +Frontend: ledbra %f0,5,%f1,0 +Assembly: ledbra %f6,5,%f7,0 +Testing: ldxbra %f0,5,%f1,0 +Frontend: ldxbra %f0,5,%f1,0 +Assembly: ldxbra %f12,5,%f13,0 +Testing: lexbra %f0,5,%f1,0 +Frontend: lexbra %f0,5,%f1,0 +Assembly: lexbra %f12,5,%f13,0 +Testing: ledbra %f0,6,%f1,0 +Frontend: ledbra %f0,6,%f1,0 +Assembly: ledbra %f6,6,%f7,0 +Testing: ldxbra %f0,6,%f1,0 +Frontend: ldxbra %f0,6,%f1,0 +Assembly: ldxbra %f12,6,%f13,0 +Testing: lexbra %f0,6,%f1,0 +Frontend: lexbra %f0,6,%f1,0 +Assembly: lexbra %f12,6,%f13,0 +Testing: ledbra %f0,7,%f1,0 +Frontend: ledbra %f0,7,%f1,0 +Assembly: ledbra %f6,7,%f7,0 +Testing: ldxbra %f0,7,%f1,0 +Frontend: ldxbra %f0,7,%f1,0 +Assembly: ldxbra %f12,7,%f13,0 +Testing: lexbra %f0,7,%f1,0 +Frontend: lexbra %f0,7,%f1,0 +Assembly: lexbra %f12,7,%f13,0 +============================================================ +MULTIPLY +============================================================ +Testing: meebr %f0,%f1 +Frontend: meebr %f0,%f1 +Assembly: meebr %f7,%f6 +Testing: mdbr %f0,%f1 +Frontend: mdbr %f0,%f1 +Assembly: mdbr %f7,%f6 +Testing: mxbr %f0,%f1 +Frontend: mxbr %f0,%f1 +Assembly: mxbr %f12,%f13 +============================================================ +MULTIPLY AND ADD +============================================================ +Testing: maebr %f0,%f1,%f2 +Frontend: maebr %f0,%f1,%f2 +Assembly: maebr %f5,%f7,%f6 +Testing: madbr %f0,%f1,%f2 +Frontend: madbr %f0,%f1,%f2 +Assembly: madbr %f5,%f7,%f6 +============================================================ +MULTIPLY AND SUBTRACT +============================================================ +Testing: msebr %f0,%f1,%f2 +Frontend: msebr %f0,%f1,%f2 +Assembly: msebr %f5,%f7,%f6 +Testing: msdbr %f0,%f1,%f2 +Frontend: msdbr %f0,%f1,%f2 +Assembly: msdbr %f5,%f7,%f6 +============================================================ +SQUARE ROOT +============================================================ +Testing: sqebr %f0,%f1 +Frontend: sqebr %f0,%f1 +Assembly: sqebr %f6,%f7 +Testing: sqdbr %f0,%f1 +Frontend: sqdbr %f0,%f1 +Assembly: sqdbr %f6,%f7 +Testing: sqxbr %f0,%f1 +Frontend: sqxbr %f0,%f1 +Assembly: sqxbr %f12,%f13 +============================================================ +SUBTRACT +============================================================ +Testing: sebr %f0,%f1 +Frontend: sebr %f0,%f1 +Assembly: sebr %f7,%f6 +Testing: sdbr %f0,%f1 +Frontend: sdbr %f0,%f1 +Assembly: sdbr %f7,%f6 +Testing: sxbr %f0,%f1 +Frontend: sxbr %f0,%f1 +Assembly: sxbr %f12,%f13 diff --git a/none/tests/s390x/bfp-emit.stderr.exp b/none/tests/s390x/bfp-emit.stderr.exp new file mode 100644 index 000000000..139597f9c --- /dev/null +++ b/none/tests/s390x/bfp-emit.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/bfp-emit.vgtest b/none/tests/s390x/bfp-emit.vgtest new file mode 100644 index 000000000..b6c6e5b06 --- /dev/null +++ b/none/tests/s390x/bfp-emit.vgtest @@ -0,0 +1,3 @@ +prereq: ./bfp-emit.pl --check-prereq && ../../../tests/s390x_features s390x-fpext +prog: /bin/true +post: ./bfp-emit.pl From ba04b3177e8fdcbb71686585850877fe6ab48ffa Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 20 Sep 2025 19:16:38 +0200 Subject: [PATCH 313/412] FreeBSD regtest: add an amd64 test that max nb args to a syscall get passed correctly --- .gitignore | 1 + memcheck/tests/amd64-freebsd/filter_arg_check | 22 +++++++++++++++++++ .../tests/amd64-freebsd/scalar_arg_check.c | 8 +++++++ .../amd64-freebsd/scalar_arg_check.stderr.exp | 1 + .../amd64-freebsd/scalar_arg_check.vgtest | 3 +++ 5 files changed, 35 insertions(+) create mode 100755 memcheck/tests/amd64-freebsd/filter_arg_check create mode 100644 memcheck/tests/amd64-freebsd/scalar_arg_check.c create mode 100644 memcheck/tests/amd64-freebsd/scalar_arg_check.stderr.exp create mode 100644 memcheck/tests/amd64-freebsd/scalar_arg_check.vgtest diff --git a/.gitignore b/.gitignore index d548fb7ba..75675b131 100644 --- a/.gitignore +++ b/.gitignore @@ -1492,6 +1492,7 @@ /memcheck/tests/amd64-freebsd/posix_fallocate /memcheck/tests/amd64-freebsd/reallocarray /memcheck/tests/amd64-freebsd/reallocf +/memcheck/tests/amd64-freebsd/scalar_arg_check # /memcheck/tests/x86-freebsd /memcheck/tests/x86-freebsd/*.stderr.diff diff --git a/memcheck/tests/amd64-freebsd/filter_arg_check b/memcheck/tests/amd64-freebsd/filter_arg_check new file mode 100755 index 000000000..334a32669 --- /dev/null +++ b/memcheck/tests/amd64-freebsd/filter_arg_check @@ -0,0 +1,22 @@ +#! /bin/sh + +# Only one test uses this which calls syscall(SYS_sendfile) +# which is the only amd64 syscall that uses 7 arguments +# The output includes --trace-syscalls=yes which is very verbose +# but we only want to see the sendfile line + +# the libc signature for sendfile is +# int sendfile(int fd, int s, off_t offset, size_t nbytes, +# struct sf_hdtr *hdtr, off_t *sbytes, int flags); +# The testcase uses values from 101 to 107 for the arguments +# (to make it easy to match the testcase to the log output) +# Some of the arguments are printed as hex, not too bad. +# Argument 6 is an offset which seems to get added to some +# variable length base address before being sent to the syscall. +# I've checked with truss and ktrace, this doesn't come from Valgrind + +grep "SYSCALL.*sendfile" | +sed 's/==.*//' | +awk '{l=length($9);$9="0x"substr($9, l-2, l);print}' | +sed -E 's/\[[0-9]{5}/[xxxxx/' + diff --git a/memcheck/tests/amd64-freebsd/scalar_arg_check.c b/memcheck/tests/amd64-freebsd/scalar_arg_check.c new file mode 100644 index 000000000..cfa6d4ea0 --- /dev/null +++ b/memcheck/tests/amd64-freebsd/scalar_arg_check.c @@ -0,0 +1,8 @@ +#include "../freebsd/scalar.h" + +int main(void) +{ + /* sendfile uses 7 args */ + SY(SYS_sendfile, 101, 102, 103, 104, 105, 106, 107); +} + diff --git a/memcheck/tests/amd64-freebsd/scalar_arg_check.stderr.exp b/memcheck/tests/amd64-freebsd/scalar_arg_check.stderr.exp new file mode 100644 index 000000000..7b9fc6363 --- /dev/null +++ b/memcheck/tests/amd64-freebsd/scalar_arg_check.stderr.exp @@ -0,0 +1 @@ +SYSCALL[xxxxx,1](393) sys_sendfile ( 101, 102, 103, 104, 0x69, 0x6a, 107 ) diff --git a/memcheck/tests/amd64-freebsd/scalar_arg_check.vgtest b/memcheck/tests/amd64-freebsd/scalar_arg_check.vgtest new file mode 100644 index 000000000..b5c15205e --- /dev/null +++ b/memcheck/tests/amd64-freebsd/scalar_arg_check.vgtest @@ -0,0 +1,3 @@ +prog: scalar_arg_check +vgopts: -q --trace-syscalls=yes +stderr_filter: filter_arg_check From 6a191834d53f44af3d83cb53c2955c195550961a Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 20 Sep 2025 19:19:46 +0200 Subject: [PATCH 314/412] FreeBSD regtest: forgot the makefile changes for amd64 scalar_arg_check --- memcheck/tests/amd64-freebsd/Makefile.am | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/memcheck/tests/amd64-freebsd/Makefile.am b/memcheck/tests/amd64-freebsd/Makefile.am index 9f1cefea2..378446d4c 100644 --- a/memcheck/tests/amd64-freebsd/Makefile.am +++ b/memcheck/tests/amd64-freebsd/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/Makefile.tool-tests.am -dist_noinst_SCRIPTS = filter_stderr +dist_noinst_SCRIPTS = filter_stderr filter_arg_check EXTRA_DIST = \ posix_fadvise.vgtest \ @@ -11,10 +11,12 @@ EXTRA_DIST = \ reallocarray.vgtest \ reallocarray.stderr.exp \ reallocf.vgtest \ - reallocf.stderr.exp + reallocf.stderr.exp \ + scalar_arg_check.vgtest \ + scalar_arg_check.stderr.exp check_PROGRAMS = \ - posix_fadvise posix_fallocate reallocarray reallocf + posix_fadvise posix_fallocate reallocarray reallocf scalar_arg_check AM_CFLAGS += @FLAG_M64@ AM_CXXFLAGS += @FLAG_M64@ From 0700c69d4f0fd9982c7fb31d84e35a2f91780898 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 20 Sep 2025 19:20:50 +0200 Subject: [PATCH 315/412] FreeBSD amd64: amd64 syscalls only ever need max 7 args The only possible exception would be a syscall0 of SYS_sendfile done by the host. Since we're never going to do that reduce the number of arguments to 7. --- coregrind/m_syscall.c | 11 ++++------- coregrind/m_syswrap/syscall-amd64-freebsd.S | 12 ++---------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/coregrind/m_syscall.c b/coregrind/m_syscall.c index c76f1df81..18a592059 100644 --- a/coregrind/m_syscall.c +++ b/coregrind/m_syscall.c @@ -768,7 +768,6 @@ extern UWord do_syscall_WRK ( UWord a5, /* %r9 */ UWord a6, /* 8(%rsp) */ UWord a7, /* 16(%rsp) */ - UWord a8, /* 24(%rsp) */ UInt *flags, /* 32(%rsp) */ UWord *rv2 /* 40(%rsp) */ ); @@ -784,20 +783,18 @@ asm( " movq %r8, %r10\n" /* a4 */ " movq %r9, %r8\n" /* a5 */ " movq 16(%rbp), %r9\n" /* a6 last register arg from stack, account for %rbp */ -" movq 32(%rbp), %r11\n" /* a8 from stack */ -" pushq %r11\n" " movq 24(%rbp), %r11\n" /* a7 from stack */ -" pushq %r11\n" +" pushq %r11\n" " subq $8,%rsp\n" /* fake return addr */ " syscall\n" " jb 1f\n" -" movq 48(%rbp),%rsi\n" /* success */ +" movq 40(%rbp),%rsi\n" /* success */ " movq %rdx, (%rsi)\n" /* second return value */ " movq %rbp, %rsp\n" " popq %rbp\n" " ret\n" "1:\n" /* error path */ -" movq 40(%rbp), %rsi\n" /* flags */ +" movq 32(%rbp), %rsi\n" /* flags */ " movl $1,(%rsi)\n" " movq %rbp, %rsp\n" " popq %rbp\n" @@ -1231,7 +1228,7 @@ SysRes VG_(do_syscall) ( UWord sysno, RegWord a1, RegWord a2, RegWord a3, UWord val2 = 0; UInt err = 0; val = do_syscall_WRK(sysno, a1, a2, a3, a4, a5, - a6, a7, a8, &err, &val2); + a6, a7, &err, &val2); return VG_(mk_SysRes_amd64_freebsd)( val, val2, (err & 1) != 0 ? True : False); # elif defined(VGP_arm64_freebsd) diff --git a/coregrind/m_syswrap/syscall-amd64-freebsd.S b/coregrind/m_syswrap/syscall-amd64-freebsd.S index d1516b106..14cd4ee90 100644 --- a/coregrind/m_syswrap/syscall-amd64-freebsd.S +++ b/coregrind/m_syswrap/syscall-amd64-freebsd.S @@ -112,17 +112,9 @@ ML_(do_syscall_for_client_WRK): movq OFFSET_amd64_R10(%r11), %r10 movq OFFSET_amd64_R8(%r11), %r8 movq OFFSET_amd64_R9(%r11), %r9 - /* 2 stack parameters plus return address (ignored by syscall) */ - /* @todo PJF there is a potential bug here - * syscall can take up to 8 arguments - * but when syscall0 or syscall198 is being used - * one argument is used for the syscall0/198 id - * and one for the actual id and in this case - * there could be 3 stack parameters. - * However, only mmap takes 8 arguments - * and only on x86. It would be an unlikely combination, - * but this might break one day. */ + /* get RSP */ movq OFFSET_amd64_RSP(%r11), %r11 /* r11 = simulated RSP */ + /* 2 stack parameters */ movq 16(%r11), %rax pushq %rax movq 8(%r11), %rax From 0a9e19a5947a2d57f5a40ebd4095a9320978b66b Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 20 Sep 2025 21:01:22 +0200 Subject: [PATCH 316/412] FreeBSD regtest: add scalar_arg_check for arm64 Much the same as arm64. x86 otoh is the only FreeBSD platform to use PRE_REG_READ8 (again for sendfile). --- .gitignore | 10 +++++++++ configure.ac | 1 + memcheck/tests/Makefile.am | 3 +++ memcheck/tests/arm64-freebsd/Makefile.am | 16 ++++++++++++++ memcheck/tests/arm64-freebsd/filter_arg_check | 22 +++++++++++++++++++ memcheck/tests/arm64-freebsd/filter_stderr | 3 +++ .../tests/arm64-freebsd/scalar_arg_check.c | 1 + .../arm64-freebsd/scalar_arg_check.stderr.exp | 1 + .../arm64-freebsd/scalar_arg_check.vgtest | 1 + 9 files changed, 58 insertions(+) create mode 100644 memcheck/tests/arm64-freebsd/Makefile.am create mode 100755 memcheck/tests/arm64-freebsd/filter_arg_check create mode 100755 memcheck/tests/arm64-freebsd/filter_stderr create mode 120000 memcheck/tests/arm64-freebsd/scalar_arg_check.c create mode 100644 memcheck/tests/arm64-freebsd/scalar_arg_check.stderr.exp create mode 120000 memcheck/tests/arm64-freebsd/scalar_arg_check.vgtest diff --git a/.gitignore b/.gitignore index 75675b131..a5e97008b 100644 --- a/.gitignore +++ b/.gitignore @@ -1506,6 +1506,16 @@ /memcheck/tests/x86-freebsd/posix_fallocate /memcheck/tests/x86-freebsd/reallocarray +# /memcheck/tests/arm64-freebsd +/memcheck/tests/arm64-freebsd/*.stderr.diff +/memcheck/tests/arm64-freebsd/*.stderr.out +/memcheck/tests/arm64-freebsd/*.stdout.diff +/memcheck/tests/arm64-freebsd/*.stdout.out +/memcheck/tests/arm64-freebsd/.deps +/memcheck/tests/arm64-freebsd/Makefile +/memcheck/tests/arm64-freebsd/Makefile.in +/memcheck/tests/arm64-freebsd/scalar_arg_check + # /mpi/ /mpi/*.dSYM /mpi/*.so diff --git a/configure.ac b/configure.ac index 1740008a6..1e7d50655 100755 --- a/configure.ac +++ b/configure.ac @@ -5779,6 +5779,7 @@ AC_CONFIG_FILES([ memcheck/tests/amd64-solaris/Makefile memcheck/tests/x86-solaris/Makefile memcheck/tests/amd64-freebsd/Makefile + memcheck/tests/arm64-freebsd/Makefile memcheck/tests/x86-freebsd/Makefile memcheck/tests/ppc32/Makefile memcheck/tests/ppc64/Makefile diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index c1779a7bb..c9a617c48 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -68,6 +68,9 @@ endif if VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD SUBDIRS += amd64-freebsd endif +if VGCONF_PLATFORMS_INCLUDE_ARM64_FREEBSD +SUBDIRS += arm64-freebsd +endif DIST_SUBDIRS = x86 amd64 arm64 ppc32 ppc64 s390x linux \ darwin solaris x86-linux amd64-linux arm64-linux riscv64-linux \ diff --git a/memcheck/tests/arm64-freebsd/Makefile.am b/memcheck/tests/arm64-freebsd/Makefile.am new file mode 100644 index 000000000..66523227a --- /dev/null +++ b/memcheck/tests/arm64-freebsd/Makefile.am @@ -0,0 +1,16 @@ + +include $(top_srcdir)/Makefile.tool-tests.am + +dist_noinst_SCRIPTS = filter_stderr filter_arg_check + +EXTRA_DIST = \ + scalar_arg_check.vgtest \ + scalar_arg_check.stderr.exp + +check_PROGRAMS = \ + scalar_arg_check + +AM_CFLAGS += @FLAG_M64@ +AM_CXXFLAGS += @FLAG_M64@ +AM_CCASFLAGS += @FLAG_M64@ + diff --git a/memcheck/tests/arm64-freebsd/filter_arg_check b/memcheck/tests/arm64-freebsd/filter_arg_check new file mode 100755 index 000000000..334a32669 --- /dev/null +++ b/memcheck/tests/arm64-freebsd/filter_arg_check @@ -0,0 +1,22 @@ +#! /bin/sh + +# Only one test uses this which calls syscall(SYS_sendfile) +# which is the only amd64 syscall that uses 7 arguments +# The output includes --trace-syscalls=yes which is very verbose +# but we only want to see the sendfile line + +# the libc signature for sendfile is +# int sendfile(int fd, int s, off_t offset, size_t nbytes, +# struct sf_hdtr *hdtr, off_t *sbytes, int flags); +# The testcase uses values from 101 to 107 for the arguments +# (to make it easy to match the testcase to the log output) +# Some of the arguments are printed as hex, not too bad. +# Argument 6 is an offset which seems to get added to some +# variable length base address before being sent to the syscall. +# I've checked with truss and ktrace, this doesn't come from Valgrind + +grep "SYSCALL.*sendfile" | +sed 's/==.*//' | +awk '{l=length($9);$9="0x"substr($9, l-2, l);print}' | +sed -E 's/\[[0-9]{5}/[xxxxx/' + diff --git a/memcheck/tests/arm64-freebsd/filter_stderr b/memcheck/tests/arm64-freebsd/filter_stderr new file mode 100755 index 000000000..a778e971f --- /dev/null +++ b/memcheck/tests/arm64-freebsd/filter_stderr @@ -0,0 +1,3 @@ +#! /bin/sh + +../filter_stderr "$@" diff --git a/memcheck/tests/arm64-freebsd/scalar_arg_check.c b/memcheck/tests/arm64-freebsd/scalar_arg_check.c new file mode 120000 index 000000000..629936bea --- /dev/null +++ b/memcheck/tests/arm64-freebsd/scalar_arg_check.c @@ -0,0 +1 @@ +../amd64-freebsd/scalar_arg_check.c \ No newline at end of file diff --git a/memcheck/tests/arm64-freebsd/scalar_arg_check.stderr.exp b/memcheck/tests/arm64-freebsd/scalar_arg_check.stderr.exp new file mode 100644 index 000000000..7b9fc6363 --- /dev/null +++ b/memcheck/tests/arm64-freebsd/scalar_arg_check.stderr.exp @@ -0,0 +1 @@ +SYSCALL[xxxxx,1](393) sys_sendfile ( 101, 102, 103, 104, 0x69, 0x6a, 107 ) diff --git a/memcheck/tests/arm64-freebsd/scalar_arg_check.vgtest b/memcheck/tests/arm64-freebsd/scalar_arg_check.vgtest new file mode 120000 index 000000000..5b2d7ffaf --- /dev/null +++ b/memcheck/tests/arm64-freebsd/scalar_arg_check.vgtest @@ -0,0 +1 @@ +../amd64-freebsd/scalar_arg_check.vgtest \ No newline at end of file From 7933a6fcb56b5e4de5d56b48e25e869633666185 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 20 Sep 2025 22:06:08 +0200 Subject: [PATCH 317/412] FreeBSD arm64: arm64 syscalls also only ever need max 7 args --- coregrind/m_syscall.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/coregrind/m_syscall.c b/coregrind/m_syscall.c index 18a592059..52a35a695 100644 --- a/coregrind/m_syscall.c +++ b/coregrind/m_syscall.c @@ -805,32 +805,31 @@ asm( #elif defined(VGP_arm64_freebsd) /* - * Arguments a1 to a8 are in registers x0 to x7. + * Arguments a1 to a7 are in registers x0 to x6. * Which is just what we want for a syscall. * - * The syscall number is on the top of the stack - * pointed to by sp. The flags are at sp+8 and - * second return value at sp+16. + * The syscall number is in x9 + * The flags are at the top of the stack, sp and + * second return value at sp+8. */ extern UWord do_syscall_WRK ( UWord a1, UWord a2, UWord a3, UWord a4, UWord a5, UWord a6, - UWord a7, UWord a8, - UWord syscall_no, + UWord a7, UWord syscall_no, UInt *flags, UWord *rv2 ); asm( ".text\n" ".globl do_syscall_WRK\n" "do_syscall_WRK:\n" - " ldr x8, [sp]\n" // retrieve syscall_no, put it in x8 + " mov x8, x9\n" // get the syscall number from x9 " svc 0x0\n" // do the syscall " mov x9, 1\n" // flags for error will be 1 or 0 " csel x9, x9, xzr, cs\n" // conditionally select 1 or 0 into x9 - " ldr x10, [sp, #8]\n" // load the address of flags + " ldr x10, [sp]\n" // load the address of flags " str w9, [x10]\n" // store flags result - " ldr x10, [sp, #16]\n" // load the addres of rv2 + " ldr x10, [sp, #8]\n" // load the addres of rv2 " str x1, [x10]\n" // store rv2 result " ret\n" ".previous\n" @@ -1236,7 +1235,7 @@ SysRes VG_(do_syscall) ( UWord sysno, RegWord a1, RegWord a2, RegWord a3, UWord val2 = 0; UInt err = 0; val = do_syscall_WRK(a1, a2, a3, a4, a5, - a6, a7, a8, sysno, &err, &val2); + a6, a7, sysno, &err, &val2); return VG_(mk_SysRes_arm64_freebsd)( val, val2, (err & 1) != 0 ? True : False); # elif defined(VGP_ppc32_linux) From 717265383c8af6f99836a42ebe54c49e98065ccb Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 20 Sep 2025 22:31:48 +0200 Subject: [PATCH 318/412] memcheck/tests/Makefile.am: Add arm64-freebsd to DIST_SUBDIRS Fixes: 0a9e19a5947a ("FreeBSD regtest: add scalar_arg_check for arm64") --- memcheck/tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index c9a617c48..0b192de10 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -75,7 +75,7 @@ endif DIST_SUBDIRS = x86 amd64 arm64 ppc32 ppc64 s390x linux \ darwin solaris x86-linux amd64-linux arm64-linux riscv64-linux \ x86-solaris amd64-solaris mips32 mips64 \ - freebsd amd64-freebsd x86-freebsd \ + freebsd amd64-freebsd arm64-freebsd x86-freebsd \ common . dist_noinst_SCRIPTS = \ From 1039274db9695bd41a119fe32c465d0845700820 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 21 Sep 2025 08:07:11 +0200 Subject: [PATCH 319/412] regtest: add arm64-freebsd to tests/platform_test Not explicitly listing the platform was causing the one test to run on other platforms --- tests/platform_test | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/platform_test b/tests/platform_test index 9762d0c09..ac452502d 100644 --- a/tests/platform_test +++ b/tests/platform_test @@ -18,6 +18,7 @@ all_platforms="$all_platforms riscv64-linux" all_platforms="$all_platforms x86-darwin amd64-darwin" all_platforms="$all_platforms x86-solaris amd64-solaris" all_platforms="$all_platforms x86-freebsd amd64-freebsd" +all_platforms="$all_platforms arm64-freebsd" if [ $# -ne 2 ] ; then echo "usage: platform_test " From c1f6e5e64aedc82b415bea515d731061d0d6e76f Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 21 Sep 2025 17:08:35 +0200 Subject: [PATCH 320/412] Refactor: make try_get_interp extern and multi-plaftorm Previously it was static and defined for Darwin, FreeBSD and Linux. Now it is global VG_(args_the_exename) and has a length check. Also fixed a nasty bug related to VG_(args_the_exename). Initially this is set to point to the name of the client command in Valgrinds own arguments. Later when checking for scripts or binaries VG_(load_script) may get called recursively. If it gets called more than once it sets VG_(args_the_exename) to point to the new name. But that is on the stack. Later, if the stack grows too much the name will get overwritten. I was seeing that with my first versions of this code in the recursive tests in none/tests/scripts. Now I'm allocating VG_(args_the_exename) on the heap. --- coregrind/m_commandline.c | 2 +- coregrind/m_initimg/initimg-darwin.c | 54 +-------------------------- coregrind/m_initimg/initimg-freebsd.c | 48 +----------------------- coregrind/m_initimg/initimg-linux.c | 52 +------------------------- coregrind/m_pathscan.c | 40 ++++++++++++++++++++ coregrind/m_ume/script.c | 10 ++++- coregrind/pub_core_pathscan.h | 4 +- 7 files changed, 56 insertions(+), 154 deletions(-) diff --git a/coregrind/m_commandline.c b/coregrind/m_commandline.c index e9fdb9bb4..da57d6c8c 100644 --- a/coregrind/m_commandline.c +++ b/coregrind/m_commandline.c @@ -213,7 +213,7 @@ void VG_(split_up_argv)( Int argc, HChar** argv ) /* Should now be looking at the exe name. */ if (i < argc) { vg_assert(argv[i]); - VG_(args_the_exename) = argv[i]; + VG_(args_the_exename) = VG_(strdup)("commandline.sua.4", argv[i]); i++; } diff --git a/coregrind/m_initimg/initimg-darwin.c b/coregrind/m_initimg/initimg-darwin.c index ca71295f2..69685ef67 100644 --- a/coregrind/m_initimg/initimg-darwin.c +++ b/coregrind/m_initimg/initimg-darwin.c @@ -259,58 +259,6 @@ static HChar *copy_str(HChar **tab, const HChar *str) return orig; } -/* - * @todo PJF Make this multi-platform - */ -static Bool try_get_interp(const HChar* args_exe, HChar* interp_out) -{ - HChar hdr[4096]; - Int len = sizeof hdr; - SysRes res; - Int fd; - HChar* end; - HChar* cp; - HChar* interp; - - res = VG_(open)(args_exe, VKI_O_RDONLY, 0); - if (sr_isError(res)) { - return False; - } else { - fd = sr_Res(res); - } - - res = VG_(pread)(fd, hdr, len, 0); - - if (sr_isError(res)) { - VG_(close)(fd); - return False; - } else { - len = sr_Res(res); - } - - if (0 != VG_(memcmp)(hdr, "#!", 2)) { - VG_(close)(fd); - return False; - } - - end = hdr + len; - interp = hdr + 2; - while (interp < end && (*interp == ' ' || *interp == '\t')) - interp++; - - for (cp = interp; cp < end && !VG_(isspace)(*cp); cp++) - ; - - *cp = '\0'; - - VG_(sprintf)(interp_out, "%s", interp); - - VG_(close)(fd); - return True; -} - - - /* ---------------------------------------------------------------- This sets up the client's initial stack, containing the args, @@ -503,7 +451,7 @@ Addr setup_client_stack( void* init_sp, if (VG_(resolved_exename) == NULL) { const HChar *exe_name = VG_(find_executable)(VG_(args_the_exename)); HChar interp_name[VKI_PATH_MAX]; - if (try_get_interp(exe_name, interp_name)) { + if (VG_(try_get_interp)(exe_name, interp_name, VKI_PATH_MAX)) { exe_name = interp_name; } HChar resolved_name[VKI_PATH_MAX]; diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index 3e0d07544..2f8ac82eb 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -337,52 +337,6 @@ static const struct auxv *find_auxv(const UWord* sp) /* * @todo PJF Make this multi-platform */ -static Bool try_get_interp(const HChar* args_exe, HChar* interp_out) -{ - HChar hdr[4096]; - Int len = sizeof hdr; - SysRes res; - Int fd; - HChar* end; - HChar* cp; - HChar* interp; - - res = VG_(open)(args_exe, VKI_O_RDONLY, 0); - if (sr_isError(res)) { - return False; - } else { - fd = sr_Res(res); - } - - res = VG_(pread)(fd, hdr, len, 0); - - if (sr_isError(res)) { - VG_(close)(fd); - return False; - } else { - len = sr_Res(res); - } - - if (0 != VG_(memcmp)(hdr, "#!", 2)) { - VG_(close)(fd); - return False; - } - - end = hdr + len; - interp = hdr + 2; - while (interp < end && (*interp == ' ' || *interp == '\t')) - interp++; - - for (cp = interp; cp < end && !VG_(isspace)(*cp); cp++) - ; - - *cp = '\0'; - - VG_(sprintf)(interp_out, "%s", interp); - - VG_(close)(fd); - return True; -} /* ---------------------------------------------------------------- @@ -468,7 +422,7 @@ static Addr setup_client_stack(const void* init_sp, const HChar *exe_name = VG_(find_executable)(VG_(args_the_exename)); HChar interp_name[VKI_PATH_MAX]; - if (try_get_interp(exe_name, interp_name)) { + if (VG_(try_get_interp)(exe_name, interp_name, VKI_PATH_MAX)) { exe_name = interp_name; } HChar resolved_name[VKI_PATH_MAX]; diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c index bcca59da7..935f032a4 100644 --- a/coregrind/m_initimg/initimg-linux.c +++ b/coregrind/m_initimg/initimg-linux.c @@ -385,56 +385,6 @@ struct auxv *find_auxv(UWord* sp) return (struct auxv *)sp; } -/* - * @todo PJF Make this multi-platform - */ -static Bool try_get_interp(const HChar* args_exe, HChar* interp_out) -{ - HChar hdr[4096]; - Int len = sizeof hdr; - SysRes res; - Int fd; - HChar* end; - HChar* cp; - HChar* interp; - - res = VG_(open)(args_exe, VKI_O_RDONLY, 0); - if (sr_isError(res)) { - return False; - } else { - fd = sr_Res(res); - } - - res = VG_(pread)(fd, hdr, len, 0); - - if (sr_isError(res)) { - VG_(close)(fd); - return False; - } else { - len = sr_Res(res); - } - - if (0 != VG_(memcmp)(hdr, "#!", 2)) { - VG_(close)(fd); - return False; - } - - end = hdr + len; - interp = hdr + 2; - while (interp < end && (*interp == ' ' || *interp == '\t')) - interp++; - - for (cp = interp; cp < end && !VG_(isspace)(*cp); cp++) - ; - - *cp = '\0'; - - VG_(sprintf)(interp_out, "%s", interp); - - VG_(close)(fd); - return True; -} - static Addr setup_client_stack( void* init_sp, HChar** orig_envp, @@ -1006,7 +956,7 @@ Addr setup_client_stack( void* init_sp, if (VG_(resolved_exename) == NULL) { const HChar *exe_name = VG_(find_executable)(VG_(args_the_exename)); HChar interp_name[VKI_PATH_MAX]; - if (try_get_interp(exe_name, interp_name)) { + if (VG_(try_get_interp)(exe_name, interp_name, VKI_PATH_MAX)) { exe_name = interp_name; } HChar resolved_name[VKI_PATH_MAX]; diff --git a/coregrind/m_pathscan.c b/coregrind/m_pathscan.c index 02b371486..f66774654 100644 --- a/coregrind/m_pathscan.c +++ b/coregrind/m_pathscan.c @@ -139,6 +139,46 @@ const HChar* VG_(find_executable) ( const HChar* exec ) return executable_name_out; } +Bool VG_(try_get_interp)(const HChar* args_exe, HChar* interp_out, SizeT max_interp_len) +{ + HChar hdr[4096]; + SysRes res; + Int fd; + HChar* end; + HChar* cp; + HChar* interp; + + res = VG_(open)(args_exe, VKI_O_RDONLY, 0); + if (sr_isError(res)) + return False; + fd = sr_Res(res); + + res = VG_(pread)(fd, hdr, sizeof(hdr), 0); + VG_(close)(fd); + if (sr_isError(res)) + return False; + + Int len = sr_Res(res); + if (len < 2 || VG_(memcmp)(hdr, "#!", 2) != 0) + return False; + + end = hdr + len; + interp = hdr + 2; + while (interp < end && (*interp == ' ' || *interp == '\t')) + interp++; + for (cp = interp; cp < end && !VG_(isspace)(*cp); cp++) + ; + + SizeT interp_len = cp - interp; + if (interp_len >= max_interp_len) + return False; + + VG_(memcpy)(interp_out, interp, interp_len); + interp_out[interp_len] = '\0'; + + return True; +} + /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/ diff --git a/coregrind/m_ume/script.c b/coregrind/m_ume/script.c index 82d2477d3..aadc2de07 100644 --- a/coregrind/m_ume/script.c +++ b/coregrind/m_ume/script.c @@ -124,7 +124,15 @@ Int VG_(load_script)(Int fd, const HChar* name, ExeInfo* info) if (info->argv && info->argv[0] != NULL) info->argv[0] = name; - VG_(args_the_exename) = name; + vg_assert(VG_(args_the_exename)); + if (name) { + if (name != VG_(args_the_exename)) { + VG_(free)((void*)VG_(args_the_exename)); + VG_(args_the_exename) = VG_(strdup)("ume.ls.3", name); + } + } else { + VG_(args_the_exename) = name; + } if (0) VG_(printf)("#! script: interp_name=\"%s\" interp_args=\"%s\"\n", diff --git a/coregrind/pub_core_pathscan.h b/coregrind/pub_core_pathscan.h index d84953ab2..8c89fe37f 100644 --- a/coregrind/pub_core_pathscan.h +++ b/coregrind/pub_core_pathscan.h @@ -34,4 +34,6 @@ extern const HChar* VG_(find_executable) ( const HChar* exec ); -#endif // ndef __PUB_CORE_PATHSCAN_H +extern Bool VG_(try_get_interp)(const HChar* args_exe, HChar* interp_out, SizeT max_interp_len); + +#endif // __PUB_CORE_PATHSCAN_H From b5c89ee9839a356248e7fc8f406d7ef888d76076 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 21 Sep 2025 20:53:33 +0200 Subject: [PATCH 321/412] Doc: add item on tcmalloc >= 2.16 hangs to FAQ --- docs/xml/FAQ.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/xml/FAQ.xml b/docs/xml/FAQ.xml index 201b36502..f246fa6c9 100644 --- a/docs/xml/FAQ.xml +++ b/docs/xml/FAQ.xml @@ -541,6 +541,26 @@ int main(void) + + + Why does Valgrind hang when using tcmalloc? + + + This is because tcmalloc makes a recursive call in its initialisation code. + Under Valgrind that becomes either an infinite loop with optimised builds of tcmalloc + or a stack overflow crash with debug builds of it. + + Your options are: + + Do not use tcmalloc in the builds that you test with Valgrind. + Use an older version of tcmalloc. This problem started on 2024-03-24. + If you use gperftools 2.15 or older you should not have this problem. + + + + + + From 86242303aa58560c070f45d25f8db7084803ead7 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 21 Sep 2025 20:57:04 +0200 Subject: [PATCH 322/412] doc: missed closing itemizedlist --- docs/xml/FAQ.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/xml/FAQ.xml b/docs/xml/FAQ.xml index f246fa6c9..bb84f3ee7 100644 --- a/docs/xml/FAQ.xml +++ b/docs/xml/FAQ.xml @@ -555,7 +555,8 @@ int main(void) Do not use tcmalloc in the builds that you test with Valgrind. Use an older version of tcmalloc. This problem started on 2024-03-24. If you use gperftools 2.15 or older you should not have this problem. - + + From da81ebf0c53e9d3afd126416d4714cbe5f20120a Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 21 Sep 2025 21:38:15 +0200 Subject: [PATCH 323/412] docs/xml/FAQ.xml: listitems contain paras, not raw CDATA Fixes: b5c89ee9839a ("Doc: add item on tcmalloc >= 2.16 hangs to FAQ") --- docs/xml/FAQ.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/xml/FAQ.xml b/docs/xml/FAQ.xml index bb84f3ee7..5d458a01b 100644 --- a/docs/xml/FAQ.xml +++ b/docs/xml/FAQ.xml @@ -552,9 +552,9 @@ int main(void) Your options are: - Do not use tcmalloc in the builds that you test with Valgrind. - Use an older version of tcmalloc. This problem started on 2024-03-24. - If you use gperftools 2.15 or older you should not have this problem. + Do not use tcmalloc in the builds that you test with Valgrind. + Use an older version of tcmalloc. This problem started on 2024-03-24. + If you use gperftools 2.15 or older you should not have this problem. From 78f1569e2235796256742d7c75763034677065af Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 21 Sep 2025 21:03:55 +0000 Subject: [PATCH 324/412] s390: New testcase none/tests/s390x/hfp Containing the very few needed hexadecimal floating point insns. Carved out of none/tests/s390x/bfp-2 Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 --- none/tests/s390x/Makefile.am | 2 +- none/tests/s390x/bfp-2.c | 26 --------------------- none/tests/s390x/bfp-2.stdout.exp | 4 ---- none/tests/s390x/hfp.c | 39 +++++++++++++++++++++++++++++++ none/tests/s390x/hfp.stderr.exp | 2 ++ none/tests/s390x/hfp.stdout.exp | 4 ++++ none/tests/s390x/hfp.vgtest | 1 + 7 files changed, 47 insertions(+), 31 deletions(-) create mode 100644 none/tests/s390x/hfp.c create mode 100644 none/tests/s390x/hfp.stderr.exp create mode 100644 none/tests/s390x/hfp.stdout.exp create mode 100644 none/tests/s390x/hfp.vgtest diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 98ef178e7..c1909da39 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -22,7 +22,7 @@ INSN_TESTS = clc clcle cvb cvd icm lpr tcxb lam_stam xc mvst add sub mul \ vector_float add-z14 sub-z14 mul-z14 bic \ misc3 vec2 vec2_float \ dfp-1 dfp-2 dfp-3 dfp-4 dfpconv dfpext dfptest pfpo srnmt \ - fpext fixbr + fpext fixbr hfp check_PROGRAMS = $(INSN_TESTS) \ allexec \ diff --git a/none/tests/s390x/bfp-2.c b/none/tests/s390x/bfp-2.c index 73349eddd..b8109ba88 100644 --- a/none/tests/s390x/bfp-2.c +++ b/none/tests/s390x/bfp-2.c @@ -71,26 +71,6 @@ void lcdbr(double in) printf("lcdbr %f -> %f\n", in, out); } -void lder(double prev, float in) -{ - unsigned long out; - - __asm__ volatile("lder %[prev],%[in]\n\t" - "std %[prev],%[out]" : - [out]"=R"(out) : [prev]"f"(prev), [in]"f"(in)); - printf("lder %f -> %lx\n", in, out); -} - -void lde(double prev, float in) -{ - unsigned long out; - - __asm__ volatile("lde %[prev],%[in]\n\t" - "std %[prev],%[out]" : - [out]"=R"(out) : [prev]"f"(prev), [in]"R"(in)); - printf("lde %f -> %lx\n", in, out); -} - int main(void) { // square root @@ -118,11 +98,5 @@ int main(void) lcdbr(-17.5); // 8 byte values lcdbr(234.5); // 8 byte values - // load lengthened - lder(0.2, 321.5f); - lder(0.9, -8388607.f); - lde(0.2, -321.5f); - lde(0.9, 8388607.f); - return 0; } diff --git a/none/tests/s390x/bfp-2.stdout.exp b/none/tests/s390x/bfp-2.stdout.exp index b1bc484c5..074180a27 100644 --- a/none/tests/s390x/bfp-2.stdout.exp +++ b/none/tests/s390x/bfp-2.stdout.exp @@ -12,7 +12,3 @@ lcebr -23.500000 -> 23.500000 lcebr 123.500000 -> -123.500000 lcdbr -17.500000 -> 17.500000 lcdbr 234.500000 -> -234.500000 -lder 321.500000 -> 43a0c00000000000 -lder -8388607.000000 -> cafffffe00000000 -lde -321.500000 -> c3a0c00000000000 -lde 8388607.000000 -> 4afffffe00000000 diff --git a/none/tests/s390x/hfp.c b/none/tests/s390x/hfp.c new file mode 100644 index 000000000..73f70c37c --- /dev/null +++ b/none/tests/s390x/hfp.c @@ -0,0 +1,39 @@ +/* Hexadecimal Floating Point insns + + HFP is generally not supported with very few exceptions. + + Carved out of bfp-2.c with no modifications. */ + +#include + +void lder(double prev, float in) +{ + unsigned long out; + + __asm__ volatile("lder %[prev],%[in]\n\t" + "std %[prev],%[out]" : + [out]"=R"(out) : [prev]"f"(prev), [in]"f"(in)); + printf("lder %f -> %lx\n", in, out); +} + +void lde(double prev, float in) +{ + unsigned long out; + + __asm__ volatile("lde %[prev],%[in]\n\t" + "std %[prev],%[out]" : + [out]"=R"(out) : [prev]"f"(prev), [in]"R"(in)); + printf("lde %f -> %lx\n", in, out); +} + +int main(void) +{ + // load lengthened + lder(0.2, 321.5f); + lder(0.9, -8388607.f); + lde(0.2, -321.5f); + lde(0.9, 8388607.f); + + return 0; +} + diff --git a/none/tests/s390x/hfp.stderr.exp b/none/tests/s390x/hfp.stderr.exp new file mode 100644 index 000000000..139597f9c --- /dev/null +++ b/none/tests/s390x/hfp.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/hfp.stdout.exp b/none/tests/s390x/hfp.stdout.exp new file mode 100644 index 000000000..2e3e77bb7 --- /dev/null +++ b/none/tests/s390x/hfp.stdout.exp @@ -0,0 +1,4 @@ +lder 321.500000 -> 43a0c00000000000 +lder -8388607.000000 -> cafffffe00000000 +lde -321.500000 -> c3a0c00000000000 +lde 8388607.000000 -> 4afffffe00000000 diff --git a/none/tests/s390x/hfp.vgtest b/none/tests/s390x/hfp.vgtest new file mode 100644 index 000000000..296bd099a --- /dev/null +++ b/none/tests/s390x/hfp.vgtest @@ -0,0 +1 @@ +prog: hfp From 6bfecf09ec169e41afcf925f00ee8db7ae8a9b5f Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 22 Sep 2025 14:59:17 +0200 Subject: [PATCH 325/412] gdbserver regtest: add return value to sleepers select error message This is failing on FreeBSD 15 (looks like an OS or libc regression). Improve the error message to make the problem clearer. errno is 0 but select is returning 93 (from a set of 0 fds!). --- gdbserver_tests/sleepers.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gdbserver_tests/sleepers.c b/gdbserver_tests/sleepers.c index b433c1984..51d197a8e 100644 --- a/gdbserver_tests/sleepers.c +++ b/gdbserver_tests/sleepers.c @@ -84,8 +84,11 @@ static void *sleeper_or_burner(void *v) t[s->t].tv_usec = (sleepms % 1000) * 1000; ret = select (0, NULL, NULL, NULL, &t[s->t]); /* We only expect a timeout result or EINTR from the above. */ - if (ret != 0 && errno != EINTR) - perror("unexpected result from select"); + if (ret != 0 && errno != EINTR) { + char buf[64]; + snprintf(buf, 64, "unexpected result (%d) from select", ret); + perror(buf); + } } if (burn > 0 && s->burn) do_burn(); From b1f875b63d6a07115dfba571c6dcc1f280c0b1f4 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 22 Sep 2025 15:31:12 +0000 Subject: [PATCH 326/412] s390: Remove none/tests/s390x/tcxb, add none/tests/s390x/bfp-tdc tcxb was busted. Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 --- none/tests/s390x/Makefile.am | 4 +- none/tests/s390x/bfp-tdc.c | 140 ++++++++++++++++++ .../{tcxb.stderr.exp => bfp-tdc.stderr.exp} | 0 none/tests/s390x/bfp-tdc.stdout.exp | 39 +++++ none/tests/s390x/bfp-tdc.vgtest | 1 + none/tests/s390x/tcxb.c | 95 ------------ none/tests/s390x/tcxb.stdout.exp | 64 -------- none/tests/s390x/tcxb.vgtest | 1 - 8 files changed, 182 insertions(+), 162 deletions(-) create mode 100644 none/tests/s390x/bfp-tdc.c rename none/tests/s390x/{tcxb.stderr.exp => bfp-tdc.stderr.exp} (100%) create mode 100644 none/tests/s390x/bfp-tdc.stdout.exp create mode 100644 none/tests/s390x/bfp-tdc.vgtest delete mode 100644 none/tests/s390x/tcxb.c delete mode 100644 none/tests/s390x/tcxb.stdout.exp delete mode 100644 none/tests/s390x/tcxb.vgtest diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index c1909da39..57dbb55db 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -2,14 +2,14 @@ include $(top_srcdir)/Makefile.tool-tests.am dist_noinst_SCRIPTS = filter_stderr bfp-emit.pl -INSN_TESTS = clc clcle cvb cvd icm lpr tcxb lam_stam xc mvst add sub mul \ +INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ and or xor insert div srst fold_And16 flogr sub_EI add_EI \ and_EI or_EI xor_EI insert_EI mul_GE add_GE condloadstore \ op_exception fgx stck stckf stcke stfle cksm mvcl clcl troo \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ - rounding-1 rounding-2 rounding-3 rounding-4 rounding-5 bfp-1 \ + bfp-tdc rounding-1 rounding-2 rounding-3 rounding-4 rounding-5 bfp-1 \ bfp-2 bfp-3 bfp-4 srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ diff --git a/none/tests/s390x/bfp-tdc.c b/none/tests/s390x/bfp-tdc.c new file mode 100644 index 000000000..a8b6769ef --- /dev/null +++ b/none/tests/s390x/bfp-tdc.c @@ -0,0 +1,140 @@ +/* TEST DATA CLASS + + Test for subnormal numbers is missing. I do not know how */ +#include +#include // NAN +#include // DBL_MIN +#include + +#define ZERO_P (1 << 11) +#define ZERO_N (1 << 10) +#define NORM_P (1 << 9) +#define NORM_N (1 << 8) +#define SUBNORM_P (1 << 7) +#define SUBNORM_N (1 << 6) +#define INF_P (1 << 5) +#define INF_N (1 << 4) +#define QNAN_P (1 << 3) +#define QNAN_N (1 << 2) +#define SNAN_P (1 << 1) +#define SNAN_N (1 << 0) + +static struct what { + unsigned bitno; + unsigned mask; + const char *str; +} whatsit[] = { + { 63, SNAN_N, "Signaling Nan with sign bit negative" }, + { 62, SNAN_P, "Signaling Nan with sign bit posative" }, + { 61, QNAN_N, "Quiet Nan with sign bit negative" }, + { 60, QNAN_P, "Quiet Nan with sign bit posative" }, + { 59, INF_N, "Infinity with sign bit negative" }, + { 58, INF_P, "Infinity with sign bit positive" }, + { 57, SUBNORM_N, "Subnormal number with sign bit negative" }, + { 56, SUBNORM_N, "Subnormal number with sign bit positive" }, + { 55, NORM_N, "Normal number with sign bit negative" }, + { 54, NORM_P, "Normal number with sign bit positive" }, + { 53, ZERO_N, "Zero with sign bit negative" }, + { 52, ZERO_P, "Zero with sign bit positive" } +}; + +#define TDC(insn, type, value, m) \ + ({ \ + int cc; \ + type r1 = value; \ + \ + __asm__ volatile(#insn " %[r1],0(%[mask])\n\t" \ + "ipm %[psw]\n\t" \ + "srl %[psw],28\n\t" \ + : [psw]"+d"(cc) \ + : [r1]"f"(r1), [mask]"a"(m) \ + : "cc"); \ + cc; \ + }) + +static void +do_tceb(float value) +{ + for (int i = 0; i < sizeof(whatsit) / sizeof(*whatsit); ++i) { + int ccv = TDC(tceb, float, value, whatsit[i].mask); + if (ccv == 1) + printf("value = %f\t\tcc = %d %s\n", value, ccv, + whatsit[i].str); + } +} + +static void +do_tcdb(double value) +{ + for (int i = 0; i < sizeof(whatsit) / sizeof(*whatsit); ++i) { + int ccv = TDC(tcdb, double, value, whatsit[i].mask); + if (ccv == 1) + printf("value = %f\t\tcc = %d %s\n", value, ccv, + whatsit[i].str); + } +} + +static void +do_tcxb(long double value) +{ + for (int i = 0; i < sizeof(whatsit) / sizeof(*whatsit); ++i) { + int ccv = TDC(tcxb, long double, value, whatsit[i].mask); + if (ccv == 1) + printf("value = %Lf\t\tcc = %d %s\n", value, ccv, + whatsit[i].str); + } +} + +int +main(void) +{ + assert(sizeof(long double) == 16); + + printf("32-bit tests\n"); + do_tceb(0.0f); + do_tceb(-0.0f); + do_tceb(3.0f); + do_tceb(-3.0f); + do_tceb(NAN); + do_tceb(-NAN); + do_tceb(INFINITY); + do_tceb(-INFINITY); + do_tceb(__builtin_nansf("")); + do_tceb(-__builtin_nansf("")); + do_tceb(FLT_MIN / 2); + do_tceb(-FLT_MIN / 2); + + printf("\n64-bit tests\n"); + do_tcdb(0.0); + do_tcdb(-0.0); + do_tcdb(3.0); + do_tcdb(-3.0); + do_tcdb(NAN); + do_tcdb(-NAN); + do_tcdb(INFINITY); + do_tcdb(-INFINITY); + do_tcdb(__builtin_nans("")); + do_tcdb(-__builtin_nans("")); + do_tcdb(DBL_MIN / 2); + do_tcdb(-DBL_MIN / 2); + + printf("\n128-bit tests\n"); + do_tcxb(0.0L); + do_tcxb(-0.0L); + do_tcxb(3.0L); + do_tcxb(-3.0L); + do_tcxb(NAN); + do_tcxb(-NAN); + do_tcxb(INFINITY); + do_tcxb(-INFINITY); + do_tcxb(__builtin_nansl("")); + do_tcxb(-__builtin_nansl("")); +#if 0 + /* Figuring out subnormal numbers for 128-bit BFP is left as + an exercise.. */ + do_tcdb(LDBL_MIN / 2); + do_tcdb(-LDBL_MIN / 2); +#endif + + return 0; +} diff --git a/none/tests/s390x/tcxb.stderr.exp b/none/tests/s390x/bfp-tdc.stderr.exp similarity index 100% rename from none/tests/s390x/tcxb.stderr.exp rename to none/tests/s390x/bfp-tdc.stderr.exp diff --git a/none/tests/s390x/bfp-tdc.stdout.exp b/none/tests/s390x/bfp-tdc.stdout.exp new file mode 100644 index 000000000..032287b59 --- /dev/null +++ b/none/tests/s390x/bfp-tdc.stdout.exp @@ -0,0 +1,39 @@ +32-bit tests +value = 0.000000 cc = 1 Zero with sign bit positive +value = -0.000000 cc = 1 Zero with sign bit negative +value = 3.000000 cc = 1 Normal number with sign bit positive +value = -3.000000 cc = 1 Normal number with sign bit negative +value = nan cc = 1 Quiet Nan with sign bit posative +value = -nan cc = 1 Quiet Nan with sign bit negative +value = inf cc = 1 Infinity with sign bit positive +value = -inf cc = 1 Infinity with sign bit negative +value = nan cc = 1 Signaling Nan with sign bit posative +value = -nan cc = 1 Signaling Nan with sign bit negative +value = -0.000000 cc = 1 Subnormal number with sign bit negative +value = -0.000000 cc = 1 Subnormal number with sign bit positive + +64-bit tests +value = 0.000000 cc = 1 Zero with sign bit positive +value = -0.000000 cc = 1 Zero with sign bit negative +value = 3.000000 cc = 1 Normal number with sign bit positive +value = -3.000000 cc = 1 Normal number with sign bit negative +value = nan cc = 1 Quiet Nan with sign bit posative +value = -nan cc = 1 Quiet Nan with sign bit negative +value = inf cc = 1 Infinity with sign bit positive +value = -inf cc = 1 Infinity with sign bit negative +value = nan cc = 1 Signaling Nan with sign bit posative +value = -nan cc = 1 Signaling Nan with sign bit negative +value = -0.000000 cc = 1 Subnormal number with sign bit negative +value = -0.000000 cc = 1 Subnormal number with sign bit positive + +128-bit tests +value = 0.000000 cc = 1 Zero with sign bit positive +value = -0.000000 cc = 1 Zero with sign bit negative +value = 3.000000 cc = 1 Normal number with sign bit positive +value = -3.000000 cc = 1 Normal number with sign bit negative +value = nan cc = 1 Quiet Nan with sign bit posative +value = -nan cc = 1 Quiet Nan with sign bit negative +value = inf cc = 1 Infinity with sign bit positive +value = -inf cc = 1 Infinity with sign bit negative +value = nan cc = 1 Signaling Nan with sign bit posative +value = -nan cc = 1 Signaling Nan with sign bit negative diff --git a/none/tests/s390x/bfp-tdc.vgtest b/none/tests/s390x/bfp-tdc.vgtest new file mode 100644 index 000000000..306de25ab --- /dev/null +++ b/none/tests/s390x/bfp-tdc.vgtest @@ -0,0 +1 @@ +prog: bfp-tdc diff --git a/none/tests/s390x/tcxb.c b/none/tests/s390x/tcxb.c deleted file mode 100644 index 4ff031f86..000000000 --- a/none/tests/s390x/tcxb.c +++ /dev/null @@ -1,95 +0,0 @@ -/* test data class tests for float, double, long double: TCEB, TCDB, TCXB */ -#include -#include - -static int tcxb(long double f, long long num) -{ - int match; - - asm volatile(" tcxb %1,0(%2)\n" - "ipm %0\n" - "srl %0,28\n" - : "=d" (match) - : "f" (f), "a" (num) - : "cc"); - return match; -} - -static int tcdb(double f, long long num) -{ - int match; - - asm volatile(" tcdb %1,0(%2)\n" - "ipm %0\n" - "srl %0,28\n" - : "=d" (match) - : "f" (f), "a" (num) - : "cc"); - return match; -} - -static int tceb(float f, long long num) -{ - int match; - - asm volatile(" tceb %1,0(%2)\n" - "ipm %0\n" - "srl %0,28\n" - : "=d" (match) - : "f" (f), "a" (num) - : "cc"); - return match; -} - -int main() -{ - int i; - - for (i = 0; i < 64; i++) { - if (sizeof (long double) == 16) { - /* long double 128 bit */ - printf("%d", tcxb(+0.0l, 1UL< Date: Mon, 22 Sep 2025 15:55:23 +0000 Subject: [PATCH 327/412] s390: Remove a few BFP testcases Namely: fgx, fixbr, rounding-4, and rounding-5 Those insn tests are covered by bfp-emit.pl Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 --- .gitignore | 7 +- none/tests/s390x/Makefile.am | 7 +- none/tests/s390x/fgx.c | 33 --------- none/tests/s390x/fgx.stderr.exp | 2 - none/tests/s390x/fgx.stdout.exp | 15 ---- none/tests/s390x/fgx.vgtest | 1 - none/tests/s390x/fixbr.c | 73 -------------------- none/tests/s390x/fixbr.stderr.exp | 2 - none/tests/s390x/fixbr.stdout.exp | 36 ---------- none/tests/s390x/fixbr.vgtest | 2 - none/tests/s390x/rounding-4.c | 95 -------------------------- none/tests/s390x/rounding-4.stderr.exp | 2 - none/tests/s390x/rounding-4.stdout.exp | 37 ---------- none/tests/s390x/rounding-4.vgtest | 1 - none/tests/s390x/rounding-5.c | 93 ------------------------- none/tests/s390x/rounding-5.stderr.exp | 2 - none/tests/s390x/rounding-5.stdout.exp | 54 --------------- none/tests/s390x/rounding-5.vgtest | 1 - 18 files changed, 5 insertions(+), 458 deletions(-) delete mode 100644 none/tests/s390x/fgx.c delete mode 100644 none/tests/s390x/fgx.stderr.exp delete mode 100644 none/tests/s390x/fgx.stdout.exp delete mode 100644 none/tests/s390x/fgx.vgtest delete mode 100644 none/tests/s390x/fixbr.c delete mode 100644 none/tests/s390x/fixbr.stderr.exp delete mode 100644 none/tests/s390x/fixbr.stdout.exp delete mode 100644 none/tests/s390x/fixbr.vgtest delete mode 100644 none/tests/s390x/rounding-4.c delete mode 100644 none/tests/s390x/rounding-4.stderr.exp delete mode 100644 none/tests/s390x/rounding-4.stdout.exp delete mode 100644 none/tests/s390x/rounding-4.vgtest delete mode 100644 none/tests/s390x/rounding-5.c delete mode 100644 none/tests/s390x/rounding-5.stderr.exp delete mode 100644 none/tests/s390x/rounding-5.stdout.exp delete mode 100644 none/tests/s390x/rounding-5.vgtest diff --git a/.gitignore b/.gitignore index a5e97008b..6cf083afe 100644 --- a/.gitignore +++ b/.gitignore @@ -2136,7 +2136,8 @@ /none/tests/s390x/sub /none/tests/s390x/sub-z14 /none/tests/s390x/sub_EI -/none/tests/s390x/tcxb +/none/tests/s390x/bfp-tdc +/none/tests/s390x/hfp /none/tests/s390x/xc /none/tests/s390x/xor /none/tests/s390x/xor_EI @@ -2144,7 +2145,6 @@ /none/tests/s390x/stcke /none/tests/s390x/stckf /none/tests/s390x/op_exception -/none/tests/s390x/fgx /none/tests/s390x/condloadstore /none/tests/s390x/fold_And16 /none/tests/s390x/stfle @@ -2187,8 +2187,6 @@ /none/tests/s390x/rounding-1 /none/tests/s390x/rounding-2 /none/tests/s390x/rounding-3 -/none/tests/s390x/rounding-4 -/none/tests/s390x/rounding-5 /none/tests/s390x/bfp-1 /none/tests/s390x/bfp-2 /none/tests/s390x/bfp-3 @@ -2231,7 +2229,6 @@ /none/tests/s390x/srnmt /none/tests/s390x/pfpo /none/tests/s390x/rxsbg -/none/tests/s390x/fixbr /none/tests/s390x/popcnt /none/tests/s390x/vector /none/tests/s390x/lsc2 diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 57dbb55db..8a373c4c8 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -5,11 +5,11 @@ dist_noinst_SCRIPTS = filter_stderr bfp-emit.pl INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ and or xor insert div srst fold_And16 flogr sub_EI add_EI \ and_EI or_EI xor_EI insert_EI mul_GE add_GE condloadstore \ - op_exception fgx stck stckf stcke stfle cksm mvcl clcl troo \ + op_exception stck stckf stcke stfle cksm mvcl clcl troo \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ - bfp-tdc rounding-1 rounding-2 rounding-3 rounding-4 rounding-5 bfp-1 \ + bfp-tdc rounding-1 rounding-2 rounding-3 bfp-1 \ bfp-2 bfp-3 bfp-4 srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ @@ -22,7 +22,7 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ vector_float add-z14 sub-z14 mul-z14 bic \ misc3 vec2 vec2_float \ dfp-1 dfp-2 dfp-3 dfp-4 dfpconv dfpext dfptest pfpo srnmt \ - fpext fixbr hfp + fpext hfp check_PROGRAMS = $(INSN_TESTS) \ allexec \ @@ -39,7 +39,6 @@ EXTRA_DIST = \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ ecag.stdout.exp-z16 \ op00.stderr.exp op00.vgtest \ - fixbr.vgtest fixbr.stderr.exp fixbr.stdout.exp \ fpext.vgtest fpext.stderr.exp fpext.stdout.exp \ fpext_fail.vgtest fpext_fail.stderr.exp fpext_fail.stdout.exp \ test.h opcodes.h add.h and.h div.h insert.h dfp_utils.h \ diff --git a/none/tests/s390x/fgx.c b/none/tests/s390x/fgx.c deleted file mode 100644 index 6c7905395..000000000 --- a/none/tests/s390x/fgx.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#include "opcodes.h" - -int main() -{ - register long g asm("r7"); - register double f asm("f8"); - double f1; - - memset(&f1, 0x0f, sizeof(double)); - f = f1; - g = 42; - printf("test LGDR\n\n"); - printf("before g = %ld\n", g); - printf("before f = %a\n", f); - printf("copy f to g\n"); - asm volatile ( LGDR(7,8) : "=d"(g) : "f"(f)); - printf("after g = %16.16lx\n", g); /* 0x0x0x0...... */ - printf("after f = %a\n", f); - - printf("\ntest LDGR\n\n"); - f = 3.14; - printf("before g = %16.16lx\n", g); /* 0x0x0x0...... */ - printf("before f = %a\n", f); - printf("copy g to f\n"); - asm volatile ( LDGR(8,7) : "=f"(f) : "d"(g)); - printf("after g = %16.16lx\n", g); /* 0x0x0x0...... */ - printf("after f = %a\n", f); - - return 0; -} - diff --git a/none/tests/s390x/fgx.stderr.exp b/none/tests/s390x/fgx.stderr.exp deleted file mode 100644 index 139597f9c..000000000 --- a/none/tests/s390x/fgx.stderr.exp +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/fgx.stdout.exp b/none/tests/s390x/fgx.stdout.exp deleted file mode 100644 index 242ff5ed8..000000000 --- a/none/tests/s390x/fgx.stdout.exp +++ /dev/null @@ -1,15 +0,0 @@ -test LGDR - -before g = 42 -before f = 0x1.f0f0f0f0f0f0fp-783 -copy f to g -after g = 0f0f0f0f0f0f0f0f -after f = 0x1.f0f0f0f0f0f0fp-783 - -test LDGR - -before g = 0f0f0f0f0f0f0f0f -before f = 0x1.91eb851eb851fp+1 -copy g to f -after g = 0f0f0f0f0f0f0f0f -after f = 0x1.f0f0f0f0f0f0fp-783 diff --git a/none/tests/s390x/fgx.vgtest b/none/tests/s390x/fgx.vgtest deleted file mode 100644 index 7bd7dac43..000000000 --- a/none/tests/s390x/fgx.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: fgx diff --git a/none/tests/s390x/fixbr.c b/none/tests/s390x/fixbr.c deleted file mode 100644 index ba99210b5..000000000 --- a/none/tests/s390x/fixbr.c +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include -#include -#include -#include -#include "opcodes.h" -#include "rounding.h" - -/* Test "fixbr" with rounding mode given in insn (m3 field) - Covers all generally available rounding modes that can be mapped to - IRRoundingMode. As a consequence m3=1 which is "round to nearest with - ties away from 0" is not tested here. -*/ - -const char * -rtext(unsigned m3_round) -{ - switch (m3_round) { - case 0: return "[-> per fpc]"; - case 1: return "[-> nearest away]"; - case 3: return "[-> prepare short]"; // floating point extension fac needed - case 4: return "[-> nearest even]"; - case 5: return "[-> 0]"; - case 6: return "[-> +inf]"; - case 7: return "[-> -inf]"; - } - assert(0); -} - -#define round_to_int(value,round) \ -do { \ - long double src = value; \ - long double dst; \ - \ - __asm__ volatile ("fixbr %[dst]," #round ",%[src]\n\t" \ - : [dst] "=f"(dst) \ - : [src] "f"(src)); \ - \ - printf("fixbr %.5Lf\t-> %Lg %s\n", \ - src, dst, rtext(round)); \ -} while (0) - -#define fixbr(value,round) round_to_int(value,round) - -void -set_rounding_mode(unsigned mode) -{ - register unsigned r asm("1") = mode; - __asm__ volatile ( SFPC(1) : : "d"(r) ); -} - - -int main(void) -{ - int j; - static const long double dval[] = { - 1.25, 1.5, 2.5, 1.75, -1.25, -1.5, -2.5, -1.75, 0.0, - }; - - assert(sizeof(long double) == 16); - - /* f128 -> f128, round to int */ - for (j = 0; j < sizeof dval / sizeof dval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - fixbr(dval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - fixbr(dval[j], M3_BFP_ROUND_ZERO); - fixbr(dval[j], M3_BFP_ROUND_POSINF); - fixbr(dval[j], M3_BFP_ROUND_NEGINF); - } - - return 0; -} diff --git a/none/tests/s390x/fixbr.stderr.exp b/none/tests/s390x/fixbr.stderr.exp deleted file mode 100644 index 139597f9c..000000000 --- a/none/tests/s390x/fixbr.stderr.exp +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/fixbr.stdout.exp b/none/tests/s390x/fixbr.stdout.exp deleted file mode 100644 index 787c0d8d2..000000000 --- a/none/tests/s390x/fixbr.stdout.exp +++ /dev/null @@ -1,36 +0,0 @@ -fixbr 1.25000 -> 1 [-> nearest even] -fixbr 1.25000 -> 1 [-> 0] -fixbr 1.25000 -> 2 [-> +inf] -fixbr 1.25000 -> 1 [-> -inf] -fixbr 1.50000 -> 2 [-> nearest even] -fixbr 1.50000 -> 1 [-> 0] -fixbr 1.50000 -> 2 [-> +inf] -fixbr 1.50000 -> 1 [-> -inf] -fixbr 2.50000 -> 2 [-> nearest even] -fixbr 2.50000 -> 2 [-> 0] -fixbr 2.50000 -> 3 [-> +inf] -fixbr 2.50000 -> 2 [-> -inf] -fixbr 1.75000 -> 2 [-> nearest even] -fixbr 1.75000 -> 1 [-> 0] -fixbr 1.75000 -> 2 [-> +inf] -fixbr 1.75000 -> 1 [-> -inf] -fixbr -1.25000 -> -1 [-> nearest even] -fixbr -1.25000 -> -1 [-> 0] -fixbr -1.25000 -> -1 [-> +inf] -fixbr -1.25000 -> -2 [-> -inf] -fixbr -1.50000 -> -2 [-> nearest even] -fixbr -1.50000 -> -1 [-> 0] -fixbr -1.50000 -> -1 [-> +inf] -fixbr -1.50000 -> -2 [-> -inf] -fixbr -2.50000 -> -2 [-> nearest even] -fixbr -2.50000 -> -2 [-> 0] -fixbr -2.50000 -> -2 [-> +inf] -fixbr -2.50000 -> -3 [-> -inf] -fixbr -1.75000 -> -2 [-> nearest even] -fixbr -1.75000 -> -1 [-> 0] -fixbr -1.75000 -> -1 [-> +inf] -fixbr -1.75000 -> -2 [-> -inf] -fixbr 0.00000 -> 0 [-> nearest even] -fixbr 0.00000 -> 0 [-> 0] -fixbr 0.00000 -> 0 [-> +inf] -fixbr 0.00000 -> 0 [-> -inf] diff --git a/none/tests/s390x/fixbr.vgtest b/none/tests/s390x/fixbr.vgtest deleted file mode 100644 index 22eb7afab..000000000 --- a/none/tests/s390x/fixbr.vgtest +++ /dev/null @@ -1,2 +0,0 @@ -prog: fixbr -prereq: test -e fixbr && ../../../tests/s390x_features s390x-fpext diff --git a/none/tests/s390x/rounding-4.c b/none/tests/s390x/rounding-4.c deleted file mode 100644 index a4a0e9603..000000000 --- a/none/tests/s390x/rounding-4.c +++ /dev/null @@ -1,95 +0,0 @@ -#include -#include -#include "opcodes.h" - -/* Test "load rounded" with universally available rounding modes. - Rounding mode is provided via FPC. - Also test "load lengthened" (which is independent of rounding modes). */ - -volatile double d; -volatile float f; - -const char * -rtext(unsigned fpc_round) -{ - switch (fpc_round) { - case 0: return "[-> near]"; - case 1: return "[-> zero]"; - case 2: return "[-> +inf]"; - case 3: return "[-> -inf]"; - } - assert(0); -} - -void -set_rounding_mode(unsigned mode) -{ - printf("setting FPC rounding mode to %s\n", rtext(mode)); - register unsigned r asm("1") = mode; - __asm__ volatile ( SFPC(1) : : "d"(r) ); -} - - -void -load_rounded(void) -{ - f = d; - printf("load rounded d = %10.3f f = %10.3f\n", d, f); -} - -void -load_lengthened(void) -{ - d = f; - printf("load lengthened d = %22.20g f = %22.20g\n", d, f); -} - -/* Tests for load rounded and load lengthened */ -int main() -{ - d = 12345678.25; - set_rounding_mode(0); - load_rounded(); - set_rounding_mode(1); - load_rounded(); - set_rounding_mode(2); - load_rounded(); - set_rounding_mode(3); - load_rounded(); - printf("======================================\n"); - d = 12345678.75; - set_rounding_mode(0); - load_rounded(); - set_rounding_mode(1); - load_rounded(); - set_rounding_mode(2); - load_rounded(); - set_rounding_mode(3); - load_rounded(); - printf("======================================\n"); - d = -12345678.25; - set_rounding_mode(0); - load_rounded(); - set_rounding_mode(1); - load_rounded(); - set_rounding_mode(2); - load_rounded(); - set_rounding_mode(3); - load_rounded(); - printf("======================================\n"); - d = -12345678.75; - set_rounding_mode(0); - load_rounded(); - set_rounding_mode(1); - load_rounded(); - set_rounding_mode(2); - load_rounded(); - set_rounding_mode(3); - load_rounded(); - printf("\n"); - - f = 1234.5678f; - load_lengthened(); - - return 0; -} diff --git a/none/tests/s390x/rounding-4.stderr.exp b/none/tests/s390x/rounding-4.stderr.exp deleted file mode 100644 index 139597f9c..000000000 --- a/none/tests/s390x/rounding-4.stderr.exp +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/rounding-4.stdout.exp b/none/tests/s390x/rounding-4.stdout.exp deleted file mode 100644 index e0b58fb92..000000000 --- a/none/tests/s390x/rounding-4.stdout.exp +++ /dev/null @@ -1,37 +0,0 @@ -setting FPC rounding mode to [-> near] -load rounded d = 12345678.250 f = 12345678.000 -setting FPC rounding mode to [-> zero] -load rounded d = 12345678.250 f = 12345678.000 -setting FPC rounding mode to [-> +inf] -load rounded d = 12345678.250 f = 12345679.000 -setting FPC rounding mode to [-> -inf] -load rounded d = 12345678.250 f = 12345678.000 -====================================== -setting FPC rounding mode to [-> near] -load rounded d = 12345678.750 f = 12345679.000 -setting FPC rounding mode to [-> zero] -load rounded d = 12345678.750 f = 12345678.000 -setting FPC rounding mode to [-> +inf] -load rounded d = 12345678.750 f = 12345679.000 -setting FPC rounding mode to [-> -inf] -load rounded d = 12345678.750 f = 12345678.000 -====================================== -setting FPC rounding mode to [-> near] -load rounded d = -12345678.250 f = -12345678.000 -setting FPC rounding mode to [-> zero] -load rounded d = -12345678.250 f = -12345678.000 -setting FPC rounding mode to [-> +inf] -load rounded d = -12345678.250 f = -12345678.000 -setting FPC rounding mode to [-> -inf] -load rounded d = -12345678.250 f = -12345679.000 -====================================== -setting FPC rounding mode to [-> near] -load rounded d = -12345678.750 f = -12345679.000 -setting FPC rounding mode to [-> zero] -load rounded d = -12345678.750 f = -12345678.000 -setting FPC rounding mode to [-> +inf] -load rounded d = -12345678.750 f = -12345678.000 -setting FPC rounding mode to [-> -inf] -load rounded d = -12345678.750 f = -12345679.000 - -load lengthened d = 1234.5677490234375 f = 1234.5677490234375 diff --git a/none/tests/s390x/rounding-4.vgtest b/none/tests/s390x/rounding-4.vgtest deleted file mode 100644 index e264b57a7..000000000 --- a/none/tests/s390x/rounding-4.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: rounding-4 diff --git a/none/tests/s390x/rounding-5.c b/none/tests/s390x/rounding-5.c deleted file mode 100644 index e1eab408e..000000000 --- a/none/tests/s390x/rounding-5.c +++ /dev/null @@ -1,93 +0,0 @@ -#include -#include -#include -#include -#include "opcodes.h" - -/* Test "convert from fixed" with universally available rounding modes. - Rounding mode is provided via FPC. */ - -volatile int32_t i32; -volatile int64_t i64; - -const char * -rtext(unsigned fpc_round) -{ - switch (fpc_round) { - case 0: return "[-> near]"; - case 1: return "[-> zero]"; - case 2: return "[-> +inf]"; - case 3: return "[-> -inf]"; - } - assert(0); -} - -void -set_rounding_mode(unsigned mode) -{ - printf("setting FPC rounding mode to %s\n", rtext(mode)); - register unsigned r asm("1") = mode; - __asm__ volatile ( SFPC(1) : : "d"(r) ); -} - -void cefbr(unsigned mode) -{ - set_rounding_mode(mode); - - float out; - - __asm__ volatile("cefbr %[r1],%[r2]" : [r1] "=f"(out) : [r2] "d"(i32)); - printf("cefbr: %"PRId32" -> %f\n", i32, out); -} - -void cegbr(unsigned mode) -{ - set_rounding_mode(mode); - - float out; - - __asm__ volatile("cegbr %[r1],%[r2]" : [r1] "=f"(out) : [r2] "d"(i64)); - printf("cegbr: %"PRId64" -> %f\n", i64, out); -} - -void cdgbr(unsigned mode) -{ - set_rounding_mode(mode); - - double out; - - __asm__ volatile("cdgbr %[r1],%[r2]" : [r1] "=f"(out) : [r2] "d"(i64)); - printf("cegbr: %"PRId64" -> %f\n", i64, out); -} - - -int main() -{ - int mode; - - /* i32 -> f32 */ - i32 = INT32_MAX; - for (mode = 0; mode <= 3; ++mode) cefbr(mode); - printf("\n"); - i32 = INT32_MIN; - for (mode = 0; mode <= 3; ++mode) cefbr(mode); - printf("\n"); - - /* i64 -> f32 */ - i64 = INT64_MAX; - for (mode = 0; mode <= 3; ++mode) cegbr(mode); - printf("\n"); - i64 = INT64_MIN; - for (mode = 0; mode <= 3; ++mode) cegbr(mode); - printf("\n"); - - /* i64 -> f64 */ - i64 = INT64_MAX; - for (mode = 0; mode <= 3; ++mode) cdgbr(mode); - printf("\n"); - i64 = INT64_MIN; - for (mode = 0; mode <= 3; ++mode) cdgbr(mode); - printf("\n"); - - return 0; -} diff --git a/none/tests/s390x/rounding-5.stderr.exp b/none/tests/s390x/rounding-5.stderr.exp deleted file mode 100644 index 139597f9c..000000000 --- a/none/tests/s390x/rounding-5.stderr.exp +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/rounding-5.stdout.exp b/none/tests/s390x/rounding-5.stdout.exp deleted file mode 100644 index 80e55f67d..000000000 --- a/none/tests/s390x/rounding-5.stdout.exp +++ /dev/null @@ -1,54 +0,0 @@ -setting FPC rounding mode to [-> near] -cefbr: 2147483647 -> 2147483648.000000 -setting FPC rounding mode to [-> zero] -cefbr: 2147483647 -> 2147483520.000000 -setting FPC rounding mode to [-> +inf] -cefbr: 2147483647 -> 2147483648.000000 -setting FPC rounding mode to [-> -inf] -cefbr: 2147483647 -> 2147483520.000000 - -setting FPC rounding mode to [-> near] -cefbr: -2147483648 -> -2147483648.000000 -setting FPC rounding mode to [-> zero] -cefbr: -2147483648 -> -2147483648.000000 -setting FPC rounding mode to [-> +inf] -cefbr: -2147483648 -> -2147483648.000000 -setting FPC rounding mode to [-> -inf] -cefbr: -2147483648 -> -2147483648.000000 - -setting FPC rounding mode to [-> near] -cegbr: 9223372036854775807 -> 9223372036854775808.000000 -setting FPC rounding mode to [-> zero] -cegbr: 9223372036854775807 -> 9223371487098961920.000000 -setting FPC rounding mode to [-> +inf] -cegbr: 9223372036854775807 -> 9223372036854775808.000000 -setting FPC rounding mode to [-> -inf] -cegbr: 9223372036854775807 -> 9223371487098961920.000000 - -setting FPC rounding mode to [-> near] -cegbr: -9223372036854775808 -> -9223372036854775808.000000 -setting FPC rounding mode to [-> zero] -cegbr: -9223372036854775808 -> -9223372036854775808.000000 -setting FPC rounding mode to [-> +inf] -cegbr: -9223372036854775808 -> -9223372036854775808.000000 -setting FPC rounding mode to [-> -inf] -cegbr: -9223372036854775808 -> -9223372036854775808.000000 - -setting FPC rounding mode to [-> near] -cegbr: 9223372036854775807 -> 9223372036854775808.000000 -setting FPC rounding mode to [-> zero] -cegbr: 9223372036854775807 -> 9223372036854774784.000000 -setting FPC rounding mode to [-> +inf] -cegbr: 9223372036854775807 -> 9223372036854775808.000000 -setting FPC rounding mode to [-> -inf] -cegbr: 9223372036854775807 -> 9223372036854774784.000000 - -setting FPC rounding mode to [-> near] -cegbr: -9223372036854775808 -> -9223372036854775808.000000 -setting FPC rounding mode to [-> zero] -cegbr: -9223372036854775808 -> -9223372036854775808.000000 -setting FPC rounding mode to [-> +inf] -cegbr: -9223372036854775808 -> -9223372036854775808.000000 -setting FPC rounding mode to [-> -inf] -cegbr: -9223372036854775808 -> -9223372036854775808.000000 - diff --git a/none/tests/s390x/rounding-5.vgtest b/none/tests/s390x/rounding-5.vgtest deleted file mode 100644 index 51f302173..000000000 --- a/none/tests/s390x/rounding-5.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: rounding-5 From 0c0e1a0b0a77a399ff220b60c3d46dc779dd9d09 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 22 Sep 2025 19:49:52 +0200 Subject: [PATCH 328/412] DRD suppression: broaden drd-glibc-io-xsputn-mempcpy Add wildcards to cover variations of mem[p]cpy. This is now the same as Helgrind. --- glibc-2.X-drd.supp.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glibc-2.X-drd.supp.in b/glibc-2.X-drd.supp.in index a75b4421f..419ff2256 100644 --- a/glibc-2.X-drd.supp.in +++ b/glibc-2.X-drd.supp.in @@ -40,7 +40,7 @@ { drd-glibc-io-xsputn-mempcpy drd:ConflictingAccess - fun:__GI_mempcpy + fun:*mem*cpy fun:_IO_*xsputn* obj:@GLIBC_LIBC_PATH@ } From d0bfd2556ce498cb091299249cb6804cbff57e81 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 22 Sep 2025 20:21:57 +0200 Subject: [PATCH 329/412] FreeBSD regtest: add an x86 version of scalar_arg_check --- .gitignore | 1 + memcheck/tests/x86-freebsd/Makefile.am | 8 +++++--- memcheck/tests/x86-freebsd/filter_arg_check | 20 +++++++++++++++++++ memcheck/tests/x86-freebsd/scalar_arg_check.c | 8 ++++++++ .../x86-freebsd/scalar_arg_check.stderr.exp | 1 + .../tests/x86-freebsd/scalar_arg_check.vgtest | 1 + 6 files changed, 36 insertions(+), 3 deletions(-) create mode 100755 memcheck/tests/x86-freebsd/filter_arg_check create mode 100644 memcheck/tests/x86-freebsd/scalar_arg_check.c create mode 100644 memcheck/tests/x86-freebsd/scalar_arg_check.stderr.exp create mode 120000 memcheck/tests/x86-freebsd/scalar_arg_check.vgtest diff --git a/.gitignore b/.gitignore index 6cf083afe..00233d852 100644 --- a/.gitignore +++ b/.gitignore @@ -1505,6 +1505,7 @@ /memcheck/tests/x86-freebsd/posix_fadvise /memcheck/tests/x86-freebsd/posix_fallocate /memcheck/tests/x86-freebsd/reallocarray +/memcheck/tests/x86-freebsd/scalar_arg_check # /memcheck/tests/arm64-freebsd /memcheck/tests/arm64-freebsd/*.stderr.diff diff --git a/memcheck/tests/x86-freebsd/Makefile.am b/memcheck/tests/x86-freebsd/Makefile.am index 1d8069021..8c48506c2 100644 --- a/memcheck/tests/x86-freebsd/Makefile.am +++ b/memcheck/tests/x86-freebsd/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/Makefile.tool-tests.am -dist_noinst_SCRIPTS = filter_stderr +dist_noinst_SCRIPTS = filter_stderr filter_arg_check EXTRA_DIST = \ posix_fadvise.vgtest \ @@ -9,10 +9,12 @@ EXTRA_DIST = \ posix_fadvise.stderr.exp \ posix_fallocate.stderr.exp \ reallocarray.vgtest \ - reallocarray.stderr.exp + reallocarray.stderr.exp \ + scalar_arg_check.vgtest \ + scalar_arg_check.stderr.exp check_PROGRAMS = \ - posix_fadvise posix_fallocate reallocarray + posix_fadvise posix_fallocate reallocarray scalar_arg_check # Linux also adds $(FLAG_MMMX) $(FLAG_MSSE) to the first two AM_CFLAGS += @FLAG_M32@ diff --git a/memcheck/tests/x86-freebsd/filter_arg_check b/memcheck/tests/x86-freebsd/filter_arg_check new file mode 100755 index 000000000..302dea2df --- /dev/null +++ b/memcheck/tests/x86-freebsd/filter_arg_check @@ -0,0 +1,20 @@ +#! /bin/sh + +# Only one test uses this which calls syscall(SYS_sendfile) +# which is the only x86 syscall that uses 8 arguments +# The output includes --trace-syscalls=yes which is very verbose +# but we only want to see the sendfile line + +# the libc signature for sendfile is +# int sendfile(int fd, int s, off_t offset, size_t nbytes, +# struct sf_hdtr *hdtr, off_t *sbytes, int flags); +# The testcase uses values from 101 to 108 for the arguments +# (to make it easy to match the testcase to the log output) +# Some of the arguments are printed as hex, not too bad. +# Argument 3 is a 64bit value made up from the 32bit arguments +# 3 and 4 resulting in 7 values in the expected. + +grep "SYSCALL.*sendfile" | +sed 's/==.*//' | +sed -E 's/\[[0-9]{5}/[xxxxx/' + diff --git a/memcheck/tests/x86-freebsd/scalar_arg_check.c b/memcheck/tests/x86-freebsd/scalar_arg_check.c new file mode 100644 index 000000000..c608150f2 --- /dev/null +++ b/memcheck/tests/x86-freebsd/scalar_arg_check.c @@ -0,0 +1,8 @@ +#include "../freebsd/scalar.h" + +int main(void) +{ + /* sendfile uses 8 args */ + SY(SYS_sendfile, 101, 102, 103, 104, 105, 106, 107, 108); +} + diff --git a/memcheck/tests/x86-freebsd/scalar_arg_check.stderr.exp b/memcheck/tests/x86-freebsd/scalar_arg_check.stderr.exp new file mode 100644 index 000000000..354d16821 --- /dev/null +++ b/memcheck/tests/x86-freebsd/scalar_arg_check.stderr.exp @@ -0,0 +1 @@ +SYSCALL[xxxxx,1](393) sys_sendfile ( 101, 102, 446676598887, 105, 0x6a, 0x6b, 108 ) diff --git a/memcheck/tests/x86-freebsd/scalar_arg_check.vgtest b/memcheck/tests/x86-freebsd/scalar_arg_check.vgtest new file mode 120000 index 000000000..5b2d7ffaf --- /dev/null +++ b/memcheck/tests/x86-freebsd/scalar_arg_check.vgtest @@ -0,0 +1 @@ +../amd64-freebsd/scalar_arg_check.vgtest \ No newline at end of file From 7d9005f4912fa02eb48dcf578f40c035d8cc851b Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 22 Sep 2025 19:31:50 +0000 Subject: [PATCH 330/412] s390: BFP testsuite tweaks Remove square root tests as they are covered by bfp-emit.pl Likewise for multiplication. Add tests for division. New file bfp-arith.c: Check condition code of arithmetic ops. Remove bfp-1.c Part of https://bugs.kde.org/show_bug.cgi?id=509572 --- .gitignore | 2 +- none/tests/s390x/Makefile.am | 2 +- none/tests/s390x/bfp-1.c | 93 ----------------- none/tests/s390x/bfp-1.stdout.exp | 10 -- none/tests/s390x/bfp-1.vgtest | 1 - none/tests/s390x/bfp-2.c | 21 ---- none/tests/s390x/bfp-2.stdout.exp | 2 - none/tests/s390x/bfp-3.c | 41 +++++++- none/tests/s390x/bfp-3.stdout.exp | 3 + none/tests/s390x/bfp-arith.c | 99 +++++++++++++++++++ ...{bfp-1.stderr.exp => bfp-arith.stderr.exp} | 0 none/tests/s390x/bfp-arith.stdout.exp | 30 ++++++ none/tests/s390x/bfp-arith.vgtest | 1 + 13 files changed, 175 insertions(+), 130 deletions(-) delete mode 100644 none/tests/s390x/bfp-1.c delete mode 100644 none/tests/s390x/bfp-1.stdout.exp delete mode 100644 none/tests/s390x/bfp-1.vgtest create mode 100644 none/tests/s390x/bfp-arith.c rename none/tests/s390x/{bfp-1.stderr.exp => bfp-arith.stderr.exp} (100%) create mode 100644 none/tests/s390x/bfp-arith.stdout.exp create mode 100644 none/tests/s390x/bfp-arith.vgtest diff --git a/.gitignore b/.gitignore index 00233d852..fb3c9cc43 100644 --- a/.gitignore +++ b/.gitignore @@ -2188,7 +2188,7 @@ /none/tests/s390x/rounding-1 /none/tests/s390x/rounding-2 /none/tests/s390x/rounding-3 -/none/tests/s390x/bfp-1 +/none/tests/s390x/bfp-arith /none/tests/s390x/bfp-2 /none/tests/s390x/bfp-3 /none/tests/s390x/bfp-4 diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 8a373c4c8..234ed656e 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -9,7 +9,7 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ - bfp-tdc rounding-1 rounding-2 rounding-3 bfp-1 \ + bfp-tdc rounding-1 rounding-2 rounding-3 bfp-arith \ bfp-2 bfp-3 bfp-4 srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ diff --git a/none/tests/s390x/bfp-1.c b/none/tests/s390x/bfp-1.c deleted file mode 100644 index 2cf558e24..000000000 --- a/none/tests/s390x/bfp-1.c +++ /dev/null @@ -1,93 +0,0 @@ -#include - -/* Simple test to see that basic operators are mapped - correctly. Uses default rounding mode. */ - -volatile double d1, d2; -volatile float f1, f2; - -void fadd8(void) -{ - printf("%f + %f = %f\n", d1, d2, d1 + d2); -} - -void fsub8(void) -{ - printf("%f - %f = %f\n", d1, d2, d1 - d2); -} - -void fmul8(void) -{ - printf("%f * %f = %f\n", d1, d2, d1 * d2); -} - -void fdiv8(void) -{ - printf("%f / %f = %f\n", d1, d2, d1 / d2); -} - -void fadd4(void) -{ - register float r1 asm("f1") = f1; - register float r2 asm("f2") = f2; - - __asm__ volatile ("aebr %[r1],%[r2]\n\t" - : [r1] "+f"(r1) - : [r2] "f"(r2) : "cc"); - printf("%f + %f = %f\n", f1, f2, r1); -} - -void fsub4(void) -{ - register float r1 asm("f1") = f1; - register float r2 asm("f2") = f2; - - __asm__ volatile ("sebr %[r1],%[r2]\n\t" - : [r1] "+f"(r1) - : [r2] "f"(r2) : "cc"); - printf("%f - %f = %f\n", f1, f2, r1); -} - -void fmul4(void) -{ - register float r1 asm("f1") = f1; - register float r2 asm("f2") = f2; - - __asm__ volatile ("meebr %[r1],%[r2]\n\t" - : [r1] "+f"(r1) - : [r2] "f"(r2) : "cc"); - printf("%f * %f = %f\n", f1, f2, r1); -} - -void fdiv4(void) -{ - register float r1 asm("f1") = f1; - register float r2 asm("f2") = f2; - - __asm__ volatile ("debr %[r1],%[r2]\n\t" - : [r1] "+f"(r1) - : [r2] "f"(r2) : "cc"); - printf("%f / %f = %f\n", f1, f2, r1); -} - - -int main() -{ - printf("double arithmetic\n"); - d1 = 10.5; - d2 = 1.25; - fadd8(); - fsub8(); - fmul8(); - fdiv8(); - - printf("float arithmetic\n"); - f1 = 10.5f; - f2 = 1.25f; - fadd4(); - fsub4(); - fmul4(); - fdiv4(); - - return 0; -} diff --git a/none/tests/s390x/bfp-1.stdout.exp b/none/tests/s390x/bfp-1.stdout.exp deleted file mode 100644 index 023c59864..000000000 --- a/none/tests/s390x/bfp-1.stdout.exp +++ /dev/null @@ -1,10 +0,0 @@ -double arithmetic -10.500000 + 1.250000 = 11.750000 -10.500000 - 1.250000 = 9.250000 -10.500000 * 1.250000 = 13.125000 -10.500000 / 1.250000 = 8.400000 -float arithmetic -10.500000 + 1.250000 = 11.750000 -10.500000 - 1.250000 = 9.250000 -10.500000 * 1.250000 = 13.125000 -10.500000 / 1.250000 = 8.400000 diff --git a/none/tests/s390x/bfp-1.vgtest b/none/tests/s390x/bfp-1.vgtest deleted file mode 100644 index 9d67c4abb..000000000 --- a/none/tests/s390x/bfp-1.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: bfp-1 diff --git a/none/tests/s390x/bfp-2.c b/none/tests/s390x/bfp-2.c index b8109ba88..7fbc2cbf3 100644 --- a/none/tests/s390x/bfp-2.c +++ b/none/tests/s390x/bfp-2.c @@ -1,28 +1,11 @@ #include /* Test various BFP ops: - - square root - load negative - load positive - load complement */ -void sqebr(float in) -{ - float out; - - __asm__ volatile("sqebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in)); - printf("sqebr %f -> %f\n", in, out); -} - -void sqdbr(double in) -{ - double out; - - __asm__ volatile("sqdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in)); - printf("sqdbr %f -> %f\n", in, out); -} - void lnebr(float in) { float out; @@ -73,10 +56,6 @@ void lcdbr(double in) int main(void) { - // square root - sqebr(121.0f); // 4 byte values - sqdbr(144.0); // 8 bytes values - // load negative lnebr(-2.5f); // 4 byte values lnebr(12.5f); // 4 byte values diff --git a/none/tests/s390x/bfp-2.stdout.exp b/none/tests/s390x/bfp-2.stdout.exp index 074180a27..d2bc54136 100644 --- a/none/tests/s390x/bfp-2.stdout.exp +++ b/none/tests/s390x/bfp-2.stdout.exp @@ -1,5 +1,3 @@ -sqebr 121.000000 -> 11.000000 -sqdbr 144.000000 -> 12.000000 lnebr -2.500000 -> -2.500000 lnebr 12.500000 -> -12.500000 lndbr -0.500000 -> -0.500000 diff --git a/none/tests/s390x/bfp-3.c b/none/tests/s390x/bfp-3.c index 857e1c83f..d7d66f263 100644 --- a/none/tests/s390x/bfp-3.c +++ b/none/tests/s390x/bfp-3.c @@ -1,7 +1,9 @@ #include +#include /* Test BFP multiply and add/sub 32/64-bit. There are no such insns - working with 128-bit data */ + working with 128-bit data. + Also test division making sure operand order is preserved. */ void maebr(float v1, float v2, float v3) { @@ -39,8 +41,40 @@ void msdbr(double v1, double v2, double v3) printf("msdbr %f * %f - %f -> %f\n", v2, v3, v1, r1); } +static void debr(float v1, float v2) +{ + float r1 = v1; + + __asm__ volatile("debr %[r1],%[r2]" + : [r1]"+f"(v1) + : [r2]"f"(v2)); + printf("debr %f / %f -> %f\n", r1, v2, v1); +} + +static void ddbr(double v1, double v2) +{ + double r1 = v1; + + __asm__ volatile("ddbr %[r1],%[r2]" + : [r1]"+f"(v1) + : [r2]"f"(v2)); + printf("ddbr %f / %f -> %f\n", r1, v2, v1); +} + +static void dxbr(long double v1, long double v2) +{ + long double r1 = v1; + + __asm__ volatile("dxbr %[r1],%[r2]" + : [r1]"+f"(v1) + : [r2]"f"(v2)); + printf("dxbr %Lf / %Lf -> %Lf\n", r1, v2, v1); +} + int main(void) { + assert(sizeof(long double) == 16); + // multiply and add maebr(10.5f, 20.25, 3.0); // 4 byte values madbr(-10.5, 42.75, -2.0); // 8 byte values @@ -49,5 +83,10 @@ int main(void) msebr(10.5f, 20.25, 3.0); // 4 byte values msdbr(-10.5, 42.75, -2.0); // 8 byte values + /* Just checking that the operand order is not mixed up. */ + debr(10.0f, 2.0f); + ddbr(10.0, 2.0); + dxbr(10.0L, 2.0L); + return 0; } diff --git a/none/tests/s390x/bfp-3.stdout.exp b/none/tests/s390x/bfp-3.stdout.exp index bd9e5c49c..b1eb0a72e 100644 --- a/none/tests/s390x/bfp-3.stdout.exp +++ b/none/tests/s390x/bfp-3.stdout.exp @@ -2,3 +2,6 @@ maebr 20.250000 * 3.000000 + 10.500000 -> 71.250000 madbr 42.750000 * -2.000000 + -10.500000 -> -96.000000 msebr 20.250000 * 3.000000 - 10.500000 -> 50.250000 msdbr 42.750000 * -2.000000 - -10.500000 -> -75.000000 +debr 10.000000 / 2.000000 -> 5.000000 +ddbr 10.000000 / 2.000000 -> 5.000000 +dxbr 10.000000 / 2.000000 -> 5.000000 diff --git a/none/tests/s390x/bfp-arith.c b/none/tests/s390x/bfp-arith.c new file mode 100644 index 000000000..e69b7cf02 --- /dev/null +++ b/none/tests/s390x/bfp-arith.c @@ -0,0 +1,99 @@ +#include +#include +#include + +/* Making sure that the condition code of arithmetic BFP ops is + set correctly. + + Multiply and square root are covered by bfp-emit.pl +*/ + +volatile int cc; + +#define TEST_INSN(insn, fmt, opnd1, opnd2) \ + do { \ + __typeof__(opnd1) v1 = opnd1; \ + __typeof__(opnd2) v2 = opnd2; \ + __asm__ volatile(insn " %[r1],%[r2]\n\t" \ + "ipm %[psw]\n\t" \ + "srl %[psw],28\n\t" \ + : [psw]"=d"(cc) \ + : [r1]"f"(v1), [r2]"f"(v2) \ + : "cc"); \ + printf("%s r1 = "fmt" r2 = "fmt" --> cc = %d\n", \ + insn, opnd1, opnd2, cc); \ + } while (0) + + +static void aebr(float r1, float r2) +{ + TEST_INSN("aebr", "%g", r1, r2); +} + +static void adbr(double r1, double r2) +{ + TEST_INSN("adbr", "%g", r1, r2); +} + +static void axbr(long double r1, long double r2) +{ + TEST_INSN("axbr", "%Lg", r1, r2); +} + +static void sebr(float r1, float r2) +{ + TEST_INSN("sebr", "%g", r1, r2); +} + +static void sdbr(double r1, double r2) +{ + TEST_INSN("sdbr", "%g", r1, r2); +} + +static void sxbr(long double r1, long double r2) +{ + TEST_INSN("sxbr", "%Lg", r1, r2); +} + +int main() +{ + assert(sizeof(long double) == 16); // ensure 128 bit wide + + printf("32-bit ADD\n"); + aebr(2.5f, -2.5f); + aebr(4.75f, -6.25f); + aebr(-2.5f, 8.5f); + aebr(NAN, 0); + + printf("64-bit ADD\n"); + adbr(2.5, -2.5); + adbr(4.75, -6.25); + adbr(-2.5, 8.5); + adbr(NAN, 0); + + printf("128-bit ADD\n"); + axbr(2.5L, -2.5L); + axbr(4.75L, -6.25L); + axbr(-2.5L, 8.5L); + axbr(NAN, 0); + + printf("32-bit SUBTRACT\n"); + sebr(2.5f, 2.5f); + sebr(4.75f, 6.25f); + sebr(8.5f, 2.5f); + sebr(NAN, 0); + + printf("64-bit SUBTRACT\n"); + sdbr(2.5, 2.5); + sdbr(4.75, 6.25); + sdbr(8.5, 2.5f); + sdbr(NAN, 0); + + printf("128-bit SUBTRACT\n"); + sxbr(2.5f, 2.5); + sxbr(4.75f, 6.25); + sxbr(8.5f, 2.5); + sxbr(NAN, 0); + + return 0; +} diff --git a/none/tests/s390x/bfp-1.stderr.exp b/none/tests/s390x/bfp-arith.stderr.exp similarity index 100% rename from none/tests/s390x/bfp-1.stderr.exp rename to none/tests/s390x/bfp-arith.stderr.exp diff --git a/none/tests/s390x/bfp-arith.stdout.exp b/none/tests/s390x/bfp-arith.stdout.exp new file mode 100644 index 000000000..237b5b3c8 --- /dev/null +++ b/none/tests/s390x/bfp-arith.stdout.exp @@ -0,0 +1,30 @@ +32-bit ADD +aebr r1 = 2.5 r2 = -2.5 --> cc = 0 +aebr r1 = 4.75 r2 = -6.25 --> cc = 1 +aebr r1 = -2.5 r2 = 8.5 --> cc = 2 +aebr r1 = nan r2 = 0 --> cc = 3 +64-bit ADD +adbr r1 = 2.5 r2 = -2.5 --> cc = 0 +adbr r1 = 4.75 r2 = -6.25 --> cc = 1 +adbr r1 = -2.5 r2 = 8.5 --> cc = 2 +adbr r1 = nan r2 = 0 --> cc = 3 +128-bit ADD +axbr r1 = 2.5 r2 = -2.5 --> cc = 0 +axbr r1 = 4.75 r2 = -6.25 --> cc = 1 +axbr r1 = -2.5 r2 = 8.5 --> cc = 2 +axbr r1 = nan r2 = 0 --> cc = 3 +32-bit SUBTRACT +sebr r1 = 2.5 r2 = 2.5 --> cc = 0 +sebr r1 = 4.75 r2 = 6.25 --> cc = 1 +sebr r1 = 8.5 r2 = 2.5 --> cc = 2 +sebr r1 = nan r2 = 0 --> cc = 3 +64-bit SUBTRACT +sdbr r1 = 2.5 r2 = 2.5 --> cc = 0 +sdbr r1 = 4.75 r2 = 6.25 --> cc = 1 +sdbr r1 = 8.5 r2 = 2.5 --> cc = 2 +sdbr r1 = nan r2 = 0 --> cc = 3 +128-bit SUBTRACT +sxbr r1 = 2.5 r2 = 2.5 --> cc = 0 +sxbr r1 = 4.75 r2 = 6.25 --> cc = 1 +sxbr r1 = 8.5 r2 = 2.5 --> cc = 2 +sxbr r1 = nan r2 = 0 --> cc = 3 diff --git a/none/tests/s390x/bfp-arith.vgtest b/none/tests/s390x/bfp-arith.vgtest new file mode 100644 index 000000000..19b58a066 --- /dev/null +++ b/none/tests/s390x/bfp-arith.vgtest @@ -0,0 +1 @@ +prog: bfp-arith From 73ece460ef7e891b404576fd7cc8bd92f4f753ed Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 22 Sep 2025 20:36:45 +0000 Subject: [PATCH 331/412] s390: BFP testsuite: comparison ops Rename bfp-4.c --> bfp-compare.c. Add more testcases including NANs. Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 --- .gitignore | 2 +- none/tests/s390x/Makefile.am | 2 +- none/tests/s390x/bfp-4.stdout.exp | 80 ------ none/tests/s390x/bfp-4.vgtest | 1 - none/tests/s390x/{bfp-4.c => bfp-compare.c} | 35 ++- ...fp-4.stderr.exp => bfp-compare.stderr.exp} | 0 none/tests/s390x/bfp-compare.stdout.exp | 230 ++++++++++++++++++ none/tests/s390x/bfp-compare.vgtest | 1 + 8 files changed, 260 insertions(+), 91 deletions(-) delete mode 100644 none/tests/s390x/bfp-4.stdout.exp delete mode 100644 none/tests/s390x/bfp-4.vgtest rename none/tests/s390x/{bfp-4.c => bfp-compare.c} (72%) rename none/tests/s390x/{bfp-4.stderr.exp => bfp-compare.stderr.exp} (100%) create mode 100644 none/tests/s390x/bfp-compare.stdout.exp create mode 100644 none/tests/s390x/bfp-compare.vgtest diff --git a/.gitignore b/.gitignore index fb3c9cc43..efdfea78a 100644 --- a/.gitignore +++ b/.gitignore @@ -2191,7 +2191,7 @@ /none/tests/s390x/bfp-arith /none/tests/s390x/bfp-2 /none/tests/s390x/bfp-3 -/none/tests/s390x/bfp-4 +/none/tests/s390x/bfp-compare /none/tests/s390x/srnm /none/tests/s390x/srnmb /none/tests/s390x/comp-1 diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 234ed656e..89bba9ec8 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -10,7 +10,7 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ bfp-tdc rounding-1 rounding-2 rounding-3 bfp-arith \ - bfp-2 bfp-3 bfp-4 srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ + bfp-2 bfp-3 bfp-compare srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ spechelper-alr spechelper-algr \ diff --git a/none/tests/s390x/bfp-4.stdout.exp b/none/tests/s390x/bfp-4.stdout.exp deleted file mode 100644 index bc81ea6ce..000000000 --- a/none/tests/s390x/bfp-4.stdout.exp +++ /dev/null @@ -1,80 +0,0 @@ -cebr: 3.14 == 3.14 -ceb: 3.14 == 3.14 -kebr: 3.14 == 3.14 -keb: 3.14 == 3.14 -cdbr: 3.14 == 3.14 -cdb: 3.14 == 3.14 -kdbr: 3.14 == 3.14 -kdb: 3.14 == 3.14 -cxbr: 3.14 == 3.14 -kxbr: 3.14 == 3.14 -cebr: -2.78 < 2.78 -ceb: -2.78 < 2.78 -kebr: -2.78 < 2.78 -keb: -2.78 < 2.78 -cdbr: -2.78 < 2.78 -cdb: -2.78 < 2.78 -kdbr: -2.78 < 2.78 -kdb: -2.78 < 2.78 -cxbr: -2.78 < 2.78 -kxbr: -2.78 < 2.78 -cebr: inf == inf -ceb: inf == inf -kebr: inf == inf -keb: inf == inf -cdbr: inf == inf -cdb: inf == inf -kdbr: inf == inf -kdb: inf == inf -cxbr: inf == inf -kxbr: inf == inf -cebr: inf > -inf -ceb: inf > -inf -kebr: inf > -inf -keb: inf > -inf -cdbr: inf > -inf -cdb: inf > -inf -kdbr: inf > -inf -kdb: inf > -inf -cxbr: inf > -inf -kxbr: inf > -inf -cebr: -inf == -inf -ceb: -inf == -inf -kebr: -inf == -inf -keb: -inf == -inf -cdbr: -inf == -inf -cdb: -inf == -inf -kdbr: -inf == -inf -kdb: -inf == -inf -cxbr: -inf == -inf -kxbr: -inf == -inf -cebr: inf > 1 -ceb: inf > 1 -kebr: inf > 1 -keb: inf > 1 -cdbr: inf > 1 -cdb: inf > 1 -kdbr: inf > 1 -kdb: inf > 1 -cxbr: inf > 1 -kxbr: inf > 1 -cebr: -inf < -1 -ceb: -inf < -1 -kebr: -inf < -1 -keb: -inf < -1 -cdbr: -inf < -1 -cdb: -inf < -1 -kdbr: -inf < -1 -kdb: -inf < -1 -cxbr: -inf < -1 -kxbr: -inf < -1 -cebr: 0 == -0 -ceb: 0 == -0 -kebr: 0 == -0 -keb: 0 == -0 -cdbr: 0 == -0 -cdb: 0 == -0 -kdbr: 0 == -0 -kdb: 0 == -0 -cxbr: 0 == -0 -kxbr: 0 == -0 diff --git a/none/tests/s390x/bfp-4.vgtest b/none/tests/s390x/bfp-4.vgtest deleted file mode 100644 index b800aa313..000000000 --- a/none/tests/s390x/bfp-4.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: bfp-4 diff --git a/none/tests/s390x/bfp-4.c b/none/tests/s390x/bfp-compare.c similarity index 72% rename from none/tests/s390x/bfp-4.c rename to none/tests/s390x/bfp-compare.c index 02315b6f9..35d5018b6 100644 --- a/none/tests/s390x/bfp-4.c +++ b/none/tests/s390x/bfp-compare.c @@ -1,4 +1,8 @@ +// FIXME rename bfp-compare.c + #include +#include +#include static const char *const cmp_result_str[] = { "==", "<", ">", "??" @@ -86,16 +90,31 @@ static void do_compare(float a, float b) int main(void) { - float inf = 1.f / 0.; - float neg_inf = -1.f / 0.; + assert(sizeof(long double) == 16); do_compare(3.14f, 3.14f); do_compare(-2.78f, 2.78f); - do_compare(inf, inf); - do_compare(inf, neg_inf); - do_compare(neg_inf, neg_inf); - do_compare(inf, 1.f); - do_compare(neg_inf, -1.f); - do_compare(1.f / inf, -1.f / inf); + do_compare( INFINITY, INFINITY); + do_compare( INFINITY, -INFINITY); + do_compare(-INFINITY, -INFINITY); + do_compare(-INFINITY, INFINITY); + do_compare( INFINITY, 1.f); + do_compare(-INFINITY, -1.f); + do_compare( 1.f, INFINITY); + do_compare(-1.f, -INFINITY); + + do_compare( NAN, NAN); + do_compare( NAN, -NAN); + do_compare(-NAN, NAN); + do_compare(-NAN, -NAN); + do_compare( NAN, INFINITY); + do_compare( NAN, -INFINITY); + do_compare(-NAN, INFINITY); + do_compare(-NAN, -INFINITY); + do_compare( NAN, 1.5); + do_compare(-NAN, -1.5); + do_compare( 1.5, NAN); + do_compare(-1.5, -NAN); + do_compare(1.f / INFINITY, -1.f / INFINITY); return 0; } diff --git a/none/tests/s390x/bfp-4.stderr.exp b/none/tests/s390x/bfp-compare.stderr.exp similarity index 100% rename from none/tests/s390x/bfp-4.stderr.exp rename to none/tests/s390x/bfp-compare.stderr.exp diff --git a/none/tests/s390x/bfp-compare.stdout.exp b/none/tests/s390x/bfp-compare.stdout.exp new file mode 100644 index 000000000..b81f3f6e2 --- /dev/null +++ b/none/tests/s390x/bfp-compare.stdout.exp @@ -0,0 +1,230 @@ +cebr: 3.14 == 3.14 +ceb: 3.14 == 3.14 +kebr: 3.14 == 3.14 +keb: 3.14 == 3.14 +cdbr: 3.14 == 3.14 +cdb: 3.14 == 3.14 +kdbr: 3.14 == 3.14 +kdb: 3.14 == 3.14 +cxbr: 3.14 == 3.14 +kxbr: 3.14 == 3.14 +cebr: -2.78 < 2.78 +ceb: -2.78 < 2.78 +kebr: -2.78 < 2.78 +keb: -2.78 < 2.78 +cdbr: -2.78 < 2.78 +cdb: -2.78 < 2.78 +kdbr: -2.78 < 2.78 +kdb: -2.78 < 2.78 +cxbr: -2.78 < 2.78 +kxbr: -2.78 < 2.78 +cebr: inf == inf +ceb: inf == inf +kebr: inf == inf +keb: inf == inf +cdbr: inf == inf +cdb: inf == inf +kdbr: inf == inf +kdb: inf == inf +cxbr: inf == inf +kxbr: inf == inf +cebr: inf > -inf +ceb: inf > -inf +kebr: inf > -inf +keb: inf > -inf +cdbr: inf > -inf +cdb: inf > -inf +kdbr: inf > -inf +kdb: inf > -inf +cxbr: inf > -inf +kxbr: inf > -inf +cebr: -inf == -inf +ceb: -inf == -inf +kebr: -inf == -inf +keb: -inf == -inf +cdbr: -inf == -inf +cdb: -inf == -inf +kdbr: -inf == -inf +kdb: -inf == -inf +cxbr: -inf == -inf +kxbr: -inf == -inf +cebr: -inf < inf +ceb: -inf < inf +kebr: -inf < inf +keb: -inf < inf +cdbr: -inf < inf +cdb: -inf < inf +kdbr: -inf < inf +kdb: -inf < inf +cxbr: -inf < inf +kxbr: -inf < inf +cebr: inf > 1 +ceb: inf > 1 +kebr: inf > 1 +keb: inf > 1 +cdbr: inf > 1 +cdb: inf > 1 +kdbr: inf > 1 +kdb: inf > 1 +cxbr: inf > 1 +kxbr: inf > 1 +cebr: -inf < -1 +ceb: -inf < -1 +kebr: -inf < -1 +keb: -inf < -1 +cdbr: -inf < -1 +cdb: -inf < -1 +kdbr: -inf < -1 +kdb: -inf < -1 +cxbr: -inf < -1 +kxbr: -inf < -1 +cebr: 1 < inf +ceb: 1 < inf +kebr: 1 < inf +keb: 1 < inf +cdbr: 1 < inf +cdb: 1 < inf +kdbr: 1 < inf +kdb: 1 < inf +cxbr: 1 < inf +kxbr: 1 < inf +cebr: -1 > -inf +ceb: -1 > -inf +kebr: -1 > -inf +keb: -1 > -inf +cdbr: -1 > -inf +cdb: -1 > -inf +kdbr: -1 > -inf +kdb: -1 > -inf +cxbr: -1 > -inf +kxbr: -1 > -inf +cebr: nan ?? nan +ceb: nan ?? nan +kebr: nan ?? nan +keb: nan ?? nan +cdbr: nan ?? nan +cdb: nan ?? nan +kdbr: nan ?? nan +kdb: nan ?? nan +cxbr: nan ?? nan +kxbr: nan ?? nan +cebr: nan ?? -nan +ceb: nan ?? -nan +kebr: nan ?? -nan +keb: nan ?? -nan +cdbr: nan ?? -nan +cdb: nan ?? -nan +kdbr: nan ?? -nan +kdb: nan ?? -nan +cxbr: nan ?? -nan +kxbr: nan ?? -nan +cebr: -nan ?? nan +ceb: -nan ?? nan +kebr: -nan ?? nan +keb: -nan ?? nan +cdbr: -nan ?? nan +cdb: -nan ?? nan +kdbr: -nan ?? nan +kdb: -nan ?? nan +cxbr: -nan ?? nan +kxbr: -nan ?? nan +cebr: -nan ?? -nan +ceb: -nan ?? -nan +kebr: -nan ?? -nan +keb: -nan ?? -nan +cdbr: -nan ?? -nan +cdb: -nan ?? -nan +kdbr: -nan ?? -nan +kdb: -nan ?? -nan +cxbr: -nan ?? -nan +kxbr: -nan ?? -nan +cebr: nan ?? inf +ceb: nan ?? inf +kebr: nan ?? inf +keb: nan ?? inf +cdbr: nan ?? inf +cdb: nan ?? inf +kdbr: nan ?? inf +kdb: nan ?? inf +cxbr: nan ?? inf +kxbr: nan ?? inf +cebr: nan ?? -inf +ceb: nan ?? -inf +kebr: nan ?? -inf +keb: nan ?? -inf +cdbr: nan ?? -inf +cdb: nan ?? -inf +kdbr: nan ?? -inf +kdb: nan ?? -inf +cxbr: nan ?? -inf +kxbr: nan ?? -inf +cebr: -nan ?? inf +ceb: -nan ?? inf +kebr: -nan ?? inf +keb: -nan ?? inf +cdbr: -nan ?? inf +cdb: -nan ?? inf +kdbr: -nan ?? inf +kdb: -nan ?? inf +cxbr: -nan ?? inf +kxbr: -nan ?? inf +cebr: -nan ?? -inf +ceb: -nan ?? -inf +kebr: -nan ?? -inf +keb: -nan ?? -inf +cdbr: -nan ?? -inf +cdb: -nan ?? -inf +kdbr: -nan ?? -inf +kdb: -nan ?? -inf +cxbr: -nan ?? -inf +kxbr: -nan ?? -inf +cebr: nan ?? 1.5 +ceb: nan ?? 1.5 +kebr: nan ?? 1.5 +keb: nan ?? 1.5 +cdbr: nan ?? 1.5 +cdb: nan ?? 1.5 +kdbr: nan ?? 1.5 +kdb: nan ?? 1.5 +cxbr: nan ?? 1.5 +kxbr: nan ?? 1.5 +cebr: -nan ?? -1.5 +ceb: -nan ?? -1.5 +kebr: -nan ?? -1.5 +keb: -nan ?? -1.5 +cdbr: -nan ?? -1.5 +cdb: -nan ?? -1.5 +kdbr: -nan ?? -1.5 +kdb: -nan ?? -1.5 +cxbr: -nan ?? -1.5 +kxbr: -nan ?? -1.5 +cebr: 1.5 ?? nan +ceb: 1.5 ?? nan +kebr: 1.5 ?? nan +keb: 1.5 ?? nan +cdbr: 1.5 ?? nan +cdb: 1.5 ?? nan +kdbr: 1.5 ?? nan +kdb: 1.5 ?? nan +cxbr: 1.5 ?? nan +kxbr: 1.5 ?? nan +cebr: -1.5 ?? -nan +ceb: -1.5 ?? -nan +kebr: -1.5 ?? -nan +keb: -1.5 ?? -nan +cdbr: -1.5 ?? -nan +cdb: -1.5 ?? -nan +kdbr: -1.5 ?? -nan +kdb: -1.5 ?? -nan +cxbr: -1.5 ?? -nan +kxbr: -1.5 ?? -nan +cebr: 0 == -0 +ceb: 0 == -0 +kebr: 0 == -0 +keb: 0 == -0 +cdbr: 0 == -0 +cdb: 0 == -0 +kdbr: 0 == -0 +kdb: 0 == -0 +cxbr: 0 == -0 +kxbr: 0 == -0 diff --git a/none/tests/s390x/bfp-compare.vgtest b/none/tests/s390x/bfp-compare.vgtest new file mode 100644 index 000000000..8bc91934c --- /dev/null +++ b/none/tests/s390x/bfp-compare.vgtest @@ -0,0 +1 @@ +prog: bfp-compare From 6190acedb1d5f1e8a3365e8affcf8ce5c0beac0f Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 22 Sep 2025 20:43:23 +0000 Subject: [PATCH 332/412] s390: Add forgotten file bfp-compare.stdout.exp --- none/tests/s390x/bfp-compare.stdout.exp | 275 ++++-------------------- 1 file changed, 45 insertions(+), 230 deletions(-) diff --git a/none/tests/s390x/bfp-compare.stdout.exp b/none/tests/s390x/bfp-compare.stdout.exp index b81f3f6e2..4f2c2a940 100644 --- a/none/tests/s390x/bfp-compare.stdout.exp +++ b/none/tests/s390x/bfp-compare.stdout.exp @@ -1,230 +1,45 @@ -cebr: 3.14 == 3.14 -ceb: 3.14 == 3.14 -kebr: 3.14 == 3.14 -keb: 3.14 == 3.14 -cdbr: 3.14 == 3.14 -cdb: 3.14 == 3.14 -kdbr: 3.14 == 3.14 -kdb: 3.14 == 3.14 -cxbr: 3.14 == 3.14 -kxbr: 3.14 == 3.14 -cebr: -2.78 < 2.78 -ceb: -2.78 < 2.78 -kebr: -2.78 < 2.78 -keb: -2.78 < 2.78 -cdbr: -2.78 < 2.78 -cdb: -2.78 < 2.78 -kdbr: -2.78 < 2.78 -kdb: -2.78 < 2.78 -cxbr: -2.78 < 2.78 -kxbr: -2.78 < 2.78 -cebr: inf == inf -ceb: inf == inf -kebr: inf == inf -keb: inf == inf -cdbr: inf == inf -cdb: inf == inf -kdbr: inf == inf -kdb: inf == inf -cxbr: inf == inf -kxbr: inf == inf -cebr: inf > -inf -ceb: inf > -inf -kebr: inf > -inf -keb: inf > -inf -cdbr: inf > -inf -cdb: inf > -inf -kdbr: inf > -inf -kdb: inf > -inf -cxbr: inf > -inf -kxbr: inf > -inf -cebr: -inf == -inf -ceb: -inf == -inf -kebr: -inf == -inf -keb: -inf == -inf -cdbr: -inf == -inf -cdb: -inf == -inf -kdbr: -inf == -inf -kdb: -inf == -inf -cxbr: -inf == -inf -kxbr: -inf == -inf -cebr: -inf < inf -ceb: -inf < inf -kebr: -inf < inf -keb: -inf < inf -cdbr: -inf < inf -cdb: -inf < inf -kdbr: -inf < inf -kdb: -inf < inf -cxbr: -inf < inf -kxbr: -inf < inf -cebr: inf > 1 -ceb: inf > 1 -kebr: inf > 1 -keb: inf > 1 -cdbr: inf > 1 -cdb: inf > 1 -kdbr: inf > 1 -kdb: inf > 1 -cxbr: inf > 1 -kxbr: inf > 1 -cebr: -inf < -1 -ceb: -inf < -1 -kebr: -inf < -1 -keb: -inf < -1 -cdbr: -inf < -1 -cdb: -inf < -1 -kdbr: -inf < -1 -kdb: -inf < -1 -cxbr: -inf < -1 -kxbr: -inf < -1 -cebr: 1 < inf -ceb: 1 < inf -kebr: 1 < inf -keb: 1 < inf -cdbr: 1 < inf -cdb: 1 < inf -kdbr: 1 < inf -kdb: 1 < inf -cxbr: 1 < inf -kxbr: 1 < inf -cebr: -1 > -inf -ceb: -1 > -inf -kebr: -1 > -inf -keb: -1 > -inf -cdbr: -1 > -inf -cdb: -1 > -inf -kdbr: -1 > -inf -kdb: -1 > -inf -cxbr: -1 > -inf -kxbr: -1 > -inf -cebr: nan ?? nan -ceb: nan ?? nan -kebr: nan ?? nan -keb: nan ?? nan -cdbr: nan ?? nan -cdb: nan ?? nan -kdbr: nan ?? nan -kdb: nan ?? nan -cxbr: nan ?? nan -kxbr: nan ?? nan -cebr: nan ?? -nan -ceb: nan ?? -nan -kebr: nan ?? -nan -keb: nan ?? -nan -cdbr: nan ?? -nan -cdb: nan ?? -nan -kdbr: nan ?? -nan -kdb: nan ?? -nan -cxbr: nan ?? -nan -kxbr: nan ?? -nan -cebr: -nan ?? nan -ceb: -nan ?? nan -kebr: -nan ?? nan -keb: -nan ?? nan -cdbr: -nan ?? nan -cdb: -nan ?? nan -kdbr: -nan ?? nan -kdb: -nan ?? nan -cxbr: -nan ?? nan -kxbr: -nan ?? nan -cebr: -nan ?? -nan -ceb: -nan ?? -nan -kebr: -nan ?? -nan -keb: -nan ?? -nan -cdbr: -nan ?? -nan -cdb: -nan ?? -nan -kdbr: -nan ?? -nan -kdb: -nan ?? -nan -cxbr: -nan ?? -nan -kxbr: -nan ?? -nan -cebr: nan ?? inf -ceb: nan ?? inf -kebr: nan ?? inf -keb: nan ?? inf -cdbr: nan ?? inf -cdb: nan ?? inf -kdbr: nan ?? inf -kdb: nan ?? inf -cxbr: nan ?? inf -kxbr: nan ?? inf -cebr: nan ?? -inf -ceb: nan ?? -inf -kebr: nan ?? -inf -keb: nan ?? -inf -cdbr: nan ?? -inf -cdb: nan ?? -inf -kdbr: nan ?? -inf -kdb: nan ?? -inf -cxbr: nan ?? -inf -kxbr: nan ?? -inf -cebr: -nan ?? inf -ceb: -nan ?? inf -kebr: -nan ?? inf -keb: -nan ?? inf -cdbr: -nan ?? inf -cdb: -nan ?? inf -kdbr: -nan ?? inf -kdb: -nan ?? inf -cxbr: -nan ?? inf -kxbr: -nan ?? inf -cebr: -nan ?? -inf -ceb: -nan ?? -inf -kebr: -nan ?? -inf -keb: -nan ?? -inf -cdbr: -nan ?? -inf -cdb: -nan ?? -inf -kdbr: -nan ?? -inf -kdb: -nan ?? -inf -cxbr: -nan ?? -inf -kxbr: -nan ?? -inf -cebr: nan ?? 1.5 -ceb: nan ?? 1.5 -kebr: nan ?? 1.5 -keb: nan ?? 1.5 -cdbr: nan ?? 1.5 -cdb: nan ?? 1.5 -kdbr: nan ?? 1.5 -kdb: nan ?? 1.5 -cxbr: nan ?? 1.5 -kxbr: nan ?? 1.5 -cebr: -nan ?? -1.5 -ceb: -nan ?? -1.5 -kebr: -nan ?? -1.5 -keb: -nan ?? -1.5 -cdbr: -nan ?? -1.5 -cdb: -nan ?? -1.5 -kdbr: -nan ?? -1.5 -kdb: -nan ?? -1.5 -cxbr: -nan ?? -1.5 -kxbr: -nan ?? -1.5 -cebr: 1.5 ?? nan -ceb: 1.5 ?? nan -kebr: 1.5 ?? nan -keb: 1.5 ?? nan -cdbr: 1.5 ?? nan -cdb: 1.5 ?? nan -kdbr: 1.5 ?? nan -kdb: 1.5 ?? nan -cxbr: 1.5 ?? nan -kxbr: 1.5 ?? nan -cebr: -1.5 ?? -nan -ceb: -1.5 ?? -nan -kebr: -1.5 ?? -nan -keb: -1.5 ?? -nan -cdbr: -1.5 ?? -nan -cdb: -1.5 ?? -nan -kdbr: -1.5 ?? -nan -kdb: -1.5 ?? -nan -cxbr: -1.5 ?? -nan -kxbr: -1.5 ?? -nan -cebr: 0 == -0 -ceb: 0 == -0 -kebr: 0 == -0 -keb: 0 == -0 -cdbr: 0 == -0 -cdb: 0 == -0 -kdbr: 0 == -0 -kdb: 0 == -0 -cxbr: 0 == -0 -kxbr: 0 == -0 +LOAD AND TEST short BFP +ltebr 100.000000 -> 100.000000 cc = 2 +ltebr -10.500000 -> -10.500000 cc = 1 +ltebr 0.000000 -> 0.000000 cc = 0 +ltebr nan -> nan cc = 3 +LOAD AND TEST long BFP +ltdbr 100.000000 -> 100.000000 cc = 2 +ltdbr -10.500000 -> -10.500000 cc = 1 +ltdbr 0.000000 -> 0.000000 cc = 0 +ltdbr nan -> nan cc = 3 +LOAD AND TEST extended BFP +ltxbr 100.000000 -> 100.000000 cc = 2 +ltxbr -10.500000 -> -10.500000 cc = 1 +ltxbr 0.000000 -> 0.000000 cc = 0 +ltxbr nan -> nan cc = 3 + +LOAD LENGTHENED short BFP -> long BFP +ldebr 101.5 -> 101.500000 +ldebr -11.1 -> -11.100000 +ldebr 0 -> 0.000000 +ldebr 7e-06 -> 0.000007 +ldebr nan -> nan +ldebr inf -> inf +ldebr -inf -> -inf +LOAD LENGTHENED short BFP -> extended BFP +lxebr 101.5 -> 101.500000 +lxebr -11.1 -> -11.100000 +lxebr 0 -> 0.000000 +lxebr 7e-06 -> 0.000007 +lxebr nan -> nan +lxebr inf -> inf +lxebr -inf -> -inf +LOAD LENGTHENED long BFP -> extended BFP +lxdbr 101.5 -> 101.500000 +lxdbr -11.1 -> -11.100000 +lxdbr 0 -> 0.000000 +lxdbr 7e-16 -> 7e-16 +lxdbr nan -> nan +lxdbr inf -> inf +lxdbr -inf -> -inf + +LOAD ZERO +lzer gpr value = 0 +lzdr gpr value = 0 +lzdr gpr values = 0 0 From 69e67dadf5572b5e6521da2b87633d503f1d597b Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 22 Sep 2025 22:20:57 +0000 Subject: [PATCH 333/412] s390: BFP testsuite: load positive/negative/complement, load and test Remove bfp-2. Add bfp-load Observe condition code! Also add correct bfp-compare.stdout.exp (c.f. 6190acedb1d) Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 --- .gitignore | 2 +- none/tests/s390x/Makefile.am | 4 +- none/tests/s390x/bfp-2.c | 81 ------ none/tests/s390x/bfp-2.stdout.exp | 12 - none/tests/s390x/bfp-2.vgtest | 1 - none/tests/s390x/bfp-compare.stdout.exp | 275 +++++++++++++++--- none/tests/s390x/bfp-load.c | 168 +++++++++++ .../{bfp-2.stderr.exp => bfp-load.stderr.exp} | 0 none/tests/s390x/bfp-load.stdout.exp | 109 +++++++ none/tests/s390x/bfp-load.vgtest | 1 + 10 files changed, 511 insertions(+), 142 deletions(-) delete mode 100644 none/tests/s390x/bfp-2.c delete mode 100644 none/tests/s390x/bfp-2.stdout.exp delete mode 100644 none/tests/s390x/bfp-2.vgtest create mode 100644 none/tests/s390x/bfp-load.c rename none/tests/s390x/{bfp-2.stderr.exp => bfp-load.stderr.exp} (100%) create mode 100644 none/tests/s390x/bfp-load.stdout.exp create mode 100644 none/tests/s390x/bfp-load.vgtest diff --git a/.gitignore b/.gitignore index efdfea78a..fb69b92a0 100644 --- a/.gitignore +++ b/.gitignore @@ -2189,7 +2189,7 @@ /none/tests/s390x/rounding-2 /none/tests/s390x/rounding-3 /none/tests/s390x/bfp-arith -/none/tests/s390x/bfp-2 +/none/tests/s390x/bfp-load /none/tests/s390x/bfp-3 /none/tests/s390x/bfp-compare /none/tests/s390x/srnm diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 89bba9ec8..b1f41a90f 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -9,8 +9,8 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ - bfp-tdc rounding-1 rounding-2 rounding-3 bfp-arith \ - bfp-2 bfp-3 bfp-compare srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ + bfp-tdc bfp-load rounding-1 rounding-2 rounding-3 bfp-arith \ + bfp-3 bfp-compare srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ spechelper-alr spechelper-algr \ diff --git a/none/tests/s390x/bfp-2.c b/none/tests/s390x/bfp-2.c deleted file mode 100644 index 7fbc2cbf3..000000000 --- a/none/tests/s390x/bfp-2.c +++ /dev/null @@ -1,81 +0,0 @@ -#include - -/* Test various BFP ops: - - load negative - - load positive - - load complement -*/ - -void lnebr(float in) -{ - float out; - - __asm__ volatile("lnebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lnebr %f -> %f\n", in, out); -} - -void lndbr(double in) -{ - double out; - - __asm__ volatile("lndbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lndbr %f -> %f\n", in, out); -} - -void lpebr(float in) -{ - float out; - - __asm__ volatile("lpebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lpebr %f -> %f\n", in, out); -} - -void lpdbr(double in) -{ - double out; - - __asm__ volatile("lpdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lpdbr %f -> %f\n", in, out); -} - -void lcebr(float in) -{ - float out; - - __asm__ volatile("lcebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lcebr %f -> %f\n", in, out); -} - -void lcdbr(double in) -{ - double out; - - __asm__ volatile("lcdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc"); - printf("lcdbr %f -> %f\n", in, out); -} - -int main(void) -{ - // load negative - lnebr(-2.5f); // 4 byte values - lnebr(12.5f); // 4 byte values - - lndbr(-0.5); // 8 byte values - lndbr(42.5); // 8 byte values - - // load positive - lpebr(-2.5f); // 4 byte values - lpebr(12.5f); // 4 byte values - - lpdbr(-0.5); // 8 byte values - lpdbr(42.5); // 8 byte values - - // load complement - lcebr(-23.5f); // 4 byte values - lcebr(123.5f); // 4 byte values - - lcdbr(-17.5); // 8 byte values - lcdbr(234.5); // 8 byte values - - return 0; -} diff --git a/none/tests/s390x/bfp-2.stdout.exp b/none/tests/s390x/bfp-2.stdout.exp deleted file mode 100644 index d2bc54136..000000000 --- a/none/tests/s390x/bfp-2.stdout.exp +++ /dev/null @@ -1,12 +0,0 @@ -lnebr -2.500000 -> -2.500000 -lnebr 12.500000 -> -12.500000 -lndbr -0.500000 -> -0.500000 -lndbr 42.500000 -> -42.500000 -lpebr -2.500000 -> 2.500000 -lpebr 12.500000 -> 12.500000 -lpdbr -0.500000 -> 0.500000 -lpdbr 42.500000 -> 42.500000 -lcebr -23.500000 -> 23.500000 -lcebr 123.500000 -> -123.500000 -lcdbr -17.500000 -> 17.500000 -lcdbr 234.500000 -> -234.500000 diff --git a/none/tests/s390x/bfp-2.vgtest b/none/tests/s390x/bfp-2.vgtest deleted file mode 100644 index 239b8f985..000000000 --- a/none/tests/s390x/bfp-2.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: bfp-2 diff --git a/none/tests/s390x/bfp-compare.stdout.exp b/none/tests/s390x/bfp-compare.stdout.exp index 4f2c2a940..b81f3f6e2 100644 --- a/none/tests/s390x/bfp-compare.stdout.exp +++ b/none/tests/s390x/bfp-compare.stdout.exp @@ -1,45 +1,230 @@ -LOAD AND TEST short BFP -ltebr 100.000000 -> 100.000000 cc = 2 -ltebr -10.500000 -> -10.500000 cc = 1 -ltebr 0.000000 -> 0.000000 cc = 0 -ltebr nan -> nan cc = 3 -LOAD AND TEST long BFP -ltdbr 100.000000 -> 100.000000 cc = 2 -ltdbr -10.500000 -> -10.500000 cc = 1 -ltdbr 0.000000 -> 0.000000 cc = 0 -ltdbr nan -> nan cc = 3 -LOAD AND TEST extended BFP -ltxbr 100.000000 -> 100.000000 cc = 2 -ltxbr -10.500000 -> -10.500000 cc = 1 -ltxbr 0.000000 -> 0.000000 cc = 0 -ltxbr nan -> nan cc = 3 - -LOAD LENGTHENED short BFP -> long BFP -ldebr 101.5 -> 101.500000 -ldebr -11.1 -> -11.100000 -ldebr 0 -> 0.000000 -ldebr 7e-06 -> 0.000007 -ldebr nan -> nan -ldebr inf -> inf -ldebr -inf -> -inf -LOAD LENGTHENED short BFP -> extended BFP -lxebr 101.5 -> 101.500000 -lxebr -11.1 -> -11.100000 -lxebr 0 -> 0.000000 -lxebr 7e-06 -> 0.000007 -lxebr nan -> nan -lxebr inf -> inf -lxebr -inf -> -inf -LOAD LENGTHENED long BFP -> extended BFP -lxdbr 101.5 -> 101.500000 -lxdbr -11.1 -> -11.100000 -lxdbr 0 -> 0.000000 -lxdbr 7e-16 -> 7e-16 -lxdbr nan -> nan -lxdbr inf -> inf -lxdbr -inf -> -inf - -LOAD ZERO -lzer gpr value = 0 -lzdr gpr value = 0 -lzdr gpr values = 0 0 +cebr: 3.14 == 3.14 +ceb: 3.14 == 3.14 +kebr: 3.14 == 3.14 +keb: 3.14 == 3.14 +cdbr: 3.14 == 3.14 +cdb: 3.14 == 3.14 +kdbr: 3.14 == 3.14 +kdb: 3.14 == 3.14 +cxbr: 3.14 == 3.14 +kxbr: 3.14 == 3.14 +cebr: -2.78 < 2.78 +ceb: -2.78 < 2.78 +kebr: -2.78 < 2.78 +keb: -2.78 < 2.78 +cdbr: -2.78 < 2.78 +cdb: -2.78 < 2.78 +kdbr: -2.78 < 2.78 +kdb: -2.78 < 2.78 +cxbr: -2.78 < 2.78 +kxbr: -2.78 < 2.78 +cebr: inf == inf +ceb: inf == inf +kebr: inf == inf +keb: inf == inf +cdbr: inf == inf +cdb: inf == inf +kdbr: inf == inf +kdb: inf == inf +cxbr: inf == inf +kxbr: inf == inf +cebr: inf > -inf +ceb: inf > -inf +kebr: inf > -inf +keb: inf > -inf +cdbr: inf > -inf +cdb: inf > -inf +kdbr: inf > -inf +kdb: inf > -inf +cxbr: inf > -inf +kxbr: inf > -inf +cebr: -inf == -inf +ceb: -inf == -inf +kebr: -inf == -inf +keb: -inf == -inf +cdbr: -inf == -inf +cdb: -inf == -inf +kdbr: -inf == -inf +kdb: -inf == -inf +cxbr: -inf == -inf +kxbr: -inf == -inf +cebr: -inf < inf +ceb: -inf < inf +kebr: -inf < inf +keb: -inf < inf +cdbr: -inf < inf +cdb: -inf < inf +kdbr: -inf < inf +kdb: -inf < inf +cxbr: -inf < inf +kxbr: -inf < inf +cebr: inf > 1 +ceb: inf > 1 +kebr: inf > 1 +keb: inf > 1 +cdbr: inf > 1 +cdb: inf > 1 +kdbr: inf > 1 +kdb: inf > 1 +cxbr: inf > 1 +kxbr: inf > 1 +cebr: -inf < -1 +ceb: -inf < -1 +kebr: -inf < -1 +keb: -inf < -1 +cdbr: -inf < -1 +cdb: -inf < -1 +kdbr: -inf < -1 +kdb: -inf < -1 +cxbr: -inf < -1 +kxbr: -inf < -1 +cebr: 1 < inf +ceb: 1 < inf +kebr: 1 < inf +keb: 1 < inf +cdbr: 1 < inf +cdb: 1 < inf +kdbr: 1 < inf +kdb: 1 < inf +cxbr: 1 < inf +kxbr: 1 < inf +cebr: -1 > -inf +ceb: -1 > -inf +kebr: -1 > -inf +keb: -1 > -inf +cdbr: -1 > -inf +cdb: -1 > -inf +kdbr: -1 > -inf +kdb: -1 > -inf +cxbr: -1 > -inf +kxbr: -1 > -inf +cebr: nan ?? nan +ceb: nan ?? nan +kebr: nan ?? nan +keb: nan ?? nan +cdbr: nan ?? nan +cdb: nan ?? nan +kdbr: nan ?? nan +kdb: nan ?? nan +cxbr: nan ?? nan +kxbr: nan ?? nan +cebr: nan ?? -nan +ceb: nan ?? -nan +kebr: nan ?? -nan +keb: nan ?? -nan +cdbr: nan ?? -nan +cdb: nan ?? -nan +kdbr: nan ?? -nan +kdb: nan ?? -nan +cxbr: nan ?? -nan +kxbr: nan ?? -nan +cebr: -nan ?? nan +ceb: -nan ?? nan +kebr: -nan ?? nan +keb: -nan ?? nan +cdbr: -nan ?? nan +cdb: -nan ?? nan +kdbr: -nan ?? nan +kdb: -nan ?? nan +cxbr: -nan ?? nan +kxbr: -nan ?? nan +cebr: -nan ?? -nan +ceb: -nan ?? -nan +kebr: -nan ?? -nan +keb: -nan ?? -nan +cdbr: -nan ?? -nan +cdb: -nan ?? -nan +kdbr: -nan ?? -nan +kdb: -nan ?? -nan +cxbr: -nan ?? -nan +kxbr: -nan ?? -nan +cebr: nan ?? inf +ceb: nan ?? inf +kebr: nan ?? inf +keb: nan ?? inf +cdbr: nan ?? inf +cdb: nan ?? inf +kdbr: nan ?? inf +kdb: nan ?? inf +cxbr: nan ?? inf +kxbr: nan ?? inf +cebr: nan ?? -inf +ceb: nan ?? -inf +kebr: nan ?? -inf +keb: nan ?? -inf +cdbr: nan ?? -inf +cdb: nan ?? -inf +kdbr: nan ?? -inf +kdb: nan ?? -inf +cxbr: nan ?? -inf +kxbr: nan ?? -inf +cebr: -nan ?? inf +ceb: -nan ?? inf +kebr: -nan ?? inf +keb: -nan ?? inf +cdbr: -nan ?? inf +cdb: -nan ?? inf +kdbr: -nan ?? inf +kdb: -nan ?? inf +cxbr: -nan ?? inf +kxbr: -nan ?? inf +cebr: -nan ?? -inf +ceb: -nan ?? -inf +kebr: -nan ?? -inf +keb: -nan ?? -inf +cdbr: -nan ?? -inf +cdb: -nan ?? -inf +kdbr: -nan ?? -inf +kdb: -nan ?? -inf +cxbr: -nan ?? -inf +kxbr: -nan ?? -inf +cebr: nan ?? 1.5 +ceb: nan ?? 1.5 +kebr: nan ?? 1.5 +keb: nan ?? 1.5 +cdbr: nan ?? 1.5 +cdb: nan ?? 1.5 +kdbr: nan ?? 1.5 +kdb: nan ?? 1.5 +cxbr: nan ?? 1.5 +kxbr: nan ?? 1.5 +cebr: -nan ?? -1.5 +ceb: -nan ?? -1.5 +kebr: -nan ?? -1.5 +keb: -nan ?? -1.5 +cdbr: -nan ?? -1.5 +cdb: -nan ?? -1.5 +kdbr: -nan ?? -1.5 +kdb: -nan ?? -1.5 +cxbr: -nan ?? -1.5 +kxbr: -nan ?? -1.5 +cebr: 1.5 ?? nan +ceb: 1.5 ?? nan +kebr: 1.5 ?? nan +keb: 1.5 ?? nan +cdbr: 1.5 ?? nan +cdb: 1.5 ?? nan +kdbr: 1.5 ?? nan +kdb: 1.5 ?? nan +cxbr: 1.5 ?? nan +kxbr: 1.5 ?? nan +cebr: -1.5 ?? -nan +ceb: -1.5 ?? -nan +kebr: -1.5 ?? -nan +keb: -1.5 ?? -nan +cdbr: -1.5 ?? -nan +cdb: -1.5 ?? -nan +kdbr: -1.5 ?? -nan +kdb: -1.5 ?? -nan +cxbr: -1.5 ?? -nan +kxbr: -1.5 ?? -nan +cebr: 0 == -0 +ceb: 0 == -0 +kebr: 0 == -0 +keb: 0 == -0 +cdbr: 0 == -0 +cdb: 0 == -0 +kdbr: 0 == -0 +kdb: 0 == -0 +cxbr: 0 == -0 +kxbr: 0 == -0 diff --git a/none/tests/s390x/bfp-load.c b/none/tests/s390x/bfp-load.c new file mode 100644 index 000000000..e5d862e69 --- /dev/null +++ b/none/tests/s390x/bfp-load.c @@ -0,0 +1,168 @@ +#include +#include +#include + +/* Test various BFP ops: + - load and test + - load zero +*/ + +#define LOADxxx(insn, initial, type, fmt) \ + do { \ + int cc; \ + type in = initial; \ + type out = 17; \ + __asm__ volatile("cr 0,0\n\t /* clear cc */\n\t" \ + insn " %[r1],%[r2]\n\t" \ + "ipm %[psw]\n\t" \ + "srl %[psw],28\n\t" \ + : [r1]"=f"(out), [psw]"=d"(cc) \ + : [r2]"f"(in) \ + : "cc"); \ + printf(insn " " fmt " -> " fmt " cc = %d\n", in, out, cc); \ + } while (0) + +void lzxr(void) +{ + long double value; + + __builtin_memset(&value, 0xff, sizeof value); + __asm__ volatile("lzxr %[r1]" : [r1]"=f"(value)); + + printf("lzxr --> "); + for (unsigned i = 0; i < sizeof(long double); ++i) { + if (i % 4 == 0) putchar(' '); + unsigned byte = ((char *)&value)[i]; + printf("%02u", byte); + } + putchar ('\n'); +} + +int main(void) +{ + assert(sizeof(long double) == 16); + + printf("LOAD AND TEST short BFP\n"); + LOADxxx("ltebr", 100.0f, float, "%f"); + LOADxxx("ltebr", -10.5f, float, "%f"); + LOADxxx("ltebr", 0.0f, float, "%f"); + LOADxxx("ltebr", NAN, float, "%f"); + LOADxxx("ltebr", -NAN, float, "%f"); + LOADxxx("ltebr", INFINITY, float, "%f"); + LOADxxx("ltebr", -INFINITY, float, "%f"); + + printf("LOAD AND TEST long BFP\n"); + LOADxxx("ltdbr", 100.0, double, "%f"); + LOADxxx("ltdbr", -10.5, double, "%f"); + LOADxxx("ltdbr", 0.0, double, "%f"); + LOADxxx("ltdbr", NAN, double, "%f"); + LOADxxx("ltdbr", INFINITY, double, "%f"); + LOADxxx("ltdbr", -INFINITY, double, "%f"); + + printf("LOAD AND TEST extended BFP\n"); + LOADxxx("ltxbr", 100.0L, long double, "%Lf"); + LOADxxx("ltxbr", -10.5L, long double, "%Lf"); + LOADxxx("ltxbr", 0.0L, long double, "%Lf"); + LOADxxx("ltxbr", NAN, long double, "%Lf"); + LOADxxx("ltxbr", INFINITY, long double, "%Lf"); + LOADxxx("ltxbr", -INFINITY, long double, "%Lf"); + + putchar('\n'); + printf("LOAD NEGATIVE short BFP\n"); + LOADxxx("lnebr", 0.0f, float, "%f"); + LOADxxx("lnebr", -0.0f, float, "%f"); + LOADxxx("lnebr", 123.0f, float, "%f"); + LOADxxx("lnebr", -12.0f, float, "%f"); + LOADxxx("lnebr", NAN, float, "%f"); + LOADxxx("lnebr", -NAN, float, "%f"); + LOADxxx("lnebr", INFINITY, float, "%f"); + LOADxxx("lnebr", -INFINITY, float, "%f"); + + printf("LOAD NEGATIVE long BFP\n"); + LOADxxx("lndbr", 0.0, double, "%f"); + LOADxxx("lndbr", -0.0, double, "%f"); + LOADxxx("lndbr", 123.0, double, "%f"); + LOADxxx("lndbr", -12.0, double, "%f"); + LOADxxx("lndbr", NAN, double, "%f"); + LOADxxx("lndbr", -NAN, double, "%f"); + LOADxxx("lndbr", INFINITY, double, "%f"); + LOADxxx("lndbr", -INFINITY, double, "%f"); + + printf("LOAD NEGATIVE extended BFP\n"); + LOADxxx("lnxbr", 0.0L, long double, "%Lf"); + LOADxxx("lnxbr", -0.0L, long double, "%Lf"); + LOADxxx("lnxbr", 123.0L, long double, "%Lf"); + LOADxxx("lnxbr", -12.0L, long double, "%Lf"); + LOADxxx("lnxbr", NAN, long double, "%Lf"); + LOADxxx("lnxbr", -NAN, long double, "%Lf"); + LOADxxx("lnxbr", INFINITY, long double, "%Lf"); + LOADxxx("lnxbr", -INFINITY, long double, "%Lf"); + + putchar('\n'); + printf("LOAD POSITIVE short BFP\n"); + LOADxxx("lpebr", 0.0f, float, "%f"); + LOADxxx("lpebr", -0.0f, float, "%f"); + LOADxxx("lpebr", 123.0f, float, "%f"); + LOADxxx("lpebr", -12.0f, float, "%f"); + LOADxxx("lpebr", NAN, float, "%f"); + LOADxxx("lpebr", -NAN, float, "%f"); + LOADxxx("lpebr", INFINITY, float, "%f"); + LOADxxx("lpebr", -INFINITY, float, "%f"); + + printf("LOAD POSITIVE long BFP\n"); + LOADxxx("lpdbr", 0.0, double, "%f"); + LOADxxx("lpdbr", -0.0, double, "%f"); + LOADxxx("lpdbr", 123.0, double, "%f"); + LOADxxx("lpdbr", -12.0, double, "%f"); + LOADxxx("lpdbr", NAN, double, "%f"); + LOADxxx("lpdbr", -NAN, double, "%f"); + LOADxxx("lpdbr", INFINITY, double, "%f"); + LOADxxx("lpdbr", -INFINITY, double, "%f"); + + printf("LOAD POSITIVE extended BFP\n"); + LOADxxx("lpxbr", 0.0L, long double, "%Lf"); + LOADxxx("lpxbr", -0.0L, long double, "%Lf"); + LOADxxx("lpxbr", 123.0L, long double, "%Lf"); + LOADxxx("lpxbr", -12.0L, long double, "%Lf"); + LOADxxx("lpxbr", NAN, long double, "%Lf"); + LOADxxx("lpxbr", -NAN, long double, "%Lf"); + LOADxxx("lpxbr", INFINITY, long double, "%Lf"); + LOADxxx("lpxbr", -INFINITY, long double, "%Lf"); + + putchar('\n'); + printf("LOAD COMPLEMENT short BFP\n"); + LOADxxx("lcebr", 0.0f, float, "%f"); + LOADxxx("lcebr", -0.0f, float, "%f"); + LOADxxx("lcebr", 123.0f, float, "%f"); + LOADxxx("lcebr", -12.0f, float, "%f"); + LOADxxx("lcebr", NAN, float, "%f"); + LOADxxx("lcebr", -NAN, float, "%f"); + LOADxxx("lcebr", INFINITY, float, "%f"); + LOADxxx("lcebr", -INFINITY, float, "%f"); + + printf("LOAD COMPLEMENT long BFP\n"); + LOADxxx("lcdbr", 0.0, double, "%f"); + LOADxxx("lcdbr", -0.0, double, "%f"); + LOADxxx("lcdbr", 123.0, double, "%f"); + LOADxxx("lcdbr", -12.0, double, "%f"); + LOADxxx("lcdbr", NAN, double, "%f"); + LOADxxx("lcdbr", -NAN, double, "%f"); + LOADxxx("lcdbr", INFINITY, double, "%f"); + LOADxxx("lcdbr", -INFINITY, double, "%f"); + + printf("LOAD COMPLEMENT extended BFP\n"); + LOADxxx("lcxbr", 0.0L, long double, "%Lf"); + LOADxxx("lcxbr", -0.0L, long double, "%Lf"); + LOADxxx("lcxbr", 123.0L, long double, "%Lf"); + LOADxxx("lcxbr", -12.0L, long double, "%Lf"); + LOADxxx("lcxbr", NAN, long double, "%Lf"); + LOADxxx("lcxbr", -NAN, long double, "%Lf"); + LOADxxx("lcxbr", INFINITY, long double, "%Lf"); + LOADxxx("lcxbr", -INFINITY, long double, "%Lf"); + + putchar('\n'); + printf("LOAD ZERO\n"); + lzxr(); + + return 0; +} diff --git a/none/tests/s390x/bfp-2.stderr.exp b/none/tests/s390x/bfp-load.stderr.exp similarity index 100% rename from none/tests/s390x/bfp-2.stderr.exp rename to none/tests/s390x/bfp-load.stderr.exp diff --git a/none/tests/s390x/bfp-load.stdout.exp b/none/tests/s390x/bfp-load.stdout.exp new file mode 100644 index 000000000..a2c287c36 --- /dev/null +++ b/none/tests/s390x/bfp-load.stdout.exp @@ -0,0 +1,109 @@ +LOAD AND TEST short BFP +ltebr 100.000000 -> 100.000000 cc = 2 +ltebr -10.500000 -> -10.500000 cc = 1 +ltebr 0.000000 -> 0.000000 cc = 0 +ltebr nan -> nan cc = 3 +ltebr -nan -> -nan cc = 3 +ltebr inf -> inf cc = 2 +ltebr -inf -> -inf cc = 1 +LOAD AND TEST long BFP +ltdbr 100.000000 -> 100.000000 cc = 2 +ltdbr -10.500000 -> -10.500000 cc = 1 +ltdbr 0.000000 -> 0.000000 cc = 0 +ltdbr nan -> nan cc = 3 +ltdbr inf -> inf cc = 2 +ltdbr -inf -> -inf cc = 1 +LOAD AND TEST extended BFP +ltxbr 100.000000 -> 100.000000 cc = 2 +ltxbr -10.500000 -> -10.500000 cc = 1 +ltxbr 0.000000 -> 0.000000 cc = 0 +ltxbr nan -> nan cc = 3 +ltxbr inf -> inf cc = 2 +ltxbr -inf -> -inf cc = 1 + +LOAD NEGATIVE short BFP +lnebr 0.000000 -> -0.000000 cc = 0 +lnebr -0.000000 -> -0.000000 cc = 0 +lnebr 123.000000 -> -123.000000 cc = 1 +lnebr -12.000000 -> -12.000000 cc = 1 +lnebr nan -> -nan cc = 3 +lnebr -nan -> -nan cc = 3 +lnebr inf -> -inf cc = 1 +lnebr -inf -> -inf cc = 1 +LOAD NEGATIVE long BFP +lndbr 0.000000 -> -0.000000 cc = 0 +lndbr -0.000000 -> -0.000000 cc = 0 +lndbr 123.000000 -> -123.000000 cc = 1 +lndbr -12.000000 -> -12.000000 cc = 1 +lndbr nan -> -nan cc = 3 +lndbr -nan -> -nan cc = 3 +lndbr inf -> -inf cc = 1 +lndbr -inf -> -inf cc = 1 +LOAD NEGATIVE extended BFP +lnxbr 0.000000 -> -0.000000 cc = 0 +lnxbr -0.000000 -> -0.000000 cc = 0 +lnxbr 123.000000 -> -123.000000 cc = 1 +lnxbr -12.000000 -> -12.000000 cc = 1 +lnxbr nan -> -nan cc = 3 +lnxbr -nan -> -nan cc = 3 +lnxbr inf -> -inf cc = 1 +lnxbr -inf -> -inf cc = 1 + +LOAD POSITIVE short BFP +lpebr 0.000000 -> 0.000000 cc = 0 +lpebr -0.000000 -> 0.000000 cc = 0 +lpebr 123.000000 -> 123.000000 cc = 2 +lpebr -12.000000 -> 12.000000 cc = 2 +lpebr nan -> nan cc = 3 +lpebr -nan -> nan cc = 3 +lpebr inf -> inf cc = 2 +lpebr -inf -> inf cc = 2 +LOAD POSITIVE long BFP +lpdbr 0.000000 -> 0.000000 cc = 0 +lpdbr -0.000000 -> 0.000000 cc = 0 +lpdbr 123.000000 -> 123.000000 cc = 2 +lpdbr -12.000000 -> 12.000000 cc = 2 +lpdbr nan -> nan cc = 3 +lpdbr -nan -> nan cc = 3 +lpdbr inf -> inf cc = 2 +lpdbr -inf -> inf cc = 2 +LOAD POSITIVE extended BFP +lpxbr 0.000000 -> 0.000000 cc = 0 +lpxbr -0.000000 -> 0.000000 cc = 0 +lpxbr 123.000000 -> 123.000000 cc = 2 +lpxbr -12.000000 -> 12.000000 cc = 2 +lpxbr nan -> nan cc = 3 +lpxbr -nan -> nan cc = 3 +lpxbr inf -> inf cc = 2 +lpxbr -inf -> inf cc = 2 + +LOAD COMPLEMENT short BFP +lcebr 0.000000 -> -0.000000 cc = 0 +lcebr -0.000000 -> 0.000000 cc = 0 +lcebr 123.000000 -> -123.000000 cc = 1 +lcebr -12.000000 -> 12.000000 cc = 2 +lcebr nan -> -nan cc = 3 +lcebr -nan -> nan cc = 3 +lcebr inf -> -inf cc = 1 +lcebr -inf -> inf cc = 2 +LOAD COMPLEMENT long BFP +lcdbr 0.000000 -> -0.000000 cc = 0 +lcdbr -0.000000 -> 0.000000 cc = 0 +lcdbr 123.000000 -> -123.000000 cc = 1 +lcdbr -12.000000 -> 12.000000 cc = 2 +lcdbr nan -> -nan cc = 3 +lcdbr -nan -> nan cc = 3 +lcdbr inf -> -inf cc = 1 +lcdbr -inf -> inf cc = 2 +LOAD COMPLEMENT extended BFP +lcxbr 0.000000 -> -0.000000 cc = 0 +lcxbr -0.000000 -> 0.000000 cc = 0 +lcxbr 123.000000 -> -123.000000 cc = 1 +lcxbr -12.000000 -> 12.000000 cc = 2 +lcxbr nan -> -nan cc = 3 +lcxbr -nan -> nan cc = 3 +lcxbr inf -> -inf cc = 1 +lcxbr -inf -> inf cc = 2 + +LOAD ZERO +lzxr --> 00000000 00000000 00000000 00000000 diff --git a/none/tests/s390x/bfp-load.vgtest b/none/tests/s390x/bfp-load.vgtest new file mode 100644 index 000000000..3e1dfc7db --- /dev/null +++ b/none/tests/s390x/bfp-load.vgtest @@ -0,0 +1 @@ +prog: bfp-load From ce0b91e1e49af679c1cbd51d88b5a95df7fc3c29 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 23 Sep 2025 13:18:25 +0000 Subject: [PATCH 334/412] s390: BFP testsuite: condolidate FPC insns in bfp-insn.c Remove srnm, srnmb, and rounding-2 testcases. Also test EFPC and LFPC. Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 --- .gitignore | 5 +- none/tests/s390x/Makefile.am | 4 +- none/tests/s390x/bfp-fpc.c | 178 ++++++++++++++++++ ...unding-2.stderr.exp => bfp-fpc.stderr.exp} | 0 none/tests/s390x/bfp-fpc.stdout.exp | 70 +++++++ none/tests/s390x/bfp-fpc.vgtest | 2 + none/tests/s390x/rounding-2.c | 41 ---- none/tests/s390x/rounding-2.stdout.exp | 9 - none/tests/s390x/rounding-2.vgtest | 1 - none/tests/s390x/srnm.c | 47 ----- none/tests/s390x/srnm.stderr.exp | 2 - none/tests/s390x/srnm.stdout.exp | 8 - none/tests/s390x/srnm.vgtest | 1 - none/tests/s390x/srnmb.c | 65 ------- none/tests/s390x/srnmb.stderr.exp | 19 -- none/tests/s390x/srnmb.stdout.exp | 6 - none/tests/s390x/srnmb.vgtest | 2 - 17 files changed, 254 insertions(+), 206 deletions(-) create mode 100644 none/tests/s390x/bfp-fpc.c rename none/tests/s390x/{rounding-2.stderr.exp => bfp-fpc.stderr.exp} (100%) create mode 100644 none/tests/s390x/bfp-fpc.stdout.exp create mode 100644 none/tests/s390x/bfp-fpc.vgtest delete mode 100644 none/tests/s390x/rounding-2.c delete mode 100644 none/tests/s390x/rounding-2.stdout.exp delete mode 100644 none/tests/s390x/rounding-2.vgtest delete mode 100644 none/tests/s390x/srnm.c delete mode 100644 none/tests/s390x/srnm.stderr.exp delete mode 100644 none/tests/s390x/srnm.stdout.exp delete mode 100644 none/tests/s390x/srnm.vgtest delete mode 100644 none/tests/s390x/srnmb.c delete mode 100644 none/tests/s390x/srnmb.stderr.exp delete mode 100644 none/tests/s390x/srnmb.stdout.exp delete mode 100644 none/tests/s390x/srnmb.vgtest diff --git a/.gitignore b/.gitignore index fb69b92a0..e70c9cc42 100644 --- a/.gitignore +++ b/.gitignore @@ -2137,7 +2137,6 @@ /none/tests/s390x/sub /none/tests/s390x/sub-z14 /none/tests/s390x/sub_EI -/none/tests/s390x/bfp-tdc /none/tests/s390x/hfp /none/tests/s390x/xc /none/tests/s390x/xor @@ -2190,10 +2189,10 @@ /none/tests/s390x/rounding-3 /none/tests/s390x/bfp-arith /none/tests/s390x/bfp-load +/none/tests/s390x/bfp-fpc +/none/tests/s390x/bfp-tdc /none/tests/s390x/bfp-3 /none/tests/s390x/bfp-compare -/none/tests/s390x/srnm -/none/tests/s390x/srnmb /none/tests/s390x/comp-1 /none/tests/s390x/comp-2 /none/tests/s390x/ex diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index b1f41a90f..7d2d1f8c4 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -9,8 +9,8 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ - bfp-tdc bfp-load rounding-1 rounding-2 rounding-3 bfp-arith \ - bfp-3 bfp-compare srnm srnmb comp-1 comp-2 exrl tmll tm stmg \ + bfp-tdc bfp-load bfp-fpc rounding-1 rounding-3 bfp-arith \ + bfp-3 bfp-compare comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ spechelper-alr spechelper-algr \ diff --git a/none/tests/s390x/bfp-fpc.c b/none/tests/s390x/bfp-fpc.c new file mode 100644 index 000000000..0862c5b04 --- /dev/null +++ b/none/tests/s390x/bfp-fpc.c @@ -0,0 +1,178 @@ +#include +#include +#include +#include "opcodes.h" +#include "rounding.h" + +/* Instructions modifying / querying the FPC register: + EFPC, LFPC, SFPC, STFPC, SRNM, SRNMB. + + No tests for SFASR and LFAS asa they are not implemented */ + +void +sfpc(unsigned mode) +{ + register unsigned r asm("1") = mode; + __asm__ volatile ( SFPC(1) : : "d"(r) ); +} + +unsigned +get_rounding_mode(void) +{ + unsigned fpc1; + uint64_t fpc2 = ~(uint64_t)0; + + __asm__ volatile ("stfpc %0" : "=Q"(fpc1)); + __asm__ volatile ("efpc %0" : "+d"(fpc2)); + + assert((fpc1 & 0x7) == (fpc2 & 0x7)); + assert((fpc2 >> 32) == 0xFFFFFFFF); + + return fpc1 & 0x7; +} + +#define srnm(b,d) \ + ({ \ + __asm__ volatile ("srnm %[displ] (%[base])\n\t" \ + : : [base]"a"(b), [displ]"L"(d)); \ + }) + +#define srnmb(b,d) \ + ({ \ + __asm__ volatile ("srnmb %[displ] (%[base])\n\t" \ + : : [base]"a"(b), [displ]"L"(d)); \ + }) + +int main(void) +{ + /* Order of rounding modes is such that the first rounding mode in + the list differs from the default rounding mode which is + FPC_BFP_ROUND_NEAREST_EVEN. */ + const unsigned rmodes[] = { + FPC_BFP_ROUND_ZERO, + FPC_BFP_ROUND_POSINF, + FPC_BFP_ROUND_NEGINF, + FPC_BFP_ROUND_PREPARE_SHORT, + FPC_BFP_ROUND_NEAREST_EVEN, + }; + + int initial = get_rounding_mode(); + assert(initial == FPC_BFP_ROUND_NEAREST_EVEN); + + printf("initial rounding mode: %u\n", initial); + + printf("Setting FPC rounding mode via SFPC\n"); + for (int i = 0; i < sizeof rmodes / sizeof rmodes[0]; ++i) { + printf("setting rounding mode to %u\n", rmodes[i]); + sfpc(rmodes[i]); + printf("...checking: %u\n", get_rounding_mode()); + } + + putchar('\n'); + printf("Setting FPC rounding mode via SRNM\n"); + /* Only rounding modes 0,1,2,3 are valid for SRNM */ + + /* Rounding mode --> base register */ + printf(".... using base register\n"); + printf("setting rounding mode to %u\n", 0); + srnm(0, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 1); + srnm(1, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 2); + srnm(2, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 3); + srnm(3, 0); + printf("...checking: %u\n", get_rounding_mode()); + + /* Rounding mode --> displacement */ + printf(".... using displacement\n"); + printf("setting rounding mode to %u\n", 0); + srnm(0, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 1); + srnm(0, 1); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 2); + srnm(0, 2); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 3); + srnm(0, 3); + printf("...checking: %u\n", get_rounding_mode()); + + putchar('\n'); + printf("Setting FPC rounding mode via SRNMB\n"); + /* All rounding modes allowed */ + + /* Rounding mode --> base register */ + printf(".... using base register\n"); + printf("setting rounding mode to %u\n", 0); + srnmb(0, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 1); + srnmb(1, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 2); + srnmb(2, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 3); + srnmb(3, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 7); + srnmb(7, 0); + printf("...checking: %u\n", get_rounding_mode()); + + /* Rounding mode --> displacement */ + printf(".... using displacement\n"); + printf("setting rounding mode to %u\n", 0); + srnmb(0, 0); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 1); + srnmb(0, 1); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 2); + srnmb(0, 2); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 3); + srnmb(0, 3); + printf("...checking: %u\n", get_rounding_mode()); + printf("setting rounding mode to %u\n", 7); + srnmb(0, 7); + printf("...checking: %u\n", get_rounding_mode()); + + putchar('\n'); + printf("SRNM specific checks\n"); + /* Making sure base reg and displacement are added. */ + srnm(1,2); // 1 + 2 = 3 + printf("rounding mode = %u\n", get_rounding_mode()); + /* Making sure extra bits get masked away */ + srnm(0,0xfff); /* 3 */ + printf("rounding mode = %u\n", get_rounding_mode()); + srnm(0xfff,0); /* 3 */ + printf("rounding mode = %u\n", get_rounding_mode()); + srnm(0xfff,0xfff); /* 3 */ + printf("rounding mode = %u\n", get_rounding_mode()); + srnm(3,3); /* 2 */ + printf("rounding mode = %u\n", get_rounding_mode()); + + putchar('\n'); + printf("SRNMB specific checks\n"); + /* Making sure base reg and displacement are added. */ + srnmb(3,4); // 3 + 4 = 7 + printf("rounding mode = %u\n", get_rounding_mode()); + + putchar('\n'); + printf("LFPC\n"); + unsigned fpcval; + + sfpc(3); /* Set rounding mode to 3 */ + printf("rounding mode = %u\n", get_rounding_mode()); + __asm__ volatile ("stfpc %0" : "=Q"(fpcval)); /* Store FPC -> fpcval; */ + fpcval = (fpcval & ~0x7) | 0x2; /* modify rounding mode bits */ + __asm__ volatile ("lfpc %0" : "=Q"(fpcval)); + printf("rounding mode = %u\n", get_rounding_mode()); + + return 0; +} diff --git a/none/tests/s390x/rounding-2.stderr.exp b/none/tests/s390x/bfp-fpc.stderr.exp similarity index 100% rename from none/tests/s390x/rounding-2.stderr.exp rename to none/tests/s390x/bfp-fpc.stderr.exp diff --git a/none/tests/s390x/bfp-fpc.stdout.exp b/none/tests/s390x/bfp-fpc.stdout.exp new file mode 100644 index 000000000..6e6c2c9ef --- /dev/null +++ b/none/tests/s390x/bfp-fpc.stdout.exp @@ -0,0 +1,70 @@ +initial rounding mode: 0 +Setting FPC rounding mode via SFPC +setting rounding mode to 1 +...checking: 1 +setting rounding mode to 2 +...checking: 2 +setting rounding mode to 3 +...checking: 3 +setting rounding mode to 7 +...checking: 7 +setting rounding mode to 0 +...checking: 0 + +Setting FPC rounding mode via SRNM +.... using base register +setting rounding mode to 0 +...checking: 0 +setting rounding mode to 1 +...checking: 1 +setting rounding mode to 2 +...checking: 2 +setting rounding mode to 3 +...checking: 3 +.... using displacement +setting rounding mode to 0 +...checking: 0 +setting rounding mode to 1 +...checking: 1 +setting rounding mode to 2 +...checking: 2 +setting rounding mode to 3 +...checking: 3 + +Setting FPC rounding mode via SRNMB +.... using base register +setting rounding mode to 0 +...checking: 0 +setting rounding mode to 1 +...checking: 1 +setting rounding mode to 2 +...checking: 2 +setting rounding mode to 3 +...checking: 3 +setting rounding mode to 7 +...checking: 7 +.... using displacement +setting rounding mode to 0 +...checking: 0 +setting rounding mode to 1 +...checking: 1 +setting rounding mode to 2 +...checking: 2 +setting rounding mode to 3 +...checking: 3 +setting rounding mode to 7 +...checking: 7 + +SRNM specific checks +rounding mode = 3 +rounding mode = 3 +rounding mode = 3 +rounding mode = 2 +rounding mode = 2 + +SRNMB specific checks +rounding mode = 7 + +LFPC +rounding mode = 3 +rounding mode = 2 diff --git a/none/tests/s390x/bfp-fpc.vgtest b/none/tests/s390x/bfp-fpc.vgtest new file mode 100644 index 000000000..d7306a2e3 --- /dev/null +++ b/none/tests/s390x/bfp-fpc.vgtest @@ -0,0 +1,2 @@ +prog: bfp-fpc +prereq: ../../../tests/s390x_features s390x-fpext diff --git a/none/tests/s390x/rounding-2.c b/none/tests/s390x/rounding-2.c deleted file mode 100644 index 32813ad26..000000000 --- a/none/tests/s390x/rounding-2.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include -#include "opcodes.h" - -/* Basic test that we can set the rounding mode in the FPC and - query it. Covers only generally available rounding modes. */ - -void -set_rounding_mode(unsigned mode) -{ - register unsigned r asm("1") = mode; - __asm__ volatile ( SFPC(1) : : "d"(r) ); -} - -unsigned -get_rounding_mode(void) -{ - unsigned fpc; - - __asm__ volatile ("stfpc %0" : "=Q"(fpc)); - - return fpc & 0x7; -} - - -int main(void) -{ - int i; - const unsigned rmodes[] = { 0, 1, 2, 3 }; - - printf("initial rounding mode: %u\n", get_rounding_mode()); - - for (i = 0; i < sizeof rmodes / sizeof rmodes[0]; ++i) { - printf("setting rounding mode to %u\n", rmodes[i]); - set_rounding_mode(rmodes[i]); - printf("...checking: %u\n", get_rounding_mode()); - } - - return 0; -} diff --git a/none/tests/s390x/rounding-2.stdout.exp b/none/tests/s390x/rounding-2.stdout.exp deleted file mode 100644 index e0da36957..000000000 --- a/none/tests/s390x/rounding-2.stdout.exp +++ /dev/null @@ -1,9 +0,0 @@ -initial rounding mode: 0 -setting rounding mode to 0 -...checking: 0 -setting rounding mode to 1 -...checking: 1 -setting rounding mode to 2 -...checking: 2 -setting rounding mode to 3 -...checking: 3 diff --git a/none/tests/s390x/rounding-2.vgtest b/none/tests/s390x/rounding-2.vgtest deleted file mode 100644 index c6e067d8b..000000000 --- a/none/tests/s390x/rounding-2.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: rounding-2 diff --git a/none/tests/s390x/srnm.c b/none/tests/s390x/srnm.c deleted file mode 100644 index b2948f327..000000000 --- a/none/tests/s390x/srnm.c +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include -#include "opcodes.h" - -#define srnm(b,d) \ - ({ \ - __asm__ volatile ( "lghi 8," #b "\n\t" \ - "srnm " #d "(8)\n\t" ::: "8"); \ - }) - -#define get_rounding_mode() \ - ({ \ - unsigned fpc; \ - __asm__ volatile ("stfpc %0" : "=Q"(fpc)); \ - fpc & 0x7; \ - }) - -int main(void) -{ - printf("initial rounding mode = %u\n", get_rounding_mode()); - - /* Set basic rounding modes in various ways */ - srnm(1,2); // 1 + 2 = 3 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnm(2,0); - printf("rounding mode = %u\n", get_rounding_mode()); - - srnm(0,1); - printf("rounding mode = %u\n", get_rounding_mode()); - - srnm(0,0); - printf("rounding mode = %u\n", get_rounding_mode()); - - /* Some rounding modes with bits to be ignored */ - srnm(0xff,0); // -> 3 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnm(0,0xfe); // -> 2 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnm(0xf0,0x0f); // -> 3 - printf("rounding mode = %u\n", get_rounding_mode()); - - return 0; -} diff --git a/none/tests/s390x/srnm.stderr.exp b/none/tests/s390x/srnm.stderr.exp deleted file mode 100644 index 139597f9c..000000000 --- a/none/tests/s390x/srnm.stderr.exp +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/srnm.stdout.exp b/none/tests/s390x/srnm.stdout.exp deleted file mode 100644 index a5a027802..000000000 --- a/none/tests/s390x/srnm.stdout.exp +++ /dev/null @@ -1,8 +0,0 @@ -initial rounding mode = 0 -rounding mode = 3 -rounding mode = 2 -rounding mode = 1 -rounding mode = 0 -rounding mode = 3 -rounding mode = 2 -rounding mode = 3 diff --git a/none/tests/s390x/srnm.vgtest b/none/tests/s390x/srnm.vgtest deleted file mode 100644 index 4144aeb19..000000000 --- a/none/tests/s390x/srnm.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: srnm diff --git a/none/tests/s390x/srnmb.c b/none/tests/s390x/srnmb.c deleted file mode 100644 index 72fc799fb..000000000 --- a/none/tests/s390x/srnmb.c +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include -#include -#include "opcodes.h" - -#define srnmb(b,d) \ - ({ \ - __asm__ volatile ( "lghi 8," #b "\n\t" \ - SRNMB(8,d) \ - ::: "8"); \ - }) - - -/* Like srnm above, except it uses r0 as a base register */ -#define srnmb0(d) \ - ({ \ - __asm__ volatile ( SRNMB(0,d) \ - ::: "0"); \ - }) - -#define get_rounding_mode() \ - ({ \ - unsigned fpc; \ - __asm__ volatile ("stfpc %0" : "=Q"(fpc)); \ - fpc & 0x7; \ - }) - -int main(void) -{ - setlinebuf(stdout); - printf("initial rounding mode = %u\n", get_rounding_mode()); - - /* Set basic rounding modes in various ways */ - srnmb(1,002); // 1 + 2 = 3 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb(2,000); - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb(0,001); - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb(0,000); - printf("rounding mode = %u\n", get_rounding_mode()); - -#if 0 - // fpext - srnmb(7,000); // -> 7 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb(0,000); // -> 0 - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb(0,007); // -> 7 - printf("rounding mode = %u\n", get_rounding_mode()); -#endif - - srnmb(0,001); - printf("rounding mode = %u\n", get_rounding_mode()); - - srnmb0(004); // -> specification exception - printf("rounding mode = %u\n", get_rounding_mode()); - - return 0; -} diff --git a/none/tests/s390x/srnmb.stderr.exp b/none/tests/s390x/srnmb.stderr.exp deleted file mode 100644 index bfdaf8b0a..000000000 --- a/none/tests/s390x/srnmb.stderr.exp +++ /dev/null @@ -1,19 +0,0 @@ - -vex s390->IR: specification exception: B2B8 0004 -valgrind: Unrecognised instruction at address 0x......... - at 0x........: main (srnmb.c:59) -Your program just tried to execute an instruction that Valgrind -did not recognise. There are two possible reasons for this. -1. Your program has a bug and erroneously jumped to a non-code - location. If you are running Memcheck and you just saw a - warning about a bad jump, it's probably your program's fault. -2. The instruction is legitimate but Valgrind doesn't handle it, - i.e. it's Valgrind's fault. If you think this is the case or - you are not sure, please let us know and we'll try to fix it. -Either way, Valgrind will now raise a SIGILL signal which will -probably kill your program. - -Process terminating with default action of signal 4 (SIGILL) - Illegal opcode at address 0x........ - at 0x........: main (srnmb.c:59) - diff --git a/none/tests/s390x/srnmb.stdout.exp b/none/tests/s390x/srnmb.stdout.exp deleted file mode 100644 index c9127aaf1..000000000 --- a/none/tests/s390x/srnmb.stdout.exp +++ /dev/null @@ -1,6 +0,0 @@ -initial rounding mode = 0 -rounding mode = 3 -rounding mode = 2 -rounding mode = 1 -rounding mode = 0 -rounding mode = 1 diff --git a/none/tests/s390x/srnmb.vgtest b/none/tests/s390x/srnmb.vgtest deleted file mode 100644 index 6eff81baf..000000000 --- a/none/tests/s390x/srnmb.vgtest +++ /dev/null @@ -1,2 +0,0 @@ -prog: srnmb -vgopts: --show-emwarns=yes From e5cd167a57e8e6141ac5b7f22df29ca2e218a935 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 23 Sep 2025 13:19:58 +0000 Subject: [PATCH 335/412] Fix an out-of-date comment. --- none/tests/s390x/rounding.h | 1 - 1 file changed, 1 deletion(-) diff --git a/none/tests/s390x/rounding.h b/none/tests/s390x/rounding.h index 0be1ee3cb..34555a8d8 100644 --- a/none/tests/s390x/rounding.h +++ b/none/tests/s390x/rounding.h @@ -37,7 +37,6 @@ // 4,5,6 are not allowed // Needs floating point extension facility -// Cannot be mapped to IRRoundingMode #define FPC_BFP_ROUND_PREPARE_SHORT 7 From d8cf0a84b26ff1ed1b5a9560bfbe5bf476f10c3a Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 23 Sep 2025 20:29:19 +0000 Subject: [PATCH 336/412] s390: Add missing BFP rounding mode conversions Function decode_bfp_rounding_mode: - Irrm_NEAREST_TIE_AWAY_0 --> S390_BFP_ROUND_NEAREST_AWAY - Irrm_PREPARE_SHORTER --> S390_BFP_ROUND_PREPARE_SHORT Macros S390_CC_FOR_BFP_CONVERT, S390_CC_FOR_BFP_UCONVERT - add S390_BFP_ROUND_NEAREST_AWAY - add S390_BFP_ROUND_PREPARE_SHORT Macros S390_CC_FOR_BFP128_CONVERT, S390_CC_FOR_BFP128_UCONVERT - add S390_BFP_ROUND_NEAREST_AWAY - add S390_BFP_ROUND_PREPARE_SHORT Fix more out-of-date comments related to rounding. --- VEX/priv/guest_s390_helpers.c | 29 ++++++++++++++++++++++++++++- none/tests/s390x/rounding.h | 3 --- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index 5bfd5eb3f..4fd9daf41 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -628,7 +628,7 @@ s390_do_cu12_cu14_helper2(UInt byte1, UInt byte2, UInt byte3, UInt byte4, UInt ij = (byte3 >> 4) & 0x3; UInt klmn = byte3 & 0xf; UInt opqrst = byte4 & 0x3f; - + if (is_cu12) { UInt abcd = (uvwxy - 1) & 0xf; UInt high_surrogate = (0xd8 << 8) | (abcd << 6) | (efgh << 2) | ij; @@ -782,6 +782,8 @@ decode_bfp_rounding_mode(UInt irrm) case Irrm_NegINF: return S390_BFP_ROUND_NEGINF; case Irrm_PosINF: return S390_BFP_ROUND_POSINF; case Irrm_ZERO: return S390_BFP_ROUND_ZERO; + case Irrm_NEAREST_TIE_AWAY_0: return S390_BFP_ROUND_NEAREST_AWAY; + case Irrm_PREPARE_SHORTER: return S390_BFP_ROUND_PREPARE_SHORT; } vpanic("decode_bfp_rounding_mode"); } @@ -880,6 +882,12 @@ decode_bfp_rounding_mode(UInt irrm) ({ \ UInt cc; \ switch (decode_bfp_rounding_mode(cc_dep2)) { \ + case S390_BFP_ROUND_NEAREST_AWAY: \ + cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,1); \ + break; \ + case S390_BFP_ROUND_PREPARE_SHORT: \ + cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,3); \ + break; \ case S390_BFP_ROUND_NEAREST_EVEN: \ cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,4); \ break; \ @@ -914,6 +922,12 @@ decode_bfp_rounding_mode(UInt irrm) ({ \ UInt cc; \ switch (decode_bfp_rounding_mode(cc_dep2)) { \ + case S390_BFP_ROUND_NEAREST_AWAY: \ + cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,1); \ + break; \ + case S390_BFP_ROUND_PREPARE_SHORT: \ + cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,3); \ + break; \ case S390_BFP_ROUND_NEAREST_EVEN: \ cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,4); \ break; \ @@ -951,6 +965,12 @@ decode_bfp_rounding_mode(UInt irrm) s390_cc_thunk_put3 for rationale. */ \ cc_dep2 = cc_dep2 ^ cc_ndep; \ switch (decode_bfp_rounding_mode(cc_ndep)) { \ + case S390_BFP_ROUND_NEAREST_AWAY: \ + cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,1); \ + break; \ + case S390_BFP_ROUND_PREPARE_SHORT: \ + cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,3); \ + break; \ case S390_BFP_ROUND_NEAREST_EVEN: \ cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,4); \ break; \ @@ -988,6 +1008,13 @@ decode_bfp_rounding_mode(UInt irrm) s390_cc_thunk_put3 for rationale. */ \ cc_dep2 = cc_dep2 ^ cc_ndep; \ switch (decode_bfp_rounding_mode(cc_ndep)) { \ + case S390_BFP_ROUND_NEAREST_AWAY: \ + cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,1); \ + break; \ + case S390_BFP_ROUND_PREPARE_SHORT: \ + cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,3); \ + cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,3); \ + break; \ case S390_BFP_ROUND_NEAREST_EVEN: \ cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,4); \ break; \ diff --git a/none/tests/s390x/rounding.h b/none/tests/s390x/rounding.h index 34555a8d8..63f19a723 100644 --- a/none/tests/s390x/rounding.h +++ b/none/tests/s390x/rounding.h @@ -8,14 +8,11 @@ /* instructions (e.g. CFEBR) */ /* ---------------------------------------------------------------- */ #define M3_BFP_ROUND_PER_FPC 0 - -// Cannot be mapped to IRRoundingMode #define M3_BFP_ROUND_NEAREST_AWAY 1 // 2 is not allowed // Needs floating point extension facility -// Cannot be mapped to IRRoundingMode #define M3_BFP_ROUND_PREPARE_SHORT 3 #define M3_BFP_ROUND_NEAREST_EVEN 4 From e8e4066c3a0160f03d9dfffaa360b65eb79745d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= Date: Tue, 12 Aug 2025 12:17:54 -0400 Subject: [PATCH 337/412] Filter Valgrind FDs from getdents syscalls This change prevents client programs from seeing Valgrind's internal file descriptors when scanning /proc/self/fd or /proc//fd. This patch modifies the getdents and getdents64 syscall wrappers to selectively filter out Valgrind's internal file descriptors only when listing /proc/*/fd directories for the current process. Add none/tests/getdents_filter.vgtest test that tests that the Valgrind's file descriptors are hidden from the client program and verifies both /proc/self/fd filtering and that regular directory listings remain unfiltered. https://bugs.kde.org/show_bug.cgi?id=331311 --- .gitignore | 1 + NEWS | 1 + coregrind/m_syswrap/syswrap-generic.c | 193 +++++++++++++++++++++++++- none/tests/Makefile.am | 2 + none/tests/getdents_filter.c | 159 +++++++++++++++++++++ none/tests/getdents_filter.stderr.exp | 0 none/tests/getdents_filter.stdout.exp | 16 +++ none/tests/getdents_filter.vgtest | 2 + 8 files changed, 370 insertions(+), 4 deletions(-) create mode 100644 none/tests/getdents_filter.c create mode 100644 none/tests/getdents_filter.stderr.exp create mode 100644 none/tests/getdents_filter.stdout.exp create mode 100644 none/tests/getdents_filter.vgtest diff --git a/.gitignore b/.gitignore index e70c9cc42..de362ecc2 100644 --- a/.gitignore +++ b/.gitignore @@ -1701,6 +1701,7 @@ /none/tests/vgprintf /none/tests/vgprintf_nvalgrind /none/tests/yield +/none/tests/getdents_filter # /none/tests/amd64/ /none/tests/amd64/*.dSYM diff --git a/NEWS b/NEWS index ecd58cc50..d7f0cb3ba 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +331311 Valgrind shows open files in /proc/self/fd that don't work for the process 309554 Wrap syscall remap_file_pages (216) 338803 Handling of dwz debug alt files or cross-CU is broken 369030 Wrap linux syscall: 171 (setdomainname) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index ce4c11c26..33b58f5a5 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -3994,11 +3994,181 @@ PRE(sys_getdents) PRE_MEM_WRITE( "getdents(dirp)", ARG2, ARG3 ); } +/* Check if the given file descriptor points to a /proc/PID/fd or /proc/PID/fdinfo directory. + Returns True if it's a directory we should filter Valgrind FDs from. */ +static Bool is_proc_fd_directory(Int fd) +{ + const HChar* path; + if (!VG_(resolve_filename)(fd, &path)) + return False; + + HChar ppfd[32]; /* large enough for /proc//fd and /proc//fdinfo */ + HChar ppfdinfo[32]; + VG_(sprintf)(ppfd, "/proc/%d/fd", VG_(getpid)()); + VG_(sprintf)(ppfdinfo, "/proc/%d/fdinfo", VG_(getpid)()); + + if (VG_(strcmp)(path, "/proc/self/fd") == 0 + || VG_(strcmp)(path, "/proc/self/fdinfo") == 0 + || VG_(strcmp)(path, ppfd) == 0 + || VG_(strcmp)(path, ppfdinfo) == 0) + return True; + + return False; +} + + +/* Helper function to decide if an FD entry should be kept */ +static Bool should_keep_fd_entry(const HChar *name) +{ + if (VG_(strcmp)(name, ".") == 0 || VG_(strcmp)(name, "..") == 0) + return True; + + Bool is_numeric = True; + for (Int i = 0; name[i] != '\0'; i++) { + if (name[i] < '0' || name[i] > '9') { + is_numeric = False; + if (VG_(clo_verbosity) > 1) + VG_(dmsg)("Warning: Non-numeric entry '%s' found in /proc/*/fd directory\n", name); + break; + } + } + + if (is_numeric && name[0] != '\0') { + Int fd_num = VG_(strtoll10)(name, NULL); + /* Hide FDs beyond soft limit or Valgrind's output FDs */ + if (fd_num >= VG_(fd_soft_limit) || + fd_num == VG_(log_output_sink).fd || + fd_num == VG_(xml_output_sink).fd) + return False; + } + + return True; +} + +/* Filter and compact dirent entries */ +static SizeT filter_dirent_entries(struct vki_dirent *dirp, SizeT orig_size) +{ + struct vki_dirent *dp = dirp; + struct vki_dirent *write_pos = dirp; + SizeT bytes_processed = 0; + SizeT new_size = 0; + + while (bytes_processed < orig_size) { + if (should_keep_fd_entry(dp->d_name)) { + if (write_pos != dp) + VG_(memmove)(write_pos, dp, dp->d_reclen); + new_size += dp->d_reclen; + write_pos = (struct vki_dirent *)((HChar *)write_pos + dp->d_reclen); + } + + bytes_processed += dp->d_reclen; + dp = (struct vki_dirent *)((HChar *)dp + dp->d_reclen); + } + + return new_size; +} + +/* Filter and compact dirent64 entries */ +static SizeT filter_dirent64_entries(struct vki_dirent64 *dirp, SizeT orig_size) +{ + struct vki_dirent64 *dp = dirp; + struct vki_dirent64 *write_pos = dirp; + SizeT bytes_processed = 0; + SizeT new_size = 0; + + while (bytes_processed < orig_size) { + if (should_keep_fd_entry(dp->d_name)) { + if (write_pos != dp) + VG_(memmove)(write_pos, dp, dp->d_reclen); + new_size += dp->d_reclen; + write_pos = (struct vki_dirent64 *)((HChar *)write_pos + dp->d_reclen); + } + + bytes_processed += dp->d_reclen; + dp = (struct vki_dirent64 *)((HChar *)dp + dp->d_reclen); + } + + return new_size; +} + +/* Filter out Valgrind's internal file descriptors from getdents results with refill capability. + When entries are filtered out, attempts to read more entries to avoid empty results. + Returns filtered size on success, or -1 if retry syscall failed. */ +static SizeT filter_valgrind_fds_from_getdents_with_refill(Int fd, struct vki_dirent *dirp, SizeT orig_size, SizeT buf_size, /*MOD*/SyscallStatus* status) +{ + SizeT new_size = filter_dirent_entries(dirp, orig_size); + + /* If we filtered out everything, try to read more entries. + Since new_size == 0, the buffer is completely unused. */ + while (new_size == 0) { + SysRes retry = VG_(do_syscall3)(__NR_getdents, fd, (UWord)dirp, buf_size); + if (sr_isError(retry)) { + /* Set the syscall status and return error indicator */ + SET_STATUS_from_SysRes(retry); + return -1; + } + if (sr_Res(retry) == 0) { + /* Real EOF - stop trying */ + break; + } + + /* Filter the new batch */ + SizeT retry_size = sr_Res(retry); + new_size = filter_dirent_entries(dirp, retry_size); + } + + return new_size; +} + +/* Filter out Valgrind's internal file descriptors from getdents64 results with refill capability. + Same logic as getdents version but for 64-bit dirent structures. + Returns filtered size on success, or -1 if retry syscall failed. */ +static SizeT filter_valgrind_fds_from_getdents64_with_refill(Int fd, struct vki_dirent64 *dirp, SizeT orig_size, SizeT buf_size, /*MOD*/SyscallStatus* status) +{ + SizeT new_size = filter_dirent64_entries(dirp, orig_size); + + /* If we filtered out everything, try to read more entries. + Since new_size == 0, the buffer is completely unused. */ + while (new_size == 0) { + SysRes retry = VG_(do_syscall3)(__NR_getdents64, fd, (UWord)dirp, buf_size); + if (sr_isError(retry)) { + /* Set the syscall status and return error indicator */ + SET_STATUS_from_SysRes(retry); + return -1; + } + if (sr_Res(retry) == 0) { + /* Real EOF - stop trying */ + break; + } + + /* Filter the new batch */ + SizeT retry_size = sr_Res(retry); + new_size = filter_dirent64_entries(dirp, retry_size); + } + + return new_size; +} + POST(sys_getdents) { vg_assert(SUCCESS); - if (RES > 0) - POST_MEM_WRITE( ARG2, RES ); + if (RES > 0) { + SizeT result_size = RES; + + /* Only filter Valgrind FDs when listing /proc/PID/fd or /proc/PID/fdinfo directories */ + if (is_proc_fd_directory(ARG1)) { + SizeT filtered_size = filter_valgrind_fds_from_getdents_with_refill(ARG1, (struct vki_dirent *)ARG2, RES, ARG3, status); + if ((SizeT)filtered_size == (SizeT)-1) { + /* Error already set by filter function */ + return; + } + result_size = filtered_size; + if (result_size != RES) + SET_STATUS_Success(result_size); + } + + POST_MEM_WRITE( ARG2, result_size ); + } } PRE(sys_getdents64) @@ -4015,8 +4185,23 @@ PRE(sys_getdents64) POST(sys_getdents64) { vg_assert(SUCCESS); - if (RES > 0) - POST_MEM_WRITE( ARG2, RES ); + if (RES > 0) { + SizeT result_size = RES; + + /* Only filter Valgrind FDs when listing /proc/PID/fd or /proc/PID/fdinfo directories */ + if (is_proc_fd_directory(ARG1)) { + SizeT filtered_size = filter_valgrind_fds_from_getdents64_with_refill(ARG1, (struct vki_dirent64 *)ARG2, RES, ARG3, status); + if ((SizeT)filtered_size == (SizeT)-1) { + /* Error already set by filter function */ + return; + } + result_size = filtered_size; + if (result_size != RES) + SET_STATUS_Success(result_size); + } + + POST_MEM_WRITE( ARG2, result_size ); + } } PRE(sys_getgroups) diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 716ce000d..ccdd85e53 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -172,6 +172,7 @@ EXTRA_DIST = \ floored.stderr.exp floored.stdout.exp floored.vgtest \ fork.stderr.exp fork.stdout.exp fork.vgtest \ fucomip.stderr.exp fucomip.vgtest \ + getdents_filter.stderr.exp getdents_filter.stdout.exp getdents_filter.vgtest \ gxx304.stderr.exp gxx304.vgtest \ ifunc.stderr.exp ifunc.stdout.exp ifunc.vgtest \ ioctl_moans.stderr.exp ioctl_moans.vgtest \ @@ -291,6 +292,7 @@ check_PROGRAMS = \ fdleak_fcntl fdleak_ipv4 fdleak_open fdleak_pipe \ fdleak_socketpair \ floored fork fucomip \ + getdents_filter \ ioctl_moans \ libvex_test \ libvexmultiarch_test \ diff --git a/none/tests/getdents_filter.c b/none/tests/getdents_filter.c new file mode 100644 index 000000000..d508cdde0 --- /dev/null +++ b/none/tests/getdents_filter.c @@ -0,0 +1,159 @@ +/* Regression test for bug #331311: Valgrind file descriptors visible in /proc/self/fd and /proc/self/fdinfo */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct linux_dirent { + unsigned long d_ino; + off_t d_off; + unsigned short d_reclen; + char d_name[]; +}; + +/* Small buffer size to test retry logic when all entries get filtered */ +#define SMALL_BUF_SIZE 64 + +/* Helper function to scan a /proc directory and print numeric FD entries with a prefix. + Returns 0 on success, -1 if directory unavailable */ +static int scan_proc_fd_directory(const char *dir_path, const char *prefix) +{ + DIR *d = opendir(dir_path); + if (d == NULL) { + printf("%s not available\n", dir_path); + return -1; + } + + struct dirent *entry; + while ((entry = readdir(d)) != NULL) { + if (entry->d_name[0] == '.') + continue; + + char *endptr; + long fd = strtol(entry->d_name, &endptr, 10); + if (*endptr == '\0' && fd >= 0) { + if (prefix) { + printf("%s:%ld\n", prefix, fd); + } else { + printf("%ld\n", fd); + } + } + } + closedir(d); + return 0; +} + +/* + * Test retry logic with raw getdents syscall and small buffer. + * + * This test validates the filtering refill mechanism in syswrap-generic.c. + * When using a tiny buffer (64 bytes), getdents may return only Valgrind FDs + * in a single call. The filtering code should detect this (new_size == 0) and + * automatically retry the syscall to get more entries until it finds client FDs + * or reaches EOF. This prevents the client from seeing empty results when + * Valgrind FDs get filtered out. + */ +static void test_retry_logic_with_small_buffer(void) +{ + int fd; + char buf[SMALL_BUF_SIZE]; + long nread; + struct linux_dirent *d; + + printf("retry_test_start\n"); + + fd = open("/proc/self/fd", O_RDONLY | O_DIRECTORY); + if (fd == -1) { + printf("retry_test_unavailable\n"); + return; + } + + /* + * Use raw getdents syscall with tiny 64-byte buffer. This forces multiple + * syscalls since each directory entry is typically 20+ bytes. Some calls + * may return only Valgrind FDs, which will trigger the retry mechanism. + */ + for (;;) { + nread = syscall(SYS_getdents, fd, buf, SMALL_BUF_SIZE); + + if (nread == -1) { + printf("retry_test_error\n"); + close(fd); + return; + } + + if (nread == 0) { + break; /* EOF - no more entries */ + } + + /* Print client FD entries found in this buffer (excluding . and ..) */ + for (size_t bpos = 0; bpos < nread;) { + d = (struct linux_dirent *)(buf + bpos); + if (strcmp(d->d_name, ".") != 0 && strcmp(d->d_name, "..") != 0) { + char *endptr; + long fd_num = strtol(d->d_name, &endptr, 10); + if (*endptr == '\0' && fd_num >= 0) { + printf("retry:%ld\n", fd_num); + } + } + bpos += d->d_reclen; + } + } + + close(fd); + printf("retry_test_end\n"); +} + +int main(void) +{ + /* Test 0: Retry logic with small buffer (tests the filtering refill mechanism) */ + test_retry_logic_with_small_buffer(); + + /* Test 1: /proc/self/fd should have Valgrind FDs filtered out */ + if (scan_proc_fd_directory("/proc/self/fd", NULL) == -1) { + return 0; /* Skip remaining tests if /proc/self/fd unavailable */ + } + + /* Test 2: /proc/self/fdinfo should have Valgrind FDs filtered out */ + scan_proc_fd_directory("/proc/self/fdinfo", "fdinfo"); + + /* Test 3: Regular directory should show all numbered files */ + DIR *d; + struct dirent *entry; + if (mkdir("testdir", 0755) == 0) { + FILE *f1 = fopen("testdir/1000", "w"); + FILE *f2 = fopen("testdir/1001", "w"); + if (f1) { fprintf(f1, "test"); fclose(f1); } + if (f2) { fprintf(f2, "test"); fclose(f2); } + + d = opendir("testdir"); + if (d != NULL) { + while ((entry = readdir(d)) != NULL) { + if (entry->d_name[0] != '.') { + char *endptr; + long num = strtol(entry->d_name, &endptr, 10); + if (*endptr == '\0' && num >= 1000) { + printf("regular:%ld\n", num); + } + } + } + closedir(d); + } + + unlink("testdir/1000"); + unlink("testdir/1001"); + rmdir("testdir"); + } + + + return 0; +} diff --git a/none/tests/getdents_filter.stderr.exp b/none/tests/getdents_filter.stderr.exp new file mode 100644 index 000000000..e69de29bb diff --git a/none/tests/getdents_filter.stdout.exp b/none/tests/getdents_filter.stdout.exp new file mode 100644 index 000000000..c228ee81f --- /dev/null +++ b/none/tests/getdents_filter.stdout.exp @@ -0,0 +1,16 @@ +retry_test_start +retry:0 +retry:1 +retry:2 +retry:3 +retry_test_end +0 +1 +2 +3 +fdinfo:0 +fdinfo:1 +fdinfo:2 +fdinfo:3 +regular:1000 +regular:1001 diff --git a/none/tests/getdents_filter.vgtest b/none/tests/getdents_filter.vgtest new file mode 100644 index 000000000..eb5bd6ceb --- /dev/null +++ b/none/tests/getdents_filter.vgtest @@ -0,0 +1,2 @@ +prog: getdents_filter +vgopts: -q From 18c5454874d9193fb422832523925406f1d32b80 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 24 Sep 2025 20:27:30 +0000 Subject: [PATCH 338/412] s390: Reorg and extend BFP "convert to/from fixed/logical" testcases Testing these insns was spread over 3 testcases: rounding-3, fpconv, and fpext. rounding-3 was testing "convert to fixed" with rounding per FPC. fpext was testing "convert to/from logical" with rounding per M3 field. fpconv was testing "convert to/from fixed" with rounding per M3 field. The new testcase bfp-convert replaces these 3. It removes the "convert from fixed/logical" testing because that is done in bfp-emit.pl. It consolidates end extends "convert to fixed/logical" testing from those files. Testing "convert to logical" has been commented out until the condition code weirdness for negative input values has been sorted. Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 --- .gitignore | 8 +- none/tests/s390x/Makefile.am | 8 +- none/tests/s390x/bfp-convert.c | 325 ++++++++ ...conv.stderr.exp => bfp-convert.stderr.exp} | 0 none/tests/s390x/bfp-convert.stdout.exp | 740 ++++++++++++++++++ none/tests/s390x/bfp-convert.vgtest | 2 + none/tests/s390x/fpconv.c | 119 --- none/tests/s390x/fpconv.stdout.exp | 94 --- none/tests/s390x/fpconv.vgtest | 1 - none/tests/s390x/fpext.c | 149 ---- none/tests/s390x/fpext.stderr.exp | 2 - none/tests/s390x/fpext.stdout.exp | 672 ---------------- none/tests/s390x/fpext.vgtest | 2 - none/tests/s390x/fpext_fail.c | 6 + none/tests/s390x/fpext_fail.vgtest | 4 +- none/tests/s390x/rounding-3.c | 113 --- none/tests/s390x/rounding-3.stderr.exp | 2 - none/tests/s390x/rounding-3.stdout.exp | 148 ---- none/tests/s390x/rounding-3.vgtest | 1 - 19 files changed, 1081 insertions(+), 1315 deletions(-) create mode 100644 none/tests/s390x/bfp-convert.c rename none/tests/s390x/{fpconv.stderr.exp => bfp-convert.stderr.exp} (100%) create mode 100644 none/tests/s390x/bfp-convert.stdout.exp create mode 100644 none/tests/s390x/bfp-convert.vgtest delete mode 100644 none/tests/s390x/fpconv.c delete mode 100644 none/tests/s390x/fpconv.stdout.exp delete mode 100644 none/tests/s390x/fpconv.vgtest delete mode 100644 none/tests/s390x/fpext.c delete mode 100644 none/tests/s390x/fpext.stderr.exp delete mode 100644 none/tests/s390x/fpext.stdout.exp delete mode 100644 none/tests/s390x/fpext.vgtest create mode 100644 none/tests/s390x/fpext_fail.c delete mode 100644 none/tests/s390x/rounding-3.c delete mode 100644 none/tests/s390x/rounding-3.stderr.exp delete mode 100644 none/tests/s390x/rounding-3.stdout.exp delete mode 100644 none/tests/s390x/rounding-3.vgtest diff --git a/.gitignore b/.gitignore index de362ecc2..b059789b8 100644 --- a/.gitignore +++ b/.gitignore @@ -2182,18 +2182,17 @@ /none/tests/s390x/cu14_1 /none/tests/s390x/cu41 /none/tests/s390x/ecag -/none/tests/s390x/fpext /none/tests/s390x/fpext_warn -/none/tests/s390x/fpconv +/none/tests/s390x/fpext_fail /none/tests/s390x/rounding-1 -/none/tests/s390x/rounding-2 -/none/tests/s390x/rounding-3 +/none/tests/s390x/rounding-6 /none/tests/s390x/bfp-arith /none/tests/s390x/bfp-load /none/tests/s390x/bfp-fpc /none/tests/s390x/bfp-tdc /none/tests/s390x/bfp-3 /none/tests/s390x/bfp-compare +/none/tests/s390x/bfp-convert /none/tests/s390x/comp-1 /none/tests/s390x/comp-2 /none/tests/s390x/ex @@ -2218,7 +2217,6 @@ /none/tests/s390x/spechelper-slgr /none/tests/s390x/spechelper-or /none/tests/s390x/spechelper-tm -/none/tests/s390x/rounding-6 /none/tests/s390x/laa /none/tests/s390x/dfp-1 /none/tests/s390x/dfp-2 diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 7d2d1f8c4..afa61c94b 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -8,8 +8,8 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ op_exception stck stckf stcke stfle cksm mvcl clcl troo \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ - ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \ - bfp-tdc bfp-load bfp-fpc rounding-1 rounding-3 bfp-arith \ + ex_sig ex_clone cu14 cu14_1 cu41 ecag fpext_warn fpext_fail \ + bfp-tdc bfp-load bfp-fpc bfp-convert rounding-1 bfp-arith \ bfp-3 bfp-compare comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ high-word traps \ @@ -22,7 +22,7 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ vector_float add-z14 sub-z14 mul-z14 bic \ misc3 vec2 vec2_float \ dfp-1 dfp-2 dfp-3 dfp-4 dfpconv dfpext dfptest pfpo srnmt \ - fpext hfp + hfp check_PROGRAMS = $(INSN_TESTS) \ allexec \ @@ -39,8 +39,6 @@ EXTRA_DIST = \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ ecag.stdout.exp-z16 \ op00.stderr.exp op00.vgtest \ - fpext.vgtest fpext.stderr.exp fpext.stdout.exp \ - fpext_fail.vgtest fpext_fail.stderr.exp fpext_fail.stdout.exp \ test.h opcodes.h add.h and.h div.h insert.h dfp_utils.h \ mul.h or.h sub.h xor.h table.h svc.h rounding.h \ dfp-1.stderr.exp dfp-1.stdout.exp dfp-1.vgtest \ diff --git a/none/tests/s390x/bfp-convert.c b/none/tests/s390x/bfp-convert.c new file mode 100644 index 000000000..1d0502e41 --- /dev/null +++ b/none/tests/s390x/bfp-convert.c @@ -0,0 +1,325 @@ +/* Test "convert to fixed" and "convert to logical" insns. + + We already know via bfp-emit.pl: + + Testing: cfebr %r0,0,%f1 + Frontend: cfebr %r0,0,%f1 + Assembly: cfebr %r5,0,%f7 + + Testing: celfbr %f0,0,%r1,0 + Frontend: celfbr %f0,0,%r1,0 + Assembly: celfbr %f7,0,%r4,0 + + So the only thing to test for here is the condition code. + + Note, no testing for "convert from ..." insns here, as they are + covered in bfd-emit.pl and do not set the condition code. +*/ +#include +#include +#include +#include +#include "rounding.h" + +#define convert_to_int(opcode,src_type,dst_type,round,value,fmt) \ + do { \ + src_type src = value; \ + dst_type dst; \ + unsigned cc; \ + \ + __asm__ volatile (opcode " %[dst]," #round ",%[src]\n\t" \ + "ipm %[cc]\n\t" \ + "srl %[cc],28\n\t" \ + : [dst]"=d"(dst), [cc]"=d"(cc) \ + : [src]"f"(src) \ + : "cc"); \ + \ + printf("%s "fmt"\tcc = %u\n", opcode, src, cc); \ + \ + __asm__ volatile (opcode "a %[dst]," #round ",%[src],0\n\t" \ + "ipm %[cc]\n\t" \ + "srl %[cc],28\n\t" \ + : [dst]"=d"(dst), [cc]"=d"(cc) \ + : [src]"f"(src) \ + : "cc"); \ + \ + printf("%sa "fmt"\tcc = %u\n", opcode, src, cc); \ +} while (0) + +#define convert_to_logical(opcode,src_type,dst_type,round,value,fmt) \ + do { \ + src_type src = value; \ + dst_type dst; \ + unsigned cc; \ + \ + __asm__ volatile (opcode " %[dst]," #round ",%[src], 0\n\t" \ + "ipm %[cc]\n\t" \ + "srl %[cc],28\n\t" \ + : [dst]"=d"(dst), [cc]"=d"(cc) \ + : [src]"f"(src) \ + : "cc"); \ + \ + printf("%s "fmt"\tcc = %u\n", opcode, src, cc); \ +} while (0) + +/* Convenience macros */ +#define cfebr(value,round) \ + convert_to_int("cfebr",float,int32_t,round,value,"%f") +#define cfdbr(value,round) \ + convert_to_int("cfdbr",double,int32_t,round,value,"%f") +#define cfxbr(value,round) \ + convert_to_int("cfxbr",long double,int32_t,round,value,"%Lf") +#define cgebr(value,round) \ + convert_to_int("cgebr",float,int64_t,round,value,"%f") +#define cgdbr(value,round) \ + convert_to_int("cgdbr",double,int64_t,round,value,"%f") +#define cgxbr(value,round) \ + convert_to_int("cgxbr",long double,int64_t,round,value,"%Lf") + +#define clfebr(value,round) \ + convert_to_logical("clfebr",float,uint32_t,round,value,"%f") +#define clfdbr(value,round) \ + convert_to_logical("clfdbr",double,uint32_t,round,value,"%f") +#define clfxbr(value,round) \ + convert_to_logical("clfxbr",long double,uint32_t,round,value,"%Lf") +#define clgebr(value,round) \ + convert_to_logical("clgebr",float,uint64_t,round,value,"%f") +#define clgdbr(value,round) \ + convert_to_logical("clgdbr",double,uint64_t,round,value,"%f") +#define clgxbr(value,round) \ + convert_to_logical("clgxbr",long double,uint64_t,round,value,"%Lf") + +#define convert_to_int_m3_tests(mode) \ + printf("...setting M3 rounding mode to %s\n", m3_rtext(mode)); \ + \ + /* f32 -> i32 */ \ + printf("......f32 -> i32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cfebr(values[j], mode); \ + \ + /* f32 -> i64 */ \ + printf("......f32 -> i64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cgebr(values[j], mode); \ + \ + /* f64 -> i32 */ \ + printf("......f64 -> i32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cfdbr(values[j], mode); \ + \ + /* f64 -> i64 */ \ + printf("......f64 -> i64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cgdbr(values[j], mode); \ + \ + /* f128 -> i32 */ \ + printf("......f128 -> i32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cfxbr(values[j], mode); \ + \ + /* f128 -> i64 */ \ + printf("......f128 -> i64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + cgxbr(values[j], mode); + +#define convert_to_logical_m3_tests(mode) \ + printf("...setting M3 rounding mode to %s\n", m3_rtext(mode)); \ + \ + /* f32 -> u32 */ \ + printf("......f32 -> u32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clfebr(values[j], mode); \ + \ + /* f32 -> u64 */ \ + printf("......f32 -> u64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clgebr(values[j], mode); \ + \ + /* f64 -> u32 */ \ + printf("......f64 -> u32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clfdbr(values[j], mode); \ + \ + /* f64 -> u64 */ \ + printf("......f64 -> u64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clgdbr(values[j], mode); \ + \ + /* f128 -> u32 */ \ + printf("......f128 -> u32\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clfxbr(values[j], mode); \ + \ + /* f128 -> u64 */ \ + printf("......f128 -> u64\n"); \ + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \ + clgxbr(values[j], mode); + +static void +set_rounding_mode(unsigned mode) +{ + __asm__ volatile ("sfpc %[r1]" : : [r1]"d"(mode)); +} + +static const char * +fpc_rtext(unsigned fpc_round) +{ + switch (fpc_round) { + case FPC_BFP_ROUND_NEAREST_EVEN: return "[-> near]"; + case FPC_BFP_ROUND_ZERO: return "[-> zero]"; + case FPC_BFP_ROUND_POSINF: return "[-> +inf]"; + case FPC_BFP_ROUND_NEGINF: return "[-> -inf]"; + case FPC_BFP_ROUND_PREPARE_SHORT: return "[-> prepare-short]"; + } + assert(0); +} + +static const char * +m3_rtext(unsigned m3_round) +{ + switch (m3_round) { + case M3_BFP_ROUND_PER_FPC: return "[per fpc]"; + case M3_BFP_ROUND_NEAREST_AWAY: return "[-> near away]"; + case M3_BFP_ROUND_PREPARE_SHORT: return "[-> prepare-short]"; + case M3_BFP_ROUND_NEAREST_EVEN: return "[-> near away]"; + case M3_BFP_ROUND_ZERO: return "[-> zero]"; + case M3_BFP_ROUND_POSINF: return "[-> +inf]"; + case M3_BFP_ROUND_NEGINF: return "[-> -inf]"; + } + assert(0); +} + +/* Can be converted to 64-bit and 128-bit values without issues. */ +static const float values[] = { + 0.0f, -1.0f, 2.0f, NAN, INFINITY +}; + +static void +convert_to_int_fpc_tests(unsigned mode) +{ + set_rounding_mode(mode); + + /* f32 -> i32 */ + printf("......f32 -> i32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cfebr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f32 -> i64 */ + printf("......f32 -> i64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cgebr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f64 -> i32 */ + printf("......f64 -> i32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cfdbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f64 -> i64 */ + printf("......f64 -> i64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cgdbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f128 -> i32 */ + printf("......f128 -> i32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cfxbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f128 -> i64 */ + printf("......f128 -> i64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + cgxbr(values[j], M3_BFP_ROUND_PER_FPC); +} + +#if 0 +static void +convert_to_logical_fpc_tests(unsigned mode) +{ + set_rounding_mode(mode); + + /* f32 -> u32 */ + printf("......f32 -> u32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clfebr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f32 -> u64 */ + printf("......f32 -> u64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clgebr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f64 -> u32 */ + printf("......f64 -> u32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clfdbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f64 -> u64 */ + printf("......f64 -> u64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clgdbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f128 -> u32 */ + printf("......f128 -> u32\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clfxbr(values[j], M3_BFP_ROUND_PER_FPC); + + /* f128 -> u64 */ + printf("......f128 -> u64\n"); + for (int j = 0; j < sizeof values / sizeof values[0]; ++j) + clgxbr(values[j], M3_BFP_ROUND_PER_FPC); +} +#endif + +int +main(void) +{ + assert(sizeof(long double) == 16); + + static const unsigned fpc_rmodes[] = { + FPC_BFP_ROUND_NEAREST_EVEN, + FPC_BFP_ROUND_ZERO, + FPC_BFP_ROUND_POSINF, + FPC_BFP_ROUND_NEGINF, + FPC_BFP_ROUND_PREPARE_SHORT + }; + + //---------------------------------------------------------- + // Convert to int + //---------------------------------------------------------- + printf("============ Convert to int =============\n"); + printf("Rounding as 'per FPC'\n"); + for (int i = 0; i < sizeof fpc_rmodes / sizeof fpc_rmodes[0]; ++i) { + printf("...setting FPC rounding mode to %s\n", fpc_rtext(fpc_rmodes[i])); + convert_to_int_fpc_tests(fpc_rmodes[i]); + } + + printf("Rounding as 'per M3'\n"); + convert_to_int_m3_tests(1); // M3_BFP_ROUND_NEAREST_AWAY + convert_to_int_m3_tests(3); // M3_BFP_ROUND_PREPARE_SHORT + convert_to_int_m3_tests(4); // M3_BFP_ROUND_NEAREST_EVEN + convert_to_int_m3_tests(5); // M3_BFP_ROUND_ZERO + convert_to_int_m3_tests(6); // M3_BFP_ROUND_POSINF + convert_to_int_m3_tests(7); // M3_BFP_ROUND_NEGINF + + //---------------------------------------------------------- + // Convert to logical + //---------------------------------------------------------- +#if 0 + /* Disabled until condition code weirdness has been cleared up. + Negative floating point number --> cc = 3. Seems wrong to me. */ + putchar('\n'); + printf("============ Convert to logical =============\n"); + printf("Rounding as 'per FPC'\n"); + for (int i = 0; i < sizeof fpc_rmodes / sizeof fpc_rmodes[0]; ++i) { + printf("...setting FPC rounding mode to %s\n", fpc_rtext(fpc_rmodes[i])); + convert_to_logical_fpc_tests(fpc_rmodes[i]); + } + + printf("Rounding as 'per M3'\n"); + convert_to_logical_m3_tests(1); // M3_BFP_ROUND_NEAREST_AWAY + convert_to_logical_m3_tests(3); // M3_BFP_ROUND_PREPARE_SHORT + convert_to_logical_m3_tests(4); // M3_BFP_ROUND_NEAREST_EVEN + convert_to_logical_m3_tests(5); // M3_BFP_ROUND_ZERO + convert_to_logical_m3_tests(6); // M3_BFP_ROUND_POSINF + convert_to_logical_m3_tests(7); // M3_BFP_ROUND_NEGINF +#endif + return 0; +} diff --git a/none/tests/s390x/fpconv.stderr.exp b/none/tests/s390x/bfp-convert.stderr.exp similarity index 100% rename from none/tests/s390x/fpconv.stderr.exp rename to none/tests/s390x/bfp-convert.stderr.exp diff --git a/none/tests/s390x/bfp-convert.stdout.exp b/none/tests/s390x/bfp-convert.stdout.exp new file mode 100644 index 000000000..c5a17ebd4 --- /dev/null +++ b/none/tests/s390x/bfp-convert.stdout.exp @@ -0,0 +1,740 @@ +============ Convert to int ============= +Rounding as 'per FPC' +...setting FPC rounding mode to [-> near] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting FPC rounding mode to [-> zero] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting FPC rounding mode to [-> +inf] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting FPC rounding mode to [-> -inf] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting FPC rounding mode to [-> prepare-short] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +Rounding as 'per M3' +...setting M3 rounding mode to [-> near away] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting M3 rounding mode to [-> prepare-short] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting M3 rounding mode to [-> near away] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting M3 rounding mode to [-> zero] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting M3 rounding mode to [-> +inf] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 +...setting M3 rounding mode to [-> -inf] +......f32 -> i32 +cfebr 0.000000 cc = 0 +cfebra 0.000000 cc = 0 +cfebr -1.000000 cc = 1 +cfebra -1.000000 cc = 1 +cfebr 2.000000 cc = 2 +cfebra 2.000000 cc = 2 +cfebr nan cc = 3 +cfebra nan cc = 3 +cfebr inf cc = 3 +cfebra inf cc = 3 +......f32 -> i64 +cgebr 0.000000 cc = 0 +cgebra 0.000000 cc = 0 +cgebr -1.000000 cc = 1 +cgebra -1.000000 cc = 1 +cgebr 2.000000 cc = 2 +cgebra 2.000000 cc = 2 +cgebr nan cc = 3 +cgebra nan cc = 3 +cgebr inf cc = 3 +cgebra inf cc = 3 +......f64 -> i32 +cfdbr 0.000000 cc = 0 +cfdbra 0.000000 cc = 0 +cfdbr -1.000000 cc = 1 +cfdbra -1.000000 cc = 1 +cfdbr 2.000000 cc = 2 +cfdbra 2.000000 cc = 2 +cfdbr nan cc = 3 +cfdbra nan cc = 3 +cfdbr inf cc = 3 +cfdbra inf cc = 3 +......f64 -> i64 +cgdbr 0.000000 cc = 0 +cgdbra 0.000000 cc = 0 +cgdbr -1.000000 cc = 1 +cgdbra -1.000000 cc = 1 +cgdbr 2.000000 cc = 2 +cgdbra 2.000000 cc = 2 +cgdbr nan cc = 3 +cgdbra nan cc = 3 +cgdbr inf cc = 3 +cgdbra inf cc = 3 +......f128 -> i32 +cfxbr 0.000000 cc = 0 +cfxbra 0.000000 cc = 0 +cfxbr -1.000000 cc = 1 +cfxbra -1.000000 cc = 1 +cfxbr 2.000000 cc = 2 +cfxbra 2.000000 cc = 2 +cfxbr nan cc = 3 +cfxbra nan cc = 3 +cfxbr inf cc = 3 +cfxbra inf cc = 3 +......f128 -> i64 +cgxbr 0.000000 cc = 0 +cgxbra 0.000000 cc = 0 +cgxbr -1.000000 cc = 1 +cgxbra -1.000000 cc = 1 +cgxbr 2.000000 cc = 2 +cgxbra 2.000000 cc = 2 +cgxbr nan cc = 3 +cgxbra nan cc = 3 +cgxbr inf cc = 3 +cgxbra inf cc = 3 diff --git a/none/tests/s390x/bfp-convert.vgtest b/none/tests/s390x/bfp-convert.vgtest new file mode 100644 index 000000000..11cd11c52 --- /dev/null +++ b/none/tests/s390x/bfp-convert.vgtest @@ -0,0 +1,2 @@ +prog: bfp-convert +prereq: ../../../tests/s390x_features s390x-fpext diff --git a/none/tests/s390x/fpconv.c b/none/tests/s390x/fpconv.c deleted file mode 100644 index 02b5128e7..000000000 --- a/none/tests/s390x/fpconv.c +++ /dev/null @@ -1,119 +0,0 @@ -#include -#include -#include -#include -#include - -/* The following opcodes are tested: - - Convert to fixed: cfebr, cgebr, cfdbr, cgdbr - Convert from fixed: cefbr, cdfbr, cegbr, cdgbr - - We do not test rounding here. Just making sure the insn selector - picks the correct insn. -*/ - -#define I2F(insn, initial, target_type) \ -do { \ - int64_t source = initial; \ - target_type target; \ - asm volatile(insn " %0,%1\n\t" :"=f" (target) :"d"(source)); \ - printf(insn " %"PRId64" -> %f\n", source, target); \ -} while (0) - -#define DO_INSN_I32_TO_F(insn, target_type) \ -do { \ - printf("\n----- int32_t -> " #target_type "\n");\ - I2F(insn, 0, target_type); \ - I2F(insn, 1, target_type); \ - I2F(insn, -1, target_type); \ - I2F(insn, 42, target_type); \ - I2F(insn, SHRT_MAX, target_type); \ - I2F(insn, SHRT_MIN, target_type); \ - I2F(insn, INT_MAX, target_type); \ - I2F(insn, INT_MIN, target_type); \ -} while (0) - -#define DO_INSN_I64_TO_F(insn, target_type) \ -do { \ - printf("\n----- int64_t -> " #target_type "\n");\ - I2F(insn, 0, target_type); \ - I2F(insn, 1, target_type); \ - I2F(insn, -1, target_type); \ - I2F(insn, 42, target_type); \ - I2F(insn, SHRT_MAX, target_type); \ - I2F(insn, SHRT_MIN, target_type); \ - I2F(insn, INT_MAX, target_type); \ - I2F(insn, INT_MIN, target_type); \ - I2F(insn, LONG_MAX, target_type); \ - I2F(insn, LONG_MIN, target_type); \ -} while (0) - -#define DO_I2F() \ -do { \ - DO_INSN_I32_TO_F("cefbr", float); \ - DO_INSN_I32_TO_F("cdfbr", double); \ - DO_INSN_I64_TO_F("cegbr", float); \ - DO_INSN_I64_TO_F("cdgbr", double); \ -} while (0) - - -#define F2I(insn, initial, source_type, target_type) \ -do { \ - int cc; \ - source_type source = initial; \ - target_type target = 0; \ - asm volatile(insn " %0,0,%2\n\t" \ - "ipm %1\n\t" \ - "srl %1,28\n\t" \ - : "=d" (target), "=d" (cc) : "f"(source) : "cc"); \ - printf(insn " %f -> %ld cc = %d\n", source, (long)target, cc); \ -} while (0) - -#define DO_INSN_F32_TO_I(insn, type) \ -do { \ - printf("\n----- float -> " #type "\n"); \ - F2I(insn, -1.0f, float, type); \ - F2I(insn, 0.0f, float, type); \ - F2I(insn, 1.0f, float, type); \ - F2I(insn, 1.4f, float, type); \ - F2I(insn, 1.5f, float, type); \ - F2I(insn, 1.6f, float, type); \ - F2I(insn, 1.6E+4f, float, type); \ - F2I(insn, 1.6E+8f, float, type); \ - F2I(insn, 1.6E-4f, float, type); \ - F2I(insn, FLT_MAX, float, type); \ -} while (0) - -#define DO_INSN_F64_TO_I(insn, type) \ -do { \ - printf("\n----- double -> " #type "\n"); \ - F2I(insn, -1.0, double, type); \ - F2I(insn, 0.0, double, type); \ - F2I(insn, 1.0, double, type); \ - F2I(insn, 1.4, double, type); \ - F2I(insn, 1.5, double, type); \ - F2I(insn, 1.6, double, type); \ - F2I(insn, 1.6E+4, double, type); \ - F2I(insn, 1.6E+8, double, type); \ - F2I(insn, 1.6E-4, double, type); \ - F2I(insn, FLT_MAX, double, type); \ - F2I(insn, DBL_MAX, double, type); \ -} while (0) - -#define DO_F2I() \ -do { \ - DO_INSN_F32_TO_I("cfebr", int32_t); \ - DO_INSN_F32_TO_I("cgebr", int64_t); \ - DO_INSN_F64_TO_I("cfdbr", int32_t); \ - DO_INSN_F64_TO_I("cgdbr", int64_t); \ -} while (0) - - -int main() -{ - DO_I2F(); - DO_F2I(); - - return 0; -} diff --git a/none/tests/s390x/fpconv.stdout.exp b/none/tests/s390x/fpconv.stdout.exp deleted file mode 100644 index 779655e13..000000000 --- a/none/tests/s390x/fpconv.stdout.exp +++ /dev/null @@ -1,94 +0,0 @@ - ------ int32_t -> float -cefbr 0 -> 0.000000 -cefbr 1 -> 1.000000 -cefbr -1 -> -1.000000 -cefbr 42 -> 42.000000 -cefbr 32767 -> 32767.000000 -cefbr -32768 -> -32768.000000 -cefbr 2147483647 -> 2147483648.000000 -cefbr -2147483648 -> -2147483648.000000 - ------ int32_t -> double -cdfbr 0 -> 0.000000 -cdfbr 1 -> 1.000000 -cdfbr -1 -> -1.000000 -cdfbr 42 -> 42.000000 -cdfbr 32767 -> 32767.000000 -cdfbr -32768 -> -32768.000000 -cdfbr 2147483647 -> 2147483647.000000 -cdfbr -2147483648 -> -2147483648.000000 - ------ int64_t -> float -cegbr 0 -> 0.000000 -cegbr 1 -> 1.000000 -cegbr -1 -> -1.000000 -cegbr 42 -> 42.000000 -cegbr 32767 -> 32767.000000 -cegbr -32768 -> -32768.000000 -cegbr 2147483647 -> 2147483648.000000 -cegbr -2147483648 -> -2147483648.000000 -cegbr 9223372036854775807 -> 9223372036854775808.000000 -cegbr -9223372036854775808 -> -9223372036854775808.000000 - ------ int64_t -> double -cdgbr 0 -> 0.000000 -cdgbr 1 -> 1.000000 -cdgbr -1 -> -1.000000 -cdgbr 42 -> 42.000000 -cdgbr 32767 -> 32767.000000 -cdgbr -32768 -> -32768.000000 -cdgbr 2147483647 -> 2147483647.000000 -cdgbr -2147483648 -> -2147483648.000000 -cdgbr 9223372036854775807 -> 9223372036854775808.000000 -cdgbr -9223372036854775808 -> -9223372036854775808.000000 - ------ float -> int32_t -cfebr -1.000000 -> -1 cc = 1 -cfebr 0.000000 -> 0 cc = 0 -cfebr 1.000000 -> 1 cc = 2 -cfebr 1.400000 -> 1 cc = 2 -cfebr 1.500000 -> 2 cc = 2 -cfebr 1.600000 -> 2 cc = 2 -cfebr 16000.000000 -> 16000 cc = 2 -cfebr 160000000.000000 -> 160000000 cc = 2 -cfebr 0.000160 -> 0 cc = 2 -cfebr 340282346638528859811704183484516925440.000000 -> 2147483647 cc = 3 - ------ float -> int64_t -cgebr -1.000000 -> -1 cc = 1 -cgebr 0.000000 -> 0 cc = 0 -cgebr 1.000000 -> 1 cc = 2 -cgebr 1.400000 -> 1 cc = 2 -cgebr 1.500000 -> 2 cc = 2 -cgebr 1.600000 -> 2 cc = 2 -cgebr 16000.000000 -> 16000 cc = 2 -cgebr 160000000.000000 -> 160000000 cc = 2 -cgebr 0.000160 -> 0 cc = 2 -cgebr 340282346638528859811704183484516925440.000000 -> 9223372036854775807 cc = 3 - ------ double -> int32_t -cfdbr -1.000000 -> -1 cc = 1 -cfdbr 0.000000 -> 0 cc = 0 -cfdbr 1.000000 -> 1 cc = 2 -cfdbr 1.400000 -> 1 cc = 2 -cfdbr 1.500000 -> 2 cc = 2 -cfdbr 1.600000 -> 2 cc = 2 -cfdbr 16000.000000 -> 16000 cc = 2 -cfdbr 160000000.000000 -> 160000000 cc = 2 -cfdbr 0.000160 -> 0 cc = 2 -cfdbr 340282346638528859811704183484516925440.000000 -> 2147483647 cc = 3 -cfdbr 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 -> 2147483647 cc = 3 - ------ double -> int64_t -cgdbr -1.000000 -> -1 cc = 1 -cgdbr 0.000000 -> 0 cc = 0 -cgdbr 1.000000 -> 1 cc = 2 -cgdbr 1.400000 -> 1 cc = 2 -cgdbr 1.500000 -> 2 cc = 2 -cgdbr 1.600000 -> 2 cc = 2 -cgdbr 16000.000000 -> 16000 cc = 2 -cgdbr 160000000.000000 -> 160000000 cc = 2 -cgdbr 0.000160 -> 0 cc = 2 -cgdbr 340282346638528859811704183484516925440.000000 -> 9223372036854775807 cc = 3 -cgdbr 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 -> 9223372036854775807 cc = 3 diff --git a/none/tests/s390x/fpconv.vgtest b/none/tests/s390x/fpconv.vgtest deleted file mode 100644 index e2e3c2872..000000000 --- a/none/tests/s390x/fpconv.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: fpconv diff --git a/none/tests/s390x/fpext.c b/none/tests/s390x/fpext.c deleted file mode 100644 index 62b6bb7f2..000000000 --- a/none/tests/s390x/fpext.c +++ /dev/null @@ -1,149 +0,0 @@ -#include -#include -#include -#include "opcodes.h" - - -#define L2F(insn, initial, target,round) \ -({ \ - register unsigned long source asm("2") = initial; \ - register typeof(target) _t asm("f0"); \ - asm volatile(insn(round,0,0,2) :"=f" (_t):"d"(source)); \ - _t; \ -}) - -#define F2L(insn, initial, type, round, cc) \ -({ \ - register type source asm("f0") = initial; \ - register unsigned long target asm ("2") = 0; \ - asm volatile(insn(round,0,2,0) \ - "ipm %1\n\t" \ - "srl %1,28\n\t" \ - :"=d" (target), "=d" (cc) :"f"(source):"cc"); \ - target; \ -}) - - -#define DO_INSN_L2F32(insn, round) \ -({ \ - float f32; \ - printf(#insn " %f\n", L2F(insn, 0, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 1, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0xffffffffUL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0x80000000UL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0x7fffffffUL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0x100000000UL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0xffffffffffffffffUL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0x8000000000000000UL, f32, round)); \ - printf(#insn " %f\n", L2F(insn, 0x7fffffffffffffffUL, f32, round)); \ -}) - -#define DO_INSN_L2F64(insn, round) \ -({ \ - double f64; \ - printf(#insn " %f\n", L2F(insn, 0, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 1, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0xffffffffUL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0x80000000UL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0x7fffffffUL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0x100000000UL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0xffffffffffffffffUL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0x8000000000000000UL, f64, round)); \ - printf(#insn " %f\n", L2F(insn, 0x7fffffffffffffffUL, f64, round)); \ -}) - -#define DO_INSN_L2F128(insn, round) \ -({ \ - long double f128; \ - printf(#insn " %Lf\n", L2F(insn, 0, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 1, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0xffffffffUL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0x80000000UL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0x7fffffffUL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0x100000000UL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0xffffffffffffffffUL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0x8000000000000000UL, f128, round)); \ - printf(#insn " %Lf\n", L2F(insn, 0x7fffffffffffffffUL, f128, round)); \ -}) - -#define DO_INSN_F2L(insn, round, type) \ -({ \ - int cc; \ - printf(#insn " %lu ", F2L(insn, -1.1, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 0, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.4, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.5, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+4, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+8, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+12, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+20, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+200, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E+2000L, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, 1.6E-4, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, FLT_MIN, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, FLT_MAX, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, DBL_MIN, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, DBL_MAX, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, LDBL_MIN, type, round, cc)); \ - printf("cc=%d\n", cc); \ - printf(#insn " %lu ", F2L(insn, LDBL_MAX, type, round, cc)); \ - printf("cc=%d\n", cc); \ -}) - -#define DO_L2F(round) \ -({ \ - DO_INSN_L2F32(CELFBR, round); \ - DO_INSN_L2F32(CELGBR, round); \ - DO_INSN_L2F64(CDLFBR, round); \ - DO_INSN_L2F64(CDLGBR, round); \ - DO_INSN_L2F128(CXLFBR, round); \ - DO_INSN_L2F128(CXLGBR, round); \ -}) - -#define DO_F2L(round) \ -({ \ - DO_INSN_F2L(CLFEBR, round, float); \ - DO_INSN_F2L(CLGEBR, round, float); \ - DO_INSN_F2L(CLFDBR, round, double); \ - DO_INSN_F2L(CLGDBR, round, double); \ - DO_INSN_F2L(CLFXBR, round, long double); \ - DO_INSN_F2L(CLGXBR, round, long double); \ -}) - - -int main() -{ - assert(sizeof(long double) == 16); - DO_L2F(4); - DO_F2L(4); - - DO_L2F(5); - DO_F2L(5); - - DO_L2F(6); - DO_F2L(6); - - DO_L2F(7); - DO_F2L(7); - - return 0; -} diff --git a/none/tests/s390x/fpext.stderr.exp b/none/tests/s390x/fpext.stderr.exp deleted file mode 100644 index 139597f9c..000000000 --- a/none/tests/s390x/fpext.stderr.exp +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/fpext.stdout.exp b/none/tests/s390x/fpext.stdout.exp deleted file mode 100644 index 48fbda0c4..000000000 --- a/none/tests/s390x/fpext.stdout.exp +++ /dev/null @@ -1,672 +0,0 @@ -CELFBR 0.000000 -CELFBR 1.000000 -CELFBR 4294967296.000000 -CELFBR 2147483648.000000 -CELFBR 2147483648.000000 -CELFBR 0.000000 -CELFBR 4294967296.000000 -CELFBR 0.000000 -CELFBR 4294967296.000000 -CELGBR 0.000000 -CELGBR 1.000000 -CELGBR 4294967296.000000 -CELGBR 2147483648.000000 -CELGBR 2147483648.000000 -CELGBR 4294967296.000000 -CELGBR 18446744073709551616.000000 -CELGBR 9223372036854775808.000000 -CELGBR 9223372036854775808.000000 -CDLFBR 0.000000 -CDLFBR 1.000000 -CDLFBR 4294967295.000000 -CDLFBR 2147483648.000000 -CDLFBR 2147483647.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLGBR 0.000000 -CDLGBR 1.000000 -CDLGBR 4294967295.000000 -CDLGBR 2147483648.000000 -CDLGBR 2147483647.000000 -CDLGBR 4294967296.000000 -CDLGBR 18446744073709551616.000000 -CDLGBR 9223372036854775808.000000 -CDLGBR 9223372036854775808.000000 -CXLFBR 0.000000 -CXLFBR 1.000000 -CXLFBR 4294967295.000000 -CXLFBR 2147483648.000000 -CXLFBR 2147483647.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLGBR 0.000000 -CXLGBR 1.000000 -CXLGBR 4294967295.000000 -CXLGBR 2147483648.000000 -CXLGBR 2147483647.000000 -CXLGBR 4294967296.000000 -CXLGBR 18446744073709551615.000000 -CXLGBR 9223372036854775808.000000 -CXLGBR 9223372036854775807.000000 -CLFEBR 0 cc=3 -CLFEBR 0 cc=0 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 2 cc=2 -CLFEBR 2 cc=2 -CLFEBR 16000 cc=2 -CLFEBR 160000000 cc=2 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=2 -CLFEBR 0 cc=2 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=0 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=0 -CLFEBR 4294967295 cc=3 -CLGEBR 0 cc=3 -CLGEBR 0 cc=0 -CLGEBR 1 cc=2 -CLGEBR 1 cc=2 -CLGEBR 2 cc=2 -CLGEBR 2 cc=2 -CLGEBR 16000 cc=2 -CLGEBR 160000000 cc=2 -CLGEBR 1599999967232 cc=2 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=2 -CLGEBR 0 cc=2 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=0 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=0 -CLGEBR 18446744073709551615 cc=3 -CLFDBR 0 cc=3 -CLFDBR 0 cc=0 -CLFDBR 1 cc=2 -CLFDBR 1 cc=2 -CLFDBR 2 cc=2 -CLFDBR 2 cc=2 -CLFDBR 16000 cc=2 -CLFDBR 160000000 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=2 -CLFDBR 0 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=0 -CLFDBR 4294967295 cc=3 -CLGDBR 0 cc=3 -CLGDBR 0 cc=0 -CLGDBR 1 cc=2 -CLGDBR 1 cc=2 -CLGDBR 2 cc=2 -CLGDBR 2 cc=2 -CLGDBR 16000 cc=2 -CLGDBR 160000000 cc=2 -CLGDBR 1600000000000 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=2 -CLGDBR 0 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=0 -CLGDBR 18446744073709551615 cc=3 -CLFXBR 0 cc=3 -CLFXBR 0 cc=0 -CLFXBR 1 cc=2 -CLFXBR 1 cc=2 -CLFXBR 2 cc=2 -CLFXBR 2 cc=2 -CLFXBR 16000 cc=2 -CLFXBR 160000000 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLGXBR 0 cc=3 -CLGXBR 0 cc=0 -CLGXBR 1 cc=2 -CLGXBR 1 cc=2 -CLGXBR 2 cc=2 -CLGXBR 2 cc=2 -CLGXBR 16000 cc=2 -CLGXBR 160000000 cc=2 -CLGXBR 1600000000000 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 -CELFBR 0.000000 -CELFBR 1.000000 -CELFBR 4294967040.000000 -CELFBR 2147483648.000000 -CELFBR 2147483520.000000 -CELFBR 0.000000 -CELFBR 4294967040.000000 -CELFBR 0.000000 -CELFBR 4294967040.000000 -CELGBR 0.000000 -CELGBR 1.000000 -CELGBR 4294967040.000000 -CELGBR 2147483648.000000 -CELGBR 2147483520.000000 -CELGBR 4294967296.000000 -CELGBR 18446742974197923840.000000 -CELGBR 9223372036854775808.000000 -CELGBR 9223371487098961920.000000 -CDLFBR 0.000000 -CDLFBR 1.000000 -CDLFBR 4294967295.000000 -CDLFBR 2147483648.000000 -CDLFBR 2147483647.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLGBR 0.000000 -CDLGBR 1.000000 -CDLGBR 4294967295.000000 -CDLGBR 2147483648.000000 -CDLGBR 2147483647.000000 -CDLGBR 4294967296.000000 -CDLGBR 18446744073709549568.000000 -CDLGBR 9223372036854775808.000000 -CDLGBR 9223372036854774784.000000 -CXLFBR 0.000000 -CXLFBR 1.000000 -CXLFBR 4294967295.000000 -CXLFBR 2147483648.000000 -CXLFBR 2147483647.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLGBR 0.000000 -CXLGBR 1.000000 -CXLGBR 4294967295.000000 -CXLGBR 2147483648.000000 -CXLGBR 2147483647.000000 -CXLGBR 4294967296.000000 -CXLGBR 18446744073709551615.000000 -CXLGBR 9223372036854775808.000000 -CXLGBR 9223372036854775807.000000 -CLFEBR 0 cc=3 -CLFEBR 0 cc=0 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 16000 cc=2 -CLFEBR 160000000 cc=2 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=2 -CLFEBR 0 cc=2 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=0 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=0 -CLFEBR 4294967295 cc=3 -CLGEBR 0 cc=3 -CLGEBR 0 cc=0 -CLGEBR 1 cc=2 -CLGEBR 1 cc=2 -CLGEBR 1 cc=2 -CLGEBR 1 cc=2 -CLGEBR 16000 cc=2 -CLGEBR 160000000 cc=2 -CLGEBR 1599999967232 cc=2 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=2 -CLGEBR 0 cc=2 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=0 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=0 -CLGEBR 18446744073709551615 cc=3 -CLFDBR 0 cc=3 -CLFDBR 0 cc=0 -CLFDBR 1 cc=2 -CLFDBR 1 cc=2 -CLFDBR 1 cc=2 -CLFDBR 1 cc=2 -CLFDBR 16000 cc=2 -CLFDBR 160000000 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=2 -CLFDBR 0 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=0 -CLFDBR 4294967295 cc=3 -CLGDBR 0 cc=3 -CLGDBR 0 cc=0 -CLGDBR 1 cc=2 -CLGDBR 1 cc=2 -CLGDBR 1 cc=2 -CLGDBR 1 cc=2 -CLGDBR 16000 cc=2 -CLGDBR 160000000 cc=2 -CLGDBR 1600000000000 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=2 -CLGDBR 0 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=0 -CLGDBR 18446744073709551615 cc=3 -CLFXBR 0 cc=3 -CLFXBR 0 cc=0 -CLFXBR 1 cc=2 -CLFXBR 1 cc=2 -CLFXBR 1 cc=2 -CLFXBR 1 cc=2 -CLFXBR 16000 cc=2 -CLFXBR 160000000 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLGXBR 0 cc=3 -CLGXBR 0 cc=0 -CLGXBR 1 cc=2 -CLGXBR 1 cc=2 -CLGXBR 1 cc=2 -CLGXBR 1 cc=2 -CLGXBR 16000 cc=2 -CLGXBR 160000000 cc=2 -CLGXBR 1600000000000 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 -CELFBR 0.000000 -CELFBR 1.000000 -CELFBR 4294967296.000000 -CELFBR 2147483648.000000 -CELFBR 2147483648.000000 -CELFBR 0.000000 -CELFBR 4294967296.000000 -CELFBR 0.000000 -CELFBR 4294967296.000000 -CELGBR 0.000000 -CELGBR 1.000000 -CELGBR 4294967296.000000 -CELGBR 2147483648.000000 -CELGBR 2147483648.000000 -CELGBR 4294967296.000000 -CELGBR 18446744073709551616.000000 -CELGBR 9223372036854775808.000000 -CELGBR 9223372036854775808.000000 -CDLFBR 0.000000 -CDLFBR 1.000000 -CDLFBR 4294967295.000000 -CDLFBR 2147483648.000000 -CDLFBR 2147483647.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLGBR 0.000000 -CDLGBR 1.000000 -CDLGBR 4294967295.000000 -CDLGBR 2147483648.000000 -CDLGBR 2147483647.000000 -CDLGBR 4294967296.000000 -CDLGBR 18446744073709551616.000000 -CDLGBR 9223372036854775808.000000 -CDLGBR 9223372036854775808.000000 -CXLFBR 0.000000 -CXLFBR 1.000000 -CXLFBR 4294967295.000000 -CXLFBR 2147483648.000000 -CXLFBR 2147483647.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLGBR 0.000000 -CXLGBR 1.000000 -CXLGBR 4294967295.000000 -CXLGBR 2147483648.000000 -CXLGBR 2147483647.000000 -CXLGBR 4294967296.000000 -CXLGBR 18446744073709551615.000000 -CXLGBR 9223372036854775808.000000 -CXLGBR 9223372036854775807.000000 -CLFEBR 0 cc=3 -CLFEBR 0 cc=0 -CLFEBR 1 cc=2 -CLFEBR 2 cc=2 -CLFEBR 2 cc=2 -CLFEBR 2 cc=2 -CLFEBR 16000 cc=2 -CLFEBR 160000000 cc=2 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=0 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=0 -CLFEBR 4294967295 cc=3 -CLGEBR 0 cc=3 -CLGEBR 0 cc=0 -CLGEBR 1 cc=2 -CLGEBR 2 cc=2 -CLGEBR 2 cc=2 -CLGEBR 2 cc=2 -CLGEBR 16000 cc=2 -CLGEBR 160000000 cc=2 -CLGEBR 1599999967232 cc=2 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 1 cc=2 -CLGEBR 1 cc=2 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=0 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=0 -CLGEBR 18446744073709551615 cc=3 -CLFDBR 0 cc=3 -CLFDBR 0 cc=0 -CLFDBR 1 cc=2 -CLFDBR 2 cc=2 -CLFDBR 2 cc=2 -CLFDBR 2 cc=2 -CLFDBR 16000 cc=2 -CLFDBR 160000000 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 1 cc=2 -CLFDBR 1 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 1 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=0 -CLFDBR 4294967295 cc=3 -CLGDBR 0 cc=3 -CLGDBR 0 cc=0 -CLGDBR 1 cc=2 -CLGDBR 2 cc=2 -CLGDBR 2 cc=2 -CLGDBR 2 cc=2 -CLGDBR 16000 cc=2 -CLGDBR 160000000 cc=2 -CLGDBR 1600000000000 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 1 cc=2 -CLGDBR 1 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 1 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=0 -CLGDBR 18446744073709551615 cc=3 -CLFXBR 0 cc=3 -CLFXBR 0 cc=0 -CLFXBR 1 cc=2 -CLFXBR 2 cc=2 -CLFXBR 2 cc=2 -CLFXBR 2 cc=2 -CLFXBR 16000 cc=2 -CLFXBR 160000000 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 1 cc=2 -CLFXBR 1 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 1 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 1 cc=2 -CLFXBR 4294967295 cc=3 -CLGXBR 0 cc=3 -CLGXBR 0 cc=0 -CLGXBR 1 cc=2 -CLGXBR 2 cc=2 -CLGXBR 2 cc=2 -CLGXBR 2 cc=2 -CLGXBR 16000 cc=2 -CLGXBR 160000000 cc=2 -CLGXBR 1600000000000 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 1 cc=2 -CLGXBR 1 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 1 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 1 cc=2 -CLGXBR 18446744073709551615 cc=3 -CELFBR 0.000000 -CELFBR 1.000000 -CELFBR 4294967040.000000 -CELFBR 2147483648.000000 -CELFBR 2147483520.000000 -CELFBR 0.000000 -CELFBR 4294967040.000000 -CELFBR 0.000000 -CELFBR 4294967040.000000 -CELGBR 0.000000 -CELGBR 1.000000 -CELGBR 4294967040.000000 -CELGBR 2147483648.000000 -CELGBR 2147483520.000000 -CELGBR 4294967296.000000 -CELGBR 18446742974197923840.000000 -CELGBR 9223372036854775808.000000 -CELGBR 9223371487098961920.000000 -CDLFBR 0.000000 -CDLFBR 1.000000 -CDLFBR 4294967295.000000 -CDLFBR 2147483648.000000 -CDLFBR 2147483647.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLFBR 0.000000 -CDLFBR 4294967295.000000 -CDLGBR 0.000000 -CDLGBR 1.000000 -CDLGBR 4294967295.000000 -CDLGBR 2147483648.000000 -CDLGBR 2147483647.000000 -CDLGBR 4294967296.000000 -CDLGBR 18446744073709549568.000000 -CDLGBR 9223372036854775808.000000 -CDLGBR 9223372036854774784.000000 -CXLFBR 0.000000 -CXLFBR 1.000000 -CXLFBR 4294967295.000000 -CXLFBR 2147483648.000000 -CXLFBR 2147483647.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLFBR 0.000000 -CXLFBR 4294967295.000000 -CXLGBR 0.000000 -CXLGBR 1.000000 -CXLGBR 4294967295.000000 -CXLGBR 2147483648.000000 -CXLGBR 2147483647.000000 -CXLGBR 4294967296.000000 -CXLGBR 18446744073709551615.000000 -CXLGBR 9223372036854775808.000000 -CXLGBR 9223372036854775807.000000 -CLFEBR 0 cc=3 -CLFEBR 0 cc=0 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 1 cc=2 -CLFEBR 16000 cc=2 -CLFEBR 160000000 cc=2 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=2 -CLFEBR 0 cc=2 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=0 -CLFEBR 4294967295 cc=3 -CLFEBR 0 cc=0 -CLFEBR 4294967295 cc=3 -CLGEBR 0 cc=3 -CLGEBR 0 cc=0 -CLGEBR 1 cc=2 -CLGEBR 1 cc=2 -CLGEBR 1 cc=2 -CLGEBR 1 cc=2 -CLGEBR 16000 cc=2 -CLGEBR 160000000 cc=2 -CLGEBR 1599999967232 cc=2 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=2 -CLGEBR 0 cc=2 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=0 -CLGEBR 18446744073709551615 cc=3 -CLGEBR 0 cc=0 -CLGEBR 18446744073709551615 cc=3 -CLFDBR 0 cc=3 -CLFDBR 0 cc=0 -CLFDBR 1 cc=2 -CLFDBR 1 cc=2 -CLFDBR 1 cc=2 -CLFDBR 1 cc=2 -CLFDBR 16000 cc=2 -CLFDBR 160000000 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=2 -CLFDBR 0 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=2 -CLFDBR 4294967295 cc=3 -CLFDBR 0 cc=0 -CLFDBR 4294967295 cc=3 -CLGDBR 0 cc=3 -CLGDBR 0 cc=0 -CLGDBR 1 cc=2 -CLGDBR 1 cc=2 -CLGDBR 1 cc=2 -CLGDBR 1 cc=2 -CLGDBR 16000 cc=2 -CLGDBR 160000000 cc=2 -CLGDBR 1600000000000 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=2 -CLGDBR 0 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=2 -CLGDBR 18446744073709551615 cc=3 -CLGDBR 0 cc=0 -CLGDBR 18446744073709551615 cc=3 -CLFXBR 0 cc=3 -CLFXBR 0 cc=0 -CLFXBR 1 cc=2 -CLFXBR 1 cc=2 -CLFXBR 1 cc=2 -CLFXBR 1 cc=2 -CLFXBR 16000 cc=2 -CLFXBR 160000000 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLFXBR 0 cc=2 -CLFXBR 4294967295 cc=3 -CLGXBR 0 cc=3 -CLGXBR 0 cc=0 -CLGXBR 1 cc=2 -CLGXBR 1 cc=2 -CLGXBR 1 cc=2 -CLGXBR 1 cc=2 -CLGXBR 16000 cc=2 -CLGXBR 160000000 cc=2 -CLGXBR 1600000000000 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 -CLGXBR 0 cc=2 -CLGXBR 18446744073709551615 cc=3 diff --git a/none/tests/s390x/fpext.vgtest b/none/tests/s390x/fpext.vgtest deleted file mode 100644 index 948bad9de..000000000 --- a/none/tests/s390x/fpext.vgtest +++ /dev/null @@ -1,2 +0,0 @@ -prog: fpext -prereq: test -e fpext && ../../../tests/s390x_features s390x-fpext diff --git a/none/tests/s390x/fpext_fail.c b/none/tests/s390x/fpext_fail.c new file mode 100644 index 000000000..9de7a8e57 --- /dev/null +++ b/none/tests/s390x/fpext_fail.c @@ -0,0 +1,6 @@ +int main(void) +{ + float val = 0.0f; + __asm__ volatile ("celfbr 1,5,%[f0],0" : : [f0]"f"(val) : "cc", "r1"); + return 0; +} diff --git a/none/tests/s390x/fpext_fail.vgtest b/none/tests/s390x/fpext_fail.vgtest index 970cbedff..48e8c5984 100644 --- a/none/tests/s390x/fpext_fail.vgtest +++ b/none/tests/s390x/fpext_fail.vgtest @@ -1,2 +1,2 @@ -prog: fpext -prereq: test -e fpext && ../../../tests/s390x_features '!s390x-fpext' +prog: fpext_fail +prereq: test -e fpext_fail && ../../../tests/s390x_features '!s390x-fpext' diff --git a/none/tests/s390x/rounding-3.c b/none/tests/s390x/rounding-3.c deleted file mode 100644 index bd53db686..000000000 --- a/none/tests/s390x/rounding-3.c +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include -#include -#include -#include -#include "opcodes.h" - -/* Test "convert to fixed" with "per fpc" rounding. - Covers all generally available rounding modes. -*/ - -void -set_rounding_mode(unsigned mode) -{ - register unsigned r asm("1") = mode; - __asm__ volatile ( SFPC(1) : : "d"(r) ); -} - -unsigned -get_rounding_mode(void) -{ - unsigned fpc; - - __asm__ volatile ("stfpc %0" : "=Q"(fpc)); - - return fpc & 0x7; -} - - -const char * -rtext(unsigned fpc_round) -{ - switch (fpc_round) { - case 0: return "[-> near]"; - case 1: return "[-> zero]"; - case 2: return "[-> +inf]"; - case 3: return "[-> -inf]"; - } - assert(0); -} - -#define convert_to_int(opcode,src_type,dst_type,dst_fmt,round,value) \ -do { \ - src_type src = value; \ - dst_type dst; \ - unsigned cc; \ - \ - __asm__ volatile (opcode " %[dst]," #round ",%[src]\n\t" \ - "ipm %[cc]\n\t" \ - "srl %[cc],28\n\t" \ - : [dst] "=d"(dst), [cc] "=d"(cc) \ - : [src] "f"(src) \ - : "cc"); \ - \ - printf("%s %f\t-> %"dst_fmt"\tcc = %u\n", \ - opcode, src, dst, cc); \ -} while (0) - - -#define cfebr(value) \ - convert_to_int("cfebr",float,int32_t,PRId32,0,value) -#define cfdbr(value) \ - convert_to_int("cfdbr",double,int32_t,PRId32,0,value) -#define cgebr(value) \ - convert_to_int("cgebr",float,int64_t,PRId64,0,value) -#define cgdbr(value) \ - convert_to_int("cgdbr",double,int64_t,PRId64,0,value) - -int main(void) -{ - int i, j; - static const unsigned rmodes[] = { 0, 1, 2, 3 }; - static const float fval[] = { - 1.25f, 1.5f, 2.5f, 1.75f, -1.25f, -1.5f, -2.5f, -1.75f, 0.0f, - }; - static const double dval[] = { - 1.25, 1.5, 2.5, 1.75, -1.25, -1.5, -2.5, -1.75, 0.0, - }; - - - for (i = 0; i < sizeof rmodes / sizeof rmodes[0]; ++i) { - printf("setting rounding mode to %s\n", rtext(rmodes[i])); - set_rounding_mode(rmodes[i]); - assert(get_rounding_mode() == rmodes[i]); - - /* f32 -> i32 */ - for (j = 0; j < sizeof fval / sizeof fval[0]; ++j) { - cfebr(fval[j]); - assert(get_rounding_mode() == rmodes[i]); - } - - /* f32 -> i64 */ - for (j = 0; j < sizeof fval / sizeof fval[0]; ++j) { - cgebr(fval[j]); - assert(get_rounding_mode() == rmodes[i]); - } - - /* f64 -> i32 */ - for (j = 0; j < sizeof dval / sizeof dval[0]; ++j) { - cfdbr(dval[j]); - assert(get_rounding_mode() == rmodes[i]); - } - - /* f64 -> i64 */ - for (j = 0; j < sizeof dval / sizeof dval[0]; ++j) { - cgdbr(dval[j]); - assert(get_rounding_mode() == rmodes[i]); - } - - } - - return 0; -} diff --git a/none/tests/s390x/rounding-3.stderr.exp b/none/tests/s390x/rounding-3.stderr.exp deleted file mode 100644 index 139597f9c..000000000 --- a/none/tests/s390x/rounding-3.stderr.exp +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/rounding-3.stdout.exp b/none/tests/s390x/rounding-3.stdout.exp deleted file mode 100644 index e613af94d..000000000 --- a/none/tests/s390x/rounding-3.stdout.exp +++ /dev/null @@ -1,148 +0,0 @@ -setting rounding mode to [-> near] -cfebr 1.250000 -> 1 cc = 2 -cfebr 1.500000 -> 2 cc = 2 -cfebr 2.500000 -> 2 cc = 2 -cfebr 1.750000 -> 2 cc = 2 -cfebr -1.250000 -> -1 cc = 1 -cfebr -1.500000 -> -2 cc = 1 -cfebr -2.500000 -> -2 cc = 1 -cfebr -1.750000 -> -2 cc = 1 -cfebr 0.000000 -> 0 cc = 0 -cgebr 1.250000 -> 1 cc = 2 -cgebr 1.500000 -> 2 cc = 2 -cgebr 2.500000 -> 2 cc = 2 -cgebr 1.750000 -> 2 cc = 2 -cgebr -1.250000 -> -1 cc = 1 -cgebr -1.500000 -> -2 cc = 1 -cgebr -2.500000 -> -2 cc = 1 -cgebr -1.750000 -> -2 cc = 1 -cgebr 0.000000 -> 0 cc = 0 -cfdbr 1.250000 -> 1 cc = 2 -cfdbr 1.500000 -> 2 cc = 2 -cfdbr 2.500000 -> 2 cc = 2 -cfdbr 1.750000 -> 2 cc = 2 -cfdbr -1.250000 -> -1 cc = 1 -cfdbr -1.500000 -> -2 cc = 1 -cfdbr -2.500000 -> -2 cc = 1 -cfdbr -1.750000 -> -2 cc = 1 -cfdbr 0.000000 -> 0 cc = 0 -cgdbr 1.250000 -> 1 cc = 2 -cgdbr 1.500000 -> 2 cc = 2 -cgdbr 2.500000 -> 2 cc = 2 -cgdbr 1.750000 -> 2 cc = 2 -cgdbr -1.250000 -> -1 cc = 1 -cgdbr -1.500000 -> -2 cc = 1 -cgdbr -2.500000 -> -2 cc = 1 -cgdbr -1.750000 -> -2 cc = 1 -cgdbr 0.000000 -> 0 cc = 0 -setting rounding mode to [-> zero] -cfebr 1.250000 -> 1 cc = 2 -cfebr 1.500000 -> 1 cc = 2 -cfebr 2.500000 -> 2 cc = 2 -cfebr 1.750000 -> 1 cc = 2 -cfebr -1.250000 -> -1 cc = 1 -cfebr -1.500000 -> -1 cc = 1 -cfebr -2.500000 -> -2 cc = 1 -cfebr -1.750000 -> -1 cc = 1 -cfebr 0.000000 -> 0 cc = 0 -cgebr 1.250000 -> 1 cc = 2 -cgebr 1.500000 -> 1 cc = 2 -cgebr 2.500000 -> 2 cc = 2 -cgebr 1.750000 -> 1 cc = 2 -cgebr -1.250000 -> -1 cc = 1 -cgebr -1.500000 -> -1 cc = 1 -cgebr -2.500000 -> -2 cc = 1 -cgebr -1.750000 -> -1 cc = 1 -cgebr 0.000000 -> 0 cc = 0 -cfdbr 1.250000 -> 1 cc = 2 -cfdbr 1.500000 -> 1 cc = 2 -cfdbr 2.500000 -> 2 cc = 2 -cfdbr 1.750000 -> 1 cc = 2 -cfdbr -1.250000 -> -1 cc = 1 -cfdbr -1.500000 -> -1 cc = 1 -cfdbr -2.500000 -> -2 cc = 1 -cfdbr -1.750000 -> -1 cc = 1 -cfdbr 0.000000 -> 0 cc = 0 -cgdbr 1.250000 -> 1 cc = 2 -cgdbr 1.500000 -> 1 cc = 2 -cgdbr 2.500000 -> 2 cc = 2 -cgdbr 1.750000 -> 1 cc = 2 -cgdbr -1.250000 -> -1 cc = 1 -cgdbr -1.500000 -> -1 cc = 1 -cgdbr -2.500000 -> -2 cc = 1 -cgdbr -1.750000 -> -1 cc = 1 -cgdbr 0.000000 -> 0 cc = 0 -setting rounding mode to [-> +inf] -cfebr 1.250000 -> 2 cc = 2 -cfebr 1.500000 -> 2 cc = 2 -cfebr 2.500000 -> 3 cc = 2 -cfebr 1.750000 -> 2 cc = 2 -cfebr -1.250000 -> -1 cc = 1 -cfebr -1.500000 -> -1 cc = 1 -cfebr -2.500000 -> -2 cc = 1 -cfebr -1.750000 -> -1 cc = 1 -cfebr 0.000000 -> 0 cc = 0 -cgebr 1.250000 -> 2 cc = 2 -cgebr 1.500000 -> 2 cc = 2 -cgebr 2.500000 -> 3 cc = 2 -cgebr 1.750000 -> 2 cc = 2 -cgebr -1.250000 -> -1 cc = 1 -cgebr -1.500000 -> -1 cc = 1 -cgebr -2.500000 -> -2 cc = 1 -cgebr -1.750000 -> -1 cc = 1 -cgebr 0.000000 -> 0 cc = 0 -cfdbr 1.250000 -> 2 cc = 2 -cfdbr 1.500000 -> 2 cc = 2 -cfdbr 2.500000 -> 3 cc = 2 -cfdbr 1.750000 -> 2 cc = 2 -cfdbr -1.250000 -> -1 cc = 1 -cfdbr -1.500000 -> -1 cc = 1 -cfdbr -2.500000 -> -2 cc = 1 -cfdbr -1.750000 -> -1 cc = 1 -cfdbr 0.000000 -> 0 cc = 0 -cgdbr 1.250000 -> 2 cc = 2 -cgdbr 1.500000 -> 2 cc = 2 -cgdbr 2.500000 -> 3 cc = 2 -cgdbr 1.750000 -> 2 cc = 2 -cgdbr -1.250000 -> -1 cc = 1 -cgdbr -1.500000 -> -1 cc = 1 -cgdbr -2.500000 -> -2 cc = 1 -cgdbr -1.750000 -> -1 cc = 1 -cgdbr 0.000000 -> 0 cc = 0 -setting rounding mode to [-> -inf] -cfebr 1.250000 -> 1 cc = 2 -cfebr 1.500000 -> 1 cc = 2 -cfebr 2.500000 -> 2 cc = 2 -cfebr 1.750000 -> 1 cc = 2 -cfebr -1.250000 -> -2 cc = 1 -cfebr -1.500000 -> -2 cc = 1 -cfebr -2.500000 -> -3 cc = 1 -cfebr -1.750000 -> -2 cc = 1 -cfebr 0.000000 -> 0 cc = 0 -cgebr 1.250000 -> 1 cc = 2 -cgebr 1.500000 -> 1 cc = 2 -cgebr 2.500000 -> 2 cc = 2 -cgebr 1.750000 -> 1 cc = 2 -cgebr -1.250000 -> -2 cc = 1 -cgebr -1.500000 -> -2 cc = 1 -cgebr -2.500000 -> -3 cc = 1 -cgebr -1.750000 -> -2 cc = 1 -cgebr 0.000000 -> 0 cc = 0 -cfdbr 1.250000 -> 1 cc = 2 -cfdbr 1.500000 -> 1 cc = 2 -cfdbr 2.500000 -> 2 cc = 2 -cfdbr 1.750000 -> 1 cc = 2 -cfdbr -1.250000 -> -2 cc = 1 -cfdbr -1.500000 -> -2 cc = 1 -cfdbr -2.500000 -> -3 cc = 1 -cfdbr -1.750000 -> -2 cc = 1 -cfdbr 0.000000 -> 0 cc = 0 -cgdbr 1.250000 -> 1 cc = 2 -cgdbr 1.500000 -> 1 cc = 2 -cgdbr 2.500000 -> 2 cc = 2 -cgdbr 1.750000 -> 1 cc = 2 -cgdbr -1.250000 -> -2 cc = 1 -cgdbr -1.500000 -> -2 cc = 1 -cgdbr -2.500000 -> -3 cc = 1 -cgdbr -1.750000 -> -2 cc = 1 -cgdbr 0.000000 -> 0 cc = 0 diff --git a/none/tests/s390x/rounding-3.vgtest b/none/tests/s390x/rounding-3.vgtest deleted file mode 100644 index 816871054..000000000 --- a/none/tests/s390x/rounding-3.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: rounding-3 From c574f5eb10d06b491512806354f8d15c3d3e020a Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 24 Sep 2025 20:54:22 +0000 Subject: [PATCH 339/412] s390: Remove rounding-6 BFP testcase (convert to int) Should have been part of 18c5454874d. Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572 --- .gitignore | 1 - none/tests/s390x/Makefile.am | 2 +- none/tests/s390x/rounding-6.c | 159 ------------------ none/tests/s390x/rounding-6.stderr.exp | 2 - none/tests/s390x/rounding-6.stdout.exp | 216 ------------------------- none/tests/s390x/rounding-6.vgtest | 1 - 6 files changed, 1 insertion(+), 380 deletions(-) delete mode 100644 none/tests/s390x/rounding-6.c delete mode 100644 none/tests/s390x/rounding-6.stderr.exp delete mode 100644 none/tests/s390x/rounding-6.stdout.exp delete mode 100644 none/tests/s390x/rounding-6.vgtest diff --git a/.gitignore b/.gitignore index b059789b8..53e2a0f83 100644 --- a/.gitignore +++ b/.gitignore @@ -2185,7 +2185,6 @@ /none/tests/s390x/fpext_warn /none/tests/s390x/fpext_fail /none/tests/s390x/rounding-1 -/none/tests/s390x/rounding-6 /none/tests/s390x/bfp-arith /none/tests/s390x/bfp-load /none/tests/s390x/bfp-fpc diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index afa61c94b..abe71570f 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -11,7 +11,7 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ ex_sig ex_clone cu14 cu14_1 cu41 ecag fpext_warn fpext_fail \ bfp-tdc bfp-load bfp-fpc bfp-convert rounding-1 bfp-arith \ bfp-3 bfp-compare comp-1 comp-2 exrl tmll tm stmg \ - ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \ + ex clst mvc test_fork test_sig rxsbg popcnt \ high-word traps \ spechelper-alr spechelper-algr \ spechelper-slr spechelper-slgr \ diff --git a/none/tests/s390x/rounding-6.c b/none/tests/s390x/rounding-6.c deleted file mode 100644 index e88087682..000000000 --- a/none/tests/s390x/rounding-6.c +++ /dev/null @@ -1,159 +0,0 @@ -#include -#include -#include -#include -#include -#include "opcodes.h" -#include "rounding.h" - -/* Test "convert to fixed" with rounding mode given in insn (m3 field) - Covers all generally available rounding modes that can be mapped to - IRRoundingMode. As a consequence m3=1 which is "round to nearest with - ties away from 0" is not tested here. -*/ - -const char * -rtext(unsigned m3_round) -{ - switch (m3_round) { - case 0: return "[-> per fpc]"; - case 1: return "[-> nearest away]"; - case 3: return "[-> prepare short]"; // floating point extension fac needed - case 4: return "[-> nearest even]"; - case 5: return "[-> 0]"; - case 6: return "[-> +inf]"; - case 7: return "[-> -inf]"; - } - assert(0); -} - -#define convert_to_int(opcode,src_type,dst_type,dst_fmt,round,value) \ -do { \ - src_type src = value; \ - dst_type dst; \ - unsigned cc; \ - \ - __asm__ volatile (opcode " %[dst]," #round ",%[src]\n\t" \ - "ipm %[cc]\n\t" \ - "srl %[cc],28\n\t" \ - : [dst] "=d"(dst), [cc] "=d"(cc) \ - : [src] "f"(src) \ - : "cc"); \ - \ - printf("%s %f\t-> %"dst_fmt"\tcc = %u %s\n", \ - opcode, src, dst, cc, rtext(round)); \ -} while (0) - -#define round_to_int(opcode,type,round,value) \ -do { \ - type src = value; \ - type dst; \ - \ - __asm__ volatile (opcode " %[dst]," #round ",%[src]\n\t" \ - : [dst] "=f"(dst) \ - : [src] "f"(src)); \ - \ - printf("%s %.5f\t-> %g %s\n", \ - opcode, src, dst, rtext(round)); \ -} while (0) - - -#define cfebr(value, round) \ - convert_to_int("cfebr",float,int32_t,PRId32,round,value) -#define cfdbr(value, round) \ - convert_to_int("cfdbr",double,int32_t,PRId32,round,value) -#define cgebr(value, round) \ - convert_to_int("cgebr",float,int64_t,PRId64,round,value) -#define cgdbr(value, round) \ - convert_to_int("cgdbr",double,int64_t,PRId64,round,value) - -#define fiebr(value, round) \ - round_to_int("fiebr",float,round,value) -#define fidbr(value, round) \ - round_to_int("fidbr",double,round,value) - -void -set_rounding_mode(unsigned mode) -{ - register unsigned r asm("1") = mode; - __asm__ volatile ( SFPC(1) : : "d"(r) ); -} - - -int main(void) -{ - int j; - static const float fval[] = { - 1.25f, 1.5f, 2.5f, 1.75f, -1.25f, -1.5f, -2.5f, -1.75f, 0.0f, - }; - static const double dval[] = { - 1.25, 1.5, 2.5, 1.75, -1.25, -1.5, -2.5, -1.75, 0.0, - }; - - /* Note when testing M3_NEAR need to set the FPC rounding mode - to something else. FPC rounding mode is NEAR by default. - Setting the FPC rounding mode to != NEAR is the only way to make - sure the M3 field is not ignored. */ - - /* f32 -> i32 */ - for (j = 0; j < sizeof fval / sizeof fval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - cfebr(fval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - cfebr(fval[j], M3_BFP_ROUND_ZERO); - cfebr(fval[j], M3_BFP_ROUND_POSINF); - cfebr(fval[j], M3_BFP_ROUND_NEGINF); - } - - /* f32 -> i64 */ - for (j = 0; j < sizeof fval / sizeof fval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - cgebr(fval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - cgebr(fval[j], M3_BFP_ROUND_ZERO); - cgebr(fval[j], M3_BFP_ROUND_POSINF); - cgebr(fval[j], M3_BFP_ROUND_NEGINF); - } - - /* f64 -> i32 */ - for (j = 0; j < sizeof dval / sizeof dval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - cfdbr(dval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - cfdbr(dval[j], M3_BFP_ROUND_ZERO); - cfdbr(dval[j], M3_BFP_ROUND_POSINF); - cfdbr(dval[j], M3_BFP_ROUND_NEGINF); - } - - /* f64 -> i64 */ - for (j = 0; j < sizeof dval / sizeof dval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - cgdbr(dval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - cgdbr(dval[j], M3_BFP_ROUND_ZERO); - cgdbr(dval[j], M3_BFP_ROUND_POSINF); - cgdbr(dval[j], M3_BFP_ROUND_NEGINF); - } - - /* f32 -> f32, round to int */ - for (j = 0; j < sizeof dval / sizeof dval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - fiebr(dval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - fiebr(dval[j], M3_BFP_ROUND_ZERO); - fiebr(dval[j], M3_BFP_ROUND_POSINF); - fiebr(dval[j], M3_BFP_ROUND_NEGINF); - } - - /* f64 -> f64, round to int */ - for (j = 0; j < sizeof dval / sizeof dval[0]; ++j) { - set_rounding_mode(FPC_BFP_ROUND_ZERO); - fidbr(dval[j], M3_BFP_ROUND_NEAREST_EVEN); - set_rounding_mode(FPC_BFP_ROUND_NEAREST_EVEN); - fidbr(dval[j], M3_BFP_ROUND_ZERO); - fidbr(dval[j], M3_BFP_ROUND_POSINF); - fidbr(dval[j], M3_BFP_ROUND_NEGINF); - } - - return 0; -} diff --git a/none/tests/s390x/rounding-6.stderr.exp b/none/tests/s390x/rounding-6.stderr.exp deleted file mode 100644 index 139597f9c..000000000 --- a/none/tests/s390x/rounding-6.stderr.exp +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/none/tests/s390x/rounding-6.stdout.exp b/none/tests/s390x/rounding-6.stdout.exp deleted file mode 100644 index f01a22973..000000000 --- a/none/tests/s390x/rounding-6.stdout.exp +++ /dev/null @@ -1,216 +0,0 @@ -cfebr 1.250000 -> 1 cc = 2 [-> nearest even] -cfebr 1.250000 -> 1 cc = 2 [-> 0] -cfebr 1.250000 -> 2 cc = 2 [-> +inf] -cfebr 1.250000 -> 1 cc = 2 [-> -inf] -cfebr 1.500000 -> 2 cc = 2 [-> nearest even] -cfebr 1.500000 -> 1 cc = 2 [-> 0] -cfebr 1.500000 -> 2 cc = 2 [-> +inf] -cfebr 1.500000 -> 1 cc = 2 [-> -inf] -cfebr 2.500000 -> 2 cc = 2 [-> nearest even] -cfebr 2.500000 -> 2 cc = 2 [-> 0] -cfebr 2.500000 -> 3 cc = 2 [-> +inf] -cfebr 2.500000 -> 2 cc = 2 [-> -inf] -cfebr 1.750000 -> 2 cc = 2 [-> nearest even] -cfebr 1.750000 -> 1 cc = 2 [-> 0] -cfebr 1.750000 -> 2 cc = 2 [-> +inf] -cfebr 1.750000 -> 1 cc = 2 [-> -inf] -cfebr -1.250000 -> -1 cc = 1 [-> nearest even] -cfebr -1.250000 -> -1 cc = 1 [-> 0] -cfebr -1.250000 -> -1 cc = 1 [-> +inf] -cfebr -1.250000 -> -2 cc = 1 [-> -inf] -cfebr -1.500000 -> -2 cc = 1 [-> nearest even] -cfebr -1.500000 -> -1 cc = 1 [-> 0] -cfebr -1.500000 -> -1 cc = 1 [-> +inf] -cfebr -1.500000 -> -2 cc = 1 [-> -inf] -cfebr -2.500000 -> -2 cc = 1 [-> nearest even] -cfebr -2.500000 -> -2 cc = 1 [-> 0] -cfebr -2.500000 -> -2 cc = 1 [-> +inf] -cfebr -2.500000 -> -3 cc = 1 [-> -inf] -cfebr -1.750000 -> -2 cc = 1 [-> nearest even] -cfebr -1.750000 -> -1 cc = 1 [-> 0] -cfebr -1.750000 -> -1 cc = 1 [-> +inf] -cfebr -1.750000 -> -2 cc = 1 [-> -inf] -cfebr 0.000000 -> 0 cc = 0 [-> nearest even] -cfebr 0.000000 -> 0 cc = 0 [-> 0] -cfebr 0.000000 -> 0 cc = 0 [-> +inf] -cfebr 0.000000 -> 0 cc = 0 [-> -inf] -cgebr 1.250000 -> 1 cc = 2 [-> nearest even] -cgebr 1.250000 -> 1 cc = 2 [-> 0] -cgebr 1.250000 -> 2 cc = 2 [-> +inf] -cgebr 1.250000 -> 1 cc = 2 [-> -inf] -cgebr 1.500000 -> 2 cc = 2 [-> nearest even] -cgebr 1.500000 -> 1 cc = 2 [-> 0] -cgebr 1.500000 -> 2 cc = 2 [-> +inf] -cgebr 1.500000 -> 1 cc = 2 [-> -inf] -cgebr 2.500000 -> 2 cc = 2 [-> nearest even] -cgebr 2.500000 -> 2 cc = 2 [-> 0] -cgebr 2.500000 -> 3 cc = 2 [-> +inf] -cgebr 2.500000 -> 2 cc = 2 [-> -inf] -cgebr 1.750000 -> 2 cc = 2 [-> nearest even] -cgebr 1.750000 -> 1 cc = 2 [-> 0] -cgebr 1.750000 -> 2 cc = 2 [-> +inf] -cgebr 1.750000 -> 1 cc = 2 [-> -inf] -cgebr -1.250000 -> -1 cc = 1 [-> nearest even] -cgebr -1.250000 -> -1 cc = 1 [-> 0] -cgebr -1.250000 -> -1 cc = 1 [-> +inf] -cgebr -1.250000 -> -2 cc = 1 [-> -inf] -cgebr -1.500000 -> -2 cc = 1 [-> nearest even] -cgebr -1.500000 -> -1 cc = 1 [-> 0] -cgebr -1.500000 -> -1 cc = 1 [-> +inf] -cgebr -1.500000 -> -2 cc = 1 [-> -inf] -cgebr -2.500000 -> -2 cc = 1 [-> nearest even] -cgebr -2.500000 -> -2 cc = 1 [-> 0] -cgebr -2.500000 -> -2 cc = 1 [-> +inf] -cgebr -2.500000 -> -3 cc = 1 [-> -inf] -cgebr -1.750000 -> -2 cc = 1 [-> nearest even] -cgebr -1.750000 -> -1 cc = 1 [-> 0] -cgebr -1.750000 -> -1 cc = 1 [-> +inf] -cgebr -1.750000 -> -2 cc = 1 [-> -inf] -cgebr 0.000000 -> 0 cc = 0 [-> nearest even] -cgebr 0.000000 -> 0 cc = 0 [-> 0] -cgebr 0.000000 -> 0 cc = 0 [-> +inf] -cgebr 0.000000 -> 0 cc = 0 [-> -inf] -cfdbr 1.250000 -> 1 cc = 2 [-> nearest even] -cfdbr 1.250000 -> 1 cc = 2 [-> 0] -cfdbr 1.250000 -> 2 cc = 2 [-> +inf] -cfdbr 1.250000 -> 1 cc = 2 [-> -inf] -cfdbr 1.500000 -> 2 cc = 2 [-> nearest even] -cfdbr 1.500000 -> 1 cc = 2 [-> 0] -cfdbr 1.500000 -> 2 cc = 2 [-> +inf] -cfdbr 1.500000 -> 1 cc = 2 [-> -inf] -cfdbr 2.500000 -> 2 cc = 2 [-> nearest even] -cfdbr 2.500000 -> 2 cc = 2 [-> 0] -cfdbr 2.500000 -> 3 cc = 2 [-> +inf] -cfdbr 2.500000 -> 2 cc = 2 [-> -inf] -cfdbr 1.750000 -> 2 cc = 2 [-> nearest even] -cfdbr 1.750000 -> 1 cc = 2 [-> 0] -cfdbr 1.750000 -> 2 cc = 2 [-> +inf] -cfdbr 1.750000 -> 1 cc = 2 [-> -inf] -cfdbr -1.250000 -> -1 cc = 1 [-> nearest even] -cfdbr -1.250000 -> -1 cc = 1 [-> 0] -cfdbr -1.250000 -> -1 cc = 1 [-> +inf] -cfdbr -1.250000 -> -2 cc = 1 [-> -inf] -cfdbr -1.500000 -> -2 cc = 1 [-> nearest even] -cfdbr -1.500000 -> -1 cc = 1 [-> 0] -cfdbr -1.500000 -> -1 cc = 1 [-> +inf] -cfdbr -1.500000 -> -2 cc = 1 [-> -inf] -cfdbr -2.500000 -> -2 cc = 1 [-> nearest even] -cfdbr -2.500000 -> -2 cc = 1 [-> 0] -cfdbr -2.500000 -> -2 cc = 1 [-> +inf] -cfdbr -2.500000 -> -3 cc = 1 [-> -inf] -cfdbr -1.750000 -> -2 cc = 1 [-> nearest even] -cfdbr -1.750000 -> -1 cc = 1 [-> 0] -cfdbr -1.750000 -> -1 cc = 1 [-> +inf] -cfdbr -1.750000 -> -2 cc = 1 [-> -inf] -cfdbr 0.000000 -> 0 cc = 0 [-> nearest even] -cfdbr 0.000000 -> 0 cc = 0 [-> 0] -cfdbr 0.000000 -> 0 cc = 0 [-> +inf] -cfdbr 0.000000 -> 0 cc = 0 [-> -inf] -cgdbr 1.250000 -> 1 cc = 2 [-> nearest even] -cgdbr 1.250000 -> 1 cc = 2 [-> 0] -cgdbr 1.250000 -> 2 cc = 2 [-> +inf] -cgdbr 1.250000 -> 1 cc = 2 [-> -inf] -cgdbr 1.500000 -> 2 cc = 2 [-> nearest even] -cgdbr 1.500000 -> 1 cc = 2 [-> 0] -cgdbr 1.500000 -> 2 cc = 2 [-> +inf] -cgdbr 1.500000 -> 1 cc = 2 [-> -inf] -cgdbr 2.500000 -> 2 cc = 2 [-> nearest even] -cgdbr 2.500000 -> 2 cc = 2 [-> 0] -cgdbr 2.500000 -> 3 cc = 2 [-> +inf] -cgdbr 2.500000 -> 2 cc = 2 [-> -inf] -cgdbr 1.750000 -> 2 cc = 2 [-> nearest even] -cgdbr 1.750000 -> 1 cc = 2 [-> 0] -cgdbr 1.750000 -> 2 cc = 2 [-> +inf] -cgdbr 1.750000 -> 1 cc = 2 [-> -inf] -cgdbr -1.250000 -> -1 cc = 1 [-> nearest even] -cgdbr -1.250000 -> -1 cc = 1 [-> 0] -cgdbr -1.250000 -> -1 cc = 1 [-> +inf] -cgdbr -1.250000 -> -2 cc = 1 [-> -inf] -cgdbr -1.500000 -> -2 cc = 1 [-> nearest even] -cgdbr -1.500000 -> -1 cc = 1 [-> 0] -cgdbr -1.500000 -> -1 cc = 1 [-> +inf] -cgdbr -1.500000 -> -2 cc = 1 [-> -inf] -cgdbr -2.500000 -> -2 cc = 1 [-> nearest even] -cgdbr -2.500000 -> -2 cc = 1 [-> 0] -cgdbr -2.500000 -> -2 cc = 1 [-> +inf] -cgdbr -2.500000 -> -3 cc = 1 [-> -inf] -cgdbr -1.750000 -> -2 cc = 1 [-> nearest even] -cgdbr -1.750000 -> -1 cc = 1 [-> 0] -cgdbr -1.750000 -> -1 cc = 1 [-> +inf] -cgdbr -1.750000 -> -2 cc = 1 [-> -inf] -cgdbr 0.000000 -> 0 cc = 0 [-> nearest even] -cgdbr 0.000000 -> 0 cc = 0 [-> 0] -cgdbr 0.000000 -> 0 cc = 0 [-> +inf] -cgdbr 0.000000 -> 0 cc = 0 [-> -inf] -fiebr 1.25000 -> 1 [-> nearest even] -fiebr 1.25000 -> 1 [-> 0] -fiebr 1.25000 -> 2 [-> +inf] -fiebr 1.25000 -> 1 [-> -inf] -fiebr 1.50000 -> 2 [-> nearest even] -fiebr 1.50000 -> 1 [-> 0] -fiebr 1.50000 -> 2 [-> +inf] -fiebr 1.50000 -> 1 [-> -inf] -fiebr 2.50000 -> 2 [-> nearest even] -fiebr 2.50000 -> 2 [-> 0] -fiebr 2.50000 -> 3 [-> +inf] -fiebr 2.50000 -> 2 [-> -inf] -fiebr 1.75000 -> 2 [-> nearest even] -fiebr 1.75000 -> 1 [-> 0] -fiebr 1.75000 -> 2 [-> +inf] -fiebr 1.75000 -> 1 [-> -inf] -fiebr -1.25000 -> -1 [-> nearest even] -fiebr -1.25000 -> -1 [-> 0] -fiebr -1.25000 -> -1 [-> +inf] -fiebr -1.25000 -> -2 [-> -inf] -fiebr -1.50000 -> -2 [-> nearest even] -fiebr -1.50000 -> -1 [-> 0] -fiebr -1.50000 -> -1 [-> +inf] -fiebr -1.50000 -> -2 [-> -inf] -fiebr -2.50000 -> -2 [-> nearest even] -fiebr -2.50000 -> -2 [-> 0] -fiebr -2.50000 -> -2 [-> +inf] -fiebr -2.50000 -> -3 [-> -inf] -fiebr -1.75000 -> -2 [-> nearest even] -fiebr -1.75000 -> -1 [-> 0] -fiebr -1.75000 -> -1 [-> +inf] -fiebr -1.75000 -> -2 [-> -inf] -fiebr 0.00000 -> 0 [-> nearest even] -fiebr 0.00000 -> 0 [-> 0] -fiebr 0.00000 -> 0 [-> +inf] -fiebr 0.00000 -> 0 [-> -inf] -fidbr 1.25000 -> 1 [-> nearest even] -fidbr 1.25000 -> 1 [-> 0] -fidbr 1.25000 -> 2 [-> +inf] -fidbr 1.25000 -> 1 [-> -inf] -fidbr 1.50000 -> 2 [-> nearest even] -fidbr 1.50000 -> 1 [-> 0] -fidbr 1.50000 -> 2 [-> +inf] -fidbr 1.50000 -> 1 [-> -inf] -fidbr 2.50000 -> 2 [-> nearest even] -fidbr 2.50000 -> 2 [-> 0] -fidbr 2.50000 -> 3 [-> +inf] -fidbr 2.50000 -> 2 [-> -inf] -fidbr 1.75000 -> 2 [-> nearest even] -fidbr 1.75000 -> 1 [-> 0] -fidbr 1.75000 -> 2 [-> +inf] -fidbr 1.75000 -> 1 [-> -inf] -fidbr -1.25000 -> -1 [-> nearest even] -fidbr -1.25000 -> -1 [-> 0] -fidbr -1.25000 -> -1 [-> +inf] -fidbr -1.25000 -> -2 [-> -inf] -fidbr -1.50000 -> -2 [-> nearest even] -fidbr -1.50000 -> -1 [-> 0] -fidbr -1.50000 -> -1 [-> +inf] -fidbr -1.50000 -> -2 [-> -inf] -fidbr -2.50000 -> -2 [-> nearest even] -fidbr -2.50000 -> -2 [-> 0] -fidbr -2.50000 -> -2 [-> +inf] -fidbr -2.50000 -> -3 [-> -inf] -fidbr -1.75000 -> -2 [-> nearest even] -fidbr -1.75000 -> -1 [-> 0] -fidbr -1.75000 -> -1 [-> +inf] -fidbr -1.75000 -> -2 [-> -inf] -fidbr 0.00000 -> 0 [-> nearest even] -fidbr 0.00000 -> 0 [-> 0] -fidbr 0.00000 -> 0 [-> +inf] -fidbr 0.00000 -> 0 [-> -inf] diff --git a/none/tests/s390x/rounding-6.vgtest b/none/tests/s390x/rounding-6.vgtest deleted file mode 100644 index 13baa314f..000000000 --- a/none/tests/s390x/rounding-6.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: rounding-6 From b2c27072b05777fe8dc6d32791de1e4eff044ebb Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 24 Sep 2025 23:16:29 +0200 Subject: [PATCH 340/412] Deal with linux arches that don't have getdents, only getdents64 Not all linux arches have getdents, some newer arches (arm64 and riscv64) only implement getdents64. So only use the function filter_valgrind_fds_from_getdents_with_refill on linux with __NR_getdents. Also move the getdents_filter testcase under none/tests/linux and only use getdents64. Fixes: e8e4066c3a01 ("Filter Valgrind FDs from getdents syscalls") https://bugs.kde.org/show_bug.cgi?id=331311 --- coregrind/m_syswrap/syswrap-generic.c | 15 +++++++++++++++ none/tests/Makefile.am | 2 -- none/tests/linux/Makefile.am | 2 ++ none/tests/{ => linux}/getdents_filter.c | 15 +++++++++------ none/tests/{ => linux}/getdents_filter.stderr.exp | 0 none/tests/{ => linux}/getdents_filter.stdout.exp | 0 none/tests/{ => linux}/getdents_filter.vgtest | 0 7 files changed, 26 insertions(+), 8 deletions(-) rename none/tests/{ => linux}/getdents_filter.c (92%) rename none/tests/{ => linux}/getdents_filter.stderr.exp (100%) rename none/tests/{ => linux}/getdents_filter.stdout.exp (100%) rename none/tests/{ => linux}/getdents_filter.vgtest (100%) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 33b58f5a5..3786e9cd8 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -4045,6 +4045,10 @@ static Bool should_keep_fd_entry(const HChar *name) return True; } +/* Make sure we really need the proc filtering using (32bit) getdents, + which not every linux arch implements. */ +#if defined(VGO_linux) && defined(__NR_getdents) + /* Filter and compact dirent entries */ static SizeT filter_dirent_entries(struct vki_dirent *dirp, SizeT orig_size) { @@ -4067,6 +4071,7 @@ static SizeT filter_dirent_entries(struct vki_dirent *dirp, SizeT orig_size) return new_size; } +#endif /* defined(VGO_linux) && defined(__NR_getdents) */ /* Filter and compact dirent64 entries */ static SizeT filter_dirent64_entries(struct vki_dirent64 *dirp, SizeT orig_size) @@ -4091,6 +4096,10 @@ static SizeT filter_dirent64_entries(struct vki_dirent64 *dirp, SizeT orig_size) return new_size; } +/* Make sure we really need the proc filtering using (32bit) getdents, + which not every linux arch implements. */ +#if defined(VGO_linux) && defined(__NR_getdents) + /* Filter out Valgrind's internal file descriptors from getdents results with refill capability. When entries are filtered out, attempts to read more entries to avoid empty results. Returns filtered size on success, or -1 if retry syscall failed. */ @@ -4119,6 +4128,7 @@ static SizeT filter_valgrind_fds_from_getdents_with_refill(Int fd, struct vki_di return new_size; } +#endif /* defined(VGO_linux) && defined(__NR_getdents) */ /* Filter out Valgrind's internal file descriptors from getdents64 results with refill capability. Same logic as getdents version but for 64-bit dirent structures. @@ -4155,6 +4165,10 @@ POST(sys_getdents) if (RES > 0) { SizeT result_size = RES; + /* Make sure we really need the proc filtering using (32bit) getdents, + which not every linux arch implements. */ +#if defined(VGO_linux) && defined(__NR_getdents) + /* Only filter Valgrind FDs when listing /proc/PID/fd or /proc/PID/fdinfo directories */ if (is_proc_fd_directory(ARG1)) { SizeT filtered_size = filter_valgrind_fds_from_getdents_with_refill(ARG1, (struct vki_dirent *)ARG2, RES, ARG3, status); @@ -4166,6 +4180,7 @@ POST(sys_getdents) if (result_size != RES) SET_STATUS_Success(result_size); } +#endif /* defined(VGO_linux) && defined(__NR_getdents) */ POST_MEM_WRITE( ARG2, result_size ); } diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index ccdd85e53..716ce000d 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -172,7 +172,6 @@ EXTRA_DIST = \ floored.stderr.exp floored.stdout.exp floored.vgtest \ fork.stderr.exp fork.stdout.exp fork.vgtest \ fucomip.stderr.exp fucomip.vgtest \ - getdents_filter.stderr.exp getdents_filter.stdout.exp getdents_filter.vgtest \ gxx304.stderr.exp gxx304.vgtest \ ifunc.stderr.exp ifunc.stdout.exp ifunc.vgtest \ ioctl_moans.stderr.exp ioctl_moans.vgtest \ @@ -292,7 +291,6 @@ check_PROGRAMS = \ fdleak_fcntl fdleak_ipv4 fdleak_open fdleak_pipe \ fdleak_socketpair \ floored fork fucomip \ - getdents_filter \ ioctl_moans \ libvex_test \ libvexmultiarch_test \ diff --git a/none/tests/linux/Makefile.am b/none/tests/linux/Makefile.am index 7bfcedc86..55426e2b2 100644 --- a/none/tests/linux/Makefile.am +++ b/none/tests/linux/Makefile.am @@ -10,6 +10,7 @@ EXTRA_DIST = \ bug498317.stderr.exp bug498317.supp bug498317.vgtest \ bug506910.stderr.exp bug506910.vgtest \ clonev.stdout.exp clonev.stderr.exp clonev.vgtest \ + getdents_filter.stderr.exp getdents_filter.stdout.exp getdents_filter.vgtest \ membarrier.stderr.exp membarrier.vgtest \ mremap.stderr.exp mremap.stderr.exp-glibc27 mremap.stdout.exp \ mremap.vgtest \ @@ -28,6 +29,7 @@ check_PROGRAMS = \ brk-overflow2 \ bug498317 \ clonev \ + getdents_filter \ mremap \ mremap2 \ mremap3 \ diff --git a/none/tests/getdents_filter.c b/none/tests/linux/getdents_filter.c similarity index 92% rename from none/tests/getdents_filter.c rename to none/tests/linux/getdents_filter.c index d508cdde0..361659f51 100644 --- a/none/tests/getdents_filter.c +++ b/none/tests/linux/getdents_filter.c @@ -13,10 +13,11 @@ #include #include -struct linux_dirent { - unsigned long d_ino; - off_t d_off; +struct linux_dirent64 { + ino64_t d_ino; + off64_t d_off; unsigned short d_reclen; + unsigned char d_type; char d_name[]; }; @@ -67,7 +68,7 @@ static void test_retry_logic_with_small_buffer(void) int fd; char buf[SMALL_BUF_SIZE]; long nread; - struct linux_dirent *d; + struct linux_dirent64 *d; printf("retry_test_start\n"); @@ -83,7 +84,9 @@ static void test_retry_logic_with_small_buffer(void) * may return only Valgrind FDs, which will trigger the retry mechanism. */ for (;;) { - nread = syscall(SYS_getdents, fd, buf, SMALL_BUF_SIZE); + /* Note, using getdents64 since some linux arches don't implement + the 32bit getdents. */ + nread = syscall(SYS_getdents64, fd, buf, SMALL_BUF_SIZE); if (nread == -1) { printf("retry_test_error\n"); @@ -97,7 +100,7 @@ static void test_retry_logic_with_small_buffer(void) /* Print client FD entries found in this buffer (excluding . and ..) */ for (size_t bpos = 0; bpos < nread;) { - d = (struct linux_dirent *)(buf + bpos); + d = (struct linux_dirent64 *)(buf + bpos); if (strcmp(d->d_name, ".") != 0 && strcmp(d->d_name, "..") != 0) { char *endptr; long fd_num = strtol(d->d_name, &endptr, 10); diff --git a/none/tests/getdents_filter.stderr.exp b/none/tests/linux/getdents_filter.stderr.exp similarity index 100% rename from none/tests/getdents_filter.stderr.exp rename to none/tests/linux/getdents_filter.stderr.exp diff --git a/none/tests/getdents_filter.stdout.exp b/none/tests/linux/getdents_filter.stdout.exp similarity index 100% rename from none/tests/getdents_filter.stdout.exp rename to none/tests/linux/getdents_filter.stdout.exp diff --git a/none/tests/getdents_filter.vgtest b/none/tests/linux/getdents_filter.vgtest similarity index 100% rename from none/tests/getdents_filter.vgtest rename to none/tests/linux/getdents_filter.vgtest From 1109ef57b23cf84be551cb9d25373a8169bedce4 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 26 Sep 2025 21:50:39 +0000 Subject: [PATCH 341/412] s390: Assorted BFP testsuite tweaks Rename rounding-1 to bfp-306054 because that was the corresponding BZ. Rename bfp-3 to bfp-muldiv as it is more expressive. Only compile testcases for 128-bit BFP if the compiler supports -mlong-double-128. Add -mlong-double-128 to the compile flags for the files that need it. This concludes fixing https://bugs.kde.org/show_bug.cgi?id=509572 --- .gitignore | 4 ++-- NEWS | 1 + none/tests/s390x/Makefile.am | 18 ++++++++++++++++-- none/tests/s390x/bfp-3.vgtest | 1 - .../tests/s390x/{rounding-1.c => bfp-306054.c} | 0 ...{bfp-3.stderr.exp => bfp-306054.stderr.exp} | 0 ...ding-1.stdout.exp => bfp-306054.stdout.exp} | 0 none/tests/s390x/bfp-306054.vgtest | 1 + none/tests/s390x/{bfp-3.c => bfp-muldiv.c} | 0 ...ding-1.stderr.exp => bfp-muldiv.stderr.exp} | 0 ...{bfp-3.stdout.exp => bfp-muldiv.stdout.exp} | 0 none/tests/s390x/bfp-muldiv.vgtest | 1 + none/tests/s390x/rounding-1.vgtest | 1 - 13 files changed, 21 insertions(+), 6 deletions(-) delete mode 100644 none/tests/s390x/bfp-3.vgtest rename none/tests/s390x/{rounding-1.c => bfp-306054.c} (100%) rename none/tests/s390x/{bfp-3.stderr.exp => bfp-306054.stderr.exp} (100%) rename none/tests/s390x/{rounding-1.stdout.exp => bfp-306054.stdout.exp} (100%) create mode 100644 none/tests/s390x/bfp-306054.vgtest rename none/tests/s390x/{bfp-3.c => bfp-muldiv.c} (100%) rename none/tests/s390x/{rounding-1.stderr.exp => bfp-muldiv.stderr.exp} (100%) rename none/tests/s390x/{bfp-3.stdout.exp => bfp-muldiv.stdout.exp} (100%) create mode 100644 none/tests/s390x/bfp-muldiv.vgtest delete mode 100644 none/tests/s390x/rounding-1.vgtest diff --git a/.gitignore b/.gitignore index 53e2a0f83..645f261bc 100644 --- a/.gitignore +++ b/.gitignore @@ -2184,12 +2184,12 @@ /none/tests/s390x/ecag /none/tests/s390x/fpext_warn /none/tests/s390x/fpext_fail -/none/tests/s390x/rounding-1 +/none/tests/s390x/bfp-306054 /none/tests/s390x/bfp-arith /none/tests/s390x/bfp-load /none/tests/s390x/bfp-fpc /none/tests/s390x/bfp-tdc -/none/tests/s390x/bfp-3 +/none/tests/s390x/bfp-muldiv /none/tests/s390x/bfp-compare /none/tests/s390x/bfp-convert /none/tests/s390x/comp-1 diff --git a/NEWS b/NEWS index d7f0cb3ba..147f4f56f 100644 --- a/NEWS +++ b/NEWS @@ -139,6 +139,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509139 Update BadSize error messages 509258 FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers 509517 s390x: Even/odd lane confusion in various vector insns +509572 s390x: Overhaul BFP testsuite 509566 Wrap amd64-linux syscall: 442 (mount_setattr) 509590 Run the LTP tests with LTP_QUIET 509567 unhandled amd64-linux syscall: 443 (quotactl_fd) diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index abe71570f..66254c3bb 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -9,8 +9,8 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \ cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \ ex_sig ex_clone cu14 cu14_1 cu41 ecag fpext_warn fpext_fail \ - bfp-tdc bfp-load bfp-fpc bfp-convert rounding-1 bfp-arith \ - bfp-3 bfp-compare comp-1 comp-2 exrl tmll tm stmg \ + bfp-fpc bfp-306054 \ + bfp-muldiv comp-1 comp-2 exrl tmll tm stmg \ ex clst mvc test_fork test_sig rxsbg popcnt \ high-word traps \ spechelper-alr spechelper-algr \ @@ -24,6 +24,10 @@ INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ dfp-1 dfp-2 dfp-3 dfp-4 dfpconv dfpext dfptest pfpo srnmt \ hfp +if HAS_MLONG_DOUBLE_128 +INSN_TESTS += bfp-arith bfp-compare bfp-convert bfp-load bfp-tdc +endif + check_PROGRAMS = $(INSN_TESTS) \ allexec \ op00 @@ -34,6 +38,11 @@ EXTRA_DIST = \ $(addsuffix .stderr.exp,$(INSN_TESTS)) \ $(addsuffix .stdout.exp,$(INSN_TESTS)) \ $(addsuffix .vgtest,$(INSN_TESTS)) \ + bfp-arith.vgtest bfp-arith.stdout.exp bfp-arith.stderr.exp \ + bfp-compare.vgtest bfp-compare.stdout.exp bfp-compare.stderr.exp \ + bfp-convert.vgtest bfp-convert.stdout.exp bfp-convert.stderr.exp \ + bfp-load.vgtest bfp-load.stdout.exp bfp-load.stderr.exp \ + bfp-tdc.vgtest bfp-tdc.stdout.exp bfp-tdc.stderr.exp \ bfp-emit.vgtest bfp-emit.stderr.exp bfp-emit.post.exp \ ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ @@ -69,3 +78,8 @@ vector_integer_CFLAGS = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=4 vector_float_CFLAGS = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=4 vec2_CFLAGS = $(AM_CFLAGS) -march=z13 vec2_float_CFLAGS = $(AM_CFLAGS) -march=z13 +bfp_arith_CFLAGS = $(AM_CFLAGS) -mlong-double-128 +bfp_compare_CFLAGS = $(AM_CFLAGS) -mlong-double-128 +bfp_convert_CFLAGS = $(AM_CFLAGS) -mlong-double-128 +bfp_load_CFLAGS = $(AM_CFLAGS) -mlong-double-128 +bfp_tdc_CFLAGS = $(AM_CFLAGS) -mlong-double-128 diff --git a/none/tests/s390x/bfp-3.vgtest b/none/tests/s390x/bfp-3.vgtest deleted file mode 100644 index 8088d7d64..000000000 --- a/none/tests/s390x/bfp-3.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: bfp-3 diff --git a/none/tests/s390x/rounding-1.c b/none/tests/s390x/bfp-306054.c similarity index 100% rename from none/tests/s390x/rounding-1.c rename to none/tests/s390x/bfp-306054.c diff --git a/none/tests/s390x/bfp-3.stderr.exp b/none/tests/s390x/bfp-306054.stderr.exp similarity index 100% rename from none/tests/s390x/bfp-3.stderr.exp rename to none/tests/s390x/bfp-306054.stderr.exp diff --git a/none/tests/s390x/rounding-1.stdout.exp b/none/tests/s390x/bfp-306054.stdout.exp similarity index 100% rename from none/tests/s390x/rounding-1.stdout.exp rename to none/tests/s390x/bfp-306054.stdout.exp diff --git a/none/tests/s390x/bfp-306054.vgtest b/none/tests/s390x/bfp-306054.vgtest new file mode 100644 index 000000000..3948f3427 --- /dev/null +++ b/none/tests/s390x/bfp-306054.vgtest @@ -0,0 +1 @@ +prog: bfp-306054 diff --git a/none/tests/s390x/bfp-3.c b/none/tests/s390x/bfp-muldiv.c similarity index 100% rename from none/tests/s390x/bfp-3.c rename to none/tests/s390x/bfp-muldiv.c diff --git a/none/tests/s390x/rounding-1.stderr.exp b/none/tests/s390x/bfp-muldiv.stderr.exp similarity index 100% rename from none/tests/s390x/rounding-1.stderr.exp rename to none/tests/s390x/bfp-muldiv.stderr.exp diff --git a/none/tests/s390x/bfp-3.stdout.exp b/none/tests/s390x/bfp-muldiv.stdout.exp similarity index 100% rename from none/tests/s390x/bfp-3.stdout.exp rename to none/tests/s390x/bfp-muldiv.stdout.exp diff --git a/none/tests/s390x/bfp-muldiv.vgtest b/none/tests/s390x/bfp-muldiv.vgtest new file mode 100644 index 000000000..df1275fa7 --- /dev/null +++ b/none/tests/s390x/bfp-muldiv.vgtest @@ -0,0 +1 @@ +prog: bfp-muldiv diff --git a/none/tests/s390x/rounding-1.vgtest b/none/tests/s390x/rounding-1.vgtest deleted file mode 100644 index 4c1e45b2b..000000000 --- a/none/tests/s390x/rounding-1.vgtest +++ /dev/null @@ -1 +0,0 @@ -prog: rounding-1 From b5b7e0238af259848996cf79b763600e2b76a14a Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 26 Sep 2025 22:01:46 +0000 Subject: [PATCH 342/412] Fix file permissions. The following files do not need to be executable: - configure.ac - Makefile*am - *.in The following files lack execute permission: - tests/platform_test - tests/vg_regtest - perf/vg_perf So from now on you can just run tests/vg_regtest and perf/vg_perf without the perl prefix. Docs changed accordingly. --- Makefile.all.am | 0 README_DEVELOPERS | 44 +++++++++---------- cachegrind/cg_annotate.in | 0 cachegrind/cg_diff.in | 0 cachegrind/cg_merge.in | 0 configure.ac | 6 ++- coregrind/link_tool_exe_freebsd.in | 0 coregrind/vgstack.in | 0 drd/scripts/download-and-build-splash2.in | 0 drd/tests/Makefile.am | 0 drd/tests/filter_error_count.in | 0 drd/tests/filter_error_summary.in | 0 drd/tests/filter_stderr.in | 0 .../filter_stderr_and_thread_no_and_offset.in | 0 drd/tests/filter_thread_no.in | 0 drd/tests/filter_xml_and_thread_no.in | 0 gdbserver_tests/Makefile.am | 0 gdbserver_tests/README_DEVELOPERS | 4 +- gdbserver_tests/filter_gdb.in | 0 gdbserver_tests/filter_memcheck_monitor.in | 0 gdbserver_tests/filter_stderr.in | 0 gdbserver_tests/filter_vgdb.in | 0 helgrind/tests/Makefile.am | 0 helgrind/tests/filter_stderr.in | 0 massif/ms_print.in | 0 memcheck/tests/filter_dw4.in | 0 memcheck/tests/filter_overlaperror.in | 0 memcheck/tests/filter_stderr.in | 0 memcheck/tests/filter_supp.in | 0 memcheck/tests/x86/filter_pushfpopf.in | 0 tests/filter_discards.in | 0 tests/filter_stderr_basic.in | 0 tests/platform_test | 0 tests/vg_regtest.in | 2 +- 34 files changed, 29 insertions(+), 27 deletions(-) mode change 100755 => 100644 Makefile.all.am mode change 100755 => 100644 cachegrind/cg_annotate.in mode change 100755 => 100644 cachegrind/cg_diff.in mode change 100755 => 100644 cachegrind/cg_merge.in mode change 100755 => 100644 configure.ac mode change 100755 => 100644 coregrind/link_tool_exe_freebsd.in mode change 100755 => 100644 coregrind/vgstack.in mode change 100755 => 100644 drd/scripts/download-and-build-splash2.in mode change 100755 => 100644 drd/tests/Makefile.am mode change 100755 => 100644 drd/tests/filter_error_count.in mode change 100755 => 100644 drd/tests/filter_error_summary.in mode change 100755 => 100644 drd/tests/filter_stderr.in mode change 100755 => 100644 drd/tests/filter_stderr_and_thread_no_and_offset.in mode change 100755 => 100644 drd/tests/filter_thread_no.in mode change 100755 => 100644 drd/tests/filter_xml_and_thread_no.in mode change 100755 => 100644 gdbserver_tests/Makefile.am mode change 100755 => 100644 gdbserver_tests/filter_gdb.in mode change 100755 => 100644 gdbserver_tests/filter_memcheck_monitor.in mode change 100755 => 100644 gdbserver_tests/filter_stderr.in mode change 100755 => 100644 gdbserver_tests/filter_vgdb.in mode change 100755 => 100644 helgrind/tests/Makefile.am mode change 100755 => 100644 helgrind/tests/filter_stderr.in mode change 100755 => 100644 massif/ms_print.in mode change 100755 => 100644 memcheck/tests/filter_dw4.in mode change 100755 => 100644 memcheck/tests/filter_overlaperror.in mode change 100755 => 100644 memcheck/tests/filter_stderr.in mode change 100755 => 100644 memcheck/tests/filter_supp.in mode change 100755 => 100644 memcheck/tests/x86/filter_pushfpopf.in mode change 100755 => 100644 tests/filter_discards.in mode change 100755 => 100644 tests/filter_stderr_basic.in mode change 100644 => 100755 tests/platform_test mode change 100755 => 100644 tests/vg_regtest.in diff --git a/Makefile.all.am b/Makefile.all.am old mode 100755 new mode 100644 diff --git a/README_DEVELOPERS b/README_DEVELOPERS index fc5a80129..22e229bd4 100644 --- a/README_DEVELOPERS +++ b/README_DEVELOPERS @@ -53,15 +53,15 @@ To build and run all the regression tests, run "make [--quiet] regtest". To run a subset of the regression tests, execute: - perl tests/vg_regtest + tests/vg_regtest where is a directory (all tests within will be run) or a single .vgtest test file, or the name of a program which has a like-named .vgtest file. Eg: - perl tests/vg_regtest memcheck - perl tests/vg_regtest memcheck/tests/badfree.vgtest - perl tests/vg_regtest memcheck/tests/badfree + tests/vg_regtest memcheck + tests/vg_regtest memcheck/tests/badfree.vgtest + tests/vg_regtest memcheck/tests/badfree The details of each vgtest run are logged to individual "vgtest.log" files. These are listed, and non-passing tests detailed, in the @@ -114,22 +114,22 @@ To build and run all the performance tests, run "make [--quiet] perf". To run a subset of the performance suite, execute: - perl perf/vg_perf + perf/vg_perf where is a directory (all tests within will be run) or a single .vgperf test file, or the name of a program which has a like-named .vgperf file. Eg: - perl perf/vg_perf perf/ - perl perf/vg_perf perf/bz2.vgperf - perl perf/vg_perf perf/bz2 + perf/vg_perf perf/ + perf/vg_perf perf/bz2.vgperf + perf/vg_perf perf/bz2 To compare multiple versions of Valgrind, use the --vg= option multiple times. For example, if you have two Valgrinds next to each other, one in trunk1/ and one in trunk2/, from within either trunk1/ or trunk2/ do this to compare them on all the performance tests: - perl perf/vg_perf --vg=../trunk1 --vg=../trunk2 perf/ + perf/vg_perf --vg=../trunk1 --vg=../trunk2 perf/ Writing regression tests ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -183,7 +183,7 @@ See tests/vg_regtest for a full description of all possible vgtest directives. The easiest way to generate the expected files is to run the test. Create empty files with touch (otherwise the test won't run) then run the test from the -top directory using perl and vg_regtest script (as in the "Running the +top directory using vg_regtest script (as in the "Running the regression tests" section. Then copy "tool/tests/newtest.stderr.out" to "tool/tests/newtest.stderr.exp". It is better to generate the .stdout.exp file directly from the testcase. You can do that by redirecting stdout to @@ -402,16 +402,16 @@ When using self-hosting with an outer Callgrind tool, use '--pop-on-jump' (B) Regression tests in an outer/inner setup: To run all the regression tests with an outer memcheck, do : - perl tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ - --all + tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ + --all To run a specific regression tests with an outer memcheck, do: - perl tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ - none/tests/args.vgtest + tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ + none/tests/args.vgtest To run regression tests with another outer tool: - perl tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ - --outer-tool=helgrind --all + tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \ + --outer-tool=helgrind --all --outer-args allows to give specific arguments to the outer tool, replacing the default one provided by vg_regtest. @@ -470,20 +470,20 @@ the guest stacktrace that did the allocation. (C) Performance tests in an outer/inner setup: To run all the performance tests with an outer cachegrind, do : - perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf + perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf To run a specific perf test (e.g. bz2) in this setup, do : - perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf/bz2 + perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf/bz2 To run all the performance tests with an outer callgrind, do : - perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \ - --outer-tool=callgrind perf + perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \ + --outer-tool=callgrind perf Note: --outer-valgrind must be a "make install"-ed valgrind. Do *not* use vg-in-place. To compare the performance of multiple Valgrind versions, do : - perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \ + perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \ --outer-tool=callgrind \ --vg=../inner_xxxx --vg=../inner_yyyy perf (where inner_xxxx and inner_yyyy are the toplevel directories of @@ -498,7 +498,7 @@ output files will be created for each test: (where tt is the two letters abbreviation for the inner tool(s) run). For example, the command - perl perf/vg_perf \ + perf/vg_perf \ --outer-valgrind=../outer_trunk/install/bin/valgrind \ --outer-tool=callgrind \ --vg=../inner_tchain --vg=../inner_trunk perf/many-loss-records diff --git a/cachegrind/cg_annotate.in b/cachegrind/cg_annotate.in old mode 100755 new mode 100644 diff --git a/cachegrind/cg_diff.in b/cachegrind/cg_diff.in old mode 100755 new mode 100644 diff --git a/cachegrind/cg_merge.in b/cachegrind/cg_merge.in old mode 100755 new mode 100644 diff --git a/configure.ac b/configure.ac old mode 100755 new mode 100644 index 1e7d50655..1a7ea34d1 --- a/configure.ac +++ b/configure.ac @@ -5752,9 +5752,7 @@ AC_CONFIG_FILES([ docs/Makefile docs/xml/vg-entities.xml tests/Makefile - tests/vg_regtest perf/Makefile - perf/vg_perf gdbserver_tests/Makefile gdbserver_tests/solaris/Makefile include/Makefile @@ -5860,6 +5858,10 @@ AC_CONFIG_FILES([tests/filter_stderr_basic], [chmod +x tests/filter_stderr_basic]) AC_CONFIG_FILES([tests/filter_discards], [chmod +x tests/filter_discards]) +AC_CONFIG_FILES([tests/vg_regtest], + [chmod +x tests/vg_regtest]) +AC_CONFIG_FILES([perf/vg_perf], + [chmod +x perf/vg_perf]) AC_CONFIG_FILES([memcheck/tests/filter_stderr], [chmod +x memcheck/tests/filter_stderr]) AC_CONFIG_FILES([memcheck/tests/filter_dw4], diff --git a/coregrind/link_tool_exe_freebsd.in b/coregrind/link_tool_exe_freebsd.in old mode 100755 new mode 100644 diff --git a/coregrind/vgstack.in b/coregrind/vgstack.in old mode 100755 new mode 100644 diff --git a/drd/scripts/download-and-build-splash2.in b/drd/scripts/download-and-build-splash2.in old mode 100755 new mode 100644 diff --git a/drd/tests/Makefile.am b/drd/tests/Makefile.am old mode 100755 new mode 100644 diff --git a/drd/tests/filter_error_count.in b/drd/tests/filter_error_count.in old mode 100755 new mode 100644 diff --git a/drd/tests/filter_error_summary.in b/drd/tests/filter_error_summary.in old mode 100755 new mode 100644 diff --git a/drd/tests/filter_stderr.in b/drd/tests/filter_stderr.in old mode 100755 new mode 100644 diff --git a/drd/tests/filter_stderr_and_thread_no_and_offset.in b/drd/tests/filter_stderr_and_thread_no_and_offset.in old mode 100755 new mode 100644 diff --git a/drd/tests/filter_thread_no.in b/drd/tests/filter_thread_no.in old mode 100755 new mode 100644 diff --git a/drd/tests/filter_xml_and_thread_no.in b/drd/tests/filter_xml_and_thread_no.in old mode 100755 new mode 100644 diff --git a/gdbserver_tests/Makefile.am b/gdbserver_tests/Makefile.am old mode 100755 new mode 100644 diff --git a/gdbserver_tests/README_DEVELOPERS b/gdbserver_tests/README_DEVELOPERS index c570f3e53..250c14326 100644 --- a/gdbserver_tests/README_DEVELOPERS +++ b/gdbserver_tests/README_DEVELOPERS @@ -15,7 +15,7 @@ or (to just run the gdbserver tests with another gdb): make check cd .. gdbserver_tests/make_local_links /path/to/another/gdb - perl tests/vg_regtest gdbserver_tests + tests/vg_regtest gdbserver_tests The minimum version to run the tests is gdb >= 6.5. Previous versions do not have the 'target remote |' command. It @@ -45,7 +45,7 @@ You are welcome to fix such bugs by enhancing filter_gdb. Alternatively, to report such problems, the best is to re-run the gdbserver tests the following way: - perl tests/vg_regtest --keep-unfiltered gdbserver_tests + tests/vg_regtest --keep-unfiltered gdbserver_tests Then file a bug in bugzilla, giving the following information: output of diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in old mode 100755 new mode 100644 diff --git a/gdbserver_tests/filter_memcheck_monitor.in b/gdbserver_tests/filter_memcheck_monitor.in old mode 100755 new mode 100644 diff --git a/gdbserver_tests/filter_stderr.in b/gdbserver_tests/filter_stderr.in old mode 100755 new mode 100644 diff --git a/gdbserver_tests/filter_vgdb.in b/gdbserver_tests/filter_vgdb.in old mode 100755 new mode 100644 diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am old mode 100755 new mode 100644 diff --git a/helgrind/tests/filter_stderr.in b/helgrind/tests/filter_stderr.in old mode 100755 new mode 100644 diff --git a/massif/ms_print.in b/massif/ms_print.in old mode 100755 new mode 100644 diff --git a/memcheck/tests/filter_dw4.in b/memcheck/tests/filter_dw4.in old mode 100755 new mode 100644 diff --git a/memcheck/tests/filter_overlaperror.in b/memcheck/tests/filter_overlaperror.in old mode 100755 new mode 100644 diff --git a/memcheck/tests/filter_stderr.in b/memcheck/tests/filter_stderr.in old mode 100755 new mode 100644 diff --git a/memcheck/tests/filter_supp.in b/memcheck/tests/filter_supp.in old mode 100755 new mode 100644 diff --git a/memcheck/tests/x86/filter_pushfpopf.in b/memcheck/tests/x86/filter_pushfpopf.in old mode 100755 new mode 100644 diff --git a/tests/filter_discards.in b/tests/filter_discards.in old mode 100755 new mode 100644 diff --git a/tests/filter_stderr_basic.in b/tests/filter_stderr_basic.in old mode 100755 new mode 100644 diff --git a/tests/platform_test b/tests/platform_test old mode 100644 new mode 100755 diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in old mode 100755 new mode 100644 index 3471322b0..945b4c161 --- a/tests/vg_regtest.in +++ b/tests/vg_regtest.in @@ -692,7 +692,7 @@ sub test_one_dir($$) if (256 == system("$tests_dir/tests/arch_test $dir")) { return; } if (256 == system("$tests_dir/tests/os_test $dir")) { return; } if ($dir =~ /(\w+)-(\w+)/ && - 256 == system("sh $tests_dir/tests/platform_test $1 $2")) { return; } + 256 == system("$tests_dir/tests/platform_test $1 $2")) { return; } if ($dir =~ "dSYM") { return; } chdir($dir) or die "Could not change into $dir\n"; From 78aa1064d8d7d46ebfb5ce488ff3355ce0db16cd Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 28 Sep 2025 13:17:28 +0000 Subject: [PATCH 343/412] Add BZ 309100 --- NEWS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 147f4f56f..1d2a6ea65 100644 --- a/NEWS +++ b/NEWS @@ -67,8 +67,9 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. -331311 Valgrind shows open files in /proc/self/fd that don't work for the process +309100 s390x: Testcases for extended BFP 309554 Wrap syscall remap_file_pages (216) +331311 Valgrind shows open files in /proc/self/fd that don't work for the process 338803 Handling of dwz debug alt files or cross-CU is broken 369030 Wrap linux syscall: 171 (setdomainname) 388526 Inconsistent severity in message text: "WARNING: Serious error" @@ -139,8 +140,8 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509139 Update BadSize error messages 509258 FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers 509517 s390x: Even/odd lane confusion in various vector insns -509572 s390x: Overhaul BFP testsuite 509566 Wrap amd64-linux syscall: 442 (mount_setattr) +509572 s390x: Overhaul BFP testsuite 509590 Run the LTP tests with LTP_QUIET 509567 unhandled amd64-linux syscall: 443 (quotactl_fd) 509642 Add missing ppc64-linux syswraps From 69e975e759c81a7790eb1f0e58881cef64c560c6 Mon Sep 17 00:00:00 2001 From: Andreas Arnez Date: Mon, 29 Sep 2025 16:11:04 +0200 Subject: [PATCH 344/412] s390x: Fix inline assembly for STFLE The inline assembly for emitting the STFLE instruction changes GPR 0, but fails to mention it in the clobber list. Depending on the compiler's mood, this may result in wrong code. A simple fix would be to just add "0" to the clobber list, but for readability it also helps to move the inline assembly to a separate function. So do that. In that function, use an "asm" variable for GPR 0 instead of moving the value back and forth between registers. --- coregrind/m_extension/extension-s390x.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/coregrind/m_extension/extension-s390x.c b/coregrind/m_extension/extension-s390x.c index 98b825d9b..a0c2913d4 100644 --- a/coregrind/m_extension/extension-s390x.c +++ b/coregrind/m_extension/extension-s390x.c @@ -902,6 +902,20 @@ static UWord do_extension_DFLTCC(ThreadState* tst, ULong variant) /*--- STFLE (store facility list extended) ---*/ /*---------------------------------------------------------------*/ +static int do_STFLE_insn(void* addr, ULong nwords, ULong* gpr0) +{ + register ULong reg0 asm("0") = *gpr0; + Int cc; + + asm(".insn s,0xb2b00000,%[out]\n" /* stfle */ + "ipm %[cc]\n" + : [out] "=Q"(*(ULong(*)[nwords])addr), [r0] "+d"(reg0), [cc] "=d"(cc) + : + : "cc"); + *gpr0 = reg0; + return cc >> 28; +} + static enum ExtensionError do_extension_STFLE(ThreadState* tst, ULong variant) { Int cc = 0; @@ -972,15 +986,8 @@ static enum ExtensionError do_extension_STFLE(ThreadState* tst, ULong variant) /* 195: unassigned */ | S390_SETBITS(196, 197)), }; - asm("lgr 0,%[r0]\n" - ".insn s,0xb2b00000,%[out]\n" /* stfle */ - "lgr %[r0],0\n" - "ipm %[cc]\n" - "srl %[cc],28\n" - : [out] "=Q"(*(ULong(*)[last_dw + 1])(void*)addr), [r0] "+d"(gpr0), - [cc] "=d"(cc) - : - : "cc"); + + cc = do_STFLE_insn((void*)addr, last_dw + 1, &gpr0); WRITE_GPR(tst, 0, gpr0); if (last_dw > (gpr0 & 0xff)) From d60982b80c6a7ae7a731305e3087345de4c1a023 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 29 Sep 2025 21:34:56 +0000 Subject: [PATCH 345/412] s390: Add testcases for unhandled IEEE exceptions. Fixes BZ 306098 New emulation warnings: EmWarn_S390X_XxC_not_zero and EmWarn_S390X_XiC_not_zero New testcases bfp-XxC, dfp-XxC, and dfp-XiC. New testcase driver emwarn-gen.pl to get around valgrind's restriction on the number of emulation warnings. Fixes https://bugs.kde.org/show_bug.cgi?id=306098 --- NEWS | 1 + VEX/priv/guest_s390_toIR.c | 250 +++++++++++++++++----------- VEX/priv/main_main.c | 10 +- VEX/pub/libvex_emnote.h | 18 +- none/tests/s390x/Makefile.am | 5 +- none/tests/s390x/bfp-XxC.post.exp | 234 ++++++++++++++++++++++++++ none/tests/s390x/bfp-XxC.stderr.exp | 2 + none/tests/s390x/bfp-XxC.vgtest | 3 + none/tests/s390x/dfp-XiC.post.exp | 36 ++++ none/tests/s390x/dfp-XiC.stderr.exp | 2 + none/tests/s390x/dfp-XiC.vgtest | 3 + none/tests/s390x/dfp-XxC.post.exp | 146 ++++++++++++++++ none/tests/s390x/dfp-XxC.stderr.exp | 2 + none/tests/s390x/dfp-XxC.vgtest | 3 + none/tests/s390x/emwarn-gen.pl | 179 ++++++++++++++++++++ 15 files changed, 794 insertions(+), 100 deletions(-) create mode 100644 none/tests/s390x/bfp-XxC.post.exp create mode 100644 none/tests/s390x/bfp-XxC.stderr.exp create mode 100644 none/tests/s390x/bfp-XxC.vgtest create mode 100644 none/tests/s390x/dfp-XiC.post.exp create mode 100644 none/tests/s390x/dfp-XiC.stderr.exp create mode 100644 none/tests/s390x/dfp-XiC.vgtest create mode 100644 none/tests/s390x/dfp-XxC.post.exp create mode 100644 none/tests/s390x/dfp-XxC.stderr.exp create mode 100644 none/tests/s390x/dfp-XxC.vgtest create mode 100755 none/tests/s390x/emwarn-gen.pl diff --git a/NEWS b/NEWS index 1d2a6ea65..d7367ba05 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +306098 s390x: Alternate opcode form for convert to/from fixed and friends 309100 s390x: Testcases for extended BFP 309554 Wrap syscall remap_file_pages (216) 331311 Valgrind shows open files in /proc/self/fd that don't work for the process diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 1f18fee66..aad1a0dbb 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -778,7 +778,7 @@ static void s390_print(HChar *text, IRExpr *value) { IRDirty *d; - + d = unsafeIRDirty_0_N(0 /* regparms */, "s390_do_print", &s390_do_print, mkIRExprVec_2(mkU64((ULong)text), value)); stmt(IRStmt_Dirty(d)); @@ -11458,13 +11458,14 @@ s390_irgen_ADB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_CEFBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CEFBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("cefbra", is_valid_rounding_mode(m3)); IRTemp op2 = newTemp(Ity_I32); @@ -11477,10 +11478,11 @@ s390_irgen_CEFBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDFBRA(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CDFBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cdfbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -11491,13 +11493,14 @@ s390_irgen_CDFBRA(UChar m3, } static const HChar * -s390_irgen_CEGBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CEGBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("cegbra", is_valid_rounding_mode(m3)); IRTemp op2 = newTemp(Ity_I64); @@ -11510,13 +11513,14 @@ s390_irgen_CEGBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDGBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDGBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("cdgbra", is_valid_rounding_mode(m3)); IRTemp op2 = newTemp(Ity_I64); @@ -11529,13 +11533,14 @@ s390_irgen_CDGBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CELFBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CELFBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("celfbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -11547,13 +11552,14 @@ s390_irgen_CELFBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDLFBR(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CDLFBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cdlfbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -11564,13 +11570,14 @@ s390_irgen_CDLFBR(UChar m3, } static const HChar * -s390_irgen_CELGBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CELGBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("celgbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -11582,13 +11589,14 @@ s390_irgen_CELGBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDLGBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDLGBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cdlgbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -11601,13 +11609,14 @@ s390_irgen_CDLGBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFEBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFEBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfebr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I32); @@ -11623,13 +11632,14 @@ s390_irgen_CLFEBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFDBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFDBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfdbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I32); @@ -11645,13 +11655,14 @@ s390_irgen_CLFDBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGEBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGEBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgebr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I64); @@ -11667,13 +11678,14 @@ s390_irgen_CLGEBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGDBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGDBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgdbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I64); @@ -11689,10 +11701,11 @@ s390_irgen_CLGDBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CFEBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFEBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cfebra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I32); @@ -11708,10 +11721,11 @@ s390_irgen_CFEBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CFDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cfdbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I32); @@ -11727,10 +11741,11 @@ s390_irgen_CFDBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGEBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGEBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cgebra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I64); @@ -11746,10 +11761,11 @@ s390_irgen_CGEBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cgdbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I64); @@ -11903,13 +11919,14 @@ s390_irgen_LDEB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_LEDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LEDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("ledbra", is_valid_rounding_mode(m3)); IRTemp op = newTemp(Ity_F64); @@ -12162,11 +12179,13 @@ s390_irgen_CXTR(UChar r1, UChar r2) static const HChar * s390_irgen_CDFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -12177,12 +12196,14 @@ s390_irgen_CDFTR(UChar m3 __attribute__((unused)), static const HChar * s390_irgen_CXFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { s390_insn_assert("cxftr", is_valid_fpr_pair(r1)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -12193,8 +12214,7 @@ s390_irgen_CXFTR(UChar m3 __attribute__((unused)), } static const HChar * -s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDGTRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12205,6 +12225,8 @@ s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_DFP_ROUND_PER_FPC_0; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); assign(op2, get_gpr_dw0(r2)); put_dpr_dw0(r1, binop(Iop_I64StoD64, mkexpr(encode_dfp_rounding_mode(m3)), @@ -12215,12 +12237,14 @@ s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)), static const HChar * s390_irgen_CXGTRA(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { s390_insn_assert("cxgtra", is_valid_fpr_pair(r1)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -12235,7 +12259,7 @@ s390_irgen_CXGTRA(UChar m3 __attribute__((unused)), static const HChar * s390_irgen_CDLFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12243,6 +12267,8 @@ s390_irgen_CDLFTR(UChar m3 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -12254,7 +12280,7 @@ s390_irgen_CDLFTR(UChar m3 __attribute__((unused)), static const HChar * s390_irgen_CXLFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12263,6 +12289,8 @@ s390_irgen_CXLFTR(UChar m3 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlftr", is_valid_fpr_pair(r1)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -12274,8 +12302,7 @@ s390_irgen_CXLFTR(UChar m3 __attribute__((unused)), } static const HChar * -s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDLGTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12283,6 +12310,8 @@ s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -12296,7 +12325,7 @@ s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)), static const HChar * s390_irgen_CXLGTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12305,6 +12334,8 @@ s390_irgen_CXLGTR(UChar m3 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlgtr", is_valid_fpr_pair(r1)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -12316,8 +12347,7 @@ s390_irgen_CXLGTR(UChar m3 __attribute__((unused)), } static const HChar * -s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12325,6 +12355,8 @@ s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12340,8 +12372,7 @@ s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12350,6 +12381,8 @@ s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cfxtr", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I32); @@ -12367,8 +12400,7 @@ s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGDTRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12376,6 +12408,8 @@ s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12388,8 +12422,7 @@ s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGXTRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGXTRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12398,6 +12431,8 @@ s390_irgen_CGXTRA(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cgxtra", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12456,8 +12491,7 @@ s390_irgen_CEXTR(UChar r1, UChar r2) } static const HChar * -s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12465,6 +12499,8 @@ s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12480,8 +12516,7 @@ s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12490,6 +12525,8 @@ s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfxtr", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I32); @@ -12507,8 +12544,7 @@ s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12516,6 +12552,8 @@ s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp result = newTemp(Ity_I64); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12531,8 +12569,7 @@ s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12541,6 +12578,8 @@ s390_irgen_CLGXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgxtr", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I64); @@ -12701,11 +12740,13 @@ s390_irgen_IEXTR(UChar r3, UChar r1, UChar r2) } static const HChar * -s390_irgen_LDETR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_LDETR(UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); IRTemp op = newTemp(Ity_D32); assign(op, get_dpr_w0(r2)); @@ -12715,11 +12756,13 @@ s390_irgen_LDETR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) } static const HChar * -s390_irgen_LXDTR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_LXDTR(UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); s390_insn_assert("lxdtr", is_valid_fpr_pair(r1)); IRTemp op = newTemp(Ity_D64); @@ -12731,8 +12774,7 @@ s390_irgen_LXDTR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) } static const HChar * -s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LDXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12746,6 +12788,10 @@ s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_DFP_ROUND_PER_FPC_0; } + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_D64); assign(result, binop(Iop_D128toD64, mkexpr(encode_dfp_rounding_mode(m3)), @@ -12756,8 +12802,7 @@ s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_LEDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LEDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12768,6 +12813,10 @@ s390_irgen_LEDTR(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_DFP_ROUND_PER_FPC_0; } + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); assign(op, get_dpr_dw0(r2)); @@ -14855,11 +14904,12 @@ s390_irgen_KDB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_CXFBRA(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXFBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cxfbra", is_valid_fpr_pair(r1)); s390_insn_assert("cxfbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -14870,14 +14920,15 @@ s390_irgen_CXFBRA(UChar m3, } static const HChar * -s390_irgen_CXLFBR(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXLFBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlfbr", is_valid_fpr_pair(r1)); s390_insn_assert("cxlfbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -14889,11 +14940,12 @@ s390_irgen_CXLFBR(UChar m3, static const HChar * -s390_irgen_CXGBRA(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXGBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cxgbra", is_valid_fpr_pair(r1)); s390_insn_assert("cxgbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -14904,14 +14956,15 @@ s390_irgen_CXGBRA(UChar m3, } static const HChar * -s390_irgen_CXLGBR(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXLGBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlgbr", is_valid_fpr_pair(r1)); s390_insn_assert("cxlgbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -14922,11 +14975,12 @@ s390_irgen_CXLGBR(UChar m3, } static const HChar * -s390_irgen_CFXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cfxbra", is_valid_fpr_pair(r2)); s390_insn_assert("cfxbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I32); @@ -14942,14 +14996,15 @@ s390_irgen_CFXBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFXBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFXBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfxbr", is_valid_fpr_pair(r2)); s390_insn_assert("clfxbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I32); @@ -14966,11 +15021,12 @@ s390_irgen_CLFXBR(UChar m3, UChar m4 __attribute__((unused)), static const HChar * -s390_irgen_CGXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cgxbra", is_valid_fpr_pair(r2)); s390_insn_assert("cgxbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I64); @@ -14986,14 +15042,15 @@ s390_irgen_CGXBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGXBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGXBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgxbr", is_valid_fpr_pair(r2)); s390_insn_assert("clgxbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I64); @@ -15112,10 +15169,11 @@ s390_irgen_LXEB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_FIEBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_FIEBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("fiebra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_F32); @@ -15127,10 +15185,11 @@ s390_irgen_FIEBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_FIDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_FIDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("fidbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_F64); @@ -15142,12 +15201,13 @@ s390_irgen_FIDBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_FIXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_FIXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("fixbra", is_valid_fpr_pair(r1)); s390_insn_assert("fixbra", is_valid_fpr_pair(r2)); s390_insn_assert("fixbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_F128); @@ -15237,13 +15297,14 @@ s390_irgen_LPXBR(UChar r1, UChar r2) } static const HChar * -s390_irgen_LDXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LDXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("ldxbra", is_valid_fpr_pair(r1)); s390_insn_assert("ldxbra", is_valid_fpr_pair(r2)); s390_insn_assert("ldxbra", is_valid_rounding_mode(m3)); @@ -15258,13 +15319,14 @@ s390_irgen_LDXBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_LEXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LEXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("lexbra", is_valid_fpr_pair(r1)); s390_insn_assert("lexbra", is_valid_fpr_pair(r2)); s390_insn_assert("lexbra", is_valid_rounding_mode(m3)); @@ -16088,7 +16150,7 @@ s390_irgen_TRE(UChar r1,UChar r2) /* Load character from source string and compare with test byte */ assign(op, load(Ity_I8, mkexpr(src_addr))); - + s390_cc_set_val(1); next_insn_if(binop(Iop_CmpEQ8, mkexpr(op), mkexpr(test_byte))); diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index db78238ae..85da551d5 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -719,7 +719,7 @@ IRSB* LibVEX_FrontEnd ( /*MOD*/ VexTranslateArgs* vta, vta->guest_extents, &vta->archinfo_host, guest_word_type, host_word_type); - + if (vex_traceflags & VEX_TRACE_INST) { vex_printf("\n------------------------" " After instrumentation " @@ -1541,6 +1541,14 @@ const HChar* LibVEX_EmNote_string ( VexEmNote ew ) " feature requires the floating point extension facility\n" " which is not available on this host. Continuing using\n" " the rounding mode from FPC. Results may differ!"; + case EmWarn_S390X_XxC_not_zero: + return "Encountered an insn with the IEEE-inexact-exception control\n" + " (XxC) bit set to 1. This is not supported. Continuing anyway.\n" + " IEEE-inexact exceptions will not be suppressed."; + case EmWarn_S390X_XiC_not_zero: + return "Encountered an insn with the IEEE-invalid-operation-exception\n" + " control (XiC) bit set to 1. This is not supported. Continuing anyway.\n" + " IEEE-invalid-operation exceptions will not be suppressed."; case EmFail_S390X_stfle: return "Instruction stfle is not supported on this host"; case EmFail_S390X_stckf: diff --git a/VEX/pub/libvex_emnote.h b/VEX/pub/libvex_emnote.h index be17a8922..bd998a1c0 100644 --- a/VEX/pub/libvex_emnote.h +++ b/VEX/pub/libvex_emnote.h @@ -37,7 +37,7 @@ #include "libvex_basictypes.h" /* VEX can sometimes generate code which returns to the dispatcher - with the guest state pointer set to VEX_TRC_JMP_EMWARN or + with the guest state pointer set to VEX_TRC_JMP_EMWARN or VEX_TRC_JMP_EMFAIL. This means that VEX is trying to tell Valgrind something noteworthy about emulation progress. For example, that Valgrind is doing imprecise emulation in some sense. The guest's pseudo-register @@ -67,16 +67,16 @@ typedef /* unmasking SSE FP exceptions is not supported */ EmWarn_X86_sseExns, - + /* setting mxcsr.fz is not supported */ EmWarn_X86_fz, - + /* setting mxcsr.daz is not supported */ EmWarn_X86_daz, /* settings to %eflags.ac (alignment check) are noted but ignored */ EmWarn_X86_acFlag, - + /* unmasking PPC32/64 FP exceptions is not supported */ EmWarn_PPCexns, @@ -89,6 +89,16 @@ typedef facility is not available on this host */ EmWarn_S390X_fpext_rounding, + /* Various BFP insns have an M4 field containing the + IEEE-inexact-exception (XxC) control bit. That bit cannot me modelled + in VEX and is expected to be zero. */ + EmWarn_S390X_XxC_not_zero, + + /* Various DFP insns have an M4 field containing the + IEEE-invalid-operation (XiC) control bit. That bit cannot me modelled + in VEX and is expected to be zero. */ + EmWarn_S390X_XiC_not_zero, + /* stfle insn is not supported on this host */ EmFail_S390X_stfle, diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 66254c3bb..e0ca00d5b 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/Makefile.tool-tests.am -dist_noinst_SCRIPTS = filter_stderr bfp-emit.pl +dist_noinst_SCRIPTS = filter_stderr bfp-emit.pl emwarn-gen.pl INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ and or xor insert div srst fold_And16 flogr sub_EI add_EI \ @@ -44,6 +44,7 @@ EXTRA_DIST = \ bfp-load.vgtest bfp-load.stdout.exp bfp-load.stderr.exp \ bfp-tdc.vgtest bfp-tdc.stdout.exp bfp-tdc.stderr.exp \ bfp-emit.vgtest bfp-emit.stderr.exp bfp-emit.post.exp \ + bfp-XxC.vgtest bfp-XxC.stderr.exp bfp-XxC.post.exp \ ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ ecag.stdout.exp-z16 \ @@ -57,6 +58,8 @@ EXTRA_DIST = \ dfptest.stderr.exp dfptest.stdout.exp dfptest.vgtest \ dfpext.stderr.exp dfpext.stdout.exp dfpext.vgtest \ dfpconv.stderr.exp dfpconv.stdout.exp dfpconv.vgtest \ + dfp-XxC.vgtest dfp-XxC.stderr.exp dfp-XxC.post.exp \ + dfp-XiC.vgtest dfp-XiC.stderr.exp dfp-XiC.post.exp \ srnmt.stderr.exp srnmt.stdout.exp srnmt.vgtest \ stfle.stdout.exp-z16 \ pfpo.stderr.exp pfpo.stdout.exp pfpo.vgtest diff --git a/none/tests/s390x/bfp-XxC.post.exp b/none/tests/s390x/bfp-XxC.post.exp new file mode 100644 index 000000000..4e63c6b4e --- /dev/null +++ b/none/tests/s390x/bfp-XxC.post.exp @@ -0,0 +1,234 @@ + +============================================================ +BFP CONVERT FROM FIXED +============================================================ +Testing: cefbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdfbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxfbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cegbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdgbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxgbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP CONVERT FROM LOGICAL +============================================================ +Testing: celfbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdlfbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlfbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: celgbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdlgbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlgbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP CONVERT TO FIXED +============================================================ +Testing: cfebra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfdbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfxbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgebra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgdbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgxbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP CONVERT TO LOGICAL +============================================================ +Testing: clfebr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfdbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfxbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgebr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgdbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgxbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP LOAD FP INTEGER +============================================================ +Testing: fiebra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: fidbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: fixbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP LOAD ROUNDED +============================================================ +Testing: ledbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: ldxbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: lexbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + diff --git a/none/tests/s390x/bfp-XxC.stderr.exp b/none/tests/s390x/bfp-XxC.stderr.exp new file mode 100644 index 000000000..139597f9c --- /dev/null +++ b/none/tests/s390x/bfp-XxC.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/bfp-XxC.vgtest b/none/tests/s390x/bfp-XxC.vgtest new file mode 100644 index 000000000..af289c94a --- /dev/null +++ b/none/tests/s390x/bfp-XxC.vgtest @@ -0,0 +1,3 @@ +prereq: ../../../tests/s390x_features s390x-fpext +prog: /bin/true +post: ./emwarn-gen.pl --bfp-XxC diff --git a/none/tests/s390x/dfp-XiC.post.exp b/none/tests/s390x/dfp-XiC.post.exp new file mode 100644 index 000000000..e51ad8330 --- /dev/null +++ b/none/tests/s390x/dfp-XiC.post.exp @@ -0,0 +1,36 @@ + +============================================================ +DFP LOAD LENGTHENED +============================================================ +Testing: ldetr 0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + +Testing: lxdtr 0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP LOAD ROUNDED +============================================================ +Testing: ledtr 0,0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + +Testing: ldxtr 0,0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + diff --git a/none/tests/s390x/dfp-XiC.stderr.exp b/none/tests/s390x/dfp-XiC.stderr.exp new file mode 100644 index 000000000..139597f9c --- /dev/null +++ b/none/tests/s390x/dfp-XiC.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/dfp-XiC.vgtest b/none/tests/s390x/dfp-XiC.vgtest new file mode 100644 index 000000000..bea81fbee --- /dev/null +++ b/none/tests/s390x/dfp-XiC.vgtest @@ -0,0 +1,3 @@ +prereq: ../../../tests/s390x_features s390x-fpext && ../../../tests/s390x_features s390x-dfp +prog: /bin/true +post: ./emwarn-gen.pl --dfp-XiC diff --git a/none/tests/s390x/dfp-XxC.post.exp b/none/tests/s390x/dfp-XxC.post.exp new file mode 100644 index 000000000..a3af32011 --- /dev/null +++ b/none/tests/s390x/dfp-XxC.post.exp @@ -0,0 +1,146 @@ + +============================================================ +DFP CONVERT FROM FIXED +============================================================ +Testing: cdgtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxgtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP CONVERT FROM LOGICAL +============================================================ +Testing: cdlgtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlgtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdlftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP CONVERT TO FIXED +============================================================ +Testing: cgdtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgxtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfdtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP CONVERT TO LOGICAL +============================================================ +Testing: clgdtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfdtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP LOAD ROUNDED +============================================================ +Testing: ledtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: ldxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + diff --git a/none/tests/s390x/dfp-XxC.stderr.exp b/none/tests/s390x/dfp-XxC.stderr.exp new file mode 100644 index 000000000..139597f9c --- /dev/null +++ b/none/tests/s390x/dfp-XxC.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/dfp-XxC.vgtest b/none/tests/s390x/dfp-XxC.vgtest new file mode 100644 index 000000000..681c300a1 --- /dev/null +++ b/none/tests/s390x/dfp-XxC.vgtest @@ -0,0 +1,3 @@ +prereq: ../../../tests/s390x_features s390x-fpext && ../../../tests/s390x_features s390x-dfp +prog: /bin/true +post: ./emwarn-gen.pl --dfp-XxC diff --git a/none/tests/s390x/emwarn-gen.pl b/none/tests/s390x/emwarn-gen.pl new file mode 100755 index 000000000..7a142d795 --- /dev/null +++ b/none/tests/s390x/emwarn-gen.pl @@ -0,0 +1,179 @@ +#!/usr/bin/env perl + +#-------------------------------------------------------------------- +# Create testcases for checking BFP/DFP emulation warnings +# +# This machinery is to circumwent valgrind's limitation of at most +# 3 emulation warnings per emulation kind. +#-------------------------------------------------------------------- + +use strict; +use warnings; +use Cwd 'abs_path'; +use Getopt::Long; + +my $rootdir = get_rootdir(); +my $runone = "$rootdir/auxprogs/s390-runone"; +my $valgrind = "$rootdir/coregrind/valgrind"; +my $valargs = "-q --tool=none --show-emwarns=yes"; + +&main; + +sub main +{ + GetOptions("bfp-XxC" => sub { test_bfp_XxC(); }, + "dfp-XiC" => sub { test_dfp_XiC(); }, + "dfp-XxC" => sub { test_dfp_XxC(); }, + ) or exit 1; + exit 0; +} + +sub test_bfp_XxC +{ + header("BFP CONVERT FROM FIXED"); + run_insn_test("cefbra 0,0,0,4"); + run_insn_test("cdfbra 0,0,0,4"); + run_insn_test("cxfbra 0,0,0,4"); + run_insn_test("cegbra 0,0,0,4"); + run_insn_test("cdgbra 0,0,0,4"); + run_insn_test("cxgbra 0,0,0,4"); + + header("BFP CONVERT FROM LOGICAL"); + run_insn_test("celfbr 0,0,0,4"); + run_insn_test("cdlfbr 0,0,0,4"); + run_insn_test("cxlfbr 0,0,0,4"); + run_insn_test("celgbr 0,0,0,4"); + run_insn_test("cdlgbr 0,0,0,4"); + run_insn_test("cxlgbr 0,0,0,4"); + + header("BFP CONVERT TO FIXED"); + run_insn_test("cfebra 0,0,0,4"); + run_insn_test("cfdbra 0,0,0,4"); + run_insn_test("cfxbra 0,0,0,4"); + run_insn_test("cgebra 0,0,0,4"); + run_insn_test("cgdbra 0,0,0,4"); + run_insn_test("cgxbra 0,0,0,4"); + + header("BFP CONVERT TO LOGICAL"); + run_insn_test("clfebr 0,0,0,4"); + run_insn_test("clfdbr 0,0,0,4"); + run_insn_test("clfxbr 0,0,0,4"); + run_insn_test("clgebr 0,0,0,4"); + run_insn_test("clgdbr 0,0,0,4"); + run_insn_test("clgxbr 0,0,0,4"); + + header("BFP LOAD FP INTEGER"); + run_insn_test("fiebra 0,0,0,4"); + run_insn_test("fidbra 0,0,0,4"); + run_insn_test("fixbra 0,0,0,4"); + + header("BFP LOAD ROUNDED"); + run_insn_test("ledbra 0,0,0,4"); + run_insn_test("ldxbra 0,0,0,4"); + run_insn_test("lexbra 0,0,0,4"); +} + +sub test_dfp_XxC +{ + header("DFP CONVERT FROM FIXED"); + run_insn_test("cdgtra 0,0,0,4"); + run_insn_test("cxgtra 0,0,0,4"); + run_insn_test("cdftr 0,0,0,4"); + run_insn_test("cxftr 0,0,0,4"); + + header("DFP CONVERT FROM LOGICAL"); + run_insn_test("cdlgtr 0,0,0,4"); + run_insn_test("cxlgtr 0,0,0,4"); + run_insn_test("cdlftr 0,0,0,4"); + run_insn_test("cxlftr 0,0,0,4"); + + header("DFP CONVERT TO FIXED"); + run_insn_test("cgdtra 0,0,0,4"); + run_insn_test("cgxtra 0,0,0,4"); + run_insn_test("cfdtr 0,0,0,4"); + run_insn_test("cfxtr 0,0,0,4"); + + header("DFP CONVERT TO LOGICAL"); + run_insn_test("clgdtr 0,0,0,4"); + run_insn_test("clgxtr 0,0,0,4"); + run_insn_test("clfdtr 0,0,0,4"); + run_insn_test("clfxtr 0,0,0,4"); + + header("DFP LOAD ROUNDED"); + run_insn_test("ledtr 0,0,0,4"); + run_insn_test("ldxtr 0,0,0,4"); +} + +sub test_dfp_XiC +{ + header("DFP LOAD LENGTHENED"); + run_insn_test("ldetr 0,0,8"); + run_insn_test("lxdtr 0,0,8"); + + header("DFP LOAD ROUNDED"); + run_insn_test("ledtr 0,0,0,8"); + run_insn_test("ldxtr 0,0,0,8"); +} + +sub run_insn_test +{ + my ($insn) = @_; + $insn =~ s/\s+/ /g; + my ($mnm) = $insn; + + $mnm =~ s/\s.*//; + print "Testing: $insn\n"; + + my $exe = "xxemwarn-$mnm"; + my $cfile = "$exe.c"; + + # Create template + `$runone --template --insn=\"$insn\" > $cfile`; + + # Compile + my $stderr = `$runone --build $cfile 2>&1`; + if ($? != 0) { + error("runone failed\n$stderr"); + return; + } + + # Run valgrind + my $output = `$valgrind $valargs ./$exe 2>&1 | ./filter_stderr`; + print STDOUT "$output\n"; + + # Remove files + unlink ($exe, $cfile, "$exe.s", "$exe.s.orig"); +} + +sub get_rootdir +{ + my $dir = "."; + while (abs_path($dir) ne "/") { + if (-e "$dir/AUTHORS") { + return abs_path($dir); + } + $dir = "$dir/.."; + } + fatal("Coud not determine root directory. \"AUTHORS\" file not found\n"); +} + +sub header +{ + my ($txt) = @_; + + print "\n"; + print "============================================================\n"; + print "$txt\n"; + print "============================================================\n"; +} + +sub error +{ + print STDERR "*** $_[0]\n"; +} + +sub fatal +{ + error($_[0]); + exit 1; +} From a984b14036fce483f98ece084c4d54370749fd26 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 29 Sep 2025 22:35:10 +0000 Subject: [PATCH 346/412] s390: Cleanup none/tests/s390x/Makefile.am --- none/tests/s390x/Makefile.am | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index e0ca00d5b..22b8128bb 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -32,7 +32,8 @@ check_PROGRAMS = $(INSN_TESTS) \ allexec \ op00 -noinst_HEADERS = vector.h +noinst_HEADERS = add.h and.h div.h dfp_utils.h insert.h mul.h opcodes.h \ + or.h rounding.h sub.h svc.h table.h test.h vector.h xor.h EXTRA_DIST = \ $(addsuffix .stderr.exp,$(INSN_TESTS)) \ @@ -49,20 +50,9 @@ EXTRA_DIST = \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ ecag.stdout.exp-z16 \ op00.stderr.exp op00.vgtest \ - test.h opcodes.h add.h and.h div.h insert.h dfp_utils.h \ - mul.h or.h sub.h xor.h table.h svc.h rounding.h \ - dfp-1.stderr.exp dfp-1.stdout.exp dfp-1.vgtest \ - dfp-2.stderr.exp dfp-2.stdout.exp dfp-2.vgtest \ - dfp-3.stderr.exp dfp-3.stdout.exp dfp-3.vgtest \ - dfp-4.stderr.exp dfp-4.stdout.exp dfp-4.vgtest \ - dfptest.stderr.exp dfptest.stdout.exp dfptest.vgtest \ - dfpext.stderr.exp dfpext.stdout.exp dfpext.vgtest \ - dfpconv.stderr.exp dfpconv.stdout.exp dfpconv.vgtest \ dfp-XxC.vgtest dfp-XxC.stderr.exp dfp-XxC.post.exp \ dfp-XiC.vgtest dfp-XiC.stderr.exp dfp-XiC.post.exp \ - srnmt.stderr.exp srnmt.stdout.exp srnmt.vgtest \ - stfle.stdout.exp-z16 \ - pfpo.stderr.exp pfpo.stdout.exp pfpo.vgtest + stfle.stdout.exp-z16 AM_CFLAGS += @FLAG_M64@ AM_CXXFLAGS += @FLAG_M64@ From 97831bbbc208f3c574095770aff9b19e5a2c6aae Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 30 Sep 2025 20:14:24 +0000 Subject: [PATCH 347/412] riscv64: Fix IR generation for shift operations (BZ 509157) For SLL, SRL, and SRA the shift amount is 6 bits wide - not 8 bits. For SLLW, SRLW, and SRAW the shift amount is 5 bits wide - not 8 bits. Patch for IR generation by Christoph Jung (christoph.j27@googlemail.com). Also clarify semantics of bitwise shift operators in libvex_ir.h Fixes https://bugs.kde.org/show_bug.cgi?id=509157 --- VEX/priv/guest_riscv64_toIR.c | 13 +++++++++---- VEX/pub/libvex_ir.h | 12 ++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/VEX/priv/guest_riscv64_toIR.c b/VEX/priv/guest_riscv64_toIR.c index 59297acd1..c90444ef1 100644 --- a/VEX/priv/guest_riscv64_toIR.c +++ b/VEX/priv/guest_riscv64_toIR.c @@ -1550,7 +1550,8 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres, break; case 0b001: expr = binop(Iop_Shl64, getIReg64(rs1), - unop(Iop_64to8, getIReg64(rs2))); + unop(Iop_64to8, binop(Iop_And64, mkU64(0b00111111), + getIReg64(rs2)))); break; case 0b010: expr = unop(Iop_1Uto64, @@ -1565,7 +1566,8 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres, break; case 0b101: expr = binop(is_base ? Iop_Shr64 : Iop_Sar64, getIReg64(rs1), - unop(Iop_64to8, getIReg64(rs2))); + unop(Iop_64to8, binop(Iop_And64, mkU64(0b00111111), + getIReg64(rs2)))); break; case 0b110: expr = binop(Iop_Or64, getIReg64(rs1), getIReg64(rs2)); @@ -1719,7 +1721,9 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres, if (rd != 0) putIReg32( irsb, rd, - binop(Iop_Shl32, getIReg32(rs1), unop(Iop_64to8, getIReg64(rs2)))); + binop(Iop_Shl32, getIReg32(rs1), + unop(Iop_64to8, binop(Iop_And64, mkU64(0b00011111), + getIReg64(rs2))))); DIP("sllw %s, %s, %s\n", nameIReg(rd), nameIReg(rs1), nameIReg(rs2)); return True; } @@ -1734,7 +1738,8 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres, if (rd != 0) putIReg32(irsb, rd, binop(is_log ? Iop_Shr32 : Iop_Sar32, getIReg32(rs1), - unop(Iop_64to8, getIReg64(rs2)))); + unop(Iop_64to8, binop(Iop_And64, mkU64(0b00011111), + getIReg64(rs2))))); DIP("%s %s, %s, %s\n", is_log ? "srlw" : "sraw", nameIReg(rd), nameIReg(rs1), nameIReg(rs2)); return True; diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h index 8c68fab44..7cb9c6b0f 100644 --- a/VEX/pub/libvex_ir.h +++ b/VEX/pub/libvex_ir.h @@ -434,6 +434,18 @@ typedef Iop_Or8, Iop_Or16, Iop_Or32, Iop_Or64, Iop_And8, Iop_And16, Iop_And32, Iop_And64, Iop_Xor8, Iop_Xor16, Iop_Xor32, Iop_Xor64, + /* Bitwise shift ops + Semantics as per C standard: + If the value of the right operand is negative or is greater + than or equal to the width of the left operand, the behaviour is + undefined. + For Shl: The result of E1 << E2 is E1 left-shifted E2 bit positions. + Vacated bits are filled with zeroes. + For Shr: The result of E1 >> E2 is E1 right-shifted E2 bit positions. + Vacated bits are filled with zeroes. + For Sar: The result of E1 >> E2 is E1 right-shifted E2 bit positions. + Vacated bits are filled with the most significant bit of E1 prior + to shifting. */ Iop_Shl8, Iop_Shl16, Iop_Shl32, Iop_Shl64, Iop_Shr8, Iop_Shr16, Iop_Shr32, Iop_Shr64, Iop_Sar8, Iop_Sar16, Iop_Sar32, Iop_Sar64, From 56f62f74ada99daf1a18cd1abe5309d4fc9c085c Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 30 Sep 2025 20:27:43 +0000 Subject: [PATCH 348/412] Add BZ 509157 to NEWS. --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index d7367ba05..765d9d3d6 100644 --- a/NEWS +++ b/NEWS @@ -985,6 +985,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 451626 Syscall param bpf(attr->raw_tracepoint.name) points to unaddressable byte(s) 451827 [ppc64le] VEX temporary storage exhausted with several vbpermq instructions 451843 valgrind fails to start on a FreeBSD system which enforces W^X +509157 riscv64: Shift instructions can behave wrong To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX From 09f6162dd7ca1e60ceeb6e7fac30a1f9a8cf6641 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 1 Oct 2025 12:19:13 +0000 Subject: [PATCH 349/412] VEX: Remove algebraic simplification for shift IROps. Shl/Shr/Sar(0,x) ==> 0 Don't. Because doing so removes the undefined behaviour in case the shift amount is out of range. This is also consistent with what constant folding does in this case, namely, passing the undefined behaviour down the VEX pipeline. --- VEX/priv/ir_opt.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 4b07b27fc..1b21c8e3e 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -2623,13 +2623,6 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e ) e2 = e->Iex.Binop.arg1; break; } - /* Shl8/Shl16/Shl32/Shl64(0,x) ==> 0 - Shr8/Shr16/Shr32/Shr64(0,x) ==> 0 - Sar8/Sar16/Sar32/Sar64(0,x) ==> 0 */ - if (isZeroU(e->Iex.Binop.arg1)) { - e2 = e->Iex.Binop.arg1; - break; - } break; case Iop_Or1: From 6abf08f96a97bf12aac01cef97ed39936eb038b3 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 1 Oct 2025 12:48:12 +0000 Subject: [PATCH 350/412] disasm-test: Makefile tweaks disasm-test/Makefile.am: Include Makefile.tool-tests.am not Makefile.all.am Also: do not build disasm-test on platforms other than s390x. There is no point doing so as you won't be able to run it in a meaningful way. --- Makefile.am | 1 - none/tests/Makefile.am | 2 +- none/tests/s390x/disasm-test/Makefile.am | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index a3150abb1..6c5b9f5b6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,7 +33,6 @@ SUBDIRS = \ perf \ gdbserver_tests \ memcheck/tests/vbit-test \ - none/tests/s390x/disasm-test \ none/tests/iropt-test \ auxprogs \ mpi \ diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 716ce000d..58e7a5249 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -24,7 +24,7 @@ if VGCONF_ARCHS_INCLUDE_ARM64 SUBDIRS += arm64 endif if VGCONF_ARCHS_INCLUDE_S390X -SUBDIRS += s390x +SUBDIRS += s390x s390x/disasm-test endif if VGCONF_ARCHS_INCLUDE_MIPS32 SUBDIRS += mips32 diff --git a/none/tests/s390x/disasm-test/Makefile.am b/none/tests/s390x/disasm-test/Makefile.am index 5629d7d52..150f38b32 100644 --- a/none/tests/s390x/disasm-test/Makefile.am +++ b/none/tests/s390x/disasm-test/Makefile.am @@ -1,4 +1,4 @@ -include $(top_srcdir)/Makefile.all.am +include $(top_srcdir)/Makefile.tool-tests.am EXTRA_DIST = disasm-test.vgtest disasm-test.stderr.exp \ disasm-test.post.exp From eed42ea290e362eaf333135f4fa53b8687005e54 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Wed, 1 Oct 2025 14:42:23 +0000 Subject: [PATCH 351/412] Add BZ 506211 to NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 765d9d3d6..e4722a729 100644 --- a/NEWS +++ b/NEWS @@ -985,6 +985,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 451626 Syscall param bpf(attr->raw_tracepoint.name) points to unaddressable byte(s) 451827 [ppc64le] VEX temporary storage exhausted with several vbpermq instructions 451843 valgrind fails to start on a FreeBSD system which enforces W^X +506211 Constant folding improvements 509157 riscv64: Shift instructions can behave wrong To see details of a given bug, visit From 94b0aab338d0e102057308dedc50b3f3d5234e17 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 1 Oct 2025 16:42:17 +0200 Subject: [PATCH 352/412] none/tests/Makefile.am: Add s390x/disasm-test to DIST_SUBDIRS Fixes: 6abf08f96a97 ("disasm-test: Makefile tweaks") --- none/tests/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 58e7a5249..f75de49f4 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -77,7 +77,8 @@ if VGCONF_PLATFORMS_INCLUDE_X86_FREEBSD SUBDIRS += x86-freebsd endif -DIST_SUBDIRS = x86 amd64 ppc32 ppc64 arm arm64 s390x mips32 mips64 nanomips \ +DIST_SUBDIRS = x86 amd64 ppc32 ppc64 arm arm64 s390x s390x/disasm-test \ + mips32 mips64 nanomips \ riscv64 linux darwin solaris freebsd amd64-linux x86-linux \ amd64-darwin x86-darwin amd64-solaris x86-solaris x86-freebsd \ scripts . From d01f7775d7544316139742a675bd0d49cf7dc3c1 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 2 Oct 2025 07:46:59 +0200 Subject: [PATCH 353/412] FreeBSD: fix build, FreeBSD has no dirent64 or getdent64 Need to check Darwin as well. --- coregrind/m_syswrap/syswrap-generic.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 3786e9cd8..296ebdd91 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -3994,6 +3994,8 @@ PRE(sys_getdents) PRE_MEM_WRITE( "getdents(dirp)", ARG2, ARG3 ); } +#if !defined(VGO_freebsd) // Darwin as well? + /* Check if the given file descriptor points to a /proc/PID/fd or /proc/PID/fdinfo directory. Returns True if it's a directory we should filter Valgrind FDs from. */ static Bool is_proc_fd_directory(Int fd) @@ -4096,6 +4098,8 @@ static SizeT filter_dirent64_entries(struct vki_dirent64 *dirp, SizeT orig_size) return new_size; } +#endif + /* Make sure we really need the proc filtering using (32bit) getdents, which not every linux arch implements. */ #if defined(VGO_linux) && defined(__NR_getdents) @@ -4130,6 +4134,8 @@ static SizeT filter_valgrind_fds_from_getdents_with_refill(Int fd, struct vki_di } #endif /* defined(VGO_linux) && defined(__NR_getdents) */ +#if !defined(VGO_freebsd) // Darwin as well? + /* Filter out Valgrind's internal file descriptors from getdents64 results with refill capability. Same logic as getdents version but for 64-bit dirent structures. Returns filtered size on success, or -1 if retry syscall failed. */ @@ -4159,6 +4165,8 @@ static SizeT filter_valgrind_fds_from_getdents64_with_refill(Int fd, struct vki_ return new_size; } +#endif + POST(sys_getdents) { vg_assert(SUCCESS); @@ -4186,6 +4194,8 @@ POST(sys_getdents) } } +#if !defined(VGO_freebsd) + PRE(sys_getdents64) { *flags |= SfMayBlock; @@ -4219,6 +4229,8 @@ POST(sys_getdents64) } } +#endif + PRE(sys_getgroups) { PRINT("sys_getgroups ( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2); From a08e6ed08f6b24ecf35d443b52e5db16ccb05f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= Date: Tue, 30 Sep 2025 09:54:58 -0400 Subject: [PATCH 354/412] getdents_filter.vgtest: Add filter_sort On some file systems the testfiles 1000 and 1001 come out in different order. Add filter_sort to sort the output lines to always appear at the same order. --- .gitignore | 1 + none/tests/Makefile.am | 3 ++- none/tests/filter_sort | 2 ++ none/tests/linux/getdents_filter.stdout.exp | 12 ++++++------ none/tests/linux/getdents_filter.vgtest | 1 + 5 files changed, 12 insertions(+), 7 deletions(-) create mode 100755 none/tests/filter_sort diff --git a/.gitignore b/.gitignore index 645f261bc..01dd2a3bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1916,6 +1916,7 @@ /none/tests/linux/open_client /none/tests/linux/pthread-stack /none/tests/linux/stack-overflow +/none/tests/linux/getdents_filter # /none/tests/mips32/ /none/tests/mips32/Makefile diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index f75de49f4..a95d66436 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -92,7 +92,8 @@ dist_noinst_SCRIPTS = \ filter_stderr \ filter_timestamp \ filter_xml \ - allexec_prepare_prereq + allexec_prepare_prereq \ + filter_sort noinst_HEADERS = fdleak.h diff --git a/none/tests/filter_sort b/none/tests/filter_sort new file mode 100755 index 000000000..5c376236c --- /dev/null +++ b/none/tests/filter_sort @@ -0,0 +1,2 @@ +#!/bin/sh +sort diff --git a/none/tests/linux/getdents_filter.stdout.exp b/none/tests/linux/getdents_filter.stdout.exp index c228ee81f..7d29d0f66 100644 --- a/none/tests/linux/getdents_filter.stdout.exp +++ b/none/tests/linux/getdents_filter.stdout.exp @@ -1,9 +1,3 @@ -retry_test_start -retry:0 -retry:1 -retry:2 -retry:3 -retry_test_end 0 1 2 @@ -14,3 +8,9 @@ fdinfo:2 fdinfo:3 regular:1000 regular:1001 +retry:0 +retry:1 +retry:2 +retry:3 +retry_test_end +retry_test_start diff --git a/none/tests/linux/getdents_filter.vgtest b/none/tests/linux/getdents_filter.vgtest index eb5bd6ceb..612ebcec2 100644 --- a/none/tests/linux/getdents_filter.vgtest +++ b/none/tests/linux/getdents_filter.vgtest @@ -1,2 +1,3 @@ prog: getdents_filter vgopts: -q +stdout_filter: ../filter_sort From 9c0c0e41d8b72825606da0db897a419c59658a56 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 3 Oct 2025 16:26:55 +0000 Subject: [PATCH 355/412] Control building documentation (BZ 495483) Introduce Makefile variable BUILD_DOCS with these possible values: none - does not build any documentation all - builds all documentation html - builds HTML docs but skips building PDFs BUILD_ALL_DOCS is still recognised for backward compatibility and is mapped to BUILD_DOCS like so: If not specified --> BUILD_DOCS=all BUILD_ALL_DOCS=yes --> BUILD_DOCS=all BUILD_ALL_DOCS=no --> BUILD_DOCS=html README_DEVELOPERS adjusted. Fixes https://bugs.kde.org/show_bug.cgi?id=495483 --- README_DEVELOPERS | 2 +- docs/Makefile.am | 35 ++++++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/README_DEVELOPERS b/README_DEVELOPERS index 22e229bd4..5d9fb823f 100644 --- a/README_DEVELOPERS +++ b/README_DEVELOPERS @@ -37,7 +37,7 @@ will also attempt to build the documentation. If you only want to test whether the generated tarball is complete and runs regression tests successfully, building documentation is not needed. - make dist BUILD_ALL_DOCS=no + make dist BUILD_DOCS=none If you insist on building documentation some embarrassing instructions can be found in docs/README. diff --git a/docs/Makefile.am b/docs/Makefile.am index 8672e8dd2..7e5ed389c 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -4,10 +4,26 @@ ## tools to do so is impractical / too difficult ##------------------------------------------------------------- -# Comment out the next line to skip building print docs. The default -# is not to skip building print docs. Note, after changing it -# you need to re-run autogen.sh and configure to make it take effect. -BUILD_ALL_DOCS=yes +# Building documentation is a pain. It takes longish and requires certain +# tools you may not have installed. +# The variable BUILD_DOCS allows you to control what documentation gets +# built: +# +# BUILD_DOCS=all builds all documentation +# BUILD_DOCS=html builds HTML docs but skips building PDFs +# BUILD_DOCS=none does not build any documentation +# +# Use it on the command line. E.g.: make dist BUILD_DOCS=none +# +ifndef BUILD_ALL_DOCS + BUILD_DOCS ?= all + else + ifeq "$(BUILD_ALL_DOCS)" "yes" + BUILD_DOCS ?= all + else + BUILD_DOCS ?= html + endif + endif # Whether to run xmlto pdf --with-fop # This is de fault, set to empty to use the default fo to pdf @@ -281,7 +297,7 @@ install-data-hook: cp $$f $(DESTDIR)$(mandir)/man1; \ fi \ done - ifeq ($(BUILD_ALL_DOCS),yes) + ifeq ($(BUILD_DOCS),all) set -e; \ if test -r index.pdf ; then \ mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \ @@ -297,18 +313,23 @@ install-data-hook: # This is done at 'make dist' time. It builds the html docs, print # docs and man pages and copies them into the docs/ directory in the # tarball. - ifeq ($(BUILD_ALL_DOCS),yes) + ifeq ($(BUILD_DOCS),none) +dist-hook: + + else + ifeq ($(BUILD_DOCS),all) dist-hook: FAQ.txt html-docs man-pages print-docs cp -r html $(distdir) cp FAQ.txt $(distdir)/.. cp *.1 $(distdir) cp print/index.pdf $(distdir) cp print/index.ps $(distdir) - else + else dist-hook: FAQ.txt html-docs man-pages cp -r html $(distdir) cp FAQ.txt $(distdir)/.. cp *.1 $(distdir) + endif endif distclean-local: From c0e022d1a8a973c4872f497b79ccb8e0a51adae9 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Fri, 3 Oct 2025 16:31:59 +0000 Subject: [PATCH 356/412] Add BZ 495483 to NEWS. Darn I keep forgetting this.... --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index e4722a729..bdf175eac 100644 --- a/NEWS +++ b/NEWS @@ -985,6 +985,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 451626 Syscall param bpf(attr->raw_tracepoint.name) points to unaddressable byte(s) 451827 [ppc64le] VEX temporary storage exhausted with several vbpermq instructions 451843 valgrind fails to start on a FreeBSD system which enforces W^X +495483 Control building documentation via BUILD_DOCS 506211 Constant folding improvements 509157 riscv64: Shift instructions can behave wrong From 3bcda36cf8f02c87ff900a0e06984b7e46a34e4f Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 3 Oct 2025 20:54:15 +0200 Subject: [PATCH 357/412] getdents* syswrap: only check proc fd/fdinfo on Linux and Solaris Keep check for __NR_getdents and use a check for __NR_getdents64 --- coregrind/m_syswrap/syswrap-generic.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 296ebdd91..0d13cea5e 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -3994,7 +3994,7 @@ PRE(sys_getdents) PRE_MEM_WRITE( "getdents(dirp)", ARG2, ARG3 ); } -#if !defined(VGO_freebsd) // Darwin as well? +#if defined(VGO_linux) || defined(VGO_solaris) /* Check if the given file descriptor points to a /proc/PID/fd or /proc/PID/fdinfo directory. Returns True if it's a directory we should filter Valgrind FDs from. */ @@ -4049,7 +4049,7 @@ static Bool should_keep_fd_entry(const HChar *name) /* Make sure we really need the proc filtering using (32bit) getdents, which not every linux arch implements. */ -#if defined(VGO_linux) && defined(__NR_getdents) +#if defined(__NR_getdents) /* Filter and compact dirent entries */ static SizeT filter_dirent_entries(struct vki_dirent *dirp, SizeT orig_size) @@ -4073,7 +4073,7 @@ static SizeT filter_dirent_entries(struct vki_dirent *dirp, SizeT orig_size) return new_size; } -#endif /* defined(VGO_linux) && defined(__NR_getdents) */ +#endif /* defined(__NR_getdents) */ /* Filter and compact dirent64 entries */ static SizeT filter_dirent64_entries(struct vki_dirent64 *dirp, SizeT orig_size) @@ -4098,11 +4098,9 @@ static SizeT filter_dirent64_entries(struct vki_dirent64 *dirp, SizeT orig_size) return new_size; } -#endif - /* Make sure we really need the proc filtering using (32bit) getdents, which not every linux arch implements. */ -#if defined(VGO_linux) && defined(__NR_getdents) +#if defined(__NR_getdents) /* Filter out Valgrind's internal file descriptors from getdents results with refill capability. When entries are filtered out, attempts to read more entries to avoid empty results. @@ -4132,9 +4130,7 @@ static SizeT filter_valgrind_fds_from_getdents_with_refill(Int fd, struct vki_di return new_size; } -#endif /* defined(VGO_linux) && defined(__NR_getdents) */ - -#if !defined(VGO_freebsd) // Darwin as well? +#endif /* defined(__NR_getdents) */ /* Filter out Valgrind's internal file descriptors from getdents64 results with refill capability. Same logic as getdents version but for 64-bit dirent structures. @@ -4165,7 +4161,7 @@ static SizeT filter_valgrind_fds_from_getdents64_with_refill(Int fd, struct vki_ return new_size; } -#endif +#endif /* defined(VGO_linux) || defined(VGO_solaris) */ POST(sys_getdents) { @@ -4175,7 +4171,7 @@ POST(sys_getdents) /* Make sure we really need the proc filtering using (32bit) getdents, which not every linux arch implements. */ -#if defined(VGO_linux) && defined(__NR_getdents) +#if (defined(VGO_linux) || defined(VGO_solaris)) && defined(__NR_getdents) /* Only filter Valgrind FDs when listing /proc/PID/fd or /proc/PID/fdinfo directories */ if (is_proc_fd_directory(ARG1)) { @@ -4188,13 +4184,13 @@ POST(sys_getdents) if (result_size != RES) SET_STATUS_Success(result_size); } -#endif /* defined(VGO_linux) && defined(__NR_getdents) */ +#endif /* (defined(VGO_linux) || defined(VGO_solaris)) && defined(__NR_getdents) */ POST_MEM_WRITE( ARG2, result_size ); } } -#if !defined(VGO_freebsd) +#if defined(__NR_getdents64) PRE(sys_getdents64) { @@ -4229,7 +4225,7 @@ POST(sys_getdents64) } } -#endif +#endif /* defined(__NR_getdents64) */ PRE(sys_getgroups) { From c6092d4230fd2533374555213632e77b95a33a5d Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 28 Sep 2025 02:11:58 +0000 Subject: [PATCH 358/412] FreeBSD vgdb: ensure stack is 16byte aligned for invoker I haven't seen any issues but there's no harm in being certain. --- coregrind/vgdb-invoker-freebsd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coregrind/vgdb-invoker-freebsd.c b/coregrind/vgdb-invoker-freebsd.c index 607e05991..4a89fb37d 100644 --- a/coregrind/vgdb-invoker-freebsd.c +++ b/coregrind/vgdb-invoker-freebsd.c @@ -561,6 +561,7 @@ Bool invoker_invoke_gdbserver (pid_t pid) reg_mod.r_rip = shared64->invoke_gdbserver; #elif defined(VGA_arm64) reg_mod.x[0] = check; + sp &= ~0xf; // keep the stack aligned on 16 bytes ... reg_mod.sp = sp; reg_mod.elr = shared64->invoke_gdbserver; /* put NULL return address in Link Register */ From ea1ec47ce1a8f29bf01412869b6a07e5ee6a2976 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 6 Oct 2025 10:55:34 +0200 Subject: [PATCH 359/412] FreeBSD setcred syscall: use arg3 for size Not really our job to check that thwe size is right. Also revamp the secred testcase. --- coregrind/m_syswrap/syswrap-freebsd.c | 2 +- memcheck/tests/freebsd/setcred.cpp | 33 ++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index eb8a16058..2c3bffa1c 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -7154,7 +7154,7 @@ PRE(sys_setcred) { PRINT("sys_setcred(%" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u)", ARG1, ARG2, ARG3); PRE_REG_READ3(int, "setcred", u_int, flags, const struct setcred*, wcred, size_t, size); - PRE_MEM_READ("setcred(wcred)", ARG2, sizeof(struct vki_setcred)); + PRE_MEM_READ("setcred(wcred)", ARG2, ARG3); } // SYS_exterrctl 592 diff --git a/memcheck/tests/freebsd/setcred.cpp b/memcheck/tests/freebsd/setcred.cpp index 464de08ef..619d1959f 100644 --- a/memcheck/tests/freebsd/setcred.cpp +++ b/memcheck/tests/freebsd/setcred.cpp @@ -1,6 +1,8 @@ #include #include #include +#include +#include static long x0; @@ -10,25 +12,44 @@ int main() x0 = px[0]; struct setcred cred1; struct setcred* cred2; - int flags1{0}; - int flags2; + int flags1{SETCREDF_RUID}; + int flags2{SETCREDF_SUPP_GROUPS}; size_t size1{sizeof(cred1)}; + int ret; std::memset(&cred1, 250, sizeof(cred1)); // needs to be root to work correctly - setcred(flags1, &cred1, size1); + ret = setcred(flags1, &cred1, size1); + assert(ret == -1); + assert(errno == EPERM); // not accessible - setcred(flags1, nullptr, size1); + ret = setcred(flags1, nullptr, size1); + assert(ret == -1); + assert(errno == EFAULT); // uninit - setcred(flags2, (struct setcred*)x0, size1+x0); + ret = setcred(flags2+x0, (struct setcred*)x0, size1+x0); + assert(ret == -1); + assert(errno == EFAULT); + + // invalid flags + ret = setcred(9999+x0, &cred1, sizeof(cred1)); + assert(ret == -1); + assert(errno == EINVAL); + + // invalid size + ret = setcred(flags1, &cred1, 3+x0); + assert(ret == -1); + assert(errno == EINVAL); cred2 = new struct setcred; // uninit memory - setcred(flags1, cred2, size1); + ret = setcred(flags1, cred2, size1); + assert(ret == -1); + assert(errno == EPERM); delete cred2; free(px); From e55d0db975c69f0f4c0feae78d64fc8a7196351f Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 28 Sep 2025 03:39:45 +0000 Subject: [PATCH 360/412] FreeBSD regtest: update setcred expected from arm64 Still have an unexpected extra error on amd64 --- memcheck/tests/freebsd/setcred.stderr.exp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/memcheck/tests/freebsd/setcred.stderr.exp b/memcheck/tests/freebsd/setcred.stderr.exp index 629ceacf8..8766361c0 100644 --- a/memcheck/tests/freebsd/setcred.stderr.exp +++ b/memcheck/tests/freebsd/setcred.stderr.exp @@ -1,29 +1,37 @@ Syscall param setcred(wcred) points to unaddressable byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:23) + by 0x........: main (setcred.cpp:28) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param setcred(flags) contains uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:26) + by 0x........: main (setcred.cpp:33) Syscall param setcred(wcred) contains uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:26) + by 0x........: main (setcred.cpp:33) Syscall param setcred(size) contains uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:26) + by 0x........: main (setcred.cpp:33) Syscall param setcred(wcred) points to unaddressable byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:26) + by 0x........: main (setcred.cpp:33) Address 0x........ is not stack'd, malloc'd or (recently) free'd +Syscall param setcred(flags) contains uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:38) + +Syscall param setcred(size) contains uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:43) + Syscall param setcred(wcred) points to uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:31) + by 0x........: main (setcred.cpp:50) Address 0x........ is 0 bytes inside a block of size 48 alloc'd at 0x........: ...operator new... (vg_replace_malloc.c:...) - by 0x........: main (setcred.cpp:28) + by 0x........: main (setcred.cpp:47) From 0329ab2021727242f31adfd665f602a8a6163aa8 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 7 Oct 2025 12:39:38 +0000 Subject: [PATCH 361/412] Document that --vex-guest-chase=not ought to be used when doing IR injection. Fixes https://bugs.kde.org/show_bug.cgi?id=506453 --- NEWS | 1 + VEX/priv/ir_inject.c | 4 ++++ memcheck/tests/vbit-test/vbit-test-sec.vgtest | 2 +- memcheck/tests/vbit-test/vbit-test.vgtest | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index bdf175eac..7335f05b3 100644 --- a/NEWS +++ b/NEWS @@ -987,6 +987,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 451843 valgrind fails to start on a FreeBSD system which enforces W^X 495483 Control building documentation via BUILD_DOCS 506211 Constant folding improvements +506453 Unexpected behaviour with IR injection and vex-guest-chase=yes 509157 riscv64: Shift instructions can behave wrong To see details of a given bug, visit diff --git a/VEX/priv/ir_inject.c b/VEX/priv/ir_inject.c index 04228538f..b447f6e94 100644 --- a/VEX/priv/ir_inject.c +++ b/VEX/priv/ir_inject.c @@ -27,6 +27,10 @@ The GNU General Public License is contained in the file COPYING. */ +/* !!! When running valgrind on applications that use IR injection + !!! --vex-guest-chase=no should be given on the command line. This + !!! avoids that vex_inject_ir is called speculatively. +*/ #include "libvex_basictypes.h" #include "libvex_ir.h" #include "libvex.h" diff --git a/memcheck/tests/vbit-test/vbit-test-sec.vgtest b/memcheck/tests/vbit-test/vbit-test-sec.vgtest index 2d3c9389d..8d84e7e90 100644 --- a/memcheck/tests/vbit-test/vbit-test-sec.vgtest +++ b/memcheck/tests/vbit-test/vbit-test-sec.vgtest @@ -1,3 +1,3 @@ prog: vbit-test-sec prereq: test -x vbit-test-sec -vgopts: -q --expensive-definedness-checks=yes +vgopts: -q --expensive-definedness-checks=yes --vex-guest-chase=no diff --git a/memcheck/tests/vbit-test/vbit-test.vgtest b/memcheck/tests/vbit-test/vbit-test.vgtest index a05890566..198c62351 100644 --- a/memcheck/tests/vbit-test/vbit-test.vgtest +++ b/memcheck/tests/vbit-test/vbit-test.vgtest @@ -1,2 +1,2 @@ prog: vbit-test -vgopts: -q --expensive-definedness-checks=yes +vgopts: -q --expensive-definedness-checks=yes --vex-guest-chase=no From 32fcdbfafd623569df800d2a1fa351c11f10a128 Mon Sep 17 00:00:00 2001 From: Andreas Arnez Date: Thu, 9 Oct 2025 13:42:39 +0200 Subject: [PATCH 362/412] s390x: Make IBM z17 known to Valgrind Make the IBM z17 machine model 9175 known to Valgrind. Also add the expected output of the s390x-specific "ecag" test case on an IBM z17, so the test case succeeds on that system. --- VEX/pub/libvex.h | 3 ++- coregrind/m_machine.c | 1 + none/tests/s390x/Makefile.am | 2 +- none/tests/s390x/ecag.stdout.exp-z17 | 21 +++++++++++++++++++++ tests/s390x_features.c | 1 + 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 none/tests/s390x/ecag.stdout.exp-z17 diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index e580160d3..bfa94d033 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -158,7 +158,8 @@ typedef #define VEX_S390X_MODEL_Z14_ZR1 15 #define VEX_S390X_MODEL_Z15 16 #define VEX_S390X_MODEL_Z16 17 -#define VEX_S390X_MODEL_UNKNOWN 18 /* always last in list */ +#define VEX_S390X_MODEL_Z17 18 +#define VEX_S390X_MODEL_UNKNOWN 19 /* always last in list */ #define VEX_S390X_MODEL_MASK 0x3F #define VEX_HWCAPS_S390X_LDISP (1<<6) /* Long-displacement facility */ diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index eaa18b0b6..bba498f98 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -624,6 +624,7 @@ static UInt VG_(get_machine_model)(void) { "8562", VEX_S390X_MODEL_Z15 }, { "3931", VEX_S390X_MODEL_Z16 }, { "3932", VEX_S390X_MODEL_Z16 }, + { "9175", VEX_S390X_MODEL_Z17 }, }; Int model, n, fh; diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 22b8128bb..dda923acc 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -48,7 +48,7 @@ EXTRA_DIST = \ bfp-XxC.vgtest bfp-XxC.stderr.exp bfp-XxC.post.exp \ ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ - ecag.stdout.exp-z16 \ + ecag.stdout.exp-z16 ecag.stdout.exp-z17 \ op00.stderr.exp op00.vgtest \ dfp-XxC.vgtest dfp-XxC.stderr.exp dfp-XxC.post.exp \ dfp-XiC.vgtest dfp-XiC.stderr.exp dfp-XiC.post.exp \ diff --git a/none/tests/s390x/ecag.stdout.exp-z17 b/none/tests/s390x/ecag.stdout.exp-z17 new file mode 100644 index 000000000..4708b2a83 --- /dev/null +++ b/none/tests/s390x/ecag.stdout.exp-z17 @@ -0,0 +1,21 @@ +L1 topology: separate data and instruction; private +L1 cache line size data: 256 +L1 cache line size insn: 256 +L1 total cachesize data: 131072 +L1 total cachesize insn: 131072 +L1 set. assoc. data: 8 +L1 set. assoc. insn: 8 +L2 topology: unified data and instruction; private +L2 cache line size data: 256 +L2 cache line size insn: 256 +L2 total cachesize data: 37748736 +L2 total cachesize insn: 37748736 +L2 set. assoc. data: 18 +L2 set. assoc. insn: 18 +L3 topology: unified data and instruction; shared +L3 cache line size data: 256 +L3 cache line size insn: 256 +L3 total cachesize data: 377487360 +L3 total cachesize insn: 377487360 +L3 set. assoc. data: 180 +L3 set. assoc. insn: 180 diff --git a/tests/s390x_features.c b/tests/s390x_features.c index 507f3ab2f..e0d4de76c 100644 --- a/tests/s390x_features.c +++ b/tests/s390x_features.c @@ -120,6 +120,7 @@ model_info models[] = { { "8562", "z15" }, { "3931", "z16" }, { "3932", "z16" }, + { "9175", "z17" }, }; From a04974ddcb51fbb24b1e44b1f9c98d0a11356cca Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Thu, 2 Oct 2025 17:11:50 +0200 Subject: [PATCH 363/412] Update the LTP version in valgrind testsuite to v20250930 Update the LTP version in valgrind testsuite to v20250930. All patches from auxprogs/ltp-patches were accepted by LTP upstream and included in the release, so these can now be dropped locally. https://bugs.kde.org/show_bug.cgi?id=510169 --- NEWS | 1 + auxprogs/Makefile.am | 9 +-- ...-powerpc-syscall-defs-don-t-leak-to-.patch | 41 ----------- .../0002-Introduce-LTP_QUIET-env-var.patch | 73 ------------------- ...-the-scanf-address-format-is-at-leas.patch | 39 ---------- 5 files changed, 4 insertions(+), 159 deletions(-) delete mode 100644 auxprogs/ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch delete mode 100644 auxprogs/ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch delete mode 100644 auxprogs/ltp-patches/0003-mmap04-Make-sure-the-scanf-address-format-is-at-leas.patch diff --git a/NEWS b/NEWS index 7335f05b3..ca3f9fca4 100644 --- a/NEWS +++ b/NEWS @@ -147,6 +147,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509567 unhandled amd64-linux syscall: 443 (quotactl_fd) 509642 Add missing ppc64-linux syswraps 509643 Add missing s390x-linux syswraps +510169 Update the LTP version in valgrind testsuite to 20250930 To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index 0ce348ef5..d96e7fd0a 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -20,10 +20,7 @@ LTP_FILTERS = \ filters/prctl10 \ filters/select03 -LTP_PATCHES = \ - ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch \ - ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch \ - ltp-patches/0003-mmap04-Make-sure-the-scanf-address-format-is-at-leas.patch +LTP_PATCHES = EXTRA_DIST = \ docs/valgrind-listener-manpage.xml \ @@ -173,8 +170,8 @@ endif endif # Linux Test Project -LTP_VERSION=20250530 -LTP_SHA256_SUM=27586ba78eac1e40cd422add2842f1ad70f09fea55da3bd6a25e10feb786d4f2 +LTP_VERSION=20250930 +LTP_SHA256_SUM=048fa4d69ddbe8a94aa15da9bdc85713ab07a0abbc3de2b8bdd9757644aef1e4 LTP_TAR_NAME=ltp-full-$(LTP_VERSION).tar.xz LTP_URL=https://github.com/linux-test-project/ltp/releases/download/$(LTP_VERSION)/$(LTP_TAR_NAME) LTP_TAR=$(AUX_CHECK_DIR)/$(LTP_TAR_NAME) diff --git a/auxprogs/ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch b/auxprogs/ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch deleted file mode 100644 index bd1fb1dd6..000000000 --- a/auxprogs/ltp-patches/0001-Make-sure-32-bit-powerpc-syscall-defs-don-t-leak-to-.patch +++ /dev/null @@ -1,41 +0,0 @@ -From a90b2aac69028bd6b9e0fcc1e36760639b937b99 Mon Sep 17 00:00:00 2001 -From: Martin Cermak -Date: Mon, 4 Aug 2025 21:46:52 +0200 -Subject: [PATCH] Make sure 32-bit powerpc syscall defs don't leak to 64-bit - powerpc systems - -generate_syscalls.sh generates the syscalls.h header at the configure -time. At the moment, that header has a set of 32-bit syscalls defined -with the __powerpc__ gate, plus another set of 64-bit syscalls defined -with the __powerpc64__ gate. For 32-bit powerpc systems that's fine. -But for a 64-bit powerpc system this means that both sets of syscalls -become defined, which isn't right. - -Thing is that on a 64-bit powerpc system, both __powerpc__ and -__powerpc64__ are defined compiler macros, while on a 32-bit powerpc -system, only the former is defined while the latter is not. - -That said, the correct gate for a 32-bit only powerpc code is: - #if defined(__powerpc__) && !defined(__powerpc64__) - -Without this patch, e.g. __NR_clock_gettime64 def leaks to -64-bit powerpc systems, which is wrong. This patch fixes it. ---- - include/lapi/syscalls/generate_syscalls.sh | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/lapi/syscalls/generate_syscalls.sh b/include/lapi/syscalls/generate_syscalls.sh -index b17c72ddf..19f280dfb 100755 ---- a/include/lapi/syscalls/generate_syscalls.sh -+++ b/include/lapi/syscalls/generate_syscalls.sh -@@ -78,6 +78,7 @@ while IFS= read -r arch; do - parisc) echo "#ifdef __hppa__" ;; - loongarch64) echo "#ifdef __loongarch__" ;; - arm64) echo "#ifdef __aarch64__" ;; -+ powerpc) echo "#if defined(__powerpc__) && !defined(__powerpc64__)" ;; - *) echo "#ifdef __${arch}__" ;; - esac - --- -2.48.1 - diff --git a/auxprogs/ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch b/auxprogs/ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch deleted file mode 100644 index a77162bfc..000000000 --- a/auxprogs/ltp-patches/0002-Introduce-LTP_QUIET-env-var.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 183df3240f8e7ca38fbe2fd472c31c9417ae7eb2 Mon Sep 17 00:00:00 2001 -From: Martin Cermak -Date: Tue, 16 Sep 2025 15:46:40 +0200 -Subject: [PATCH] Introduce LTP_QUIET env var - -Introduce LTP_QUIET env variable. When set to 1 or y, it will -suppress printing TCONF, TWARN, TINFO, and TDEBUG messages. ---- - lib/tst_test.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/lib/tst_test.c b/lib/tst_test.c -index 92872cc89..609a7b075 100644 ---- a/lib/tst_test.c -+++ b/lib/tst_test.c -@@ -68,6 +68,7 @@ static int iterations = 1; - static float duration = -1; - static float timeout_mul = -1; - static int reproducible_output; -+static int quiet_output; - - struct context { - int32_t lib_pid; -@@ -307,15 +308,19 @@ static void print_result(const char *file, const int lineno, int ttype, - res = "TBROK"; - break; - case TCONF: -+ if (quiet_output) return; - res = "TCONF"; - break; - case TWARN: -+ if (quiet_output) return; - res = "TWARN"; - break; - case TINFO: -+ if (quiet_output) return; - res = "TINFO"; - break; - case TDEBUG: -+ if (quiet_output) return; - res = "TDEBUG"; - break; - default: -@@ -670,6 +675,7 @@ static void print_help(void) - fprintf(stderr, "LTP_DEV_FS_TYPE Filesystem used for testing (default: %s)\n", DEFAULT_FS_TYPE); - fprintf(stderr, "LTP_ENABLE_DEBUG Print debug messages (set 1 or y)\n"); - fprintf(stderr, "LTP_REPRODUCIBLE_OUTPUT Values 1 or y discard the actual content of the messages printed by the test\n"); -+ fprintf(stderr, "LTP_QUIET Values 1 or y will suppress printing TCONF, TWARN, TINFO, and TDEBUG messages\n"); - fprintf(stderr, "LTP_SINGLE_FS_TYPE Specifies filesystem instead all supported (for .all_filesystems)\n"); - fprintf(stderr, "LTP_FORCE_SINGLE_FS_TYPE Testing only. The same as LTP_SINGLE_FS_TYPE but ignores test skiplist.\n"); - fprintf(stderr, "LTP_TIMEOUT_MUL Timeout multiplier (must be a number >=1)\n"); -@@ -1361,6 +1367,7 @@ static void do_setup(int argc, char *argv[]) - { - char *tdebug_env = getenv("LTP_ENABLE_DEBUG"); - char *reproducible_env = getenv("LTP_REPRODUCIBLE_OUTPUT"); -+ char *quiet_env = getenv("LTP_QUIET"); - - if (!tst_test) - tst_brk(TBROK, "No tests to run"); -@@ -1391,6 +1398,10 @@ static void do_setup(int argc, char *argv[]) - (!strcmp(reproducible_env, "1") || !strcmp(reproducible_env, "y"))) - reproducible_output = 1; - -+ if (quiet_env && -+ (!strcmp(quiet_env, "1") || !strcmp(quiet_env, "y"))) -+ quiet_output = 1; -+ - assert_test_fn(); - - TCID = tcid = get_tcid(argv); --- -2.48.1 - diff --git a/auxprogs/ltp-patches/0003-mmap04-Make-sure-the-scanf-address-format-is-at-leas.patch b/auxprogs/ltp-patches/0003-mmap04-Make-sure-the-scanf-address-format-is-at-leas.patch deleted file mode 100644 index 7956999b3..000000000 --- a/auxprogs/ltp-patches/0003-mmap04-Make-sure-the-scanf-address-format-is-at-leas.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 6c3a6a6f625b58e8dc611cc12bc6015dc8dd5b32 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Thu, 18 Sep 2025 17:16:05 +0200 -Subject: [PATCH] mmap04: Make sure the scanf address format is at least 8 hex - chars - -The addresses in /proc/self/maps are at least 8 hex chars. Zeros are -added to the front of the address when shorter (both on 32bit and -64bit systems). - -Under valgrind the mmaps used in kernel/syscalls/mmap/mmap04.c come -out very low in the address space and might be shorter than 8 hex -chars. This causes the scanf to fail: -mmap04.c:62: TBROK: Expected 1 conversions got 0 FILE '/proc/self/maps' - -Fix this by using "%08" PRIxPTR when creating the fmt used. - -Signed-off-by: Mark Wielaard ---- - testcases/kernel/syscalls/mmap/mmap04.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/testcases/kernel/syscalls/mmap/mmap04.c b/testcases/kernel/syscalls/mmap/mmap04.c -index 4a050b7b50da..5b28180df29b 100644 ---- a/testcases/kernel/syscalls/mmap/mmap04.c -+++ b/testcases/kernel/syscalls/mmap/mmap04.c -@@ -58,7 +58,8 @@ static void run(unsigned int i) - - addr2 = SAFE_MMAP(addr1 + pagesize, pagesize, tc->prot, tc->flags | MAP_FIXED, -1, 0); - -- sprintf(fmt, "%" PRIxPTR "-%%*x %%s", (uintptr_t)addr2); -+ /* A /proc/self/maps address is at least 8 hex (left zero padded) */ -+ sprintf(fmt, "%08" PRIxPTR "-%%*x %%s", (uintptr_t)addr2); - SAFE_FILE_LINES_SCANF("/proc/self/maps", fmt, perms); - - if (!strcmp(perms, tc->exp_perms)) { --- -2.51.0 - From c3f8f3ceb4ba6942993762f82911a670fa128789 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Wed, 8 Oct 2025 10:07:30 +0200 Subject: [PATCH 364/412] Wrap swapon and swapoff syscalls on non-mips arches. Drop the mips-specific syswraps for swapon and swapoff syscalls. Instead, wrap these syscalls on all the arches. https://bugs.kde.org/show_bug.cgi?id=368791 --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 3 +++ coregrind/m_syswrap/syswrap-amd64-linux.c | 4 ++-- coregrind/m_syswrap/syswrap-arm-linux.c | 4 ++-- coregrind/m_syswrap/syswrap-arm64-linux.c | 4 ++-- coregrind/m_syswrap/syswrap-linux.c | 13 +++++++++++++ coregrind/m_syswrap/syswrap-mips32-linux.c | 4 ++-- coregrind/m_syswrap/syswrap-mips64-linux.c | 18 ++---------------- coregrind/m_syswrap/syswrap-nanomips-linux.c | 18 ++---------------- coregrind/m_syswrap/syswrap-ppc32-linux.c | 4 ++-- coregrind/m_syswrap/syswrap-ppc64-linux.c | 4 ++-- coregrind/m_syswrap/syswrap-riscv64-linux.c | 2 ++ coregrind/m_syswrap/syswrap-s390x-linux.c | 4 ++-- coregrind/m_syswrap/syswrap-x86-linux.c | 4 ++-- 14 files changed, 39 insertions(+), 48 deletions(-) diff --git a/NEWS b/NEWS index ca3f9fca4..b097e3789 100644 --- a/NEWS +++ b/NEWS @@ -72,6 +72,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 309554 Wrap syscall remap_file_pages (216) 331311 Valgrind shows open files in /proc/self/fd that don't work for the process 338803 Handling of dwz debug alt files or cross-CU is broken +368791 Handle swapon and swapoff syscalls as linux generic 369030 Wrap linux syscall: 171 (setdomainname) 388526 Inconsistent severity in message text: "WARNING: Serious error" 418756 MAP_FIXED_NOREPLACE mmap flag unsupported diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 53aa1b582..ca462e896 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -288,6 +288,9 @@ DECL_TEMPLATE(linux, sys_init_module); DECL_TEMPLATE(linux, sys_finit_module); DECL_TEMPLATE(linux, sys_delete_module); +DECL_TEMPLATE(linux, sys_swapon); +DECL_TEMPLATE(linux, sys_swapoff); + // Linux-specific (oprofile-related) DECL_TEMPLATE(linux, sys_lookup_dcookie); // (*/32/64) L diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 4a3bad55f..838bf5e84 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -670,8 +670,8 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_mount, sys_mount), // 165 LINX_(__NR_umount2, sys_umount), // 166 - // (__NR_swapon, sys_swapon), // 167 - // (__NR_swapoff, sys_swapoff), // 168 + LINX_(__NR_swapon, sys_swapon), // 167 + LINX_(__NR_swapoff, sys_swapoff), // 168 // (__NR_reboot, sys_reboot), // 169 GENX_(__NR_sethostname, sys_sethostname), // 170 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index f55ed05e6..1fda7ba8a 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -653,7 +653,7 @@ static SyscallTableEntry syscall_main_table[] = { //zz GENXY(__NR_readlink, sys_readlink), // 85 //zz // (__NR_uselib, sys_uselib), // 86 */Linux -//zz // (__NR_swapon, sys_swapon), // 87 */Linux + LINX_(__NR_swapon, sys_swapon), // 87 */Linux //zz // (__NR_reboot, sys_reboot), // 88 */Linux //zz // (__NR_readdir, old_readdir), // 89 -- superseded //zz @@ -687,7 +687,7 @@ static SyscallTableEntry syscall_main_table[] = { // PLAXY(__NR_vm86old, sys_vm86old), // 113 __NR_syscall... weird GENXY(__NR_wait4, sys_wait4), // 114 //zz -//zz // (__NR_swapoff, sys_swapoff), // 115 */Linux + LINX_(__NR_swapoff, sys_swapoff), // 115 */Linux LINXY(__NR_sysinfo, sys_sysinfo), // 116 // _____(__NR_ipc, sys_ipc), // 117 GENX_(__NR_fsync, sys_fsync), // 118 diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index b28b4598c..175002e6b 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -772,8 +772,8 @@ static SyscallTableEntry syscall_main_table[] = { GENX_(__NR_execve, sys_execve), // 221 PLAX_(__NR_mmap, sys_mmap), // 222 PLAX_(__NR_fadvise64, sys_fadvise64), // 223 - // (__NR_swapon, sys_swapon), // 224 - // (__NR_swapoff, sys_swapoff), // 225 + LINX_(__NR_swapon, sys_swapon), // 224 + LINX_(__NR_swapoff, sys_swapoff), // 225 GENXY(__NR_mprotect, sys_mprotect), // 226 GENX_(__NR_msync, sys_msync), // 227 GENX_(__NR_mlock, sys_mlock), // 228 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index d891ac6da..1402c3d1f 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2133,6 +2133,19 @@ POST(sys_ppoll_time64) ppoll_post_helper (tid, arrghs, status); } +PRE(sys_swapon) +{ + PRINT("sys_swapon ( %#lx, %#lx )", ARG1, ARG2); + PRE_REG_READ2(long, "swapon", const void *, path, int, flags); + PRE_MEM_RASCIIZ( "swapon(path)", ARG1); +} + +PRE(sys_swapoff) +{ + PRINT("sys_swapoff ( %#lx )", ARG1); + PRE_REG_READ1(long, "swapoff", const void *, path); + PRE_MEM_RASCIIZ( "swapoff(path)", ARG1); +} /* --------------------------------------------------------------------- epoll_* wrappers diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index c4d7a6620..4edfe8a70 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -852,7 +852,7 @@ static SyscallTableEntry syscall_main_table[] = { //.. // (__NR_oldlstat, sys_lstat), // 84 GENXY (__NR_readlink, sys_readlink), // 85 //.. // (__NR_uselib, sys_uselib), // 86 - //.. // (__NR_swapon, sys_swapon), // 87 + LINX_ (__NR_swapon, sys_swapon), // 87 //.. // (__NR_reboot, sys_reboot), // 88 //.. // (__NR_readdir, old_readdir), // 89 PLAX_ (__NR_mmap, sys_mmap), // 90 @@ -880,7 +880,7 @@ static SyscallTableEntry syscall_main_table[] = { //.. GENX_(__NR_idle, sys_ni_syscall), // 112 //.. // (__NR_vm86old, sys_vm86old), // 113 GENXY (__NR_wait4, sys_wait4), // 114 - //.. // (__NR_swapoff, sys_swapoff), // 115 + LINX_ (__NR_swapoff, sys_swapoff), // 115 LINXY (__NR_sysinfo, sys_sysinfo), // 116 LINXY (__NR_ipc, sys_ipc), // 117 GENX_ (__NR_fsync, sys_fsync), // 118 diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 45af0a3fd..4fb6f060e 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -215,8 +215,6 @@ SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ) file, but that requires even more macro magic. */ DECL_TEMPLATE (mips_linux, sys_set_thread_area); -DECL_TEMPLATE (mips_linux, sys_swapon); -DECL_TEMPLATE (mips_linux, sys_swapoff); DECL_TEMPLATE (mips_linux, sys_sethostname); DECL_TEMPLATE (mips_linux, sys_reboot); DECL_TEMPLATE (mips_linux, sys_cacheflush); @@ -236,18 +234,6 @@ PRE(sys_sched_rr_get_interval) *flags |= SfMayBlock; } -PRE(sys_swapon) -{ - PRINT("sys_swapon ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", ARG1, ARG2); - PRE_REG_READ2(long, "swapon", const void *, path, int, flags); -} - -PRE(sys_swapoff) -{ - PRINT("sys_swapoff ( %#" FMT_REGWORD "x )", ARG1); - PRE_REG_READ1(long, "swapoff", const void *, path); -} - /* Very much MIPS specific */ PRE(sys_cacheflush) { @@ -648,8 +634,8 @@ static SyscallTableEntry syscall_main_table[] = { LINX_ (__NR_mount, sys_mount), LINX_ (__NR_mount_setattr, sys_mount_setattr), LINX_ (__NR_umount2, sys_umount), - PLAX_ (__NR_swapon, sys_swapon), - PLAX_ (__NR_swapoff, sys_swapoff), + LINX_ (__NR_swapon, sys_swapon), + LINX_ (__NR_swapoff, sys_swapoff), PLAX_ (__NR_reboot, sys_reboot), PLAX_ (__NR_sethostname, sys_sethostname), LINX_ (__NR_setdomainname, sys_setdomainname), diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index 94e4ce4d4..f1a0b3c59 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -383,8 +383,6 @@ DECL_TEMPLATE (mips_linux, sys_ptrace); DECL_TEMPLATE (mips_linux, sys_unshare); DECL_TEMPLATE (mips_linux, sys_reboot); DECL_TEMPLATE (mips_linux, sys_sethostname); -DECL_TEMPLATE (mips_linux, sys_swapon); -DECL_TEMPLATE (mips_linux, sys_swapoff); PRE(sys_mmap2) { @@ -519,18 +517,6 @@ PRE(sys_sethostname) PRE_REG_READ2 (long, "sethostname", const void *, name, int, len); } -PRE(sys_swapon) -{ - PRINT("sys_swapon ( %#lx, %#lx )", ARG1, ARG2); - PRE_REG_READ2(long, "swapon", const void *, path, int, flags); -} - -PRE(sys_swapoff) -{ - PRINT("sys_swapoff ( %#lx )", ARG1); - PRE_REG_READ1(long, "swapoff", const void *, path); -} - #undef PRE #undef POST @@ -765,8 +751,8 @@ static SyscallTableEntry syscall_main_table[] = { GENX_ (__NR_execve, sys_execve), PLAX_ (__NR_mmap2, sys_mmap2), LINX_ (__NR_fadvise64_64, sys_fadvise64_64), - PLAX_ (__NR_swapon, sys_swapon), - PLAX_ (__NR_swapoff, sys_swapoff), + LINX_ (__NR_swapon, sys_swapon), + LINX_ (__NR_swapoff, sys_swapoff), GENXY (__NR_mprotect, sys_mprotect), GENX_ (__NR_msync, sys_msync), GENX_ (__NR_mlock, sys_mlock), diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index 8bb0a04f5..b1390f3ab 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -716,7 +716,7 @@ static SyscallTableEntry syscall_table[] = { //.. GENXY(__NR_readlink, sys_readlink), // 85 //.. // (__NR_uselib, sys_uselib), // 86 */Linux -//.. // (__NR_swapon, sys_swapon), // 87 */Linux + LINX_(__NR_swapon, sys_swapon), // 87 */Linux //.. // (__NR_reboot, sys_reboot), // 88 */Linux //.. // (__NR_readdir, old_readdir), // 89 -- superseded @@ -750,7 +750,7 @@ static SyscallTableEntry syscall_table[] = { //.. // (__NR_vm86old, sys_vm86old), // 113 x86/Linux-only GENXY(__NR_wait4, sys_wait4), // 114 //.. -//.. // (__NR_swapoff, sys_swapoff), // 115 */Linux + LINX_(__NR_swapoff, sys_swapoff), // 115 */Linux LINXY(__NR_sysinfo, sys_sysinfo), // 116 LINXY(__NR_ipc, sys_ipc), // 117 GENX_(__NR_fsync, sys_fsync), // 118 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 0f5111728..4a0865084 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -704,7 +704,7 @@ static SyscallTableEntry syscall_table[] = { GENXY(__NR_readlink, sys_readlink), // 85 // _____(__NR_uselib, sys_uselib), // 86 -// _____(__NR_swapon, sys_swapon), // 87 + LINX_(__NR_swapon, sys_swapon), // 87 // _____(__NR_reboot, sys_reboot), // 88 // _____(__NR_readdir, sys_readdir), // 89 @@ -738,7 +738,7 @@ static SyscallTableEntry syscall_table[] = { // _____(__NR_vm86, sys_vm86), // 113 GENXY(__NR_wait4, sys_wait4), // 114 -// _____(__NR_swapoff, sys_swapoff), // 115 + LINX_(__NR_swapoff, sys_swapoff), // 115 LINXY(__NR_sysinfo, sys_sysinfo), // 116 LINXY(__NR_ipc, sys_ipc), // 117 GENX_(__NR_fsync, sys_fsync), // 118 diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index d806b92b8..5a1ea2553 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -530,6 +530,8 @@ static SyscallTableEntry syscall_main_table[] = { GENX_(__NR_execve, sys_execve), /* 221 */ PLAX_(__NR_mmap, sys_mmap), /* 222 */ GENX_(__NR_fadvise64, sys_ni_syscall), /* 223 */ + LINX_(__NR_swapon, sys_swapon), /* 224 */ + LINX_(__NR_swapoff, sys_swapoff), /* 225 */ GENXY(__NR_mprotect, sys_mprotect), /* 226 */ GENX_(__NR_msync, sys_msync), /* 227 */ GENX_(__NR_mlock, sys_mlock), /* 228 */ diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index 643549c64..acb4aefee 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -515,7 +515,7 @@ static SyscallTableEntry syscall_table[] = { GENXY(__NR_readlink, sys_readlink), // 85 // ?????(__NR_uselib, ), // 86 -// ?????(__NR_swapon, ), // 87 + LINX_(__NR_swapon, sys_swapon), // 87 // ?????(__NR_reboot, ), // 88 GENX_(89, sys_ni_syscall), /* unimplemented (by the kernel) */ // 89 @@ -549,7 +549,7 @@ static SyscallTableEntry syscall_table[] = { GENX_(113, sys_ni_syscall), /* unimplemented (by the kernel) */ // 113 GENXY(__NR_wait4, sys_wait4), // 114 -// ?????(__NR_swapoff, ), // 115 + LINX_(__NR_swapoff, sys_swapoff), // 115 LINXY(__NR_sysinfo, sys_sysinfo), // 116 LINXY(__NR_ipc, sys_ipc), // 117 GENX_(__NR_fsync, sys_fsync), // 118 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 42a69cb96..f697a9e19 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1261,7 +1261,7 @@ static SyscallTableEntry syscall_table[] = { //zz GENXY(__NR_readlink, sys_readlink), // 85 //zz // (__NR_uselib, sys_uselib), // 86 */Linux -//zz // (__NR_swapon, sys_swapon), // 87 */Linux + LINX_(__NR_swapon, sys_swapon), // 87 */Linux //zz // (__NR_reboot, sys_reboot), // 88 */Linux //zz // (__NR_readdir, old_readdir), // 89 -- superseded //zz @@ -1295,7 +1295,7 @@ static SyscallTableEntry syscall_table[] = { PLAXY(__NR_vm86old, sys_vm86old), // 113 x86/Linux-only GENXY(__NR_wait4, sys_wait4), // 114 //zz -//zz // (__NR_swapoff, sys_swapoff), // 115 */Linux + LINX_(__NR_swapoff, sys_swapoff), // 115 */Linux LINXY(__NR_sysinfo, sys_sysinfo), // 116 LINXY(__NR_ipc, sys_ipc), // 117 GENX_(__NR_fsync, sys_fsync), // 118 From 001f7439d6e20f3b117b5032070111fd701195bc Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 10 Oct 2025 18:12:02 +0200 Subject: [PATCH 365/412] Define __NR_swapon and __NR_swapoff on riscv64 Update commit c3f8f3ceb4ba6942993762f82911a670fa128789 adding a missing define. https://bugs.kde.org/show_bug.cgi?id=368791 --- include/vki/vki-scnums-riscv64-linux.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/vki/vki-scnums-riscv64-linux.h b/include/vki/vki-scnums-riscv64-linux.h index 6130ce37f..d630a1916 100644 --- a/include/vki/vki-scnums-riscv64-linux.h +++ b/include/vki/vki-scnums-riscv64-linux.h @@ -254,6 +254,8 @@ #define __NR_execve 221 #define __NR3264_mmap 222 #define __NR3264_fadvise64 223 +#define __NR_swapon 224 +#define __NR_swapoff 225 #define __NR_mprotect 226 #define __NR_msync 227 #define __NR_mlock 228 From 9640ff697cd9c9be485ea8bffc6381395b3ad1d4 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 10 Oct 2025 20:57:26 +0200 Subject: [PATCH 366/412] FreeBSD regtest: tweak setcred test Should now work on both arm64 and amd64 (and with a diff on the size of struct setcred for x86). Still don't see what caused the Conditional jump error. --- memcheck/tests/freebsd/setcred.cpp | 33 ++++++++++++++++------- memcheck/tests/freebsd/setcred.stderr.exp | 26 +++++++++--------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/memcheck/tests/freebsd/setcred.cpp b/memcheck/tests/freebsd/setcred.cpp index 619d1959f..1ae28f7f0 100644 --- a/memcheck/tests/freebsd/setcred.cpp +++ b/memcheck/tests/freebsd/setcred.cpp @@ -19,30 +19,23 @@ int main() std::memset(&cred1, 250, sizeof(cred1)); - // needs to be root to work correctly - ret = setcred(flags1, &cred1, size1); - assert(ret == -1); - assert(errno == EPERM); - - // not accessible - ret = setcred(flags1, nullptr, size1); - assert(ret == -1); - assert(errno == EFAULT); - // uninit ret = setcred(flags2+x0, (struct setcred*)x0, size1+x0); assert(ret == -1); assert(errno == EFAULT); + errno = 0; // invalid flags ret = setcred(9999+x0, &cred1, sizeof(cred1)); assert(ret == -1); assert(errno == EINVAL); + errno = 0; // invalid size ret = setcred(flags1, &cred1, 3+x0); assert(ret == -1); assert(errno == EINVAL); + errno = 0; cred2 = new struct setcred; @@ -50,6 +43,26 @@ int main() ret = setcred(flags1, cred2, size1); assert(ret == -1); assert(errno == EPERM); + errno = 0; + + // PJF these two calls to setcred were before the + // uninit one that is now first + // that was fine on arm64 but on amd64 the uninit + // call generated an extre Conditional jump ... error + + // fairly mysterious, and usually that means that there + // is something wrong with the syscall wrapper + + // needs to be root to work correctly + ret = setcred(flags1, &cred1, size1); + assert(ret == -1); + assert(errno == EPERM); + errno = 0; + + // not accessible + ret = setcred(flags1, nullptr, size1); + assert(ret == -1); + assert(errno == EFAULT); delete cred2; free(px); diff --git a/memcheck/tests/freebsd/setcred.stderr.exp b/memcheck/tests/freebsd/setcred.stderr.exp index 8766361c0..5f84b4f28 100644 --- a/memcheck/tests/freebsd/setcred.stderr.exp +++ b/memcheck/tests/freebsd/setcred.stderr.exp @@ -1,37 +1,37 @@ -Syscall param setcred(wcred) points to unaddressable byte(s) - at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:28) - Address 0x........ is not stack'd, malloc'd or (recently) free'd - Syscall param setcred(flags) contains uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:33) + by 0x........: main (setcred.cpp:23) Syscall param setcred(wcred) contains uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:33) + by 0x........: main (setcred.cpp:23) Syscall param setcred(size) contains uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:33) + by 0x........: main (setcred.cpp:23) Syscall param setcred(wcred) points to unaddressable byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:33) + by 0x........: main (setcred.cpp:23) Address 0x........ is not stack'd, malloc'd or (recently) free'd Syscall param setcred(flags) contains uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:38) + by 0x........: main (setcred.cpp:29) Syscall param setcred(size) contains uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:43) + by 0x........: main (setcred.cpp:35) Syscall param setcred(wcred) points to uninitialised byte(s) at 0x........: setcred (in /...libc...) - by 0x........: main (setcred.cpp:50) + by 0x........: main (setcred.cpp:43) Address 0x........ is 0 bytes inside a block of size 48 alloc'd at 0x........: ...operator new... (vg_replace_malloc.c:...) - by 0x........: main (setcred.cpp:47) + by 0x........: main (setcred.cpp:40) + +Syscall param setcred(wcred) points to unaddressable byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:63) + Address 0x........ is not stack'd, malloc'd or (recently) free'd From 5a3aa8c8d13720636df4415ca6bb0aa43b67ef1c Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 11 Oct 2025 00:32:23 +0200 Subject: [PATCH 367/412] FreeBSD regtest: improve filter_arg_check This was looking for PIDs with 5 digits so the test failed when the PIDs being used have fewer digits. --- memcheck/tests/amd64-freebsd/filter_arg_check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcheck/tests/amd64-freebsd/filter_arg_check b/memcheck/tests/amd64-freebsd/filter_arg_check index 334a32669..c1152cf83 100755 --- a/memcheck/tests/amd64-freebsd/filter_arg_check +++ b/memcheck/tests/amd64-freebsd/filter_arg_check @@ -18,5 +18,5 @@ grep "SYSCALL.*sendfile" | sed 's/==.*//' | awk '{l=length($9);$9="0x"substr($9, l-2, l);print}' | -sed -E 's/\[[0-9]{5}/[xxxxx/' +sed -E 's/\[[0-9]+/[xxxxx/' From 7068b807905af87729a66d192f7c10247c42212f Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 11 Oct 2025 13:01:03 +0200 Subject: [PATCH 368/412] gdbserver doc: add some comments about the invoker implementations. --- gdbserver_tests/README_DEVELOPERS | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gdbserver_tests/README_DEVELOPERS b/gdbserver_tests/README_DEVELOPERS index 250c14326..0a9f2846f 100644 --- a/gdbserver_tests/README_DEVELOPERS +++ b/gdbserver_tests/README_DEVELOPERS @@ -30,11 +30,27 @@ if testing with a lower version). Test behaviour with gdb < 7.0 is unknown: some might fail, some might block or loop for a very long time. -Some tests implies to have a vgdb "ptrace invoker" capable. +Some tests imply having the vgdb "ptrace invoker" capability. The prerequisite are established during make regtest (using marker files). Each test verifies the prerequisite using the prereq: line. +The invoker is implemented as follows on the currently supported OSes. + +------------------------------------------------------------ +| Linux | ptrace | vgdb-invoker-ptrace.c | +| FreeBSD | ptrace | vgdb-invoker-freebsd.c | +| Solaris | process control files | vgdb-invoker-solaris.c | +| Darwin | not implemented | vgdb-invoker-none.c | +------------------------------------------------------------ + +The source files are all in coregrind/. ptrace is not part of any +standardised interface like POSIX. That means that the Linux and +FreeBSD implementations are very similar but there are some +differences. Darwin not having an invoker means that it is not possible +to interrupt Valgrind attached to GDB if it hangs. You will need to +kill Valgrind and start again if that happens. + In case of failing tests ------------------------ When executed with a new gdb version and/or depending on the OS version, From 01db0b93a8b9145d26e2e15da1759f1377f7ee91 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 11 Oct 2025 15:09:46 +0200 Subject: [PATCH 369/412] NEWS: Add FreeBSD platform section --- NEWS | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/NEWS b/NEWS index b097e3789..eebbf4fab 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,21 @@ X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux. * ================== PLATFORM CHANGES ================= +FreeBSD 15 (which is expected to ship in December 2025, after +Valgrind 3.26 is released) contains a change to ptrace that affects +use of Valgrind with vgdb. This impacts the mechanism that vgdb +uses to interrupt Valgrind if all threads are blocked and you want +to get back to the gdb prompt by hitting ctrl-c. This mechanism +is no longer reliable. On arm64 Valgrind will crash with an assert. +On amd64 syscalls may give spurious and incorrect return codes. + +There is a workaround. Run the following command (as root). + + sysctl debug.ptrace_attach_transparent=0 + + See also + https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290008 + * ==================== TOOL CHANGES =================== * There is a new utility script, "vgstack". It has two From 5addc084570ee5fbb2876093415ffefdb8b9645c Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 11 Oct 2025 15:11:10 +0200 Subject: [PATCH 370/412] FreeBSD cleanup: remove an orphaned comment Removed the function, forgot to remove the reminder comment. --- coregrind/m_initimg/initimg-freebsd.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index 2f8ac82eb..f187c0e3d 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -334,10 +334,6 @@ static const struct auxv *find_auxv(const UWord* sp) return (const struct auxv *)sp; } -/* - * @todo PJF Make this multi-platform - */ - /* ---------------------------------------------------------------- This sets up the client's initial stack, containing the args, From 0a5028313b6ff0462b77318b250ed31a2b069510 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 12 Oct 2025 13:29:45 +0200 Subject: [PATCH 371/412] FreeBSD regtest: add a prereq for bug452274 This test tends to hang when running in a VM. The problem is that the test spams both syscalls (write) and signals (SIGVTALRM from setitimer). The test halts after 100 signals have been handled. Under VirtualBox the timer signals get starved by the syscalls and the limit of 100 doesn't get reached (at least not in any reasonable amount of time). --- none/tests/freebsd/bug452274.vgtest | 1 + 1 file changed, 1 insertion(+) diff --git a/none/tests/freebsd/bug452274.vgtest b/none/tests/freebsd/bug452274.vgtest index 30b1179a6..23092b138 100644 --- a/none/tests/freebsd/bug452274.vgtest +++ b/none/tests/freebsd/bug452274.vgtest @@ -1,3 +1,4 @@ +prereq: [ `sysctl -n kern.vm_guest` = "none" ] prog: bug452274 vgopts: -q stderr_filter: filter_452274 From ea458dade2cb8f42586ef5a3f271b4cdddbf647a Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 4 Oct 2025 18:46:58 +0000 Subject: [PATCH 372/412] Bug 509406 - FreeBSD 15 issues This is the last of a series of fixes and bodges. I now get the following results. On arm64 == 793 tests, 1 stderr failure, 0 stdout failures, 0 stderrB failures, 0 stdoutB failures, 0 post failures == memcheck/tests/thread_alloca (stderr) (which is not a new failure) and == 947 tests, 1 stderr failure, 0 stdout failures, 0 stderrB failures, 1 stdoutB failure, 0 post failures == gdbserver_tests/nlvgdbsigqueue (stderr) gdbserver_tests/nlvgdbsigqueue (stdoutB) (again a test that fails regularly) --- NEWS | 3 ++- memcheck/tests/freebsd/pdfork_pdkill.supp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index eebbf4fab..b1b27e815 100644 --- a/NEWS +++ b/NEWS @@ -70,7 +70,7 @@ There is a workaround. Run the following command (as root). "UnsafeZeroSize". Checks for C23 free_sized and free_aligned_sized have been added to - Linux. Almost no libraries support these functions yes, with + Linux. Almost no libraries support these functions yet, with the exception being Google tcmalloc. * ==================== FIXED BUGS ==================== @@ -156,6 +156,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509107 memcheck/tests/duplicate_align_size_errors.cpp fails 509139 Update BadSize error messages 509258 FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers +509406 FreeBSD 15 issues 509517 s390x: Even/odd lane confusion in various vector insns 509566 Wrap amd64-linux syscall: 442 (mount_setattr) 509572 s390x: Overhaul BFP testsuite diff --git a/memcheck/tests/freebsd/pdfork_pdkill.supp b/memcheck/tests/freebsd/pdfork_pdkill.supp index cd3ad7479..47a836de9 100644 --- a/memcheck/tests/freebsd/pdfork_pdkill.supp +++ b/memcheck/tests/freebsd/pdfork_pdkill.supp @@ -7,7 +7,7 @@ { arm64 suppression 2 Memcheck:Cond - fun:__sys_pdfork + fun:_*pdfork } From d84be08b872099cc627524a9bf36cdc6e5f0cb45 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 13 Oct 2025 08:11:43 +0200 Subject: [PATCH 373/412] FreeBSD regtest: rename 45032 to bug45032 --- .gitignore | 2 +- none/tests/x86-freebsd/445032.vgtest | 2 -- none/tests/x86-freebsd/Makefile.am | 6 +++--- none/tests/x86-freebsd/{445032.c => bug445032.c} | 0 .../x86-freebsd/{445032.stderr.exp => bug445032.stderr.exp} | 0 none/tests/x86-freebsd/bug445032.vgtest | 2 ++ 6 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 none/tests/x86-freebsd/445032.vgtest rename none/tests/x86-freebsd/{445032.c => bug445032.c} (100%) rename none/tests/x86-freebsd/{445032.stderr.exp => bug445032.stderr.exp} (100%) create mode 100644 none/tests/x86-freebsd/bug445032.vgtest diff --git a/.gitignore b/.gitignore index 01dd2a3bc..03eecd1ed 100644 --- a/.gitignore +++ b/.gitignore @@ -2472,7 +2472,7 @@ none/tests/freebsd/bug499212 /none/tests/x86-freebsd/.deps /none/tests/x86-freebsd/Makefile /none/tests/x86-freebsd/Makefile.in -/none/tests/x86-freebsd/445032 +/none/tests/x86-freebsd/bug445032 # /perf/ /perf/*.dSYM diff --git a/none/tests/x86-freebsd/445032.vgtest b/none/tests/x86-freebsd/445032.vgtest deleted file mode 100644 index 06fb23391..000000000 --- a/none/tests/x86-freebsd/445032.vgtest +++ /dev/null @@ -1,2 +0,0 @@ -prog: 445032 -vgopts: -q diff --git a/none/tests/x86-freebsd/Makefile.am b/none/tests/x86-freebsd/Makefile.am index 5dc444b6d..e65dc0941 100644 --- a/none/tests/x86-freebsd/Makefile.am +++ b/none/tests/x86-freebsd/Makefile.am @@ -3,11 +3,11 @@ include $(top_srcdir)/Makefile.tool-tests.am dist_noinst_SCRIPTS = filter_stderr EXTRA_DIST = \ - 445032.vgtest \ - 445032.stderr.exp + bug445032.vgtest \ + bug445032.stderr.exp check_PROGRAMS = \ - 445032 + bug445032 # Linux also adds $(FLAG_MMMX) $(FLAG_MSSE) to the first two AM_CFLAGS += @FLAG_M32@ diff --git a/none/tests/x86-freebsd/445032.c b/none/tests/x86-freebsd/bug445032.c similarity index 100% rename from none/tests/x86-freebsd/445032.c rename to none/tests/x86-freebsd/bug445032.c diff --git a/none/tests/x86-freebsd/445032.stderr.exp b/none/tests/x86-freebsd/bug445032.stderr.exp similarity index 100% rename from none/tests/x86-freebsd/445032.stderr.exp rename to none/tests/x86-freebsd/bug445032.stderr.exp diff --git a/none/tests/x86-freebsd/bug445032.vgtest b/none/tests/x86-freebsd/bug445032.vgtest new file mode 100644 index 000000000..ac6ef9c76 --- /dev/null +++ b/none/tests/x86-freebsd/bug445032.vgtest @@ -0,0 +1,2 @@ +prog: bug445032 +vgopts: -q From 5b6a8d27e717dc71818e0b8b28b6d41e377f4b84 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 13 Oct 2025 08:38:09 +0200 Subject: [PATCH 374/412] configure and make: add configure checks for C++ exception warnings Add checks for -Wno-implicit-exception-spec-mismatch (FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH) and -Wno-missing-exception-spec (FLAG_W_NO_MISSING_EXCEPTION_SPEC) Also we should clean up C++ flag checking a bit. If all checks get grouped together than just one AC_LANG(C++)/AC_LANG(C) would be needed. --- configure.ac | 18 ++++++++++++++++++ massif/tests/Makefile.am | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1a7ea34d1..9217aa0ac 100644 --- a/configure.ac +++ b/configure.ac @@ -2638,6 +2638,24 @@ AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP]) AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION]) AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH]) +# as above, C++ flags +AC_DEFUN([AC_GXX_WARNING_SUBST_NO],[ + AC_MSG_CHECKING([if g++ accepts -W$1]) + safe_CXXFLAGS=$CXXFLAGS + CXXFLAGS="-W$1 -Werror" + AC_LANG_PUSH(C++) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [ + AC_SUBST([$2], [-Wno-$1]) + AC_LANG_POP() + AC_MSG_RESULT([yes])], [ + AC_SUBST([$2], []) + AC_MSG_RESULT([no])]) + CXXFLAGS=$safe_CXXFLAGS +]) + +AC_GXX_WARNING_SUBST_NO([missing-exception-spec], [FLAG_W_NO_MISSING_EXCEPTION_SPEC]) +AC_GXX_WARNING_SUBST_NO([implicit-exception-spec-mismatch], [FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH]) + # Does this compiler support -Wformat-security ? # Special handling is needed, because certain GCC versions require -Wformat # being present if -Wformat-security is given. Otherwise a warning is issued. diff --git a/massif/tests/Makefile.am b/massif/tests/Makefile.am index d4d798f69..b59659272 100644 --- a/massif/tests/Makefile.am +++ b/massif/tests/Makefile.am @@ -98,7 +98,7 @@ bug469146_CXXFLAGS = $(AM_CXXFLAGS) -O2 -fno-optimize-sibling-calls @FLAG_W_NO_U new_cpp_SOURCES = new-cpp.cpp overloaded_new_SOURCES = overloaded-new.cpp # aligned new needs C++17 -overloaded_new_CXXFLAGS = $(AM_CXXFLAGS) -Wno-implicit-exception-spec-mismatch -Wno-missing-exception-spec -std=c++17 +overloaded_new_CXXFLAGS = $(AM_CXXFLAGS) @FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH@ @FLAG_W_NO_MISSING_EXCEPTION_SPEC@ -std=c++17 # Suppress warnings for issues we are testing for alloc_fns_CFLAGS = $(AM_CFLAGS) -Wno-unused-result From ef2d328dae99c8ee9884723f662003e930e6ba36 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 13 Oct 2025 09:18:18 +0200 Subject: [PATCH 375/412] FreeBSD syscall wrapper: fix warning Was giving m_syswrap/syswrap-main.c:370:28: warning: variable 'saved' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer] 370 | syscall_mask, &saved, sizeof(vki_sigset_t) | ^~~~~ Initialising it is probably the safest thing to do, but I suspect that the argument ought not to be const. Will check on that. While I'm at it, looking at how Solaris handles the carry flag it's much better than the global variable used by FreeBSD and Darwin. Will check on that as well. --- coregrind/m_syswrap/syswrap-main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c index 5919698f0..424d0a08a 100644 --- a/coregrind/m_syswrap/syswrap-main.c +++ b/coregrind/m_syswrap/syswrap-main.c @@ -350,15 +350,14 @@ void do_syscall_for_client ( Int syscallno, { vki_sigset_t saved; UWord err; -# if defined(VGO_freebsd) - Word real_syscallno; -# endif # if defined(VGO_linux) err = ML_(do_syscall_for_client_WRK)( syscallno, &tst->arch.vex, syscall_mask, &saved, sizeof(vki_sigset_t) ); # elif defined(VGO_freebsd) + Word real_syscallno; + VG_(sigemptyset)(&saved); if (tst->arch.vex.guest_SC_CLASS == VG_FREEBSD_SYSCALL0) real_syscallno = __NR_syscall; else if (tst->arch.vex.guest_SC_CLASS == VG_FREEBSD_SYSCALL198) From 904087f06ed847b828ee6a46b2d7700ab289367d Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 13 Oct 2025 12:37:35 +0200 Subject: [PATCH 376/412] Bug 286849 - [PATCH] Interceptors for new/delete on Darwin were erroneously commented out in r12043 --- NEWS | 2 ++ coregrind/m_replacemalloc/vg_replace_malloc.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index b1b27e815..f6608c70f 100644 --- a/NEWS +++ b/NEWS @@ -82,6 +82,8 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +286849 [PATCH] Interceptors for new/delete on Darwin were erroneously + commented out in r12043 306098 s390x: Alternate opcode form for convert to/from fixed and friends 309100 s390x: Testcases for extended BFP 309554 Wrap syscall remap_file_pages (216) diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 0438fbdf0..a7a671985 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -507,7 +507,7 @@ extern int * __error(void) __attribute__((weak)); #if VG_WORDSIZE == 4 ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znwj, __builtin_new); ALLOC_or_BOMB(VG_Z_LIBCXX_SONAME, _Znwj, __builtin_new); - ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znwj, __builtin_new); + ALLOC_or_BOMB(SO_SYN_MALLOC, _Znwj, __builtin_new); #endif // operator new(unsigned long) #if VG_WORDSIZE == 8 @@ -627,7 +627,7 @@ extern int * __error(void) __attribute__((weak)); #if VG_WORDSIZE == 4 ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new); ALLOC_or_NULL(VG_Z_LIBCXX_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new); - ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new); + ALLOC_or_NULL(SO_SYN_MALLOC, _ZnwjRKSt9nothrow_t, __builtin_new); #endif // operator new(unsigned long, std::nothrow_t const&) #if VG_WORDSIZE == 8 @@ -870,7 +870,7 @@ extern int * __error(void) __attribute__((weak)); #if VG_WORDSIZE == 4 ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new ); ALLOC_or_NULL(VG_Z_LIBCXX_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new ); - ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new ); + ALLOC_or_NULL(SO_SYN_MALLOC, _ZnajRKSt9nothrow_t, __builtin_vec_new ); #endif // operator new[](unsigned long, std::nothrow_t const&) #if VG_WORDSIZE == 8 From ed4463ff3f1b5d15a5ad8962b36e525e6a89cfb4 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 13 Oct 2025 13:02:52 +0200 Subject: [PATCH 377/412] configure: hard code -Wno-alloc-size-larger-than=2147483647 Should be OK for both 32bit and 64bit. Remove AC_GCC_WARNING_SUBST_NO_VAL - always need to set a value. --- configure.ac | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 9217aa0ac..724e8f07d 100644 --- a/configure.ac +++ b/configure.ac @@ -2566,20 +2566,6 @@ AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[ CFLAGS=$safe_CFLAGS ]) -# A variation of the above for arguments that -# take a value -AC_DEFUN([AC_GCC_WARNING_SUBST_NO_VAL],[ - AC_MSG_CHECKING([if gcc accepts -W$1=$2]) - safe_CFLAGS=$CFLAGS - CFLAGS="-W$1=$2 -Werror" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [ - AC_SUBST([$3], [-Wno-$1]) - AC_MSG_RESULT([yes])], [ - AC_SUBST([$3], []) - AC_MSG_RESULT([no])]) - CFLAGS=$safe_CFLAGS -]) - # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes # -W$1 (instead of -Wno-$1). AC_DEFUN([AC_GCC_WARNING_SUBST],[ @@ -2623,8 +2609,8 @@ AC_GCC_WARNING_SUBST_NO([attributes], [FLAG_W_NO_ATTRIBUTES]) AC_GCC_WARNING_SUBST_NO([unused-result], [FLAG_W_NO_UNUSED_RESULT]) AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION]) AC_GCC_WARNING_SUBST_NO([deprecated], [FLAG_W_NO_DEPRECATED]) - -AC_GCC_WARNING_SUBST_NO_VAL([alloc-size-larger-than], [1677216], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN]) +# OK for 32 and 64 bit +AC_GCC_WARNING_SUBST_NO([alloc-size-larger-than=2147483647], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN]) AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS]) AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY]) From 65b555e4939de7045a984b515b53f2f130aa50be Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 13 Oct 2025 13:26:50 +0200 Subject: [PATCH 378/412] FreeBSD warnings: clear up most warnings with clang19 Still a few more (from MIPS and exe name handling which I added) --- configure.ac | 1 + memcheck/tests/Makefile.am | 3 ++- memcheck/tests/freebsd/Makefile.am | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 724e8f07d..51a6d1767 100644 --- a/configure.ac +++ b/configure.ac @@ -2611,6 +2611,7 @@ AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION]) AC_GCC_WARNING_SUBST_NO([deprecated], [FLAG_W_NO_DEPRECATED]) # OK for 32 and 64 bit AC_GCC_WARNING_SUBST_NO([alloc-size-larger-than=2147483647], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN]) +AC_GCC_WARNING_SUBST_NO([alloc-size], [FLAG_W_NO_ALLOC_SIZE]) AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS]) AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY]) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 0b192de10..cf8991e91 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -700,7 +700,7 @@ if VGCONF_OS_IS_SOLARIS mallinfo_LDADD = -lmalloc endif mallinfo2_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations -malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ +malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ @FLAG_W_NO_ALLOC_SIZE@ sbfragment_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations if VGCONF_OS_IS_SOLARIS sbfragment_LDADD = -lmalloc @@ -720,6 +720,7 @@ duplicate_align_size_errors_SOURCES = duplicate_align_size_errors.cpp duplicate_align_size_errors_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 new_aligned_delete_default_SOURCES = new_aligned_delete_default.cpp new_aligned_delete_default_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 +realloc3_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE@ sized_aligned_new_delete_args_SOURCES = sized_aligned_new_delete_args.cpp sized_aligned_new_delete_args_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 sized_aligned_new_delete_misaligned1_SOURCES = sized_aligned_new_delete_misaligned1.cpp diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index 3bac5e73c..6a77a262d 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -231,6 +231,7 @@ endif if FREEBSD_TIMERFD_SYSCALL check_PROGRAMS += timerfd +timerfd_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE@ timerfd_LDFLAGS = -lm endif @@ -238,6 +239,7 @@ endif access_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ aligned_alloc_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ capsicum_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +clock_nanosleep_interrupt_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE@ chflags_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ chmod_chown_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ delete_sized_mismatch_CXXFLAGS = ${AM_CXXFLAGS} --std=c++14 @@ -257,7 +259,7 @@ memalign_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@ misc_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ openpty_LDFLAGS = ${AM_LDFLAGS} -lutil pdfork_pdkill_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ -realpathat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ +realpathat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ @FLAG_W_NO_ALLOC_SIZE@ revoke_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ scalar_CFLAGS = ${AM_CFLAGS} -g @FLAG_W_NO_UNINITIALIZED@ scalar_abort2_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @@ -268,7 +270,7 @@ scalar_vfork_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_VARIABLE@ sctp2_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ sigwait_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ stat_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ -statfs_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ +statfs_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ @FLAG_W_NO_ALLOC_SIZE@ timing_safe_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_USE_AFTER_FREE@ utimens_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ utimes_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ From ca61eb9faf603e08146f3f4273c942bcf467fc84 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 13 Oct 2025 20:50:10 +0200 Subject: [PATCH 379/412] configure: correct the value for -Wno-alloc-size-larger-than --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 51a6d1767..aa89abb9f 100644 --- a/configure.ac +++ b/configure.ac @@ -2610,7 +2610,7 @@ AC_GCC_WARNING_SUBST_NO([unused-result], [FLAG_W_NO_UNUSED_RESULT]) AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION]) AC_GCC_WARNING_SUBST_NO([deprecated], [FLAG_W_NO_DEPRECATED]) # OK for 32 and 64 bit -AC_GCC_WARNING_SUBST_NO([alloc-size-larger-than=2147483647], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN]) +AC_GCC_WARNING_SUBST_NO([alloc-size-larger-than=18446744073709551615], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN]) AC_GCC_WARNING_SUBST_NO([alloc-size], [FLAG_W_NO_ALLOC_SIZE]) AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS]) From d21fb0775d55abb8f849b0a00b4278d5874275ab Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Mon, 13 Oct 2025 21:33:39 +0200 Subject: [PATCH 380/412] FreeBSD regtest: fix filter_arg_check on arm64 and x86 --- memcheck/tests/arm64-freebsd/filter_arg_check | 2 +- memcheck/tests/x86-freebsd/filter_arg_check | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/memcheck/tests/arm64-freebsd/filter_arg_check b/memcheck/tests/arm64-freebsd/filter_arg_check index 334a32669..c1152cf83 100755 --- a/memcheck/tests/arm64-freebsd/filter_arg_check +++ b/memcheck/tests/arm64-freebsd/filter_arg_check @@ -18,5 +18,5 @@ grep "SYSCALL.*sendfile" | sed 's/==.*//' | awk '{l=length($9);$9="0x"substr($9, l-2, l);print}' | -sed -E 's/\[[0-9]{5}/[xxxxx/' +sed -E 's/\[[0-9]+/[xxxxx/' diff --git a/memcheck/tests/x86-freebsd/filter_arg_check b/memcheck/tests/x86-freebsd/filter_arg_check index 302dea2df..f7bc245b7 100755 --- a/memcheck/tests/x86-freebsd/filter_arg_check +++ b/memcheck/tests/x86-freebsd/filter_arg_check @@ -16,5 +16,5 @@ grep "SYSCALL.*sendfile" | sed 's/==.*//' | -sed -E 's/\[[0-9]{5}/[xxxxx/' +sed -E 's/\[[0-9]+/[xxxxx/' From b0161e30960b09720058a7dcd6bc38934224d34d Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 14 Oct 2025 07:25:25 +0200 Subject: [PATCH 381/412] regtest: move memcheck realloc3 CFLAGS It was inside a block for C++ 17 features. Old systems not supporting that lost the default AM_CFLAGS with -g. --- memcheck/tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index cf8991e91..920f262a6 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -720,7 +720,6 @@ duplicate_align_size_errors_SOURCES = duplicate_align_size_errors.cpp duplicate_align_size_errors_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 new_aligned_delete_default_SOURCES = new_aligned_delete_default.cpp new_aligned_delete_default_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 -realloc3_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE@ sized_aligned_new_delete_args_SOURCES = sized_aligned_new_delete_args.cpp sized_aligned_new_delete_args_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 sized_aligned_new_delete_misaligned1_SOURCES = sized_aligned_new_delete_misaligned1.cpp @@ -824,6 +823,7 @@ partial_load_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_USE_AFTER_FREE@ reach_thread_register_CFLAGS = $(AM_CFLAGS) -O2 reach_thread_register_LDADD = -lpthread +realloc3_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE@ realloc_size_zero_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_INCOMPATIBLE_POINTER_TYPES_DISCARDS_QUALIFIERS@ realloc_size_zero_mismatch_SOURCES = realloc_size_zero_mismatch.cpp realloc_size_zero_mismatch_CXXFLAGS = $(AM_CXXFLAGS) @FLAG_W_NO_MISMATCHED_NEW_DELETE@ From 303ecc60a73237129e2274906cbd883a5ec0edad Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 14 Oct 2025 08:27:16 +0200 Subject: [PATCH 382/412] Fix exe name warnings Most of the exe name functions can take a const char* for the name. Indeed, on Linux this is a requirement since we also lookup debuginfod-find using a const char string literal. The exception to this rule is for scripts. In this case the script shebang can refer to another script with another shebang. And so on until eventually an ELF or macho file is encountered. In that case VG_(args_the_exename) will get freed if necessary and reassigned to a new string. So VG_(load_script) needs to be able to take a non-const char* name, unlike VG_(load_ELF) and VG_(load_macho). VG_(args_the_exename) is now non-const (which fixes a warning when freeing it), VG_(load_script) takes a non-const name and there is an ugly cast for the function pointer. --- coregrind/m_clientstate.c | 2 +- coregrind/m_ume/main.c | 3 ++- coregrind/m_ume/priv_ume.h | 2 +- coregrind/m_ume/script.c | 2 +- include/pub_tool_clientstate.h | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/coregrind/m_clientstate.c b/coregrind/m_clientstate.c index 404a60f37..2e4752b8d 100644 --- a/coregrind/m_clientstate.c +++ b/coregrind/m_clientstate.c @@ -91,7 +91,7 @@ Int VG_(args_for_valgrind_noexecpass) = 0; /* The name of the client executable, as specified on the command line. */ -const HChar* VG_(args_the_exename) = NULL; +HChar* VG_(args_the_exename) = NULL; /* The real name of the executable, with resolved * relative paths and symlinks */ diff --git a/coregrind/m_ume/main.c b/coregrind/m_ume/main.c index 229867e26..0886b009c 100644 --- a/coregrind/m_ume/main.c +++ b/coregrind/m_ume/main.c @@ -42,6 +42,7 @@ #include "priv_ume.h" +typedef Int (*load_function)( Int fd, const HChar *name, ExeInfo *info ); typedef struct { Bool (*match_fn)(const void *hdr, SizeT len); @@ -56,7 +57,7 @@ static ExeHandler exe_handlers[] = { # else # error "unknown OS" # endif - { VG_(match_script), VG_(load_script) }, + { VG_(match_script), (load_function)VG_(load_script) }, }; #define EXE_HANDLER_COUNT (sizeof(exe_handlers)/sizeof(exe_handlers[0])) diff --git a/coregrind/m_ume/priv_ume.h b/coregrind/m_ume/priv_ume.h index 489fc7522..3997d30eb 100644 --- a/coregrind/m_ume/priv_ume.h +++ b/coregrind/m_ume/priv_ume.h @@ -45,7 +45,7 @@ extern Int VG_(load_macho) ( Int fd, const HChar *name, ExeInfo *info ); #endif extern Bool VG_(match_script) ( const void *hdr, SizeT len ); -extern Int VG_(load_script) ( Int fd, const HChar *name, ExeInfo *info ); +extern Int VG_(load_script) ( Int fd, HChar *name, ExeInfo *info ); #endif // __PRIV_UME_H diff --git a/coregrind/m_ume/script.c b/coregrind/m_ume/script.c index aadc2de07..fe83e7360 100644 --- a/coregrind/m_ume/script.c +++ b/coregrind/m_ume/script.c @@ -67,7 +67,7 @@ Bool VG_(match_script)(const void *hdr, SizeT len) /* returns: 0 = success, non-0 is failure */ -Int VG_(load_script)(Int fd, const HChar* name, ExeInfo* info) +Int VG_(load_script)(Int fd, HChar* name, ExeInfo* info) { HChar hdr[4096]; Int len = sizeof hdr; diff --git a/include/pub_tool_clientstate.h b/include/pub_tool_clientstate.h index e25a59702..5670838cd 100644 --- a/include/pub_tool_clientstate.h +++ b/include/pub_tool_clientstate.h @@ -61,7 +61,7 @@ extern Int VG_(args_for_valgrind_noexecpass); /* The name of the client executable, as specified on the command line. */ -extern const HChar* VG_(args_the_exename); +extern HChar* VG_(args_the_exename); extern const HChar* VG_(resolved_exename); From 5c44bef52a16e3755c9f9eb3b663cb7bff7ccf82 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 15 Oct 2025 08:11:50 +0200 Subject: [PATCH 383/412] Massif warnings: use -Wno-attributes for overloaded-new.cpp test The was showing up with gcc (Debian 8.3.0-6) 8.3.0 --- massif/tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/massif/tests/Makefile.am b/massif/tests/Makefile.am index b59659272..5992039c4 100644 --- a/massif/tests/Makefile.am +++ b/massif/tests/Makefile.am @@ -98,7 +98,7 @@ bug469146_CXXFLAGS = $(AM_CXXFLAGS) -O2 -fno-optimize-sibling-calls @FLAG_W_NO_U new_cpp_SOURCES = new-cpp.cpp overloaded_new_SOURCES = overloaded-new.cpp # aligned new needs C++17 -overloaded_new_CXXFLAGS = $(AM_CXXFLAGS) @FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH@ @FLAG_W_NO_MISSING_EXCEPTION_SPEC@ -std=c++17 +overloaded_new_CXXFLAGS = $(AM_CXXFLAGS) @FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH@ @FLAG_W_NO_MISSING_EXCEPTION_SPEC@ @FLAG_W_NO_ATTRIBUTES@ -std=c++17 # Suppress warnings for issues we are testing for alloc_fns_CFLAGS = $(AM_CFLAGS) -Wno-unused-result From 1684ce8a93740396e773ab94dcb546e9ad79c4b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= Date: Wed, 15 Oct 2025 06:02:03 -0400 Subject: [PATCH 384/412] vgdb.c: Handle qExecAndArgs packet New qExecAndArgs packet has been added recently to GDB's remote protocol. The new qExecAndArgs packet is sent from GDB, and gdbserver replies with a packet that includes the executable filename and the arguments string that were used for starting the initial inferior. On the GDB side this information can be used to update GDB's state, the 'show remote exec-file' will reflect how gdbserver was started, and 'show args' will reflect the arguments used for starting the inferior. When running Valgrind from inside GDB, we can see that GDB actually sends the packet to vgdb and vgdb is able to respond to it. gdb -ex 'set debug remote on' \ -ex 'set remote exec-file /bin/ls' \ -ex 'set sysroot /' \ -ex 'target extended-remote | ~/valgrind/coregrind/vgdb --multi --vargs -q' \ /bin/ls [remote] Sending packet: $qExecAndArgs#96 [remote] Packet received: U [remote] packet_ok: Packet qExecAndArgs (fetch-exec-and-args) is supported To be able to run Valgrind from inside GDB we currently have to set remote exec-file and our goal is to avoid that to make running Valgrind from GDB easier for the users. There's work on GDB side which should allow us to avoid this soon. When vgdb replies with 'U', it indicates that no executable has been set. GDB sees that the executable that it has loaded is inside the sysroot (which we set with 'set sysroot /'), then GDB knows that the remote and GDB can see the same file. GDB will then automatically use the current executable path as the remote exec-file value. --- coregrind/vgdb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c index dab425d68..cc0be240b 100644 --- a/coregrind/vgdb.c +++ b/coregrind/vgdb.c @@ -1418,6 +1418,7 @@ void do_multi_mode(int check_trials, int in_port) #define QENVIRONMENTUNSET "QEnvironmentUnset" #define QSETWORKINGDIR "QSetWorkingDir" #define QTSTATUS "qTStatus" +#define QEXECANDARGS "qExecAndArgs" if (strncmp(QSUPPORTED, buf, strlen(QSUPPORTED)) == 0) { DEBUG(1, "CASE %s\n", QSUPPORTED); @@ -1669,6 +1670,10 @@ void do_multi_mode(int check_trials, int in_port) DEBUG(1, "Got qfThreadInfo\n"); /* There are no threads yet, reply 'l' end of list. */ send_packet ("l", noackmode); + } else if (strcmp(QEXECANDARGS, buf) == 0) { + DEBUG(1, "Got qExecAndArgs\n"); + /* We don't have any. */ + send_packet ("U", noackmode); } else if (buf[0] != '\0') { // We didn't understand. DEBUG(1, "Unknown packet received: '%s'\n", buf); From 3c3262fc702e829fc13192d1ca1de1e2de8987b3 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 16 Oct 2025 14:23:01 +0000 Subject: [PATCH 385/412] Revert 644d68e9501dd5679194dd5c8e0d3ce24764a1d8 That change broke none/tests/ppc64/test_isa_3_1_VRT. Not good. Add a comment as to why a vector type is needed. --- VEX/priv/ir_defs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c index afb14fcc5..1889c9718 100644 --- a/VEX/priv/ir_defs.c +++ b/VEX/priv/ir_defs.c @@ -3724,10 +3724,13 @@ void typeOfPrimop ( IROp op, case Iop_PwExtUSMulQAdd8x16: BINARY(Ity_V128,Ity_V128, Ity_V128); - case Iop_DivU128: case Iop_DivS128: + /* Note: Semantically, operands and result of these IROps are 128-bit + integers (c.f. libvex_ir.h). The Ity_V128 type is used here to + indicate that those values require a vector register to be stored. */ + case Iop_DivU128: case Iop_DivS128: case Iop_DivU128E: case Iop_DivS128E: case Iop_ModU128: case Iop_ModS128: - BINARY(Ity_I128,Ity_I128, Ity_I128); + BINARY(Ity_V128,Ity_V128, Ity_V128); case Iop_2xMultU64Add128CarryOut: case Iop_Perm8x16x2: From 41e2f95cf129191555e0048ccbbb392ee0fb155e Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 17 Oct 2025 15:38:43 +0200 Subject: [PATCH 386/412] Support AArch64 ARMv8.3 LDAPR/LDAPRH/LDAPRB instructions Implement them just like LDAR/LDARH/LDARB. Patch by: Arne Juul https://bugs.kde.org/show_bug.cgi?id=476465 --- NEWS | 1 + VEX/priv/guest_arm64_toIR.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index f6608c70f..130665208 100644 --- a/NEWS +++ b/NEWS @@ -93,6 +93,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 369030 Wrap linux syscall: 171 (setdomainname) 388526 Inconsistent severity in message text: "WARNING: Serious error" 418756 MAP_FIXED_NOREPLACE mmap flag unsupported +476465 AArch64 ARMv8.3 LDAPR/LDAPRH/LDAPRB instructions not supported 493430 Review all syscalls that use or return (new) file descriptors 493434 Add --track-fds=bad mode (no "leak" tracking) 501741 syscall cachestat not wrapped diff --git a/VEX/priv/guest_arm64_toIR.c b/VEX/priv/guest_arm64_toIR.c index f5b445489..abee07081 100644 --- a/VEX/priv/guest_arm64_toIR.c +++ b/VEX/priv/guest_arm64_toIR.c @@ -7053,14 +7053,20 @@ Bool dis_ARM64_load_store(/*MB_OUT*/DisResult* dres, UInt insn, /* ------------------ LDA{R,RH,RB} ------------------ */ /* ------------------ STL{R,RH,RB} ------------------ */ + /* ------------------ LDAP{R,RH,RB} ----------------- */ /* 31 29 23 20 14 9 4 sz 001000 110 11111 1 11111 n t LDAR Rt, [Xn|SP] sz 001000 100 11111 1 11111 n t STLR Rt, [Xn|SP] + sz 111000 101 11111 1 10000 n t LDAPR Rt, [Xn|SP] */ - if (INSN(29,23) == BITS7(0,0,1,0,0,0,1) - && INSN(21,10) == BITS12(0,1,1,1,1,1,1,1,1,1,1,1)) { + if ((INSN(29,23) == BITS7(0,0,1,0,0,0,1) + && INSN(21,10) == BITS12(0,1,1,1,1,1,1,1,1,1,1,1)) + || + (INSN(29,21) == BITS9(1,1,1,0,0,0,1,0,1) + && INSN(20,10) == BITS11(1,1,1,1,1,1,1,0,0,0,0))) + { UInt szBlg2 = INSN(31,30); - Bool isLD = INSN(22,22) == 1; + Bool isLD = INSN(23,21) != BITS3(1,0,0); UInt nn = INSN(9,5); UInt tt = INSN(4,0); From a4593438d9fb95bae841531bd70a9217818c482b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 17 Oct 2025 18:23:58 +0200 Subject: [PATCH 387/412] Keep at least one frame while peeling syscall frames VG_(get_StackTrace_with_deltas) might peel extra glibc syscall (cancel) frames. But if the backtrace failed, or only contains such syscall frames then we should keep at least one (the initial frame will always be there). Various routines expect n_ips of a Stacktrace to be at least 1. https://bugs.kde.org/show_bug.cgi?id=507188 --- NEWS | 1 + coregrind/m_stacktrace.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 130665208..e53121813 100644 --- a/NEWS +++ b/NEWS @@ -133,6 +133,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 506970 mmap needs an EBADF fd_allowed check 507033 Remove deprecated Iop_Clz32/64 and Iop_Ctz32/64 507173 s390x: Crash when constant folding is disabled +507188 memcheck with track-fds=yes on x86 with popen: Assertion 507720 Review syscalls returning file descriptors (other platforms) 507721 Wire up illumos and Solaris mallinfo 507853 faccessat and faccessat2 should handle AT_FDCWD and absolute paths diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c index 21c0f4794..d4ee10792 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -1709,7 +1709,8 @@ UInt VG_(get_StackTrace_with_deltas)( Int i; Int start = 0; DiEpoch ep = VG_(current_DiEpoch)(); - for (i = 0; i < found; i++) { + /* We want to keep at least one frame. */ + for (i = 0; i < found - 1; i++) { /* This could be made a little more efficient by doing the lookups for the symbols at glibc load time and check the address falls inside the function symbol address range here. But given this From 34806c89abbd509b0ff731dda8fa3a3e95882438 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 17 Oct 2025 19:26:09 +0200 Subject: [PATCH 388/412] Hook up bpf syscall wrapper on x86-linux --- coregrind/m_syswrap/syswrap-x86-linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index f697a9e19..22f5a1a07 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1588,7 +1588,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_getrandom, sys_getrandom), // 355 LINXY(__NR_memfd_create, sys_memfd_create), // 356 -// LIN__(__NR_bpf, sys_ni_syscall), // 357 + LINXY(__NR_bpf, sys_bpf), // 357 LINX_(__NR_execveat, sys_execveat), // 358 LINXY(__NR_socket, sys_socket), // 359 LINXY(__NR_socketpair, sys_socketpair), // 360 From f4ba277d6edb28ff4ae447b50975799b4a862545 Mon Sep 17 00:00:00 2001 From: Maxim Zhukov Date: Mon, 23 May 2022 17:30:22 +0300 Subject: [PATCH 389/412] syswrap, i386-linux: add missing ipc syscalls Kernel 5.1 introduced separate IPC syscalls: * semget * semctl * shmget * shmctl * shmat * shmdt * msgget * msgsnd * msgrcv * msgctl instead of ipc() Note the new shm wrappers were already added as afea9317a1c9 ("Bug 501846 - Add x86 Linux shm wrappers") Signed-off-by: Maxim Zhukov https://bugs.kde.org/show_bug.cgi?id=454276 --- NEWS | 1 + coregrind/m_syswrap/syswrap-x86-linux.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/NEWS b/NEWS index e53121813..6b8f755dd 100644 --- a/NEWS +++ b/NEWS @@ -93,6 +93,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 369030 Wrap linux syscall: 171 (setdomainname) 388526 Inconsistent severity in message text: "WARNING: Serious error" 418756 MAP_FIXED_NOREPLACE mmap flag unsupported +454276 Some IPC syscalls is missing for x86 linux 476465 AArch64 ARMv8.3 LDAPR/LDAPRH/LDAPRB instructions not supported 493430 Review all syscalls that use or return (new) file descriptors 493434 Add --track-fds=bad mode (no "leak" tracking) diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 22f5a1a07..df9b33634 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1624,11 +1624,19 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_io_pgetevents, sys_io_pgetevents), // 385 GENX_(__NR_rseq, sys_ni_syscall), // 386 + LINX_(__NR_semget, sys_semget), // 393 + LINXY(__NR_semctl, sys_semctl), // 394 + LINX_(__NR_shmget, sys_shmget), // 395 LINX_(__NR_shmctl, sys_shmctl), // 396 LINX_(__NR_shmat, sys_shmat), // 397 LINX_(__NR_shmdt, sys_shmdt), // 398 + LINX_(__NR_msgget, sys_msgget), // 399 + LINX_(__NR_msgsnd, sys_msgsnd), // 400 + LINXY(__NR_msgrcv, sys_msgrcv), // 401 + LINXY(__NR_msgctl, sys_msgctl), // 402 + LINXY(__NR_clock_gettime64, sys_clock_gettime64), // 403 LINX_(__NR_clock_settime64, sys_clock_settime64), // 404 From 757dc5703d6a0e42344d3ee19a835b504f312aaf Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 12 Oct 2025 21:21:31 +0200 Subject: [PATCH 390/412] Update where to get a copy of the GNU General Public License Several files still said to write to the Free Software Foundation at a particular address. Add a reference to instead. Some files that were imported into valgrind from other places still mention the old address. They should be updated when new versions get imported. --- VEX/priv/common_nanomips_defs.h | 4 +--- VEX/priv/guest_nanomips_defs.h | 4 +--- VEX/priv/guest_nanomips_helpers.c | 4 +--- VEX/priv/guest_nanomips_toIR.c | 4 +--- VEX/priv/host_nanomips_defs.c | 4 +--- VEX/priv/host_nanomips_defs.h | 4 +--- VEX/priv/host_nanomips_isel.c | 4 +--- coregrind/m_dispatch/dispatch-nanomips-linux.S | 4 +--- dhat/dh_replace_strmem.c | 4 +--- include/vki/vki-nanomips-linux.h | 4 +--- include/vki/vki-posixtypes-nanomips-linux.h | 4 +--- include/vki/vki-scnums-nanomips-linux.h | 4 +--- none/tests/ppc64/test_isa_3_1_AT.c | 3 +-- none/tests/ppc64/test_isa_3_1_Misc.c | 3 +-- none/tests/ppc64/test_isa_3_1_R1_RT.c | 3 +-- none/tests/ppc64/test_isa_3_1_R1_XT.c | 3 +-- none/tests/ppc64/test_isa_3_1_RT.c | 3 +-- none/tests/ppc64/test_isa_3_1_VRT.c | 3 +-- none/tests/ppc64/test_isa_3_1_XT.c | 3 +-- 19 files changed, 19 insertions(+), 50 deletions(-) diff --git a/VEX/priv/common_nanomips_defs.h b/VEX/priv/common_nanomips_defs.h index 28b097dc6..beb3e5531 100644 --- a/VEX/priv/common_nanomips_defs.h +++ b/VEX/priv/common_nanomips_defs.h @@ -20,9 +20,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. + along with this program; if not, see . The GNU General Public License is contained in the file COPYING. */ diff --git a/VEX/priv/guest_nanomips_defs.h b/VEX/priv/guest_nanomips_defs.h index 2e26b9cf1..128ef0695 100644 --- a/VEX/priv/guest_nanomips_defs.h +++ b/VEX/priv/guest_nanomips_defs.h @@ -20,9 +20,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. + along with this program; if not, see . The GNU General Public License is contained in the file COPYING. */ diff --git a/VEX/priv/guest_nanomips_helpers.c b/VEX/priv/guest_nanomips_helpers.c index 00944494b..d34227861 100644 --- a/VEX/priv/guest_nanomips_helpers.c +++ b/VEX/priv/guest_nanomips_helpers.c @@ -20,9 +20,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. + along with this program; if not, see . The GNU General Public License is contained in the file COPYING. */ diff --git a/VEX/priv/guest_nanomips_toIR.c b/VEX/priv/guest_nanomips_toIR.c index fddc1afa4..1404c00c9 100644 --- a/VEX/priv/guest_nanomips_toIR.c +++ b/VEX/priv/guest_nanomips_toIR.c @@ -20,9 +20,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. + along with this program; if not, see . The GNU General Public License is contained in the file COPYING. */ diff --git a/VEX/priv/host_nanomips_defs.c b/VEX/priv/host_nanomips_defs.c index b356d09d8..94b556b35 100644 --- a/VEX/priv/host_nanomips_defs.c +++ b/VEX/priv/host_nanomips_defs.c @@ -19,9 +19,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. + along with this program; if not, see . The GNU General Public License is contained in the file COPYING. */ diff --git a/VEX/priv/host_nanomips_defs.h b/VEX/priv/host_nanomips_defs.h index 87219dab5..f9c6d75f2 100644 --- a/VEX/priv/host_nanomips_defs.h +++ b/VEX/priv/host_nanomips_defs.h @@ -20,9 +20,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. + along with this program; if not, see . The GNU General Public License is contained in the file COPYING. */ diff --git a/VEX/priv/host_nanomips_isel.c b/VEX/priv/host_nanomips_isel.c index 05e4cc512..7f8b9b584 100644 --- a/VEX/priv/host_nanomips_isel.c +++ b/VEX/priv/host_nanomips_isel.c @@ -20,9 +20,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + along with this program; if not, see . The GNU General Public License is contained in the file COPYING. */ diff --git a/coregrind/m_dispatch/dispatch-nanomips-linux.S b/coregrind/m_dispatch/dispatch-nanomips-linux.S index 30d54994f..394fd9ea7 100644 --- a/coregrind/m_dispatch/dispatch-nanomips-linux.S +++ b/coregrind/m_dispatch/dispatch-nanomips-linux.S @@ -19,9 +19,7 @@ # General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -# 02111-1307, USA. +# along with this program; if not, see . # The GNU General Public License is contained in the file COPYING. diff --git a/dhat/dh_replace_strmem.c b/dhat/dh_replace_strmem.c index a5099253a..13c3f6c5e 100644 --- a/dhat/dh_replace_strmem.c +++ b/dhat/dh_replace_strmem.c @@ -21,9 +21,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. + along with this program; if not, see . The GNU General Public License is contained in the file COPYING. */ diff --git a/include/vki/vki-nanomips-linux.h b/include/vki/vki-nanomips-linux.h index 7f4b6d902..e6d2a9730 100644 --- a/include/vki/vki-nanomips-linux.h +++ b/include/vki/vki-nanomips-linux.h @@ -20,9 +20,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. + along with this program; if not, see . The GNU General Public License is contained in the file COPYING. */ diff --git a/include/vki/vki-posixtypes-nanomips-linux.h b/include/vki/vki-posixtypes-nanomips-linux.h index b7976ec50..b3060e263 100644 --- a/include/vki/vki-posixtypes-nanomips-linux.h +++ b/include/vki/vki-posixtypes-nanomips-linux.h @@ -21,9 +21,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. + along with this program; if not, see . The GNU General Public License is contained in the file COPYING. */ diff --git a/include/vki/vki-scnums-nanomips-linux.h b/include/vki/vki-scnums-nanomips-linux.h index 2b2d9efa9..73ee39e92 100644 --- a/include/vki/vki-scnums-nanomips-linux.h +++ b/include/vki/vki-scnums-nanomips-linux.h @@ -21,9 +21,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. + along with this program; if not, see . The GNU General Public License is contained in the file COPYING. */ diff --git a/none/tests/ppc64/test_isa_3_1_AT.c b/none/tests/ppc64/test_isa_3_1_AT.c index e9db9cc9a..f31f99453 100644 --- a/none/tests/ppc64/test_isa_3_1_AT.c +++ b/none/tests/ppc64/test_isa_3_1_AT.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, see . */ #include diff --git a/none/tests/ppc64/test_isa_3_1_Misc.c b/none/tests/ppc64/test_isa_3_1_Misc.c index 78ca1534a..93be288ee 100644 --- a/none/tests/ppc64/test_isa_3_1_Misc.c +++ b/none/tests/ppc64/test_isa_3_1_Misc.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, see . */ #include diff --git a/none/tests/ppc64/test_isa_3_1_R1_RT.c b/none/tests/ppc64/test_isa_3_1_R1_RT.c index 241d6cf41..141607870 100644 --- a/none/tests/ppc64/test_isa_3_1_R1_RT.c +++ b/none/tests/ppc64/test_isa_3_1_R1_RT.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, see . */ #include diff --git a/none/tests/ppc64/test_isa_3_1_R1_XT.c b/none/tests/ppc64/test_isa_3_1_R1_XT.c index bd30bfd62..6c1080469 100644 --- a/none/tests/ppc64/test_isa_3_1_R1_XT.c +++ b/none/tests/ppc64/test_isa_3_1_R1_XT.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, see . */ #include diff --git a/none/tests/ppc64/test_isa_3_1_RT.c b/none/tests/ppc64/test_isa_3_1_RT.c index 9e2e352f8..95dcbfd63 100644 --- a/none/tests/ppc64/test_isa_3_1_RT.c +++ b/none/tests/ppc64/test_isa_3_1_RT.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, see . */ #include diff --git a/none/tests/ppc64/test_isa_3_1_VRT.c b/none/tests/ppc64/test_isa_3_1_VRT.c index 5df236005..a72f2e47e 100644 --- a/none/tests/ppc64/test_isa_3_1_VRT.c +++ b/none/tests/ppc64/test_isa_3_1_VRT.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, see . */ #include diff --git a/none/tests/ppc64/test_isa_3_1_XT.c b/none/tests/ppc64/test_isa_3_1_XT.c index 905c17951..fb96243aa 100644 --- a/none/tests/ppc64/test_isa_3_1_XT.c +++ b/none/tests/ppc64/test_isa_3_1_XT.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, see . */ #include From 3392155359822c0d4e8bb371862e92425054d02a Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 12 Oct 2025 23:57:43 +0200 Subject: [PATCH 391/412] Upgrade to GNU General Public License version 3 - Update COPYING and VEX/LICENSE.GPL to version 3. - Update README, NEWS, docs/manual license and contributing text. - Update file headers to say either version 3 of the License, or (at your option) any later version. - Leave tests and perf file headers as is, unless the code is derived from Valgrind/VEX. - Leave valgrind.h, cachegrind.h, callgrind.h, drd.h, helgrind.h, memcheck.h and dhat.h Hybrid-BSD licensed. --- COPYING | 899 ++++++++++++------ NEWS | 2 + README | 4 +- VEX/LICENSE.GPL | 899 ++++++++++++------ VEX/LICENSE.README | 4 +- VEX/auxprogs/genoffsets.c | 2 +- VEX/priv/common_nanomips_defs.h | 2 +- VEX/priv/guest_amd64_defs.h | 2 +- VEX/priv/guest_amd64_helpers.c | 2 +- VEX/priv/guest_amd64_toIR.c | 2 +- VEX/priv/guest_arm64_defs.h | 2 +- VEX/priv/guest_arm64_helpers.c | 2 +- VEX/priv/guest_arm64_toIR.c | 2 +- VEX/priv/guest_arm_defs.h | 2 +- VEX/priv/guest_arm_helpers.c | 2 +- VEX/priv/guest_arm_toIR.c | 2 +- VEX/priv/guest_generic_bb_to_IR.c | 2 +- VEX/priv/guest_generic_bb_to_IR.h | 2 +- VEX/priv/guest_generic_x87.c | 2 +- VEX/priv/guest_generic_x87.h | 2 +- VEX/priv/guest_mips_defs.h | 2 +- VEX/priv/guest_mips_helpers.c | 2 +- VEX/priv/guest_mips_toIR.c | 2 +- VEX/priv/guest_nanomips_defs.h | 2 +- VEX/priv/guest_nanomips_helpers.c | 2 +- VEX/priv/guest_nanomips_toIR.c | 2 +- VEX/priv/guest_ppc_defs.h | 2 +- VEX/priv/guest_ppc_helpers.c | 2 +- VEX/priv/guest_ppc_toIR.c | 2 +- VEX/priv/guest_riscv64_defs.h | 2 +- VEX/priv/guest_riscv64_helpers.c | 2 +- VEX/priv/guest_riscv64_toIR.c | 2 +- VEX/priv/guest_s390_defs.h | 2 +- VEX/priv/guest_s390_helpers.c | 2 +- VEX/priv/guest_s390_toIR.c | 2 +- VEX/priv/guest_x86_defs.h | 2 +- VEX/priv/guest_x86_helpers.c | 2 +- VEX/priv/guest_x86_toIR.c | 2 +- VEX/priv/host_amd64_defs.c | 2 +- VEX/priv/host_amd64_defs.h | 2 +- VEX/priv/host_amd64_isel.c | 2 +- VEX/priv/host_arm64_defs.c | 2 +- VEX/priv/host_arm64_defs.h | 2 +- VEX/priv/host_arm64_isel.c | 2 +- VEX/priv/host_arm_defs.c | 2 +- VEX/priv/host_arm_defs.h | 2 +- VEX/priv/host_arm_isel.c | 2 +- VEX/priv/host_generic_reg_alloc2.c | 2 +- VEX/priv/host_generic_reg_alloc3.c | 2 +- VEX/priv/host_generic_regs.c | 2 +- VEX/priv/host_generic_regs.h | 2 +- VEX/priv/host_generic_simd128.c | 2 +- VEX/priv/host_generic_simd128.h | 2 +- VEX/priv/host_generic_simd256.c | 2 +- VEX/priv/host_generic_simd256.h | 2 +- VEX/priv/host_generic_simd64.c | 2 +- VEX/priv/host_generic_simd64.h | 2 +- VEX/priv/host_mips_defs.c | 2 +- VEX/priv/host_mips_defs.h | 2 +- VEX/priv/host_mips_isel.c | 2 +- VEX/priv/host_nanomips_defs.c | 2 +- VEX/priv/host_nanomips_defs.h | 2 +- VEX/priv/host_nanomips_isel.c | 2 +- VEX/priv/host_ppc_defs.c | 2 +- VEX/priv/host_ppc_defs.h | 2 +- VEX/priv/host_ppc_isel.c | 2 +- VEX/priv/host_riscv64_defs.c | 2 +- VEX/priv/host_riscv64_defs.h | 2 +- VEX/priv/host_riscv64_isel.c | 2 +- VEX/priv/host_s390_defs.c | 2 +- VEX/priv/host_s390_defs.h | 2 +- VEX/priv/host_s390_isel.c | 2 +- VEX/priv/host_x86_defs.c | 2 +- VEX/priv/host_x86_defs.h | 2 +- VEX/priv/host_x86_isel.c | 2 +- VEX/priv/ir_defs.c | 2 +- VEX/priv/ir_inject.c | 2 +- VEX/priv/ir_match.c | 2 +- VEX/priv/ir_match.h | 2 +- VEX/priv/ir_opt.c | 2 +- VEX/priv/ir_opt.h | 2 +- VEX/priv/main_globals.c | 2 +- VEX/priv/main_globals.h | 2 +- VEX/priv/main_main.c | 2 +- VEX/priv/main_util.c | 2 +- VEX/priv/main_util.h | 2 +- VEX/priv/mips_defs.h | 2 +- VEX/priv/multiarch_main_main.c | 2 +- VEX/priv/s390_defs.h | 2 +- VEX/priv/s390_disasm.c | 2 +- VEX/priv/s390_disasm.h | 2 +- VEX/pub/libvex.h | 2 +- VEX/pub/libvex_basictypes.h | 2 +- VEX/pub/libvex_emnote.h | 2 +- VEX/pub/libvex_guest_amd64.h | 2 +- VEX/pub/libvex_guest_arm.h | 2 +- VEX/pub/libvex_guest_arm64.h | 2 +- VEX/pub/libvex_guest_mips32.h | 2 +- VEX/pub/libvex_guest_mips64.h | 2 +- VEX/pub/libvex_guest_ppc32.h | 2 +- VEX/pub/libvex_guest_ppc64.h | 2 +- VEX/pub/libvex_guest_riscv64.h | 2 +- VEX/pub/libvex_guest_s390x.h | 2 +- VEX/pub/libvex_guest_x86.h | 2 +- VEX/pub/libvex_inner.h | 2 +- VEX/pub/libvex_ir.h | 2 +- VEX/pub/libvex_s390x_common.h | 2 +- VEX/pub/libvex_trc_values.h | 2 +- VEX/test/test-amd64.c | 2 +- VEX/test/test-i386.c | 2 +- VEX/useful/hd_fpu.c | 2 +- VEX/useful/test_main.c | 4 +- auxprogs/getoff.c | 2 +- auxprogs/valgrind-di-server.c | 2 +- auxprogs/valgrind-listener.c | 2 +- cachegrind/cachegrind.h | 4 +- cachegrind/cg_annotate.in | 2 +- cachegrind/cg_arch.c | 2 +- cachegrind/cg_arch.h | 2 +- cachegrind/cg_branchpred.c | 2 +- cachegrind/cg_diff.in | 2 +- cachegrind/cg_main.c | 2 +- cachegrind/cg_merge.in | 2 +- cachegrind/cg_sim.c | 2 +- callgrind/bb.c | 2 +- callgrind/bbcc.c | 2 +- callgrind/callgrind.h | 4 +- callgrind/callgrind_annotate.in | 2 +- callgrind/callgrind_control.in | 2 +- callgrind/callstack.c | 2 +- callgrind/clo.c | 2 +- callgrind/context.c | 2 +- callgrind/costs.c | 2 +- callgrind/costs.h | 2 +- callgrind/debug.c | 2 +- callgrind/dump.c | 2 +- callgrind/events.c | 2 +- callgrind/events.h | 2 +- callgrind/fn.c | 2 +- callgrind/global.h | 2 +- callgrind/jumps.c | 2 +- callgrind/main.c | 2 +- callgrind/sim.c | 2 +- callgrind/threads.c | 2 +- coregrind/launcher-darwin.c | 2 +- coregrind/launcher-freebsd.c | 2 +- coregrind/launcher-linux.c | 2 +- coregrind/m_addrinfo.c | 2 +- coregrind/m_aspacehl.c | 2 +- coregrind/m_aspacemgr/aspacemgr-common.c | 2 +- coregrind/m_aspacemgr/aspacemgr-linux.c | 2 +- coregrind/m_aspacemgr/aspacemgr-segnames.c | 2 +- coregrind/m_aspacemgr/priv_aspacemgr.h | 2 +- coregrind/m_cache.c | 2 +- coregrind/m_clientstate.c | 2 +- coregrind/m_commandline.c | 2 +- coregrind/m_compiler.c | 2 +- coregrind/m_coredump/coredump-elf.c | 2 +- coregrind/m_coredump/coredump-macho.c | 2 +- coregrind/m_coredump/coredump-solaris.c | 2 +- coregrind/m_cpuid.S | 2 +- coregrind/m_debuginfo/d3basics.c | 2 +- coregrind/m_debuginfo/debuginfo.c | 2 +- coregrind/m_debuginfo/image.c | 2 +- coregrind/m_debuginfo/lzoconf.h | 2 +- coregrind/m_debuginfo/lzodefs.h | 2 +- coregrind/m_debuginfo/minilzo-inl.c | 2 +- coregrind/m_debuginfo/minilzo.h | 2 +- coregrind/m_debuginfo/misc.c | 2 +- coregrind/m_debuginfo/priv_d3basics.h | 2 +- coregrind/m_debuginfo/priv_image.h | 2 +- coregrind/m_debuginfo/priv_misc.h | 2 +- coregrind/m_debuginfo/priv_readdwarf.h | 2 +- coregrind/m_debuginfo/priv_readdwarf3.h | 2 +- coregrind/m_debuginfo/priv_readelf.h | 2 +- coregrind/m_debuginfo/priv_readexidx.h | 2 +- coregrind/m_debuginfo/priv_readmacho.h | 2 +- coregrind/m_debuginfo/priv_readpdb.h | 2 +- coregrind/m_debuginfo/priv_storage.h | 2 +- coregrind/m_debuginfo/priv_tytypes.h | 2 +- coregrind/m_debuginfo/readdwarf.c | 2 +- coregrind/m_debuginfo/readdwarf3.c | 2 +- coregrind/m_debuginfo/readelf.c | 2 +- coregrind/m_debuginfo/readexidx.c | 2 +- coregrind/m_debuginfo/readmacho.c | 2 +- coregrind/m_debuginfo/readpdb.c | 2 +- coregrind/m_debuginfo/storage.c | 2 +- coregrind/m_debuginfo/tinfl.c | 2 +- coregrind/m_debuginfo/tytypes.c | 2 +- coregrind/m_debuglog.c | 2 +- coregrind/m_deduppoolalloc.c | 2 +- coregrind/m_demangle/ansidecl.h | 2 +- coregrind/m_demangle/cp-demangle.c | 2 +- coregrind/m_demangle/cp-demangle.h | 2 +- coregrind/m_demangle/demangle.c | 2 +- coregrind/m_demangle/demangle.h | 2 +- coregrind/m_demangle/dyn-string.c | 2 +- coregrind/m_demangle/dyn-string.h | 2 +- coregrind/m_demangle/vg_libciface.h | 2 +- coregrind/m_dispatch/dispatch-amd64-darwin.S | 2 +- coregrind/m_dispatch/dispatch-amd64-freebsd.S | 2 +- coregrind/m_dispatch/dispatch-amd64-linux.S | 2 +- coregrind/m_dispatch/dispatch-amd64-solaris.S | 2 +- coregrind/m_dispatch/dispatch-arm-linux.S | 2 +- coregrind/m_dispatch/dispatch-arm64-freebsd.S | 2 +- coregrind/m_dispatch/dispatch-arm64-linux.S | 2 +- coregrind/m_dispatch/dispatch-mips32-linux.S | 2 +- coregrind/m_dispatch/dispatch-mips64-linux.S | 2 +- .../m_dispatch/dispatch-nanomips-linux.S | 2 +- coregrind/m_dispatch/dispatch-ppc32-linux.S | 2 +- coregrind/m_dispatch/dispatch-ppc64be-linux.S | 2 +- coregrind/m_dispatch/dispatch-ppc64le-linux.S | 2 +- coregrind/m_dispatch/dispatch-riscv64-linux.S | 2 +- coregrind/m_dispatch/dispatch-s390x-linux.S | 2 +- coregrind/m_dispatch/dispatch-x86-darwin.S | 2 +- coregrind/m_dispatch/dispatch-x86-freebsd.S | 2 +- coregrind/m_dispatch/dispatch-x86-linux.S | 2 +- coregrind/m_dispatch/dispatch-x86-solaris.S | 2 +- coregrind/m_errormgr.c | 2 +- coregrind/m_execontext.c | 2 +- coregrind/m_extension/extension-main.c | 2 +- coregrind/m_extension/extension-s390x.c | 2 +- coregrind/m_extension/priv_extension.h | 2 +- coregrind/m_extension/priv_types_n_macros.h | 2 +- coregrind/m_gdbserver/gdb/signals.h | 2 +- coregrind/m_gdbserver/inferiors.c | 2 +- coregrind/m_gdbserver/m_gdbserver.c | 2 +- coregrind/m_gdbserver/regcache.c | 2 +- coregrind/m_gdbserver/regcache.h | 2 +- coregrind/m_gdbserver/regdef.h | 2 +- coregrind/m_gdbserver/remote-utils-shared.c | 2 +- coregrind/m_gdbserver/remote-utils.c | 2 +- coregrind/m_gdbserver/server.c | 2 +- coregrind/m_gdbserver/server.h | 2 +- coregrind/m_gdbserver/signals.c | 2 +- coregrind/m_gdbserver/target.c | 2 +- coregrind/m_gdbserver/target.h | 2 +- coregrind/m_gdbserver/utils.c | 2 +- coregrind/m_gdbserver/valgrind-low-amd64.c | 2 +- coregrind/m_gdbserver/valgrind-low-arm.c | 2 +- coregrind/m_gdbserver/valgrind-low-arm64.c | 2 +- coregrind/m_gdbserver/valgrind-low-mips32.c | 2 +- coregrind/m_gdbserver/valgrind-low-mips64.c | 2 +- coregrind/m_gdbserver/valgrind-low-nanomips.c | 2 +- coregrind/m_gdbserver/valgrind-low-ppc32.c | 2 +- coregrind/m_gdbserver/valgrind-low-ppc64.c | 2 +- coregrind/m_gdbserver/valgrind-low-riscv64.c | 2 +- coregrind/m_gdbserver/valgrind-low-s390x.c | 2 +- coregrind/m_gdbserver/valgrind-low-x86.c | 2 +- coregrind/m_gdbserver/valgrind-monitor-def.py | 2 +- coregrind/m_gdbserver/valgrind-monitor.py | 2 +- coregrind/m_gdbserver/valgrind_low.h | 2 +- coregrind/m_hashtable.c | 2 +- coregrind/m_initimg/initimg-darwin.c | 2 +- coregrind/m_initimg/initimg-freebsd.c | 2 +- coregrind/m_initimg/initimg-linux.c | 2 +- coregrind/m_initimg/initimg-solaris.c | 2 +- coregrind/m_libcassert.c | 2 +- coregrind/m_libcbase.c | 2 +- coregrind/m_libcfile.c | 2 +- coregrind/m_libcprint.c | 2 +- coregrind/m_libcproc.c | 2 +- coregrind/m_libcsetjmp.c | 2 +- coregrind/m_libcsignal.c | 2 +- coregrind/m_libgcc_sup.c | 2 +- coregrind/m_mach/mach_basics.c | 2 +- coregrind/m_mach/mach_traps-amd64-darwin.S | 2 +- coregrind/m_mach/mach_traps-x86-darwin.S | 2 +- coregrind/m_machine.c | 2 +- coregrind/m_main.c | 2 +- coregrind/m_mallocfree.c | 2 +- coregrind/m_options.c | 2 +- coregrind/m_oset.c | 6 +- coregrind/m_pathscan.c | 2 +- coregrind/m_poolalloc.c | 2 +- coregrind/m_rangemap.c | 2 +- coregrind/m_redir.c | 2 +- .../m_replacemalloc/replacemalloc_core.c | 2 +- coregrind/m_replacemalloc/vg_replace_malloc.c | 2 +- coregrind/m_sbprofile.c | 2 +- coregrind/m_scheduler/priv_sched-lock-impl.h | 2 +- coregrind/m_scheduler/priv_sched-lock.h | 2 +- coregrind/m_scheduler/priv_sema.h | 2 +- coregrind/m_scheduler/sched-lock-generic.c | 2 +- coregrind/m_scheduler/sched-lock.c | 2 +- coregrind/m_scheduler/scheduler.c | 2 +- coregrind/m_scheduler/sema.c | 2 +- coregrind/m_scheduler/ticket-lock-linux.c | 2 +- coregrind/m_seqmatch.c | 2 +- coregrind/m_sigframe/priv_sigframe.h | 2 +- coregrind/m_sigframe/sigframe-amd64-darwin.c | 2 +- coregrind/m_sigframe/sigframe-amd64-freebsd.c | 2 +- coregrind/m_sigframe/sigframe-amd64-linux.c | 2 +- coregrind/m_sigframe/sigframe-arm-linux.c | 2 +- coregrind/m_sigframe/sigframe-arm64-freebsd.c | 2 +- coregrind/m_sigframe/sigframe-arm64-linux.c | 2 +- coregrind/m_sigframe/sigframe-common.c | 2 +- coregrind/m_sigframe/sigframe-mips32-linux.c | 2 +- coregrind/m_sigframe/sigframe-mips64-linux.c | 2 +- .../m_sigframe/sigframe-nanomips-linux.c | 2 +- coregrind/m_sigframe/sigframe-ppc32-linux.c | 2 +- coregrind/m_sigframe/sigframe-ppc64-linux.c | 2 +- coregrind/m_sigframe/sigframe-riscv64-linux.c | 2 +- coregrind/m_sigframe/sigframe-s390x-linux.c | 2 +- coregrind/m_sigframe/sigframe-solaris.c | 2 +- coregrind/m_sigframe/sigframe-x86-darwin.c | 2 +- coregrind/m_sigframe/sigframe-x86-freebsd.c | 2 +- coregrind/m_sigframe/sigframe-x86-linux.c | 2 +- coregrind/m_signals.c | 2 +- coregrind/m_sparsewa.c | 2 +- coregrind/m_stacks.c | 2 +- coregrind/m_stacktrace.c | 2 +- coregrind/m_syscall.c | 2 +- coregrind/m_syswrap/priv_syswrap-darwin.h | 2 +- coregrind/m_syswrap/priv_syswrap-freebsd.h | 2 +- coregrind/m_syswrap/priv_syswrap-generic.h | 2 +- .../m_syswrap/priv_syswrap-linux-variants.h | 2 +- coregrind/m_syswrap/priv_syswrap-linux.h | 2 +- coregrind/m_syswrap/priv_syswrap-main.h | 2 +- coregrind/m_syswrap/priv_syswrap-solaris.h | 2 +- coregrind/m_syswrap/priv_syswrap-xen.h | 2 +- coregrind/m_syswrap/priv_types_n_macros.h | 2 +- coregrind/m_syswrap/syscall-amd64-darwin.S | 2 +- coregrind/m_syswrap/syscall-amd64-freebsd.S | 2 +- coregrind/m_syswrap/syscall-amd64-linux.S | 2 +- coregrind/m_syswrap/syscall-amd64-solaris.S | 2 +- coregrind/m_syswrap/syscall-arm-linux.S | 2 +- coregrind/m_syswrap/syscall-arm64-freebsd.S | 2 +- coregrind/m_syswrap/syscall-arm64-linux.S | 2 +- coregrind/m_syswrap/syscall-mips32-linux.S | 2 +- coregrind/m_syswrap/syscall-mips64-linux.S | 2 +- coregrind/m_syswrap/syscall-nanomips-linux.S | 2 +- coregrind/m_syswrap/syscall-ppc32-linux.S | 2 +- coregrind/m_syswrap/syscall-ppc64be-linux.S | 2 +- coregrind/m_syswrap/syscall-ppc64le-linux.S | 2 +- coregrind/m_syswrap/syscall-riscv64-linux.S | 2 +- coregrind/m_syswrap/syscall-s390x-linux.S | 2 +- coregrind/m_syswrap/syscall-x86-darwin.S | 2 +- coregrind/m_syswrap/syscall-x86-freebsd.S | 2 +- coregrind/m_syswrap/syscall-x86-linux.S | 2 +- coregrind/m_syswrap/syscall-x86-solaris.S | 2 +- coregrind/m_syswrap/syswrap-amd64-darwin.c | 2 +- coregrind/m_syswrap/syswrap-amd64-freebsd.c | 2 +- coregrind/m_syswrap/syswrap-amd64-linux.c | 2 +- coregrind/m_syswrap/syswrap-amd64-solaris.c | 2 +- coregrind/m_syswrap/syswrap-arm-linux.c | 2 +- coregrind/m_syswrap/syswrap-arm64-freebsd.c | 2 +- coregrind/m_syswrap/syswrap-arm64-linux.c | 2 +- coregrind/m_syswrap/syswrap-darwin.c | 2 +- coregrind/m_syswrap/syswrap-freebsd.c | 2 +- coregrind/m_syswrap/syswrap-generic.c | 2 +- coregrind/m_syswrap/syswrap-linux-variants.c | 2 +- coregrind/m_syswrap/syswrap-linux.c | 2 +- coregrind/m_syswrap/syswrap-main.c | 2 +- coregrind/m_syswrap/syswrap-mips32-linux.c | 2 +- coregrind/m_syswrap/syswrap-mips64-linux.c | 2 +- coregrind/m_syswrap/syswrap-nanomips-linux.c | 2 +- coregrind/m_syswrap/syswrap-ppc32-linux.c | 2 +- coregrind/m_syswrap/syswrap-ppc64-linux.c | 2 +- coregrind/m_syswrap/syswrap-riscv64-linux.c | 2 +- coregrind/m_syswrap/syswrap-s390x-linux.c | 2 +- coregrind/m_syswrap/syswrap-solaris.c | 2 +- coregrind/m_syswrap/syswrap-x86-darwin.c | 2 +- coregrind/m_syswrap/syswrap-x86-freebsd.c | 2 +- coregrind/m_syswrap/syswrap-x86-linux.c | 2 +- coregrind/m_syswrap/syswrap-x86-solaris.c | 2 +- coregrind/m_syswrap/syswrap-xen.c | 2 +- coregrind/m_threadstate.c | 2 +- coregrind/m_tooliface.c | 2 +- coregrind/m_trampoline.S | 2 +- coregrind/m_translate.c | 2 +- coregrind/m_transtab.c | 2 +- coregrind/m_ume/elf.c | 2 +- coregrind/m_ume/macho.c | 2 +- coregrind/m_ume/main.c | 2 +- coregrind/m_ume/priv_ume.h | 2 +- coregrind/m_ume/script.c | 2 +- coregrind/m_vki.c | 2 +- coregrind/m_vkiscnums.c | 2 +- coregrind/m_wordfm.c | 2 +- coregrind/m_xarray.c | 2 +- coregrind/m_xtmemory.c | 2 +- coregrind/m_xtree.c | 2 +- coregrind/pub_core_addrinfo.h | 2 +- coregrind/pub_core_aspacehl.h | 2 +- coregrind/pub_core_aspacemgr.h | 2 +- coregrind/pub_core_basics.h | 2 +- coregrind/pub_core_basics_asm.h | 2 +- coregrind/pub_core_clientstate.h | 2 +- coregrind/pub_core_clreq.h | 2 +- coregrind/pub_core_commandline.h | 2 +- coregrind/pub_core_coredump.h | 2 +- coregrind/pub_core_cpuid.h | 2 +- coregrind/pub_core_debuginfo.h | 2 +- coregrind/pub_core_debuglog.h | 2 +- coregrind/pub_core_deduppoolalloc.h | 2 +- coregrind/pub_core_demangle.h | 2 +- coregrind/pub_core_dispatch.h | 2 +- coregrind/pub_core_dispatch_asm.h | 2 +- coregrind/pub_core_errormgr.h | 2 +- coregrind/pub_core_execontext.h | 2 +- coregrind/pub_core_extension.h | 2 +- coregrind/pub_core_gdbserver.h | 2 +- coregrind/pub_core_guest.h | 2 +- coregrind/pub_core_hashtable.h | 2 +- coregrind/pub_core_initimg.h | 2 +- coregrind/pub_core_inner.h | 2 +- coregrind/pub_core_libcassert.h | 2 +- coregrind/pub_core_libcbase.h | 2 +- coregrind/pub_core_libcfile.h | 2 +- coregrind/pub_core_libcprint.h | 2 +- coregrind/pub_core_libcproc.h | 2 +- coregrind/pub_core_libcsetjmp.h | 2 +- coregrind/pub_core_libcsignal.h | 2 +- coregrind/pub_core_mach.h | 2 +- coregrind/pub_core_machine.h | 2 +- coregrind/pub_core_mallocfree.h | 2 +- coregrind/pub_core_options.h | 2 +- coregrind/pub_core_oset.h | 2 +- coregrind/pub_core_pathscan.h | 2 +- coregrind/pub_core_poolalloc.h | 2 +- coregrind/pub_core_rangemap.h | 2 +- coregrind/pub_core_redir.h | 2 +- coregrind/pub_core_replacemalloc.h | 2 +- coregrind/pub_core_sbprofile.h | 2 +- coregrind/pub_core_scheduler.h | 2 +- coregrind/pub_core_seqmatch.h | 2 +- coregrind/pub_core_sigframe.h | 2 +- coregrind/pub_core_signals.h | 2 +- coregrind/pub_core_sparsewa.h | 2 +- coregrind/pub_core_stacks.h | 2 +- coregrind/pub_core_stacktrace.h | 2 +- coregrind/pub_core_syscall.h | 2 +- coregrind/pub_core_syswrap.h | 2 +- coregrind/pub_core_threadstate.h | 2 +- coregrind/pub_core_tooliface.h | 2 +- coregrind/pub_core_trampoline.h | 2 +- coregrind/pub_core_translate.h | 2 +- coregrind/pub_core_transtab.h | 2 +- coregrind/pub_core_transtab_asm.h | 2 +- coregrind/pub_core_ume.h | 2 +- coregrind/pub_core_vki.h | 2 +- coregrind/pub_core_vkiscnums.h | 2 +- coregrind/pub_core_vkiscnums_asm.h | 2 +- coregrind/pub_core_wordfm.h | 2 +- coregrind/pub_core_xarray.h | 2 +- coregrind/pub_core_xtmemory.h | 2 +- coregrind/pub_core_xtree.h | 2 +- coregrind/vg_preloaded.c | 2 +- coregrind/vgdb-invoker-freebsd.c | 2 +- coregrind/vgdb-invoker-none.c | 2 +- coregrind/vgdb-invoker-ptrace.c | 2 +- coregrind/vgdb-invoker-solaris.c | 2 +- coregrind/vgdb.c | 2 +- coregrind/vgdb.h | 2 +- dhat/dh_main.c | 2 +- dhat/dh_replace_strmem.c | 2 +- dhat/dh_test.js | 2 +- dhat/dh_view.css | 2 +- dhat/dh_view.js | 2 +- dhat/dhat.h | 4 +- docs/xml/manual-intro.xml | 6 +- drd/drd.h | 4 +- drd/drd_barrier.c | 2 +- drd/drd_barrier.h | 2 +- drd/drd_basics.h | 2 +- drd/drd_bitmap.c | 2 +- drd/drd_bitmap.h | 2 +- drd/drd_clientobj.c | 2 +- drd/drd_clientobj.h | 2 +- drd/drd_clientreq.c | 2 +- drd/drd_clientreq.h | 2 +- drd/drd_cond.c | 2 +- drd/drd_cond.h | 2 +- drd/drd_darwin_intercepts.c | 2 +- drd/drd_error.c | 2 +- drd/drd_error.h | 2 +- drd/drd_hb.c | 2 +- drd/drd_hb.h | 2 +- drd/drd_libstdcxx_intercepts.c | 2 +- drd/drd_load_store.c | 2 +- drd/drd_load_store.h | 2 +- drd/drd_main.c | 2 +- drd/drd_malloc_wrappers.c | 2 +- drd/drd_malloc_wrappers.h | 2 +- drd/drd_mutex.c | 2 +- drd/drd_mutex.h | 2 +- drd/drd_pthread_intercepts.c | 2 +- drd/drd_qtcore_intercepts.c | 2 +- drd/drd_rwlock.c | 2 +- drd/drd_rwlock.h | 2 +- drd/drd_segment.c | 2 +- drd/drd_segment.h | 2 +- drd/drd_semaphore.c | 2 +- drd/drd_semaphore.h | 2 +- drd/drd_strmem_intercepts.c | 2 +- drd/drd_suppression.c | 2 +- drd/drd_thread.c | 2 +- drd/drd_thread.h | 2 +- drd/drd_thread_bitmap.h | 2 +- drd/drd_vc.c | 2 +- drd/drd_vc.h | 2 +- drd/pub_drd_bitmap.h | 2 +- drd/tests/monitor_example.cpp | 4 +- drd/tests/tsan_thread_wrappers_pthread.h | 2 +- drd/tests/tsan_unittest.cpp | 2 +- exp-bbv/bbv_main.c | 2 +- helgrind/helgrind.h | 4 +- helgrind/hg_addrdescr.c | 2 +- helgrind/hg_addrdescr.h | 2 +- helgrind/hg_basics.c | 2 +- helgrind/hg_basics.h | 2 +- helgrind/hg_errors.c | 2 +- helgrind/hg_errors.h | 2 +- helgrind/hg_intercepts.c | 2 +- helgrind/hg_lock_n_thread.c | 2 +- helgrind/hg_lock_n_thread.h | 2 +- helgrind/hg_main.c | 2 +- helgrind/hg_wordset.c | 2 +- helgrind/hg_wordset.h | 2 +- helgrind/libhb.h | 2 +- helgrind/libhb_core.c | 2 +- include/pub_tool_addrinfo.h | 2 +- include/pub_tool_aspacehl.h | 2 +- include/pub_tool_aspacemgr.h | 2 +- include/pub_tool_basics.h | 2 +- include/pub_tool_basics_asm.h | 2 +- include/pub_tool_clientstate.h | 2 +- include/pub_tool_clreq.h | 2 +- include/pub_tool_debuginfo.h | 2 +- include/pub_tool_deduppoolalloc.h | 2 +- include/pub_tool_errormgr.h | 2 +- include/pub_tool_execontext.h | 2 +- include/pub_tool_gdbserver.h | 2 +- include/pub_tool_guest.h | 2 +- include/pub_tool_hashtable.h | 2 +- include/pub_tool_libcassert.h | 2 +- include/pub_tool_libcbase.h | 2 +- include/pub_tool_libcfile.h | 2 +- include/pub_tool_libcprint.h | 2 +- include/pub_tool_libcproc.h | 2 +- include/pub_tool_libcsetjmp.h | 2 +- include/pub_tool_libcsignal.h | 2 +- include/pub_tool_machine.h | 2 +- include/pub_tool_mallocfree.h | 2 +- include/pub_tool_options.h | 2 +- include/pub_tool_oset.h | 2 +- include/pub_tool_poolalloc.h | 2 +- include/pub_tool_rangemap.h | 2 +- include/pub_tool_redir.h | 2 +- include/pub_tool_replacemalloc.h | 2 +- include/pub_tool_seqmatch.h | 2 +- include/pub_tool_signals.h | 2 +- include/pub_tool_sparsewa.h | 2 +- include/pub_tool_stacktrace.h | 2 +- include/pub_tool_threadstate.h | 2 +- include/pub_tool_tooliface.h | 2 +- include/pub_tool_transtab.h | 2 +- include/pub_tool_vki.h | 2 +- include/pub_tool_vkiscnums.h | 2 +- include/pub_tool_vkiscnums_asm.h | 2 +- include/pub_tool_wordfm.h | 2 +- include/pub_tool_xarray.h | 2 +- include/pub_tool_xtmemory.h | 2 +- include/pub_tool_xtree.h | 2 +- include/valgrind.h.in | 4 +- include/vki/vki-amd64-freebsd.h | 2 +- include/vki/vki-amd64-linux.h | 2 +- include/vki/vki-arm-linux.h | 2 +- include/vki/vki-arm64-freebsd.h | 2 +- include/vki/vki-arm64-linux.h | 2 +- include/vki/vki-darwin.h | 2 +- include/vki/vki-freebsd.h | 2 +- include/vki/vki-linux-io_uring.h | 2 +- include/vki/vki-linux-landlock.h | 2 +- include/vki/vki-linux.h | 2 +- include/vki/vki-machine-types-amd64-freebsd.h | 2 +- include/vki/vki-machine-types-arm64-freebsd.h | 2 +- include/vki/vki-machine-types-x86-freebsd.h | 2 +- include/vki/vki-mips32-linux.h | 2 +- include/vki/vki-mips64-linux.h | 2 +- include/vki/vki-nanomips-linux.h | 2 +- include/vki/vki-posixtypes-amd64-linux.h | 2 +- include/vki/vki-posixtypes-arm-linux.h | 2 +- include/vki/vki-posixtypes-arm64-linux.h | 2 +- include/vki/vki-posixtypes-mips32-linux.h | 2 +- include/vki/vki-posixtypes-mips64-linux.h | 2 +- include/vki/vki-posixtypes-nanomips-linux.h | 2 +- include/vki/vki-posixtypes-ppc32-linux.h | 2 +- include/vki/vki-posixtypes-ppc64-linux.h | 2 +- include/vki/vki-posixtypes-riscv64-linux.h | 2 +- include/vki/vki-posixtypes-s390x-linux.h | 2 +- include/vki/vki-posixtypes-x86-linux.h | 2 +- include/vki/vki-ppc32-linux.h | 2 +- include/vki/vki-ppc64-linux.h | 2 +- include/vki/vki-riscv64-linux.h | 2 +- include/vki/vki-s390x-linux.h | 2 +- include/vki/vki-scnums-32bit-linux.h | 2 +- include/vki/vki-scnums-amd64-linux.h | 2 +- include/vki/vki-scnums-arm-linux.h | 2 +- include/vki/vki-scnums-arm64-linux.h | 2 +- include/vki/vki-scnums-darwin.h | 2 +- include/vki/vki-scnums-freebsd.h | 2 +- include/vki/vki-scnums-mips32-linux.h | 2 +- include/vki/vki-scnums-mips64-linux.h | 2 +- include/vki/vki-scnums-nanomips-linux.h | 2 +- include/vki/vki-scnums-ppc32-linux.h | 2 +- include/vki/vki-scnums-ppc64-linux.h | 2 +- include/vki/vki-scnums-riscv64-linux.h | 2 +- include/vki/vki-scnums-s390x-linux.h | 2 +- include/vki/vki-scnums-shared-linux.h | 2 +- include/vki/vki-scnums-solaris.h | 2 +- include/vki/vki-scnums-x86-linux.h | 2 +- include/vki/vki-solaris-repcache.h | 2 +- include/vki/vki-solaris.h | 2 +- include/vki/vki-x86-freebsd.h | 2 +- include/vki/vki-x86-linux.h | 2 +- include/vki/vki-xen-domctl.h | 2 +- include/vki/vki-xen-evtchn.h | 2 +- include/vki/vki-xen-gnttab.h | 2 +- include/vki/vki-xen-hvm.h | 2 +- include/vki/vki-xen-memory.h | 2 +- include/vki/vki-xen-mmuext.h | 2 +- include/vki/vki-xen-physdev.h | 2 +- include/vki/vki-xen-schedop.h | 2 +- include/vki/vki-xen-tmem.h | 2 +- include/vki/vki-xen-version.h | 2 +- include/vki/vki-xen-x86.h | 2 +- include/vki/vki-xen-xsm.h | 2 +- include/vki/vki-xen.h | 2 +- lackey/lk_main.c | 2 +- massif/ms_main.c | 2 +- massif/ms_print.in | 4 +- memcheck/mc_errors.c | 2 +- memcheck/mc_include.h | 2 +- memcheck/mc_leakcheck.c | 2 +- memcheck/mc_machine.c | 2 +- memcheck/mc_main.c | 2 +- memcheck/mc_main_asm.c | 2 +- memcheck/mc_malloc_wrappers.c | 2 +- memcheck/mc_replace_strmem.c | 2 +- memcheck/mc_translate.c | 2 +- memcheck/memcheck.h | 4 +- memcheck/tests/vbit-test/binary.c | 2 +- memcheck/tests/vbit-test/irops.c | 2 +- memcheck/tests/vbit-test/main.c | 2 +- memcheck/tests/vbit-test/qernary.c | 2 +- memcheck/tests/vbit-test/ternary.c | 2 +- memcheck/tests/vbit-test/unary.c | 2 +- memcheck/tests/vbit-test/util.c | 2 +- memcheck/tests/vbit-test/valgrind.c | 2 +- memcheck/tests/vbit-test/vbits.c | 2 +- memcheck/tests/vbit-test/vbits.h | 2 +- memcheck/tests/vbit-test/vtest.h | 2 +- mpi/libmpiwrap.c | 2 +- none/nl_main.c | 2 +- none/tests/iropt-test/binary.c | 2 +- none/tests/iropt-test/irops.tab | 2 +- none/tests/iropt-test/main.c | 2 +- none/tests/iropt-test/unary.c | 2 +- none/tests/iropt-test/util.c | 2 +- none/tests/iropt-test/valgrind.c | 2 +- none/tests/iropt-test/vtest.h | 2 +- none/tests/s390x/disasm-test/generate.c | 2 +- none/tests/s390x/disasm-test/main.c | 2 +- none/tests/s390x/disasm-test/main.h | 2 +- none/tests/s390x/disasm-test/objdump.c | 2 +- none/tests/s390x/disasm-test/objdump.h | 2 +- none/tests/s390x/disasm-test/opcode.c | 2 +- none/tests/s390x/disasm-test/verify.c | 2 +- none/tests/s390x/disasm-test/vex.c | 2 +- none/tests/s390x/disasm-test/vex.h | 2 +- perf/vg_perf.in | 2 +- shared/vg_replace_strmem.c | 2 +- tests/vg_regtest.in | 2 +- 675 files changed, 1925 insertions(+), 1251 deletions(-) diff --git a/COPYING b/COPYING index d159169d1..f288702d2 100644 --- a/COPYING +++ b/COPYING @@ -1,281 +1,622 @@ GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + Version 3, 29 June 2007 - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. END OF TERMS AND CONDITIONS @@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least +state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -303,37 +644,31 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/NEWS b/NEWS index 6b8f755dd..6c39b58dc 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux. * ==================== CORE CHANGES =================== +* Upgrade to the GNU General Public License version 3. + * New VEX API function LibVEX_set_VexControl * The deprecated IROps: Iop_Clz32/64 and Iop_Ctz32/64 have been removed diff --git a/README b/README index eabcc6ad8..62fc01deb 100644 --- a/README +++ b/README @@ -51,11 +51,11 @@ Note that AMD64 is just another name for x86_64, and Valgrind runs fine on Intel processors. Also note that the core of macOS is called "Darwin" and this name is used sometimes. -Valgrind is licensed under the GNU General Public License, version 2. +Valgrind is licensed under the GNU General Public License, version 3. Read the file COPYING in the source distribution for details. However: if you contribute code, you need to make it available as GPL -version 2 or later, and not 2-only. +version 3 or later, and not 3-only. Documentation diff --git a/VEX/LICENSE.GPL b/VEX/LICENSE.GPL index d159169d1..f288702d2 100644 --- a/VEX/LICENSE.GPL +++ b/VEX/LICENSE.GPL @@ -1,281 +1,622 @@ GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + Version 3, 29 June 2007 - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. END OF TERMS AND CONDITIONS @@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least +state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -303,37 +644,31 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/VEX/LICENSE.README b/VEX/LICENSE.README index 8ae1ccd4e..b4b14f5b0 100644 --- a/VEX/LICENSE.README +++ b/VEX/LICENSE.README @@ -4,7 +4,7 @@ binary instrumentation and translation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but @@ -18,4 +18,4 @@ binary instrumentation and translation. The GNU General Public License is contained in the file LICENSE.GPL. If you want to contribute code to LibVEX, please ensure it is licensed -as "GPL v2 or later". +as "GPL v3 or later". diff --git a/VEX/auxprogs/genoffsets.c b/VEX/auxprogs/genoffsets.c index 48c9723dc..07ff09be7 100644 --- a/VEX/auxprogs/genoffsets.c +++ b/VEX/auxprogs/genoffsets.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/common_nanomips_defs.h b/VEX/priv/common_nanomips_defs.h index beb3e5531..40e750e07 100644 --- a/VEX/priv/common_nanomips_defs.h +++ b/VEX/priv/common_nanomips_defs.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_amd64_defs.h b/VEX/priv/guest_amd64_defs.h index f7a4e06c0..35c74dcb8 100644 --- a/VEX/priv/guest_amd64_defs.h +++ b/VEX/priv/guest_amd64_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c index 8313d58b4..ca33f7c81 100644 --- a/VEX/priv/guest_amd64_helpers.c +++ b/VEX/priv/guest_amd64_helpers.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c index c98b55c06..34ebcbdf9 100644 --- a/VEX/priv/guest_amd64_toIR.c +++ b/VEX/priv/guest_amd64_toIR.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_arm64_defs.h b/VEX/priv/guest_arm64_defs.h index a83a4d9a7..18b08b7ee 100644 --- a/VEX/priv/guest_arm64_defs.h +++ b/VEX/priv/guest_arm64_defs.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_arm64_helpers.c b/VEX/priv/guest_arm64_helpers.c index d75798b2b..d6a03fe36 100644 --- a/VEX/priv/guest_arm64_helpers.c +++ b/VEX/priv/guest_arm64_helpers.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_arm64_toIR.c b/VEX/priv/guest_arm64_toIR.c index abee07081..6e77b34c7 100644 --- a/VEX/priv/guest_arm64_toIR.c +++ b/VEX/priv/guest_arm64_toIR.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_arm_defs.h b/VEX/priv/guest_arm_defs.h index 85521e770..791e48cb1 100644 --- a/VEX/priv/guest_arm_defs.h +++ b/VEX/priv/guest_arm_defs.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_arm_helpers.c b/VEX/priv/guest_arm_helpers.c index d0de845d9..f57340571 100644 --- a/VEX/priv/guest_arm_helpers.c +++ b/VEX/priv/guest_arm_helpers.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_arm_toIR.c b/VEX/priv/guest_arm_toIR.c index 673e87628..a4b91e06f 100644 --- a/VEX/priv/guest_arm_toIR.c +++ b/VEX/priv/guest_arm_toIR.c @@ -17,7 +17,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_generic_bb_to_IR.c b/VEX/priv/guest_generic_bb_to_IR.c index 1b9821a7c..9eff7d6ae 100644 --- a/VEX/priv/guest_generic_bb_to_IR.c +++ b/VEX/priv/guest_generic_bb_to_IR.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_generic_bb_to_IR.h b/VEX/priv/guest_generic_bb_to_IR.h index cad6768a0..59684e357 100644 --- a/VEX/priv/guest_generic_bb_to_IR.h +++ b/VEX/priv/guest_generic_bb_to_IR.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_generic_x87.c b/VEX/priv/guest_generic_x87.c index 85ebebdc7..98d0ac8e3 100644 --- a/VEX/priv/guest_generic_x87.c +++ b/VEX/priv/guest_generic_x87.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_generic_x87.h b/VEX/priv/guest_generic_x87.h index e8467547c..3bfe466ae 100644 --- a/VEX/priv/guest_generic_x87.h +++ b/VEX/priv/guest_generic_x87.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_mips_defs.h b/VEX/priv/guest_mips_defs.h index 27e89d112..98d13d9aa 100644 --- a/VEX/priv/guest_mips_defs.h +++ b/VEX/priv/guest_mips_defs.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_mips_helpers.c b/VEX/priv/guest_mips_helpers.c index 79197378c..f7e6f39d2 100644 --- a/VEX/priv/guest_mips_helpers.c +++ b/VEX/priv/guest_mips_helpers.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_mips_toIR.c b/VEX/priv/guest_mips_toIR.c index e42fc2782..69b6714c2 100644 --- a/VEX/priv/guest_mips_toIR.c +++ b/VEX/priv/guest_mips_toIR.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_nanomips_defs.h b/VEX/priv/guest_nanomips_defs.h index 128ef0695..18e1eee29 100644 --- a/VEX/priv/guest_nanomips_defs.h +++ b/VEX/priv/guest_nanomips_defs.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_nanomips_helpers.c b/VEX/priv/guest_nanomips_helpers.c index d34227861..81afd2548 100644 --- a/VEX/priv/guest_nanomips_helpers.c +++ b/VEX/priv/guest_nanomips_helpers.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_nanomips_toIR.c b/VEX/priv/guest_nanomips_toIR.c index 1404c00c9..849dcbeb1 100644 --- a/VEX/priv/guest_nanomips_toIR.c +++ b/VEX/priv/guest_nanomips_toIR.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_ppc_defs.h b/VEX/priv/guest_ppc_defs.h index 220fbf139..f5571c49b 100644 --- a/VEX/priv/guest_ppc_defs.h +++ b/VEX/priv/guest_ppc_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_ppc_helpers.c b/VEX/priv/guest_ppc_helpers.c index 2611e5210..106f57e73 100644 --- a/VEX/priv/guest_ppc_helpers.c +++ b/VEX/priv/guest_ppc_helpers.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c index eafc557cc..231e914e5 100644 --- a/VEX/priv/guest_ppc_toIR.c +++ b/VEX/priv/guest_ppc_toIR.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_riscv64_defs.h b/VEX/priv/guest_riscv64_defs.h index ee5435e14..bdbf34c56 100644 --- a/VEX/priv/guest_riscv64_defs.h +++ b/VEX/priv/guest_riscv64_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_riscv64_helpers.c b/VEX/priv/guest_riscv64_helpers.c index e7c4ed805..36fad1935 100644 --- a/VEX/priv/guest_riscv64_helpers.c +++ b/VEX/priv/guest_riscv64_helpers.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_riscv64_toIR.c b/VEX/priv/guest_riscv64_toIR.c index c90444ef1..5a0cbfc9f 100644 --- a/VEX/priv/guest_riscv64_toIR.c +++ b/VEX/priv/guest_riscv64_toIR.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_s390_defs.h b/VEX/priv/guest_s390_defs.h index 29efa0131..a780e8388 100644 --- a/VEX/priv/guest_s390_defs.h +++ b/VEX/priv/guest_s390_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index 4fd9daf41..3d6fec5c1 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index aad1a0dbb..d98802829 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_x86_defs.h b/VEX/priv/guest_x86_defs.h index 3f86339bc..5394e8cea 100644 --- a/VEX/priv/guest_x86_defs.h +++ b/VEX/priv/guest_x86_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_x86_helpers.c b/VEX/priv/guest_x86_helpers.c index 135e997c4..90722d767 100644 --- a/VEX/priv/guest_x86_helpers.c +++ b/VEX/priv/guest_x86_helpers.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/guest_x86_toIR.c b/VEX/priv/guest_x86_toIR.c index 11617914d..8ecfad155 100644 --- a/VEX/priv/guest_x86_toIR.c +++ b/VEX/priv/guest_x86_toIR.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_amd64_defs.c b/VEX/priv/host_amd64_defs.c index 253ed6515..d7d1ab1aa 100644 --- a/VEX/priv/host_amd64_defs.c +++ b/VEX/priv/host_amd64_defs.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_amd64_defs.h b/VEX/priv/host_amd64_defs.h index eae878e31..4c16db17b 100644 --- a/VEX/priv/host_amd64_defs.h +++ b/VEX/priv/host_amd64_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_amd64_isel.c b/VEX/priv/host_amd64_isel.c index 113dc1bf3..6de40bccf 100644 --- a/VEX/priv/host_amd64_isel.c +++ b/VEX/priv/host_amd64_isel.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_arm64_defs.c b/VEX/priv/host_arm64_defs.c index dc5d198e0..da52748eb 100644 --- a/VEX/priv/host_arm64_defs.c +++ b/VEX/priv/host_arm64_defs.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_arm64_defs.h b/VEX/priv/host_arm64_defs.h index f24a2f4ba..4f5b1bce3 100644 --- a/VEX/priv/host_arm64_defs.h +++ b/VEX/priv/host_arm64_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_arm64_isel.c b/VEX/priv/host_arm64_isel.c index 190d8c8f1..55d688531 100644 --- a/VEX/priv/host_arm64_isel.c +++ b/VEX/priv/host_arm64_isel.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_arm_defs.c b/VEX/priv/host_arm_defs.c index e30336583..39d89f7e8 100644 --- a/VEX/priv/host_arm_defs.c +++ b/VEX/priv/host_arm_defs.c @@ -17,7 +17,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_arm_defs.h b/VEX/priv/host_arm_defs.h index 0f4b51951..904bd0c43 100644 --- a/VEX/priv/host_arm_defs.h +++ b/VEX/priv/host_arm_defs.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_arm_isel.c b/VEX/priv/host_arm_isel.c index 4b76a6170..90bc699fc 100644 --- a/VEX/priv/host_arm_isel.c +++ b/VEX/priv/host_arm_isel.c @@ -17,7 +17,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_generic_reg_alloc2.c b/VEX/priv/host_generic_reg_alloc2.c index b731720f2..ee1a68d4f 100644 --- a/VEX/priv/host_generic_reg_alloc2.c +++ b/VEX/priv/host_generic_reg_alloc2.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_generic_reg_alloc3.c b/VEX/priv/host_generic_reg_alloc3.c index b7446921a..0dc39fea3 100644 --- a/VEX/priv/host_generic_reg_alloc3.c +++ b/VEX/priv/host_generic_reg_alloc3.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_generic_regs.c b/VEX/priv/host_generic_regs.c index 803950a5d..b22d2a5af 100644 --- a/VEX/priv/host_generic_regs.c +++ b/VEX/priv/host_generic_regs.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_generic_regs.h b/VEX/priv/host_generic_regs.h index 2b369f2eb..c5e9a93b3 100644 --- a/VEX/priv/host_generic_regs.h +++ b/VEX/priv/host_generic_regs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_generic_simd128.c b/VEX/priv/host_generic_simd128.c index f895de46f..b656aef50 100644 --- a/VEX/priv/host_generic_simd128.c +++ b/VEX/priv/host_generic_simd128.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_generic_simd128.h b/VEX/priv/host_generic_simd128.h index 842385f73..9e73e45a9 100644 --- a/VEX/priv/host_generic_simd128.h +++ b/VEX/priv/host_generic_simd128.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_generic_simd256.c b/VEX/priv/host_generic_simd256.c index f6b457747..9a00e37ba 100644 --- a/VEX/priv/host_generic_simd256.c +++ b/VEX/priv/host_generic_simd256.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_generic_simd256.h b/VEX/priv/host_generic_simd256.h index 36e599301..4a4d2d658 100644 --- a/VEX/priv/host_generic_simd256.h +++ b/VEX/priv/host_generic_simd256.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_generic_simd64.c b/VEX/priv/host_generic_simd64.c index 523a5cd1c..673e687c2 100644 --- a/VEX/priv/host_generic_simd64.c +++ b/VEX/priv/host_generic_simd64.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_generic_simd64.h b/VEX/priv/host_generic_simd64.h index 0df3fccff..db16b3ced 100644 --- a/VEX/priv/host_generic_simd64.h +++ b/VEX/priv/host_generic_simd64.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_mips_defs.c b/VEX/priv/host_mips_defs.c index 7641ccf62..ad92c055c 100644 --- a/VEX/priv/host_mips_defs.c +++ b/VEX/priv/host_mips_defs.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_mips_defs.h b/VEX/priv/host_mips_defs.h index 96ab2f9a4..423f68ea0 100644 --- a/VEX/priv/host_mips_defs.h +++ b/VEX/priv/host_mips_defs.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_mips_isel.c b/VEX/priv/host_mips_isel.c index 2bdfa4a64..7d57078ba 100644 --- a/VEX/priv/host_mips_isel.c +++ b/VEX/priv/host_mips_isel.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_nanomips_defs.c b/VEX/priv/host_nanomips_defs.c index 94b556b35..3e91c904f 100644 --- a/VEX/priv/host_nanomips_defs.c +++ b/VEX/priv/host_nanomips_defs.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_nanomips_defs.h b/VEX/priv/host_nanomips_defs.h index f9c6d75f2..beb808479 100644 --- a/VEX/priv/host_nanomips_defs.h +++ b/VEX/priv/host_nanomips_defs.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_nanomips_isel.c b/VEX/priv/host_nanomips_isel.c index 7f8b9b584..65998fd8a 100644 --- a/VEX/priv/host_nanomips_isel.c +++ b/VEX/priv/host_nanomips_isel.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_ppc_defs.c b/VEX/priv/host_ppc_defs.c index d4d948a3b..dfefcb3fd 100644 --- a/VEX/priv/host_ppc_defs.c +++ b/VEX/priv/host_ppc_defs.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_ppc_defs.h b/VEX/priv/host_ppc_defs.h index 39dca08a2..c57afd50b 100644 --- a/VEX/priv/host_ppc_defs.h +++ b/VEX/priv/host_ppc_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_ppc_isel.c b/VEX/priv/host_ppc_isel.c index 2fad3c59e..ea7ff89a9 100644 --- a/VEX/priv/host_ppc_isel.c +++ b/VEX/priv/host_ppc_isel.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_riscv64_defs.c b/VEX/priv/host_riscv64_defs.c index 149483cd3..152d4ae92 100644 --- a/VEX/priv/host_riscv64_defs.c +++ b/VEX/priv/host_riscv64_defs.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_riscv64_defs.h b/VEX/priv/host_riscv64_defs.h index 16c524cab..7a97f90ef 100644 --- a/VEX/priv/host_riscv64_defs.h +++ b/VEX/priv/host_riscv64_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_riscv64_isel.c b/VEX/priv/host_riscv64_isel.c index fd63cfc77..b174d260d 100644 --- a/VEX/priv/host_riscv64_isel.c +++ b/VEX/priv/host_riscv64_isel.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index a3b91071d..9389364da 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_s390_defs.h b/VEX/priv/host_s390_defs.h index 87726c3e5..3de079e83 100644 --- a/VEX/priv/host_s390_defs.h +++ b/VEX/priv/host_s390_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c index cf0a0a7ee..8f87cc239 100644 --- a/VEX/priv/host_s390_isel.c +++ b/VEX/priv/host_s390_isel.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_x86_defs.c b/VEX/priv/host_x86_defs.c index 5497efdf7..200c122fd 100644 --- a/VEX/priv/host_x86_defs.c +++ b/VEX/priv/host_x86_defs.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_x86_defs.h b/VEX/priv/host_x86_defs.h index 2455b3245..ecd74e6a5 100644 --- a/VEX/priv/host_x86_defs.h +++ b/VEX/priv/host_x86_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/host_x86_isel.c b/VEX/priv/host_x86_isel.c index b80d1116a..6559ad51d 100644 --- a/VEX/priv/host_x86_isel.c +++ b/VEX/priv/host_x86_isel.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c index 1889c9718..b178912aa 100644 --- a/VEX/priv/ir_defs.c +++ b/VEX/priv/ir_defs.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/ir_inject.c b/VEX/priv/ir_inject.c index b447f6e94..105bb4f1f 100644 --- a/VEX/priv/ir_inject.c +++ b/VEX/priv/ir_inject.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/ir_match.c b/VEX/priv/ir_match.c index 3f4fe8cc5..afd285833 100644 --- a/VEX/priv/ir_match.c +++ b/VEX/priv/ir_match.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/ir_match.h b/VEX/priv/ir_match.h index 9c34dfe32..7c713853f 100644 --- a/VEX/priv/ir_match.h +++ b/VEX/priv/ir_match.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index 1b21c8e3e..3acc9b419 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/ir_opt.h b/VEX/priv/ir_opt.h index e5127be6c..7626866b1 100644 --- a/VEX/priv/ir_opt.h +++ b/VEX/priv/ir_opt.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/main_globals.c b/VEX/priv/main_globals.c index c0536bea7..6dd7723de 100644 --- a/VEX/priv/main_globals.c +++ b/VEX/priv/main_globals.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/main_globals.h b/VEX/priv/main_globals.h index 948079f7d..487a42741 100644 --- a/VEX/priv/main_globals.h +++ b/VEX/priv/main_globals.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index 85da551d5..08e4587f1 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/main_util.c b/VEX/priv/main_util.c index 2c713274d..8d99eab83 100644 --- a/VEX/priv/main_util.c +++ b/VEX/priv/main_util.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/main_util.h b/VEX/priv/main_util.h index 01b623fe7..4abae5440 100644 --- a/VEX/priv/main_util.h +++ b/VEX/priv/main_util.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/mips_defs.h b/VEX/priv/mips_defs.h index cb19eac52..94653ee48 100644 --- a/VEX/priv/mips_defs.h +++ b/VEX/priv/mips_defs.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/multiarch_main_main.c b/VEX/priv/multiarch_main_main.c index 8110b856d..ace23eebf 100644 --- a/VEX/priv/multiarch_main_main.c +++ b/VEX/priv/multiarch_main_main.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/s390_defs.h b/VEX/priv/s390_defs.h index 482dc4f0e..64c30987c 100644 --- a/VEX/priv/s390_defs.h +++ b/VEX/priv/s390_defs.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/s390_disasm.c b/VEX/priv/s390_disasm.c index 0eb8f922f..d2325e7ca 100644 --- a/VEX/priv/s390_disasm.c +++ b/VEX/priv/s390_disasm.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/priv/s390_disasm.h b/VEX/priv/s390_disasm.h index 14731898c..d3096fd47 100644 --- a/VEX/priv/s390_disasm.h +++ b/VEX/priv/s390_disasm.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index bfa94d033..0be6deb82 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_basictypes.h b/VEX/pub/libvex_basictypes.h index 6c48b227c..67bc1a9b2 100644 --- a/VEX/pub/libvex_basictypes.h +++ b/VEX/pub/libvex_basictypes.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_emnote.h b/VEX/pub/libvex_emnote.h index bd998a1c0..331c1b603 100644 --- a/VEX/pub/libvex_emnote.h +++ b/VEX/pub/libvex_emnote.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_guest_amd64.h b/VEX/pub/libvex_guest_amd64.h index 9be073a21..e96b6b0f3 100644 --- a/VEX/pub/libvex_guest_amd64.h +++ b/VEX/pub/libvex_guest_amd64.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_guest_arm.h b/VEX/pub/libvex_guest_arm.h index 87bb03962..a540f2b41 100644 --- a/VEX/pub/libvex_guest_arm.h +++ b/VEX/pub/libvex_guest_arm.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_guest_arm64.h b/VEX/pub/libvex_guest_arm64.h index 298f4fcfa..30317dae6 100644 --- a/VEX/pub/libvex_guest_arm64.h +++ b/VEX/pub/libvex_guest_arm64.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_guest_mips32.h b/VEX/pub/libvex_guest_mips32.h index e769819d7..c43ac2f22 100644 --- a/VEX/pub/libvex_guest_mips32.h +++ b/VEX/pub/libvex_guest_mips32.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_guest_mips64.h b/VEX/pub/libvex_guest_mips64.h index a953f0ab8..1ee2c1832 100644 --- a/VEX/pub/libvex_guest_mips64.h +++ b/VEX/pub/libvex_guest_mips64.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_guest_ppc32.h b/VEX/pub/libvex_guest_ppc32.h index 9457e9bc0..f0cdedacb 100644 --- a/VEX/pub/libvex_guest_ppc32.h +++ b/VEX/pub/libvex_guest_ppc32.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_guest_ppc64.h b/VEX/pub/libvex_guest_ppc64.h index c7fe874a8..cea667928 100644 --- a/VEX/pub/libvex_guest_ppc64.h +++ b/VEX/pub/libvex_guest_ppc64.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_guest_riscv64.h b/VEX/pub/libvex_guest_riscv64.h index 31264b124..51b646971 100644 --- a/VEX/pub/libvex_guest_riscv64.h +++ b/VEX/pub/libvex_guest_riscv64.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_guest_s390x.h b/VEX/pub/libvex_guest_s390x.h index ec4d71bb4..c805dc0c0 100644 --- a/VEX/pub/libvex_guest_s390x.h +++ b/VEX/pub/libvex_guest_s390x.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_guest_x86.h b/VEX/pub/libvex_guest_x86.h index 50de8d379..80916a2ba 100644 --- a/VEX/pub/libvex_guest_x86.h +++ b/VEX/pub/libvex_guest_x86.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_inner.h b/VEX/pub/libvex_inner.h index f5db06d56..9d1160724 100644 --- a/VEX/pub/libvex_inner.h +++ b/VEX/pub/libvex_inner.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h index 7cb9c6b0f..3a1f92f45 100644 --- a/VEX/pub/libvex_ir.h +++ b/VEX/pub/libvex_ir.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_s390x_common.h b/VEX/pub/libvex_s390x_common.h index ea6a59d27..295e0c29b 100644 --- a/VEX/pub/libvex_s390x_common.h +++ b/VEX/pub/libvex_s390x_common.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/pub/libvex_trc_values.h b/VEX/pub/libvex_trc_values.h index c9adcb70d..eb8fed925 100644 --- a/VEX/pub/libvex_trc_values.h +++ b/VEX/pub/libvex_trc_values.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/test/test-amd64.c b/VEX/test/test-amd64.c index 9cb8c3dbe..bedc99e98 100644 --- a/VEX/test/test-amd64.c +++ b/VEX/test/test-amd64.c @@ -15,7 +15,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, diff --git a/VEX/test/test-i386.c b/VEX/test/test-i386.c index a948519e1..3489b1547 100644 --- a/VEX/test/test-i386.c +++ b/VEX/test/test-i386.c @@ -5,7 +5,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, diff --git a/VEX/useful/hd_fpu.c b/VEX/useful/hd_fpu.c index 9655f12f8..86b7ff271 100644 --- a/VEX/useful/hd_fpu.c +++ b/VEX/useful/hd_fpu.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/VEX/useful/test_main.c b/VEX/useful/test_main.c index ba4e25017..08513d9a0 100644 --- a/VEX/useful/test_main.c +++ b/VEX/useful/test_main.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but @@ -530,7 +530,7 @@ static void MC_helperc_value_check4_fail( void ) { } This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/auxprogs/getoff.c b/auxprogs/getoff.c index 7cd9d2414..30d9cded1 100644 --- a/auxprogs/getoff.c +++ b/auxprogs/getoff.c @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/auxprogs/valgrind-di-server.c b/auxprogs/valgrind-di-server.c index a16800237..955e7d76c 100644 --- a/auxprogs/valgrind-di-server.c +++ b/auxprogs/valgrind-di-server.c @@ -21,7 +21,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/auxprogs/valgrind-listener.c b/auxprogs/valgrind-listener.c index 5607e138d..96c7c9be6 100644 --- a/auxprogs/valgrind-listener.c +++ b/auxprogs/valgrind-listener.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/cachegrind/cachegrind.h b/cachegrind/cachegrind.h index ddc10abe5..963e01274 100644 --- a/cachegrind/cachegrind.h +++ b/cachegrind/cachegrind.h @@ -3,7 +3,7 @@ Notice that the following BSD-style license applies to this one file (cachegrind.h) only. The rest of Valgrind is licensed under the - terms of the GNU General Public License, version 2, unless + terms of the GNU General Public License, version 3, unless otherwise indicated. See the COPYING file in the source distribution for details. @@ -49,7 +49,7 @@ Notice that the above BSD-style license applies to this one file (cachegrind.h) only. The entire rest of Valgrind is licensed under - the terms of the GNU General Public License, version 2. See the + the terms of the GNU General Public License, version 3. See the COPYING file in the source distribution for details. ---------------------------------------------------------------- diff --git a/cachegrind/cg_annotate.in b/cachegrind/cg_annotate.in index fe3f41181..965da96c6 100644 --- a/cachegrind/cg_annotate.in +++ b/cachegrind/cg_annotate.in @@ -13,7 +13,7 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the +# published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but diff --git a/cachegrind/cg_arch.c b/cachegrind/cg_arch.c index be2973405..f877f95c7 100644 --- a/cachegrind/cg_arch.c +++ b/cachegrind/cg_arch.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/cachegrind/cg_arch.h b/cachegrind/cg_arch.h index 5bb56b082..2f1813c7d 100644 --- a/cachegrind/cg_arch.h +++ b/cachegrind/cg_arch.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/cachegrind/cg_branchpred.c b/cachegrind/cg_branchpred.c index f7a261c6f..d845fa068 100644 --- a/cachegrind/cg_branchpred.c +++ b/cachegrind/cg_branchpred.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/cachegrind/cg_diff.in b/cachegrind/cg_diff.in index acc5484f1..1185c3090 100644 --- a/cachegrind/cg_diff.in +++ b/cachegrind/cg_diff.in @@ -13,7 +13,7 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the +# published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index e8f534c98..ee3e91c6f 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/cachegrind/cg_merge.in b/cachegrind/cg_merge.in index 7cc0f2b14..b92851f44 100644 --- a/cachegrind/cg_merge.in +++ b/cachegrind/cg_merge.in @@ -13,7 +13,7 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the +# published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but diff --git a/cachegrind/cg_sim.c b/cachegrind/cg_sim.c index c2ea3791b..8383e290b 100644 --- a/cachegrind/cg_sim.c +++ b/cachegrind/cg_sim.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/bb.c b/callgrind/bb.c index a599c10a5..858048185 100644 --- a/callgrind/bb.c +++ b/callgrind/bb.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/bbcc.c b/callgrind/bbcc.c index d197f3dee..ca597697a 100644 --- a/callgrind/bbcc.c +++ b/callgrind/bbcc.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/callgrind.h b/callgrind/callgrind.h index f078cc82b..88a23b274 100644 --- a/callgrind/callgrind.h +++ b/callgrind/callgrind.h @@ -4,7 +4,7 @@ Notice that the following BSD-style license applies to this one file (callgrind.h) only. The rest of Valgrind is licensed under the - terms of the GNU General Public License, version 2, unless + terms of the GNU General Public License, version 3, unless otherwise indicated. See the COPYING file in the source distribution for details. @@ -50,7 +50,7 @@ Notice that the above BSD-style license applies to this one file (callgrind.h) only. The entire rest of Valgrind is licensed under - the terms of the GNU General Public License, version 2. See the + the terms of the GNU General Public License, version 3. See the COPYING file in the source distribution for details. ---------------------------------------------------------------- diff --git a/callgrind/callgrind_annotate.in b/callgrind/callgrind_annotate.in index 976fe9b5f..07f3a2196 100644 --- a/callgrind/callgrind_annotate.in +++ b/callgrind/callgrind_annotate.in @@ -17,7 +17,7 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the +# published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but diff --git a/callgrind/callgrind_control.in b/callgrind/callgrind_control.in index bee6661ef..16cdb44fa 100644 --- a/callgrind/callgrind_control.in +++ b/callgrind/callgrind_control.in @@ -11,7 +11,7 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the +# published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but diff --git a/callgrind/callstack.c b/callgrind/callstack.c index fc1d6eeab..20669e9cd 100644 --- a/callgrind/callstack.c +++ b/callgrind/callstack.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/clo.c b/callgrind/clo.c index ce15fc832..e0912e178 100644 --- a/callgrind/clo.c +++ b/callgrind/clo.c @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/context.c b/callgrind/context.c index 81261bdf1..55be82028 100644 --- a/callgrind/context.c +++ b/callgrind/context.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/costs.c b/callgrind/costs.c index 936cf9014..321e19541 100644 --- a/callgrind/costs.c +++ b/callgrind/costs.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/costs.h b/callgrind/costs.h index 9b33da480..42678312d 100644 --- a/callgrind/costs.h +++ b/callgrind/costs.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/debug.c b/callgrind/debug.c index 58af44a66..89cec7f3f 100644 --- a/callgrind/debug.c +++ b/callgrind/debug.c @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/dump.c b/callgrind/dump.c index 130b73bd0..a365999f1 100644 --- a/callgrind/dump.c +++ b/callgrind/dump.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/events.c b/callgrind/events.c index 4b0394f6e..997ee61d0 100644 --- a/callgrind/events.c +++ b/callgrind/events.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/events.h b/callgrind/events.h index a4ca93300..5d067a71f 100644 --- a/callgrind/events.h +++ b/callgrind/events.h @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/fn.c b/callgrind/fn.c index 27ad4988a..d6250c34b 100644 --- a/callgrind/fn.c +++ b/callgrind/fn.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/global.h b/callgrind/global.h index 4a988a481..89b9a2799 100644 --- a/callgrind/global.h +++ b/callgrind/global.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/jumps.c b/callgrind/jumps.c index 5a0d32e9e..13bac4572 100644 --- a/callgrind/jumps.c +++ b/callgrind/jumps.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/main.c b/callgrind/main.c index 39aa230ed..82602c9ad 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/sim.c b/callgrind/sim.c index 90e613431..3350ae93e 100644 --- a/callgrind/sim.c +++ b/callgrind/sim.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/callgrind/threads.c b/callgrind/threads.c index 624588a26..4ef3db766 100644 --- a/callgrind/threads.c +++ b/callgrind/threads.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/launcher-darwin.c b/coregrind/launcher-darwin.c index eafc21d04..933050617 100644 --- a/coregrind/launcher-darwin.c +++ b/coregrind/launcher-darwin.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/launcher-freebsd.c b/coregrind/launcher-freebsd.c index 1675fbcf5..56307d50b 100644 --- a/coregrind/launcher-freebsd.c +++ b/coregrind/launcher-freebsd.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/launcher-linux.c b/coregrind/launcher-linux.c index 20e624003..b4ac3d222 100644 --- a/coregrind/launcher-linux.c +++ b/coregrind/launcher-linux.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_addrinfo.c b/coregrind/m_addrinfo.c index 0d4624dbb..32d2fd4c9 100644 --- a/coregrind/m_addrinfo.c +++ b/coregrind/m_addrinfo.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_aspacehl.c b/coregrind/m_aspacehl.c index a692f4f5c..c74723921 100644 --- a/coregrind/m_aspacehl.c +++ b/coregrind/m_aspacehl.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_aspacemgr/aspacemgr-common.c b/coregrind/m_aspacemgr/aspacemgr-common.c index 14864d96c..379ad773d 100644 --- a/coregrind/m_aspacemgr/aspacemgr-common.c +++ b/coregrind/m_aspacemgr/aspacemgr-common.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index 785d75c70..214b4a808 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -16,7 +16,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_aspacemgr/aspacemgr-segnames.c b/coregrind/m_aspacemgr/aspacemgr-segnames.c index cfd7ffa33..6d6070897 100644 --- a/coregrind/m_aspacemgr/aspacemgr-segnames.c +++ b/coregrind/m_aspacemgr/aspacemgr-segnames.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_aspacemgr/priv_aspacemgr.h b/coregrind/m_aspacemgr/priv_aspacemgr.h index 0c8a807f2..978c58b98 100644 --- a/coregrind/m_aspacemgr/priv_aspacemgr.h +++ b/coregrind/m_aspacemgr/priv_aspacemgr.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_cache.c b/coregrind/m_cache.c index 4abd26f0b..fd6f801c1 100644 --- a/coregrind/m_cache.c +++ b/coregrind/m_cache.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_clientstate.c b/coregrind/m_clientstate.c index 2e4752b8d..61cf0502b 100644 --- a/coregrind/m_clientstate.c +++ b/coregrind/m_clientstate.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_commandline.c b/coregrind/m_commandline.c index da57d6c8c..df36ffb15 100644 --- a/coregrind/m_commandline.c +++ b/coregrind/m_commandline.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_compiler.c b/coregrind/m_compiler.c index 9e792e8a4..157f96480 100644 --- a/coregrind/m_compiler.c +++ b/coregrind/m_compiler.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_coredump/coredump-elf.c b/coregrind/m_coredump/coredump-elf.c index b57d26275..ab584eb13 100644 --- a/coregrind/m_coredump/coredump-elf.c +++ b/coregrind/m_coredump/coredump-elf.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_coredump/coredump-macho.c b/coregrind/m_coredump/coredump-macho.c index 61c8b0589..da120c724 100644 --- a/coregrind/m_coredump/coredump-macho.c +++ b/coregrind/m_coredump/coredump-macho.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_coredump/coredump-solaris.c b/coregrind/m_coredump/coredump-solaris.c index 00d131b37..cec2afaf8 100644 --- a/coregrind/m_coredump/coredump-solaris.c +++ b/coregrind/m_coredump/coredump-solaris.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_cpuid.S b/coregrind/m_cpuid.S index 4885e2e20..10839a132 100644 --- a/coregrind/m_cpuid.S +++ b/coregrind/m_cpuid.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/d3basics.c b/coregrind/m_debuginfo/d3basics.c index 80dec21a6..485213d63 100644 --- a/coregrind/m_debuginfo/d3basics.c +++ b/coregrind/m_debuginfo/d3basics.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 63ed32608..18152b9e2 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/image.c b/coregrind/m_debuginfo/image.c index d00535cda..21deabb35 100644 --- a/coregrind/m_debuginfo/image.c +++ b/coregrind/m_debuginfo/image.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/lzoconf.h b/coregrind/m_debuginfo/lzoconf.h index 23c6ca93f..fd02f8020 100644 --- a/coregrind/m_debuginfo/lzoconf.h +++ b/coregrind/m_debuginfo/lzoconf.h @@ -22,7 +22,7 @@ The LZO library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The LZO library is distributed in the hope that it will be useful, diff --git a/coregrind/m_debuginfo/lzodefs.h b/coregrind/m_debuginfo/lzodefs.h index 0e40e332a..4dbcabe17 100644 --- a/coregrind/m_debuginfo/lzodefs.h +++ b/coregrind/m_debuginfo/lzodefs.h @@ -22,7 +22,7 @@ The LZO library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The LZO library is distributed in the hope that it will be useful, diff --git a/coregrind/m_debuginfo/minilzo-inl.c b/coregrind/m_debuginfo/minilzo-inl.c index b45ec92ea..939e929d9 100644 --- a/coregrind/m_debuginfo/minilzo-inl.c +++ b/coregrind/m_debuginfo/minilzo-inl.c @@ -22,7 +22,7 @@ The LZO library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The LZO library is distributed in the hope that it will be useful, diff --git a/coregrind/m_debuginfo/minilzo.h b/coregrind/m_debuginfo/minilzo.h index 4c7b23784..d9e7d6ab2 100644 --- a/coregrind/m_debuginfo/minilzo.h +++ b/coregrind/m_debuginfo/minilzo.h @@ -22,7 +22,7 @@ The LZO library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The LZO library is distributed in the hope that it will be useful, diff --git a/coregrind/m_debuginfo/misc.c b/coregrind/m_debuginfo/misc.c index 910d9b217..520c4cf99 100644 --- a/coregrind/m_debuginfo/misc.c +++ b/coregrind/m_debuginfo/misc.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/priv_d3basics.h b/coregrind/m_debuginfo/priv_d3basics.h index 34c987287..1eb3fd762 100644 --- a/coregrind/m_debuginfo/priv_d3basics.h +++ b/coregrind/m_debuginfo/priv_d3basics.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/priv_image.h b/coregrind/m_debuginfo/priv_image.h index 1632fa71f..90de98dfc 100644 --- a/coregrind/m_debuginfo/priv_image.h +++ b/coregrind/m_debuginfo/priv_image.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/priv_misc.h b/coregrind/m_debuginfo/priv_misc.h index ca430d3d0..d9080079b 100644 --- a/coregrind/m_debuginfo/priv_misc.h +++ b/coregrind/m_debuginfo/priv_misc.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/priv_readdwarf.h b/coregrind/m_debuginfo/priv_readdwarf.h index 302266924..665c25f22 100644 --- a/coregrind/m_debuginfo/priv_readdwarf.h +++ b/coregrind/m_debuginfo/priv_readdwarf.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/priv_readdwarf3.h b/coregrind/m_debuginfo/priv_readdwarf3.h index 25e3cd50d..dea54a4b4 100644 --- a/coregrind/m_debuginfo/priv_readdwarf3.h +++ b/coregrind/m_debuginfo/priv_readdwarf3.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/priv_readelf.h b/coregrind/m_debuginfo/priv_readelf.h index 75e02c980..88c9cc927 100644 --- a/coregrind/m_debuginfo/priv_readelf.h +++ b/coregrind/m_debuginfo/priv_readelf.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/priv_readexidx.h b/coregrind/m_debuginfo/priv_readexidx.h index 8dca00f2b..5ca55d338 100644 --- a/coregrind/m_debuginfo/priv_readexidx.h +++ b/coregrind/m_debuginfo/priv_readexidx.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/priv_readmacho.h b/coregrind/m_debuginfo/priv_readmacho.h index 0cbdad90f..5ff5d048c 100644 --- a/coregrind/m_debuginfo/priv_readmacho.h +++ b/coregrind/m_debuginfo/priv_readmacho.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/priv_readpdb.h b/coregrind/m_debuginfo/priv_readpdb.h index b9b8fb3a2..49f24291c 100644 --- a/coregrind/m_debuginfo/priv_readpdb.h +++ b/coregrind/m_debuginfo/priv_readpdb.h @@ -16,7 +16,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/priv_storage.h b/coregrind/m_debuginfo/priv_storage.h index 868ce2772..c38dfd76f 100644 --- a/coregrind/m_debuginfo/priv_storage.h +++ b/coregrind/m_debuginfo/priv_storage.h @@ -16,7 +16,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/priv_tytypes.h b/coregrind/m_debuginfo/priv_tytypes.h index 787c57870..97c7cc9b3 100644 --- a/coregrind/m_debuginfo/priv_tytypes.h +++ b/coregrind/m_debuginfo/priv_tytypes.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c index b08720182..3cc00d317 100644 --- a/coregrind/m_debuginfo/readdwarf.c +++ b/coregrind/m_debuginfo/readdwarf.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c index 49c5abb68..374237498 100644 --- a/coregrind/m_debuginfo/readdwarf3.c +++ b/coregrind/m_debuginfo/readdwarf3.c @@ -16,7 +16,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index 61a39af2a..52965a1ca 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/readexidx.c b/coregrind/m_debuginfo/readexidx.c index 261c9c466..92509efe3 100644 --- a/coregrind/m_debuginfo/readexidx.c +++ b/coregrind/m_debuginfo/readexidx.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/readmacho.c b/coregrind/m_debuginfo/readmacho.c index 691ec9435..48ef5aaf5 100644 --- a/coregrind/m_debuginfo/readmacho.c +++ b/coregrind/m_debuginfo/readmacho.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/readpdb.c b/coregrind/m_debuginfo/readpdb.c index 9ad5a1177..dbae197b3 100644 --- a/coregrind/m_debuginfo/readpdb.c +++ b/coregrind/m_debuginfo/readpdb.c @@ -19,7 +19,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c index 1db726be8..baaa60899 100644 --- a/coregrind/m_debuginfo/storage.c +++ b/coregrind/m_debuginfo/storage.c @@ -16,7 +16,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/tinfl.c b/coregrind/m_debuginfo/tinfl.c index 612a69f6c..7609d5b27 100644 --- a/coregrind/m_debuginfo/tinfl.c +++ b/coregrind/m_debuginfo/tinfl.c @@ -17,7 +17,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuginfo/tytypes.c b/coregrind/m_debuginfo/tytypes.c index e356b92c9..61e8ff4e1 100644 --- a/coregrind/m_debuginfo/tytypes.c +++ b/coregrind/m_debuginfo/tytypes.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c index 225e5a085..fa358df64 100644 --- a/coregrind/m_debuglog.c +++ b/coregrind/m_debuglog.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_deduppoolalloc.c b/coregrind/m_deduppoolalloc.c index 2ee6a1bbd..c07b62a3f 100644 --- a/coregrind/m_deduppoolalloc.c +++ b/coregrind/m_deduppoolalloc.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_demangle/ansidecl.h b/coregrind/m_demangle/ansidecl.h index 653d91869..323ff8be3 100644 --- a/coregrind/m_demangle/ansidecl.h +++ b/coregrind/m_demangle/ansidecl.h @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or +the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_demangle/cp-demangle.c b/coregrind/m_demangle/cp-demangle.c index a3d1b8810..adec005b4 100644 --- a/coregrind/m_demangle/cp-demangle.c +++ b/coregrind/m_demangle/cp-demangle.c @@ -6,7 +6,7 @@ This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. In addition to the permissions in the GNU General Public License, the diff --git a/coregrind/m_demangle/cp-demangle.h b/coregrind/m_demangle/cp-demangle.h index 7640a4fb6..cc5bab0ca 100644 --- a/coregrind/m_demangle/cp-demangle.h +++ b/coregrind/m_demangle/cp-demangle.h @@ -6,7 +6,7 @@ This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. In addition to the permissions in the GNU General Public License, the diff --git a/coregrind/m_demangle/demangle.c b/coregrind/m_demangle/demangle.c index 165012aea..ba7f86564 100644 --- a/coregrind/m_demangle/demangle.c +++ b/coregrind/m_demangle/demangle.c @@ -16,7 +16,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_demangle/demangle.h b/coregrind/m_demangle/demangle.h index 8b7dd705a..70cd90bfa 100644 --- a/coregrind/m_demangle/demangle.h +++ b/coregrind/m_demangle/demangle.h @@ -3,7 +3,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License - as published by the Free Software Foundation; either version 2, or + as published by the Free Software Foundation; either version 3, or (at your option) any later version. In addition to the permissions in the GNU Library General Public diff --git a/coregrind/m_demangle/dyn-string.c b/coregrind/m_demangle/dyn-string.c index c16f269dd..af9d41ea1 100644 --- a/coregrind/m_demangle/dyn-string.c +++ b/coregrind/m_demangle/dyn-string.c @@ -6,7 +6,7 @@ This file is part of GNU CC. GNU CC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) +the Free Software Foundation; either version 3, or (at your option) any later version. In addition to the permissions in the GNU General Public License, the diff --git a/coregrind/m_demangle/dyn-string.h b/coregrind/m_demangle/dyn-string.h index b0a108d9f..76e23e0c3 100644 --- a/coregrind/m_demangle/dyn-string.h +++ b/coregrind/m_demangle/dyn-string.h @@ -6,7 +6,7 @@ This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) +the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, diff --git a/coregrind/m_demangle/vg_libciface.h b/coregrind/m_demangle/vg_libciface.h index d64d5a70c..ac8c4c7ef 100644 --- a/coregrind/m_demangle/vg_libciface.h +++ b/coregrind/m_demangle/vg_libciface.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-amd64-darwin.S b/coregrind/m_dispatch/dispatch-amd64-darwin.S index 7dc06a84e..996e78e31 100644 --- a/coregrind/m_dispatch/dispatch-amd64-darwin.S +++ b/coregrind/m_dispatch/dispatch-amd64-darwin.S @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-amd64-freebsd.S b/coregrind/m_dispatch/dispatch-amd64-freebsd.S index db4dccac7..101f2d8c4 100644 --- a/coregrind/m_dispatch/dispatch-amd64-freebsd.S +++ b/coregrind/m_dispatch/dispatch-amd64-freebsd.S @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-amd64-linux.S b/coregrind/m_dispatch/dispatch-amd64-linux.S index 8ea2235d8..092d756a9 100644 --- a/coregrind/m_dispatch/dispatch-amd64-linux.S +++ b/coregrind/m_dispatch/dispatch-amd64-linux.S @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-amd64-solaris.S b/coregrind/m_dispatch/dispatch-amd64-solaris.S index a894253fe..389d88bc4 100644 --- a/coregrind/m_dispatch/dispatch-amd64-solaris.S +++ b/coregrind/m_dispatch/dispatch-amd64-solaris.S @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-arm-linux.S b/coregrind/m_dispatch/dispatch-arm-linux.S index 40629017c..b97662323 100644 --- a/coregrind/m_dispatch/dispatch-arm-linux.S +++ b/coregrind/m_dispatch/dispatch-arm-linux.S @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-arm64-freebsd.S b/coregrind/m_dispatch/dispatch-arm64-freebsd.S index fcc222d49..7eceb6cef 100644 --- a/coregrind/m_dispatch/dispatch-arm64-freebsd.S +++ b/coregrind/m_dispatch/dispatch-arm64-freebsd.S @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-arm64-linux.S b/coregrind/m_dispatch/dispatch-arm64-linux.S index 3426bd915..95670d125 100644 --- a/coregrind/m_dispatch/dispatch-arm64-linux.S +++ b/coregrind/m_dispatch/dispatch-arm64-linux.S @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-mips32-linux.S b/coregrind/m_dispatch/dispatch-mips32-linux.S index 2b077c3c7..0f5cf1916 100644 --- a/coregrind/m_dispatch/dispatch-mips32-linux.S +++ b/coregrind/m_dispatch/dispatch-mips32-linux.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-mips64-linux.S b/coregrind/m_dispatch/dispatch-mips64-linux.S index f5b79ba1e..03db1121e 100644 --- a/coregrind/m_dispatch/dispatch-mips64-linux.S +++ b/coregrind/m_dispatch/dispatch-mips64-linux.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-nanomips-linux.S b/coregrind/m_dispatch/dispatch-nanomips-linux.S index 394fd9ea7..2773e4db2 100644 --- a/coregrind/m_dispatch/dispatch-nanomips-linux.S +++ b/coregrind/m_dispatch/dispatch-nanomips-linux.S @@ -10,7 +10,7 @@ # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the +# published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-ppc32-linux.S b/coregrind/m_dispatch/dispatch-ppc32-linux.S index b679a2eb6..77e205d91 100644 --- a/coregrind/m_dispatch/dispatch-ppc32-linux.S +++ b/coregrind/m_dispatch/dispatch-ppc32-linux.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-ppc64be-linux.S b/coregrind/m_dispatch/dispatch-ppc64be-linux.S index 9722fd803..3612657df 100644 --- a/coregrind/m_dispatch/dispatch-ppc64be-linux.S +++ b/coregrind/m_dispatch/dispatch-ppc64be-linux.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-ppc64le-linux.S b/coregrind/m_dispatch/dispatch-ppc64le-linux.S index e790ae84c..4589695c4 100644 --- a/coregrind/m_dispatch/dispatch-ppc64le-linux.S +++ b/coregrind/m_dispatch/dispatch-ppc64le-linux.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-riscv64-linux.S b/coregrind/m_dispatch/dispatch-riscv64-linux.S index c4941e457..710cbcdff 100644 --- a/coregrind/m_dispatch/dispatch-riscv64-linux.S +++ b/coregrind/m_dispatch/dispatch-riscv64-linux.S @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-s390x-linux.S b/coregrind/m_dispatch/dispatch-s390x-linux.S index 4acc5ba2f..05e33c34f 100644 --- a/coregrind/m_dispatch/dispatch-s390x-linux.S +++ b/coregrind/m_dispatch/dispatch-s390x-linux.S @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-x86-darwin.S b/coregrind/m_dispatch/dispatch-x86-darwin.S index ce8756009..82ceb3d99 100644 --- a/coregrind/m_dispatch/dispatch-x86-darwin.S +++ b/coregrind/m_dispatch/dispatch-x86-darwin.S @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-x86-freebsd.S b/coregrind/m_dispatch/dispatch-x86-freebsd.S index 667bfcd96..89293959f 100644 --- a/coregrind/m_dispatch/dispatch-x86-freebsd.S +++ b/coregrind/m_dispatch/dispatch-x86-freebsd.S @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-x86-linux.S b/coregrind/m_dispatch/dispatch-x86-linux.S index 9c0c04554..ed41e5824 100644 --- a/coregrind/m_dispatch/dispatch-x86-linux.S +++ b/coregrind/m_dispatch/dispatch-x86-linux.S @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_dispatch/dispatch-x86-solaris.S b/coregrind/m_dispatch/dispatch-x86-solaris.S index 332546cf0..9b852f07c 100644 --- a/coregrind/m_dispatch/dispatch-x86-solaris.S +++ b/coregrind/m_dispatch/dispatch-x86-solaris.S @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c index 8dfeefeed..aaf3d5661 100644 --- a/coregrind/m_errormgr.c +++ b/coregrind/m_errormgr.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_execontext.c b/coregrind/m_execontext.c index b00db1886..cd4b870e2 100644 --- a/coregrind/m_execontext.c +++ b/coregrind/m_execontext.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_extension/extension-main.c b/coregrind/m_extension/extension-main.c index 5590c9d28..4a2d3e420 100644 --- a/coregrind/m_extension/extension-main.c +++ b/coregrind/m_extension/extension-main.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_extension/extension-s390x.c b/coregrind/m_extension/extension-s390x.c index a0c2913d4..9c2df8d79 100644 --- a/coregrind/m_extension/extension-s390x.c +++ b/coregrind/m_extension/extension-s390x.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_extension/priv_extension.h b/coregrind/m_extension/priv_extension.h index 6f6dbaca8..d90c6a5aa 100644 --- a/coregrind/m_extension/priv_extension.h +++ b/coregrind/m_extension/priv_extension.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_extension/priv_types_n_macros.h b/coregrind/m_extension/priv_types_n_macros.h index 3dced8e35..f4e8f9b87 100644 --- a/coregrind/m_extension/priv_types_n_macros.h +++ b/coregrind/m_extension/priv_types_n_macros.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_gdbserver/gdb/signals.h b/coregrind/m_gdbserver/gdb/signals.h index 81f373ae7..99e30bd9a 100644 --- a/coregrind/m_gdbserver/gdb/signals.h +++ b/coregrind/m_gdbserver/gdb/signals.h @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/inferiors.c b/coregrind/m_gdbserver/inferiors.c index fbf7d2359..530bb40db 100644 --- a/coregrind/m_gdbserver/inferiors.c +++ b/coregrind/m_gdbserver/inferiors.c @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/m_gdbserver.c b/coregrind/m_gdbserver/m_gdbserver.c index 5d0973e9e..994d5eb44 100644 --- a/coregrind/m_gdbserver/m_gdbserver.c +++ b/coregrind/m_gdbserver/m_gdbserver.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_gdbserver/regcache.c b/coregrind/m_gdbserver/regcache.c index 7357967d2..313c3c17c 100644 --- a/coregrind/m_gdbserver/regcache.c +++ b/coregrind/m_gdbserver/regcache.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/regcache.h b/coregrind/m_gdbserver/regcache.h index 881dcc37b..048424362 100644 --- a/coregrind/m_gdbserver/regcache.h +++ b/coregrind/m_gdbserver/regcache.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/regdef.h b/coregrind/m_gdbserver/regdef.h index a318ce913..09dc22828 100644 --- a/coregrind/m_gdbserver/regdef.h +++ b/coregrind/m_gdbserver/regdef.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/remote-utils-shared.c b/coregrind/m_gdbserver/remote-utils-shared.c index d0e11b302..ce508a70c 100644 --- a/coregrind/m_gdbserver/remote-utils-shared.c +++ b/coregrind/m_gdbserver/remote-utils-shared.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/remote-utils.c b/coregrind/m_gdbserver/remote-utils.c index 2daf54383..de0991c79 100644 --- a/coregrind/m_gdbserver/remote-utils.c +++ b/coregrind/m_gdbserver/remote-utils.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c index 410ebf3bc..21e21da73 100644 --- a/coregrind/m_gdbserver/server.c +++ b/coregrind/m_gdbserver/server.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/server.h b/coregrind/m_gdbserver/server.h index d6dc8d692..4d8a752d9 100644 --- a/coregrind/m_gdbserver/server.h +++ b/coregrind/m_gdbserver/server.h @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/signals.c b/coregrind/m_gdbserver/signals.c index 5119c0d34..9b3d58e47 100644 --- a/coregrind/m_gdbserver/signals.c +++ b/coregrind/m_gdbserver/signals.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/target.c b/coregrind/m_gdbserver/target.c index 4238c608c..fad94e44a 100644 --- a/coregrind/m_gdbserver/target.c +++ b/coregrind/m_gdbserver/target.c @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/target.h b/coregrind/m_gdbserver/target.h index 1309bba7a..7d6376977 100644 --- a/coregrind/m_gdbserver/target.h +++ b/coregrind/m_gdbserver/target.h @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/utils.c b/coregrind/m_gdbserver/utils.c index 83295a195..59ac127a8 100644 --- a/coregrind/m_gdbserver/utils.c +++ b/coregrind/m_gdbserver/utils.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-low-amd64.c b/coregrind/m_gdbserver/valgrind-low-amd64.c index 1808609a5..0487bc3d0 100644 --- a/coregrind/m_gdbserver/valgrind-low-amd64.c +++ b/coregrind/m_gdbserver/valgrind-low-amd64.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-low-arm.c b/coregrind/m_gdbserver/valgrind-low-arm.c index 79050f15b..c628f42b8 100644 --- a/coregrind/m_gdbserver/valgrind-low-arm.c +++ b/coregrind/m_gdbserver/valgrind-low-arm.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-low-arm64.c b/coregrind/m_gdbserver/valgrind-low-arm64.c index 03239b28e..67e836482 100644 --- a/coregrind/m_gdbserver/valgrind-low-arm64.c +++ b/coregrind/m_gdbserver/valgrind-low-arm64.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-low-mips32.c b/coregrind/m_gdbserver/valgrind-low-mips32.c index 62eeb01f9..d5edcb17a 100644 --- a/coregrind/m_gdbserver/valgrind-low-mips32.c +++ b/coregrind/m_gdbserver/valgrind-low-mips32.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-low-mips64.c b/coregrind/m_gdbserver/valgrind-low-mips64.c index 9b96d9e5b..fee92bcef 100644 --- a/coregrind/m_gdbserver/valgrind-low-mips64.c +++ b/coregrind/m_gdbserver/valgrind-low-mips64.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-low-nanomips.c b/coregrind/m_gdbserver/valgrind-low-nanomips.c index dea345c29..53f6341d5 100644 --- a/coregrind/m_gdbserver/valgrind-low-nanomips.c +++ b/coregrind/m_gdbserver/valgrind-low-nanomips.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-low-ppc32.c b/coregrind/m_gdbserver/valgrind-low-ppc32.c index be5fb9767..4cecd1e3a 100644 --- a/coregrind/m_gdbserver/valgrind-low-ppc32.c +++ b/coregrind/m_gdbserver/valgrind-low-ppc32.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-low-ppc64.c b/coregrind/m_gdbserver/valgrind-low-ppc64.c index 01488bbef..ee53be9e9 100644 --- a/coregrind/m_gdbserver/valgrind-low-ppc64.c +++ b/coregrind/m_gdbserver/valgrind-low-ppc64.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-low-riscv64.c b/coregrind/m_gdbserver/valgrind-low-riscv64.c index 5c200318c..629bc569c 100644 --- a/coregrind/m_gdbserver/valgrind-low-riscv64.c +++ b/coregrind/m_gdbserver/valgrind-low-riscv64.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-low-s390x.c b/coregrind/m_gdbserver/valgrind-low-s390x.c index bdb767f20..b7e00f748 100644 --- a/coregrind/m_gdbserver/valgrind-low-s390x.c +++ b/coregrind/m_gdbserver/valgrind-low-s390x.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-low-x86.c b/coregrind/m_gdbserver/valgrind-low-x86.c index 4acccef2a..a6a74d6e7 100644 --- a/coregrind/m_gdbserver/valgrind-low-x86.c +++ b/coregrind/m_gdbserver/valgrind-low-x86.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_gdbserver/valgrind-monitor-def.py b/coregrind/m_gdbserver/valgrind-monitor-def.py index bb9a83c33..b31dc0b65 100644 --- a/coregrind/m_gdbserver/valgrind-monitor-def.py +++ b/coregrind/m_gdbserver/valgrind-monitor-def.py @@ -5,7 +5,7 @@ # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the +# published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_gdbserver/valgrind-monitor.py b/coregrind/m_gdbserver/valgrind-monitor.py index 713319d18..415bae624 100644 --- a/coregrind/m_gdbserver/valgrind-monitor.py +++ b/coregrind/m_gdbserver/valgrind-monitor.py @@ -5,7 +5,7 @@ # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the +# published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_gdbserver/valgrind_low.h b/coregrind/m_gdbserver/valgrind_low.h index ef4e19089..87845b21f 100644 --- a/coregrind/m_gdbserver/valgrind_low.h +++ b/coregrind/m_gdbserver/valgrind_low.h @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/coregrind/m_hashtable.c b/coregrind/m_hashtable.c index 6fa07c29f..22ae0631b 100644 --- a/coregrind/m_hashtable.c +++ b/coregrind/m_hashtable.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_initimg/initimg-darwin.c b/coregrind/m_initimg/initimg-darwin.c index 69685ef67..d4452fd9d 100644 --- a/coregrind/m_initimg/initimg-darwin.c +++ b/coregrind/m_initimg/initimg-darwin.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index f187c0e3d..874d129f6 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c index 935f032a4..547707555 100644 --- a/coregrind/m_initimg/initimg-linux.c +++ b/coregrind/m_initimg/initimg-linux.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_initimg/initimg-solaris.c b/coregrind/m_initimg/initimg-solaris.c index 4fa94b8c4..79072f3a8 100644 --- a/coregrind/m_initimg/initimg-solaris.c +++ b/coregrind/m_initimg/initimg-solaris.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c index 38b064021..585991249 100644 --- a/coregrind/m_libcassert.c +++ b/coregrind/m_libcassert.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_libcbase.c b/coregrind/m_libcbase.c index a5d004880..c8ba6454f 100644 --- a/coregrind/m_libcbase.c +++ b/coregrind/m_libcbase.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index ea8a56b9c..a84f22ffd 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c index 390c0a01a..ca3962b2d 100644 --- a/coregrind/m_libcprint.c +++ b/coregrind/m_libcprint.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_libcproc.c b/coregrind/m_libcproc.c index c70f229e5..7c4d6acc9 100644 --- a/coregrind/m_libcproc.c +++ b/coregrind/m_libcproc.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_libcsetjmp.c b/coregrind/m_libcsetjmp.c index 02324daab..5ccaa54e3 100644 --- a/coregrind/m_libcsetjmp.c +++ b/coregrind/m_libcsetjmp.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_libcsignal.c b/coregrind/m_libcsignal.c index a32b53a2f..d8563a4d0 100644 --- a/coregrind/m_libcsignal.c +++ b/coregrind/m_libcsignal.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_libgcc_sup.c b/coregrind/m_libgcc_sup.c index 373f80ca1..df509be08 100644 --- a/coregrind/m_libgcc_sup.c +++ b/coregrind/m_libgcc_sup.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_mach/mach_basics.c b/coregrind/m_mach/mach_basics.c index 2c968ce7d..f0f45f573 100644 --- a/coregrind/m_mach/mach_basics.c +++ b/coregrind/m_mach/mach_basics.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_mach/mach_traps-amd64-darwin.S b/coregrind/m_mach/mach_traps-amd64-darwin.S index 4b88f92a6..ae2d7d1cc 100644 --- a/coregrind/m_mach/mach_traps-amd64-darwin.S +++ b/coregrind/m_mach/mach_traps-amd64-darwin.S @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_mach/mach_traps-x86-darwin.S b/coregrind/m_mach/mach_traps-x86-darwin.S index a12ef23aa..abd20e493 100644 --- a/coregrind/m_mach/mach_traps-x86-darwin.S +++ b/coregrind/m_mach/mach_traps-x86-darwin.S @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index bba498f98..9c19b30eb 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 87c75d2ac..e1bfae2b5 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index a42b1e737..3a08520e1 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_options.c b/coregrind/m_options.c index e70ba08e8..612ef8d8b 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_oset.c b/coregrind/m_oset.c index 0521904d9..c8d156d45 100644 --- a/coregrind/m_oset.c +++ b/coregrind/m_oset.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but @@ -31,7 +31,9 @@ // // ANSI C Library for maintenance of AVL Balanced Trees // (C) 2000 Daniel Nagy, Budapest University of Technology and Economics -// Released under GNU General Public License (GPL) version 2 +// Released under GNU General Public License (GPL) version 2+ +// +// See also coregrind/m_wordfm.c which has the full (license) history. //---------------------------------------------------------------------- // This file implements a generic ordered set using an AVL tree. diff --git a/coregrind/m_pathscan.c b/coregrind/m_pathscan.c index f66774654..841c674e3 100644 --- a/coregrind/m_pathscan.c +++ b/coregrind/m_pathscan.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_poolalloc.c b/coregrind/m_poolalloc.c index d16377b2e..2f0cce4d2 100644 --- a/coregrind/m_poolalloc.c +++ b/coregrind/m_poolalloc.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_rangemap.c b/coregrind/m_rangemap.c index a033ab27e..c2c4b1c44 100644 --- a/coregrind/m_rangemap.c +++ b/coregrind/m_rangemap.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c index 857f910cb..e0f596fbe 100644 --- a/coregrind/m_redir.c +++ b/coregrind/m_redir.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_replacemalloc/replacemalloc_core.c b/coregrind/m_replacemalloc/replacemalloc_core.c index 6c86a8ce1..2bef1102c 100644 --- a/coregrind/m_replacemalloc/replacemalloc_core.c +++ b/coregrind/m_replacemalloc/replacemalloc_core.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index a7a671985..c3f42b863 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sbprofile.c b/coregrind/m_sbprofile.c index 84563206c..c77396685 100644 --- a/coregrind/m_sbprofile.c +++ b/coregrind/m_sbprofile.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_scheduler/priv_sched-lock-impl.h b/coregrind/m_scheduler/priv_sched-lock-impl.h index f53d2be11..093895837 100644 --- a/coregrind/m_scheduler/priv_sched-lock-impl.h +++ b/coregrind/m_scheduler/priv_sched-lock-impl.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_scheduler/priv_sched-lock.h b/coregrind/m_scheduler/priv_sched-lock.h index f04de850f..9632a54d0 100644 --- a/coregrind/m_scheduler/priv_sched-lock.h +++ b/coregrind/m_scheduler/priv_sched-lock.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_scheduler/priv_sema.h b/coregrind/m_scheduler/priv_sema.h index c09b2ef9a..8e19b6a4a 100644 --- a/coregrind/m_scheduler/priv_sema.h +++ b/coregrind/m_scheduler/priv_sema.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_scheduler/sched-lock-generic.c b/coregrind/m_scheduler/sched-lock-generic.c index 93e8ffe6a..c2ea255a4 100644 --- a/coregrind/m_scheduler/sched-lock-generic.c +++ b/coregrind/m_scheduler/sched-lock-generic.c @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_scheduler/sched-lock.c b/coregrind/m_scheduler/sched-lock.c index 1a1a843ec..9c6452f5c 100644 --- a/coregrind/m_scheduler/sched-lock.c +++ b/coregrind/m_scheduler/sched-lock.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index 4862f2506..59c8f8287 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_scheduler/sema.c b/coregrind/m_scheduler/sema.c index 5954cdf8f..9a8a328ba 100644 --- a/coregrind/m_scheduler/sema.c +++ b/coregrind/m_scheduler/sema.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_scheduler/ticket-lock-linux.c b/coregrind/m_scheduler/ticket-lock-linux.c index 91ed32213..3dfa98bd7 100644 --- a/coregrind/m_scheduler/ticket-lock-linux.c +++ b/coregrind/m_scheduler/ticket-lock-linux.c @@ -18,7 +18,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_seqmatch.c b/coregrind/m_seqmatch.c index 09abbca09..46cf6d820 100644 --- a/coregrind/m_seqmatch.c +++ b/coregrind/m_seqmatch.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/priv_sigframe.h b/coregrind/m_sigframe/priv_sigframe.h index 2a491bf3e..4394c1630 100644 --- a/coregrind/m_sigframe/priv_sigframe.h +++ b/coregrind/m_sigframe/priv_sigframe.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-amd64-darwin.c b/coregrind/m_sigframe/sigframe-amd64-darwin.c index cb47f8c04..4d6e9c7f3 100644 --- a/coregrind/m_sigframe/sigframe-amd64-darwin.c +++ b/coregrind/m_sigframe/sigframe-amd64-darwin.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-amd64-freebsd.c b/coregrind/m_sigframe/sigframe-amd64-freebsd.c index 1377c2bae..084f177f9 100644 --- a/coregrind/m_sigframe/sigframe-amd64-freebsd.c +++ b/coregrind/m_sigframe/sigframe-amd64-freebsd.c @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-amd64-linux.c b/coregrind/m_sigframe/sigframe-amd64-linux.c index 0e2430609..33580f2b4 100644 --- a/coregrind/m_sigframe/sigframe-amd64-linux.c +++ b/coregrind/m_sigframe/sigframe-amd64-linux.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-arm-linux.c b/coregrind/m_sigframe/sigframe-arm-linux.c index f982f1213..18b4008ef 100644 --- a/coregrind/m_sigframe/sigframe-arm-linux.c +++ b/coregrind/m_sigframe/sigframe-arm-linux.c @@ -17,7 +17,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-arm64-freebsd.c b/coregrind/m_sigframe/sigframe-arm64-freebsd.c index 854e0ebc2..bdb4e8629 100644 --- a/coregrind/m_sigframe/sigframe-arm64-freebsd.c +++ b/coregrind/m_sigframe/sigframe-arm64-freebsd.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-arm64-linux.c b/coregrind/m_sigframe/sigframe-arm64-linux.c index f98d563b1..69bfc5289 100644 --- a/coregrind/m_sigframe/sigframe-arm64-linux.c +++ b/coregrind/m_sigframe/sigframe-arm64-linux.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-common.c b/coregrind/m_sigframe/sigframe-common.c index 3812c22f8..628a03231 100644 --- a/coregrind/m_sigframe/sigframe-common.c +++ b/coregrind/m_sigframe/sigframe-common.c @@ -17,7 +17,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-mips32-linux.c b/coregrind/m_sigframe/sigframe-mips32-linux.c index 26292f6cb..dd07e861e 100644 --- a/coregrind/m_sigframe/sigframe-mips32-linux.c +++ b/coregrind/m_sigframe/sigframe-mips32-linux.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-mips64-linux.c b/coregrind/m_sigframe/sigframe-mips64-linux.c index d48d20b55..a5f3656fe 100644 --- a/coregrind/m_sigframe/sigframe-mips64-linux.c +++ b/coregrind/m_sigframe/sigframe-mips64-linux.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-nanomips-linux.c b/coregrind/m_sigframe/sigframe-nanomips-linux.c index e2e46f11e..fda8ec913 100644 --- a/coregrind/m_sigframe/sigframe-nanomips-linux.c +++ b/coregrind/m_sigframe/sigframe-nanomips-linux.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-ppc32-linux.c b/coregrind/m_sigframe/sigframe-ppc32-linux.c index 5e6b7ef0e..24020f937 100644 --- a/coregrind/m_sigframe/sigframe-ppc32-linux.c +++ b/coregrind/m_sigframe/sigframe-ppc32-linux.c @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-ppc64-linux.c b/coregrind/m_sigframe/sigframe-ppc64-linux.c index b54c4e0be..fd01ce73d 100644 --- a/coregrind/m_sigframe/sigframe-ppc64-linux.c +++ b/coregrind/m_sigframe/sigframe-ppc64-linux.c @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-riscv64-linux.c b/coregrind/m_sigframe/sigframe-riscv64-linux.c index 8ef05407e..464ac69cd 100644 --- a/coregrind/m_sigframe/sigframe-riscv64-linux.c +++ b/coregrind/m_sigframe/sigframe-riscv64-linux.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-s390x-linux.c b/coregrind/m_sigframe/sigframe-s390x-linux.c index a48899431..d31480351 100644 --- a/coregrind/m_sigframe/sigframe-s390x-linux.c +++ b/coregrind/m_sigframe/sigframe-s390x-linux.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-solaris.c b/coregrind/m_sigframe/sigframe-solaris.c index 1afb277d3..9cb9f9cc2 100644 --- a/coregrind/m_sigframe/sigframe-solaris.c +++ b/coregrind/m_sigframe/sigframe-solaris.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-x86-darwin.c b/coregrind/m_sigframe/sigframe-x86-darwin.c index 9bc821962..89736e726 100644 --- a/coregrind/m_sigframe/sigframe-x86-darwin.c +++ b/coregrind/m_sigframe/sigframe-x86-darwin.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-x86-freebsd.c b/coregrind/m_sigframe/sigframe-x86-freebsd.c index f631ad6f9..73c51fcae 100644 --- a/coregrind/m_sigframe/sigframe-x86-freebsd.c +++ b/coregrind/m_sigframe/sigframe-x86-freebsd.c @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sigframe/sigframe-x86-linux.c b/coregrind/m_sigframe/sigframe-x86-linux.c index 309bae2a7..1a89a15f1 100644 --- a/coregrind/m_sigframe/sigframe-x86-linux.c +++ b/coregrind/m_sigframe/sigframe-x86-linux.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index a51840c0a..a914cd0c2 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_sparsewa.c b/coregrind/m_sparsewa.c index f6a6d461c..a5abd4f59 100644 --- a/coregrind/m_sparsewa.c +++ b/coregrind/m_sparsewa.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_stacks.c b/coregrind/m_stacks.c index 90101496d..821ef3e60 100644 --- a/coregrind/m_stacks.c +++ b/coregrind/m_stacks.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c index d4ee10792..fa2dc0964 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syscall.c b/coregrind/m_syscall.c index 52a35a695..cb3c603f8 100644 --- a/coregrind/m_syscall.c +++ b/coregrind/m_syscall.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h index 4435f8b57..67c3412d3 100644 --- a/coregrind/m_syswrap/priv_syswrap-darwin.h +++ b/coregrind/m_syswrap/priv_syswrap-darwin.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index 8ac3b8e92..6aaa36aba 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/priv_syswrap-generic.h b/coregrind/m_syswrap/priv_syswrap-generic.h index 9dbc1e6f2..a59cdf5ef 100644 --- a/coregrind/m_syswrap/priv_syswrap-generic.h +++ b/coregrind/m_syswrap/priv_syswrap-generic.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/priv_syswrap-linux-variants.h b/coregrind/m_syswrap/priv_syswrap-linux-variants.h index db8770012..483806990 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux-variants.h +++ b/coregrind/m_syswrap/priv_syswrap-linux-variants.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index ca462e896..21cb32829 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/priv_syswrap-main.h b/coregrind/m_syswrap/priv_syswrap-main.h index e1da0a127..8139f9cdd 100644 --- a/coregrind/m_syswrap/priv_syswrap-main.h +++ b/coregrind/m_syswrap/priv_syswrap-main.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/priv_syswrap-solaris.h b/coregrind/m_syswrap/priv_syswrap-solaris.h index c988a6d54..b9af0c3d6 100644 --- a/coregrind/m_syswrap/priv_syswrap-solaris.h +++ b/coregrind/m_syswrap/priv_syswrap-solaris.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/priv_syswrap-xen.h b/coregrind/m_syswrap/priv_syswrap-xen.h index b1d2f485d..d372cea37 100644 --- a/coregrind/m_syswrap/priv_syswrap-xen.h +++ b/coregrind/m_syswrap/priv_syswrap-xen.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/priv_types_n_macros.h b/coregrind/m_syswrap/priv_types_n_macros.h index cc00592ef..0ce26bd33 100644 --- a/coregrind/m_syswrap/priv_types_n_macros.h +++ b/coregrind/m_syswrap/priv_types_n_macros.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-amd64-darwin.S b/coregrind/m_syswrap/syscall-amd64-darwin.S index 5c68d0c4d..9abfd998f 100644 --- a/coregrind/m_syswrap/syscall-amd64-darwin.S +++ b/coregrind/m_syswrap/syscall-amd64-darwin.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-amd64-freebsd.S b/coregrind/m_syswrap/syscall-amd64-freebsd.S index 14cd4ee90..0d25efdcc 100644 --- a/coregrind/m_syswrap/syscall-amd64-freebsd.S +++ b/coregrind/m_syswrap/syscall-amd64-freebsd.S @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-amd64-linux.S b/coregrind/m_syswrap/syscall-amd64-linux.S index 98f060f0b..6448cdbe4 100644 --- a/coregrind/m_syswrap/syscall-amd64-linux.S +++ b/coregrind/m_syswrap/syscall-amd64-linux.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-amd64-solaris.S b/coregrind/m_syswrap/syscall-amd64-solaris.S index 14a7e0c5d..c301e29b3 100644 --- a/coregrind/m_syswrap/syscall-amd64-solaris.S +++ b/coregrind/m_syswrap/syscall-amd64-solaris.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-arm-linux.S b/coregrind/m_syswrap/syscall-arm-linux.S index 12dc9390c..e57180ce4 100644 --- a/coregrind/m_syswrap/syscall-arm-linux.S +++ b/coregrind/m_syswrap/syscall-arm-linux.S @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-arm64-freebsd.S b/coregrind/m_syswrap/syscall-arm64-freebsd.S index 52ba022ba..fb7c68768 100644 --- a/coregrind/m_syswrap/syscall-arm64-freebsd.S +++ b/coregrind/m_syswrap/syscall-arm64-freebsd.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-arm64-linux.S b/coregrind/m_syswrap/syscall-arm64-linux.S index 2e6b72fa6..9ff45c786 100644 --- a/coregrind/m_syswrap/syscall-arm64-linux.S +++ b/coregrind/m_syswrap/syscall-arm64-linux.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-mips32-linux.S b/coregrind/m_syswrap/syscall-mips32-linux.S index 217fa150c..da27cea29 100644 --- a/coregrind/m_syswrap/syscall-mips32-linux.S +++ b/coregrind/m_syswrap/syscall-mips32-linux.S @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-mips64-linux.S b/coregrind/m_syswrap/syscall-mips64-linux.S index bdff39a0b..684aba76b 100644 --- a/coregrind/m_syswrap/syscall-mips64-linux.S +++ b/coregrind/m_syswrap/syscall-mips64-linux.S @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-nanomips-linux.S b/coregrind/m_syswrap/syscall-nanomips-linux.S index 5f00e10a3..7b93fbaaa 100644 --- a/coregrind/m_syswrap/syscall-nanomips-linux.S +++ b/coregrind/m_syswrap/syscall-nanomips-linux.S @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-ppc32-linux.S b/coregrind/m_syswrap/syscall-ppc32-linux.S index af087aaf2..cacf885da 100644 --- a/coregrind/m_syswrap/syscall-ppc32-linux.S +++ b/coregrind/m_syswrap/syscall-ppc32-linux.S @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-ppc64be-linux.S b/coregrind/m_syswrap/syscall-ppc64be-linux.S index a6a2f38b4..cf0e56882 100644 --- a/coregrind/m_syswrap/syscall-ppc64be-linux.S +++ b/coregrind/m_syswrap/syscall-ppc64be-linux.S @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-ppc64le-linux.S b/coregrind/m_syswrap/syscall-ppc64le-linux.S index e416688e3..21a4489c7 100644 --- a/coregrind/m_syswrap/syscall-ppc64le-linux.S +++ b/coregrind/m_syswrap/syscall-ppc64le-linux.S @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-riscv64-linux.S b/coregrind/m_syswrap/syscall-riscv64-linux.S index cf976cee1..6d4c4315c 100644 --- a/coregrind/m_syswrap/syscall-riscv64-linux.S +++ b/coregrind/m_syswrap/syscall-riscv64-linux.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-s390x-linux.S b/coregrind/m_syswrap/syscall-s390x-linux.S index c1cd85bc7..ee583ad73 100644 --- a/coregrind/m_syswrap/syscall-s390x-linux.S +++ b/coregrind/m_syswrap/syscall-s390x-linux.S @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-x86-darwin.S b/coregrind/m_syswrap/syscall-x86-darwin.S index d92ecf15e..393cc8eb7 100644 --- a/coregrind/m_syswrap/syscall-x86-darwin.S +++ b/coregrind/m_syswrap/syscall-x86-darwin.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-x86-freebsd.S b/coregrind/m_syswrap/syscall-x86-freebsd.S index 4ddba2d34..9e69d85be 100644 --- a/coregrind/m_syswrap/syscall-x86-freebsd.S +++ b/coregrind/m_syswrap/syscall-x86-freebsd.S @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-x86-linux.S b/coregrind/m_syswrap/syscall-x86-linux.S index 2820bb9cc..eddabd739 100644 --- a/coregrind/m_syswrap/syscall-x86-linux.S +++ b/coregrind/m_syswrap/syscall-x86-linux.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syscall-x86-solaris.S b/coregrind/m_syswrap/syscall-x86-solaris.S index b94f3479c..48fb5e366 100644 --- a/coregrind/m_syswrap/syscall-x86-solaris.S +++ b/coregrind/m_syswrap/syscall-x86-solaris.S @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-amd64-darwin.c b/coregrind/m_syswrap/syswrap-amd64-darwin.c index b2eb17f77..e6f284c9a 100644 --- a/coregrind/m_syswrap/syswrap-amd64-darwin.c +++ b/coregrind/m_syswrap/syswrap-amd64-darwin.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-amd64-freebsd.c b/coregrind/m_syswrap/syswrap-amd64-freebsd.c index b2fc6114f..3576f64b9 100644 --- a/coregrind/m_syswrap/syswrap-amd64-freebsd.c +++ b/coregrind/m_syswrap/syswrap-amd64-freebsd.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 838bf5e84..234b056e5 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-amd64-solaris.c b/coregrind/m_syswrap/syswrap-amd64-solaris.c index 404cba5a0..657726688 100644 --- a/coregrind/m_syswrap/syswrap-amd64-solaris.c +++ b/coregrind/m_syswrap/syswrap-amd64-solaris.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 1fda7ba8a..26f67b3c8 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-arm64-freebsd.c b/coregrind/m_syswrap/syswrap-arm64-freebsd.c index fe2d16194..29f5455c5 100644 --- a/coregrind/m_syswrap/syswrap-arm64-freebsd.c +++ b/coregrind/m_syswrap/syswrap-arm64-freebsd.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index 175002e6b..418c78443 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index 2e1ba1da8..de8c37fc3 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 2c3bffa1c..dce26ba91 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 0d13cea5e..37f312fe8 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-linux-variants.c b/coregrind/m_syswrap/syswrap-linux-variants.c index 3b0bff162..55d6415e7 100644 --- a/coregrind/m_syswrap/syswrap-linux-variants.c +++ b/coregrind/m_syswrap/syswrap-linux-variants.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 1402c3d1f..341fa96ec 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c index 424d0a08a..c7dbd6b92 100644 --- a/coregrind/m_syswrap/syswrap-main.c +++ b/coregrind/m_syswrap/syswrap-main.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 4edfe8a70..6132c9ff1 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 4fb6f060e..238b1cda0 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index f1a0b3c59..bb20cd7d3 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index b1390f3ab..4d7e43130 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 4a0865084..826c87937 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index 5a1ea2553..78b1b6b42 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index acb4aefee..c16b69731 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c index 519d92d39..2665633f4 100644 --- a/coregrind/m_syswrap/syswrap-solaris.c +++ b/coregrind/m_syswrap/syswrap-solaris.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-x86-darwin.c b/coregrind/m_syswrap/syswrap-x86-darwin.c index 49533e253..7459ef83a 100644 --- a/coregrind/m_syswrap/syswrap-x86-darwin.c +++ b/coregrind/m_syswrap/syswrap-x86-darwin.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-x86-freebsd.c b/coregrind/m_syswrap/syswrap-x86-freebsd.c index 483ca67ec..1bb3d6fed 100644 --- a/coregrind/m_syswrap/syswrap-x86-freebsd.c +++ b/coregrind/m_syswrap/syswrap-x86-freebsd.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index df9b33634..423feac56 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-x86-solaris.c b/coregrind/m_syswrap/syswrap-x86-solaris.c index 59c36c185..629e01981 100644 --- a/coregrind/m_syswrap/syswrap-x86-solaris.c +++ b/coregrind/m_syswrap/syswrap-x86-solaris.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c index 8cb91b57d..e9f844e0d 100644 --- a/coregrind/m_syswrap/syswrap-xen.c +++ b/coregrind/m_syswrap/syswrap-xen.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_threadstate.c b/coregrind/m_threadstate.c index 85ae03569..9b303bd14 100644 --- a/coregrind/m_threadstate.c +++ b/coregrind/m_threadstate.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c index 58aa82ccf..1362cd142 100644 --- a/coregrind/m_tooliface.c +++ b/coregrind/m_tooliface.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S index af25c8f7a..0746fd0f1 100644 --- a/coregrind/m_trampoline.S +++ b/coregrind/m_trampoline.S @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c index 5da88cac7..4f1c287cc 100644 --- a/coregrind/m_translate.c +++ b/coregrind/m_translate.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index cb6c5ad52..2ed62e005 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_ume/elf.c b/coregrind/m_ume/elf.c index 5f2ac1fed..20e0185cb 100644 --- a/coregrind/m_ume/elf.c +++ b/coregrind/m_ume/elf.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_ume/macho.c b/coregrind/m_ume/macho.c index 6d65574e4..ec7257084 100644 --- a/coregrind/m_ume/macho.c +++ b/coregrind/m_ume/macho.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_ume/main.c b/coregrind/m_ume/main.c index 0886b009c..bca641eb2 100644 --- a/coregrind/m_ume/main.c +++ b/coregrind/m_ume/main.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_ume/priv_ume.h b/coregrind/m_ume/priv_ume.h index 3997d30eb..64b01467f 100644 --- a/coregrind/m_ume/priv_ume.h +++ b/coregrind/m_ume/priv_ume.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_ume/script.c b/coregrind/m_ume/script.c index fe83e7360..dfeb16a9e 100644 --- a/coregrind/m_ume/script.c +++ b/coregrind/m_ume/script.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_vki.c b/coregrind/m_vki.c index 0cc1882a1..d10c31295 100644 --- a/coregrind/m_vki.c +++ b/coregrind/m_vki.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_vkiscnums.c b/coregrind/m_vkiscnums.c index 76ae104af..83bc622ab 100644 --- a/coregrind/m_vkiscnums.c +++ b/coregrind/m_vkiscnums.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_wordfm.c b/coregrind/m_wordfm.c index 07fdec908..945297a42 100644 --- a/coregrind/m_wordfm.c +++ b/coregrind/m_wordfm.c @@ -33,7 +33,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_xarray.c b/coregrind/m_xarray.c index d9baab30a..1b07039e3 100644 --- a/coregrind/m_xarray.c +++ b/coregrind/m_xarray.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_xtmemory.c b/coregrind/m_xtmemory.c index ef68ae9d7..a6e6ceb6a 100644 --- a/coregrind/m_xtmemory.c +++ b/coregrind/m_xtmemory.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/m_xtree.c b/coregrind/m_xtree.c index 16635ebb6..e20e7e903 100644 --- a/coregrind/m_xtree.c +++ b/coregrind/m_xtree.c @@ -20,7 +20,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_addrinfo.h b/coregrind/pub_core_addrinfo.h index 392c2d5bb..bb6cfb495 100644 --- a/coregrind/pub_core_addrinfo.h +++ b/coregrind/pub_core_addrinfo.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_aspacehl.h b/coregrind/pub_core_aspacehl.h index db7c9fc75..9a4185158 100644 --- a/coregrind/pub_core_aspacehl.h +++ b/coregrind/pub_core_aspacehl.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_aspacemgr.h b/coregrind/pub_core_aspacemgr.h index 56c5b8dd1..070fa5495 100644 --- a/coregrind/pub_core_aspacemgr.h +++ b/coregrind/pub_core_aspacemgr.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_basics.h b/coregrind/pub_core_basics.h index 353e69ce8..a46464319 100644 --- a/coregrind/pub_core_basics.h +++ b/coregrind/pub_core_basics.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_basics_asm.h b/coregrind/pub_core_basics_asm.h index 405416fb1..511382a8c 100644 --- a/coregrind/pub_core_basics_asm.h +++ b/coregrind/pub_core_basics_asm.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_clientstate.h b/coregrind/pub_core_clientstate.h index 06d0fe343..573de81ce 100644 --- a/coregrind/pub_core_clientstate.h +++ b/coregrind/pub_core_clientstate.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_clreq.h b/coregrind/pub_core_clreq.h index 23b402a09..e2c83a1f1 100644 --- a/coregrind/pub_core_clreq.h +++ b/coregrind/pub_core_clreq.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_commandline.h b/coregrind/pub_core_commandline.h index 1af0bbdba..0daf7127f 100644 --- a/coregrind/pub_core_commandline.h +++ b/coregrind/pub_core_commandline.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_coredump.h b/coregrind/pub_core_coredump.h index b302c1755..316f94937 100644 --- a/coregrind/pub_core_coredump.h +++ b/coregrind/pub_core_coredump.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_cpuid.h b/coregrind/pub_core_cpuid.h index 794b9a988..4a01d1a28 100644 --- a/coregrind/pub_core_cpuid.h +++ b/coregrind/pub_core_cpuid.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_debuginfo.h b/coregrind/pub_core_debuginfo.h index 08579e6f0..ad484c4c2 100644 --- a/coregrind/pub_core_debuginfo.h +++ b/coregrind/pub_core_debuginfo.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_debuglog.h b/coregrind/pub_core_debuglog.h index 17547216a..cd6dc9aa5 100644 --- a/coregrind/pub_core_debuglog.h +++ b/coregrind/pub_core_debuglog.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_deduppoolalloc.h b/coregrind/pub_core_deduppoolalloc.h index dde76bf59..3b3e31b30 100644 --- a/coregrind/pub_core_deduppoolalloc.h +++ b/coregrind/pub_core_deduppoolalloc.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_demangle.h b/coregrind/pub_core_demangle.h index 1532251b2..29dc301c7 100644 --- a/coregrind/pub_core_demangle.h +++ b/coregrind/pub_core_demangle.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_dispatch.h b/coregrind/pub_core_dispatch.h index 3ad66fcee..368f2bc57 100644 --- a/coregrind/pub_core_dispatch.h +++ b/coregrind/pub_core_dispatch.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_dispatch_asm.h b/coregrind/pub_core_dispatch_asm.h index db19f0370..ac63bc324 100644 --- a/coregrind/pub_core_dispatch_asm.h +++ b/coregrind/pub_core_dispatch_asm.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_errormgr.h b/coregrind/pub_core_errormgr.h index d4bf2e7a8..94e993e7a 100644 --- a/coregrind/pub_core_errormgr.h +++ b/coregrind/pub_core_errormgr.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_execontext.h b/coregrind/pub_core_execontext.h index 7fe8575fe..352d69d77 100644 --- a/coregrind/pub_core_execontext.h +++ b/coregrind/pub_core_execontext.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_extension.h b/coregrind/pub_core_extension.h index 39fa4dd8b..80ad7941e 100644 --- a/coregrind/pub_core_extension.h +++ b/coregrind/pub_core_extension.h @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_gdbserver.h b/coregrind/pub_core_gdbserver.h index 844337f9d..b7eb1b082 100644 --- a/coregrind/pub_core_gdbserver.h +++ b/coregrind/pub_core_gdbserver.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_guest.h b/coregrind/pub_core_guest.h index 0da9bc4b0..da035edac 100644 --- a/coregrind/pub_core_guest.h +++ b/coregrind/pub_core_guest.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_hashtable.h b/coregrind/pub_core_hashtable.h index 512538956..5bb81831c 100644 --- a/coregrind/pub_core_hashtable.h +++ b/coregrind/pub_core_hashtable.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_initimg.h b/coregrind/pub_core_initimg.h index cfbd41f8b..40ef71d04 100644 --- a/coregrind/pub_core_initimg.h +++ b/coregrind/pub_core_initimg.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_inner.h b/coregrind/pub_core_inner.h index 6632f58f3..4120712b9 100644 --- a/coregrind/pub_core_inner.h +++ b/coregrind/pub_core_inner.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_libcassert.h b/coregrind/pub_core_libcassert.h index 619c570ac..cc9d5a9fd 100644 --- a/coregrind/pub_core_libcassert.h +++ b/coregrind/pub_core_libcassert.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_libcbase.h b/coregrind/pub_core_libcbase.h index fdeada471..53b665c90 100644 --- a/coregrind/pub_core_libcbase.h +++ b/coregrind/pub_core_libcbase.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_libcfile.h b/coregrind/pub_core_libcfile.h index 8411ad368..ac585986d 100644 --- a/coregrind/pub_core_libcfile.h +++ b/coregrind/pub_core_libcfile.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_libcprint.h b/coregrind/pub_core_libcprint.h index 7d5c0d416..e21a2ac40 100644 --- a/coregrind/pub_core_libcprint.h +++ b/coregrind/pub_core_libcprint.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_libcproc.h b/coregrind/pub_core_libcproc.h index 488aaf0ca..9391898af 100644 --- a/coregrind/pub_core_libcproc.h +++ b/coregrind/pub_core_libcproc.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_libcsetjmp.h b/coregrind/pub_core_libcsetjmp.h index ed8e323ba..bf04fb8ab 100644 --- a/coregrind/pub_core_libcsetjmp.h +++ b/coregrind/pub_core_libcsetjmp.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_libcsignal.h b/coregrind/pub_core_libcsignal.h index 312bae2f5..394effb47 100644 --- a/coregrind/pub_core_libcsignal.h +++ b/coregrind/pub_core_libcsignal.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_mach.h b/coregrind/pub_core_mach.h index d85ab6854..8ab46417a 100644 --- a/coregrind/pub_core_mach.h +++ b/coregrind/pub_core_mach.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_machine.h b/coregrind/pub_core_machine.h index 555506a03..b9f2d0102 100644 --- a/coregrind/pub_core_machine.h +++ b/coregrind/pub_core_machine.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_mallocfree.h b/coregrind/pub_core_mallocfree.h index 1ab3a9f08..6276fda3a 100644 --- a/coregrind/pub_core_mallocfree.h +++ b/coregrind/pub_core_mallocfree.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_options.h b/coregrind/pub_core_options.h index d8bc4736d..6462ae90c 100644 --- a/coregrind/pub_core_options.h +++ b/coregrind/pub_core_options.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_oset.h b/coregrind/pub_core_oset.h index 858c78dc5..8a5824f02 100644 --- a/coregrind/pub_core_oset.h +++ b/coregrind/pub_core_oset.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_pathscan.h b/coregrind/pub_core_pathscan.h index 8c89fe37f..0c4aa513c 100644 --- a/coregrind/pub_core_pathscan.h +++ b/coregrind/pub_core_pathscan.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_poolalloc.h b/coregrind/pub_core_poolalloc.h index 25bb5ad7b..f67e3debe 100644 --- a/coregrind/pub_core_poolalloc.h +++ b/coregrind/pub_core_poolalloc.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_rangemap.h b/coregrind/pub_core_rangemap.h index f680816ee..463dfa82f 100644 --- a/coregrind/pub_core_rangemap.h +++ b/coregrind/pub_core_rangemap.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_redir.h b/coregrind/pub_core_redir.h index 0cf0b009e..2ffcd21ff 100644 --- a/coregrind/pub_core_redir.h +++ b/coregrind/pub_core_redir.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_replacemalloc.h b/coregrind/pub_core_replacemalloc.h index 0c81e7c55..cd4969b48 100644 --- a/coregrind/pub_core_replacemalloc.h +++ b/coregrind/pub_core_replacemalloc.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_sbprofile.h b/coregrind/pub_core_sbprofile.h index 387da6b30..b7579c3cc 100644 --- a/coregrind/pub_core_sbprofile.h +++ b/coregrind/pub_core_sbprofile.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_scheduler.h b/coregrind/pub_core_scheduler.h index d74eb0629..ed234f676 100644 --- a/coregrind/pub_core_scheduler.h +++ b/coregrind/pub_core_scheduler.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_seqmatch.h b/coregrind/pub_core_seqmatch.h index 1ededd28c..9d9059da3 100644 --- a/coregrind/pub_core_seqmatch.h +++ b/coregrind/pub_core_seqmatch.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_sigframe.h b/coregrind/pub_core_sigframe.h index 1b8caeb69..5680eee2a 100644 --- a/coregrind/pub_core_sigframe.h +++ b/coregrind/pub_core_sigframe.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_signals.h b/coregrind/pub_core_signals.h index ae8555ba8..a27240490 100644 --- a/coregrind/pub_core_signals.h +++ b/coregrind/pub_core_signals.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_sparsewa.h b/coregrind/pub_core_sparsewa.h index 1a230ce28..2cdc0b1ec 100644 --- a/coregrind/pub_core_sparsewa.h +++ b/coregrind/pub_core_sparsewa.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_stacks.h b/coregrind/pub_core_stacks.h index ec1bc51e9..a360a16a7 100644 --- a/coregrind/pub_core_stacks.h +++ b/coregrind/pub_core_stacks.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_stacktrace.h b/coregrind/pub_core_stacktrace.h index 436702e4d..203e1c44b 100644 --- a/coregrind/pub_core_stacktrace.h +++ b/coregrind/pub_core_stacktrace.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_syscall.h b/coregrind/pub_core_syscall.h index e1e066fcc..f8a5c3a41 100644 --- a/coregrind/pub_core_syscall.h +++ b/coregrind/pub_core_syscall.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_syswrap.h b/coregrind/pub_core_syswrap.h index d30dc90cf..0b6fa5d74 100644 --- a/coregrind/pub_core_syswrap.h +++ b/coregrind/pub_core_syswrap.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_threadstate.h b/coregrind/pub_core_threadstate.h index ae7cf6312..e4b2c3938 100644 --- a/coregrind/pub_core_threadstate.h +++ b/coregrind/pub_core_threadstate.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h index 492c06818..069e60360 100644 --- a/coregrind/pub_core_tooliface.h +++ b/coregrind/pub_core_tooliface.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h index 92b4fc67b..2ca144211 100644 --- a/coregrind/pub_core_trampoline.h +++ b/coregrind/pub_core_trampoline.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_translate.h b/coregrind/pub_core_translate.h index 6242a84b1..d66ec423f 100644 --- a/coregrind/pub_core_translate.h +++ b/coregrind/pub_core_translate.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_transtab.h b/coregrind/pub_core_transtab.h index cc70a2944..f151df988 100644 --- a/coregrind/pub_core_transtab.h +++ b/coregrind/pub_core_transtab.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_transtab_asm.h b/coregrind/pub_core_transtab_asm.h index c14e24ebf..19f57272d 100644 --- a/coregrind/pub_core_transtab_asm.h +++ b/coregrind/pub_core_transtab_asm.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_ume.h b/coregrind/pub_core_ume.h index d6230fff7..45626ebdd 100644 --- a/coregrind/pub_core_ume.h +++ b/coregrind/pub_core_ume.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_vki.h b/coregrind/pub_core_vki.h index 23ea92b7e..db85ffb3b 100644 --- a/coregrind/pub_core_vki.h +++ b/coregrind/pub_core_vki.h @@ -17,7 +17,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_vkiscnums.h b/coregrind/pub_core_vkiscnums.h index ff94c626a..9e1de3787 100644 --- a/coregrind/pub_core_vkiscnums.h +++ b/coregrind/pub_core_vkiscnums.h @@ -16,7 +16,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_vkiscnums_asm.h b/coregrind/pub_core_vkiscnums_asm.h index a4e162cdd..830560d0c 100644 --- a/coregrind/pub_core_vkiscnums_asm.h +++ b/coregrind/pub_core_vkiscnums_asm.h @@ -16,7 +16,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_wordfm.h b/coregrind/pub_core_wordfm.h index f51dfabd9..c09ee2ad7 100644 --- a/coregrind/pub_core_wordfm.h +++ b/coregrind/pub_core_wordfm.h @@ -33,7 +33,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_xarray.h b/coregrind/pub_core_xarray.h index 5069e0e88..9b714b8b2 100644 --- a/coregrind/pub_core_xarray.h +++ b/coregrind/pub_core_xarray.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_xtmemory.h b/coregrind/pub_core_xtmemory.h index f389ed8bd..7861c42ab 100644 --- a/coregrind/pub_core_xtmemory.h +++ b/coregrind/pub_core_xtmemory.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/pub_core_xtree.h b/coregrind/pub_core_xtree.h index 27b234efb..8b1c314e2 100644 --- a/coregrind/pub_core_xtree.h +++ b/coregrind/pub_core_xtree.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c index e4c2dbc21..0b77e0537 100644 --- a/coregrind/vg_preloaded.c +++ b/coregrind/vg_preloaded.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/vgdb-invoker-freebsd.c b/coregrind/vgdb-invoker-freebsd.c index 4a89fb37d..ec42ab23a 100644 --- a/coregrind/vgdb-invoker-freebsd.c +++ b/coregrind/vgdb-invoker-freebsd.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/vgdb-invoker-none.c b/coregrind/vgdb-invoker-none.c index 561638df9..5ae5e22fd 100644 --- a/coregrind/vgdb-invoker-none.c +++ b/coregrind/vgdb-invoker-none.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/vgdb-invoker-ptrace.c b/coregrind/vgdb-invoker-ptrace.c index a6df5dc07..d463553ce 100644 --- a/coregrind/vgdb-invoker-ptrace.c +++ b/coregrind/vgdb-invoker-ptrace.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/vgdb-invoker-solaris.c b/coregrind/vgdb-invoker-solaris.c index ac95bdb85..f33376799 100644 --- a/coregrind/vgdb-invoker-solaris.c +++ b/coregrind/vgdb-invoker-solaris.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c index cc0be240b..c635f94b5 100644 --- a/coregrind/vgdb.c +++ b/coregrind/vgdb.c @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/coregrind/vgdb.h b/coregrind/vgdb.h index 03553296b..2a0d4a845 100644 --- a/coregrind/vgdb.h +++ b/coregrind/vgdb.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/dhat/dh_main.c b/dhat/dh_main.c index 9e6ec1c06..238d1c967 100644 --- a/dhat/dh_main.c +++ b/dhat/dh_main.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/dhat/dh_replace_strmem.c b/dhat/dh_replace_strmem.c index 13c3f6c5e..332a70bd8 100644 --- a/dhat/dh_replace_strmem.c +++ b/dhat/dh_replace_strmem.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/dhat/dh_test.js b/dhat/dh_test.js index ee88e7b72..0f824441e 100644 --- a/dhat/dh_test.js +++ b/dhat/dh_test.js @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/dhat/dh_view.css b/dhat/dh_view.css index 235fcbf4b..34b1e1518 100644 --- a/dhat/dh_view.css +++ b/dhat/dh_view.css @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/dhat/dh_view.js b/dhat/dh_view.js index ffdea9303..312f30743 100644 --- a/dhat/dh_view.js +++ b/dhat/dh_view.js @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/dhat/dhat.h b/dhat/dhat.h index 97e1ade8f..adf51e33b 100644 --- a/dhat/dhat.h +++ b/dhat/dhat.h @@ -4,7 +4,7 @@ Notice that the following BSD-style license applies to this one file (dhat.h) only. The rest of Valgrind is licensed under the - terms of the GNU General Public License, version 2, unless + terms of the GNU General Public License, version 3, unless otherwise indicated. See the COPYING file in the source distribution for details. @@ -50,7 +50,7 @@ Notice that the above BSD-style license applies to this one file (memcheck.h) only. The entire rest of Valgrind is licensed under - the terms of the GNU General Public License, version 2. See the + the terms of the GNU General Public License, version 3. See the COPYING file in the source distribution for details. ---------------------------------------------------------------- diff --git a/docs/xml/manual-intro.xml b/docs/xml/manual-intro.xml index 5f84671fd..9fa78f072 100644 --- a/docs/xml/manual-intro.xml +++ b/docs/xml/manual-intro.xml @@ -85,7 +85,7 @@ install process; full details are given in the README file in the distribution. Valgrind is licensed under the , -version 2. The valgrind/*.h headers +version 3. The valgrind/*.h headers that you may wish to include in your code (eg. valgrind.h, memcheck.h, helgrind.h, etc.) are @@ -97,9 +97,9 @@ Farrell, ISBN 1-56592-115-1, published by O'Reilly & Associates, Inc. If you contribute code to Valgrind, please ensure your -contributions are licensed as "GPLv2, or (at your option) any later +contributions are licensed as "GPLv3, or (at your option) any later version." This is so as to allow the possibility of easily upgrading -the license to GPLv3 in future. If you want to modify code in the VEX +the license to a future version. If you want to modify code in the VEX subdirectory, please also see the file VEX/HACKING.README in the distribution. diff --git a/drd/drd.h b/drd/drd.h index 88a5c6e9b..679954e53 100644 --- a/drd/drd.h +++ b/drd/drd.h @@ -3,7 +3,7 @@ Notice that the following BSD-style license applies to this one file (drd.h) only. The rest of Valgrind is licensed under the - terms of the GNU General Public License, version 2, unless + terms of the GNU General Public License, version 3, unless otherwise indicated. See the COPYING file in the source distribution for details. @@ -50,7 +50,7 @@ Notice that the above BSD-style license applies to this one file (drd.h) only. The entire rest of Valgrind is licensed under - the terms of the GNU General Public License, version 2. See the + the terms of the GNU General Public License, version 3. See the COPYING file in the source distribution for details. ---------------------------------------------------------------- diff --git a/drd/drd_barrier.c b/drd/drd_barrier.c index 0d6d2136a..c4387bb9c 100644 --- a/drd/drd_barrier.c +++ b/drd/drd_barrier.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_barrier.h b/drd/drd_barrier.h index c8cda80b6..96582dadc 100644 --- a/drd/drd_barrier.h +++ b/drd/drd_barrier.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_basics.h b/drd/drd_basics.h index f1e2001c7..702d3aacd 100644 --- a/drd/drd_basics.h +++ b/drd/drd_basics.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_bitmap.c b/drd/drd_bitmap.c index 3bd7fa56b..b6b88a895 100644 --- a/drd/drd_bitmap.c +++ b/drd/drd_bitmap.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_bitmap.h b/drd/drd_bitmap.h index fa1506ed4..b01c80855 100644 --- a/drd/drd_bitmap.h +++ b/drd/drd_bitmap.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_clientobj.c b/drd/drd_clientobj.c index 4815f712f..c257bf17e 100644 --- a/drd/drd_clientobj.c +++ b/drd/drd_clientobj.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_clientobj.h b/drd/drd_clientobj.h index 5a99f1e37..a3cd197bd 100644 --- a/drd/drd_clientobj.h +++ b/drd/drd_clientobj.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_clientreq.c b/drd/drd_clientreq.c index 914d9a348..e526a6bce 100644 --- a/drd/drd_clientreq.c +++ b/drd/drd_clientreq.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_clientreq.h b/drd/drd_clientreq.h index e87927d0d..1c437a4e6 100644 --- a/drd/drd_clientreq.h +++ b/drd/drd_clientreq.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_cond.c b/drd/drd_cond.c index 0e35eb140..ff6811097 100644 --- a/drd/drd_cond.c +++ b/drd/drd_cond.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_cond.h b/drd/drd_cond.h index c41b5935b..386fdac3d 100644 --- a/drd/drd_cond.h +++ b/drd/drd_cond.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_darwin_intercepts.c b/drd/drd_darwin_intercepts.c index 9b082173a..b18defaf0 100644 --- a/drd/drd_darwin_intercepts.c +++ b/drd/drd_darwin_intercepts.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_error.c b/drd/drd_error.c index d7928f9b7..82333439c 100644 --- a/drd/drd_error.c +++ b/drd/drd_error.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_error.h b/drd/drd_error.h index 742cd43a0..87f2a8c12 100644 --- a/drd/drd_error.h +++ b/drd/drd_error.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_hb.c b/drd/drd_hb.c index 120bca2a7..c4efa0fb4 100644 --- a/drd/drd_hb.c +++ b/drd/drd_hb.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_hb.h b/drd/drd_hb.h index 8ac6f7d9a..e7dfe97ab 100644 --- a/drd/drd_hb.h +++ b/drd/drd_hb.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_libstdcxx_intercepts.c b/drd/drd_libstdcxx_intercepts.c index 18c7cd122..3120cf609 100644 --- a/drd/drd_libstdcxx_intercepts.c +++ b/drd/drd_libstdcxx_intercepts.c @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_load_store.c b/drd/drd_load_store.c index a6fb874bf..968ec885e 100644 --- a/drd/drd_load_store.c +++ b/drd/drd_load_store.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_load_store.h b/drd/drd_load_store.h index 1bd7eccec..241002ba4 100644 --- a/drd/drd_load_store.h +++ b/drd/drd_load_store.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_main.c b/drd/drd_main.c index 1f2ffc2a3..455685a06 100644 --- a/drd/drd_main.c +++ b/drd/drd_main.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_malloc_wrappers.c b/drd/drd_malloc_wrappers.c index 72e906181..682ba08a5 100644 --- a/drd/drd_malloc_wrappers.c +++ b/drd/drd_malloc_wrappers.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_malloc_wrappers.h b/drd/drd_malloc_wrappers.h index 31fd9946c..11ceb7420 100644 --- a/drd/drd_malloc_wrappers.h +++ b/drd/drd_malloc_wrappers.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_mutex.c b/drd/drd_mutex.c index 34d8c8260..6ba57a96f 100644 --- a/drd/drd_mutex.c +++ b/drd/drd_mutex.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_mutex.h b/drd/drd_mutex.h index 624b1d44a..e16715f20 100644 --- a/drd/drd_mutex.h +++ b/drd/drd_mutex.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c index 73b802efc..0cd7c0be6 100644 --- a/drd/drd_pthread_intercepts.c +++ b/drd/drd_pthread_intercepts.c @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_qtcore_intercepts.c b/drd/drd_qtcore_intercepts.c index 31bde9fd4..cb4e8dab6 100644 --- a/drd/drd_qtcore_intercepts.c +++ b/drd/drd_qtcore_intercepts.c @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_rwlock.c b/drd/drd_rwlock.c index e5f845721..46a6b5517 100644 --- a/drd/drd_rwlock.c +++ b/drd/drd_rwlock.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_rwlock.h b/drd/drd_rwlock.h index c36eac44a..885e0daac 100644 --- a/drd/drd_rwlock.h +++ b/drd/drd_rwlock.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_segment.c b/drd/drd_segment.c index 2674914d0..0ebb0c673 100644 --- a/drd/drd_segment.c +++ b/drd/drd_segment.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_segment.h b/drd/drd_segment.h index 377b1bab8..d9a551d16 100644 --- a/drd/drd_segment.h +++ b/drd/drd_segment.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_semaphore.c b/drd/drd_semaphore.c index 7984c7630..9f79b2ee6 100644 --- a/drd/drd_semaphore.c +++ b/drd/drd_semaphore.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_semaphore.h b/drd/drd_semaphore.h index 46eed0578..bf2ca566b 100644 --- a/drd/drd_semaphore.h +++ b/drd/drd_semaphore.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_strmem_intercepts.c b/drd/drd_strmem_intercepts.c index ba82014df..e37377ffc 100644 --- a/drd/drd_strmem_intercepts.c +++ b/drd/drd_strmem_intercepts.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_suppression.c b/drd/drd_suppression.c index 8688bec97..b13cc600a 100644 --- a/drd/drd_suppression.c +++ b/drd/drd_suppression.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_thread.c b/drd/drd_thread.c index 891967b03..745eaeb26 100644 --- a/drd/drd_thread.c +++ b/drd/drd_thread.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_thread.h b/drd/drd_thread.h index 0f7d78373..e6dcc00f3 100644 --- a/drd/drd_thread.h +++ b/drd/drd_thread.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_thread_bitmap.h b/drd/drd_thread_bitmap.h index 2c7b0a91e..e69201f47 100644 --- a/drd/drd_thread_bitmap.h +++ b/drd/drd_thread_bitmap.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_vc.c b/drd/drd_vc.c index 5705391f2..c8f6cec84 100644 --- a/drd/drd_vc.c +++ b/drd/drd_vc.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/drd_vc.h b/drd/drd_vc.h index 0161be0f2..08c544af9 100644 --- a/drd/drd_vc.h +++ b/drd/drd_vc.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/pub_drd_bitmap.h b/drd/pub_drd_bitmap.h index 4c5c1b6e5..fb9d14ae1 100644 --- a/drd/pub_drd_bitmap.h +++ b/drd/pub_drd_bitmap.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/tests/monitor_example.cpp b/drd/tests/monitor_example.cpp index 3237d16b9..db11d45fd 100644 --- a/drd/tests/monitor_example.cpp +++ b/drd/tests/monitor_example.cpp @@ -7,7 +7,7 @@ Notice that the following BSD-style license applies to this one file (monitor_example.cpp) only. The rest of Valgrind is licensed - under the terms of the GNU General Public License, version 2, + under the terms of the GNU General Public License, version 3, unless otherwise indicated. See the COPYING file in the source distribution for details. @@ -53,7 +53,7 @@ Notice that the above BSD-style license applies to this one file (monitor_example.cpp) only. The rest of Valgrind is licensed - under the terms of the GNU General Public License, version 2, + under the terms of the GNU General Public License, version 3, unless otherwise indicated. See the COPYING file in the source distribution for details. diff --git a/drd/tests/tsan_thread_wrappers_pthread.h b/drd/tests/tsan_thread_wrappers_pthread.h index e022e5dec..24a29b8d5 100644 --- a/drd/tests/tsan_thread_wrappers_pthread.h +++ b/drd/tests/tsan_thread_wrappers_pthread.h @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/drd/tests/tsan_unittest.cpp b/drd/tests/tsan_unittest.cpp index ab4274051..95cbb7ec9 100644 --- a/drd/tests/tsan_unittest.cpp +++ b/drd/tests/tsan_unittest.cpp @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/exp-bbv/bbv_main.c b/exp-bbv/bbv_main.c index e632ea11f..c7efd8b62 100644 --- a/exp-bbv/bbv_main.c +++ b/exp-bbv/bbv_main.c @@ -16,7 +16,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/helgrind.h b/helgrind/helgrind.h index d6fa1f491..afc2649c0 100644 --- a/helgrind/helgrind.h +++ b/helgrind/helgrind.h @@ -3,7 +3,7 @@ Notice that the above BSD-style license applies to this one file (helgrind.h) only. The entire rest of Valgrind is licensed under - the terms of the GNU General Public License, version 2. See the + the terms of the GNU General Public License, version 3. See the COPYING file in the source distribution for details. ---------------------------------------------------------------- @@ -49,7 +49,7 @@ Notice that the above BSD-style license applies to this one file (helgrind.h) only. The entire rest of Valgrind is licensed under - the terms of the GNU General Public License, version 2. See the + the terms of the GNU General Public License, version 3. See the COPYING file in the source distribution for details. ---------------------------------------------------------------- diff --git a/helgrind/hg_addrdescr.c b/helgrind/hg_addrdescr.c index c13ad07e2..8c4558472 100644 --- a/helgrind/hg_addrdescr.c +++ b/helgrind/hg_addrdescr.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/hg_addrdescr.h b/helgrind/hg_addrdescr.h index 18d370d74..f859617e2 100644 --- a/helgrind/hg_addrdescr.h +++ b/helgrind/hg_addrdescr.h @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/hg_basics.c b/helgrind/hg_basics.c index 64e4470df..1487d6b53 100644 --- a/helgrind/hg_basics.c +++ b/helgrind/hg_basics.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/hg_basics.h b/helgrind/hg_basics.h index 534866b2f..d62b47af7 100644 --- a/helgrind/hg_basics.h +++ b/helgrind/hg_basics.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/hg_errors.c b/helgrind/hg_errors.c index 638739dc6..961513cca 100644 --- a/helgrind/hg_errors.c +++ b/helgrind/hg_errors.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/hg_errors.h b/helgrind/hg_errors.h index 5824151c9..a6b6a8530 100644 --- a/helgrind/hg_errors.h +++ b/helgrind/hg_errors.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c index b1082cd4b..4bef0ab95 100644 --- a/helgrind/hg_intercepts.c +++ b/helgrind/hg_intercepts.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/hg_lock_n_thread.c b/helgrind/hg_lock_n_thread.c index f874e1def..00e1b46b5 100644 --- a/helgrind/hg_lock_n_thread.c +++ b/helgrind/hg_lock_n_thread.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/hg_lock_n_thread.h b/helgrind/hg_lock_n_thread.h index 956fbdd8f..fc13c14e2 100644 --- a/helgrind/hg_lock_n_thread.h +++ b/helgrind/hg_lock_n_thread.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index 135c4d3b9..3f81a9d25 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/hg_wordset.c b/helgrind/hg_wordset.c index ac4a70019..917947141 100644 --- a/helgrind/hg_wordset.c +++ b/helgrind/hg_wordset.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/hg_wordset.h b/helgrind/hg_wordset.h index c7264b8d3..6a3131a98 100644 --- a/helgrind/hg_wordset.h +++ b/helgrind/hg_wordset.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/libhb.h b/helgrind/libhb.h index a6005ade0..53e41c0d5 100644 --- a/helgrind/libhb.h +++ b/helgrind/libhb.h @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/helgrind/libhb_core.c b/helgrind/libhb_core.c index 0a084dd60..302028ace 100644 --- a/helgrind/libhb_core.c +++ b/helgrind/libhb_core.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_addrinfo.h b/include/pub_tool_addrinfo.h index e168500f1..98745349d 100644 --- a/include/pub_tool_addrinfo.h +++ b/include/pub_tool_addrinfo.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_aspacehl.h b/include/pub_tool_aspacehl.h index 8f6fe8a79..1ea594bdd 100644 --- a/include/pub_tool_aspacehl.h +++ b/include/pub_tool_aspacehl.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_aspacemgr.h b/include/pub_tool_aspacemgr.h index 479a71d9f..2f4775d6e 100644 --- a/include/pub_tool_aspacemgr.h +++ b/include/pub_tool_aspacemgr.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_basics.h b/include/pub_tool_basics.h index 155454bff..ddf3cce3c 100644 --- a/include/pub_tool_basics.h +++ b/include/pub_tool_basics.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_basics_asm.h b/include/pub_tool_basics_asm.h index 99f2ab18e..b0b010abc 100644 --- a/include/pub_tool_basics_asm.h +++ b/include/pub_tool_basics_asm.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_clientstate.h b/include/pub_tool_clientstate.h index 5670838cd..b9fe8df24 100644 --- a/include/pub_tool_clientstate.h +++ b/include/pub_tool_clientstate.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_clreq.h b/include/pub_tool_clreq.h index 5ae18192c..9b41ec936 100644 --- a/include/pub_tool_clreq.h +++ b/include/pub_tool_clreq.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_debuginfo.h b/include/pub_tool_debuginfo.h index bd0395695..08ea5368c 100644 --- a/include/pub_tool_debuginfo.h +++ b/include/pub_tool_debuginfo.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_deduppoolalloc.h b/include/pub_tool_deduppoolalloc.h index 6e6c17ad5..e92d51421 100644 --- a/include/pub_tool_deduppoolalloc.h +++ b/include/pub_tool_deduppoolalloc.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_errormgr.h b/include/pub_tool_errormgr.h index 668afa950..8130d712a 100644 --- a/include/pub_tool_errormgr.h +++ b/include/pub_tool_errormgr.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_execontext.h b/include/pub_tool_execontext.h index 98c29b7e8..4f5d04ff8 100644 --- a/include/pub_tool_execontext.h +++ b/include/pub_tool_execontext.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_gdbserver.h b/include/pub_tool_gdbserver.h index bf03add07..c60905ea4 100644 --- a/include/pub_tool_gdbserver.h +++ b/include/pub_tool_gdbserver.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_guest.h b/include/pub_tool_guest.h index 9e5c0c24a..c206e5e60 100644 --- a/include/pub_tool_guest.h +++ b/include/pub_tool_guest.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_hashtable.h b/include/pub_tool_hashtable.h index 69d4148e4..bf7fe42e2 100644 --- a/include/pub_tool_hashtable.h +++ b/include/pub_tool_hashtable.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_libcassert.h b/include/pub_tool_libcassert.h index a2ba8635a..a469214ba 100644 --- a/include/pub_tool_libcassert.h +++ b/include/pub_tool_libcassert.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_libcbase.h b/include/pub_tool_libcbase.h index b71066e25..7fb7bf04d 100644 --- a/include/pub_tool_libcbase.h +++ b/include/pub_tool_libcbase.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_libcfile.h b/include/pub_tool_libcfile.h index 5b912d31c..780510581 100644 --- a/include/pub_tool_libcfile.h +++ b/include/pub_tool_libcfile.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_libcprint.h b/include/pub_tool_libcprint.h index 52c0f5764..0e8712935 100644 --- a/include/pub_tool_libcprint.h +++ b/include/pub_tool_libcprint.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_libcproc.h b/include/pub_tool_libcproc.h index 49c10dae2..c53285ec2 100644 --- a/include/pub_tool_libcproc.h +++ b/include/pub_tool_libcproc.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_libcsetjmp.h b/include/pub_tool_libcsetjmp.h index e9638c3d0..97c509ca1 100644 --- a/include/pub_tool_libcsetjmp.h +++ b/include/pub_tool_libcsetjmp.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_libcsignal.h b/include/pub_tool_libcsignal.h index 8a772dec6..abae53c11 100644 --- a/include/pub_tool_libcsignal.h +++ b/include/pub_tool_libcsignal.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_machine.h b/include/pub_tool_machine.h index 933dc8e12..c3d55efcb 100644 --- a/include/pub_tool_machine.h +++ b/include/pub_tool_machine.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_mallocfree.h b/include/pub_tool_mallocfree.h index ef7096ede..7861ffa7a 100644 --- a/include/pub_tool_mallocfree.h +++ b/include/pub_tool_mallocfree.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_options.h b/include/pub_tool_options.h index 021f888be..809fe0eb6 100644 --- a/include/pub_tool_options.h +++ b/include/pub_tool_options.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_oset.h b/include/pub_tool_oset.h index 346539612..311df204d 100644 --- a/include/pub_tool_oset.h +++ b/include/pub_tool_oset.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_poolalloc.h b/include/pub_tool_poolalloc.h index b4dd3a67c..60bb575a6 100644 --- a/include/pub_tool_poolalloc.h +++ b/include/pub_tool_poolalloc.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_rangemap.h b/include/pub_tool_rangemap.h index 02e125147..f6bed2691 100644 --- a/include/pub_tool_rangemap.h +++ b/include/pub_tool_rangemap.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_redir.h b/include/pub_tool_redir.h index 788db2129..c19fd3d97 100644 --- a/include/pub_tool_redir.h +++ b/include/pub_tool_redir.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_replacemalloc.h b/include/pub_tool_replacemalloc.h index 914f9a823..a118f1867 100644 --- a/include/pub_tool_replacemalloc.h +++ b/include/pub_tool_replacemalloc.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_seqmatch.h b/include/pub_tool_seqmatch.h index d3302ddb7..a4204d1a4 100644 --- a/include/pub_tool_seqmatch.h +++ b/include/pub_tool_seqmatch.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_signals.h b/include/pub_tool_signals.h index f037cd5d7..a6447dc3f 100644 --- a/include/pub_tool_signals.h +++ b/include/pub_tool_signals.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_sparsewa.h b/include/pub_tool_sparsewa.h index c5b336bda..108cf1403 100644 --- a/include/pub_tool_sparsewa.h +++ b/include/pub_tool_sparsewa.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_stacktrace.h b/include/pub_tool_stacktrace.h index cad840e1d..272e43abe 100644 --- a/include/pub_tool_stacktrace.h +++ b/include/pub_tool_stacktrace.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_threadstate.h b/include/pub_tool_threadstate.h index 0bf116e2b..437e488d4 100644 --- a/include/pub_tool_threadstate.h +++ b/include/pub_tool_threadstate.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h index 6b361ef8b..01cefa6f0 100644 --- a/include/pub_tool_tooliface.h +++ b/include/pub_tool_tooliface.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_transtab.h b/include/pub_tool_transtab.h index 05a9fe5a3..91f570940 100644 --- a/include/pub_tool_transtab.h +++ b/include/pub_tool_transtab.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_vki.h b/include/pub_tool_vki.h index 7b6e71e11..9ca5195dd 100644 --- a/include/pub_tool_vki.h +++ b/include/pub_tool_vki.h @@ -17,7 +17,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_vkiscnums.h b/include/pub_tool_vkiscnums.h index df766ecab..641d11f9e 100644 --- a/include/pub_tool_vkiscnums.h +++ b/include/pub_tool_vkiscnums.h @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_vkiscnums_asm.h b/include/pub_tool_vkiscnums_asm.h index e7aa87976..b5f61d41d 100644 --- a/include/pub_tool_vkiscnums_asm.h +++ b/include/pub_tool_vkiscnums_asm.h @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_wordfm.h b/include/pub_tool_wordfm.h index bbfaf18b5..371bba7a4 100644 --- a/include/pub_tool_wordfm.h +++ b/include/pub_tool_wordfm.h @@ -33,7 +33,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_xarray.h b/include/pub_tool_xarray.h index becb87946..35ab20632 100644 --- a/include/pub_tool_xarray.h +++ b/include/pub_tool_xarray.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_xtmemory.h b/include/pub_tool_xtmemory.h index e51b221c0..bab6376d8 100644 --- a/include/pub_tool_xtmemory.h +++ b/include/pub_tool_xtmemory.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/pub_tool_xtree.h b/include/pub_tool_xtree.h index de2d31ef1..3593080bd 100644 --- a/include/pub_tool_xtree.h +++ b/include/pub_tool_xtree.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/valgrind.h.in b/include/valgrind.h.in index f1710924a..24a659998 100644 --- a/include/valgrind.h.in +++ b/include/valgrind.h.in @@ -3,7 +3,7 @@ Notice that the following BSD-style license applies to this one file (valgrind.h) only. The rest of Valgrind is licensed under the - terms of the GNU General Public License, version 2, unless + terms of the GNU General Public License, version 3, unless otherwise indicated. See the COPYING file in the source distribution for details. @@ -49,7 +49,7 @@ Notice that the above BSD-style license applies to this one file (valgrind.h) only. The entire rest of Valgrind is licensed under - the terms of the GNU General Public License, version 2. See the + the terms of the GNU General Public License, version 3. See the COPYING file in the source distribution for details. ---------------------------------------------------------------- diff --git a/include/vki/vki-amd64-freebsd.h b/include/vki/vki-amd64-freebsd.h index 44f4ce8c9..7db0e756d 100644 --- a/include/vki/vki-amd64-freebsd.h +++ b/include/vki/vki-amd64-freebsd.h @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-amd64-linux.h b/include/vki/vki-amd64-linux.h index bbcf4ab4e..53cc2c252 100644 --- a/include/vki/vki-amd64-linux.h +++ b/include/vki/vki-amd64-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-arm-linux.h b/include/vki/vki-arm-linux.h index a72268ca4..2d1a6adbb 100644 --- a/include/vki/vki-arm-linux.h +++ b/include/vki/vki-arm-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-arm64-freebsd.h b/include/vki/vki-arm64-freebsd.h index e535fe7fe..406b0d87c 100644 --- a/include/vki/vki-arm64-freebsd.h +++ b/include/vki/vki-arm64-freebsd.h @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-arm64-linux.h b/include/vki/vki-arm64-linux.h index 1b005c775..f2de1aca0 100644 --- a/include/vki/vki-arm64-linux.h +++ b/include/vki/vki-arm64-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-darwin.h b/include/vki/vki-darwin.h index f7fcac60c..93433d4f0 100644 --- a/include/vki/vki-darwin.h +++ b/include/vki/vki-darwin.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index bd49381a2..b5c7c84bc 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-linux-io_uring.h b/include/vki/vki-linux-io_uring.h index 5059c3010..31dc63f01 100644 --- a/include/vki/vki-linux-io_uring.h +++ b/include/vki/vki-linux-io_uring.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-linux-landlock.h b/include/vki/vki-linux-landlock.h index e549ae93e..5f70ecb4c 100644 --- a/include/vki/vki-linux-landlock.h +++ b/include/vki/vki-linux-landlock.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index 1b32295bf..3f9272f4d 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-machine-types-amd64-freebsd.h b/include/vki/vki-machine-types-amd64-freebsd.h index 2963f4d86..e505e05ae 100644 --- a/include/vki/vki-machine-types-amd64-freebsd.h +++ b/include/vki/vki-machine-types-amd64-freebsd.h @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-machine-types-arm64-freebsd.h b/include/vki/vki-machine-types-arm64-freebsd.h index dda1f86d9..68e5da360 100644 --- a/include/vki/vki-machine-types-arm64-freebsd.h +++ b/include/vki/vki-machine-types-arm64-freebsd.h @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-machine-types-x86-freebsd.h b/include/vki/vki-machine-types-x86-freebsd.h index 70f0a2b3f..c24adec9c 100644 --- a/include/vki/vki-machine-types-x86-freebsd.h +++ b/include/vki/vki-machine-types-x86-freebsd.h @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-mips32-linux.h b/include/vki/vki-mips32-linux.h index 584b5dd72..9cdecbb25 100644 --- a/include/vki/vki-mips32-linux.h +++ b/include/vki/vki-mips32-linux.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-mips64-linux.h b/include/vki/vki-mips64-linux.h index 9171b6fb0..0b8648569 100644 --- a/include/vki/vki-mips64-linux.h +++ b/include/vki/vki-mips64-linux.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-nanomips-linux.h b/include/vki/vki-nanomips-linux.h index e6d2a9730..1b2b34c1e 100644 --- a/include/vki/vki-nanomips-linux.h +++ b/include/vki/vki-nanomips-linux.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-posixtypes-amd64-linux.h b/include/vki/vki-posixtypes-amd64-linux.h index 60bcd080f..cb4d8c38b 100644 --- a/include/vki/vki-posixtypes-amd64-linux.h +++ b/include/vki/vki-posixtypes-amd64-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-posixtypes-arm-linux.h b/include/vki/vki-posixtypes-arm-linux.h index 2b1ed9c78..1a56dd944 100644 --- a/include/vki/vki-posixtypes-arm-linux.h +++ b/include/vki/vki-posixtypes-arm-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-posixtypes-arm64-linux.h b/include/vki/vki-posixtypes-arm64-linux.h index 94685f127..53479d0df 100644 --- a/include/vki/vki-posixtypes-arm64-linux.h +++ b/include/vki/vki-posixtypes-arm64-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-posixtypes-mips32-linux.h b/include/vki/vki-posixtypes-mips32-linux.h index 7f83c314e..4234a6e3b 100644 --- a/include/vki/vki-posixtypes-mips32-linux.h +++ b/include/vki/vki-posixtypes-mips32-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-posixtypes-mips64-linux.h b/include/vki/vki-posixtypes-mips64-linux.h index 61f476196..26b741ada 100644 --- a/include/vki/vki-posixtypes-mips64-linux.h +++ b/include/vki/vki-posixtypes-mips64-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-posixtypes-nanomips-linux.h b/include/vki/vki-posixtypes-nanomips-linux.h index b3060e263..d2f7d831c 100644 --- a/include/vki/vki-posixtypes-nanomips-linux.h +++ b/include/vki/vki-posixtypes-nanomips-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-posixtypes-ppc32-linux.h b/include/vki/vki-posixtypes-ppc32-linux.h index db978fa8a..31d506158 100644 --- a/include/vki/vki-posixtypes-ppc32-linux.h +++ b/include/vki/vki-posixtypes-ppc32-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-posixtypes-ppc64-linux.h b/include/vki/vki-posixtypes-ppc64-linux.h index ae9d352a3..468fc6c1b 100644 --- a/include/vki/vki-posixtypes-ppc64-linux.h +++ b/include/vki/vki-posixtypes-ppc64-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-posixtypes-riscv64-linux.h b/include/vki/vki-posixtypes-riscv64-linux.h index b8dfc9ce7..b5a15359a 100644 --- a/include/vki/vki-posixtypes-riscv64-linux.h +++ b/include/vki/vki-posixtypes-riscv64-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-posixtypes-s390x-linux.h b/include/vki/vki-posixtypes-s390x-linux.h index 0d0145acf..f3b42f364 100644 --- a/include/vki/vki-posixtypes-s390x-linux.h +++ b/include/vki/vki-posixtypes-s390x-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-posixtypes-x86-linux.h b/include/vki/vki-posixtypes-x86-linux.h index 2f3b72098..c21b7c482 100644 --- a/include/vki/vki-posixtypes-x86-linux.h +++ b/include/vki/vki-posixtypes-x86-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-ppc32-linux.h b/include/vki/vki-ppc32-linux.h index 6e6ca00da..68f6aad39 100644 --- a/include/vki/vki-ppc32-linux.h +++ b/include/vki/vki-ppc32-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-ppc64-linux.h b/include/vki/vki-ppc64-linux.h index c55762610..edb899707 100644 --- a/include/vki/vki-ppc64-linux.h +++ b/include/vki/vki-ppc64-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-riscv64-linux.h b/include/vki/vki-riscv64-linux.h index 0ad826c02..a06e8b553 100644 --- a/include/vki/vki-riscv64-linux.h +++ b/include/vki/vki-riscv64-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-s390x-linux.h b/include/vki/vki-s390x-linux.h index 726f068a0..21a25788c 100644 --- a/include/vki/vki-s390x-linux.h +++ b/include/vki/vki-s390x-linux.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-32bit-linux.h b/include/vki/vki-scnums-32bit-linux.h index ca0ff79bd..32259578b 100644 --- a/include/vki/vki-scnums-32bit-linux.h +++ b/include/vki/vki-scnums-32bit-linux.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-amd64-linux.h b/include/vki/vki-scnums-amd64-linux.h index 5e218a3ae..4ff66ddd5 100644 --- a/include/vki/vki-scnums-amd64-linux.h +++ b/include/vki/vki-scnums-amd64-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-arm-linux.h b/include/vki/vki-scnums-arm-linux.h index 44803bcb8..8aa639b02 100644 --- a/include/vki/vki-scnums-arm-linux.h +++ b/include/vki/vki-scnums-arm-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-arm64-linux.h b/include/vki/vki-scnums-arm64-linux.h index e2ac07625..57cbc1d0c 100644 --- a/include/vki/vki-scnums-arm64-linux.h +++ b/include/vki/vki-scnums-arm64-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-darwin.h b/include/vki/vki-scnums-darwin.h index 8eee21ec4..3a3352078 100644 --- a/include/vki/vki-scnums-darwin.h +++ b/include/vki/vki-scnums-darwin.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h index 8af22bde7..924434f3f 100644 --- a/include/vki/vki-scnums-freebsd.h +++ b/include/vki/vki-scnums-freebsd.h @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-mips32-linux.h b/include/vki/vki-scnums-mips32-linux.h index 62b423395..539db119b 100644 --- a/include/vki/vki-scnums-mips32-linux.h +++ b/include/vki/vki-scnums-mips32-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-mips64-linux.h b/include/vki/vki-scnums-mips64-linux.h index 91f578345..a8fb5e2a8 100644 --- a/include/vki/vki-scnums-mips64-linux.h +++ b/include/vki/vki-scnums-mips64-linux.h @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-nanomips-linux.h b/include/vki/vki-scnums-nanomips-linux.h index 73ee39e92..792c4318c 100644 --- a/include/vki/vki-scnums-nanomips-linux.h +++ b/include/vki/vki-scnums-nanomips-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-ppc32-linux.h b/include/vki/vki-scnums-ppc32-linux.h index d3ca94ebb..09fb560fe 100644 --- a/include/vki/vki-scnums-ppc32-linux.h +++ b/include/vki/vki-scnums-ppc32-linux.h @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-ppc64-linux.h b/include/vki/vki-scnums-ppc64-linux.h index 85e2d7a70..5b8e9a3da 100644 --- a/include/vki/vki-scnums-ppc64-linux.h +++ b/include/vki/vki-scnums-ppc64-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-riscv64-linux.h b/include/vki/vki-scnums-riscv64-linux.h index d630a1916..aff49aeef 100644 --- a/include/vki/vki-scnums-riscv64-linux.h +++ b/include/vki/vki-scnums-riscv64-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-s390x-linux.h b/include/vki/vki-scnums-s390x-linux.h index 22d94ee4d..38660e07b 100644 --- a/include/vki/vki-scnums-s390x-linux.h +++ b/include/vki/vki-scnums-s390x-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h index 518131a1f..8efba6169 100644 --- a/include/vki/vki-scnums-shared-linux.h +++ b/include/vki/vki-scnums-shared-linux.h @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-solaris.h b/include/vki/vki-scnums-solaris.h index 25bde39d8..e4d9bd8bd 100644 --- a/include/vki/vki-scnums-solaris.h +++ b/include/vki/vki-scnums-solaris.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-scnums-x86-linux.h b/include/vki/vki-scnums-x86-linux.h index 4807c5daa..b1afff14a 100644 --- a/include/vki/vki-scnums-x86-linux.h +++ b/include/vki/vki-scnums-x86-linux.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-solaris-repcache.h b/include/vki/vki-solaris-repcache.h index acac86f4d..aeb998324 100644 --- a/include/vki/vki-solaris-repcache.h +++ b/include/vki/vki-solaris-repcache.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-solaris.h b/include/vki/vki-solaris.h index 18d976700..8d9d68709 100644 --- a/include/vki/vki-solaris.h +++ b/include/vki/vki-solaris.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-x86-freebsd.h b/include/vki/vki-x86-freebsd.h index 60ca1040b..3a092f87b 100644 --- a/include/vki/vki-x86-freebsd.h +++ b/include/vki/vki-x86-freebsd.h @@ -16,7 +16,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-x86-linux.h b/include/vki/vki-x86-linux.h index d00de22b4..e5d365e80 100644 --- a/include/vki/vki-x86-linux.h +++ b/include/vki/vki-x86-linux.h @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h index 3a544f556..c2b5d055f 100644 --- a/include/vki/vki-xen-domctl.h +++ b/include/vki/vki-xen-domctl.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-evtchn.h b/include/vki/vki-xen-evtchn.h index a68292f55..f7f70d11f 100644 --- a/include/vki/vki-xen-evtchn.h +++ b/include/vki/vki-xen-evtchn.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-gnttab.h b/include/vki/vki-xen-gnttab.h index 33e9ba31e..24ebbb5ff 100644 --- a/include/vki/vki-xen-gnttab.h +++ b/include/vki/vki-xen-gnttab.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-hvm.h b/include/vki/vki-xen-hvm.h index c6ce0d90b..6775ed5d6 100644 --- a/include/vki/vki-xen-hvm.h +++ b/include/vki/vki-xen-hvm.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-memory.h b/include/vki/vki-xen-memory.h index f8eccd562..63384ce93 100644 --- a/include/vki/vki-xen-memory.h +++ b/include/vki/vki-xen-memory.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-mmuext.h b/include/vki/vki-xen-mmuext.h index b0634afbb..34922a7e5 100644 --- a/include/vki/vki-xen-mmuext.h +++ b/include/vki/vki-xen-mmuext.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-physdev.h b/include/vki/vki-xen-physdev.h index 807aeac5a..1c8231716 100644 --- a/include/vki/vki-xen-physdev.h +++ b/include/vki/vki-xen-physdev.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-schedop.h b/include/vki/vki-xen-schedop.h index 49ee30a6b..35cfd1fbb 100644 --- a/include/vki/vki-xen-schedop.h +++ b/include/vki/vki-xen-schedop.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-tmem.h b/include/vki/vki-xen-tmem.h index ef3f72e5a..898e185b2 100644 --- a/include/vki/vki-xen-tmem.h +++ b/include/vki/vki-xen-tmem.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-version.h b/include/vki/vki-xen-version.h index e65b6d509..57d28335d 100644 --- a/include/vki/vki-xen-version.h +++ b/include/vki/vki-xen-version.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-x86.h b/include/vki/vki-xen-x86.h index de654af47..55720501c 100644 --- a/include/vki/vki-xen-x86.h +++ b/include/vki/vki-xen-x86.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen-xsm.h b/include/vki/vki-xen-xsm.h index ae30b24f5..520284d5a 100644 --- a/include/vki/vki-xen-xsm.h +++ b/include/vki/vki-xen-xsm.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/include/vki/vki-xen.h b/include/vki/vki-xen.h index 2c91b4a20..3316f4cb7 100644 --- a/include/vki/vki-xen.h +++ b/include/vki/vki-xen.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/lackey/lk_main.c b/lackey/lk_main.c index 4d5e1e692..ec4d8a7b5 100644 --- a/lackey/lk_main.c +++ b/lackey/lk_main.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/massif/ms_main.c b/massif/ms_main.c index 0aed0890d..94eca658e 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -11,7 +11,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/massif/ms_print.in b/massif/ms_print.in index a206ce4d6..ecd9f383e 100644 --- a/massif/ms_print.in +++ b/massif/ms_print.in @@ -12,7 +12,7 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the +# published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -75,7 +75,7 @@ usage: ms_print [options] massif-out-file --y=<4..1000> graph height, in rows [20] ms_print is Copyright (C) 2007-2017 Nicholas Nethercote. - and licensed under the GNU General Public License, version 2. + and licensed under the GNU General Public License, version 3. Bug reports, feedback, admiration, abuse, etc, to: njn\@valgrind.org. END diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c index e34d4e9df..8dbeb15ab 100644 --- a/memcheck/mc_errors.c +++ b/memcheck/mc_errors.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/mc_include.h b/memcheck/mc_include.h index 7cc5febe0..c00b7d75f 100644 --- a/memcheck/mc_include.h +++ b/memcheck/mc_include.h @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c index 3099a04dd..586bff448 100644 --- a/memcheck/mc_leakcheck.c +++ b/memcheck/mc_leakcheck.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/mc_machine.c b/memcheck/mc_machine.c index b0026a6bd..1d5c5c19f 100644 --- a/memcheck/mc_machine.c +++ b/memcheck/mc_machine.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index c7409156b..9a14f8436 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/mc_main_asm.c b/memcheck/mc_main_asm.c index c221b800f..eee1856d2 100644 --- a/memcheck/mc_main_asm.c +++ b/memcheck/mc_main_asm.c @@ -15,7 +15,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/mc_malloc_wrappers.c b/memcheck/mc_malloc_wrappers.c index 584afa50e..ae50923c4 100644 --- a/memcheck/mc_malloc_wrappers.c +++ b/memcheck/mc_malloc_wrappers.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/mc_replace_strmem.c b/memcheck/mc_replace_strmem.c index 5f026a6a4..b4853a19a 100644 --- a/memcheck/mc_replace_strmem.c +++ b/memcheck/mc_replace_strmem.c @@ -14,7 +14,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c index dfaf10c2b..656b943ac 100644 --- a/memcheck/mc_translate.c +++ b/memcheck/mc_translate.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/memcheck.h b/memcheck/memcheck.h index 6a71a2566..0ab6d192a 100644 --- a/memcheck/memcheck.h +++ b/memcheck/memcheck.h @@ -4,7 +4,7 @@ Notice that the following BSD-style license applies to this one file (memcheck.h) only. The rest of Valgrind is licensed under the - terms of the GNU General Public License, version 2, unless + terms of the GNU General Public License, version 3, unless otherwise indicated. See the COPYING file in the source distribution for details. @@ -50,7 +50,7 @@ Notice that the above BSD-style license applies to this one file (memcheck.h) only. The entire rest of Valgrind is licensed under - the terms of the GNU General Public License, version 2. See the + the terms of the GNU General Public License, version 3. See the COPYING file in the source distribution for details. ---------------------------------------------------------------- diff --git a/memcheck/tests/vbit-test/binary.c b/memcheck/tests/vbit-test/binary.c index 4ac0435b0..c269236fd 100644 --- a/memcheck/tests/vbit-test/binary.c +++ b/memcheck/tests/vbit-test/binary.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/tests/vbit-test/irops.c b/memcheck/tests/vbit-test/irops.c index aec2670b8..46af4fa97 100644 --- a/memcheck/tests/vbit-test/irops.c +++ b/memcheck/tests/vbit-test/irops.c @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/tests/vbit-test/main.c b/memcheck/tests/vbit-test/main.c index d40365219..858a516c0 100644 --- a/memcheck/tests/vbit-test/main.c +++ b/memcheck/tests/vbit-test/main.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/tests/vbit-test/qernary.c b/memcheck/tests/vbit-test/qernary.c index 3e719110b..265a1fd5b 100644 --- a/memcheck/tests/vbit-test/qernary.c +++ b/memcheck/tests/vbit-test/qernary.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/tests/vbit-test/ternary.c b/memcheck/tests/vbit-test/ternary.c index 96d392de7..1a326fb29 100644 --- a/memcheck/tests/vbit-test/ternary.c +++ b/memcheck/tests/vbit-test/ternary.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/tests/vbit-test/unary.c b/memcheck/tests/vbit-test/unary.c index 836026597..e6f51b7f4 100644 --- a/memcheck/tests/vbit-test/unary.c +++ b/memcheck/tests/vbit-test/unary.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/tests/vbit-test/util.c b/memcheck/tests/vbit-test/util.c index 48869c12b..221289e8a 100644 --- a/memcheck/tests/vbit-test/util.c +++ b/memcheck/tests/vbit-test/util.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/tests/vbit-test/valgrind.c b/memcheck/tests/vbit-test/valgrind.c index 204bf57ac..5450cc29e 100644 --- a/memcheck/tests/vbit-test/valgrind.c +++ b/memcheck/tests/vbit-test/valgrind.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/tests/vbit-test/vbits.c b/memcheck/tests/vbit-test/vbits.c index 88247cde1..b4f7eb17c 100644 --- a/memcheck/tests/vbit-test/vbits.c +++ b/memcheck/tests/vbit-test/vbits.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/tests/vbit-test/vbits.h b/memcheck/tests/vbit-test/vbits.h index 7d0002d32..995f36cb3 100644 --- a/memcheck/tests/vbit-test/vbits.h +++ b/memcheck/tests/vbit-test/vbits.h @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/memcheck/tests/vbit-test/vtest.h b/memcheck/tests/vbit-test/vtest.h index 16f7bf43f..907a31cfa 100644 --- a/memcheck/tests/vbit-test/vtest.h +++ b/memcheck/tests/vbit-test/vtest.h @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/mpi/libmpiwrap.c b/mpi/libmpiwrap.c index 2fa1cb8fe..3d08bc9fa 100644 --- a/mpi/libmpiwrap.c +++ b/mpi/libmpiwrap.c @@ -9,7 +9,7 @@ Notice that the following BSD-style license applies to this one file (mpiwrap.c) only. The rest of Valgrind is licensed under the - terms of the GNU General Public License, version 2, unless + terms of the GNU General Public License, version 3, unless otherwise indicated. See the COPYING file in the source distribution for details. diff --git a/none/nl_main.c b/none/nl_main.c index 6d4da55cc..17b55e4b6 100644 --- a/none/nl_main.c +++ b/none/nl_main.c @@ -12,7 +12,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c index d8d3618b2..285a3cab0 100644 --- a/none/tests/iropt-test/binary.c +++ b/none/tests/iropt-test/binary.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index 882ba59ba..b8cfd4ce6 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/iropt-test/main.c b/none/tests/iropt-test/main.c index 64ad44d87..25c312b2e 100644 --- a/none/tests/iropt-test/main.c +++ b/none/tests/iropt-test/main.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/iropt-test/unary.c b/none/tests/iropt-test/unary.c index fa961f28a..26962381d 100644 --- a/none/tests/iropt-test/unary.c +++ b/none/tests/iropt-test/unary.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/iropt-test/util.c b/none/tests/iropt-test/util.c index 275c2b4cb..694edb4db 100644 --- a/none/tests/iropt-test/util.c +++ b/none/tests/iropt-test/util.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/iropt-test/valgrind.c b/none/tests/iropt-test/valgrind.c index d6ac5f222..1456cfc89 100644 --- a/none/tests/iropt-test/valgrind.c +++ b/none/tests/iropt-test/valgrind.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/iropt-test/vtest.h b/none/tests/iropt-test/vtest.h index cee5ddacb..96c0902f1 100644 --- a/none/tests/iropt-test/vtest.h +++ b/none/tests/iropt-test/vtest.h @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/s390x/disasm-test/generate.c b/none/tests/s390x/disasm-test/generate.c index 408fe370e..abde6bfef 100644 --- a/none/tests/s390x/disasm-test/generate.c +++ b/none/tests/s390x/disasm-test/generate.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/s390x/disasm-test/main.c b/none/tests/s390x/disasm-test/main.c index aa362b511..7805a1859 100644 --- a/none/tests/s390x/disasm-test/main.c +++ b/none/tests/s390x/disasm-test/main.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/s390x/disasm-test/main.h b/none/tests/s390x/disasm-test/main.h index 8c51b1dc2..cdf75d241 100644 --- a/none/tests/s390x/disasm-test/main.h +++ b/none/tests/s390x/disasm-test/main.h @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/s390x/disasm-test/objdump.c b/none/tests/s390x/disasm-test/objdump.c index 1646fe9ba..cabb0af7c 100644 --- a/none/tests/s390x/disasm-test/objdump.c +++ b/none/tests/s390x/disasm-test/objdump.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/s390x/disasm-test/objdump.h b/none/tests/s390x/disasm-test/objdump.h index 388943f7a..ac6f72e27 100644 --- a/none/tests/s390x/disasm-test/objdump.h +++ b/none/tests/s390x/disasm-test/objdump.h @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/s390x/disasm-test/opcode.c b/none/tests/s390x/disasm-test/opcode.c index df8ca7e8c..86cd642f3 100644 --- a/none/tests/s390x/disasm-test/opcode.c +++ b/none/tests/s390x/disasm-test/opcode.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/s390x/disasm-test/verify.c b/none/tests/s390x/disasm-test/verify.c index 8dee9f596..b80e270e3 100644 --- a/none/tests/s390x/disasm-test/verify.c +++ b/none/tests/s390x/disasm-test/verify.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/s390x/disasm-test/vex.c b/none/tests/s390x/disasm-test/vex.c index 39d940371..7d80ceadd 100644 --- a/none/tests/s390x/disasm-test/vex.c +++ b/none/tests/s390x/disasm-test/vex.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/none/tests/s390x/disasm-test/vex.h b/none/tests/s390x/disasm-test/vex.h index 0a9510b51..627c1e55e 100644 --- a/none/tests/s390x/disasm-test/vex.h +++ b/none/tests/s390x/disasm-test/vex.h @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/perf/vg_perf.in b/perf/vg_perf.in index 90ee1d238..cc2783464 100644 --- a/perf/vg_perf.in +++ b/perf/vg_perf.in @@ -11,7 +11,7 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the +# published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c index 6fed7a2f2..2081c62b7 100644 --- a/shared/vg_replace_strmem.c +++ b/shared/vg_replace_strmem.c @@ -13,7 +13,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in index 945b4c161..0d7ec71a6 100644 --- a/tests/vg_regtest.in +++ b/tests/vg_regtest.in @@ -11,7 +11,7 @@ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the +# published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but From b74d16c9b0db657ea321b72dc17d0c06022a7f71 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 18 Oct 2025 01:27:57 +0200 Subject: [PATCH 392/412] coregrind/m_debuginfo/readpdb.c (DEBUG_SnarfLinetab): Remove this_seg GCC notices that this_seg is set, but never really used in this function m_debuginfo/readpdb.c: In function 'DEBUG_SnarfLinetab': m_debuginfo/readpdb.c:1542:23: warning: variable 'this_seg' set but not used [-Wunused-but-set-variable=] 1542 | Int this_seg; | ^~~~~~~~ Fix this by just removing this_seg. --- coregrind/m_debuginfo/readpdb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/coregrind/m_debuginfo/readpdb.c b/coregrind/m_debuginfo/readpdb.c index dbae197b3..9e29fefb1 100644 --- a/coregrind/m_debuginfo/readpdb.c +++ b/coregrind/m_debuginfo/readpdb.c @@ -1539,7 +1539,6 @@ static ULong DEBUG_SnarfLinetab( union any_size pnt; union any_size pnt2; const struct startend * start; - Int this_seg; Bool debug = di->trace_symtab; ULong n_lines_read = 0; @@ -1563,7 +1562,6 @@ static ULong DEBUG_SnarfLinetab( pnt2.c = (const HChar *)linetab + filetab[i]; } - this_seg = 0; for (i = 0; i < nfile; i++) { const HChar *fnmstr; const HChar *dirstr; @@ -1601,7 +1599,7 @@ static ULong DEBUG_SnarfLinetab( fnmstr = ML_(addStr)(di, fnmstr, k); fnmdirstr_ix = ML_(addFnDn) (di, fnmstr, dirstr); - for (k = 0; k < file_segcount; k++, this_seg++) { + for (k = 0; k < file_segcount; k++) { Int linecount; Int segno; From 0d5a3996b5f0398cdef646c00ad77d086187897e Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 18 Oct 2025 02:36:25 +0200 Subject: [PATCH 393/412] Update libiberty demangler Update the libiberty demangler using the auxprogs/update-demangler script to gcc git commit 7921bb4afcb7a3be8e10e63b10acfc2bfa477cae. This update includes: - Support for unnamed unscoped enums. - Fix whaever -> whatever, comment typo. - Update copyright years. --- auxprogs/update-demangler | 4 +- coregrind/m_demangle/ansidecl.h | 2 +- coregrind/m_demangle/cp-demangle.c | 67 ++++++++++++++++++++++++---- coregrind/m_demangle/cp-demangle.h | 2 +- coregrind/m_demangle/cplus-dem.c | 2 +- coregrind/m_demangle/d-demangle.c | 2 +- coregrind/m_demangle/demangle.h | 4 +- coregrind/m_demangle/dyn-string.c | 2 +- coregrind/m_demangle/dyn-string.h | 2 +- coregrind/m_demangle/rust-demangle.c | 2 +- coregrind/m_demangle/safe-ctype.c | 2 +- coregrind/m_demangle/safe-ctype.h | 2 +- 12 files changed, 72 insertions(+), 21 deletions(-) diff --git a/auxprogs/update-demangler b/auxprogs/update-demangler index 396823975..3ac0c04ea 100755 --- a/auxprogs/update-demangler +++ b/auxprogs/update-demangler @@ -17,8 +17,8 @@ set -e #--------------------------------------------------------------------- # You need to modify these revision numbers for your update. -old_gcc_revision=ca2f7c84927f85b95f0f48f82b93f1460c372db4 # the revision of the previous update -new_gcc_revision=94bea5dd6c9a06ddb6244be1e5196ff5fbe2b186 # the revision for this update +old_gcc_revision=94bea5dd6c9a06ddb6244be1e5196ff5fbe2b186 # the revision of the previous update +new_gcc_revision=7921bb4afcb7a3be8e10e63b10acfc2bfa477cae # the revision for this update # Unless the organization of demangler related files has changed, no # changes below this line should be necessary. diff --git a/coregrind/m_demangle/ansidecl.h b/coregrind/m_demangle/ansidecl.h index 323ff8be3..534b05251 100644 --- a/coregrind/m_demangle/ansidecl.h +++ b/coregrind/m_demangle/ansidecl.h @@ -1,5 +1,5 @@ /* Compiler compatibility macros - Copyright (C) 1991-2024 Free Software Foundation, Inc. + Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify diff --git a/coregrind/m_demangle/cp-demangle.c b/coregrind/m_demangle/cp-demangle.c index adec005b4..3bf5a372e 100644 --- a/coregrind/m_demangle/cp-demangle.c +++ b/coregrind/m_demangle/cp-demangle.c @@ -1,5 +1,5 @@ /* Demangler for g++ V3 ABI. - Copyright (C) 2003-2024 Free Software Foundation, Inc. + Copyright (C) 2003-2025 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of the libiberty library, which is part of GCC. @@ -516,6 +516,8 @@ static struct demangle_component *d_lambda (struct d_info *); static struct demangle_component *d_unnamed_type (struct d_info *); +static struct demangle_component *d_unnamed_enum (struct d_info *); + static struct demangle_component * d_clone_suffix (struct d_info *, struct demangle_component *); @@ -1441,7 +1443,7 @@ d_encoding (struct d_info *di, int top_level) /* If this is a non-top-level local-name, clear the return type, so it doesn't confuse the user by - being confused with the return type of whaever + being confused with the return type of whatever this is nested within. */ if (!top_level && dc->type == DEMANGLE_COMPONENT_LOCAL_NAME && ftype->type == DEMANGLE_COMPONENT_FUNCTION_TYPE) @@ -1816,6 +1818,9 @@ d_unqualified_name (struct d_info *di, struct demangle_component *scope, { switch (d_peek_next_char (di)) { + case 'e': + ret = d_unnamed_enum (di); + break; case 'l': ret = d_lambda (di); break; @@ -2745,13 +2750,20 @@ cplus_demangle_type (struct d_info *di) break; case 'U': - d_advance (di, 1); - ret = d_source_name (di); - if (d_peek_char (di) == 'I') - ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret, - d_template_args (di)); - ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL, - cplus_demangle_type (di), ret); + peek = d_peek_next_char (di); + if (IS_DIGIT (peek)) + { + d_advance (di, 1); + ret = d_source_name (di); + if (d_peek_char (di) == 'I') + ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret, + d_template_args (di)); + ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL, + cplus_demangle_type (di), ret); + } + else + /* Could be a closure type or an unnamed enum. */ + ret = d_unqualified_name (di, NULL, NULL); break; case 'D': @@ -4107,6 +4119,33 @@ d_unnamed_type (struct d_info *di) return ret; } +/* ::= Ue */ + +static struct demangle_component * +d_unnamed_enum (struct d_info *di) +{ + if (! d_check_char (di, 'U')) + return NULL; + if (! d_check_char (di, 'e')) + return NULL; + + struct demangle_component *underlying = cplus_demangle_type (di); + struct demangle_component *name = d_source_name (di); + + struct demangle_component *ret = d_make_empty (di); + if (ret) + { + ret->type = DEMANGLE_COMPONENT_UNNAMED_ENUM; + d_left (ret) = underlying; + d_right (ret) = name; + } + + if (! d_add_substitution (di, ret)) + return NULL; + + return ret; +} + /* ::= [ . ] [ . ]* */ @@ -4413,6 +4452,7 @@ d_count_templates_scopes (struct d_print_info *dpi, case DEMANGLE_COMPONENT_CHARACTER: case DEMANGLE_COMPONENT_NUMBER: case DEMANGLE_COMPONENT_UNNAMED_TYPE: + case DEMANGLE_COMPONENT_UNNAMED_ENUM: case DEMANGLE_COMPONENT_STRUCTURED_BINDING: case DEMANGLE_COMPONENT_MODULE_NAME: case DEMANGLE_COMPONENT_MODULE_PARTITION: @@ -4813,6 +4853,7 @@ d_find_pack (struct d_print_info *dpi, case DEMANGLE_COMPONENT_CHARACTER: case DEMANGLE_COMPONENT_FUNCTION_PARAM: case DEMANGLE_COMPONENT_UNNAMED_TYPE: + case DEMANGLE_COMPONENT_UNNAMED_ENUM: case DEMANGLE_COMPONENT_DEFAULT_ARG: case DEMANGLE_COMPONENT_NUMBER: return NULL; @@ -6291,6 +6332,14 @@ d_print_comp_inner (struct d_print_info *dpi, int options, d_append_char (dpi, '}'); return; + case DEMANGLE_COMPONENT_UNNAMED_ENUM: + d_append_string (dpi, "{enum:"); + d_print_comp (dpi, options, d_left (dc)); + d_append_string (dpi, "{"); + d_print_comp (dpi, options, d_right (dc)); + d_append_string (dpi, "}}"); + return; + case DEMANGLE_COMPONENT_CLONE: d_print_comp (dpi, options, d_left (dc)); d_append_string (dpi, " [clone "); diff --git a/coregrind/m_demangle/cp-demangle.h b/coregrind/m_demangle/cp-demangle.h index cc5bab0ca..9b33a2f84 100644 --- a/coregrind/m_demangle/cp-demangle.h +++ b/coregrind/m_demangle/cp-demangle.h @@ -1,5 +1,5 @@ /* Internal demangler interface for g++ V3 ABI. - Copyright (C) 2003-2024 Free Software Foundation, Inc. + Copyright (C) 2003-2025 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of the libiberty library, which is part of GCC. diff --git a/coregrind/m_demangle/cplus-dem.c b/coregrind/m_demangle/cplus-dem.c index cbe697361..9d173c03d 100644 --- a/coregrind/m_demangle/cplus-dem.c +++ b/coregrind/m_demangle/cplus-dem.c @@ -1,5 +1,5 @@ /* Demangler for GNU C++ - Copyright (C) 1989-2024 Free Software Foundation, Inc. + Copyright (C) 1989-2025 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.uucp) Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling Modified by Satish Pai (pai@apollo.hp.com) for HP demangling diff --git a/coregrind/m_demangle/d-demangle.c b/coregrind/m_demangle/d-demangle.c index 9a6a89332..2f44211eb 100644 --- a/coregrind/m_demangle/d-demangle.c +++ b/coregrind/m_demangle/d-demangle.c @@ -1,5 +1,5 @@ /* Demangler for the D programming language - Copyright (C) 2014-2024 Free Software Foundation, Inc. + Copyright (C) 2014-2025 Free Software Foundation, Inc. Written by Iain Buclaw (ibuclaw@gdcproject.org) This file is part of the libiberty library. diff --git a/coregrind/m_demangle/demangle.h b/coregrind/m_demangle/demangle.h index 70cd90bfa..010c103d0 100644 --- a/coregrind/m_demangle/demangle.h +++ b/coregrind/m_demangle/demangle.h @@ -1,5 +1,5 @@ /* Defs for interface to demanglers. - Copyright (C) 1992-2024 Free Software Foundation, Inc. + Copyright (C) 1992-2025 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License @@ -437,6 +437,8 @@ enum demangle_component_type DEMANGLE_COMPONENT_DEFAULT_ARG, /* An unnamed type. */ DEMANGLE_COMPONENT_UNNAMED_TYPE, + /* An unnamed enum. */ + DEMANGLE_COMPONENT_UNNAMED_ENUM, /* A transactional clone. This has one subtree, the encoding for which it is providing alternative linkage. */ DEMANGLE_COMPONENT_TRANSACTION_CLONE, diff --git a/coregrind/m_demangle/dyn-string.c b/coregrind/m_demangle/dyn-string.c index af9d41ea1..38ad5eb5f 100644 --- a/coregrind/m_demangle/dyn-string.c +++ b/coregrind/m_demangle/dyn-string.c @@ -1,5 +1,5 @@ /* An abstract string datatype. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GNU CC. diff --git a/coregrind/m_demangle/dyn-string.h b/coregrind/m_demangle/dyn-string.h index 76e23e0c3..7e07a4d92 100644 --- a/coregrind/m_demangle/dyn-string.h +++ b/coregrind/m_demangle/dyn-string.h @@ -1,5 +1,5 @@ /* An abstract string datatype. - Copyright (C) 1998-2024 Free Software Foundation, Inc. + Copyright (C) 1998-2025 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GCC. diff --git a/coregrind/m_demangle/rust-demangle.c b/coregrind/m_demangle/rust-demangle.c index 4024813c2..70f13d7c4 100644 --- a/coregrind/m_demangle/rust-demangle.c +++ b/coregrind/m_demangle/rust-demangle.c @@ -1,5 +1,5 @@ /* Demangler for the Rust programming language - Copyright (C) 2016-2024 Free Software Foundation, Inc. + Copyright (C) 2016-2025 Free Software Foundation, Inc. Written by David Tolnay (dtolnay@gmail.com). Rewritten by Eduard-Mihai Burtescu (eddyb@lyken.rs) for v0 support. diff --git a/coregrind/m_demangle/safe-ctype.c b/coregrind/m_demangle/safe-ctype.c index 32654ef1e..95c41cd68 100644 --- a/coregrind/m_demangle/safe-ctype.c +++ b/coregrind/m_demangle/safe-ctype.c @@ -1,6 +1,6 @@ /* replacement macros. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Zack Weinberg . This file is part of the libiberty library. diff --git a/coregrind/m_demangle/safe-ctype.h b/coregrind/m_demangle/safe-ctype.h index d3e5214d5..c0f804228 100644 --- a/coregrind/m_demangle/safe-ctype.h +++ b/coregrind/m_demangle/safe-ctype.h @@ -1,6 +1,6 @@ /* replacement macros. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. Contributed by Zack Weinberg . This file is part of the libiberty library. From b28f4882caa89a35838224002ed474b18177eacb Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 18 Oct 2025 03:35:12 +0200 Subject: [PATCH 394/412] Set version to 3.26.0-RC1 --- NEWS | 4 +++- configure.ac | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 6c39b58dc..11af2b785 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -Release 3.26.0 (?? Oct 2025) +Release 3.26.0.RC1 (17 Oct 2025) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This release supports X86/Linux, AMD64/Linux, ARM32/Linux, ARM64/Linux, @@ -177,6 +177,8 @@ 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 above. +(3.26.0.RC1: 17 Oct 2025) + Release 3.25.0 (25 Apr 2025) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/configure.ac b/configure.ac index aa89abb9f..90fafaf1c 100644 --- a/configure.ac +++ b/configure.ac @@ -18,8 +18,8 @@ AC_PREREQ(2.69) m4_define([v_major_ver], [3]) m4_define([v_minor_ver], [26]) m4_define([v_micro_ver], [0]) -m4_define([v_suffix_ver], [GIT]) -m4_define([v_rel_date], ["?? Oct 2025"]) +m4_define([v_suffix_ver], [RC1]) +m4_define([v_rel_date], ["17 Oct 2025"]) m4_define([v_version], m4_if(v_suffix_ver, [], [v_major_ver.v_minor_ver.v_micro_ver], From 79020198175d40429e84f502a92afc779d9a9d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= Date: Wed, 15 Oct 2025 07:32:06 -0400 Subject: [PATCH 395/412] vgdb.c: Update --vargs documentation --- coregrind/vgdb.c | 6 +++++- docs/xml/manual-core-adv.xml | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c index c635f94b5..8cf524a4f 100644 --- a/coregrind/vgdb.c +++ b/coregrind/vgdb.c @@ -2077,7 +2077,11 @@ void usage(void) " gdbserver has not processed a command after number seconds\n" " --multi start in extended-remote mode, wait for gdb to tell us what to run\n" " --valgrind, pass the path to valgrind to use. If not specified, the system valgrind will be launched.\n" -" --vargs everything that follows is an argument for valgrind.\n" +" --vargs Additional valgrind tool options (must be used with --multi).\n" +" Everything following --vargs is passed to valgrind as tool options\n" +" (like -q, --leak-check=full, --tool=helgrind, etc.). The program\n" +" executable and its arguments are specified separately by GDB and\n" +" should NOT be included here.\n" " -l arg tells to show the list of running Valgrind gdbserver and then exit.\n" " -T arg tells to add timestamps to vgdb information messages.\n" " -D arg tells to show shared mem status and then exit.\n" diff --git a/docs/xml/manual-core-adv.xml b/docs/xml/manual-core-adv.xml index d7944b8a1..3591cf731 100644 --- a/docs/xml/manual-core-adv.xml +++ b/docs/xml/manual-core-adv.xml @@ -1424,7 +1424,9 @@ gdb prog Options to run valgrind with, in extended-remote mode. For example . Everything following will be provided as arguments - to valgrind as is. + to valgrind as is. This is only for supplying valgrind options. + The program executable and its arguments are specified separately + by GDB and should NOT be included here. From 48d64d0e6bb72220bb2557be4f427a57038dfbc6 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 20 Oct 2025 19:04:25 +0200 Subject: [PATCH 396/412] Document FdBadUse in xml-output-protocol5.txt The core error FdBadUse was added in commit 22971a15d62d "Report track-fd errors for fd used which was not opened or already closed" But not documented. Add it to the protocol documentation now. --- docs/internals/xml-output-protocol5.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/internals/xml-output-protocol5.txt b/docs/internals/xml-output-protocol5.txt index 046f59408..a481361da 100644 --- a/docs/internals/xml-output-protocol5.txt +++ b/docs/internals/xml-output-protocol5.txt @@ -37,3 +37,6 @@ The possible values are: On exit the file descriptor is still open + FdBadUse + + The file descriptor is (no longer) valid From 7c3ebd4c8f91739b9d436cb5c6011715f10acd80 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 20 Oct 2025 19:11:41 +0200 Subject: [PATCH 397/412] Update NEWS with more items - Make BUILD_DOCS controls building documentation. - LTP integration has been updated to v20250930. - New Linux syscall wrappers (cachestat, futex_waitv, listmount, mount_setattr, mseal, quotactl_fd, remap_file_pages, setdomainname, statmount, swapoff, swapon, sysfs and ustat). - New --modify-fds=yes is like --modify-fds=high except for fds 0,1,2. - New --track-fds=bad only produces errors for bad file descriptor usage. - With --xml=yes log now always uses output protocol 6. - vgdb now handles the qExecAndArgs packet. - DWARF inlined subroutine handling has been rewritten to work cross CUs. --- NEWS | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/NEWS b/NEWS index 11af2b785..d01944d8a 100644 --- a/NEWS +++ b/NEWS @@ -12,10 +12,45 @@ X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux. * Upgrade to the GNU General Public License version 3. +* Control building documentation. When using make dist set the + Makefile BUILD_DOCS to none, all or html. none, does not build any + documentation. all, builds all documentation. html, builds HTML + docs but skips building PDFs. See also README_DEVELOPERS. + * New VEX API function LibVEX_set_VexControl * The deprecated IROps: Iop_Clz32/64 and Iop_Ctz32/64 have been removed +* The Linux Test Project (LTP) integration has been updated to + v20250930. The test output has been made compatible with bunsen. + Various issues with the linux syscall wrappers have been fixed. + + New Linux syscall wrappers for: cachestat, futex_waitv, listmount, + mount_setattr, mseal, quotactl_fd, remap_file_pages, setdomainname, + statmount, swapoff, swapon, sysfs and ustat. + +* --modify-fds=yes has been added. It acts like --modify-fds=high (the + highest available file descriptor is returned first) except when + when the lowers stdin/stdout/stderr (file descriptors 0, 1, 2) are + available. With --modify-fds=yes 0, 1 or 2 are always returned first + when still available before higher file descriptor numbers are. + +* With --xml=yes log output protocol 6 is now always used (unlike + protocol 5 which was only used with--track-fds). The main difference + is that the xml output now contains error summaries. See also + xml-output-protocol6.txt. + +* Add "bad" option for --track-fds. When --track-fds=bad is specified, + do not produce errors about unclosed file descriptors at program + exit. Only produce errors for bad file descriptor usage, either + double close or use of file descriptor that is (no longer) valid. + +* vgdb will now handle the qExecAndArgs packet. + +* DWARF inlined subroutine handling has been rewritten to work cross + compile units. This should get rid of backtraces with + "UnknownInlinedFun". + * ================== PLATFORM CHANGES ================= FreeBSD 15 (which is expected to ship in December 2025, after From a1b92c02dcda9df53102a9a236aee68fb3e95426 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 21 Oct 2025 17:45:52 +0000 Subject: [PATCH 398/412] Fix a compiler warning about an unused variable on some platforms. --- coregrind/m_debuginfo/readdwarf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c index 3cc00d317..3b5c6be70 100644 --- a/coregrind/m_debuginfo/readdwarf.c +++ b/coregrind/m_debuginfo/readdwarf.c @@ -2366,9 +2366,10 @@ static Bool summarise_context(/*OUT*/Addr* base, *len = 0; VG_(bzero_inline)(si_m, sizeof(*si_m)); - /*const*/ Bool is_s390x_linux = False; # if defined(VGP_s390x_linux) - is_s390x_linux = True; + #define is_s390x_linux True +# else + #define is_s390x_linux False # endif /* Guard against obviously stupid settings of the reg-rule stack From d9e49b513f2c8a18bc5cf0b293dc14ab910f98e0 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 23 Oct 2025 01:23:48 +0200 Subject: [PATCH 399/412] Hook up ioprio_{get,set}, [vm]splice, tee and bpf syscalls on arm-linux --- coregrind/m_syswrap/syswrap-arm-linux.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index 26f67b3c8..9e1b2efb4 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -921,9 +921,8 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_add_key, sys_add_key), // 286 LINX_(__NR_request_key, sys_request_key), // 287 LINXY(__NR_keyctl, sys_keyctl), // not 288... -// LINX_(__NR_ioprio_set, sys_ioprio_set), // 289 - -// LINX_(__NR_ioprio_get, sys_ioprio_get), // 290 + LINX_(__NR_ioprio_set, sys_ioprio_set), // 289 + LINX_(__NR_ioprio_get, sys_ioprio_get), // 290 LINXY(__NR_inotify_init, sys_inotify_init), // 291 LINX_(__NR_inotify_add_watch, sys_inotify_add_watch), // 292 LINX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 293 @@ -953,11 +952,10 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_unshare, sys_unshare), // 310 LINX_(__NR_set_robust_list, sys_set_robust_list), // 311 LINXY(__NR_get_robust_list, sys_get_robust_list), // 312 -// LINX_(__NR_splice, sys_ni_syscall), // 313 + LINX_(__NR_splice, sys_splice), // 313 // LINX_(__NR_sync_file_range, sys_sync_file_range), // 314 - -// LINX_(__NR_tee, sys_ni_syscall), // 315 -// LINX_(__NR_vmsplice, sys_ni_syscall), // 316 + LINX_(__NR_tee, sys_tee), // 315 + LINXY(__NR_vmsplice, sys_vmsplice), // 316 LINXY(__NR_move_pages, sys_move_pages), // 317 LINX_(__NR_utimensat, sys_utimensat), // 320 @@ -1018,7 +1016,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_getrandom, sys_getrandom), // 384 LINXY(__NR_memfd_create, sys_memfd_create), // 385 - + LINXY(__NR_bpf, sys_bpf), // 386 LINX_(__NR_execveat, sys_execveat), // 387 LINXY(__NR_userfaultfd, sys_userfaultfd), // 388 From b8a91ecb77483639e1f56d27b14cac2ea353ccc4 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 23 Oct 2025 21:06:41 +0000 Subject: [PATCH 400/412] s390-runone: Add command line option --cc=... to choose a compiler. gcc is still default, --cc=whatever overrides. --- auxprogs/s390-runone | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/auxprogs/s390-runone b/auxprogs/s390-runone index f8d0288dd..94eff0374 100755 --- a/auxprogs/s390-runone +++ b/auxprogs/s390-runone @@ -56,7 +56,8 @@ Usage: s390-runone [options] FILE --template Write template --build Build executable from C file --insn INSN Add INSN to template - --arch ARCH Passed as -march=ARCH to GCC + --arch ARCH Passed as -march=ARCH to the compiler + --cc COMP Use COMP as compiler --help Write this text FILE is mandatory with --build @@ -73,12 +74,14 @@ sub main { my $help = 0; my $insn = ""; my $arch = "arch14"; + my $cc = "gcc"; GetOptions("template|t" => sub { $template = 1; $build = 0; }, "build|b" => sub { $template = 0; $build = 1; }, "help|h" => \$help, "insn|i=s" => \$insn, - "arch|a=s" => \$arch + "arch|a=s" => \$arch, + "cc=s" => \$cc ) or usage(); usage() if ($help); @@ -96,7 +99,7 @@ sub main { if ($template) { write_template($file, $insn); } elsif ($build) { - $rc = build_exe($file, $arch); + $rc = build_exe($file, $arch, $cc); } else { print "Nothing happens\n"; } @@ -138,7 +141,7 @@ END2 sub build_exe { - my ($file, $arch) = @_; + my ($file, $arch, $cc) = @_; my $base = `basename "$file" .c`; chomp($base); @@ -146,9 +149,9 @@ sub build_exe my $exe = "$base"; # Compile the testprogram to assembler - my $stderr = `gcc -S -fno-ident -march=$arch $file 2>&1`; + my $stderr = `$cc -S -fno-ident -march=$arch $file 2>&1`; if ($? != 0) { - error("GCC: Compilation failed\n $stderr"); + error("$cc: Compilation failed\n $stderr"); return 1; } `mv "$asm" "$asm.orig"`; # save before massaging @@ -166,7 +169,7 @@ sub build_exe open(IN, "$asm.orig") || fatal("Cannot open '$file': $!\n"); while (my $line = ) { chomp($line); - next if ($line =~ /^#/); # comment + next if ($line =~ /^\s*#/); # comment next if ($line =~ /\.cfi_/); # cfi stuff if ($in_main == 0) { $in_main = 1 if ($line =~ /^main:/); @@ -192,12 +195,12 @@ sub build_exe close(OUT); # Assemble file and link to executable - my $gcc = "gcc -static -Wa,--fatal-warnings -Wl,--build-id=none" + my $ccc = "$cc -static -Wa,--fatal-warnings -Wl,--build-id=none" . " -nodefaultlibs -nostartfiles"; - $stderr = `$gcc "$asm" -o "$exe" 2>&1`; + $stderr = `$ccc "$asm" -o "$exe" 2>&1`; if ($? != 0) { - error("GCC: Linking executable failed"); + error("$cc: Linking executable failed"); for my $line (split /\n/,$stderr) { print STDERR "$line\n" if ($line !~ /treating warnings as errors/); } From c7590f0e28460af1b46709e235126302eb00e6fb Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 23 Oct 2025 21:10:57 +0000 Subject: [PATCH 401/412] s390x testcases: Fix valgrind invocation coregrind/valgrind works iff valgrind was installed beforehand. But we don't know that. Use vg-in-place instead. --- none/tests/s390x/bfp-emit.pl | 4 ++-- none/tests/s390x/emwarn-gen.pl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/none/tests/s390x/bfp-emit.pl b/none/tests/s390x/bfp-emit.pl index 4128a5d02..a4e191b9e 100755 --- a/none/tests/s390x/bfp-emit.pl +++ b/none/tests/s390x/bfp-emit.pl @@ -27,7 +27,7 @@ my $rootdir = get_rootdir(); my $runone = "$rootdir/auxprogs/s390-runone"; -my $valgrind = "$rootdir/coregrind/valgrind"; +my $valgrind = "$rootdir/vg-in-place"; my $valargs = "-q --tool=none --trace-notbelow=0 --trace-flags=10000001"; @@ -332,7 +332,7 @@ sub test_insn my $stdout = `$valgrind $valargs ./$exe 2>&1`; # Parse the output from valgrind - # Need to find the "interesting" insns in the stream. There isexactly + # Need to find the "interesting" insns in the stream. There is exactly # one such insn in the "frontend" part and in the "assembly" part. # # Let diff --git a/none/tests/s390x/emwarn-gen.pl b/none/tests/s390x/emwarn-gen.pl index 7a142d795..00f2644f4 100755 --- a/none/tests/s390x/emwarn-gen.pl +++ b/none/tests/s390x/emwarn-gen.pl @@ -14,7 +14,7 @@ my $rootdir = get_rootdir(); my $runone = "$rootdir/auxprogs/s390-runone"; -my $valgrind = "$rootdir/coregrind/valgrind"; +my $valgrind = "$rootdir/vg-in-place"; my $valargs = "-q --tool=none --show-emwarns=yes"; &main; From bfabafd7b64de5f40f54020046b40bc4b627a48a Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 23 Oct 2025 22:35:27 +0000 Subject: [PATCH 402/412] none/tests/s390x/bfp-emit testcase: Assorted fixes. Make function check_valgrind_output actually check something.. Remove --check-prereq logic. It is not needed. I think I was doing some experiment of using objdump to make sure the insns written out by valgrind match those produced by objdump. And then there was different behaviour of objdump in different versions. --- none/tests/s390x/bfp-emit.pl | 21 +++++---------------- none/tests/s390x/bfp-emit.vgtest | 2 +- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/none/tests/s390x/bfp-emit.pl b/none/tests/s390x/bfp-emit.pl index a4e191b9e..660449713 100755 --- a/none/tests/s390x/bfp-emit.pl +++ b/none/tests/s390x/bfp-emit.pl @@ -74,16 +74,6 @@ sub main { - if ($#ARGV == 0 && $ARGV[0] eq "--check-prereq") { - my $stdout = `as --version`; - # GNU assembler (GNU Binutils for Ubuntu) 2.38 - $stdout = (split /\n/, $stdout)[0]; - $stdout =~ s/^[^0-9]+//; - my @v = split /\./, $stdout; - exit 0 if ($v[0] > 2 || ($v[0] == 2 && $v[1] >= 44)); - exit 1; - } - #----------------------------------------------------------------------- # POP Chapter 9: Floating-Point Overview and Support Instructions #----------------------------------------------------------------------- @@ -411,25 +401,24 @@ sub test_insn sub check_valgrind_output { - return 0; my ($mnm, $stdout) = @_; my @lines = split /\n/,$stdout; my $num_lines = scalar @lines; - if ($num_lines != 4) { - error("$mnm: Expected 4 lines; found $num_lines"); + if ($num_lines != 2) { + error("$mnm: Expected 2 lines; found $num_lines"); for my $line (@lines) { print "LINE |$line|\n"; } return 1; } - if ($lines[0] !~ "Front end") { + if ($lines[0] !~ "Frontend") { error("$mnm: Unrecognised line |$lines[0]|"); return 1; } - if ($lines[2] !~ "Assembly") { - error("$mnm: Unrecognised line |$lines[2]|"); + if ($lines[1] !~ "Assembly") { + error("$mnm: Unrecognised line |$lines[1]|"); return 1; } return 0; diff --git a/none/tests/s390x/bfp-emit.vgtest b/none/tests/s390x/bfp-emit.vgtest index b6c6e5b06..4bfcbac22 100644 --- a/none/tests/s390x/bfp-emit.vgtest +++ b/none/tests/s390x/bfp-emit.vgtest @@ -1,3 +1,3 @@ -prereq: ./bfp-emit.pl --check-prereq && ../../../tests/s390x_features s390x-fpext +prereq: ../../../tests/s390x_features s390x-fpext prog: /bin/true post: ./bfp-emit.pl From 44b0ab50214051ca05c46274ef21dae86316298b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 24 Oct 2025 01:12:19 +0200 Subject: [PATCH 403/412] configure.ac: Use primary arch flags for openssl and libaio checks Make sure that the configure check for openssl/crypto and libaio use the primary arch flags. These are used in testcases for the primary arch and should compile and link with the primary arch flags (which are empty on most arches, but are set explicitly on e.g. mips). Move the libaio check after the compiler check flags. --- configure.ac | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/configure.ac b/configure.ac index 90fafaf1c..c485b4c8c 100644 --- a/configure.ac +++ b/configure.ac @@ -2173,25 +2173,6 @@ AC_MSG_RESULT([no]) AM_CONDITIONAL(HAVE_NR_IO_PGETEVENTS, [test x$ac_have_nr_io_pgetevents = xyes]) -safe_LIBS="$LIBS" -LIBS="-laio" -AC_MSG_CHECKING([for libaio]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -]], [[ -io_context_t ctx; -io_submit(ctx, 1, NULL); -]])], [ -ac_have_libaio=yes -AC_MSG_RESULT([yes]) -], [ -ac_have_libaio=no -AC_MSG_RESULT([no]) -]) - -AM_CONDITIONAL(HAVE_LIBAIO, [test x$ac_have_libaio = xyes]) -LIBS=$safe_LIBS - #---------------------------------------------------------------------------- # Checking for supported compiler flags. #---------------------------------------------------------------------------- @@ -5393,6 +5374,28 @@ CFLAGS=$safe_CFLAGS AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes]) +safe_CFLAGS=$CFLAGS +CFLAGS="$mflag_primary" +safe_LIBS="$LIBS" +LIBS="-laio" +AC_MSG_CHECKING([for libaio]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +]], [[ +io_context_t ctx; +io_submit(ctx, 1, NULL); +]])], [ +ac_have_libaio=yes +AC_MSG_RESULT([yes]) +], [ +ac_have_libaio=no +AC_MSG_RESULT([no]) +]) + +AM_CONDITIONAL(HAVE_LIBAIO, [test x$ac_have_libaio = xyes]) +LIBS=$safe_LIBS +CFLAGS=$safe_CFLAGS + # Check for __builtin_popcount AC_MSG_CHECKING([for __builtin_popcount()]) @@ -5559,6 +5562,8 @@ AM_CONDITIONAL([HAVE_OPENAT2], # check for crypto +safe_CFLAGS=$CFLAGS +CFLAGS="$mflag_primary" safe_LIBS="$LIBS" LIBS="-lcrypto" AC_MSG_CHECKING([if platform has openssl crypto]) @@ -5575,6 +5580,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ AC_MSG_RESULT([no]) ]) LIBS=$safe_LIBS +CFLAGS=$safe_CFLAGS AM_CONDITIONAL([HAVE_OPENSSL], [test x$ac_have_openssl = xyes]) From 4e3a4a2f729c9af05392a305caae0e2ce8332b61 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Fri, 24 Oct 2025 06:26:51 +0200 Subject: [PATCH 404/412] gdbserver_tests: Avoid l10n problems with gdb tests GNU gdb (Ubuntu 12.1-0ubuntu1) 12.1 with LANG=de_DE.UTF-8 Fixes these issues: == 26 tests, 0 stderr failures, 0 stdout failures, 14 stderrB failures, 10 stdoutB failures, 0 post failures == gdbserver_tests/hginfo (stdoutB) gdbserver_tests/hginfo (stderrB) gdbserver_tests/hgtls (stdoutB) gdbserver_tests/mcblocklistsearch (stderrB) gdbserver_tests/mcbreak (stdoutB) gdbserver_tests/mcbreak (stderrB) gdbserver_tests/mcclean_after_fork (stdoutB) gdbserver_tests/mcclean_after_fork (stderrB) gdbserver_tests/mcinfcallWSRU (stderrB) gdbserver_tests/mcleak (stdoutB) gdbserver_tests/mcleak (stderrB) gdbserver_tests/mcmain_pic (stdoutB) gdbserver_tests/mcmain_pic (stderrB) gdbserver_tests/mcvabits (stdoutB) gdbserver_tests/mcvabits (stderrB) gdbserver_tests/mcwatchpoints (stdoutB) gdbserver_tests/mssnapshot (stdoutB) gdbserver_tests/mssnapshot (stderrB) gdbserver_tests/nlgone_abrt (stderrB) gdbserver_tests/nlgone_return (stderrB) gdbserver_tests/nlpasssigalrm (stdoutB) gdbserver_tests/nlpasssigalrm (stderrB) gdbserver_tests/nlself_invalidate (stderrB) gdbserver_tests/nlsigvgdb (stderrB) All issues are similar to this: --- mcblocklistsearch.stderrB.exp +++ mcblocklistsearch.stderrB.out @@ -1,7 +1,8 @@ vgdb-error value changed from 0 to 999999 -Breakpoint 1 at 0x........: file leak-tree.c, line 42. -Breakpoint 2 at 0x........: file leak-tree.c, line 68. +Haltepunkt 1 at 0x........: file leak-tree.c, line 42. +Haltepunkt 2 at 0x........: file leak-tree.c, line 68. Continuing. +Warnung: Missing auto-load script at offset 0 in section .debug_gdb_scripts Breakpoint 1, f () at leak-tree.c:42 42 t->l = mk(); // B Continuing. @@ -63,4 +64,4 @@ 0x........[16] indirect loss record 4 0x........[16] indirect loss record 5 monitor command request to kill this process -Remote connection closed +Remote Verbindung wurde beendet --- gdbserver_tests/hginfo.vgtest | 1 + gdbserver_tests/hgtls.vgtest | 1 + gdbserver_tests/mcblocklistsearch.vgtest | 1 + gdbserver_tests/mcbreak.vgtest | 1 + gdbserver_tests/mcclean_after_fork.vgtest | 1 + gdbserver_tests/mcinfcallWSRU.vgtest | 1 + gdbserver_tests/mcleak.vgtest | 1 + gdbserver_tests/mcmain_pic.vgtest | 1 + gdbserver_tests/mcvabits.vgtest | 1 + gdbserver_tests/mcwatchpoints.vgtest | 1 + gdbserver_tests/mssnapshot.vgtest | 1 + gdbserver_tests/nlgone_abrt.vgtest | 1 + gdbserver_tests/nlgone_return.vgtest | 1 + gdbserver_tests/nlpasssigalrm.vgtest | 1 + gdbserver_tests/nlself_invalidate.vgtest | 1 + gdbserver_tests/nlsigvgdb.vgtest | 1 + 16 files changed, 16 insertions(+) diff --git a/gdbserver_tests/hginfo.vgtest b/gdbserver_tests/hginfo.vgtest index 0ea8ab4b3..af58a62bd 100644 --- a/gdbserver_tests/hginfo.vgtest +++ b/gdbserver_tests/hginfo.vgtest @@ -5,6 +5,7 @@ vgopts: --tool=helgrind --ignore-thread-creation=yes --vgdb=yes --vgdb-error=0 prereq: test -e gdb.eval stdout_filter: filter_make_empty stderr_filter: filter_stderr +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ../helgrind/tests/hg01_all_ok stdinB: hginfo.stdinB.gdb diff --git a/gdbserver_tests/hgtls.vgtest b/gdbserver_tests/hgtls.vgtest index 44bc4e1ec..73453e15b 100644 --- a/gdbserver_tests/hgtls.vgtest +++ b/gdbserver_tests/hgtls.vgtest @@ -4,6 +4,7 @@ vgopts: --tool=helgrind --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-hg prereq: test -e gdb && test -e ../none/tests/tls && grep '^#define HAVE_TLS 1' ../config.h > /dev/null && grep '^#define HAVE_DLINFO_RTLD_DI_TLS_MODID 1' ../config.h > /dev/null stdout_filter: filter_make_empty stderr_filter: filter_make_empty +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ../none/tests/tls stdinB: hgtls.stdinB.gdb diff --git a/gdbserver_tests/mcblocklistsearch.vgtest b/gdbserver_tests/mcblocklistsearch.vgtest index bced1cde8..5073bc396 100644 --- a/gdbserver_tests/mcblocklistsearch.vgtest +++ b/gdbserver_tests/mcblocklistsearch.vgtest @@ -4,6 +4,7 @@ vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mc prereq: test -e gdb.eval stdout_filter: filter_make_empty stderr_filter: filter_make_empty +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx 1>&2 ../memcheck/tests/leak-tree stdinB: mcblocklistsearch.stdinB.gdb diff --git a/gdbserver_tests/mcbreak.vgtest b/gdbserver_tests/mcbreak.vgtest index d42fbd0d1..ea4e16328 100644 --- a/gdbserver_tests/mcbreak.vgtest +++ b/gdbserver_tests/mcbreak.vgtest @@ -5,6 +5,7 @@ prog: t vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mcbreak stdout_filter: filter_gdb stderr_filter: filter_make_empty +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ./t stdinB: mcbreak.stdinB.gdb diff --git a/gdbserver_tests/mcclean_after_fork.vgtest b/gdbserver_tests/mcclean_after_fork.vgtest index 25ca47132..126194545 100644 --- a/gdbserver_tests/mcclean_after_fork.vgtest +++ b/gdbserver_tests/mcclean_after_fork.vgtest @@ -3,6 +3,7 @@ prereq: test -e gdb prog: clean_after_fork vgopts: --tool=memcheck --vgdb=full --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mcclean_after_fork stderr_filter: filter_memcheck_monitor +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ./clean_after_fork stdinB: mcclean_after_fork.stdinB.gdb diff --git a/gdbserver_tests/mcinfcallWSRU.vgtest b/gdbserver_tests/mcinfcallWSRU.vgtest index af260ff20..91276a108 100644 --- a/gdbserver_tests/mcinfcallWSRU.vgtest +++ b/gdbserver_tests/mcinfcallWSRU.vgtest @@ -10,6 +10,7 @@ vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mc prereq: test -e gdb -a -f gdb.step && ! ../tests/os_test darwin # filter_gdb to replace pid and Thread numbers in the output of the program: stderr_filter: filter_gdb +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx 1>&2 ./sleepers stdinB: mcinfcallWSRU.stdinB.gdb diff --git a/gdbserver_tests/mcleak.vgtest b/gdbserver_tests/mcleak.vgtest index 9cd96a0a2..0a7bd7a52 100644 --- a/gdbserver_tests/mcleak.vgtest +++ b/gdbserver_tests/mcleak.vgtest @@ -4,6 +4,7 @@ vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mc prereq: test -e gdb stdout_filter: filter_memcheck_monitor stderr_filter: filter_memcheck_monitor +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ../memcheck/tests/leak-delta stdinB: mcleak.stdinB.gdb diff --git a/gdbserver_tests/mcmain_pic.vgtest b/gdbserver_tests/mcmain_pic.vgtest index 418695edd..776960e9f 100644 --- a/gdbserver_tests/mcmain_pic.vgtest +++ b/gdbserver_tests/mcmain_pic.vgtest @@ -8,6 +8,7 @@ prog: main_pic vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mcmain_pic stdout_filter: filter_gdb stderr_filter: filter_memcheck_monitor +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ./main_pic stdinB: mcmain_pic.stdinB.gdb diff --git a/gdbserver_tests/mcvabits.vgtest b/gdbserver_tests/mcvabits.vgtest index 9ef834f1c..7298b6569 100644 --- a/gdbserver_tests/mcvabits.vgtest +++ b/gdbserver_tests/mcvabits.vgtest @@ -5,6 +5,7 @@ vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mc stdout_filter: filter_make_empty stderr_filter: filter_make_empty prereq: test -e gdb.eval +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ./t stdinB: mcvabits.stdinB.gdb diff --git a/gdbserver_tests/mcwatchpoints.vgtest b/gdbserver_tests/mcwatchpoints.vgtest index c1152296c..db41f6fe3 100644 --- a/gdbserver_tests/mcwatchpoints.vgtest +++ b/gdbserver_tests/mcwatchpoints.vgtest @@ -6,6 +6,7 @@ prog: watchpoints vgopts: --tool=memcheck --vgdb=full --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mcwatchpoints stdout_filter: filter_make_empty stderr_filter: filter_memcheck_monitor +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ./watchpoints stdinB: mcwatchpoints.stdinB.gdb diff --git a/gdbserver_tests/mssnapshot.vgtest b/gdbserver_tests/mssnapshot.vgtest index 20a558b72..7bf4b8753 100644 --- a/gdbserver_tests/mssnapshot.vgtest +++ b/gdbserver_tests/mssnapshot.vgtest @@ -4,6 +4,7 @@ prog: t vgopts: --tool=massif --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mssnapshot stdout_filter: filter_make_empty stderr_filter: filter_make_empty +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ./t stdinB: mssnapshot.stdinB.gdb diff --git a/gdbserver_tests/nlgone_abrt.vgtest b/gdbserver_tests/nlgone_abrt.vgtest index e1e9f24fd..4c326ebec 100644 --- a/gdbserver_tests/nlgone_abrt.vgtest +++ b/gdbserver_tests/nlgone_abrt.vgtest @@ -5,6 +5,7 @@ args: abort vgopts: -q --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlgone-abrt stderr_filter: filter_stderr prereq: test -e gdb +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ./gone stdinB: nlgone_abrt.stdinB.gdb diff --git a/gdbserver_tests/nlgone_return.vgtest b/gdbserver_tests/nlgone_return.vgtest index 996f01c7b..ddebea997 100644 --- a/gdbserver_tests/nlgone_return.vgtest +++ b/gdbserver_tests/nlgone_return.vgtest @@ -5,6 +5,7 @@ args: return vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlgone-return stderr_filter: filter_stderr prereq: test -e gdb +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ./gone stdinB: nlgone_return.stdinB.gdb diff --git a/gdbserver_tests/nlpasssigalrm.vgtest b/gdbserver_tests/nlpasssigalrm.vgtest index 0450207a6..e9896f5d5 100644 --- a/gdbserver_tests/nlpasssigalrm.vgtest +++ b/gdbserver_tests/nlpasssigalrm.vgtest @@ -8,6 +8,7 @@ prog: passsigalrm vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlpasssigalrm stderr_filter: filter_stderr prereq: test -e gdb +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ./passsigalrm stdinB: nlpasssigalrm.stdinB.gdb diff --git a/gdbserver_tests/nlself_invalidate.vgtest b/gdbserver_tests/nlself_invalidate.vgtest index 203113035..4a1955d35 100644 --- a/gdbserver_tests/nlself_invalidate.vgtest +++ b/gdbserver_tests/nlself_invalidate.vgtest @@ -5,6 +5,7 @@ prog: self_invalidate vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlself_invalidate stderr_filter: filter_stderr prereq: test -e gdb && ( ../tests/arch_test amd64 || ../tests/arch_test mips32 || ../tests/arch_test mips64 ) +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ./self_invalidate stdinB: nlself_invalidate.stdinB.gdb diff --git a/gdbserver_tests/nlsigvgdb.vgtest b/gdbserver_tests/nlsigvgdb.vgtest index 0b03b0405..ad69a129f 100644 --- a/gdbserver_tests/nlsigvgdb.vgtest +++ b/gdbserver_tests/nlsigvgdb.vgtest @@ -8,6 +8,7 @@ args: 1 10000000 0 -S-S-S-S 1 vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlsigvgdb stderr_filter: filter_stderr prereq: test -e gdb -a -f vgdb.invoker +envB: LC_ALL=C progB: gdb argsB: --quiet -l 60 --nx ./sleepers stdinB: nlsigvgdb.stdinB.gdb From f80358f109d1bce25d2013579e5d4b933b502797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= Date: Wed, 15 Oct 2025 06:27:25 -0400 Subject: [PATCH 405/412] server.c: handle qExecAndArgs remote protocol packet New qExecAndArgs packet has been added recently to GDB's remote protocol. The new qExecAndArgs packet is sent from GDB, and gdbserver replies with a packet that includes the executable filename and the arguments string that were used for starting the initial inferior. On the GDB side this information can be used to update GDB's state, the 'show remote exec-file' will reflect how gdbserver was started, and 'show args' will reflect the arguments used for starting the inferior. When running valgrind together with GDB like this: ./vg-in-place --tool=memcheck --vgdb-error=0 /bin/ls -lh ~/build/gdb/gdb/gdb target remote | coregrind/vgdb We can now ask GDB to show the executable's arguments: (gdb) show args Argument list to give program being debugged when it is started is "-lh". or the executable's name: (gdb) show remote exec-file The remote exec-file is "/bin/ls". --- coregrind/m_gdbserver/server.c | 59 ++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c index 21e21da73..6a131e1ba 100644 --- a/coregrind/m_gdbserver/server.c +++ b/coregrind/m_gdbserver/server.c @@ -873,6 +873,65 @@ void handle_query (char *arg_own_buf, int *new_packet_len_p) return; } + /* Without argument, traditional remote protocol. */ + if (strcmp ("qExecAndArgs", arg_own_buf) == 0) { + const HChar *exename = VG_(resolved_exename); + + /* If we don't have an executable, return "U". */ + if (exename == NULL) { + arg_own_buf[0] = 'U'; + arg_own_buf[1] = '\0'; + return; + } + + /* Build the response: "S;;;" + Need to hex-encode both the program name and arguments. */ + + /* First, encode the executable name. */ + char hex_exename[2 * VG_(strlen)(exename) + 1]; + hexify(hex_exename, exename, VG_(strlen)(exename)); + + /* Build the arguments string from VG_(args_for_client). */ + int num_args = VG_(sizeXA)(VG_(args_for_client)); + char *args_str = NULL; + + if (num_args > 0) { + int count = 0; + for (int i = 0; i < num_args; i++) { + HChar* arg = * (HChar**) VG_(indexXA)(VG_(args_for_client), i); + count += VG_(strlen)(arg); + } + + /* Allocate space for args + spaces between them + null terminator. */ + int args_str_size = count + num_args; + args_str = VG_(malloc)("handle_query.qExecAndArgs", args_str_size); + char *p = args_str; + + for (int i = 0; i < num_args; i++) { + HChar* arg = * (HChar**) VG_(indexXA)(VG_(args_for_client), i); + int num = VG_(strlen)(arg); + VG_(memcpy)(p, arg, num); + p += num; + if (i < num_args - 1) { + *p++ = ' '; /* Add space separator between arguments. */ + } + } + *p = '\0'; /* Null terminate the string. */ + + char hex_args_buf[2 * VG_(strlen)(args_str) + 1]; + hexify(hex_args_buf, args_str, VG_(strlen)(args_str)); + VG_(free)(args_str); + + /* Build the full response. */ + VG_(sprintf)(arg_own_buf, "S;%s;%s;", hex_exename, hex_args_buf); + } else { + /* No arguments, just send program name with empty args. */ + VG_(sprintf)(arg_own_buf, "S;%s;;", hex_exename); + } + + return; + } + if (strcmp ("qSymbol::", arg_own_buf) == 0) { /* We have no symbol to read. */ write_ok (arg_own_buf); From 438ca216011583ec96b3ccb55f7b02112b9f5929 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 24 Oct 2025 16:48:09 +0200 Subject: [PATCH 406/412] NEWS: Add bug 510694 Handle qExecAndArgs remote protocol packet Fixed in f80358f109d1 server.c: handle qExecAndArgs remote protocol packet --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index d01944d8a..62a1d8914 100644 --- a/NEWS +++ b/NEWS @@ -207,6 +207,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509642 Add missing ppc64-linux syswraps 509643 Add missing s390x-linux syswraps 510169 Update the LTP version in valgrind testsuite to 20250930 +510694 Handle qExecAndArgs remote protocol packet To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX From ef3f78a3d66db60af42d6b9118deb71bf8c4ba0b Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Mon, 13 Oct 2025 09:53:56 +0200 Subject: [PATCH 407/412] Silence false positive failure of LTP munmap01 After upgrading LTP testsuite version to 20250930 (tracked in bug 510169) munmap01 syscall test started failing. It however turns out that this testcase was substantially rewritten and the failure is expected. This update will silence mentioned false positive. https://bugs.kde.org/show_bug.cgi?id=510292 --- NEWS | 1 + auxprogs/Makefile.am | 3 ++- auxprogs/filters/munmap01 | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 auxprogs/filters/munmap01 diff --git a/NEWS b/NEWS index 62a1d8914..ff72ff158 100644 --- a/NEWS +++ b/NEWS @@ -207,6 +207,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509642 Add missing ppc64-linux syswraps 509643 Add missing s390x-linux syswraps 510169 Update the LTP version in valgrind testsuite to 20250930 +510292 Silence false positive failure of LTP munmap01 510694 Handle qExecAndArgs remote protocol packet To see details of a given bug, visit diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index d96e7fd0a..b68cbac05 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -18,7 +18,8 @@ dist_noinst_SCRIPTS = \ LTP_FILTERS = \ filters/mmap18 \ filters/prctl10 \ - filters/select03 + filters/select03 \ + filters/munmap01 LTP_PATCHES = diff --git a/auxprogs/filters/munmap01 b/auxprogs/filters/munmap01 new file mode 100755 index 000000000..b063ba84c --- /dev/null +++ b/auxprogs/filters/munmap01 @@ -0,0 +1,35 @@ +#!/bin/awk -f + +# Filter out stuff like the following, since it is expected output for the munmap01 testcase: + +# munmap01: unempty log2.filtered: +# ==1980523== +# ==1980523== Process terminating with default action of signal 11 (SIGSEGV): dumping core +# ==1980523== Access not within mapped region at address 0x483F000 +# ==1980523== at 0x401F9A: run (munmap01.c:46) +# ==1980523== by 0x40D42F: fork_testrun.isra.0 (tst_test.c:1669) +# ==1980523== by 0x40F894: tst_run_tcases (tst_test.c:2041) +# ==1980523== by 0x401DCD: main (tst_test.h:738) +# ==1980523== If you believe this happened as a result of a stack +# ==1980523== overflow in your program's main thread (unlikely but +# ==1980523== possible), you can try to increase the size of the +# ==1980523== main thread stack using the --main-stacksize= flag. +# ==1980523== The main thread stack size used in this run was 8388608. +# ==1980540== +# ==1980540== Process terminating with default action of signal 11 (SIGSEGV): dumping core +# ==1980540== Access not within mapped region at address 0x4840000 +# ==1980540== at 0x401F9A: run (munmap01.c:46) +# ==1980540== by 0x40D42F: fork_testrun.isra.0 (tst_test.c:1669) +# ==1980540== by 0x40F894: tst_run_tcases (tst_test.c:2041) +# ==1980540== by 0x401DCD: main (tst_test.h:738) +# ==1980540== If you believe this happened as a result of a stack +# ==1980540== overflow in your program's main thread (unlikely but +# ==1980540== possible), you can try to increase the size of the +# ==1980540== main thread stack using the --main-stacksize= flag. +# ==1980540== The main thread stack size used in this run was 8388608. + +skip = 0 +/==[0-9][0-9]*==/ { skip = 1 } +/Process terminating with default action of signal 11/ { skip = 1; skipblock=1 } +/The main thread stack size used in this run was/ { skip = 1; skipblock=0 } +!skip && !skipblock { print } From 8b230a64f0603723fab048b7b8bdaed7d26fd4ba Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 24 Oct 2025 18:31:31 +0200 Subject: [PATCH 408/412] Don't warn about fcntl F_GETFD with --track-fds fcntl F_GETFD is used to check if a file descriptor is valid, so only make sure it isn't a valgrind fd, otherwise we might warn, with --track-fds=bad for any bad fd. https://bugs.kde.org/show_bug.cgi?id=510436 --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index ff72ff158..bf7d42ec2 100644 --- a/NEWS +++ b/NEWS @@ -208,6 +208,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509643 Add missing s390x-linux syswraps 510169 Update the LTP version in valgrind testsuite to 20250930 510292 Silence false positive failure of LTP munmap01 +510436 Don't warn about fcntl F_GETFD with --track-fds 510694 Handle qExecAndArgs remote protocol packet To see details of a given bug, visit diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 341fa96ec..e8b200385 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -7447,7 +7447,16 @@ PRE(sys_fcntl) # endif *flags |= SfMayBlock; - if (!ML_(fd_allowed)(ARG1, "fcntl", tid, False)) { + /* F_GETFD is used to check if a file descriptor is valid, so only + make sure it isn't a valgrind fd, otherwise we might warn, with + --track-fds=bad for any bad fd. */ + if (ARG2 == VKI_F_GETFD) { + if (ARG1 >= VG_(fd_soft_limit) || + ARG1 == VG_(log_output_sink).fd || + ARG1 == VG_(xml_output_sink).fd) { + SET_STATUS_Failure (VKI_EBADF); + } + } else if (!ML_(fd_allowed)(ARG1, "fcntl", tid, False)) { SET_STATUS_Failure (VKI_EBADF); } } @@ -7563,8 +7572,17 @@ PRE(sys_fcntl64) # endif *flags |= SfMayBlock; - if (!ML_(fd_allowed)(ARG1, "fcntl64", tid, False)) { - SET_STATUS_Failure (VKI_EBADF); + /* F_GETFD is used to check if a file descriptor is valid, so only + make sure it isn't a valgrind fd, otherwise we might warn, with + --track-fds=bad for any bad fd. */ + if (ARG2 == VKI_F_GETFD) { + if (ARG1 >= VG_(fd_soft_limit) || + ARG1 == VG_(log_output_sink).fd || + ARG1 == VG_(xml_output_sink).fd) { + SET_STATUS_Failure (VKI_EBADF); + } + } else if (!ML_(fd_allowed)(ARG1, "fcntl64", tid, False)) { + SET_STATUS_Failure (VKI_EBADF); } } From 218cee2feb2556b6b4b8991cf0977256b801e3e5 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 24 Oct 2025 20:24:02 +0200 Subject: [PATCH 409/412] -> 3.26.0 final --- NEWS | 2 +- configure.ac | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index bf7d42ec2..fdeebfaea 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -Release 3.26.0.RC1 (17 Oct 2025) +Release 3.26.0 (24 Oct 2025) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This release supports X86/Linux, AMD64/Linux, ARM32/Linux, ARM64/Linux, diff --git a/configure.ac b/configure.ac index c485b4c8c..e30e4c1a1 100644 --- a/configure.ac +++ b/configure.ac @@ -18,8 +18,8 @@ AC_PREREQ(2.69) m4_define([v_major_ver], [3]) m4_define([v_minor_ver], [26]) m4_define([v_micro_ver], [0]) -m4_define([v_suffix_ver], [RC1]) -m4_define([v_rel_date], ["17 Oct 2025"]) +m4_define([v_suffix_ver], []) +m4_define([v_rel_date], ["24 Oct 2025"]) m4_define([v_version], m4_if(v_suffix_ver, [], [v_major_ver.v_minor_ver.v_micro_ver], From 7a9c07f567996e7f7a2d021411b901ac9db3554e Mon Sep 17 00:00:00 2001 From: not-matthias Date: Wed, 5 Nov 2025 18:47:22 +0100 Subject: [PATCH 410/412] fix: initialize hash table in lookup function if NULL --- coregrind/m_debuginfo/inltab_lookup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coregrind/m_debuginfo/inltab_lookup.c b/coregrind/m_debuginfo/inltab_lookup.c index 89c748415..04e1df26e 100644 --- a/coregrind/m_debuginfo/inltab_lookup.c +++ b/coregrind/m_debuginfo/inltab_lookup.c @@ -94,7 +94,7 @@ void VG_(inltab_lookup_insert)(VgHashTable *ht, Addr addr, Word inl_idx) { Bool VG_(inltab_lookup_get)(VgHashTable *ht, Addr addr, Word *inl_idx, const DebugInfo* di) { if (ht == NULL) - return False; + ht = VG_(inltab_lookup_new)(); /* Try hash table lookup first */ InlLookupNode *node = VG_(HT_lookup)(ht, (UWord)addr); From 36d7451d196f3be1c08bdb704b7689032cc82488 Mon Sep 17 00:00:00 2001 From: not-matthias Date: Thu, 6 Nov 2025 12:03:45 +0100 Subject: [PATCH 411/412] fix(test): stop after finding main --- callgrind/tests/filter_inline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/callgrind/tests/filter_inline b/callgrind/tests/filter_inline index 678590404..b547eec4f 100755 --- a/callgrind/tests/filter_inline +++ b/callgrind/tests/filter_inline @@ -15,7 +15,7 @@ awk ' } in_main && /^fn=/ && !/^fn=main$/ { - in_main = 0 + exit } in_main { From 429e451e93e02a25f027e6fead08e820d67983ae Mon Sep 17 00:00:00 2001 From: not-matthias Date: Thu, 6 Nov 2025 12:13:23 +0100 Subject: [PATCH 412/412] fix: allow benchmarks to continue on error for non-local valgrind versions --- .github/workflows/codspeed.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 222c2268b..3dee317db 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -91,6 +91,7 @@ jobs: - name: Run the benchmarks uses: CodSpeedHQ/action@main + continue-on-error: ${{ matrix.valgrind != 'local' }} env: CODSPEED_PERF_ENABLED: false with: