Compare commits
No commits in common. 'c9' and 'cs10' have entirely different histories.
@ -1 +1 @@
|
||||
SOURCES/valgrind-3.21.0.tar.bz2
|
||||
SOURCES/valgrind-3.24.0.tar.bz2
|
||||
|
@ -1 +1 @@
|
||||
817d769743d278b5d07526e85115082054e9bf9c SOURCES/valgrind-3.21.0.tar.bz2
|
||||
6fc0470fedc0d85dae3e042297cabd13c6100749 SOURCES/valgrind-3.24.0.tar.bz2
|
||||
|
@ -0,0 +1,31 @@
|
||||
From cc09f61e56e90c9d3a0e7231cc69b2a499d1205f Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
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 49b4647d4295..8362e1d2df41 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -1,3 +1,14 @@
|
||||
+Branch 3.24
|
||||
+~~~~~~~~~~~
|
||||
+
|
||||
+* ==================== FIXED BUGS ====================
|
||||
+
|
||||
+The following bugs have been fixed or resolved on this branch.
|
||||
+
|
||||
+To see details of a given bug, visit
|
||||
+ https://bugs.kde.org/show_bug.cgi?id=XXXXXX
|
||||
+where XXXXXX is the bug number as listed above.
|
||||
+
|
||||
Release 3.24.0 (31 Oct 2024)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
--
|
||||
2.47.0
|
||||
|
@ -0,0 +1,37 @@
|
||||
From 2cb0bee2d7722b57956f66a0795b5b9106f88afc Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
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
|
||||
|
@ -0,0 +1,36 @@
|
||||
From 8b08da73cf3d72439c4f750c96ed2f088ef1bbec Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
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
|
||||
|
@ -0,0 +1,27 @@
|
||||
From 7e79bb6e6b80eb43138cbbb64737433f9e036cd4 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Floyd <pjfloyd@wanadoo.fr>
|
||||
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
|
||||
|
@ -0,0 +1,491 @@
|
||||
From ba15b8fe7d6fabfb73424a616de18a752a56430a Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
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 @@
|
||||
+<?xml version="1.0"?>
|
||||
+
|
||||
+<valgrindoutput>
|
||||
+
|
||||
+<protocolversion>5</protocolversion>
|
||||
+<protocoltool>none</protocoltool>
|
||||
+
|
||||
+<preamble>
|
||||
+ <line>Nulgrind, the minimal Valgrind tool</line>
|
||||
+ <line>Copyright...</line>
|
||||
+ <line>Using Valgrind...</line>
|
||||
+ <line>Command: ./fdleak_cmsg</line>
|
||||
+</preamble>
|
||||
+
|
||||
+<pid>...</pid>
|
||||
+<ppid>...</ppid>
|
||||
+<tool>none</tool>
|
||||
+
|
||||
+<args>
|
||||
+ <vargv>
|
||||
+ <exe>...</exe>
|
||||
+ <arg>--command-line-only=yes</arg>
|
||||
+ <arg>--memcheck:leak-check=no</arg>
|
||||
+ <arg>--tool=none</arg>
|
||||
+ <arg>--track-fds=all</arg>
|
||||
+ <arg>--xml=yes</arg>
|
||||
+ <arg>--xml-fd=2</arg>
|
||||
+ <arg>--child-silent-after-fork=yes</arg>
|
||||
+ </vargv>
|
||||
+ <argv>
|
||||
+ <exe>...</exe>
|
||||
+ </argv>
|
||||
+</args>
|
||||
+
|
||||
+<status>
|
||||
+ <state>RUNNING</state>
|
||||
+ <time>...</time>
|
||||
+</status>
|
||||
+
|
||||
+
|
||||
+<status>
|
||||
+ <state>FINISHED</state>
|
||||
+ <time>...</time>
|
||||
+</status>
|
||||
+
|
||||
+<error>
|
||||
+ <unique>0x........</unique>
|
||||
+ <tid>...</tid>
|
||||
+ <kind>FdNotClosed</kind>
|
||||
+ <fd>5</fd>
|
||||
+ <path>...</path>
|
||||
+ <what>...</what>
|
||||
+ <stack>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>client</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_cmsg.c</file>
|
||||
+ <line>133</line>
|
||||
+ </frame>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>main</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_cmsg.c</file>
|
||||
+ <line>174</line>
|
||||
+ </frame>
|
||||
+ </stack>
|
||||
+</error>
|
||||
+
|
||||
+<error>
|
||||
+ <unique>0x........</unique>
|
||||
+ <tid>...</tid>
|
||||
+ <kind>FdNotClosed</kind>
|
||||
+ <fd>4</fd>
|
||||
+ <path>...</path>
|
||||
+ <what>...</what>
|
||||
+ <stack>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>client</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_cmsg.c</file>
|
||||
+ <line>133</line>
|
||||
+ </frame>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>main</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_cmsg.c</file>
|
||||
+ <line>174</line>
|
||||
+ </frame>
|
||||
+ </stack>
|
||||
+</error>
|
||||
+
|
||||
+<error>
|
||||
+ <unique>0x........</unique>
|
||||
+ <tid>...</tid>
|
||||
+ <kind>FdNotClosed</kind>
|
||||
+ <fd>3</fd>
|
||||
+ <what>...</what>
|
||||
+ <stack>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>client</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_cmsg.c</file>
|
||||
+ <line>112</line>
|
||||
+ </frame>
|
||||
+ </stack>
|
||||
+</error>
|
||||
+
|
||||
+<error>
|
||||
+ <unique>0x........</unique>
|
||||
+ <tid>...</tid>
|
||||
+ <kind>FdNotClosed</kind>
|
||||
+ <fd>2</fd>
|
||||
+ <path>...</path>
|
||||
+ <what>...</what>
|
||||
+</error>
|
||||
+
|
||||
+<error>
|
||||
+ <unique>0x........</unique>
|
||||
+ <tid>...</tid>
|
||||
+ <kind>FdNotClosed</kind>
|
||||
+ <fd>1</fd>
|
||||
+ <path>...</path>
|
||||
+ <what>...</what>
|
||||
+</error>
|
||||
+
|
||||
+<error>
|
||||
+ <unique>0x........</unique>
|
||||
+ <tid>...</tid>
|
||||
+ <kind>FdNotClosed</kind>
|
||||
+ <fd>0</fd>
|
||||
+ <path>...</path>
|
||||
+ <what>...</what>
|
||||
+</error>
|
||||
+
|
||||
+
|
||||
+</valgrindoutput>
|
||||
+
|
||||
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 @@
|
||||
+<?xml version="1.0"?>
|
||||
+
|
||||
+<valgrindoutput>
|
||||
+
|
||||
+<protocolversion>5</protocolversion>
|
||||
+<protocoltool>none</protocoltool>
|
||||
+
|
||||
+<preamble>
|
||||
+ <line>Nulgrind, the minimal Valgrind tool</line>
|
||||
+ <line>Copyright...</line>
|
||||
+ <line>Using Valgrind...</line>
|
||||
+ <line>Command: ./fdleak_ipv4</line>
|
||||
+</preamble>
|
||||
+
|
||||
+<pid>...</pid>
|
||||
+<ppid>...</ppid>
|
||||
+<tool>none</tool>
|
||||
+
|
||||
+<args>
|
||||
+ <vargv>
|
||||
+ <exe>...</exe>
|
||||
+ <arg>--command-line-only=yes</arg>
|
||||
+ <arg>--memcheck:leak-check=no</arg>
|
||||
+ <arg>--tool=none</arg>
|
||||
+ <arg>--track-fds=yes</arg>
|
||||
+ <arg>--xml=yes</arg>
|
||||
+ <arg>--xml-fd=2</arg>
|
||||
+ <arg>--child-silent-after-fork=yes</arg>
|
||||
+ </vargv>
|
||||
+ <argv>
|
||||
+ <exe>...</exe>
|
||||
+ </argv>
|
||||
+</args>
|
||||
+
|
||||
+<status>
|
||||
+ <state>RUNNING</state>
|
||||
+ <time>...</time>
|
||||
+</status>
|
||||
+
|
||||
+<error>
|
||||
+ <unique>0x........</unique>
|
||||
+ <tid>...</tid>
|
||||
+ <kind>FdBadClose</kind>
|
||||
+ <fd>4</fd>
|
||||
+ <what>...</what>
|
||||
+ <stack>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>client</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_ipv4.c</file>
|
||||
+ <line>70</line>
|
||||
+ </frame>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>main</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_ipv4.c</file>
|
||||
+ <line>90</line>
|
||||
+ </frame>
|
||||
+ </stack>
|
||||
+ <auxwhat>Previously closed</auxwhat>
|
||||
+ <stack>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>client</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_ipv4.c</file>
|
||||
+ <line>69</line>
|
||||
+ </frame>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>main</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_ipv4.c</file>
|
||||
+ <line>90</line>
|
||||
+ </frame>
|
||||
+ </stack>
|
||||
+ <auxwhat>Originally opened</auxwhat>
|
||||
+ <stack>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>client</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_ipv4.c</file>
|
||||
+ <line>68</line>
|
||||
+ </frame>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>main</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_ipv4.c</file>
|
||||
+ <line>90</line>
|
||||
+ </frame>
|
||||
+ </stack>
|
||||
+</error>
|
||||
+
|
||||
+
|
||||
+<status>
|
||||
+ <state>FINISHED</state>
|
||||
+ <time>...</time>
|
||||
+</status>
|
||||
+
|
||||
+<error>
|
||||
+ <unique>0x........</unique>
|
||||
+ <tid>...</tid>
|
||||
+ <kind>FdNotClosed</kind>
|
||||
+ <fd>3</fd>
|
||||
+ <what>...</what>
|
||||
+ <stack>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>client</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>fdleak_ipv4.c</file>
|
||||
+ <line>51</line>
|
||||
+ </frame>
|
||||
+ </stack>
|
||||
+</error>
|
||||
+
|
||||
+<errorcounts>
|
||||
+ <pair>
|
||||
+ <count>1</count>
|
||||
+ <unique>0x........</unique>
|
||||
+ </pair>
|
||||
+</errorcounts>
|
||||
+
|
||||
+<suppcounts>
|
||||
+</suppcounts>
|
||||
+
|
||||
+</valgrindoutput>
|
||||
+
|
||||
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 @@
|
||||
+<?xml version="1.0"?>
|
||||
+
|
||||
+<valgrindoutput>
|
||||
+
|
||||
+<protocolversion>5</protocolversion>
|
||||
+<protocoltool>none</protocoltool>
|
||||
+
|
||||
+<preamble>
|
||||
+ <line>Nulgrind, the minimal Valgrind tool</line>
|
||||
+ <line>Copyright...</line>
|
||||
+ <line>Using Valgrind...</line>
|
||||
+ <line>Command: ./socket_close</line>
|
||||
+</preamble>
|
||||
+
|
||||
+<pid>...</pid>
|
||||
+<ppid>...</ppid>
|
||||
+<tool>none</tool>
|
||||
+
|
||||
+<args>
|
||||
+ <vargv>
|
||||
+ <exe>...</exe>
|
||||
+ <arg>--command-line-only=yes</arg>
|
||||
+ <arg>--memcheck:leak-check=no</arg>
|
||||
+ <arg>--tool=none</arg>
|
||||
+ <arg>-q</arg>
|
||||
+ <arg>--track-fds=yes</arg>
|
||||
+ <arg>--xml=yes</arg>
|
||||
+ <arg>--xml-fd=2</arg>
|
||||
+ </vargv>
|
||||
+ <argv>
|
||||
+ <exe>...</exe>
|
||||
+ </argv>
|
||||
+</args>
|
||||
+
|
||||
+<status>
|
||||
+ <state>RUNNING</state>
|
||||
+ <time>...</time>
|
||||
+</status>
|
||||
+
|
||||
+Open socket 3
|
||||
+close socket_fd 3
|
||||
+and close the socket again 3
|
||||
+<error>
|
||||
+ <unique>0x........</unique>
|
||||
+ <tid>...</tid>
|
||||
+ <kind>FdBadClose</kind>
|
||||
+ <fd>3</fd>
|
||||
+ <what>...</what>
|
||||
+ <stack>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>main</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>socket_close.c</file>
|
||||
+ <line>40</line>
|
||||
+ </frame>
|
||||
+ </stack>
|
||||
+ <auxwhat>Previously closed</auxwhat>
|
||||
+ <stack>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>main</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>socket_close.c</file>
|
||||
+ <line>36</line>
|
||||
+ </frame>
|
||||
+ </stack>
|
||||
+ <auxwhat>Originally opened</auxwhat>
|
||||
+ <stack>
|
||||
+ <frame>
|
||||
+ <ip>0x........</ip>
|
||||
+ <obj>...</obj>
|
||||
+ <fn>open_socket</fn>
|
||||
+ <dir>...</dir>
|
||||
+ <file>socket_close.c</file>
|
||||
+ <line>17</line>
|
||||
+ </frame>
|
||||
+ </stack>
|
||||
+</error>
|
||||
+
|
||||
+
|
||||
+<status>
|
||||
+ <state>FINISHED</state>
|
||||
+ <time>...</time>
|
||||
+</status>
|
||||
+
|
||||
+<errorcounts>
|
||||
+ <pair>
|
||||
+ <count>1</count>
|
||||
+ <unique>0x........</unique>
|
||||
+ </pair>
|
||||
+</errorcounts>
|
||||
+
|
||||
+
|
||||
+</valgrindoutput>
|
||||
+
|
||||
--
|
||||
2.47.0
|
||||
|
@ -0,0 +1,41 @@
|
||||
From 42f196574aebea451c7e4138b476e042ba302745 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Floyd <pjfloyd@wanadoo.fr>
|
||||
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
|
||||
|
@ -0,0 +1,358 @@
|
||||
From 3d72dd780be97bd19331403da60908f295712fc7 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Seiderer <ps.report@gmx.net>
|
||||
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 <ps.report@gmx.net>
|
||||
|
||||
(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 <ps.report@gmx.net>
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU General Public License as
|
||||
+ published by the Free Software Foundation; either version 2 of the
|
||||
+ License, or (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful, but
|
||||
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ The GNU General Public License is contained in the file COPYING.
|
||||
+*/
|
||||
+#ifndef __VKI_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
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 459fa5b82df0d07cf871fc7359a060410052b82e Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
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
|
||||
|
@ -0,0 +1,38 @@
|
||||
From c08e155fdf6641a569053b3a70c52bfae09dd34c Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
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
|
||||
|
@ -0,0 +1,34 @@
|
||||
From 53d667789d369042b1fe45f72102ecb5c16e5d12 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
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
|
||||
|
@ -0,0 +1,398 @@
|
||||
From 349b57d3a8c8d2df23128d4b03eca91b629629e1 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
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
|
||||
|
@ -1,123 +0,0 @@
|
||||
From e97f7a6cf2315908fb0a9b900f1de87a155c9df1 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
Date: Sun, 14 May 2023 23:34:05 +0200
|
||||
Subject: [PATCH] Add --with-gdbscripts-dir=PATH configure option
|
||||
|
||||
Currently the gdb valgrind scripts are installed under VG_LIBDIR
|
||||
which is normally pkglibexecdir which is likely not in the default
|
||||
gdb safe-path (a list of directories from which it is safe to
|
||||
auto-load files). So users will have to add the directory to their
|
||||
.gdbinit file.
|
||||
|
||||
This patch adds a --with-gdbscripts-dir=PATH configure option that
|
||||
sets VG_GDBSCRIPTS_DIR to the given PATH (${libexecdir}/valgrind if
|
||||
not given).
|
||||
|
||||
Use VG_GDBSCRIPTS_DIR as gdbscriptsdir to install the valgrind-monitor
|
||||
python files and pass it with CPPFLAGS when building vg_preloaded.c
|
||||
and vgdb.c to use instead of VG_LIBDIR.
|
||||
---
|
||||
configure.ac | 11 +++++++++++
|
||||
coregrind/Makefile.am | 15 ++++++++++-----
|
||||
coregrind/vg_preloaded.c | 2 +-
|
||||
coregrind/vgdb.c | 2 +-
|
||||
4 files changed, 23 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 15fbf5ea2..223ab4529 100755
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1198,6 +1198,17 @@ AC_MSG_RESULT([$xcodedir])
|
||||
AC_DEFINE_UNQUOTED(XCODE_DIR, "$xcodedir", [xcode sdk include directory])
|
||||
AC_SUBST(XCODE_DIR, [$xcodedir])])
|
||||
|
||||
+#----------------------------------------------------------------------------
|
||||
+# Where to install gdb scripts, defaults to VG_LIBDIR (pkglibexecdir)
|
||||
+#----------------------------------------------------------------------------
|
||||
+AC_MSG_CHECKING([where gdb scripts are installed])
|
||||
+AC_ARG_WITH(gdbscripts-dir,
|
||||
+ [ --with-gdbscripts-dir=PATH Specify path to install gdb scripts],
|
||||
+ [gdbscriptsdir=${withval}],
|
||||
+ [gdbscriptsdir=${libexecdir}/valgrind])
|
||||
+AC_MSG_RESULT([$gdbscriptsdir])
|
||||
+AC_SUBST(VG_GDBSCRIPTS_DIR, [$gdbscriptsdir])
|
||||
+
|
||||
#----------------------------------------------------------------------------
|
||||
# Libc and suppressions
|
||||
#----------------------------------------------------------------------------
|
||||
diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
|
||||
index 553211782..64d593b08 100644
|
||||
--- a/coregrind/Makefile.am
|
||||
+++ b/coregrind/Makefile.am
|
||||
@@ -101,7 +101,8 @@
|
||||
vgdb_SOURCES += vgdb-invoker-freebsd.c
|
||||
endif
|
||||
|
||||
-vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI)
|
||||
+vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) \
|
||||
+ -DVG_GDBSCRIPTS_DIR="\"@VG_GDBSCRIPTS_DIR@\""
|
||||
vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong
|
||||
vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI)
|
||||
vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ -Wl,-z,now
|
||||
@@ -626,7 +627,8 @@
|
||||
|
||||
vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_SOURCES = vg_preloaded.c
|
||||
vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CPPFLAGS = \
|
||||
- $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
|
||||
+ $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
|
||||
+ -DVG_GDBSCRIPTS_DIR="\"@VG_GDBSCRIPTS_DIR@\""
|
||||
vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CFLAGS = \
|
||||
$(AM_CFLAGS_PSO_@VGCONF_PLATFORM_PRI_CAPS@)
|
||||
vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
|
||||
@@ -634,7 +636,8 @@
|
||||
if VGCONF_HAVE_PLATFORM_SEC
|
||||
vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = vg_preloaded.c
|
||||
vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_CPPFLAGS = \
|
||||
- $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
|
||||
+ $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) \
|
||||
+ -DVG_GDBSCRIPTS_DIR="\"@VG_GDBSCRIPTS_DIR@\""
|
||||
vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_CFLAGS = \
|
||||
$(AM_CFLAGS_PSO_@VGCONF_PLATFORM_SEC_CAPS@)
|
||||
vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_LDFLAGS = \
|
||||
@@ -766,8 +769,10 @@
|
||||
# so as to make sure these get copied into the install tree
|
||||
vglibdir = $(pkglibexecdir)
|
||||
vglib_DATA = $(GDBSERVER_XML_FILES)
|
||||
-vglib_DATA += m_gdbserver/valgrind-monitor.py
|
||||
-vglib_DATA += m_gdbserver/valgrind-monitor-def.py
|
||||
+
|
||||
+gdbscriptsdir = @VG_GDBSCRIPTS_DIR@
|
||||
+gdbscripts_DATA = m_gdbserver/valgrind-monitor.py
|
||||
+gdbscripts_DATA += m_gdbserver/valgrind-monitor-def.py
|
||||
|
||||
# so as to make sure these get copied into the tarball
|
||||
EXTRA_DIST += $(GDBSERVER_XML_FILES)
|
||||
diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c
|
||||
index d6e05898c..bff76b81b 100644
|
||||
--- a/coregrind/vg_preloaded.c
|
||||
+++ b/coregrind/vg_preloaded.c
|
||||
@@ -61,7 +61,7 @@
|
||||
.popsection \n\
|
||||
");
|
||||
|
||||
-DEFINE_GDB_PY_SCRIPT(VG_LIBDIR "/valgrind-monitor.py")
|
||||
+DEFINE_GDB_PY_SCRIPT(VG_GDBSCRIPTS_DIR "/valgrind-monitor.py")
|
||||
#endif
|
||||
|
||||
#if defined(VGO_linux) || defined(VGO_solaris) || defined(VGO_freebsd)
|
||||
diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c
|
||||
index 8ec424077..a449b86e0 100644
|
||||
--- a/coregrind/vgdb.c
|
||||
+++ b/coregrind/vgdb.c
|
||||
@@ -1984,7 +1984,7 @@ void usage(void)
|
||||
" -h --help shows this message\n"
|
||||
" The GDB python code defining GDB front end valgrind commands is:\n %s\n"
|
||||
" To get help from the Valgrind gdbserver, use vgdb help\n"
|
||||
-"\n", vgdb_prefix_default(), VG_LIBDIR "/valgrind-monitor.py"
|
||||
+"\n", vgdb_prefix_default(), VG_GDBSCRIPTS_DIR "/valgrind-monitor.py"
|
||||
);
|
||||
invoker_restrictions_msg();
|
||||
}
|
||||
--
|
||||
2.40.0
|
||||
|
@ -1,12 +0,0 @@
|
||||
diff --git a/callgrind/callgrind_control.in b/callgrind/callgrind_control.in
|
||||
index 083ffa29f..eb50c16ad 100644
|
||||
--- a/callgrind/callgrind_control.in
|
||||
+++ b/callgrind/callgrind_control.in
|
||||
@@ -22,7 +22,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-use strict;
|
||||
use warnings;
|
||||
|
||||
use File::Basename;
|
@ -1,22 +0,0 @@
|
||||
diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c
|
||||
index b32f13f76..464e8d4ca 100644
|
||||
--- a/shared/vg_replace_strmem.c
|
||||
+++ b/shared/vg_replace_strmem.c
|
||||
@@ -1128,7 +1128,7 @@ static inline void my_exit ( int x )
|
||||
MEMMOVE_OR_MEMCPY(20181, soname, fnname, 0)
|
||||
|
||||
#define MEMCPY(soname, fnname) \
|
||||
- MEMMOVE_OR_MEMCPY(20180, soname, fnname, 1)
|
||||
+ MEMMOVE_OR_MEMCPY(20180, soname, fnname, 0) /* See KDE bug #402833 */
|
||||
|
||||
#if defined(VGO_linux)
|
||||
/* For older memcpy we have to use memmove-like semantics and skip
|
||||
@@ -1714,8 +1714,6 @@ static inline void my_exit ( int x )
|
||||
RECORD_COPY(len); \
|
||||
if (len == 0) \
|
||||
return dst; \
|
||||
- if (is_overlap(dst, src, len, len)) \
|
||||
- RECORD_OVERLAP_ERROR("memcpy_chk", dst, src, len); \
|
||||
if ( dst > src ) { \
|
||||
d = (HChar *)dst + len - 1; \
|
||||
s = (const HChar *)src + len - 1; \
|
@ -1,73 +0,0 @@
|
||||
From 56f1bd12c92806fd18337ba4cd3c0a8d714d0e94 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Arnez <arnez@linux.ibm.com>
|
||||
Date: Thu, 15 Jun 2023 17:24:53 +0200
|
||||
Subject: [PATCH] Bug 470978 - s390x: Link the tools with -Wl,--s390-pgste
|
||||
|
||||
Programs that require the PGSTE mode to be enabled may currently fail
|
||||
under Valgrind. In particular this affects qemu-kvm.
|
||||
|
||||
While it is also possible to enable the PGSTE mode globally with
|
||||
|
||||
sysctl vm.allocate_psgte=1
|
||||
|
||||
the problem can more easily be prevented by linking the Valgrind tools
|
||||
with -Wl,--s390-pgste. Add a configure check if the linker supports this,
|
||||
and activate the flag if it does.
|
||||
|
||||
To verify the intended result, the following shell command can be used to
|
||||
list the executables having this flag set:
|
||||
|
||||
find . -type f -perm -u+x -execdir \
|
||||
/bin/sh -c 'readelf -lW $0 2>/dev/null | grep PGSTE' {} \; -print
|
||||
---
|
||||
Makefile.tool.am | 2 +-
|
||||
configure.ac | 20 ++++++++++++++++++++
|
||||
2 files changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.tool.am b/Makefile.tool.am
|
||||
index df9502913..4ce6d5ab0 100644
|
||||
--- a/Makefile.tool.am
|
||||
+++ b/Makefile.tool.am
|
||||
@@ -78,7 +78,7 @@ TOOL_LDFLAGS_ARM64_LINUX = \
|
||||
$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
|
||||
|
||||
TOOL_LDFLAGS_S390X_LINUX = \
|
||||
- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
|
||||
+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ @FLAG_S390_PGSTE@
|
||||
|
||||
TOOL_LDFLAGS_X86_DARWIN = \
|
||||
$(TOOL_LDFLAGS_COMMON_DARWIN) -arch i386
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 0cf84a1c0..1d4164a7d 100755
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -3096,6 +3096,26 @@ AC_SUBST([FLAG_NO_BUILD_ID], [""])
|
||||
fi
|
||||
CFLAGS=$safe_CFLAGS
|
||||
|
||||
+# On s390x, if the linker supports -Wl,--s390-pgste, then we build the
|
||||
+# tools with that flag. This enables running programs that need it, such
|
||||
+# as qemu-kvm.
|
||||
+if test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX; then
|
||||
+AC_MSG_CHECKING([if the linker accepts -Wl,--s390-pgste])
|
||||
+safe_CFLAGS=$CFLAGS
|
||||
+CFLAGS="-Wl,--s390-pgste"
|
||||
+
|
||||
+AC_LINK_IFELSE(
|
||||
+[AC_LANG_PROGRAM([ ], [return 0;])],
|
||||
+[
|
||||
+ AC_SUBST([FLAG_S390_PGSTE], ["-Wl,--s390-pgste"])
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+], [
|
||||
+ AC_SUBST([FLAG_S390_PGSTE], [""])
|
||||
+ AC_MSG_RESULT([no])
|
||||
+])
|
||||
+CFLAGS=$safe_CFLAGS
|
||||
+fi
|
||||
+
|
||||
# does the ppc assembler support "mtocrf" et al?
|
||||
AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
|
||||
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,167 +0,0 @@
|
||||
From b904112d7084227f8d6fab322bc360a8a6240a51 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
Date: Thu, 1 Jun 2023 16:10:56 +0200
|
||||
Subject: [PATCH] memcheck: Handle Err_ReallocSizeZero in MC_(eq_Error)
|
||||
|
||||
When an realloc size zero error is emitted MC_(eq_Error) is called to
|
||||
see if the errors can be deduplicated. This crashed since
|
||||
Err_ReallocSizeZero wasn't handled. Handle it like Err_Free.
|
||||
|
||||
Also add a testcase for this case and test with both
|
||||
--realloc-zero-bytes-frees=yes and
|
||||
--realloc-zero-bytes-frees=no.
|
||||
Which will report a different number of errors.
|
||||
|
||||
https://bugs.kde.org/show_bug.cgi?id=470520
|
||||
---
|
||||
memcheck/mc_errors.c | 1 +
|
||||
memcheck/tests/Makefile.am | 7 +++++++
|
||||
memcheck/tests/realloc_size_zero_again.c | 15 +++++++++++++++
|
||||
.../realloc_size_zero_again_no.stderr.exp | 18 ++++++++++++++++++
|
||||
.../realloc_size_zero_again_no.stdout.exp | 0
|
||||
.../tests/realloc_size_zero_again_no.vgtest | 2 ++
|
||||
.../realloc_size_zero_again_yes.stderr.exp | 18 ++++++++++++++++++
|
||||
.../realloc_size_zero_again_yes.stdout.exp | 0
|
||||
.../tests/realloc_size_zero_again_yes.vgtest | 2 ++
|
||||
9 files changed, 63 insertions(+)
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again.c
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_no.stderr.exp
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_no.stdout.exp
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_no.vgtest
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_yes.stderr.exp
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_yes.stdout.exp
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_yes.vgtest
|
||||
|
||||
diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c
|
||||
index 00d6ec301..65210a220 100644
|
||||
--- a/memcheck/mc_errors.c
|
||||
+++ b/memcheck/mc_errors.c
|
||||
@@ -1041,6 +1041,7 @@ Bool MC_(eq_Error) ( VgRes res, const Error* e1, const Error* e2 )
|
||||
case Err_IllegalMempool:
|
||||
case Err_Overlap:
|
||||
case Err_Cond:
|
||||
+ case Err_ReallocSizeZero:
|
||||
return True;
|
||||
|
||||
case Err_FishyValue:
|
||||
diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am
|
||||
index 71c38acba..5a17fd35d 100644
|
||||
--- a/memcheck/tests/Makefile.am
|
||||
+++ b/memcheck/tests/Makefile.am
|
||||
@@ -291,8 +291,14 @@ EXTRA_DIST = \
|
||||
realloc_size_zero.vgtest \
|
||||
realloc_size_zero_yes.stderr.exp realloc_size_zero_yes.stdout.exp \
|
||||
realloc_size_zero_yes.vgtest \
|
||||
+ realloc_size_zero_again_yes.stderr.exp \
|
||||
+ realloc_size_zero_again_yes.stdout.exp \
|
||||
+ realloc_size_zero_again_yes.vgtest \
|
||||
realloc_size_zero_no.stderr.exp realloc_size_zero_no.stdout.exp \
|
||||
realloc_size_zero_no.vgtest \
|
||||
+ realloc_size_zero_again_no.stderr.exp \
|
||||
+ realloc_size_zero_again_no.stdout.exp \
|
||||
+ realloc_size_zero_again_no.vgtest \
|
||||
realloc_size_zero_off.stderr.exp realloc_size_zero_off.stdout.exp \
|
||||
realloc_size_zero_off.vgtest \
|
||||
realloc_size_zero_mismatch.stderr.exp \
|
||||
@@ -459,6 +465,7 @@ check_PROGRAMS = \
|
||||
posix_memalign \
|
||||
post-syscall \
|
||||
realloc_size_zero realloc_size_zero_mismatch \
|
||||
+ realloc_size_zero_again \
|
||||
realloc1 realloc2 realloc3 \
|
||||
recursive-merge \
|
||||
resvn_stack \
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again.c b/memcheck/tests/realloc_size_zero_again.c
|
||||
new file mode 100644
|
||||
index 000000000..782d4bde5
|
||||
--- /dev/null
|
||||
+++ b/memcheck/tests/realloc_size_zero_again.c
|
||||
@@ -0,0 +1,15 @@
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ char *p = malloc (1024);
|
||||
+ for (int i = 3; i >= 0; i--)
|
||||
+ for (int j = 0; j <= 3; j++)
|
||||
+ {
|
||||
+ char *q = realloc (p, i * j * 512);
|
||||
+ p = q;
|
||||
+ }
|
||||
+
|
||||
+ free (p);
|
||||
+}
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_no.stderr.exp b/memcheck/tests/realloc_size_zero_again_no.stderr.exp
|
||||
new file mode 100644
|
||||
index 000000000..b9c061d1a
|
||||
--- /dev/null
|
||||
+++ b/memcheck/tests/realloc_size_zero_again_no.stderr.exp
|
||||
@@ -0,0 +1,18 @@
|
||||
+realloc() with size 0
|
||||
+ at 0x........: realloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd
|
||||
+ at 0x........: malloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+
|
||||
+ERROR SUMMARY: 7 errors from 1 contexts (suppressed: 0 from 0)
|
||||
+
|
||||
+7 errors in context 1 of 1:
|
||||
+realloc() with size 0
|
||||
+ at 0x........: realloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd
|
||||
+ at 0x........: malloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+
|
||||
+ERROR SUMMARY: 7 errors from 1 contexts (suppressed: 0 from 0)
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_no.stdout.exp b/memcheck/tests/realloc_size_zero_again_no.stdout.exp
|
||||
new file mode 100644
|
||||
index 000000000..e69de29bb
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_no.vgtest b/memcheck/tests/realloc_size_zero_again_no.vgtest
|
||||
new file mode 100644
|
||||
index 000000000..f1757b6c1
|
||||
--- /dev/null
|
||||
+++ b/memcheck/tests/realloc_size_zero_again_no.vgtest
|
||||
@@ -0,0 +1,2 @@
|
||||
+prog: realloc_size_zero_again
|
||||
+vgopts: -q -s --realloc-zero-bytes-frees=no
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_yes.stderr.exp b/memcheck/tests/realloc_size_zero_again_yes.stderr.exp
|
||||
new file mode 100644
|
||||
index 000000000..d40aa2455
|
||||
--- /dev/null
|
||||
+++ b/memcheck/tests/realloc_size_zero_again_yes.stderr.exp
|
||||
@@ -0,0 +1,18 @@
|
||||
+realloc() with size 0
|
||||
+ at 0x........: realloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd
|
||||
+ at 0x........: malloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+
|
||||
+ERROR SUMMARY: 5 errors from 1 contexts (suppressed: 0 from 0)
|
||||
+
|
||||
+5 errors in context 1 of 1:
|
||||
+realloc() with size 0
|
||||
+ at 0x........: realloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd
|
||||
+ at 0x........: malloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+
|
||||
+ERROR SUMMARY: 5 errors from 1 contexts (suppressed: 0 from 0)
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_yes.stdout.exp b/memcheck/tests/realloc_size_zero_again_yes.stdout.exp
|
||||
new file mode 100644
|
||||
index 000000000..e69de29bb
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_yes.vgtest b/memcheck/tests/realloc_size_zero_again_yes.vgtest
|
||||
new file mode 100644
|
||||
index 000000000..215392ed6
|
||||
--- /dev/null
|
||||
+++ b/memcheck/tests/realloc_size_zero_again_yes.vgtest
|
||||
@@ -0,0 +1,2 @@
|
||||
+prog: realloc_size_zero_again
|
||||
+vgopts: -q -s --realloc-zero-bytes-frees=yes
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,105 +0,0 @@
|
||||
From 21f7a2af2805a02a144c81f12895c134f4a171a3 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Arnez <arnez@linux.ibm.com>
|
||||
Date: Mon, 22 May 2023 19:49:08 +0200
|
||||
Subject: [PATCH 2/2] Bug 470132 - s390x: Increase test coverage for VGM
|
||||
|
||||
Add more tests for the VGM instruction, to verify the fix for the VGM
|
||||
wrap-around case. Also test setting unused bits in the I2 and I3 fields,
|
||||
to check that Valgrind ignores them as it should.
|
||||
---
|
||||
none/tests/s390x/vec2.c | 44 ++++++++++++++++++++++++++++++++
|
||||
none/tests/s390x/vec2.stdout.exp | 20 +++++++++++++++
|
||||
2 files changed, 64 insertions(+)
|
||||
|
||||
diff --git a/none/tests/s390x/vec2.c b/none/tests/s390x/vec2.c
|
||||
index 73b04dee4..c473a2a9a 100644
|
||||
--- a/none/tests/s390x/vec2.c
|
||||
+++ b/none/tests/s390x/vec2.c
|
||||
@@ -301,6 +301,49 @@ static void test_all_fp_int_conversions()
|
||||
#undef TEST_EXEC
|
||||
#undef TEST_GENERATE
|
||||
|
||||
+/* -- Vector generate mask -- */
|
||||
+
|
||||
+#define TEST_GENERATE(insn, i2, i3, m4) \
|
||||
+ static void test_vgm_##i2##_##i3##_##m4(void) \
|
||||
+ { \
|
||||
+ ulong_v out = vec_ini; \
|
||||
+ __asm__("vgm %[out]," #i2 "," #i3 "," #m4 : [out] "+v"(out) : :); \
|
||||
+ printf("\t%016lx %016lx\n", out[0], out[1]); \
|
||||
+ }
|
||||
+
|
||||
+#define TEST_EXEC(insn, i2, i3, m4) \
|
||||
+ do { \
|
||||
+ puts(#insn " " #i2 "," #i3 "," #m4); \
|
||||
+ test_vgm_##i2##_##i3##_##m4(); \
|
||||
+ } while (0)
|
||||
+
|
||||
+#define INSNS \
|
||||
+ XTEST(vgmb, 2, 1, 0); \
|
||||
+ XTEST(vgmb, 0xf7, 0x30, 0); \
|
||||
+ XTEST(vgmb, 0, 0, 0); \
|
||||
+ XTEST(vgmh, 3, 2, 1); \
|
||||
+ XTEST(vgmh, 15, 15, 1); \
|
||||
+ XTEST(vgmf, 4, 3, 2); \
|
||||
+ XTEST(vgmf, 16, 17, 2); \
|
||||
+ XTEST(vgmg, 55, 63, 3); \
|
||||
+ XTEST(vgmg, 43, 55, 3); \
|
||||
+ XTEST(vgmg, 63, 2, 3);
|
||||
+
|
||||
+#define XTEST TEST_GENERATE
|
||||
+INSNS
|
||||
+#undef XTEST
|
||||
+
|
||||
+static void test_all_generate_mask()
|
||||
+{
|
||||
+#define XTEST TEST_EXEC
|
||||
+ INSNS
|
||||
+#undef XTEST
|
||||
+}
|
||||
+
|
||||
+#undef INSNS
|
||||
+#undef TEST_EXEC
|
||||
+#undef TEST_GENERATE
|
||||
+
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -310,5 +353,6 @@ int main()
|
||||
test_all_double_bitshifts();
|
||||
test_all_int_fp_conversions();
|
||||
test_all_fp_int_conversions();
|
||||
+ test_all_generate_mask();
|
||||
return 0;
|
||||
}
|
||||
diff --git a/none/tests/s390x/vec2.stdout.exp b/none/tests/s390x/vec2.stdout.exp
|
||||
index b32cbe1bc..2c9ac21c1 100644
|
||||
--- a/none/tests/s390x/vec2.stdout.exp
|
||||
+++ b/none/tests/s390x/vec2.stdout.exp
|
||||
@@ -166,3 +166,23 @@ vcsfp 0
|
||||
vcsfp 8
|
||||
00ffffff - - -
|
||||
00000004 - - -
|
||||
+vgmb 2,1,0
|
||||
+ ffffffffffffffff ffffffffffffffff
|
||||
+vgmb 0xf7,0x30,0
|
||||
+ 8181818181818181 8181818181818181
|
||||
+vgmb 0,0,0
|
||||
+ 8080808080808080 8080808080808080
|
||||
+vgmh 3,2,1
|
||||
+ ffffffffffffffff ffffffffffffffff
|
||||
+vgmh 15,15,1
|
||||
+ 0001000100010001 0001000100010001
|
||||
+vgmf 4,3,2
|
||||
+ ffffffffffffffff ffffffffffffffff
|
||||
+vgmf 16,17,2
|
||||
+ 0000c0000000c000 0000c0000000c000
|
||||
+vgmg 55,63,3
|
||||
+ 00000000000001ff 00000000000001ff
|
||||
+vgmg 43,55,3
|
||||
+ 00000000001fff00 00000000001fff00
|
||||
+vgmg 63,2,3
|
||||
+ e000000000000001 e000000000000001
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,99 +0,0 @@
|
||||
From 70ef4417837b690755feede0088331a28b102c65 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Arnez <arnez@linux.ibm.com>
|
||||
Date: Mon, 22 May 2023 18:57:35 +0200
|
||||
Subject: [PATCH 1/2] Bug 470132 - s390x: Fix the wrap-around case in VGM
|
||||
|
||||
Valgrind's implementation of VGM is incomplete:
|
||||
|
||||
* It doesn't support generating a wrap-around bit mask. Such a mask
|
||||
should result when the ending bit position is smaller than the starting
|
||||
bit position. Valgrind runs into an assertion failure instead.
|
||||
|
||||
* It doesn't ignore unused bits in the I2 and I3 fields of the
|
||||
instruction, as it should.
|
||||
|
||||
Fix this by re-implementing the main logic in s390_irgen_VGM().
|
||||
---
|
||||
VEX/priv/guest_s390_toIR.c | 57 +++++++++++++++-----------------------
|
||||
1 file changed, 22 insertions(+), 35 deletions(-)
|
||||
|
||||
diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c
|
||||
index 11dda41ef..d9d746c38 100644
|
||||
--- a/VEX/priv/guest_s390_toIR.c
|
||||
+++ b/VEX/priv/guest_s390_toIR.c
|
||||
@@ -16388,50 +16388,37 @@ s390_irgen_VGBM(UChar v1, UShort i2, UChar m3 __attribute__((unused)))
|
||||
static const HChar *
|
||||
s390_irgen_VGM(UChar v1, UShort i2, UChar m3)
|
||||
{
|
||||
- UChar from = (i2 & 0xff00) >> 8;
|
||||
- UChar to = (i2 & 0x00ff);
|
||||
- ULong value = 0UL;
|
||||
- IRType type = s390_vr_get_type(m3);
|
||||
- vassert(from <= to);
|
||||
-
|
||||
- UChar maxIndex = 0;
|
||||
- switch (type) {
|
||||
- case Ity_I8:
|
||||
- maxIndex = 7;
|
||||
- break;
|
||||
- case Ity_I16:
|
||||
- maxIndex = 15;
|
||||
- break;
|
||||
- case Ity_I32:
|
||||
- maxIndex = 31;
|
||||
- break;
|
||||
- case Ity_I64:
|
||||
- maxIndex = 63;
|
||||
- break;
|
||||
- default:
|
||||
- vpanic("s390_irgen_VGM: unknown type");
|
||||
- }
|
||||
-
|
||||
- for(UChar index = from; index <= to; index++) {
|
||||
- value |= (1ULL << (maxIndex - index));
|
||||
- }
|
||||
-
|
||||
- IRExpr *fillValue;
|
||||
- switch (type) {
|
||||
- case Ity_I8:
|
||||
+ s390_insn_assert("vgm", m3 <= 3);
|
||||
+
|
||||
+ UChar max_idx = (8 << m3) - 1;
|
||||
+ UChar from = max_idx & (i2 >> 8);
|
||||
+ UChar to = max_idx & i2;
|
||||
+ ULong all_one = (1ULL << max_idx << 1) - 1;
|
||||
+ ULong value = (all_one >> from) ^ (all_one >> to >> 1);
|
||||
+
|
||||
+ /* In case of wrap-around we now have a value that needs inverting:
|
||||
+ to from
|
||||
+ V V
|
||||
+ 00000111111111110000000000000000 */
|
||||
+ if (to < from)
|
||||
+ value ^= all_one;
|
||||
+
|
||||
+ IRExpr* fillValue;
|
||||
+ switch (m3) {
|
||||
+ case 0:
|
||||
fillValue = mkU8(value);
|
||||
break;
|
||||
- case Ity_I16:
|
||||
+ case 1:
|
||||
fillValue = mkU16(value);
|
||||
break;
|
||||
- case Ity_I32:
|
||||
+ case 2:
|
||||
fillValue = mkU32(value);
|
||||
break;
|
||||
- case Ity_I64:
|
||||
+ case 3:
|
||||
fillValue = mkU64(value);
|
||||
break;
|
||||
default:
|
||||
- vpanic("s390_irgen_VGM: unknown type");
|
||||
+ vpanic("s390_irgen_VGM: unknown element size");
|
||||
}
|
||||
|
||||
s390_vr_fill(v1, fillValue);
|
||||
--
|
||||
2.40.1
|
||||
|
Loading…
Reference in new issue