From 811335058c9f6df30838bc48cff87ea7ac2bfaf7 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Tue, 13 May 2025 14:51:26 +0000 Subject: [PATCH] import UBI valgrind-3.24.0-3.el9 --- .gitignore | 2 +- .valgrind.metadata | 2 +- ...-Prepare-NEWS-for-branch-3.24-fixes.patch} | 14 +- ...uestArchState-has-no-member-named-gu.patch | 83 --- ...exec_valgrind-Fix-off-by-one-error-w.patch | 37 ++ ...3-Bug-486293-memccpy-false-positives.patch | 96 ---- ...exec_valgrind-Fix-another-off-by-one.patch | 36 ++ ...-inotify_init-syscall-wrapper-missin.patch | 138 ----- ...leak-filter-for-write-on-write-on-li.patch | 27 + ...-patterns-for-missing-main-frame-for.patch | 491 ++++++++++++++++++ ...rinta-and-frinta-vector-instructions.patch | 282 ---------- ...onal-exp-ppc64le-files-to-EXTRA_DIST.patch | 41 ++ ...ng-shared-syscall-numbers-for-mips32.patch | 169 ------ ...landlock_create_ruleset-444-landlock.patch | 358 +++++++++++++ ...ninitialized-err-in-handle_extension.patch | 45 -- ...st_IP_AT_SYSCALL-in-handle_extension.patch | 31 -- ...ts-tc17_sembar.c-Remove-bool-typedef.patch | 35 ++ ...ntext.c-Rename-typedef-struct-thread.patch | 38 ++ ...90x-Minor-fixes-in-extension-s390x.c.patch | 66 --- ...4-gbserver_tests-failures-in-aarch64.patch | 38 -- ...4814.c-sa_handler-take-an-int-as-arg.patch | 34 ++ ...ve_mount-fsopen-fsconfig-fsmount-fsp.patch | 398 ++++++++++++++ ...-regtest-reallocarray-needs-malloc.h.patch | 56 -- ...012-Bug-487439-SIGILL-in-JDK11-JDK17.patch | 184 ------- ...cognize-new-DWARF5-DW_LANG-constants.patch | 144 +++++ ...Use-is-not-a-valid-CoreError-type-in.patch | 147 ++++++ ...created-with-log-file-xml-file-or-lo.patch | 226 -------- ...nal-pipe-fds-after-VG_-fork-in-paren.patch | 138 ----- .../0014-linux-support-EVIOCGRAB-ioctl.patch | 60 +++ ...rams-calling-fnctl-on-valgrind-s-own.patch | 58 --- ...ng-shared-syscall-numbers-for-mips64.patch | 176 ------- ...filters-remove-python-rpm-module-loa.patch | 46 -- .../0018-Implement-VMOVQ-xmm1-xmm2-m64.patch | 318 ------------ .../0019-arm64-Fix-fcvtas-instruction.patch | 258 --------- ...filters-remove-more-verbose-python-r.patch | 52 -- ...e-check-on-btrfs-with-sanity-level-3.patch | 74 --- SPECS/valgrind.spec | 70 +-- 37 files changed, 1894 insertions(+), 2574 deletions(-) rename SOURCES/{0001-Prepare-NEWS-for-branch-3.23-fixes.patch => 0001-Prepare-NEWS-for-branch-3.24-fixes.patch} (65%) delete mode 100644 SOURCES/0002-486180-MIPS-VexGuestArchState-has-no-member-named-gu.patch create mode 100644 SOURCES/0002-vgdb.c-fork_and_exec_valgrind-Fix-off-by-one-error-w.patch delete mode 100644 SOURCES/0003-Bug-486293-memccpy-false-positives.patch create mode 100644 SOURCES/0003-vgdb.c-fork_and_exec_valgrind-Fix-another-off-by-one.patch delete mode 100644 SOURCES/0004-Bug-486569-linux-inotify_init-syscall-wrapper-missin.patch create mode 100644 SOURCES/0004-regtest-add-a-fdleak-filter-for-write-on-write-on-li.patch create mode 100644 SOURCES/0005-Add-exp-and-supp-patterns-for-missing-main-frame-for.patch delete mode 100644 SOURCES/0005-aarch64-frinta-and-frinta-vector-instructions.patch create mode 100644 SOURCES/0006-Add-additional-exp-ppc64le-files-to-EXTRA_DIST.patch delete mode 100644 SOURCES/0006-mips-skip-using-shared-syscall-numbers-for-mips32.patch create mode 100644 SOURCES/0007-Add-support-for-landlock_create_ruleset-444-landlock.patch delete mode 100644 SOURCES/0007-Fix-uninitialized-err-in-handle_extension.patch delete mode 100644 SOURCES/0008-Avoid-use-of-guest_IP_AT_SYSCALL-in-handle_extension.patch create mode 100644 SOURCES/0008-helgrind-tests-tc17_sembar.c-Remove-bool-typedef.patch create mode 100644 SOURCES/0009-drd-tests-swapcontext.c-Rename-typedef-struct-thread.patch delete mode 100644 SOURCES/0009-s390x-Minor-fixes-in-extension-s390x.c.patch delete mode 100644 SOURCES/0010-Bug-453044-gbserver_tests-failures-in-aarch64.patch create mode 100644 SOURCES/0010-none-tests-bug234814.c-sa_handler-take-an-int-as-arg.patch create mode 100644 SOURCES/0011-Add-open_tree-move_mount-fsopen-fsconfig-fsmount-fsp.patch delete mode 100644 SOURCES/0011-Linux-regtest-reallocarray-needs-malloc.h.patch delete mode 100644 SOURCES/0012-Bug-487439-SIGILL-in-JDK11-JDK17.patch create mode 100644 SOURCES/0012-Recognize-new-DWARF5-DW_LANG-constants.patch create mode 100644 SOURCES/0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch delete mode 100644 SOURCES/0013-Don-t-leave-fds-created-with-log-file-xml-file-or-lo.patch delete mode 100644 SOURCES/0014-Close-both-internal-pipe-fds-after-VG_-fork-in-paren.patch create mode 100644 SOURCES/0014-linux-support-EVIOCGRAB-ioctl.patch delete mode 100644 SOURCES/0015-Don-t-allow-programs-calling-fnctl-on-valgrind-s-own.patch delete mode 100644 SOURCES/0016-mips-skip-using-shared-syscall-numbers-for-mips64.patch delete mode 100644 SOURCES/0017-gdbserver_tests-filters-remove-python-rpm-module-loa.patch delete mode 100644 SOURCES/0018-Implement-VMOVQ-xmm1-xmm2-m64.patch delete mode 100644 SOURCES/0019-arm64-Fix-fcvtas-instruction.patch delete mode 100644 SOURCES/0020-gdbserver_tests-filters-remove-more-verbose-python-r.patch delete mode 100644 SOURCES/0021-Avoid-dev-inode-check-on-btrfs-with-sanity-level-3.patch diff --git a/.gitignore b/.gitignore index 357889f..1b236d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/valgrind-3.23.0.tar.bz2 +SOURCES/valgrind-3.24.0.tar.bz2 diff --git a/.valgrind.metadata b/.valgrind.metadata index 434db31..9b603e5 100644 --- a/.valgrind.metadata +++ b/.valgrind.metadata @@ -1 +1 @@ -ec410c75d3920d4f9249a5cfa2cac31e1bf6d586 SOURCES/valgrind-3.23.0.tar.bz2 +6fc0470fedc0d85dae3e042297cabd13c6100749 SOURCES/valgrind-3.24.0.tar.bz2 diff --git a/SOURCES/0001-Prepare-NEWS-for-branch-3.23-fixes.patch b/SOURCES/0001-Prepare-NEWS-for-branch-3.24-fixes.patch similarity index 65% rename from SOURCES/0001-Prepare-NEWS-for-branch-3.23-fixes.patch rename to SOURCES/0001-Prepare-NEWS-for-branch-3.24-fixes.patch index 327fb04..12402a0 100644 --- a/SOURCES/0001-Prepare-NEWS-for-branch-3.23-fixes.patch +++ b/SOURCES/0001-Prepare-NEWS-for-branch-3.24-fixes.patch @@ -1,18 +1,18 @@ -From 2afcd730a10d61c318289bc4c39c42eebd4b35a6 Mon Sep 17 00:00:00 2001 +From cc09f61e56e90c9d3a0e7231cc69b2a499d1205f Mon Sep 17 00:00:00 2001 From: Mark Wielaard -Date: Mon, 29 Apr 2024 15:15:46 +0200 -Subject: [PATCH 01/11] Prepare NEWS for branch 3.23 fixes +Date: Sat, 23 Nov 2024 02:09:27 +0100 +Subject: [PATCH 01/11] Prepare NEWS for branch 3.24 fixes --- NEWS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NEWS b/NEWS -index 11c67410fb6f..8bdd3753f7bb 100644 +index 49b4647d4295..8362e1d2df41 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,14 @@ -+Branch 3.23 ++Branch 3.24 +~~~~~~~~~~~ + +* ==================== FIXED BUGS ==================== @@ -23,9 +23,9 @@ index 11c67410fb6f..8bdd3753f7bb 100644 + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +where XXXXXX is the bug number as listed above. + - Release 3.23.0 (26 Apr 2024) + Release 3.24.0 (31 Oct 2024) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- -2.45.2 +2.47.0 diff --git a/SOURCES/0002-486180-MIPS-VexGuestArchState-has-no-member-named-gu.patch b/SOURCES/0002-486180-MIPS-VexGuestArchState-has-no-member-named-gu.patch deleted file mode 100644 index b8ab417..0000000 --- a/SOURCES/0002-486180-MIPS-VexGuestArchState-has-no-member-named-gu.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 2e26af756d69c53026bf2d6d61589f754796340d Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Sat, 27 Apr 2024 13:07:07 +0200 -Subject: [PATCH 02/11] 486180 [MIPS] 'VexGuestArchState' has no member named - 'guest_IP_AT_SYSCALL' - -(cherry picked from commit 7214886886bce9029f325214156c02dcfff760d5) ---- - NEWS | 2 ++ - VEX/priv/guest_mips_helpers.c | 4 ++++ - VEX/pub/libvex_guest_mips32.h | 6 +++--- - VEX/pub/libvex_guest_mips64.h | 2 ++ - 4 files changed, 11 insertions(+), 3 deletions(-) - -diff --git a/NEWS b/NEWS -index 8bdd3753f7bb..c40e00cce46b 100644 ---- a/NEWS -+++ b/NEWS -@@ -5,6 +5,8 @@ Branch 3.23 - - The following bugs have been fixed or resolved on this branch. - -+486180 [MIPS] 'VexGuestArchState' has no member named 'guest_IP_AT_SYSCALL' -+ - 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. -diff --git a/VEX/priv/guest_mips_helpers.c b/VEX/priv/guest_mips_helpers.c -index 74cfb9c34caa..79197378cc74 100644 ---- a/VEX/priv/guest_mips_helpers.c -+++ b/VEX/priv/guest_mips_helpers.c -@@ -187,6 +187,8 @@ void LibVEX_GuestMIPS32_initialise( /*OUT*/ VexGuestMIPS32State * vex_state) - vex_state->guest_w1.w64[1] = 0; - vex_state->guest_w2.w64[0] = 0; - vex_state->guest_w2.w64[1] = 0; -+ -+ vex_state->guest_IP_AT_SYSCALL = 0; - } - - void LibVEX_GuestMIPS64_initialise ( /*OUT*/ VexGuestMIPS64State * vex_state ) -@@ -294,6 +296,8 @@ void LibVEX_GuestMIPS64_initialise ( /*OUT*/ VexGuestMIPS64State * vex_state ) - vex_state->guest_LLaddr = 0xFFFFFFFFFFFFFFFFULL; - vex_state->guest_LLdata = 0; - -+ vex_state->guest_IP_AT_SYSCALL = 0; -+ - vex_state->guest_MSACSR = 0; - } - -diff --git a/VEX/pub/libvex_guest_mips32.h b/VEX/pub/libvex_guest_mips32.h -index 214f63cdbe8c..e769819d75ae 100644 ---- a/VEX/pub/libvex_guest_mips32.h -+++ b/VEX/pub/libvex_guest_mips32.h -@@ -188,10 +188,10 @@ typedef - - /* 1016 */ UInt guest_MSACSR; - -- /* 1020 */ UInt _padding3; -+ /* 1020 */ UInt guest_IP_AT_SYSCALL; - -- /* 1020 */ ULong guest_LLdata64; -- /* 1028 */ ULong _padding4; -+ /* 1024 */ ULong guest_LLdata64; -+ /* 1032 */ ULong _padding3; - } VexGuestMIPS32State; - /*---------------------------------------------------------------*/ - /*--- Utility functions for MIPS32 guest stuff. ---*/ -diff --git a/VEX/pub/libvex_guest_mips64.h b/VEX/pub/libvex_guest_mips64.h -index 657fe6fa3343..a953f0ab86a2 100644 ---- a/VEX/pub/libvex_guest_mips64.h -+++ b/VEX/pub/libvex_guest_mips64.h -@@ -184,6 +184,8 @@ typedef - /* 1144 */ UInt guest_MSACSR; - - /* 1148 */ UInt _padding2; -+ /* 1152 */ ULong guest_IP_AT_SYSCALL; -+ /* 1160 */ ULong _padding3; - - } VexGuestMIPS64State; - --- -2.45.2 - diff --git a/SOURCES/0002-vgdb.c-fork_and_exec_valgrind-Fix-off-by-one-error-w.patch b/SOURCES/0002-vgdb.c-fork_and_exec_valgrind-Fix-off-by-one-error-w.patch new file mode 100644 index 0000000..30fd79d --- /dev/null +++ b/SOURCES/0002-vgdb.c-fork_and_exec_valgrind-Fix-off-by-one-error-w.patch @@ -0,0 +1,37 @@ +From 2cb0bee2d7722b57956f66a0795b5b9106f88afc Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 12 Nov 2024 13:23:03 +0100 +Subject: [PATCH 02/11] vgdb.c (fork_and_exec_valgrind): Fix off-by-one error + write + +commit 646978d9adc5 ("vgdb: Handle EINTR and EAGAIN more +consistently") introduced an off-by-one issue trying to write back the +error from child to parent. + +Instead of +1 it should have been +written (which initially is zero). + +This is in an "should never happen" path, so hopefully didn't really +cause issues. But if it did happen the parent would have gotten the +wrong error code. + +(cherry picked from commit f4fe5faf3d0f45b3824bbb9070232682df52a582) +--- + coregrind/vgdb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c +index 786ead160d34..112f23fe6ba1 100644 +--- a/coregrind/vgdb.c ++++ b/coregrind/vgdb.c +@@ -1368,7 +1368,7 @@ int fork_and_exec_valgrind (int argc, char **argv, const char *working_dir, + // We try to write the result to the parent, but always exit. + size_t written = 0; + while (written < sizeof (int)) { +- ssize_t nrw = write (pipefd[1], ((char *) &err) + 1, ++ ssize_t nrw = write (pipefd[1], ((char *) &err) + written, + sizeof (int) - written); + if (nrw == -1) { + if (errno == EINTR || errno == EAGAIN) +-- +2.47.0 + diff --git a/SOURCES/0003-Bug-486293-memccpy-false-positives.patch b/SOURCES/0003-Bug-486293-memccpy-false-positives.patch deleted file mode 100644 index 10c7d5e..0000000 --- a/SOURCES/0003-Bug-486293-memccpy-false-positives.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 14141bb4a6ea528b4c0b9295aa64348f7a675735 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Wed, 1 May 2024 09:24:14 +0200 -Subject: [PATCH 03/11] Bug 486293 - memccpy false positives - -(cherry picked from commit 805c020c6e5161966e6eb0099ebe937a510cea9e) ---- - NEWS | 1 + - memcheck/tests/memccpy2.c | 20 ++++++++++++++++++++ - memcheck/tests/memccpy2.stderr.exp | 4 ++-- - shared/vg_replace_strmem.c | 4 ++-- - 4 files changed, 25 insertions(+), 4 deletions(-) - -diff --git a/NEWS b/NEWS -index c40e00cce46b..f674191a286a 100644 ---- a/NEWS -+++ b/NEWS -@@ -6,6 +6,7 @@ Branch 3.23 - The following bugs have been fixed or resolved on this branch. - - 486180 [MIPS] 'VexGuestArchState' has no member named 'guest_IP_AT_SYSCALL' -+486293 memccpy false positives - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/memcheck/tests/memccpy2.c b/memcheck/tests/memccpy2.c -index a5a1dfc9f0af..947324581715 100644 ---- a/memcheck/tests/memccpy2.c -+++ b/memcheck/tests/memccpy2.c -@@ -1,6 +1,8 @@ - #include - #include - #include -+#include -+#include - - int main(void) - { -@@ -9,5 +11,23 @@ int main(void) - memccpy(astring+10, astring, '#', len-10); - sprintf(astring, "this is a string # with something to seek"); - memccpy(astring, astring+10, '#', len); -+ -+ sprintf(astring, "this is a string # with something to seek"); -+ /* -+ * space is earlier than len, no overlap -+ * "this " gets copied (up to and including the first ' ') -+ * and it overwrites the destination starting with the 's' of "string" -+ * so res will point to the 'g' of "string" -+ */ -+ char* res = memccpy(astring+10, astring, ' ', len-10); -+ assert(res && *res == 'g'); -+ sprintf(astring, "this is a string # with something to seek"); -+ /* length is 0, nothing copied, returns NULL */ -+ res = memccpy(astring, "abcdefhhijklmnopqrstuvwxy", 'z', 0); -+ assert(NULL == res); -+ /* 'z' not found so 20 bytes copied, returns NULL */ -+ res = memccpy(astring, "abcdefhhijklmnopqrstuvwxy", 'z', 20); -+ assert(NULL == res); -+ free(astring); - } - -diff --git a/memcheck/tests/memccpy2.stderr.exp b/memcheck/tests/memccpy2.stderr.exp -index 0132ef06c56a..240ce925c182 100644 ---- a/memcheck/tests/memccpy2.stderr.exp -+++ b/memcheck/tests/memccpy2.stderr.exp -@@ -1,8 +1,8 @@ - Source and destination overlap in memccpy(0x........, 0x........, 31) - at 0x........: memccpy (vg_replace_strmem.c:...) -- by 0x........: main (memccpy2.c:9) -+ by 0x........: main (memccpy2.c:11) - - Source and destination overlap in memccpy(0x........, 0x........, 41) - at 0x........: memccpy (vg_replace_strmem.c:...) -- by 0x........: main (memccpy2.c:11) -+ by 0x........: main (memccpy2.c:13) - -diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c -index 737abbf67898..ae13a2a5f87a 100644 ---- a/shared/vg_replace_strmem.c -+++ b/shared/vg_replace_strmem.c -@@ -2364,9 +2364,9 @@ static inline void my_exit ( int x ) - \ - while (i-- > 0) \ - if ((*d++ = *s++) == x) { \ -- SizeT srclen = (i < len) ? i : len; \ -+ SizeT srclen = len - i; \ - RECORD_COPY(srclen); \ -- if (is_overlap(dst, src, srclen, srclen)) \ -+ if (is_overlap(dst, src, len, srclen)) \ - RECORD_OVERLAP_ERROR("memccpy", dst, src, len); \ - return d; \ - } \ --- -2.45.2 - diff --git a/SOURCES/0003-vgdb.c-fork_and_exec_valgrind-Fix-another-off-by-one.patch b/SOURCES/0003-vgdb.c-fork_and_exec_valgrind-Fix-another-off-by-one.patch new file mode 100644 index 0000000..d04870f --- /dev/null +++ b/SOURCES/0003-vgdb.c-fork_and_exec_valgrind-Fix-another-off-by-one.patch @@ -0,0 +1,36 @@ +From 8b08da73cf3d72439c4f750c96ed2f088ef1bbec Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 12 Nov 2024 13:34:09 +0100 +Subject: [PATCH 03/11] vgdb.c (fork_and_exec_valgrind): Fix another off-by-one + error write + +commit 646978d9adc5 ("vgdb: Handle EINTR and EAGAIN more +consistently") introduced another off-by-one issue trying to write +back the error from child to parent. + +Instead of +1 it should have been +written (which initially is zero). + +This is when the child needs to do a chdir and that chdir fails. If +that happens the parent would have gotten the wrong error code. + +(cherry picked from commit 747ca4eb5fed5dd58a14391a997bb9e658e3b1c8) +--- + coregrind/vgdb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c +index 112f23fe6ba1..cc945c8dfafa 100644 +--- a/coregrind/vgdb.c ++++ b/coregrind/vgdb.c +@@ -1289,7 +1289,7 @@ int fork_and_exec_valgrind (int argc, char **argv, const char *working_dir, + // We try to write the result to the parent, but always exit. + size_t written = 0; + while (written < sizeof (int)) { +- int nrw = write (pipefd[1], ((char *)&err) + 1, ++ int nrw = write (pipefd[1], ((char *)&err) + written, + sizeof (int) - written); + if (nrw == -1) { + if (errno == EINTR || errno == EAGAIN) +-- +2.47.0 + diff --git a/SOURCES/0004-Bug-486569-linux-inotify_init-syscall-wrapper-missin.patch b/SOURCES/0004-Bug-486569-linux-inotify_init-syscall-wrapper-missin.patch deleted file mode 100644 index 0b34908..0000000 --- a/SOURCES/0004-Bug-486569-linux-inotify_init-syscall-wrapper-missin.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 3795a011eeb9730cda9f0beadce70aab8aa71e68 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Sat, 4 May 2024 15:03:11 +0200 -Subject: [PATCH 04/11] Bug 486569 - linux inotify_init syscall wrapper missing - POST entry in syscall_table - -(cherry picked from commit b38115cc6087f30f872c533f93c7c31a6d73eb24) ---- - NEWS | 1 + - coregrind/m_syswrap/syswrap-amd64-linux.c | 2 +- - coregrind/m_syswrap/syswrap-arm-linux.c | 2 +- - coregrind/m_syswrap/syswrap-mips32-linux.c | 2 +- - coregrind/m_syswrap/syswrap-mips64-linux.c | 2 +- - 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 +- - 9 files changed, 9 insertions(+), 8 deletions(-) - -diff --git a/NEWS b/NEWS -index f674191a286a..b65f9206679b 100644 ---- a/NEWS -+++ b/NEWS -@@ -7,6 +7,7 @@ The following bugs have been fixed or resolved on this branch. - - 486180 [MIPS] 'VexGuestArchState' has no member named 'guest_IP_AT_SYSCALL' - 486293 memccpy false positives -+486569 linux inotify_init syscall wrapper missing POST entry in syscall_table - - 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-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c -index a59e01826ca2..86a47d9c2811 100644 ---- a/coregrind/m_syswrap/syswrap-amd64-linux.c -+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c -@@ -773,7 +773,7 @@ static SyscallTableEntry syscall_table[] = { - LINXY(__NR_keyctl, sys_keyctl), // 250 - LINX_(__NR_ioprio_set, sys_ioprio_set), // 251 - LINX_(__NR_ioprio_get, sys_ioprio_get), // 252 -- LINX_(__NR_inotify_init, sys_inotify_init), // 253 -+ LINXY(__NR_inotify_init, sys_inotify_init), // 253 - LINX_(__NR_inotify_add_watch, sys_inotify_add_watch), // 254 - - LINX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 255 -diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c -index 217b1c49dc9d..7b536e52cb2e 100644 ---- a/coregrind/m_syswrap/syswrap-arm-linux.c -+++ b/coregrind/m_syswrap/syswrap-arm-linux.c -@@ -922,7 +922,7 @@ static SyscallTableEntry syscall_main_table[] = { - // LINX_(__NR_ioprio_set, sys_ioprio_set), // 289 - - // LINX_(__NR_ioprio_get, sys_ioprio_get), // 290 -- LINX_(__NR_inotify_init, sys_inotify_init), // 291 -+ 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 - // LINX_(__NR_migrate_pages, sys_migrate_pages), // 294 -diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c -index 3f991da0a18d..e2f499eb80f8 100644 ---- a/coregrind/m_syswrap/syswrap-mips32-linux.c -+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c -@@ -1037,7 +1037,7 @@ static SyscallTableEntry syscall_main_table[] = { - LINXY (__NR_mq_timedreceive, sys_mq_timedreceive), // 274 - LINX_ (__NR_mq_notify, sys_mq_notify), // 275 - LINXY (__NR_mq_getsetattr, sys_mq_getsetattr), // 276 -- LINX_ (__NR_inotify_init, sys_inotify_init), // 275 -+ LINXY (__NR_inotify_init, sys_inotify_init), // 275 - LINX_ (__NR_inotify_add_watch, sys_inotify_add_watch), // 276 - LINX_ (__NR_inotify_rm_watch, sys_inotify_rm_watch), // 277 - LINXY (__NR_waitid, sys_waitid), // 278 -diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c -index 9899a21cfa78..24f2bcc93956 100644 ---- a/coregrind/m_syswrap/syswrap-mips64-linux.c -+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c -@@ -759,7 +759,7 @@ static SyscallTableEntry syscall_main_table[] = { - LINX_ (__NR_request_key, sys_request_key), - LINXY (__NR_keyctl, sys_keyctl), - PLAX_ (__NR_set_thread_area, sys_set_thread_area), -- LINX_ (__NR_inotify_init, sys_inotify_init), -+ LINXY (__NR_inotify_init, sys_inotify_init), - LINX_ (__NR_inotify_add_watch, sys_inotify_add_watch), - LINX_ (__NR_inotify_rm_watch, sys_inotify_rm_watch), - LINXY (__NR_openat, sys_openat), -diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c -index 0aabfbb179ec..74ba68564cd8 100644 ---- a/coregrind/m_syswrap/syswrap-ppc32-linux.c -+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c -@@ -944,7 +944,7 @@ static SyscallTableEntry syscall_table[] = { - LINX_(__NR_ioprio_set, sys_ioprio_set), // 273 - LINX_(__NR_ioprio_get, sys_ioprio_get), // 274 - -- LINX_(__NR_inotify_init, sys_inotify_init), // 275 -+ LINXY(__NR_inotify_init, sys_inotify_init), // 275 - LINX_(__NR_inotify_add_watch, sys_inotify_add_watch), // 276 - LINX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 277 - PLAXY(__NR_spu_run, sys_spu_run), // 278 -diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c -index 35e3f8ec4ee4..4609e10df363 100644 ---- a/coregrind/m_syswrap/syswrap-ppc64-linux.c -+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c -@@ -928,7 +928,7 @@ static SyscallTableEntry syscall_table[] = { - LINX_(__NR_ioprio_set, sys_ioprio_set), // 273 - LINX_(__NR_ioprio_get, sys_ioprio_get), // 274 - -- LINX_(__NR_inotify_init, sys_inotify_init), // 275 -+ LINXY(__NR_inotify_init, sys_inotify_init), // 275 - LINX_(__NR_inotify_add_watch, sys_inotify_add_watch), // 276 - LINX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 277 - -diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c -index f941bdd1907a..9ed2fa46888f 100644 ---- a/coregrind/m_syswrap/syswrap-s390x-linux.c -+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c -@@ -751,7 +751,7 @@ static SyscallTableEntry syscall_table[] = { - LINXY(__NR_waitid, sys_waitid), // 281 - LINX_(__NR_ioprio_set, sys_ioprio_set), // 282 - LINX_(__NR_ioprio_get, sys_ioprio_get), // 283 -- LINX_(__NR_inotify_init, sys_inotify_init), // 284 -+ LINXY(__NR_inotify_init, sys_inotify_init), // 284 - - LINX_(__NR_inotify_add_watch, sys_inotify_add_watch), // 285 - LINX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 286 -diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c -index c6cf682e797c..ea930bafe3ec 100644 ---- a/coregrind/m_syswrap/syswrap-x86-linux.c -+++ b/coregrind/m_syswrap/syswrap-x86-linux.c -@@ -1508,7 +1508,7 @@ static SyscallTableEntry syscall_table[] = { - LINX_(__NR_ioprio_set, sys_ioprio_set), // 289 - - LINX_(__NR_ioprio_get, sys_ioprio_get), // 290 -- LINX_(__NR_inotify_init, sys_inotify_init), // 291 -+ 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 - // LINX_(__NR_migrate_pages, sys_migrate_pages), // 294 --- -2.45.2 - diff --git a/SOURCES/0004-regtest-add-a-fdleak-filter-for-write-on-write-on-li.patch b/SOURCES/0004-regtest-add-a-fdleak-filter-for-write-on-write-on-li.patch new file mode 100644 index 0000000..2a8838a --- /dev/null +++ b/SOURCES/0004-regtest-add-a-fdleak-filter-for-write-on-write-on-li.patch @@ -0,0 +1,27 @@ +From 7e79bb6e6b80eb43138cbbb64737433f9e036cd4 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Thu, 21 Nov 2024 08:44:04 +0100 +Subject: [PATCH 04/11] regtest: add a fdleak filter for write on write on + linux arm64 + +(cherry picked from commit 9150b3c7cfad2fdbeb7cf707175c359ee12d8f75) +--- + none/tests/filter_fdleak | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/none/tests/filter_fdleak b/none/tests/filter_fdleak +index d26937bccd38..72923aa730c8 100755 +--- a/none/tests/filter_fdleak ++++ b/none/tests/filter_fdleak +@@ -19,6 +19,8 @@ perl -p -e 's/socket\.c:[1-9][0-9]*/in \/...libc.../' | + # arm systems substitute open for creat + perl -p -e 's/open \(open64\.c:[1-9][0-9]*\)/creat (in \/...libc...)/' | + perl -p -e "s/: open \(/: creat (/" | ++# arm64 write resolved to file:line with debuginfo ++perl -p -e "s/write\.c:[1-9][0-9]*/in \/...libc.../" | + + # FreeBSD specific fdleak filters + perl -p -e 's/ _close / close /;s/ _openat / creat /;s/internet/AF_INET socket 4: 127.0.0.1:... <-> 127.0.0.1:.../' | +-- +2.47.0 + diff --git a/SOURCES/0005-Add-exp-and-supp-patterns-for-missing-main-frame-for.patch b/SOURCES/0005-Add-exp-and-supp-patterns-for-missing-main-frame-for.patch new file mode 100644 index 0000000..22efd08 --- /dev/null +++ b/SOURCES/0005-Add-exp-and-supp-patterns-for-missing-main-frame-for.patch @@ -0,0 +1,491 @@ +From ba15b8fe7d6fabfb73424a616de18a752a56430a Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sat, 23 Nov 2024 21:28:13 +0100 +Subject: [PATCH 05/11] Add exp and supp patterns for missing main frame for + ppc64le + +In some cases on ppc64le we are missing the main frame. +Add alternative .exp-ppc64le variants for socket_close_xml, +fdleak_cmsg_xml and fdleak_ipv4_xml. And extra suppressions +without a main frame for fdleak_cmsg_supp. + +See also commit 04d30049b "Filter away "main" differences in filter_fdleak" + +(cherry picked from commit e6960c2e41b103ab8d393cbe13dc6473fb89bffc) +--- + none/tests/fdleak_cmsg_supp.supp | 47 ++++++ + none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le | 147 ++++++++++++++++++ + none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le | 139 +++++++++++++++++ + .../tests/socket_close_xml.stderr.exp-ppc64le | 98 ++++++++++++ + 4 files changed, 431 insertions(+) + create mode 100644 none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le + create mode 100644 none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le + create mode 100644 none/tests/socket_close_xml.stderr.exp-ppc64le + +diff --git a/none/tests/fdleak_cmsg_supp.supp b/none/tests/fdleak_cmsg_supp.supp +index 92fbacabdb78..a169fd888bcc 100644 +--- a/none/tests/fdleak_cmsg_supp.supp ++++ b/none/tests/fdleak_cmsg_supp.supp +@@ -12,6 +12,13 @@ + fun:server + fun:main + } ++{ ++ sup2-ppc64le ++ CoreError:FdNotClosed ++ fun:socket ++ fun:server ++ #fun:main ++} + { + sup3 + CoreError:FdNotClosed +@@ -42,3 +49,43 @@ + fun:client + fun:main + } ++{ ++ sup6-ppc64le ++ CoreError:FdNotClosed ++ fun:socket ++ fun:client ++ #fun:main ++} ++{ ++ sup7 ++ CoreError:FdNotClosed ++ fun:_so_socket ++ fun:__xnet_socket ++ fun:client ++ fun:main ++} ++{ ++ sup8 ++ CoreError:FdNotClosed ++ fun:__so_recvmsg ++ fun:__xnet_recvmsg ++ fun:client ++ fun:main ++} ++{ ++ sup9 ++ CoreError:FdNotClosed ++ fun:_so_socket ++ fun:__xnet_socket ++ fun:server ++ fun:main ++} ++{ ++ sup10 ++ CoreError:FdNotClosed ++ fun:__so_accept ++ fun:accept ++ fun:server ++ fun:main ++} ++ +diff --git a/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le b/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le +new file mode 100644 +index 000000000000..6294094eb92e +--- /dev/null ++++ b/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le +@@ -0,0 +1,147 @@ ++ ++ ++ ++ ++5 ++none ++ ++ ++ Nulgrind, the minimal Valgrind tool ++ Copyright... ++ Using Valgrind... ++ Command: ./fdleak_cmsg ++ ++ ++... ++... ++none ++ ++ ++ ++ ... ++ --command-line-only=yes ++ --memcheck:leak-check=no ++ --tool=none ++ --track-fds=all ++ --xml=yes ++ --xml-fd=2 ++ --child-silent-after-fork=yes ++ ++ ++ ... ++ ++ ++ ++ ++ RUNNING ++ ++ ++ ++ ++ ++ FINISHED ++ ++ ++ ++ ++ 0x........ ++ ... ++ FdNotClosed ++ 5 ++ ... ++ ... ++ ++ ++ 0x........ ++ ... ++ client ++ ... ++ fdleak_cmsg.c ++ 133 ++ ++ ++ 0x........ ++ ... ++ main ++ ... ++ fdleak_cmsg.c ++ 174 ++ ++ ++ ++ ++ ++ 0x........ ++ ... ++ FdNotClosed ++ 4 ++ ... ++ ... ++ ++ ++ 0x........ ++ ... ++ client ++ ... ++ fdleak_cmsg.c ++ 133 ++ ++ ++ 0x........ ++ ... ++ main ++ ... ++ fdleak_cmsg.c ++ 174 ++ ++ ++ ++ ++ ++ 0x........ ++ ... ++ FdNotClosed ++ 3 ++ ... ++ ++ ++ 0x........ ++ ... ++ client ++ ... ++ fdleak_cmsg.c ++ 112 ++ ++ ++ ++ ++ ++ 0x........ ++ ... ++ FdNotClosed ++ 2 ++ ... ++ ... ++ ++ ++ ++ 0x........ ++ ... ++ FdNotClosed ++ 1 ++ ... ++ ... ++ ++ ++ ++ 0x........ ++ ... ++ FdNotClosed ++ 0 ++ ... ++ ... ++ ++ ++ ++ ++ +diff --git a/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le +new file mode 100644 +index 000000000000..df413b62895c +--- /dev/null ++++ b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le +@@ -0,0 +1,139 @@ ++ ++ ++ ++ ++5 ++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 ++ ++ ++ 0x........ ++ ... ++ main ++ ... ++ fdleak_ipv4.c ++ 90 ++ ++ ++ Previously closed ++ ++ ++ 0x........ ++ ... ++ client ++ ... ++ fdleak_ipv4.c ++ 69 ++ ++ ++ 0x........ ++ ... ++ main ++ ... ++ fdleak_ipv4.c ++ 90 ++ ++ ++ Originally opened ++ ++ ++ 0x........ ++ ... ++ client ++ ... ++ fdleak_ipv4.c ++ 68 ++ ++ ++ 0x........ ++ ... ++ main ++ ... ++ fdleak_ipv4.c ++ 90 ++ ++ ++ ++ ++ ++ ++ FINISHED ++ ++ ++ ++ ++ 0x........ ++ ... ++ FdNotClosed ++ 3 ++ ... ++ ++ ++ 0x........ ++ ... ++ client ++ ... ++ fdleak_ipv4.c ++ 51 ++ ++ ++ ++ ++ ++ ++ 1 ++ 0x........ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/none/tests/socket_close_xml.stderr.exp-ppc64le b/none/tests/socket_close_xml.stderr.exp-ppc64le +new file mode 100644 +index 000000000000..2f2bc9831e79 +--- /dev/null ++++ b/none/tests/socket_close_xml.stderr.exp-ppc64le +@@ -0,0 +1,98 @@ ++ ++ ++ ++ ++5 ++none ++ ++ ++ Nulgrind, the minimal Valgrind tool ++ Copyright... ++ Using Valgrind... ++ Command: ./socket_close ++ ++ ++... ++... ++none ++ ++ ++ ++ ... ++ --command-line-only=yes ++ --memcheck:leak-check=no ++ --tool=none ++ -q ++ --track-fds=yes ++ --xml=yes ++ --xml-fd=2 ++ ++ ++ ... ++ ++ ++ ++ ++ RUNNING ++ ++ ++ ++Open socket 3 ++close socket_fd 3 ++and close the socket again 3 ++ ++ 0x........ ++ ... ++ FdBadClose ++ 3 ++ ... ++ ++ ++ 0x........ ++ ... ++ main ++ ... ++ socket_close.c ++ 40 ++ ++ ++ Previously closed ++ ++ ++ 0x........ ++ ... ++ main ++ ... ++ socket_close.c ++ 36 ++ ++ ++ Originally opened ++ ++ ++ 0x........ ++ ... ++ open_socket ++ ... ++ socket_close.c ++ 17 ++ ++ ++ ++ ++ ++ ++ FINISHED ++ ++ ++ ++ ++ ++ 1 ++ 0x........ ++ ++ ++ ++ ++ ++ +-- +2.47.0 + diff --git a/SOURCES/0005-aarch64-frinta-and-frinta-vector-instructions.patch b/SOURCES/0005-aarch64-frinta-and-frinta-vector-instructions.patch deleted file mode 100644 index 9a9c7d9..0000000 --- a/SOURCES/0005-aarch64-frinta-and-frinta-vector-instructions.patch +++ /dev/null @@ -1,282 +0,0 @@ -From f5d1c336e9276dd5947ef94c9831d9d53673b75b Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Thu, 9 May 2024 21:01:52 +0200 -Subject: [PATCH 05/11] aarch64 frinta and frinta vector instructions - -The initial fix for Bug 484426 only corrected frinta and frintn -scalar instructions. This adds support for the vector variants. - -(cherry picked from commit 7b66a5b58219ac1a4865da8e371edbdb8d765f32) ---- - NEWS | 1 + - VEX/priv/guest_arm64_toIR.c | 47 ++++++---- - none/tests/arm64/frinta_frintn.cpp | 141 +++++++++++++++++++++++++++++ - 3 files changed, 171 insertions(+), 18 deletions(-) - -diff --git a/NEWS b/NEWS -index b65f9206679b..adb52169dd87 100644 ---- a/NEWS -+++ b/NEWS -@@ -8,6 +8,7 @@ The following bugs have been fixed or resolved on this branch. - 486180 [MIPS] 'VexGuestArchState' has no member named 'guest_IP_AT_SYSCALL' - 486293 memccpy false positives - 486569 linux inotify_init syscall wrapper missing POST entry in syscall_table -+n-i-bz aarch64 frinta and frinta vector instructions - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/VEX/priv/guest_arm64_toIR.c b/VEX/priv/guest_arm64_toIR.c -index c7e395b4b63d..27d945d6328d 100644 ---- a/VEX/priv/guest_arm64_toIR.c -+++ b/VEX/priv/guest_arm64_toIR.c -@@ -13821,46 +13821,57 @@ Bool dis_AdvSIMD_two_reg_misc(/*MB_OUT*/DisResult* dres, UInt insn) - /* -------- 1,1x,11000 (apparently unassigned) (7) -------- */ - /* -------- 1,1x,11001 FRINTI 2d_2d, 4s_4s, 2s_2s (8) -------- */ - /* rm plan: -- FRINTN: tieeven -- !! FIXME KLUDGED !! -+ FRINTN: tieeven - FRINTM: -inf - FRINTP: +inf - FRINTZ: zero -- FRINTA: tieaway -- !! FIXME KLUDGED !! -+ FRINTA: tieaway - FRINTX: per FPCR + "exact = TRUE" - FRINTI: per FPCR - */ - Bool isD = (size & 1) == 1; - if (bitQ == 0 && isD) return False; // implied 1d case - -- IRTemp irrmRM = mk_get_IR_rounding_mode(); -- -- UChar ch = '?'; -- IRTemp irrm = newTemp(Ity_I32); -+ UChar ch = '?'; -+ IROp op = isD ? Iop_RoundF64toInt : Iop_RoundF32toInt; -+ Bool isBinop = True; -+ IRExpr* irrmE = NULL; - switch (ix) { -- case 1: ch = 'n'; assign(irrm, mkU32(Irrm_NEAREST)); break; -- case 2: ch = 'm'; assign(irrm, mkU32(Irrm_NegINF)); break; -- case 3: ch = 'p'; assign(irrm, mkU32(Irrm_PosINF)); break; -- case 4: ch = 'z'; assign(irrm, mkU32(Irrm_ZERO)); break; -+ case 1: ch = 'n'; isBinop = False; op = isD ? Iop_RoundF64toIntE : Iop_RoundF32toIntE; break; -+ case 2: ch = 'm'; irrmE = mkU32(Irrm_NegINF); break; -+ case 3: ch = 'p'; irrmE = mkU32(Irrm_PosINF); break; -+ case 4: ch = 'z'; irrmE = mkU32(Irrm_ZERO); break; - // The following is a kludge. Should be: Irrm_NEAREST_TIE_AWAY_0 -- case 5: ch = 'a'; assign(irrm, mkU32(Irrm_NEAREST)); break; -+ case 5: ch = 'a'; isBinop = False; op = isD ? Iop_RoundF64toIntA0 : Iop_RoundF32toIntA0; break; - // I am unsure about the following, due to the "integral exact" - // description in the manual. What does it mean? (frintx, that is) -- case 6: ch = 'x'; assign(irrm, mkexpr(irrmRM)); break; -- case 8: ch = 'i'; assign(irrm, mkexpr(irrmRM)); break; -+ case 6: ch = 'x'; irrmE = mkexpr(mk_get_IR_rounding_mode()); break; -+ case 8: ch = 'i'; irrmE = mkexpr(mk_get_IR_rounding_mode()); break; - default: vassert(0); - } - -- IROp opRND = isD ? Iop_RoundF64toInt : Iop_RoundF32toInt; - if (isD) { - for (UInt i = 0; i < 2; i++) { -- putQRegLane(dd, i, binop(opRND, mkexpr(irrm), -- getQRegLane(nn, i, Ity_F64))); -+ if (isBinop) { -+ IRTemp irrm = newTemp(Ity_I32); -+ assign(irrm, irrmE); -+ putQRegLane(dd, i, binop(op, mkexpr(irrm), -+ getQRegLane(nn, i, Ity_F64))); -+ } else { -+ putQRegLane(dd, i, unop(op, getQRegLane(nn, i, Ity_F64))); -+ } - } - } else { - UInt n = bitQ==1 ? 4 : 2; - for (UInt i = 0; i < n; i++) { -- putQRegLane(dd, i, binop(opRND, mkexpr(irrm), -- getQRegLane(nn, i, Ity_F32))); -+ if (isBinop) { -+ IRTemp irrm = newTemp(Ity_I32); -+ assign(irrm, irrmE); -+ putQRegLane(dd, i, binop(op, mkexpr(irrm), -+ getQRegLane(nn, i, Ity_F32))); -+ } else { -+ putQRegLane(dd, i, unop(op, getQRegLane(nn, i, Ity_F32))); -+ } - } - if (bitQ == 0) - putQRegLane(dd, 1, mkU64(0)); // zero out lanes 2 and 3 -diff --git a/none/tests/arm64/frinta_frintn.cpp b/none/tests/arm64/frinta_frintn.cpp -index 8e13761eb966..c0803688f698 100644 ---- a/none/tests/arm64/frinta_frintn.cpp -+++ b/none/tests/arm64/frinta_frintn.cpp -@@ -36,6 +36,55 @@ void test_frinta(T input, T expected) - } - } - -+template -+void test_frinta_fullvec(T* input, T* expected) -+{ -+ T result[2*sizeof(double)/sizeof(T)]; -+ T* rp = result; -+ if constexpr (std::is_same_v == true) -+ { -+ __asm__ __volatile__( -+ "ldr q23, [%1];\n" -+ "frinta v22.2d, v23.2d;\n" -+ "str q22, [%0];\n" -+ : "+rm" (rp) -+ : "r" (input) -+ : "memory", "v22", "v23"); -+ assert(result[0] == expected[0]); -+ assert(result[1] == expected[1]); -+ } -+ else -+ { -+ __asm__ __volatile__( -+ "ldr q23, [%1];\n" -+ "frinta v22.4s, v23.4s;\n" -+ "str q22, [%0];\n" -+ : "+rm" (rp) -+ : "r" (input) -+ : "memory", "v22", "v23"); -+ assert(result[0] == expected[0]); -+ assert(result[1] == expected[1]); -+ assert(result[2] == expected[2]); -+ assert(result[3] == expected[3]); -+ } -+} -+ -+void test_frinta_halfvec(float* input, float* expected) -+{ -+ float result[2]; -+ float* rp = result; -+ __asm__ __volatile__( -+ "ldr d23, [%1];\n" -+ "frinta v22.2s, v23.2s;\n" -+ "str d22, [%0];\n" -+ : "+rm" (rp) -+ : "r" (input) -+ : "memory", "v22", "v23"); -+ assert(result[0] == expected[0]); -+ assert(result[1] == expected[1]); -+} -+ -+ - template - void test_frintn(T input, T expected) - { -@@ -66,6 +115,54 @@ void test_frintn(T input, T expected) - } - } - -+template -+void test_frintn_fullvec(T* input, T* expected) -+{ -+ T result[2*sizeof(double)/sizeof(T)]; -+ T* rp = result; -+ if constexpr (std::is_same_v == true) -+ { -+ __asm__ __volatile__( -+ "ldr q23, [%1];\n" -+ "frintn v22.2d, v23.2d;\n" -+ "str q22, [%0];\n" -+ : "+rm" (rp) -+ : "r" (input) -+ : "memory", "v22", "v23"); -+ assert(result[0] == expected[0]); -+ assert(result[1] == expected[1]); -+ } -+ else -+ { -+ __asm__ __volatile__( -+ "ldr q23, [%1];\n" -+ "frintn v22.4s, v23.4s;\n" -+ "str q22, [%0];\n" -+ : "+rm" (rp) -+ : "r" (input) -+ : "memory", "v22", "v23"); -+ assert(result[0] == expected[0]); -+ assert(result[1] == expected[1]); -+ assert(result[2] == expected[2]); -+ assert(result[3] == expected[3]); -+ } -+} -+ -+void test_frintn_halfvec(float* input, float* expected) -+{ -+ float result[2]; -+ float* rp = result; -+ __asm__ __volatile__( -+ "ldr d23, [%1];\n" -+ "frintn v22.2s, v23.2s;\n" -+ "str d22, [%0];\n" -+ : "+rm" (rp) -+ : "r" (input) -+ : "memory", "v22", "v23"); -+ assert(result[0] == expected[0]); -+ assert(result[1] == expected[1]); -+} -+ - int main() - { - // round "away from zero" -@@ -78,6 +175,36 @@ int main() - test_frinta(-1.5F, -2.0F); - test_frinta(-2.5F, -3.0F); - -+ double in1[] = {1.5, 1.5}; -+ double out1[] = {2.0, 2,0}; -+ test_frinta_fullvec(in1, out1); -+ double in2[] = {2.5, 2.5}; -+ double out2[] = {3.0, 3,0}; -+ test_frinta_fullvec(in2, out2); -+ double in3[] = {-1.5, -1.5}; -+ double out3[] = {-2.0, -2,0}; -+ test_frinta_fullvec(in3, out3); -+ double in4[] = {-2.5, -2.5}; -+ double out4[] = {-3.0, -3,0}; -+ test_frinta_fullvec(in4, out4); -+ -+ float in1f[] = {1.5F, 1.5F, 1.5F, 1.5F}; -+ float out1f[] = {2.0F, 2.0F, 2.0F, 2.0F}; -+ test_frinta_fullvec(in1f, out1f); -+ test_frinta_halfvec(in1f, out1f); -+ float in2f[] = {2.5F, 2.5F, 2.5F, 2.5F}; -+ float out2f[] = {3.0F, 3.0F, 3.0F, 3.0F}; -+ test_frinta_fullvec(in2f, out2f); -+ test_frinta_halfvec(in2f, out2f); -+ float in3f[] = {-1.5F, -1.5F, -1.5F, -1.5F}; -+ float out3f[] = {-2.0F, -2.0F, -2.0F, -2.0F}; -+ test_frinta_fullvec(in3f, out3f); -+ test_frinta_halfvec(in3f, out3f); -+ float in4f[] = {-2.5F, -2.5F, -2.5F, -2.5F}; -+ float out4f[] = {-3.0F, -3.0F, -3.0F, -3.0F}; -+ test_frinta_fullvec(in4f, out4f); -+ test_frinta_halfvec(in4f, out4f); -+ - // round "to even" - test_frintn(1.5, 2.0); - test_frintn(2.5, 2.0); -@@ -87,5 +214,19 @@ int main() - test_frintn(2.5F, 2.0F); - test_frintn(-1.5F, -2.0F); - test_frintn(-2.5F, -2.0F); -+ -+ test_frintn_fullvec(in1, out1); -+ test_frintn_fullvec(in2, out1); -+ test_frintn_fullvec(in3, out3); -+ test_frintn_fullvec(in4, out3); -+ -+ test_frintn_fullvec(in1f, out1f); -+ test_frintn_halfvec(in1f, out1f); -+ test_frintn_fullvec(in2f, out1f); -+ test_frintn_halfvec(in2f, out1f); -+ test_frintn_fullvec(in3f, out3f); -+ test_frintn_halfvec(in3f, out3f); -+ test_frintn_fullvec(in4f, out3f); -+ test_frintn_halfvec(in4f, out3f); - } - --- -2.45.2 - diff --git a/SOURCES/0006-Add-additional-exp-ppc64le-files-to-EXTRA_DIST.patch b/SOURCES/0006-Add-additional-exp-ppc64le-files-to-EXTRA_DIST.patch new file mode 100644 index 0000000..2a483ba --- /dev/null +++ b/SOURCES/0006-Add-additional-exp-ppc64le-files-to-EXTRA_DIST.patch @@ -0,0 +1,41 @@ +From 42f196574aebea451c7e4138b476e042ba302745 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Sun, 24 Nov 2024 08:10:51 +0100 +Subject: [PATCH 06/11] Add additional exp-ppc64le files to EXTRA_DIST + +(cherry picked from commit 7241959ebb88a588eebe5a9fd35d1642db71474b) +--- + none/tests/Makefile.am | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am +index 59be79e57920..53a6e1f6bc95 100644 +--- a/none/tests/Makefile.am ++++ b/none/tests/Makefile.am +@@ -135,6 +135,7 @@ EXTRA_DIST = \ + faultstatus.vgtest faultstatus.stderr.exp faultstatus.stderr.exp-s390x \ + fcntl_setown.vgtest fcntl_setown.stdout.exp fcntl_setown.stderr.exp \ + fdleak_cmsg.stderr.exp fdleak_cmsg.vgtest \ ++ fdleak_cmsg_xml.stderr.exp-ppc64le \ + fdleak_cmsg_xml.stderr.exp fdleak_cmsg_xml.vgtest \ + fdleak_cmsg_supp.stderr.exp fdleak_cmsg_supp.supp \ + fdleak_cmsg_supp.vgtest \ +@@ -149,6 +150,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-ppc64le \ + fdleak_ipv4_xml.stderr.exp fdleak_ipv4_xml.stdout.exp \ + fdleak_ipv4_xml.vgtest fdleak_ipv4_xml.stderr.exp-nomain \ + fdleak_open.stderr.exp fdleak_open.vgtest \ +@@ -248,6 +250,7 @@ EXTRA_DIST = \ + process_vm_readv_writev.stderr.exp process_vm_readv_writev.vgtest \ + sigprocmask.stderr.exp sigprocmask.vgtest \ + socket_close.stderr.exp socket_close.vgtest \ ++ socket_close_xml.stderr.exp-ppc64le \ + socket_close_xml.stderr.exp socket_close_xml.vgtest \ + file_dclose.stderr.exp file_dclose.vgtest \ + file_dclose_xml.stderr.exp file_dclose_xml.vgtest \ +-- +2.47.0 + diff --git a/SOURCES/0006-mips-skip-using-shared-syscall-numbers-for-mips32.patch b/SOURCES/0006-mips-skip-using-shared-syscall-numbers-for-mips32.patch deleted file mode 100644 index d393c9c..0000000 --- a/SOURCES/0006-mips-skip-using-shared-syscall-numbers-for-mips32.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 726f930355ca74b4aa4c656979224c9b7a706244 Mon Sep 17 00:00:00 2001 -From: Aleksandar Rikalo -Date: Fri, 10 May 2024 17:59:28 +0200 -Subject: [PATCH 06/11] mips: skip using shared syscall numbers for mips32 - -mips does not use shared syscall numbers, so we can not use -vki-scnums-shared-linux.h. - -This partially fixes KDE #444781. - -Signed-off-by: Hauke Mehrtens -Signed-off-by: Aleksandar Rikalo -(cherry picked from commit 54d6ad3348fb50f5b972fe9c05d0d8757bfe73ba) ---- - coregrind/m_syswrap/syswrap-mips32-linux.c | 1 + - include/pub_tool_vkiscnums_asm.h | 2 - - include/vki/vki-scnums-mips32-linux.h | 105 ++++++++++++++++----- - 3 files changed, 83 insertions(+), 25 deletions(-) - -diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c -index e2f499eb80f8..e3498cd96f9b 100644 ---- a/coregrind/m_syswrap/syswrap-mips32-linux.c -+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c -@@ -1110,6 +1110,7 @@ static SyscallTableEntry syscall_main_table[] = { - LINX_ (__NR_pwritev2, sys_pwritev2), // 362 - //.. - LINXY(__NR_statx, sys_statx), // 366 -+ GENX_(__NR_rseq, sys_ni_syscall), // 367 - - LINXY(__NR_clock_gettime64, sys_clock_gettime64), // 403 - LINX_(__NR_clock_settime64, sys_clock_settime64), // 404 -diff --git a/include/pub_tool_vkiscnums_asm.h b/include/pub_tool_vkiscnums_asm.h -index 8a26f834a93e..d3d7dc19be9d 100644 ---- a/include/pub_tool_vkiscnums_asm.h -+++ b/include/pub_tool_vkiscnums_asm.h -@@ -63,8 +63,6 @@ - # include "vki/vki-scnums-arm64-linux.h" - - #elif defined(VGP_mips32_linux) --# include "vki/vki-scnums-shared-linux.h" --# include "vki/vki-scnums-32bit-linux.h" - # include "vki/vki-scnums-mips32-linux.h" - - #elif defined(VGP_nanomips_linux) -diff --git a/include/vki/vki-scnums-mips32-linux.h b/include/vki/vki-scnums-mips32-linux.h -index e452a2e6c8d0..d4f8de15aac7 100644 ---- a/include/vki/vki-scnums-mips32-linux.h -+++ b/include/vki/vki-scnums-mips32-linux.h -@@ -380,35 +380,94 @@ - #define __NR_setns (__NR_Linux + 343) - #define __NR_process_vm_readv (__NR_Linux + 345) - #define __NR_process_vm_writev (__NR_Linux + 346) --#define __NR_kcmp (__NR_Linux + 347) --#define __NR_finit_module (__NR_Linux + 348) --#define __NR_sched_setattr (__NR_Linux + 349) --#define __NR_sched_getattr (__NR_Linux + 350) --#define __NR_renameat2 (__NR_Linux + 351) --#define __NR_seccomp (__NR_Linux + 352) --#define __NR_getrandom (__NR_Linux + 353) --#define __NR_memfd_create (__NR_Linux + 354) --#define __NR_bpf (__NR_Linux + 355) --#define __NR_execveat (__NR_Linux + 356) --#define __NR_userfaultfd (__NR_Linux + 357) --#define __NR_membarrier (__NR_Linux + 358) --#define __NR_mlock2 (__NR_Linux + 359) --#define __NR_copy_file_range (__NR_Linux + 360) --#define __NR_preadv2 (__NR_Linux + 361) --#define __NR_pwritev2 (__NR_Linux + 362) --#define __NR_pkey_mprotect (__NR_Linux + 363) --#define __NR_pkey_alloc (__NR_Linux + 364) --#define __NR_pkey_free (__NR_Linux + 365) --#define __NR_statx (__NR_Linux + 366) -- -+#define __NR_kcmp (__NR_Linux + 347) -+#define __NR_finit_module (__NR_Linux + 348) -+#define __NR_sched_setattr (__NR_Linux + 349) -+#define __NR_sched_getattr (__NR_Linux + 350) -+#define __NR_renameat2 (__NR_Linux + 351) -+#define __NR_seccomp (__NR_Linux + 352) -+#define __NR_getrandom (__NR_Linux + 353) -+#define __NR_memfd_create (__NR_Linux + 354) -+#define __NR_bpf (__NR_Linux + 355) -+#define __NR_execveat (__NR_Linux + 356) -+#define __NR_userfaultfd (__NR_Linux + 357) -+#define __NR_membarrier (__NR_Linux + 358) -+#define __NR_mlock2 (__NR_Linux + 359) -+#define __NR_copy_file_range (__NR_Linux + 360) -+#define __NR_preadv2 (__NR_Linux + 361) -+#define __NR_pwritev2 (__NR_Linux + 362) -+#define __NR_pkey_mprotect (__NR_Linux + 363) -+#define __NR_pkey_alloc (__NR_Linux + 364) -+#define __NR_pkey_free (__NR_Linux + 365) -+#define __NR_statx (__NR_Linux + 366) -+#define __NR_rseq (__NR_Linux + 367) -+#define __NR_io_pgetevents (__NR_Linux + 368) -+#define __NR_semget (__NR_Linux + 393) -+#define __NR_semctl (__NR_Linux + 394) -+#define __NR_shmget (__NR_Linux + 395) -+#define __NR_shmctl (__NR_Linux + 396) -+#define __NR_shmat (__NR_Linux + 397) -+#define __NR_shmdt (__NR_Linux + 398) -+#define __NR_msgget (__NR_Linux + 399) -+#define __NR_msgsnd (__NR_Linux + 400) -+#define __NR_msgrcv (__NR_Linux + 401) -+#define __NR_msgctl (__NR_Linux + 402) -+#define __NR_clock_gettime64 (__NR_Linux + 403) -+#define __NR_clock_settime64 (__NR_Linux + 404) -+#define __NR_clock_adjtime64 (__NR_Linux + 405) -+#define __NR_clock_getres_time64 (__NR_Linux + 406) -+#define __NR_clock_nanosleep_time64 (__NR_Linux + 407) -+#define __NR_timer_gettime64 (__NR_Linux + 408) -+#define __NR_timer_settime64 (__NR_Linux + 409) -+#define __NR_timerfd_gettime64 (__NR_Linux + 410) -+#define __NR_timerfd_settime64 (__NR_Linux + 411) -+#define __NR_utimensat_time64 (__NR_Linux + 412) -+#define __NR_pselect6_time64 (__NR_Linux + 413) -+#define __NR_ppoll_time64 (__NR_Linux + 414) -+#define __NR_io_pgetevents_time64 (__NR_Linux + 416) -+#define __NR_recvmmsg_time64 (__NR_Linux + 417) -+#define __NR_mq_timedsend_time64 (__NR_Linux + 418) -+#define __NR_mq_timedreceive_time64 (__NR_Linux + 419) -+#define __NR_semtimedop_time64 (__NR_Linux + 420) -+#define __NR_rt_sigtimedwait_time64 (__NR_Linux + 421) -+#define __NR_futex_time64 (__NR_Linux + 422) -+#define __NR_sched_rr_get_interval_time64 (__NR_Linux + 423) -+#define __NR_pidfd_send_signal (__NR_Linux + 424) -+#define __NR_io_uring_setup (__NR_Linux + 425) -+#define __NR_io_uring_enter (__NR_Linux + 426) -+#define __NR_io_uring_register (__NR_Linux + 427) -+#define __NR_open_tree (__NR_Linux + 428) -+#define __NR_move_mount (__NR_Linux + 429) -+#define __NR_fsopen (__NR_Linux + 430) -+#define __NR_fsconfig (__NR_Linux + 431) -+#define __NR_fsmount (__NR_Linux + 432) -+#define __NR_fspick (__NR_Linux + 433) -+#define __NR_pidfd_open (__NR_Linux + 434) -+#define __NR_clone3 (__NR_Linux + 435) -+#define __NR_close_range (__NR_Linux + 436) -+#define __NR_openat2 (__NR_Linux + 437) -+#define __NR_pidfd_getfd (__NR_Linux + 438) -+#define __NR_faccessat2 (__NR_Linux + 439) -+#define __NR_process_madvise (__NR_Linux + 440) -+#define __NR_epoll_pwait2 (__NR_Linux + 441) -+#define __NR_mount_setattr (__NR_Linux + 442) -+#define __NR_quotactl_fd (__NR_Linux + 443) -+#define __NR_landlock_create_ruleset (__NR_Linux + 444) -+#define __NR_landlock_add_rule (__NR_Linux + 445) -+#define __NR_landlock_restrict_self (__NR_Linux + 446) -+#define __NR_process_mrelease (__NR_Linux + 448) -+#define __NR_futex_waitv (__NR_Linux + 449) -+#define __NR_set_mempolicy_home_node (__NR_Linux + 450) -+#define __NR_cachestat (__NR_Linux + 451) -+#define __NR_fchmodat2 (__NR_Linux + 452) - /* - * Offset of the last Linux o32 flavoured syscall - */ --#define __NR_Linux_syscalls 366 -+#define __NR_Linux_syscalls 366 - - - #define __NR_O32_Linux 4000 --#define __NR_O32_Linux_syscalls 366 -+#define __NR_O32_Linux_syscalls 366 - - - #endif /* __VKI_SCNUMS_MIPS32_LINUX_H */ --- -2.45.2 - diff --git a/SOURCES/0007-Add-support-for-landlock_create_ruleset-444-landlock.patch b/SOURCES/0007-Add-support-for-landlock_create_ruleset-444-landlock.patch new file mode 100644 index 0000000..28377de --- /dev/null +++ b/SOURCES/0007-Add-support-for-landlock_create_ruleset-444-landlock.patch @@ -0,0 +1,358 @@ +From 3d72dd780be97bd19331403da60908f295712fc7 Mon Sep 17 00:00:00 2001 +From: Peter Seiderer +Date: Mon, 8 Jul 2024 11:05:47 +0200 +Subject: [PATCH 07/11] Add support for landlock_create_ruleset (444), + landlock_add_rule (445) and landlock_restrict_self (446) syscalls + +- add support for landlock_create_ruleset (444) syscall +- add support for landlock_add_rule (445) syscall +- add support for landlock_restrict_self (446) syscall + +https://bugs.kde.org/show_bug.cgi?id=489913 + +Signed-off-by: Peter Seiderer + +(cherry picked from commit b1453546fe7396e7d4b4b2fc8ec7e64b71d18611) +--- + NEWS | 2 + + coregrind/m_syswrap/priv_syswrap-linux.h | 5 ++ + 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 | 48 ++++++++++++++++++++ + coregrind/m_syswrap/syswrap-mips32-linux.c | 4 ++ + coregrind/m_syswrap/syswrap-mips64-linux.c | 5 +- + coregrind/m_syswrap/syswrap-nanomips-linux.c | 3 ++ + coregrind/m_syswrap/syswrap-ppc32-linux.c | 4 ++ + coregrind/m_syswrap/syswrap-ppc64-linux.c | 4 ++ + coregrind/m_syswrap/syswrap-s390x-linux.c | 4 ++ + coregrind/m_syswrap/syswrap-x86-linux.c | 4 ++ + include/Makefile.am | 3 +- + include/pub_tool_vki.h | 1 + + include/vki/vki-linux-landlock.h | 37 +++++++++++++++ + include/vki/vki-scnums-shared-linux.h | 4 ++ + 17 files changed, 138 insertions(+), 2 deletions(-) + create mode 100644 include/vki/vki-linux-landlock.h + +diff --git a/NEWS b/NEWS +index 8362e1d2df41..68cd0c6fa603 100644 +--- a/NEWS ++++ b/NEWS +@@ -5,6 +5,8 @@ Branch 3.24 + + The following bugs have been fixed or resolved on this branch. + ++489913 WARNING: unhandled amd64-linux syscall: 444 (landlock_create_ruleset) ++ + 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. +diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h +index d50cdcc981b9..221439a0ec33 100644 +--- a/coregrind/m_syswrap/priv_syswrap-linux.h ++++ b/coregrind/m_syswrap/priv_syswrap-linux.h +@@ -328,6 +328,11 @@ DECL_TEMPLATE(linux, sys_pidfd_open); + DECL_TEMPLATE(linux, sys_close_range); + DECL_TEMPLATE(linux, sys_openat2); + ++// Linux-specific (new in Linux 5.13) ++DECL_TEMPLATE(linux, sys_landlock_create_ruleset) ++DECL_TEMPLATE(linux, sys_landlock_add_rule) ++DECL_TEMPLATE(linux, sys_landlock_restrict_self) ++ + // Linux-specific (new in Linux 5.14) + DECL_TEMPLATE(linux, sys_memfd_secret); + +diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c +index 2230baf772b0..9488d3090e80 100644 +--- a/coregrind/m_syswrap/syswrap-amd64-linux.c ++++ b/coregrind/m_syswrap/syswrap-amd64-linux.c +@@ -887,6 +887,10 @@ static SyscallTableEntry syscall_table[] = { + + LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + ++ 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 ++ + LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + + 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 d326fdb9eeda..65f64af99bb7 100644 +--- a/coregrind/m_syswrap/syswrap-arm-linux.c ++++ b/coregrind/m_syswrap/syswrap-arm-linux.c +@@ -1062,6 +1062,10 @@ static SyscallTableEntry syscall_main_table[] = { + + LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + ++ 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_fchmodat2, sys_fchmodat2), // 452 + }; + +diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c +index 05e0e421fa6c..151ae0640b10 100644 +--- a/coregrind/m_syswrap/syswrap-arm64-linux.c ++++ b/coregrind/m_syswrap/syswrap-arm64-linux.c +@@ -840,6 +840,10 @@ static SyscallTableEntry syscall_main_table[] = { + + LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + ++ 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 ++ + LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + + LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 +diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c +index eec8388224ba..70ae837a9454 100644 +--- a/coregrind/m_syswrap/syswrap-linux.c ++++ b/coregrind/m_syswrap/syswrap-linux.c +@@ -4163,6 +4163,54 @@ POST(sys_memfd_create) + } + } + ++PRE(sys_landlock_create_ruleset) ++{ ++ PRINT("sys_landlock_create_ruleset ( %#" FMT_REGWORD "x, %lu, %lu )", ++ ARG1, ARG2, ARG3); ++ PRE_REG_READ3(long, "landlock_create_ruleset", ++ const struct vki_landlock_ruleset_attr*, attr, ++ vki_size_t, size, vki_uint32_t, flags); ++ PRE_MEM_READ( "landlock_create_ruleset(value)", ARG1, ARG2 ); ++ ++ /* XXX Alternatively we could always fail with EOPNOTSUPP ++ since the rules might interfere with valgrind itself. */ ++} ++ ++POST(sys_landlock_create_ruleset) ++{ ++ /* Returns either the abi version or a file descriptor. */ ++ if (ARG3 != VKI_LANDLOCK_CREATE_RULESET_VERSION) { ++ if (!ML_(fd_allowed)(RES, "landlock_create_ruleset", tid, True)) { ++ VG_(close)(RES); ++ SET_STATUS_Failure( VKI_EMFILE ); ++ } else { ++ if (VG_(clo_track_fds)) ++ ML_(record_fd_open_nameless)(tid, RES); ++ } ++ } ++} ++ ++PRE(sys_landlock_add_rule) ++{ ++ PRINT("sys_landlock_add_rule ( %ld, %lu, %#" FMT_REGWORD "x, %lu )", ++ SARG1, ARG2, ARG3, ARG4); ++ PRE_REG_READ4(long, "landlock_add_rule", ++ int, ruleset_fd, enum vki_landlock_rule_type, rule_type, ++ const void*, rule_attr, vki_uint32_t, flags); ++ if (!ML_(fd_allowed)(ARG1, "landlock_add_rule", tid, False)) ++ SET_STATUS_Failure(VKI_EBADF); ++ /* XXX Depending on rule_type we should also check the given rule_attr. */ ++} ++ ++PRE(sys_landlock_restrict_self) ++{ ++ PRINT("sys_landlock_restrict_self ( %ld, %lu )", SARG1, ARG2); ++ PRE_REG_READ2(long, "landlock_create_ruleset", ++ int, ruleset_fd, vki_uint32_t, flags); ++ if (!ML_(fd_allowed)(ARG1, "landlock_restrict_self", tid, False)) ++ SET_STATUS_Failure(VKI_EBADF); ++} ++ + PRE(sys_memfd_secret) + { + PRINT("sys_memfd_secret ( %#" FMT_REGWORD "x )", ARG1); +diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c +index 421344213676..757b637ba986 100644 +--- a/coregrind/m_syswrap/syswrap-mips32-linux.c ++++ b/coregrind/m_syswrap/syswrap-mips32-linux.c +@@ -1147,6 +1147,10 @@ static SyscallTableEntry syscall_main_table[] = { + + LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + ++ 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_fchmodat2, sys_fchmodat2), // 452 + }; + +diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c +index e9bb5c54c59c..f0c5f7e04f4e 100644 +--- a/coregrind/m_syswrap/syswrap-mips64-linux.c ++++ b/coregrind/m_syswrap/syswrap-mips64-linux.c +@@ -824,7 +824,10 @@ static SyscallTableEntry syscall_main_table[] = { + LINXY (__NR_openat2, sys_openat2), + LINXY (__NR_pidfd_getfd, sys_pidfd_getfd), + LINX_ (__NR_faccessat2, sys_faccessat2), +- LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), ++ LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), ++ 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), + LINX_ (__NR_fchmodat2, sys_fchmodat2), + }; + +diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c +index 36a5c0ca002d..f466aca147e0 100644 +--- a/coregrind/m_syswrap/syswrap-nanomips-linux.c ++++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c +@@ -831,6 +831,9 @@ static SyscallTableEntry syscall_main_table[] = { + LINXY(__NR_pidfd_getfd, sys_pidfd_getfd), + LINX_ (__NR_faccessat2, sys_faccessat2), + LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), ++ 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), + LINX_ (__NR_fchmodat2, sys_fchmodat2), + }; + +diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c +index f7a90c753060..634f288ce0d1 100644 +--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c ++++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c +@@ -1069,6 +1069,10 @@ static SyscallTableEntry syscall_table[] = { + + LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + ++ 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_fchmodat2, sys_fchmodat2), // 452 + }; + +diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c +index 8de95624fa7c..2c2def330ad7 100644 +--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c ++++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c +@@ -1035,6 +1035,10 @@ static SyscallTableEntry syscall_table[] = { + + LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + ++ 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_fchmodat2, sys_fchmodat2), // 452 + }; + +diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c +index 8a1be8cbef54..ca571f0f1a7c 100644 +--- a/coregrind/m_syswrap/syswrap-s390x-linux.c ++++ b/coregrind/m_syswrap/syswrap-s390x-linux.c +@@ -875,6 +875,10 @@ static SyscallTableEntry syscall_table[] = { + + LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + ++ 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 ++ + LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + + 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 31243a0db373..a23743743abe 100644 +--- a/coregrind/m_syswrap/syswrap-x86-linux.c ++++ b/coregrind/m_syswrap/syswrap-x86-linux.c +@@ -1656,6 +1656,10 @@ static SyscallTableEntry syscall_table[] = { + + LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 + ++ 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 ++ + LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 + + LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 +diff --git a/include/Makefile.am b/include/Makefile.am +index 8012d73749b3..5d5162a46eb6 100644 +--- a/include/Makefile.am ++++ b/include/Makefile.am +@@ -107,4 +107,5 @@ nobase_pkginclude_HEADERS = \ + vki/vki-xen-xsm.h \ + vki/vki-xen-x86.h \ + vki/vki-linux-drm.h \ +- vki/vki-linux-io_uring.h ++ vki/vki-linux-io_uring.h \ ++ vki/vki-linux-landlock.h +diff --git a/include/pub_tool_vki.h b/include/pub_tool_vki.h +index 24f99cc09f16..7b6e71e11eb4 100644 +--- a/include/pub_tool_vki.h ++++ b/include/pub_tool_vki.h +@@ -47,6 +47,7 @@ + # include "vki/vki-linux.h" + # include "vki/vki-linux-drm.h" + # include "vki/vki-linux-io_uring.h" ++# include "vki/vki-linux-landlock.h" + #elif defined(VGO_darwin) + # include "vki/vki-darwin.h" + #elif defined(VGO_solaris) +diff --git a/include/vki/vki-linux-landlock.h b/include/vki/vki-linux-landlock.h +new file mode 100644 +index 000000000000..e549ae93eff9 +--- /dev/null ++++ b/include/vki/vki-linux-landlock.h +@@ -0,0 +1,37 @@ ++/* ++ This file is part of Valgrind, a dynamic binary instrumentation framework. ++ ++ Copyright (C) 2024 Peter Seiderer ++ ++ This program is free software; you can redistribute it and/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 __VKI_LANDLOCK_H ++#define __VKI_LANDLOCK_H ++ ++// Derived from linux-6.9.7/include/uapi/linux/landlock.h ++struct vki_landlock_ruleset_attr { ++ __vki_u64 handled_access_fs; ++ __vki_u64 handled_access_net; ++}; ++ ++enum vki_landlock_rule_type { ++ VKI_LANDLOCK_RULE_PATH_BENEATH = 1, ++ VKI_LANDLOCK_RULE_NET_PORT, ++}; ++ ++#define VKI_LANDLOCK_CREATE_RULESET_VERSION 1 ++ ++#endif +diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h +index 068a2cd12bd6..20346ca71678 100644 +--- a/include/vki/vki-scnums-shared-linux.h ++++ b/include/vki/vki-scnums-shared-linux.h +@@ -48,6 +48,10 @@ + + #define __NR_epoll_pwait2 441 + ++#define __NR_landlock_create_ruleset 444 ++#define __NR_landlock_add_rule 445 ++#define __NR_landlock_restrict_self 446 ++ + #define __NR_memfd_secret 447 + + #define __NR_fchmodat2 452 +-- +2.47.0 + diff --git a/SOURCES/0007-Fix-uninitialized-err-in-handle_extension.patch b/SOURCES/0007-Fix-uninitialized-err-in-handle_extension.patch deleted file mode 100644 index 84efe6f..0000000 --- a/SOURCES/0007-Fix-uninitialized-err-in-handle_extension.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 468933f9765449c1e353c38e88555a2f1603b9ce Mon Sep 17 00:00:00 2001 -From: Andreas Arnez -Date: Wed, 15 May 2024 14:32:42 +0200 -Subject: [PATCH 07/11] Fix uninitialized `err' in handle_extension() - -In handle_extension(), in the case of a second return from SCHEDSETJMP the -variable `err' would be used uninitialized. Fix this by avoiding any -access to `err' in this case. - -(cherry picked from commit 94c2e5c6be23c6323f24deacdad5f98fb9f0b1c2) ---- - coregrind/m_scheduler/scheduler.c | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - -diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c -index fc8cf7c9cb1d..29751bb28283 100644 ---- a/coregrind/m_scheduler/scheduler.c -+++ b/coregrind/m_scheduler/scheduler.c -@@ -1233,7 +1233,10 @@ static void handle_extension(ThreadId tid) - SCHEDSETJMP(tid, jumped, err = VG_(client_extension)(tid)); - vg_assert(VG_(is_running_thread)(tid)); - -- if (err != ExtErr_OK) { -+ if (jumped != (UWord)0) { -+ block_signals(); -+ VG_(poll_signals)(tid); -+ } else if (err != ExtErr_OK) { - ThreadState* tst = VG_(get_ThreadState)(tid); - Addr addr = tst->arch.vex.guest_IP_AT_SYSCALL; - switch (err) { -@@ -1244,11 +1247,6 @@ static void handle_extension(ThreadId tid) - VG_(core_panic)("scheduler: bad return code from extension"); - } - } -- -- if (jumped != (UWord)0) { -- block_signals(); -- VG_(poll_signals)(tid); -- } - } - - /* tid just requested a jump to the noredir version of its current --- -2.45.2 - diff --git a/SOURCES/0008-Avoid-use-of-guest_IP_AT_SYSCALL-in-handle_extension.patch b/SOURCES/0008-Avoid-use-of-guest_IP_AT_SYSCALL-in-handle_extension.patch deleted file mode 100644 index 8e5f4ae..0000000 --- a/SOURCES/0008-Avoid-use-of-guest_IP_AT_SYSCALL-in-handle_extension.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 40b68ae8d6c869f098493e3a31d66f09170592e3 Mon Sep 17 00:00:00 2001 -From: Andreas Arnez -Date: Wed, 15 May 2024 14:32:42 +0200 -Subject: [PATCH 08/11] Avoid use of guest_IP_AT_SYSCALL in handle_extension() - -The guest state field guest_IP_AT_SYSCALL is referenced in -handle_extension(), even though it may not be defined by all -architectures. Avoid its use altogether. - -(cherry picked from commit 16249b21456d681b5d98400287b8dbd926050c75) ---- - coregrind/m_scheduler/scheduler.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c -index 29751bb28283..cc8d070b7930 100644 ---- a/coregrind/m_scheduler/scheduler.c -+++ b/coregrind/m_scheduler/scheduler.c -@@ -1237,8 +1237,7 @@ static void handle_extension(ThreadId tid) - block_signals(); - VG_(poll_signals)(tid); - } else if (err != ExtErr_OK) { -- ThreadState* tst = VG_(get_ThreadState)(tid); -- Addr addr = tst->arch.vex.guest_IP_AT_SYSCALL; -+ Addr addr = VG_(get_IP)(tid); - switch (err) { - case ExtErr_Illop: - VG_(synth_sigill)(tid, addr); --- -2.45.2 - diff --git a/SOURCES/0008-helgrind-tests-tc17_sembar.c-Remove-bool-typedef.patch b/SOURCES/0008-helgrind-tests-tc17_sembar.c-Remove-bool-typedef.patch new file mode 100644 index 0000000..5a02dda --- /dev/null +++ b/SOURCES/0008-helgrind-tests-tc17_sembar.c-Remove-bool-typedef.patch @@ -0,0 +1,35 @@ +From 459fa5b82df0d07cf871fc7359a060410052b82e Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sat, 23 Nov 2024 22:37:14 +0100 +Subject: [PATCH 08/11] helgrind/tests/tc17_sembar.c: Remove bool typedef + +Since C23 bool is a keyword. Also bool wasn't actually used. + +tc17_sembar.c:45:14: error: both 'long' and '_Bool' in declaration specifiers + 45 | typedef long bool; + | ^~~~ +tc17_sembar.c:45:1: warning: useless type name in empty declaration + 45 | typedef long bool; + | ^~~~~~~ + +(cherry picked from commit 932bf2c027579c8d933b57ed80bb5842b390bdb3) +--- + helgrind/tests/tc17_sembar.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/helgrind/tests/tc17_sembar.c b/helgrind/tests/tc17_sembar.c +index 36412a07e206..ee40160b082d 100644 +--- a/helgrind/tests/tc17_sembar.c ++++ b/helgrind/tests/tc17_sembar.c +@@ -42,7 +42,7 @@ typedef struct + sem_t* xxx; + } gomp_barrier_t; + +-typedef long bool; ++ + + void + gomp_barrier_init (gomp_barrier_t *bar, unsigned count) +-- +2.47.0 + diff --git a/SOURCES/0009-drd-tests-swapcontext.c-Rename-typedef-struct-thread.patch b/SOURCES/0009-drd-tests-swapcontext.c-Rename-typedef-struct-thread.patch new file mode 100644 index 0000000..b940eba --- /dev/null +++ b/SOURCES/0009-drd-tests-swapcontext.c-Rename-typedef-struct-thread.patch @@ -0,0 +1,38 @@ +From c08e155fdf6641a569053b3a70c52bfae09dd34c Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sat, 23 Nov 2024 22:48:03 +0100 +Subject: [PATCH 09/11] drd/tests/swapcontext.c: Rename typedef struct + thread_local to threadlocal + +Since C23 thread_local is a keyword (thread storage duration). + +swapcontext.c:23:16: error: expected '{' before 'thread_local' + 23 | typedef struct thread_local { + | ^~~~~~~~~~~~ +swapcontext.c:23:16: warning: 'thread_local' is not at beginning of declaration [-Wold-style-declaration] +swapcontext.c:23:16: error: 'thread_local' used with 'typedef' +swapcontext.c:26:3: warning: data definition has no type or storage class + 26 | } thread_local_t; + | ^~~~~~~~~~~~~~ + +(cherry picked from commit 907b985725805f1537396a6d76539bf490cc6c7e) +--- + drd/tests/swapcontext.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drd/tests/swapcontext.c b/drd/tests/swapcontext.c +index 2cb969a5eafa..ec191968cab1 100644 +--- a/drd/tests/swapcontext.c ++++ b/drd/tests/swapcontext.c +@@ -20,7 +20,7 @@ + + #define STACKSIZE (PTHREAD_STACK_MIN + 4096) + +-typedef struct thread_local { ++typedef struct threadlocal { + ucontext_t uc[3]; + size_t nrsw; + } thread_local_t; +-- +2.47.0 + diff --git a/SOURCES/0009-s390x-Minor-fixes-in-extension-s390x.c.patch b/SOURCES/0009-s390x-Minor-fixes-in-extension-s390x.c.patch deleted file mode 100644 index 3bb1df0..0000000 --- a/SOURCES/0009-s390x-Minor-fixes-in-extension-s390x.c.patch +++ /dev/null @@ -1,66 +0,0 @@ -From ebe5fd9c0aae97767a4418d2f26f3281065b3e6a Mon Sep 17 00:00:00 2001 -From: Andreas Arnez -Date: Wed, 15 May 2024 14:32:42 +0200 -Subject: [PATCH 09/11] s390x: Minor fixes in extension-s390x.c - -Some tracker names for registers are not consistent with the naming -scheme. Also, there is a dead assignment to orig_addr2 and orig_len2. -Fix both. - -(cherry picked from commit 76f2218924f85547f670969b1a0b59e5200e22ec) ---- - coregrind/m_extension/extension-s390x.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/coregrind/m_extension/extension-s390x.c b/coregrind/m_extension/extension-s390x.c -index fd45c7ee948f..735406e6e4c5 100644 ---- a/coregrind/m_extension/extension-s390x.c -+++ b/coregrind/m_extension/extension-s390x.c -@@ -37,9 +37,9 @@ - - #undef SYSNO - --#define READ_FUNCTION_CODE(tst) \ -+#define READ_FUNCTION_CODE(tst, extname) \ - ({ \ -- PRE_REG_READ(tst, "func_code", r0, 7, sizeof(UChar)); \ -+ PRE_REG_READ(tst, extname "(func_code)", r0, 7, sizeof(UChar)); \ - tst->arch.vex.guest_r0 & 0xff; \ - }) - -@@ -141,10 +141,10 @@ static enum ExtensionError do_extension_PRNO(ThreadState* tst, ULong variant) - { - UChar r1 = variant & 0xf; - UChar r2 = (variant >> 4) & 0xf; -- UChar func = READ_FUNCTION_CODE(tst); -+ UChar func = READ_FUNCTION_CODE(tst, "PRNO"); - UChar fc = func & 0x7f; - UChar mflag = func & 128; -- ULong parms = READ_GPR(tst, "r1", 1); -+ ULong parms = READ_GPR(tst, "PRNO(r1)", 1); - ULong parms_len; - Int cc = 0; - ULong orig_addr1 = 0, orig_len1 = 0, orig_addr2 = 0, orig_len2 = 0; -@@ -175,8 +175,8 @@ static enum ExtensionError do_extension_PRNO(ThreadState* tst, ULong variant) - PRE_MEM_WRITE(tst, "PRNO(op1)", addr1, len1); - } else { - // Seed operation -- addr2 = orig_addr2 = READ_GPR(tst, "PRNO(op2_addr)", r2); -- len2 = orig_len2 = READ_GPR(tst, "PRNO(op2_len)", r2 + 1); -+ addr2 = READ_GPR(tst, "PRNO(op2_addr)", r2); -+ len2 = READ_GPR(tst, "PRNO(op2_len)", r2 + 1); - PRE_MEM_READ(tst, "PRNO(op2)", addr2, len2); - } - PRE_MEM_WRITE(tst, "PRNO(parms)", parms, parms_len); -@@ -474,7 +474,7 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) - { - ULong gpr0 = READ_GPR(tst, "NNPA(r0)", 0); - UChar fc = gpr0 & 0x7f; -- ULong parms_addr = READ_GPR(tst, "r1", 1); -+ ULong parms_addr = READ_GPR(tst, "NNPA(r1)", 1); - Int cc = 0; - ULong parms_len; - --- -2.45.2 - diff --git a/SOURCES/0010-Bug-453044-gbserver_tests-failures-in-aarch64.patch b/SOURCES/0010-Bug-453044-gbserver_tests-failures-in-aarch64.patch deleted file mode 100644 index 7cc4012..0000000 --- a/SOURCES/0010-Bug-453044-gbserver_tests-failures-in-aarch64.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 70d765faa162f2f12e7771db51877649637f2c12 Mon Sep 17 00:00:00 2001 -From: Jesus Checa -Date: Sat, 25 May 2024 12:40:30 +0200 -Subject: [PATCH 10/11] Bug 453044 - gbserver_tests failures in aarch64 - -(cherry picked from commit 790abdf7d3f3df0c968605b68ca765310689b7ce) ---- - NEWS | 1 + - gdbserver_tests/filter_gdb.in | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/NEWS b/NEWS -index adb52169dd87..c2ad6a207d96 100644 ---- a/NEWS -+++ b/NEWS -@@ -5,6 +5,7 @@ Branch 3.23 - - The following bugs have been fixed or resolved on this branch. - -+453044 gbserver_tests failures in aarch64 - 486180 [MIPS] 'VexGuestArchState' has no member named 'guest_IP_AT_SYSCALL' - 486293 memccpy false positives - 486569 linux inotify_init syscall wrapper missing POST entry in syscall_table -diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in -index 4118063f6bc6..497171732b25 100755 ---- a/gdbserver_tests/filter_gdb.in -+++ b/gdbserver_tests/filter_gdb.in -@@ -152,6 +152,7 @@ s/in _select ()/in syscall .../ - /sysv\/linux\/generic\/select.c/d - /return SYSCALL_CANCEL /d - /r = SYSCALL_CANCEL /d -+/result = SYSCALL_CANCEL /d - - # a more specialised system call select stack trace part - # (on 32 bits, we have an int_80, on 64 bits, directly select) --- -2.45.2 - diff --git a/SOURCES/0010-none-tests-bug234814.c-sa_handler-take-an-int-as-arg.patch b/SOURCES/0010-none-tests-bug234814.c-sa_handler-take-an-int-as-arg.patch new file mode 100644 index 0000000..5ae9012 --- /dev/null +++ b/SOURCES/0010-none-tests-bug234814.c-sa_handler-take-an-int-as-arg.patch @@ -0,0 +1,34 @@ +From 53d667789d369042b1fe45f72102ecb5c16e5d12 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sat, 23 Nov 2024 22:59:21 +0100 +Subject: [PATCH 10/11] none/tests/bug234814.c: sa_handler take an int as + argument + +GCC15 will turn this warning into an error: + +bug234814.c: In function 'main': +bug234814.c:20:18: error: assignment to '__sighandler_t' {aka 'void (*)(int)'} from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types] + 20 | sa.sa_handler = mysigbus; + | ^ + +(cherry picked from commit 8f6cef269b91739f6a2e7f3b4b1e0a429db3e748) +--- + none/tests/bug234814.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/none/tests/bug234814.c b/none/tests/bug234814.c +index 16b561fde6b0..11e0f6779162 100644 +--- a/none/tests/bug234814.c ++++ b/none/tests/bug234814.c +@@ -9,7 +9,7 @@ const char kSigbus[] = "I caught the SIGBUS signal!\n"; + + int GLOB = 3; + +-void mysigbus() { ++void mysigbus(int signum) { + write(1, kSigbus, sizeof(kSigbus)-1); + GLOB--; + return; +-- +2.47.0 + diff --git a/SOURCES/0011-Add-open_tree-move_mount-fsopen-fsconfig-fsmount-fsp.patch b/SOURCES/0011-Add-open_tree-move_mount-fsopen-fsconfig-fsmount-fsp.patch new file mode 100644 index 0000000..a1be881 --- /dev/null +++ b/SOURCES/0011-Add-open_tree-move_mount-fsopen-fsconfig-fsmount-fsp.patch @@ -0,0 +1,398 @@ +From 349b57d3a8c8d2df23128d4b03eca91b629629e1 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 26 Nov 2024 19:00:34 +0100 +Subject: [PATCH 11/11] Add open_tree, move_mount, fsopen, fsconfig, fsmount, + fspick linux syswraps + +Shared linux syscalls implementing various file system mount tasks. +Since linux kernel version 5.2. + +Check arguments and track file descriptors. + +https://bugs.kde.org/show_bug.cgi?id=494246 + +(cherry picked from commit 4044bcea0427853fc44a3d02a0fc0b2a81935452) +--- + NEWS | 1 + + coregrind/m_syswrap/priv_syswrap-linux.h | 8 + + coregrind/m_syswrap/syswrap-amd64-linux.c | 6 + + coregrind/m_syswrap/syswrap-arm-linux.c | 7 +- + coregrind/m_syswrap/syswrap-arm64-linux.c | 7 +- + coregrind/m_syswrap/syswrap-linux.c | 146 +++++++++++++++++++ + coregrind/m_syswrap/syswrap-mips32-linux.c | 7 +- + coregrind/m_syswrap/syswrap-mips64-linux.c | 6 + + coregrind/m_syswrap/syswrap-nanomips-linux.c | 6 + + coregrind/m_syswrap/syswrap-ppc32-linux.c | 7 +- + coregrind/m_syswrap/syswrap-ppc64-linux.c | 7 +- + coregrind/m_syswrap/syswrap-s390x-linux.c | 7 +- + coregrind/m_syswrap/syswrap-x86-linux.c | 7 +- + 13 files changed, 215 insertions(+), 7 deletions(-) + +diff --git a/NEWS b/NEWS +index 68cd0c6fa603..7f1334aa0f07 100644 +--- a/NEWS ++++ b/NEWS +@@ -6,6 +6,7 @@ Branch 3.24 + The following bugs have been fixed or resolved on this branch. + + 489913 WARNING: unhandled amd64-linux syscall: 444 (landlock_create_ruleset) ++494246 syscall fsopen 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 221439a0ec33..1bdd9a94ec19 100644 +--- a/coregrind/m_syswrap/priv_syswrap-linux.h ++++ b/coregrind/m_syswrap/priv_syswrap-linux.h +@@ -321,6 +321,14 @@ DECL_TEMPLATE(linux, sys_io_uring_setup); + DECL_TEMPLATE(linux, sys_io_uring_enter); + DECL_TEMPLATE(linux, sys_io_uring_register); + ++// open_tree and friends (shared linux syscalls) ++DECL_TEMPLATE(linux, sys_open_tree); ++DECL_TEMPLATE(linux, sys_move_mount); ++DECL_TEMPLATE(linux, sys_fsopen); ++DECL_TEMPLATE(linux, sys_fsconfig); ++DECL_TEMPLATE(linux, sys_fsmount); ++DECL_TEMPLATE(linux, sys_fspick); ++ + // Linux-specific (new in Linux 5.3) + DECL_TEMPLATE(linux, sys_pidfd_open); + +diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c +index 9488d3090e80..bdba41826ad8 100644 +--- a/coregrind/m_syswrap/syswrap-amd64-linux.c ++++ b/coregrind/m_syswrap/syswrap-amd64-linux.c +@@ -877,6 +877,12 @@ static SyscallTableEntry syscall_table[] = { + 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 ++ LINXY(__NR_open_tree, sys_open_tree), // 428 ++ LINX_(__NR_move_mount, sys_move_mount), // 429 ++ LINXY(__NR_fsopen, sys_fsopen), // 430 ++ LINX_(__NR_fsconfig, sys_fsconfig), // 431 ++ LINXY(__NR_fsmount, sys_fsmount), // 432 ++ LINXY(__NR_fspick, sys_fspick), // 433 + + LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 + GENX_(__NR_clone3, sys_ni_syscall), // 435 +diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c +index 65f64af99bb7..108e1f91e5e9 100644 +--- a/coregrind/m_syswrap/syswrap-arm-linux.c ++++ b/coregrind/m_syswrap/syswrap-arm-linux.c +@@ -1052,7 +1052,12 @@ static SyscallTableEntry syscall_main_table[] = { + 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 +- ++ LINXY(__NR_open_tree, sys_open_tree), // 428 ++ LINX_(__NR_move_mount, sys_move_mount), // 429 ++ LINXY(__NR_fsopen, sys_fsopen), // 430 ++ LINX_(__NR_fsconfig, sys_fsconfig), // 431 ++ LINXY(__NR_fsmount, sys_fsmount), // 432 ++ LINXY(__NR_fspick, sys_fspick), // 433 + LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 + GENX_(__NR_clone3, sys_ni_syscall), // 435 + LINXY(__NR_close_range, sys_close_range), // 436 +diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c +index 151ae0640b10..23b0b6b51c10 100644 +--- a/coregrind/m_syswrap/syswrap-arm64-linux.c ++++ b/coregrind/m_syswrap/syswrap-arm64-linux.c +@@ -830,7 +830,12 @@ static SyscallTableEntry syscall_main_table[] = { + 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 +- ++ LINXY(__NR_open_tree, sys_open_tree), // 428 ++ LINX_(__NR_move_mount, sys_move_mount), // 429 ++ LINXY(__NR_fsopen, sys_fsopen), // 430 ++ LINX_(__NR_fsconfig, sys_fsconfig), // 431 ++ LINXY(__NR_fsmount, sys_fsmount), // 432 ++ LINXY(__NR_fspick, sys_fspick), // 433 + LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 + GENX_(__NR_clone3, sys_ni_syscall), // 435 + LINXY(__NR_close_range, sys_close_range), // 436 +diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c +index 70ae837a9454..57672f167126 100644 +--- a/coregrind/m_syswrap/syswrap-linux.c ++++ b/coregrind/m_syswrap/syswrap-linux.c +@@ -13836,6 +13836,152 @@ POST(sys_pidfd_getfd) + } + } + ++/* int open_tree (int dfd, const char *filename, unsigned int flags) */ ++PRE(sys_open_tree) ++{ ++ PRINT("sys_open_tree ( %ld, %#" FMT_REGWORD "x(%s), %ld", ++ SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3); ++ PRE_REG_READ3(long, "open_tree", ++ int, dfd, const char *, filename, int, flags); ++ PRE_MEM_RASCIIZ( "open_tree(filename)", ARG2); ++ /* 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, "open_tree", tid, False)) ++ SET_STATUS_Failure( VKI_EBADF ); ++} ++ ++POST(sys_open_tree) ++{ ++ if (!ML_(fd_allowed)(RES, "open_tree", tid, True)) { ++ VG_(close)(RES); ++ SET_STATUS_Failure( VKI_EMFILE ); ++ } else { ++ if (VG_(clo_track_fds)) ++ ML_(record_fd_open_with_given_name)(tid, RES, (HChar*)(Addr)ARG2); ++ } ++} ++ ++/* int move_mount (int from_dfd, const char *from_pathname, ++ int to_dfd, const char *to_pathname, ++ unsigned int flags) */ ++PRE(sys_move_mount) ++{ ++ PRINT("sys_move_mount ( %ld, %#" FMT_REGWORD "x(%s), " ++ "%ld, %#" FMT_REGWORD "x(%s), %ld", ++ SARG1, ARG2, (HChar*)(Addr)ARG2, ++ SARG3, ARG4, (HChar*)(Addr)ARG4, SARG5); ++ PRE_REG_READ5(long, "mount_move", ++ int, from_dfd, const char *, from_pathname, ++ int, to_dfd, const char*, to_pathname, int, flags); ++ PRE_MEM_RASCIIZ( "mount_move(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); ++ /* 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 ); ++} ++ ++/* int fsopen (const char *fs_name, unsigned int flags) */ ++PRE(sys_fsopen) ++{ ++ PRINT("sys_fsopen ( %#" FMT_REGWORD "x(%s), %ld", ++ ARG1, (HChar*)(Addr)ARG1, SARG2); ++ PRE_REG_READ2(long, "fsopen", const char *, fs_name, int, flags); ++ PRE_MEM_RASCIIZ( "fsopen(filename)", ARG1); ++} ++ ++POST(sys_fsopen) ++{ ++ if (!ML_(fd_allowed)(RES, "fsopen", tid, True)) { ++ VG_(close)(RES); ++ SET_STATUS_Failure( VKI_EMFILE ); ++ } else { ++ if (VG_(clo_track_fds)) ++ ML_(record_fd_open_with_given_name)(tid, RES, (HChar*)(Addr)ARG1); ++ } ++} ++ ++/* int fsmount (int fd, unsigned int flags, unsigned int ms_flags) */ ++PRE(sys_fsmount) ++{ ++ PRINT("sys_fsmount ( %ld, %ld, %ld", SARG1, SARG2, SARG3); ++ PRE_REG_READ3(long, "fsmount", int, fd, int, flags, int, ms_flags); ++ if (!ML_(fd_allowed)(ARG1, "fsmount", tid, False)) ++ SET_STATUS_Failure( VKI_EBADF ); ++} ++ ++POST(sys_fsmount) ++{ ++ if (!ML_(fd_allowed)(RES, "fsmount", tid, True)) { ++ VG_(close)(RES); ++ SET_STATUS_Failure( VKI_EMFILE ); ++ } else { ++ if (VG_(clo_track_fds)) ++ ML_(record_fd_open_nameless)(tid, RES); ++ } ++} ++ ++/* int fsconfig (int fd, unsigned int cmd, const char *key, ++ const void *value, int aux) */ ++PRE(sys_fsconfig) ++{ ++ PRINT("sys_fsconfig ( %ld, %ld, %#" FMT_REGWORD "x(%s), " ++ "%#" FMT_REGWORD "x, %ld )", ++ SARG1, SARG2, ARG3, (HChar*)(Addr)ARG3, ARG4, SARG6); ++ PRE_REG_READ5(long, "fsconfig", int, fd, int, cmd, ++ const char *, key, const void *, value, int, aux); ++ if (ARG3) ++ PRE_MEM_RASCIIZ( "fsconfig(key)", ARG3); ++ if (!ML_(fd_allowed)(ARG1, "fsconfig", tid, False)) ++ SET_STATUS_Failure( VKI_EBADF ); ++ /* XXX we could also check the value based on the cmd FSCONFIG_... */ ++} ++ ++/* int fspick (int dfd, const char *path, unsigned int flags) */ ++PRE(sys_fspick) ++{ ++ PRINT("sys_fspick ( %ld, %#" FMT_REGWORD "x(%s), %ld", ++ SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3); ++ PRE_REG_READ3(long, "fspick", ++ int, dfd, const char *, filename, int, flags); ++ PRE_MEM_RASCIIZ( "fspick(path)", ARG2); ++ /* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD, ++ path 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, "fspick", tid, False)) ++ SET_STATUS_Failure( VKI_EBADF ); ++} ++ ++POST(sys_fspick) ++{ ++ if (!ML_(fd_allowed)(RES, "fspick", tid, True)) { ++ VG_(close)(RES); ++ SET_STATUS_Failure( VKI_EMFILE ); ++ } else { ++ if (VG_(clo_track_fds)) ++ ML_(record_fd_open_with_given_name)(tid, RES, (HChar*)(Addr)ARG2); ++ } ++} ++ + #undef PRE + #undef POST + +diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c +index 757b637ba986..39ba911aa5e4 100644 +--- a/coregrind/m_syswrap/syswrap-mips32-linux.c ++++ b/coregrind/m_syswrap/syswrap-mips32-linux.c +@@ -1137,7 +1137,12 @@ static SyscallTableEntry syscall_main_table[] = { + 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 +- ++ LINXY(__NR_open_tree, sys_open_tree), // 428 ++ LINX_(__NR_move_mount, sys_move_mount), // 429 ++ LINXY(__NR_fsopen, sys_fsopen), // 430 ++ LINX_(__NR_fsconfig, sys_fsconfig), // 431 ++ LINXY(__NR_fsmount, sys_fsmount), // 432 ++ LINXY(__NR_fspick, sys_fspick), // 433 + LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 + GENX_(__NR_clone3, sys_ni_syscall), // 435 + LINXY(__NR_close_range, sys_close_range), // 436 +diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c +index f0c5f7e04f4e..d603924c5566 100644 +--- a/coregrind/m_syswrap/syswrap-mips64-linux.c ++++ b/coregrind/m_syswrap/syswrap-mips64-linux.c +@@ -818,6 +818,12 @@ static SyscallTableEntry syscall_main_table[] = { + LINXY (__NR_io_uring_setup, sys_io_uring_setup), + LINXY (__NR_io_uring_enter, sys_io_uring_enter), + LINXY (__NR_io_uring_register, sys_io_uring_register), ++ LINXY (__NR_open_tree, sys_open_tree), ++ LINX_ (__NR_move_mount, sys_move_mount), ++ LINXY (__NR_fsopen, sys_fsopen), ++ LINX_ (__NR_fsconfig, sys_fsconfig), ++ LINXY (__NR_fsmount, sys_fsmount), ++ LINXY (__NR_fspick, sys_fspick), + LINXY (__NR_pidfd_open, sys_pidfd_open), + GENX_ (__NR_clone3, sys_ni_syscall), + LINXY (__NR_close_range, sys_close_range), +diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c +index f466aca147e0..853495e981b1 100644 +--- a/coregrind/m_syswrap/syswrap-nanomips-linux.c ++++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c +@@ -824,6 +824,12 @@ static SyscallTableEntry syscall_main_table[] = { + LINXY (__NR_io_uring_setup, sys_io_uring_setup), + LINXY (__NR_io_uring_enter, sys_io_uring_enter), + LINXY (__NR_io_uring_register, sys_io_uring_register), ++ LINXY (__NR_open_tree, sys_open_tree), ++ LINX_ (__NR_move_mount, sys_move_mount), ++ LINXY (__NR_fsopen, sys_fsopen), ++ LINX_ (__NR_fsconfig, sys_fsconfig), ++ LINXY (__NR_fsmount, sys_fsmount), ++ LINXY (__NR_fspick, sys_fspick), + LINXY (__NR_pidfd_open, sys_pidfd_open), + GENX_ (__NR_clone3, sys_ni_syscall), + LINXY (__NR_close_range, sys_close_range), +diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c +index 634f288ce0d1..24d8eb213190 100644 +--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c ++++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c +@@ -1059,7 +1059,12 @@ static SyscallTableEntry syscall_table[] = { + 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 +- ++ LINXY(__NR_open_tree, sys_open_tree), // 428 ++ LINX_(__NR_move_mount, sys_move_mount), // 429 ++ LINXY(__NR_fsopen, sys_fsopen), // 430 ++ LINX_(__NR_fsconfig, sys_fsconfig), // 431 ++ LINXY(__NR_fsmount, sys_fsmount), // 432 ++ LINXY(__NR_fspick, sys_fspick), // 433 + LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 + GENX_(__NR_clone3, sys_ni_syscall), // 435 + LINXY(__NR_close_range, sys_close_range), // 436 +diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c +index 2c2def330ad7..2a3ed8b92481 100644 +--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c ++++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c +@@ -1025,7 +1025,12 @@ static SyscallTableEntry syscall_table[] = { + 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 +- ++ LINXY(__NR_open_tree, sys_open_tree), // 428 ++ LINX_(__NR_move_mount, sys_move_mount), // 429 ++ LINXY(__NR_fsopen, sys_fsopen), // 430 ++ LINX_(__NR_fsconfig, sys_fsconfig), // 431 ++ LINXY(__NR_fsmount, sys_fsmount), // 432 ++ LINXY(__NR_fspick, sys_fspick), // 433 + LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 + GENX_(__NR_clone3, sys_ni_syscall), // 435 + LINXY(__NR_close_range, sys_close_range), // 436 +diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c +index ca571f0f1a7c..893306bbdae3 100644 +--- a/coregrind/m_syswrap/syswrap-s390x-linux.c ++++ b/coregrind/m_syswrap/syswrap-s390x-linux.c +@@ -865,7 +865,12 @@ static SyscallTableEntry syscall_table[] = { + 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 +- ++ LINXY(__NR_open_tree, sys_open_tree), // 428 ++ LINX_(__NR_move_mount, sys_move_mount), // 429 ++ LINXY(__NR_fsopen, sys_fsopen), // 430 ++ LINX_(__NR_fsconfig, sys_fsconfig), // 431 ++ LINXY(__NR_fsmount, sys_fsmount), // 432 ++ LINXY(__NR_fspick, sys_fspick), // 433 + LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 + GENX_(__NR_clone3, sys_ni_syscall), // 435 + LINXY(__NR_close_range, sys_close_range), // 436 +diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c +index a23743743abe..50384817dbe5 100644 +--- a/coregrind/m_syswrap/syswrap-x86-linux.c ++++ b/coregrind/m_syswrap/syswrap-x86-linux.c +@@ -1646,7 +1646,12 @@ static SyscallTableEntry syscall_table[] = { + 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 +- ++ LINXY(__NR_open_tree, sys_open_tree), // 428 ++ LINX_(__NR_move_mount, sys_move_mount), // 429 ++ LINXY(__NR_fsopen, sys_fsopen), // 430 ++ LINX_(__NR_fsconfig, sys_fsconfig), // 431 ++ LINXY(__NR_fsmount, sys_fsmount), // 432 ++ LINXY(__NR_fspick, sys_fspick), // 433 + LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 + GENX_(__NR_clone3, sys_ni_syscall), // 435 + LINXY(__NR_close_range, sys_close_range), // 436 +-- +2.47.0 + diff --git a/SOURCES/0011-Linux-regtest-reallocarray-needs-malloc.h.patch b/SOURCES/0011-Linux-regtest-reallocarray-needs-malloc.h.patch deleted file mode 100644 index 85f4415..0000000 --- a/SOURCES/0011-Linux-regtest-reallocarray-needs-malloc.h.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 1c2cdfd790b3e26f47e709770bdefd456d83a7cb Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Tue, 4 Jun 2024 12:49:33 +0200 -Subject: [PATCH 11/11] Linux regtest: reallocarray needs malloc.h - -Seen on Rocky 8.9 - -(cherry picked from commit a015ad2e0db40076b4841220c7ab6d6853798936) ---- - memcheck/tests/amd64-linux/reallocarray.c | 1 + - memcheck/tests/amd64-linux/reallocarray.stderr.exp | 8 ++++---- - 2 files changed, 5 insertions(+), 4 deletions(-) - -diff --git a/memcheck/tests/amd64-linux/reallocarray.c b/memcheck/tests/amd64-linux/reallocarray.c -index 8765ca4997cb..ce63b80100da 100644 ---- a/memcheck/tests/amd64-linux/reallocarray.c -+++ b/memcheck/tests/amd64-linux/reallocarray.c -@@ -2,6 +2,7 @@ - #include - #include - #include -+#include - #include "../../memcheck.h" - - int main(void) -diff --git a/memcheck/tests/amd64-linux/reallocarray.stderr.exp b/memcheck/tests/amd64-linux/reallocarray.stderr.exp -index a1c8439cc9ef..20a1c4e8b4f9 100644 ---- a/memcheck/tests/amd64-linux/reallocarray.stderr.exp -+++ b/memcheck/tests/amd64-linux/reallocarray.stderr.exp -@@ -12,19 +12,19 @@ To see them, rerun with: --leak-check=full --show-leak-kinds=all - - realloc() with size 0 - at 0x........: reallocarray (vg_replace_malloc.c:...) -- by 0x........: main (reallocarray.c:13) -+ by 0x........: main (reallocarray.c:14) - Address 0x........ is 0 bytes inside a block of size 40 alloc'd - at 0x........: reallocarray (vg_replace_malloc.c:...) -- by 0x........: main (reallocarray.c:11) -+ by 0x........: main (reallocarray.c:12) - - All heap blocks were freed -- no leaks are possible - - realloc() with size 0 - at 0x........: reallocarray (vg_replace_malloc.c:...) -- by 0x........: main (reallocarray.c:16) -+ by 0x........: main (reallocarray.c:17) - Address 0x........ is 0 bytes inside a block of size 10 alloc'd - at 0x........: malloc (vg_replace_malloc.c:...) -- by 0x........: main (reallocarray.c:15) -+ by 0x........: main (reallocarray.c:16) - - All heap blocks were freed -- no leaks are possible - --- -2.45.2 - diff --git a/SOURCES/0012-Bug-487439-SIGILL-in-JDK11-JDK17.patch b/SOURCES/0012-Bug-487439-SIGILL-in-JDK11-JDK17.patch deleted file mode 100644 index 5254b37..0000000 --- a/SOURCES/0012-Bug-487439-SIGILL-in-JDK11-JDK17.patch +++ /dev/null @@ -1,184 +0,0 @@ -From e62c7b4f9ee0a8c20c7211a92ad512f925e9515c Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Sun, 16 Jun 2024 09:25:51 +0200 -Subject: [PATCH 12/15] Bug 487439 - SIGILL in JDK11, JDK17 - -(cherry picked from commit c19d19d34a6dadaf4a9d590f516f813e9cbacdd0) ---- - .gitignore | 1 + - NEWS | 1 + - VEX/priv/guest_amd64_toIR.c | 2 +- - none/tests/amd64/Makefile.am | 3 + - none/tests/amd64/bug487439.cpp | 83 +++++++++++++++++++++++++++ - none/tests/amd64/bug487439.stderr.exp | 0 - none/tests/amd64/bug487439.stdout.exp | 1 + - none/tests/amd64/bug487439.vgtest | 2 + - 8 files changed, 92 insertions(+), 1 deletion(-) - create mode 100644 none/tests/amd64/bug487439.cpp - create mode 100644 none/tests/amd64/bug487439.stderr.exp - create mode 100644 none/tests/amd64/bug487439.stdout.exp - create mode 100644 none/tests/amd64/bug487439.vgtest - -diff --git a/NEWS b/NEWS -index c2ad6a207d96..fbe0f012ef0c 100644 ---- a/NEWS -+++ b/NEWS -@@ -9,6 +9,7 @@ The following bugs have been fixed or resolved on this branch. - 486180 [MIPS] 'VexGuestArchState' has no member named 'guest_IP_AT_SYSCALL' - 486293 memccpy false positives - 486569 linux inotify_init syscall wrapper missing POST entry in syscall_table -+487439 SIGILL in JDK11, JDK17 - n-i-bz aarch64 frinta and frinta vector instructions - - To see details of a given bug, visit -diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c -index f0b1c5516267..28c37f092211 100644 ---- a/VEX/priv/guest_amd64_toIR.c -+++ b/VEX/priv/guest_amd64_toIR.c -@@ -14138,7 +14138,7 @@ Long dis_ESC_0F__SSE2 ( Bool* decode_OK, - goto decode_success; - } - /* 66 0F 73 /6 ib = PSLLQ by immediate */ -- if (have66noF2noF3(pfx) && sz == 2 -+ if (have66noF2noF3(pfx) && (sz == 2 || /* ignore redundant REX.W */ sz == 8) - && epartIsReg(getUChar(delta)) - && gregLO3ofRM(getUChar(delta)) == 6) { - delta = dis_SSE_shiftE_imm( pfx, delta, "psllq", Iop_ShlN64x2 ); -diff --git a/none/tests/amd64/Makefile.am b/none/tests/amd64/Makefile.am -index dc0498018209..83029c15590c 100644 ---- a/none/tests/amd64/Makefile.am -+++ b/none/tests/amd64/Makefile.am -@@ -44,6 +44,7 @@ EXTRA_DIST = \ - bug156404-amd64.vgtest bug156404-amd64.stdout.exp \ - bug156404-amd64.stderr.exp \ - bug485148.vgtest bug485148.stdout.exp bug485148.stderr.exp \ -+ bug487439.vgtest bug487439.stdout.exp bug487439.stderr.exp \ - cet_nops.vgtest cet_nops.stdout.exp cet_nops.stderr.exp \ - clc.vgtest clc.stdout.exp clc.stderr.exp \ - crc32.vgtest crc32.stdout.exp crc32.stderr.exp \ -@@ -107,6 +108,7 @@ check_PROGRAMS = \ - amd64locked \ - bt_flags \ - bug127521-64 bug132813-amd64 bug132918 bug137714-amd64 \ -+ bug487439 \ - cet_nops \ - clc \ - cmpxchg \ -@@ -204,6 +206,7 @@ amd64locked_CFLAGS = $(AM_CFLAGS) -O - bug132918_LDADD = -lm - bug485148_CXXFLAGS = ${AM_CXXFLAGS} -mfma - bug485148_SOURCES = bug485148.cpp -+bug487439_SOURCES = bug487439.cpp - cmpxchg_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@ - fb_test_amd64_CFLAGS = $(AM_CFLAGS) -O -fno-strict-aliasing - fb_test_amd64_LDADD = -lm -diff --git a/none/tests/amd64/bug487439.cpp b/none/tests/amd64/bug487439.cpp -new file mode 100644 -index 000000000000..f86bb65ce9eb ---- /dev/null -+++ b/none/tests/amd64/bug487439.cpp -@@ -0,0 +1,83 @@ -+// This is more or less a copy/paste from the generated insn_sse2.c -+// I didn't want to mess with the perl generator because -+// GCC and clang don't agree on the asm syntax -+// Using the rex prefix looks like a bug or misfeature in OpenJDK -+// so I'm assuming that this is a one-off and not a general issue -+ -+#include -+#include -+#include -+ -+union reg128_t { -+ char sb[16]; -+ unsigned char ub[16]; -+ short sw[8]; -+ unsigned short uw[8]; -+ int sd[4]; -+ unsigned int ud[4]; -+ long long int sq[2]; -+ unsigned long long int uq[2]; -+ float ps[4]; -+ double pd[2]; -+} __attribute__ ((aligned (16))); -+ -+static sigjmp_buf catchpoint; -+ -+static void handle_sigill(int signum) -+{ -+ siglongjmp(catchpoint, 1); -+} -+ -+/* with redundant rex.W */ -+static void psllq_4(void) -+{ -+ reg128_t arg1 = { .uq = { 0x0123456789abcdefULL, 0x0123456789abcdefULL } }; -+ reg128_t result0; -+ char state[108]; -+ -+ if (sigsetjmp(catchpoint, 1) == 0) -+ { -+ asm( -+ "ffree %%st(7)\n" -+ "ffree %%st(6)\n" -+ "ffree %%st(5)\n" -+ "ffree %%st(4)\n" -+ "movlps %2, %%xmm1\n" -+ "movhps %3, %%xmm1\n" -+ // only GCC -+ //".rex.W psllq $12, %%xmm1\n" -+ // only clang -+ //"data16 rex64 psllq $12, %mm1\n" -+ ".byte 0x66,0x48,0x0f,0x73,0xf1,0x0c\n" -+ "movlps %%xmm1, %0\n" -+ "movhps %%xmm1, %1\n" -+ "cld\n" -+ : "=m" (result0.uq[0]), "=m" (result0.uq[1]) -+ : "m" (arg1.uq[0]), "m" (arg1.uq[1]), "m" (state[0]) -+ : "xmm1" -+ ); -+ -+ if (result0.uq[0] == 0x3456789abcdef000ULL && result0.uq[1] == 0x3456789abcdef000ULL ) -+ { -+ std::cout << "psllq_4 ... ok\n"; -+ } -+ else -+ { -+ std::cout << "psllq_4 ... not ok\n"; -+ std::cout << " result0.uq[0] = " << result0.uq[0] << " (expected " << 0x3456789abcdef000ULL << ")\n"; -+ std::cout << " result0.uq[1] = " << result0.uq[1] << " (expected " << 0x3456789abcdef000ULL << ")\n"; -+ } -+ } -+ else -+ { -+ std::cout << "psllq_4 ... failed\n"; -+ } -+ -+ return; -+} -+ -+int main() -+{ -+ signal(SIGILL, handle_sigill); -+ psllq_4(); -+} -diff --git a/none/tests/amd64/bug487439.stderr.exp b/none/tests/amd64/bug487439.stderr.exp -new file mode 100644 -index 000000000000..e69de29bb2d1 -diff --git a/none/tests/amd64/bug487439.stdout.exp b/none/tests/amd64/bug487439.stdout.exp -new file mode 100644 -index 000000000000..065b518a27d7 ---- /dev/null -+++ b/none/tests/amd64/bug487439.stdout.exp -@@ -0,0 +1 @@ -+psllq_4 ... ok -diff --git a/none/tests/amd64/bug487439.vgtest b/none/tests/amd64/bug487439.vgtest -new file mode 100644 -index 000000000000..3faa1ed6b014 ---- /dev/null -+++ b/none/tests/amd64/bug487439.vgtest -@@ -0,0 +1,2 @@ -+prog: bug487439 -+vgopts: -q --- -2.45.2 - diff --git a/SOURCES/0012-Recognize-new-DWARF5-DW_LANG-constants.patch b/SOURCES/0012-Recognize-new-DWARF5-DW_LANG-constants.patch new file mode 100644 index 0000000..ef89578 --- /dev/null +++ b/SOURCES/0012-Recognize-new-DWARF5-DW_LANG-constants.patch @@ -0,0 +1,144 @@ +From a2c30f44ac39eb36baa4e831b041fe7cdf25e481 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Fri, 6 Dec 2024 15:39:25 +0100 +Subject: [PATCH 12/14] Recognize new DWARF5 DW_LANG constants + +When using --read-var-info=yes readdwarf3 will try to read and +interpret the CU DW_AT_langauge attribute. Since DWARF5 was released a +number if new language constants have been introduced. See +https://dwarfstd.org/languages.html + +GCC15 might start emitting some of these when switching to C23 by +default. + +When valgrind --read-var-info=yes encounters an unknown DW_LANG +constant it will produce an error and stop processing any further +DWARF. + +Recognize all currently known language constants. In particular +recognize DW_LANG_C17, DW_LANG_C23, DW_LANG_C_plus_plus_17, +DW_LANG_C_plus_plus_20, DW_LANG_C_plus_plus_23, DW_LANG_Fortran18, +DW_LANG_Fortran23, DW_LANG_Ada2005, DW_LANG_Ada2012 and DW_LANG_Rust. + +https://bugs.kde.org/show_bug.cgi?id=497130 + +(cherry picked from commit 7136316123c54aba37fdab166e1bf860e452a4ae) +--- + NEWS | 1 + + coregrind/m_debuginfo/priv_d3basics.h | 31 +++++++++++++++++++++++++++ + coregrind/m_debuginfo/readdwarf3.c | 27 +++++++++++++++++++++-- + 3 files changed, 57 insertions(+), 2 deletions(-) + +diff --git a/NEWS b/NEWS +index 7f1334aa0f07..a25f9b663098 100644 +--- a/NEWS ++++ b/NEWS +@@ -7,6 +7,7 @@ The following bugs have been fixed or resolved on this branch. + + 489913 WARNING: unhandled amd64-linux syscall: 444 (landlock_create_ruleset) + 494246 syscall fsopen not wrapped ++497130 Recognize new DWARF5 DW_LANG constants + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/coregrind/m_debuginfo/priv_d3basics.h b/coregrind/m_debuginfo/priv_d3basics.h +index 3f6e5c72c9e4..34c98728711c 100644 +--- a/coregrind/m_debuginfo/priv_d3basics.h ++++ b/coregrind/m_debuginfo/priv_d3basics.h +@@ -179,6 +179,7 @@ typedef enum dwarf_source_language + /* DWARF 4. */ + DW_LANG_Python = 0x0014, + /* DWARF 5. */ ++ DW_LANG_OpenCL = 0x0015, + DW_LANG_Go = 0x0016, + DW_LANG_Modula3 = 0x0017, + DW_LANG_Haskell = 0x0018, +@@ -195,6 +196,36 @@ typedef enum dwarf_source_language + DW_LANG_Fortran08 = 0x0023, + DW_LANG_RenderScript = 0x0024, + DW_LANG_BLISS = 0x0025, ++ /* Language codes added since DWARF 5. ++ https://dwarfstd.org/languages.html */ ++ DW_LANG_Kotlin = 0x0026, ++ DW_LANG_Zig = 0x0027, ++ DW_LANG_Crystal = 0x0028, ++ DW_LANG_C_plus_plus_17 = 0x002a, ++ DW_LANG_C_plus_plus_20 = 0x002b, ++ DW_LANG_C17 = 0x002c, ++ DW_LANG_Fortran18 = 0x002d, ++ DW_LANG_Ada2005 = 0x002e, ++ DW_LANG_Ada2012 = 0x002f, ++ DW_LANG_HIP = 0x0030, ++ DW_LANG_Assembly = 0x0031, ++ DW_LANG_C_sharp = 0x0032, ++ DW_LANG_Mojo = 0x0033, ++ DW_LANG_GLSL = 0x0034, ++ DW_LANG_GLSL_ES = 0x0035, ++ DW_LANG_HLSL = 0x0036, ++ DW_LANG_OpenCL_CPP = 0x0037, ++ DW_LANG_CPP_for_OpenCL = 0x0038, ++ DW_LANG_SYCL = 0x0039, ++ DW_LANG_C_plus_plus_23 = 0x003a, ++ DW_LANG_Odin = 0x003b, ++ DW_LANG_P4 = 0x003c, ++ DW_LANG_Metal = 0x003d, ++ DW_LANG_C23 = 0x003e, ++ DW_LANG_Fortran23 = 0x003f, ++ DW_LANG_Ruby = 0x0040, ++ DW_LANG_Move = 0x0041, ++ DW_LANG_Hylo = 0x0042, + /* MIPS. */ + DW_LANG_Mips_Assembler = 0x8001, + /* UPC. */ +diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c +index a4b75a8c532b..735896f7c0d3 100644 +--- a/coregrind/m_debuginfo/readdwarf3.c ++++ b/coregrind/m_debuginfo/readdwarf3.c +@@ -3972,19 +3972,42 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents, + case DW_LANG_C_plus_plus: case DW_LANG_ObjC: + case DW_LANG_ObjC_plus_plus: case DW_LANG_UPC: + case DW_LANG_Upc: case DW_LANG_C99: case DW_LANG_C11: ++ case DW_LANG_C17: case DW_LANG_C23: + case DW_LANG_C_plus_plus_11: case DW_LANG_C_plus_plus_14: ++ case DW_LANG_C_plus_plus_17: case DW_LANG_C_plus_plus_20: ++ case DW_LANG_C_plus_plus_23: + parser->language = 'C'; break; + case DW_LANG_Fortran77: case DW_LANG_Fortran90: + case DW_LANG_Fortran95: case DW_LANG_Fortran03: +- case DW_LANG_Fortran08: ++ case DW_LANG_Fortran08: case DW_LANG_Fortran18: ++ case DW_LANG_Fortran23: + parser->language = 'F'; break; + case DW_LANG_Ada83: case DW_LANG_Ada95: ++ case DW_LANG_Ada2005: case DW_LANG_Ada2012: + parser->language = 'A'; break; + case DW_LANG_Cobol74: + case DW_LANG_Cobol85: case DW_LANG_Pascal83: + case DW_LANG_Modula2: case DW_LANG_Java: + case DW_LANG_PLI: +- case DW_LANG_D: case DW_LANG_Python: case DW_LANG_Go: ++ case DW_LANG_D: case DW_LANG_Python: ++ case DW_LANG_OpenCL: case DW_LANG_Go: ++ case DW_LANG_Modula3: case DW_LANG_Haskell: ++ case DW_LANG_OCaml: case DW_LANG_Rust: case DW_LANG_Swift: ++ case DW_LANG_Julia: case DW_LANG_Dylan: ++ case DW_LANG_RenderScript: case DW_LANG_BLISS: ++ case DW_LANG_Kotlin: case DW_LANG_Zig: ++ case DW_LANG_Crystal: case DW_LANG_HIP: ++ case DW_LANG_Assembly: case DW_LANG_C_sharp: ++ case DW_LANG_Mojo: case DW_LANG_GLSL: ++ case DW_LANG_GLSL_ES: case DW_LANG_HLSL: ++ case DW_LANG_OpenCL_CPP: case DW_LANG_CPP_for_OpenCL: ++ case DW_LANG_SYCL: ++ case DW_LANG_Odin: ++ case DW_LANG_P4: ++ case DW_LANG_Metal: ++ case DW_LANG_Ruby: ++ case DW_LANG_Move: ++ case DW_LANG_Hylo: + case DW_LANG_Mips_Assembler: + parser->language = '?'; break; + default: +-- +2.47.1 + diff --git a/SOURCES/0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch b/SOURCES/0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch new file mode 100644 index 0000000..6c8c3f7 --- /dev/null +++ b/SOURCES/0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch @@ -0,0 +1,147 @@ +From febe1ccef09f70777b086f938c03f3e71989a7c8 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Tue, 7 Jan 2025 08:05:20 +0100 +Subject: [PATCH 13/14] Bug 498317 - FdBadUse is not a valid CoreError type in + a suppression even though it's generated by --gen-suppressions=yes + +https://bugs.kde.org/show_bug.cgi?id=498317 + +(cherry picked from commit 47bdc4a6f3de8e2071561d349fdd5f830388c489) +--- + NEWS | 2 ++ + coregrind/m_errormgr.c | 7 +++++-- + coregrind/m_syswrap/syswrap-freebsd.c | 4 ++++ + none/tests/freebsd/Makefile.am | 4 +++- + none/tests/freebsd/bug498317.c | 7 +++++++ + none/tests/freebsd/bug498317.stderr.exp | 0 + none/tests/freebsd/bug498317.supp | 8 ++++++++ + none/tests/freebsd/bug498317.vgtest | 2 ++ + 9 files changed, 32 insertions(+), 3 deletions(-) + create mode 100644 none/tests/freebsd/bug498317.c + create mode 100644 none/tests/freebsd/bug498317.stderr.exp + create mode 100644 none/tests/freebsd/bug498317.supp + create mode 100644 none/tests/freebsd/bug498317.vgtest + +diff --git a/NEWS b/NEWS +index a25f9b663098..2fb8ce5c724b 100644 +--- a/NEWS ++++ b/NEWS +@@ -8,6 +8,8 @@ The following bugs have been fixed or resolved on this branch. + 489913 WARNING: unhandled amd64-linux syscall: 444 (landlock_create_ruleset) + 494246 syscall fsopen not wrapped + 497130 Recognize new DWARF5 DW_LANG constants ++498317 FdBadUse is not a valid CoreError type in a suppression ++ even though it's generated by --gen-suppressions=yes + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c +index 4bbcea02474c..2ce919482f77 100644 +--- a/coregrind/m_errormgr.c ++++ b/coregrind/m_errormgr.c +@@ -206,7 +206,8 @@ typedef + // example should new core errors ever be added. + ThreadSupp = -1, /* Matches ThreadErr */ + FdBadCloseSupp = -2, +- FdNotClosedSupp = -3 ++ FdNotClosedSupp = -3, ++ FdBadUseSupp = -4 + } + CoreSuppKind; + +@@ -1033,7 +1034,7 @@ static Bool core_error_matches_suppression(const Error* err, const Supp* su) + return err->ekind == FdBadClose; + case FdNotClosedSupp: + return err->ekind == FdNotClosed; +- case FdBadUse: ++ case FdBadUseSupp: + return err->ekind == FdBadUse; + default: + VG_(umsg)("FATAL: unknown core suppression kind: %d\n", su->skind ); +@@ -1522,6 +1523,8 @@ static void load_one_suppressions_file ( Int clo_suppressions_i ) + supp->skind = FdBadCloseSupp; + else if (VG_STREQ(supp_name, "FdNotClosed")) + supp->skind = FdNotClosedSupp; ++ else if (VG_STREQ(supp_name, "FdBadUse")) ++ supp->skind = FdBadUseSupp; + else + BOMB("unknown core suppression type"); + } +diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c +index 685eb6be076c..a2b79545594e 100644 +--- a/coregrind/m_syswrap/syswrap-freebsd.c ++++ b/coregrind/m_syswrap/syswrap-freebsd.c +@@ -1400,6 +1400,10 @@ PRE(sys_fcntl) + PRINT("sys_fcntl[UNKNOWN] ( %lu, %lu, %lu )", ARG1,ARG2,ARG3); + I_die_here; + } ++ ++ if (!ML_(fd_allowed)(ARG1, "fcntl", tid, False)) { ++ SET_STATUS_Failure (VKI_EBADF); ++ } + } + + POST(sys_fcntl) +diff --git a/none/tests/freebsd/Makefile.am b/none/tests/freebsd/Makefile.am +index fe4f8db69824..1ccfefb57fe2 100644 +--- a/none/tests/freebsd/Makefile.am ++++ b/none/tests/freebsd/Makefile.am +@@ -11,6 +11,8 @@ EXTRA_DIST = \ + auxv.stderr.exp-freebsd131 \ + auxv.stderr.exp-freebsd14 \ + auxv.stderr.exp-arm64 \ ++ bug498317.vgtest bug498317.stderr.exp \ ++ bug498317.supp \ + cp.vgtest \ + cp.stderr.exp \ + osrel.vgtest \ +@@ -61,7 +63,7 @@ EXTRA_DIST = \ + usrstack.stdout.exp + + check_PROGRAMS = \ +- auxv osrel swapcontext hello_world fexecve 452275 usrstack \ ++ auxv bug498317 osrel swapcontext hello_world fexecve 452275 usrstack \ + proc_pid_file sanity_level_thread umtx_shm_creat + + AM_CFLAGS += $(AM_FLAG_M3264_PRI) +diff --git a/none/tests/freebsd/bug498317.c b/none/tests/freebsd/bug498317.c +new file mode 100644 +index 000000000000..36a1a5a1365e +--- /dev/null ++++ b/none/tests/freebsd/bug498317.c +@@ -0,0 +1,7 @@ ++#include ++ ++int main(void) { ++ fcntl(-1, F_GETFD); ++ return 0; ++} ++ +diff --git a/none/tests/freebsd/bug498317.stderr.exp b/none/tests/freebsd/bug498317.stderr.exp +new file mode 100644 +index 000000000000..e69de29bb2d1 +diff --git a/none/tests/freebsd/bug498317.supp b/none/tests/freebsd/bug498317.supp +new file mode 100644 +index 000000000000..b3a99447c2a4 +--- /dev/null ++++ b/none/tests/freebsd/bug498317.supp +@@ -0,0 +1,8 @@ ++{ ++ test suppression of FdBadUse ++ CoreError:FdBadUse ++ fun:_fcntl ++ fun:fcntl ++ fun:main ++} ++ +diff --git a/none/tests/freebsd/bug498317.vgtest b/none/tests/freebsd/bug498317.vgtest +new file mode 100644 +index 000000000000..6579ebce8c56 +--- /dev/null ++++ b/none/tests/freebsd/bug498317.vgtest +@@ -0,0 +1,2 @@ ++prog: bug498317 ++vgopts: -q +-- +2.47.1 + diff --git a/SOURCES/0013-Don-t-leave-fds-created-with-log-file-xml-file-or-lo.patch b/SOURCES/0013-Don-t-leave-fds-created-with-log-file-xml-file-or-lo.patch deleted file mode 100644 index bdabc23..0000000 --- a/SOURCES/0013-Don-t-leave-fds-created-with-log-file-xml-file-or-lo.patch +++ /dev/null @@ -1,226 +0,0 @@ -From 14cefe7c645a3148165f4b2fa6095d9446e378c7 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Sun, 16 Jun 2024 21:23:08 +0200 -Subject: [PATCH 13/15] Don't leave fds created with --log-file, --xml-file or - --log-socket open -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -prepare_sink_fd and prepare_sink_socket will create a new file -descriptor for the output sink. finalize_sink_fd then copies the fd -to the safe range, so it doesn't conflict with any application fds. - -If we created the original fd ourselves, it was a VgLogTo_File or -VgLogTo_Socket, not VgLogTo_Fd, finalize_sink_fd should close it. - -Also close socket when connecting fails in VG_(connect_via_socket). - -Add a testcase for --log-file and --xml-file which prints output to -/dev/stderr - -https://bugs.kde.org/show_bug.cgi?id=202770 -https://bugs.kde.org/show_bug.cgi?id=311655 -https://bugs.kde.org/show_bug.cgi?id=488379 - -Co-authored-by: Alexandra Hájková fd = safe_fd; -+ /* If we created the new_fd (VgLogTo_File or VgLogTo_Socket), then we -+ don't need the original file descriptor open anymore. We only need -+ to keep it open if it was an existing fd given by the user (or -+ stderr). */ -+ if (sink->type != VgLogTo_Fd) -+ VG_(close)(new_fd); - } - } - -diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am -index 185993f204bb..532cc7632a8f 100644 ---- a/none/tests/Makefile.am -+++ b/none/tests/Makefile.am -@@ -86,6 +86,7 @@ dist_noinst_SCRIPTS = \ - filter_none_discards \ - filter_stderr \ - filter_timestamp \ -+ filter_xml \ - allexec_prepare_prereq - - noinst_HEADERS = fdleak.h -@@ -229,7 +230,9 @@ EXTRA_DIST = \ - sigprocmask.stderr.exp sigprocmask.vgtest \ - socket_close.stderr.exp socket_close.vgtest \ - file_dclose.stderr.exp file_dclose.vgtest \ -- double_close_range.stderr.exp double_close_range.vgtest -+ double_close_range.stderr.exp double_close_range.vgtest \ -+ log-track-fds.stderr.exp log-track-fds.vgtest \ -+ xml-track-fds.stderr.exp xml-track-fds.vgtest - - - check_PROGRAMS = \ -diff --git a/none/tests/filter_xml b/none/tests/filter_xml -new file mode 100755 -index 000000000000..d1ef570a05b0 ---- /dev/null -+++ b/none/tests/filter_xml -@@ -0,0 +1,25 @@ -+#! /bin/sh -+ -+dir=`dirname $0` -+ -+# FreeBSD adds this one extra line -+# but after filter_xml_frames it will just be ...<\/path> -+# which matches other lines, so get rid of it while we can -+# uniquely match it -+sed "/internet<\/path>/d" | -+ -+$dir/../../tests/filter_xml_frames | -+perl -p -e "s/