diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml
index 222c2268b6..3dee317db9 100644
--- a/.github/workflows/codspeed.yml
+++ b/.github/workflows/codspeed.yml
@@ -91,6 +91,7 @@ jobs:
- name: Run the benchmarks
uses: CodSpeedHQ/action@main
+ continue-on-error: ${{ matrix.valgrind != 'local' }}
env:
CODSPEED_PERF_ENABLED: false
with:
diff --git a/.gitignore b/.gitignore
index e5f9dea671..ea71bb0aa3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -180,6 +180,7 @@
/coregrind/valgrind
/coregrind/vgdb
/coregrind/vgpreload_core-x86-darwin.so.dSYM
+/coregrind/vgstack
/coregrind/vg_intercept.c
/coregrind/vg_replace_malloc.c
/coregrind/vg_toolint.c
@@ -944,6 +945,7 @@
/memcheck/tests/Makefile
/memcheck/tests/Makefile.in
/memcheck/tests/mallinfo
+/memcheck/tests/mallinfo2
/memcheck/tests/malloc1
/memcheck/tests/malloc2
/memcheck/tests/malloc3
@@ -1102,11 +1104,12 @@
/memcheck/tests/amd64-linux/defcfaexpr
/memcheck/tests/amd64-linux/int3-amd64
/memcheck/tests/amd64-linux/reallocarray
+/memcheck/tests/amd64-linux/scalar
/memcheck/tests/amd64-linux/Makefile
/memcheck/tests/amd64-linux/Makefile.in
# /memcheck/tests/amd64-solaris/
-/memcheck/tests/amd64-solaris/*.stderr.diff
+/memcheck/tests/amd64-solaris/*.stderr.diff*
/memcheck/tests/amd64-solaris/*.stderr.out
/memcheck/tests/amd64-solaris/*.stdout.diff
/memcheck/tests/amd64-solaris/*.stdout.out
@@ -1176,7 +1179,7 @@
/memcheck/tests/darwin/scalar_vfork
# /memcheck/tests/linux/
-/memcheck/tests/linux/*.stderr.diff
+/memcheck/tests/linux/*.stderr.diff*
/memcheck/tests/linux/*.stderr.out
/memcheck/tests/linux/*.stdout.diff
/memcheck/tests/linux/*.stdout.out
@@ -1269,13 +1272,14 @@
/memcheck/tests/s390x/cu42
/memcheck/tests/s390x/ltgjhe
/memcheck/tests/s390x/tmxx
+/memcheck/tests/s390x/vme
/memcheck/tests/s390x/vstrc
/memcheck/tests/s390x/vfae
/memcheck/tests/s390x/vistr
/memcheck/tests/s390x/vstrs
# /memcheck/tests/solaris/
-/memcheck/tests/solaris/*.stderr.diff
+/memcheck/tests/solaris/*.stderr.diff*
/memcheck/tests/solaris/*.stderr.out
/memcheck/tests/solaris/*.stdout.diff
/memcheck/tests/solaris/*.stdout.out
@@ -1393,7 +1397,7 @@
/memcheck/tests/x86-linux/shm
# /memcheck/tests/x86-solaris/
-/memcheck/tests/x86-solaris/*.stderr.diff
+/memcheck/tests/x86-solaris/*.stderr.diff*
/memcheck/tests/x86-solaris/*.stderr.out
/memcheck/tests/x86-solaris/*.stdout.diff
/memcheck/tests/x86-solaris/*.stdout.out
@@ -1435,7 +1439,9 @@
/memcheck/tests/freebsd/eventfd1
/memcheck/tests/freebsd/eventfd2
/memcheck/tests/freebsd/extattr
+/memcheck/tests/freebsd/exterrctl
/memcheck/tests/freebsd/fbsd278566
+/memcheck/tests/freebsd/fchroot
/memcheck/tests/freebsd/fexecve
/memcheck/tests/freebsd/file_locking_wait6
/memcheck/tests/freebsd/get_set_context
@@ -1445,6 +1451,7 @@
/memcheck/tests/freebsd/getrlimitusage
/memcheck/tests/freebsd/inlinfo
/memcheck/tests/freebsd/inlinfo_nested.so
+/memcheck/tests/freebsd/kenv
/memcheck/tests/freebsd/kqueue
/memcheck/tests/freebsd/kqueuex
/memcheck/tests/freebsd/linkat
@@ -1462,6 +1469,7 @@
/memcheck/tests/freebsd/scalar_vfork
/memcheck/tests/freebsd/sctp
/memcheck/tests/freebsd/sctp2
+/memcheck/tests/freebsd/setcred
/memcheck/tests/freebsd/setproctitle
/memcheck/tests/freebsd/sigwait
/memcheck/tests/freebsd/stat
@@ -1486,6 +1494,7 @@
/memcheck/tests/amd64-freebsd/posix_fallocate
/memcheck/tests/amd64-freebsd/reallocarray
/memcheck/tests/amd64-freebsd/reallocf
+/memcheck/tests/amd64-freebsd/scalar_arg_check
# /memcheck/tests/x86-freebsd
/memcheck/tests/x86-freebsd/*.stderr.diff
@@ -1498,6 +1507,17 @@
/memcheck/tests/x86-freebsd/posix_fadvise
/memcheck/tests/x86-freebsd/posix_fallocate
/memcheck/tests/x86-freebsd/reallocarray
+/memcheck/tests/x86-freebsd/scalar_arg_check
+
+# /memcheck/tests/arm64-freebsd
+/memcheck/tests/arm64-freebsd/*.stderr.diff
+/memcheck/tests/arm64-freebsd/*.stderr.out
+/memcheck/tests/arm64-freebsd/*.stdout.diff
+/memcheck/tests/arm64-freebsd/*.stdout.out
+/memcheck/tests/arm64-freebsd/.deps
+/memcheck/tests/arm64-freebsd/Makefile
+/memcheck/tests/arm64-freebsd/Makefile.in
+/memcheck/tests/arm64-freebsd/scalar_arg_check
# /mpi/
/mpi/*.dSYM
@@ -1569,6 +1589,7 @@
/none/tests/fdbaduse
/none/tests/fdleak_cmsg
/none/tests/fdleak_creat
+/none/tests/fdleak_doubleclose0
/none/tests/fdleak_dup
/none/tests/fdleak_dup2
/none/tests/fdleak_fcntl
@@ -1673,6 +1694,8 @@
/none/tests/tls
/none/tests/track-fds-exec-children
/none/tests/track_new
+/none/tests/track_std
+/none/tests/track_bad
/none/tests/unit_debuglog
/none/tests/use_after_close
/none/tests/valgrind_cpp_test
@@ -1680,6 +1703,7 @@
/none/tests/vgprintf
/none/tests/vgprintf_nvalgrind
/none/tests/yield
+/none/tests/getdents_filter
# /none/tests/amd64/
/none/tests/amd64/*.dSYM
@@ -1788,11 +1812,11 @@
/none/tests/amd64-linux/map_32bits
# /none/tests/amd64-solaris/
-/none/tests/amd64-solaris/*.stderr.diff
+/none/tests/amd64-solaris/*.stderr.diff*
/none/tests/amd64-solaris/*.stderr.out
/none/tests/amd64-solaris/*.stdout.diff
/none/tests/amd64-solaris/*.stdout.out
-/none/tests/amd64-solaris/*.post.diff
+/none/tests/amd64-solaris/*.post.diff*
/none/tests/amd64-solaris/*.post.out
/none/tests/amd64-solaris/.deps
/none/tests/amd64-solaris/Makefile
@@ -1880,6 +1904,7 @@
/none/tests/linux/brk-overflow1
/none/tests/linux/brk-overflow2
/none/tests/linux/bug498317
+/none/tests/linux/bug506910
/none/tests/linux/clonev
/none/tests/linux/Makefile
/none/tests/linux/Makefile.in
@@ -1890,8 +1915,10 @@
/none/tests/linux/mremap4
/none/tests/linux/mremap5
/none/tests/linux/mremap6
+/none/tests/linux/open_client
/none/tests/linux/pthread-stack
/none/tests/linux/stack-overflow
+/none/tests/linux/getdents_filter
# /none/tests/mips32/
/none/tests/mips32/Makefile
@@ -2114,7 +2141,7 @@
/none/tests/s390x/sub
/none/tests/s390x/sub-z14
/none/tests/s390x/sub_EI
-/none/tests/s390x/tcxb
+/none/tests/s390x/hfp
/none/tests/s390x/xc
/none/tests/s390x/xor
/none/tests/s390x/xor_EI
@@ -2122,7 +2149,6 @@
/none/tests/s390x/stcke
/none/tests/s390x/stckf
/none/tests/s390x/op_exception
-/none/tests/s390x/fgx
/none/tests/s390x/condloadstore
/none/tests/s390x/fold_And16
/none/tests/s390x/stfle
@@ -2159,20 +2185,16 @@
/none/tests/s390x/cu14_1
/none/tests/s390x/cu41
/none/tests/s390x/ecag
-/none/tests/s390x/fpext
/none/tests/s390x/fpext_warn
-/none/tests/s390x/fpconv
-/none/tests/s390x/rounding-1
-/none/tests/s390x/rounding-2
-/none/tests/s390x/rounding-3
-/none/tests/s390x/rounding-4
-/none/tests/s390x/rounding-5
-/none/tests/s390x/bfp-1
-/none/tests/s390x/bfp-2
-/none/tests/s390x/bfp-3
-/none/tests/s390x/bfp-4
-/none/tests/s390x/srnm
-/none/tests/s390x/srnmb
+/none/tests/s390x/fpext_fail
+/none/tests/s390x/bfp-306054
+/none/tests/s390x/bfp-arith
+/none/tests/s390x/bfp-load
+/none/tests/s390x/bfp-fpc
+/none/tests/s390x/bfp-tdc
+/none/tests/s390x/bfp-muldiv
+/none/tests/s390x/bfp-compare
+/none/tests/s390x/bfp-convert
/none/tests/s390x/comp-1
/none/tests/s390x/comp-2
/none/tests/s390x/ex
@@ -2197,7 +2219,6 @@
/none/tests/s390x/spechelper-slgr
/none/tests/s390x/spechelper-or
/none/tests/s390x/spechelper-tm
-/none/tests/s390x/rounding-6
/none/tests/s390x/laa
/none/tests/s390x/dfp-1
/none/tests/s390x/dfp-2
@@ -2209,7 +2230,6 @@
/none/tests/s390x/srnmt
/none/tests/s390x/pfpo
/none/tests/s390x/rxsbg
-/none/tests/s390x/fixbr
/none/tests/s390x/popcnt
/none/tests/s390x/vector
/none/tests/s390x/lsc2
@@ -2240,6 +2260,18 @@
/none/tests/riscv64/integer
/none/tests/riscv64/muldiv
+# /none/tests/iropt-test/
+/none/tests/iropt-test/*.dSYM
+/none/tests/iropt-test/*.stderr.diff*
+/none/tests/iropt-test/*.stderr.out
+/none/tests/iropt-test/*.stdout.diff*
+/none/tests/iropt-test/*.stdout.out
+/none/tests/iropt-test/.deps
+/none/tests/iropt-test/Makefile
+/none/tests/iropt-test/Makefile.in
+/none/tests/iropt-test/iropt-test
+/none/tests/iropt-test/iropt-test-sec
+
# /none/tests/s390x/disasm-test/
/none/tests/s390x/disasm-test/*.dSYM
/none/tests/s390x/disasm-test/*.stderr.diff*
@@ -2308,9 +2340,12 @@
/none/tests/freebsd/bug498317
none/tests/freebsd/bug499212
/none/tests/freebsd/osrel
+/none/tests/freebsd/readlinkat
+/none/tests/freebsd/readlinkat2
/none/tests/freebsd/swapcontext
/none/tests/freebsd/fexecve
/none/tests/freebsd/hello_world
+/none/tests/freebsd/open_client
/none/tests/freebsd/proc_pid_file
/none/tests/freebsd/sanity_level_thread
/none/tests/freebsd/usrstack
@@ -2417,11 +2452,11 @@ none/tests/freebsd/bug499212
/none/tests/x86-linux/sigcontext
# /none/tests/x86-solaris/
-/none/tests/x86-solaris/*.stderr.diff
+/none/tests/x86-solaris/*.stderr.diff*
/none/tests/x86-solaris/*.stderr.out
/none/tests/x86-solaris/*.stdout.diff
/none/tests/x86-solaris/*.stdout.out
-/none/tests/x86-solaris/*.post.diff
+/none/tests/x86-solaris/*.post.diff*
/none/tests/x86-solaris/*.post.out
/none/tests/x86-solaris/.deps
/none/tests/x86-solaris/Makefile
@@ -2439,7 +2474,7 @@ none/tests/freebsd/bug499212
/none/tests/x86-freebsd/.deps
/none/tests/x86-freebsd/Makefile
/none/tests/x86-freebsd/Makefile.in
-/none/tests/x86-freebsd/445032
+/none/tests/x86-freebsd/bug445032
# /perf/
/perf/*.dSYM
@@ -2508,6 +2543,9 @@ none/tests/freebsd/bug499212
# /VEX/switchback/
/VEX/switchback/switchback
+# /VEX/useful/
+/VEX/useful/vex
+
*.vgtest*.trs
*.vgtest*.log
/test-suite-overall.log
diff --git a/COPYING b/COPYING
index d159169d10..f288702d2f 100644
--- a/COPYING
+++ b/COPYING
@@ -1,281 +1,622 @@
GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ Version 3, 29 June 2007
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
this License.
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
@@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
+state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -303,37 +644,31 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- , 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/Makefile.all.am b/Makefile.all.am
old mode 100755
new mode 100644
diff --git a/Makefile.am b/Makefile.am
index e67356b5a0..6c5b9f5b63 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,7 +33,7 @@ SUBDIRS = \
perf \
gdbserver_tests \
memcheck/tests/vbit-test \
- none/tests/s390x/disasm-test \
+ none/tests/iropt-test \
auxprogs \
mpi \
solaris \
diff --git a/NEWS b/NEWS
index 741329a681..ce6cc7130f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,23 +1,221 @@
-Release 3.25.1 (20 May 2025)
+Release 3.26.0 (24 Oct 2025)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-This point release contains only bug fixes.
+This release supports X86/Linux, AMD64/Linux, ARM32/Linux, ARM64/Linux,
+PPC32/Linux, PPC64BE/Linux, PPC64LE/Linux, S390X/Linux, MIPS32/Linux,
+MIPS64/Linux, RISCV64/Linux, ARM/Android, ARM64/Android, MIPS32/Android,
+X86/Android, X86/Solaris, AMD64/Solaris, AMD64/MacOSX 10.12, X86/FreeBSD,
+AMD64/FreeBSD and ARM64/FreeBSD There is also preliminary support for
+X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux.
+
+* ==================== CORE CHANGES ===================
+
+* Upgrade to the GNU General Public License version 3.
+
+* Control building documentation. When using make dist set the
+ Makefile BUILD_DOCS to none, all or html. none, does not build any
+ documentation. all, builds all documentation. html, builds HTML
+ docs but skips building PDFs. See also README_DEVELOPERS.
+
+* New VEX API function LibVEX_set_VexControl
+
+* The deprecated IROps: Iop_Clz32/64 and Iop_Ctz32/64 have been removed
+
+* The Linux Test Project (LTP) integration has been updated to
+ v20250930. The test output has been made compatible with bunsen.
+ Various issues with the linux syscall wrappers have been fixed.
+
+ New Linux syscall wrappers for: cachestat, futex_waitv, listmount,
+ mount_setattr, mseal, quotactl_fd, remap_file_pages, setdomainname,
+ statmount, swapoff, swapon, sysfs and ustat.
+
+* --modify-fds=yes has been added. It acts like --modify-fds=high (the
+ highest available file descriptor is returned first) except when
+ when the lowers stdin/stdout/stderr (file descriptors 0, 1, 2) are
+ available. With --modify-fds=yes 0, 1 or 2 are always returned first
+ when still available before higher file descriptor numbers are.
+
+* With --xml=yes log output protocol 6 is now always used (unlike
+ protocol 5 which was only used with--track-fds). The main difference
+ is that the xml output now contains error summaries. See also
+ xml-output-protocol6.txt.
+
+* Add "bad" option for --track-fds. When --track-fds=bad is specified,
+ do not produce errors about unclosed file descriptors at program
+ exit. Only produce errors for bad file descriptor usage, either
+ double close or use of file descriptor that is (no longer) valid.
+
+* vgdb will now handle the qExecAndArgs packet.
+
+* DWARF inlined subroutine handling has been rewritten to work cross
+ compile units. This should get rid of backtraces with
+ "UnknownInlinedFun".
+
+* ================== PLATFORM CHANGES =================
+
+FreeBSD 15 (which is expected to ship in December 2025, after
+Valgrind 3.26 is released) contains a change to ptrace that affects
+use of Valgrind with vgdb. This impacts the mechanism that vgdb
+uses to interrupt Valgrind if all threads are blocked and you want
+to get back to the gdb prompt by hitting ctrl-c. This mechanism
+is no longer reliable. On arm64 Valgrind will crash with an assert.
+On amd64 syscalls may give spurious and incorrect return codes.
+
+There is a workaround. Run the following command (as root).
+
+ sysctl debug.ptrace_attach_transparent=0
+
+ See also
+ https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290008
+
+* ==================== TOOL CHANGES ===================
+
+* There is a new utility script, "vgstack". It has two
+ option, -h for minimal help, and -v for the version information.
+ In normal use pass it the PID of a running Valgrind process
+ and it will perform a vgdb attach and print the backtrace(s)
+ of the guest executable.
+
+* Memcheck handling of aligned allocation functions with a
+ size of zero has changed.
+
+ Firstly, 'free_aligned_sized' with a size of
+ zero is no longer considered an error. This was intended so
+ that deallocation had the same behaviour as allocation. In
+ practice, platforms that allow aligned allocation with a
+ size of zero will already generate an error at allocation.
+ Other platforms will get an 'Invalid free' error. The case
+ where the allocation and deallocation sizes are different
+ with the deallocation size being zero is already covered by
+ "Mismatched [alloc/dealloc] size" errors.
+
+ Secondly, the three C aligned allocation functions memalign,
+ aligned_alloc and posix_memalign have a different error
+ message if used with a size of zero. Previously the error
+ was "[function] invalid size value: [number]". This was an
+ overstatement of the issue. The problem is that such usage
+ is not portable across platforms. memalign and aligned_alloc
+ are poorly documented, saying things like "Behavior is undefined
+ if size is not an integral multiple of alignment.". Clearly
+ this does not include negative integers though it does not say
+ so explicitly. Does that include zero? posix_memalign is well documented
+ but says that using a size of 0 is implementation-defined. These
+ functions now produce an error
+ "Unsafe allocation with size of zero is implementation-defined".
+
+ The associated suppression name has also changed from "BadSize" to
+ "UnsafeZeroSize".
+
+ Checks for C23 free_sized and free_aligned_sized have been added to
+ Linux. Almost no libraries support these functions yet, with
+ the exception being Google tcmalloc.
* ==================== FIXED BUGS ====================
-The following bugs have been fixed or resolved in this point release.
+The following bugs have been fixed or resolved. Note that "n-i-bz"
+stands for "not in bugzilla" -- that is, a bug that was reported to us
+but never got a bugzilla entry. We encourage you to file bugs in
+bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather
+than mailing the developers (or mailing lists) directly -- bugs that
+are not entered into bugzilla tend to get forgotten about or ignored.
+286849 [PATCH] Interceptors for new/delete on Darwin were erroneously
+ commented out in r12043
+306098 s390x: Alternate opcode form for convert to/from fixed and friends
+309100 s390x: Testcases for extended BFP
+309554 Wrap syscall remap_file_pages (216)
+331311 Valgrind shows open files in /proc/self/fd that don't work for the process
+338803 Handling of dwz debug alt files or cross-CU is broken
+368791 Handle swapon and swapoff syscalls as linux generic
+369030 Wrap linux syscall: 171 (setdomainname)
+388526 Inconsistent severity in message text: "WARNING: Serious error"
+418756 MAP_FIXED_NOREPLACE mmap flag unsupported
+454276 Some IPC syscalls is missing for x86 linux
+476465 AArch64 ARMv8.3 LDAPR/LDAPRH/LDAPRB instructions not supported
+493430 Review all syscalls that use or return (new) file descriptors
+493434 Add --track-fds=bad mode (no "leak" tracking)
+501741 syscall cachestat not wrapped
+502359 Add --modify-fds=yes option
+502968 Wrap linux specific syscalls 457 (listmount) and 458 (statmount)
503098 Incorrect NAN-boxing for float registers in RISC-V
+503241 s390x: Support z17 changes to the NNPA instruction
503641 close_range syscalls started failing with 3.25.0
+503677 duplicated-cond compiler warning in dis_RV64M
+503817 s390x: fix 'ordered comparison of pointer with integer zero' compiler warnings
503914 mount syscall param filesystemtype may be NULL
+503969 Make test results of make ltpchecks compatible with bunsen
+504101 Add a "vgstack" script
504177 FILE DESCRIPTORS banner shows when closing some inherited fds
504265 FreeBSD: missing syscall wrappers for fchroot and setcred
+504341 Valgrind killed by LTP syscall testcase setrlimit05
504466 Double close causes SEGV
+504904 Hide "bad act handler address" warnings when -q (quiet) flag is set
+504909 Hide "Bad oldset address" warnings when -q (quiet) flag is set
+504919 Hide "client tried to modify addresses" warnings when -q (quiet) set
+504936 Add FreeBSD amd64 sysarch subcommands AMD64_SET_TLSBASE and
+ AMD64_GET_TLSBASE
+505228 Wrap linux specific mseal syscall
+505673 Valgrind crashes with an internal error and SIGBUS when
+ the guest tries to open its own file with O_WRONLY|O_CREAT|O_TRUNC
+506076 unimplemented fcntl command: 1028 (F_CREATED_QUERY)
+506499 Unhandled syscall 592 (exterrctl - FreeBSD
+506795 Better report which clone flags are problematic
+506806 Fix execveat() with AT_FDCWD and relative path
+506813 The execveat wrapper needs to do more checking
+506816 futex2, futex_waitv WARNING: unhandled amd64-linux syscall: 449
+506910 openat2 with RESOLVE_NO_MAGICLINKS succeeds on /proc/self/exe
+506928 Wrap (deprecated) linux specific ustat syscall
+506929 Wrap (deprecated) linux sysfs syscall
+506930 valgrind allows SIGKILL being reset to SIG_DFL
+506967 Implement and override mallinfo2
+506970 mmap needs an EBADF fd_allowed check
+507033 Remove deprecated Iop_Clz32/64 and Iop_Ctz32/64
+507173 s390x: Crash when constant folding is disabled
+507188 memcheck with track-fds=yes on x86 with popen: Assertion
+507720 Review syscalls returning file descriptors (other platforms)
+507721 Wire up illumos and Solaris mallinfo
+507853 faccessat and faccessat2 should handle AT_FDCWD and absolute paths
+507866 fanotify_mark dirfd isn't checked
+507867 perf_event_open group_fd isn't checked
+507868 futimesat doesn't handle AT_FDCWD
+507869 Various at syscalls don't check dirfd argument
+507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD
+507897 Allow for patching LTP sources
+507970 -Wcalloc-transposed-args warnings in valgrind-di-server.c
+508027 Fix mips32 FTBFS
+508029 Review the vmsplice syscall wrapper
+508030 Add several missing syscall hooks to ppc64-linux
+508093 VALGRIND_CLO_CHANGE does not update vex_control
+508145 ppc64le needs ld.so hardwire for strcmp
+508154 PRE(sys_fchownat) not handling VKI_AT_FDCWD
+508638 Self-hosting not working on FreeBSD
+508777 amd64-linux: add minimal scalar test
+508778 syscall-wrapper waitid warns about infop=null
+508779 PRE(sys_prlimit64): reorder check for memory validity
+508869 x86-linux: simplify scalar test output
+508958 FreeBSD: add getgroups and setgroups wrappers
+509103 Fix tests/arm64/bug484935.c build with "-O2 -flto -ffat-lto-objects"
+509107 memcheck/tests/duplicate_align_size_errors.cpp fails
+509139 Update BadSize error messages
+509258 FreeBSD: add jail_attach_jd and jail_remove_jd syscall wrappers
+509406 FreeBSD 15 issues
+509517 s390x: Even/odd lane confusion in various vector insns
+509566 Wrap amd64-linux syscall: 442 (mount_setattr)
+509572 s390x: Overhaul BFP testsuite
+509590 Run the LTP tests with LTP_QUIET
+509567 unhandled amd64-linux syscall: 443 (quotactl_fd)
+509642 Add missing ppc64-linux syswraps
+509643 Add missing s390x-linux syswraps
+510169 Update the LTP version in valgrind testsuite to 20250930
+510292 Silence false positive failure of LTP munmap01
+510436 Don't warn about fcntl F_GETFD with --track-fds
+510694 Handle qExecAndArgs remote protocol packet
To see details of a given bug, visit
https://bugs.kde.org/show_bug.cgi?id=XXXXXX
where XXXXXX is the bug number as listed above.
+(3.26.0.RC1: 17 Oct 2025)
Release 3.25.0 (25 Apr 2025)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -466,7 +664,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
471311 gdb --multi mode stdout redirecting to stderr
471807 Add support for lazy reading and downloading of DWARF debuginfo
472219 Syscall param ppoll(ufds.events) points to uninitialised byte(s)
-472875 none/tests/s390x/dfp-1 failure
+472875 none/tests/s390x/dfp-1 failure
472963 Broken regular expression in configure.ac
473604 Fix bug472219.c compile failure with Clang 16
473677 make check compile failure with Clang 16 based on GCC 13.x
@@ -656,7 +854,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
444568 drd/tests/pth_barrier_thr_cr fails on Fedora 38
445743 "The impossible happened: mutex is locked simultaneously by two threads"
while using mutexes with priority inheritance and signals
-449309 Missing loopback device ioctl(s)
+449309 Missing loopback device ioctl(s)
459476 vgdb: allow address reuse to avoid "address already in use" errorsuse" errors
460356 s390: Sqrt32Fx4 -- cannot reduce tree
462830 WARNING: unhandled amd64-freebsd syscall: 474
@@ -733,7 +931,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
453055 shared_timed_mutex drd test fails with "Lock shared failed" message
453602 Missing command line option to enable/disable debuginfod
452802 Handle lld 9+ split RW PT_LOAD segments correctly
-454040 s390x: False-positive memcheck:cond in memmem on arch13 systems
+454040 s390x: False-positive memcheck:cond in memmem on arch13 systems
456171 [PATCH] FreeBSD: Don't record address errors when accessing the 'kern.ps_strings' sysctl struct
n-i-bz Implement vgdb invoker on FreeBSD
458845 PowerPC: The L field for the dcbf and sync instruction should be
@@ -852,6 +1050,10 @@ are not entered into bugzilla tend to get forgotten about or ignored.
451626 Syscall param bpf(attr->raw_tracepoint.name) points to unaddressable byte(s)
451827 [ppc64le] VEX temporary storage exhausted with several vbpermq instructions
451843 valgrind fails to start on a FreeBSD system which enforces W^X
+495483 Control building documentation via BUILD_DOCS
+506211 Constant folding improvements
+506453 Unexpected behaviour with IR injection and vex-guest-chase=yes
+509157 riscv64: Shift instructions can behave wrong
To see details of a given bug, visit
https://bugs.kde.org/show_bug.cgi?id=XXXXXX
diff --git a/README b/README
index eabcc6ad88..62fc01debb 100644
--- a/README
+++ b/README
@@ -51,11 +51,11 @@ Note that AMD64 is just another name for x86_64, and Valgrind runs fine
on Intel processors. Also note that the core of macOS is called
"Darwin" and this name is used sometimes.
-Valgrind is licensed under the GNU General Public License, version 2.
+Valgrind is licensed under the GNU General Public License, version 3.
Read the file COPYING in the source distribution for details.
However: if you contribute code, you need to make it available as GPL
-version 2 or later, and not 2-only.
+version 3 or later, and not 3-only.
Documentation
diff --git a/README.freebsd b/README.freebsd
index 799543fe3d..ef850513ee 100644
--- a/README.freebsd
+++ b/README.freebsd
@@ -186,6 +186,50 @@ git history. You can also look at
https://docs.freebsd.org/en/books/porters-handbook/versions/
+Capsicum enabled applications
+-----------------------------
+Valgrind will not work well with Capsicum enabled applications. As an example,
+if you run
+
+valgrind --tool=massif echo hello
+
+you will get something like this in the output:
+
+==66088==
+==66088== WARNING: Valgrind may not operate correctly in capability mode.
+==66088== Please consider disabling capability by using the RUNNING_ON_VALGRIND mechanism.
+==66088== See http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq
+hello
+==66088==
+==66088== Error: can not open xtree output file `/home/paulf/massif.out.66088'
+
+Additionally capabilities mode can affect how the kernel uses syscall
+parameters. An example of this is the fd argument of the *at() syscall
+family. In capability mode fd must not be AT_FDCWD. The consequence
+of this is that we ought do adapt the syscall parameter checking depending
+on whether the guest is running in capability mode or not. Since we do not
+recommend running Capsicum enabled applications under Valgrind the checks
+are not adapted to to capability mode. Not to mention that adding checks
+for this would add a lot of complexity to these syscall wrappers
+
+One way that you might conditionally disable capabilities in your code as the
+above warning suggests is to do as follows.
+
+#if !defined(NDEBUG)
+#include
+#endif
+
+void do_capsicum_setup(void); // contains capabilities code
+
+#if !defined(NDEBUG)
+ if (!RUNNING_ON_VALGRIND)
+ {
+#endif
+ do_capsicum_setup();
+#if !defined(NDEBUG)
+ }
+#endif
+
Feedback
~~~~~~~~
diff --git a/README.s390 b/README.s390
index 528eafc5cc..d2236d29fa 100644
--- a/README.s390
+++ b/README.s390
@@ -42,6 +42,6 @@ Reading Material
(1) ELF ABI s390x Supplement
https://github.com/IBM/s390x-abi/releases
(2) z/Architecture Principles of Operation
- https://publibfp.dhe.ibm.com/epubs/pdf/a227832d.pdf
+ https://www.ibm.com/docs/en/module_1678991624569/pdf/SA22-7832-14.pdf
(3) Collection of z/Architecture publications
https://linux.mainframe.blog/zarchitecture-principles-of-operation/
diff --git a/README_DEVELOPERS b/README_DEVELOPERS
index 0be02b7dae..5d9fb823f9 100644
--- a/README_DEVELOPERS
+++ b/README_DEVELOPERS
@@ -37,7 +37,7 @@ will also attempt to build the documentation.
If you only want to test whether the generated tarball is complete and runs
regression tests successfully, building documentation is not needed.
- make dist BUILD_ALL_DOCS=no
+ make dist BUILD_DOCS=none
If you insist on building documentation some embarrassing instructions
can be found in docs/README.
@@ -53,15 +53,15 @@ To build and run all the regression tests, run "make [--quiet] regtest".
To run a subset of the regression tests, execute:
- perl tests/vg_regtest
+ tests/vg_regtest
where is a directory (all tests within will be run) or a single
.vgtest test file, or the name of a program which has a like-named .vgtest
file. Eg:
- perl tests/vg_regtest memcheck
- perl tests/vg_regtest memcheck/tests/badfree.vgtest
- perl tests/vg_regtest memcheck/tests/badfree
+ tests/vg_regtest memcheck
+ tests/vg_regtest memcheck/tests/badfree.vgtest
+ tests/vg_regtest memcheck/tests/badfree
The details of each vgtest run are logged to individual "vgtest.log"
files. These are listed, and non-passing tests detailed, in the
@@ -70,28 +70,66 @@ are also created, for emulating automake-style testsuites, as expected
by tools such as bunsen.)
+Platform-specific setup for regression tests
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+On some platforms some setup is required otherwise some of the tests
+will fail.
+
+Inherited inotifier file descriptors
+------------------------------------
+Seen on openSUSE amd64 KDE, all processes seem to inherit an inotify
+file descriptor which interferes with some of the fdleak tests in the
+none directory. Here is an example
+
+lsof | grep inotify | grep bash
+bash 13128 paulf 31r a_inode 0,14 0 46 inotify
+
+I don't know how to turn this off completely. You can close the
+file descriptor for the current shell by using
+
+MY_INOTIFIER=$(lsof 2>&1 | grep $$ | grep inotify | awk '{print $4}' | sed 's/r//')
+
+if [ -n ${MY_INOTIFIER} ] ; then
+ exec {MY_INOTIFIER}<&-
+fi
+
+FreeBSD kernel modules and stack guard page
+-------------------------------------------
+The sctp and mqueuefs kernel modules need to be loaded. As root
+
+kldload sctp mqueuefs
+
+Additionally FreeBSD has strange belt and braces thread stack protection
+with both the kernel and the allocated thread stack providing guard pages.
+This interferes with the memcheck descr_belowsp test. The extra kernel
+guard page can be turned off with the following command run as root
+
+sysctl security.bsd.stack_guard_page=0
+
+
Running the performance tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To build and run all the performance tests, run "make [--quiet] perf".
To run a subset of the performance suite, execute:
- perl perf/vg_perf
+ perf/vg_perf
where is a directory (all tests within will be run) or a single
.vgperf test file, or the name of a program which has a like-named .vgperf
file. Eg:
- perl perf/vg_perf perf/
- perl perf/vg_perf perf/bz2.vgperf
- perl perf/vg_perf perf/bz2
+ perf/vg_perf perf/
+ perf/vg_perf perf/bz2.vgperf
+ perf/vg_perf perf/bz2
To compare multiple versions of Valgrind, use the --vg= option multiple
times. For example, if you have two Valgrinds next to each other, one in
trunk1/ and one in trunk2/, from within either trunk1/ or trunk2/ do this to
compare them on all the performance tests:
- perl perf/vg_perf --vg=../trunk1 --vg=../trunk2 perf/
+ perf/vg_perf --vg=../trunk1 --vg=../trunk2 perf/
Writing regression tests
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -145,7 +183,7 @@ See tests/vg_regtest for a full description of all possible vgtest directives.
The easiest way to generate the expected files is to run the test. Create empty
files with touch (otherwise the test won't run) then run the test from the
-top directory using perl and vg_regtest script (as in the "Running the
+top directory using vg_regtest script (as in the "Running the
regression tests" section. Then copy "tool/tests/newtest.stderr.out" to
"tool/tests/newtest.stderr.exp". It is better to generate the .stdout.exp
file directly from the testcase. You can do that by redirecting stdout to
@@ -158,7 +196,32 @@ Make sure that the test runs and passes.
The last file to change is .gitignore in the top directory. Add a new entry,
for example "/tool/tests/newtest".
-Check for mistakes in Makefile.am. In the top directory run
+The 'scalar' tests are something of a special case. Scalar in this sense
+refers to the registers (or stack slots) used to pass in arguments. These tests
+directly use the 'syscall' syscall via a macro, SY. They make little effort
+to use the sysall in a realistic manner. Rather, the objective is to
+exhaustively test all of the arguemnts and referenced memory of syscalls.
+The variable 'x0' is a long integer, containing the value of 0 but
+also uninitialised. It can be used on its own or with some other value
+to ensure that all of the syscall arguemts are uninitialised.
+A second macro, GO, is used precede the syscall (and subsequent errors)
+with a header. The GO string includes the name of the syscall, a count of
+expected scalar errors and a count of memory errors. The tests are usually
+followed by the FAIL macro, which ensures that the syscall failed.
+An example scalar test is
+
+ /* SYS_link 9 */
+ GO(SYS_link, "2s 2m");
+ SY(SYS_link, x0, x0); FAIL;
+
+
+This syscall takes two strings so the expected errors are
+2 scalar (for the pointer arguments) and 2 memory (for
+the strings themselves).
+
+When your test is done check for mistakes in Makefile.am.
+In the top directory run
+
make post-regtest-checks
You should only see
@@ -208,12 +271,12 @@ without too much problem by following these steps:
export VALGRIND_LIB=$DIR/.in_place
VALGRIND_LIB is where the default.supp and vgpreload_ libraries
- are found (which is under /usr/libexec/valgrind for an installed
+ are found (which is under /usr/local/libexec/valgrind for an installed
version).
(2) Run gdb on the tool executable. Eg:
- gdb /usr/local/lib/valgrind/lackey-ppc32-linux
+ gdb /usr/local/libexec/valgrind/lackey-ppc32-linux
or
@@ -339,16 +402,16 @@ When using self-hosting with an outer Callgrind tool, use '--pop-on-jump'
(B) Regression tests in an outer/inner setup:
To run all the regression tests with an outer memcheck, do :
- perl tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \
- --all
+ tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \
+ --all
To run a specific regression tests with an outer memcheck, do:
- perl tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \
- none/tests/args.vgtest
+ tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \
+ none/tests/args.vgtest
To run regression tests with another outer tool:
- perl tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \
- --outer-tool=helgrind --all
+ tests/vg_regtest --outer-valgrind=../outer/.../bin/valgrind \
+ --outer-tool=helgrind --all
--outer-args allows to give specific arguments to the outer tool,
replacing the default one provided by vg_regtest.
@@ -407,20 +470,20 @@ the guest stacktrace that did the allocation.
(C) Performance tests in an outer/inner setup:
To run all the performance tests with an outer cachegrind, do :
- perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf
+ perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf
To run a specific perf test (e.g. bz2) in this setup, do :
- perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf/bz2
+ perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind perf/bz2
To run all the performance tests with an outer callgrind, do :
- perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \
- --outer-tool=callgrind perf
+ perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \
+ --outer-tool=callgrind perf
Note: --outer-valgrind must be a "make install"-ed valgrind.
Do *not* use vg-in-place.
To compare the performance of multiple Valgrind versions, do :
- perl perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \
+ perf/vg_perf --outer-valgrind=../outer/.../bin/valgrind \
--outer-tool=callgrind \
--vg=../inner_xxxx --vg=../inner_yyyy perf
(where inner_xxxx and inner_yyyy are the toplevel directories of
@@ -435,7 +498,7 @@ output files will be created for each test:
(where tt is the two letters abbreviation for the inner tool(s) run).
For example, the command
- perl perf/vg_perf \
+ perf/vg_perf \
--outer-valgrind=../outer_trunk/install/bin/valgrind \
--outer-tool=callgrind \
--vg=../inner_tchain --vg=../inner_trunk perf/many-loss-records
diff --git a/VEX/LICENSE.GPL b/VEX/LICENSE.GPL
index d159169d10..f288702d2f 100644
--- a/VEX/LICENSE.GPL
+++ b/VEX/LICENSE.GPL
@@ -1,281 +1,622 @@
GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ Version 3, 29 June 2007
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
this License.
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
@@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
+state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -303,37 +644,31 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- , 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/VEX/LICENSE.README b/VEX/LICENSE.README
index 8ae1ccd4ea..b4b14f5b05 100644
--- a/VEX/LICENSE.README
+++ b/VEX/LICENSE.README
@@ -4,7 +4,7 @@ binary instrumentation and translation.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -18,4 +18,4 @@ binary instrumentation and translation.
The GNU General Public License is contained in the file LICENSE.GPL.
If you want to contribute code to LibVEX, please ensure it is licensed
-as "GPL v2 or later".
+as "GPL v3 or later".
diff --git a/VEX/Makefile-gcc b/VEX/Makefile-gcc
index 0b94e13c5f..57e33cdb25 100644
--- a/VEX/Makefile-gcc
+++ b/VEX/Makefile-gcc
@@ -68,6 +68,7 @@ LIB_OBJS = priv/ir_defs.o \
priv/host_generic_simd128.o \
priv/host_generic_simd256.o \
priv/host_generic_reg_alloc2.o \
+ priv/host_generic_reg_alloc3.o \
priv/guest_generic_x87.o \
priv/guest_generic_bb_to_IR.o \
priv/guest_x86_helpers.o \
@@ -347,6 +348,10 @@ priv/host_generic_reg_alloc2.o: $(ALL_HEADERS) priv/host_generic_reg_alloc2.c
$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_reg_alloc2.o \
-c priv/host_generic_reg_alloc2.c
+priv/host_generic_reg_alloc3.o: $(ALL_HEADERS) priv/host_generic_reg_alloc3.c
+ $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_reg_alloc3.o \
+ -c priv/host_generic_reg_alloc3.c
+
priv/guest_x86_toIR.o: $(ALL_HEADERS) priv/guest_x86_toIR.c
$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_x86_toIR.o \
-c priv/guest_x86_toIR.c
diff --git a/VEX/auxprogs/genoffsets.c b/VEX/auxprogs/genoffsets.c
index 48c9723dc6..07ff09be7d 100644
--- a/VEX/auxprogs/genoffsets.c
+++ b/VEX/auxprogs/genoffsets.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/common_nanomips_defs.h b/VEX/priv/common_nanomips_defs.h
index 28b097dc69..40e750e072 100644
--- a/VEX/priv/common_nanomips_defs.h
+++ b/VEX/priv/common_nanomips_defs.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -20,9 +20,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
+ along with this program; if not, see .
The GNU General Public License is contained in the file COPYING.
*/
diff --git a/VEX/priv/guest_amd64_defs.h b/VEX/priv/guest_amd64_defs.h
index f7a4e06c05..35c74dcb83 100644
--- a/VEX/priv/guest_amd64_defs.h
+++ b/VEX/priv/guest_amd64_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c
index b4e37fcbd6..ca33f7c818 100644
--- a/VEX/priv/guest_amd64_helpers.c
+++ b/VEX/priv/guest_amd64_helpers.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -2665,6 +2665,7 @@ void amd64g_dirtyhelper_FINIT ( VexGuestAMD64State* gst )
{
Int i;
gst->guest_FTOP = 0;
+ gst->pad1 = 0;
for (i = 0; i < 8; i++) {
gst->guest_FPTAG[i] = 0; /* empty */
gst->guest_FPREG[i] = 0; /* IEEE754 64-bit zero */
@@ -4831,7 +4832,7 @@ void LibVEX_GuestAMD64_initialise ( /*OUT*/VexGuestAMD64State* vex_state )
vex_state->guest_GS_CONST = 0;
vex_state->guest_IP_AT_SYSCALL = 0;
- vex_state->pad1 = 0;
+ vex_state->guest_TLSBASE = 0;
}
diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c
index 57a8a434b8..34ebcbdf9a 100644
--- a/VEX/priv/guest_amd64_toIR.c
+++ b/VEX/priv/guest_amd64_toIR.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -5075,14 +5075,14 @@ static IRTemp gen_LZCNT ( IRType ty, IRTemp src )
binop(Iop_Shl64, mkexpr(src64),
mkU8(64 - 8 * sizeofIRType(ty))));
- // Clz64 has undefined semantics when its input is zero, so
- // special-case around that.
+ /* Guard against 0 input value. Use ClzNat64 operator for all other
+ values */
IRTemp res64 = newTemp(Ity_I64);
assign(res64,
IRExpr_ITE(
binop(Iop_CmpEQ64, mkexpr(src64x), mkU64(0)),
mkU64(8 * sizeofIRType(ty)),
- unop(Iop_Clz64, mkexpr(src64x))
+ unop(Iop_ClzNat64, mkexpr(src64x))
));
IRTemp res = newTemp(ty);
@@ -5103,14 +5103,14 @@ static IRTemp gen_TZCNT ( IRType ty, IRTemp src )
IRTemp src64 = newTemp(Ity_I64);
assign(src64, widenUto64( mkexpr(src) ));
- // Ctz64 has undefined semantics when its input is zero, so
- // special-case around that.
+ /* Guard against 0 input value. Use CtzNat64 operator for all other
+ values */
IRTemp res64 = newTemp(Ity_I64);
assign(res64,
IRExpr_ITE(
binop(Iop_CmpEQ64, mkexpr(src64), mkU64(0)),
mkU64(8 * sizeofIRType(ty)),
- unop(Iop_Ctz64, mkexpr(src64))
+ unop(Iop_CtzNat64, mkexpr(src64))
));
IRTemp res = newTemp(ty);
@@ -8421,30 +8421,28 @@ ULong dis_bs_E_G ( const VexAbiInfo* vbi,
elimination of previous stores to this field work better. */
stmt( IRStmt_Put( OFFB_CC_NDEP, mkU64(0) ));
- /* Result: iff source value is zero, we can't use
- Iop_Clz64/Iop_Ctz64 as they have no defined result in that case.
- But anyway, amd64 semantics say the result is undefined in
- such situations. Hence handle the zero case specially. */
+ /* amd64 semantics say the result is undefined iff source value is
+ zero. Hence handle the zero case specially. */
/* Bleh. What we compute:
bsf64: if src == 0 then {dst is unchanged}
- else Ctz64(src)
+ else CtzNat64(src)
bsr64: if src == 0 then {dst is unchanged}
- else 63 - Clz64(src)
+ else 63 - ClzNat64(src)
bsf32: if src == 0 then {dst is unchanged}
- else Ctz64(32Uto64(src))
+ else CtzNat64(32Uto64(src))
bsr32: if src == 0 then {dst is unchanged}
- else 63 - Clz64(32Uto64(src))
+ else 63 - ClzNat64(32Uto64(src))
bsf16: if src == 0 then {dst is unchanged}
- else Ctz64(32Uto64(16Uto32(src)))
+ else CtzNat64(32Uto64(16Uto32(src)))
bsr16: if src == 0 then {dst is unchanged}
- else 63 - Clz64(32Uto64(16Uto32(src)))
+ else 63 - ClzNat64(32Uto64(16Uto32(src)))
*/
/* The main computation, guarding against zero. */
@@ -8452,10 +8450,10 @@ ULong dis_bs_E_G ( const VexAbiInfo* vbi,
IRExpr_ITE(
mkexpr(srcB),
/* src != 0 */
- fwds ? unop(Iop_Ctz64, mkexpr(src64))
+ fwds ? unop(Iop_CtzNat64, mkexpr(src64))
: binop(Iop_Sub64,
mkU64(63),
- unop(Iop_Clz64, mkexpr(src64))),
+ unop(Iop_ClzNat64, mkexpr(src64))),
/* src == 0 -- leave dst unchanged */
widenUto64( getIRegG( sz, pfx, modrm ) )
)
@@ -18606,8 +18604,9 @@ static Long dis_PEXTRQ ( const VexAbiInfo* vbi, Prefix pfx,
static IRExpr* math_CTZ32(IRExpr *exp)
{
- /* Iop_Ctz32 isn't implemented by the amd64 back end, so use Iop_Ctz64. */
- return unop(Iop_64to32, unop(Iop_Ctz64, unop(Iop_32Uto64, exp)));
+ /* Iop_CtzNat32 isn't implemented by the amd64 back end, so use
+ Iop_CtzNat64. */
+ return unop(Iop_64to32, unop(Iop_CtzNat64, unop(Iop_32Uto64, exp)));
}
static Long dis_PCMPISTRI_3A ( UChar modrm, UInt regNoL, UInt regNoR,
diff --git a/VEX/priv/guest_arm64_defs.h b/VEX/priv/guest_arm64_defs.h
index a83a4d9a7f..18b08b7ee1 100644
--- a/VEX/priv/guest_arm64_defs.h
+++ b/VEX/priv/guest_arm64_defs.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_arm64_helpers.c b/VEX/priv/guest_arm64_helpers.c
index d75798b2b4..d6a03fe364 100644
--- a/VEX/priv/guest_arm64_helpers.c
+++ b/VEX/priv/guest_arm64_helpers.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_arm64_toIR.c b/VEX/priv/guest_arm64_toIR.c
index e6b92c7a04..6e77b34c7c 100644
--- a/VEX/priv/guest_arm64_toIR.c
+++ b/VEX/priv/guest_arm64_toIR.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -3504,12 +3504,12 @@ Bool dis_ARM64_data_processing_register(/*MB_OUT*/DisResult* dres,
if (is64) {
assign(dst, IRExpr_ITE(binop(Iop_CmpEQ64, mkexpr(srcZ), mkU64(0)),
mkU64(isCLS ? 63 : 64),
- unop(Iop_Clz64, mkexpr(srcZ))));
+ unop(Iop_ClzNat64, mkexpr(srcZ))));
putIReg64orZR(dd, mkexpr(dst));
} else {
assign(dst, IRExpr_ITE(binop(Iop_CmpEQ64, mkexpr(srcZ), mkU64(0)),
mkU64(isCLS ? 31 : 32),
- unop(Iop_Clz64, mkexpr(srcZ))));
+ unop(Iop_ClzNat64, mkexpr(srcZ))));
putIReg32orZR(dd, unop(Iop_64to32, mkexpr(dst)));
}
DIP("cl%c %s, %s\n", isCLS ? 's' : 'z',
@@ -7053,14 +7053,20 @@ Bool dis_ARM64_load_store(/*MB_OUT*/DisResult* dres, UInt insn,
/* ------------------ LDA{R,RH,RB} ------------------ */
/* ------------------ STL{R,RH,RB} ------------------ */
+ /* ------------------ LDAP{R,RH,RB} ----------------- */
/* 31 29 23 20 14 9 4
sz 001000 110 11111 1 11111 n t LDAR Rt, [Xn|SP]
sz 001000 100 11111 1 11111 n t STLR Rt, [Xn|SP]
+ sz 111000 101 11111 1 10000 n t LDAPR Rt, [Xn|SP]
*/
- if (INSN(29,23) == BITS7(0,0,1,0,0,0,1)
- && INSN(21,10) == BITS12(0,1,1,1,1,1,1,1,1,1,1,1)) {
+ if ((INSN(29,23) == BITS7(0,0,1,0,0,0,1)
+ && INSN(21,10) == BITS12(0,1,1,1,1,1,1,1,1,1,1,1))
+ ||
+ (INSN(29,21) == BITS9(1,1,1,0,0,0,1,0,1)
+ && INSN(20,10) == BITS11(1,1,1,1,1,1,1,0,0,0,0)))
+ {
UInt szBlg2 = INSN(31,30);
- Bool isLD = INSN(22,22) == 1;
+ Bool isLD = INSN(23,21) != BITS3(1,0,0);
UInt nn = INSN(9,5);
UInt tt = INSN(4,0);
diff --git a/VEX/priv/guest_arm_defs.h b/VEX/priv/guest_arm_defs.h
index 85521e7706..791e48cb1b 100644
--- a/VEX/priv/guest_arm_defs.h
+++ b/VEX/priv/guest_arm_defs.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_arm_helpers.c b/VEX/priv/guest_arm_helpers.c
index d0de845d9f..f573405717 100644
--- a/VEX/priv/guest_arm_helpers.c
+++ b/VEX/priv/guest_arm_helpers.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_arm_toIR.c b/VEX/priv/guest_arm_toIR.c
index 2bedccd14d..a4b91e06f0 100644
--- a/VEX/priv/guest_arm_toIR.c
+++ b/VEX/priv/guest_arm_toIR.c
@@ -17,7 +17,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -17100,11 +17100,7 @@ DisResult disInstr_ARM_WRK (
IRTemp arg = newTemp(Ity_I32);
IRTemp res = newTemp(Ity_I32);
assign(arg, getIRegA(rM));
- assign(res, IRExpr_ITE(
- binop(Iop_CmpEQ32, mkexpr(arg), mkU32(0)),
- mkU32(32),
- unop(Iop_Clz32, mkexpr(arg))
- ));
+ assign(res, unop(Iop_ClzNat32, mkexpr(arg)));
putIRegA(rD, mkexpr(res), condT, Ijk_Boring);
DIP("clz%s r%u, r%u\n", nCC(INSN_COND), rD, rM);
goto decode_success;
@@ -22730,11 +22726,7 @@ DisResult disInstr_THUMB_WRK (
IRTemp arg = newTemp(Ity_I32);
IRTemp res = newTemp(Ity_I32);
assign(arg, getIRegT(rM1));
- assign(res, IRExpr_ITE(
- binop(Iop_CmpEQ32, mkexpr(arg), mkU32(0)),
- mkU32(32),
- unop(Iop_Clz32, mkexpr(arg))
- ));
+ assign(res, unop(Iop_ClzNat32, mkexpr(arg)));
putIRegT(rD, mkexpr(res), condT);
DIP("clz r%u, r%u\n", rD, rM1);
goto decode_success;
diff --git a/VEX/priv/guest_generic_bb_to_IR.c b/VEX/priv/guest_generic_bb_to_IR.c
index 1b9821a7cf..9eff7d6ae9 100644
--- a/VEX/priv/guest_generic_bb_to_IR.c
+++ b/VEX/priv/guest_generic_bb_to_IR.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_generic_bb_to_IR.h b/VEX/priv/guest_generic_bb_to_IR.h
index cad6768a0b..59684e3574 100644
--- a/VEX/priv/guest_generic_bb_to_IR.h
+++ b/VEX/priv/guest_generic_bb_to_IR.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_generic_x87.c b/VEX/priv/guest_generic_x87.c
index 85ebebdc77..98d0ac8e37 100644
--- a/VEX/priv/guest_generic_x87.c
+++ b/VEX/priv/guest_generic_x87.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_generic_x87.h b/VEX/priv/guest_generic_x87.h
index e8467547c4..3bfe466aea 100644
--- a/VEX/priv/guest_generic_x87.h
+++ b/VEX/priv/guest_generic_x87.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_mips_defs.h b/VEX/priv/guest_mips_defs.h
index 27e89d1120..98d13d9aa4 100644
--- a/VEX/priv/guest_mips_defs.h
+++ b/VEX/priv/guest_mips_defs.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_mips_helpers.c b/VEX/priv/guest_mips_helpers.c
index 79197378cc..f7e6f39d2b 100644
--- a/VEX/priv/guest_mips_helpers.c
+++ b/VEX/priv/guest_mips_helpers.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_mips_toIR.c b/VEX/priv/guest_mips_toIR.c
index 1285edad0b..69b6714c20 100644
--- a/VEX/priv/guest_mips_toIR.c
+++ b/VEX/priv/guest_mips_toIR.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -17086,14 +17086,10 @@ static UInt disInstr_MIPS_WRK_Special(UInt cins, const VexArchInfo* archinfo,
IRTemp tmpRs32 = newTemp(Ity_I32);
assign(tmpRs32, mkNarrowTo32(ty, getIReg(rs)));
- assign(tmpClz32, unop(Iop_Clz32, mkexpr(tmpRs32)));
+ assign(tmpClz32, unop(Iop_ClzNat32, mkexpr(tmpRs32)));
putIReg(rd, mkWidenFrom32(ty, mkexpr(tmpClz32), True));
} else {
- t1 = newTemp(Ity_I1);
- assign(t1, binop(Iop_CmpEQ32, getIReg(rs), mkU32(0)));
- putIReg(rd, IRExpr_ITE(mkexpr(t1),
- mkU32(0x00000020),
- unop(Iop_Clz32, getIReg(rs))));
+ putIReg(rd, unop(Iop_ClzNat32, getIReg(rs)));
}
} else {
ILLEGAL_INSTRUCTON;
@@ -17126,21 +17122,14 @@ static UInt disInstr_MIPS_WRK_Special(UInt cins, const VexArchInfo* archinfo,
IRTemp tmpRs32 = newTemp(Ity_I32);
assign(tmpRs32, mkNarrowTo32(ty, getIReg(rs)));
- t1 = newTemp(Ity_I1);
- assign(t1, binop(Iop_CmpEQ32, mkexpr(tmpRs32), mkU32(0xffffffff)));
- assign(tmpClo32, IRExpr_ITE(mkexpr(t1),
- mkU32(0x00000020),
- unop(Iop_Clz32, unop(Iop_Not32, mkexpr(tmpRs32)))));
+ assign(tmpClo32, unop(Iop_ClzNat32,
+ unop(Iop_Not32, mkexpr(tmpRs32))));
putIReg(rd, mkWidenFrom32(ty, mkexpr(tmpClo32), True));
break;
} else {
- t1 = newTemp(Ity_I1);
- assign(t1, binop(Iop_CmpEQ32, getIReg(rs), mkU32(0xffffffff)));
- putIReg(rd, IRExpr_ITE(mkexpr(t1),
- mkU32(0x00000020),
- unop(Iop_Clz32,
- unop(Iop_Not32, getIReg(rs)))));
+ putIReg(rd, unop(Iop_ClzNat32,
+ unop(Iop_Not32, getIReg(rs))));
}
} else {
ILLEGAL_INSTRUCTON;
@@ -17188,11 +17177,7 @@ static UInt disInstr_MIPS_WRK_Special(UInt cins, const VexArchInfo* archinfo,
case 1:
DIP("dclz r%u, r%u", rd, rs);
- t1 = newTemp(Ity_I1);
- assign(t1, binop(Iop_CmpEQ64, getIReg(rs), mkU64(0)));
- putIReg(rd, IRExpr_ITE(mkexpr(t1),
- mkU64(0x00000040),
- unop(Iop_Clz64, getIReg(rs))));
+ putIReg(rd, unop(Iop_ClzNat64, getIReg(rs)));
break;
}
@@ -17225,13 +17210,8 @@ static UInt disInstr_MIPS_WRK_Special(UInt cins, const VexArchInfo* archinfo,
case 1:
DIP("dclo r%u, r%u", rd, rs);
- t1 = newTemp(Ity_I1);
- assign(t1, binop(Iop_CmpEQ64, getIReg(rs),
- mkU64(0xffffffffffffffffULL)));
- putIReg(rd, IRExpr_ITE(mkexpr(t1),
- mkU64(0x40),
- unop(Iop_Clz64, unop(Iop_Not64,
- getIReg(rs)))));
+ putIReg(rd, unop(Iop_ClzNat64,
+ unop(Iop_Not64, getIReg(rs))));
break;
}
@@ -18772,14 +18752,10 @@ static UInt disInstr_MIPS_WRK_Special2(UInt cins, const VexArchInfo* archinfo,
IRTemp tmpRs32 = newTemp(Ity_I32);
assign(tmpRs32, mkNarrowTo32(ty, getIReg(rs)));
- assign(tmpClz32, unop(Iop_Clz32, mkexpr(tmpRs32)));
+ assign(tmpClz32, unop(Iop_ClzNat32, mkexpr(tmpRs32)));
putIReg(rd, mkWidenFrom32(ty, mkexpr(tmpClz32), True));
} else {
- t1 = newTemp(Ity_I1);
- assign(t1, binop(Iop_CmpEQ32, getIReg(rs), mkU32(0)));
- putIReg(rd, IRExpr_ITE(mkexpr(t1),
- mkU32(0x00000020),
- unop(Iop_Clz32, getIReg(rs))));
+ putIReg(rd, unop(Iop_ClzNat32, getIReg(rs)));
}
break;
@@ -18793,43 +18769,25 @@ static UInt disInstr_MIPS_WRK_Special2(UInt cins, const VexArchInfo* archinfo,
IRTemp tmpRs32 = newTemp(Ity_I32);
assign(tmpRs32, mkNarrowTo32(ty, getIReg(rs)));
- t1 = newTemp(Ity_I1);
- assign(t1, binop(Iop_CmpEQ32, mkexpr(tmpRs32), mkU32(0xffffffff)));
- assign(tmpClo32, IRExpr_ITE(mkexpr(t1),
- mkU32(0x00000020),
- unop(Iop_Clz32, unop(Iop_Not32, mkexpr(tmpRs32)))));
+ assign(tmpClo32, unop(Iop_ClzNat32,
+ unop(Iop_Not32, mkexpr(tmpRs32))));
putIReg(rd, mkWidenFrom32(ty, mkexpr(tmpClo32), True));
break;
} else {
- t1 = newTemp(Ity_I1);
- assign(t1, binop(Iop_CmpEQ32, getIReg(rs), mkU32(0xffffffff)));
- putIReg(rd, IRExpr_ITE(mkexpr(t1),
- mkU32(0x00000020),
- unop(Iop_Clz32,
- unop(Iop_Not32, getIReg(rs)))));
+ putIReg(rd, unop(Iop_ClzNat32, unop(Iop_Not32, getIReg(rs))));
break;
}
}
case 0x24: /* Count Leading Zeros in Doubleword - DCLZ; MIPS64 */
DIP("dclz r%u, r%u", rd, rs);
- t1 = newTemp(Ity_I1);
- assign(t1, binop(Iop_CmpEQ64, getIReg(rs), mkU64(0)));
- putIReg(rd, IRExpr_ITE(mkexpr(t1),
- mkU64(0x00000040),
- unop(Iop_Clz64, getIReg(rs))));
+ putIReg(rd, unop(Iop_ClzNat64, getIReg(rs)));
break;
case 0x25: /* Count Leading Ones in Doubleword - DCLO; MIPS64 */
DIP("dclo r%u, r%u", rd, rs);
- t1 = newTemp(Ity_I1);
- assign(t1, binop(Iop_CmpEQ64, getIReg(rs),
- mkU64(0xffffffffffffffffULL)));
- putIReg(rd, IRExpr_ITE(mkexpr(t1),
- mkU64(0x40),
- unop(Iop_Clz64, unop(Iop_Not64,
- getIReg(rs)))));
+ putIReg(rd, unop(Iop_ClzNat64, unop(Iop_Not64, getIReg(rs))));
break;
default:
diff --git a/VEX/priv/guest_nanomips_defs.h b/VEX/priv/guest_nanomips_defs.h
index 2e26b9cf15..18e1eee299 100644
--- a/VEX/priv/guest_nanomips_defs.h
+++ b/VEX/priv/guest_nanomips_defs.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -20,9 +20,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
+ along with this program; if not, see .
The GNU General Public License is contained in the file COPYING.
*/
diff --git a/VEX/priv/guest_nanomips_helpers.c b/VEX/priv/guest_nanomips_helpers.c
index 00944494b4..81afd2548e 100644
--- a/VEX/priv/guest_nanomips_helpers.c
+++ b/VEX/priv/guest_nanomips_helpers.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -20,9 +20,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
+ along with this program; if not, see .
The GNU General Public License is contained in the file COPYING.
*/
diff --git a/VEX/priv/guest_nanomips_toIR.c b/VEX/priv/guest_nanomips_toIR.c
index 3827ac3fc0..849dcbeb11 100644
--- a/VEX/priv/guest_nanomips_toIR.c
+++ b/VEX/priv/guest_nanomips_toIR.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -20,9 +20,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
+ along with this program; if not, see .
The GNU General Public License is contained in the file COPYING.
*/
@@ -864,23 +862,17 @@ static void nano_pool32Axf_4(DisResult *dres, UInt cins)
{
UChar rs = (cins >> 16) & 0x1F;
UChar rt = (cins >> 21) & 0x1F;
- IRTemp t1;
switch ((cins >> 9) & 0x7F) {
case nano_POOL32Axf4_CLO: { /* clo */
DIP("clo r%u, r%u", rt, rs);
- t1 = newTemp(Ity_I1);
- assign(t1, binop(Iop_CmpEQ32, getIReg(rs), mkU32(0xffffffff)));
- putIReg(rt, IRExpr_ITE(mkexpr(t1),
- mkU32(0x00000020),
- unop(Iop_Clz32,
- unop(Iop_Not32, getIReg(rs)))));
+ putIReg(rt, unop(Iop_ClzNat32, unop(Iop_Not32, getIReg(rs))));
break;
}
case nano_POOL32Axf4_CLZ: { /* clz */
DIP("clz r%u, r%u", rt, rs);
- putIReg(rt, unop(Iop_Clz32, getIReg(rs)));
+ putIReg(rt, unop(Iop_ClzNat32, getIReg(rs)));
break;
}
}
diff --git a/VEX/priv/guest_ppc_defs.h b/VEX/priv/guest_ppc_defs.h
index 220fbf1395..f5571c49bb 100644
--- a/VEX/priv/guest_ppc_defs.h
+++ b/VEX/priv/guest_ppc_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_ppc_helpers.c b/VEX/priv/guest_ppc_helpers.c
index 2611e52107..106f57e738 100644
--- a/VEX/priv/guest_ppc_helpers.c
+++ b/VEX/priv/guest_ppc_helpers.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c
index 18716dd04c..231e914e5d 100644
--- a/VEX/priv/guest_ppc_toIR.c
+++ b/VEX/priv/guest_ppc_toIR.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -21285,7 +21285,7 @@ dis_vector_logical_mask_bits ( UInt prefix, UInt theInstr, UInt opc2,
) ) ) );
assign( clz[0],
- unop( Iop_Clz64,
+ unop( Iop_ClzNat64,
mkexpr( extracted_bits[0] ) ) );
assign( extracted_bits[1],
@@ -21300,7 +21300,7 @@ dis_vector_logical_mask_bits ( UInt prefix, UInt theInstr, UInt opc2,
mkexpr( cnt_extract_bits[1] )
) ) ) );
assign( clz[1],
- unop( Iop_Clz64,
+ unop( Iop_ClzNat64,
mkexpr( extracted_bits[1] ) ) );
putVReg( vRT_addr, binop( Iop_64HLtoV128,
diff --git a/VEX/priv/guest_riscv64_defs.h b/VEX/priv/guest_riscv64_defs.h
index ee5435e145..bdbf34c567 100644
--- a/VEX/priv/guest_riscv64_defs.h
+++ b/VEX/priv/guest_riscv64_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_riscv64_helpers.c b/VEX/priv/guest_riscv64_helpers.c
index e7c4ed8055..36fad19350 100644
--- a/VEX/priv/guest_riscv64_helpers.c
+++ b/VEX/priv/guest_riscv64_helpers.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_riscv64_toIR.c b/VEX/priv/guest_riscv64_toIR.c
index ee9580520a..5a0cbfc9f8 100644
--- a/VEX/priv/guest_riscv64_toIR.c
+++ b/VEX/priv/guest_riscv64_toIR.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1550,7 +1550,8 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres,
break;
case 0b001:
expr = binop(Iop_Shl64, getIReg64(rs1),
- unop(Iop_64to8, getIReg64(rs2)));
+ unop(Iop_64to8, binop(Iop_And64, mkU64(0b00111111),
+ getIReg64(rs2))));
break;
case 0b010:
expr = unop(Iop_1Uto64,
@@ -1565,7 +1566,8 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres,
break;
case 0b101:
expr = binop(is_base ? Iop_Shr64 : Iop_Sar64, getIReg64(rs1),
- unop(Iop_64to8, getIReg64(rs2)));
+ unop(Iop_64to8, binop(Iop_And64, mkU64(0b00111111),
+ getIReg64(rs2))));
break;
case 0b110:
expr = binop(Iop_Or64, getIReg64(rs1), getIReg64(rs2));
@@ -1719,7 +1721,9 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres,
if (rd != 0)
putIReg32(
irsb, rd,
- binop(Iop_Shl32, getIReg32(rs1), unop(Iop_64to8, getIReg64(rs2))));
+ binop(Iop_Shl32, getIReg32(rs1),
+ unop(Iop_64to8, binop(Iop_And64, mkU64(0b00011111),
+ getIReg64(rs2)))));
DIP("sllw %s, %s, %s\n", nameIReg(rd), nameIReg(rs1), nameIReg(rs2));
return True;
}
@@ -1734,7 +1738,8 @@ static Bool dis_RV64I(/*MB_OUT*/ DisResult* dres,
if (rd != 0)
putIReg32(irsb, rd,
binop(is_log ? Iop_Shr32 : Iop_Sar32, getIReg32(rs1),
- unop(Iop_64to8, getIReg64(rs2))));
+ unop(Iop_64to8, binop(Iop_And64, mkU64(0b00011111),
+ getIReg64(rs2)))));
DIP("%s %s, %s, %s\n", is_log ? "srlw" : "sraw", nameIReg(rd),
nameIReg(rs1), nameIReg(rs2));
return True;
@@ -1758,8 +1763,6 @@ static Bool dis_RV64M(/*MB_OUT*/ DisResult* dres,
UInt rs1 = INSN(19, 15);
UInt rs2 = INSN(24, 20);
if (funct3 == 0b010) {
- /* Invalid {MUL,DIV,REM}, fall through. */
- } else if (funct3 == 0b010) {
/* MULHSU, not currently handled, fall through. */
} else {
if (rd != 0) {
diff --git a/VEX/priv/guest_s390_defs.h b/VEX/priv/guest_s390_defs.h
index 29efa01311..a780e83881 100644
--- a/VEX/priv/guest_s390_defs.h
+++ b/VEX/priv/guest_s390_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c
index 6e0321feaa..3d6fec5c18 100644
--- a/VEX/priv/guest_s390_helpers.c
+++ b/VEX/priv/guest_s390_helpers.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -44,127 +44,9 @@
void
LibVEX_GuestS390X_initialise(VexGuestS390XState *state)
{
-/*------------------------------------------------------------*/
-/*--- Initialise ar registers ---*/
-/*------------------------------------------------------------*/
-
- state->guest_a0 = 0;
- state->guest_a1 = 0;
- state->guest_a2 = 0;
- state->guest_a3 = 0;
- state->guest_a4 = 0;
- state->guest_a5 = 0;
- state->guest_a6 = 0;
- state->guest_a7 = 0;
- state->guest_a8 = 0;
- state->guest_a9 = 0;
- state->guest_a10 = 0;
- state->guest_a11 = 0;
- state->guest_a12 = 0;
- state->guest_a13 = 0;
- state->guest_a14 = 0;
- state->guest_a15 = 0;
-
-/*------------------------------------------------------------*/
-/*--- Initialise vr registers ---*/
-/*------------------------------------------------------------*/
-
-#define VRZERO(vr) \
- do { \
- vr.w64[0] = vr.w64[1] = 0ULL; \
- } while(0);
-
- VRZERO(state->guest_v0)
- VRZERO(state->guest_v1)
- VRZERO(state->guest_v2)
- VRZERO(state->guest_v3)
- VRZERO(state->guest_v4)
- VRZERO(state->guest_v5)
- VRZERO(state->guest_v6)
- VRZERO(state->guest_v7)
- VRZERO(state->guest_v8)
- VRZERO(state->guest_v9)
- VRZERO(state->guest_v10)
- VRZERO(state->guest_v11)
- VRZERO(state->guest_v12)
- VRZERO(state->guest_v13)
- VRZERO(state->guest_v14)
- VRZERO(state->guest_v15)
- VRZERO(state->guest_v16)
- VRZERO(state->guest_v17)
- VRZERO(state->guest_v18)
- VRZERO(state->guest_v19)
- VRZERO(state->guest_v20)
- VRZERO(state->guest_v21)
- VRZERO(state->guest_v22)
- VRZERO(state->guest_v23)
- VRZERO(state->guest_v24)
- VRZERO(state->guest_v25)
- VRZERO(state->guest_v26)
- VRZERO(state->guest_v27)
- VRZERO(state->guest_v28)
- VRZERO(state->guest_v29)
- VRZERO(state->guest_v30)
- VRZERO(state->guest_v31)
-
-#undef VRZERO
-/*------------------------------------------------------------*/
-/*--- Initialise gpr registers ---*/
-/*------------------------------------------------------------*/
-
- state->guest_r0 = 0;
- state->guest_r1 = 0;
- state->guest_r2 = 0;
- state->guest_r3 = 0;
- state->guest_r4 = 0;
- state->guest_r5 = 0;
- state->guest_r6 = 0;
- state->guest_r7 = 0;
- state->guest_r8 = 0;
- state->guest_r9 = 0;
- state->guest_r10 = 0;
- state->guest_r11 = 0;
- state->guest_r12 = 0;
- state->guest_r13 = 0;
- state->guest_r14 = 0;
- state->guest_r15 = 0;
-
-/*------------------------------------------------------------*/
-/*--- Initialise S390 miscellaneous registers ---*/
-/*------------------------------------------------------------*/
-
- state->guest_counter = 0;
- state->guest_fpc = 0;
- state->guest_IA = 0;
-
-/*------------------------------------------------------------*/
-/*--- Initialise S390 pseudo registers ---*/
-/*------------------------------------------------------------*/
+ __builtin_memset(state, 0x0, sizeof *state);
- state->guest_SYSNO = 0;
-
-/*------------------------------------------------------------*/
-/*--- Initialise generic pseudo registers ---*/
-/*------------------------------------------------------------*/
-
- state->guest_NRADDR = 0;
- state->guest_CMSTART = 0;
- state->guest_CMLEN = 0;
- state->guest_IP_AT_SYSCALL = 0;
state->guest_EMNOTE = EmNote_NONE;
- state->host_EvC_COUNTER = 0;
- state->host_EvC_FAILADDR = 0;
-
-/*------------------------------------------------------------*/
-/*--- Initialise thunk ---*/
-/*------------------------------------------------------------*/
-
- state->guest_CC_OP = 0;
- state->guest_CC_DEP1 = 0;
- state->guest_CC_DEP2 = 0;
- state->guest_CC_NDEP = 0;
-
- __builtin_memset(state->padding, 0x0, sizeof(state->padding));
}
@@ -746,7 +628,7 @@ s390_do_cu12_cu14_helper2(UInt byte1, UInt byte2, UInt byte3, UInt byte4,
UInt ij = (byte3 >> 4) & 0x3;
UInt klmn = byte3 & 0xf;
UInt opqrst = byte4 & 0x3f;
-
+
if (is_cu12) {
UInt abcd = (uvwxy - 1) & 0xf;
UInt high_surrogate = (0xd8 << 8) | (abcd << 6) | (efgh << 2) | ij;
@@ -900,6 +782,8 @@ decode_bfp_rounding_mode(UInt irrm)
case Irrm_NegINF: return S390_BFP_ROUND_NEGINF;
case Irrm_PosINF: return S390_BFP_ROUND_POSINF;
case Irrm_ZERO: return S390_BFP_ROUND_ZERO;
+ case Irrm_NEAREST_TIE_AWAY_0: return S390_BFP_ROUND_NEAREST_AWAY;
+ case Irrm_PREPARE_SHORTER: return S390_BFP_ROUND_PREPARE_SHORT;
}
vpanic("decode_bfp_rounding_mode");
}
@@ -998,6 +882,12 @@ decode_bfp_rounding_mode(UInt irrm)
({ \
UInt cc; \
switch (decode_bfp_rounding_mode(cc_dep2)) { \
+ case S390_BFP_ROUND_NEAREST_AWAY: \
+ cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,1); \
+ break; \
+ case S390_BFP_ROUND_PREPARE_SHORT: \
+ cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,3); \
+ break; \
case S390_BFP_ROUND_NEAREST_EVEN: \
cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,4); \
break; \
@@ -1032,6 +922,12 @@ decode_bfp_rounding_mode(UInt irrm)
({ \
UInt cc; \
switch (decode_bfp_rounding_mode(cc_dep2)) { \
+ case S390_BFP_ROUND_NEAREST_AWAY: \
+ cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,1); \
+ break; \
+ case S390_BFP_ROUND_PREPARE_SHORT: \
+ cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,3); \
+ break; \
case S390_BFP_ROUND_NEAREST_EVEN: \
cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,4); \
break; \
@@ -1069,6 +965,12 @@ decode_bfp_rounding_mode(UInt irrm)
s390_cc_thunk_put3 for rationale. */ \
cc_dep2 = cc_dep2 ^ cc_ndep; \
switch (decode_bfp_rounding_mode(cc_ndep)) { \
+ case S390_BFP_ROUND_NEAREST_AWAY: \
+ cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,1); \
+ break; \
+ case S390_BFP_ROUND_PREPARE_SHORT: \
+ cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,3); \
+ break; \
case S390_BFP_ROUND_NEAREST_EVEN: \
cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,4); \
break; \
@@ -1106,6 +1008,13 @@ decode_bfp_rounding_mode(UInt irrm)
s390_cc_thunk_put3 for rationale. */ \
cc_dep2 = cc_dep2 ^ cc_ndep; \
switch (decode_bfp_rounding_mode(cc_ndep)) { \
+ case S390_BFP_ROUND_NEAREST_AWAY: \
+ cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,1); \
+ break; \
+ case S390_BFP_ROUND_PREPARE_SHORT: \
+ cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,3); \
+ cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,3); \
+ break; \
case S390_BFP_ROUND_NEAREST_EVEN: \
cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,4); \
break; \
@@ -1818,9 +1727,9 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args,
# if 0
vex_printf("spec request:\n");
- vex_printf(" %s ", function_name);
+ vex_printf(" %s", function_name);
for (i = 0; i < arity; i++) {
- vex_printf(" ");
+ vex_printf(" [%u]: ", i);
ppIRExpr(args[i]);
}
vex_printf("\n");
@@ -2143,13 +2052,13 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args,
cc_dep1 = the value to be tested, ANDed with the mask
cc_dep2 = an 8-bit mask; expected to be a constant here */
if (cc_op == S390_CC_OP_TEST_UNDER_MASK_8) {
- ULong mask16;
+ ULong mask8;
if (! isC64(cc_dep2)) goto missed;
- mask16 = cc_dep2->Iex.Const.con->Ico.U64;
+ mask8 = cc_dep2->Iex.Const.con->Ico.U64;
- if (mask16 == 0) { /* cc == 0 */
+ if (mask8 == 0) { /* cc == 0 */
if (cond & 0x8) return mkU32(1);
return mkU32(0);
}
@@ -2167,6 +2076,22 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args,
if (cond == 14 || cond == 14 - 2) { /* not all bits set */
return unop(Iop_1Uto32, binop(Iop_CmpNE64, cc_dep1, cc_dep2));
}
+ if (cond == 4 || cond == 4 + 2) { /* not all zero and not all one */
+ return unop(Iop_1Uto32, binop(Iop_And1,
+ binop(Iop_CmpNE64, cc_dep1, cc_dep2),
+ binop(Iop_CmpNE64, cc_dep1, mkU64(0))));
+ }
+ if (cond == 9 || cond == 9 + 2) { /* selected bits all 1 or all 0 */
+ return unop(Iop_1Uto32, binop(Iop_Or1,
+ binop(Iop_CmpEQ64, cc_dep1, cc_dep2),
+ binop(Iop_CmpEQ64, cc_dep1, mkU64(0))));
+ }
+ if (cond == 0 || cond == 0 + 2) {
+ return mkU32(0);
+ }
+ if (cond == 15 || cond == 15 - 2) {
+ return mkU32(1);
+ }
goto missed;
}
@@ -2216,6 +2141,17 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args,
if (cond == 14) { /* not all bits set */
return unop(Iop_1Uto32, binop(Iop_CmpNE64, val, mkU64(mask)));
}
+ if (cond == 9) { /* selected bits all 1 or all 0 */
+ return unop(Iop_1Uto32, binop(Iop_Or1,
+ binop(Iop_CmpEQ64, cc_dep1, cc_dep2),
+ binop(Iop_CmpEQ64, cc_dep1, mkU64(0))));
+ }
+ if (cond == 6) { /* not all zero and not all one */
+ return unop(Iop_1Uto32, binop(Iop_And1,
+ binop(Iop_CmpNE64, cc_dep1, cc_dep2),
+ binop(Iop_CmpNE64, cc_dep1, mkU64(0))));
+ }
+ if (cond == 0) return mkU32(0);
IRExpr *masked_msb = binop(Iop_And64, val, mkU64(msb));
@@ -2260,8 +2196,22 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args,
binop(Iop_CmpEQ64, masked_msb, mkU64(0)),
binop(Iop_CmpEQ64, val, mkU64(mask))));
}
- // fixs390: handle cond = 5,6,9,10 (the missing cases)
- // vex_printf("TUM mask = 0x%llx\n", mask16);
+ if (cond == 5) { /* cc == 1 || cc == 3 */
+ /* mixed and leftmost bit zero or all bits set */
+ IRExpr *cc1 = binop(Iop_And1,
+ binop(Iop_CmpEQ64, masked_msb, mkU64(0)),
+ binop(Iop_CmpNE64, val, mkU64(0)));
+ IRExpr *cc3 = binop(Iop_CmpEQ64, val, mkU64(mask));
+ return unop(Iop_1Uto32, binop(Iop_Or1, cc1, cc3));
+ }
+ if (cond == 10) { /* cc == 0 || cc == 2 */
+ /* all bits zero or mixed and leftmost bit one */
+ IRExpr *cc0 = binop(Iop_CmpEQ64, val, mkU64(0));
+ IRExpr *cc2 = binop(Iop_And1,
+ binop(Iop_CmpNE64, masked_msb, mkU64(0)),
+ binop(Iop_CmpNE64, val, mkU64(mask)));
+ return unop(Iop_1Uto32, binop(Iop_Or1, cc0, cc2));
+ }
goto missed;
}
diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c
index 102c6a9034..d98802829d 100644
--- a/VEX/priv/guest_s390_toIR.c
+++ b/VEX/priv/guest_s390_toIR.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -507,16 +507,6 @@ call_function(IRExpr *callee_address)
dis_res->jk_StopHere = Ijk_Call;
}
-/* Function call with known target. */
-static void
-call_function_and_chase(Addr64 callee_address)
-{
- put_IA(mkaddr_expr(callee_address));
-
- dis_res->whatNext = Dis_StopHere;
- dis_res->jk_StopHere = Ijk_Call;
-}
-
/* Function return sequence */
static void
return_from_function(IRExpr *return_address)
@@ -578,18 +568,6 @@ always_goto(IRExpr *target)
dis_res->jk_StopHere = Ijk_Boring;
}
-
-/* An unconditional branch to a known target. */
-// QQQQ fixme this is now the same as always_goto
-static void
-always_goto_and_chase(Addr64 target)
-{
- put_IA(mkaddr_expr(target));
-
- dis_res->whatNext = Dis_StopHere;
- dis_res->jk_StopHere = Ijk_Boring;
-}
-
/* A system call */
static void
system_call(IRExpr *sysno)
@@ -800,7 +778,7 @@ static void
s390_print(HChar *text, IRExpr *value)
{
IRDirty *d;
-
+
d = unsafeIRDirty_0_N(0 /* regparms */, "s390_do_print", &s390_do_print,
mkIRExprVec_2(mkU64((ULong)text), value));
stmt(IRStmt_Dirty(d));
@@ -2779,8 +2757,8 @@ s390_format_E(const HChar *(*irgen)(void))
}
static void
-s390_format_MII_UPP(const HChar *(*irgen)(UChar m1, UShort i2, UShort i3),
- UChar m1, UShort i2, UShort i3)
+s390_format_MII_UPP(const HChar *(*irgen)(UChar m1, UShort i2, UInt i3),
+ UChar m1, UShort i2, UInt i3)
{
const HChar *mnm;
@@ -2788,7 +2766,7 @@ s390_format_MII_UPP(const HChar *(*irgen)(UChar m1, UShort i2, UShort i3),
if (UNLIKELY(vex_traceflags & VEX_TRACE_FE))
S390_DISASM(MNM(mnm), UINT(m1), PCREL((Int)((Short)(i2 << 4) >> 4)),
- PCREL((Int)(Short)i3));
+ PCREL((Int)(i3 << 8) >> 8));
}
static void
@@ -5799,7 +5777,7 @@ static const HChar *
s390_irgen_BRAS(UChar r1, UShort i2)
{
put_gpr_dw0(r1, mkU64(guest_IA_next_instr));
- call_function_and_chase(addr_relative(i2));
+ call_function(mkaddr_expr(addr_relative(i2)));
return "bras";
}
@@ -5808,7 +5786,7 @@ static const HChar *
s390_irgen_BRASL(UChar r1, UInt i2)
{
put_gpr_dw0(r1, mkU64(guest_IA_next_instr));
- call_function_and_chase(addr_rel_long(i2));
+ call_function(mkaddr_expr(addr_rel_long(i2)));
return "brasl";
}
@@ -5821,7 +5799,7 @@ s390_irgen_BRC(UChar m1, UShort i2)
if (m1 == 0) {
} else {
if (m1 == 15) {
- always_goto_and_chase(addr_relative(i2));
+ always_goto(mkaddr_expr(addr_relative(i2)));
} else {
assign(cond, s390_call_calculate_cond(m1));
if_condition_goto(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)),
@@ -5843,7 +5821,7 @@ s390_irgen_BRCL(UChar m1, UInt i2)
if (m1 == 0) {
} else {
if (m1 == 15) {
- always_goto_and_chase(addr_rel_long(i2));
+ always_goto(mkaddr_expr(addr_rel_long(i2)));
} else {
assign(cond, s390_call_calculate_cond(m1));
if_condition_goto(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)),
@@ -6154,7 +6132,7 @@ s390_irgen_CRJ(UChar r1, UChar r2, UShort i4, UChar m3)
if (m3 == 0) {
} else {
if (m3 == 14) {
- always_goto_and_chase(addr_relative(i4));
+ always_goto(mkaddr_expr(addr_relative(i4)));
} else {
assign(op1, get_gpr_w1(r1));
assign(op2, get_gpr_w1(r2));
@@ -6179,7 +6157,7 @@ s390_irgen_CGRJ(UChar r1, UChar r2, UShort i4, UChar m3)
if (m3 == 0) {
} else {
if (m3 == 14) {
- always_goto_and_chase(addr_relative(i4));
+ always_goto(mkaddr_expr(addr_relative(i4)));
} else {
assign(op1, get_gpr_dw0(r1));
assign(op2, get_gpr_dw0(r2));
@@ -6252,7 +6230,7 @@ s390_irgen_CIJ(UChar r1, UChar m3, UShort i4, UChar i2)
if (m3 == 0) {
} else {
if (m3 == 14) {
- always_goto_and_chase(addr_relative(i4));
+ always_goto(mkaddr_expr(addr_relative(i4)));
} else {
assign(op1, get_gpr_w1(r1));
op2 = (Int)(Char)i2;
@@ -6277,7 +6255,7 @@ s390_irgen_CGIJ(UChar r1, UChar m3, UShort i4, UChar i2)
if (m3 == 0) {
} else {
if (m3 == 14) {
- always_goto_and_chase(addr_relative(i4));
+ always_goto(mkaddr_expr(addr_relative(i4)));
} else {
assign(op1, get_gpr_dw0(r1));
op2 = (Long)(Char)i2;
@@ -7000,7 +6978,7 @@ s390_irgen_CLRJ(UChar r1, UChar r2, UShort i4, UChar m3)
if (m3 == 0) {
} else {
if (m3 == 14) {
- always_goto_and_chase(addr_relative(i4));
+ always_goto(mkaddr_expr(addr_relative(i4)));
} else {
assign(op1, get_gpr_w1(r1));
assign(op2, get_gpr_w1(r2));
@@ -7025,7 +7003,7 @@ s390_irgen_CLGRJ(UChar r1, UChar r2, UShort i4, UChar m3)
if (m3 == 0) {
} else {
if (m3 == 14) {
- always_goto_and_chase(addr_relative(i4));
+ always_goto(mkaddr_expr(addr_relative(i4)));
} else {
assign(op1, get_gpr_dw0(r1));
assign(op2, get_gpr_dw0(r2));
@@ -7098,7 +7076,7 @@ s390_irgen_CLIJ(UChar r1, UChar m3, UShort i4, UChar i2)
if (m3 == 0) {
} else {
if (m3 == 14) {
- always_goto_and_chase(addr_relative(i4));
+ always_goto(mkaddr_expr(addr_relative(i4)));
} else {
assign(op1, get_gpr_w1(r1));
op2 = (UInt)i2;
@@ -7123,7 +7101,7 @@ s390_irgen_CLGIJ(UChar r1, UChar m3, UShort i4, UChar i2)
if (m3 == 0) {
} else {
if (m3 == 14) {
- always_goto_and_chase(addr_relative(i4));
+ always_goto(mkaddr_expr(addr_relative(i4)));
} else {
assign(op1, get_gpr_dw0(r1));
op2 = (ULong)i2;
@@ -11480,13 +11458,14 @@ s390_irgen_ADB(UChar r1, IRTemp op2addr)
}
static const HChar *
-s390_irgen_CEFBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CEFBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
m3 = S390_BFP_ROUND_PER_FPC;
}
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
s390_insn_assert("cefbra", is_valid_rounding_mode(m3));
IRTemp op2 = newTemp(Ity_I32);
@@ -11499,10 +11478,11 @@ s390_irgen_CEFBRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CDFBRA(UChar m3,
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+s390_irgen_CDFBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("cdfbra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I32);
@@ -11513,13 +11493,14 @@ s390_irgen_CDFBRA(UChar m3,
}
static const HChar *
-s390_irgen_CEGBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CEGBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
m3 = S390_BFP_ROUND_PER_FPC;
}
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
s390_insn_assert("cegbra", is_valid_rounding_mode(m3));
IRTemp op2 = newTemp(Ity_I64);
@@ -11532,13 +11513,14 @@ s390_irgen_CEGBRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CDGBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CDGBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
m3 = S390_BFP_ROUND_PER_FPC;
}
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
s390_insn_assert("cdgbra", is_valid_rounding_mode(m3));
IRTemp op2 = newTemp(Ity_I64);
@@ -11551,13 +11533,14 @@ s390_irgen_CDGBRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CELFBR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CELFBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("celfbr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I32);
@@ -11569,13 +11552,14 @@ s390_irgen_CELFBR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CDLFBR(UChar m3,
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+s390_irgen_CDLFBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("cdlfbr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I32);
@@ -11586,13 +11570,14 @@ s390_irgen_CDLFBR(UChar m3,
}
static const HChar *
-s390_irgen_CELGBR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CELGBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("celgbr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I64);
@@ -11604,13 +11589,14 @@ s390_irgen_CELGBR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CDLGBR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CDLGBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("cdlgbr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I64);
@@ -11623,13 +11609,14 @@ s390_irgen_CDLGBR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CLFEBR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CLFEBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("clfebr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_I32);
@@ -11645,13 +11632,14 @@ s390_irgen_CLFEBR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CLFDBR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CLFDBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("clfdbr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_I32);
@@ -11667,13 +11655,14 @@ s390_irgen_CLFDBR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CLGEBR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CLGEBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("clgebr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_I64);
@@ -11689,13 +11678,14 @@ s390_irgen_CLGEBR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CLGDBR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CLGDBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("clgdbr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_I64);
@@ -11711,10 +11701,11 @@ s390_irgen_CLGDBR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CFEBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CFEBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("cfebra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_I32);
@@ -11730,10 +11721,11 @@ s390_irgen_CFEBRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CFDBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CFDBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("cfdbra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_I32);
@@ -11749,10 +11741,11 @@ s390_irgen_CFDBRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CGEBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CGEBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("cgebra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_I64);
@@ -11768,10 +11761,11 @@ s390_irgen_CGEBRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CGDBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CGDBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("cgdbra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_I64);
@@ -11925,13 +11919,14 @@ s390_irgen_LDEB(UChar r1, IRTemp op2addr)
}
static const HChar *
-s390_irgen_LEDBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_LEDBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
m3 = S390_BFP_ROUND_PER_FPC;
}
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
s390_insn_assert("ledbra", is_valid_rounding_mode(m3));
IRTemp op = newTemp(Ity_F64);
@@ -12184,11 +12179,13 @@ s390_irgen_CXTR(UChar r1, UChar r2)
static const HChar *
s390_irgen_CDFTR(UChar m3 __attribute__((unused)),
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+ UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
} else {
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I32);
assign(op2, get_gpr_w1(r2));
@@ -12199,12 +12196,14 @@ s390_irgen_CDFTR(UChar m3 __attribute__((unused)),
static const HChar *
s390_irgen_CXFTR(UChar m3 __attribute__((unused)),
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+ UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
} else {
s390_insn_assert("cxftr", is_valid_fpr_pair(r1));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I32);
@@ -12215,8 +12214,7 @@ s390_irgen_CXFTR(UChar m3 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CDGTRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12227,6 +12225,8 @@ s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)),
emulation_warning(EmWarn_S390X_fpext_rounding);
m3 = S390_DFP_ROUND_PER_FPC_0;
}
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
assign(op2, get_gpr_dw0(r2));
put_dpr_dw0(r1, binop(Iop_I64StoD64, mkexpr(encode_dfp_rounding_mode(m3)),
@@ -12237,12 +12237,14 @@ s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)),
static const HChar *
s390_irgen_CXGTRA(UChar m3 __attribute__((unused)),
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+ UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
} else {
s390_insn_assert("cxgtra", is_valid_fpr_pair(r1));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I64);
@@ -12257,7 +12259,7 @@ s390_irgen_CXGTRA(UChar m3 __attribute__((unused)),
static const HChar *
s390_irgen_CDLFTR(UChar m3 __attribute__((unused)),
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+ UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12265,6 +12267,8 @@ s390_irgen_CDLFTR(UChar m3 __attribute__((unused)),
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I32);
assign(op2, get_gpr_w1(r2));
@@ -12276,7 +12280,7 @@ s390_irgen_CDLFTR(UChar m3 __attribute__((unused)),
static const HChar *
s390_irgen_CXLFTR(UChar m3 __attribute__((unused)),
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+ UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12285,6 +12289,8 @@ s390_irgen_CXLFTR(UChar m3 __attribute__((unused)),
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("cxlftr", is_valid_fpr_pair(r1));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I32);
@@ -12296,8 +12302,7 @@ s390_irgen_CXLFTR(UChar m3 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CDLGTR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12305,6 +12310,8 @@ s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)),
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I64);
assign(op2, get_gpr_dw0(r2));
@@ -12318,7 +12325,7 @@ s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)),
static const HChar *
s390_irgen_CXLGTR(UChar m3 __attribute__((unused)),
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+ UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12327,6 +12334,8 @@ s390_irgen_CXLGTR(UChar m3 __attribute__((unused)),
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("cxlgtr", is_valid_fpr_pair(r1));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I64);
@@ -12338,8 +12347,7 @@ s390_irgen_CXLGTR(UChar m3 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CFDTR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12347,6 +12355,8 @@ s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)),
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_D64);
IRTemp result = newTemp(Ity_I32);
IRTemp rounding_mode = encode_dfp_rounding_mode(m3);
@@ -12362,8 +12372,7 @@ s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CFXTR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12372,6 +12381,8 @@ s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)),
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("cfxtr", is_valid_fpr_pair(r2));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_D128);
IRTemp result = newTemp(Ity_I32);
@@ -12389,8 +12400,7 @@ s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CGDTRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12398,6 +12408,8 @@ s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)),
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_D64);
IRTemp rounding_mode = encode_dfp_rounding_mode(m3);
@@ -12410,8 +12422,7 @@ s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CGXTRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CGXTRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12420,6 +12431,8 @@ s390_irgen_CGXTRA(UChar m3, UChar m4 __attribute__((unused)),
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("cgxtra", is_valid_fpr_pair(r2));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_D128);
IRTemp rounding_mode = encode_dfp_rounding_mode(m3);
@@ -12478,8 +12491,7 @@ s390_irgen_CEXTR(UChar r1, UChar r2)
}
static const HChar *
-s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CLFDTR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12487,6 +12499,8 @@ s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)),
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_D64);
IRTemp result = newTemp(Ity_I32);
IRTemp rounding_mode = encode_dfp_rounding_mode(m3);
@@ -12502,8 +12516,7 @@ s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CLFXTR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12512,6 +12525,8 @@ s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)),
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("clfxtr", is_valid_fpr_pair(r2));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_D128);
IRTemp result = newTemp(Ity_I32);
@@ -12529,8 +12544,7 @@ s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CLGDTR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12538,6 +12552,8 @@ s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)),
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_D64);
IRTemp result = newTemp(Ity_I64);
IRTemp rounding_mode = encode_dfp_rounding_mode(m3);
@@ -12553,8 +12569,7 @@ s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CLGXTR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CLGXTR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12563,6 +12578,8 @@ s390_irgen_CLGXTR(UChar m3, UChar m4 __attribute__((unused)),
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("clgxtr", is_valid_fpr_pair(r2));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_D128);
IRTemp result = newTemp(Ity_I64);
@@ -12723,11 +12740,13 @@ s390_irgen_IEXTR(UChar r3, UChar r1, UChar r2)
}
static const HChar *
-s390_irgen_LDETR(UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+s390_irgen_LDETR(UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
} else {
+ if ((m4 & 0x8) != 0)
+ emulation_warning(EmWarn_S390X_XiC_not_zero);
IRTemp op = newTemp(Ity_D32);
assign(op, get_dpr_w0(r2));
@@ -12737,11 +12756,13 @@ s390_irgen_LDETR(UChar m4 __attribute__((unused)), UChar r1, UChar r2)
}
static const HChar *
-s390_irgen_LXDTR(UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+s390_irgen_LXDTR(UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
} else {
+ if ((m4 & 0x8) != 0)
+ emulation_warning(EmWarn_S390X_XiC_not_zero);
s390_insn_assert("lxdtr", is_valid_fpr_pair(r1));
IRTemp op = newTemp(Ity_D64);
@@ -12753,8 +12774,7 @@ s390_irgen_LXDTR(UChar m4 __attribute__((unused)), UChar r1, UChar r2)
}
static const HChar *
-s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_LDXTR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12768,6 +12788,10 @@ s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)),
emulation_warning(EmWarn_S390X_fpext_rounding);
m3 = S390_DFP_ROUND_PER_FPC_0;
}
+ if ((m4 & 0x8) != 0)
+ emulation_warning(EmWarn_S390X_XiC_not_zero);
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp result = newTemp(Ity_D64);
assign(result, binop(Iop_D128toD64, mkexpr(encode_dfp_rounding_mode(m3)),
@@ -12778,8 +12802,7 @@ s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_LEDTR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_LEDTR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_dfp) {
emulation_failure(EmFail_S390X_DFP_insn);
@@ -12790,6 +12813,10 @@ s390_irgen_LEDTR(UChar m3, UChar m4 __attribute__((unused)),
emulation_warning(EmWarn_S390X_fpext_rounding);
m3 = S390_DFP_ROUND_PER_FPC_0;
}
+ if ((m4 & 0x8) != 0)
+ emulation_warning(EmWarn_S390X_XiC_not_zero);
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_D64);
assign(op, get_dpr_dw0(r2));
@@ -14877,11 +14904,12 @@ s390_irgen_KDB(UChar r1, IRTemp op2addr)
}
static const HChar *
-s390_irgen_CXFBRA(UChar m3,
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+s390_irgen_CXFBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("cxfbra", is_valid_fpr_pair(r1));
s390_insn_assert("cxfbra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I32);
@@ -14892,14 +14920,15 @@ s390_irgen_CXFBRA(UChar m3,
}
static const HChar *
-s390_irgen_CXLFBR(UChar m3,
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+s390_irgen_CXLFBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("cxlfbr", is_valid_fpr_pair(r1));
s390_insn_assert("cxlfbr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I32);
@@ -14911,11 +14940,12 @@ s390_irgen_CXLFBR(UChar m3,
static const HChar *
-s390_irgen_CXGBRA(UChar m3,
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+s390_irgen_CXGBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("cxgbra", is_valid_fpr_pair(r1));
s390_insn_assert("cxgbra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I64);
@@ -14926,14 +14956,15 @@ s390_irgen_CXGBRA(UChar m3,
}
static const HChar *
-s390_irgen_CXLGBR(UChar m3,
- UChar m4 __attribute__((unused)), UChar r1, UChar r2)
+s390_irgen_CXLGBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("cxlgbr", is_valid_fpr_pair(r1));
s390_insn_assert("cxlgbr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op2 = newTemp(Ity_I64);
@@ -14944,11 +14975,12 @@ s390_irgen_CXLGBR(UChar m3,
}
static const HChar *
-s390_irgen_CFXBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CFXBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("cfxbra", is_valid_fpr_pair(r2));
s390_insn_assert("cfxbra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F128);
IRTemp result = newTemp(Ity_I32);
@@ -14964,14 +14996,15 @@ s390_irgen_CFXBRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CLFXBR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CLFXBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("clfxbr", is_valid_fpr_pair(r2));
s390_insn_assert("clfxbr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F128);
IRTemp result = newTemp(Ity_I32);
@@ -14988,11 +15021,12 @@ s390_irgen_CLFXBR(UChar m3, UChar m4 __attribute__((unused)),
static const HChar *
-s390_irgen_CGXBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CGXBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("cgxbra", is_valid_fpr_pair(r2));
s390_insn_assert("cgxbra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F128);
IRTemp result = newTemp(Ity_I64);
@@ -15008,14 +15042,15 @@ s390_irgen_CGXBRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_CLGXBR(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_CLGXBR(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext) {
emulation_failure(EmFail_S390X_fpext);
} else {
s390_insn_assert("clgxbr", is_valid_fpr_pair(r2));
s390_insn_assert("clgxbr", is_valid_rounding_mode(m3));
+ if ((m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp op = newTemp(Ity_F128);
IRTemp result = newTemp(Ity_I64);
@@ -15134,10 +15169,11 @@ s390_irgen_LXEB(UChar r1, IRTemp op2addr)
}
static const HChar *
-s390_irgen_FIEBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_FIEBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("fiebra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp result = newTemp(Ity_F32);
@@ -15149,10 +15185,11 @@ s390_irgen_FIEBRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_FIDBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_FIDBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("fidbra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp result = newTemp(Ity_F64);
@@ -15164,12 +15201,13 @@ s390_irgen_FIDBRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_FIXBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_FIXBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
s390_insn_assert("fixbra", is_valid_fpr_pair(r1));
s390_insn_assert("fixbra", is_valid_fpr_pair(r2));
s390_insn_assert("fixbra", is_valid_rounding_mode(m3));
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
IRTemp result = newTemp(Ity_F128);
@@ -15259,13 +15297,14 @@ s390_irgen_LPXBR(UChar r1, UChar r2)
}
static const HChar *
-s390_irgen_LDXBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_LDXBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
m3 = S390_BFP_ROUND_PER_FPC;
}
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
s390_insn_assert("ldxbra", is_valid_fpr_pair(r1));
s390_insn_assert("ldxbra", is_valid_fpr_pair(r2));
s390_insn_assert("ldxbra", is_valid_rounding_mode(m3));
@@ -15280,13 +15319,14 @@ s390_irgen_LDXBRA(UChar m3, UChar m4 __attribute__((unused)),
}
static const HChar *
-s390_irgen_LEXBRA(UChar m3, UChar m4 __attribute__((unused)),
- UChar r1, UChar r2)
+s390_irgen_LEXBRA(UChar m3, UChar m4, UChar r1, UChar r2)
{
if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
m3 = S390_BFP_ROUND_PER_FPC;
}
+ if (s390_host_has_fpext && (m4 & 0x4) != 0)
+ emulation_warning(EmWarn_S390X_XxC_not_zero);
s390_insn_assert("lexbra", is_valid_fpr_pair(r1));
s390_insn_assert("lexbra", is_valid_fpr_pair(r2));
s390_insn_assert("lexbra", is_valid_rounding_mode(m3));
@@ -16110,7 +16150,7 @@ s390_irgen_TRE(UChar r1,UChar r2)
/* Load character from source string and compare with test byte */
assign(op, load(Ity_I8, mkexpr(src_addr)));
-
+
s390_cc_set_val(1);
next_insn_if(binop(Iop_CmpEQ8, mkexpr(op), mkexpr(test_byte)));
@@ -18453,25 +18493,25 @@ s390_irgen_VMH(UChar v1, UChar v2, UChar v3, UChar m4)
}
static const HChar *
-s390_irgen_VME(UChar v1, UChar v2, UChar v3, UChar m4)
+s390_irgen_VMO(UChar v1, UChar v2, UChar v3, UChar m4)
{
- s390_insn_assert("vme", m4 <= 2);
+ s390_insn_assert("vmo", m4 <= 2);
const IROp ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8, Iop_MullEven32Sx4 };
put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3)));
- return "vme";
+ return "vmo";
}
static const HChar *
-s390_irgen_VMLE(UChar v1, UChar v2, UChar v3, UChar m4)
+s390_irgen_VMLO(UChar v1, UChar v2, UChar v3, UChar m4)
{
- s390_insn_assert("vmle", m4 <= 2);
+ s390_insn_assert("vmlo", m4 <= 2);
const IROp ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8, Iop_MullEven32Ux4 };
put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3)));
- return "vmle";
+ return "vmlo";
}
static const HChar *
@@ -18875,43 +18915,43 @@ s390_irgen_VSRD(UChar v1, UChar v2, UChar v3, UChar i4)
}
static const HChar *
-s390_irgen_VMO(UChar v1, UChar v2, UChar v3, UChar m4)
+s390_irgen_VME(UChar v1, UChar v2, UChar v3, UChar m4)
{
- s390_insn_assert("vmo", m4 <= 2);
+ s390_insn_assert("vme", m4 <= 2);
const IROp ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8,
Iop_MullEven32Sx4 };
UChar shifts[] = { 8, 16, 32 };
IRExpr* result = binop(ops[m4],
- binop(Iop_ShlV128, get_vr_qw(v2), mkU8(shifts[m4])),
- binop(Iop_ShlV128, get_vr_qw(v3), mkU8(shifts[m4]))
+ binop(Iop_ShrV128, get_vr_qw(v2), mkU8(shifts[m4])),
+ binop(Iop_ShrV128, get_vr_qw(v3), mkU8(shifts[m4]))
);
put_vr_qw(v1, result);
- return "vmo";
+ return "vme";
}
static const HChar *
-s390_irgen_VMLO(UChar v1, UChar v2, UChar v3, UChar m4)
+s390_irgen_VMLE(UChar v1, UChar v2, UChar v3, UChar m4)
{
- s390_insn_assert("vmlo", m4 <= 2);
+ s390_insn_assert("vmle", m4 <= 2);
const IROp ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8,
Iop_MullEven32Ux4 };
UChar shifts[] = { 8, 16, 32 };
IRExpr* result = binop(ops[m4],
- binop(Iop_ShlV128, get_vr_qw(v2), mkU8(shifts[m4])),
- binop(Iop_ShlV128, get_vr_qw(v3), mkU8(shifts[m4]))
+ binop(Iop_ShrV128, get_vr_qw(v2), mkU8(shifts[m4])),
+ binop(Iop_ShrV128, get_vr_qw(v3), mkU8(shifts[m4]))
);
put_vr_qw(v1, result);
- return "vmlo";
+ return "vmle";
}
static const HChar *
-s390_irgen_VMAE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
+s390_irgen_VMAO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
{
- s390_insn_assert("vmae", m5 <= 2);
+ s390_insn_assert("vmao", m5 <= 2);
const IROp mul_ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8,
Iop_MullEven32Sx4 };
@@ -18921,13 +18961,13 @@ s390_irgen_VMAE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
IRExpr* result = binop(add_ops[m5], mul_result, get_vr_qw(v4));
put_vr_qw(v1, result);
- return "vmae";
+ return "vmao";
}
static const HChar *
-s390_irgen_VMALE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
+s390_irgen_VMALO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
{
- s390_insn_assert("vmale", m5 <= 2);
+ s390_insn_assert("vmalo", m5 <= 2);
const IROp mul_ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8,
Iop_MullEven32Ux4 };
@@ -18937,13 +18977,13 @@ s390_irgen_VMALE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
IRExpr* result = binop(add_ops[m5], mul_result, get_vr_qw(v4));
put_vr_qw(v1, result);
- return "vmale";
+ return "vmalo";
}
static const HChar *
-s390_irgen_VMAO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
+s390_irgen_VMAE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
{
- s390_insn_assert("vmao", m5 <= 2);
+ s390_insn_assert("vmae", m5 <= 2);
const IROp mul_ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8,
Iop_MullEven32Sx4 };
@@ -18952,18 +18992,18 @@ s390_irgen_VMAO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
IRExpr* mul_result =
binop(mul_ops[m5],
- binop(Iop_ShlV128, get_vr_qw(v2), mkU8(shifts[m5])),
- binop(Iop_ShlV128, get_vr_qw(v3), mkU8(shifts[m5])));
+ binop(Iop_ShrV128, get_vr_qw(v2), mkU8(shifts[m5])),
+ binop(Iop_ShrV128, get_vr_qw(v3), mkU8(shifts[m5])));
IRExpr* result = binop(add_ops[m5], mul_result, get_vr_qw(v4));
put_vr_qw(v1, result);
- return "vmao";
+ return "vmae";
}
static const HChar *
-s390_irgen_VMALO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
+s390_irgen_VMALE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
{
- s390_insn_assert("vmalo", m5 <= 2);
+ s390_insn_assert("vmale", m5 <= 2);
const IROp mul_ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8,
Iop_MullEven32Ux4 };
@@ -18971,16 +19011,16 @@ s390_irgen_VMALO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5)
UChar shifts[] = { 8, 16, 32 };
IRExpr* mul_result = binop(mul_ops[m5],
- binop(Iop_ShlV128,
+ binop(Iop_ShrV128,
get_vr_qw(v2), mkU8(shifts[m5])),
- binop(Iop_ShlV128,
+ binop(Iop_ShrV128,
get_vr_qw(v3), mkU8(shifts[m5]))
);
IRExpr* result = binop(add_ops[m5], mul_result, get_vr_qw(v4));
put_vr_qw(v1, result);
- return "vmalo";
+ return "vmale";
}
static const HChar *
@@ -20643,7 +20683,7 @@ s390_irgen_BPP(UChar m1, UShort i2, IRTemp op3addr)
}
static const HChar *
-s390_irgen_BPRP(UChar m1, UShort i2, UShort i3)
+s390_irgen_BPRP(UChar m1, UShort i2, UInt i3)
{
/* Treat as a no-op */
return "bprp";
@@ -20676,8 +20716,8 @@ s390_irgen_PPA(UChar m3, UChar r1, UChar r2)
static void
s390_irgen_client_request(void)
{
- if (0)
- vex_printf("%%R3 = client_request ( %%R2 )\n");
+ if (UNLIKELY(vex_traceflags & VEX_TRACE_FE))
+ vex_printf("special insn: client_request");
Addr64 next = guest_IA_curr_instr + S390_SPECIAL_OP_PREAMBLE_SIZE
+ S390_SPECIAL_OP_SIZE;
@@ -20691,8 +20731,8 @@ s390_irgen_client_request(void)
static void
s390_irgen_guest_NRADDR(void)
{
- if (0)
- vex_printf("%%R3 = guest_NRADDR\n");
+ if (UNLIKELY(vex_traceflags & VEX_TRACE_FE))
+ vex_printf("special insn: guest_NRADDR");
put_gpr_dw0(3, IRExpr_Get(S390X_GUEST_OFFSET(guest_NRADDR), Ity_I64));
}
@@ -20700,6 +20740,9 @@ s390_irgen_guest_NRADDR(void)
static void
s390_irgen_call_noredir(void)
{
+ if (UNLIKELY(vex_traceflags & VEX_TRACE_FE))
+ vex_printf("special insn: call_noredir");
+
Addr64 next = guest_IA_curr_instr + S390_SPECIAL_OP_PREAMBLE_SIZE
+ S390_SPECIAL_OP_SIZE;
@@ -20713,6 +20756,30 @@ s390_irgen_call_noredir(void)
dis_res->jk_StopHere = Ijk_NoRedir;
}
+static void
+s390_irgen_inject_ir(void)
+{
+ if (UNLIKELY(vex_traceflags & VEX_TRACE_FE))
+ vex_printf("special insn: inject_ir");
+
+ vex_inject_ir(irsb, Iend_BE);
+
+ /* Invalidate the current insn. The reason is that the IRop we're
+ injecting here can change. In which case the translation has to
+ be redone. For ease of handling, we simply invalidate all the
+ time. */
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_CMSTART),
+ mkU64(guest_IA_curr_instr)));
+ stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_CMLEN),
+ mkU64(guest_IA_next_instr - guest_IA_curr_instr)));
+ vassert(guest_IA_next_instr - guest_IA_curr_instr ==
+ S390_SPECIAL_OP_PREAMBLE_SIZE + S390_SPECIAL_OP_SIZE);
+
+ put_IA(mkaddr_expr(guest_IA_next_instr));
+ dis_res->whatNext = Dis_StopHere;
+ dis_res->jk_StopHere = Ijk_InvalICache;
+}
+
static s390_decode_t
s390_decode_2byte_and_irgen(const UChar *bytes)
{
@@ -23775,22 +23842,7 @@ s390_decode_special_and_irgen(const UChar *bytes)
} else if (bytes[0] == 0x18 && bytes[1] == 0x44 /* lr %r4, %r4 */) {
s390_irgen_call_noredir();
} else if (bytes[0] == 0x18 && bytes[1] == 0x55 /* lr %r5, %r5 */) {
- vex_inject_ir(irsb, Iend_BE);
-
- /* Invalidate the current insn. The reason is that the IRop we're
- injecting here can change. In which case the translation has to
- be redone. For ease of handling, we simply invalidate all the
- time. */
- stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_CMSTART),
- mkU64(guest_IA_curr_instr)));
- stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_CMLEN),
- mkU64(guest_IA_next_instr - guest_IA_curr_instr)));
- vassert(guest_IA_next_instr - guest_IA_curr_instr ==
- S390_SPECIAL_OP_PREAMBLE_SIZE + S390_SPECIAL_OP_SIZE);
-
- put_IA(mkaddr_expr(guest_IA_next_instr));
- dis_res->whatNext = Dis_StopHere;
- dis_res->jk_StopHere = Ijk_InvalICache;
+ s390_irgen_inject_ir();
} else {
/* We don't know what it is. */
return S390_DECODE_UNKNOWN_SPECIAL_INSN;
@@ -23891,12 +23943,10 @@ s390_decode_and_irgen(const UChar *bytes, UInt insn_length, DisResult *dres)
vpanic("s390_decode_and_irgen");
}
- vex_printf("%02x%02x", bytes[0], bytes[1]);
- if (insn_length > 2) {
- vex_printf(" %02x%02x", bytes[2], bytes[3]);
- }
- if (insn_length > 4) {
- vex_printf(" %02x%02x", bytes[4], bytes[5]);
+ for (unsigned i = 0; i < insn_length; i += 2) {
+ if (i != 0)
+ vex_printf(" ");
+ vex_printf("%02x%02x", bytes[i], bytes[i + 1]);
}
vex_printf("\n");
}
@@ -23934,8 +23984,6 @@ disInstr_S390_WRK(const UChar *insn)
dres.jk_StopHere = Ijk_INVALID;
dres.hint = Dis_HintNone;
- /* fixs390: consider chasing of conditional jumps */
-
/* Normal and special instruction handling starts here. */
if (s390_decode_and_irgen(insn, insn_length, &dres) == 0) {
/* All decode failures end up here. The decoder has already issued an
diff --git a/VEX/priv/guest_x86_defs.h b/VEX/priv/guest_x86_defs.h
index 3f86339bc1..5394e8cea1 100644
--- a/VEX/priv/guest_x86_defs.h
+++ b/VEX/priv/guest_x86_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_x86_helpers.c b/VEX/priv/guest_x86_helpers.c
index 135e997c48..90722d7673 100644
--- a/VEX/priv/guest_x86_helpers.c
+++ b/VEX/priv/guest_x86_helpers.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/guest_x86_toIR.c b/VEX/priv/guest_x86_toIR.c
index 7b31bd7695..8ecfad155c 100644
--- a/VEX/priv/guest_x86_toIR.c
+++ b/VEX/priv/guest_x86_toIR.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -3418,14 +3418,14 @@ static IRTemp gen_LZCNT ( IRType ty, IRTemp src )
binop(Iop_Shl32, mkexpr(src32),
mkU8(32 - 8 * sizeofIRType(ty))));
- // Clz32 has undefined semantics when its input is zero, so
- // special-case around that.
+ /* Guard against 0 input value. Use ClzNat32 operator for all other
+ values */
IRTemp res32 = newTemp(Ity_I32);
assign(res32,
IRExpr_ITE(
binop(Iop_CmpEQ32, mkexpr(src32x), mkU32(0)),
mkU32(8 * sizeofIRType(ty)),
- unop(Iop_Clz32, mkexpr(src32x))
+ unop(Iop_ClzNat32, mkexpr(src32x))
));
IRTemp res = newTemp(ty);
@@ -6512,18 +6512,16 @@ UInt dis_bs_E_G ( UChar sorb, Int sz, Int delta, Bool fwds )
elimination of previous stores to this field work better. */
stmt( IRStmt_Put( OFFB_CC_NDEP, mkU32(0) ));
- /* Result: iff source value is zero, we can't use
- Iop_Clz32/Iop_Ctz32 as they have no defined result in that case.
- But anyway, Intel x86 semantics say the result is undefined in
- such situations. Hence handle the zero case specially. */
+ /* Intel x86 semantics say the result is undefined iff source value is
+ zero. Hence handle the zero case specially. */
/* Bleh. What we compute:
- bsf32: if src == 0 then 0 else Ctz32(src)
- bsr32: if src == 0 then 0 else 31 - Clz32(src)
+ bsf32: if src == 0 then 0 else CtzNat32(src)
+ bsr32: if src == 0 then 0 else 31 - ClzNat32(src)
- bsf16: if src == 0 then 0 else Ctz32(16Uto32(src))
- bsr16: if src == 0 then 0 else 31 - Clz32(16Uto32(src))
+ bsf16: if src == 0 then 0 else CtzNat32(16Uto32(src))
+ bsr16: if src == 0 then 0 else 31 - ClzNat32(16Uto32(src))
First, widen src to 32 bits if it is not already.
@@ -6540,10 +6538,10 @@ UInt dis_bs_E_G ( UChar sorb, Int sz, Int delta, Bool fwds )
IRExpr_ITE(
mkexpr(srcB),
/* src != 0 */
- fwds ? unop(Iop_Ctz32, mkexpr(src32))
+ fwds ? unop(Iop_CtzNat32, mkexpr(src32))
: binop(Iop_Sub32,
mkU32(31),
- unop(Iop_Clz32, mkexpr(src32))),
+ unop(Iop_ClzNat32, mkexpr(src32))),
/* src == 0 -- leave dst unchanged */
widenUto32( getIReg( sz, gregOfRM(modrm) ) )
)
diff --git a/VEX/priv/host_amd64_defs.c b/VEX/priv/host_amd64_defs.c
index 253ed65150..d7d1ab1aad 100644
--- a/VEX/priv/host_amd64_defs.c
+++ b/VEX/priv/host_amd64_defs.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_amd64_defs.h b/VEX/priv/host_amd64_defs.h
index eae878e312..4c16db17bf 100644
--- a/VEX/priv/host_amd64_defs.h
+++ b/VEX/priv/host_amd64_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_amd64_isel.c b/VEX/priv/host_amd64_isel.c
index 21d20c77f0..6de40bccfb 100644
--- a/VEX/priv/host_amd64_isel.c
+++ b/VEX/priv/host_amd64_isel.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1628,14 +1628,19 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, const IRExpr* e )
addInstr(env, AMD64Instr_Sh64(Ash_SAR, 63, dst));
return dst;
}
- case Iop_Ctz64: {
+ case Iop_CtzNat64: {
/* Count trailing zeroes, implemented by amd64 'bsfq' */
HReg dst = newVRegI(env);
HReg src = iselIntExpr_R(env, e->Iex.Unop.arg);
addInstr(env, AMD64Instr_Bsfr64(True,src,dst));
+ /* Patch the result in case there was a 0 operand. */
+ IRExpr *cond = unop(Iop_CmpNEZ64, e->Iex.Unop.arg);
+ AMD64CondCode cc = iselCondCode_C(env, cond);
+ HReg ifz = iselIntExpr_R(env, IRExpr_Const(IRConst_U64(64)));
+ addInstr(env, AMD64Instr_CMov64(cc ^ 1, ifz, dst));
return dst;
}
- case Iop_Clz64: {
+ case Iop_ClzNat64: {
/* Count leading zeroes. Do 'bsrq' to establish the index
of the highest set bit, and subtract that value from
63. */
@@ -1647,6 +1652,11 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, const IRExpr* e )
AMD64RMI_Imm(63), dst));
addInstr(env, AMD64Instr_Alu64R(Aalu_SUB,
AMD64RMI_Reg(tmp), dst));
+ /* Patch the result in case there was a 0 operand. */
+ IRExpr *cond = unop(Iop_CmpNEZ64, e->Iex.Unop.arg);
+ AMD64CondCode cc = iselCondCode_C(env, cond);
+ HReg ifz = iselIntExpr_R(env, IRExpr_Const(IRConst_U64(64)));
+ addInstr(env, AMD64Instr_CMov64(cc ^ 1, ifz, dst));
return dst;
}
diff --git a/VEX/priv/host_arm64_defs.c b/VEX/priv/host_arm64_defs.c
index dc5d198e0d..da52748eb9 100644
--- a/VEX/priv/host_arm64_defs.c
+++ b/VEX/priv/host_arm64_defs.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_arm64_defs.h b/VEX/priv/host_arm64_defs.h
index f24a2f4ba6..4f5b1bce3e 100644
--- a/VEX/priv/host_arm64_defs.h
+++ b/VEX/priv/host_arm64_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_arm64_isel.c b/VEX/priv/host_arm64_isel.c
index 34c5265590..55d688531d 100644
--- a/VEX/priv/host_arm64_isel.c
+++ b/VEX/priv/host_arm64_isel.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -2048,7 +2048,7 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, IRExpr* e )
addInstr(env, ARM64Instr_Unary(dst, src, ARM64un_NOT));
return dst;
}
- case Iop_Clz64: {
+ case Iop_ClzNat64: {
HReg dst = newVRegI(env);
HReg src = iselIntExpr_R(env, e->Iex.Unop.arg);
addInstr(env, ARM64Instr_Unary(dst, src, ARM64un_CLZ));
diff --git a/VEX/priv/host_arm_defs.c b/VEX/priv/host_arm_defs.c
index e30336583d..39d89f7e87 100644
--- a/VEX/priv/host_arm_defs.c
+++ b/VEX/priv/host_arm_defs.c
@@ -17,7 +17,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_arm_defs.h b/VEX/priv/host_arm_defs.h
index 0f4b519515..904bd0c43c 100644
--- a/VEX/priv/host_arm_defs.h
+++ b/VEX/priv/host_arm_defs.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_arm_isel.c b/VEX/priv/host_arm_isel.c
index d19efe5c3e..90bc699fc4 100644
--- a/VEX/priv/host_arm_isel.c
+++ b/VEX/priv/host_arm_isel.c
@@ -17,7 +17,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1870,14 +1870,7 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, IRExpr* e )
//zz addInstr(env, X86Instr_Sh32(Xsh_SAR, 31, dst));
//zz return dst;
//zz }
-//zz case Iop_Ctz32: {
-//zz /* Count trailing zeroes, implemented by x86 'bsfl' */
-//zz HReg dst = newVRegI(env);
-//zz HReg src = iselIntExpr_R(env, e->Iex.Unop.arg);
-//zz addInstr(env, X86Instr_Bsfr32(True,src,dst));
-//zz return dst;
-//zz }
- case Iop_Clz32: {
+ case Iop_ClzNat32: {
/* Count leading zeroes; easy on ARM. */
HReg dst = newVRegI(env);
HReg src = iselIntExpr_R(env, e->Iex.Unop.arg);
diff --git a/VEX/priv/host_generic_reg_alloc2.c b/VEX/priv/host_generic_reg_alloc2.c
index b731720f22..ee1a68d4f5 100644
--- a/VEX/priv/host_generic_reg_alloc2.c
+++ b/VEX/priv/host_generic_reg_alloc2.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_generic_reg_alloc3.c b/VEX/priv/host_generic_reg_alloc3.c
index b7446921a4..0dc39fea38 100644
--- a/VEX/priv/host_generic_reg_alloc3.c
+++ b/VEX/priv/host_generic_reg_alloc3.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_generic_regs.c b/VEX/priv/host_generic_regs.c
index 803950a5d7..b22d2a5af3 100644
--- a/VEX/priv/host_generic_regs.c
+++ b/VEX/priv/host_generic_regs.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_generic_regs.h b/VEX/priv/host_generic_regs.h
index 2b369f2ebd..c5e9a93b33 100644
--- a/VEX/priv/host_generic_regs.h
+++ b/VEX/priv/host_generic_regs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_generic_simd128.c b/VEX/priv/host_generic_simd128.c
index f895de46f4..b656aef50c 100644
--- a/VEX/priv/host_generic_simd128.c
+++ b/VEX/priv/host_generic_simd128.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_generic_simd128.h b/VEX/priv/host_generic_simd128.h
index 842385f738..9e73e45a9a 100644
--- a/VEX/priv/host_generic_simd128.h
+++ b/VEX/priv/host_generic_simd128.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_generic_simd256.c b/VEX/priv/host_generic_simd256.c
index f6b4577476..9a00e37baa 100644
--- a/VEX/priv/host_generic_simd256.c
+++ b/VEX/priv/host_generic_simd256.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_generic_simd256.h b/VEX/priv/host_generic_simd256.h
index 36e599301c..4a4d2d6584 100644
--- a/VEX/priv/host_generic_simd256.h
+++ b/VEX/priv/host_generic_simd256.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_generic_simd64.c b/VEX/priv/host_generic_simd64.c
index 523a5cd1c6..673e687c2b 100644
--- a/VEX/priv/host_generic_simd64.c
+++ b/VEX/priv/host_generic_simd64.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_generic_simd64.h b/VEX/priv/host_generic_simd64.h
index 0df3fccff8..db16b3ced2 100644
--- a/VEX/priv/host_generic_simd64.h
+++ b/VEX/priv/host_generic_simd64.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_mips_defs.c b/VEX/priv/host_mips_defs.c
index 7641ccf62e..ad92c055c9 100644
--- a/VEX/priv/host_mips_defs.c
+++ b/VEX/priv/host_mips_defs.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_mips_defs.h b/VEX/priv/host_mips_defs.h
index 96ab2f9a45..423f68ea09 100644
--- a/VEX/priv/host_mips_defs.h
+++ b/VEX/priv/host_mips_defs.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_mips_isel.c b/VEX/priv/host_mips_isel.c
index 33e4f52169..7d57078ba8 100644
--- a/VEX/priv/host_mips_isel.c
+++ b/VEX/priv/host_mips_isel.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -2155,13 +2155,13 @@ static HReg iselWordExpr_R_wrk(ISelEnv * env, IRExpr * e)
return r_dst;
}
- case Iop_Clz64:
+ case Iop_ClzNat64:
vassert(mode64);
/* fallthrough */
- case Iop_Clz32: {
+ case Iop_ClzNat32: {
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
- MIPSUnaryOp op = (op_unop == Iop_Clz64) ? Mun_DCLZ : Mun_CLZ;
+ MIPSUnaryOp op = (op_unop == Iop_ClzNat64) ? Mun_DCLZ : Mun_CLZ;
addInstr(env, MIPSInstr_Unary(op, r_dst, r_src));
return r_dst;
}
diff --git a/VEX/priv/host_nanomips_defs.c b/VEX/priv/host_nanomips_defs.c
index b356d09d81..3e91c904f6 100644
--- a/VEX/priv/host_nanomips_defs.c
+++ b/VEX/priv/host_nanomips_defs.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -19,9 +19,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
+ along with this program; if not, see .
The GNU General Public License is contained in the file COPYING.
*/
diff --git a/VEX/priv/host_nanomips_defs.h b/VEX/priv/host_nanomips_defs.h
index 87219dab53..beb8084797 100644
--- a/VEX/priv/host_nanomips_defs.h
+++ b/VEX/priv/host_nanomips_defs.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -20,9 +20,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
+ along with this program; if not, see .
The GNU General Public License is contained in the file COPYING.
*/
diff --git a/VEX/priv/host_nanomips_isel.c b/VEX/priv/host_nanomips_isel.c
index c4a8f4fe3c..65998fd8aa 100644
--- a/VEX/priv/host_nanomips_isel.c
+++ b/VEX/priv/host_nanomips_isel.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -20,9 +20,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
+ along with this program; if not, see .
The GNU General Public License is contained in the file COPYING.
*/
@@ -815,7 +813,7 @@ static HReg iselWordExpr_R_wrk(ISelEnv * env, IRExpr * e)
return r_dst;
}
- case Iop_Clz32: {
+ case Iop_ClzNat32: {
HReg r_dst = newVRegI(env);
HReg r_src = iselWordExpr_R(env, e->Iex.Unop.arg);
addInstr(env, NANOMIPSInstr_Unary(NMun_CLZ, r_dst, r_src));
diff --git a/VEX/priv/host_ppc_defs.c b/VEX/priv/host_ppc_defs.c
index d4d948a3ba..dfefcb3fd4 100644
--- a/VEX/priv/host_ppc_defs.c
+++ b/VEX/priv/host_ppc_defs.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_ppc_defs.h b/VEX/priv/host_ppc_defs.h
index 39dca08a2e..c57afd50b5 100644
--- a/VEX/priv/host_ppc_defs.h
+++ b/VEX/priv/host_ppc_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_ppc_isel.c b/VEX/priv/host_ppc_isel.c
index ff87ae7ed6..ea7ff89a9d 100644
--- a/VEX/priv/host_ppc_isel.c
+++ b/VEX/priv/host_ppc_isel.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -2069,14 +2069,14 @@ static HReg iselWordExpr_R_wrk ( ISelEnv* env, const IRExpr* e,
}
break;
- case Iop_Clz32: case Iop_ClzNat32:
- case Iop_Clz64: case Iop_ClzNat64: {
+ case Iop_ClzNat32:
+ case Iop_ClzNat64: {
// cntlz is available even in the most basic (earliest) ppc
// variants, so it's safe to generate it unconditionally.
HReg r_src, r_dst;
- PPCUnaryOp op_clz = (op_unop == Iop_Clz32 || op_unop == Iop_ClzNat32)
+ PPCUnaryOp op_clz = (op_unop == Iop_ClzNat32)
? Pun_CLZ32 : Pun_CLZ64;
- if ((op_unop == Iop_Clz64 || op_unop == Iop_ClzNat64) && !mode64)
+ if ((op_unop == Iop_ClzNat64) && !mode64)
goto irreducible;
/* Count leading zeroes. */
r_dst = newVRegI(env);
@@ -2085,9 +2085,7 @@ static HReg iselWordExpr_R_wrk ( ISelEnv* env, const IRExpr* e,
return r_dst;
}
- //case Iop_Ctz32:
case Iop_CtzNat32:
- //case Iop_Ctz64:
case Iop_CtzNat64:
{
// Generate code using Clz, because we can't assume the host has
@@ -2095,7 +2093,7 @@ static HReg iselWordExpr_R_wrk ( ISelEnv* env, const IRExpr* e,
// creating a Ctz in ir_opt.c from smaller fragments.
PPCUnaryOp op_clz = Pun_CLZ64;
Int WS = 64;
- if (op_unop == Iop_Ctz32 || op_unop == Iop_CtzNat32) {
+ if (op_unop == Iop_CtzNat32) {
op_clz = Pun_CLZ32;
WS = 32;
}
diff --git a/VEX/priv/host_riscv64_defs.c b/VEX/priv/host_riscv64_defs.c
index 149483cd36..152d4ae92c 100644
--- a/VEX/priv/host_riscv64_defs.c
+++ b/VEX/priv/host_riscv64_defs.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_riscv64_defs.h b/VEX/priv/host_riscv64_defs.h
index 16c524cab3..7a97f90ef4 100644
--- a/VEX/priv/host_riscv64_defs.h
+++ b/VEX/priv/host_riscv64_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_riscv64_isel.c b/VEX/priv/host_riscv64_isel.c
index fd63cfc77d..b174d260d0 100644
--- a/VEX/priv/host_riscv64_isel.c
+++ b/VEX/priv/host_riscv64_isel.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c
index e26ea09d48..9389364da8 100644
--- a/VEX/priv/host_s390_defs.c
+++ b/VEX/priv/host_s390_defs.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1118,8 +1118,10 @@ s390_insn_map_regs(HRegRemap *m, s390_insn *insn)
break;
case S390_INSN_COND_MOVE:
- insn->variant.cond_move.dst = lookupHRegRemap(m, insn->variant.cond_move.dst);
- s390_opnd_RMI_map_regs(m, &insn->variant.cond_move.src);
+ if (insn->variant.cond_move.cond != S390_CC_NEVER) {
+ insn->variant.cond_move.dst = lookupHRegRemap(m, insn->variant.cond_move.dst);
+ s390_opnd_RMI_map_regs(m, &insn->variant.cond_move.src);
+ }
break;
case S390_INSN_LOAD_IMMEDIATE:
@@ -5813,7 +5815,6 @@ static UChar*
s390_emit_VCEQ(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4)
{
if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM))
- /* fixs390: m5 = 0 --> condition code not set */
S390_DISASM(XMNM("vceq", vch_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(0));
return emit_VRR_VVVM(p, 0xE700000000f8ULL, v1, v2, v3, m4);
@@ -5844,7 +5845,6 @@ static UChar *
s390_emit_VPKS(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4)
{
if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM))
- /* fixs390: m5 = 0 --> condition code not set */
S390_DISASM(XMNM("vpks", vch_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(0));
return emit_VRR_VVVM(p, 0xE70000000097ULL, v1, v2, v3, m4);
@@ -5855,7 +5855,6 @@ static UChar *
s390_emit_VPKLS(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4)
{
if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM))
- /* fixs390: m5 = 0 --> condition code not set */
S390_DISASM(XMNM("vpkls", vch_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(0));
return emit_VRR_VVVM(p, 0xE70000000095ULL, v1, v2, v3, m4);
@@ -5952,7 +5951,6 @@ static UChar *
s390_emit_VCH(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4)
{
if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM))
- /* fixs390: m5 = 0 --> condition code not set */
S390_DISASM(XMNM("vch", vch_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(0));
return emit_VRR_VVVM(p, 0xE700000000fbULL, v1, v2, v3, m4);
@@ -5962,7 +5960,6 @@ static UChar *
s390_emit_VCHL(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4)
{
if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM))
- /* fixs390: m5 = 0 --> condition code not set */
S390_DISASM(XMNM("vchl", vch_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(0));
return emit_VRR_VVVM(p, 0xE700000000f9ULL, v1, v2, v3, m4);
@@ -6086,21 +6083,21 @@ s390_emit_VML(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4)
}
static UChar *
-s390_emit_VME(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4)
+s390_emit_VMO(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4)
{
if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM))
- S390_DISASM(XMNM("vme", va_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4));
+ S390_DISASM(XMNM("vmo", va_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4));
- return emit_VRR_VVVM(p, 0xE700000000a6ULL, v1, v2, v3, m4);
+ return emit_VRR_VVVM(p, 0xE700000000a7ULL, v1, v2, v3, m4);
}
static UChar *
-s390_emit_VMLE(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4)
+s390_emit_VMLO(UChar *p, UChar v1, UChar v2, UChar v3, UChar m4)
{
if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM))
- S390_DISASM(XMNM("vmle", va_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4));
+ S390_DISASM(XMNM("vmlo", va_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4));
- return emit_VRR_VVVM(p, 0xE700000000a4ULL, v1, v2, v3, m4);
+ return emit_VRR_VVVM(p, 0xE700000000a5ULL, v1, v2, v3, m4);
}
static UChar *
@@ -8211,8 +8208,8 @@ s390_insn_as_string(const s390_insn *insn)
case S390_VEC_INT_MUL_HIGHS: op = "v-vintmulhis"; break;
case S390_VEC_INT_MUL_HIGHU: op = "v-vintmulhiu"; break;
case S390_VEC_INT_MUL_LOW: op = "v-vintmullo"; break;
- case S390_VEC_INT_MUL_EVENS: op = "v-vintmulevens"; break;
- case S390_VEC_INT_MUL_EVENU: op = "v-vintmulevenu"; break;
+ case S390_VEC_INT_MUL_ODDS: op = "v-vintmulodds"; break;
+ case S390_VEC_INT_MUL_ODDU: op = "v-vintmuloddu"; break;
case S390_VEC_ELEM_SHL_V: op = "v-velemshl"; break;
case S390_VEC_ELEM_SHRA_V: op = "v-vshrav"; break;
case S390_VEC_ELEM_SHRL_V: op = "v-vshrlv"; break;
@@ -9261,7 +9258,10 @@ s390_widen_emit(UChar *buf, const s390_insn *insn, UInt from_size,
case 2:
if (insn->size == 4) { /* 16 --> 32 */
- return s390_emit_LHI(buf, r1, value);
+ if (sign_extend)
+ return s390_emit_LHI(buf, r1, value);
+ else
+ return s390_emit_IILF(buf, r1, value);
}
if (insn->size == 8) { /* 16 --> 64 */
if (sign_extend)
@@ -11523,10 +11523,10 @@ s390_insn_vec_binop_emit(UChar *buf, const s390_insn *insn)
return s390_emit_VMLH(buf, v1, v2, v3, s390_getM_from_size(size));
case S390_VEC_INT_MUL_LOW:
return s390_emit_VML(buf, v1, v2, v3, s390_getM_from_size(size));
- case S390_VEC_INT_MUL_EVENS:
- return s390_emit_VME(buf, v1, v2, v3, s390_getM_from_size(size));
- case S390_VEC_INT_MUL_EVENU:
- return s390_emit_VMLE(buf, v1, v2, v3, s390_getM_from_size(size));
+ case S390_VEC_INT_MUL_ODDS:
+ return s390_emit_VMO(buf, v1, v2, v3, s390_getM_from_size(size));
+ case S390_VEC_INT_MUL_ODDU:
+ return s390_emit_VMLO(buf, v1, v2, v3, s390_getM_from_size(size));
case S390_VEC_ELEM_SHL_V:
return s390_emit_VESLV(buf, v1, v2, v3, s390_getM_from_size(size));
case S390_VEC_ELEM_SHRA_V:
diff --git a/VEX/priv/host_s390_defs.h b/VEX/priv/host_s390_defs.h
index dcdb6713e9..3de079e838 100644
--- a/VEX/priv/host_s390_defs.h
+++ b/VEX/priv/host_s390_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -100,13 +100,10 @@ typedef enum {
} s390_opnd_t;
-/* Naming convention for operand locations:
- R - GPR
- I - immediate value
- M - memory (any Amode may be used)
-*/
-
-/* An operand that is either in a GPR or is addressable via a BX20 amode */
+/* An operand that is either
+ R located in a GPR or
+ M located in memory and addressable via any amode or
+ I an immediate integer constant */
typedef struct {
s390_opnd_t tag;
union {
@@ -385,8 +382,8 @@ typedef enum {
S390_VEC_INT_MUL_HIGHS,
S390_VEC_INT_MUL_HIGHU,
S390_VEC_INT_MUL_LOW,
- S390_VEC_INT_MUL_EVENS,
- S390_VEC_INT_MUL_EVENU,
+ S390_VEC_INT_MUL_ODDS,
+ S390_VEC_INT_MUL_ODDU,
S390_VEC_ELEM_SHL_V,
S390_VEC_ELEM_SHRA_V,
S390_VEC_ELEM_SHRL_V,
@@ -706,8 +703,18 @@ typedef struct {
s390_amode *guest_IA;
} xassisted;
struct {
- /* fixs390: I don't think these are really needed
- as the gsp and the offset are fixed no ? */
+ /* Note: these fields are needed. Here's why:
+ These fields are amodes for accessing the host_EvC_COUNTER and
+ host_EvC_FAILADDR fields in the guest state.
+ When guest and host architecture are both s390x then we know that
+ the displacement in evcheck::counter is
+ offsetof(VexGuestS390XState, host_EvC_COUNTER) and likewise for
+ the displacement in evcheck::fail_addr. There would be no point
+ to build these amodes in the first place because we could just
+ hardwire the displacements in s390_insn_evcheck_emit.
+ However in a multi-arch setting the amodes point to the
+ host_EvC_COUNTER/FAILADDR fields in a *different* guest state and
+ those offsets are not known. So we do need to build the amodes. */
s390_amode *counter; /* dispatch counter */
s390_amode *fail_addr;
} evcheck;
diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c
index 2b075c9300..8f87cc2394 100644
--- a/VEX/priv/host_s390_isel.c
+++ b/VEX/priv/host_s390_isel.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1243,10 +1243,17 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr)
s390_opnd_RMI op2, value, opnd;
s390_insn *insn;
Bool is_commutative, is_signed_multiply, is_signed_divide;
+ Bool is_single_multiply = False;
is_commutative = True;
switch (expr->Iex.Binop.op) {
+ case Iop_Mul8:
+ case Iop_Mul16:
+ case Iop_Mul32:
+ case Iop_Mul64:
+ is_single_multiply = True;
+ /* fall through */
case Iop_MullU8:
case Iop_MullU16:
case Iop_MullU32:
@@ -1254,14 +1261,24 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr)
goto do_multiply;
case Iop_MullS8:
+ arg1 = IRExpr_Unop(Iop_8Sto32, arg1);
+ arg2 = IRExpr_Unop(Iop_8Sto32, arg2);
+ is_signed_multiply = True;
+ goto do_multiply;
+
case Iop_MullS16:
+ arg1 = IRExpr_Unop(Iop_16Sto32, arg1);
+ arg2 = IRExpr_Unop(Iop_16Sto32, arg2);
+ is_signed_multiply = True;
+ goto do_multiply;
+
case Iop_MullS32:
is_signed_multiply = True;
goto do_multiply;
do_multiply: {
HReg r10, r11;
- UInt arg_size = size / 2;
+ UInt arg_size = is_single_multiply ? size : size / 2;
order_commutative_operands(arg1, arg2);
@@ -1278,9 +1295,22 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr)
/* Multiply */
addInstr(env, s390_insn_mul(arg_size, r10, r11, op2, is_signed_multiply));
+ res = newVRegI(env);
+ if (arg_size == 1 || arg_size == 2) {
+ /* For 8-bit and 16-bit multiplication the result is in
+ r11[32:63] */
+ addInstr(env, s390_insn_move(size, res, r11));
+ return res;
+ }
+
+ /* For Iop_Mul64 the result is in r11[0:63] */
+ if (expr->Iex.Binop.op == Iop_Mul64) {
+ addInstr(env, s390_insn_move(size, res, r11));
+ return res;
+ }
+
/* The result is in registers r10 and r11. Combine them into a SIZE-bit
value into the destination register. */
- res = newVRegI(env);
addInstr(env, s390_insn_move(arg_size, res, r10));
value = s390_opnd_imm(arg_size * 8);
addInstr(env, s390_insn_alu(size, S390_ALU_LSH, res, value));
@@ -3621,6 +3651,7 @@ s390_isel_cc(ISelEnv *env, IRExpr *cond)
case Iop_CmpNE8:
case Iop_CasCmpNE8:
+ case Iop_ExpCmpNE8:
op = S390_ZERO_EXTEND_8;
result = S390_CC_NE;
goto do_compare_ze;
@@ -3633,6 +3664,7 @@ s390_isel_cc(ISelEnv *env, IRExpr *cond)
case Iop_CmpNE16:
case Iop_CasCmpNE16:
+ case Iop_ExpCmpNE16:
op = S390_ZERO_EXTEND_16;
result = S390_CC_NE;
goto do_compare_ze;
@@ -4471,27 +4503,27 @@ s390_isel_vec_expr_wrk(ISelEnv *env, IRExpr *expr)
case Iop_MullEven8Sx16:
size = 1;
- vec_binop = S390_VEC_INT_MUL_EVENS;
+ vec_binop = S390_VEC_INT_MUL_ODDS;
goto Iop_VV_wrk;
case Iop_MullEven8Ux16:
size = 1;
- vec_binop = S390_VEC_INT_MUL_EVENU;
+ vec_binop = S390_VEC_INT_MUL_ODDU;
goto Iop_VV_wrk;
case Iop_MullEven16Sx8:
size = 2;
- vec_binop = S390_VEC_INT_MUL_EVENS;
+ vec_binop = S390_VEC_INT_MUL_ODDS;
goto Iop_VV_wrk;
case Iop_MullEven16Ux8:
size = 2;
- vec_binop = S390_VEC_INT_MUL_EVENU;
+ vec_binop = S390_VEC_INT_MUL_ODDU;
goto Iop_VV_wrk;
case Iop_MullEven32Sx4:
size = 4;
- vec_binop = S390_VEC_INT_MUL_EVENS;
+ vec_binop = S390_VEC_INT_MUL_ODDS;
goto Iop_VV_wrk;
case Iop_MullEven32Ux4:
size = 4;
- vec_binop = S390_VEC_INT_MUL_EVENU;
+ vec_binop = S390_VEC_INT_MUL_ODDU;
goto Iop_VV_wrk;
case Iop_Shl8x16:
diff --git a/VEX/priv/host_x86_defs.c b/VEX/priv/host_x86_defs.c
index 5497efdf7a..200c122fd8 100644
--- a/VEX/priv/host_x86_defs.c
+++ b/VEX/priv/host_x86_defs.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_x86_defs.h b/VEX/priv/host_x86_defs.h
index 2455b3245e..ecd74e6a53 100644
--- a/VEX/priv/host_x86_defs.h
+++ b/VEX/priv/host_x86_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/host_x86_isel.c b/VEX/priv/host_x86_isel.c
index e89b145327..6559ad51de 100644
--- a/VEX/priv/host_x86_isel.c
+++ b/VEX/priv/host_x86_isel.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1306,14 +1306,19 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, const IRExpr* e )
addInstr(env, X86Instr_Sh32(Xsh_SAR, 31, dst));
return dst;
}
- case Iop_Ctz32: {
+ case Iop_CtzNat32: {
/* Count trailing zeroes, implemented by x86 'bsfl' */
HReg dst = newVRegI(env);
HReg src = iselIntExpr_R(env, e->Iex.Unop.arg);
addInstr(env, X86Instr_Bsfr32(True,src,dst));
+ /* Patch the result in case there was a 0 operand. */
+ IRExpr *cond = unop(Iop_CmpNEZ32, e->Iex.Unop.arg);
+ X86CondCode cc = iselCondCode(env, cond);
+ X86RM *ifz = iselIntExpr_RM(env, IRExpr_Const(IRConst_U32(32)));
+ addInstr(env, X86Instr_CMov32(cc ^ 1, ifz, dst));
return dst;
}
- case Iop_Clz32: {
+ case Iop_ClzNat32: {
/* Count leading zeroes. Do 'bsrl' to establish the index
of the highest set bit, and subtract that value from
31. */
@@ -1325,6 +1330,11 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, const IRExpr* e )
X86RMI_Imm(31), dst));
addInstr(env, X86Instr_Alu32R(Xalu_SUB,
X86RMI_Reg(tmp), dst));
+ /* Patch the result in case there was a 0 operand. */
+ IRExpr *cond = unop(Iop_CmpNEZ32, e->Iex.Unop.arg);
+ X86CondCode cc = iselCondCode(env, cond);
+ X86RM *ifz = iselIntExpr_RM(env, IRExpr_Const(IRConst_U32(32)));
+ addInstr(env, X86Instr_CMov32(cc ^ 1, ifz, dst));
return dst;
}
diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c
index 9e7fbf920e..b178912aa0 100644
--- a/VEX/priv/ir_defs.c
+++ b/VEX/priv/ir_defs.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -190,11 +190,6 @@ void ppIROp ( IROp op )
case Iop_MullU32: vex_printf("MullU32"); return;
case Iop_MullU64: vex_printf("MullU64"); return;
- case Iop_Clz64: vex_printf("Clz64"); return;
- case Iop_Clz32: vex_printf("Clz32"); return;
- case Iop_Ctz64: vex_printf("Ctz64"); return;
- case Iop_Ctz32: vex_printf("Ctz32"); return;
-
case Iop_ClzNat64: vex_printf("ClzNat64"); return;
case Iop_ClzNat32: vex_printf("ClzNat32"); return;
case Iop_CtzNat64: vex_printf("CtzNat64"); return;
@@ -1416,7 +1411,6 @@ Bool primopMightTrap ( IROp op )
case Iop_ExpCmpNE16: case Iop_ExpCmpNE32: case Iop_ExpCmpNE64:
case Iop_MullS8: case Iop_MullS16: case Iop_MullS32: case Iop_MullS64:
case Iop_MullU8: case Iop_MullU16: case Iop_MullU32: case Iop_MullU64:
- case Iop_Clz64: case Iop_Clz32: case Iop_Ctz64: case Iop_Ctz32:
case Iop_ClzNat64: case Iop_ClzNat32: case Iop_CtzNat64: case Iop_CtzNat32:
case Iop_PopCount64: case Iop_PopCount32:
case Iop_CmpLT32S: case Iop_CmpLT64S: case Iop_CmpLE32S: case Iop_CmpLE64S:
@@ -2357,20 +2351,23 @@ IRRegArray* mkIRRegArray ( Int base, IRType elemTy, Int nElems )
/* Constructors -- IRExpr */
-IRExpr* IRExpr_Binder ( Int binder ) {
+IRExpr* IRExpr_Binder ( Int binder )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
e->tag = Iex_Binder;
e->Iex.Binder.binder = binder;
return e;
}
-IRExpr* IRExpr_Get ( Int off, IRType ty ) {
+IRExpr* IRExpr_Get ( Int off, IRType ty )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
e->tag = Iex_Get;
e->Iex.Get.offset = off;
e->Iex.Get.ty = ty;
return e;
}
-IRExpr* IRExpr_GetI ( IRRegArray* descr, IRExpr* ix, Int bias ) {
+IRExpr* IRExpr_GetI ( IRRegArray* descr, IRExpr* ix, Int bias )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
e->tag = Iex_GetI;
e->Iex.GetI.descr = descr;
@@ -2378,14 +2375,16 @@ IRExpr* IRExpr_GetI ( IRRegArray* descr, IRExpr* ix, Int bias ) {
e->Iex.GetI.bias = bias;
return e;
}
-IRExpr* IRExpr_RdTmp ( IRTemp tmp ) {
+IRExpr* IRExpr_RdTmp ( IRTemp tmp )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
e->tag = Iex_RdTmp;
e->Iex.RdTmp.tmp = tmp;
return e;
}
IRExpr* IRExpr_Qop ( IROp op, IRExpr* arg1, IRExpr* arg2,
- IRExpr* arg3, IRExpr* arg4 ) {
+ IRExpr* arg3, IRExpr* arg4 )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
IRQop* qop = LibVEX_Alloc_inline(sizeof(IRQop));
qop->op = op;
@@ -2398,7 +2397,8 @@ IRExpr* IRExpr_Qop ( IROp op, IRExpr* arg1, IRExpr* arg2,
return e;
}
IRExpr* IRExpr_Triop ( IROp op, IRExpr* arg1,
- IRExpr* arg2, IRExpr* arg3 ) {
+ IRExpr* arg2, IRExpr* arg3 )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
IRTriop* triop = LibVEX_Alloc_inline(sizeof(IRTriop));
triop->op = op;
@@ -2409,7 +2409,8 @@ IRExpr* IRExpr_Triop ( IROp op, IRExpr* arg1,
e->Iex.Triop.details = triop;
return e;
}
-IRExpr* IRExpr_Binop ( IROp op, IRExpr* arg1, IRExpr* arg2 ) {
+IRExpr* IRExpr_Binop ( IROp op, IRExpr* arg1, IRExpr* arg2 )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
e->tag = Iex_Binop;
e->Iex.Binop.op = op;
@@ -2424,7 +2425,8 @@ IRExpr* IRExpr_Unop ( IROp op, IRExpr* arg ) {
e->Iex.Unop.arg = arg;
return e;
}
-IRExpr* IRExpr_Load ( IREndness end, IRType ty, IRExpr* addr ) {
+IRExpr* IRExpr_Load ( IREndness end, IRType ty, IRExpr* addr )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
e->tag = Iex_Load;
e->Iex.Load.end = end;
@@ -2433,13 +2435,15 @@ IRExpr* IRExpr_Load ( IREndness end, IRType ty, IRExpr* addr ) {
vassert(end == Iend_LE || end == Iend_BE);
return e;
}
-IRExpr* IRExpr_Const ( IRConst* con ) {
+IRExpr* IRExpr_Const ( IRConst* con )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
e->tag = Iex_Const;
e->Iex.Const.con = con;
return e;
}
-IRExpr* IRExpr_CCall ( IRCallee* cee, IRType retty, IRExpr** args ) {
+IRExpr* IRExpr_CCall ( IRCallee* cee, IRType retty, IRExpr** args )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
e->tag = Iex_CCall;
e->Iex.CCall.cee = cee;
@@ -2447,7 +2451,8 @@ IRExpr* IRExpr_CCall ( IRCallee* cee, IRType retty, IRExpr** args ) {
e->Iex.CCall.args = args;
return e;
}
-IRExpr* IRExpr_ITE ( IRExpr* cond, IRExpr* iftrue, IRExpr* iffalse ) {
+IRExpr* IRExpr_ITE ( IRExpr* cond, IRExpr* iftrue, IRExpr* iffalse )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
e->tag = Iex_ITE;
e->Iex.ITE.cond = cond;
@@ -2455,12 +2460,14 @@ IRExpr* IRExpr_ITE ( IRExpr* cond, IRExpr* iftrue, IRExpr* iffalse ) {
e->Iex.ITE.iffalse = iffalse;
return e;
}
-IRExpr* IRExpr_VECRET ( void ) {
+IRExpr* IRExpr_VECRET ( void )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
e->tag = Iex_VECRET;
return e;
}
-IRExpr* IRExpr_GSPTR ( void ) {
+IRExpr* IRExpr_GSPTR ( void )
+{
IRExpr* e = LibVEX_Alloc_inline(sizeof(IRExpr));
e->tag = Iex_GSPTR;
return e;
@@ -2470,25 +2477,29 @@ IRExpr* IRExpr_GSPTR ( void ) {
/* Constructors for NULL-terminated IRExpr expression vectors,
suitable for use as arg lists in clean/dirty helper calls. */
-IRExpr** mkIRExprVec_0 ( void ) {
+IRExpr** mkIRExprVec_0 ( void )
+{
IRExpr** vec = LibVEX_Alloc_inline(1 * sizeof(IRExpr*));
vec[0] = NULL;
return vec;
}
-IRExpr** mkIRExprVec_1 ( IRExpr* arg1 ) {
+IRExpr** mkIRExprVec_1 ( IRExpr* arg1 )
+{
IRExpr** vec = LibVEX_Alloc_inline(2 * sizeof(IRExpr*));
vec[0] = arg1;
vec[1] = NULL;
return vec;
}
-IRExpr** mkIRExprVec_2 ( IRExpr* arg1, IRExpr* arg2 ) {
+IRExpr** mkIRExprVec_2 ( IRExpr* arg1, IRExpr* arg2 )
+{
IRExpr** vec = LibVEX_Alloc_inline(3 * sizeof(IRExpr*));
vec[0] = arg1;
vec[1] = arg2;
vec[2] = NULL;
return vec;
}
-IRExpr** mkIRExprVec_3 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3 ) {
+IRExpr** mkIRExprVec_3 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3 )
+{
IRExpr** vec = LibVEX_Alloc_inline(4 * sizeof(IRExpr*));
vec[0] = arg1;
vec[1] = arg2;
@@ -2497,7 +2508,8 @@ IRExpr** mkIRExprVec_3 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3 ) {
return vec;
}
IRExpr** mkIRExprVec_4 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
- IRExpr* arg4 ) {
+ IRExpr* arg4 )
+{
IRExpr** vec = LibVEX_Alloc_inline(5 * sizeof(IRExpr*));
vec[0] = arg1;
vec[1] = arg2;
@@ -2507,7 +2519,8 @@ IRExpr** mkIRExprVec_4 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
return vec;
}
IRExpr** mkIRExprVec_5 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
- IRExpr* arg4, IRExpr* arg5 ) {
+ IRExpr* arg4, IRExpr* arg5 )
+{
IRExpr** vec = LibVEX_Alloc_inline(6 * sizeof(IRExpr*));
vec[0] = arg1;
vec[1] = arg2;
@@ -2518,7 +2531,8 @@ IRExpr** mkIRExprVec_5 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
return vec;
}
IRExpr** mkIRExprVec_6 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
- IRExpr* arg4, IRExpr* arg5, IRExpr* arg6 ) {
+ IRExpr* arg4, IRExpr* arg5, IRExpr* arg6 )
+{
IRExpr** vec = LibVEX_Alloc_inline(7 * sizeof(IRExpr*));
vec[0] = arg1;
vec[1] = arg2;
@@ -2531,7 +2545,8 @@ IRExpr** mkIRExprVec_6 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
}
IRExpr** mkIRExprVec_7 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
IRExpr* arg4, IRExpr* arg5, IRExpr* arg6,
- IRExpr* arg7 ) {
+ IRExpr* arg7 )
+{
IRExpr** vec = LibVEX_Alloc_inline(8 * sizeof(IRExpr*));
vec[0] = arg1;
vec[1] = arg2;
@@ -2545,7 +2560,8 @@ IRExpr** mkIRExprVec_7 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
}
IRExpr** mkIRExprVec_8 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
IRExpr* arg4, IRExpr* arg5, IRExpr* arg6,
- IRExpr* arg7, IRExpr* arg8 ) {
+ IRExpr* arg7, IRExpr* arg8 )
+{
IRExpr** vec = LibVEX_Alloc_inline(9 * sizeof(IRExpr*));
vec[0] = arg1;
vec[1] = arg2;
@@ -2560,7 +2576,8 @@ IRExpr** mkIRExprVec_8 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
}
IRExpr** mkIRExprVec_9 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
IRExpr* arg4, IRExpr* arg5, IRExpr* arg6,
- IRExpr* arg7, IRExpr* arg8, IRExpr* arg9 ) {
+ IRExpr* arg7, IRExpr* arg8, IRExpr* arg9 )
+{
IRExpr** vec = LibVEX_Alloc_inline(10 * sizeof(IRExpr*));
vec[0] = arg1;
vec[1] = arg2;
@@ -2579,7 +2596,8 @@ IRExpr** mkIRExprVec_13 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
IRExpr* arg7, IRExpr* arg8, IRExpr* arg9,
IRExpr* arg10, IRExpr* arg11, IRExpr* arg12,
IRExpr* arg13
- ) {
+ )
+{
IRExpr** vec = LibVEX_Alloc_inline(14 * sizeof(IRExpr*));
vec[0] = arg1;
vec[1] = arg2;
@@ -2601,7 +2619,8 @@ IRExpr** mkIRExprVec_13 ( IRExpr* arg1, IRExpr* arg2, IRExpr* arg3,
/* Constructors -- IRDirty */
-IRDirty* emptyIRDirty ( void ) {
+IRDirty* emptyIRDirty ( void )
+{
IRDirty* d = LibVEX_Alloc_inline(sizeof(IRDirty));
d->cee = NULL;
d->guard = NULL;
@@ -2620,7 +2639,8 @@ IRDirty* emptyIRDirty ( void ) {
IRCAS* mkIRCAS ( IRTemp oldHi, IRTemp oldLo,
IREndness end, IRExpr* addr,
IRExpr* expdHi, IRExpr* expdLo,
- IRExpr* dataHi, IRExpr* dataLo ) {
+ IRExpr* dataHi, IRExpr* dataLo )
+{
IRCAS* cas = LibVEX_Alloc_inline(sizeof(IRCAS));
cas->oldHi = oldHi;
cas->oldLo = oldLo;
@@ -2684,7 +2704,8 @@ IRStmt* IRStmt_NoOp ( void )
static_closure.tag = Ist_NoOp;
return &static_closure;
}
-IRStmt* IRStmt_IMark ( Addr addr, UInt len, UChar delta ) {
+IRStmt* IRStmt_IMark ( Addr addr, UInt len, UChar delta )
+{
IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt));
s->tag = Ist_IMark;
s->Ist.IMark.addr = addr;
@@ -2692,7 +2713,8 @@ IRStmt* IRStmt_IMark ( Addr addr, UInt len, UChar delta ) {
s->Ist.IMark.delta = delta;
return s;
}
-IRStmt* IRStmt_AbiHint ( IRExpr* base, Int len, IRExpr* nia ) {
+IRStmt* IRStmt_AbiHint ( IRExpr* base, Int len, IRExpr* nia )
+{
IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt));
s->tag = Ist_AbiHint;
s->Ist.AbiHint.base = base;
@@ -2700,27 +2722,31 @@ IRStmt* IRStmt_AbiHint ( IRExpr* base, Int len, IRExpr* nia ) {
s->Ist.AbiHint.nia = nia;
return s;
}
-IRStmt* IRStmt_Put ( Int off, IRExpr* data ) {
+IRStmt* IRStmt_Put ( Int off, IRExpr* data )
+{
IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt));
s->tag = Ist_Put;
s->Ist.Put.offset = off;
s->Ist.Put.data = data;
return s;
}
-IRStmt* IRStmt_PutI ( IRPutI* details ) {
+IRStmt* IRStmt_PutI ( IRPutI* details )
+{
IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt));
s->tag = Ist_PutI;
s->Ist.PutI.details = details;
return s;
}
-IRStmt* IRStmt_WrTmp ( IRTemp tmp, IRExpr* data ) {
+IRStmt* IRStmt_WrTmp ( IRTemp tmp, IRExpr* data )
+{
IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt));
s->tag = Ist_WrTmp;
s->Ist.WrTmp.tmp = tmp;
s->Ist.WrTmp.data = data;
return s;
}
-IRStmt* IRStmt_Store ( IREndness end, IRExpr* addr, IRExpr* data ) {
+IRStmt* IRStmt_Store ( IREndness end, IRExpr* addr, IRExpr* data )
+{
IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt));
s->tag = Ist_Store;
s->Ist.Store.end = end;
@@ -2738,20 +2764,23 @@ IRStmt* IRStmt_StoreG ( IREndness end, IRExpr* addr, IRExpr* data,
return s;
}
IRStmt* IRStmt_LoadG ( IREndness end, IRLoadGOp cvt, IRTemp dst,
- IRExpr* addr, IRExpr* alt, IRExpr* guard ) {
+ IRExpr* addr, IRExpr* alt, IRExpr* guard )
+{
IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt));
s->tag = Ist_LoadG;
s->Ist.LoadG.details = mkIRLoadG(end, cvt, dst, addr, alt, guard);
return s;
}
-IRStmt* IRStmt_CAS ( IRCAS* cas ) {
+IRStmt* IRStmt_CAS ( IRCAS* cas )
+{
IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt));
s->tag = Ist_CAS;
s->Ist.CAS.details = cas;
return s;
}
IRStmt* IRStmt_LLSC ( IREndness end,
- IRTemp result, IRExpr* addr, IRExpr* storedata ) {
+ IRTemp result, IRExpr* addr, IRExpr* storedata )
+{
IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt));
s->tag = Ist_LLSC;
s->Ist.LLSC.end = end;
@@ -2775,7 +2804,8 @@ IRStmt* IRStmt_MBE ( IRMBusEvent event )
return s;
}
IRStmt* IRStmt_Exit ( IRExpr* guard, IRJumpKind jk, IRConst* dst,
- Int offsIP ) {
+ Int offsIP )
+{
IRStmt* s = LibVEX_Alloc_inline(sizeof(IRStmt));
s->tag = Ist_Exit;
s->Ist.Exit.guard = guard;
@@ -3292,12 +3322,10 @@ void typeOfPrimop ( IROp op,
case Iop_MullU64: case Iop_MullS64:
BINARY(Ity_I64,Ity_I64, Ity_I128);
- case Iop_Clz32: case Iop_Ctz32:
case Iop_ClzNat32: case Iop_CtzNat32:
case Iop_PopCount32:
UNARY(Ity_I32, Ity_I32);
- case Iop_Clz64: case Iop_Ctz64:
case Iop_ClzNat64: case Iop_CtzNat64:
case Iop_PopCount64:
UNARY(Ity_I64, Ity_I64);
@@ -3694,6 +3722,11 @@ void typeOfPrimop ( IROp op,
case Iop_MulI128by10E:
case Iop_MulI128by10ECarry:
case Iop_PwExtUSMulQAdd8x16:
+ BINARY(Ity_V128,Ity_V128, Ity_V128);
+
+ /* Note: Semantically, operands and result of these IROps are 128-bit
+ integers (c.f. libvex_ir.h). The Ity_V128 type is used here to
+ indicate that those values require a vector register to be stored. */
case Iop_DivU128: case Iop_DivS128:
case Iop_DivU128E: case Iop_DivS128E:
case Iop_ModU128: case Iop_ModS128:
diff --git a/VEX/priv/ir_inject.c b/VEX/priv/ir_inject.c
index 26e8ca2787..105bb4f1f3 100644
--- a/VEX/priv/ir_inject.c
+++ b/VEX/priv/ir_inject.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -27,12 +27,18 @@
The GNU General Public License is contained in the file COPYING.
*/
+/* !!! When running valgrind on applications that use IR injection
+ !!! --vex-guest-chase=no should be given on the command line. This
+ !!! avoids that vex_inject_ir is called speculatively.
+*/
#include "libvex_basictypes.h"
#include "libvex_ir.h"
#include "libvex.h"
#include "main_util.h"
+#include "main_globals.h" // vex_control
/* Convenience macros for readibility */
+#define mkU1(v) IRExpr_Const(IRConst_U1(v))
#define mkU8(v) IRExpr_Const(IRConst_U8(v))
#define mkU16(v) IRExpr_Const(IRConst_U16(v))
#define mkU32(v) IRExpr_Const(IRConst_U32(v))
@@ -46,13 +52,12 @@
/* The IR Injection Control Block. vex_inject_ir will query its contents
to construct IR statements for testing purposes. */
-static IRICB iricb;
-
+static IRICB the_iricb;
void
LibVEX_InitIRI(const IRICB *iricb_in)
{
- iricb = *iricb_in; // copy in
+ the_iricb = *iricb_in; // copy in
}
@@ -67,7 +72,8 @@ load_aux(IREndness endian, IRType type, IRExpr *addr)
IRExpr_Load(endian, Ity_I64, addr));
}
if (type == Ity_I1) {
- /* A Boolean value is stored as a 32-bit entity (see store_aux). */
+ /* A Boolean value is stored as a 32-bit entity. For an explanation
+ see comment in vbit-test/vbits.h */
return unop(Iop_32to1, IRExpr_Load(endian, Ity_I32, addr));
}
@@ -131,8 +137,8 @@ store_aux(IRSB *irsb, IREndness endian, IRExpr *addr, IRExpr *data)
data = unop(Iop_ReinterpD64asI64, data);
}
if (typeOfIRExpr(irsb->tyenv, data) == Ity_I1) {
- /* We cannot store a single bit. So we store it in a 32-bit container.
- See also load_aux. */
+ /* A Boolean value is stored as a 32-bit entity. For an explanation
+ see comment in vbit-test/vbits.h */
data = unop(Iop_1Uto32, data);
}
stmt(irsb, IRStmt_Store(endian, addr, data));
@@ -189,9 +195,10 @@ store(IRSB *irsb, IREndness endian, HWord haddr, IRExpr *data)
/* Inject IR stmts depending on the data provided in the control
block iricb. */
-void
-vex_inject_ir(IRSB *irsb, IREndness endian)
+static void
+vex_inject_ir_vbit(IRSB *irsb, IREndness endian)
{
+ IRICB_vbit_payload iricb = the_iricb.vbit;
IRExpr *data, *rounding_mode, *opnd1, *opnd2, *opnd3, *opnd4;
rounding_mode = NULL;
@@ -320,6 +327,90 @@ vex_inject_ir(IRSB *irsb, IREndness endian)
}
}
+
+static void
+vex_inject_ir_iropt(IRSB *irsb, IREndness endian)
+{
+ IRICB_iropt_payload iricb = the_iricb.iropt;
+ IRExpr *opnd1, *opnd2, *expr;
+ ULong val1, val2;
+
+ val1 = *(ULong *)iricb.opnd1;
+ switch (iricb.t_opnd1) {
+ case Ity_I1: opnd1 = mkU1(val1); break;
+ case Ity_I8: opnd1 = mkU8(val1); break;
+ case Ity_I16: opnd1 = mkU16(val1); break;
+ case Ity_I32: opnd1 = mkU32(val1); break;
+ case Ity_I64: opnd1 = mkU64(val1); break;
+ default:
+ vpanic("unsupported type");
+ }
+
+ switch (iricb.num_operands) {
+ case 1:
+ expr = unop(iricb.op, opnd1);
+ break;
+
+ case 2:
+ val2 = *(ULong *)iricb.opnd2;
+ switch (iricb.t_opnd2) {
+ case Ity_I1: opnd2 = mkU1(val2); break;
+ case Ity_I8: opnd2 = mkU8(val2); break;
+ case Ity_I16: opnd2 = mkU16(val2); break;
+ case Ity_I32: opnd2 = mkU32(val2); break;
+ case Ity_I64: opnd2 = mkU64(val2); break;
+ default:
+ vpanic("unsupported type");
+ }
+ expr = binop(iricb.op, opnd1, opnd2);
+ break;
+
+ default:
+ vpanic("unsupported operator");
+ }
+
+ if (! vex_control.iropt_fold_expr) {
+ store(irsb, endian, iricb.result_nofold, expr);
+ return;
+ }
+
+ /* Make sure the expression gets folded ! */
+ IRExpr *env[1] = { 0 };
+ IRExpr *res = foldIRExpr(env, expr);
+
+// vex_printf("FOLDED RESULT "); ppIRExpr(res); vex_printf("\n");
+
+ if (res->tag != Iex_Const) {
+ vex_printf("*** ");
+ ppIROp(iricb.op);
+ vex_printf(": not folded: result = ");
+ ppIRExpr(res);
+ vex_printf("\n");
+// *(ULong *)iricb.result_fold = 0; // whatever
+// return;
+ res = mkU32(0); // whatever
+ }
+ store(irsb, endian, iricb.result_fold, res);
+}
+
+
+void
+vex_inject_ir(IRSB *irsb, IREndness endian)
+{
+ switch (the_iricb.kind) {
+ case IRICB_vbit:
+ vex_inject_ir_vbit(irsb, endian);
+ break;
+
+ case IRICB_iropt:
+ vex_inject_ir_iropt(irsb, endian);
+ break;
+
+ default:
+ vpanic("unknown IRICB kind");
+ }
+}
+
/*---------------------------------------------------------------*/
/*--- end ir_inject.c ---*/
/*---------------------------------------------------------------*/
diff --git a/VEX/priv/ir_match.c b/VEX/priv/ir_match.c
index 3f4fe8cc54..afd2858334 100644
--- a/VEX/priv/ir_match.c
+++ b/VEX/priv/ir_match.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/ir_match.h b/VEX/priv/ir_match.h
index 9c34dfe321..7c713853fe 100644
--- a/VEX/priv/ir_match.h
+++ b/VEX/priv/ir_match.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c
index 6565378654..3acc9b4199 100644
--- a/VEX/priv/ir_opt.c
+++ b/VEX/priv/ir_opt.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -198,7 +198,7 @@ static HashHW* newHHW ( void )
/* Look up key in the map. */
-static Bool lookupHHW ( HashHW* h, /*OUT*/HWord* val, HWord key )
+static Bool lookupHHW ( const HashHW* h, /*OUT*/HWord* val, HWord key )
{
Int i;
/* vex_printf("lookupHHW(%llx)\n", key ); */
@@ -264,7 +264,7 @@ static void addToHHW ( HashHW* h, HWord key, HWord val )
/* Non-critical helper, heuristic for reducing the number of tmp-tmp
copies made by flattening. If in doubt return False. */
-static Bool isFlat ( IRExpr* e )
+static Bool isFlat ( const IRExpr* e )
{
if (e->tag == Iex_Get)
return True;
@@ -550,7 +550,7 @@ static IRSB* flatten_BB ( IRSB* in )
/* Extract the min/max offsets from a guest state array descriptor. */
inline
-static void getArrayBounds ( IRRegArray* descr,
+static void getArrayBounds ( const IRRegArray* descr,
UInt* minoff, UInt* maxoff )
{
*minoff = descr->base;
@@ -572,7 +572,7 @@ static UInt mk_key_GetPut ( Int offset, IRType ty )
return (minoff << 16) | maxoff;
}
-static UInt mk_key_GetIPutI ( IRRegArray* descr )
+static UInt mk_key_GetIPutI ( const IRRegArray* descr )
{
UInt minoff, maxoff;
getArrayBounds( descr, &minoff, &maxoff );
@@ -1041,17 +1041,17 @@ static UInt num_nodes_visited;
slower out of line general case. Saves a few insns. */
__attribute__((noinline))
-static Bool sameIRExprs_aux2 ( IRExpr** env, IRExpr* e1, IRExpr* e2 );
+static Bool sameIRExprs_aux2 ( IRExpr** env, const IRExpr* e1, const IRExpr* e2 );
inline
-static Bool sameIRExprs_aux ( IRExpr** env, IRExpr* e1, IRExpr* e2 )
+static Bool sameIRExprs_aux ( IRExpr** env, const IRExpr* e1, const IRExpr* e2 )
{
if (e1->tag != e2->tag) return False;
return sameIRExprs_aux2(env, e1, e2);
}
__attribute__((noinline))
-static Bool sameIRExprs_aux2 ( IRExpr** env, IRExpr* e1, IRExpr* e2 )
+static Bool sameIRExprs_aux2 ( IRExpr** env, const IRExpr* e1, const IRExpr* e2 )
{
if (num_nodes_visited++ > NODE_LIMIT) return False;
@@ -1129,7 +1129,7 @@ static Bool sameIRExprs_aux2 ( IRExpr** env, IRExpr* e1, IRExpr* e2 )
}
inline
-static Bool sameIRExprs ( IRExpr** env, IRExpr* e1, IRExpr* e2 )
+static Bool sameIRExprs ( IRExpr** env, const IRExpr* e1, const IRExpr* e2 )
{
Bool same;
@@ -1158,8 +1158,8 @@ static Bool sameIRExprs ( IRExpr** env, IRExpr* e1, IRExpr* e2 )
--vex-iropt-level > 0, that is, vex_control.iropt_verbosity > 0.
Bad because it duplicates functionality from typeOfIRExpr. See
comment on the single use point below for rationale. */
-static
-Bool debug_only_hack_sameIRExprs_might_assert ( IRExpr* e1, IRExpr* e2 )
+static Bool
+debug_only_hack_sameIRExprs_might_assert ( const IRExpr* e1, const IRExpr* e2 )
{
if (e1->tag != e2->tag) return False;
switch (e1->tag) {
@@ -1176,27 +1176,8 @@ Bool debug_only_hack_sameIRExprs_might_assert ( IRExpr* e1, IRExpr* e2 )
}
-/* Is this literally IRExpr_Const(IRConst_U32(0)) ? */
-static Bool isZeroU32 ( IRExpr* e )
-{
- return toBool( e->tag == Iex_Const
- && e->Iex.Const.con->tag == Ico_U32
- && e->Iex.Const.con->Ico.U32 == 0);
-}
-
-/* Is this literally IRExpr_Const(IRConst_U64(0)) ?
- Currently unused; commented out to avoid compiler warning */
-#if 0
-static Bool isZeroU64 ( IRExpr* e )
-{
- return toBool( e->tag == Iex_Const
- && e->Iex.Const.con->tag == Ico_U64
- && e->Iex.Const.con->Ico.U64 == 0);
-}
-#endif
-
/* Is this literally IRExpr_Const(IRConst_V128(0)) ? */
-static Bool isZeroV128 ( IRExpr* e )
+static Bool isZeroV128 ( const IRExpr* e )
{
return toBool( e->tag == Iex_Const
&& e->Iex.Const.con->tag == Ico_V128
@@ -1204,7 +1185,7 @@ static Bool isZeroV128 ( IRExpr* e )
}
/* Is this literally IRExpr_Const(IRConst_V128(1...1)) ? */
-static Bool isOnesV128 ( IRExpr* e )
+static Bool isOnesV128 ( const IRExpr* e )
{
return toBool( e->tag == Iex_Const
&& e->Iex.Const.con->tag == Ico_V128
@@ -1212,7 +1193,7 @@ static Bool isOnesV128 ( IRExpr* e )
}
/* Is this literally IRExpr_Const(IRConst_V256(0)) ? */
-static Bool isZeroV256 ( IRExpr* e )
+static Bool isZeroV256 ( const IRExpr* e )
{
return toBool( e->tag == Iex_Const
&& e->Iex.Const.con->tag == Ico_V256
@@ -1220,7 +1201,7 @@ static Bool isZeroV256 ( IRExpr* e )
}
/* Is this an integer constant with value 0 ? */
-static Bool isZeroU ( IRExpr* e )
+static Bool isZeroU ( const IRExpr* e )
{
if (e->tag != Iex_Const) return False;
switch (e->Iex.Const.con->tag) {
@@ -1234,8 +1215,22 @@ static Bool isZeroU ( IRExpr* e )
}
}
+/* Is this an integer constant with value 1 ? */
+static Bool isOneU ( const IRExpr* e )
+{
+ if (e->tag != Iex_Const) return False;
+ switch (e->Iex.Const.con->tag) {
+ case Ico_U1: return toBool( e->Iex.Const.con->Ico.U1 == 1);
+ case Ico_U8: return toBool( e->Iex.Const.con->Ico.U8 == 1);
+ case Ico_U16: return toBool( e->Iex.Const.con->Ico.U16 == 1);
+ case Ico_U32: return toBool( e->Iex.Const.con->Ico.U32 == 1);
+ case Ico_U64: return toBool( e->Iex.Const.con->Ico.U64 == 1);
+ default: vpanic("isOneU");
+ }
+}
+
/* Is this an integer constant with value 1---1b ? */
-static Bool isOnesU ( IRExpr* e )
+static Bool isOnesU ( const IRExpr* e )
{
if (e->tag != Iex_Const) return False;
switch (e->Iex.Const.con->tag) {
@@ -1262,11 +1257,26 @@ static Bool notBool ( Bool b )
static IRExpr* mkZeroOfPrimopResultType ( IROp op )
{
switch (op) {
- case Iop_CmpNE32: return IRExpr_Const(IRConst_U1(toBool(0)));
+ case Iop_Sub8:
+ case Iop_Mul8:
case Iop_Xor8: return IRExpr_Const(IRConst_U8(0));
+ case Iop_Sub16:
+ case Iop_Mul16:
+ case Iop_MullU8:
+ case Iop_MullS8:
case Iop_Xor16: return IRExpr_Const(IRConst_U16(0));
+ case Iop_MullU16:
+ case Iop_MullS16:
+ case Iop_Mul32:
+ case Iop_DivU32:
+ case Iop_DivS32:
case Iop_Sub32:
case Iop_Xor32: return IRExpr_Const(IRConst_U32(0));
+ case Iop_MullU32:
+ case Iop_MullS32:
+ case Iop_Mul64:
+ case Iop_DivU64:
+ case Iop_DivS64:
case Iop_And64:
case Iop_Sub64:
case Iop_Xor64: return IRExpr_Const(IRConst_U64(0));
@@ -1274,23 +1284,35 @@ static IRExpr* mkZeroOfPrimopResultType ( IROp op )
case Iop_AndV128: return IRExpr_Const(IRConst_V128(0));
case Iop_XorV256:
case Iop_AndV256: return IRExpr_Const(IRConst_V256(0));
- default: vpanic("mkZeroOfPrimopResultType: bad primop");
+ default: ppIROp(op); vpanic("mkZeroOfPrimopResultType: bad primop");
}
}
+/* Make a Boolean False value */
+static inline IRExpr* mkFalse(void)
+{
+ return IRExpr_Const(IRConst_U1(toBool(0)));
+}
+
+/* Make a Boolean True value */
+static inline IRExpr* mkTrue(void)
+{
+ return IRExpr_Const(IRConst_U1(toBool(1)));
+}
+
/* Make a value containing all 1-bits, which has the same type as the
result of the given primop. */
static IRExpr* mkOnesOfPrimopResultType ( IROp op )
{
switch (op) {
- case Iop_CmpEQ32:
- case Iop_CmpEQ64:
- return IRExpr_Const(IRConst_U1(toBool(1)));
+ case Iop_Or1:
+ return IRExpr_Const(IRConst_U1(0x1));
case Iop_Or8:
return IRExpr_Const(IRConst_U8(0xFF));
case Iop_Or16:
return IRExpr_Const(IRConst_U16(0xFFFF));
case Iop_Or32:
+ case Iop_Max32U:
return IRExpr_Const(IRConst_U32(0xFFFFFFFF));
case Iop_CmpEQ8x8:
case Iop_CmpEQ16x4:
@@ -1313,31 +1335,74 @@ static IRExpr* mkOnesOfPrimopResultType ( IROp op )
}
}
-/* Helpers for folding Clz32/64. */
-static UInt fold_Clz64 ( ULong value )
+/* Helpers for folding ClzNat32/64. */
+static UInt fold_ClzNat64 ( ULong value )
{
UInt i;
- vassert(value != 0ULL); /* no defined semantics for arg==0 */
for (i = 0; i < 64; ++i) {
if (0ULL != (value & (((ULong)1) << (63 - i)))) return i;
}
- vassert(0);
- /*NOTREACHED*/
- return 0;
+ return 64;
}
-static UInt fold_Clz32 ( UInt value )
+static UInt fold_ClzNat32 ( UInt value )
{
UInt i;
- vassert(value != 0); /* no defined semantics for arg==0 */
for (i = 0; i < 32; ++i) {
if (0 != (value & (((UInt)1) << (31 - i)))) return i;
}
- vassert(0);
- /*NOTREACHED*/
- return 0;
+ return 32;
+}
+
+/* Helpers for folding CtzNat32/64. */
+static UInt fold_CtzNat_WRK ( ULong value, UInt num_bits )
+{
+ UInt count = 0;
+
+ for (UInt i = 1; i <= num_bits; ++i) {
+ if (value & 0x1)
+ return count;
+ value >>= 1;
+ ++count;
+ }
+ return count;
+}
+
+static UInt fold_CtzNat64 ( ULong value )
+{
+ return fold_CtzNat_WRK(value, 64);
+}
+
+static UInt fold_CtzNat32 ( UInt value )
+{
+ return fold_CtzNat_WRK(value, 32);
}
+/* Helpers for folding PopCount32/64.
+ https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan
+ As many iterations as 1-bits present.
+*/
+static UInt fold_PopCount64 ( ULong value )
+{
+ UInt count;
+
+ for (count = 0; value != 0; ++count) {
+ value &= value - 1; // clear the least significant 1-bit
+ }
+ return count;
+}
+
+static UInt fold_PopCount32 ( UInt value )
+{
+ UInt count;
+
+ for (count = 0; value != 0; ++count) {
+ value &= value - 1; // clear the least significant 1-bit
+ }
+ return count;
+}
+
+
/* V64 holds 8 summary-constant bits in V128/V256 style. Convert to
the corresponding real constant. */
//XXX re-check this before use
@@ -1386,6 +1451,8 @@ static IRExpr* chase1 ( IRExpr** env, IRExpr* e )
__attribute__((noinline))
static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
{
+ if (UNLIKELY(vex_control.iropt_fold_expr == False)) return e;
+
Int shift;
IRExpr* e2 = e; /* e2 is the result of folding e, if possible */
@@ -1440,6 +1507,13 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
e2 = IRExpr_Const(IRConst_U32(u32));
break;
}
+ case Iop_8Sto64: {
+ ULong u64 = e->Iex.Unop.arg->Iex.Const.con->Ico.U8;
+ u64 <<= 56;
+ u64 = (Long)u64 >> 56; /* signed shift */
+ e2 = IRExpr_Const(IRConst_U64(u64));
+ break;
+ }
case Iop_16Sto32: {
UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U16;
u32 <<= 16;
@@ -1474,6 +1548,12 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
e2 = IRExpr_Const(IRConst_U32(
0xFFFF & e->Iex.Unop.arg->Iex.Const.con->Ico.U16));
break;
+ case Iop_32HIto16: {
+ UInt w32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32;
+ w32 >>= 16;
+ e2 = IRExpr_Const(IRConst_U16(toUShort(w32)));
+ break;
+ }
case Iop_32to16:
e2 = IRExpr_Const(IRConst_U16(toUShort(
0xFFFF & e->Iex.Unop.arg->Iex.Const.con->Ico.U32)));
@@ -1583,6 +1663,12 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
(0xFF & e->Iex.Unop.arg->Iex.Const.con->Ico.U8)
)));
break;
+ case Iop_CmpNEZ16:
+ e2 = IRExpr_Const(IRConst_U1(toBool(
+ 0 !=
+ (0xFFFF & e->Iex.Unop.arg->Iex.Const.con->Ico.U16)
+ )));
+ break;
case Iop_CmpNEZ32:
e2 = IRExpr_Const(IRConst_U1(toBool(
0 !=
@@ -1612,6 +1698,22 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
break;
}
+ case Iop_Left8: {
+ UChar u8 = e->Iex.Unop.arg->Iex.Const.con->Ico.U8;
+ Char s8 = (Char)(u8 & 0xFF);
+ s8 = (s8 | (-s8));
+ e2 = IRExpr_Const( IRConst_U8( (UChar)s8 ));
+ break;
+ }
+
+ case Iop_Left16: {
+ UShort u16 = e->Iex.Unop.arg->Iex.Const.con->Ico.U16;
+ Short s16 = (Short)(u16 & 0xFFFF);
+ s16 = (s16 | (-s16));
+ e2 = IRExpr_Const( IRConst_U16( (UShort)s16 ));
+ break;
+ }
+
case Iop_Left32: {
UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32;
Int s32 = (Int)(u32 & 0xFFFFFFFF);
@@ -1628,16 +1730,36 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
break;
}
- case Iop_Clz32: {
+ case Iop_ClzNat32: {
+ UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32;
+ e2 = IRExpr_Const(IRConst_U32(fold_ClzNat32(u32)));
+ break;
+ }
+ case Iop_ClzNat64: {
+ ULong u64 = e->Iex.Unop.arg->Iex.Const.con->Ico.U64;
+ e2 = IRExpr_Const(IRConst_U64(fold_ClzNat64(u64)));
+ break;
+ }
+
+ case Iop_CtzNat32: {
+ UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32;
+ e2 = IRExpr_Const(IRConst_U32(fold_CtzNat32(u32)));
+ break;
+ }
+ case Iop_CtzNat64: {
+ ULong u64 = e->Iex.Unop.arg->Iex.Const.con->Ico.U64;
+ e2 = IRExpr_Const(IRConst_U64(fold_CtzNat64(u64)));
+ break;
+ }
+
+ case Iop_PopCount32: {
UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32;
- if (u32 != 0)
- e2 = IRExpr_Const(IRConst_U32(fold_Clz32(u32)));
+ e2 = IRExpr_Const(IRConst_U32(fold_PopCount32(u32)));
break;
}
- case Iop_Clz64: {
+ case Iop_PopCount64: {
ULong u64 = e->Iex.Unop.arg->Iex.Const.con->Ico.U64;
- if (u64 != 0ULL)
- e2 = IRExpr_Const(IRConst_U64(fold_Clz64(u64)));
+ e2 = IRExpr_Const(IRConst_U64(fold_PopCount64(u64)));
break;
}
@@ -1779,6 +1901,11 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
switch (e->Iex.Binop.op) {
/* -- Or -- */
+ case Iop_Or1:
+ e2 = IRExpr_Const(IRConst_U1(toBool(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U1
+ | e->Iex.Binop.arg2->Iex.Const.con->Ico.U1))));
+ break;
case Iop_Or8:
e2 = IRExpr_Const(IRConst_U8(toUChar(
(e->Iex.Binop.arg1->Iex.Const.con->Ico.U8
@@ -1870,6 +1997,11 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
(e->Iex.Binop.arg1->Iex.Const.con->Ico.U8
+ e->Iex.Binop.arg2->Iex.Const.con->Ico.U8))));
break;
+ case Iop_Add16:
+ e2 = IRExpr_Const(IRConst_U16(toUShort(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16
+ + e->Iex.Binop.arg2->Iex.Const.con->Ico.U16))));
+ break;
case Iop_Add32:
e2 = IRExpr_Const(IRConst_U32(
(e->Iex.Binop.arg1->Iex.Const.con->Ico.U32
@@ -1887,6 +2019,11 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
(e->Iex.Binop.arg1->Iex.Const.con->Ico.U8
- e->Iex.Binop.arg2->Iex.Const.con->Ico.U8))));
break;
+ case Iop_Sub16:
+ e2 = IRExpr_Const(IRConst_U16(toUShort(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16
+ - e->Iex.Binop.arg2->Iex.Const.con->Ico.U16))));
+ break;
case Iop_Sub32:
e2 = IRExpr_Const(IRConst_U32(
(e->Iex.Binop.arg1->Iex.Const.con->Ico.U32
@@ -1908,6 +2045,16 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
}
/* -- Mul -- */
+ case Iop_Mul8:
+ e2 = IRExpr_Const(IRConst_U8(toUChar(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8
+ * e->Iex.Binop.arg2->Iex.Const.con->Ico.U8))));
+ break;
+ case Iop_Mul16:
+ e2 = IRExpr_Const(IRConst_U16(toUShort(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16
+ * e->Iex.Binop.arg2->Iex.Const.con->Ico.U16))));
+ break;
case Iop_Mul32:
e2 = IRExpr_Const(IRConst_U32(
(e->Iex.Binop.arg1->Iex.Const.con->Ico.U32
@@ -1919,6 +2066,53 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
* e->Iex.Binop.arg2->Iex.Const.con->Ico.U64)));
break;
+ case Iop_MullU8: {
+ UChar u8a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U8;
+ UChar u8b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ Int res = u8a * u8b; /* Compiler will promote to int */
+ e2 = IRExpr_Const(IRConst_U16(toUShort(res)));
+ break;
+ }
+ case Iop_MullU16: {
+ UShort u16a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U16;
+ UShort u16b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U16;
+ Int res = u16a * u16b; /* Compiler will promote to int */
+ e2 = IRExpr_Const(IRConst_U32(res));
+ break;
+ }
+ case Iop_MullU32: {
+ UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32;
+ UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32;
+ ULong res = (ULong)u32a * (ULong)u32b;
+ e2 = IRExpr_Const(IRConst_U64(res));
+ break;
+ }
+ case Iop_MullS8: {
+ /* very paranoid */
+ UChar u8a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U8;
+ UChar u8b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ Char s8a = (Char)u8a;
+ Char s8b = (Char)u8b;
+ Short s16a = (Short)s8a;
+ Short s16b = (Short)s8b;
+ Int sres = s16a * s16b;
+ UShort ures = toUShort(sres);
+ e2 = IRExpr_Const(IRConst_U16(ures));
+ break;
+ }
+ case Iop_MullS16: {
+ /* very paranoid */
+ UShort u16a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U16;
+ UShort u16b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U16;
+ Short s16a = (Short)u16a;
+ Short s16b = (Short)u16b;
+ Int s32a = (Int)s16a;
+ Int s32b = (Int)s16b;
+ Int sres = s32a * s32b;
+ UInt ures = (UInt)sres;
+ e2 = IRExpr_Const(IRConst_U32(ures));
+ break;
+ }
case Iop_MullS32: {
/* very paranoid */
UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32;
@@ -1933,7 +2127,129 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
break;
}
+ /* -- Div -- */
+ case Iop_DivS32: {
+ Int s32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32;
+ Int s32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32;
+ if (s32b != 0)
+ e2 = IRExpr_Const(IRConst_U32(s32a / s32b));
+ break;
+ }
+ case Iop_DivS64: {
+ Long s64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64;
+ Long s64b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U64;
+ if (s64b != 0)
+ e2 = IRExpr_Const(IRConst_U64(s64a / s64b));
+ break;
+ }
+ case Iop_DivU32: {
+ UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32;
+ UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32;
+ if (u32b != 0)
+ e2 = IRExpr_Const(IRConst_U32(u32a / u32b));
+ break;
+ }
+ case Iop_DivU64: {
+ ULong u64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64;
+ ULong u64b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U64;
+ if (u64b != 0)
+ e2 = IRExpr_Const(IRConst_U64(u64a / u64b));
+ break;
+ }
+ case Iop_DivS32E: {
+ Int s32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32;
+ Int s32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32;
+ if (s32b != 0) {
+ Long s64a = (Long)s32a << 32;
+ e2 = IRExpr_Const(IRConst_U32(toUInt(s64a / s32b)));
+ }
+ break;
+ }
+ case Iop_DivU32E: {
+ UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32;
+ UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32;
+ if (u32b != 0) {
+ ULong u64a = (ULong)u32a << 32;
+ e2 = IRExpr_Const(IRConst_U32(toUInt(u64a / u32b)));
+ }
+ break;
+ }
+
+ /* -- DivMod -- */
+ case Iop_DivModU64to32: {
+ ULong u64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64;
+ UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32;
+ if (u32b != 0) {
+ ULong q = u64a / u32b;
+ /* Can q be represented in 32 bit? */
+ if (q <= 0xFFFFFFFF) {
+ UInt r = u64a % u32b;
+ e2 = IRExpr_Const(IRConst_U64(((ULong)r << 32) | (UInt)q));
+ }
+ }
+ break;
+ }
+ case Iop_DivModS64to32: {
+ Long s64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64;
+ Int s32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32;
+ if (s32b != 0) {
+ /* Division may trap when result overflows i.e. when
+ attempting: INT64_MAX / -1 */
+ if (e->Iex.Binop.arg1->Iex.Const.con->Ico.U64 == (1ULL << 63)
+ && s32b == -1)
+ break;
+ Long q = s64a / s32b;
+ /* Can q be represented in 32 bit? */
+ if (q >= (-2147483647-1) && q <= 2147483647) {
+ Int r = s64a % s32b;
+ e2 = IRExpr_Const(IRConst_U64(((ULong)r << 32) | (UInt)q));
+ }
+ }
+ break;
+ }
+ case Iop_DivModU32to32: {
+ UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32;
+ UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32;
+ if (u32b != 0) {
+ UInt q = u32a / u32b;
+ UInt r = u32a % u32b;
+ e2 = IRExpr_Const(IRConst_U64(((ULong)r << 32) | q));
+ }
+ break;
+ }
+ case Iop_DivModS32to32: {
+ Int s32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32;
+ Int s32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32;
+ if (s32b != 0) {
+ /* Division may trap when result overflows i.e. when
+ attempting: INT32_MAX / -1 */
+ if (e->Iex.Binop.arg1->Iex.Const.con->Ico.U32 == (1UL << 31)
+ && s32b == -1)
+ break;
+ Int q = s32a / s32b;
+ Int r = s32a % s32b;
+ e2 = IRExpr_Const(IRConst_U64(((ULong)(UInt)r << 32) | (UInt)q));
+ }
+ break;
+ }
+
/* -- Shl -- */
+ case Iop_Shl8:
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 7)
+ e2 = IRExpr_Const(IRConst_U8(toUChar(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8
+ << shift))));
+ break;
+ case Iop_Shl16:
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 15)
+ e2 = IRExpr_Const(IRConst_U16(toUShort(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16
+ << shift))));
+ break;
case Iop_Shl32:
vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
shift = (Int)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U8);
@@ -1952,6 +2268,28 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
break;
/* -- Sar -- */
+ case Iop_Sar8: {
+ Int s8;
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ s8 = (Char)(e->Iex.Binop.arg1->Iex.Const.con->Ico.U8);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 7) {
+ s8 >>=/*signed*/ shift;
+ e2 = IRExpr_Const(IRConst_U8(toUChar(s8)));
+ }
+ break;
+ }
+ case Iop_Sar16: {
+ Int s16;
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ s16 = (Short)(e->Iex.Binop.arg1->Iex.Const.con->Ico.U16);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 15) {
+ s16 >>=/*signed*/ shift;
+ e2 = IRExpr_Const(IRConst_U16(toUShort(s16)));
+ }
+ break;
+ }
case Iop_Sar32: {
/* paranoid ... */
/*signed*/ Int s32;
@@ -1978,6 +2316,24 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
}
/* -- Shr -- */
+ case Iop_Shr8: {
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 7)
+ e2 = IRExpr_Const(IRConst_U8(toUChar(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8
+ >> shift))));
+ break;
+ }
+ case Iop_Shr16: {
+ vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8);
+ shift = e->Iex.Binop.arg2->Iex.Const.con->Ico.U8;
+ if (shift >= 0 && shift <= 15)
+ e2 = IRExpr_Const(IRConst_U16(toUShort(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16
+ >> shift))));
+ break;
+ }
case Iop_Shr32: {
/* paranoid ... */
/*unsigned*/ UInt u32;
@@ -2004,12 +2360,26 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
}
/* -- CmpEQ -- */
+ case Iop_CmpEQ8:
+ case Iop_CasCmpEQ8:
+ e2 = IRExpr_Const(IRConst_U1(toBool(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U8
+ == e->Iex.Binop.arg2->Iex.Const.con->Ico.U8))));
+ break;
+ case Iop_CmpEQ16:
+ case Iop_CasCmpEQ16:
+ e2 = IRExpr_Const(IRConst_U1(toBool(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16
+ == e->Iex.Binop.arg2->Iex.Const.con->Ico.U16))));
+ break;
case Iop_CmpEQ32:
+ case Iop_CasCmpEQ32:
e2 = IRExpr_Const(IRConst_U1(toBool(
(e->Iex.Binop.arg1->Iex.Const.con->Ico.U32
== e->Iex.Binop.arg2->Iex.Const.con->Ico.U32))));
break;
case Iop_CmpEQ64:
+ case Iop_CasCmpEQ64:
e2 = IRExpr_Const(IRConst_U1(toBool(
(e->Iex.Binop.arg1->Iex.Const.con->Ico.U64
== e->Iex.Binop.arg2->Iex.Const.con->Ico.U64))));
@@ -2023,6 +2393,13 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
((0xFF & e->Iex.Binop.arg1->Iex.Const.con->Ico.U8)
!= (0xFF & e->Iex.Binop.arg2->Iex.Const.con->Ico.U8)))));
break;
+ case Iop_CmpNE16:
+ case Iop_CasCmpNE16:
+ case Iop_ExpCmpNE16:
+ e2 = IRExpr_Const(IRConst_U1(toBool(
+ (e->Iex.Binop.arg1->Iex.Const.con->Ico.U16
+ != e->Iex.Binop.arg2->Iex.Const.con->Ico.U16))));
+ break;
case Iop_CmpNE32:
case Iop_CasCmpNE32:
case Iop_ExpCmpNE32:
@@ -2103,8 +2480,64 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
e2 = IRExpr_Const(IRConst_U32(r));
break;
}
+ case Iop_CmpORD64S: {
+ /* very paranoid */
+ ULong u64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64;
+ ULong u64b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U64;
+ Long s64a = (Long)u64a;
+ Long s64b = (Long)u64b;
+ Int r = 0x2; /* EQ */
+ if (s64a < s64b) {
+ r = 0x8; /* LT */
+ }
+ else if (s64a > s64b) {
+ r = 0x4; /* GT */
+ }
+ e2 = IRExpr_Const(IRConst_U64(r));
+ break;
+ }
+ case Iop_CmpORD32U: {
+ UInt u32a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U32;
+ UInt u32b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U32;
+ Int r = 0x2; /* EQ */
+ if (u32a < u32b) {
+ r = 0x8; /* LT */
+ }
+ else if (u32a > u32b) {
+ r = 0x4; /* GT */
+ }
+ e2 = IRExpr_Const(IRConst_U32(r));
+ break;
+ }
+ case Iop_CmpORD64U: {
+ ULong u64a = e->Iex.Binop.arg1->Iex.Const.con->Ico.U64;
+ ULong u64b = e->Iex.Binop.arg2->Iex.Const.con->Ico.U64;
+ Int r = 0x2; /* EQ */
+ if (u64a < u64b) {
+ r = 0x8; /* LT */
+ }
+ else if (u64a > u64b) {
+ r = 0x4; /* GT */
+ }
+ e2 = IRExpr_Const(IRConst_U64(r));
+ break;
+ }
/* -- nHLto2n -- */
+ case Iop_8HLto16:
+ e2 = IRExpr_Const(IRConst_U16(toUShort(
+ (((UInt)(e->Iex.Binop.arg1
+ ->Iex.Const.con->Ico.U8)) << 8)
+ | ((UInt)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U8)))
+ ));
+ break;
+ case Iop_16HLto32:
+ e2 = IRExpr_Const(IRConst_U32(
+ (((UInt)(e->Iex.Binop.arg1
+ ->Iex.Const.con->Ico.U16)) << 16)
+ | ((UInt)(e->Iex.Binop.arg2->Iex.Const.con->Ico.U16))
+ ));
+ break;
case Iop_32HLto64:
e2 = IRExpr_Const(IRConst_U64(
(((ULong)(e->Iex.Binop.arg1
@@ -2166,52 +2599,50 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
}
} else {
+ IROp widen_op = Iop_INVALID;
/* other cases (identities, etc) */
switch (e->Iex.Binop.op) {
+ case Iop_Shl8:
+ case Iop_Shl16:
case Iop_Shl32:
case Iop_Shl64:
+ case Iop_Shr8:
+ case Iop_Shr16:
+ case Iop_Shr32:
case Iop_Shr64:
- case Iop_Sar64:
- /* Shl32/Shl64/Shr64/Sar64(x,0) ==> x */
- if (isZeroU(e->Iex.Binop.arg2)) {
- e2 = e->Iex.Binop.arg1;
- break;
- }
- /* Shl32/Shl64/Shr64(0,x) ==> 0 */
- if (isZeroU(e->Iex.Binop.arg1)) {
- e2 = e->Iex.Binop.arg1;
- break;
- }
- break;
-
+ case Iop_Sar8:
+ case Iop_Sar16:
case Iop_Sar32:
- case Iop_Shr32:
- /* Shr32/Sar32(x,0) ==> x */
+ case Iop_Sar64:
+ /* Shl8/Shl16/Shl32/Shl64(x,0) ==> x
+ Shr8/Shr16/Shr32/Shr64(x,0) ==> x
+ Sar8/Sar16/Sar32/Sar64(x,0) ==> x */
if (isZeroU(e->Iex.Binop.arg2)) {
e2 = e->Iex.Binop.arg1;
break;
}
break;
+ case Iop_Or1:
case Iop_Or8:
case Iop_Or16:
case Iop_Or32:
case Iop_Or64:
case Iop_Max32U:
- /* Or8/Or16/Or32/Or64/Max32U(x,0) ==> x */
+ /* Or1/Or8/Or16/Or32/Or64/Max32U(x,0) ==> x */
if (isZeroU(e->Iex.Binop.arg2)) {
e2 = e->Iex.Binop.arg1;
break;
}
- /* Or8/Or16/Or32/Or64/Max32U(0,x) ==> x */
+ /* Or1/Or8/Or16/Or32/Or64/Max32U(0,x) ==> x */
if (isZeroU(e->Iex.Binop.arg1)) {
e2 = e->Iex.Binop.arg2;
break;
}
- /* Or8/Or16/Or32/Or64/Max32U(x,1---1b) ==> 1---1b */
- /* Or8/Or16/Or32/Or64/Max32U(1---1b,x) ==> 1---1b */
+ /* Or1/Or8/Or16/Or32/Or64/Max32U(x,1---1b) ==> 1---1b */
+ /* Or1/Or8/Or16/Or32/Or64/Max32U(1---1b,x) ==> 1---1b */
if (isOnesU(e->Iex.Binop.arg1) || isOnesU(e->Iex.Binop.arg2)) {
e2 = mkOnesOfPrimopResultType(e->Iex.Binop.op);
break;
@@ -2224,54 +2655,51 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
break;
case Iop_Add8:
- /* Add8(t,t) ==> t << 1.
- Memcheck doesn't understand that
- x+x produces a defined least significant bit, and it seems
- simplest just to get rid of the problem by rewriting it
- out, since the opportunity to do so exists. */
- if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
- e2 = IRExpr_Binop(Iop_Shl8, e->Iex.Binop.arg1,
- IRExpr_Const(IRConst_U8(1)));
- break;
- }
- break;
-
- /* NB no Add16(t,t) case yet as no known test case exists */
-
+ case Iop_Add16:
case Iop_Add32:
case Iop_Add64:
- /* Add32/Add64(x,0) ==> x */
+ /* Add8/Add16/Add32/Add64(x,0) ==> x */
if (isZeroU(e->Iex.Binop.arg2)) {
e2 = e->Iex.Binop.arg1;
break;
}
- /* Add32/Add64(0,x) ==> x */
+ /* Add8/Add16/Add32/Add64(0,x) ==> x */
if (isZeroU(e->Iex.Binop.arg1)) {
e2 = e->Iex.Binop.arg2;
break;
}
- /* Add32/Add64(t,t) ==> t << 1. Same rationale as for Add8. */
+ /* Add8/Add16/Add32/Add64(t,t) ==> t << 1.
+ Memcheck doesn't understand that
+ x+x produces a defined least significant bit, and it seems
+ simplest just to get rid of the problem by rewriting it
+ out, since the opportunity to do so exists. */
if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
- e2 = IRExpr_Binop(
- e->Iex.Binop.op == Iop_Add32 ? Iop_Shl32 : Iop_Shl64,
- e->Iex.Binop.arg1, IRExpr_Const(IRConst_U8(1)));
+ IROp add_op = e->Iex.Binop.op;
+ IROp shift_op = (add_op == Iop_Add64) ? Iop_Shl64 :
+ (add_op == Iop_Add32) ? Iop_Shl32 :
+ (add_op == Iop_Add16) ? Iop_Shl16 : Iop_Shl8;
+ e2 = IRExpr_Binop(shift_op, e->Iex.Binop.arg1,
+ IRExpr_Const(IRConst_U8(1)));
break;
}
break;
+ case Iop_Sub8:
+ case Iop_Sub16:
case Iop_Sub32:
case Iop_Sub64:
- /* Sub32/Sub64(x,0) ==> x */
+ /* Sub8/Sub16/Sub32/Sub64(x,0) ==> x */
if (isZeroU(e->Iex.Binop.arg2)) {
e2 = e->Iex.Binop.arg1;
break;
}
- /* Sub32/Sub64(t,t) ==> 0, for some IRTemp t */
+ /* Sub8/Sub16/Sub32/Sub64(t,t) ==> 0, for some IRTemp t */
if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
e2 = mkZeroOfPrimopResultType(e->Iex.Binop.op);
break;
}
break;
+
case Iop_Sub8x16:
/* Sub8x16(x,0) ==> x */
if (isZeroV128(e->Iex.Binop.arg2)) {
@@ -2280,6 +2708,62 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
}
break;
+ case Iop_Mul8:
+ case Iop_Mul16:
+ case Iop_Mul32:
+ case Iop_Mul64:
+ widen_op = Iop_INVALID;
+ goto common_mulopt;
+
+ case Iop_MullU8: widen_op = Iop_8Uto16; goto common_mulopt;
+ case Iop_MullS8: widen_op = Iop_8Sto16; goto common_mulopt;
+ case Iop_MullU16: widen_op = Iop_16Uto32; goto common_mulopt;
+ case Iop_MullS16: widen_op = Iop_16Sto32; goto common_mulopt;
+ case Iop_MullU32: widen_op = Iop_32Uto64; goto common_mulopt;
+ case Iop_MullS32: widen_op = Iop_32Sto64; goto common_mulopt;
+
+ common_mulopt:
+ /* Multiplying x with 0 ==> 0 */
+ if (isZeroU(e->Iex.Binop.arg1) || isZeroU(e->Iex.Binop.arg2)) {
+ e2 = mkZeroOfPrimopResultType(e->Iex.Binop.op);
+ break;
+ }
+ /* Multiplying x with 1 ==> x */
+ if (isOneU(e->Iex.Binop.arg1)) {
+ e2 = (widen_op == Iop_INVALID) ? e->Iex.Binop.arg2
+ : IRExpr_Unop(widen_op, e->Iex.Binop.arg2);
+ break;
+ }
+ if (isOneU(e->Iex.Binop.arg2)) {
+ e2 = (widen_op == Iop_INVALID) ? e->Iex.Binop.arg1
+ : IRExpr_Unop(widen_op, e->Iex.Binop.arg1);
+ break;
+ }
+ break;
+
+ case Iop_DivU32:
+ case Iop_DivS32:
+ case Iop_DivU64:
+ case Iop_DivS64:
+ /* Dividing x by 1 ==> x */
+ if (isOneU(e->Iex.Binop.arg2)) {
+ e2 = e->Iex.Binop.arg1;
+ break;
+ }
+
+ /* Dividing x by x ==> 1
+ DON'T. The reason is that we cannot decide at JIT time whether
+ e->Iex.Binop.arg2 might evaluate to zero. Suppose it does.
+ Then we would be rewriting 0 / 0 ==> 1 and that is clearly
+ wrong. */
+
+ /* Dividing 0 by x ==> 0 */
+ if (isZeroU(e->Iex.Binop.arg1)) {
+ e2 = mkZeroOfPrimopResultType(e->Iex.Binop.op);
+ break;
+ }
+ break;
+
case Iop_And1:
case Iop_And8:
case Iop_And16:
@@ -2432,14 +2916,27 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
}
break;
+ case Iop_ExpCmpNE8:
+ case Iop_ExpCmpNE16:
+ case Iop_ExpCmpNE32:
+ case Iop_ExpCmpNE64:
+ case Iop_CmpLT32S:
+ case Iop_CmpLT64S:
+ case Iop_CmpLT32U:
+ case Iop_CmpLT64U:
+ case Iop_CmpNE8:
+ case Iop_CmpNE16:
case Iop_CmpNE32:
- /* CmpNE32(t,t) ==> 0, for some IRTemp t */
+ case Iop_CmpNE64:
+ /* Integer comparisons for some kind of inequality yield
+ 'False' when both operands are identical. */
if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
- e2 = mkZeroOfPrimopResultType(e->Iex.Binop.op);
+ e2 = mkFalse();
break;
}
/* CmpNE32(1Uto32(b), 0) ==> b */
- if (isZeroU32(e->Iex.Binop.arg2)) {
+ if (e->Iex.Binop.op == Iop_CmpNE32 &&
+ isZeroU(e->Iex.Binop.arg2)) {
IRExpr* a1 = chase(env, e->Iex.Binop.arg1);
if (a1 && a1->tag == Iex_Unop
&& a1->Iex.Unop.op == Iop_1Uto32) {
@@ -2449,10 +2946,22 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
}
break;
- // in total 32 bits
+ case Iop_CmpLE32U:
+ case Iop_CmpLE64U:
+ case Iop_CmpLE32S:
+ case Iop_CmpLE64S:
+ case Iop_CmpEQ8:
+ case Iop_CmpEQ16:
case Iop_CmpEQ32:
- // in total 64 bits
case Iop_CmpEQ64:
+ /* CmpEQ8/16/32/64(t,t) ==> 1, for some IRTemp t */
+ /* CmpLE32U/64U/32S/64S(t,t) ==> 1, for some IRTemp t */
+ if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
+ e2 = mkTrue();
+ }
+ break;
+
+ // in total 64 bits
case Iop_CmpEQ8x8:
case Iop_CmpEQ16x4:
case Iop_CmpEQ32x2:
@@ -2559,6 +3068,11 @@ static IRExpr* fold_Expr ( IRExpr** env, IRExpr* e )
return env == NULL ? e : fold_Expr_WRK(env, e);
}
+IRExpr* foldIRExpr ( IRExpr** env, IRExpr* e )
+{
+ return fold_Expr(env, e);
+}
+
/* Apply the subst to a simple 1-level expression -- guaranteed to be
1-level due to previous flattening pass. */
@@ -2678,7 +3192,7 @@ static IRExpr* subst_Expr ( IRExpr** env, IRExpr* ex )
As a result of this, the stmt may wind up being turned into a no-op.
*/
static IRStmt* subst_and_maybe_fold_Stmt ( Bool doFolding,
- IRExpr** env, IRStmt* st )
+ IRExpr** env, const IRStmt* st )
{
# if 0
vex_printf("\nsubst and maybe fold stmt\n");
@@ -3063,7 +3577,8 @@ static IRSB* cprop_BB_WRK ( IRSB* in, Bool mustRetainNoOps, Bool doFolding )
}
-IRSB* cprop_BB ( IRSB* in ) {
+IRSB* cprop_BB ( IRSB* in )
+{
return cprop_BB_WRK(in, /*mustRetainNoOps=*/False, /*doFolding=*/True);
}
@@ -3085,7 +3600,7 @@ static void addUses_Temp ( Bool* set, IRTemp tmp )
set[(Int)tmp] = True;
}
-static void addUses_Expr ( Bool* set, IRExpr* e )
+static void addUses_Expr ( Bool* set, const IRExpr* e )
{
Int i;
switch (e->tag) {
@@ -3135,7 +3650,7 @@ static void addUses_Expr ( Bool* set, IRExpr* e )
}
}
-static void addUses_Stmt ( Bool* set, IRStmt* st )
+static void addUses_Stmt ( Bool* set, const IRStmt* st )
{
Int i;
IRDirty* d;
@@ -3214,23 +3729,6 @@ static void addUses_Stmt ( Bool* set, IRStmt* st )
}
-/* Is this literally IRExpr_Const(IRConst_U1(False)) ? */
-static Bool isZeroU1 ( IRExpr* e )
-{
- return toBool( e->tag == Iex_Const
- && e->Iex.Const.con->tag == Ico_U1
- && e->Iex.Const.con->Ico.U1 == False );
-}
-
-/* Is this literally IRExpr_Const(IRConst_U1(True)) ? */
-static Bool isOneU1 ( IRExpr* e )
-{
- return toBool( e->tag == Iex_Const
- && e->Iex.Const.con->tag == Ico_U1
- && e->Iex.Const.con->Ico.U1 == True );
-}
-
-
/* Note, this destructively modifies the given IRSB. */
/* Scan backwards through statements, carrying a set of IRTemps which
@@ -3268,7 +3766,7 @@ static Bool isOneU1 ( IRExpr* e )
continue;
/* take note of any unconditional exits */
if (st->tag == Ist_Exit
- && isOneU1(st->Ist.Exit.guard))
+ && isOneU(st->Ist.Exit.guard))
i_unconditional_exit = i;
if (st->tag == Ist_WrTmp
&& set[(Int)(st->Ist.WrTmp.tmp)] == False) {
@@ -3283,7 +3781,7 @@ static Bool isOneU1 ( IRExpr* e )
else
if (st->tag == Ist_Dirty
&& st->Ist.Dirty.details->guard
- && isZeroU1(st->Ist.Dirty.details->guard)) {
+ && isZeroU(st->Ist.Dirty.details->guard)) {
/* This is a dirty helper which will never get called.
Delete it. */
bb->stmts[i] = IRStmt_NoOp();
@@ -3415,8 +3913,8 @@ GSAliasing getAliasingRelation_IC ( IRRegArray* descr1, IRExpr* ix1,
static
GSAliasing getAliasingRelation_II (
- IRRegArray* descr1, IRExpr* ix1, Int bias1,
- IRRegArray* descr2, IRExpr* ix2, Int bias2
+ IRRegArray* descr1, const IRExpr* ix1, Int bias1,
+ IRRegArray* descr2, const IRExpr* ix2, Int bias2
)
{
UInt minoff1, maxoff1, minoff2, maxoff2;
@@ -5397,10 +5895,12 @@ static IRExpr* atbSubst_Temp ( ATmpInfo* env, IRTemp tmp )
'single-shot', so once a binding is used, it is marked as no longer
available, by setting its .bindee field to NULL. */
-static inline Bool is_Unop ( IRExpr* e, IROp op ) {
+static inline Bool is_Unop ( IRExpr* e, IROp op )
+{
return e->tag == Iex_Unop && e->Iex.Unop.op == op;
}
-static inline Bool is_Binop ( IRExpr* e, IROp op ) {
+static inline Bool is_Binop ( IRExpr* e, IROp op )
+{
return e->tag == Iex_Binop && e->Iex.Binop.op == op;
}
@@ -5418,7 +5918,7 @@ static IRExpr* fold_IRExpr_Binop ( IROp op, IRExpr* a1, IRExpr* a2 )
case Iop_CmpNE32:
/* Since X has type Ity_I1 we can simplify:
CmpNE32(1Uto32(X),0)) ==> X */
- if (is_Unop(a1, Iop_1Uto32) && isZeroU32(a2))
+ if (is_Unop(a1, Iop_1Uto32) && isZeroU(a2))
return a1->Iex.Unop.arg;
break;
@@ -6844,7 +7344,8 @@ IRSB* do_iropt_BB(
return bb;
}
-IRSB* do_minimal_initial_iropt_BB(IRSB* bb0) {
+IRSB* do_minimal_initial_iropt_BB(IRSB* bb0)
+{
/* First flatten the block out, since all other phases assume flat code. */
IRSB* bb = flatten_BB ( bb0 );
diff --git a/VEX/priv/ir_opt.h b/VEX/priv/ir_opt.h
index e5127be6c7..7626866b13 100644
--- a/VEX/priv/ir_opt.h
+++ b/VEX/priv/ir_opt.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/main_globals.c b/VEX/priv/main_globals.c
index 9167e8131c..6dd7723de3 100644
--- a/VEX/priv/main_globals.c
+++ b/VEX/priv/main_globals.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -57,7 +57,7 @@ Int vex_debuglevel = 0;
Int vex_traceflags = 0;
/* Max # guest insns per bb */
-VexControl vex_control = { 0,0,VexRegUpd_INVALID,0,0,False,0 };
+VexControl vex_control = { 0,0,VexRegUpd_INVALID,0,0,False,0,False };
diff --git a/VEX/priv/main_globals.h b/VEX/priv/main_globals.h
index 948079f7d6..487a42741b 100644
--- a/VEX/priv/main_globals.h
+++ b/VEX/priv/main_globals.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c
index 0520fd7470..08e4587f1b 100644
--- a/VEX/priv/main_main.c
+++ b/VEX/priv/main_main.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -204,6 +204,12 @@ void LibVEX_default_VexControl ( /*OUT*/ VexControl* vcon )
vcon->guest_max_insns = 60;
vcon->guest_chase = True;
vcon->regalloc_version = 3;
+ vcon->iropt_fold_expr = True;
+}
+
+void LibVEX_set_VexControl ( VexControl vcon )
+{
+ __builtin_memcpy(&vex_control, &vcon, sizeof vex_control);
}
@@ -713,7 +719,7 @@ IRSB* LibVEX_FrontEnd ( /*MOD*/ VexTranslateArgs* vta,
vta->guest_extents,
&vta->archinfo_host,
guest_word_type, host_word_type);
-
+
if (vex_traceflags & VEX_TRACE_INST) {
vex_printf("\n------------------------"
" After instrumentation "
@@ -1535,6 +1541,14 @@ const HChar* LibVEX_EmNote_string ( VexEmNote ew )
" feature requires the floating point extension facility\n"
" which is not available on this host. Continuing using\n"
" the rounding mode from FPC. Results may differ!";
+ case EmWarn_S390X_XxC_not_zero:
+ return "Encountered an insn with the IEEE-inexact-exception control\n"
+ " (XxC) bit set to 1. This is not supported. Continuing anyway.\n"
+ " IEEE-inexact exceptions will not be suppressed.";
+ case EmWarn_S390X_XiC_not_zero:
+ return "Encountered an insn with the IEEE-invalid-operation-exception\n"
+ " control (XiC) bit set to 1. This is not supported. Continuing anyway.\n"
+ " IEEE-invalid-operation exceptions will not be suppressed.";
case EmFail_S390X_stfle:
return "Instruction stfle is not supported on this host";
case EmFail_S390X_stckf:
@@ -1675,7 +1689,8 @@ void LibVEX_default_VexAbiInfo ( /*OUT*/VexAbiInfo* vbi )
}
-static IRType arch_word_size (VexArch arch) {
+static IRType arch_word_size (VexArch arch)
+{
switch (arch) {
case VexArchX86:
case VexArchARM:
diff --git a/VEX/priv/main_util.c b/VEX/priv/main_util.c
index fffe4b4263..8d99eab83f 100644
--- a/VEX/priv/main_util.c
+++ b/VEX/priv/main_util.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -632,9 +632,9 @@ UInt vex_sprintf ( HChar* buf, const HChar *format, ... )
/*--- Misaligned memory access support ---*/
/*---------------------------------------------------------*/
-UInt read_misaligned_UInt_LE ( void* addr )
+UInt read_misaligned_UInt_LE ( const void* addr )
{
- UChar* p = (UChar*)addr;
+ const UChar* p = addr;
UInt w = 0;
w = (w << 8) | p[3];
w = (w << 8) | p[2];
@@ -643,9 +643,9 @@ UInt read_misaligned_UInt_LE ( void* addr )
return w;
}
-ULong read_misaligned_ULong_LE ( void* addr )
+ULong read_misaligned_ULong_LE ( const void* addr )
{
- UChar* p = (UChar*)addr;
+ const UChar* p = addr;
ULong w = 0;
w = (w << 8) | p[7];
w = (w << 8) | p[6];
diff --git a/VEX/priv/main_util.h b/VEX/priv/main_util.h
index 7fd304dd14..4abae5440e 100644
--- a/VEX/priv/main_util.h
+++ b/VEX/priv/main_util.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -195,8 +195,8 @@ static inline void* LibVEX_Alloc_inline ( SizeT nbytes )
/* Misaligned memory access support. */
-extern UInt read_misaligned_UInt_LE ( void* addr );
-extern ULong read_misaligned_ULong_LE ( void* addr );
+extern UInt read_misaligned_UInt_LE ( const void* addr );
+extern ULong read_misaligned_ULong_LE ( const void* addr );
extern void write_misaligned_UInt_LE ( void* addr, UInt w );
extern void write_misaligned_ULong_LE ( void* addr, ULong w );
diff --git a/VEX/priv/mips_defs.h b/VEX/priv/mips_defs.h
index cb19eac525..94653ee482 100644
--- a/VEX/priv/mips_defs.h
+++ b/VEX/priv/mips_defs.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/multiarch_main_main.c b/VEX/priv/multiarch_main_main.c
index 8110b856d0..ace23eebf2 100644
--- a/VEX/priv/multiarch_main_main.c
+++ b/VEX/priv/multiarch_main_main.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/s390_defs.h b/VEX/priv/s390_defs.h
index 482dc4f0e9..64c30987cc 100644
--- a/VEX/priv/s390_defs.h
+++ b/VEX/priv/s390_defs.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/s390_disasm.c b/VEX/priv/s390_disasm.c
index 0eb8f922f5..d2325e7ca4 100644
--- a/VEX/priv/s390_disasm.c
+++ b/VEX/priv/s390_disasm.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/priv/s390_disasm.h b/VEX/priv/s390_disasm.h
index 14731898c5..d3096fd47a 100644
--- a/VEX/priv/s390_disasm.h
+++ b/VEX/priv/s390_disasm.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h
index 2dbfbe770e..0be6deb824 100644
--- a/VEX/pub/libvex.h
+++ b/VEX/pub/libvex.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -158,7 +158,8 @@ typedef
#define VEX_S390X_MODEL_Z14_ZR1 15
#define VEX_S390X_MODEL_Z15 16
#define VEX_S390X_MODEL_Z16 17
-#define VEX_S390X_MODEL_UNKNOWN 18 /* always last in list */
+#define VEX_S390X_MODEL_Z17 18
+#define VEX_S390X_MODEL_UNKNOWN 19 /* always last in list */
#define VEX_S390X_MODEL_MASK 0x3F
#define VEX_HWCAPS_S390X_LDISP (1<<6) /* Long-displacement facility */
@@ -572,6 +573,9 @@ typedef
- '3': current, faster implementation; perhaps producing slightly worse
spilling decisions. */
UInt regalloc_version;
+ /* When false constant folding and algebric simplification is disabled.
+ This is used in the iropt tester. */
+ Bool iropt_fold_expr;
}
VexControl;
@@ -581,6 +585,8 @@ typedef
extern
void LibVEX_default_VexControl ( /*OUT*/ VexControl* vcon );
+extern
+void LibVEX_set_VexControl ( VexControl );
/*-------------------------------------------------------*/
/*--- Storage management control ---*/
@@ -960,7 +966,14 @@ extern void LibVEX_ShowStats ( void );
#define NO_ROUNDING_MODE (~0u)
-typedef
+typedef
+ enum {
+ IRICB_vbit,
+ IRICB_iropt,
+ }
+ IRICB_t;
+
+typedef
struct {
IROp op; // the operation to perform
HWord result; // address of the result
@@ -976,14 +989,38 @@ typedef
UInt rounding_mode;
UInt num_operands; // excluding rounding mode, if any
/* The following two members describe if this operand has immediate
- * operands. There are a few restrictions:
- * (1) An operator can have at most one immediate operand.
+ * operands. There are a few restrictions:
+ * (1) An operator can have at most one immediate operand.
* (2) If there is an immediate operand, it is the right-most operand
- * An immediate_index of 0 means there is no immediate operand.
+ * An immediate_index of 0 means there is no immediate operand.
*/
UInt immediate_type; // size of immediate Ity_I8, Ity_16
UInt immediate_index; // operand number: 1, 2
}
+ IRICB_vbit_payload;
+
+typedef
+ struct {
+ IROp op; // the operation to perform
+ HWord result_fold; // address of the result (with folding)
+ HWord result_nofold; // address of the result (without folding)
+ HWord opnd1; // address of 1st operand
+ HWord opnd2; // address of 2nd operand
+ IRType t_result; // type of result
+ IRType t_opnd1; // type of 1st operand
+ IRType t_opnd2; // type of 2nd operand
+ UInt num_operands;
+ }
+ IRICB_iropt_payload;
+
+typedef
+ struct {
+ IRICB_t kind;
+ union {
+ IRICB_vbit_payload vbit;
+ IRICB_iropt_payload iropt;
+ };
+ }
IRICB;
extern void LibVEX_InitIRI ( const IRICB * );
diff --git a/VEX/pub/libvex_basictypes.h b/VEX/pub/libvex_basictypes.h
index 6c48b227c0..67bc1a9b2a 100644
--- a/VEX/pub/libvex_basictypes.h
+++ b/VEX/pub/libvex_basictypes.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex_emnote.h b/VEX/pub/libvex_emnote.h
index be17a8922f..331c1b603f 100644
--- a/VEX/pub/libvex_emnote.h
+++ b/VEX/pub/libvex_emnote.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -37,7 +37,7 @@
#include "libvex_basictypes.h"
/* VEX can sometimes generate code which returns to the dispatcher
- with the guest state pointer set to VEX_TRC_JMP_EMWARN or
+ with the guest state pointer set to VEX_TRC_JMP_EMWARN or
VEX_TRC_JMP_EMFAIL. This means that VEX is trying to tell Valgrind
something noteworthy about emulation progress. For example, that Valgrind
is doing imprecise emulation in some sense. The guest's pseudo-register
@@ -67,16 +67,16 @@ typedef
/* unmasking SSE FP exceptions is not supported */
EmWarn_X86_sseExns,
-
+
/* setting mxcsr.fz is not supported */
EmWarn_X86_fz,
-
+
/* setting mxcsr.daz is not supported */
EmWarn_X86_daz,
/* settings to %eflags.ac (alignment check) are noted but ignored */
EmWarn_X86_acFlag,
-
+
/* unmasking PPC32/64 FP exceptions is not supported */
EmWarn_PPCexns,
@@ -89,6 +89,16 @@ typedef
facility is not available on this host */
EmWarn_S390X_fpext_rounding,
+ /* Various BFP insns have an M4 field containing the
+ IEEE-inexact-exception (XxC) control bit. That bit cannot me modelled
+ in VEX and is expected to be zero. */
+ EmWarn_S390X_XxC_not_zero,
+
+ /* Various DFP insns have an M4 field containing the
+ IEEE-invalid-operation (XiC) control bit. That bit cannot me modelled
+ in VEX and is expected to be zero. */
+ EmWarn_S390X_XiC_not_zero,
+
/* stfle insn is not supported on this host */
EmFail_S390X_stfle,
diff --git a/VEX/pub/libvex_guest_amd64.h b/VEX/pub/libvex_guest_amd64.h
index 8f6bb560cb..e96b6b0f3f 100644
--- a/VEX/pub/libvex_guest_amd64.h
+++ b/VEX/pub/libvex_guest_amd64.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -170,8 +170,11 @@ typedef
been interrupted by a signal. */
ULong guest_IP_AT_SYSCALL;
- /* Padding to make it have an 16-aligned size */
- ULong pad3;
+ /* Used on FreeBSD as part of a mechanism to allow signal handlers
+ to use TLS. */
+ ULong guest_TLSBASE;
+
+ /* Add padding here to make it have an 16-aligned size */
}
VexGuestAMD64State;
diff --git a/VEX/pub/libvex_guest_arm.h b/VEX/pub/libvex_guest_arm.h
index 87bb03962a..a540f2b410 100644
--- a/VEX/pub/libvex_guest_arm.h
+++ b/VEX/pub/libvex_guest_arm.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex_guest_arm64.h b/VEX/pub/libvex_guest_arm64.h
index 298f4fcfaa..30317dae65 100644
--- a/VEX/pub/libvex_guest_arm64.h
+++ b/VEX/pub/libvex_guest_arm64.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex_guest_mips32.h b/VEX/pub/libvex_guest_mips32.h
index e769819d75..c43ac2f225 100644
--- a/VEX/pub/libvex_guest_mips32.h
+++ b/VEX/pub/libvex_guest_mips32.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex_guest_mips64.h b/VEX/pub/libvex_guest_mips64.h
index a953f0ab86..1ee2c18327 100644
--- a/VEX/pub/libvex_guest_mips64.h
+++ b/VEX/pub/libvex_guest_mips64.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex_guest_ppc32.h b/VEX/pub/libvex_guest_ppc32.h
index 9457e9bc0f..f0cdedacb6 100644
--- a/VEX/pub/libvex_guest_ppc32.h
+++ b/VEX/pub/libvex_guest_ppc32.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex_guest_ppc64.h b/VEX/pub/libvex_guest_ppc64.h
index c7fe874a89..cea6679286 100644
--- a/VEX/pub/libvex_guest_ppc64.h
+++ b/VEX/pub/libvex_guest_ppc64.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex_guest_riscv64.h b/VEX/pub/libvex_guest_riscv64.h
index 31264b1245..51b6469713 100644
--- a/VEX/pub/libvex_guest_riscv64.h
+++ b/VEX/pub/libvex_guest_riscv64.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex_guest_s390x.h b/VEX/pub/libvex_guest_s390x.h
index ec4d71bb45..c805dc0c0a 100644
--- a/VEX/pub/libvex_guest_s390x.h
+++ b/VEX/pub/libvex_guest_s390x.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex_guest_x86.h b/VEX/pub/libvex_guest_x86.h
index 50de8d3798..80916a2bab 100644
--- a/VEX/pub/libvex_guest_x86.h
+++ b/VEX/pub/libvex_guest_x86.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex_inner.h b/VEX/pub/libvex_inner.h
index 023d1f6a3e..9d11607248 100644
--- a/VEX/pub/libvex_inner.h
+++ b/VEX/pub/libvex_inner.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -37,8 +37,6 @@
// For more details, see README_DEVELOPPERS.
//--------------------------------------------------------------------
-#include "config.h"
-
// The code of the inner Valgrind (core or tool code) contains client
// requests (e.g. from helgrind.h, memcheck.h, ...) to help the
// outer Valgrind finding (relevant) errors in the inner Valgrind.
diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h
index 80ef8f27a4..3a1f92f45c 100644
--- a/VEX/pub/libvex_ir.h
+++ b/VEX/pub/libvex_ir.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -434,6 +434,18 @@ typedef
Iop_Or8, Iop_Or16, Iop_Or32, Iop_Or64,
Iop_And8, Iop_And16, Iop_And32, Iop_And64,
Iop_Xor8, Iop_Xor16, Iop_Xor32, Iop_Xor64,
+ /* Bitwise shift ops
+ Semantics as per C standard:
+ If the value of the right operand is negative or is greater
+ than or equal to the width of the left operand, the behaviour is
+ undefined.
+ For Shl: The result of E1 << E2 is E1 left-shifted E2 bit positions.
+ Vacated bits are filled with zeroes.
+ For Shr: The result of E1 >> E2 is E1 right-shifted E2 bit positions.
+ Vacated bits are filled with zeroes.
+ For Sar: The result of E1 >> E2 is E1 right-shifted E2 bit positions.
+ Vacated bits are filled with the most significant bit of E1 prior
+ to shifting. */
Iop_Shl8, Iop_Shl16, Iop_Shl32, Iop_Shl64,
Iop_Shr8, Iop_Shr16, Iop_Shr32, Iop_Shr64,
Iop_Sar8, Iop_Sar16, Iop_Sar32, Iop_Sar64,
@@ -462,13 +474,6 @@ typedef
Iop_MullU8, Iop_MullU16, Iop_MullU32, Iop_MullU64,
/* Counting bits */
- /* Ctz64/Ctz32/Clz64/Clz32 are UNDEFINED when given arguments of zero.
- You must ensure they are never given a zero argument. As of
- 2018-Nov-14 they are deprecated. Try to use the Nat variants
- immediately below, if you can.
- */
- Iop_Clz64, Iop_Clz32, /* count leading zeroes */
- Iop_Ctz64, Iop_Ctz32, /* count trailing zeros */
/* Count leading/trailing zeroes, with "natural" semantics for the
case where the input is zero: then the result is the number of bits
in the word. */
@@ -499,7 +504,13 @@ typedef
Iop_CmpORD32S, Iop_CmpORD64S,
/* Division */
- /* TODO: clarify semantics wrt rounding, negative values, whatever */
+ /* Semantics of division as per C standard:
+ If the value of the divisor is zero, the behaviour is undefined.
+ When integers are divided, the result of division is the algebraic
+ quotient with any fractional part discarded. In other words:
+ truncation towards zero. If the quotient a/b is representable,
+ the expression (a/b)*b + a%b shall equal a; otherwise, the behaviour
+ of division and modulo operation is undefined. */
Iop_DivU32, // :: I32,I32 -> I32 (simple div, no mod)
Iop_DivS32, // ditto, signed
Iop_DivU64, // :: I64,I64 -> I64 (simple div, no mod)
@@ -521,7 +532,7 @@ typedef
// of which lo half is div and hi half is mod
Iop_DivModS64to32, // ditto, signed
- Iop_DivModU128to64, // :: V128,I64 -> V128
+ Iop_DivModU128to64, // :: I128,I64 -> I128
// of which lo half is div and hi half is mod
Iop_DivModS128to64, // ditto, signed
@@ -2405,6 +2416,9 @@ extern IRExpr* deepCopyIRExpr ( const IRExpr* );
/* Pretty-print an IRExpr. */
extern void ppIRExpr ( const IRExpr* );
+/* Fold an IRExpr. Return folded result. */
+extern IRExpr* foldIRExpr ( IRExpr**, IRExpr* );
+
/* NULL-terminated IRExpr vector constructors, suitable for
use as arg lists in clean/dirty helper calls. */
extern IRExpr** mkIRExprVec_0 ( void );
diff --git a/VEX/pub/libvex_s390x_common.h b/VEX/pub/libvex_s390x_common.h
index ea6a59d274..295e0c29b0 100644
--- a/VEX/pub/libvex_s390x_common.h
+++ b/VEX/pub/libvex_s390x_common.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/pub/libvex_trc_values.h b/VEX/pub/libvex_trc_values.h
index c9adcb70d7..eb8fed925b 100644
--- a/VEX/pub/libvex_trc_values.h
+++ b/VEX/pub/libvex_trc_values.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/test/test-amd64.c b/VEX/test/test-amd64.c
index 9cb8c3dbe0..bedc99e98f 100644
--- a/VEX/test/test-amd64.c
+++ b/VEX/test/test-amd64.c
@@ -15,7 +15,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/VEX/test/test-i386.c b/VEX/test/test-i386.c
index a948519e15..3489b15478 100644
--- a/VEX/test/test-i386.c
+++ b/VEX/test/test-i386.c
@@ -5,7 +5,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/VEX/useful/Makefile-vex b/VEX/useful/Makefile-vex
index 637afc9830..42d6d66eb4 100644
--- a/VEX/useful/Makefile-vex
+++ b/VEX/useful/Makefile-vex
@@ -1,8 +1,8 @@
# Crude makefile to build the "vex" executable from test_main.c
vex: test_main.c test_main.h ../pub/*.h ../priv/*.c ../priv/*.h
- (cd ..; make -f Makefile-gcc)
- cc -I../pub -o vex test_main.c ../libvex.a
+ (cd ..; ${MAKE} -f Makefile-gcc)
+ ${CC} -I../pub -o vex test_main.c ../libvex.a
clean:
rm -f vex ../priv/*.o
diff --git a/VEX/useful/hd_fpu.c b/VEX/useful/hd_fpu.c
index 9655f12f84..86b7ff2711 100644
--- a/VEX/useful/hd_fpu.c
+++ b/VEX/useful/hd_fpu.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/VEX/useful/test_main.c b/VEX/useful/test_main.c
index 85168e7043..08513d9a0e 100644
--- a/VEX/useful/test_main.c
+++ b/VEX/useful/test_main.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -530,7 +530,7 @@ static void MC_helperc_value_check4_fail( void ) { }
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -2022,10 +2022,6 @@ IRExpr* expr2vbits_Unop ( MCEnv* mce, IROp op, IRAtom* atom )
case Iop_2xm1F64:
return mkPCastTo(mce, Ity_I64, vatom);
- case Iop_Clz32:
- case Iop_Ctz32:
- return mkPCastTo(mce, Ity_I32, vatom);
-
case Iop_32Sto64:
case Iop_32Uto64:
case Iop_V128to64:
diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am
index 9cec4f222b..b68cbac05a 100644
--- a/auxprogs/Makefile.am
+++ b/auxprogs/Makefile.am
@@ -2,27 +2,43 @@ include $(top_srcdir)/Makefile.all.am
dist_noinst_SCRIPTS = \
change-copyright-year \
+ pybuild.sh \
dump_insn_ppc.sh \
gen-mdg \
gsl19test \
+ ltp-tester.sh \
+ ltp-apply-patches.sh \
make_or_upd_vgversion_h \
nightly-build-summary \
+ s390-check-opcodes.pl \
+ s390-runone \
update-demangler \
posixtestsuite-1.5.1-diff-results
+LTP_FILTERS = \
+ filters/mmap18 \
+ filters/prctl10 \
+ filters/select03 \
+ filters/munmap01
+
+LTP_PATCHES =
+
EXTRA_DIST = \
docs/valgrind-listener-manpage.xml \
docs/valgrind-di-server-manpage.xml \
+ pylintrc \
gsl-1.6.patch \
gsl-1.6.supp \
gsl-1.6.out.x86.exp \
- ltp-tester.sh \
ltp-excludes.txt \
ltp-error-patterns.txt \
posixtestsuite-1.5.1-diff.txt \
ppcfround.c \
ppc64shifts.c \
- primes.c
+ primes.c \
+ ltp-patches/README \
+ $(LTP_FILTERS) \
+ $(LTP_PATCHES)
#----------------------------------------------------------------------------
# valgrind_listener (built for the primary target only)
@@ -33,7 +49,7 @@ bin_PROGRAMS = valgrind-listener valgrind-di-server
valgrind_listener_SOURCES = valgrind-listener.c
valgrind_listener_CPPFLAGS = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind
-valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI)
+valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI) -fhosted
valgrind_listener_CCASFLAGS = $(AM_CCASFLAGS_PRI)
valgrind_listener_LDFLAGS = $(AM_CFLAGS_PRI)
if VGCONF_PLATVARIANT_IS_ANDROID
@@ -52,7 +68,7 @@ endif
valgrind_di_server_SOURCES = valgrind-di-server.c
valgrind_di_server_CPPFLAGS = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind
-valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI)
+valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI) -fhosted
valgrind_di_server_CCASFLAGS = $(AM_CCASFLAGS_PRI)
valgrind_di_server_LDFLAGS = $(AM_CFLAGS_PRI)
if VGCONF_PLATVARIANT_IS_ANDROID
@@ -87,7 +103,7 @@ endif
getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = getoff.c
getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
-getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -fhosted
getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_PRI)
getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@
if HAVE_DLINFO_RTLD_DI_TLS_MODID
@@ -104,7 +120,7 @@ endif
if VGCONF_HAVE_PLATFORM_SEC
getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = getoff.c
getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
-getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) -fhosted
getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_SEC)
getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = $(AM_CFLAGS_SEC)
if HAVE_DLINFO_RTLD_DI_TLS_MODID
@@ -155,8 +171,8 @@ endif
endif
# Linux Test Project
-LTP_VERSION=20250130
-LTP_SHA256_SUM=02e4ec326be54c3fd92968229a468c02c665d168a8a673edc38a891f7395ae10
+LTP_VERSION=20250930
+LTP_SHA256_SUM=048fa4d69ddbe8a94aa15da9bdc85713ab07a0abbc3de2b8bdd9757644aef1e4
LTP_TAR_NAME=ltp-full-$(LTP_VERSION).tar.xz
LTP_URL=https://github.com/linux-test-project/ltp/releases/download/$(LTP_VERSION)/$(LTP_TAR_NAME)
LTP_TAR=$(AUX_CHECK_DIR)/$(LTP_TAR_NAME)
@@ -195,13 +211,15 @@ $(GSL_SRC_DIR)/gsl-patched: $(GSL_TAR)
autoreconf -f -i -Wnone)
touch $@
-$(LTP_SRC_DIR): $(LTP_TAR)
+$(LTP_SRC_DIR): $(LTP_TAR) ltp-apply-patches.sh $(LTP_PATCHES)
echo "$(LTP_SHA256_SUM) $(LTP_TAR)" | @SHA256SUM@ --check -
(cd $(AUX_CHECK_DIR) && \
tar Jxf $(LTP_TAR_NAME) && \
+ $(abs_top_srcdir)/auxprogs/ltp-apply-patches.sh $(LTP_SRC_DIR) && \
cd $(LTP_SRC_DIR) && \
./configure CC="${CC}" CXX="${CXX}" CFLAGS="$(LTP_CFLAGS)" && \
- ${MAKE} -j $(nproc) -C testcases/kernel/syscalls)
+ ${MAKE} clean && \
+ ${MAKE} -C testcases/kernel/syscalls)
touch $@
# We need make check -k because
@@ -211,7 +229,7 @@ $(GSL_BUILD_DIR)/gsl-build: $(GSL_SRC_DIR)/gsl-patched
mkdir -p $(GSL_BUILD_DIR)
(cd $(GSL_BUILD_DIR) && \
$(GSL_SRC_DIR)/configure CC="${CC}" CXX="${CXX}" CFLAGS="$(GSL_CFLAGS)" && \
- ${MAKE} -j $(nproc) && \
+ ${MAKE} && \
${MAKE} check -k || true)
touch $@
@@ -231,7 +249,13 @@ gsl-check: $(GSL_BUILD_DIR)/gsl-build
diff -u $(abs_top_srcdir)/auxprogs/gsl-1.6.out.x86.exp \
$(GSL_BUILD_DIR)/valgrind-gsl.out
+# Extract -jNUM from MAKEFLAGS.
+# Note that any spaces between -j and NUM have already been removed.
+# Also there will be only one (the last) -jNUM left in MAKEFLAGS.
+PARALLEL_JOBS=$(subst -j,,$(filter -j%,$(MAKEFLAGS)))
+
ltp-check: $(LTP_SRC_DIR)
+ PARALLEL_JOBS=$(PARALLEL_JOBS) \
LTP_SRC_DIR=$(LTP_SRC_DIR) \
VALGRIND=$(abs_top_builddir)/vg-in-place \
$(abs_top_srcdir)/auxprogs/ltp-tester.sh
diff --git a/auxprogs/filters/mmap18 b/auxprogs/filters/mmap18
new file mode 100755
index 0000000000..edaf9c15d0
--- /dev/null
+++ b/auxprogs/filters/mmap18
@@ -0,0 +1,29 @@
+#!/bin/awk -f
+
+# Filter out stuff like the following, since it is expected output for the select03 testcase:
+
+# mmap18: unempty log2.filtered:
+# ==24613==
+# ==24613== Process terminating with default action of signal 11 (SIGSEGV): dumping core
+# ==24613== Access not within mapped region at address 0x4B3AFF8
+# ==24613== at 0x401F86: check_depth_recursive (mmap18.c:118)
+# ==24613== If you believe this happened as a result of a stack
+# ==24613== overflow in your program's main thread (unlikely but
+# ==24613== possible), you can try to increase the size of the
+# ==24613== main thread stack using the --main-stacksize= flag.
+# ==24613== The main thread stack size used in this run was 8388608.
+# ==24620==
+# ==24620== Process terminating with default action of signal 11 (SIGSEGV): dumping core
+# ==24620== Access not within mapped region at address 0x4B2EFF8
+# ==24620== at 0x401F86: check_depth_recursive (mmap18.c:118)
+# ==24620== If you believe this happened as a result of a stack
+# ==24620== overflow in your program's main thread (unlikely but
+# ==24620== possible), you can try to increase the size of the
+# ==24620== main thread stack using the --main-stacksize= flag.
+# ==24620== The main thread stack size used in this run was 8388608.
+
+skip = 0
+/==[0-9][0-9]*==/ { skip = 1 }
+/Process terminating with default action of signal 11/ { skip = 1; skipblock=1 }
+/The main thread stack size used in this run was/ { skip = 1; skipblock=0 }
+!skip && !skipblock { print }
diff --git a/auxprogs/filters/munmap01 b/auxprogs/filters/munmap01
new file mode 100755
index 0000000000..b063ba84c1
--- /dev/null
+++ b/auxprogs/filters/munmap01
@@ -0,0 +1,35 @@
+#!/bin/awk -f
+
+# Filter out stuff like the following, since it is expected output for the munmap01 testcase:
+
+# munmap01: unempty log2.filtered:
+# ==1980523==
+# ==1980523== Process terminating with default action of signal 11 (SIGSEGV): dumping core
+# ==1980523== Access not within mapped region at address 0x483F000
+# ==1980523== at 0x401F9A: run (munmap01.c:46)
+# ==1980523== by 0x40D42F: fork_testrun.isra.0 (tst_test.c:1669)
+# ==1980523== by 0x40F894: tst_run_tcases (tst_test.c:2041)
+# ==1980523== by 0x401DCD: main (tst_test.h:738)
+# ==1980523== If you believe this happened as a result of a stack
+# ==1980523== overflow in your program's main thread (unlikely but
+# ==1980523== possible), you can try to increase the size of the
+# ==1980523== main thread stack using the --main-stacksize= flag.
+# ==1980523== The main thread stack size used in this run was 8388608.
+# ==1980540==
+# ==1980540== Process terminating with default action of signal 11 (SIGSEGV): dumping core
+# ==1980540== Access not within mapped region at address 0x4840000
+# ==1980540== at 0x401F9A: run (munmap01.c:46)
+# ==1980540== by 0x40D42F: fork_testrun.isra.0 (tst_test.c:1669)
+# ==1980540== by 0x40F894: tst_run_tcases (tst_test.c:2041)
+# ==1980540== by 0x401DCD: main (tst_test.h:738)
+# ==1980540== If you believe this happened as a result of a stack
+# ==1980540== overflow in your program's main thread (unlikely but
+# ==1980540== possible), you can try to increase the size of the
+# ==1980540== main thread stack using the --main-stacksize= flag.
+# ==1980540== The main thread stack size used in this run was 8388608.
+
+skip = 0
+/==[0-9][0-9]*==/ { skip = 1 }
+/Process terminating with default action of signal 11/ { skip = 1; skipblock=1 }
+/The main thread stack size used in this run was/ { skip = 1; skipblock=0 }
+!skip && !skipblock { print }
diff --git a/auxprogs/filters/prctl10 b/auxprogs/filters/prctl10
new file mode 100755
index 0000000000..abed203843
--- /dev/null
+++ b/auxprogs/filters/prctl10
@@ -0,0 +1,18 @@
+#!/bin/awk -f
+
+# Filter out stuff like the following, since it is expected output for the
+# prctl10 testcase:
+
+# ==298306==
+# ==298306== Process terminating with default action of signal 11 (SIGSEGV): dumping core
+# ==298306== General Protection Fault
+# ==298306== at 0x40152B: verify_prctl (prctl10.c:75)
+# ==298306== by 0x40A894: fork_testrun.isra.0 (tst_test.c:1617)
+# ==298306== by 0x40CC53: tst_run_tcases (tst_test.c:1970)
+# ==298306== by 0x4011BD: main (tst_test.h:729)
+
+skip = 0
+/==[0-9][0-9]*==/ { skip = 1 }
+/Process terminating with default action of signal 11/ { skip = 1; skipblock=1 }
+/by.*main.*tst_test.h/ { skip = 1; skipblock=0 }
+!skip && !skipblock { print }
diff --git a/auxprogs/filters/select03 b/auxprogs/filters/select03
new file mode 100755
index 0000000000..368a884e7c
--- /dev/null
+++ b/auxprogs/filters/select03
@@ -0,0 +1,18 @@
+#!/bin/awk -f
+
+# Filter out stuff like the following, since it is expected output for the select03 testcase:
+
+# ==22396==
+# ==22396== Process terminating with default action of signal 11 (SIGSEGV): dumping core
+# ==22396== Bad permissions for mapped region at address 0x483B000
+# ==22396== at 0x4946397: select (in /usr/lib64/libc.so.6)
+# ==22396== by 0x4020BA: run (select_var.h:26)
+# ==22396== by 0x40B30C: fork_testrun (tst_test.c:1566)
+# ==22396== by 0x40D4EF: tst_run_tcases (tst_test.c:1918)
+# ==22396== by 0x401D4D: main (tst_test.h:725)
+
+skip = 0
+/==[0-9][0-9]*==/ { skip = 1 }
+/Process terminating with default action of signal 11/ { skip = 1; skipblock=1 }
+/by.*main.*tst_test.h/ { skip = 1; skipblock=0 }
+!skip && !skipblock { print }
diff --git a/auxprogs/getoff.c b/auxprogs/getoff.c
index 7cd9d24144..30d9cded1d 100644
--- a/auxprogs/getoff.c
+++ b/auxprogs/getoff.c
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/auxprogs/ltp-apply-patches.sh b/auxprogs/ltp-apply-patches.sh
new file mode 100755
index 0000000000..150dd2a9b0
--- /dev/null
+++ b/auxprogs/ltp-apply-patches.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -xe
+
+LTP_SRC_DIR=$1
+cd $(dirname $(readlink -f $0))
+echo "applying LTP patches ..."
+if compgen -G "ltp-patches/*.patch"; then
+ for i in ltp-patches/*.patch; do
+ patch -d "$LTP_SRC_DIR" -p1 < "$i"
+ done
+ echo "applying LTP patches finished"
+else
+ echo "no patches found, nothing to do"
+fi
diff --git a/auxprogs/ltp-excludes.txt b/auxprogs/ltp-excludes.txt
index 5b1d898c80..3a3d7e44d8 100644
--- a/auxprogs/ltp-excludes.txt
+++ b/auxprogs/ltp-excludes.txt
@@ -1,10 +1,40 @@
+# Exclude the following syscall tests because they are too slow:
bind06
epoll-ltp
+fork13
+fork14
+futex_cmp_requeue01
+futex_cmp_requeue02
inotify09
msgstress01
+pidfd_send_signal01
+pidfd_send_signal02
+pidfd_send_signal03
sendmsg03
setsockopt06
setsockopt07
signal05
signal06
timerfd_settime02
+# The following fcntl syscall tests time out, need at least
+# LTP_TIMEOUT_MUL=5 when run under memcheck
+fcntl14
+fcntl14_64
+fcntl34
+fcntl34_64
+fcntl36
+fcntl36_64
+# Tests fail because valgrind only supports a limited number
+# of clone flags.
+clone08
+close_range02
+kcmp03
+# Test fails because it tests something valgrind doesn't support:
+# We don't have fastbins so smblks & fsmblks are always 0. Also we
+# don't have a separate mmap allocator so set hblks & hblkhd to 0.
+mallinfo02
+mallinfo2_01
+# The shmctl05 testcase is a long running one. It does pass with
+# LTP_TIMEOUT_MUL set to some relatively high value. Let's just
+# skip it here.
+shmctl05
diff --git a/auxprogs/ltp-patches/README b/auxprogs/ltp-patches/README
new file mode 100644
index 0000000000..89df4bff10
--- /dev/null
+++ b/auxprogs/ltp-patches/README
@@ -0,0 +1,5 @@
+This directory contains LTP patches that are not included in the official LTP
+tarball. After a new version of LTP is adopted for Valgrind testing, this patch
+set should be reviewed and cleaned up. Patch filenames are expected to have the
+.patch suffix.
+
diff --git a/auxprogs/ltp-tester.sh b/auxprogs/ltp-tester.sh
index 000cfaa7f3..a95c603c58 100755
--- a/auxprogs/ltp-tester.sh
+++ b/auxprogs/ltp-tester.sh
@@ -8,72 +8,113 @@ if [ -z "${LTP_SRC_DIR:-}" ]; then
fi
ORIG_PATH=$PATH
-ORIG_PWD=$PWD
-LOGDIR=${LOGDIR:-$LTP_SRC_DIR/valgrind-ltp-logs}
-SUMMARY_LOG="$LOGDIR/summary.log"
+SCRIPT_SRC=$(dirname $0)
+LOGDIR=${LOGDIR:-$LTP_SRC_DIR/ltp/tests}
DIFFCMD="diff -u"
-VALGRIND="${VALGRIND:-$LTP_SRC_DIR/../../../vg-in-place}"
+# vgdb sensitive testcase: e.g. nftw01 nftw6401 setfsgid04 setfsgid03_16 symlink03
+VGARGS="-q --vgdb=no"
+VALGRIND="${VALGRIND:-$LTP_SRC_DIR/../../../vg-in-place} ${VGARGS}"
+# For parallel testing, consider IO intensive jobs, take nproc into account
+PARALLEL_JOBS=${PARALLEL_JOBS:-$(nproc)}
+# TESTS env var may be specified to restrict testing to selected test cases
+# Configure the LTP testsuite behavior per
+# https://lore.kernel.org/ltp/20250505195003.GB137650@pevik/T/#t
+export LTP_COLORIZE_OUTPUT=0
+export LTP_REPRODUCIBLE_OUTPUT=1
+export LTP_QUIET=1
-# Initialize LOGDIR
-mkdir -p $LOGDIR; rm -rf $LOGDIR/*
+# Initialize LOGDIR for bunsen upload (https://sourceware.org/bunsen/)
+mkdir -p $LOGDIR; rm -rf ${LOGDIR:?}/*
-myLog ()
-{
- msg="$1"
- echo "$msg"
- echo -e "FAIL: $msg" >> $SUMMARY_LOG
-}
-
-cd $LTP_SRC_DIR
-mapfile -t files < <(find testcases/kernel/syscalls -executable -and -type f \
- | sort | grep -v -f $ORIG_PWD/ltp-excludes.txt)
-c=${#files[@]}; i=0
-
-for test in "${files[@]}"; do
- dir=$(dirname $test)
- exe=$(basename $test)
- l="$LOGDIR/$exe"
+doTest ()
+{
+ t=$1
+ nr=$2
+ dir=$(dirname $t)
+ exe=$(basename $t)
+ l="$LOGDIR/$dir/$exe"
+ rv="PASS"
mkdir -p $l
- i=$((++i))
+ echo "[$nr/$c] Testing $exe ..."
pushd $dir >/dev/null
- echo "[$i/$c] Testing $exe ..." | tee -a $SUMMARY_LOG
PATH="$ORIG_PATH:$PWD"
./$exe >$l/log1std 2>$l/log1err ||:
- $VALGRIND -q --tool=none --log-file=$l/log2 ./$exe >$l/log2std 2>$l/log2err ||:
- $VALGRIND -q --tool=memcheck --log-file=$l/log3 ./$exe >$l/log3std 2>$l/log3err ||:
-
- # We want to make sure that LTP syscall tests give identical
- # results with and without valgrind. The test logs go to the
- # stderr. They aren't identical across individual runs. The
- # differences include port numbers, temporary files, test
- # output ordering changes and more. They aren't trivially
- # comparable. We resort to comparing at least the final
- # summary of individual test results
- tail -10 $l/log1err | grep -E "^(passed|failed|broken|skipped|warnings):" > $l/log1summary ||:
- tail -10 $l/log2err | grep -E "^(passed|failed|broken|skipped|warnings):" > $l/log2summary ||:
- tail -10 $l/log3err | grep -E "^(passed|failed|broken|skipped|warnings):" > $l/log3summary ||:
+ $VALGRIND --tool=none --log-file=$l/log2 ./$exe >$l/log2std 2>$l/log2err ||:
+ $VALGRIND --tool=memcheck --log-file=$l/log3 ./$exe >$l/log3std 2>$l/log3err ||:
+
+ for i in "$l"/log{1std,1err,2,2std,2err,3,3std,3err}; do
+ echo "# cat $(basename $i)" >> $LOGDIR/$exe.log
+ cat $i >> $LOGDIR/$exe.log
+ done
+
+ echo "# errors" >> $LOGDIR/$exe.log
+
+ # If there is a logfile filter, apply it
+ if test -f "${SCRIPT_SRC}/filters/${exe}"; then
+ cat $l/log2 | ${SCRIPT_SRC}/filters/${exe} > $l/log2.filtered
+ else
+ cat $l/log2 > $l/log2.filtered
+ fi
# Check logs, report errors
pushd $l >/dev/null
- if test -s log2; then
- myLog "${exe}: unempty log2:\n$(cat log2)"
+ if test -s log2.filtered; then
+ echo -e "${exe}: unempty log2.filtered:\n$(cat log2.filtered)" | tee -a $LOGDIR/$exe.log
+ rv="FAIL"
fi
- if grep -f $ORIG_PWD/ltp-error-patterns.txt * > error-patterns-found.txt; then
- myLog "${exe}: error string found:\n$(cat error-patterns-found.txt)"
+ if grep -f $SCRIPT_SRC/ltp-error-patterns.txt log* > error-patterns-found.txt; then
+ echo -e "${exe}: error string found:\n$(cat error-patterns-found.txt)" | tee -a $LOGDIR/$exe.log
+ rv="FAIL"
fi
- if ! ${DIFFCMD} log1summary log2summary >/dev/null; then
- myLog "${exe}: ${DIFFCMD} log1summary log2summary:\n$(${DIFFCMD} log1summary log2summary)"
+ if ! ${DIFFCMD} log1err log2err >/dev/null; then
+ echo -e "${exe}: ${DIFFCMD} log1err log2err:\n$(${DIFFCMD} log1err log2err)" | tee -a $LOGDIR/$exe.log
+ rv="FAIL"
fi
- if ! ${DIFFCMD} log2summary log3summary >/dev/null; then
- myLog "${exe}: ${DIFFCMD} log2summary log3summary:\n$(${DIFFCMD} log2summary log3summary)"
+ if ! ${DIFFCMD} log2err log3err >/dev/null; then
+ echo -e "${exe}: ${DIFFCMD} log2err log3err:\n$(${DIFFCMD} log2err log3err)" | tee -a $LOGDIR/$exe.log
+ rv="FAIL"
fi
+
+ # synthetize automake style testlogs for bunsen import
+ echo "# result" >> $LOGDIR/$exe.log
+ echo ":test-result: $rv" | tee -a $LOGDIR/$exe.log > $LOGDIR/$exe.trs
popd >/dev/null
popd >/dev/null
+}
+
+cd $LTP_SRC_DIR
+
+echo "See *.log files for details on each test in this directory." > $LOGDIR/test-suite.log
+
+if [ -n "$TESTS" ]; then
+ echo "Running individual syscall tests specified in the TESTS env var ..."
+ mapfile -t files < <(find testcases/kernel/syscalls -executable -and -type f \
+ | sort | grep -f <(echo $TESTS | tr ' ' '\n' | sed 's/.*/\/\0$/'))
+else
+ echo "Running whole the LTP syscall testsuite ..."
+ mapfile -t files < <(find testcases/kernel/syscalls -executable -and -type f \
+ | sort | grep -v -f $SCRIPT_SRC/ltp-excludes.txt)
+fi
+
+c=${#files[@]}; i=0
+
+# Run tests in parallel
+for test in "${files[@]}"; do
+ while test "$(jobs -l | wc -l)" -gt $PARALLEL_JOBS; do sleep 0.1; done
+ i=$((++i))
+ doTest $test $i &
done
-echo "TESTING FINISHED, logs in $LOGDIR"
+wait
+
+echo -e "\nBrief LTP test results summary"
+echo "-----------------------------------------"
+find $LOGDIR -type f -name '*.trs' -exec grep -F ':test-result:' '{}' ';' |\
+ sort -r | uniq -c | awk '{print $NF": "$1}'
+echo -e "-----------------------------------------\n"
+echo "TESTING FINISHED, logs in $LOGDIR"
diff --git a/auxprogs/s390-runone b/auxprogs/s390-runone
new file mode 100755
index 0000000000..94eff03744
--- /dev/null
+++ b/auxprogs/s390-runone
@@ -0,0 +1,220 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Getopt::Long;
+
+#-----------------------------------------------------------------------
+# Compile a small C program containing a sequence of assembler
+# instructions into an executable that does not need a dynamic linker.
+# Very handy for debugging new insns or small snippets without going
+# through the multi-pass process of figuring out which SB contains the
+# code we're interested in.
+#
+# Step #1: s390-runone -t bla.c
+#
+# Creates a template which looks like so:
+#
+# int main(void)
+# {
+# asm volatile ("csch"); // begin mark: do not remove
+# //FIXME: insert test code here:
+# asm volatile ("lghi %r1,1"); // __NR_exit
+# asm volatile ("lghi %r2,0"); // return code = 0
+# asm volatile ("svc 0"); // terminate process
+# asm volatile ("csch"); // end mark: do not remove
+# return 0;
+# }
+#
+# Step #2: Replace the FIXME line with one or more asm statements.
+# Skip this step if you used --insn=... in step #1.
+#
+# Step #3: s390-runone --build bla.c
+#
+# Compiles and links "bla.c" into an executable "bla" which does not
+# require the dynamic loader and which contains only those insns between
+# the two marker insns (csch).
+#
+# objdump -d:
+#
+# 00000000010000b0 <_start>:
+# 10000b0: a7 19 00 01 lghi %r1,1
+# 10000b4: a7 29 00 00 lghi %r2,0
+# 10000b8: 0a 00 svc 0
+#
+#-----------------------------------------------------------------------
+#
+
+&main;
+
+sub usage {
+ my $text =< sub { $template = 1; $build = 0; },
+ "build|b" => sub { $template = 0; $build = 1; },
+ "help|h" => \$help,
+ "insn|i=s" => \$insn,
+ "arch|a=s" => \$arch,
+ "cc=s" => \$cc
+ ) or usage();
+
+ usage() if ($help);
+
+ my $num_arg = $#ARGV + 1;
+ my $file = "";
+
+ if ($num_arg != 1) {
+ fatal("Missing file name") if ($build);
+ } else {
+ $file = $ARGV[0];
+ }
+
+ my $rc = 0;
+ if ($template) {
+ write_template($file, $insn);
+ } elsif ($build) {
+ $rc = build_exe($file, $arch, $cc);
+ } else {
+ print "Nothing happens\n";
+ }
+ exit $rc;
+}
+
+sub write_template
+{
+ my ($file, $insn) = @_;
+ my $asm;
+
+ if ($insn eq "") {
+ $asm = "//FIXME: insert test code here:";
+ } else {
+ $asm = "asm volatile (\"$insn\");";
+ }
+
+ my $template = <$file") || fatal("Cannot open '$file': $!\n");
+ print OUT $template;
+ close(OUT);
+ } else {
+ print $template;
+ }
+}
+
+sub build_exe
+{
+ my ($file, $arch, $cc) = @_;
+
+ my $base = `basename "$file" .c`;
+ chomp($base);
+ my $asm = "$base.s";
+ my $exe = "$base";
+
+# Compile the testprogram to assembler
+ my $stderr = `$cc -S -fno-ident -march=$arch $file 2>&1`;
+ if ($? != 0) {
+ error("$cc: Compilation failed\n $stderr");
+ return 1;
+ }
+ `mv "$asm" "$asm.orig"`; # save before massaging
+
+# Massage assembler file:
+# - rename main ---> _start
+# - remove cfi stuff
+# - remove comment lines
+# - remove insns preceeding 1st mark (csch)
+# - remove insns succeeding 2nd mark (csch)
+
+ my $in_main = 0;
+ my $mark_seen = 0;
+ my $output = "";
+ open(IN, "$asm.orig") || fatal("Cannot open '$file': $!\n");
+ while (my $line = ) {
+ chomp($line);
+ next if ($line =~ /^\s*#/); # comment
+ next if ($line =~ /\.cfi_/); # cfi stuff
+ if ($in_main == 0) {
+ $in_main = 1 if ($line =~ /^main:/);
+ } else {
+ if ($mark_seen == 0) {
+ if ($line =~ /csch/) {
+ $mark_seen = 1;
+ next;
+ }
+ next if ($line =~ /^\t[a-z]/); # skip insn
+ } else {
+ if ($line =~ /csch/) {
+ $mark_seen = 0;
+ next;
+ }
+ }
+ }
+ $line =~ s/main/_start/g;
+ $output .= "$line\n";
+ }
+ open(OUT, ">$asm") || fatal("Cannot open '$asm': $!\n");
+ print OUT $output;
+ close(OUT);
+
+ # Assemble file and link to executable
+ my $ccc = "$cc -static -Wa,--fatal-warnings -Wl,--build-id=none"
+ . " -nodefaultlibs -nostartfiles";
+ $stderr = `$ccc "$asm" -o "$exe" 2>&1`;
+
+ if ($? != 0) {
+ error("$cc: Linking executable failed");
+ for my $line (split /\n/,$stderr) {
+ print STDERR "$line\n" if ($line !~ /treating warnings as errors/);
+ }
+ return 1;
+ }
+}
+
+sub error
+{
+ print STDERR "*** $_[0]\n";
+}
+
+sub fatal
+{
+ error($_[0]);
+ exit 1;
+}
diff --git a/auxprogs/update-demangler b/auxprogs/update-demangler
index 3968239759..3ac0c04ea0 100755
--- a/auxprogs/update-demangler
+++ b/auxprogs/update-demangler
@@ -17,8 +17,8 @@ set -e
#---------------------------------------------------------------------
# You need to modify these revision numbers for your update.
-old_gcc_revision=ca2f7c84927f85b95f0f48f82b93f1460c372db4 # the revision of the previous update
-new_gcc_revision=94bea5dd6c9a06ddb6244be1e5196ff5fbe2b186 # the revision for this update
+old_gcc_revision=94bea5dd6c9a06ddb6244be1e5196ff5fbe2b186 # the revision of the previous update
+new_gcc_revision=7921bb4afcb7a3be8e10e63b10acfc2bfa477cae # the revision for this update
# Unless the organization of demangler related files has changed, no
# changes below this line should be necessary.
diff --git a/auxprogs/valgrind-di-server.c b/auxprogs/valgrind-di-server.c
index 1b6506e3da..955e7d76c8 100644
--- a/auxprogs/valgrind-di-server.c
+++ b/auxprogs/valgrind-di-server.c
@@ -21,7 +21,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -413,10 +413,10 @@ static ULong read_ULong_le ( UChar* src )
static Frame* mk_Frame_asciiz ( const char* tag, const char* str )
{
assert(strlen(tag) == 4);
- Frame* f = calloc(sizeof(Frame), 1);
+ Frame* f = calloc(1, sizeof(Frame));
size_t n_str = strlen(str);
f->n_data = 4 + n_str + 1;
- f->data = calloc(f->n_data, 1);
+ f->data = calloc(1, f->n_data);
memcpy(&f->data[0], tag, 4);
memcpy(&f->data[4], str, n_str);
assert(f->data[4 + n_str] == 0);
@@ -462,9 +462,9 @@ static Bool parse_Frame_asciiz ( Frame* fr, const HChar* tag,
static Frame* mk_Frame_le64 ( const HChar* tag, ULong n1 )
{
assert(strlen(tag) == 4);
- Frame* f = calloc(sizeof(Frame), 1);
+ Frame* f = calloc(1, sizeof(Frame));
f->n_data = 4 + 1*8;
- f->data = calloc(f->n_data, 1);
+ f->data = calloc(1, f->n_data);
memcpy(&f->data[0], tag, 4);
write_ULong_le(&f->data[4 + 0*8], n1);
return f;
@@ -473,9 +473,9 @@ static Frame* mk_Frame_le64 ( const HChar* tag, ULong n1 )
static Frame* mk_Frame_le64_le64 ( const HChar* tag, ULong n1, ULong n2 )
{
assert(strlen(tag) == 4);
- Frame* f = calloc(sizeof(Frame), 1);
+ Frame* f = calloc(1, sizeof(Frame));
f->n_data = 4 + 2*8;
- f->data = calloc(f->n_data, 1);
+ f->data = calloc(1, f->n_data);
memcpy(&f->data[0], tag, 4);
write_ULong_le(&f->data[4 + 0*8], n1);
write_ULong_le(&f->data[4 + 1*8], n2);
@@ -503,9 +503,9 @@ static Frame* mk_Frame_le64_le64_le64_bytes (
/*OUT*/UChar** data )
{
assert(strlen(tag) == 4);
- Frame* f = calloc(sizeof(Frame), 1);
+ Frame* f = calloc(1, sizeof(Frame));
f->n_data = 4 + 3*8 + n_data;
- f->data = calloc(f->n_data, 1);
+ f->data = calloc(1, f->n_data);
memcpy(&f->data[0], tag, 4);
write_ULong_le(&f->data[4 + 0*8], n1);
write_ULong_le(&f->data[4 + 1*8], n2);
@@ -706,9 +706,9 @@ static Bool handle_transaction ( int conn_no )
// Reject obviously-insane length fields.
if (rd_len > 4*1024*1024) goto fail;
assert(req == NULL);
- req = calloc(sizeof(Frame), 1);
+ req = calloc(1, sizeof(Frame));
req->n_data = rd_len;
- req->data = calloc(rd_len, 1);
+ req->data = calloc(1, rd_len);
if (rd_len > 0) {
Int r = my_read(sd, req->data, req->n_data);
if (r != rd_len) goto fail;
@@ -1172,7 +1172,7 @@ int main (int argc, char** argv)
break;
if (i >= M_CONNECTIONS) {
- fprintf(stderr, "\n\nMore than %d concurrent connections.\n"
+ fprintf(stderr, "\n\nMore than %u concurrent connections.\n"
"Restart the server giving --max-connect=INT on the\n"
"commandline to increase the limit.\n\n",
M_CONNECTIONS);
diff --git a/auxprogs/valgrind-listener.c b/auxprogs/valgrind-listener.c
index 158f11c088..96c7c9be63 100644
--- a/auxprogs/valgrind-listener.c
+++ b/auxprogs/valgrind-listener.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -355,7 +355,7 @@ int main (int argc, char** argv)
break;
if (i >= M_CONNECTIONS) {
- fprintf(stderr, "\n\nMore than %d concurrent connections.\n"
+ fprintf(stderr, "\n\nMore than %u concurrent connections.\n"
"Restart the listener giving --max-connect=INT on the\n"
"commandline to increase the limit.\n\n",
M_CONNECTIONS);
diff --git a/cachegrind/cachegrind.h b/cachegrind/cachegrind.h
index ddc10abe59..963e012746 100644
--- a/cachegrind/cachegrind.h
+++ b/cachegrind/cachegrind.h
@@ -3,7 +3,7 @@
Notice that the following BSD-style license applies to this one
file (cachegrind.h) only. The rest of Valgrind is licensed under the
- terms of the GNU General Public License, version 2, unless
+ terms of the GNU General Public License, version 3, unless
otherwise indicated. See the COPYING file in the source
distribution for details.
@@ -49,7 +49,7 @@
Notice that the above BSD-style license applies to this one file
(cachegrind.h) only. The entire rest of Valgrind is licensed under
- the terms of the GNU General Public License, version 2. See the
+ the terms of the GNU General Public License, version 3. See the
COPYING file in the source distribution for details.
----------------------------------------------------------------
diff --git a/cachegrind/cg_annotate.in b/cachegrind/cg_annotate.in
old mode 100755
new mode 100644
index fe3f411818..965da96c6e
--- a/cachegrind/cg_annotate.in
+++ b/cachegrind/cg_annotate.in
@@ -13,7 +13,7 @@
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
+# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
diff --git a/cachegrind/cg_arch.c b/cachegrind/cg_arch.c
index be2973405a..f877f95c7a 100644
--- a/cachegrind/cg_arch.c
+++ b/cachegrind/cg_arch.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/cachegrind/cg_arch.h b/cachegrind/cg_arch.h
index 5bb56b082b..2f1813c7d2 100644
--- a/cachegrind/cg_arch.h
+++ b/cachegrind/cg_arch.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/cachegrind/cg_branchpred.c b/cachegrind/cg_branchpred.c
index f7a261c6fe..d845fa068e 100644
--- a/cachegrind/cg_branchpred.c
+++ b/cachegrind/cg_branchpred.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/cachegrind/cg_diff.in b/cachegrind/cg_diff.in
old mode 100755
new mode 100644
index acc5484f1a..1185c30903
--- a/cachegrind/cg_diff.in
+++ b/cachegrind/cg_diff.in
@@ -13,7 +13,7 @@
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
+# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index e8f534c98b..ee3e91c6ff 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/cachegrind/cg_merge.in b/cachegrind/cg_merge.in
old mode 100755
new mode 100644
index 7cc0f2b14b..b92851f442
--- a/cachegrind/cg_merge.in
+++ b/cachegrind/cg_merge.in
@@ -13,7 +13,7 @@
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
+# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
diff --git a/cachegrind/cg_sim.c b/cachegrind/cg_sim.c
index c2ea3791b9..8383e290b9 100644
--- a/cachegrind/cg_sim.c
+++ b/cachegrind/cg_sim.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/bb.c b/callgrind/bb.c
index a599c10a55..8580481858 100644
--- a/callgrind/bb.c
+++ b/callgrind/bb.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/bbcc.c b/callgrind/bbcc.c
index dc72ba0e14..36b2300e1f 100644
--- a/callgrind/bbcc.c
+++ b/callgrind/bbcc.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/callgrind.h b/callgrind/callgrind.h
index f078cc82b9..88a23b2741 100644
--- a/callgrind/callgrind.h
+++ b/callgrind/callgrind.h
@@ -4,7 +4,7 @@
Notice that the following BSD-style license applies to this one
file (callgrind.h) only. The rest of Valgrind is licensed under the
- terms of the GNU General Public License, version 2, unless
+ terms of the GNU General Public License, version 3, unless
otherwise indicated. See the COPYING file in the source
distribution for details.
@@ -50,7 +50,7 @@
Notice that the above BSD-style license applies to this one file
(callgrind.h) only. The entire rest of Valgrind is licensed under
- the terms of the GNU General Public License, version 2. See the
+ the terms of the GNU General Public License, version 3. See the
COPYING file in the source distribution for details.
----------------------------------------------------------------
diff --git a/callgrind/callgrind_annotate.in b/callgrind/callgrind_annotate.in
index 976fe9b5fb..07f3a2196e 100644
--- a/callgrind/callgrind_annotate.in
+++ b/callgrind/callgrind_annotate.in
@@ -17,7 +17,7 @@
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
+# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/callgrind_control.in b/callgrind/callgrind_control.in
index bee6661efb..16cdb44fa3 100644
--- a/callgrind/callgrind_control.in
+++ b/callgrind/callgrind_control.in
@@ -11,7 +11,7 @@
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
+# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/callstack.c b/callgrind/callstack.c
index fc1d6eeab1..20669e9cd8 100644
--- a/callgrind/callstack.c
+++ b/callgrind/callstack.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/clo.c b/callgrind/clo.c
index 14b0a7b4fc..59b45b0dbd 100644
--- a/callgrind/clo.c
+++ b/callgrind/clo.c
@@ -9,7 +9,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/context.c b/callgrind/context.c
index 81261bdf1c..55be820284 100644
--- a/callgrind/context.c
+++ b/callgrind/context.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/costs.c b/callgrind/costs.c
index 936cf90142..321e19541f 100644
--- a/callgrind/costs.c
+++ b/callgrind/costs.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/costs.h b/callgrind/costs.h
index 9b33da480c..42678312de 100644
--- a/callgrind/costs.h
+++ b/callgrind/costs.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/debug.c b/callgrind/debug.c
index 58af44a664..89cec7f3f6 100644
--- a/callgrind/debug.c
+++ b/callgrind/debug.c
@@ -9,7 +9,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/dump.c b/callgrind/dump.c
index 4f07cb144b..02b042b216 100644
--- a/callgrind/dump.c
+++ b/callgrind/dump.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/events.c b/callgrind/events.c
index 4b0394f6e3..997ee61d03 100644
--- a/callgrind/events.c
+++ b/callgrind/events.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/events.h b/callgrind/events.h
index a4ca93300b..5d067a71f7 100644
--- a/callgrind/events.h
+++ b/callgrind/events.h
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/fn.c b/callgrind/fn.c
index a291f012e4..efa5430de2 100644
--- a/callgrind/fn.c
+++ b/callgrind/fn.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/global.h b/callgrind/global.h
index d602601927..ab2b21a01d 100644
--- a/callgrind/global.h
+++ b/callgrind/global.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/jumps.c b/callgrind/jumps.c
index 5a0d32e9e4..13bac45726 100644
--- a/callgrind/jumps.c
+++ b/callgrind/jumps.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/main.c b/callgrind/main.c
index 39aa230ed2..82602c9ad6 100644
--- a/callgrind/main.c
+++ b/callgrind/main.c
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/sim.c b/callgrind/sim.c
index 90e6134319..3350ae93ed 100644
--- a/callgrind/sim.c
+++ b/callgrind/sim.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/callgrind/tests/filter_inline b/callgrind/tests/filter_inline
index 678590404f..b547eec4f4 100755
--- a/callgrind/tests/filter_inline
+++ b/callgrind/tests/filter_inline
@@ -15,7 +15,7 @@ awk '
}
in_main && /^fn=/ && !/^fn=main$/ {
- in_main = 0
+ exit
}
in_main {
diff --git a/callgrind/threads.c b/callgrind/threads.c
index 624588a269..4ef3db7661 100644
--- a/callgrind/threads.c
+++ b/callgrind/threads.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/configure.ac b/configure.ac
old mode 100755
new mode 100644
index 8970ff8430..f3f3867ef7
--- a/configure.ac
+++ b/configure.ac
@@ -16,11 +16,11 @@ AC_PREREQ(2.69)
# Also set the (expected/last) release date here.
# Do not forget to rerun ./autogen.sh
m4_define([v_major_ver], [3])
-m4_define([v_minor_ver], [25])
-m4_define([v_micro_ver], [1])
+m4_define([v_minor_ver], [26])
+m4_define([v_micro_ver], [0])
m4_define([v_suffix_ver], [])
m4_define([v_suffix_ver], [codspeed])
-m4_define([v_rel_date], ["18 Oct 2025"])
+m4_define([v_rel_date], ["5 Nov 2025"])
m4_define([v_version],
m4_if(v_suffix_ver, [],
[v_major_ver.v_minor_ver.v_micro_ver],
@@ -36,7 +36,7 @@ AC_SUBST(VG_DATE, v_rel_date)
AC_CONFIG_SRCDIR(coregrind/m_main.c)
AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
+AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip tar-ustar subdir-objects])
AM_MAINTAINER_MODE
@@ -1994,6 +1994,54 @@ AC_LANG(C)
AM_CONDITIONAL(HAVE_CXX17, test x$ac_have_cxx_17 = xyes)
+# Compiler may announce C++17 support as above but may lack
+# some features
+AC_MSG_CHECKING([that C++ compiler supports constexpr if])
+AC_LANG(C++)
+safe_CXXFLAGS=$CXXFLAGS
+CXXFLAGS=-std=c++17
+
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+void f()
+{
+ if constexpr (true)
+ ;
+}
+])],
+[
+ac_have_constexpr_if=yes
+AC_MSG_RESULT([yes])
+], [
+ac_have_constexpr_if=no
+AC_MSG_RESULT([no])
+ ])
+CXXFLAGS=$safe_CXXFLAGS
+AC_LANG(C)
+
+AM_CONDITIONAL(HAVE_CONSTEXPR_IF, test x$ac_have_constexpr_if = xyes)
+
+AC_MSG_CHECKING([that C++ compiler supports std::align_val_t])
+AC_LANG(C++)
+safe_CXXFLAGS=$CXXFLAGS
+CXXFLAGS=-std=c++17
+
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#include
+std::align_val_t a;
+])],
+[
+ac_have_align_val_t=yes
+AC_MSG_RESULT([yes])
+], [
+ac_have_align_val_t=no
+AC_MSG_RESULT([no])
+ ])
+CXXFLAGS=$safe_CXXFLAGS
+AC_LANG(C)
+
+AM_CONDITIONAL(HAVE_ALIGN_VAL_T, test x$ac_have_align_val_t = xyes)
+
+
AC_MSG_CHECKING([that C++ compiler can include header file])
AC_LANG(C++)
safe_CXXFLAGS=$CXXFLAGS
@@ -2126,25 +2174,6 @@ AC_MSG_RESULT([no])
AM_CONDITIONAL(HAVE_NR_IO_PGETEVENTS, [test x$ac_have_nr_io_pgetevents = xyes])
-safe_LIBS="$LIBS"
-LIBS="-laio"
-AC_MSG_CHECKING([for libaio])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include
-]], [[
-io_context_t ctx;
-io_submit(ctx, 1, NULL);
-]])], [
-ac_have_libaio=yes
-AC_MSG_RESULT([yes])
-], [
-ac_have_libaio=no
-AC_MSG_RESULT([no])
-])
-
-AM_CONDITIONAL(HAVE_LIBAIO, [test x$ac_have_libaio = xyes])
-LIBS=$safe_LIBS
-
#----------------------------------------------------------------------------
# Checking for supported compiler flags.
#----------------------------------------------------------------------------
@@ -2519,20 +2548,6 @@ AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
CFLAGS=$safe_CFLAGS
])
-# A variation of the above for arguments that
-# take a value
-AC_DEFUN([AC_GCC_WARNING_SUBST_NO_VAL],[
- AC_MSG_CHECKING([if gcc accepts -W$1=$2])
- safe_CFLAGS=$CFLAGS
- CFLAGS="-W$1=$2 -Werror"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
- AC_SUBST([$3], [-Wno-$1])
- AC_MSG_RESULT([yes])], [
- AC_SUBST([$3], [])
- AC_MSG_RESULT([no])])
- CFLAGS=$safe_CFLAGS
-])
-
# Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
# -W$1 (instead of -Wno-$1).
AC_DEFUN([AC_GCC_WARNING_SUBST],[
@@ -2576,8 +2591,9 @@ AC_GCC_WARNING_SUBST_NO([attributes], [FLAG_W_NO_ATTRIBUTES])
AC_GCC_WARNING_SUBST_NO([unused-result], [FLAG_W_NO_UNUSED_RESULT])
AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
AC_GCC_WARNING_SUBST_NO([deprecated], [FLAG_W_NO_DEPRECATED])
-
-AC_GCC_WARNING_SUBST_NO_VAL([alloc-size-larger-than], [1677216], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN])
+# OK for 32 and 64 bit
+AC_GCC_WARNING_SUBST_NO([alloc-size-larger-than=18446744073709551615], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN])
+AC_GCC_WARNING_SUBST_NO([alloc-size], [FLAG_W_NO_ALLOC_SIZE])
AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
@@ -2591,6 +2607,24 @@ AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP])
AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION])
AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH])
+# as above, C++ flags
+AC_DEFUN([AC_GXX_WARNING_SUBST_NO],[
+ AC_MSG_CHECKING([if g++ accepts -W$1])
+ safe_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="-W$1 -Werror"
+ AC_LANG_PUSH(C++)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
+ AC_SUBST([$2], [-Wno-$1])
+ AC_LANG_POP()
+ AC_MSG_RESULT([yes])], [
+ AC_SUBST([$2], [])
+ AC_MSG_RESULT([no])])
+ CXXFLAGS=$safe_CXXFLAGS
+])
+
+AC_GXX_WARNING_SUBST_NO([missing-exception-spec], [FLAG_W_NO_MISSING_EXCEPTION_SPEC])
+AC_GXX_WARNING_SUBST_NO([implicit-exception-spec-mismatch], [FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH])
+
# Does this compiler support -Wformat-security ?
# Special handling is needed, because certain GCC versions require -Wformat
# being present if -Wformat-security is given. Otherwise a warning is issued.
@@ -4944,6 +4978,12 @@ AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([rt], [clock_gettime])
AC_CHECK_LIB([rt], [timer_delete])
+if test "$VGCONF_OS" = "solaris" ; then
+# for mallinfo
+saved_LDFLAGS="$LDFLAGS"
+LDFLAGS="$saved_LDFLAGS -lmalloc"
+fi
+
AC_CHECK_FUNCS([ \
aligned_alloc \
clock_gettime\
@@ -4953,6 +4993,7 @@ AC_CHECK_FUNCS([ \
getaddrinfo \
klogctl \
mallinfo \
+ mallinfo2 \
memchr \
memfd_create \
memset \
@@ -5009,9 +5050,14 @@ AC_CHECK_FUNCS([ \
getrlimitusage \
timer_delete \
fchroot \
- setcred
+ setcred \
+ exterrctl
])
+if test "$VGCONF_OS" = "solaris" ; then
+LDFLAGS="$saved_LDFLAGS"
+fi
+
# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
# libraries with any shared object and/or executable. This is NOT what we
# want for e.g. vgpreload_core-x86-linux.so
@@ -5071,6 +5117,8 @@ AM_CONDITIONAL([HAVE_FCHROOT],
[test x$ac_cv_func_fchroot = xyes])
AM_CONDITIONAL([HAVE_SETCRED],
[test x$ac_cv_func_setcred = xyes])
+AM_CONDITIONAL([HAVE_EXTERRCTL],
+ [test x$ac_cv_func_exterrctl = xyes])
if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
@@ -5327,6 +5375,28 @@ CFLAGS=$safe_CFLAGS
AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
+safe_CFLAGS=$CFLAGS
+CFLAGS="$mflag_primary"
+safe_LIBS="$LIBS"
+LIBS="-laio"
+AC_MSG_CHECKING([for libaio])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include
+]], [[
+io_context_t ctx;
+io_submit(ctx, 1, NULL);
+]])], [
+ac_have_libaio=yes
+AC_MSG_RESULT([yes])
+], [
+ac_have_libaio=no
+AC_MSG_RESULT([no])
+])
+
+AM_CONDITIONAL(HAVE_LIBAIO, [test x$ac_have_libaio = xyes])
+LIBS=$safe_LIBS
+CFLAGS=$safe_CFLAGS
+
# Check for __builtin_popcount
AC_MSG_CHECKING([for __builtin_popcount()])
@@ -5493,6 +5563,8 @@ AM_CONDITIONAL([HAVE_OPENAT2],
# check for crypto
+safe_CFLAGS=$CFLAGS
+CFLAGS="$mflag_primary"
safe_LIBS="$LIBS"
LIBS="-lcrypto"
AC_MSG_CHECKING([if platform has openssl crypto])
@@ -5509,6 +5581,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
AC_MSG_RESULT([no])
])
LIBS=$safe_LIBS
+CFLAGS=$safe_CFLAGS
AM_CONDITIONAL([HAVE_OPENSSL],
[test x$ac_have_openssl = xyes])
@@ -5691,9 +5764,7 @@ AC_CONFIG_FILES([
docs/Makefile
docs/xml/vg-entities.xml
tests/Makefile
- tests/vg_regtest
perf/Makefile
- perf/vg_perf
gdbserver_tests/Makefile
gdbserver_tests/solaris/Makefile
include/Makefile
@@ -5718,6 +5789,7 @@ AC_CONFIG_FILES([
memcheck/tests/amd64-solaris/Makefile
memcheck/tests/x86-solaris/Makefile
memcheck/tests/amd64-freebsd/Makefile
+ memcheck/tests/arm64-freebsd/Makefile
memcheck/tests/x86-freebsd/Makefile
memcheck/tests/ppc32/Makefile
memcheck/tests/ppc64/Makefile
@@ -5758,6 +5830,7 @@ AC_CONFIG_FILES([
none/tests/arm64/Makefile
none/tests/s390x/Makefile
none/tests/s390x/disasm-test/Makefile
+ none/tests/iropt-test/Makefile
none/tests/mips32/Makefile
none/tests/mips64/Makefile
none/tests/nanomips/Makefile
@@ -5791,10 +5864,16 @@ AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
[chmod +x coregrind/link_tool_exe_darwin])
AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
[chmod +x coregrind/link_tool_exe_solaris])
+AC_CONFIG_FILES([coregrind/vgstack],
+ [chmod +x coregrind/vgstack])
AC_CONFIG_FILES([tests/filter_stderr_basic],
[chmod +x tests/filter_stderr_basic])
AC_CONFIG_FILES([tests/filter_discards],
[chmod +x tests/filter_discards])
+AC_CONFIG_FILES([tests/vg_regtest],
+ [chmod +x tests/vg_regtest])
+AC_CONFIG_FILES([perf/vg_perf],
+ [chmod +x perf/vg_perf])
AC_CONFIG_FILES([memcheck/tests/filter_stderr],
[chmod +x memcheck/tests/filter_stderr])
AC_CONFIG_FILES([memcheck/tests/filter_dw4],
diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
index 48ddd01e9b..e7921ffaad 100644
--- a/coregrind/Makefile.am
+++ b/coregrind/Makefile.am
@@ -34,6 +34,8 @@ bin_PROGRAMS = \
valgrind \
vgdb
+bin_SCRIPTS = vgstack
+
if VGCONF_OS_IS_LINUX
valgrind_SOURCES = \
launcher-linux.c \
@@ -60,7 +62,7 @@ AR = ${LTO_AR}
RANLIB = ${LTO_RANLIB}
valgrind_CPPFLAGS = $(AM_CPPFLAGS_PRI)
-valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS)
+valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fhosted
valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI)
valgrind_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@
# If there is no secondary platform, and the platforms include x86-darwin,
@@ -102,7 +104,7 @@ vgdb_SOURCES += vgdb-invoker-freebsd.c
endif
vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) $(GDB_SCRIPTS_DIR)
-vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS)
+vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fhosted
vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI)
vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@
if VGCONF_PLATVARIANT_IS_ANDROID
diff --git a/coregrind/launcher-darwin.c b/coregrind/launcher-darwin.c
index eafc21d04f..933050617b 100644
--- a/coregrind/launcher-darwin.c
+++ b/coregrind/launcher-darwin.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/launcher-freebsd.c b/coregrind/launcher-freebsd.c
index 1675fbcf5d..56307d50b6 100644
--- a/coregrind/launcher-freebsd.c
+++ b/coregrind/launcher-freebsd.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/launcher-linux.c b/coregrind/launcher-linux.c
index 20e624003a..b4ac3d2225 100644
--- a/coregrind/launcher-linux.c
+++ b/coregrind/launcher-linux.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/link_tool_exe_freebsd.in b/coregrind/link_tool_exe_freebsd.in
old mode 100755
new mode 100644
diff --git a/coregrind/m_addrinfo.c b/coregrind/m_addrinfo.c
index 0d4624dbbc..32d2fd4c90 100644
--- a/coregrind/m_addrinfo.c
+++ b/coregrind/m_addrinfo.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_aspacehl.c b/coregrind/m_aspacehl.c
index a692f4f5c1..c74723921f 100644
--- a/coregrind/m_aspacehl.c
+++ b/coregrind/m_aspacehl.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_aspacemgr/aspacemgr-common.c b/coregrind/m_aspacemgr/aspacemgr-common.c
index 14864d96c3..379ad773db 100644
--- a/coregrind/m_aspacemgr/aspacemgr-common.c
+++ b/coregrind/m_aspacemgr/aspacemgr-common.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c
index bae4f781a8..214b4a8087 100644
--- a/coregrind/m_aspacemgr/aspacemgr-linux.c
+++ b/coregrind/m_aspacemgr/aspacemgr-linux.c
@@ -16,7 +16,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1726,19 +1726,6 @@ Addr VG_(am_startup) ( Addr sp_at_startup )
// so we can't use these syscalls. Maybe one day when all supported platforms
// have them.
-#if 0
- // this block implements what is described above
- // note this needs
- // #include "pub_core_libcproc.h"
- SizeT kern_maxssiz;
- SizeT kern_sgrowsiz;
- SizeT sysctl_size = sizeof(SizeT);
- VG_(sysctlbyname)("kern.maxssiz", &kern_maxssiz, &sysctl_size, NULL, 0);
- VG_(sysctlbyname)("kern.sgrowsiz", &kern_sgrowsiz, &sysctl_size, NULL, 0);
- VG_(printf)("maxssiz %lx\n", kern_maxssiz);
- //suggested_clstack_end = aspacem_maxAddr - (kern_maxssiz - kern_sgrowsiz) + VKI_PAGE_SIZE;
-#endif
-
// on amd64 we have oodles of space and just shove the new stack somewhere out of the way
// x86 is far more constrained, and we put the new stack just below the stack passed in to V
// except that it has stack space and the growth stack guard below it as decribed above
@@ -1748,7 +1735,30 @@ Addr VG_(am_startup) ( Addr sp_at_startup )
suggested_clstack_end = aspacem_maxAddr - 64*1024*1024UL
+ VKI_PAGE_SIZE;
#else
- suggested_clstack_end = aspacem_maxAddr;
+
+ SizeT kern_maxssiz;
+ //SizeT kern_sgrowsiz;
+ SizeT sysctl_size = sizeof(SizeT);
+ VG_(sysctlbyname)("kern.maxssiz", &kern_maxssiz, &sysctl_size, NULL, 0);
+ if (kern_maxssiz < 64*1024*1024UL) {
+ kern_maxssiz = 64*1024*1024UL;
+ VG_(debugLog)(2, "aspacem",
+ " max stack size (maxssiz) set to lower limit, 64Mb\n");
+ }
+ //VG_(sysctlbyname)("kern.sgrowsiz", &kern_sgrowsiz, &sysctl_size, NULL, 0);
+ // initially this was aspacem_maxAddr - (kern_maxssiz - kern_sgrowsiz) + VKI_PAGE_SIZE
+ // but we're not using / respecting the stack grow size (yet)
+ suggested_clstack_end = aspacem_maxAddr - (kern_maxssiz) + VKI_PAGE_SIZE;
+ VG_(debugLog)(2, "aspacem",
+ " max stack size (maxssiz) = 0x%lx\n",
+ kern_maxssiz);
+ //VG_(debugLog)(2, "aspacem",
+ // " stack grow size (sgrowsiz) = 0x%lx\n",
+ // kern_sgrowsiz);
+ VG_(debugLog)(2, "aspacem",
+ " suggested client stack end (aspacem_maxAddr - (kern_maxssiz) + VKI_PAGE_SIZE) = 0x%lx\n",
+ suggested_clstack_end);
+
#endif
// --- Solaris ------------------------------------------
diff --git a/coregrind/m_aspacemgr/aspacemgr-segnames.c b/coregrind/m_aspacemgr/aspacemgr-segnames.c
index cfd7ffa330..6d60708977 100644
--- a/coregrind/m_aspacemgr/aspacemgr-segnames.c
+++ b/coregrind/m_aspacemgr/aspacemgr-segnames.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_aspacemgr/priv_aspacemgr.h b/coregrind/m_aspacemgr/priv_aspacemgr.h
index 0c8a807f22..978c58b987 100644
--- a/coregrind/m_aspacemgr/priv_aspacemgr.h
+++ b/coregrind/m_aspacemgr/priv_aspacemgr.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_cache.c b/coregrind/m_cache.c
index 4abd26f0b2..fd6f801c13 100644
--- a/coregrind/m_cache.c
+++ b/coregrind/m_cache.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_clientstate.c b/coregrind/m_clientstate.c
index 404a60f372..61cf0502b4 100644
--- a/coregrind/m_clientstate.c
+++ b/coregrind/m_clientstate.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -91,7 +91,7 @@ Int VG_(args_for_valgrind_noexecpass) = 0;
/* The name of the client executable, as specified on the command
line. */
-const HChar* VG_(args_the_exename) = NULL;
+HChar* VG_(args_the_exename) = NULL;
/* The real name of the executable, with resolved
* relative paths and symlinks */
diff --git a/coregrind/m_commandline.c b/coregrind/m_commandline.c
index e9fdb9bb4c..df36ffb155 100644
--- a/coregrind/m_commandline.c
+++ b/coregrind/m_commandline.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -213,7 +213,7 @@ void VG_(split_up_argv)( Int argc, HChar** argv )
/* Should now be looking at the exe name. */
if (i < argc) {
vg_assert(argv[i]);
- VG_(args_the_exename) = argv[i];
+ VG_(args_the_exename) = VG_(strdup)("commandline.sua.4", argv[i]);
i++;
}
diff --git a/coregrind/m_compiler.c b/coregrind/m_compiler.c
index 9e792e8a43..157f964805 100644
--- a/coregrind/m_compiler.c
+++ b/coregrind/m_compiler.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_coredump/coredump-elf.c b/coregrind/m_coredump/coredump-elf.c
index b57d26275b..ab584eb133 100644
--- a/coregrind/m_coredump/coredump-elf.c
+++ b/coregrind/m_coredump/coredump-elf.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_coredump/coredump-macho.c b/coregrind/m_coredump/coredump-macho.c
index 61c8b05899..da120c7246 100644
--- a/coregrind/m_coredump/coredump-macho.c
+++ b/coregrind/m_coredump/coredump-macho.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_coredump/coredump-solaris.c b/coregrind/m_coredump/coredump-solaris.c
index 00d131b370..cec2afaf83 100644
--- a/coregrind/m_coredump/coredump-solaris.c
+++ b/coregrind/m_coredump/coredump-solaris.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_cpuid.S b/coregrind/m_cpuid.S
index 4885e2e20a..10839a132c 100644
--- a/coregrind/m_cpuid.S
+++ b/coregrind/m_cpuid.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/d3basics.c b/coregrind/m_debuginfo/d3basics.c
index 80dec21a65..485213d636 100644
--- a/coregrind/m_debuginfo/d3basics.c
+++ b/coregrind/m_debuginfo/d3basics.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
index c801fc5c04..fbfab5650b 100644
--- a/coregrind/m_debuginfo/debuginfo.c
+++ b/coregrind/m_debuginfo/debuginfo.c
@@ -9,12 +9,12 @@
This file is part of Valgrind, a dynamic binary instrumentation
framework.
- Copyright (C) 2000-2017 Julian Seward
+ Copyright (C) 2000-2017 Julian Seward
jseward@acm.org
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -84,14 +84,14 @@
debuginfo reading confusing. Recently I arrived at some
terminology which makes it clearer (to me, at least). There are 3
kinds of address used in the debuginfo reading process:
-
+
stated VMAs - the address where (eg) a .so says a symbol is, that
is, what it tells you if you consider the .so in
isolation
-
+
actual VMAs - the address where (eg) said symbol really wound up
after the .so was mapped into memory
-
+
image addresses - pointers into the copy of the .so (etc)
transiently mmaped aboard whilst we read its info
@@ -298,7 +298,7 @@ static void show_epochs ( const HChar* msg )
static ULong handle_counter = 1;
/* Allocate and zero out a new DebugInfo record. */
-static
+static
DebugInfo* alloc_DebugInfo( const HChar* filename )
{
Bool traceme;
@@ -317,7 +317,7 @@ DebugInfo* alloc_DebugInfo( const HChar* filename )
/* Everything else -- pointers, sizes, arrays -- is zeroed by
ML_(dinfo_zalloc). Now set up the debugging-output flags. */
- traceme
+ traceme
= VG_(string_match)( VG_(clo_trace_symtab_patt), filename );
if (traceme) {
di->trace_symtab = VG_(clo_trace_symtab);
@@ -463,7 +463,7 @@ static void discard_or_archive_DebugInfo ( DebugInfo* di )
if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir))
VG_(dmsg)("%s syms at %#lx-%#lx in %s (have_dinfo %d)\n",
archive ? "Archiving" : "Discarding",
- di->text_avma,
+ di->text_avma,
di->text_avma + di->text_size,
curr->fsm.filename ? curr->fsm.filename
: "???",
@@ -541,7 +541,7 @@ static Bool discard_syms_in_range ( Addr start, SizeT length )
static Bool ranges_overlap (Addr s1, SizeT len1, Addr s2, SizeT len2 )
{
Addr e1, e2;
- if (len1 == 0 || len2 == 0)
+ if (len1 == 0 || len2 == 0)
return False;
e1 = s1 + len1 - 1;
e2 = s2 + len2 - 1;
@@ -832,7 +832,7 @@ static Bool overlaps_DebugInfoMappings ( const DebugInfoMapping* map1,
/* Helper (indirect) for di_notify_ACHIEVE_ACCEPT_STATE */
-static void show_DebugInfoMappings
+static void show_DebugInfoMappings
( const DebugInfo* di,
/*MOD*/XArray* maps /* XArray */ )
{
@@ -936,7 +936,7 @@ static void truncate_DebugInfoMapping_overlaps
/* When the sequence of observations causes a DebugInfoFSM to move
into the accept state, call here to actually get the debuginfo read
- in. Returns a ULong whose purpose is described in comments
+ in. Returns a ULong whose purpose is described in comments
preceding VG_(di_notify_mmap) just below.
*/
static ULong di_notify_ACHIEVE_ACCEPT_STATE ( struct _DebugInfo* di )
@@ -1156,7 +1156,7 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd )
if (debug) {
VG_(dmsg)("di_notify_mmap-0:\n");
VG_(dmsg)("di_notify_mmap-1: %#lx-%#lx %c%c%c\n",
- seg->start, seg->end,
+ seg->start, seg->end,
seg->hasR ? 'r' : '-',
seg->hasW ? 'w' : '-',seg->hasX ? 'x' : '-' );
}
@@ -1490,7 +1490,7 @@ void VG_(addr_load_di)( Addr a )
VG_(di_load_di)(di);
}
-/* Unmap is simpler - throw away any SegInfos intersecting
+/* Unmap is simpler - throw away any SegInfos intersecting
[a, a+len). */
void VG_(di_notify_munmap)( Addr a, SizeT len )
{
@@ -1642,7 +1642,7 @@ void VG_(di_notify_pdb_debuginfo)( Int fd_obj, Addr avma_obj,
VG_(message)(Vg_UserMsg, "\n");
VG_(message)(Vg_UserMsg,
"LOAD_PDB_DEBUGINFO: clreq: fd=%d, avma=%#lx, total_size=%lu, "
- "bias=%#lx\n",
+ "bias=%#lx\n",
fd_obj, avma_obj, total_size, (UWord)bias_obj
);
}
@@ -1661,7 +1661,7 @@ void VG_(di_notify_pdb_debuginfo)( Int fd_obj, Addr avma_obj,
return; /* failed */
sz_exename = VG_(strlen)(exe);
HChar exename[sz_exename + 1];
- VG_(strcpy)(exename, exe); // make a copy on the stack
+ VG_(strcpy)(exename, exe); // make a copy on the stack
if (VG_(clo_verbosity) > 0) {
VG_(message)(Vg_UserMsg, "LOAD_PDB_DEBUGINFO: objname: %s\n", exename);
@@ -1884,7 +1884,7 @@ void VG_(di_discard_ALL_debuginfo)( void )
DebugInfoMapping* ML_(find_rx_mapping) ( DebugInfo* di, Addr lo, Addr hi )
{
Word i;
- vg_assert(lo <= hi);
+ vg_assert(lo <= hi);
/* Optimization: Try to use the last matched rx mapping first */
if ( di->last_rx_map
@@ -1951,7 +1951,7 @@ Bool VG_(next_IIPC)(InlIPCursor *iipc)
di = iipc->di;
for (i = iipc->inltab_lopos; i <= iipc->inltab_hipos; i++) {
- if (di->inltab[i].addr_lo <= iipc->eip
+ if (di->inltab[i].addr_lo <= iipc->eip
&& iipc->eip < di->inltab[i].addr_hi
&& di->inltab[i].level < iipc->curlevel
&& (!hinl || hinl->level < di->inltab[i].level)) {
@@ -1959,7 +1959,7 @@ Bool VG_(next_IIPC)(InlIPCursor *iipc)
hinl_pos = i;
}
}
-
+
iipc->cur_inltab = iipc->next_inltab;
iipc->next_inltab = hinl_pos;
if (iipc->next_inltab < 0)
@@ -1981,12 +1981,12 @@ static void search_all_loctabs ( DiEpoch ep, Addr ptr,
(note that inltab might have duplicates addr_lo). */
static Word inltab_insert_pos (DebugInfo *di, Addr eip)
{
- Word mid,
- lo = 0,
+ Word mid,
+ lo = 0,
hi = di->inltab_used-1;
while (lo <= hi) {
mid = (lo + hi) / 2;
- if (eip < di->inltab[mid].addr_lo) { hi = mid-1; continue; }
+ if (eip < di->inltab[mid].addr_lo) { hi = mid-1; continue; }
if (eip > di->inltab[mid].addr_lo) { lo = mid+1; continue; }
lo = mid; break;
}
@@ -2032,7 +2032,7 @@ InlIPCursor* VG_(new_IIPC)(DiEpoch ep, Addr eip)
if (di->inltab[i].addr_lo < eip - di->maxinl_codesz)
return NULL;
}
-
+
if (i < 0)
return NULL; // No entry containing eip.
@@ -2043,7 +2043,7 @@ InlIPCursor* VG_(new_IIPC)(DiEpoch ep, Addr eip)
ret->di = di;
ret->inltab_hipos = i;
for (i = ret->inltab_hipos - 1; i >= 0; i--) {
-
+
if (di->inltab[i].addr_lo < eip - di->maxinl_codesz)
break; /* Similar stop backward scan logic as above. */
}
@@ -2100,27 +2100,27 @@ static void search_all_symtabs ( DiEpoch ep, Addr ptr,
} else {
inRange = (di->data_present
&& di->data_size > 0
- && di->data_avma <= ptr
+ && di->data_avma <= ptr
&& ptr < di->data_avma + di->data_size)
||
(di->sdata_present
&& di->sdata_size > 0
- && di->sdata_avma <= ptr
+ && di->sdata_avma <= ptr
&& ptr < di->sdata_avma + di->sdata_size)
||
(di->bss_present
&& di->bss_size > 0
- && di->bss_avma <= ptr
+ && di->bss_avma <= ptr
&& ptr < di->bss_avma + di->bss_size)
||
(di->sbss_present
&& di->sbss_size > 0
- && di->sbss_avma <= ptr
+ && di->sbss_avma <= ptr
&& ptr < di->sbss_avma + di->sbss_size)
||
(di->rodata_present
&& di->rodata_size > 0
- && di->rodata_avma <= ptr
+ && di->rodata_avma <= ptr
&& ptr < di->rodata_avma + di->rodata_size);
}
@@ -2151,7 +2151,7 @@ static void search_all_loctabs ( DiEpoch ep, Addr ptr,
continue;
if (di->text_present
&& di->text_size > 0
- && di->text_avma <= ptr
+ && di->text_avma <= ptr
&& ptr < di->text_avma + di->text_size) {
lno = ML_(search_one_loctab) ( di, ptr );
if (lno == -1) goto not_found;
@@ -2176,7 +2176,7 @@ typedef
Addr sym_avma;
// Fields below here are not part of the key.
const HChar* sym_name;
- PtrdiffT offset : (sizeof(PtrdiffT)*8)-1;
+ PtrdiffT offset : (sizeof(PtrdiffT)*8)-1;
Bool isText : 1;
}
Sym_Name_CacheEnt;
@@ -2212,10 +2212,10 @@ static void sym_name_cache__invalidate ( void ) {
-- caller must choose one kind or the other.
NOTE: See IMPORTANT COMMENT above about persistence and ownership
- in pub_tool_debuginfo.h
+ in pub_tool_debuginfo.h
get_sym_name and the fact it calls the demangler is the main reason
for non persistence of the information returned by m_debuginfo.c
- functions : the string returned in *BUF is persistent as long as
+ functions : the string returned in *BUF is persistent as long as
(1) the DebugInfo it belongs to is not discarded
(2) the demangler is not invoked again
Also, the returned string is owned by "somebody else". Callers must
@@ -2266,7 +2266,7 @@ Bool get_sym_name ( Bool do_cxx_demangling, Bool do_z_demangling,
se->sym_name, buf );
/* Do the below-main hack */
- // To reduce the endless nuisance of multiple different names
+ // To reduce the endless nuisance of multiple different names
// for "the frame below main()" screwing up the testsuite, change all
// known incarnations of said into a single name, "(below main)", if
// --show-below-main=yes.
@@ -2311,7 +2311,7 @@ Addr VG_(get_tocptr) ( DiEpoch ep, Addr guest_code_addr )
search_all_symtabs ( ep, guest_code_addr,
&si, &sno,
True/*consider text symbols only*/ );
- if (si == NULL)
+ if (si == NULL)
return 0;
else
return GET_TOCPTR_AVMA(si->symtab[sno].avmas);
@@ -2329,7 +2329,7 @@ Bool VG_(get_fnname) ( DiEpoch ep, Addr a, const HChar** buf )
return get_sym_name ( /*C++-demangle*/True, /*Z-demangle*/True,
/*below-main-renaming*/True,
ep, a, buf,
- /*match_anywhere_in_fun*/True,
+ /*match_anywhere_in_fun*/True,
/*show offset?*/False,
/*text sym*/True,
/*offsetP*/NULL );
@@ -2356,7 +2356,7 @@ Bool VG_(get_fnname_inl) ( DiEpoch ep, Addr a, const HChar** buf,
? & iipc->di->inltab[iipc->next_inltab]
: NULL;
vg_assert (next_inl);
- *buf = next_inl->inlinedfn;
+ *buf = next_inl->inlined.fn;
return True;
}
}
@@ -2370,7 +2370,7 @@ Bool VG_(get_fnname_w_offset) ( DiEpoch ep, Addr a, const HChar** buf )
return get_sym_name ( /*C++-demangle*/True, /*Z-demangle*/True,
/*below-main-renaming*/True,
ep, a, buf,
- /*match_anywhere_in_fun*/True,
+ /*match_anywhere_in_fun*/True,
/*show offset?*/True,
/*text sym*/True,
/*offsetP*/NULL );
@@ -2394,7 +2394,7 @@ Bool VG_(get_inline_fnname) ( DiEpoch ep, Addr a, const HChar** inl_fnname )
Word inl_idx;
if (VG_(inltab_lookup_get)(si->inltab_lookup, a, &inl_idx, si)) {
/* Found it! Return the inline function name */
- *inl_fnname = si->inltab[inl_idx].inlinedfn;
+ *inl_fnname = si->inltab[inl_idx].inlined.fn;
return True;
}
@@ -2414,7 +2414,7 @@ Bool VG_(get_fnname_if_entry) ( DiEpoch ep, Addr a, const HChar** buf )
res = get_sym_name ( /*C++-demangle*/True, /*Z-demangle*/True,
/*below-main-renaming*/True,
ep, a, &tmp,
- /*match_anywhere_in_fun*/False,
+ /*match_anywhere_in_fun*/False,
/*show offset?*/False,
/*text sym*/True,
/*offsetP*/NULL );
@@ -2433,7 +2433,7 @@ Bool VG_(get_fnname_raw) ( DiEpoch ep, Addr a, const HChar** buf )
return get_sym_name ( /*C++-demangle*/False, /*Z-demangle*/False,
/*below-main-renaming*/False,
ep, a, buf,
- /*match_anywhere_in_fun*/True,
+ /*match_anywhere_in_fun*/True,
/*show offset?*/False,
/*text sym*/True,
/*offsetP*/NULL );
@@ -2461,7 +2461,7 @@ Bool VG_(get_fnname_no_cxx_demangle) ( DiEpoch ep, Addr a, const HChar** buf,
return get_sym_name ( /*C++-demangle*/False, /*Z-demangle*/True,
/*below-main-renaming*/True,
ep, a, buf,
- /*match_anywhere_in_fun*/True,
+ /*match_anywhere_in_fun*/True,
/*show offset?*/False,
/*text sym*/True,
/*offsetP*/NULL );
@@ -2471,12 +2471,12 @@ Bool VG_(get_fnname_no_cxx_demangle) ( DiEpoch ep, Addr a, const HChar** buf,
: NULL;
vg_assert (next_inl);
// The function we are in is called by next_inl.
- *buf = next_inl->inlinedfn;
+ *buf = next_inl->inlined.fn;
return True;
}
}
-/* mips-linux only: find the offset of current address. This is needed for
+/* mips-linux only: find the offset of current address. This is needed for
stack unwinding for MIPS.
*/
Bool VG_(get_inst_offset_in_function)( DiEpoch ep, Addr a,
@@ -2486,7 +2486,7 @@ Bool VG_(get_inst_offset_in_function)( DiEpoch ep, Addr a,
return get_sym_name ( /*C++-demangle*/False, /*Z-demangle*/False,
/*below-main-renaming*/False,
ep, a, &fnname,
- /*match_anywhere_in_sym*/True,
+ /*match_anywhere_in_sym*/True,
/*show offset?*/False,
/*text sym*/True,
offset );
@@ -2549,7 +2549,7 @@ Bool VG_(get_datasym_and_offset)( DiEpoch ep, Addr data_addr,
return get_sym_name ( /*C++-demangle*/False, /*Z-demangle*/False,
/*below-main-renaming*/False,
ep, data_addr, dname,
- /*match_anywhere_in_sym*/True,
+ /*match_anywhere_in_sym*/True,
/*show offset?*/False,
/*text sym*/False,
offset );
@@ -2557,7 +2557,7 @@ Bool VG_(get_datasym_and_offset)( DiEpoch ep, Addr data_addr,
/* Map a code address to the name of a shared object file or the
executable. Returns False if no idea; otherwise True.
- Note: the string returned in *BUF is persistent as long as
+ Note: the string returned in *BUF is persistent as long as
(1) the DebugInfo it belongs to is not discarded
(2) the segment containing the address is not merged with another segment
*/
@@ -2574,7 +2574,7 @@ Bool VG_(get_objname) ( DiEpoch ep, Addr a, const HChar** objname )
continue;
if (di->text_present
&& di->text_size > 0
- && di->text_avma <= a
+ && di->text_avma <= a
&& a < di->text_avma + di->text_size) {
*objname = di->fsm.filename;
return True;
@@ -2610,7 +2610,7 @@ DebugInfo* VG_(find_DebugInfo) ( DiEpoch ep, Addr a )
continue;
if (di->text_present
&& di->text_size > 0
- && di->text_avma <= a
+ && di->text_avma <= a
&& a < di->text_avma + di->text_size) {
if (0 == (n_search & 0xF))
move_DebugInfo_one_step_forward( di );
@@ -2630,7 +2630,7 @@ Bool VG_(get_filename)( DiEpoch ep, Addr a, const HChar** filename )
UInt fndn_ix;
search_all_loctabs ( ep, a, &si, &locno );
- if (si == NULL)
+ if (si == NULL)
return False;
fndn_ix = ML_(fndn_ix) (si, locno);
*filename = ML_(fndn_ix2filename) (si, fndn_ix);
@@ -2643,7 +2643,7 @@ Bool VG_(get_linenum)( DiEpoch ep, Addr a, UInt* lineno )
DebugInfo* si;
Word locno;
search_all_loctabs ( ep, a, &si, &locno );
- if (si == NULL)
+ if (si == NULL)
return False;
*lineno = si->loctab[locno].lineno;
@@ -2725,7 +2725,7 @@ Bool VG_(lookup_symbol_SLOW)(DiEpoch ep,
vg_assert(sec_names[0]);
while (*sec_names) {
if (0==VG_(strcmp)(name, *sec_names)
- && (require_pToc
+ && (require_pToc
? GET_TOCPTR_AVMA(si->symtab[i].avmas) : True)) {
*avmas = si->symtab[i].avmas;
return True;
@@ -2745,8 +2745,8 @@ Bool VG_(lookup_symbol_SLOW)(DiEpoch ep,
/* Copy str into *buf starting at n, ensuring that buf is zero-terminated.
Return the index of the terminating null character. */
-static SizeT
-putStr( SizeT n, HChar** buf, SizeT *bufsiz, const HChar* str )
+static SizeT
+putStr( SizeT n, HChar** buf, SizeT *bufsiz, const HChar* str )
{
SizeT slen = VG_(strlen)(str);
SizeT need = n + slen + 1;
@@ -2763,21 +2763,21 @@ putStr( SizeT n, HChar** buf, SizeT *bufsiz, const HChar* str )
}
/* Same as putStr, but escaping chars for XML output. */
-static SizeT
+static SizeT
putStrEsc( SizeT n, HChar** buf, SizeT *bufsiz, const HChar* str )
{
HChar alt[2];
for (; *str != 0; str++) {
switch (*str) {
- case '&':
- n = putStr( n, buf, bufsiz, "&");
+ case '&':
+ n = putStr( n, buf, bufsiz, "&");
break;
- case '<':
- n = putStr( n, buf, bufsiz, "<");
+ case '<':
+ n = putStr( n, buf, bufsiz, "<");
break;
- case '>':
- n = putStr( n, buf, bufsiz, ">");
+ case '>':
+ n = putStr( n, buf, bufsiz, ">");
break;
default:
alt[0] = *str;
@@ -2798,7 +2798,7 @@ const HChar* VG_(describe_IP)(DiEpoch ep, Addr eip, const InlIPCursor *iipc)
# define APPEND_ESC(_str) \
n = putStrEsc(n, &buf, &bufsiz, _str)
- UInt lineno;
+ UInt lineno;
HChar ibuf[50]; // large enough
SizeT n = 0;
@@ -2833,7 +2833,7 @@ const HChar* VG_(describe_IP)(DiEpoch ep, Addr eip, const InlIPCursor *iipc)
: NULL;
vg_assert (next_inl);
// The function we are in is called by next_inl.
- buf_fn = next_inl->inlinedfn;
+ buf_fn = next_inl->inlined.fn;
know_fnname = True;
// INLINED????
@@ -2951,7 +2951,7 @@ const HChar* VG_(describe_IP)(DiEpoch ep, Addr eip, const InlIPCursor *iipc)
Int i;
dirname = buf_dirname;
// Remove leading prefixes from the dirname.
- // If user supplied --fullpath-after=foo, this will remove
+ // If user supplied --fullpath-after=foo, this will remove
// a leading string which matches '.*foo' (not greedy).
for (i = 0; i < VG_(sizeXA)(VG_(clo_fullpath_after)); i++) {
const HChar* prefix =
@@ -3031,7 +3031,7 @@ typedef
caller must set it to True before calling. */
__attribute__((noinline))
static
-UWord evalCfiExpr ( const XArray* exprs, Int ix,
+UWord evalCfiExpr ( const XArray* exprs, Int ix,
const CfiExprEvalContext* eec, Bool* ok )
{
UWord w, wL, wR;
@@ -3118,7 +3118,7 @@ UWord evalCfiExpr ( const XArray* exprs, Int ix,
}
/* let's hope it doesn't trap! */
return ML_(read_UWord)((void *)a);
- default:
+ default:
goto unhandled;
}
/*NOTREACHED*/
@@ -3133,7 +3133,7 @@ UWord evalCfiExpr ( const XArray* exprs, Int ix,
/* Search all the DebugInfos in the entire system, to find the DiCfSI_m
- that pertains to 'ip'.
+ that pertains to 'ip'.
If found, set *diP to the DebugInfo in which it resides, and
*cfsi_mP to the cfsi_m pointer in that DebugInfo's cfsi_m_pool.
@@ -3144,7 +3144,7 @@ UWord evalCfiExpr ( const XArray* exprs, Int ix,
DebugInfos that are valid for the current epoch.
*/
__attribute__((noinline))
-static void find_DiCfSI ( /*OUT*/DebugInfo** diP,
+static void find_DiCfSI ( /*OUT*/DebugInfo** diP,
/*OUT*/DiCfSI_m** cfsi_mP,
Addr ip )
{
@@ -3226,7 +3226,7 @@ static void find_DiCfSI ( /*OUT*/DebugInfo** diP,
if (0 && ((n_search & 0x7FFFF) == 0))
VG_(printf)("find_DiCfSI: %lu searches, "
- "%lu DebugInfos looked at\n",
+ "%lu DebugInfos looked at\n",
n_search, n_steps);
}
@@ -3318,23 +3318,23 @@ static Addr compute_cfa ( const D3UnwindRegs* uregs,
cfa = 0;
switch (cfsi_m->cfa_how) {
# if defined(VGA_x86) || defined(VGA_amd64)
- case CFIC_IA_SPREL:
+ case CFIC_IA_SPREL:
cfa = cfsi_m->cfa_off + uregs->xsp;
break;
- case CFIC_IA_BPREL:
+ case CFIC_IA_BPREL:
cfa = cfsi_m->cfa_off + uregs->xbp;
break;
# elif defined(VGA_arm)
- case CFIC_ARM_R13REL:
+ case CFIC_ARM_R13REL:
cfa = cfsi_m->cfa_off + uregs->r13;
break;
- case CFIC_ARM_R12REL:
+ case CFIC_ARM_R12REL:
cfa = cfsi_m->cfa_off + uregs->r12;
break;
- case CFIC_ARM_R11REL:
+ case CFIC_ARM_R11REL:
cfa = cfsi_m->cfa_off + uregs->r11;
break;
- case CFIC_ARM_R7REL:
+ case CFIC_ARM_R7REL:
cfa = cfsi_m->cfa_off + uregs->r7;
break;
# elif defined(VGA_s390x)
@@ -3367,10 +3367,10 @@ static Addr compute_cfa ( const D3UnwindRegs* uregs,
break;
# elif defined(VGA_ppc32) || defined(VGA_ppc64be) || defined(VGA_ppc64le)
# elif defined(VGP_arm64_linux)
- case CFIC_ARM64_SPREL:
+ case CFIC_ARM64_SPREL:
cfa = cfsi_m->cfa_off + uregs->sp;
break;
- case CFIC_ARM64_X29REL:
+ case CFIC_ARM64_X29REL:
cfa = cfsi_m->cfa_off + uregs->x29;
break;
# elif defined(VGP_arm64_freebsd)
@@ -3403,7 +3403,7 @@ static Addr compute_cfa ( const D3UnwindRegs* uregs,
cfa = evalCfiExpr(di->cfsi_exprs, cfsi_m->cfa_off, &eec, &ok );
if (!ok) return 0;
break;
- default:
+ default:
vg_assert(0);
}
return cfa;
@@ -3559,7 +3559,7 @@ Bool VG_(use_CF_info) ( /*MOD*/D3UnwindRegs* uregsHere,
cfsi_m = ce->cfsi_m;
if (0) {
- VG_(printf)("found cfsi_m (but printing fake base/len): ");
+ VG_(printf)("found cfsi_m (but printing fake base/len): ");
ML_(ppDiCfSI)(di->cfsi_exprs, 0, 0, cfsi_m);
}
@@ -3581,7 +3581,6 @@ Bool VG_(use_CF_info) ( /*MOD*/D3UnwindRegs* uregsHere,
# endif
# if defined(VGA_s390x)
- const Bool is_s390x = True;
const Addr old_S390X_F0 = uregsHere->f0;
const Addr old_S390X_F1 = uregsHere->f1;
const Addr old_S390X_F2 = uregsHere->f2;
@@ -3590,16 +3589,9 @@ Bool VG_(use_CF_info) ( /*MOD*/D3UnwindRegs* uregsHere,
const Addr old_S390X_F5 = uregsHere->f5;
const Addr old_S390X_F6 = uregsHere->f6;
const Addr old_S390X_F7 = uregsHere->f7;
+# define SAVE_TO_PREV(p,reg) do { p = reg; } while (0)
# else
- const Bool is_s390x = False;
- const Addr old_S390X_F0 = 0;
- const Addr old_S390X_F1 = 0;
- const Addr old_S390X_F2 = 0;
- const Addr old_S390X_F3 = 0;
- const Addr old_S390X_F4 = 0;
- const Addr old_S390X_F5 = 0;
- const Addr old_S390X_F6 = 0;
- const Addr old_S390X_F7 = 0;
+# define SAVE_TO_PREV(p,reg) do { vg_assert(0); } while (0)
# endif
# define COMPUTE(_prev, _here, _how, _off) \
@@ -3631,29 +3623,29 @@ Bool VG_(use_CF_info) ( /*MOD*/D3UnwindRegs* uregsHere,
if (!ok) return False; \
break; \
case CFIR_S390X_F0: \
- if (is_s390x) { _prev = old_S390X_F0; break; } \
- vg_assert(0+0-0); \
+ SAVE_TO_PREV(_prev, old_S390X_F0); \
+ break; \
case CFIR_S390X_F1: \
- if (is_s390x) { _prev = old_S390X_F1; break; } \
- vg_assert(0+1-1); \
+ SAVE_TO_PREV(_prev, old_S390X_F1); \
+ break; \
case CFIR_S390X_F2: \
- if (is_s390x) { _prev = old_S390X_F2; break; } \
- vg_assert(0+2-2); \
+ SAVE_TO_PREV(_prev, old_S390X_F2); \
+ break; \
case CFIR_S390X_F3: \
- if (is_s390x) { _prev = old_S390X_F3; break; } \
- vg_assert(0+3-3); \
+ SAVE_TO_PREV(_prev, old_S390X_F3); \
+ break; \
case CFIR_S390X_F4: \
- if (is_s390x) { _prev = old_S390X_F4; break; } \
- vg_assert(0+4-4); \
+ SAVE_TO_PREV(_prev, old_S390X_F4); \
+ break; \
case CFIR_S390X_F5: \
- if (is_s390x) { _prev = old_S390X_F5; break; } \
- vg_assert(0+5-5); \
+ SAVE_TO_PREV(_prev, old_S390X_F5); \
+ break; \
case CFIR_S390X_F6: \
- if (is_s390x) { _prev = old_S390X_F6; break; } \
- vg_assert(0+6-6); \
+ SAVE_TO_PREV(_prev, old_S390X_F6); \
+ break; \
case CFIR_S390X_F7: \
- if (is_s390x) { _prev = old_S390X_F7; break; } \
- vg_assert(0+7-7); \
+ SAVE_TO_PREV(_prev, old_S390X_F7); \
+ break; \
default: \
vg_assert(0*0); \
} \
@@ -3828,11 +3820,11 @@ Bool VG_(use_FPO_info) ( /*MOD*/Addr* ipP,
I don't know what happens when the compiler constructs an outgoing CALL.
%esp could move if outgoing parameters are PUSHed, and this affects
traceback for errors during the PUSHes. */
-
+
spHere = *spP;
*ipP = ML_(read_Addr)((void *)(spHere + 4*(fpo->cbRegs + fpo->cdwLocals)));
- *spP = spHere + 4*(fpo->cbRegs + fpo->cdwLocals + 1
+ *spP = spHere + 4*(fpo->cbRegs + fpo->cdwLocals + 1
+ fpo->cdwParams);
*fpP = ML_(read_Addr)((void *)(spHere + 4*2));
return True;
@@ -3930,7 +3922,7 @@ static Bool data_address_is_in_var ( /*OUT*/PtrdiffT* offset,
VG_(printf)("\n");
}
- if (res.kind == GXR_Addr
+ if (res.kind == GXR_Addr
&& res.word <= data_addr
&& data_addr < res.word + var_szB) {
*offset = data_addr - res.word;
@@ -3955,7 +3947,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1,
PtrdiffT var_offset,
PtrdiffT residual_offset,
const XArray* /*HChar*/ described,
- Int frameNo,
+ Int frameNo,
ThreadId tid )
{
Bool have_descr, have_srcloc;
@@ -4024,7 +4016,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1,
p2XA( dn2,
"in frame #%d of thread %u", frameNo, tid );
}
- }
+ }
else
if ( frameNo >= 0 && have_srcloc && (!have_descr) ) {
/* no description:
@@ -4045,7 +4037,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1,
TXTR( dn2 );
// FIXME: also do
p2XA( dn2,
- " %pS%d ",
+ " %pS%d ",
fileName, var->lineNo );
XAGR( dn2 );
} else {
@@ -4082,7 +4074,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1,
p2XA( dn2,
"in frame #%d of thread %u", frameNo, tid );
}
- }
+ }
else
if ( frameNo >= 0 && have_srcloc && have_descr ) {
/* Location 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2,
@@ -4132,7 +4124,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1,
"Location 0x%lx is %ld byte%s inside global var \"%s\"",
data_addr, var_offset, vo_plural, var->name );
}
- }
+ }
else
if ( frameNo >= -1 && have_srcloc && (!have_descr) ) {
/* no description:
@@ -4190,7 +4182,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1,
p2XA( dn2,
"a global variable");
}
- }
+ }
else
if ( frameNo >= -1 && have_srcloc && have_descr ) {
/* Location 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2,
@@ -4223,7 +4215,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1,
fileName, var->lineNo);
}
}
- else
+ else
vg_assert(0);
/* Zero terminate both strings */
@@ -4244,7 +4236,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1,
ends of DNAME{1,2}, which are XArray*s of HChar, that have been
initialised by the caller, zero terminate both, and return True.
If it's not a local variable in said frame, return False. */
-static
+static
Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1,
/*MOD*/XArray* /* of HChar */ dname2,
DiEpoch ep,
@@ -4275,7 +4267,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1,
if (di->text_avma <= ip && ip < di->text_avma + di->text_size)
break;
}
-
+
/* Didn't find it. Strange -- means ip is a code address outside
of any mapped text segment. Unlikely but not impossible -- app
could be generating code to run. */
@@ -4284,7 +4276,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1,
if (0 && ((n_search & 0x1) == 0))
VG_(printf)("consider_vars_in_frame: %u searches, "
- "%u DebugInfos looked at\n",
+ "%u DebugInfos looked at\n",
n_search, n_steps);
/* Start of performance-enhancing hack: once every ??? (chosen
hackily after profiling) successful searches, move the found
@@ -4314,7 +4306,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1,
XArray* vars;
Word j;
DiAddrRange* arange;
- OSet* this_scope
+ OSet* this_scope
= *(OSet**)VG_(indexXA)( di->varinfo, i );
if (debug)
VG_(printf)("QQQQ: considering scope %ld\n", (Word)i);
@@ -4323,7 +4315,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1,
/* Find the set of variables in this scope that
bracket the program counter. */
arange = VG_(OSetGen_LookupWithCmp)(
- this_scope, &ip,
+ this_scope, &ip,
ML_(cmp_for_DiAddrRange_range)
);
if (!arange)
@@ -4355,7 +4347,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1,
data_addr, di )) {
PtrdiffT residual_offset = 0;
XArray* described = ML_(describe_type)( &residual_offset,
- di->admin_tyents,
+ di->admin_tyents,
var->typeR, offset );
format_message( dname1, dname2,
data_addr, di, var, offset, residual_offset,
@@ -4382,7 +4374,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1,
using VG_(strlen) on the contents, rather than VG_(sizeXA) on the
XArray itself.
*/
-Bool VG_(get_data_description)(
+Bool VG_(get_data_description)(
/*MOD*/ XArray* /* of HChar */ dname1,
/*MOD*/ XArray* /* of HChar */ dname2,
DiEpoch ep, Addr data_addr
@@ -4432,7 +4424,7 @@ Bool VG_(get_data_description)(
vg_assert(gs_size == 1);
/* Fish out the global scope and check it is as expected. */
zero = 0;
- global_arange
+ global_arange
= VG_(OSetGen_Lookup)( global_scope, &zero );
/* The global range from (Addr)0 to ~(Addr)0 must exist */
vg_assert(global_arange);
@@ -4455,8 +4447,8 @@ Bool VG_(get_data_description)(
This means, if the evaluation of the location
expression/list requires a register, we have to let it
fail. */
- if (data_address_is_in_var( &offset, di->admin_tyents, var,
- NULL/* RegSummary* */,
+ if (data_address_is_in_var( &offset, di->admin_tyents, var,
+ NULL/* RegSummary* */,
data_addr, di )) {
PtrdiffT residual_offset = 0;
XArray* described = ML_(describe_type)( &residual_offset,
@@ -4506,7 +4498,7 @@ Bool VG_(get_data_description)(
for (j = 0; j < n_frames; j++) {
if (consider_vars_in_frame( dname1, dname2,
ep, data_addr,
- ips[j],
+ ips[j],
sps[j], fps[j], tid, j )) {
zterm_XA( dname1 );
zterm_XA( dname2 );
@@ -4533,7 +4525,7 @@ Bool VG_(get_data_description)(
if (j > 0 /* this is a non-innermost frame */
&& consider_vars_in_frame( dname1, dname2,
ep, data_addr,
- ips[j] + 1,
+ ips[j] + 1,
sps[j], fps[j], tid, j )) {
zterm_XA( dname1 );
zterm_XA( dname2 );
@@ -4561,7 +4553,7 @@ Bool VG_(get_data_description)(
it. If 'arrays_only' is True, also ignore it unless it has an
array type. */
-static
+static
void analyse_deps ( /*MOD*/XArray* /* of FrameBlock */ blocks,
const XArray* /* TyEnt */ tyents,
Addr ip, const DebugInfo* di, const DiVariable* var,
@@ -4719,7 +4711,7 @@ VG_(di_get_stack_blocks_at_ip)( Addr ip, Bool arrays_only )
if (di->text_avma <= ip && ip < di->text_avma + di->text_size)
break;
}
-
+
/* Didn't find it. Strange -- means ip is a code address outside
of any mapped text segment. Unlikely but not impossible -- app
could be generating code to run. */
@@ -4728,7 +4720,7 @@ VG_(di_get_stack_blocks_at_ip)( Addr ip, Bool arrays_only )
if (0 && ((n_search & 0x1) == 0))
VG_(printf)("VG_(di_get_stack_blocks_at_ip): %u searches, "
- "%u DebugInfos looked at\n",
+ "%u DebugInfos looked at\n",
n_search, n_steps);
/* Start of performance-enhancing hack: once every ??? (chosen
hackily after profiling) successful searches, move the found
@@ -4755,7 +4747,7 @@ VG_(di_get_stack_blocks_at_ip)( Addr ip, Bool arrays_only )
XArray* vars;
Word j;
DiAddrRange* arange;
- OSet* this_scope
+ OSet* this_scope
= *(OSet**)VG_(indexXA)( di->varinfo, i );
if (debug)
VG_(printf)("QQQQ: considering scope %ld\n", (Word)i);
@@ -4764,7 +4756,7 @@ VG_(di_get_stack_blocks_at_ip)( Addr ip, Bool arrays_only )
/* Find the set of variables in this scope that
bracket the program counter. */
arange = VG_(OSetGen_LookupWithCmp)(
- this_scope, &ip,
+ this_scope, &ip,
ML_(cmp_for_DiAddrRange_range)
);
if (!arange)
@@ -4788,7 +4780,7 @@ VG_(di_get_stack_blocks_at_ip)( Addr ip, Bool arrays_only )
for (j = 0; j < VG_(sizeXA)( vars ); j++) {
DiVariable* var = (DiVariable*)VG_(indexXA)( vars, j );
if (debug)
- VG_(printf)("QQQQ: var:name=%s %#lx-%#lx %#lx\n",
+ VG_(printf)("QQQQ: var:name=%s %#lx-%#lx %#lx\n",
var->name,arange->aMin,arange->aMax,ip);
analyse_deps( res, di->admin_tyents, ip,
di, var, arrays_only );
@@ -4948,32 +4940,32 @@ const DebugInfo* VG_(next_DebugInfo)(const DebugInfo* di)
Addr VG_(DebugInfo_get_text_avma)(const DebugInfo* di)
{
- return di->text_present ? di->text_avma : 0;
+ return di->text_present ? di->text_avma : 0;
}
SizeT VG_(DebugInfo_get_text_size)(const DebugInfo* di)
{
- return di->text_present ? di->text_size : 0;
+ return di->text_present ? di->text_size : 0;
}
Addr VG_(DebugInfo_get_bss_avma)(const DebugInfo* di)
{
- return di->bss_present ? di->bss_avma : 0;
+ return di->bss_present ? di->bss_avma : 0;
}
SizeT VG_(DebugInfo_get_bss_size)(const DebugInfo* di)
{
- return di->bss_present ? di->bss_size : 0;
+ return di->bss_present ? di->bss_size : 0;
}
Addr VG_(DebugInfo_get_plt_avma)(const DebugInfo* di)
{
- return di->plt_present ? di->plt_avma : 0;
+ return di->plt_present ? di->plt_avma : 0;
}
SizeT VG_(DebugInfo_get_plt_size)(const DebugInfo* di)
{
- return di->plt_present ? di->plt_size : 0;
+ return di->plt_present ? di->plt_size : 0;
}
Addr VG_(DebugInfo_get_pltsec_avma)(const DebugInfo* di)
@@ -4988,22 +4980,22 @@ SizeT VG_(DebugInfo_get_pltsec_size)(const DebugInfo* di)
Addr VG_(DebugInfo_get_gotplt_avma)(const DebugInfo* di)
{
- return di->gotplt_present ? di->gotplt_avma : 0;
+ return di->gotplt_present ? di->gotplt_avma : 0;
}
SizeT VG_(DebugInfo_get_gotplt_size)(const DebugInfo* di)
{
- return di->gotplt_present ? di->gotplt_size : 0;
+ return di->gotplt_present ? di->gotplt_size : 0;
}
Addr VG_(DebugInfo_get_got_avma)(const DebugInfo* di)
{
- return di->got_present ? di->got_avma : 0;
+ return di->got_present ? di->got_avma : 0;
}
SizeT VG_(DebugInfo_get_got_size)(const DebugInfo* di)
{
- return di->got_present ? di->got_size : 0;
+ return di->got_present ? di->got_size : 0;
}
const HChar* VG_(DebugInfo_get_soname)(const DebugInfo* di)
@@ -5026,7 +5018,7 @@ Int VG_(DebugInfo_syms_howmany) ( const DebugInfo *si )
return si->symtab_used;
}
-void VG_(DebugInfo_syms_getidx) ( const DebugInfo *si,
+void VG_(DebugInfo_syms_getidx) ( const DebugInfo *si,
Int idx,
/*OUT*/SymAVMAs* avmas,
/*OUT*/UInt* size,
diff --git a/coregrind/m_debuginfo/image.c b/coregrind/m_debuginfo/image.c
index d00535cda2..21deabb356 100644
--- a/coregrind/m_debuginfo/image.c
+++ b/coregrind/m_debuginfo/image.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/inltab_lookup.c b/coregrind/m_debuginfo/inltab_lookup.c
index 89c7484158..04e1df26e5 100644
--- a/coregrind/m_debuginfo/inltab_lookup.c
+++ b/coregrind/m_debuginfo/inltab_lookup.c
@@ -94,7 +94,7 @@ void VG_(inltab_lookup_insert)(VgHashTable *ht, Addr addr, Word inl_idx) {
Bool VG_(inltab_lookup_get)(VgHashTable *ht, Addr addr, Word *inl_idx,
const DebugInfo* di) {
if (ht == NULL)
- return False;
+ ht = VG_(inltab_lookup_new)();
/* Try hash table lookup first */
InlLookupNode *node = VG_(HT_lookup)(ht, (UWord)addr);
diff --git a/coregrind/m_debuginfo/lzoconf.h b/coregrind/m_debuginfo/lzoconf.h
index 23c6ca93fc..fd02f80201 100644
--- a/coregrind/m_debuginfo/lzoconf.h
+++ b/coregrind/m_debuginfo/lzoconf.h
@@ -22,7 +22,7 @@
The LZO library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
+ published by the Free Software Foundation; either version 3 of
the License, or (at your option) any later version.
The LZO library is distributed in the hope that it will be useful,
diff --git a/coregrind/m_debuginfo/lzodefs.h b/coregrind/m_debuginfo/lzodefs.h
index 0e40e332a8..4dbcabe178 100644
--- a/coregrind/m_debuginfo/lzodefs.h
+++ b/coregrind/m_debuginfo/lzodefs.h
@@ -22,7 +22,7 @@
The LZO library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
+ published by the Free Software Foundation; either version 3 of
the License, or (at your option) any later version.
The LZO library is distributed in the hope that it will be useful,
diff --git a/coregrind/m_debuginfo/minilzo-inl.c b/coregrind/m_debuginfo/minilzo-inl.c
index b45ec92eaa..939e929d92 100644
--- a/coregrind/m_debuginfo/minilzo-inl.c
+++ b/coregrind/m_debuginfo/minilzo-inl.c
@@ -22,7 +22,7 @@
The LZO library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
+ published by the Free Software Foundation; either version 3 of
the License, or (at your option) any later version.
The LZO library is distributed in the hope that it will be useful,
diff --git a/coregrind/m_debuginfo/minilzo.h b/coregrind/m_debuginfo/minilzo.h
index 4c7b237849..d9e7d6ab25 100644
--- a/coregrind/m_debuginfo/minilzo.h
+++ b/coregrind/m_debuginfo/minilzo.h
@@ -22,7 +22,7 @@
The LZO library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
+ published by the Free Software Foundation; either version 3 of
the License, or (at your option) any later version.
The LZO library is distributed in the hope that it will be useful,
diff --git a/coregrind/m_debuginfo/misc.c b/coregrind/m_debuginfo/misc.c
index 910d9b2172..520c4cf992 100644
--- a/coregrind/m_debuginfo/misc.c
+++ b/coregrind/m_debuginfo/misc.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/priv_d3basics.h b/coregrind/m_debuginfo/priv_d3basics.h
index 34c9872871..1eb3fd7629 100644
--- a/coregrind/m_debuginfo/priv_d3basics.h
+++ b/coregrind/m_debuginfo/priv_d3basics.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/priv_image.h b/coregrind/m_debuginfo/priv_image.h
index 1632fa71f0..90de98dfc5 100644
--- a/coregrind/m_debuginfo/priv_image.h
+++ b/coregrind/m_debuginfo/priv_image.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/priv_misc.h b/coregrind/m_debuginfo/priv_misc.h
index ca430d3d07..d9080079b3 100644
--- a/coregrind/m_debuginfo/priv_misc.h
+++ b/coregrind/m_debuginfo/priv_misc.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/priv_readdwarf.h b/coregrind/m_debuginfo/priv_readdwarf.h
index 302266924f..665c25f228 100644
--- a/coregrind/m_debuginfo/priv_readdwarf.h
+++ b/coregrind/m_debuginfo/priv_readdwarf.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/priv_readdwarf3.h b/coregrind/m_debuginfo/priv_readdwarf3.h
index 25e3cd50dc..dea54a4b4e 100644
--- a/coregrind/m_debuginfo/priv_readdwarf3.h
+++ b/coregrind/m_debuginfo/priv_readdwarf3.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/priv_readelf.h b/coregrind/m_debuginfo/priv_readelf.h
index 75e02c9800..88c9cc9272 100644
--- a/coregrind/m_debuginfo/priv_readelf.h
+++ b/coregrind/m_debuginfo/priv_readelf.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/priv_readexidx.h b/coregrind/m_debuginfo/priv_readexidx.h
index 8dca00f2bf..5ca55d3387 100644
--- a/coregrind/m_debuginfo/priv_readexidx.h
+++ b/coregrind/m_debuginfo/priv_readexidx.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/priv_readmacho.h b/coregrind/m_debuginfo/priv_readmacho.h
index 0cbdad90f2..5ff5d048ce 100644
--- a/coregrind/m_debuginfo/priv_readmacho.h
+++ b/coregrind/m_debuginfo/priv_readmacho.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/priv_readpdb.h b/coregrind/m_debuginfo/priv_readpdb.h
index b9b8fb3a2c..49f24291cd 100644
--- a/coregrind/m_debuginfo/priv_readpdb.h
+++ b/coregrind/m_debuginfo/priv_readpdb.h
@@ -16,7 +16,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/priv_storage.h b/coregrind/m_debuginfo/priv_storage.h
index e7946e931f..fad960aa02 100644
--- a/coregrind/m_debuginfo/priv_storage.h
+++ b/coregrind/m_debuginfo/priv_storage.h
@@ -11,10 +11,12 @@
Copyright (C) 2000-2017 Julian Seward
jseward@acm.org
+ Copyright (C) 2025 Mark J. Wielaard
+ mark@klomp.org
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -143,7 +145,10 @@ typedef
/* Word 2 */
Addr addr_hi; /* highest address following the inlined fn */
/* Word 3 */
- const HChar* inlinedfn; /* inlined function name */
+ union {
+ UWord subprog; /* subprogram DIE (cooked) reference. */
+ const HChar* fn; /* inlined function name (after resolving) */
+ } inlined;
/* Word 4 and 5 */
UInt fndn_ix; /* index in di->fndnpool of caller source
dirname/filename */
@@ -152,6 +157,18 @@ typedef
}
DiInlLoc;
+typedef
+ struct {
+ UWord index; /* cooked DIE index. */
+ union {
+ const HChar *fn; /* Name of subprogram. */
+ UWord subprog; /* DW_AT_specification of another subprogram. */
+ } ref;
+ Bool isSubprogRef; /* True is ref is a subprog reference. */
+ Bool isArtificial; /* True is the subprogram has DW_AT_artificial. */
+ }
+ DiSubprogram;
+
/* --------------------- CF INFO --------------------- */
/* DiCfSI: a structure to summarise DWARF2/3 CFA info for the code
@@ -954,6 +971,12 @@ struct _DebugInfo {
UWord inltab_size;
SizeT maxinl_codesz;
+ /* Storage for subprogram attributes. To use in inltab after pass over
+ all debuginfo to resolve names. */
+ DiSubprogram* subtab;
+ UWord subtab_used;
+ UWord subtab_size;
+
/* Hash table for O(1) inline lookups by address.
Maps arbitrary addresses to indices in inltab; populated on-demand during lookups for cache efficiency. */
VgHashTable* inltab_lookup;
@@ -1134,10 +1157,12 @@ void ML_(addLineInfo) ( struct _DebugInfo* di,
extern
void ML_(addInlInfo) ( struct _DebugInfo* di,
Addr addr_lo, Addr addr_hi,
- const HChar* inlinedfn,
+ UWord subprog,
UInt fndn_ix,
Int lineno, UShort level);
+extern void ML_(addSubprogram) ( struct _DebugInfo* di, DiSubprogram* sub );
+
/* Add a CFI summary record. The supplied DiCfSI_m is copied. */
extern void ML_(addDiCfSI) ( struct _DebugInfo* di,
Addr base, UInt len, DiCfSI_m* cfsi_m );
diff --git a/coregrind/m_debuginfo/priv_tytypes.h b/coregrind/m_debuginfo/priv_tytypes.h
index 787c578704..97c7cc9b34 100644
--- a/coregrind/m_debuginfo/priv_tytypes.h
+++ b/coregrind/m_debuginfo/priv_tytypes.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c
index b08720182e..3b5c6be703 100644
--- a/coregrind/m_debuginfo/readdwarf.c
+++ b/coregrind/m_debuginfo/readdwarf.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -2366,9 +2366,10 @@ static Bool summarise_context(/*OUT*/Addr* base,
*len = 0;
VG_(bzero_inline)(si_m, sizeof(*si_m));
- /*const*/ Bool is_s390x_linux = False;
# if defined(VGP_s390x_linux)
- is_s390x_linux = True;
+ #define is_s390x_linux True
+# else
+ #define is_s390x_linux False
# endif
/* Guard against obviously stupid settings of the reg-rule stack
diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c
index 735896f7c0..374237498e 100644
--- a/coregrind/m_debuginfo/readdwarf3.c
+++ b/coregrind/m_debuginfo/readdwarf3.c
@@ -11,10 +11,12 @@
Copyright (C) 2008-2017 OpenWorks LLP
info@open-works.co.uk
+ Copyright (C) 2025 Mark J. Wielaard
+ mark@klomp.org
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -3388,147 +3390,6 @@ typedef
}
D3InlParser;
-/* Return the function name corresponding to absori.
-
- absori is a 'cooked' reference to a DIE, i.e. absori can be either
- in cc->escn_debug_info or in cc->escn_debug_info_alt.
- get_inlFnName will uncook absori.
-
- The returned value is a (permanent) string in DebugInfo's .strchunks.
-
- LIMITATION: absori must point in the CU of cc. If absori points
- in another CU, returns "UnknownInlinedFun".
-
- Here are the problems to retrieve the fun name if absori is in
- another CU: the DIE reading code cannot properly extract data from
- another CU, as the abbv code retrieved in the other CU cannot be
- translated in an abbreviation. Reading data from the alternate debug
- info also gives problems as the string reference is also in the alternate
- file, but when reading the alt DIE, the string form is a 'local' string,
- but cannot be read in the current CU, but must be read in the alt CU.
- See bug 338803 comment#3 and attachment for a failed attempt to handle
- these problems (failed because with the patch, only one alt abbrev hash
- table is kept, while we must handle all abbreviations in all CUs
- referenced by an absori (being a reference to an alt CU, or a previous
- or following CU). */
-static const HChar* get_inlFnName (Int absori, CUConst* cc, Bool td3)
-{
- Cursor c;
- const g_abbv *abbv;
- ULong atag, abbv_code;
- UInt has_children;
- UWord posn;
- Bool type_flag, alt_flag;
- const HChar *ret = NULL;
- FormContents cts;
- UInt nf_i;
-
- /* Some inlined subroutine call dwarf entries do not have the abstract
- origin attribute, resulting in absori being 0 (see callers of
- get_inlFnName). This is observed at least with gcc 6.3.0 when compiling
- valgrind with lto. So, in case we have a 0 absori, do not report an
- error, instead, rather return an unknown inlined function. */
- if (absori == 0) {
- static Bool absori0_reported = False;
- if (!absori0_reported && VG_(clo_verbosity) > 1) {
- VG_(message)(Vg_DebugMsg,
- "Warning: inlined fn name without absori\n"
- "is shown as UnknownInlinedFun\n");
- absori0_reported = True;
- }
- TRACE_D3(" : absori is not set");
- return ML_(addStr)(cc->di, "UnknownInlinedFun", -1);
- }
-
- posn = uncook_die( cc, absori, &type_flag, &alt_flag);
- if (type_flag)
- cc->barf("get_inlFnName: uncooked absori in type debug info");
-
- /* LIMITATION: check we are in the same CU.
- If not, return unknown inlined function name. */
- /* if crossing between alt debug info<>normal info
- or posn not in the cu range,
- then it is in another CU. */
- if (alt_flag != cc->is_alt_info
- || posn < cc->cu_start_offset
- || posn >= cc->cu_start_offset + cc->unit_length) {
- static Bool reported = False;
- if (!reported && VG_(clo_verbosity) > 1) {
- VG_(message)(Vg_DebugMsg,
- "Warning: cross-CU LIMITATION: some inlined fn names\n"
- "might be shown as UnknownInlinedFun\n");
- reported = True;
- }
- TRACE_D3(" <%lx>: cross-CU LIMITATION", posn);
- return ML_(addStr)(cc->di, "UnknownInlinedFun", -1);
- }
-
- init_Cursor (&c, cc->escn_debug_info, posn, cc->barf,
- "Overrun get_inlFnName absori");
-
- abbv_code = get_ULEB128( &c );
- abbv = get_abbv ( cc, abbv_code, td3);
- atag = abbv->atag;
- TRACE_D3(" <%lx>: Abbrev Number: %llu (%s)\n",
- posn, abbv_code, ML_(pp_DW_TAG)( atag ) );
-
- if (atag == 0)
- cc->barf("get_inlFnName: invalid zero tag on DIE");
-
- has_children = abbv->has_children;
- if (has_children != DW_children_no && has_children != DW_children_yes)
- cc->barf("get_inlFnName: invalid has_children value");
-
- if (atag != DW_TAG_subprogram)
- cc->barf("get_inlFnName: absori not a subprogram");
-
- nf_i = 0;
- while (True) {
- DW_AT attr = (DW_AT) abbv->nf[nf_i].at_name;
- DW_FORM form = (DW_FORM)abbv->nf[nf_i].at_form;
- const name_form *nf = &abbv->nf[nf_i];
- nf_i++;
- if (attr == 0 && form == 0) break;
- get_Form_contents( &cts, cc, &c, False/*td3*/, nf );
- if (attr == DW_AT_name) {
- HChar *fnname;
- if (cts.szB >= 0)
- cc->barf("get_inlFnName: expecting indirect string");
- fnname = ML_(cur_read_strdup)( cts.u.cur,
- "get_inlFnName.1" );
- ret = ML_(addStr)(cc->di, fnname, -1);
- ML_(dinfo_free) (fnname);
- break; /* Name found, get out of the loop, as this has priority over
- DW_AT_specification. */
- }
- if (attr == DW_AT_specification) {
- UWord cdie;
-
- if (cts.szB == 0)
- cc->barf("get_inlFnName: AT specification missing");
-
- /* The recursive call to get_inlFnName will uncook its arg.
- So, we need to cook it here, so as to reference the
- correct section (e.g. the alt info). */
- cdie = cook_die_using_form(cc, (UWord)cts.u.val, form);
-
- /* hoping that there is no loop */
- ret = get_inlFnName (cdie, cc, td3);
- /* Unclear if having both DW_AT_specification and DW_AT_name is
- possible but in any case, we do not break here.
- If we find later on a DW_AT_name, it will override the name found
- in the DW_AT_specification.*/
- }
- }
-
- if (ret)
- return ret;
- else {
- TRACE_D3("AbsOriFnNameNotFound");
- return ML_(addStr)(cc->di, "AbsOriFnNameNotFound", -1);
- }
-}
-
/* Returns True if the (possibly) childrens of the current DIE are interesting
to parse. Returns False otherwise.
If the current DIE has a sibling, the non interesting children can
@@ -3618,8 +3479,8 @@ static Bool parse_inl_DIE (
Addr rangeoff = 0;
UInt caller_fndn_ix = 0;
Int caller_lineno = 0;
- Int inlinedfn_abstract_origin = 0;
- // 0 will be interpreted as no abstract origin by get_inlFnName
+ UWord inlinedfn_abstract_origin = 0;
+ // 0 will be interpreted as no abstract origin
nf_i = 0;
while (True) {
@@ -3683,7 +3544,7 @@ static Bool parse_inl_DIE (
ip_hi1 += cc->di->text_debug_bias;
ML_(addInlInfo) (cc->di,
ip_lo, ip_hi1,
- get_inlFnName (inlinedfn_abstract_origin, cc, td3),
+ inlinedfn_abstract_origin,
caller_fndn_ix,
caller_lineno, level);
}
@@ -3691,8 +3552,6 @@ static Bool parse_inl_DIE (
/* This inlined call is several address ranges. */
XArray *ranges;
Word j;
- const HChar *inlfnname =
- get_inlFnName (inlinedfn_abstract_origin, cc, td3);
/* Ranges are biased for the inline info using the same logic
as what is used for biasing ranges for the var info, for which
@@ -3709,7 +3568,7 @@ static Bool parse_inl_DIE (
// aMax+1 as range has its last bound included
// while ML_(addInlInfo) expects last bound not
// included.
- inlfnname,
+ inlinedfn_abstract_origin,
caller_fndn_ix,
caller_lineno, level);
}
@@ -3718,11 +3577,91 @@ static Bool parse_inl_DIE (
goto_bad_DIE;
}
+ if (dtag == DW_TAG_subprogram) {
+ DiSubprogram sub;
+ sub.index = posn; /* Note posn is already cooked. */
+ sub.isArtificial = False;
+ UWord cdie = 0;
+ const HChar *fn = NULL;
+ Bool name_or_spec = False;
+ nf_i = 0;
+ while (True) {
+ DW_AT attr = (DW_AT) abbv->nf[nf_i].at_name;
+ DW_FORM form = (DW_FORM)abbv->nf[nf_i].at_form;
+ const name_form *nf = &abbv->nf[nf_i];
+ nf_i++;
+ if (attr == 0 && form == 0) break;
+ get_Form_contents( &cts, cc, c_die, False/*td3*/, nf );
+ if (attr == DW_AT_sibling && cts.szB > 0) {
+ parser->sibling = cts.u.val;
+ }
+ if (attr == DW_AT_artificial && cts.u.val == 1) {
+ sub.isArtificial = True;
+ }
+ if ((attr == DW_AT_specification
+ || attr == DW_AT_abstract_origin)
+ && cts.szB > 0 && cts.u.val > 0) {
+ name_or_spec = True;
+ cdie = cook_die_using_form(cc, (UWord)cts.u.val, form);
+ sub.ref.subprog = cdie;
+ sub.isSubprogRef = True;
+ }
+ if (attr == DW_AT_name && cts.szB < 0) {
+ HChar *fnname;
+ name_or_spec = True;
+ fnname = ML_(cur_read_strdup)( cts.u.cur,
+ ".1" );
+ fn = ML_(addStr)(cc->di, fnname, -1);
+ ML_(dinfo_free) (fnname);
+ sub.ref.fn = fn;
+ sub.isSubprogRef = False;
+ }
+ }
+ /* Clang doesn't give a name for some artificial subprograms.
+ Just use "" as the name. */
+ if (!name_or_spec && sub.isArtificial) {
+ name_or_spec = True;
+ fn = ML_(addStr)(cc->di, "", -1);
+ sub.ref.fn = fn;
+ sub.isSubprogRef = False;
+ }
+ if (name_or_spec)
+ ML_(addSubprogram) (cc->di, &sub);
+ else if (nf_i > 1 /* Clang produces empty subprograms, no attrs. */
+ && VG_(clo_verbosity) >= 1) {
+ /* Only warn once per debug file. */
+ static HChar *last_dbgname;
+ HChar *dbgname = cc->di->fsm.dbgname
+ ? cc->di->fsm.dbgname : cc->di->fsm.filename;
+ if (last_dbgname != dbgname) {
+ VG_(message)(Vg_DebugMsg,
+ "Warning: <%lx> DW_TAG_subprogram with no"
+ " DW_AT_name and no DW_AT_specification or"
+ " DW_AT_abstract_origin in %s\n", posn, dbgname);
+ last_dbgname = dbgname;
+ }
+ }
+ }
+
// Only recursively parse the (possible) children for the DIE which
- // might maybe contain a DW_TAG_inlined_subroutine:
+ // might maybe contain a DW_TAG_inlined_subroutine or DW_TAG_subprogram.
+ // subprograms can also appear without addresses.
Bool ret = (unit_has_addrs
- || dtag == DW_TAG_lexical_block || dtag == DW_TAG_subprogram
- || dtag == DW_TAG_inlined_subroutine || dtag == DW_TAG_namespace);
+ || dtag == DW_TAG_compile_unit
+ || dtag == DW_TAG_partial_unit
+ || dtag == DW_TAG_lexical_block
+ || dtag == DW_TAG_subprogram
+ || dtag == DW_TAG_inlined_subroutine
+ || dtag == DW_TAG_namespace
+ || dtag == DW_TAG_enumeration_type
+ || dtag == DW_TAG_class_type
+ || dtag == DW_TAG_structure_type
+ || dtag == DW_TAG_union_type
+ || dtag == DW_TAG_module
+ || dtag == DW_TAG_with_stmt
+ || dtag == DW_TAG_catch_block
+ || dtag == DW_TAG_try_block
+ || dtag == DW_TAG_entry_point);
return ret;
bad_DIE:
@@ -5609,8 +5548,10 @@ void new_dwarf3_reader_wrk (
}
/* Perform three DIE-reading passes. The first pass reads DIEs from
- alternate .debug_info (if any), the second pass reads DIEs from
- .debug_info, and the third pass reads DIEs from .debug_types.
+ .debug_info, the second pass reads DIEs from .debug_types (if any),
+ and the third pass reads DIEs from the alternate .debug_info (if any).
+ This is in the order that cook_die numbers the DIEs, so the inlined
+ parser can add subprograms in order.
Moving the body of this loop into a separate function would
require a large number of arguments to be passed in, so it is
kept inline instead. */
@@ -5618,23 +5559,6 @@ void new_dwarf3_reader_wrk (
ULong section_size;
if (pass == 0) {
- if (!ML_(sli_is_valid)(escn_debug_info_alt))
- continue;
- /* Now loop over the Compilation Units listed in the alternate
- .debug_info section (see D3SPEC sec 7.5) paras 1 and 2.
- Each compilation unit contains a Compilation Unit Header
- followed by precisely one DW_TAG_compile_unit or
- DW_TAG_partial_unit DIE. */
- init_Cursor( &info, escn_debug_info_alt, 0, barf,
- "Overrun whilst reading alternate .debug_info section" );
- section_size = escn_debug_info_alt.szB;
-
- /* Keep track of the last line table we have seen,
- it might turn up again. */
- reset_fndn_ix_table(&fndn_ix_Table, &debug_line_offset, (ULong) -1);
-
- TRACE_D3("\n------ Parsing alternate .debug_info section ------\n");
- } else if (pass == 1) {
/* Now loop over the Compilation Units listed in the .debug_info
section (see D3SPEC sec 7.5) paras 1 and 2. Each compilation
unit contains a Compilation Unit Header followed by precisely
@@ -5648,7 +5572,7 @@ void new_dwarf3_reader_wrk (
reset_fndn_ix_table(&fndn_ix_Table, &debug_line_offset, (ULong) -1);
TRACE_D3("\n------ Parsing .debug_info section ------\n");
- } else {
+ } else if (pass == 1) {
if (!ML_(sli_is_valid)(escn_debug_types))
continue;
if (!VG_(clo_read_var_info))
@@ -5662,6 +5586,23 @@ void new_dwarf3_reader_wrk (
reset_fndn_ix_table(&fndn_ix_Table, &debug_line_offset, (ULong) -1);
TRACE_D3("\n------ Parsing .debug_types section ------\n");
+ } else {
+ if (!ML_(sli_is_valid)(escn_debug_info_alt))
+ continue;
+ /* Now loop over the Compilation Units listed in the alternate
+ .debug_info section (see D3SPEC sec 7.5) paras 1 and 2.
+ Each compilation unit contains a Compilation Unit Header
+ followed by precisely one DW_TAG_compile_unit or
+ DW_TAG_partial_unit DIE. */
+ init_Cursor( &info, escn_debug_info_alt, 0, barf,
+ "Overrun whilst reading alternate .debug_info section" );
+ section_size = escn_debug_info_alt.szB;
+
+ /* Keep track of the last line table we have seen,
+ it might turn up again. */
+ reset_fndn_ix_table(&fndn_ix_Table, &debug_line_offset, (ULong) -1);
+
+ TRACE_D3("\n------ Parsing alternate .debug_info section ------\n");
}
abbv_state last_abbv;
@@ -5713,22 +5654,22 @@ void new_dwarf3_reader_wrk (
TRACE_D3("\n");
TRACE_D3(" Compilation Unit @ offset 0x%llx:\n", cu_start_offset);
/* parse_CU_header initialises the CU's hashtable of abbvs ht_abbvs */
- if (pass == 0) {
+ if (pass == 2) {
parse_CU_Header( &cc, td3, &info, escn_debug_abbv_alt,
last_abbv, False, True );
} else {
parse_CU_Header( &cc, td3, &info, escn_debug_abbv,
- last_abbv, pass == 2, False );
+ last_abbv, pass == 1, False );
}
- cc.escn_debug_str = pass == 0 ? escn_debug_str_alt
+ cc.escn_debug_str = pass == 2 ? escn_debug_str_alt
: escn_debug_str;
cc.escn_debug_ranges = escn_debug_ranges;
cc.escn_debug_rnglists = escn_debug_rnglists;
cc.escn_debug_loclists = escn_debug_loclists;
cc.escn_debug_loc = escn_debug_loc;
- cc.escn_debug_line = pass == 0 ? escn_debug_line_alt
+ cc.escn_debug_line = pass == 2 ? escn_debug_line_alt
: escn_debug_line;
- cc.escn_debug_info = pass == 0 ? escn_debug_info_alt
+ cc.escn_debug_info = pass == 2 ? escn_debug_info_alt
: escn_debug_info;
cc.escn_debug_types = escn_debug_types;
cc.escn_debug_info_alt = escn_debug_info_alt;
@@ -6161,6 +6102,99 @@ void new_dwarf3_reader_wrk (
}
}
+static Word search_one_subtab ( DebugInfo* di, UWord index )
+{
+ Word mid,
+ lo = 0,
+ hi = di->subtab_used-1;
+ UWord mid_index;
+ while (True) {
+ /* current unsearched space is from lo to hi, inclusive. */
+ if (lo > hi) return -1; /* not found */
+ mid = (lo + hi) / 2;
+ mid_index = di->subtab[mid].index;
+
+ if (mid_index > index) { hi = mid-1; continue; }
+ if (mid_index < index) { lo = mid+1; continue; }
+ vg_assert(index == mid_index);
+ return mid;
+ }
+}
+
+/* Report an issue only once, we cannot really give too good an error
+ message since we don't know the exact DIE that was broken.
+ So only report once per DebugInfo file. */
+static void report_resolve_subprogram_issue (DebugInfo *di, const HChar *msg)
+{
+ static HChar *last_dbgname;
+ HChar *dbgname = di->fsm.dbgname ? di->fsm.dbgname : di->fsm.filename;
+ if (last_dbgname != dbgname) {
+ if (VG_(clo_verbosity) >= 1)
+ VG_(message)(Vg_DebugMsg, "Warning: %s in %s\n", msg, dbgname);
+ last_dbgname = dbgname;
+ }
+}
+
+static void resolve_subprograms ( DebugInfo* di )
+{
+ for (UWord i = 0; i < di->inltab_used; i++) {
+ Word s = di->inltab[i].inlined.subprog;
+ if (s == 0) {
+ report_resolve_subprogram_issue
+ (di, "zero subprog, missing DW_AT_abstract_origin in"
+ " DW_TAG_inlined_subroutine");
+ di->inltab[i].inlined.fn = ML_(addStr)(di, "UnknownInlinedFun", -1);
+ continue;
+ }
+ s = search_one_subtab (di, di->inltab[i].inlined.subprog);
+ if (s == -1) {
+ report_resolve_subprogram_issue
+ (di, "subprog not found, DW_TAG_inlined_subroutine points to"
+ " unknown DW_TAG_subprogram");
+ di->inltab[i].inlined.fn = ML_(addStr)(di, "UnknownInlinedFun", -1);
+ continue;
+ }
+ /* We allow two indirections, subprograms with abstract origins. */
+ if (di->subtab[s].isSubprogRef) {
+ s = search_one_subtab (di, di->subtab[s].ref.subprog);
+ if (s == -1) {
+ report_resolve_subprogram_issue
+ (di, "subprog ref not found, DW_TAG_subprogram has an"
+ " unknown DW_AT_abstract_origin or DW_AT_specification");
+ di->inltab[i].inlined.fn = ML_(addStr)(di,
+ "UnknownInlinedFun", -1);
+ continue;
+ }
+ }
+ if (di->subtab[s].isSubprogRef) {
+ s = search_one_subtab (di, di->subtab[s].ref.subprog);
+ if (s == -1) {
+ report_resolve_subprogram_issue
+ (di, "subprog ref to ref not found, DW_TAG_subprogram has an"
+ " unknown DW_AT_abstract_origin or DW_AT_specification");
+ di->inltab[i].inlined.fn = ML_(addStr)(di,
+ "UnknownInlinedFun", -1);
+ continue;
+ }
+ }
+ if (di->subtab[s].isSubprogRef)
+ {
+ report_resolve_subprogram_issue
+ (di, "too many subprog indirections for DW_TAG_subprogram"
+ " with DW_AT_abstract_origin or DW_AT_specification refs");
+ di->inltab[i].inlined.fn = ML_(addStr)(di,
+ "UnknownInlinedFun", -1);
+ continue;
+ }
+ di->inltab[i].inlined.fn = di->subtab[s].ref.fn;
+ }
+
+ /* We don't need the SubPrograms anymore. */
+ ML_(dinfo_free)(di->subtab);
+ di->subtab = NULL;
+ di->subtab_used = 0;
+ di->subtab_size = 0;
+}
/*------------------------------------------------------------*/
/*--- ---*/
@@ -6232,6 +6266,10 @@ ML_(new_dwarf3_reader) (
d3rd_jmpbuf_valid = False;
d3rd_jmpbuf_reason = NULL;
+
+ /* Always call this even after .debug_info reading failed, to make sure
+ any known inlined subroutine names are resolved and memory freed. */
+ resolve_subprograms (di);
}
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
index 72fccbab4c..58ffc9b53c 100644
--- a/coregrind/m_debuginfo/readelf.c
+++ b/coregrind/m_debuginfo/readelf.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/readexidx.c b/coregrind/m_debuginfo/readexidx.c
index 261c9c466a..92509efe30 100644
--- a/coregrind/m_debuginfo/readexidx.c
+++ b/coregrind/m_debuginfo/readexidx.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/readmacho.c b/coregrind/m_debuginfo/readmacho.c
index 691ec94353..48ef5aaf5f 100644
--- a/coregrind/m_debuginfo/readmacho.c
+++ b/coregrind/m_debuginfo/readmacho.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/readpdb.c b/coregrind/m_debuginfo/readpdb.c
index 9ad5a11775..9e29fefb15 100644
--- a/coregrind/m_debuginfo/readpdb.c
+++ b/coregrind/m_debuginfo/readpdb.c
@@ -19,7 +19,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1539,7 +1539,6 @@ static ULong DEBUG_SnarfLinetab(
union any_size pnt;
union any_size pnt2;
const struct startend * start;
- Int this_seg;
Bool debug = di->trace_symtab;
ULong n_lines_read = 0;
@@ -1563,7 +1562,6 @@ static ULong DEBUG_SnarfLinetab(
pnt2.c = (const HChar *)linetab + filetab[i];
}
- this_seg = 0;
for (i = 0; i < nfile; i++) {
const HChar *fnmstr;
const HChar *dirstr;
@@ -1601,7 +1599,7 @@ static ULong DEBUG_SnarfLinetab(
fnmstr = ML_(addStr)(di, fnmstr, k);
fnmdirstr_ix = ML_(addFnDn) (di, fnmstr, dirstr);
- for (k = 0; k < file_segcount; k++, this_seg++) {
+ for (k = 0; k < file_segcount; k++) {
Int linecount;
Int segno;
diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c
index 477d5ef4ec..b66339d9f4 100644
--- a/coregrind/m_debuginfo/storage.c
+++ b/coregrind/m_debuginfo/storage.c
@@ -11,10 +11,12 @@
Copyright (C) 2000-2017 Julian Seward
jseward@acm.org
+ Copyright (C) 2025 Mark J. Wielaard
+ mark@klomp.org
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -68,19 +70,12 @@ void ML_(symerr) ( const DebugInfo* di, Bool serious, const HChar* msg )
return;
if (serious) {
-
- VG_(message)(Vg_DebugMsg, "WARNING: Serious error when "
- "reading debug info\n");
- if (True || VG_(clo_verbosity) < 2) {
- /* Need to show what the file name is, at verbosity levels 2
- or below, since that won't already have been shown */
- VG_(message)(Vg_DebugMsg,
- "When reading debug info from %s:\n",
- (di && di->fsm.filename) ? di->fsm.filename
- : "???");
- }
+ VG_(message)(Vg_DebugMsg,
+ "WARNING: Serious problem when reading debug info from %s:\n",
+ (di && di->fsm.filename) ? di->fsm.filename : "???");
+ VG_(message)(Vg_DebugMsg,
+ "WARNING: Valgrind will continue to execute but error messages may be degraded.\n");
VG_(message)(Vg_DebugMsg, "%s\n", msg);
-
} else { /* !serious */
if (VG_(clo_verbosity) >= 2)
@@ -698,7 +693,7 @@ static void shrinkInlTab ( struct _DebugInfo* di )
/* Top-level place to call to add a addr-to-inlined fn info. */
void ML_(addInlInfo) ( struct _DebugInfo* di,
Addr addr_lo, Addr addr_hi,
- const HChar* inlinedfn,
+ UWord subprog,
UInt fndn_ix,
Int lineno, UShort level)
{
@@ -706,9 +701,9 @@ void ML_(addInlInfo) ( struct _DebugInfo* di,
# define SHOWLINEINFO \
VG_(message) (Vg_DebugMsg, \
- "addInlInfo: fn %s inlined as addr_lo %#lx,addr_hi %#lx," \
+ "addInlInfo: fn %lx inlined as addr_lo %#lx,addr_hi %#lx," \
"caller fndn_ix %u %s:%d\n", \
- inlinedfn, addr_lo, addr_hi, fndn_ix, \
+ subprog, addr_lo, addr_hi, fndn_ix, \
ML_(fndn_ix2filename) (di, fndn_ix), lineno)
/* Similar paranoia as in ML_(addLineInfo). Unclear if needed. */
@@ -738,7 +733,7 @@ void ML_(addInlInfo) ( struct _DebugInfo* di,
// code resulting from inlining of inlinedfn:
inl.addr_lo = addr_lo;
inl.addr_hi = addr_hi;
- inl.inlinedfn = inlinedfn;
+ inl.inlined.subprog = subprog;
// caller:
inl.fndn_ix = fndn_ix;
inl.lineno = lineno;
@@ -750,6 +745,29 @@ void ML_(addInlInfo) ( struct _DebugInfo* di,
# undef SHOWLINEINFO
}
+void ML_(addSubprogram) ( struct _DebugInfo* di, DiSubprogram* sub )
+{
+ UInt new_sz, i;
+ DiSubprogram* new_tab;
+
+ if (di->subtab_used == di->subtab_size) {
+ new_sz = 2 * di->subtab_size;
+ if (new_sz == 0) new_sz = 2560;
+ new_tab = ML_(dinfo_zalloc)( "di.storage.addSubprogram.1",
+ new_sz * sizeof(DiSubprogram) );
+ if (di->subtab != NULL) {
+ for (i = 0; i < di->subtab_used; i++)
+ new_tab[i] = di->subtab[i];
+ ML_(dinfo_free)(di->subtab);
+ }
+ di->subtab = new_tab;
+ di->subtab_size = new_sz;
+ }
+
+ di->subtab[di->subtab_used] = *sub;
+ di->subtab_used++;
+}
+
DiCfSI_m* ML_(get_cfsi_m) (const DebugInfo* di, UInt pos)
{
UInt cfsi_m_ix;
diff --git a/coregrind/m_debuginfo/tinfl.c b/coregrind/m_debuginfo/tinfl.c
index 612a69f6c9..7609d5b270 100644
--- a/coregrind/m_debuginfo/tinfl.c
+++ b/coregrind/m_debuginfo/tinfl.c
@@ -17,7 +17,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuginfo/tytypes.c b/coregrind/m_debuginfo/tytypes.c
index e356b92c9a..61e8ff4e1d 100644
--- a/coregrind/m_debuginfo/tytypes.c
+++ b/coregrind/m_debuginfo/tytypes.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c
index 225e5a0854..fa358df64f 100644
--- a/coregrind/m_debuglog.c
+++ b/coregrind/m_debuglog.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_deduppoolalloc.c b/coregrind/m_deduppoolalloc.c
index 2ee6a1bbdf..c07b62a3f1 100644
--- a/coregrind/m_deduppoolalloc.c
+++ b/coregrind/m_deduppoolalloc.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_demangle/ansidecl.h b/coregrind/m_demangle/ansidecl.h
index 653d91869e..534b05251d 100644
--- a/coregrind/m_demangle/ansidecl.h
+++ b/coregrind/m_demangle/ansidecl.h
@@ -1,10 +1,10 @@
/* Compiler compatibility macros
- Copyright (C) 1991-2024 Free Software Foundation, Inc.
+ Copyright (C) 1991-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_demangle/cp-demangle.c b/coregrind/m_demangle/cp-demangle.c
index a3d1b8810b..3bf5a372ef 100644
--- a/coregrind/m_demangle/cp-demangle.c
+++ b/coregrind/m_demangle/cp-demangle.c
@@ -1,12 +1,12 @@
/* Demangler for g++ V3 ABI.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
Written by Ian Lance Taylor .
This file is part of the libiberty library, which is part of GCC.
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
In addition to the permissions in the GNU General Public License, the
@@ -516,6 +516,8 @@ static struct demangle_component *d_lambda (struct d_info *);
static struct demangle_component *d_unnamed_type (struct d_info *);
+static struct demangle_component *d_unnamed_enum (struct d_info *);
+
static struct demangle_component *
d_clone_suffix (struct d_info *, struct demangle_component *);
@@ -1441,7 +1443,7 @@ d_encoding (struct d_info *di, int top_level)
/* If this is a non-top-level local-name, clear the
return type, so it doesn't confuse the user by
- being confused with the return type of whaever
+ being confused with the return type of whatever
this is nested within. */
if (!top_level && dc->type == DEMANGLE_COMPONENT_LOCAL_NAME
&& ftype->type == DEMANGLE_COMPONENT_FUNCTION_TYPE)
@@ -1816,6 +1818,9 @@ d_unqualified_name (struct d_info *di, struct demangle_component *scope,
{
switch (d_peek_next_char (di))
{
+ case 'e':
+ ret = d_unnamed_enum (di);
+ break;
case 'l':
ret = d_lambda (di);
break;
@@ -2745,13 +2750,20 @@ cplus_demangle_type (struct d_info *di)
break;
case 'U':
- d_advance (di, 1);
- ret = d_source_name (di);
- if (d_peek_char (di) == 'I')
- ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
- d_template_args (di));
- ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL,
- cplus_demangle_type (di), ret);
+ peek = d_peek_next_char (di);
+ if (IS_DIGIT (peek))
+ {
+ d_advance (di, 1);
+ ret = d_source_name (di);
+ if (d_peek_char (di) == 'I')
+ ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
+ d_template_args (di));
+ ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL,
+ cplus_demangle_type (di), ret);
+ }
+ else
+ /* Could be a closure type or an unnamed enum. */
+ ret = d_unqualified_name (di, NULL, NULL);
break;
case 'D':
@@ -4107,6 +4119,33 @@ d_unnamed_type (struct d_info *di)
return ret;
}
+/* ::= Ue */
+
+static struct demangle_component *
+d_unnamed_enum (struct d_info *di)
+{
+ if (! d_check_char (di, 'U'))
+ return NULL;
+ if (! d_check_char (di, 'e'))
+ return NULL;
+
+ struct demangle_component *underlying = cplus_demangle_type (di);
+ struct demangle_component *name = d_source_name (di);
+
+ struct demangle_component *ret = d_make_empty (di);
+ if (ret)
+ {
+ ret->type = DEMANGLE_COMPONENT_UNNAMED_ENUM;
+ d_left (ret) = underlying;
+ d_right (ret) = name;
+ }
+
+ if (! d_add_substitution (di, ret))
+ return NULL;
+
+ return ret;
+}
+
/* ::= [ . ] [ . ]*
*/
@@ -4413,6 +4452,7 @@ d_count_templates_scopes (struct d_print_info *dpi,
case DEMANGLE_COMPONENT_CHARACTER:
case DEMANGLE_COMPONENT_NUMBER:
case DEMANGLE_COMPONENT_UNNAMED_TYPE:
+ case DEMANGLE_COMPONENT_UNNAMED_ENUM:
case DEMANGLE_COMPONENT_STRUCTURED_BINDING:
case DEMANGLE_COMPONENT_MODULE_NAME:
case DEMANGLE_COMPONENT_MODULE_PARTITION:
@@ -4813,6 +4853,7 @@ d_find_pack (struct d_print_info *dpi,
case DEMANGLE_COMPONENT_CHARACTER:
case DEMANGLE_COMPONENT_FUNCTION_PARAM:
case DEMANGLE_COMPONENT_UNNAMED_TYPE:
+ case DEMANGLE_COMPONENT_UNNAMED_ENUM:
case DEMANGLE_COMPONENT_DEFAULT_ARG:
case DEMANGLE_COMPONENT_NUMBER:
return NULL;
@@ -6291,6 +6332,14 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
d_append_char (dpi, '}');
return;
+ case DEMANGLE_COMPONENT_UNNAMED_ENUM:
+ d_append_string (dpi, "{enum:");
+ d_print_comp (dpi, options, d_left (dc));
+ d_append_string (dpi, "{");
+ d_print_comp (dpi, options, d_right (dc));
+ d_append_string (dpi, "}}");
+ return;
+
case DEMANGLE_COMPONENT_CLONE:
d_print_comp (dpi, options, d_left (dc));
d_append_string (dpi, " [clone ");
diff --git a/coregrind/m_demangle/cp-demangle.h b/coregrind/m_demangle/cp-demangle.h
index 7640a4fb60..9b33a2f84c 100644
--- a/coregrind/m_demangle/cp-demangle.h
+++ b/coregrind/m_demangle/cp-demangle.h
@@ -1,12 +1,12 @@
/* Internal demangler interface for g++ V3 ABI.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
Written by Ian Lance Taylor .
This file is part of the libiberty library, which is part of GCC.
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
In addition to the permissions in the GNU General Public License, the
diff --git a/coregrind/m_demangle/cplus-dem.c b/coregrind/m_demangle/cplus-dem.c
index cbe6973615..9d173c03db 100644
--- a/coregrind/m_demangle/cplus-dem.c
+++ b/coregrind/m_demangle/cplus-dem.c
@@ -1,5 +1,5 @@
/* Demangler for GNU C++
- Copyright (C) 1989-2024 Free Software Foundation, Inc.
+ Copyright (C) 1989-2025 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.uucp)
Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling
Modified by Satish Pai (pai@apollo.hp.com) for HP demangling
diff --git a/coregrind/m_demangle/d-demangle.c b/coregrind/m_demangle/d-demangle.c
index 9a6a893324..2f44211eb7 100644
--- a/coregrind/m_demangle/d-demangle.c
+++ b/coregrind/m_demangle/d-demangle.c
@@ -1,5 +1,5 @@
/* Demangler for the D programming language
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
Written by Iain Buclaw (ibuclaw@gdcproject.org)
This file is part of the libiberty library.
diff --git a/coregrind/m_demangle/demangle.c b/coregrind/m_demangle/demangle.c
index 165012aeaf..ba7f865648 100644
--- a/coregrind/m_demangle/demangle.c
+++ b/coregrind/m_demangle/demangle.c
@@ -16,7 +16,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_demangle/demangle.h b/coregrind/m_demangle/demangle.h
index 8b7dd705ac..010c103d0b 100644
--- a/coregrind/m_demangle/demangle.h
+++ b/coregrind/m_demangle/demangle.h
@@ -1,9 +1,9 @@
/* Defs for interface to demanglers.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License
- as published by the Free Software Foundation; either version 2, or
+ as published by the Free Software Foundation; either version 3, or
(at your option) any later version.
In addition to the permissions in the GNU Library General Public
@@ -437,6 +437,8 @@ enum demangle_component_type
DEMANGLE_COMPONENT_DEFAULT_ARG,
/* An unnamed type. */
DEMANGLE_COMPONENT_UNNAMED_TYPE,
+ /* An unnamed enum. */
+ DEMANGLE_COMPONENT_UNNAMED_ENUM,
/* A transactional clone. This has one subtree, the encoding for
which it is providing alternative linkage. */
DEMANGLE_COMPONENT_TRANSACTION_CLONE,
diff --git a/coregrind/m_demangle/dyn-string.c b/coregrind/m_demangle/dyn-string.c
index c16f269dde..38ad5eb5ff 100644
--- a/coregrind/m_demangle/dyn-string.c
+++ b/coregrind/m_demangle/dyn-string.c
@@ -1,12 +1,12 @@
/* An abstract string datatype.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
In addition to the permissions in the GNU General Public License, the
diff --git a/coregrind/m_demangle/dyn-string.h b/coregrind/m_demangle/dyn-string.h
index b0a108d9fa..7e07a4d926 100644
--- a/coregrind/m_demangle/dyn-string.h
+++ b/coregrind/m_demangle/dyn-string.h
@@ -1,12 +1,12 @@
/* An abstract string datatype.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
diff --git a/coregrind/m_demangle/rust-demangle.c b/coregrind/m_demangle/rust-demangle.c
index 4024813c20..70f13d7c4d 100644
--- a/coregrind/m_demangle/rust-demangle.c
+++ b/coregrind/m_demangle/rust-demangle.c
@@ -1,5 +1,5 @@
/* Demangler for the Rust programming language
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
Written by David Tolnay (dtolnay@gmail.com).
Rewritten by Eduard-Mihai Burtescu (eddyb@lyken.rs) for v0 support.
diff --git a/coregrind/m_demangle/safe-ctype.c b/coregrind/m_demangle/safe-ctype.c
index 32654ef1e2..95c41cd68f 100644
--- a/coregrind/m_demangle/safe-ctype.c
+++ b/coregrind/m_demangle/safe-ctype.c
@@ -1,6 +1,6 @@
/* replacement macros.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Zack Weinberg .
This file is part of the libiberty library.
diff --git a/coregrind/m_demangle/safe-ctype.h b/coregrind/m_demangle/safe-ctype.h
index d3e5214d58..c0f8042281 100644
--- a/coregrind/m_demangle/safe-ctype.h
+++ b/coregrind/m_demangle/safe-ctype.h
@@ -1,6 +1,6 @@
/* replacement macros.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Zack Weinberg .
This file is part of the libiberty library.
diff --git a/coregrind/m_demangle/vg_libciface.h b/coregrind/m_demangle/vg_libciface.h
index d64d5a70c1..ac8c4c7efe 100644
--- a/coregrind/m_demangle/vg_libciface.h
+++ b/coregrind/m_demangle/vg_libciface.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-amd64-darwin.S b/coregrind/m_dispatch/dispatch-amd64-darwin.S
index 7dc06a84e7..996e78e316 100644
--- a/coregrind/m_dispatch/dispatch-amd64-darwin.S
+++ b/coregrind/m_dispatch/dispatch-amd64-darwin.S
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-amd64-freebsd.S b/coregrind/m_dispatch/dispatch-amd64-freebsd.S
index db4dccac76..101f2d8c4d 100644
--- a/coregrind/m_dispatch/dispatch-amd64-freebsd.S
+++ b/coregrind/m_dispatch/dispatch-amd64-freebsd.S
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-amd64-linux.S b/coregrind/m_dispatch/dispatch-amd64-linux.S
index 8ea2235d8e..092d756a92 100644
--- a/coregrind/m_dispatch/dispatch-amd64-linux.S
+++ b/coregrind/m_dispatch/dispatch-amd64-linux.S
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-amd64-solaris.S b/coregrind/m_dispatch/dispatch-amd64-solaris.S
index a894253fec..389d88bc4f 100644
--- a/coregrind/m_dispatch/dispatch-amd64-solaris.S
+++ b/coregrind/m_dispatch/dispatch-amd64-solaris.S
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-arm-linux.S b/coregrind/m_dispatch/dispatch-arm-linux.S
index 40629017c8..b976623234 100644
--- a/coregrind/m_dispatch/dispatch-arm-linux.S
+++ b/coregrind/m_dispatch/dispatch-arm-linux.S
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-arm64-freebsd.S b/coregrind/m_dispatch/dispatch-arm64-freebsd.S
index fcc222d498..7eceb6cefc 100644
--- a/coregrind/m_dispatch/dispatch-arm64-freebsd.S
+++ b/coregrind/m_dispatch/dispatch-arm64-freebsd.S
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-arm64-linux.S b/coregrind/m_dispatch/dispatch-arm64-linux.S
index 3426bd9155..95670d1254 100644
--- a/coregrind/m_dispatch/dispatch-arm64-linux.S
+++ b/coregrind/m_dispatch/dispatch-arm64-linux.S
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-mips32-linux.S b/coregrind/m_dispatch/dispatch-mips32-linux.S
index 2b077c3c79..0f5cf19168 100644
--- a/coregrind/m_dispatch/dispatch-mips32-linux.S
+++ b/coregrind/m_dispatch/dispatch-mips32-linux.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-mips64-linux.S b/coregrind/m_dispatch/dispatch-mips64-linux.S
index f5b79ba1e8..03db1121eb 100644
--- a/coregrind/m_dispatch/dispatch-mips64-linux.S
+++ b/coregrind/m_dispatch/dispatch-mips64-linux.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-nanomips-linux.S b/coregrind/m_dispatch/dispatch-nanomips-linux.S
index 30d54994fd..2773e4db2d 100644
--- a/coregrind/m_dispatch/dispatch-nanomips-linux.S
+++ b/coregrind/m_dispatch/dispatch-nanomips-linux.S
@@ -10,7 +10,7 @@
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
+# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
@@ -19,9 +19,7 @@
# General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307, USA.
+# along with this program; if not, see .
# The GNU General Public License is contained in the file COPYING.
diff --git a/coregrind/m_dispatch/dispatch-ppc32-linux.S b/coregrind/m_dispatch/dispatch-ppc32-linux.S
index b679a2eb6a..77e205d91c 100644
--- a/coregrind/m_dispatch/dispatch-ppc32-linux.S
+++ b/coregrind/m_dispatch/dispatch-ppc32-linux.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-ppc64be-linux.S b/coregrind/m_dispatch/dispatch-ppc64be-linux.S
index 9722fd803d..3612657dfd 100644
--- a/coregrind/m_dispatch/dispatch-ppc64be-linux.S
+++ b/coregrind/m_dispatch/dispatch-ppc64be-linux.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-ppc64le-linux.S b/coregrind/m_dispatch/dispatch-ppc64le-linux.S
index e790ae84cd..4589695c4c 100644
--- a/coregrind/m_dispatch/dispatch-ppc64le-linux.S
+++ b/coregrind/m_dispatch/dispatch-ppc64le-linux.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-riscv64-linux.S b/coregrind/m_dispatch/dispatch-riscv64-linux.S
index c4941e4573..710cbcdff0 100644
--- a/coregrind/m_dispatch/dispatch-riscv64-linux.S
+++ b/coregrind/m_dispatch/dispatch-riscv64-linux.S
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-s390x-linux.S b/coregrind/m_dispatch/dispatch-s390x-linux.S
index 4acc5ba2fb..05e33c34f5 100644
--- a/coregrind/m_dispatch/dispatch-s390x-linux.S
+++ b/coregrind/m_dispatch/dispatch-s390x-linux.S
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-x86-darwin.S b/coregrind/m_dispatch/dispatch-x86-darwin.S
index ce8756009b..82ceb3d998 100644
--- a/coregrind/m_dispatch/dispatch-x86-darwin.S
+++ b/coregrind/m_dispatch/dispatch-x86-darwin.S
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-x86-freebsd.S b/coregrind/m_dispatch/dispatch-x86-freebsd.S
index 667bfcd96a..89293959f8 100644
--- a/coregrind/m_dispatch/dispatch-x86-freebsd.S
+++ b/coregrind/m_dispatch/dispatch-x86-freebsd.S
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-x86-linux.S b/coregrind/m_dispatch/dispatch-x86-linux.S
index 9c0c045548..ed41e58247 100644
--- a/coregrind/m_dispatch/dispatch-x86-linux.S
+++ b/coregrind/m_dispatch/dispatch-x86-linux.S
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_dispatch/dispatch-x86-solaris.S b/coregrind/m_dispatch/dispatch-x86-solaris.S
index 332546cf0c..9b852f07cd 100644
--- a/coregrind/m_dispatch/dispatch-x86-solaris.S
+++ b/coregrind/m_dispatch/dispatch-x86-solaris.S
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index 2ce919482f..aaf3d5661f 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1116,8 +1116,10 @@ static Bool show_used_suppressions ( void )
any_supp = True;
}
- if (VG_(clo_xml))
+ if (VG_(clo_xml)) {
VG_(printf_xml)("\n");
+ VG_(printf_xml)("\n");
+ }
return any_supp;
}
@@ -1134,10 +1136,19 @@ void VG_(show_all_errors) ( Int verbosity, Bool xml, Int show_error_list)
if (verbosity == 0 && show_error_list == 0)
return;
- /* If we're printing XML, just show the suppressions and stop. */
+ /* If we're printing XML, show the suppressions, the summary and stop. */
if (xml) {
if (show_error_list > 0)
(void)show_used_suppressions();
+ VG_(printf_xml)("\n"
+ " %u\n"
+ " %u\n"
+ " %u\n"
+ " %u\n"
+ "\n",
+ n_errs_found, n_err_contexts,
+ n_errs_suppressed, n_supp_contexts );
+ VG_(printf_xml)("\n");
return;
}
diff --git a/coregrind/m_execontext.c b/coregrind/m_execontext.c
index b00db18861..cd4b870e23 100644
--- a/coregrind/m_execontext.c
+++ b/coregrind/m_execontext.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_extension/extension-main.c b/coregrind/m_extension/extension-main.c
index 5590c9d285..4a2d3e4203 100644
--- a/coregrind/m_extension/extension-main.c
+++ b/coregrind/m_extension/extension-main.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_extension/extension-s390x.c b/coregrind/m_extension/extension-s390x.c
index 85b99ad086..9c2df8d796 100644
--- a/coregrind/m_extension/extension-s390x.c
+++ b/coregrind/m_extension/extension-s390x.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -301,11 +301,17 @@ typedef enum {
S390_NNPA_MAX = 0x15,
S390_NNPA_LOG = 0x20,
S390_NNPA_EXP = 0x21,
+ S390_NNPA_SQRT = 0x22,
+ S390_NNPA_INVSQRT = 0x23,
S390_NNPA_RELU = 0x31,
S390_NNPA_TANH = 0x32,
S390_NNPA_SIGMOID = 0x33,
S390_NNPA_SOFTMAX = 0x34,
+ S390_NNPA_GELU = 0x35,
S390_NNPA_BATCHNORM = 0x40,
+ S390_NNPA_MOMENTS = 0x41,
+ S390_NNPA_LAYERNORM = 0x42,
+ S390_NNPA_NORM = 0x43,
S390_NNPA_MAXPOOL2D = 0x50,
S390_NNPA_AVGPOOL2D = 0x51,
S390_NNPA_LSTMACT = 0x60,
@@ -313,6 +319,9 @@ typedef enum {
S390_NNPA_CONVOLUTION = 0x70,
S390_NNPA_MATMUL_OP = 0x71,
S390_NNPA_MATMUL_OP_BCAST23 = 0x72,
+ S390_NNPA_MATMUL_OP_BCAST1 = 0x73,
+ S390_NNPA_TRANSFORM = 0xf0,
+ S390_NNPA_REDUCE = 0xf1,
} s390_nnpa_function_t;
/* Suported NNPA functions */
@@ -321,30 +330,51 @@ static const ULong NNPA_functions[] = {
S390_SETBIT(S390_NNPA_SUB) | S390_SETBIT(S390_NNPA_MUL) |
S390_SETBIT(S390_NNPA_DIV) | S390_SETBIT(S390_NNPA_MIN) |
S390_SETBIT(S390_NNPA_MAX) | S390_SETBIT(S390_NNPA_LOG) |
- S390_SETBIT(S390_NNPA_EXP) | S390_SETBIT(S390_NNPA_RELU) |
+ S390_SETBIT(S390_NNPA_EXP) | S390_SETBIT(S390_NNPA_SQRT) |
+ S390_SETBIT(S390_NNPA_INVSQRT) | S390_SETBIT(S390_NNPA_RELU) |
S390_SETBIT(S390_NNPA_TANH) | S390_SETBIT(S390_NNPA_SIGMOID) |
- S390_SETBIT(S390_NNPA_SOFTMAX)),
- (S390_SETBIT(S390_NNPA_BATCHNORM) | S390_SETBIT(S390_NNPA_MAXPOOL2D) |
- S390_SETBIT(S390_NNPA_AVGPOOL2D) | S390_SETBIT(S390_NNPA_LSTMACT) |
- S390_SETBIT(S390_NNPA_GRUACT) | S390_SETBIT(S390_NNPA_CONVOLUTION) |
- S390_SETBIT(S390_NNPA_MATMUL_OP) |
- S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST23)),
+ S390_SETBIT(S390_NNPA_SOFTMAX) | S390_SETBIT(S390_NNPA_GELU)),
+ (S390_SETBIT(S390_NNPA_BATCHNORM) | S390_SETBIT(S390_NNPA_MOMENTS) |
+ S390_SETBIT(S390_NNPA_LAYERNORM) | S390_SETBIT(S390_NNPA_NORM) |
+ S390_SETBIT(S390_NNPA_MAXPOOL2D) | S390_SETBIT(S390_NNPA_AVGPOOL2D) |
+ S390_SETBIT(S390_NNPA_LSTMACT) | S390_SETBIT(S390_NNPA_GRUACT) |
+ S390_SETBIT(S390_NNPA_CONVOLUTION) | S390_SETBIT(S390_NNPA_MATMUL_OP) |
+ S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST23) |
+ S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST1)),
+ 0,
+ (S390_SETBIT(S390_NNPA_TRANSFORM) | S390_SETBIT(S390_NNPA_REDUCE)),
};
/* Supported parameter block formats */
static const ULong NNPA_ipbf[] = {
- (S390_SETBIT(0)),
+ (S390_SETBIT(0) | S390_SETBIT(1)),
};
/* Supported data types and data layout formats */
+enum {
+ S390_NNPA_TYPE_1 = 0, // data type 1 (16 bit)
+ S390_NNPA_TYPE_BFP32 = 6,
+ S390_NNPA_TYPE_INT8 = 8,
+ S390_NNPA_TYPE_INT32 = 10,
+};
+
+enum {
+ S390_NNPA_4D_FEATURE_TENSOR = 0,
+ S390_NNPA_4D_KERNEL_TENSOR = 1,
+ S390_NNPA_4D_WEIGHTS_TENSOR = 2,
+ S390_NNPA_4D_GENERIC_TENSOR = 31,
+};
+
static const ULong NNPA_dtypes_layouts[] = {
/* Data types */
- (S390_SETBIT(0) | // data type 1 (16 bit)
+ (S390_SETBIT(S390_NNPA_TYPE_1) | S390_SETBIT(S390_NNPA_TYPE_BFP32) |
+ S390_SETBIT(S390_NNPA_TYPE_INT8) | S390_SETBIT(S390_NNPA_TYPE_INT32) |
/* Data layout formats */
- S390_SETBIT(32 + 0) | // 4D-feature tensor
- S390_SETBIT(32 + 1) // 4D-kernel tensor
- ),
+ S390_SETBIT(32 + S390_NNPA_4D_FEATURE_TENSOR) |
+ S390_SETBIT(32 + S390_NNPA_4D_KERNEL_TENSOR) |
+ S390_SETBIT(32 + S390_NNPA_4D_WEIGHTS_TENSOR) |
+ S390_SETBIT(32 + S390_NNPA_4D_GENERIC_TENSOR)),
};
static const ULong NNPA_conversions[] = {
@@ -360,10 +390,15 @@ struct s390_NNPA_parms_qaf {
UInt mdis;
ULong mts;
ULong conversions;
- ULong reserved2[22];
+ ULong reserved2;
+ UInt mdnis[4];
+ struct {
+ ULong reserved[19];
+ } reserved3;
};
-struct s390_NNPA_tensor0 {
+/* Tensor descriptor, common for all data-layout formats */
+struct s390_NNPA_tensor {
UChar layout;
UChar dtype;
UShort reserved1;
@@ -372,21 +407,21 @@ struct s390_NNPA_tensor0 {
ULong address;
};
-struct s390_NNPA_parms0 {
- ULong pbvn : 16;
- ULong mvn : 8;
- ULong ribm : 24;
- ULong reserved0 : 15;
- ULong cf : 1;
- ULong reserved1[6];
- ULong save_area_address;
- struct s390_NNPA_tensor0 out[2];
- struct s390_NNPA_tensor0 reserved2[2];
- struct s390_NNPA_tensor0 in[3];
- ULong reserved3[12];
- UInt param[5];
- UInt reserved4;
- ULong reserved5[13];
+/* Parameter block format 0 or 1 */
+struct s390_NNPA_parms {
+ ULong pbvn : 16;
+ ULong mvn : 8;
+ ULong ribm : 24;
+ ULong reserved0 : 15;
+ ULong cf : 1;
+ ULong reserved1[6];
+ ULong save_area_address;
+ struct s390_NNPA_tensor out[2];
+ struct s390_NNPA_tensor reserved2[2];
+ struct s390_NNPA_tensor in[3];
+ ULong reserved3[12];
+ UInt param[16];
+ ULong reserved4[8];
};
enum {
@@ -418,135 +453,145 @@ static const char* const s390_NNPA_errmsg_access[s390_NNPA_message_n] = {
struct s390_NNPA_mem_dimensions {
UChar layout;
- ULong dim[5]; // total dimensions
- ULong used[4]; // used dimensions, without padding
- ULong step[5];
- ULong last_dim4_size;
+ ULong dim[4];
+ ULong total_size;
+ ULong used_sticks; // occupied sticks per next-higher dimension
+ ULong stick_fill;
+ ULong last_stick_fill;
};
-/* Determine the 5 dimensions used to represent the tensor data in memory */
+/* Determine the dimensions used to represent the tensor data in memory */
static enum ExtensionError
-NNPA_tensor0_size(const struct s390_NNPA_tensor0* t,
- UInt msg_idx,
- struct s390_NNPA_mem_dimensions* out_md)
+NNPA_tensor_size(const struct s390_NNPA_tensor* t,
+ UInt msg_idx,
+ struct s390_NNPA_mem_dimensions* out_md)
{
struct s390_NNPA_mem_dimensions md;
ULong elem_size;
+ ULong eps;
- md.layout = t->layout;
- if (t->dtype == 0)
+ switch (t->dtype) {
+ case S390_NNPA_TYPE_INT8:
+ elem_size = 1;
+ break;
+ case S390_NNPA_TYPE_1:
elem_size = 2;
- else
+ break;
+ case S390_NNPA_TYPE_BFP32:
+ case S390_NNPA_TYPE_INT32:
+ elem_size = 4;
+ break;
+ default:
return INSN_ERR(s390_NNPA_errmsg_dtype[msg_idx]);
+ }
+ eps = 128 / elem_size;
+ md.layout = t->layout;
switch (t->layout) {
- case 0: // 4D-feature tensor
- md.dim[0] = md.used[0] = t->dim4;
- md.dim[1] = md.used[1] = (t->dim1 + 63) / 64;
- md.dim[2] = md.used[2] = t->dim3;
- md.dim[3] = (t->dim2 + 31) / 32 * 32;
- md.used[3] = t->dim2;
- md.dim[4] = 64;
- md.last_dim4_size = elem_size * (t->dim1 % 64);
+ case S390_NNPA_4D_FEATURE_TENSOR:
+ md.dim[0] = t->dim4;
+ md.dim[1] = (t->dim1 + eps - 1) / eps;
+ md.used_sticks = t->dim2;
+ goto common_tensor_dimensions;
+ case S390_NNPA_4D_KERNEL_TENSOR:
+ md.dim[0] = (t->dim1 + eps - 1) / eps;
+ md.dim[1] = t->dim4;
+ md.used_sticks = t->dim2;
+ goto common_tensor_dimensions;
+ case S390_NNPA_4D_WEIGHTS_TENSOR:
+ elem_size *= 2;
+ eps /= 2;
+ md.dim[0] = t->dim4;
+ md.dim[1] = (t->dim1 + eps - 1) / eps;
+ md.used_sticks = (t->dim2 + 1) / 2;
+ common_tensor_dimensions:
+ md.dim[2] = t->dim3;
+ md.dim[3] = (md.used_sticks + 31) / 32 * 32;
+ md.stick_fill = elem_size * (t->dim1 >= eps ? eps : t->dim1);
+ md.last_stick_fill = elem_size * ((t->dim1 - 1) % eps + 1);
break;
- case 1: // 4D-kernel tensor
- md.dim[0] = md.used[0] = (t->dim1 + 63) / 64;
- md.dim[1] = md.used[1] = t->dim4;
- md.dim[2] = md.used[2] = t->dim3;
- md.dim[3] = (t->dim2 + 31) / 32 * 32;
- md.used[3] = t->dim2;
- md.dim[4] = 64;
- md.last_dim4_size = elem_size * (t->dim1 % 64);
+ case S390_NNPA_4D_GENERIC_TENSOR:
+ md.dim[0] = t->dim4;
+ md.dim[1] = t->dim3;
+ md.dim[2] = t->dim2;
+ md.dim[3] = t->dim1;
+ eps = 1;
break;
default:
return INSN_ERR(s390_NNPA_errmsg_layout[msg_idx]);
}
- md.step[4] = elem_size * md.dim[4];
- md.step[3] = md.step[4] * md.dim[3];
- md.step[2] = md.step[3] * md.dim[2];
- md.step[1] = md.step[2] * md.dim[1];
- md.step[0] = md.step[1] * md.dim[0]; // total size
- *out_md = md;
+ md.total_size =
+ elem_size * eps * md.dim[3] * md.dim[2] * md.dim[1] * md.dim[0];
+ *out_md = md;
return ExtErr_OK;
}
-/* Determine the size of the non-pad elements in the last dimension */
-static ULong NNPA_mem_dim4_size(const struct s390_NNPA_mem_dimensions* md,
- ULong d0,
- ULong d1)
-{
- switch (md->layout) {
- case 0: // 4D-feature tensor
- return d1 + 1 == md->dim[1] ? md->last_dim4_size : md->step[4];
- case 1: // 4D-kernel tensor
- return d0 + 1 == md->dim[0] ? md->last_dim4_size : md->step[4];
- }
- return 0;
-}
-
-static enum ExtensionError NNPA_pre_read_tensor0(
- ThreadState* tst, UInt msg_idx, const struct s390_NNPA_tensor0* t)
+/* Track a tensor's memory regions with PRE_MEM_READ or POST_MEM_WRITE */
+static enum ExtensionError NNPA_track_tensor(ThreadState* tst,
+ UInt msg_idx,
+ const struct s390_NNPA_tensor* t,
+ Bool do_write)
{
struct s390_NNPA_mem_dimensions md;
enum ExtensionError ret;
+ ULong addr = t->address;
- ret = NNPA_tensor0_size(t, msg_idx, &md);
+ ret = NNPA_tensor_size(t, msg_idx, &md);
if (ret != ExtErr_OK)
return ret;
- for (ULong d0 = 0; d0 < md.used[0]; d0++) {
- for (ULong d1 = 0; d1 < md.used[1]; d1++) {
- for (ULong d2 = 0; d2 < md.used[2]; d2++) {
- for (ULong d3 = 0; d3 < md.used[3]; d3++) {
- ULong addr = t->address + d0 * md.step[1] + d1 * md.step[2] +
- d2 * md.step[3] + d3 * md.step[4];
- ULong len = NNPA_mem_dim4_size(&md, d0, d1);
- PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], addr, len);
+ switch (md.layout) {
+ case S390_NNPA_4D_FEATURE_TENSOR:
+ case S390_NNPA_4D_KERNEL_TENSOR:
+ case S390_NNPA_4D_WEIGHTS_TENSOR:
+ for (ULong d0 = 0; d0 < md.dim[0]; d0++) {
+ for (ULong d1 = 0; d1 < md.dim[1]; d1++) {
+ ULong len;
+ switch (md.layout) {
+ case S390_NNPA_4D_FEATURE_TENSOR:
+ case S390_NNPA_4D_WEIGHTS_TENSOR:
+ len = d1 + 1 == md.dim[1] ? md.last_stick_fill : md.stick_fill;
+ break;
+ case S390_NNPA_4D_KERNEL_TENSOR:
+ len = d0 + 1 == md.dim[0] ? md.last_stick_fill : md.stick_fill;
+ break;
}
- }
- }
- }
- return ExtErr_OK;
-}
-
-static UWord NNPA_pre_write_tensor0(ThreadState* tst,
- UInt msg_idx,
- const struct s390_NNPA_tensor0* t)
-{
- struct s390_NNPA_mem_dimensions md;
- enum ExtensionError ret;
-
- ret = NNPA_tensor0_size(t, msg_idx, &md);
- if (ret != ExtErr_OK)
- return ret;
-
- PRE_MEM_WRITE(tst, "NNPA(out_tensor)", t->address, md.step[0]);
- return ExtErr_OK;
-}
-
-static void NNPA_post_write_tensor0(ThreadState* tst,
- UInt msg_idx,
- const struct s390_NNPA_tensor0* t)
-{
- struct s390_NNPA_mem_dimensions md;
- enum ExtensionError ret;
-
- ret = NNPA_tensor0_size(t, msg_idx, &md);
- if (ret != ExtErr_OK)
- return;
-
- for (ULong d0 = 0; d0 < md.used[0]; d0++) {
- for (ULong d1 = 0; d1 < md.used[1]; d1++) {
- for (ULong d2 = 0; d2 < md.used[2]; d2++) {
- for (ULong d3 = 0; d3 < md.used[3]; d3++) {
- ULong addr = t->address + d0 * md.step[1] + d1 * md.step[2] +
- d2 * md.step[3] + d3 * md.step[4];
- ULong len = NNPA_mem_dim4_size(&md, d0, d1);
- POST_MEM_WRITE(tst, addr, len);
+ for (ULong d2 = 0; d2 < md.dim[2]; d2++) {
+ for (ULong d3 = 0; d3 < md.used_sticks; d3++) {
+ if (md.layout == S390_NNPA_4D_WEIGHTS_TENSOR &&
+ d3 == md.used_sticks - 1 && t->dim2 % 2 != 0) {
+ // even elements only
+ for (ULong i = 0; i < len - 1; i += 2) {
+ if (do_write) {
+ POST_MEM_WRITE(tst, addr + i, 1);
+ } else {
+ PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx],
+ addr + i, 1);
+ }
+ }
+ } else if (do_write) {
+ POST_MEM_WRITE(tst, addr, len);
+ } else {
+ PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], addr,
+ len);
+ }
+ addr += 128;
+ }
+ addr += 128 * (md.dim[3] - md.used_sticks);
}
}
}
+ break;
+ case S390_NNPA_4D_GENERIC_TENSOR:
+ if (do_write) {
+ POST_MEM_WRITE(tst, t->address, md.total_size);
+ } else {
+ PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], t->address,
+ md.total_size);
+ }
+ break;
}
+ return ExtErr_OK;
}
static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant)
@@ -571,16 +616,21 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant)
NNPA_dtypes_layouts, sizeof(NNPA_dtypes_layouts));
s390_filter_functions(&parms->conversions, sizeof(ULong),
NNPA_conversions, sizeof(NNPA_conversions));
+ // Clear reserved fields
+ parms->reserved1 = 0;
+ parms->reserved2 = 0;
+ parms->reserved3 = (__typeof__(parms->reserved3)){0};
} else {
- struct s390_NNPA_parms0* parms = (void*)parms_addr;
- const struct s390_NNPA_parms0 orig_parms = *parms;
- ULong save_area_size = 0;
- UInt in_tensors;
- UInt out_tensors;
+ struct s390_NNPA_parms* parms = (void*)parms_addr;
+ const struct s390_NNPA_parms orig_parms = *parms;
+ ULong save_area_size = 0;
+ UInt in_tensors;
+ UInt out_tensors;
+ enum ExtensionError retval;
parms_len = 4096;
PRE_MEM_READ(tst, "NNPA(parms)", parms_addr,
- sizeof(struct s390_NNPA_parms0));
+ sizeof(struct s390_NNPA_parms));
if (parms->cf) {
PRE_MEM_READ(tst, "NNPA(parms.csb)", parms_addr + 512,
parms_len - 512);
@@ -594,28 +644,39 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant)
case S390_NNPA_DIV:
case S390_NNPA_MIN:
case S390_NNPA_MAX:
+ case S390_NNPA_NORM:
in_tensors = 2;
out_tensors = 1;
break;
case S390_NNPA_LOG:
case S390_NNPA_EXP:
+ case S390_NNPA_SQRT:
+ case S390_NNPA_INVSQRT:
case S390_NNPA_RELU:
case S390_NNPA_TANH:
case S390_NNPA_SIGMOID:
+ case S390_NNPA_GELU:
in_tensors = 1;
out_tensors = 1;
break;
case S390_NNPA_SOFTMAX:
+ case S390_NNPA_REDUCE:
in_tensors = 1;
out_tensors = 1;
save_area_size = 8192;
break;
case S390_NNPA_BATCHNORM:
+ case S390_NNPA_LAYERNORM:
in_tensors = 3;
out_tensors = 1;
break;
+ case S390_NNPA_MOMENTS:
+ in_tensors = 1;
+ out_tensors = 2;
+ break;
case S390_NNPA_MAXPOOL2D:
case S390_NNPA_AVGPOOL2D:
+ case S390_NNPA_TRANSFORM:
in_tensors = 1;
out_tensors = 1;
break;
@@ -627,6 +688,7 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant)
case S390_NNPA_CONVOLUTION:
case S390_NNPA_MATMUL_OP:
case S390_NNPA_MATMUL_OP_BCAST23:
+ case S390_NNPA_MATMUL_OP_BCAST1:
in_tensors = 3;
out_tensors = 1;
break;
@@ -635,16 +697,20 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant)
}
for (UInt i = 0; i < in_tensors; i++) {
- enum ExtensionError retval =
- NNPA_pre_read_tensor0(tst, s390_NNPA_message_in + i, &parms->in[i]);
+ retval = NNPA_track_tensor(tst, s390_NNPA_message_in + i,
+ &parms->in[i], False);
if (retval != ExtErr_OK)
return retval;
}
for (UInt i = 0; i < out_tensors; i++) {
- enum ExtensionError retval = NNPA_pre_write_tensor0(
- tst, s390_NNPA_message_out + i, &parms->out[i]);
+ UInt msg_idx = s390_NNPA_message_out + i;
+ struct s390_NNPA_mem_dimensions md;
+
+ retval = NNPA_tensor_size(&parms->out[i], msg_idx, &md);
if (retval != ExtErr_OK)
return retval;
+ PRE_MEM_WRITE(tst, s390_NNPA_errmsg_access[msg_idx],
+ parms->out[i].address, md.total_size);
}
if (save_area_size != 0) {
PRE_MEM_WRITE(tst, "NNPA(save_area)", parms->save_area_address,
@@ -653,8 +719,10 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant)
cc = do_NNPA_insn(&gpr0, parms_addr);
if (cc == 0) {
for (UInt i = 0; i < out_tensors; i++) {
- NNPA_post_write_tensor0(tst, s390_NNPA_message_out + i,
- &orig_parms.out[i]);
+ retval = NNPA_track_tensor(tst, s390_NNPA_message_out + i,
+ &orig_parms.out[i], True);
+ if (retval != ExtErr_OK)
+ return retval;
}
}
}
@@ -834,6 +902,20 @@ static UWord do_extension_DFLTCC(ThreadState* tst, ULong variant)
/*--- STFLE (store facility list extended) ---*/
/*---------------------------------------------------------------*/
+static int do_STFLE_insn(void* addr, ULong nwords, ULong* gpr0)
+{
+ register ULong reg0 asm("0") = *gpr0;
+ Int cc;
+
+ asm(".insn s,0xb2b00000,%[out]\n" /* stfle */
+ "ipm %[cc]\n"
+ : [out] "=Q"(*(ULong(*)[nwords])addr), [r0] "+d"(reg0), [cc] "=d"(cc)
+ :
+ : "cc");
+ *gpr0 = reg0;
+ return cc >> 28;
+}
+
static enum ExtensionError do_extension_STFLE(ThreadState* tst, ULong variant)
{
Int cc = 0;
@@ -904,15 +986,8 @@ static enum ExtensionError do_extension_STFLE(ThreadState* tst, ULong variant)
/* 195: unassigned */
| S390_SETBITS(196, 197)),
};
- asm("lgr 0,%[r0]\n"
- ".insn s,0xb2b00000,%[out]\n" /* stfle */
- "lgr %[r0],0\n"
- "ipm %[cc]\n"
- "srl %[cc],28\n"
- : [out] "=Q"(*(ULong(*)[last_dw + 1])(void*)addr), [r0] "+d"(gpr0),
- [cc] "=d"(cc)
- :
- : "cc");
+
+ cc = do_STFLE_insn((void*)addr, last_dw + 1, &gpr0);
WRITE_GPR(tst, 0, gpr0);
if (last_dw > (gpr0 & 0xff))
diff --git a/coregrind/m_extension/priv_extension.h b/coregrind/m_extension/priv_extension.h
index 6f6dbaca89..d90c6a5aad 100644
--- a/coregrind/m_extension/priv_extension.h
+++ b/coregrind/m_extension/priv_extension.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_extension/priv_types_n_macros.h b/coregrind/m_extension/priv_types_n_macros.h
index 3dced8e356..f4e8f9b874 100644
--- a/coregrind/m_extension/priv_types_n_macros.h
+++ b/coregrind/m_extension/priv_types_n_macros.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_gdbserver/gdb/signals.h b/coregrind/m_gdbserver/gdb/signals.h
index 81f373ae78..99e30bd9a6 100644
--- a/coregrind/m_gdbserver/gdb/signals.h
+++ b/coregrind/m_gdbserver/gdb/signals.h
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/inferiors.c b/coregrind/m_gdbserver/inferiors.c
index fbf7d2359c..530bb40db9 100644
--- a/coregrind/m_gdbserver/inferiors.c
+++ b/coregrind/m_gdbserver/inferiors.c
@@ -9,7 +9,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/m_gdbserver.c b/coregrind/m_gdbserver/m_gdbserver.c
index 5d0973e9ed..994d5eb445 100644
--- a/coregrind/m_gdbserver/m_gdbserver.c
+++ b/coregrind/m_gdbserver/m_gdbserver.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_gdbserver/regcache.c b/coregrind/m_gdbserver/regcache.c
index 7357967d2c..313c3c17ca 100644
--- a/coregrind/m_gdbserver/regcache.c
+++ b/coregrind/m_gdbserver/regcache.c
@@ -7,7 +7,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/regcache.h b/coregrind/m_gdbserver/regcache.h
index 881dcc37b1..0484243628 100644
--- a/coregrind/m_gdbserver/regcache.h
+++ b/coregrind/m_gdbserver/regcache.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/regdef.h b/coregrind/m_gdbserver/regdef.h
index a318ce9130..09dc228285 100644
--- a/coregrind/m_gdbserver/regdef.h
+++ b/coregrind/m_gdbserver/regdef.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/remote-utils-shared.c b/coregrind/m_gdbserver/remote-utils-shared.c
index d0e11b302c..ce508a70c4 100644
--- a/coregrind/m_gdbserver/remote-utils-shared.c
+++ b/coregrind/m_gdbserver/remote-utils-shared.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/remote-utils.c b/coregrind/m_gdbserver/remote-utils.c
index 2daf543831..de0991c79b 100644
--- a/coregrind/m_gdbserver/remote-utils.c
+++ b/coregrind/m_gdbserver/remote-utils.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c
index 410ebf3bc3..6a131e1bab 100644
--- a/coregrind/m_gdbserver/server.c
+++ b/coregrind/m_gdbserver/server.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -873,6 +873,65 @@ void handle_query (char *arg_own_buf, int *new_packet_len_p)
return;
}
+ /* Without argument, traditional remote protocol. */
+ if (strcmp ("qExecAndArgs", arg_own_buf) == 0) {
+ const HChar *exename = VG_(resolved_exename);
+
+ /* If we don't have an executable, return "U". */
+ if (exename == NULL) {
+ arg_own_buf[0] = 'U';
+ arg_own_buf[1] = '\0';
+ return;
+ }
+
+ /* Build the response: "S;;;"
+ Need to hex-encode both the program name and arguments. */
+
+ /* First, encode the executable name. */
+ char hex_exename[2 * VG_(strlen)(exename) + 1];
+ hexify(hex_exename, exename, VG_(strlen)(exename));
+
+ /* Build the arguments string from VG_(args_for_client). */
+ int num_args = VG_(sizeXA)(VG_(args_for_client));
+ char *args_str = NULL;
+
+ if (num_args > 0) {
+ int count = 0;
+ for (int i = 0; i < num_args; i++) {
+ HChar* arg = * (HChar**) VG_(indexXA)(VG_(args_for_client), i);
+ count += VG_(strlen)(arg);
+ }
+
+ /* Allocate space for args + spaces between them + null terminator. */
+ int args_str_size = count + num_args;
+ args_str = VG_(malloc)("handle_query.qExecAndArgs", args_str_size);
+ char *p = args_str;
+
+ for (int i = 0; i < num_args; i++) {
+ HChar* arg = * (HChar**) VG_(indexXA)(VG_(args_for_client), i);
+ int num = VG_(strlen)(arg);
+ VG_(memcpy)(p, arg, num);
+ p += num;
+ if (i < num_args - 1) {
+ *p++ = ' '; /* Add space separator between arguments. */
+ }
+ }
+ *p = '\0'; /* Null terminate the string. */
+
+ char hex_args_buf[2 * VG_(strlen)(args_str) + 1];
+ hexify(hex_args_buf, args_str, VG_(strlen)(args_str));
+ VG_(free)(args_str);
+
+ /* Build the full response. */
+ VG_(sprintf)(arg_own_buf, "S;%s;%s;", hex_exename, hex_args_buf);
+ } else {
+ /* No arguments, just send program name with empty args. */
+ VG_(sprintf)(arg_own_buf, "S;%s;;", hex_exename);
+ }
+
+ return;
+ }
+
if (strcmp ("qSymbol::", arg_own_buf) == 0) {
/* We have no symbol to read. */
write_ok (arg_own_buf);
diff --git a/coregrind/m_gdbserver/server.h b/coregrind/m_gdbserver/server.h
index d6dc8d692a..4d8a752d9a 100644
--- a/coregrind/m_gdbserver/server.h
+++ b/coregrind/m_gdbserver/server.h
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/signals.c b/coregrind/m_gdbserver/signals.c
index 5119c0d34a..9b3d58e47c 100644
--- a/coregrind/m_gdbserver/signals.c
+++ b/coregrind/m_gdbserver/signals.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/target.c b/coregrind/m_gdbserver/target.c
index 4238c608cb..fad94e44af 100644
--- a/coregrind/m_gdbserver/target.c
+++ b/coregrind/m_gdbserver/target.c
@@ -9,7 +9,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/target.h b/coregrind/m_gdbserver/target.h
index 1309bba7a5..7d63769775 100644
--- a/coregrind/m_gdbserver/target.h
+++ b/coregrind/m_gdbserver/target.h
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/utils.c b/coregrind/m_gdbserver/utils.c
index 83295a195c..59ac127a89 100644
--- a/coregrind/m_gdbserver/utils.c
+++ b/coregrind/m_gdbserver/utils.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-low-amd64.c b/coregrind/m_gdbserver/valgrind-low-amd64.c
index 1808609a5e..0487bc3d03 100644
--- a/coregrind/m_gdbserver/valgrind-low-amd64.c
+++ b/coregrind/m_gdbserver/valgrind-low-amd64.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-low-arm.c b/coregrind/m_gdbserver/valgrind-low-arm.c
index 79050f15b6..c628f42b83 100644
--- a/coregrind/m_gdbserver/valgrind-low-arm.c
+++ b/coregrind/m_gdbserver/valgrind-low-arm.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-low-arm64.c b/coregrind/m_gdbserver/valgrind-low-arm64.c
index 03239b28e8..67e8364829 100644
--- a/coregrind/m_gdbserver/valgrind-low-arm64.c
+++ b/coregrind/m_gdbserver/valgrind-low-arm64.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-low-mips32.c b/coregrind/m_gdbserver/valgrind-low-mips32.c
index 62eeb01f9d..d5edcb17aa 100644
--- a/coregrind/m_gdbserver/valgrind-low-mips32.c
+++ b/coregrind/m_gdbserver/valgrind-low-mips32.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-low-mips64.c b/coregrind/m_gdbserver/valgrind-low-mips64.c
index 9b96d9e5bc..fee92bcef5 100644
--- a/coregrind/m_gdbserver/valgrind-low-mips64.c
+++ b/coregrind/m_gdbserver/valgrind-low-mips64.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-low-nanomips.c b/coregrind/m_gdbserver/valgrind-low-nanomips.c
index dea345c29e..53f6341d54 100644
--- a/coregrind/m_gdbserver/valgrind-low-nanomips.c
+++ b/coregrind/m_gdbserver/valgrind-low-nanomips.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-low-ppc32.c b/coregrind/m_gdbserver/valgrind-low-ppc32.c
index be5fb97678..4cecd1e3a4 100644
--- a/coregrind/m_gdbserver/valgrind-low-ppc32.c
+++ b/coregrind/m_gdbserver/valgrind-low-ppc32.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-low-ppc64.c b/coregrind/m_gdbserver/valgrind-low-ppc64.c
index 01488bbef7..ee53be9e94 100644
--- a/coregrind/m_gdbserver/valgrind-low-ppc64.c
+++ b/coregrind/m_gdbserver/valgrind-low-ppc64.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-low-riscv64.c b/coregrind/m_gdbserver/valgrind-low-riscv64.c
index 5c200318c0..629bc569cf 100644
--- a/coregrind/m_gdbserver/valgrind-low-riscv64.c
+++ b/coregrind/m_gdbserver/valgrind-low-riscv64.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-low-s390x.c b/coregrind/m_gdbserver/valgrind-low-s390x.c
index bdb767f204..b7e00f748e 100644
--- a/coregrind/m_gdbserver/valgrind-low-s390x.c
+++ b/coregrind/m_gdbserver/valgrind-low-s390x.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-low-x86.c b/coregrind/m_gdbserver/valgrind-low-x86.c
index 4acccef2a8..a6a74d6e7d 100644
--- a/coregrind/m_gdbserver/valgrind-low-x86.c
+++ b/coregrind/m_gdbserver/valgrind-low-x86.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_gdbserver/valgrind-monitor-def.py b/coregrind/m_gdbserver/valgrind-monitor-def.py
index bb9a83c333..b31dc0b65e 100644
--- a/coregrind/m_gdbserver/valgrind-monitor-def.py
+++ b/coregrind/m_gdbserver/valgrind-monitor-def.py
@@ -5,7 +5,7 @@
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
+# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_gdbserver/valgrind-monitor.py b/coregrind/m_gdbserver/valgrind-monitor.py
index 713319d18e..415bae624b 100644
--- a/coregrind/m_gdbserver/valgrind-monitor.py
+++ b/coregrind/m_gdbserver/valgrind-monitor.py
@@ -5,7 +5,7 @@
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
+# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_gdbserver/valgrind_low.h b/coregrind/m_gdbserver/valgrind_low.h
index ef4e190897..87845b21f7 100644
--- a/coregrind/m_gdbserver/valgrind_low.h
+++ b/coregrind/m_gdbserver/valgrind_low.h
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
diff --git a/coregrind/m_hashtable.c b/coregrind/m_hashtable.c
index 6fa07c29f1..22ae0631b5 100644
--- a/coregrind/m_hashtable.c
+++ b/coregrind/m_hashtable.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_initimg/initimg-darwin.c b/coregrind/m_initimg/initimg-darwin.c
index 57fbd0bf75..d4452fd9d5 100644
--- a/coregrind/m_initimg/initimg-darwin.c
+++ b/coregrind/m_initimg/initimg-darwin.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -259,7 +259,6 @@ static HChar *copy_str(HChar **tab, const HChar *str)
return orig;
}
-
/* ----------------------------------------------------------------
This sets up the client's initial stack, containing the args,
@@ -449,6 +448,17 @@ Addr setup_client_stack( void* init_sp,
vg_assert((strtab-stringbase) == stringsize);
+ if (VG_(resolved_exename) == NULL) {
+ const HChar *exe_name = VG_(find_executable)(VG_(args_the_exename));
+ HChar interp_name[VKI_PATH_MAX];
+ if (VG_(try_get_interp)(exe_name, interp_name, VKI_PATH_MAX)) {
+ exe_name = interp_name;
+ }
+ HChar resolved_name[VKI_PATH_MAX];
+ VG_(realpath)(exe_name, resolved_name);
+ VG_(resolved_exename) = VG_(strdup)("initimg-darwin.sre.1", resolved_name);
+ }
+
/* client_SP is pointing at client's argc/argv */
if (0) VG_(printf)("startup SP = %#lx\n", client_SP);
diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c
index cb98eb9144..874d129f62 100644
--- a/coregrind/m_initimg/initimg-freebsd.c
+++ b/coregrind/m_initimg/initimg-freebsd.c
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -334,53 +334,6 @@ static const struct auxv *find_auxv(const UWord* sp)
return (const struct auxv *)sp;
}
-static Bool try_get_interp(const HChar* args_exe, HChar* interp_out)
-{
- HChar hdr[4096];
- Int len = sizeof hdr;
- SysRes res;
- Int fd;
- HChar* end;
- HChar* cp;
- HChar* interp;
-
- res = VG_(open)(args_exe, VKI_O_RDONLY, 0);
- if (sr_isError(res)) {
- return False;
- } else {
- fd = sr_Res(res);
- }
-
- res = VG_(pread)(fd, hdr, len, 0);
-
- if (sr_isError(res)) {
- VG_(close)(fd);
- return False;
- } else {
- len = sr_Res(res);
- }
-
- if (0 != VG_(memcmp)(hdr, "#!", 2)) {
- VG_(close)(fd);
- return False;
- }
-
- end = hdr + len;
- interp = hdr + 2;
- while (interp < end && (*interp == ' ' || *interp == '\t'))
- interp++;
-
- for (cp = interp; cp < end && !VG_(isspace)(*cp); cp++)
- ;
-
- *cp = '\0';
-
- VG_(sprintf)(interp_out, "%s", interp);
-
- VG_(close)(fd);
- return True;
-}
-
/* ----------------------------------------------------------------
This sets up the client's initial stack, containing the args,
@@ -465,7 +418,7 @@ static Addr setup_client_stack(const void* init_sp,
const HChar *exe_name = VG_(find_executable)(VG_(args_the_exename));
HChar interp_name[VKI_PATH_MAX];
- if (try_get_interp(exe_name, interp_name)) {
+ if (VG_(try_get_interp)(exe_name, interp_name, VKI_PATH_MAX)) {
exe_name = interp_name;
}
HChar resolved_name[VKI_PATH_MAX];
@@ -759,6 +712,7 @@ static Addr setup_client_stack(const void* init_sp,
#if defined(VGP_arm64_freebsd)
// FreeBSD 11+ also have HWCAP and HWCAP2
// but they aren't used on amd64
+ // FreeBSD 15 adds HWCAP3 and HWCAP4
case VKI_AT_HWCAP:
#define ARM64_SUPPORTED_HWCAP (VKI_HWCAP_ATOMICS \
| VKI_HWCAP_AES \
diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c
index 483b7a3ddd..5477075555 100644
--- a/coregrind/m_initimg/initimg-linux.c
+++ b/coregrind/m_initimg/initimg-linux.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -387,7 +387,7 @@ struct auxv *find_auxv(UWord* sp)
static
Addr setup_client_stack( void* init_sp,
- HChar** orig_envp,
+ HChar** orig_envp,
const ExeInfo* info,
UInt** client_auxv,
Addr clstack_end,
@@ -953,6 +953,17 @@ Addr setup_client_stack( void* init_sp,
vg_assert((strtab-stringbase) == stringsize);
+ if (VG_(resolved_exename) == NULL) {
+ const HChar *exe_name = VG_(find_executable)(VG_(args_the_exename));
+ HChar interp_name[VKI_PATH_MAX];
+ if (VG_(try_get_interp)(exe_name, interp_name, VKI_PATH_MAX)) {
+ exe_name = interp_name;
+ }
+ HChar resolved_name[VKI_PATH_MAX];
+ VG_(realpath)(exe_name, resolved_name);
+ VG_(resolved_exename) = VG_(strdup)("initimg-linux.sre.1", resolved_name);
+ }
+
/* client_SP is pointing at client's argc/argv */
if (0) VG_(printf)("startup SP = %#lx\n", client_SP);
diff --git a/coregrind/m_initimg/initimg-solaris.c b/coregrind/m_initimg/initimg-solaris.c
index 4fa94b8c4c..79072f3a85 100644
--- a/coregrind/m_initimg/initimg-solaris.c
+++ b/coregrind/m_initimg/initimg-solaris.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c
index c6380d4e0b..5859912496 100644
--- a/coregrind/m_libcassert.c
+++ b/coregrind/m_libcassert.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -498,6 +498,10 @@ static void report_and_quit ( const HChar* report,
True, // stack_usage
False, // exited_threads
startRegsIN);
+
+ if (VG_(clo_xml)) // After flushing outputs
+ VG_(printf_xml)("\n");
+
VG_(printf)(
"\n"
"Note: see also the FAQ in the source distribution.\n"
@@ -535,9 +539,6 @@ void VG_(assert_fail) ( Bool isCore, const HChar* expr, const HChar* file,
bugs_to = VG_(details).bug_reports_to;
}
- if (VG_(clo_xml))
- VG_(printf_xml)("\n");
-
// Treat vg_assert2(0, "foo") specially, as a panicky abort
if (VG_STREQ(expr, "0")) {
VG_(printf)("\n%s: %s:%d (%s): the 'impossible' happened.\n",
@@ -567,8 +568,6 @@ __attribute__ ((noreturn))
static void panic ( const HChar* name, const HChar* report, const HChar* str,
const UnwindStartRegs* startRegs )
{
- if (VG_(clo_xml))
- VG_(printf_xml)("\n");
VG_(printf)("\n%s: the 'impossible' happened:\n %s\n", name, str);
report_and_quit(report, startRegs);
}
diff --git a/coregrind/m_libcbase.c b/coregrind/m_libcbase.c
index a5d0048802..c8ba6454f3 100644
--- a/coregrind/m_libcbase.c
+++ b/coregrind/m_libcbase.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c
index 767f34522c..a84f22ffda 100644
--- a/coregrind/m_libcfile.c
+++ b/coregrind/m_libcfile.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -674,13 +674,24 @@ Int VG_(fstat) ( Int fd, struct vg_stat* vgbuf )
# endif
}
-#if defined(VGO_freebsd)
/* extend this to other OSes as and when needed */
SysRes VG_(lstat) ( const HChar* file_name, struct vg_stat* vgbuf )
{
SysRes res;
VG_(memset)(vgbuf, 0, sizeof(*vgbuf));
+#if defined(VGO_linux)
+
+struct vki_stat buf;
+
+#if defined(__NR_newfstatat)
+ res = VG_(do_syscall4)(__NR_newfstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW);
+#else
+ res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf);
+#endif
+
+#elif defined(VGO_freebsd)
+
#if (__FreeBSD_version < 1200031)
struct vki_freebsd11_stat buf;
res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf);
@@ -688,12 +699,31 @@ SysRes VG_(lstat) ( const HChar* file_name, struct vg_stat* vgbuf )
struct vki_stat buf;
res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW);
#endif
+
+#elif defined(VGO_solaris)
+
+ struct vki_stat buf;
+#if defined(SOLARIS_OLD_SYSCALLS)
+ // illumos
+ res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf);
+#else
+ // Solaris 11+
+ res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW);
+#endif
+
+#else
+
+ /* check this on Darwin */
+ struct vki_stat buf;
+ res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf);
+
+#endif
+
if (!sr_isError(res)) {
TRANSLATE_TO_vg_stat(vgbuf, &buf);
}
return res;
}
-#endif
#undef TRANSLATE_TO_vg_stat
#undef TRANSLATE_statx_TO_vg_stat
@@ -1803,7 +1833,6 @@ const HChar *VG_(dirname)(const HChar *path)
return buf;
}
-#if defined(VGO_freebsd)
/*
* I did look at nicking this from FreeBSD, it's fairly easy to port
* but I was put off by the copyright and 3-clause licence
@@ -1819,7 +1848,7 @@ Bool VG_(realpath)(const HChar *path, HChar *resolved)
{
vg_assert(path);
vg_assert(resolved);
-#if (__FreeBSD_version >= 1300080)
+#if defined(VGO_freebsd) && (__FreeBSD_version >= 1300080)
return !sr_isError(VG_(do_syscall5)(__NR___realpathat, VKI_AT_FDCWD, (RegWord)path, (RegWord)resolved, VKI_PATH_MAX, 0));
#else
// poor man's realpath
@@ -1847,7 +1876,13 @@ Bool VG_(realpath)(const HChar *path, HChar *resolved)
if (resolved_name[0] == '.' && resolved_name[1] == '/') {
resolved_name += 2;
}
- VG_(snprintf)(resolved, VKI_PATH_MAX, "%s/%s", VG_(get_startup_wd)(), resolved_name);
+ HChar wd[VKI_PATH_MAX];
+#if defined(VGO_linux) || defined(VGO_solaris)
+ res = VG_(do_syscall2)(__NR_getcwd, (UWord)wd, VKI_PATH_MAX);
+#elif defined(VGO_freebsd)
+ res = VG_(do_syscall2)(__NR___getcwd, (UWord)wd, VKI_PATH_MAX);
+#endif
+ VG_(snprintf)(resolved, VKI_PATH_MAX, "%s/%s", wd, resolved_name);
} else {
VG_(snprintf)(resolved, VKI_PATH_MAX, "%s", resolved_name);
}
@@ -1855,7 +1890,6 @@ Bool VG_(realpath)(const HChar *path, HChar *resolved)
return True;
#endif
}
-#endif
/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c
index 593889da9d..ca3962b2db 100644
--- a/coregrind/m_libcprint.c
+++ b/coregrind/m_libcprint.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -151,11 +151,7 @@ void VG_(print_preamble)(Bool logging_to_fd)
VG_(printf_xml)("\n");
VG_(printf_xml)("\n");
VG_(printf_xml)("\n");
- /* track-fds introduced some new elements. */
- if (VG_(clo_track_fds))
- VG_(printf_xml)("5\n");
- else
- VG_(printf_xml)("4\n");
+ VG_(printf_xml)("6\n");
VG_(printf_xml)("%s\n", VG_(clo_toolname));
VG_(printf_xml)("\n");
}
diff --git a/coregrind/m_libcproc.c b/coregrind/m_libcproc.c
index c70f229e5d..7c4d6acc9d 100644
--- a/coregrind/m_libcproc.c
+++ b/coregrind/m_libcproc.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_libcsetjmp.c b/coregrind/m_libcsetjmp.c
index 02324daab7..5ccaa54e3d 100644
--- a/coregrind/m_libcsetjmp.c
+++ b/coregrind/m_libcsetjmp.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_libcsignal.c b/coregrind/m_libcsignal.c
index a32b53a2f4..d8563a4d02 100644
--- a/coregrind/m_libcsignal.c
+++ b/coregrind/m_libcsignal.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_libgcc_sup.c b/coregrind/m_libgcc_sup.c
index 373f80ca19..df509be08d 100644
--- a/coregrind/m_libgcc_sup.c
+++ b/coregrind/m_libgcc_sup.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_mach/mach_basics.c b/coregrind/m_mach/mach_basics.c
index 2c968ce7d7..f0f45f5735 100644
--- a/coregrind/m_mach/mach_basics.c
+++ b/coregrind/m_mach/mach_basics.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_mach/mach_traps-amd64-darwin.S b/coregrind/m_mach/mach_traps-amd64-darwin.S
index 4b88f92a69..ae2d7d1cc9 100644
--- a/coregrind/m_mach/mach_traps-amd64-darwin.S
+++ b/coregrind/m_mach/mach_traps-amd64-darwin.S
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_mach/mach_traps-x86-darwin.S b/coregrind/m_mach/mach_traps-x86-darwin.S
index a12ef23aae..abd20e4933 100644
--- a/coregrind/m_mach/mach_traps-x86-darwin.S
+++ b/coregrind/m_mach/mach_traps-x86-darwin.S
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c
index eaa18b0b61..9c19b30ebb 100644
--- a/coregrind/m_machine.c
+++ b/coregrind/m_machine.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -624,6 +624,7 @@ static UInt VG_(get_machine_model)(void)
{ "8562", VEX_S390X_MODEL_Z15 },
{ "3931", VEX_S390X_MODEL_Z16 },
{ "3932", VEX_S390X_MODEL_Z16 },
+ { "9175", VEX_S390X_MODEL_Z17 },
};
Int model, n, fh;
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 55ffd769b3..e1bfae2b55 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -113,9 +113,13 @@ static void usage_NORETURN ( int need_help )
" --vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none]\n"
" where event is one of:\n"
" startup exit abexit valgrindabexit all none\n"
-" --track-fds=no|yes|all track open file descriptors? [no]\n"
-" all includes reporting inherited file descriptors\n"
-" --modify-fds=no|high modify newly open file descriptors? [no]\n"
+" --track-fds=no|yes|all|bad track open file descriptors? [no]\n"
+" all also reports on open inherited file\n"
+" descriptors at exit (e.g. stdin/out/err)\n"
+" bad only reports on file descriptor usage\n"
+" errors and doesn't list open file descriptors\n"
+" at exit\n"
+" --modify-fds=no|yes|high modify newly open file descriptors? [no]\n"
" --time-stamp=no|yes add timestamps to log messages? [no]\n"
" --log-fd= log messages to file descriptor [2=stderr]\n"
" --log-file= log messages to \n"
@@ -290,6 +294,7 @@ static void usage_NORETURN ( int need_help )
" --vex-iropt-verbosity=<0..9> [0]\n"
" --vex-iropt-level=<0..2> [2]\n"
" --vex-iropt-unroll-thresh=<0..400> [120]\n"
+" --vex-iropt-fold-expr=no|yes [yes]\n"
" --vex-guest-max-insns=<1..100> [50]\n"
" --vex-guest-chase=no|yes [yes]\n"
" Precise exception control. Possible values for 'mode' are as follows\n"
@@ -643,18 +648,22 @@ static void process_option (Clo_Mode mode,
VG_(clo_track_fds) = 2;
else if (VG_(strcmp)(tmp_str, "no") == 0)
VG_(clo_track_fds) = 0;
+ else if (VG_(strcmp)(tmp_str, "bad") == 0)
+ VG_(clo_track_fds) = 3;
else
VG_(fmsg_bad_option)(arg,
"Bad argument, should be 'yes', 'all' or 'no'\n");
}
else if VG_STR_CLO(arg, "--modify-fds", tmp_str) {
if (VG_(strcmp)(tmp_str, "high") == 0)
- VG_(clo_modify_fds) = 1;
+ VG_(clo_modify_fds) = VG_MODIFY_FD_HIGH;
+ else if (VG_(strcmp)(tmp_str, "yes") == 0)
+ VG_(clo_modify_fds) = VG_MODIFY_FD_YES;
else if (VG_(strcmp)(tmp_str, "no") == 0)
- VG_(clo_modify_fds) = 0;
+ VG_(clo_modify_fds) = VG_MODIFY_FD_NO;
else
VG_(fmsg_bad_option)(arg,
- "Bad argument, should be 'high' or 'no'\n");
+ "Bad argument, should be 'high', 'yes', or 'no'\n");
}
else if VG_BOOL_CLOM(cloPD, arg, "--trace-children", VG_(clo_trace_children)) {}
else if VG_BOOL_CLOM(cloPD, arg, "--child-silent-after-fork",
@@ -753,6 +762,8 @@ static void process_option (Clo_Mode mode,
VG_(clo_vex_control).iropt_level, 0, 2) {}
else if VG_BINT_CLO(arg, "--vex-regalloc-version",
VG_(clo_vex_control).regalloc_version, 2, 3) {}
+ else if VG_BOOL_CLOM(cloPD, arg, "--vex-iropt-fold-expr",
+ VG_(clo_vex_control).iropt_fold_expr) {}
else if (VG_STRINDEX_CLO(arg, "--vex-iropt-register-updates",
pxStrings, ix)
@@ -931,6 +942,10 @@ void VG_(process_dynamic_option) (Clo_Mode mode, HChar *value)
struct process_option_state dummy;
process_option (mode, value, &dummy);
// No need to handle a process_option_state once valgrind has started.
+
+ /* Update vex_control in case VALGRIND_CLO_CHANGE was used to modify a
+ VexControl member. */
+ LibVEX_set_VexControl(VG_(clo_vex_control));
}
/* Peer at previously set up VG_(args_for_valgrind) and do some
@@ -2307,9 +2322,7 @@ void shutdown_actions_NORETURN( ThreadId tid,
// affects what order the messages come.
//--------------------------------------------------------------
// First thing in the post-amble is a blank line.
- if (VG_(clo_xml))
- VG_(printf_xml)("\n");
- else if (VG_(clo_verbosity) > 0)
+ if (VG_(clo_verbosity) > 0 && !VG_(clo_xml))
VG_(message)(Vg_UserMsg, "\n");
if (VG_(clo_xml)) {
@@ -2324,7 +2337,7 @@ void shutdown_actions_NORETURN( ThreadId tid,
}
/* Print out file descriptor summary and stats. */
- if (VG_(clo_track_fds))
+ if (VG_(clo_track_fds) && VG_(clo_track_fds) < 3)
VG_(show_open_fds)("at exit");
/* Call the tool's finalisation function. This makes Memcheck's
@@ -2351,9 +2364,7 @@ void shutdown_actions_NORETURN( ThreadId tid,
}
if (VG_(clo_xml)) {
- VG_(printf_xml)("\n");
VG_(printf_xml)("\n");
- VG_(printf_xml)("\n");
}
VG_(sanity_check_general)( True /*include expensive checks*/ );
@@ -3544,12 +3555,12 @@ void *memcpy(void *dest, const void *src, size_t n);
void *memcpy(void *dest, const void *src, size_t n) {
return VG_(memcpy)(dest, src, n);
}
-void* memmove(void *dest, const void *src, SizeT n);
-void* memmove(void *dest, const void *src, SizeT n) {
+void* memmove(void *dest, const void *src, size_t n);
+void* memmove(void *dest, const void *src, size_t n) {
return VG_(memmove)(dest,src,n);
}
-void* memset(void *s, int c, SizeT n);
-void* memset(void *s, int c, SizeT n) {
+void* memset(void *s, int c, size_t n);
+void* memset(void *s, int c, size_t n) {
return VG_(memset)(s,c,n);
}
diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c
index dbbcb93961..3a08520e18 100644
--- a/coregrind/m_mallocfree.c
+++ b/coregrind/m_mallocfree.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -2372,6 +2372,7 @@ SizeT VG_(arena_malloc_usable_size) ( ArenaId aid, void* ptr )
return get_pszB(a, b);
}
+#if defined(VGO_linux) || defined(VGO_solaris)
// Implementation of mallinfo(). There is no recent standard that defines
// the behavior of mallinfo(). The meaning of the fields in struct mallinfo
@@ -2432,6 +2433,44 @@ void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi )
mi->fordblks = free_blocks_size + VG_(free_queue_volume);
mi->keepcost = 0; // may want some value in here
}
+#endif
+
+#if defined(VGO_linux)
+// The aforementioned older function, mallinfo(), is deprecated since the type
+// used for the fields is too small.
+void VG_(mallinfo2) ( ThreadId tid, struct vg_mallinfo2* mi )
+{
+ UWord i, free_blocks, free_blocks_size;
+ Arena* a = arenaId_to_ArenaP(VG_AR_CLIENT);
+
+ // Traverse free list and calculate free blocks statistics.
+ // This may seem slow but glibc works the same way.
+ free_blocks_size = free_blocks = 0;
+ for (i = 0; i < N_MALLOC_LISTS; i++) {
+ Block* b = a->freelist[i];
+ if (b == NULL) continue;
+ for (;;) {
+ free_blocks++;
+ free_blocks_size += (UWord)get_pszB(a, b);
+ b = get_next_b(b);
+ if (b == a->freelist[i]) break;
+ }
+ }
+
+ // We don't have fastbins so smblks & fsmblks are always 0. Also we don't
+ // have a separate mmap allocator so set hblks & hblkhd to 0.
+ mi->arena = a->stats__bytes_mmaped;
+ mi->ordblks = free_blocks + VG_(free_queue_length);
+ mi->smblks = 0;
+ mi->hblks = 0;
+ mi->hblkhd = 0;
+ mi->usmblks = 0;
+ mi->fsmblks = 0;
+ mi->uordblks = a->stats__bytes_on_loan - VG_(free_queue_volume);
+ mi->fordblks = free_blocks_size + VG_(free_queue_volume);
+ mi->keepcost = 0; // may want some value in here
+}
+#endif
SizeT VG_(arena_redzone_size) ( ArenaId aid )
{
diff --git a/coregrind/m_options.c b/coregrind/m_options.c
index 6f5a4d0458..612ef8d8be 100644
--- a/coregrind/m_options.c
+++ b/coregrind/m_options.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -182,7 +182,7 @@ XArray *VG_(clo_req_tsyms); // array of strings
Bool VG_(clo_run_libc_freeres) = True;
Bool VG_(clo_run_cxx_freeres) = True;
UInt VG_(clo_track_fds) = 0;
-UInt VG_(clo_modify_fds) = 0;
+UInt VG_(clo_modify_fds) = VG_MODIFY_FD_NO;
Bool VG_(clo_show_below_main)= False;
Bool VG_(clo_keep_debuginfo) = False;
Bool VG_(clo_show_emwarns) = False;
diff --git a/coregrind/m_oset.c b/coregrind/m_oset.c
index 0521904d96..c8d156d456 100644
--- a/coregrind/m_oset.c
+++ b/coregrind/m_oset.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -31,7 +31,9 @@
//
// ANSI C Library for maintenance of AVL Balanced Trees
// (C) 2000 Daniel Nagy, Budapest University of Technology and Economics
-// Released under GNU General Public License (GPL) version 2
+// Released under GNU General Public License (GPL) version 2+
+//
+// See also coregrind/m_wordfm.c which has the full (license) history.
//----------------------------------------------------------------------
// This file implements a generic ordered set using an AVL tree.
diff --git a/coregrind/m_pathscan.c b/coregrind/m_pathscan.c
index 02b371486e..841c674e33 100644
--- a/coregrind/m_pathscan.c
+++ b/coregrind/m_pathscan.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -139,6 +139,46 @@ const HChar* VG_(find_executable) ( const HChar* exec )
return executable_name_out;
}
+Bool VG_(try_get_interp)(const HChar* args_exe, HChar* interp_out, SizeT max_interp_len)
+{
+ HChar hdr[4096];
+ SysRes res;
+ Int fd;
+ HChar* end;
+ HChar* cp;
+ HChar* interp;
+
+ res = VG_(open)(args_exe, VKI_O_RDONLY, 0);
+ if (sr_isError(res))
+ return False;
+ fd = sr_Res(res);
+
+ res = VG_(pread)(fd, hdr, sizeof(hdr), 0);
+ VG_(close)(fd);
+ if (sr_isError(res))
+ return False;
+
+ Int len = sr_Res(res);
+ if (len < 2 || VG_(memcmp)(hdr, "#!", 2) != 0)
+ return False;
+
+ end = hdr + len;
+ interp = hdr + 2;
+ while (interp < end && (*interp == ' ' || *interp == '\t'))
+ interp++;
+ for (cp = interp; cp < end && !VG_(isspace)(*cp); cp++)
+ ;
+
+ SizeT interp_len = cp - interp;
+ if (interp_len >= max_interp_len)
+ return False;
+
+ VG_(memcpy)(interp_out, interp, interp_len);
+ interp_out[interp_len] = '\0';
+
+ return True;
+}
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_poolalloc.c b/coregrind/m_poolalloc.c
index d16377b2ed..2f0cce4d23 100644
--- a/coregrind/m_poolalloc.c
+++ b/coregrind/m_poolalloc.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_rangemap.c b/coregrind/m_rangemap.c
index a033ab27e9..c2c4b1c441 100644
--- a/coregrind/m_rangemap.c
+++ b/coregrind/m_rangemap.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
index 63172b9717..e0f596fbee 100644
--- a/coregrind/m_redir.c
+++ b/coregrind/m_redir.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1508,6 +1508,12 @@ void VG_(redir_initialise) ( void )
NULL /* not mandatory - so why bother at all? */
/* glibc-2.5 (FC6, ppc64) seems fine without it */
);
+
+ add_hardwired_spec(
+ "ld64.so.2", "strcmp",
+ (Addr)&VG_(ppc64_linux_REDIR_FOR_strcmp),
+ NULL
+ );
}
# elif defined(VGP_arm_linux)
diff --git a/coregrind/m_replacemalloc/replacemalloc_core.c b/coregrind/m_replacemalloc/replacemalloc_core.c
index 6c86a8ce17..2bef1102c2 100644
--- a/coregrind/m_replacemalloc/replacemalloc_core.c
+++ b/coregrind/m_replacemalloc/replacemalloc_core.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c
index aff2d27b3c..c3f42b8633 100644
--- a/coregrind/m_replacemalloc/vg_replace_malloc.c
+++ b/coregrind/m_replacemalloc/vg_replace_malloc.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -103,6 +103,7 @@
10190 PANIC
10200 MALLOC_STATS
10210 MALLINFO
+ 10215 MALLINFO2
10220 DEFAULT_ZONE
10230 CREATE_ZONE
10240 ZONE_FROM_PTR
@@ -506,7 +507,7 @@ extern int * __error(void) __attribute__((weak));
#if VG_WORDSIZE == 4
ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znwj, __builtin_new);
ALLOC_or_BOMB(VG_Z_LIBCXX_SONAME, _Znwj, __builtin_new);
- ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znwj, __builtin_new);
+ ALLOC_or_BOMB(SO_SYN_MALLOC, _Znwj, __builtin_new);
#endif
// operator new(unsigned long)
#if VG_WORDSIZE == 8
@@ -626,7 +627,7 @@ extern int * __error(void) __attribute__((weak));
#if VG_WORDSIZE == 4
ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new);
ALLOC_or_NULL(VG_Z_LIBCXX_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new);
- ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new);
+ ALLOC_or_NULL(SO_SYN_MALLOC, _ZnwjRKSt9nothrow_t, __builtin_new);
#endif
// operator new(unsigned long, std::nothrow_t const&)
#if VG_WORDSIZE == 8
@@ -869,7 +870,7 @@ extern int * __error(void) __attribute__((weak));
#if VG_WORDSIZE == 4
ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new );
ALLOC_or_NULL(VG_Z_LIBCXX_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new );
- ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new );
+ ALLOC_or_NULL(SO_SYN_MALLOC, _ZnajRKSt9nothrow_t, __builtin_vec_new );
#endif
// operator new[](unsigned long, std::nothrow_t const&)
#if VG_WORDSIZE == 8
@@ -1072,6 +1073,8 @@ extern int * __error(void) __attribute__((weak));
#if defined(VGO_linux)
+ FREE_ALIGNED_SIZED(VG_Z_LIBC_SONAME, free_aligned_sized, free, FreeAlignedSized );
+ FREE_ALIGNED_SIZED(SO_SYN_MALLOC, free_aligned_sized, free, FreeAlignedSized );
#elif defined(VGO_freebsd)
FREE_ALIGNED_SIZED(VG_Z_LIBC_SONAME, free_aligned_sized, free, FreeAlignedSized );
@@ -1839,7 +1842,10 @@ extern int * __error(void) __attribute__((weak));
*
* FreeBSD, undocumented, just calls aligned_alloc
* with size rounded up to a multiple
- * of aligment
+ * of aligment (unless the alignment is 0 in which case
+ * it just calls malloc [prior to Feb 2023 this wasn't
+ * handled correctly resulting in a division-by-zero crash
+ * in the size roundup code])
*
* jemalloc mininum alignment is 1, must be a power of 2
* it looks like excessively large alignment causes ENOMEM
@@ -1923,7 +1929,7 @@ extern int * __error(void) __attribute__((weak));
#define VG_MEMALIGN_NO_ALIGN_ZERO 0
#endif
-#if defined(MUSL_LIBC)
+#if defined(MUSL_LIBC) || defined(VGO_freebsd)
#define VG_MEMALIGN_NO_SIZE_ZERO 0
#else
#define VG_MEMALIGN_NO_SIZE_ZERO 1
@@ -2187,7 +2193,7 @@ extern int * __error(void) __attribute__((weak));
DO_INIT; \
TRIGGER_MEMCHECK_ERROR_IF_UNDEFINED(size); \
VERIFY_ALIGNMENT(&aligned_alloc_info); \
- MALLOC_TRACE("posix_memalign(al %llu, size %llu)\n", \
+ MALLOC_TRACE("posix_memalign(al %llu, size %llu)", \
(ULong)alignment, (ULong)size ); \
/* Test whether the alignment argument is valid. It must be \
a power of two multiple of sizeof (void *). */ \
@@ -2295,10 +2301,16 @@ extern int * __error(void) __attribute__((weak));
#define VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR 0
#endif
-#if defined(MUSL_LIBC)
+#if defined(VGO_solaris)
+#define VG_ALIGNED_ALLOC_NO_SIZE_ZERO 1
+#else
#define VG_ALIGNED_ALLOC_NO_SIZE_ZERO 0
+#endif
+
+#if defined(MUSL_LIBC)
+#define VG_ALIGNED_ALLOC_NO_ALIGN_ZERO 0
#else
-#define VG_ALIGNED_ALLOC_NO_SIZE_ZERO 1
+#define VG_ALIGNED_ALLOC_NO_ALIGN_ZERO 1
#endif
#if defined (VGO_linux) && !defined(MUSL_LIBC) && !defined(HAVE_GNU_LIBC_C17_ALIGNED_ALLOC)
@@ -2360,8 +2372,9 @@ extern int * __error(void) __attribute__((weak));
VERIFY_ALIGNMENT(&aligned_alloc_info); \
MALLOC_TRACE("aligned_alloc(al %llu, size %llu)", \
(ULong)alignment, (ULong)size ); \
- if ((VG_ALIGNED_ALLOC_NO_SIZE_ZERO && (alignment == 0)) \
- || (VG_ALIGNED_ALLOC_SIZE_MULTIPLE_ALIGN && (size % alignment != 0)) \
+ if ((VG_ALIGNED_ALLOC_NO_SIZE_ZERO && (size == 0)) \
+ || (VG_ALIGNED_ALLOC_NO_ALIGN_ZERO && (alignment == 0)) \
+ || (VG_ALIGNED_ALLOC_SIZE_MULTIPLE_ALIGN && alignment && (size % alignment != 0)) \
|| (VG_ALIGNED_ALLOC_ALIGN_POWER_TWO && (alignment & (alignment - 1)) != 0) \
|| (VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR && (alignment % 4 != 0))) { \
SET_ERRNO_EINVAL; \
@@ -2517,8 +2530,33 @@ static void panic(const char *str)
MALLINFO(VG_Z_LIBC_SONAME, mallinfo);
MALLINFO(SO_SYN_MALLOC, mallinfo);
-#elif defined(VGO_darwin)
- //MALLINFO(VG_Z_LIBC_SONAME, mallinfo);
+#elif defined(VGO_solaris)
+ MALLINFO(VG_Z_LIBC_SONAME, mallinfo);
+ MALLINFO(SO_SYN_MALLOC, mallinfo);
+
+#endif
+
+
+/*---------------------- mallinfo2 ----------------------*/
+
+// mi must be static; if it is auto then Memcheck thinks it is
+// uninitialised when used by the caller of this function, because Memcheck
+// doesn't know that the call to mallinfo2 fills in mi.
+#define MALLINFO2(soname, fnname) \
+ \
+ struct vg_mallinfo2 VG_REPLACE_FUNCTION_EZU(10215,soname,fnname) ( void ); \
+ struct vg_mallinfo2 VG_REPLACE_FUNCTION_EZU(10215,soname,fnname) ( void ) \
+ { \
+ static struct vg_mallinfo2 mi; \
+ DO_INIT; \
+ MALLOC_TRACE("mallinfo2()\n"); \
+ (void)VALGRIND_NON_SIMD_CALL1( info.mallinfo2, &mi ); \
+ return mi; \
+ }
+
+#if defined(VGO_linux)
+ MALLINFO2(VG_Z_LIBC_SONAME, mallinfo2);
+ MALLINFO2(SO_SYN_MALLOC, mallinfo2);
#endif
diff --git a/coregrind/m_sbprofile.c b/coregrind/m_sbprofile.c
index 84563206ce..c773966859 100644
--- a/coregrind/m_sbprofile.c
+++ b/coregrind/m_sbprofile.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_scheduler/priv_sched-lock-impl.h b/coregrind/m_scheduler/priv_sched-lock-impl.h
index f53d2be11e..093895837a 100644
--- a/coregrind/m_scheduler/priv_sched-lock-impl.h
+++ b/coregrind/m_scheduler/priv_sched-lock-impl.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_scheduler/priv_sched-lock.h b/coregrind/m_scheduler/priv_sched-lock.h
index f04de850fd..9632a54d0e 100644
--- a/coregrind/m_scheduler/priv_sched-lock.h
+++ b/coregrind/m_scheduler/priv_sched-lock.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_scheduler/priv_sema.h b/coregrind/m_scheduler/priv_sema.h
index c09b2ef9a7..8e19b6a4a4 100644
--- a/coregrind/m_scheduler/priv_sema.h
+++ b/coregrind/m_scheduler/priv_sema.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_scheduler/sched-lock-generic.c b/coregrind/m_scheduler/sched-lock-generic.c
index 93e8ffe6a2..c2ea255a49 100644
--- a/coregrind/m_scheduler/sched-lock-generic.c
+++ b/coregrind/m_scheduler/sched-lock-generic.c
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_scheduler/sched-lock.c b/coregrind/m_scheduler/sched-lock.c
index 1a1a843ec0..9c6452f5cc 100644
--- a/coregrind/m_scheduler/sched-lock.c
+++ b/coregrind/m_scheduler/sched-lock.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
index 51ba343616..59c8f8287b 100644
--- a/coregrind/m_scheduler/scheduler.c
+++ b/coregrind/m_scheduler/scheduler.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1982,7 +1982,7 @@ Int print_client_message( ThreadId tid, const HChar *format,
VG_(get_and_pp_StackTrace)( tid, VG_(clo_backtrace_size) );
if (VG_(clo_xml))
- VG_(printf_xml)( "\n" );
+ VG_(printf_xml)( "\n\n" );
return count;
}
@@ -2145,8 +2145,12 @@ void do_client_request ( ThreadId tid )
info->tl___builtin_vec_delete = VG_(tdict).tool___builtin_vec_delete;
info->tl___builtin_vec_delete_aligned = VG_(tdict).tool___builtin_vec_delete_aligned;
info->tl_malloc_usable_size = VG_(tdict).tool_malloc_usable_size;
-
+#if defined(VGO_linux) || defined(VGO_solaris)
info->mallinfo = VG_(mallinfo);
+#endif
+#if defined(VGO_linux)
+ info->mallinfo2 = VG_(mallinfo2);
+#endif
info->clo_trace_malloc = VG_(clo_trace_malloc);
info->clo_realloc_zero_bytes_frees = VG_(clo_realloc_zero_bytes_frees);
diff --git a/coregrind/m_scheduler/sema.c b/coregrind/m_scheduler/sema.c
index 5954cdf8f3..9a8a328ba5 100644
--- a/coregrind/m_scheduler/sema.c
+++ b/coregrind/m_scheduler/sema.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_scheduler/ticket-lock-linux.c b/coregrind/m_scheduler/ticket-lock-linux.c
index 91ed32213c..3dfa98bd76 100644
--- a/coregrind/m_scheduler/ticket-lock-linux.c
+++ b/coregrind/m_scheduler/ticket-lock-linux.c
@@ -18,7 +18,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_seqmatch.c b/coregrind/m_seqmatch.c
index 09abbca092..46cf6d820e 100644
--- a/coregrind/m_seqmatch.c
+++ b/coregrind/m_seqmatch.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/priv_sigframe.h b/coregrind/m_sigframe/priv_sigframe.h
index 2a491bf3e0..4394c16305 100644
--- a/coregrind/m_sigframe/priv_sigframe.h
+++ b/coregrind/m_sigframe/priv_sigframe.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-amd64-darwin.c b/coregrind/m_sigframe/sigframe-amd64-darwin.c
index cb47f8c04f..4d6e9c7f3c 100644
--- a/coregrind/m_sigframe/sigframe-amd64-darwin.c
+++ b/coregrind/m_sigframe/sigframe-amd64-darwin.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-amd64-freebsd.c b/coregrind/m_sigframe/sigframe-amd64-freebsd.c
index 1377c2baeb..084f177f9d 100644
--- a/coregrind/m_sigframe/sigframe-amd64-freebsd.c
+++ b/coregrind/m_sigframe/sigframe-amd64-freebsd.c
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-amd64-linux.c b/coregrind/m_sigframe/sigframe-amd64-linux.c
index 0e24306096..33580f2b46 100644
--- a/coregrind/m_sigframe/sigframe-amd64-linux.c
+++ b/coregrind/m_sigframe/sigframe-amd64-linux.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-arm-linux.c b/coregrind/m_sigframe/sigframe-arm-linux.c
index f982f1213e..18b4008ef6 100644
--- a/coregrind/m_sigframe/sigframe-arm-linux.c
+++ b/coregrind/m_sigframe/sigframe-arm-linux.c
@@ -17,7 +17,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-arm64-freebsd.c b/coregrind/m_sigframe/sigframe-arm64-freebsd.c
index 854e0ebc2a..bdb4e8629c 100644
--- a/coregrind/m_sigframe/sigframe-arm64-freebsd.c
+++ b/coregrind/m_sigframe/sigframe-arm64-freebsd.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-arm64-linux.c b/coregrind/m_sigframe/sigframe-arm64-linux.c
index f98d563b15..69bfc52892 100644
--- a/coregrind/m_sigframe/sigframe-arm64-linux.c
+++ b/coregrind/m_sigframe/sigframe-arm64-linux.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-common.c b/coregrind/m_sigframe/sigframe-common.c
index 3812c22f83..628a032313 100644
--- a/coregrind/m_sigframe/sigframe-common.c
+++ b/coregrind/m_sigframe/sigframe-common.c
@@ -17,7 +17,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-mips32-linux.c b/coregrind/m_sigframe/sigframe-mips32-linux.c
index 26292f6cb4..dd07e861e5 100644
--- a/coregrind/m_sigframe/sigframe-mips32-linux.c
+++ b/coregrind/m_sigframe/sigframe-mips32-linux.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-mips64-linux.c b/coregrind/m_sigframe/sigframe-mips64-linux.c
index d48d20b55d..a5f3656fec 100644
--- a/coregrind/m_sigframe/sigframe-mips64-linux.c
+++ b/coregrind/m_sigframe/sigframe-mips64-linux.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-nanomips-linux.c b/coregrind/m_sigframe/sigframe-nanomips-linux.c
index e2e46f11e7..fda8ec913a 100644
--- a/coregrind/m_sigframe/sigframe-nanomips-linux.c
+++ b/coregrind/m_sigframe/sigframe-nanomips-linux.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-ppc32-linux.c b/coregrind/m_sigframe/sigframe-ppc32-linux.c
index 5e6b7ef0e8..24020f9377 100644
--- a/coregrind/m_sigframe/sigframe-ppc32-linux.c
+++ b/coregrind/m_sigframe/sigframe-ppc32-linux.c
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-ppc64-linux.c b/coregrind/m_sigframe/sigframe-ppc64-linux.c
index b54c4e0be0..fd01ce73d2 100644
--- a/coregrind/m_sigframe/sigframe-ppc64-linux.c
+++ b/coregrind/m_sigframe/sigframe-ppc64-linux.c
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-riscv64-linux.c b/coregrind/m_sigframe/sigframe-riscv64-linux.c
index 8ef05407eb..464ac69cd9 100644
--- a/coregrind/m_sigframe/sigframe-riscv64-linux.c
+++ b/coregrind/m_sigframe/sigframe-riscv64-linux.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-s390x-linux.c b/coregrind/m_sigframe/sigframe-s390x-linux.c
index a48899431d..d314803517 100644
--- a/coregrind/m_sigframe/sigframe-s390x-linux.c
+++ b/coregrind/m_sigframe/sigframe-s390x-linux.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-solaris.c b/coregrind/m_sigframe/sigframe-solaris.c
index 1afb277d33..9cb9f9cc24 100644
--- a/coregrind/m_sigframe/sigframe-solaris.c
+++ b/coregrind/m_sigframe/sigframe-solaris.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-x86-darwin.c b/coregrind/m_sigframe/sigframe-x86-darwin.c
index 9bc8219623..89736e726e 100644
--- a/coregrind/m_sigframe/sigframe-x86-darwin.c
+++ b/coregrind/m_sigframe/sigframe-x86-darwin.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-x86-freebsd.c b/coregrind/m_sigframe/sigframe-x86-freebsd.c
index f631ad6f95..73c51fcae7 100644
--- a/coregrind/m_sigframe/sigframe-x86-freebsd.c
+++ b/coregrind/m_sigframe/sigframe-x86-freebsd.c
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_sigframe/sigframe-x86-linux.c b/coregrind/m_sigframe/sigframe-x86-linux.c
index 309bae2a78..1a89a15f1b 100644
--- a/coregrind/m_sigframe/sigframe-x86-linux.c
+++ b/coregrind/m_sigframe/sigframe-x86-linux.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c
index f0e6b8e7cf..a914cd0c28 100644
--- a/coregrind/m_signals.c
+++ b/coregrind/m_signals.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -178,7 +178,7 @@
else
if thread is blocked in a syscall marked SfMayBlock
- then signals may be delivered to async_sighandler, since we
+ then signals may be delivered to async_signalhandler, since we
temporarily unblocked them for the duration of the syscall,
by using the real (SCSS) mask for this thread
@@ -855,7 +855,7 @@ void calculate_SKSS_from_SCSS ( SKSS* dst )
case VKI_SIGFPE:
case VKI_SIGILL:
case VKI_SIGTRAP:
-#if defined(VGO_freebsd)
+#if defined(VKI_SIGSYS)
case VKI_SIGSYS:
#endif
/* For these, we always want to catch them and report, even
@@ -1317,10 +1317,8 @@ SysRes VG_(do_sys_sigaction) ( Int signo,
|| new_act->ksa_handler == VKI_SIG_IGN) )
goto bad_signo_reserved;
- /* Reject attempts to set a handler (or set ignore) for SIGKILL. */
- if ( (signo == VKI_SIGKILL || signo == VKI_SIGSTOP)
- && new_act
- && new_act->ksa_handler != VKI_SIG_DFL)
+ /* Reject any attempt to set the handler for SIGKILL/STOP. */
+ if ( (signo == VKI_SIGKILL || signo == VKI_SIGSTOP) && new_act )
goto bad_sigkill_or_sigstop;
/* If the client supplied non-NULL old_act, copy the relevant SCSS
@@ -1834,6 +1832,9 @@ static void default_action(const vki_siginfo_t *info, ThreadId tid)
case VKI_SIGPIPE: /* term */
case VKI_SIGALRM: /* term */
case VKI_SIGTERM: /* term */
+# if defined(VKI_SIGSTKFLT)
+ case VKI_SIGSTKFLT: /* term */
+# endif
case VKI_SIGUSR1: /* term */
case VKI_SIGUSR2: /* term */
case VKI_SIGIO: /* term */
@@ -2998,7 +2999,7 @@ void sync_signalhandler ( Int sigNo,
Bool from_user;
if (0)
- VG_(printf)("sync_sighandler(%d, %p, %p)\n", sigNo, info, uc);
+ VG_(printf)("sync_signalhandler(%d, %p, %p)\n", sigNo, info, uc);
vg_assert(info != NULL);
vg_assert(info->si_signo == sigNo);
@@ -3006,6 +3007,9 @@ void sync_signalhandler ( Int sigNo,
|| sigNo == VKI_SIGBUS
|| sigNo == VKI_SIGFPE
|| sigNo == VKI_SIGILL
+#if defined(VKI_SIGSYS)
+ || sigNo == VKI_SIGSYS
+#endif
|| sigNo == VKI_SIGTRAP);
info->si_code = sanitize_si_code(info->si_code);
diff --git a/coregrind/m_sparsewa.c b/coregrind/m_sparsewa.c
index f6a6d461c4..a5abd4f593 100644
--- a/coregrind/m_sparsewa.c
+++ b/coregrind/m_sparsewa.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_stacks.c b/coregrind/m_stacks.c
index 90101496d4..821ef3e600 100644
--- a/coregrind/m_stacks.c
+++ b/coregrind/m_stacks.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c
index 21c0f47942..fa2dc09644 100644
--- a/coregrind/m_stacktrace.c
+++ b/coregrind/m_stacktrace.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1709,7 +1709,8 @@ UInt VG_(get_StackTrace_with_deltas)(
Int i;
Int start = 0;
DiEpoch ep = VG_(current_DiEpoch)();
- for (i = 0; i < found; i++) {
+ /* We want to keep at least one frame. */
+ for (i = 0; i < found - 1; i++) {
/* This could be made a little more efficient by doing the lookups
for the symbols at glibc load time and check the address falls
inside the function symbol address range here. But given this
diff --git a/coregrind/m_syscall.c b/coregrind/m_syscall.c
index c76f1df81b..cb3c603f8f 100644
--- a/coregrind/m_syscall.c
+++ b/coregrind/m_syscall.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -768,7 +768,6 @@ extern UWord do_syscall_WRK (
UWord a5, /* %r9 */
UWord a6, /* 8(%rsp) */
UWord a7, /* 16(%rsp) */
- UWord a8, /* 24(%rsp) */
UInt *flags, /* 32(%rsp) */
UWord *rv2 /* 40(%rsp) */
);
@@ -784,20 +783,18 @@ asm(
" movq %r8, %r10\n" /* a4 */
" movq %r9, %r8\n" /* a5 */
" movq 16(%rbp), %r9\n" /* a6 last register arg from stack, account for %rbp */
-" movq 32(%rbp), %r11\n" /* a8 from stack */
-" pushq %r11\n"
" movq 24(%rbp), %r11\n" /* a7 from stack */
-" pushq %r11\n"
+" pushq %r11\n"
" subq $8,%rsp\n" /* fake return addr */
" syscall\n"
" jb 1f\n"
-" movq 48(%rbp),%rsi\n" /* success */
+" movq 40(%rbp),%rsi\n" /* success */
" movq %rdx, (%rsi)\n" /* second return value */
" movq %rbp, %rsp\n"
" popq %rbp\n"
" ret\n"
"1:\n" /* error path */
-" movq 40(%rbp), %rsi\n" /* flags */
+" movq 32(%rbp), %rsi\n" /* flags */
" movl $1,(%rsi)\n"
" movq %rbp, %rsp\n"
" popq %rbp\n"
@@ -808,32 +805,31 @@ asm(
#elif defined(VGP_arm64_freebsd)
/*
- * Arguments a1 to a8 are in registers x0 to x7.
+ * Arguments a1 to a7 are in registers x0 to x6.
* Which is just what we want for a syscall.
*
- * The syscall number is on the top of the stack
- * pointed to by sp. The flags are at sp+8 and
- * second return value at sp+16.
+ * The syscall number is in x9
+ * The flags are at the top of the stack, sp and
+ * second return value at sp+8.
*/
extern UWord do_syscall_WRK (
UWord a1, UWord a2, UWord a3,
UWord a4, UWord a5, UWord a6,
- UWord a7, UWord a8,
- UWord syscall_no,
+ UWord a7, UWord syscall_no,
UInt *flags, UWord *rv2
);
asm(
".text\n"
".globl do_syscall_WRK\n"
"do_syscall_WRK:\n"
- " ldr x8, [sp]\n" // retrieve syscall_no, put it in x8
+ " mov x8, x9\n" // get the syscall number from x9
" svc 0x0\n" // do the syscall
" mov x9, 1\n" // flags for error will be 1 or 0
" csel x9, x9, xzr, cs\n" // conditionally select 1 or 0 into x9
- " ldr x10, [sp, #8]\n" // load the address of flags
+ " ldr x10, [sp]\n" // load the address of flags
" str w9, [x10]\n" // store flags result
- " ldr x10, [sp, #16]\n" // load the addres of rv2
+ " ldr x10, [sp, #8]\n" // load the addres of rv2
" str x1, [x10]\n" // store rv2 result
" ret\n"
".previous\n"
@@ -1231,7 +1227,7 @@ SysRes VG_(do_syscall) ( UWord sysno, RegWord a1, RegWord a2, RegWord a3,
UWord val2 = 0;
UInt err = 0;
val = do_syscall_WRK(sysno, a1, a2, a3, a4, a5,
- a6, a7, a8, &err, &val2);
+ a6, a7, &err, &val2);
return VG_(mk_SysRes_amd64_freebsd)( val, val2, (err & 1) != 0 ? True : False);
# elif defined(VGP_arm64_freebsd)
@@ -1239,7 +1235,7 @@ SysRes VG_(do_syscall) ( UWord sysno, RegWord a1, RegWord a2, RegWord a3,
UWord val2 = 0;
UInt err = 0;
val = do_syscall_WRK(a1, a2, a3, a4, a5,
- a6, a7, a8, sysno, &err, &val2);
+ a6, a7, sysno, &err, &val2);
return VG_(mk_SysRes_arm64_freebsd)( val, val2, (err & 1) != 0 ? True : False);
# elif defined(VGP_ppc32_linux)
diff --git a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h
index 4435f8b571..67c3412d36 100644
--- a/coregrind/m_syswrap/priv_syswrap-darwin.h
+++ b/coregrind/m_syswrap/priv_syswrap-darwin.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h
index f8d404239d..6aaa36abab 100644
--- a/coregrind/m_syswrap/priv_syswrap-freebsd.h
+++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -81,7 +81,7 @@ DECL_TEMPLATE(freebsd, sys_fchflags) // 35
// generic kill 37
// generic getppid 39
// generic dup 41
-DECL_TEMPLATE(freebsd, sys_pipe) // 42
+DECL_TEMPLATE(freebsd, sys_freebsd10_pipe) // 42
// generic getegid 43
// generic profil redirect to ni_syscall 44
// sys_ktrace refirect to ni_syscall 45
@@ -107,8 +107,8 @@ DECL_TEMPLATE(freebsd, sys_sbrk) // 69
// generic mprotect 74
// generic madvise 75
// generic mincore 78
-// generic getgroups 79
-// generic setgroups 80
+// generic freebsd14_getgroups 79
+// generic freebsd14_setgroups 80
// generic getpgrp 81
// generic setpgid 82
// generic setitimer 83
@@ -543,6 +543,16 @@ DECL_TEMPLATE(freebsd, sys_getrlimitusage) // 589
DECL_TEMPLATE(freebsd, sys_fchroot) // 590
DECL_TEMPLATE(freebsd, sys_setcred) // 591
+DECL_TEMPLATE(freebsd, sys_exterrctl) // 592
+DECL_TEMPLATE(freebsd, sys_inotify_add_watch_at) // 593
+DECL_TEMPLATE(freebsd, sys_inotify_rm_watch) // 594
+
+// generic getgroups 595
+// generic setgroups 596
+
+DECL_TEMPLATE(freebsd, sys_jail_attach_jd) // 597
+DECL_TEMPLATE(freebsd, sys_jail_remove_jd) // 598
+
DECL_TEMPLATE(freebsd, sys_fake_sigreturn)
#endif // PRIV_SYSWRAP_FREEBSD_H
diff --git a/coregrind/m_syswrap/priv_syswrap-generic.h b/coregrind/m_syswrap/priv_syswrap-generic.h
index b24b6b9035..a59cdf5efd 100644
--- a/coregrind/m_syswrap/priv_syswrap-generic.h
+++ b/coregrind/m_syswrap/priv_syswrap-generic.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -59,6 +59,17 @@ extern
Bool ML_(fd_allowed)(Int fd, const HChar *syscallname, ThreadId tid,
Bool isNewFD);
+// used bye "*at" syscalls that take a directory fd for use
+// with relative paths. Need to check that
+// 1. the path is relative
+// 2. the directory is not the specail value VKI_AT_FDCWD
+// 3. the directory fd is allowd (as above)
+extern
+void ML_(fd_at_check_allowed)(Int fd, const HChar* path,
+ const HChar* function_name, ThreadId tid,
+ SyscallStatus* status);
+
+
extern void ML_(record_fd_close) (ThreadId tid, Int fd);
extern Int ML_(get_fd_count) (void);
extern void ML_(record_fd_close_range) (ThreadId tid, Int fd);
@@ -342,13 +353,14 @@ extern SysRes ML_(generic_PRE_sys_mmap) ( TId, UW, UW, UW, UW, UW, Off64
/* Helper macro for POST handlers that return a new file in RES.
If possible sets RES (through SET_STATUS_Success) to a new
(not yet seem before) file descriptor. */
-#define POST_newFd_RES \
- do { \
- if (VG_(clo_modify_fds) == 1) { \
- int newFd = ML_(get_next_new_fd)(RES); \
- if (newFd != RES) \
- SET_STATUS_Success(newFd); \
- } \
+#define POST_newFd_RES \
+ do { \
+ if ((VG_(clo_modify_fds) == VG_MODIFY_FD_YES && RES > 2) \
+ || (VG_(clo_modify_fds) == VG_MODIFY_FD_HIGH)) { \
+ int newFd = ML_(get_next_new_fd)(RES); \
+ if (newFd != RES) \
+ SET_STATUS_Success(newFd); \
+ } \
} while (0)
/////////////////////////////////////////////////////////////////
diff --git a/coregrind/m_syswrap/priv_syswrap-linux-variants.h b/coregrind/m_syswrap/priv_syswrap-linux-variants.h
index db8770012b..4838069905 100644
--- a/coregrind/m_syswrap/priv_syswrap-linux-variants.h
+++ b/coregrind/m_syswrap/priv_syswrap-linux-variants.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h
index 4dad82dfbb..21cb32829a 100644
--- a/coregrind/m_syswrap/priv_syswrap-linux.h
+++ b/coregrind/m_syswrap/priv_syswrap-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -40,6 +40,7 @@ extern void ML_(call_on_new_stack_0_1) ( Addr stack, Addr retaddr,
// Linux-specific (but non-arch-specific) syscalls
+DECL_TEMPLATE(linux, sys_ustat);
DECL_TEMPLATE(linux, sys_clone)
DECL_TEMPLATE(linux, sys_mount);
DECL_TEMPLATE(linux, sys_oldumount);
@@ -59,6 +60,9 @@ DECL_TEMPLATE(linux, sys_tee);
DECL_TEMPLATE(linux, sys_vmsplice);
DECL_TEMPLATE(linux, sys_readahead);
DECL_TEMPLATE(linux, sys_move_pages);
+DECL_TEMPLATE(linux, sys_cachestat);
+DECL_TEMPLATE(linux, sys_sysfs);
+DECL_TEMPLATE(linux, sys_setdomainname);
// clone is similar enough between linux variants to have a generic
// version, but which will call an extern defined in syswrap--linux.c
@@ -107,6 +111,7 @@ DECL_TEMPLATE(linux, sys_epoll_ctl);
DECL_TEMPLATE(linux, sys_epoll_wait);
DECL_TEMPLATE(linux, sys_epoll_pwait);
DECL_TEMPLATE(linux, sys_epoll_pwait2);
+DECL_TEMPLATE(linux, sys_remap_file_pages);
DECL_TEMPLATE(linux, sys_eventfd);
DECL_TEMPLATE(linux, sys_eventfd2);
@@ -250,6 +255,7 @@ DECL_TEMPLATE(linux, sys_munlockall);
DECL_TEMPLATE(linux, sys_pipe);
DECL_TEMPLATE(linux, sys_pipe2);
DECL_TEMPLATE(linux, sys_quotactl);
+DECL_TEMPLATE(linux, sys_quotactl_fd);
DECL_TEMPLATE(linux, sys_waitid);
// Posix, but in Darwin utime is a libc function that calls syscall utimes.
@@ -282,6 +288,9 @@ DECL_TEMPLATE(linux, sys_init_module);
DECL_TEMPLATE(linux, sys_finit_module);
DECL_TEMPLATE(linux, sys_delete_module);
+DECL_TEMPLATE(linux, sys_swapon);
+DECL_TEMPLATE(linux, sys_swapoff);
+
// Linux-specific (oprofile-related)
DECL_TEMPLATE(linux, sys_lookup_dcookie); // (*/32/64) L
@@ -340,6 +349,9 @@ DECL_TEMPLATE(linux, sys_pidfd_open);
DECL_TEMPLATE(linux, sys_close_range);
DECL_TEMPLATE(linux, sys_openat2);
+// Linux-specific (new in Linux 5.12)
+DECL_TEMPLATE(linux, sys_mount_setattr)
+
// Linux-specific (new in Linux 5.13)
DECL_TEMPLATE(linux, sys_landlock_create_ruleset)
DECL_TEMPLATE(linux, sys_landlock_add_rule)
@@ -354,6 +366,13 @@ DECL_TEMPLATE(linux, sys_pidfd_getfd);
// Since Linux 6.6
DECL_TEMPLATE(linux, sys_fchmodat2);
+// Since Linux 6.8
+DECL_TEMPLATE(linux, sys_listmount);
+DECL_TEMPLATE(linux, sys_statmount);
+
+// Since Linux 6.10
+DECL_TEMPLATE(linux, sys_mseal);
+
/* ---------------------------------------------------------------------
Wrappers for sockets and ipc-ery. These are split into standalone
procedures because x86-linux hides them inside multiplexors
@@ -454,6 +473,7 @@ DECL_TEMPLATE(linux, sys_mq_timedreceive_time64);
DECL_TEMPLATE(linux, sys_semtimedop_time64);
DECL_TEMPLATE(linux, sys_rt_sigtimedwait_time64);
DECL_TEMPLATE(linux, sys_futex_time64);
+DECL_TEMPLATE(linux, sys_futex_waitv);
DECL_TEMPLATE(linux, sys_sched_rr_get_interval_time64);
// Some arch specific functions called from syswrap-linux.c
diff --git a/coregrind/m_syswrap/priv_syswrap-main.h b/coregrind/m_syswrap/priv_syswrap-main.h
index e1da0a127d..8139f9cdd4 100644
--- a/coregrind/m_syswrap/priv_syswrap-main.h
+++ b/coregrind/m_syswrap/priv_syswrap-main.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/priv_syswrap-solaris.h b/coregrind/m_syswrap/priv_syswrap-solaris.h
index c988a6d545..b9af0c3d65 100644
--- a/coregrind/m_syswrap/priv_syswrap-solaris.h
+++ b/coregrind/m_syswrap/priv_syswrap-solaris.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/priv_syswrap-xen.h b/coregrind/m_syswrap/priv_syswrap-xen.h
index b1d2f485dc..d372cea37f 100644
--- a/coregrind/m_syswrap/priv_syswrap-xen.h
+++ b/coregrind/m_syswrap/priv_syswrap-xen.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/priv_types_n_macros.h b/coregrind/m_syswrap/priv_types_n_macros.h
index cc00592ef2..0ce26bd33d 100644
--- a/coregrind/m_syswrap/priv_types_n_macros.h
+++ b/coregrind/m_syswrap/priv_types_n_macros.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-amd64-darwin.S b/coregrind/m_syswrap/syscall-amd64-darwin.S
index 5c68d0c4d0..9abfd998f5 100644
--- a/coregrind/m_syswrap/syscall-amd64-darwin.S
+++ b/coregrind/m_syswrap/syscall-amd64-darwin.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-amd64-freebsd.S b/coregrind/m_syswrap/syscall-amd64-freebsd.S
index d1516b1065..0d25efdccc 100644
--- a/coregrind/m_syswrap/syscall-amd64-freebsd.S
+++ b/coregrind/m_syswrap/syscall-amd64-freebsd.S
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -112,17 +112,9 @@ ML_(do_syscall_for_client_WRK):
movq OFFSET_amd64_R10(%r11), %r10
movq OFFSET_amd64_R8(%r11), %r8
movq OFFSET_amd64_R9(%r11), %r9
- /* 2 stack parameters plus return address (ignored by syscall) */
- /* @todo PJF there is a potential bug here
- * syscall can take up to 8 arguments
- * but when syscall0 or syscall198 is being used
- * one argument is used for the syscall0/198 id
- * and one for the actual id and in this case
- * there could be 3 stack parameters.
- * However, only mmap takes 8 arguments
- * and only on x86. It would be an unlikely combination,
- * but this might break one day. */
+ /* get RSP */
movq OFFSET_amd64_RSP(%r11), %r11 /* r11 = simulated RSP */
+ /* 2 stack parameters */
movq 16(%r11), %rax
pushq %rax
movq 8(%r11), %rax
diff --git a/coregrind/m_syswrap/syscall-amd64-linux.S b/coregrind/m_syswrap/syscall-amd64-linux.S
index 98f060f0ba..6448cdbe46 100644
--- a/coregrind/m_syswrap/syscall-amd64-linux.S
+++ b/coregrind/m_syswrap/syscall-amd64-linux.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-amd64-solaris.S b/coregrind/m_syswrap/syscall-amd64-solaris.S
index 14a7e0c5dd..c301e29b3f 100644
--- a/coregrind/m_syswrap/syscall-amd64-solaris.S
+++ b/coregrind/m_syswrap/syscall-amd64-solaris.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-arm-linux.S b/coregrind/m_syswrap/syscall-arm-linux.S
index 12dc9390cb..e57180ce47 100644
--- a/coregrind/m_syswrap/syscall-arm-linux.S
+++ b/coregrind/m_syswrap/syscall-arm-linux.S
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-arm64-freebsd.S b/coregrind/m_syswrap/syscall-arm64-freebsd.S
index 52ba022ba2..fb7c687687 100644
--- a/coregrind/m_syswrap/syscall-arm64-freebsd.S
+++ b/coregrind/m_syswrap/syscall-arm64-freebsd.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-arm64-linux.S b/coregrind/m_syswrap/syscall-arm64-linux.S
index 2e6b72fa67..9ff45c786d 100644
--- a/coregrind/m_syswrap/syscall-arm64-linux.S
+++ b/coregrind/m_syswrap/syscall-arm64-linux.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-mips32-linux.S b/coregrind/m_syswrap/syscall-mips32-linux.S
index 217fa150cd..da27cea296 100644
--- a/coregrind/m_syswrap/syscall-mips32-linux.S
+++ b/coregrind/m_syswrap/syscall-mips32-linux.S
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-mips64-linux.S b/coregrind/m_syswrap/syscall-mips64-linux.S
index bdff39a0bc..684aba76b7 100644
--- a/coregrind/m_syswrap/syscall-mips64-linux.S
+++ b/coregrind/m_syswrap/syscall-mips64-linux.S
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-nanomips-linux.S b/coregrind/m_syswrap/syscall-nanomips-linux.S
index 5f00e10a30..7b93fbaaa3 100644
--- a/coregrind/m_syswrap/syscall-nanomips-linux.S
+++ b/coregrind/m_syswrap/syscall-nanomips-linux.S
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-ppc32-linux.S b/coregrind/m_syswrap/syscall-ppc32-linux.S
index af087aaf22..cacf885da8 100644
--- a/coregrind/m_syswrap/syscall-ppc32-linux.S
+++ b/coregrind/m_syswrap/syscall-ppc32-linux.S
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-ppc64be-linux.S b/coregrind/m_syswrap/syscall-ppc64be-linux.S
index a6a2f38b41..cf0e568828 100644
--- a/coregrind/m_syswrap/syscall-ppc64be-linux.S
+++ b/coregrind/m_syswrap/syscall-ppc64be-linux.S
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-ppc64le-linux.S b/coregrind/m_syswrap/syscall-ppc64le-linux.S
index e416688e37..21a4489c79 100644
--- a/coregrind/m_syswrap/syscall-ppc64le-linux.S
+++ b/coregrind/m_syswrap/syscall-ppc64le-linux.S
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-riscv64-linux.S b/coregrind/m_syswrap/syscall-riscv64-linux.S
index cf976cee18..6d4c4315c9 100644
--- a/coregrind/m_syswrap/syscall-riscv64-linux.S
+++ b/coregrind/m_syswrap/syscall-riscv64-linux.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-s390x-linux.S b/coregrind/m_syswrap/syscall-s390x-linux.S
index c1cd85bc79..ee583ad73d 100644
--- a/coregrind/m_syswrap/syscall-s390x-linux.S
+++ b/coregrind/m_syswrap/syscall-s390x-linux.S
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-x86-darwin.S b/coregrind/m_syswrap/syscall-x86-darwin.S
index d92ecf15e0..393cc8eb72 100644
--- a/coregrind/m_syswrap/syscall-x86-darwin.S
+++ b/coregrind/m_syswrap/syscall-x86-darwin.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-x86-freebsd.S b/coregrind/m_syswrap/syscall-x86-freebsd.S
index 4ddba2d340..9e69d85bec 100644
--- a/coregrind/m_syswrap/syscall-x86-freebsd.S
+++ b/coregrind/m_syswrap/syscall-x86-freebsd.S
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-x86-linux.S b/coregrind/m_syswrap/syscall-x86-linux.S
index 2820bb9cc5..eddabd739e 100644
--- a/coregrind/m_syswrap/syscall-x86-linux.S
+++ b/coregrind/m_syswrap/syscall-x86-linux.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syscall-x86-solaris.S b/coregrind/m_syswrap/syscall-x86-solaris.S
index b94f3479c6..48fb5e3669 100644
--- a/coregrind/m_syswrap/syscall-x86-solaris.S
+++ b/coregrind/m_syswrap/syscall-x86-solaris.S
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syswrap-amd64-darwin.c b/coregrind/m_syswrap/syswrap-amd64-darwin.c
index 6227352eee..e6f284c9a6 100644
--- a/coregrind/m_syswrap/syswrap-amd64-darwin.c
+++ b/coregrind/m_syswrap/syswrap-amd64-darwin.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -476,15 +476,14 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem,
/* For whatever reason, tst->os_state.pthread appear to have a
constant offset of 96 on 10.7, but zero on 10.6 and 10.5. No
idea why. */
-# if DARWIN_VERS <= DARWIN_10_6
+# if DARWIN_VERS <= DARWIN_10_6 || DARWIN_VERS == DARWIN_10_13
UWord magic_delta = 0;
# elif DARWIN_VERS == DARWIN_10_7 || DARWIN_VERS == DARWIN_10_8
UWord magic_delta = 0x60;
# elif DARWIN_VERS == DARWIN_10_9 \
|| DARWIN_VERS == DARWIN_10_10 \
|| DARWIN_VERS == DARWIN_10_11 \
- || DARWIN_VERS == DARWIN_10_12 \
- || DARWIN_VERS == DARWIN_10_13
+ || DARWIN_VERS == DARWIN_10_12
UWord magic_delta = 0xE0;
# else
# error "magic_delta: to be computed on new OS version"
@@ -528,6 +527,9 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem,
vex->guest_R8 = reuse;
vex->guest_R9 = 0;
vex->guest_RSP = sp;
+#if DARWIN_VERS >= DARWIN_10_12
+ vex->guest_GS_CONST = self + pthread_tsd_offset;
+#endif
stacksize = 512*1024; // wq stacks are always DEFAULT_STACK_SIZE
stack = VG_PGROUNDUP(sp) - stacksize;
diff --git a/coregrind/m_syswrap/syswrap-amd64-freebsd.c b/coregrind/m_syswrap/syswrap-amd64-freebsd.c
index e1316eac3e..3576f64b9b 100644
--- a/coregrind/m_syswrap/syswrap-amd64-freebsd.c
+++ b/coregrind/m_syswrap/syswrap-amd64-freebsd.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -128,13 +128,18 @@ PRE(sys_sysarch)
PRE_REG_READ2(int, "sysarch", int, number, void *, args);
switch (ARG1) {
case VKI_AMD64_SET_FSBASE:
- PRINT("sys_amd64_set_fsbase ( %#lx )", ARG2);
+ case VKI_AMD64_SET_TLSBASE:
+ PRINT("sys_amd64_set_%ssbase ( %#lx )", (ARG1 == VKI_AMD64_SET_FSBASE ? "f" : "tl"), ARG2);
if (ML_(safe_to_deref)((void**)ARG2, sizeof(void*))) {
/* On FreeBSD, the syscall loads the %gs selector for us, so do it now. */
tst = VG_(get_ThreadState)(tid);
p = (void**)ARG2;
tst->arch.vex.guest_FS_CONST = (UWord)*p;
+ if (ARG1 == VKI_AMD64_SET_TLSBASE) {
+ tst->arch.vex.guest_TLSBASE = (UWord)*p;
+ // kernel also calls "set_pcb_flags(pcb, PCB_TLSBASE);"
+ }
/* "do" the syscall ourselves; the kernel never sees it */
SET_STATUS_Success2((ULong)*p, tst->arch.vex.guest_RDX );
} else {
@@ -165,6 +170,19 @@ PRE(sys_sysarch)
tst = VG_(get_ThreadState)(tid);
SET_STATUS_Success2( tst->arch.vex.guest_FPTAG[0], tst->arch.vex.guest_FPTAG[0] );
break;
+ //case VKI_AMD64_SET_PKRU:
+ //case VKI_AMD64_CLEAR_PKRU:
+ case VKI_AMD64_GET_TLSBASE:
+ PRINT("sys_amd64_get_tlsbase ( %#lx )", ARG2);
+ PRE_MEM_WRITE( "amd64_get_fsbase(basep)", ARG2, sizeof(void *) );
+ if (ML_(safe_to_deref)((void**)ARG2, sizeof(void*))) {
+ /* "do" the syscall ourselves; the kernel never sees it */
+ tst = VG_(get_ThreadState)(tid);
+ SET_STATUS_Success2( tst->arch.vex.guest_TLSBASE, tst->arch.vex.guest_RDX );
+ } else {
+ SET_STATUS_Failure( VKI_EINVAL );
+ }
+ break;
default:
VG_(message) (Vg_UserMsg, "unhandled sysarch cmd %lu", ARG1);
VG_(unimplemented) ("unhandled sysarch cmd");
@@ -179,6 +197,7 @@ POST(sys_sysarch)
break;
case VKI_AMD64_GET_FSBASE:
case VKI_AMD64_GET_XFPUSTATE:
+ case VKI_AMD64_GET_TLSBASE:
POST_MEM_WRITE( ARG2, sizeof(void *) );
break;
default:
@@ -249,17 +268,16 @@ PRE(sys_preadv)
int, iovcnt, vki_off_t, offset);
if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) {
SET_STATUS_Failure( VKI_EBADF );
- } else {
- if ((Int)ARG3 > 0) {
- PRE_MEM_READ( "preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec) );
- }
+ }
+ if ((Int)ARG3 > 0) {
+ PRE_MEM_READ( "preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec) );
+ }
- if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) {
- vec = (struct vki_iovec *)(Addr)ARG2;
- for (i = 0; i < (Int)ARG3; i++) {
- VG_(sprintf)(buf, "preadv(iov[%d])", i);
- PRE_MEM_WRITE(buf, (Addr)vec[i].iov_base, vec[i].iov_len);
- }
+ if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) {
+ vec = (struct vki_iovec *)(Addr)ARG2;
+ for (i = 0; i < (Int)ARG3; i++) {
+ VG_(sprintf)(buf, "preadv(iov[%d])", i);
+ PRE_MEM_WRITE(buf, (Addr)vec[i].iov_base, vec[i].iov_len);
}
}
}
@@ -304,16 +322,15 @@ PRE(sys_pwritev)
vki_off_t, offset);
if (!ML_(fd_allowed)(ARG1, "pwritev", tid, False)) {
SET_STATUS_Failure( VKI_EBADF );
- } else {
- if ((Int)ARG3 >= 0) {
- PRE_MEM_READ( "pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) );
- }
- if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) {
- vec = (struct vki_iovec *)(Addr)ARG2;
- for (i = 0; i < (Int)ARG3; i++) {
- VG_(sprintf)(buf, "pwritev(iov[%d])", i);
- PRE_MEM_READ(buf, (Addr)vec[i].iov_base, vec[i].iov_len );
- }
+ }
+ if ((Int)ARG3 >= 0) {
+ PRE_MEM_READ( "pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) );
+ }
+ if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) {
+ vec = (struct vki_iovec *)(Addr)ARG2;
+ for (i = 0; i < (Int)ARG3; i++) {
+ VG_(sprintf)(buf, "pwritev(iov[%d])", i);
+ PRE_MEM_READ(buf, (Addr)vec[i].iov_base, vec[i].iov_len );
}
}
}
@@ -330,7 +347,8 @@ PRE(sys_sendfile)
PRE_REG_READ7(int, "sendfile",
int, fd, int, s, vki_off_t, offset, size_t, nbytes,
void *, hdtr, vki_off_t *, sbytes, int, flags);
-
+ if (!ML_(fd_allowed)(ARG1, "sendfile", tid, False))
+ SET_STATUS_Failure( VKI_EBADF );
if (ARG5 != 0) {
PRE_MEM_READ("sendfile(hdtr)", ARG5, sizeof(struct vki_sf_hdtr));
}
@@ -742,6 +760,8 @@ PRE(sys_lseek)
PRE_REG_READ3(long, "lseek",
unsigned int, fd, unsigned long, offset,
unsigned int, whence);
+ if (!ML_(fd_allowed)(ARG1, "lseek", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_truncate 479
@@ -763,6 +783,8 @@ PRE(sys_ftruncate)
PRINT("sys_ftruncate ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1,ARG2);
PRE_REG_READ2(long, "ftruncate", unsigned int, fd,
unsigned long, length);
+ if (!ML_(fd_allowed)(ARG1, "ftruncate", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_cpuset_setid 485
@@ -836,6 +858,8 @@ PRE(sys_posix_fallocate)
PRE_REG_READ3(long, "posix_fallocate",
int, fd, vki_off_t, offset,
vki_off_t, len);
+ if (!ML_(fd_allowed)(ARG1, "posix_fallocate", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_posix_fadvise 531
@@ -848,7 +872,8 @@ PRE(sys_posix_fadvise)
int, fd, off_t, offset,
off_t, len,
int, advice);
- // @todo PJF advice can be 0 to 5 inclusive
+ if (!ML_(fd_allowed)(ARG1, "posix_fadvise", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_wait6 532
@@ -962,6 +987,7 @@ PRE(sys_mknodat)
PRE_REG_READ4(long, "mknodat",
int, fd, const char *, path, vki_mode_t, mode, vki_dev_t, dev);
PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mknodat", tid, status);
}
// SYS_cpuset_getdomain 561
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
index 646a832408..234b056e58 100644
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -633,10 +633,10 @@ static SyscallTableEntry syscall_table[] = {
// (__NR_uselib, sys_uselib), // 134
LINX_(__NR_personality, sys_personality), // 135
- // (__NR_ustat, sys_ustat), // 136
+ LINXY(__NR_ustat, sys_ustat), // 136
GENXY(__NR_statfs, sys_statfs), // 137
GENXY(__NR_fstatfs, sys_fstatfs), // 138
- // (__NR_sysfs, sys_sysfs), // 139
+ LINXY(__NR_sysfs, sys_sysfs), // 139
GENX_(__NR_getpriority, sys_getpriority), // 140
GENX_(__NR_setpriority, sys_setpriority), // 141
@@ -670,12 +670,12 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_mount, sys_mount), // 165
LINX_(__NR_umount2, sys_umount), // 166
- // (__NR_swapon, sys_swapon), // 167
- // (__NR_swapoff, sys_swapoff), // 168
+ LINX_(__NR_swapon, sys_swapon), // 167
+ LINX_(__NR_swapoff, sys_swapoff), // 168
// (__NR_reboot, sys_reboot), // 169
GENX_(__NR_sethostname, sys_sethostname), // 170
- // (__NR_setdomainname, sys_setdomainname), // 171
+ LINX_(__NR_setdomainname, sys_setdomainname), // 171
GENX_(__NR_iopl, sys_iopl), // 172
LINX_(__NR_ioperm, sys_ioperm), // 173
GENX_(__NR_create_module, sys_ni_syscall), // 174
@@ -729,7 +729,7 @@ static SyscallTableEntry syscall_table[] = {
// (__NR_epoll_ctl_old, sys_ni_syscall), // 214
// (__NR_epoll_wait_old, sys_ni_syscall), // 215
- // (__NR_remap_file_pages, sys_remap_file_pages)// 216
+ LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 216
GENXY(__NR_getdents64, sys_getdents64), // 217
LINX_(__NR_set_tid_address, sys_set_tid_address),// 218
// (__NR_restart_syscall, sys_restart_syscall),// 219
@@ -895,14 +895,21 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+ LINX_(__NR_mount_setattr, sys_mount_setattr), // 442
+ LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443
LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445
LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446
LINXY(__NR_memfd_secret, sys_memfd_secret), // 447
+ LINX_(__NR_futex_waitv, sys_futex_waitv), // 449
+ LINXY(__NR_cachestat, sys_cachestat), // 451
LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
+ LINXY(__NR_statmount, sys_statmount), // 457
+ LINXY(__NR_listmount, sys_listmount), // 458
+ LINX_(__NR_mseal, sys_mseal), // 462
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/coregrind/m_syswrap/syswrap-amd64-solaris.c b/coregrind/m_syswrap/syswrap-amd64-solaris.c
index 404cba5a0a..6577266883 100644
--- a/coregrind/m_syswrap/syswrap-amd64-solaris.c
+++ b/coregrind/m_syswrap/syswrap-amd64-solaris.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
index a12053dd07..9e1b2efb48 100644
--- a/coregrind/m_syswrap/syswrap-arm-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -284,6 +284,8 @@ PRE(sys_fstatat64)
SARG1, ARG2, (HChar*)ARG2, ARG3);
PRE_REG_READ3(long, "fstatat64",
int, dfd, char *, file_name, struct stat64 *, buf);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat64", tid, status);
+ SET_STATUS_Failure( VKI_EBADF );
PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 );
PRE_MEM_WRITE( "fstatat64(buf)", ARG3, sizeof(struct vki_stat64) );
}
@@ -621,7 +623,7 @@ static SyscallTableEntry syscall_main_table[] = {
//zz
GENX_(__NR_umask, sys_umask), // 60
GENX_(__NR_chroot, sys_chroot), // 61
-//zz // (__NR_ustat, sys_ustat) // 62 SVr4 -- deprecated
+ LINXY(__NR_ustat, sys_ustat), // 62 SVr4 -- deprecated
GENXY(__NR_dup2, sys_dup2), // 63
GENX_(__NR_getppid, sys_getppid), // 64
@@ -651,7 +653,7 @@ static SyscallTableEntry syscall_main_table[] = {
//zz
GENXY(__NR_readlink, sys_readlink), // 85
//zz // (__NR_uselib, sys_uselib), // 86 */Linux
-//zz // (__NR_swapon, sys_swapon), // 87 */Linux
+ LINX_(__NR_swapon, sys_swapon), // 87 */Linux
//zz // (__NR_reboot, sys_reboot), // 88 */Linux
//zz // (__NR_readdir, old_readdir), // 89 -- superseded
//zz
@@ -685,14 +687,14 @@ static SyscallTableEntry syscall_main_table[] = {
// PLAXY(__NR_vm86old, sys_vm86old), // 113 __NR_syscall... weird
GENXY(__NR_wait4, sys_wait4), // 114
//zz
-//zz // (__NR_swapoff, sys_swapoff), // 115 */Linux
+ LINX_(__NR_swapoff, sys_swapoff), // 115 */Linux
LINXY(__NR_sysinfo, sys_sysinfo), // 116
// _____(__NR_ipc, sys_ipc), // 117
GENX_(__NR_fsync, sys_fsync), // 118
PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux
LINX_(__NR_clone, sys_clone), // 120
-//zz // (__NR_setdomainname, sys_setdomainname), // 121 */*(?)
+ LINX_(__NR_setdomainname, sys_setdomainname), // 121
GENXY(__NR_uname, sys_newuname), // 122
// PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123
LINXY(__NR_adjtimex, sys_adjtimex), // 124
@@ -711,7 +713,7 @@ static SyscallTableEntry syscall_main_table[] = {
GENX_(__NR_fchdir, sys_fchdir), // 133
//zz // (__NR_bdflush, sys_bdflush), // 134 */Linux
//zz
-//zz // (__NR_sysfs, sys_sysfs), // 135 SVr4
+ LINXY(__NR_sysfs, sys_sysfs), // 135 SVr4
LINX_(__NR_personality, sys_personality), // 136
// GENX_(__NR_afs_syscall, sys_ni_syscall), // 137
LINX_(__NR_setfsuid, sys_setfsuid16), // 138
@@ -858,7 +860,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 255
LINXY(__NR_epoll_wait, sys_epoll_wait), // 256
-//zz // (__NR_remap_file_pages, sys_remap_file_pages), // 257 */Linux
+ LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 257 */Linux
LINX_(__NR_set_tid_address, sys_set_tid_address), // 258
LINXY(__NR_timer_create, sys_timer_create), // 259
@@ -919,9 +921,8 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_(__NR_add_key, sys_add_key), // 286
LINX_(__NR_request_key, sys_request_key), // 287
LINXY(__NR_keyctl, sys_keyctl), // not 288...
-// LINX_(__NR_ioprio_set, sys_ioprio_set), // 289
-
-// LINX_(__NR_ioprio_get, sys_ioprio_get), // 290
+ LINX_(__NR_ioprio_set, sys_ioprio_set), // 289
+ LINX_(__NR_ioprio_get, sys_ioprio_get), // 290
LINXY(__NR_inotify_init, sys_inotify_init), // 291
LINX_(__NR_inotify_add_watch, sys_inotify_add_watch), // 292
LINX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 293
@@ -951,11 +952,10 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_(__NR_unshare, sys_unshare), // 310
LINX_(__NR_set_robust_list, sys_set_robust_list), // 311
LINXY(__NR_get_robust_list, sys_get_robust_list), // 312
-// LINX_(__NR_splice, sys_ni_syscall), // 313
+ LINX_(__NR_splice, sys_splice), // 313
// LINX_(__NR_sync_file_range, sys_sync_file_range), // 314
-
-// LINX_(__NR_tee, sys_ni_syscall), // 315
-// LINX_(__NR_vmsplice, sys_ni_syscall), // 316
+ LINX_(__NR_tee, sys_tee), // 315
+ LINXY(__NR_vmsplice, sys_vmsplice), // 316
LINXY(__NR_move_pages, sys_move_pages), // 317
LINX_(__NR_utimensat, sys_utimensat), // 320
@@ -1016,7 +1016,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_getrandom, sys_getrandom), // 384
LINXY(__NR_memfd_create, sys_memfd_create), // 385
-
+ LINXY(__NR_bpf, sys_bpf), // 386
LINX_(__NR_execveat, sys_execveat), // 387
LINXY(__NR_userfaultfd, sys_userfaultfd), // 388
@@ -1065,15 +1065,21 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_close_range, sys_close_range), // 436
LINXY(__NR_openat2, sys_openat2), // 437
LINXY(__NR_pidfd_getfd, sys_pidfd_getfd), // 438
- LINX_(__NR_faccessat2, sys_faccessat2), // 439
-
+ LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+ LINX_(__NR_mount_setattr, sys_mount_setattr), // 442
+ LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443
LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445
LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446
+ LINX_(__NR_futex_waitv, sys_futex_waitv), // 449
+ LINXY(__NR_cachestat, sys_cachestat), // 451
LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
+ LINXY(__NR_statmount, sys_statmount), // 457
+ LINXY(__NR_listmount, sys_listmount), // 458
+ LINX_(__NR_mseal, sys_mseal), // 462
};
diff --git a/coregrind/m_syswrap/syswrap-arm64-freebsd.c b/coregrind/m_syswrap/syswrap-arm64-freebsd.c
index d90cf212ba..29f5455c5c 100644
--- a/coregrind/m_syswrap/syswrap-arm64-freebsd.c
+++ b/coregrind/m_syswrap/syswrap-arm64-freebsd.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -202,20 +202,18 @@ PRE(sys_preadv)
SARG1, ARG2, SARG3, SARG4);
PRE_REG_READ4(ssize_t, "preadv", int, fd, const struct iovec*, iov, int,
iovcnt, vki_off_t, offset);
- if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) {
+ if (!ML_(fd_allowed)(ARG1, "preadv", tid, False))
SET_STATUS_Failure(VKI_EBADF);
- } else {
- if ((Int)ARG3 > 0) {
- PRE_MEM_READ("preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec));
- }
+ if ((Int)ARG3 > 0) {
+ PRE_MEM_READ("preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec));
+ }
- if (ML_(safe_to_deref)((struct vki_iovec*)ARG2,
- ARG3 * sizeof(struct vki_iovec))) {
- vec = (struct vki_iovec*)(Addr)ARG2;
- for (i = 0; i < (Int)ARG3; i++) {
- VG_(sprintf)(buf, "preadv(iov[%d])", i);
- PRE_MEM_WRITE(buf, (Addr)vec[i].iov_base, vec[i].iov_len);
- }
+ if (ML_(safe_to_deref)((struct vki_iovec*)ARG2,
+ ARG3 * sizeof(struct vki_iovec))) {
+ vec = (struct vki_iovec*)(Addr)ARG2;
+ for (i = 0; i < (Int)ARG3; i++) {
+ VG_(sprintf)(buf, "preadv(iov[%d])", i);
+ PRE_MEM_WRITE(buf, (Addr)vec[i].iov_base, vec[i].iov_len);
}
}
}
@@ -259,17 +257,16 @@ PRE(sys_pwritev)
iovcnt, vki_off_t, offset);
if (!ML_(fd_allowed)(ARG1, "pwritev", tid, False)) {
SET_STATUS_Failure(VKI_EBADF);
- } else {
- if ((Int)ARG3 >= 0) {
- PRE_MEM_READ("pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec));
- }
- if (ML_(safe_to_deref)((struct vki_iovec*)ARG2,
- ARG3 * sizeof(struct vki_iovec))) {
- vec = (struct vki_iovec*)(Addr)ARG2;
- for (i = 0; i < (Int)ARG3; i++) {
- VG_(sprintf)(buf, "pwritev(iov[%d])", i);
- PRE_MEM_READ(buf, (Addr)vec[i].iov_base, vec[i].iov_len);
- }
+ }
+ if ((Int)ARG3 >= 0) {
+ PRE_MEM_READ("pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec));
+ }
+ if (ML_(safe_to_deref)((struct vki_iovec*)ARG2,
+ ARG3 * sizeof(struct vki_iovec))) {
+ vec = (struct vki_iovec*)(Addr)ARG2;
+ for (i = 0; i < (Int)ARG3; i++) {
+ VG_(sprintf)(buf, "pwritev(iov[%d])", i);
+ PRE_MEM_READ(buf, (Addr)vec[i].iov_base, vec[i].iov_len);
}
}
}
@@ -287,7 +284,8 @@ PRE(sys_sendfile)
SARG1, SARG2, ARG3, ARG4, ARG5, ARG6, SARG7);
PRE_REG_READ7(int, "sendfile", int, fd, int, s, vki_off_t, offset, size_t,
nbytes, void*, hdtr, vki_off_t*, sbytes, int, flags);
-
+ if (!ML_(fd_allowed)(ARG1, "sendfile", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
if (ARG5 != 0) {
PRE_MEM_READ("sendfile(hdtr)", ARG5, sizeof(struct vki_sf_hdtr));
}
@@ -659,9 +657,8 @@ PRE(sys_pread)
if (!ML_(fd_allowed)(ARG1, "read", tid, False)) {
SET_STATUS_Failure(VKI_EBADF);
- } else {
- PRE_MEM_WRITE("pread(buf)", ARG2, ARG3);
}
+ PRE_MEM_WRITE("pread(buf)", ARG2, ARG3);
}
POST(sys_pread)
@@ -721,6 +718,8 @@ PRE(sys_lseek)
ARG1, ARG2, ARG3);
PRE_REG_READ3(long, "lseek", unsigned int, fd, unsigned long, offset,
unsigned int, whence);
+ if (!ML_(fd_allowed)(ARG1, "lseek", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_truncate 479
@@ -741,6 +740,8 @@ PRE(sys_ftruncate)
*flags |= SfMayBlock;
PRINT("sys_ftruncate ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2);
PRE_REG_READ2(long, "ftruncate", unsigned int, fd, unsigned long, length);
+ if (!ML_(fd_allowed)(ARG1, "ftruncate", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_cpuset_setid 485
@@ -814,6 +815,8 @@ PRE(sys_posix_fallocate)
SARG1, ARG2, ARG3);
PRE_REG_READ3(long, "posix_fallocate", int, fd, vki_off_t, offset, vki_off_t,
len);
+ if (!ML_(fd_allowed)(ARG1, "posix_fallocate", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_posix_fadvise 531
@@ -825,7 +828,8 @@ PRE(sys_posix_fadvise)
SARG1, ARG2, ARG3, SARG4);
PRE_REG_READ4(long, "posix_fadvise", int, fd, off_t, offset, off_t, len, int,
advice);
- // @todo PJF advice can be 0 to 5 inclusive
+ if (!ML_(fd_allowed)(ARG1, "posix_faadvise", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_wait6 532
@@ -951,6 +955,7 @@ PRE(sys_mknodat)
PRE_REG_READ4(long, "mknodat", int, fd, const char*, path, vki_mode_t, mode,
vki_dev_t, dev);
PRE_MEM_RASCIIZ("mknodat(pathname)", ARG2);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mknodat", tid, status);
}
// SYS_cpuset_getdomain 561
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
index c8bb486c4b..418c78443f 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -623,7 +623,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_pselect6, sys_pselect6), // 72
LINXY(__NR_ppoll, sys_ppoll), // 73
LINXY(__NR_signalfd4, sys_signalfd4), // 74
- LINX_(__NR_vmsplice, sys_vmsplice), // 75
+ LINXY(__NR_vmsplice, sys_vmsplice), // 75
LINX_(__NR_splice, sys_splice), // 76
LINX_(__NR_tee, sys_tee), // 77
LINXY(__NR_readlinkat, sys_readlinkat), // 78
@@ -710,7 +710,7 @@ static SyscallTableEntry syscall_main_table[] = {
GENX_(__NR_setgroups, sys_setgroups), // 159
GENXY(__NR_uname, sys_newuname), // 160
GENX_(__NR_sethostname, sys_sethostname), // 161
- // (__NR_setdomainname, sys_ni_syscall), // 162
+ LINX_(__NR_setdomainname, sys_setdomainname), // 162
GENXY(__NR_getrlimit, sys_old_getrlimit), // 163
GENX_(__NR_setrlimit, sys_setrlimit), // 164
GENXY(__NR_getrusage, sys_getrusage), // 165
@@ -772,8 +772,8 @@ static SyscallTableEntry syscall_main_table[] = {
GENX_(__NR_execve, sys_execve), // 221
PLAX_(__NR_mmap, sys_mmap), // 222
PLAX_(__NR_fadvise64, sys_fadvise64), // 223
- // (__NR_swapon, sys_swapon), // 224
- // (__NR_swapoff, sys_swapoff), // 225
+ LINX_(__NR_swapon, sys_swapon), // 224
+ LINX_(__NR_swapoff, sys_swapoff), // 225
GENXY(__NR_mprotect, sys_mprotect), // 226
GENX_(__NR_msync, sys_msync), // 227
GENX_(__NR_mlock, sys_mlock), // 228
@@ -782,7 +782,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_(__NR_munlockall, sys_munlockall), // 231
GENXY(__NR_mincore, sys_mincore), // 232
GENX_(__NR_madvise, sys_madvise), // 233
- // (__NR_remap_file_pages, sys_ni_syscall) // 234
+ LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 234
LINX_(__NR_mbind, sys_mbind), // 235
LINXY(__NR_get_mempolicy, sys_get_mempolicy), // 236
LINX_(__NR_set_mempolicy, sys_set_mempolicy), // 237
@@ -846,14 +846,21 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+ LINX_(__NR_mount_setattr, sys_mount_setattr), // 442
+ LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443
LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445
LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446
LINXY(__NR_memfd_secret, sys_memfd_secret), // 447
+ LINX_(__NR_futex_waitv, sys_futex_waitv), // 449
+ LINXY(__NR_cachestat, sys_cachestat), // 451
LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
+ LINXY(__NR_statmount, sys_statmount), // 457
+ LINXY(__NR_listmount, sys_listmount), // 458
+ LINX_(__NR_mseal, sys_mseal), // 462
};
diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c
index 8aaf8fc833..de8c37fc3e 100644
--- a/coregrind/m_syswrap/syswrap-darwin.c
+++ b/coregrind/m_syswrap/syswrap-darwin.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1940,6 +1940,7 @@ PRE(kqueue)
POST(kqueue)
{
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "kqueue", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -1970,6 +1971,7 @@ PRE(guarded_kqueue_np)
POST(guarded_kqueue_np)
{
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "guarded_kqueue_np", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -2083,18 +2085,18 @@ PRE(bsdthread_register)
pthread_starter = ARG1;
wqthread_starter = ARG2;
pthread_structsize = ARG3;
- #if DARWIN_VERS >= DARWIN_10_12
- typedef struct {
+#if DARWIN_VERS >= DARWIN_10_12
+ typedef struct {
uint64_t version;
uint64_t dispatch_queue_offset;
uint64_t main_qos;
uint32_t tsd_offset;
uint32_t return_to_kernel_offset;
uint32_t mach_thread_self_offset;
- } __attribute__ ((packed)) _pthread_registration_data;
+ } __attribute__ ((packed)) _pthread_registration_data;
- pthread_tsd_offset = ((_pthread_registration_data*) ARG4)->tsd_offset;
- #endif
+ pthread_tsd_offset = ((_pthread_registration_data*) ARG4)->tsd_offset;
+#endif
ARG1 = (Word)&pthread_hijack_asm;
ARG2 = (Word)&wqthread_hijack_asm;
}
@@ -2140,6 +2142,7 @@ PRE(workq_ops)
// GrP fixme need anything here?
// GrP fixme may block?
break;
+ case VKI_WQOPS_THREAD_KEVENT_RETURN:
case VKI_WQOPS_THREAD_RETURN: {
// The interesting case. The kernel will do one of two things:
// 1. Return normally. We continue; libc proceeds to stop the thread.
@@ -2169,10 +2172,6 @@ PRE(workq_ops)
// JRS uh, looks like it queues up a bunch of threads, or some such?
*flags |= SfMayBlock; // the kernel sources take a spinlock, so play safe
break;
- case VKI_WQOPS_THREAD_KEVENT_RETURN:
- // RK fixme need anything here?
- // perhaps similar to VKI_WQOPS_THREAD_RETURN above?
- break;
case VKI_WQOPS_SET_EVENT_MANAGER_PRIORITY:
// RK fixme this just sets scheduling priorities - don't think we need
// to do anything here
@@ -2410,6 +2409,8 @@ PRE(__pthread_fchdir)
{
PRINT("__pthread_fchdir ( %lu )", ARG1);
PRE_REG_READ1(long, "__pthread_fchdir", unsigned int, fd);
+ if (!ML_(fd_allowed)(ARG1, "__pthread_chdir", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
@@ -2525,6 +2526,8 @@ PRE(fgetxattr)
PRE_REG_READ6(vki_ssize_t, "fgetxattr",
int, fd, char *, name, void *, value,
vki_size_t, size, uint32_t, position, int, options);
+ if (!ML_(fd_allowed)(ARG1, "fgetxattr", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_RASCIIZ("getxattr(name)", ARG2);
PRE_MEM_WRITE( "getxattr(value)", ARG3, ARG4);
}
@@ -2556,7 +2559,8 @@ PRE(fsetxattr)
PRE_REG_READ6(int, "fsetxattr",
int,"fd", char *,"name", void *,"value",
vki_size_t,"size", uint32_t,"position", int,"options" );
-
+ if (!ML_(fd_allowed)(ARG1, "fsetxattr", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_RASCIIZ( "fsetxattr(name)", ARG2 );
PRE_MEM_READ( "fsetxattr(value)", ARG3, ARG4 );
}
@@ -2579,6 +2583,8 @@ PRE(fremovexattr)
SARG1, ARG2, (HChar*)ARG2, SARG3 );
PRE_REG_READ3(int, "fremovexattr",
int, "fd", char*, "attrname", int, "options");
+ if (!ML_(fd_allowed)(ARG1, "fremovextattr", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_RASCIIZ( "removexattr(attrname)", ARG2 );
}
@@ -2610,6 +2616,8 @@ PRE(flistxattr)
PRE_REG_READ4 (long, "flistxattr",
int, "fd", char *,"namebuf",
vki_size_t,"size", int,"options" );
+ if (!ML_(fd_allowed)(ARG1, "flistxtattr", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_WRITE( "flistxattr(namebuf)", ARG2, ARG3 );
*flags |= SfMayBlock;
}
@@ -2681,6 +2689,7 @@ PRE(shm_open)
POST(shm_open)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "shm_open", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -9846,29 +9855,23 @@ POST(getattrlistbulk)
PRE(faccessat)
{
- uint32_t fd = ARG1;
+ Int fd = ARG1;
PRINT("faccessat(fd:%d, path:%#lx(%s), amode:%#lx, flag:%#lx)",
fd, ARG2, ARG2 ? (HChar*)ARG2 : "null", ARG3, ARG4);
PRE_REG_READ4(int, "faccessat",
int, fd, user_addr_t, path, int, amode, int, flag);
-
- if (fd != VKI_AT_FDCWD && !ML_(fd_allowed)(fd, "faccessat", tid, False)) {
- SET_STATUS_Failure( VKI_EBADF );
- }
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "faccessat", tid, status);
PRE_MEM_RASCIIZ( "faccessat(path)", ARG2 );
}
PRE(fstatat64)
{
- uint32_t fd = ARG1;
+ Int fd = ARG1;
PRINT("fstatat64(fd:%d, path:%#lx(%s), ub:%#lx, flag:%#lx)",
fd, ARG2, ARG2 ? (HChar*)ARG2 : "null", ARG3, ARG4);
PRE_REG_READ4(int, "fstatat64",
int, fd, user_addr_t, path, user_addr_t, ub, int, flag);
-
- if (fd != VKI_AT_FDCWD && !ML_(fd_allowed)(fd, "fstatat64", tid, False)) {
- SET_STATUS_Failure( VKI_EBADF );
- }
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat64", tid, status);
PRE_MEM_RASCIIZ( "fstatat64(path)", ARG2 );
PRE_MEM_WRITE( "fstatat64(ub)", ARG3, sizeof(struct vki_stat64) );
}
@@ -9879,25 +9882,24 @@ POST(fstatat64)
PRE(readlinkat)
{
- Word saved = SYSNO;
-
PRINT("readlinkat ( %ld, %#lx(%s), %#lx, %ld )",
SARG1, ARG2, (HChar*)ARG2, ARG3, SARG4);
PRE_REG_READ4(long, "readlinkat",
int, dfd, const char *, path, char *, buf, int, bufsiz);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "readlinkat", tid, status);
PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 );
PRE_MEM_WRITE( "readlinkat(buf)", ARG3,ARG4 );
/*
- * Refer to coregrind/m_syswrap/syswrap-linux.c
+ * Linux needs to jump through hoops to check for accesses to things liks
+ * /proc/PID/self
+ * Darwin does not have proc so no need here
*/
- {
- /* Normal case */
- SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, ARG2, ARG3, ARG4));
- }
-
- if (SUCCESS && RES > 0)
- POST_MEM_WRITE( ARG3, RES );
+}
+
+POST(readlinkat)
+{
+ POST_MEM_WRITE( ARG3, RES );
}
PRE(bsdthread_ctl)
@@ -9995,11 +9997,7 @@ PRE(openat)
/* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD,
filename is relative to cwd. When comparing dfd against AT_FDCWD,
be sure only to compare the bottom 32 bits. */
- if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 )
- && *(Char *)(Addr)ARG2 != '/'
- && ((Int)ARG1) != ((Int)VKI_AT_FDCWD)
- && !ML_(fd_allowed)(ARG1, "openat", tid, False))
- SET_STATUS_Failure( VKI_EBADF );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "openat", tid, status);
/* Otherwise handle normally */
*flags |= SfMayBlock;
@@ -10008,6 +10006,7 @@ PRE(openat)
POST(openat)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "openat", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -10022,6 +10021,7 @@ PRE(mkdirat)
PRINT("mkdirat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3);
PRE_REG_READ3(int, "mkdirat",
int, fd, const char *, path, unsigned int, mode);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mkdirat", tid, status);
PRE_MEM_RASCIIZ( "mkdirat(path)", ARG2 );
*flags |= SfMayBlock;
}
@@ -10479,18 +10479,16 @@ PRE(openat_nocancel)
/* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD,
filename is relative to cwd. When comparing dfd against AT_FDCWD,
be sure only to compare the bottom 32 bits. */
- if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 )
- && *(Char *)(Addr)ARG2 != '/'
- && ((Int)ARG1) != ((Int)VKI_AT_FDCWD)
- && !ML_(fd_allowed)(ARG1, "openat_nocancel", tid, False))
- SET_STATUS_Failure( VKI_EBADF );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "openat_nocancel", tid, status);
/* Otherwise handle normally */
*flags |= SfMayBlock;
}
+
POST(openat_nocancel)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "openat_nocancel", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -11100,7 +11098,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
#endif
MACX_(__NR_faccessat, faccessat), // 466
MACXY(__NR_fstatat64, fstatat64), // 470
- MACX_(__NR_readlinkat, readlinkat), // 473
+ MACXY(__NR_readlinkat, readlinkat), // 473
MACX_(__NR_bsdthread_ctl, bsdthread_ctl), // 478
MACXY(__NR_csrctl, csrctl), // 483
MACX_(__NR_guarded_open_dprotected_np, guarded_open_dprotected_np), // 484
diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c
index 8fcfe10904..0832633213 100644
--- a/coregrind/m_syswrap/syswrap-freebsd.c
+++ b/coregrind/m_syswrap/syswrap-freebsd.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -899,6 +899,8 @@ PRE(sys_fchflags)
{
PRINT("sys_fchflags ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1,ARG2);
PRE_REG_READ2(int, "fchflags", int, fd, unsigned long, flags);
+ if (!ML_(fd_allowed)(ARG1, "fchflags", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_sync 36
@@ -916,15 +918,15 @@ PRE(sys_fchflags)
// Pipe on freebsd doesn't have args, and uses dual returns!
// SYS_freebsd10_pipe 42
// int pipe(void);
-PRE(sys_pipe)
+PRE(sys_freebsd10_pipe)
{
- PRINT("%s", "sys_pipe ()");
+ PRINT("%s", "sys_freebsd10_pipe ()");
}
-POST(sys_pipe)
+POST(sys_freebsd10_pipe)
{
- if (!ML_(fd_allowed)(RES, "pipe", tid, True) ||
- !ML_(fd_allowed)(RESHI, "pipe", tid, True)) {
+ if (!ML_(fd_allowed)(RES, "freebsd10_pipe", tid, True) ||
+ !ML_(fd_allowed)(RESHI, "freebsd10_pipe", tid, True)) {
VG_(close)(RES);
VG_(close)(RESHI);
SET_STATUS_Failure( VKI_EMFILE );
@@ -988,6 +990,8 @@ PRE(sys_ioctl)
PRINT("sys_ioctl ( %" FMT_REGWORD "u, 0x%" FMT_REGWORD "x, %#" FMT_REGWORD "x )",ARG1,ARG2,ARG3);
PRE_REG_READ3(int, "ioctl",
int, fd, unsigned long, request, unsigned long, arg);
+ if (!ML_(fd_allowed)(ARG1, "ioctl", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
switch (ARG2 /* request */) {
/* Handle specific ioctls which pass structures which may have pointers to other
@@ -1179,7 +1183,8 @@ PRE(sys_revoke)
// SYS_symlink 57
// generic
-static void do_readlink(const HChar* path, HChar *buf, SizeT bufsize, SyscallStatus* status, Bool* curproc_file)
+// returns whether caller needs to set SfMayBlock in flags
+static Bool do_readlink(const HChar* path, HChar *buf, SizeT bufsize, SyscallStatus* status)
{
HChar name[30];
VG_(sprintf)(name, "/proc/%d/file", VG_(getpid)());
@@ -1187,43 +1192,32 @@ static void do_readlink(const HChar* path, HChar *buf, SizeT bufsize, SyscallSta
&& (VG_(strcmp)(path, name) == 0
|| VG_(strcmp)(path, "/proc/curproc/file") == 0)) {
vg_assert(VG_(resolved_exename));
- Int len = VG_(snprintf)(buf, bufsize, "%s", VG_(resolved_exename));
+ Int len = VG_(snprintf)(buf, bufsize, "%s", VG_(resolved_exename)) + 1;
SET_STATUS_Success(len);
- *curproc_file = True;
+ return False;
}
+ return True;
}
// SYS_readlink 58
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsiz);
PRE(sys_readlink)
{
- FUSE_COMPATIBLE_MAY_BLOCK();
- Word saved = SYSNO;
- Bool curproc_file = False;
-
PRINT("sys_readlink ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %llu )",
ARG1, (char*)(Addr)ARG1, ARG2, (ULong)ARG3);
PRE_REG_READ3(long, "readlink",
const char *, path, char *, buf, int, bufsiz);
- PRE_MEM_RASCIIZ( "readlink(path)", ARG1 );
- PRE_MEM_WRITE( "readlink(buf)", ARG2,ARG3 );
+ PRE_MEM_RASCIIZ("readlink(path)", ARG1);
+ PRE_MEM_WRITE("readlink(buf)", ARG2, ARG3);
- if (VG_(have_slash_proc) == True)
- {
- /*
- * Handle the case where readlink is looking at /proc/curproc/file or
- * /proc//file
- */
- do_readlink((const HChar *)ARG1, (HChar *)ARG2, (SizeT)ARG3, status, &curproc_file);
+ if (VG_(have_slash_proc) == False || do_readlink((const HChar *)ARG1, (HChar *)ARG2, (SizeT)ARG3, status)) {
+ *flags |= SfMayBlock;
}
+}
- if (!curproc_file) {
- /* Normal case */
- SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, ARG1, ARG2, ARG3));
- }
- if (SUCCESS && RES > 0) {
- POST_MEM_WRITE( ARG2, RES );
- }
+POST(sys_readlink)
+{
+ POST_MEM_WRITE(ARG2, RES);
}
// SYS_execve 59
@@ -1401,9 +1395,8 @@ PRE(sys_fcntl)
I_die_here;
}
- if (!ML_(fd_allowed)(ARG1, "fcntl", tid, False)) {
+ if (!ML_(fd_allowed)(ARG1, "fcntl", tid, False))
SET_STATUS_Failure (VKI_EBADF);
- }
}
POST(sys_fcntl)
@@ -1795,9 +1788,9 @@ PRE(sys_seteuid)
PRE(sys_freebsd11_stat)
{
PRINT("sys_freebsd11_stat ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",ARG1,(char *)ARG1,ARG2);
- PRE_REG_READ2(int, "stat", char *, path, struct freebsd11_stat *, sb);
- PRE_MEM_RASCIIZ( "stat(path)", ARG1 );
- PRE_MEM_WRITE( "stat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
+ PRE_REG_READ2(int, "freebsd11_stat", char *, path, struct freebsd11_stat *, sb);
+ PRE_MEM_RASCIIZ( "freebsd11_stat(path)", ARG1 );
+ PRE_MEM_WRITE( "freebsd11_stat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
}
POST(sys_freebsd11_stat)
@@ -1810,8 +1803,10 @@ POST(sys_freebsd11_stat)
PRE(sys_freebsd11_fstat)
{
PRINT("sys_freebsd11_fstat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",SARG1,ARG2);
- PRE_REG_READ2(int, "fstat", int, fd, struct stat *, sb);
- PRE_MEM_WRITE( "fstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
+ PRE_REG_READ2(int, "freebsd11_fstat", int, fd, struct stat *, sb);
+ if (!ML_(fd_allowed)(ARG1, "freebsd11_fstat", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
+ PRE_MEM_WRITE( "freebsd11_fstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
}
POST(sys_freebsd11_fstat)
@@ -1824,9 +1819,9 @@ POST(sys_freebsd11_fstat)
PRE(sys_freebsd11_lstat)
{
PRINT("sys_freebsd11_lstat ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",ARG1,(char *)ARG1,ARG2);
- PRE_REG_READ2(sb, "lstat", const char *, path, struct freebsd11_stat *, sb);
- PRE_MEM_RASCIIZ( "lstat(path)", ARG1 );
- PRE_MEM_WRITE( "lstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
+ PRE_REG_READ2(sb, "freebsd11_lstat", const char *, path, struct freebsd11_stat *, sb);
+ PRE_MEM_RASCIIZ( "freebsd11_lstat(path)", ARG1 );
+ PRE_MEM_WRITE( "freebsd11_lstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
}
POST(sys_freebsd11_lstat)
@@ -1852,6 +1847,8 @@ PRE(sys_fpathconf)
{
PRINT("sys_fpathconf ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )",ARG1,ARG2);
PRE_REG_READ2(long, "fpathconf", int, fd, int, name);
+ if (!ML_(fd_allowed)(ARG1, "fpathconf", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_getrlimit 194
@@ -1867,13 +1864,15 @@ PRE(sys_freebsd11_getdirentries)
{
*flags |= SfMayBlock;
PRINT("sys_freebsd11_getdirentries ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", ARG1,ARG2,ARG3);
- PRE_REG_READ4(int, "getdirentries",
+ PRE_REG_READ4(int, "freebsd11_getdirentries",
int, fd, char *, buf,
int, nbytes,
long *, basep);
- PRE_MEM_WRITE( "getdirentries(buf)", ARG2, ARG3 );
+ if (!ML_(fd_allowed)(ARG1, "freebsd11_getdirentries", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
+ PRE_MEM_WRITE( "freebsd11_getdirentries(buf)", ARG2, ARG3 );
if (ARG4) {
- PRE_MEM_WRITE( "getdirentries(basep)", ARG4, sizeof(long) );
+ PRE_MEM_WRITE( "freebsd11_getdirentries(basep)", ARG4, sizeof(long) );
}
}
@@ -1927,29 +1926,40 @@ static void sysctl_kern_usrstack(SizeT* out, SizeT* outlen)
*outlen = sizeof(ULong);
}
-static Bool sysctl_kern_proc_pathname(HChar *out, SizeT *len)
+static Int sysctl_kern_proc_pathname(HChar *out, SizeT *len)
{
const HChar *exe_name = VG_(resolved_exename);
+ // assert that exe_name is an absolute path
+ vg_assert(exe_name && exe_name[0] == '/');
if (!len) {
- return False;
+ return VKI_ENOMEM;
}
+ if (!ML_(safe_to_deref)(len, sizeof(len))) {
+ // ???? check
+ return VKI_ENOMEM;
+ }
+
+ SizeT exe_name_length = VG_(strlen)(exe_name)+1;
if (!out) {
- HChar tmp[VKI_PATH_MAX];
- if (!VG_(realpath)(exe_name, tmp)) {
- return False;
- }
- *len = VG_(strlen)(tmp)+1;
- return True;
+ *len = exe_name_length;
+ return 0;
}
- if (!VG_(realpath)(exe_name, out)) {
- return False;
+ if (*len < exe_name_length) {
+ return VKI_ENOMEM;
}
- *len = VG_(strlen)(out)+1;
- return True;
+ if (ML_(safe_to_deref)(out, exe_name_length)) {
+ VG_(strncpy)(out, exe_name, exe_name_length);
+ } else {
+ // ???? check
+ return VKI_EFAULT;
+ }
+
+ *len = exe_name_length;
+ return 0;
}
// SYS___sysctl 202
@@ -2031,7 +2041,7 @@ PRE(sys___sysctl)
if (SARG2 == 2 && ML_(safe_to_deref)(name, 2*sizeof(int))) {
if (name[0] == 1 && name[1] == 32) {
if (sysctl_kern_ps_strings((SizeT*)ARG3, (SizeT*)ARG4)) {
- SET_STATUS_Success(0);
+ SET_STATUS_Success(0);
}
}
}
@@ -2043,8 +2053,12 @@ PRE(sys___sysctl)
if (name[0] == 1 && name[1] == 14 && name[2] == 12) {
vki_pid_t pid = (vki_pid_t)name[3];
if (pid == -1 || pid == VG_(getpid)()) {
- sysctl_kern_proc_pathname((HChar *)ARG3, (SizeT *)ARG4);
- SET_STATUS_Success(0);
+ int res = sysctl_kern_proc_pathname((HChar *)ARG3, (SizeT *)ARG4);
+ if (res == 0) {
+ SET_STATUS_Success(0);
+ } else {
+ SET_STATUS_Failure(res);
+ }
}
}
}
@@ -2082,8 +2096,10 @@ PRE(sys___sysctl)
if (ML_(safe_to_deref)((void*)(Addr)ARG4, sizeof(vki_size_t))) {
PRE_MEM_WRITE("sysctl(oldp)", (Addr)ARG3, *(vki_size_t *)ARG4);
} else {
- VG_(dmsg)("Warning: Bad oldlenp address %p in sysctl\n",
- (void *)(Addr)ARG4);
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(dmsg)("Warning: Bad oldlenp address %p in sysctl\n",
+ (void *)(Addr)ARG4);
+ }
SET_STATUS_Failure ( VKI_EFAULT );
}
} else {
@@ -2125,8 +2141,10 @@ PRE(sys_undelete)
// int futimes(int fd, const struct timeval *times);
PRE(sys_futimes)
{
- PRINT("sys_lutimes ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1,ARG2);
+ PRINT("sys_futimes ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1,ARG2);
PRE_REG_READ2(long, "futimes", int, fd, struct timeval *, times);
+ if (!ML_(fd_allowed)(ARG1, "futimes", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
if (ARG2 != 0) {
PRE_MEM_READ( "futimes(times)", ARG2, sizeof(struct vki_timeval) );
}
@@ -2151,9 +2169,9 @@ PRE(sys_freebsd7___semctl)
case VKI_GETALL:
case VKI_SETALL:
PRINT("sys_freebsd7___semctl ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )",ARG1,ARG2,ARG3,ARG4);
- PRE_REG_READ4(int, "semctl",
+ PRE_REG_READ4(int, "freebsd7___semctl",
int, semid, int, semnum, int, cmd, union vki_semun *, arg);
- PRE_MEM_READ("sys_freebsd7___semctl(arg)", ARG4, sizeof(union vki_semun));
+ PRE_MEM_READ("freebsd7___semctl(arg)", ARG4, sizeof(union vki_semun));
semun = (union vki_semun*)ARG4;
if (ML_(safe_to_deref)(semun, sizeof(*semun))) {
ARG4 = (RegWord)semun;
@@ -2162,7 +2180,7 @@ PRE(sys_freebsd7___semctl)
break;
default:
PRINT("sys_freebsd7___semctl ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" FMT_REGWORD "u )",ARG1,ARG2,ARG3);
- PRE_REG_READ3(long, "semctl",
+ PRE_REG_READ3(long, "freebsd7___semctl",
int, semid, int, semnum, int, cmd);
break;
}
@@ -2204,15 +2222,15 @@ PRE(sys_freebsd7_msgctl)
{
PRINT("sys_freebsd7_msgctl ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1,SARG2,ARG3 );
- PRE_REG_READ3(int, "msgctl", int, msqid, int, cmd, struct msqid_ds_old *, buf);
+ PRE_REG_READ3(int, "freebsd7_msgctl", int, msqid, int, cmd, struct msqid_ds_old *, buf);
switch (ARG2 /* cmd */) {
case VKI_IPC_STAT:
- PRE_MEM_WRITE( "msgctl(IPC_STAT, buf)",
+ PRE_MEM_WRITE( "freebsd7_msgctl(IPC_STAT, buf)",
ARG3, sizeof(struct vki_msqid_ds_old) );
break;
case VKI_IPC_SET:
- PRE_MEM_READ( "msgctl(IPC_SET, buf)",
+ PRE_MEM_READ( "freebsd7_msgctl(IPC_SET, buf)",
ARG3, sizeof(struct vki_msqid_ds_old) );
break;
}
@@ -2294,15 +2312,15 @@ POST(sys_shmat)
PRE(sys_freebsd7_shmctl)
{
PRINT("sys_freebsd7_shmctl ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",SARG1,SARG2,ARG3);
- PRE_REG_READ3(int, "shmctl",
+ PRE_REG_READ3(int, "freebsd7_shmctl",
int, shmid, int, cmd, struct vki_shmid_ds_old *, buf);
switch (ARG2 /* cmd */) {
case VKI_IPC_STAT:
- PRE_MEM_WRITE( "shmctl7(IPC_STAT, buf)",
+ PRE_MEM_WRITE( "freebsd7_shmctl7(IPC_STAT, buf)",
ARG3, sizeof(struct vki_shmid_ds_old) );
break;
case VKI_IPC_SET:
- PRE_MEM_READ( "shmctl7(IPC_SET, buf)",
+ PRE_MEM_READ( "freebsd7_shmctl7(IPC_SET, buf)",
ARG3, sizeof(struct vki_shmid_ds_old) );
break;
}
@@ -2746,9 +2764,9 @@ POST(sys_fhopen)
PRE(sys_freebsd11_fhstat)
{
PRINT("sys_freebsd11_fhstat ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",ARG1,ARG2);
- PRE_REG_READ2(int, "fhstat", struct fhandle *, fhp, struct freebd11_stat *, sb);
- PRE_MEM_READ( "fhstat(fhp)", ARG1, sizeof(struct vki_fhandle) );
- PRE_MEM_WRITE( "fhstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
+ PRE_REG_READ2(int, "freebsd11_fhstat", struct fhandle *, fhp, struct freebd11_stat *, sb);
+ PRE_MEM_READ( "freebsd11_fhstat(fhp)", ARG1, sizeof(struct vki_fhandle) );
+ PRE_MEM_WRITE( "freebsd11_fhstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
}
POST(sys_freebsd11_fhstat)
@@ -2945,23 +2963,21 @@ PRE(sys_aio_cancel)
if (ARG2) {
PRE_MEM_READ("aio_cancel(iocb)", ARG2, sizeof(struct vki_aiocb));
}
- if (!ML_(fd_allowed)(ARG1, "aio_cancel", tid, False)) {
+ if (!ML_(fd_allowed)(ARG1, "aio_cancel", tid, False))
SET_STATUS_Failure(VKI_EBADF);
- } else {
- if (ARG2) {
- if (ML_(safe_to_deref)((struct vki_aiocb *)ARG2, sizeof(struct vki_aiocb))) {
- // struct vki_aiocb *iocb = (struct vki_aiocb *)ARG2;
- // @todo PJF cancel only requests associated with
- // fildes and iocb
- // Do I need to remove pending reads from iocb(v)_table
- // or should the user always call aio_return even after
- // aio_cancel?
- } else {
- SET_STATUS_Failure(VKI_EINVAL);
- }
+ if (ARG2) {
+ if (ML_(safe_to_deref)((struct vki_aiocb *)ARG2, sizeof(struct vki_aiocb))) {
+ // struct vki_aiocb *iocb = (struct vki_aiocb *)ARG2;
+ // @todo PJF cancel only requests associated with
+ // fildes and iocb
+ // Do I need to remove pending reads from iocb(v)_table
+ // or should the user always call aio_return even after
+ // aio_cancel?
} else {
- // @todo PJF cancel all requests associated with fildes, see above
+ SET_STATUS_Failure(VKI_EINVAL);
}
+ } else {
+ // @todo PJF cancel all requests associated with fildes, see above
}
}
@@ -3197,13 +3213,17 @@ PRE(sys_sigprocmask)
if (ARG2 != 0 &&
!ML_(safe_to_deref)((void *)(Addr)ARG2, sizeof(vki_sigset_t))) {
- VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n",
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n",
(void *)(Addr)ARG2);
+ }
SET_STATUS_Failure ( VKI_EFAULT );
} else if (ARG3 != 0 &&
!ML_(safe_to_deref)((void *)(Addr)ARG3, sizeof(vki_sigset_t))) {
- VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n",
- (void *)(Addr)ARG3);
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n",
+ (void *)(Addr)ARG3);
+ }
SET_STATUS_Failure ( VKI_EFAULT );
} else {
SET_STATUS_from_SysRes(VG_(do_sys_sigprocmask)(tid, ARG1 /*how*/,
@@ -3296,9 +3316,7 @@ PRE(sys_sigwaitinfo)
ARG1,ARG2);
PRE_REG_READ2(int, "sigwaitinfo",
const vki_sigset_t *, set, vki_siginfo_t *, info);
- if (ARG1 != 0) {
- PRE_MEM_READ( "sigwaitinfo(set)", ARG1, sizeof(vki_sigset_t));
- }
+ PRE_MEM_READ( "sigwaitinfo(set)", ARG1, sizeof(vki_sigset_t));
if (ARG2 != 0) {
PRE_MEM_WRITE( "sigwaitinfo(info)", ARG2, sizeof(vki_siginfo_t) );
}
@@ -3348,6 +3366,8 @@ PRE(sys___acl_get_fd)
PRINT("sys___acl_get_fd ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1,ARG2,ARG3);
PRE_REG_READ3(int, "acl_get_fd",
int, fd, int, type, struct vki_acl *, aclp);
+ if (!ML_(fd_allowed)(ARG1, "__acl_get_fd", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_WRITE( "acl_get_file(aclp)", ARG3, sizeof(struct vki_acl) );
}
@@ -3366,6 +3386,8 @@ PRE(sys___acl_set_fd)
PRINT("sys___acl_set_fd ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1,ARG2,ARG3);
PRE_REG_READ3(int, "acl_set_fd",
int, filedes, int, type, struct vki_acl *, aclp);
+ if (!ML_(fd_allowed)(ARG1, "__acl_set_fd", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_READ( "acl_get_file(aclp)", ARG3, sizeof(struct vki_acl) );
}
@@ -3385,6 +3407,8 @@ PRE(sys___acl_delete_fd)
PRINT("sys___acl_delete_fd ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1,ARG2);
PRE_REG_READ2(int, "acl_delete_fd",
int, filedes, int, acltype);
+ if (!ML_(fd_allowed)(ARG1, "__acl_delete_fd", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS___acl_aclcheck_file 353
@@ -3405,6 +3429,8 @@ PRE(sys___acl_aclcheck_fd)
PRINT("sys___acl_aclcheck_fd ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1,ARG2,ARG3);
PRE_REG_READ3(int, "acl_aclcheck_fd",
int, fd, int, type, struct vki_acl *, aclp);
+ if (!ML_(fd_allowed)(ARG1, "__acl_aclcheck_fd", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_READ( "acl_aclcheck_fd(aclp)", ARG3, sizeof(struct vki_acl) );
}
@@ -3558,21 +3584,23 @@ POST(sys_kqueue)
PRE(sys_freebsd11_kevent)
{
PRINT("sys_freebsd11_kevent ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )\n", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
- PRE_REG_READ6(int, "kevent",
+ PRE_REG_READ6(int, "freebsd11_kevent",
int, fd, const struct vki_kevent_freebsd11 *, changelist, int, nchanges,
struct vki_kevent_freebsd11 *, eventlist, int, nevents,
struct timespec *, timeout);
+ if (!ML_(fd_allowed)(ARG1, "freebsd11_kevent", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
if (ARG2 != 0 && ARG3 != 0) {
- PRE_MEM_READ( "kevent(changelist)", ARG2, sizeof(struct vki_kevent_freebsd11)*ARG3 );
+ PRE_MEM_READ( "freebsd11_kevent(changelist)", ARG2, sizeof(struct vki_kevent_freebsd11)*ARG3 );
}
if (ARG4 != 0 && ARG5 != 0) {
- PRE_MEM_WRITE( "kevent(eventlist)", ARG4, sizeof(struct vki_kevent_freebsd11)*ARG5);
+ PRE_MEM_WRITE( "freebsd11_kevent(eventlist)", ARG4, sizeof(struct vki_kevent_freebsd11)*ARG5);
}
if (ARG5 != 0) {
*flags |= SfMayBlock;
}
if (ARG6 != 0) {
- PRE_MEM_READ( "kevent(timeout)",
+ PRE_MEM_READ( "freebsd11_kevent(timeout)",
ARG6, sizeof(struct vki_timespec));
}
}
@@ -3594,6 +3622,8 @@ PRE(sys_extattr_set_fd)
{
PRINT("sys_extattr_set_fd ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1,SARG2,ARG3,ARG4,ARG5);
PRE_REG_READ5(int, "extattr_set_fd", int, fd, int, attrnamespace, const char *,attrname, const void *,data, size_t, nbytes);
+ if (!ML_(fd_allowed)(ARG1, "extattr_set_fd", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_RASCIIZ( "extattr_set_fd(attrname)", ARG3 );
PRE_MEM_READ("extattr_set_fd(data)", ARG4, ARG5);
}
@@ -3605,6 +3635,8 @@ PRE(sys_extattr_get_fd)
{
PRINT("sys_extattr_get_fd ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1,SARG2,ARG3,ARG4,ARG5);
PRE_REG_READ5(int, "extattr_get_fd", int, fd, int, attrnamespace, const char *,attrname, const void *,data, size_t, nbytes);
+ if (!ML_(fd_allowed)(ARG1, "extattr_get_fd", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_RASCIIZ( "extattr_get_fd(attrname)", ARG3 );
PRE_MEM_WRITE("extattr_get_fd(data)", ARG4, ARG5);
}
@@ -3620,6 +3652,8 @@ PRE(sys_extattr_delete_fd)
{
PRINT("sys_extattr_delete_fd ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1,SARG2,ARG3);
PRE_REG_READ3(int, "extattr_delete_fd", int, fd, int, attrnamespace, const char *,attrname);
+ if (!ML_(fd_allowed)(ARG1, "extattr_delete_fd", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_RASCIIZ( "extattr_delete_fd(attrname)", ARG3 );
}
@@ -3676,18 +3710,42 @@ PRE(sys_nmount)
PRE(sys_kenv)
{
PRINT("sys_kenv ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", ARG1,ARG2,ARG3,ARG4);
- PRE_REG_READ4(int, "kenv",
- int, action, const char *, name, char *, value, int, len);
switch (ARG1) {
case VKI_KENV_GET:
+ // read from arg1, write to arg2
+ PRE_REG_READ4(int, "kenv",
+ int, action, const char *, name, char *, value, int, len);
+ PRE_MEM_RASCIIZ("kenv(name)", ARG2);
+ PRE_MEM_WRITE("kenv(value)", ARG3, ARG4);
+ break;
case VKI_KENV_SET:
+ PRE_REG_READ3(int, "kenv",
+ int, action, const char *, name, char *, value);
+ PRE_MEM_RASCIIZ("kenv(name)", ARG2);
+ PRE_MEM_RASCIIZ("kenv(value)", ARG3);
+ break;
case VKI_KENV_UNSET:
+ PRE_REG_READ2(int, "kenv", int, action, const char *, name);
PRE_MEM_RASCIIZ("kenv(name)", ARG2);
- /* FALLTHROUGH */
+ break;
case VKI_KENV_DUMP:
+ case VKI_KENV_DUMP_LOADER:
+ case VKI_KENV_DUMP_STATIC:
+ PRRSN;
+ PRA1("kenv",int,action);
+ // ARG2 name is ignored
+ PRA3("kenv",char*,value);
+ PRA4("kenv",int,len);
+ if (ARG3) {
+ PRE_MEM_WRITE("kenv(value)", ARG3, ARG4);
+ }
break;
default:
- VG_(dmsg)("Warning: Bad action %" FMT_REGWORD "u in kenv\n", ARG1);
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(umsg)("Warning: bad or unimplemented kenv action: %" FMT_REGWORD "d\n",
+ SARG1);
+ }
+ break;
}
}
@@ -3699,7 +3757,7 @@ POST(sys_kenv)
POST_MEM_WRITE(ARG3, ARG4);
break;
case VKI_KENV_DUMP:
- if (ARG3 != (Addr)NULL) {
+ if (ARG3) {
POST_MEM_WRITE(ARG3, ARG4);
}
break;
@@ -3745,8 +3803,8 @@ POST(sys_uuidgen)
PRE(sys_freebsd11_getfsstat)
{
PRINT("sys_freebsd11_getfsstat ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %" FMT_REGWORD "u )",ARG1,ARG2,ARG3);
- PRE_REG_READ3(int, "getfsstat", struct vki_freebsd11_statfs *, buf, long, bufsize, int, mode);
- PRE_MEM_WRITE( "getfsstat(buf)", ARG1, ARG2 );
+ PRE_REG_READ3(int, "freebsd11_getfsstat", struct vki_freebsd11_statfs *, buf, long, bufsize, int, mode);
+ PRE_MEM_WRITE( "freebsd11_getfsstat(buf)", ARG1, ARG2 );
}
POST(sys_freebsd11_getfsstat)
@@ -3761,10 +3819,10 @@ POST(sys_freebsd11_getfsstat)
// int statfs(const char *path, struct statfs *buf);
PRE(sys_freebsd11_statfs)
{
- PRINT("sys_statfs ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",ARG1,(char *)ARG1,ARG2);
- PRE_REG_READ2(int, "statfs", const char *, path, struct statfs *, buf);
- PRE_MEM_RASCIIZ( "statfs(path)", ARG1 );
- PRE_MEM_WRITE( "statfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) );
+ PRINT("sys_freebsd11_statfs ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",ARG1,(char *)ARG1,ARG2);
+ PRE_REG_READ2(int, "freebsd11_statfs", const char *, path, struct statfs *, buf);
+ PRE_MEM_RASCIIZ( "freebsd11_statfs(path)", ARG1 );
+ PRE_MEM_WRITE( "freebsd11_statfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) );
}
POST(sys_freebsd11_statfs)
@@ -3776,10 +3834,12 @@ POST(sys_freebsd11_statfs)
// int fstatfs(int fd, struct statfs *buf);
PRE(sys_freebsd11_fstatfs)
{
- PRINT("sys_fstatfs ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )",ARG1,ARG2);
- PRE_REG_READ2(int, "fstatfs",
+ PRINT("sys_freebsd11_fstatfs ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )",ARG1,ARG2);
+ PRE_REG_READ2(int, "freebsd11_fstatfs",
unsigned int, fd, struct statfs *, buf);
- PRE_MEM_WRITE( "fstatfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) );
+ if (!ML_(fd_allowed)(ARG1, "freebsd11_fstatfs", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
+ PRE_MEM_WRITE( "freebsd11_fstatfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) );
}
POST(sys_freebsd11_fstatfs)
@@ -3791,11 +3851,11 @@ POST(sys_freebsd11_fstatfs)
// int fhstatfs(const fhandle_t *fhp, struct statfs *buf);
PRE(sys_freebsd11_fhstatfs)
{
- PRINT("sys_fhstatfs ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",ARG1,ARG2);
- PRE_REG_READ2(int, "fhstatfs",
+ PRINT("sys_freebsd11_fhstatfs ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",ARG1,ARG2);
+ PRE_REG_READ2(int, "freebsd11_fhstatfs",
struct fhandle *, fhp, struct statfs *, buf);
- PRE_MEM_READ( "fhstatfs(fhp)", ARG1, sizeof(struct vki_fhandle) );
- PRE_MEM_WRITE( "fhstatfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) );
+ PRE_MEM_READ( "freebsd11_fhstatfs(fhp)", ARG1, sizeof(struct vki_fhandle) );
+ PRE_MEM_WRITE( "freebsd11_fhstatfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) );
}
POST(sys_freebsd11_fhstatfs)
@@ -3922,14 +3982,18 @@ PRE(sys_sigaction)
if (ARG2 != 0
&& ! ML_(safe_to_deref)((void *)(Addr)ARG2,
sizeof(struct vki_sigaction))) {
- VG_(umsg)("Warning: bad act handler address %p in sigaction()\n",
- (void *)(Addr)ARG2);
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(umsg)("Warning: bad act handler address %p in sigaction()\n",
+ (void *)(Addr)ARG2);
+ }
SET_STATUS_Failure ( VKI_EFAULT );
} else if ((ARG3 != 0
&& ! ML_(safe_to_deref)((void *)(Addr)ARG3,
sizeof(struct vki_sigaction)))) {
- VG_(umsg)("Warning: bad oact handler address %p in sigaction()\n",
- (void *)(Addr)ARG3);
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(umsg)("Warning: bad oact handler address %p in sigaction()\n",
+ (void *)(Addr)ARG3);
+ }
SET_STATUS_Failure ( VKI_EFAULT );
} else {
if (ARG2 != 0) {
@@ -3988,8 +4052,8 @@ POST(sys_swapcontext)
PRE(sys_freebsd13_swapoff)
{
PRINT("sys_freebsd13_swapoff ( %#" FMT_REGWORD "x(%s) )", ARG1,(char *)ARG1);
- PRE_REG_READ1(int, "swapoff", const char *, special);
- PRE_MEM_RASCIIZ( "swapoff(special)", ARG1 );
+ PRE_REG_READ1(int, "freebsd13_swapoff", const char *, special);
+ PRE_MEM_RASCIIZ( "freebsd13_swapoff(special)", ARG1 );
}
// SYS___acl_get_link 425
@@ -4050,21 +4114,20 @@ PRE(sys_sigwait)
ARG1,ARG2);
PRE_REG_READ2(int, "sigwait",
const vki_sigset_t *, set, int *, sig);
- if (ARG1 != 0) {
- PRE_MEM_READ( "sigwait(set)", ARG1, sizeof(vki_sigset_t));
- vki_sigset_t* set = (vki_sigset_t*)ARG1;
- if (ML_(safe_to_deref)(set, sizeof(vki_sigset_t))) {
- *flags |= SfMayBlock;
- }
- }
- if (ARG2 != 0) {
- PRE_MEM_WRITE( "sigwait(sig)", ARG2, sizeof(int));
+ PRE_MEM_READ( "sigwait(set)", ARG1, sizeof(vki_sigset_t));
+ vki_sigset_t* set = (vki_sigset_t*)ARG1;
+ if (ML_(safe_to_deref)(set, sizeof(vki_sigset_t))) {
+ *flags |= SfMayBlock;
}
+ PRE_MEM_WRITE( "sigwait(sig)", ARG2, sizeof(int));
}
+// sigwait doesn't follow the norm of returning -1 on error
+// instead it returns errno if there is an error
POST(sys_sigwait)
{
- if (RES == 0 && ARG2 != 0) {
+ if (RES == 0)
+ {
POST_MEM_WRITE( ARG2, sizeof(int));
}
}
@@ -4182,6 +4245,8 @@ PRE(sys_extattr_list_fd)
{
PRINT("extattr_list_fd ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1, SARG2, ARG3, ARG4);
PRE_REG_READ4(ssize_t, "extattr_list_fd", int, id, int, attrnamespace, void *,data, size_t, nbytes);
+ if (!ML_(fd_allowed)(ARG1, "extattr_list_fd", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_WRITE("extattr_list_fd(data)", ARG3, ARG4);
}
@@ -4815,8 +4880,8 @@ PRE(sys_kmq_notify)
// int kmq_unlink(const char *path);
PRE(sys_kmq_unlink)
{
- PRINT("sys_kmq_unlink ( %#" FMT_REGWORD "x(%s) )", ARG1,(char *)ARG1);
- PRE_REG_READ1(int, "mq_unlink", const char *, name);
+ PRINT("sys_kmq_unlink ( %#" FMT_REGWORD "x(%s) )", ARG1,(HChar *)ARG1);
+ PRE_REG_READ1(int, "mq_unlink", const HChar *, name);
PRE_MEM_RASCIIZ( "mq_unlink(name)", ARG1 );
}
@@ -5114,6 +5179,7 @@ PRE(sys_faccessat)
PRINT("sys_faccessat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3);
PRE_REG_READ3(int, "faccessat",
int, fd, const char *, path, int, flag);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "faccessat", tid, status);
PRE_MEM_RASCIIZ( "faccessat(path)", ARG2 );
}
@@ -5124,6 +5190,7 @@ PRE(sys_fchmodat)
PRINT("sys_fchmodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3);
PRE_REG_READ4(int, "fchmodat",
int, fd, const char *, path, vki_mode_t, mode, int, flag);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fchmodat", tid, status);
PRE_MEM_RASCIIZ( "fchmodat(path)", ARG2 );
}
@@ -5133,6 +5200,7 @@ PRE(sys_fchownat)
{
PRINT("sys_fchownat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x, %" FMT_REGWORD "d )",
ARG1,ARG2,(char*)ARG2,ARG3,ARG4, SARG5);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fchownat", tid, status);
PRE_REG_READ5(int, "fchownat",
int, fd, const char *, path,
vki_uid_t, owner, vki_gid_t, group, int, flag);
@@ -5224,8 +5292,9 @@ PRE(sys_freebsd11_fstatat)
PRINT("sys_freebsd11_fstatat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3);
PRE_REG_READ4(int, "fstatat",
int, fd, const char *, path, struct freebsd11_stat *, buf, int, flag);
- PRE_MEM_RASCIIZ( "fstatat(path)", ARG2 );
- PRE_MEM_WRITE( "fstatat(sb)", ARG3, sizeof(struct vki_freebsd11_stat) );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "freebsd11_fstatat", tid, status);
+ PRE_MEM_RASCIIZ( "freebsd11_fstatat(path)", ARG2 );
+ PRE_MEM_WRITE( "freebsd11_fstatat(sb)", ARG3, sizeof(struct vki_freebsd11_stat) );
}
POST(sys_freebsd11_fstatat)
@@ -5240,6 +5309,7 @@ PRE(sys_futimesat)
PRINT("sys_futimesat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3);
PRE_REG_READ3(int, "futimesat",
int, fd, const char *, path, struct timeval *, times);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "futimesat", tid, status);
if (ARG2 != 0) {
PRE_MEM_RASCIIZ( "futimesat(path)", ARG2 );
}
@@ -5258,6 +5328,7 @@ PRE(sys_linkat)
int, fd1, const char *, name1,
int, fd2, const char *, name2,
int, flag);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "linkat", tid, status);
PRE_MEM_RASCIIZ( "linkat(name1)", ARG2);
PRE_MEM_RASCIIZ( "linkat(name2)", ARG4);
}
@@ -5270,6 +5341,7 @@ PRE(sys_mkdirat)
PRINT("sys_mkdirat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3);
PRE_REG_READ3(int, "mkdirat",
int, fd, const char *, path, unsigned int, mode);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mkdirat", tid, status);
PRE_MEM_RASCIIZ( "mkdirat(path)", ARG2 );
}
@@ -5279,6 +5351,7 @@ PRE(sys_mkfifoat)
{
PRINT("sys_mkfifoat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x )",
SARG1,ARG2,(HChar*)ARG2,ARG3 );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mkfifoat", tid, status);
PRE_REG_READ3(int, "mkfifoat",
int, fd, const char *, path, vki_mode_t, mode);
PRE_MEM_RASCIIZ( "mkfifoat(path)", ARG2 );
@@ -5289,15 +5362,49 @@ PRE(sys_mkfifoat)
PRE(sys_freebsd11_mknodat)
{
PRINT("sys_freebsd11_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4 );
- PRE_REG_READ4(long, "mknodat",
+ PRE_REG_READ4(long, "freebsd11_mknodat",
int, dfd, const char *, pathname, int, mode, unsigned, dev);
- PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "freebsd11_mknodat", tid, status);
+ PRE_MEM_RASCIIZ( "freebsd11_mknodat(pathname)", ARG2 );
}
// SYS_openat 499
// int openat(int fd, const char *path, int flags, ...);
PRE(sys_openat)
{
+ // check that we are not trying to open the client exe for writing
+ if ((ARG3 & VKI_O_WRONLY) ||
+ (ARG3 & VKI_O_RDWR)) {
+ vg_assert(VG_(resolved_exename) && VG_(resolved_exename)[0] == '/');
+ Int fd = ARG1;
+ const HChar* path = (const HChar*)ARG2;
+ if (ML_(safe_to_deref)(path, 1)) { // we need something like a "ML_(safe_to_deref_path)" that does a binary search for the addressable length, and maybe nul
+ if (fd == VKI_AT_FDCWD) {
+ HChar tmp[VKI_PATH_MAX];
+ if (VG_(realpath)(path, tmp)) {
+ if (!VG_(strcmp)(tmp, VG_(resolved_exename))) {
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ }
+ }
+ } else {
+ const HChar* dirname;
+ if (VG_(resolve_filename)(fd, &dirname) == False) {
+ goto no_client_write; // let the OS do the error handling
+ }
+ HChar tmp1[VKI_PATH_MAX];
+ VG_(snprintf)(tmp1, VKI_PATH_MAX, "%s/%s", dirname, path);
+ tmp1[VKI_PATH_MAX - 1] = '\0';
+ //VG_(free)((void*)dirname);
+ HChar tmp2[VKI_PATH_MAX];
+ if (VG_(realpath)(tmp1, tmp2)) {
+ if (!VG_(strcmp)(tmp2, VG_(resolved_exename))) {
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ }
+ }
+ }
+ }
+ }
+no_client_write:
if (ARG3 & VKI_O_CREAT) {
// 4-arg version
PRINT("sys_openat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %" FMT_REGWORD "u )",ARG1,ARG2,(char*)ARG2,ARG3,ARG4);
@@ -5309,12 +5416,8 @@ PRE(sys_openat)
PRE_REG_READ3(int, "openat",
int, fd, const char *, path, int, flags);
}
-
- if (ARG1 != (unsigned)VKI_AT_FDCWD && !ML_(fd_allowed)(ARG1, "openat", tid, False)) {
- SET_STATUS_Failure( VKI_EBADF );
- } else {
- PRE_MEM_RASCIIZ( "openat(path)", ARG2 );
- }
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "openat", tid, status);
+ PRE_MEM_RASCIIZ("openat(path)", ARG2);
/* Otherwise handle normally */
*flags |= SfMayBlock;
@@ -5339,38 +5442,24 @@ POST(sys_openat)
// size_t bufsize);
PRE(sys_readlinkat)
{
- Word saved = SYSNO;
- Bool curproc_file = False;
-
- PRINT("sys_readlinkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %llu )", ARG1,ARG2,(char*)ARG2,ARG3,(ULong)ARG4);
+ PRINT("sys_readlinkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %llu )",
+ ARG1, ARG2, (char*)ARG2, ARG3, (ULong)ARG4);
PRE_REG_READ4(ssize_t, "readlinkat",
int, fd, const char *, path, char *, buf, int, bufsize);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "readlinkat", tid, status);
PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 );
- PRE_MEM_WRITE( "readlinkat(buf)", ARG3,ARG4 );
-
- if (VG_(have_slash_proc) == True && (Int)ARG1 == VKI_AT_FDCWD) {
- /*
- * Handle the case where readlinkat is looking at /proc/curproc/file or
- * /proc//file.
- */
- do_readlink((const HChar *)ARG2, (HChar *)ARG3, (SizeT)ARG4, status, &curproc_file);
- }
+ PRE_MEM_WRITE("readlinkat(buf)", ARG3, ARG4);
- // @todo PJF there is still the case where fd refers to /proc or /proc/pid
- // or /proc/curproc and path is relative pid/file, curptoc/file or just file
-
- if (!curproc_file) {
- /* Normal case */
- SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, ARG2, ARG3, ARG4));
- }
- if (SUCCESS && RES > 0) {
- POST_MEM_WRITE( ARG3, RES );
+ if (VG_(have_slash_proc) == False || do_readlink((const HChar *)ARG2, (HChar *)ARG3, (SizeT)ARG4, status)) {
+ // @todo PJF there is still the case where fd refers to / or /proc or /proc/pid
+ // or /proc/curproc and path is relative pid/file, curproc/file or just file
+ *flags |= SfMayBlock;
}
}
POST(sys_readlinkat)
{
- POST_MEM_WRITE( ARG3, RES );
+ POST_MEM_WRITE(ARG3, RES);
}
// SYS_renameat 501
@@ -5381,6 +5470,8 @@ PRE(sys_renameat)
PRE_REG_READ4(int, "renameat",
int, fromfd, const char *, from,
int, tofd, const char *, to);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "renameat(fromfd)", tid, status);
+ ML_(fd_at_check_allowed)(SARG3, (const HChar*)ARG4, "renameat(tofd)", tid, status);
PRE_MEM_RASCIIZ( "renameat(oldpath)", ARG2 );
PRE_MEM_RASCIIZ( "renameat(newpath)", ARG4 );
}
@@ -5393,6 +5484,7 @@ PRE(sys_symlinkat)
PRINT("sys_symlinkat ( %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s) )",ARG1,(char*)ARG1,ARG2,ARG3,(char*)ARG3);
PRE_REG_READ3(int, "symlinkat",
const char *, name1, int, fd, const char *, name2);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "symlinkat", tid, status);
PRE_MEM_RASCIIZ( "symlinkat(name1)", ARG1 );
PRE_MEM_RASCIIZ( "symlinkat(name2)", ARG3 );
}
@@ -5401,9 +5493,9 @@ PRE(sys_symlinkat)
// int unlinkat(int fd, const char *path, int flag);
PRE(sys_unlinkat)
{
- *flags |= SfMayBlock;
PRINT("sys_unlinkat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u ",
ARG1, ARG2, (char*)ARG2, ARG3);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "unlinkat", tid, status);
PRE_REG_READ3(int, "unlinkat", int, fd, const char *, path, int, flag);
PRE_MEM_RASCIIZ( "unlinkat(path)", ARG2 );
}
@@ -5599,6 +5691,8 @@ PRE(sys_cap_rights_get)
{
PRINT("sys_cap_rights_get ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, SARG2, ARG3);
PRE_REG_READ3(long, "cap_rights_get", int, version, int, fd, vki_cap_rights_t*, rights);
+ if (!ML_(fd_allowed)(ARG2, "cap_rights_get", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_WRITE("cap_rights_get(rights)", ARG3, sizeof(vki_cap_rights_t));
}
@@ -5692,7 +5786,21 @@ PRE(sys_pdfork)
POST(sys_pdfork)
{
if (ARG1) {
- POST_MEM_WRITE( ARG1, sizeof(int) );
+ POST_MEM_WRITE(ARG1, sizeof(int));
+ Int* fdp = (Int*)ARG1;
+ if ((VG_(clo_modify_fds) == VG_MODIFY_FD_YES && *fdp > 2)
+ || (VG_(clo_modify_fds) == VG_MODIFY_FD_HIGH)) {
+ int newFd = ML_(get_next_new_fd)(*fdp);
+ if (newFd == *fdp) {
+ // PJF ugh the pdfork syscall succeeded
+ // but our fdup failed
+ // how can I clean up the mess? I presume that the child will still run
+ SET_STATUS_Failure(-1);
+ }
+ }
+ if (VG_(clo_track_fds)) {
+ ML_(record_fd_open_nameless)(tid, *fdp);
+ }
}
}
@@ -5702,13 +5810,15 @@ PRE(sys_pdkill)
{
PRINT("sys_pdkill ( %" FMT_REGWORD "u, %" FMT_REGWORD "d )", ARG1, SARG2);
PRE_REG_READ2(int, "pdkill", int, fd, int, signum);
+ if (!ML_(fd_allowed)(ARG1, "pdkill", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
if (!ML_(client_signal_OK)(ARG2)) {
SET_STATUS_Failure( VKI_EINVAL );
return;
}
- /* Ther was some code here to check if the kill is to this process
+ /* There was some code here to check if the kill is to this process
*
* But it was totally wrong
*
@@ -5727,7 +5837,7 @@ PRE(sys_pdkill)
* The kill functions operate on pids, not tids.
*
* One last thing, I don't see how pdkill could do a self
- * kill 9. It neads an fd which implied pdfork whichimplies
+ * kill 9. It needs an fd which implies pdfork which implies
* that the fd/pid are for a child process
*/
@@ -5741,7 +5851,6 @@ PRE(sys_pdkill)
/* This kill might have given us a pending signal. Ask for a check once
the syscall is done. */
*flags |= SfPollAfter;
-
}
// SYS_pdgetpid 520
@@ -5751,6 +5860,8 @@ PRE(sys_pdgetpid)
PRINT("pdgetpid ( %" FMT_REGWORD "d, %#lx )", SARG1, ARG2);
PRE_REG_READ2(int, "pdgetpid",
int, fd, pid_t*, pidp);
+ if (!ML_(fd_allowed)(ARG1, "pdgetpid", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_WRITE( "pdgetpid(pidp))", ARG2, sizeof(vki_pid_t) );
}
@@ -5930,6 +6041,8 @@ PRE(sys_cap_rights_limit)
PRINT("sys_cap_rights_limit ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, ARG2);
PRE_REG_READ2(int, "cap_rights_limit",
int, fd, const cap_rights_t *, rights);
+ if (!ML_(fd_allowed)(ARG1, "cap_rights_limit", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_READ( "cap_rights_limit(rights)", ARG2, sizeof(struct vki_cap_rights) );
}
@@ -5940,6 +6053,8 @@ PRE(sys_cap_ioctls_limit)
PRINT("cap_ioctls_limit ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", ARG1, ARG2, ARG3);
PRE_REG_READ3(int, "cap_ioctls_limit",
int, fd, unsigned long*, rights, vki_size_t, ncmds);
+ if (!ML_(fd_allowed)(ARG1, "cap_ioctls_limit", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
// "can be up to 256" taking that to not be inclusive
if (ARG3 < 256 ) {
PRE_MEM_READ( "cap_ioctls_limit(cmds))", ARG2, ARG3*sizeof(unsigned long) );
@@ -5953,6 +6068,8 @@ PRE(sys_cap_ioctls_get)
{
PRINT("sys_cap_ioctls_get ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1, ARG2, ARG3);
PRE_REG_READ3(int, "cap_ioctls_get", int, fd, unsigned long *, cmds, size_t, maxcmds);
+ if (!ML_(fd_allowed)(ARG1, "cap_ioctls_get", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
if (ARG3 < 256) {
PRE_MEM_WRITE("cap_ioctls_get(cmds)", ARG2, ARG3*sizeof(unsigned long));
}
@@ -5965,7 +6082,6 @@ POST(sys_cap_ioctls_get)
}
}
-
// SYS_cap_fcntls_limit 536
//int cap_fcntls_limit(int fd, uint32_t fcntlrights);
PRE(sys_cap_fcntls_limit)
@@ -5973,6 +6089,8 @@ PRE(sys_cap_fcntls_limit)
PRINT("cap_fcntls_limit ( %" FMT_REGWORD "d, %" FMT_REGWORD "u )", SARG1, ARG2);
PRE_REG_READ2(long, "cap_fcntls_limit",
int, fd, vki_uint32_t, fcntlrights);
+ if (!ML_(fd_allowed)(ARG1, "cap_fcntls_limit", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_cap_fcntls_get 537
@@ -5981,6 +6099,8 @@ PRE(sys_cap_fcntls_get)
{
PRINT("sys_cap_fcntls_get ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, ARG2);
PRE_REG_READ2(int, "cap_fcntls_get", int, fd, uint32_t *, fcntlrightsp);
+ if (!ML_(fd_allowed)(ARG1, "cap_fcntls_get", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_WRITE("cap_fcntls_get(fcntlrightsp)", ARG2, sizeof(uint32_t));
}
@@ -5996,6 +6116,7 @@ PRE(sys_bindat)
PRINT("sys_bindat ( %" FMT_REGWORD "d, %" FMT_REGWORD "dx, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )",
SARG1, SARG2, ARG3, ARG4);
PRE_REG_READ4(int, "bindat", int, fd, int, s, const struct vki_sockaddr *, name, vki_socklen_t, namelen);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "bindat", tid, status);
PRE_MEM_READ("bindat(name)", ARG3, ARG4);
}
@@ -6006,6 +6127,7 @@ PRE(sys_connectat)
PRINT("sys_connectat ( %" FMT_REGWORD "d, %" FMT_REGWORD "dx, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )",
SARG1, SARG2, ARG3, ARG4);
PRE_REG_READ4(int, "connectat", int, fd, int, s, const struct vki_sockaddr *, name, vki_socklen_t, namelen);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "connectat", tid, status);
PRE_MEM_READ("connectat(name)", ARG3, ARG4);
}
@@ -6016,6 +6138,7 @@ PRE(sys_chflagsat)
PRINT("sys_chglagsat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %" FMT_REGWORD "d )",
SARG1, ARG2, ARG3, SARG4);
PRE_REG_READ4(int, "chflagsat", int, fd, const char *, path, unsigned long, flags, int, atflag);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "chflagsat", tid, status);
PRE_MEM_RASCIIZ("chflagsat(path)", ARG2);
}
@@ -6142,6 +6265,8 @@ PRE(sys_futimens)
{
PRINT("sys_futimens ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, ARG2);
PRE_REG_READ2(int, "futimens", int, fd, const struct timespec *, times);
+ if (!ML_(fd_allowed)(ARG1, "futimens", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_READ("futimens(times)", ARG2, 2*sizeof(struct vki_timespec));
}
@@ -6154,6 +6279,7 @@ PRE(sys_utimensat)
SARG1, ARG2, ARG3, SARG4);
PRE_REG_READ4(int, "utimensat", int, fd, const char *,path, const struct timespec *, times,
int, flag);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "utimensat", tid, status);
PRE_MEM_RASCIIZ("utimensat(path)", ARG2);
PRE_MEM_READ("utimensat(times)", ARG3, 2*sizeof(struct vki_timespec));
}
@@ -6164,6 +6290,8 @@ PRE(sys_fdatasync)
{
PRINT("sys_fdatasync ( %" FMT_REGWORD "d )",SARG1);
PRE_REG_READ1(int, "fdatasync", int, fd);
+ if (!ML_(fd_allowed)(ARG1, "fdatasync", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_fstat 551
@@ -6173,6 +6301,8 @@ PRE(sys_fstat)
PRINT("sys_fstat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",SARG1,ARG2);
PRE_REG_READ2(int, "fstat", int, fd, struct stat *, sb);
PRE_MEM_WRITE( "fstat(sb)", ARG2, sizeof(struct vki_stat) );
+ if ( !ML_(fd_allowed)(ARG1, "fstat", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
POST(sys_fstat)
@@ -6187,6 +6317,7 @@ PRE(sys_fstatat)
PRINT("sys_fstatat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %" FMT_REGWORD "d )", SARG1,ARG2,(char*)ARG2,ARG3,SARG4);
PRE_REG_READ4(int, "fstatat",
int, fd, const char *, path, struct stat *, sb, int, flag);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat", tid, status);
PRE_MEM_RASCIIZ( "fstatat(path)", ARG2 );
PRE_MEM_WRITE( "fstatat(sb)", ARG3, sizeof(struct vki_stat) );
}
@@ -6220,6 +6351,8 @@ PRE(sys_getdirentries)
int, fd, char *, buf,
size_t, nbytes,
off_t *, basep);
+ if (!ML_(fd_allowed)(ARG1, "getdirentries", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_WRITE( "getdirentries(buf)", ARG2, ARG3 );
if (ARG4) {
PRE_MEM_WRITE("getdirentries(basep)", ARG4, sizeof (vki_off_t));
@@ -6259,6 +6392,8 @@ PRE(sys_fstatfs)
PRINT("sys_fstatfs ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",SARG1,ARG2);
PRE_REG_READ2(int, "fstatfs",
int, fd, struct vki_statfs *, buf);
+ if (!ML_(fd_allowed)(ARG1, "fstatfs", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_WRITE( "fstatfs(buf)", ARG2, sizeof(struct vki_statfs) );
}
@@ -6369,6 +6504,7 @@ PRE(sys_getfhat)
{
PRINT("sys_getfhat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "x, %" FMT_REGWORD "d ", SARG1, ARG2, ARG3, SARG4);
PRE_REG_READ4(int, "getfhat", int, fd, const char*, path, vki_fhandle_t*, fhp, int, flag);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "getfhat", tid, status);
PRE_MEM_RASCIIZ( "getfhat(path)", ARG2 );
PRE_MEM_WRITE("getfhat(fhp)", ARG3, sizeof(vki_fhandle_t));
}
@@ -6421,6 +6557,7 @@ PRE(sys_funlinkat)
PRINT("sys_funlinkat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %" FMT_REGWORD"u )",
SARG1, ARG2, (char*)ARG2, ARG4, ARG5);
PRE_REG_READ4(int, "funlinkat", int, dfd, const char *, path, int, fd, int, flag);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "funlinkat", tid, status);
PRE_MEM_RASCIIZ( "funlinkat(path)", ARG2 );
}
@@ -6444,17 +6581,16 @@ PRE(sys_copy_file_range)
valgrind itself uses some, so make sure someone didn't
put in one of our own... */
if (!ML_(fd_allowed)(ARG1, "copy_file_range(infd)", tid, False) ||
- !ML_(fd_allowed)(ARG3, "copy_file_range(infd)", tid, False)) {
+ !ML_(fd_allowed)(ARG3, "copy_file_range(infd)", tid, False))
SET_STATUS_Failure( VKI_EBADF );
- } else {
- /* Now see if the offsets are defined. PRE_MEM_READ will
- double check it can dereference them. */
- if (ARG2 != 0) {
- PRE_MEM_READ( "copy_file_range(inoffp)", ARG2, sizeof(vki_off_t));
- }
- if (ARG4 != 0) {
- PRE_MEM_READ( "copy_file_range(outoffp)", ARG4, sizeof(vki_off_t));
- }
+
+ /* Now see if the offsets are defined. PRE_MEM_READ will
+ double check it can dereference them. */
+ if (ARG2 != 0) {
+ PRE_MEM_READ( "copy_file_range(inoffp)", ARG2, sizeof(vki_off_t));
+ }
+ if (ARG4 != 0) {
+ PRE_MEM_READ( "copy_file_range(outoffp)", ARG4, sizeof(vki_off_t));
}
}
@@ -6602,6 +6738,7 @@ PRE(sys___realpathat)
SARG1,ARG2,(const char*)ARG2,ARG3,ARG4,SARG5 );
PRE_REG_READ5(int, "__realpathat", int, fd, const char *, path,
char *, buf, vki_size_t, size, int, flags);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "__realpathat", tid, status);
PRE_MEM_RASCIIZ("__realpathat(path)", (Addr)ARG2);
PRE_MEM_WRITE("__realpathat(buf)", (Addr)ARG3, ARG4);
}
@@ -6800,6 +6937,8 @@ PRE(sys_fspacectl)
{
PRINT("fspacectl ( %" FMT_REGWORD "d, %" FMT_REGWORD "d, %#" FMT_REGWORD "x, %" FMT_REGWORD "d, %#" FMT_REGWORD "x )", SARG1, SARG2, ARG3, SARG4, ARG5);
PRE_REG_READ5(int, "fspacectl", int, fd, int, cmd, const struct spacectl_range *, rqsr, int, flags, struct spacectl_range *, rmsr);
+ if (!ML_(fd_allowed)(ARG1, "fspacectl", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
PRE_MEM_READ("fspacectl(rqsr)", (Addr)ARG3, sizeof(struct vki_spacectl_range));
if (ARG5) {
PRE_MEM_WRITE("fspacectl(rmsr)", (Addr)ARG5, sizeof(struct vki_spacectl_range));
@@ -6885,9 +7024,8 @@ PRE(sys_timerfd_gettime)
struct vki_itimerspec*, curr_value);
if (!ML_(fd_allowed)(ARG1, "timerfd_gettime", tid, False))
SET_STATUS_Failure(VKI_EBADF);
- else
- PRE_MEM_WRITE("timerfd_gettime(curr_value)",
- ARG2, sizeof(struct vki_itimerspec));
+ PRE_MEM_WRITE("timerfd_gettime(curr_value)",
+ ARG2, sizeof(struct vki_itimerspec));
}
POST(sys_timerfd_gettime)
@@ -6910,15 +7048,12 @@ PRE(sys_timerfd_settime)
struct vki_itimerspec*, old_value);
if (!ML_(fd_allowed)(ARG1, "timerfd_settime", tid, False))
SET_STATUS_Failure(VKI_EBADF);
- else
+ PRE_MEM_READ("timerfd_settime(new_value)",
+ ARG3, sizeof(struct vki_itimerspec));
+ if (ARG4)
{
- PRE_MEM_READ("timerfd_settime(new_value)",
- ARG3, sizeof(struct vki_itimerspec));
- if (ARG4)
- {
- PRE_MEM_WRITE("timerfd_settime(old_value)",
- ARG4, sizeof(struct vki_itimerspec));
- }
+ PRE_MEM_WRITE("timerfd_settime(old_value)",
+ ARG4, sizeof(struct vki_itimerspec));
}
}
@@ -6986,7 +7121,7 @@ POST(sys_getrlimitusage)
break;
case VKI_RLIMIT_STACK:
/*
- * The main client stack is quite different when running under Valgrind.
+ * The main client stack is quite different when running under Valgrind.
* See aspacemg-linux.c for details, but in short on 64bit systems
* the main stack starts with 128k reserved and a 512M limit.
* Valgrind just has one value, 16M by default (can be changed with
@@ -7005,7 +7140,7 @@ POST(sys_getrlimitusage)
// int fchroot(int fd);
PRE(sys_fchroot)
{
- PRINT("sys_fchroot(%ld)", ARG1);
+ PRINT("sys_fchroot(%" FMT_REGWORD "d)", SARG1);
PRE_REG_READ1(int, "fchroot", int, fd);
/* Be strict. */
@@ -7013,15 +7148,80 @@ PRE(sys_fchroot)
SET_STATUS_Failure(VKI_EBADF);
}
-// SYS_setcred
+// SYS_setcred 591
// int setcred(u_int flags, const struct setcred *wcred, size_t size);
PRE(sys_setcred)
{
- PRINT("sys_setcred(%ld, %#" FMT_REGWORD "x, %lu)", ARG1, ARG2, ARG3);
+ PRINT("sys_setcred(%" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u)", ARG1, ARG2, ARG3);
PRE_REG_READ3(int, "setcred", u_int, flags, const struct setcred*, wcred, size_t, size);
- PRE_MEM_READ("setcred(wcred)", ARG2, sizeof(struct vki_setcred));
+ PRE_MEM_READ("setcred(wcred)", ARG2, ARG3);
}
+// SYS_exterrctl 592
+// int exterrctl(u_int op, u_int flags, _In_reads_bytes_(4) void *ptr
+PRE(sys_exterrctl)
+{
+ PRINT("sys_exterrctl(%" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x)",
+ ARG1, ARG2, ARG3);
+ PRE_REG_READ3(int, "exterrctl", u_int, op, u_int, flags, void*, ptr);
+ // the void* points to struct uexterror which at the time of writing has 10 fields
+ // but this syscall just turns this feature on and off and it's only th first 4 bytes
+ // for the version that gets checked
+ PRE_MEM_READ("exterrctl(ptr)", ARG3, 4);
+}
+
+// SYS_inotify_add_watch_at 593
+// int inotify_add_watch_at(int fd, int dfd, _In_z_ const char *path, uint32_t mask);
+PRE(sys_inotify_add_watch_at)
+{
+ PRINT("sys_inotify_add_watch_at(%" FMT_REGWORD "d, %" FMT_REGWORD "d, %" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x)", SARG1, SARG2, ARG3, (HChar*)ARG3, ARG4);
+ PRE_REG_READ4(int, "inotify_add_watch_at", int, fd, int, dfd, const char*, path, uint32_t, mask);
+ PRE_MEM_RASCIIZ("inotify_add_watch_at(path)", ARG3);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "inotify_add_watch_at", tid, status);
+}
+
+// SYS_inotify_rm_watch 594
+// int inotify_rm_watch(int fd, int wd);
+PRE(sys_inotify_rm_watch)
+{
+ PRINT("sys_inotify_rm_watch(%" FMT_REGWORD "d, %" FMT_REGWORD "d)", SARG1, SARG2);
+ PRE_REG_READ2(int, "inotify_rm_watch", int, fd, int, wd);
+ if (!ML_(fd_allowed)(ARG1, "inotify_rm_watch", tid, False)) {
+ SET_STATUS_Failure( VKI_EBADF );
+ }
+ // PJF I don't think that this can be AT_FDCWD
+ if (!ML_(fd_allowed)(ARG2, "inotify_rm_watch", tid, False)) {
+ SET_STATUS_Failure( VKI_EBADF );
+ }
+}
+
+// __NR_setgroups 595
+// generic
+
+// __NR_getgroups 596
+// generic
+
+// __NR_jail_attach_jd 597
+// int jail_attach_jd(int fd);
+PRE(sys_jail_attach_jd)
+{
+ PRINT("sys_jail_attach_jd(%" FMT_REGWORD"d)", SARG1);
+ PRE_REG_READ1(int, "jail_attach_jd", int, fd);
+
+ if (!ML_(fd_allowed)(ARG1, "jail_attach_id", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
+}
+
+// __NR_jail_remove_jd 598
+// int jail_remove_jd(int fd);
+PRE(sys_jail_remove_jd)
+{
+ PRINT("sys_jail_remove_jd(%" FMT_REGWORD"d)", SARG1);
+ PRE_REG_READ1(int, "jail_remove_jd", int, fd);
+
+ if (!ML_(fd_allowed)(ARG1, "jail_remove_id", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
+}
#undef PRE
#undef POST
@@ -7087,7 +7287,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
#if defined(VGP_arm64_freebsd)
GENX_(__NR_freebsd10_pipe, sys_ni_syscall), // 42
#else
- BSDXY(__NR_freebsd10_pipe, sys_pipe), // 42
+ BSDXY(__NR_freebsd10_pipe, sys_freebsd10_pipe), // 42
#endif
GENX_(__NR_getegid, sys_getegid), // 43
@@ -7108,7 +7308,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
BSDX_(__NR_revoke, sys_revoke), // 56
GENX_(__NR_symlink, sys_symlink), // 57
- BSDX_(__NR_readlink, sys_readlink), // 58
+ BSDXY(__NR_readlink, sys_readlink), // 58
GENX_(__NR_execve, sys_execve), // 59
GENX_(__NR_umask, sys_umask), // 60
@@ -7134,9 +7334,17 @@ const SyscallTableEntry ML_(syscall_table)[] = {
// obsol vhangup 76
// obsol vlimit 77
GENXY(__NR_mincore, sys_mincore), // 78
- GENXY(__NR_getgroups, sys_getgroups), // 79
-
- GENX_(__NR_setgroups, sys_setgroups), // 80
+ #if defined(__NR_freebsd14_getgroups)
+ GENXY(__NR_freebsd14_getgroups, sys_getgroups), // 79
+ #else
+ GENXY(__NR_getgroups, sys_getgroups), // 79
+ #endif
+
+ #if defined(__NR_freebsd14_setgroups)
+ GENX_(__NR_freebsd14_setgroups, sys_setgroups), // 80
+ #else
+ GENX_(__NR_setgroups, sys_setgroups), // 80
+ #endif
GENX_(__NR_getpgrp, sys_getpgrp), // 81
GENX_(__NR_setpgid, sys_setpgid), // 82
GENXY(__NR_setitimer, sys_setitimer), // 83
@@ -7719,6 +7927,20 @@ const SyscallTableEntry ML_(syscall_table)[] = {
BSDX_(__NR_fchroot, sys_fchroot), // 590
BSDX_(__NR_setcred, sys_setcred), // 591
+ BSDX_(__NR_exterrctl, sys_exterrctl), // 592
+ BSDX_(__NR_inotify_add_watch_at, sys_inotify_add_watch_at), // 593
+ BSDX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 594
+
+#if defined(__NR_freebsd14_setgroups)
+ GENX_(__NR_setgroups, sys_setgroups), // 595
+#endif
+#if defined(__NR_freebsd14_getgroups)
+ GENXY(__NR_getgroups, sys_getgroups), // 596
+#endif
+
+ BSDX_(__NR_jail_attach_jd, sys_jail_attach_jd), // 597
+ BSDX_(__NR_jail_remove_jd, sys_jail_remove_jd), // 598
+
BSDX_(__NR_fake_sigreturn, sys_fake_sigreturn), // 1000, fake sigreturn
};
diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c
index 98cbb172fd..37f312fe8f 100644
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -121,9 +121,11 @@ Bool ML_(valid_client_addr)(Addr start, SizeT size, ThreadId tid,
syscallname, start, start+size-1, (Int)ret);
if (!ret && syscallname != NULL) {
- VG_(message)(Vg_UserMsg, "Warning: client syscall %s tried "
- "to modify addresses %#lx-%#lx\n",
- syscallname, start, start+size-1);
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(message)(Vg_UserMsg, "Warning: client syscall %s tried "
+ "to modify addresses %#lx-%#lx\n",
+ syscallname, start, start+size-1);
+ }
if (VG_(clo_verbosity) > 1) {
VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size));
}
@@ -1792,6 +1794,12 @@ Bool ML_(fd_allowed)(Int fd, const HChar *syscallname, ThreadId tid,
return allowed;
}
+void ML_(fd_at_check_allowed)(Int fd, const HChar* path, const HChar* function_name, ThreadId tid, SyscallStatus* status)
+{
+ if ((ML_(safe_to_deref) (path, 1)) && (path[0] != '/'))
+ if ((fd != VKI_AT_FDCWD) && !ML_(fd_allowed)(fd, function_name, tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
+}
/* ---------------------------------------------------------------------
Deal with a bunch of socket-related syscalls
@@ -2651,6 +2659,31 @@ ML_(generic_PRE_sys_mmap) ( ThreadId tid,
VG_(core_panic)("can't use ML_(generic_PRE_sys_mmap) on Darwin");
# endif
+#if !defined(VKI_MAP_GUARD)
+// on platforms without MAP_GUARD the compiler should optimise away
+// the term using it below as it will always be true
+#define VKI_MAP_GUARD 0
+#endif
+
+#if !defined(VKI_MAP_STACK)
+// as above
+#define VKI_MAP_STACK 0
+#endif
+
+ /* fd (arg5) is only used when flags (arg4) does not contain
+ MAP_ANONYMOUS (or, on FreeBSD, MAP_GUARD and MAP_STACK).
+ ML_(fd_allowed) might just warn (with --track-fds)
+ and not fail, unless it is a Valgrind owned file descriptor.
+ So also check with fcntl (F_GETFD) to know if it really is a bad
+ fd. Fail early in that case with EBADF. */
+ if (!(arg4 & VKI_MAP_ANONYMOUS)
+ && !(arg4 & VKI_MAP_GUARD)
+ && !(arg4 & VKI_MAP_STACK)
+ && (!ML_(fd_allowed)(arg5, "mmap", tid, False)
+ || VG_(fcntl) (arg5, VKI_F_GETFD, 0) < 0)) {
+ return VG_(mk_SysRes_Error)( VKI_EBADF );
+ }
+
if (arg2 == 0) {
/* SuSV3 says: If len is zero, mmap() shall fail and no mapping
shall be established. */
@@ -2676,7 +2709,12 @@ ML_(generic_PRE_sys_mmap) ( ThreadId tid,
(fixed/hint/any), and ask aspacem what we should do. */
mreq.start = arg1;
mreq.len = arg2;
- if (arg4 & VKI_MAP_FIXED) {
+ if ((arg4 & VKI_MAP_FIXED)
+#if defined(VKI_MAP_FIXED_NOREPLACE)
+ || (arg4 & VKI_MAP_FIXED_NOREPLACE)
+#endif
+ )
+ {
mreq.rkind = MFixed;
} else
#if defined(VGO_solaris) && defined(VKI_MAP_ALIGN)
@@ -2708,6 +2746,11 @@ ML_(generic_PRE_sys_mmap) ( ThreadId tid,
advised = VG_(am_get_advisory)( &mreq, True/*client*/, &mreq_ok );
if (!mreq_ok) {
/* Our request was bounced, so we'd better fail. */
+#if defined(VKI_MAP_FIXED_NOREPLACE)
+ if (arg4 & VKI_MAP_FIXED_NOREPLACE) {
+ return VG_(mk_SysRes_Error)( VKI_EEXIST );
+ }
+#endif
return VG_(mk_SysRes_Error)( VKI_EINVAL );
}
@@ -2742,6 +2785,13 @@ ML_(generic_PRE_sys_mmap) ( ThreadId tid,
}
# endif
+# if defined(VKI_MAP_FIXED_NOREPLACE)
+ /* FIXED_NOREPLACE is fatal, no retries. */
+ if ((arg4 & VKI_MAP_FIXED_NOREPLACE) && sr_isError(sres)) {
+ return VG_(mk_SysRes_Error)( VKI_EEXIST );
+ }
+# endif
+
/* A refinement: it may be that the kernel refused aspacem's choice
of address. If we were originally asked for a hinted mapping,
there is still a last chance: try again at any address.
@@ -2900,6 +2950,8 @@ PRE(sys_fsync)
*flags |= SfMayBlock;
PRINT("sys_fsync ( %" FMT_REGWORD "u )", ARG1);
PRE_REG_READ1(long, "fsync", unsigned int, fd);
+ if ( !ML_(fd_allowed)(ARG1, "fsync", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
PRE(sys_fdatasync)
@@ -2907,6 +2959,8 @@ PRE(sys_fdatasync)
*flags |= SfMayBlock;
PRINT("sys_fdatasync ( %" FMT_REGWORD "u )", ARG1);
PRE_REG_READ1(long, "fdatasync", unsigned int, fd);
+ if ( !ML_(fd_allowed)(ARG1, "fdatasync", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
PRE(sys_msync)
@@ -3171,6 +3225,8 @@ PRE(sys_fstatfs)
PRE_REG_READ2(long, "fstatfs",
unsigned int, fd, struct statfs *, buf);
PRE_MEM_WRITE( "fstatfs(buf)", ARG2, sizeof(struct vki_statfs) );
+ if ( !ML_(fd_allowed)(ARG1, "fstatfs", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
POST(sys_fstatfs)
@@ -3186,6 +3242,8 @@ PRE(sys_fstatfs64)
PRE_REG_READ3(long, "fstatfs64",
unsigned int, fd, vki_size_t, size, struct statfs64 *, buf);
PRE_MEM_WRITE( "fstatfs64(buf)", ARG3, ARG2 );
+ if ( !ML_(fd_allowed)(ARG1, "fstatfs64", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
POST(sys_fstatfs64)
{
@@ -3244,6 +3302,8 @@ PRE(sys_flock)
*flags |= SfMayBlock;
PRINT("sys_flock ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2 );
PRE_REG_READ2(long, "flock", unsigned int, fd, unsigned int, operation);
+ if ( !ML_(fd_allowed)(ARG1, "flock", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
// Pre_read a char** argument.
@@ -3756,6 +3816,8 @@ PRE(sys_dup2)
{
PRINT("sys_dup2 ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2);
PRE_REG_READ2(long, "dup2", unsigned int, oldfd, unsigned int, newfd);
+ if (!ML_(fd_allowed)(ARG1, "dup2", tid, False))
+ SET_STATUS_Failure( VKI_EBADF );
if (!ML_(fd_allowed)(ARG2, "dup2", tid, True))
SET_STATUS_Failure( VKI_EBADF );
}
@@ -3772,6 +3834,8 @@ PRE(sys_fchdir)
FUSE_COMPATIBLE_MAY_BLOCK();
PRINT("sys_fchdir ( %" FMT_REGWORD "u )", ARG1);
PRE_REG_READ1(long, "fchdir", unsigned int, fd);
+ if ( !ML_(fd_allowed)(ARG1, "fchdir", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
PRE(sys_fchown)
@@ -3781,6 +3845,8 @@ PRE(sys_fchown)
FMT_REGWORD "u )", ARG1, ARG2, ARG3);
PRE_REG_READ3(long, "fchown",
unsigned int, fd, vki_uid_t, owner, vki_gid_t, group);
+ if ( !ML_(fd_allowed)(ARG1, "fchown", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
PRE(sys_fchmod)
@@ -3788,6 +3854,8 @@ PRE(sys_fchmod)
FUSE_COMPATIBLE_MAY_BLOCK();
PRINT("sys_fchmod ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2);
PRE_REG_READ2(long, "fchmod", unsigned int, fildes, vki_mode_t, mode);
+ if ( !ML_(fd_allowed)(ARG1, "fchmod", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
#if !defined(VGP_nanomips_linux) && !defined (VGO_freebsd)
@@ -3797,6 +3865,8 @@ PRE(sys_newfstat)
PRINT("sys_newfstat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1, ARG2);
PRE_REG_READ2(long, "fstat", unsigned int, fd, struct stat *, buf);
PRE_MEM_WRITE( "fstat(buf)", ARG2, sizeof(struct vki_stat) );
+ if ( !ML_(fd_allowed)(ARG1, "fstat", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
POST(sys_newfstat)
@@ -3864,6 +3934,8 @@ PRE(sys_ftruncate)
*flags |= SfMayBlock;
PRINT("sys_ftruncate ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2);
PRE_REG_READ2(long, "ftruncate", unsigned int, fd, unsigned long, length);
+ if ( !ML_(fd_allowed)(ARG1, "ftruncate", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
PRE(sys_truncate)
@@ -3890,6 +3962,8 @@ PRE(sys_ftruncate64)
PRE_REG_READ2(long, "ftruncate64",
unsigned int,fd, UWord,length);
#endif
+ if ( !ML_(fd_allowed)(ARG1, "ftruncate64", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
PRE(sys_truncate64)
@@ -3920,13 +3994,204 @@ PRE(sys_getdents)
PRE_MEM_WRITE( "getdents(dirp)", ARG2, ARG3 );
}
+#if defined(VGO_linux) || defined(VGO_solaris)
+
+/* Check if the given file descriptor points to a /proc/PID/fd or /proc/PID/fdinfo directory.
+ Returns True if it's a directory we should filter Valgrind FDs from. */
+static Bool is_proc_fd_directory(Int fd)
+{
+ const HChar* path;
+ if (!VG_(resolve_filename)(fd, &path))
+ return False;
+
+ HChar ppfd[32]; /* large enough for /proc//fd and /proc//fdinfo */
+ HChar ppfdinfo[32];
+ VG_(sprintf)(ppfd, "/proc/%d/fd", VG_(getpid)());
+ VG_(sprintf)(ppfdinfo, "/proc/%d/fdinfo", VG_(getpid)());
+
+ if (VG_(strcmp)(path, "/proc/self/fd") == 0
+ || VG_(strcmp)(path, "/proc/self/fdinfo") == 0
+ || VG_(strcmp)(path, ppfd) == 0
+ || VG_(strcmp)(path, ppfdinfo) == 0)
+ return True;
+
+ return False;
+}
+
+
+/* Helper function to decide if an FD entry should be kept */
+static Bool should_keep_fd_entry(const HChar *name)
+{
+ if (VG_(strcmp)(name, ".") == 0 || VG_(strcmp)(name, "..") == 0)
+ return True;
+
+ Bool is_numeric = True;
+ for (Int i = 0; name[i] != '\0'; i++) {
+ if (name[i] < '0' || name[i] > '9') {
+ is_numeric = False;
+ if (VG_(clo_verbosity) > 1)
+ VG_(dmsg)("Warning: Non-numeric entry '%s' found in /proc/*/fd directory\n", name);
+ break;
+ }
+ }
+
+ if (is_numeric && name[0] != '\0') {
+ Int fd_num = VG_(strtoll10)(name, NULL);
+ /* Hide FDs beyond soft limit or Valgrind's output FDs */
+ if (fd_num >= VG_(fd_soft_limit) ||
+ fd_num == VG_(log_output_sink).fd ||
+ fd_num == VG_(xml_output_sink).fd)
+ return False;
+ }
+
+ return True;
+}
+
+/* Make sure we really need the proc filtering using (32bit) getdents,
+ which not every linux arch implements. */
+#if defined(__NR_getdents)
+
+/* Filter and compact dirent entries */
+static SizeT filter_dirent_entries(struct vki_dirent *dirp, SizeT orig_size)
+{
+ struct vki_dirent *dp = dirp;
+ struct vki_dirent *write_pos = dirp;
+ SizeT bytes_processed = 0;
+ SizeT new_size = 0;
+
+ while (bytes_processed < orig_size) {
+ if (should_keep_fd_entry(dp->d_name)) {
+ if (write_pos != dp)
+ VG_(memmove)(write_pos, dp, dp->d_reclen);
+ new_size += dp->d_reclen;
+ write_pos = (struct vki_dirent *)((HChar *)write_pos + dp->d_reclen);
+ }
+
+ bytes_processed += dp->d_reclen;
+ dp = (struct vki_dirent *)((HChar *)dp + dp->d_reclen);
+ }
+
+ return new_size;
+}
+#endif /* defined(__NR_getdents) */
+
+/* Filter and compact dirent64 entries */
+static SizeT filter_dirent64_entries(struct vki_dirent64 *dirp, SizeT orig_size)
+{
+ struct vki_dirent64 *dp = dirp;
+ struct vki_dirent64 *write_pos = dirp;
+ SizeT bytes_processed = 0;
+ SizeT new_size = 0;
+
+ while (bytes_processed < orig_size) {
+ if (should_keep_fd_entry(dp->d_name)) {
+ if (write_pos != dp)
+ VG_(memmove)(write_pos, dp, dp->d_reclen);
+ new_size += dp->d_reclen;
+ write_pos = (struct vki_dirent64 *)((HChar *)write_pos + dp->d_reclen);
+ }
+
+ bytes_processed += dp->d_reclen;
+ dp = (struct vki_dirent64 *)((HChar *)dp + dp->d_reclen);
+ }
+
+ return new_size;
+}
+
+/* Make sure we really need the proc filtering using (32bit) getdents,
+ which not every linux arch implements. */
+#if defined(__NR_getdents)
+
+/* Filter out Valgrind's internal file descriptors from getdents results with refill capability.
+ When entries are filtered out, attempts to read more entries to avoid empty results.
+ Returns filtered size on success, or -1 if retry syscall failed. */
+static SizeT filter_valgrind_fds_from_getdents_with_refill(Int fd, struct vki_dirent *dirp, SizeT orig_size, SizeT buf_size, /*MOD*/SyscallStatus* status)
+{
+ SizeT new_size = filter_dirent_entries(dirp, orig_size);
+
+ /* If we filtered out everything, try to read more entries.
+ Since new_size == 0, the buffer is completely unused. */
+ while (new_size == 0) {
+ SysRes retry = VG_(do_syscall3)(__NR_getdents, fd, (UWord)dirp, buf_size);
+ if (sr_isError(retry)) {
+ /* Set the syscall status and return error indicator */
+ SET_STATUS_from_SysRes(retry);
+ return -1;
+ }
+ if (sr_Res(retry) == 0) {
+ /* Real EOF - stop trying */
+ break;
+ }
+
+ /* Filter the new batch */
+ SizeT retry_size = sr_Res(retry);
+ new_size = filter_dirent_entries(dirp, retry_size);
+ }
+
+ return new_size;
+}
+#endif /* defined(__NR_getdents) */
+
+/* Filter out Valgrind's internal file descriptors from getdents64 results with refill capability.
+ Same logic as getdents version but for 64-bit dirent structures.
+ Returns filtered size on success, or -1 if retry syscall failed. */
+static SizeT filter_valgrind_fds_from_getdents64_with_refill(Int fd, struct vki_dirent64 *dirp, SizeT orig_size, SizeT buf_size, /*MOD*/SyscallStatus* status)
+{
+ SizeT new_size = filter_dirent64_entries(dirp, orig_size);
+
+ /* If we filtered out everything, try to read more entries.
+ Since new_size == 0, the buffer is completely unused. */
+ while (new_size == 0) {
+ SysRes retry = VG_(do_syscall3)(__NR_getdents64, fd, (UWord)dirp, buf_size);
+ if (sr_isError(retry)) {
+ /* Set the syscall status and return error indicator */
+ SET_STATUS_from_SysRes(retry);
+ return -1;
+ }
+ if (sr_Res(retry) == 0) {
+ /* Real EOF - stop trying */
+ break;
+ }
+
+ /* Filter the new batch */
+ SizeT retry_size = sr_Res(retry);
+ new_size = filter_dirent64_entries(dirp, retry_size);
+ }
+
+ return new_size;
+}
+
+#endif /* defined(VGO_linux) || defined(VGO_solaris) */
+
POST(sys_getdents)
{
vg_assert(SUCCESS);
- if (RES > 0)
- POST_MEM_WRITE( ARG2, RES );
+ if (RES > 0) {
+ SizeT result_size = RES;
+
+ /* Make sure we really need the proc filtering using (32bit) getdents,
+ which not every linux arch implements. */
+#if (defined(VGO_linux) || defined(VGO_solaris)) && defined(__NR_getdents)
+
+ /* Only filter Valgrind FDs when listing /proc/PID/fd or /proc/PID/fdinfo directories */
+ if (is_proc_fd_directory(ARG1)) {
+ SizeT filtered_size = filter_valgrind_fds_from_getdents_with_refill(ARG1, (struct vki_dirent *)ARG2, RES, ARG3, status);
+ if ((SizeT)filtered_size == (SizeT)-1) {
+ /* Error already set by filter function */
+ return;
+ }
+ result_size = filtered_size;
+ if (result_size != RES)
+ SET_STATUS_Success(result_size);
+ }
+#endif /* (defined(VGO_linux) || defined(VGO_solaris)) && defined(__NR_getdents) */
+
+ POST_MEM_WRITE( ARG2, result_size );
+ }
}
+#if defined(__NR_getdents64)
+
PRE(sys_getdents64)
{
*flags |= SfMayBlock;
@@ -3941,10 +4206,27 @@ PRE(sys_getdents64)
POST(sys_getdents64)
{
vg_assert(SUCCESS);
- if (RES > 0)
- POST_MEM_WRITE( ARG2, RES );
+ if (RES > 0) {
+ SizeT result_size = RES;
+
+ /* Only filter Valgrind FDs when listing /proc/PID/fd or /proc/PID/fdinfo directories */
+ if (is_proc_fd_directory(ARG1)) {
+ SizeT filtered_size = filter_valgrind_fds_from_getdents64_with_refill(ARG1, (struct vki_dirent64 *)ARG2, RES, ARG3, status);
+ if ((SizeT)filtered_size == (SizeT)-1) {
+ /* Error already set by filter function */
+ return;
+ }
+ result_size = filtered_size;
+ if (result_size != RES)
+ SET_STATUS_Success(result_size);
+ }
+
+ POST_MEM_WRITE( ARG2, result_size );
+ }
}
+#endif /* defined(__NR_getdents64) */
+
PRE(sys_getgroups)
{
PRINT("sys_getgroups ( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2);
@@ -4556,8 +4838,23 @@ Bool ML_(handle_self_exe_open)(SyscallStatus *status, const HChar *filename,
}
#endif // defined(VGO_linux)
+// int open(const char *path, int flags, mode_t mode);
PRE(sys_open)
{
+#if defined(VGO_linux)
+ HChar name[30]; // large enough
+ Bool proc_self_exe = False;
+
+ /* Check for /proc/self/exe or /proc//exe case
+ * first so that we can then use the later checks. */
+ VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
+ if (ML_(safe_to_deref)( (void*)(Addr)ARG1, 1 )
+ && (VG_(strcmp)((HChar *)(Addr)ARG1, name) == 0
+ || VG_(strcmp)((HChar *)(Addr)ARG1, "/proc/self/exe") == 0)) {
+ proc_self_exe = True;
+ }
+#endif
+
if (ARG2 & VKI_O_CREAT) {
// 3-arg version
PRINT("sys_open ( %#" FMT_REGWORD "x(%s), %ld, %ld )",ARG1,
@@ -4573,13 +4870,39 @@ PRE(sys_open)
}
PRE_MEM_RASCIIZ( "open(filename)", ARG1 );
+ // check that we are not trying to open the client exe for writing
+ if ((ARG2 & VKI_O_WRONLY) ||
+ (ARG2 & VKI_O_RDWR)) {
+#if defined(VGO_linux)
+ if (proc_self_exe) {
+
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ return;
+ } else {
+#endif
+ vg_assert(VG_(resolved_exename));
+ const HChar* path = (const HChar*)ARG1;
+ if (ML_(safe_to_deref)(path, 1)) {
+ // we need something like a "ML_(safe_to_deref_path)" that does a binary search for the addressable length, and maybe nul
+ HChar tmp[VKI_PATH_MAX];
+ if (VG_(realpath)(path, tmp)) {
+ if (!VG_(strcmp)(tmp, VG_(resolved_exename))) {
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ return;
+ }
+ }
+ }
+#if defined(VGO_linux)
+ }
+#endif
+ }
+
#if defined(VGO_linux)
/* Handle the case where the open is of /proc/self/cmdline or
/proc//cmdline, and just give it a copy of the fd for the
fake file we cooked up at startup (in m_main). Also, seek the
cloned fd back to the start. */
{
- HChar name[30]; // large enough
HChar* arg1s = (HChar*) (Addr)ARG1;
SysRes sres;
@@ -4602,6 +4925,11 @@ PRE(sys_open)
if (ML_(handle_auxv_open)(status, (const HChar *)(Addr)ARG1, ARG2)
|| ML_(handle_self_exe_open)(status, (const HChar *)(Addr)ARG1, ARG2))
return;
+
+ if (proc_self_exe) {
+ // do the syscall with VG_(resolved_exename)
+ ARG1 = (Word)VG_(resolved_exename);
+ }
#endif // defined(VGO_linux)
/* Otherwise handle normally */
@@ -4709,6 +5037,9 @@ PRE(sys_poll)
PRE_MEM_READ( "poll(ufds.fd)",
(Addr)(&ufds[i].fd), sizeof(ufds[i].fd) );
if (ML_(safe_to_deref)(&ufds[i].fd, sizeof(ufds[i].fd)) && ufds[i].fd >= 0) {
+ if (!ML_(fd_allowed)(ufds[i].fd, "poll(ufds.fd)", tid, False)) {
+ /* do nothing? Just let fd_allowed produce a warning? */
+ }
PRE_MEM_READ( "poll(ufds.events)",
(Addr)(&ufds[i].events), sizeof(ufds[i].events) );
}
diff --git a/coregrind/m_syswrap/syswrap-linux-variants.c b/coregrind/m_syswrap/syswrap-linux-variants.c
index 3b0bff162a..55d6415e71 100644
--- a/coregrind/m_syswrap/syswrap-linux-variants.c
+++ b/coregrind/m_syswrap/syswrap-linux-variants.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index afd4a618b1..3606bb9ad6 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -114,7 +114,6 @@ static VgSchedReturnCode thread_wrapper(Word /*ThreadId*/ tidW)
return ret;
}
-
/* ---------------------------------------------------------------------
clone-related stuff
------------------------------------------------------------------ */
@@ -131,7 +130,7 @@ static void run_a_thread_NORETURN ( Word tidW )
Int registered_vgstack_id;
#endif
- VG_(debugLog)(1, "syswrap-linux",
+ VG_(debugLog)(1, "syswrap-linux",
"run_a_thread_NORETURN(tid=%u): pre-thread_wrapper\n",
tid);
@@ -147,14 +146,14 @@ static void run_a_thread_NORETURN ( Word tidW )
is the stack to use by the outer to e.g. do stacktraces.
*/
INNER_REQUEST
- (registered_vgstack_id
+ (registered_vgstack_id
= VALGRIND_STACK_REGISTER (tst->os_state.valgrind_stack_base,
tst->os_state.valgrind_stack_init_SP));
-
+
/* Run the thread all the way through. */
- src = thread_wrapper(tid);
+ src = thread_wrapper(tid);
- VG_(debugLog)(1, "syswrap-linux",
+ VG_(debugLog)(1, "syswrap-linux",
"run_a_thread_NORETURN(tid=%u): post-thread_wrapper\n",
tid);
@@ -181,7 +180,7 @@ static void run_a_thread_NORETURN ( Word tidW )
"WARNING: of the VALGRIND_DISABLE_ERROR_REPORTING macros.\n"
);
VG_(debugLog)(
- 1, "syswrap-linux",
+ 1, "syswrap-linux",
"run_a_thread_NORETURN(tid=%u): "
"WARNING: exiting thread has err_disablement_level = %u\n",
tid, tst->err_disablement_level
@@ -191,18 +190,18 @@ static void run_a_thread_NORETURN ( Word tidW )
if (c == 1) {
- VG_(debugLog)(1, "syswrap-linux",
+ VG_(debugLog)(1, "syswrap-linux",
"run_a_thread_NORETURN(tid=%u): "
"last one standing\n",
tid);
/* We are the last one standing. Keep hold of the lock and
- carry on to show final tool results, then exit the entire system.
+ carry on to show final tool results, then exit the entire system.
Use the continuation pointer set at startup in m_main. */
( * VG_(address_of_m_main_shutdown_actions_NORETURN) ) (tid, src);
} else {
- VG_(debugLog)(1, "syswrap-linux",
+ VG_(debugLog)(1, "syswrap-linux",
"run_a_thread_NORETURN(tid=%u): "
"not last one standing\n",
tid);
@@ -372,10 +371,10 @@ Addr ML_(allocstack)(ThreadId tid)
if (0)
VG_(printf)( "stack for tid %u at %p; init_SP=%p\n",
- tid,
- (void*)tst->os_state.valgrind_stack_base,
+ tid,
+ (void*)tst->os_state.valgrind_stack_base,
(void*)tst->os_state.valgrind_stack_init_SP );
-
+
return tst->os_state.valgrind_stack_init_SP;
}
@@ -387,7 +386,7 @@ Addr ML_(allocstack)(ThreadId tid)
void VG_(main_thread_wrapper_NORETURN)(ThreadId tid)
{
Addr sp;
- VG_(debugLog)(1, "syswrap-linux",
+ VG_(debugLog)(1, "syswrap-linux",
"entering VG_(main_thread_wrapper_NORETURN)\n");
sp = ML_(allocstack)(tid);
@@ -398,7 +397,7 @@ void VG_(main_thread_wrapper_NORETURN)(ThreadId tid)
// reports 'write error' on the non registered stack.
ThreadState* tst = VG_(get_ThreadState)(tid);
INNER_REQUEST
- ((void)
+ ((void)
VALGRIND_STACK_REGISTER (tst->os_state.valgrind_stack_base,
tst->os_state.valgrind_stack_init_SP));
}
@@ -428,7 +427,7 @@ void VG_(main_thread_wrapper_NORETURN)(ThreadId tid)
/* shouldn't be any other threads around yet */
vg_assert( VG_(count_living_threads)() == 1 );
- ML_(call_on_new_stack_0_1)(
+ ML_(call_on_new_stack_0_1)(
(Addr)sp, /* stack */
0, /* bogus return address */
run_a_thread_NORETURN, /* fn to call */
@@ -442,11 +441,11 @@ void VG_(main_thread_wrapper_NORETURN)(ThreadId tid)
/* Clone a new thread. Note that in the clone syscalls, we hard-code
tlsaddr argument as NULL : the guest TLS is emulated via guest
registers, and Valgrind itself has no thread local storage. */
-static SysRes clone_new_thread ( Word (*fn)(void *),
- void* stack,
- Word flags,
+static SysRes clone_new_thread ( Word (*fn)(void *),
+ void* stack,
+ Word flags,
ThreadState* ctst,
- Int* child_tidptr,
+ Int* child_tidptr,
Int* parent_tidptr)
{
SysRes res;
@@ -480,7 +479,7 @@ static SysRes clone_new_thread ( Word (*fn)(void *),
/* High half word64 is syscall return value. Low half is
the entire CR, from which we need to extract CR0.SO. */
/* VG_(printf)("word64 = 0x%llx\n", word64); */
- res = VG_(mk_SysRes_ppc32_linux)(/*val*/(UInt)(word64 >> 32),
+ res = VG_(mk_SysRes_ppc32_linux)(/*val*/(UInt)(word64 >> 32),
/*errflag*/ (((UInt)word64) >> 28) & 1);
#elif defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
ULong word64;
@@ -497,7 +496,7 @@ static SysRes clone_new_thread ( Word (*fn)(void *),
the entire CR, from which we need to extract CR0.SO. */
/* VG_(printf)("word64 = 0x%llx\n", word64); */
res = VG_(mk_SysRes_ppc64_linux)
- (/*val*/(UInt)(word64 & 0xFFFFFFFFULL),
+ (/*val*/(UInt)(word64 & 0xFFFFFFFFULL),
/*errflag*/ (UInt)((word64 >> (32+28)) & 1), flag);
#elif defined(VGP_s390x_linux)
ULong r2;
@@ -536,7 +535,7 @@ static SysRes clone_new_thread ( Word (*fn)(void *),
(ML_(start_thread_NORETURN), stack, flags, ctst,
child_tidptr, parent_tidptr, NULL);
/* High half word64 is syscall return value. Low half is
- the entire CR, from which we need to extract CR0.SO. */
+ the entire CR, from which we need to extract CR0.SO. */
res = VG_ (mk_SysRes_mips32_linux) (/*val */ ret, 0, /*errflag */ 0);
#elif defined(VGP_nanomips_linux)
UInt ret = 0;
@@ -558,16 +557,16 @@ static SysRes clone_new_thread ( Word (*fn)(void *),
return res;
}
-static void setup_child ( /*OUT*/ ThreadArchState *child,
+static void setup_child ( /*OUT*/ ThreadArchState *child,
/*IN*/ ThreadArchState *parent )
-{
+{
/* We inherit our parent's guest state. */
child->vex = parent->vex;
child->vex_shadow1 = parent->vex_shadow1;
child->vex_shadow2 = parent->vex_shadow2;
#if defined(VGP_x86_linux)
- extern void ML_(x86_setup_LDT_GDT) ( /*OUT*/ ThreadArchState *child,
+ extern void ML_(x86_setup_LDT_GDT) ( /*OUT*/ ThreadArchState *child,
/*IN*/ ThreadArchState *parent );
ML_(x86_setup_LDT_GDT)(child, parent);
#endif
@@ -588,7 +587,7 @@ static SysRes setup_child_tls (ThreadId ctid, Addr tlsaddr)
if (debug)
VG_(printf)("clone child has SETTLS: tls info at %p: idx=%u "
"base=%#lx limit=%x; esp=%#x fs=%x gs=%x\n",
- tlsinfo, tlsinfo->entry_number,
+ tlsinfo, tlsinfo->entry_number,
tlsinfo->base_addr, tlsinfo->limit,
ctst->arch.vex.guest_ESP,
ctst->arch.vex.guest_FS, ctst->arch.vex.guest_GS);
@@ -620,9 +619,9 @@ static SysRes setup_child_tls (ThreadId ctid, Addr tlsaddr)
# error Unknown platform
#endif
return res;
-}
+}
-/*
+/*
When a client clones, we need to keep track of the new thread. This means:
1. allocate a ThreadId+ThreadState+stack for the thread
@@ -632,10 +631,10 @@ static SysRes setup_child_tls (ThreadId ctid, Addr tlsaddr)
but using the scheduler entrypoint for EIP, and a separate stack
for ESP.
*/
-static SysRes do_clone ( ThreadId ptid,
- UWord flags, Addr sp,
- Int* parent_tidptr,
- Int* child_tidptr,
+static SysRes do_clone ( ThreadId ptid,
+ UWord flags, Addr sp,
+ Int* parent_tidptr,
+ Int* child_tidptr,
Addr tlsaddr)
{
ThreadId ctid = VG_(alloc_ThreadState)();
@@ -691,7 +690,7 @@ static SysRes do_clone ( ThreadId ptid,
ctst->os_state.threadgroup = ptst->os_state.threadgroup;
ML_(guess_and_register_stack) (sp, ctst);
-
+
/* Assume the clone will succeed, and tell any tool that wants to
know that this thread has come into existence. We cannot defer
it beyond this point because setup_tls, just below,
@@ -756,7 +755,7 @@ static SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags,
vki_sigset_t mask;
SysRes res;
- if (flags & (VKI_CLONE_SETTLS | VKI_CLONE_FS | VKI_CLONE_VM
+ if (flags & (VKI_CLONE_SETTLS | VKI_CLONE_FS | VKI_CLONE_VM
| VKI_CLONE_FILES))
return VG_(mk_SysRes_Error)( VKI_EINVAL );
@@ -775,14 +774,14 @@ static SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags,
|| defined(VGP_arm_linux) || defined(VGP_mips32_linux) \
|| defined(VGP_mips64_linux) || defined(VGP_arm64_linux) \
|| defined(VGP_nanomips_linux) || defined(VGP_riscv64_linux)
- res = VG_(do_syscall5)( __NR_clone, flags,
- (UWord)NULL, (UWord)parent_tidptr,
+ res = VG_(do_syscall5)( __NR_clone, flags,
+ (UWord)NULL, (UWord)parent_tidptr,
(UWord)NULL, (UWord)child_tidptr );
#elif defined(VGP_amd64_linux)
/* note that the last two arguments are the opposite way round to x86 and
ppc32 as the amd64 kernel expects the arguments in a different order */
- res = VG_(do_syscall5)( __NR_clone, flags,
- (UWord)NULL, (UWord)parent_tidptr,
+ res = VG_(do_syscall5)( __NR_clone, flags,
+ (UWord)NULL, (UWord)parent_tidptr,
(UWord)child_tidptr, (UWord)NULL );
#elif defined(VGP_s390x_linux)
/* Note that s390 has the stack first and then the flags */
@@ -800,8 +799,8 @@ static SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags,
/* restore signal mask */
VG_(sigprocmask)(VKI_SIG_SETMASK, &fork_saved_mask, NULL);
- }
- else
+ }
+ else
if (!sr_isError(res) && sr_Res(res) > 0) {
/* parent */
VG_(do_atfork_parent)(tid);
@@ -878,7 +877,7 @@ PRE(sys_clone)
PRA3("clone", int *, parent_tidptr);
}
PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int));
- if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int),
+ if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int),
VKI_PROT_WRITE)) {
badarg = True;
}
@@ -892,7 +891,7 @@ PRE(sys_clone)
ARG_TLS pointer if the type looks like a real type, i.e. sizeof > 1. */
if (sizeof(vki_modify_ldt_t) > 1) {
PRE_MEM_READ("clone(tlsinfo)", ARG_TLS, sizeof(vki_modify_ldt_t));
- if (!VG_(am_is_valid_for_client)(ARG_TLS, sizeof(vki_modify_ldt_t),
+ if (!VG_(am_is_valid_for_client)(ARG_TLS, sizeof(vki_modify_ldt_t),
VKI_PROT_READ)) {
badarg = True;
}
@@ -903,7 +902,7 @@ PRE(sys_clone)
PRA_CHILD_TIDPTR("clone", int *, child_tidptr);
}
PRE_MEM_WRITE("clone(child_tidptr)", ARG_CHILD_TIDPTR, sizeof(Int));
- if (!VG_(am_is_valid_for_client)(ARG_CHILD_TIDPTR, sizeof(Int),
+ if (!VG_(am_is_valid_for_client)(ARG_CHILD_TIDPTR, sizeof(Int),
VKI_PROT_WRITE)) {
badarg = True;
}
@@ -922,7 +921,7 @@ PRE(sys_clone)
}
/* Only look at the flags we really care about */
- switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS
+ switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS
| VKI_CLONE_FILES | VKI_CLONE_VFORK)) {
case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES:
/* thread creation */
@@ -955,8 +954,17 @@ PRE(sys_clone)
"x\n", ARG_FLAGS);
VG_(message)(Vg_UserMsg, "\n");
VG_(message)(Vg_UserMsg, "The only supported clone() uses are:\n");
- VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)\n");
- VG_(message)(Vg_UserMsg, " - via the implementation of fork or vfork\n");
+ VG_(message)(Vg_UserMsg,
+ " - via a threads library (VM, FS and FILES flags set)\n");
+ VG_(message)(Vg_UserMsg,
+ " - via the implementation of vfork (VFORK or VFORK and VM flags set)\n");
+ VG_(message)(Vg_UserMsg,
+ " - via plain fork (no VM, FS, FILES, VFORK flags set)\n");
+ VG_(message)(Vg_UserMsg, " clone call had %s%s%s%sflags set\n",
+ cloneflags & VKI_CLONE_VM ? "CLONE_VM " : "",
+ cloneflags & VKI_CLONE_FS ? "CLONE_FS " : "",
+ cloneflags & VKI_CLONE_FILES ? "CLONE_FILES " : "",
+ cloneflags & VKI_CLONE_VFORK ? "CLONE_VFORK " : "");
VG_(unimplemented)
("Valgrind does not support general clone().");
}
@@ -1017,6 +1025,18 @@ PRE(sys_mount)
PRE_MEM_RASCIIZ( "mount(type)", ARG3);
}
+PRE(sys_mount_setattr)
+{
+ // int syscall(SYS_mount_setattr, int dirfd, const char *pathname,
+ // unsigned int flags, struct mount_attr *attr, size_t size);
+ *flags |= SfMayBlock;
+ PRINT("sys_mount_setattr ( %d, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#"
+ FMT_REGWORD "x, %" FMT_REGWORD "u )", (Int)ARG1, ARG2,
+ ARG3, ARG4, ARG5);
+ PRE_MEM_READ("mount(attr)", ARG5, ARG6);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mount_setattr(dirfd)", tid, status);
+}
+
PRE(sys_oldumount)
{
PRINT("sys_oldumount( %#" FMT_REGWORD "x )", ARG1);
@@ -1112,7 +1132,7 @@ PRE(sys_getresuid)
{
PRINT("sys_getresuid ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %#"
FMT_REGWORD "x )", ARG1,ARG2,ARG3);
- PRE_REG_READ3(long, "getresuid",
+ PRE_REG_READ3(long, "getresuid",
vki_uid_t *, ruid, vki_uid_t *, euid, vki_uid_t *, suid);
PRE_MEM_WRITE( "getresuid(ruid)", ARG1, sizeof(vki_uid_t) );
PRE_MEM_WRITE( "getresuid(euid)", ARG2, sizeof(vki_uid_t) );
@@ -1133,7 +1153,7 @@ PRE(sys_setresgid16)
PRINT("sys_setresgid16 ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %"
FMT_REGWORD "u )", ARG1, ARG2, ARG3);
PRE_REG_READ3(long, "setresgid16",
- vki_old_gid_t, rgid,
+ vki_old_gid_t, rgid,
vki_old_gid_t, egid, vki_old_gid_t, sgid);
}
@@ -1170,7 +1190,7 @@ PRE(sys_getresgid)
{
PRINT("sys_getresgid ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %#"
FMT_REGWORD "x )", ARG1,ARG2,ARG3);
- PRE_REG_READ3(long, "getresgid",
+ PRE_REG_READ3(long, "getresgid",
vki_gid_t *, rgid, vki_gid_t *, egid, vki_gid_t *, sgid);
PRE_MEM_WRITE( "getresgid(rgid)", ARG1, sizeof(vki_gid_t) );
PRE_MEM_WRITE( "getresgid(egid)", ARG2, sizeof(vki_gid_t) );
@@ -1215,7 +1235,7 @@ PRE(sys_exit_group)
syscall. */
for (t = 1; t < VG_N_THREADS; t++) {
if ( /* not alive */
- VG_(threads)[t].status == VgTs_Empty
+ VG_(threads)[t].status == VgTs_Empty
||
/* not our group */
VG_(threads)[t].os_state.threadgroup != tst->os_state.threadgroup
@@ -1228,12 +1248,12 @@ PRE(sys_exit_group)
/* Indicate in all other threads that the process is exiting.
Then wait using VG_(reap_threads) for these threads to disappear.
-
+
Can this give a deadlock if another thread is calling exit in parallel
and would then wait for this thread to disappear ?
The answer is no:
Other threads are either blocked in a syscall or have yielded the CPU.
-
+
A thread that has yielded the CPU is trying to get the big lock in
VG_(scheduler). This thread will get the CPU thanks to the call
to VG_(reap_threads). The scheduler will then check for signals,
@@ -1242,7 +1262,7 @@ PRE(sys_exit_group)
the thread status is VG_(is_exiting), the scheduler exits the thread.
So, a thread that has yielded the CPU does not have a chance to
call exit => no deadlock for this thread.
-
+
VG_(nuke_all_threads_except) will send the VG_SIGVGKILL signal
to all threads blocked in a syscall.
The syscall will be interrupted, and the control will go to the
@@ -1375,7 +1395,7 @@ PRE(sys_syslog)
case 2: case 3: case 4:
PRE_MEM_WRITE( "syslog(bufp)", ARG2, ARG3);
break;
- default:
+ default:
break;
}
}
@@ -1420,7 +1440,7 @@ PRE(sys_sysctl)
args = (struct __vki_sysctl_args *)(Addr)ARG1;
PRE_REG_READ1(long, "sysctl", struct __sysctl_args *, args);
PRE_MEM_WRITE( "sysctl(args)", ARG1, sizeof(struct __vki_sysctl_args) );
- if (!VG_(am_is_valid_for_client)(ARG1, sizeof(struct __vki_sysctl_args),
+ if (!VG_(am_is_valid_for_client)(ARG1, sizeof(struct __vki_sysctl_args),
VKI_PROT_READ)) {
SET_STATUS_Failure( VKI_EFAULT );
return;
@@ -1645,6 +1665,13 @@ POST(sys_sendfile64)
}
}
+PRE(sys_setdomainname)
+{
+ PRINT ("sys_setdomainname ( %#" FMT_REGWORD "x, %ld )", ARG1, SARG2);
+ PRE_REG_READ2 (long, "setdomainname", const void *, name, int, len);
+ PRE_MEM_READ("setdomainname(name)", ARG1, ARG2);
+}
+
static void pre_read_timespec64 (ThreadId tid, const char *msg, UWord arg)
{
struct vki_timespec64 *ts64 = (void *)(Addr)arg;
@@ -1663,7 +1690,7 @@ static void futex_pre_helper ( ThreadId tid, SyscallArgLayout* layout,
SyscallArgs* arrghs, SyscallStatus* status,
UWord* flags, Bool is_time64 )
{
- /*
+ /*
arg param used by ops
ARG1 - u32 *futex all
@@ -1679,11 +1706,11 @@ static void futex_pre_helper ( ThreadId tid, SyscallArgLayout* layout,
case VKI_FUTEX_WAKE_OP:
case VKI_FUTEX_CMP_REQUEUE_PI:
if (is_time64) {
- PRE_REG_READ6(long, "futex_time64",
+ PRE_REG_READ6(long, "futex_time64",
vki_u32 *, futex, int, op, int, val,
struct timespec64 *, utime, vki_u32 *, uaddr2, int, val3);
} else {
- PRE_REG_READ6(long, "futex",
+ PRE_REG_READ6(long, "futex",
vki_u32 *, futex, int, op, int, val,
struct timespec *, utime, vki_u32 *, uaddr2, int, val3);
}
@@ -1691,11 +1718,11 @@ static void futex_pre_helper ( ThreadId tid, SyscallArgLayout* layout,
case VKI_FUTEX_REQUEUE:
case VKI_FUTEX_WAIT_REQUEUE_PI:
if (is_time64) {
- PRE_REG_READ5(long, "futex_time64",
+ PRE_REG_READ5(long, "futex_time64",
vki_u32 *, futex, int, op, int, val,
struct timespec64 *, utime, vki_u32 *, uaddr2);
} else {
- PRE_REG_READ5(long, "futex",
+ PRE_REG_READ5(long, "futex",
vki_u32 *, futex, int, op, int, val,
struct timespec *, utime, vki_u32 *, uaddr2);
}
@@ -1742,18 +1769,18 @@ static void futex_pre_helper ( ThreadId tid, SyscallArgLayout* layout,
case VKI_FUTEX_WAIT:
case VKI_FUTEX_LOCK_PI:
if (is_time64) {
- PRE_REG_READ4(long, "futex_time64",
+ PRE_REG_READ4(long, "futex_time64",
vki_u32 *, futex, int, op, int, val,
struct timespec64 *, utime);
} else {
- PRE_REG_READ4(long, "futex",
+ PRE_REG_READ4(long, "futex",
vki_u32 *, futex, int, op, int, val,
struct timespec *, utime);
}
break;
case VKI_FUTEX_WAKE:
case VKI_FUTEX_FD:
- PRE_REG_READ3(long, "futex",
+ PRE_REG_READ3(long, "futex",
vki_u32 *, futex, int, op, int, val);
break;
case VKI_FUTEX_TRYLOCK_PI:
@@ -1846,11 +1873,23 @@ POST(sys_futex_time64)
futex_post_helper (tid, arrghs, status);
}
+PRE(sys_futex_waitv)
+{
+ /* asmlinkage long sys_futex_waitv(struct futex_waitv __user *waiters,
+ * unsigned int nr_futexes, unsigned int flags,
+ * struct __kernel_timespec __user *timeout, clockid_t clockid); */
+ *flags |= SfMayBlock;
+ PRINT("sys_futex_waitv ( %#" FMT_REGWORD "x, %ld, %ld, %#" FMT_REGWORD "x, %" FMT_REGWORD "d )",
+ ARG1, SARG2, SARG3, ARG4, SARG5);
+ PRE_MEM_READ("sys_futex_waitv(waiters)", ARG1, sizeof(struct vki_futex_waitv) * ARG2);
+ PRE_MEM_READ("sys_futex_waitv(timeout)", ARG4, sizeof(struct vki__kernel_timespec));
+}
+
PRE(sys_set_robust_list)
{
PRINT("sys_set_robust_list ( %#" FMT_REGWORD "x, %"
FMT_REGWORD "u )", ARG1, ARG2);
- PRE_REG_READ2(long, "set_robust_list",
+ PRE_REG_READ2(long, "set_robust_list",
struct vki_robust_list_head *, head, vki_size_t, len);
/* Just check the robust_list_head structure is readable - don't
@@ -1906,13 +1945,13 @@ static void pselect6_pre_helper ( ThreadId tid, SyscallArgLayout* layout,
}
// XXX: this possibly understates how much memory is read.
if (ARG2 != 0)
- PRE_MEM_READ( "pselect6(readfds)",
+ PRE_MEM_READ( "pselect6(readfds)",
ARG2, ARG1/8 /* __FD_SETSIZE/8 */ );
if (ARG3 != 0)
- PRE_MEM_READ( "pselect6(writefds)",
+ PRE_MEM_READ( "pselect6(writefds)",
ARG3, ARG1/8 /* __FD_SETSIZE/8 */ );
if (ARG4 != 0)
- PRE_MEM_READ( "pselect6(exceptfds)",
+ PRE_MEM_READ( "pselect6(exceptfds)",
ARG4, ARG1/8 /* __FD_SETSIZE/8 */ );
if (ARG5 != 0) {
if (is_time64) {
@@ -2032,6 +2071,8 @@ static void ppoll_pre_helper ( ThreadId tid, SyscallArgLayout* layout,
for (i = 0; i < ARG2; i++) {
PRE_MEM_READ( "ppoll(ufds.fd)",
(Addr)(&ufds[i].fd), sizeof(ufds[i].fd) );
+ if (!ML_(safe_to_deref)(&ufds[i].fd, sizeof(ufds[i].fd)))
+ break;
if (ufds[i].fd >= 0) {
PRE_MEM_READ( "ppoll(ufds.events)",
(Addr)(&ufds[i].events), sizeof(ufds[i].events) );
@@ -2092,6 +2133,19 @@ POST(sys_ppoll_time64)
ppoll_post_helper (tid, arrghs, status);
}
+PRE(sys_swapon)
+{
+ PRINT("sys_swapon ( %#lx, %#lx )", ARG1, ARG2);
+ PRE_REG_READ2(long, "swapon", const void *, path, int, flags);
+ PRE_MEM_RASCIIZ( "swapon(path)", ARG1);
+}
+
+PRE(sys_swapoff)
+{
+ PRINT("sys_swapoff ( %#lx )", ARG1);
+ PRE_REG_READ1(long, "swapoff", const void *, path);
+ PRE_MEM_RASCIIZ( "swapoff(path)", ARG1);
+}
/* ---------------------------------------------------------------------
epoll_* wrappers
@@ -2231,6 +2285,19 @@ POST(sys_epoll_pwait2)
epoll_post_helper (tid, arrghs, status);
}
+PRE(sys_remap_file_pages)
+{
+ /* int remap_file_pages(void addr[.size], size_t size,
+ int prot, size_t pgoff, int flags); */
+ Int arg_3 = (Int) ARG3;
+ Int arg_5 = (Int) ARG5;
+ PRINT("sys_remap_file_pages ( %#" FMT_REGWORD "x, %lu, %d, %lu, %d",
+ ARG1, ARG2, arg_3, ARG4, arg_5);
+ PRE_REG_READ5(int, "remap_file_pages", void *, addr, vki_size_t,
+ size_t, int, prot, vki_size_t, pgoff, int, flags);
+ PRE_MEM_READ("sys_remap_file_pages(addr)", ARG1, ARG2);
+}
+
PRE(sys_eventfd)
{
PRINT("sys_eventfd ( %" FMT_REGWORD "u )", ARG1);
@@ -2295,10 +2362,18 @@ PRE(sys_prlimit64)
vki_pid_t, pid, unsigned int, resource,
const struct rlimit64 *, new_rlim,
struct rlimit64 *, old_rlim);
- if (ARG3)
+ if (ARG3) {
PRE_MEM_READ( "rlimit64(new_rlim)", ARG3, sizeof(struct vki_rlimit64) );
- if (ARG4)
+ }
+ if (ARG4) {
PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct vki_rlimit64) );
+ }
+
+ if ((ARG3 && !ML_(safe_to_deref)((void*)(Addr)ARG3, sizeof(struct vki_rlimit64)))
+ || (ARG4 && !ML_(safe_to_deref)((void*)(Addr)ARG4, sizeof(struct vki_rlimit64)))) {
+ SET_STATUS_Failure(VKI_EFAULT);
+ return;
+ }
if (ARG3 &&
((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur
@@ -2410,7 +2485,7 @@ PRE(sys_tkill)
SET_STATUS_Failure( VKI_EINVAL );
return;
}
-
+
/* Check to see if this kill gave us a pending signal */
*flags |= SfPollAfter;
@@ -2451,7 +2526,7 @@ PRE(sys_tgkill)
SET_STATUS_Failure( VKI_EINVAL );
return;
}
-
+
/* Check to see if this kill gave us a pending signal */
*flags |= SfPollAfter;
@@ -2497,6 +2572,8 @@ PRE(sys_fadvise64)
PRE_REG_READ5(long, "fadvise64",
int, fd, vki_u32, MERGE64_FIRST(offset), vki_u32, MERGE64_SECOND(offset),
vki_size_t, len, int, advice);
+ if ( !ML_(fd_allowed)(SARG1, "fadvise64", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
PRE(sys_fadvise64_64)
@@ -2506,6 +2583,8 @@ PRE(sys_fadvise64_64)
PRE_REG_READ6(long, "fadvise64_64",
int, fd, vki_u32, MERGE64_FIRST(offset), vki_u32, MERGE64_SECOND(offset),
vki_u32, MERGE64_FIRST(len), vki_u32, MERGE64_SECOND(len), int, advice);
+ if ( !ML_(fd_allowed)(SARG1, "fadvise64_64", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
/* ---------------------------------------------------------------------
@@ -2528,7 +2607,7 @@ POST(sys_io_setup)
{
SizeT size;
struct vki_aio_ring *r;
-
+
size = VG_PGROUNDUP(sizeof(struct vki_aio_ring) +
ARG1*sizeof(struct vki_io_event));
r = *(struct vki_aio_ring **)(Addr)ARG2;
@@ -2552,7 +2631,7 @@ POST(sys_io_setup)
PRE(sys_io_destroy)
{
SizeT size = 0;
-
+
PRINT("sys_io_destroy ( %llu )", (ULong)ARG1);
PRE_REG_READ1(long, "io_destroy", vki_aio_context_t, ctx);
@@ -2560,20 +2639,20 @@ PRE(sys_io_destroy)
// possible...
if (ML_(safe_to_deref)( (void*)(Addr)ARG1, sizeof(struct vki_aio_ring))) {
struct vki_aio_ring *r = (struct vki_aio_ring *)(Addr)ARG1;
- size = VG_PGROUNDUP(sizeof(struct vki_aio_ring) +
+ size = VG_PGROUNDUP(sizeof(struct vki_aio_ring) +
r->nr*sizeof(struct vki_io_event));
}
SET_STATUS_from_SysRes( VG_(do_syscall1)(SYSNO, ARG1) );
- if (SUCCESS && RES == 0) {
+ if (SUCCESS && RES == 0) {
Bool d = VG_(am_notify_munmap)( ARG1, size );
VG_TRACK( die_mem_munmap, ARG1, size );
if (d)
- VG_(discard_translations)( (Addr)ARG1, (ULong)size,
+ VG_(discard_translations)( (Addr)ARG1, (ULong)size,
"PRE(sys_io_destroy)" );
- }
-}
+ }
+}
static
void common_pre_io_getevents(ThreadId tid, UWord a1, UWord a2, UWord a3, UWord a4, UWord a5, UWord a6, UWord* flags, const HChar* funtion_name)
@@ -2680,12 +2759,15 @@ PRE(sys_io_submit)
vki_aio_context_t, ctx_id, long, nr,
struct iocb **, iocbpp);
PRE_MEM_READ( "io_submit(iocbpp)", ARG3, ARG2*sizeof(struct vki_iocb *) );
- if (ARG3 != 0) {
+ if (ML_(safe_to_deref)((void *)(Addr)ARG3, ARG2*sizeof(struct vki_iocb *))) {
for (i = 0; i < ARG2; i++) {
struct vki_iocb *cb = ((struct vki_iocb **)(Addr)ARG3)[i];
struct vki_iovec *iov;
PRE_MEM_READ( "io_submit(iocb)", (Addr)cb, sizeof(struct vki_iocb) );
+ if (!ML_(safe_to_deref)(&cb->aio_lio_opcode,
+ sizeof(cb->aio_lio_opcode)))
+ continue;
switch (cb->aio_lio_opcode) {
case VKI_IOCB_CMD_PREAD:
PRE_MEM_WRITE( "io_submit(PREAD)", cb->aio_buf, cb->aio_nbytes );
@@ -2822,16 +2904,16 @@ PRE(sys_fanotify_mark)
PRINT( "sys_fanotify_mark ( %ld, %" FMT_REGWORD "u, %llu, %ld, %#"
FMT_REGWORD "x(%s))", SARG1, ARG2, MERGE64(ARG3,ARG4), SARG5, ARG6,
(HChar *)(Addr)ARG6);
- PRE_REG_READ6(long, "sys_fanotify_mark",
+ PRE_REG_READ6(long, "sys_fanotify_mark",
int, fanotify_fd, unsigned int, flags,
__vki_u32, mask0, __vki_u32, mask1,
int, dfd, const char *, pathname);
if (ARG6)
PRE_MEM_RASCIIZ( "fanotify_mark(path)", ARG6);
#elif VG_WORDSIZE == 8
- PRINT( "sys_fanotify_mark ( %ld, %lu, %lu, %ld, %#lx(%s))",
+ PRINT( "sys_fanotify_mark ( %ld, %lu, %lu, %ld, %#lx(%s))",
SARG1, ARG2, ARG3, SARG4, ARG5, (HChar *)(Addr)ARG5);
- PRE_REG_READ5(long, "sys_fanotify_mark",
+ PRE_REG_READ5(long, "sys_fanotify_mark",
int, fanotify_fd, unsigned int, flags,
__vki_u64, mask,
int, dfd, const char *, pathname);
@@ -2840,6 +2922,9 @@ PRE(sys_fanotify_mark)
#else
# error Unexpected word size
#endif
+ if ( !ML_(fd_allowed)(SARG1, "fanotify_mark(fanotify_fd)", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
+ ML_(fd_at_check_allowed)(SARG4, (const HChar*)ARG5, "fanotify_mark(dirfd)", tid, status);
}
/* ---------------------------------------------------------------------
@@ -2873,6 +2958,7 @@ PRE(sys_inotify_init1)
POST(sys_inotify_init1)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "inotify_init", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -2919,6 +3005,7 @@ PRE(sys_mq_open)
POST(sys_mq_open)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "mq_open", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -3061,7 +3148,7 @@ PRE(sys_mq_getsetattr)
if (ARG3 != 0)
PRE_MEM_WRITE( "mq_getsetattr(omqstat)", ARG3,
sizeof(struct vki_mq_attr) );
- }
+ }
}
POST(sys_mq_getsetattr)
{
@@ -3076,7 +3163,7 @@ POST(sys_mq_getsetattr)
PRE(sys_clock_settime)
{
PRINT("sys_clock_settime( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2);
- PRE_REG_READ2(long, "clock_settime",
+ PRE_REG_READ2(long, "clock_settime",
vki_clockid_t, clk_id, const struct timespec *, tp);
PRE_MEM_READ( "clock_settime(tp)", ARG2, sizeof(struct vki_timespec) );
}
@@ -3092,7 +3179,7 @@ PRE(sys_clock_settime64)
PRE(sys_clock_gettime)
{
PRINT("sys_clock_gettime( %ld, %#" FMT_REGWORD "x )" , SARG1, ARG2);
- PRE_REG_READ2(long, "clock_gettime",
+ PRE_REG_READ2(long, "clock_gettime",
vki_clockid_t, clk_id, struct timespec *, tp);
PRE_MEM_WRITE( "clock_gettime(tp)", ARG2, sizeof(struct vki_timespec) );
}
@@ -3119,7 +3206,7 @@ PRE(sys_clock_getres)
PRINT("sys_clock_getres( %ld, %#" FMT_REGWORD "x )" , SARG1, ARG2);
// Nb: we can't use "RES" as the param name because that's a macro
// defined above!
- PRE_REG_READ2(long, "clock_getres",
+ PRE_REG_READ2(long, "clock_getres",
vki_clockid_t, clk_id, struct timespec *, res);
if (ARG2 != 0)
PRE_MEM_WRITE( "clock_getres(res)", ARG2, sizeof(struct vki_timespec) );
@@ -3222,7 +3309,7 @@ PRE(sys_timer_settime)
{
PRINT("sys_timer_settime( %ld, %ld, %#" FMT_REGWORD "x, %#"
FMT_REGWORD "x )", SARG1,SARG2,ARG3,ARG4);
- PRE_REG_READ4(long, "timer_settime",
+ PRE_REG_READ4(long, "timer_settime",
vki_timer_t, timerid, int, flags,
const struct itimerspec *, value,
struct itimerspec *, ovalue);
@@ -3242,7 +3329,7 @@ PRE(sys_timer_settime64)
{
PRINT("sys_timer_settime64( %ld, %ld, %#" FMT_REGWORD "x, %#"
FMT_REGWORD "x )", SARG1,SARG2,ARG3,ARG4);
- PRE_REG_READ4(long, "timer_settime64",
+ PRE_REG_READ4(long, "timer_settime64",
vki_timer_t, timerid, int, flags,
const struct vki_itimerspec64 *, value,
struct vki_itimerspec64 *, ovalue);
@@ -3261,7 +3348,7 @@ POST(sys_timer_settime64)
PRE(sys_timer_gettime)
{
PRINT("sys_timer_gettime( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2);
- PRE_REG_READ2(long, "timer_gettime",
+ PRE_REG_READ2(long, "timer_gettime",
vki_timer_t, timerid, struct itimerspec *, value);
PRE_MEM_WRITE( "timer_gettime(value)", ARG2,
sizeof(struct vki_itimerspec));
@@ -3274,7 +3361,7 @@ POST(sys_timer_gettime)
PRE(sys_timer_gettime64)
{
PRINT("sys_timer_gettime64( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2);
- PRE_REG_READ2(long, "timer_gettime64",
+ PRE_REG_READ2(long, "timer_gettime64",
vki_timer_t, timerid, struct vki_itimerspec64 *, value);
PRE_MEM_WRITE( "timer_gettime64(value)", ARG2,
sizeof(struct vki_itimerspec64));
@@ -3349,6 +3436,7 @@ PRE(sys_timerfd_create)
}
POST(sys_timerfd_create)
{
+ POST_newFd_RES;
if (linux_kernel_2_6_22())
{
/* 2.6.22 kernel: timerfd system call. */
@@ -3471,12 +3559,12 @@ POST(sys_timerfd_settime64)
PRE(sys_capget)
{
PRINT("sys_capget ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", ARG1, ARG2 );
- PRE_REG_READ2(long, "capget",
+ PRE_REG_READ2(long, "capget",
vki_cap_user_header_t, header, vki_cap_user_data_t, data);
- PRE_MEM_READ( "capget(header)", ARG1,
+ PRE_MEM_READ( "capget(header)", ARG1,
sizeof(struct __vki_user_cap_header_struct) );
if (ARG2 != (Addr)NULL)
- PRE_MEM_WRITE( "capget(data)", ARG2,
+ PRE_MEM_WRITE( "capget(data)", ARG2,
sizeof(struct __vki_user_cap_data_struct) );
}
POST(sys_capget)
@@ -3488,12 +3576,12 @@ POST(sys_capget)
PRE(sys_capset)
{
PRINT("sys_capset ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", ARG1, ARG2 );
- PRE_REG_READ2(long, "capset",
+ PRE_REG_READ2(long, "capset",
vki_cap_user_header_t, header,
const vki_cap_user_data_t, data);
- PRE_MEM_READ( "capset(header)",
+ PRE_MEM_READ( "capset(header)",
ARG1, sizeof(struct __vki_user_cap_header_struct) );
- PRE_MEM_READ( "capset(data)",
+ PRE_MEM_READ( "capset(data)",
ARG2, sizeof(struct __vki_user_cap_data_struct) );
}
@@ -3591,6 +3679,9 @@ PRE(sys_fchown16)
FMT_REGWORD "u )", ARG1, ARG2, ARG3);
PRE_REG_READ3(long, "fchown16",
unsigned int, fd, vki_old_uid_t, owner, vki_old_gid_t, group);
+ if ( !ML_(fd_allowed)(ARG1, "fchown16", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
+
}
/* ---------------------------------------------------------------------
@@ -3685,6 +3776,9 @@ PRE(sys_fgetxattr)
int, fd, char *, name, void *, value, vki_size_t, size);
PRE_MEM_RASCIIZ( "fgetxattr(name)", ARG2 );
PRE_MEM_WRITE( "fgetxattr(value)", ARG3, ARG4 );
+ if ( !ML_(fd_allowed)(SARG1, "fgetxattr", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
+
}
POST(sys_fgetxattr)
{
@@ -3732,6 +3826,9 @@ PRE(sys_flistxattr)
PRE_REG_READ3(ssize_t, "flistxattr",
int, fd, char *, list, vki_size_t, size);
PRE_MEM_WRITE( "flistxattr(list)", ARG2, ARG3 );
+ if ( !ML_(fd_allowed)(ARG1, "flistxattr", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
+
}
POST(sys_flistxattr)
{
@@ -3765,6 +3862,9 @@ PRE(sys_fremovexattr)
PRINT("sys_fremovexattr ( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2);
PRE_REG_READ2(long, "fremovexattr", int, fd, char *, name);
PRE_MEM_RASCIIZ( "fremovexattr(name)", ARG2 );
+ if ( !ML_(fd_allowed)(SARG1, "fremovexattr", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
+
}
/* ---------------------------------------------------------------------
@@ -3774,7 +3874,7 @@ PRE(sys_fremovexattr)
PRE(sys_sched_setparam)
{
PRINT("sched_setparam ( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2 );
- PRE_REG_READ2(long, "sched_setparam",
+ PRE_REG_READ2(long, "sched_setparam",
vki_pid_t, pid, struct sched_param *, p);
PRE_MEM_READ( "sched_setparam(p)", ARG2, sizeof(struct vki_sched_param) );
}
@@ -3786,7 +3886,7 @@ POST(sys_sched_setparam)
PRE(sys_sched_getparam)
{
PRINT("sched_getparam ( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2 );
- PRE_REG_READ2(long, "sched_getparam",
+ PRE_REG_READ2(long, "sched_getparam",
vki_pid_t, pid, struct sched_param *, p);
PRE_MEM_WRITE( "sched_getparam(p)", ARG2, sizeof(struct vki_sched_param) );
}
@@ -3840,10 +3940,10 @@ PRE(sys_sched_setscheduler)
{
PRINT("sys_sched_setscheduler ( %ld, %ld, %#" FMT_REGWORD "x )",
SARG1, SARG2, ARG3);
- PRE_REG_READ3(long, "sched_setscheduler",
+ PRE_REG_READ3(long, "sched_setscheduler",
vki_pid_t, pid, int, policy, struct sched_param *, p);
if (ARG3 != 0)
- PRE_MEM_READ( "sched_setscheduler(p)",
+ PRE_MEM_READ( "sched_setscheduler(p)",
ARG3, sizeof(struct vki_sched_param));
}
@@ -3901,7 +4001,7 @@ PRE(sys_sched_setaffinity)
{
PRINT("sched_setaffinity ( %ld, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )",
SARG1, ARG2, ARG3);
- PRE_REG_READ3(long, "sched_setaffinity",
+ PRE_REG_READ3(long, "sched_setaffinity",
vki_pid_t, pid, unsigned int, len, unsigned long *, mask);
PRE_MEM_READ( "sched_setaffinity(mask)", ARG3, ARG2);
}
@@ -3910,7 +4010,7 @@ PRE(sys_sched_getaffinity)
{
PRINT("sched_getaffinity ( %ld, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )",
SARG1, ARG2, ARG3);
- PRE_REG_READ3(long, "sched_getaffinity",
+ PRE_REG_READ3(long, "sched_getaffinity",
vki_pid_t, pid, unsigned int, len, unsigned long *, mask);
PRE_MEM_WRITE( "sched_getaffinity(mask)", ARG3, ARG2);
}
@@ -4035,6 +4135,22 @@ PRE(sys_quotactl)
PRE_MEM_RASCIIZ( "quotactl(special)", ARG2 );
}
+PRE(sys_quotactl_fd)
+{
+ // SYSCALL_DEFINE4(quotactl_fd,
+ // unsigned int, fd,
+ // unsigned int, cmd,
+ // qid_t, id,
+ // void __user *, addr)
+ PRINT("sys_quotactl (0x%" FMT_REGWORD "x, 0x%#" FMT_REGWORD "x, 0x%"
+ FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1, ARG2, ARG3, ARG4);
+ PRE_REG_READ4(long, "quotactl_fd",
+ unsigned int, fd, unsigned int, cmd, vki_qid_t, id,
+ void *, addr);
+ if (!ML_(fd_allowed)(ARG1, "quotactl_fd", tid, False))
+ SET_STATUS_Failure( VKI_EBADF );
+}
+
PRE(sys_waitid)
{
*flags |= SfMayBlock;
@@ -4043,13 +4159,15 @@ PRE(sys_waitid)
PRE_REG_READ5(int32_t, "sys_waitid",
int, which, vki_pid_t, pid, struct vki_siginfo *, infop,
int, options, struct vki_rusage *, ru);
- PRE_MEM_WRITE( "waitid(infop)", ARG3, sizeof(struct vki_siginfo) );
+ if (ARG3 != 0)
+ PRE_MEM_WRITE( "waitid(infop)", ARG3, sizeof(struct vki_siginfo) );
if (ARG5 != 0)
PRE_MEM_WRITE( "waitid(ru)", ARG5, sizeof(struct vki_rusage) );
}
POST(sys_waitid)
{
- POST_MEM_WRITE( ARG3, sizeof(struct vki_siginfo) );
+ if (ARG3 != 0)
+ POST_MEM_WRITE( ARG3, sizeof(struct vki_siginfo) );
if (ARG5 != 0)
POST_MEM_WRITE( ARG5, sizeof(struct vki_rusage) );
}
@@ -4110,6 +4228,8 @@ PRE(sys_stime)
PRE(sys_perf_event_open)
{
+ // int syscall(SYS_perf_event_open, struct perf_event_attr *attr,
+ // pid_t pid, int cpu, int group_fd, unsigned long flags);
struct vki_perf_event_attr *attr;
PRINT("sys_perf_event_open ( %#" FMT_REGWORD "x, %ld, %ld, %ld, %#"
FMT_REGWORD "x )", ARG1, SARG2, SARG3, SARG4, ARG5);
@@ -4122,11 +4242,19 @@ PRE(sys_perf_event_open)
(Addr)&attr->size, sizeof(attr->size) );
PRE_MEM_READ( "perf_event_open(attr)",
(Addr)attr, attr->size );
+ if ((ARG5 & VKI_PERF_FLAG_FD_NO_GROUP) != VKI_PERF_FLAG_FD_NO_GROUP) {
+ if ((Int)SARG4 != -1) {
+ if (!ML_(fd_allowed)(SARG4, "perf_event_open", tid, False)) {
+ SET_STATUS_Failure(VKI_EBADF);
+ }
+ }
+ }
}
POST(sys_perf_event_open)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "perf_event_open", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -4140,7 +4268,7 @@ PRE(sys_getcpu)
{
PRINT("sys_getcpu ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %#"
FMT_REGWORD "x )" , ARG1, ARG2, ARG3);
- PRE_REG_READ3(int, "getcpu",
+ PRE_REG_READ3(int, "getcpu",
unsigned *, cpu, unsigned *, node, struct vki_getcpu_cache *, tcache);
if (ARG1 != 0)
PRE_MEM_WRITE( "getcpu(cpu)", ARG1, sizeof(unsigned) );
@@ -4205,6 +4333,7 @@ PRE(sys_memfd_create)
POST(sys_memfd_create)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "memfd_create", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -4231,6 +4360,7 @@ POST(sys_landlock_create_ruleset)
{
/* Returns either the abi version or a file descriptor. */
if (ARG3 != VKI_LANDLOCK_CREATE_RULESET_VERSION) {
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "landlock_create_ruleset", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -4271,6 +4401,7 @@ PRE(sys_memfd_secret)
POST(sys_memfd_secret)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "memfd_secret", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -4286,6 +4417,71 @@ PRE(sys_membarrier)
PRE_REG_READ1(int, "membarrier", int, flags);
}
+PRE(sys_mseal)
+{
+ /* int mseal(void *addr, size_t len, unsigned long flags) */
+ PRINT("sys_mseal ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, )", ARG1, ARG2, ARG3);
+ PRE_REG_READ3(int, "mseal", void *, addr, vki_size_t, len, int, flags);
+ /* First check for overflow which produces EINVAL. */
+ if ((Addr)ARG1 > ((SizeT)(-1) - (SizeT)ARG2)) {
+ SET_STATUS_Failure(VKI_EINVAL);
+ } else if (!ML_(valid_client_addr)(ARG1, ARG2, tid, "mseal"))
+ SET_STATUS_Failure(VKI_ENOMEM);
+}
+
+PRE(sys_statmount)
+{
+ // int syscall(SYS_statmount, struct mnt_id_req *req,
+ // struct statmount *smbuf, size_t bufsize,
+ // unsigned long flags);
+ FUSE_COMPATIBLE_MAY_BLOCK();
+ PRINT("sys_statmount ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %lu, %#" FMT_REGWORD "x)", ARG1, ARG2, ARG3, ARG4);
+ PRE_REG_READ4(long, "statmount", struct vki_mnt_id_req *, req, struct vki_statmount *, smbuf, vki_size_t, bufsize, unsigned long, flags);
+
+ struct vki_mnt_id_req *req = (struct vki_mnt_id_req *)(Addr)ARG1;
+ if (!ML_(safe_to_deref) ((void *)&req->size, sizeof(vki_size_t)))
+ PRE_MEM_READ("statmount(req)", ARG1, sizeof(struct vki_mnt_id_req));
+ else
+ PRE_MEM_READ("statmount(req)", ARG1, req->size);
+
+ struct vki_statmount *smbuf = (struct vki_statmount *)(Addr)ARG2;
+ if (!ML_(safe_to_deref) ((void *)&smbuf->size, sizeof(struct vki_statmount)))
+ PRE_MEM_WRITE("statmount(smbuf)", ARG2, sizeof(struct vki_statmount));
+ else
+ PRE_MEM_WRITE("statmount(smbuf)", ARG2, ARG3);
+}
+
+POST(sys_statmount)
+{
+ struct vki_statmount *smbuf = (struct vki_statmount *)(Addr)ARG2;
+ POST_MEM_WRITE((Addr)smbuf, smbuf->size);
+}
+
+PRE(sys_listmount)
+{
+ // int syscall(SYS_listmount, struct mnt_id_req *req,
+ // uint64_t *mnt_ids, size_t nr_mnt_ids,
+ // unsigned long flags);
+ FUSE_COMPATIBLE_MAY_BLOCK();
+ PRINT("sys_listmount ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %lu, %#" FMT_REGWORD "x)", ARG1, ARG2, ARG3, ARG4);
+ PRE_REG_READ4(long, "listmount", struct vki_mnt_id_req *, req, vki_uint64_t *, mnt_ids, vki_size_t, nr_mnt_ids, unsigned long, flags);
+
+ struct vki_mnt_id_req *req = (struct vki_mnt_id_req *)(Addr)ARG1;
+ if (!ML_(safe_to_deref) ((void *)&req->size, sizeof(vki_size_t)))
+ PRE_MEM_READ("listmount(req)", ARG1, sizeof(struct vki_mnt_id_req));
+ else
+ PRE_MEM_READ("listmount(req)", ARG1, req->size);
+
+ PRE_MEM_WRITE("listmount(mnt_ids)", ARG2, ARG3 * sizeof(vki_uint64_t));
+}
+
+POST(sys_listmount)
+{
+ if (RES > 0) {
+ POST_MEM_WRITE(ARG2, RES * sizeof(vki_uint64_t));
+ }
+}
+
PRE(sys_syncfs)
{
*flags |= SfMayBlock;
@@ -4293,6 +4489,42 @@ PRE(sys_syncfs)
PRE_REG_READ1(long, "syncfs", unsigned int, fd);
}
+PRE(sys_sysfs)
+{
+ FUSE_COMPATIBLE_MAY_BLOCK();
+ switch (ARG1) {
+ case 1:
+ PRINT("sys_sysfs ( %lu, %lu )", ARG1, ARG2);
+ PRE_REG_READ2(long, "sysfs", int, flags, const void *, path);
+ PRE_MEM_RASCIIZ("sysfs(path)", ARG2);
+ break;
+ case 2:
+ PRINT("sys_sysfs ( %lu, %lu, %#" FMT_REGWORD "x )",
+ ARG1, ARG2, ARG3);
+ PRE_REG_READ3(long, "sysfs", int, flags, int, desc, void *, path);
+ PRE_MEM_WRITE("sysfs(path)", ARG3, 1);
+ break;
+ case 3:
+ PRINT("sys_sysfs ( %lu )", ARG1);
+ PRE_REG_READ1(long, "sysfs", int, flags);
+ break;
+ default:
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(message)(Vg_DebugMsg,
+ "WARNING: unhandled sysfs option %lu\n", ARG1);
+ }
+ break;
+ }
+}
+
+POST(sys_sysfs)
+{
+ if (ARG1 == 2) {
+ // For option 2, getting the fsname, there is no way to know how big the buffer needs to be.
+ POST_MEM_WRITE(ARG3, VG_(strlen)((void *)ARG3));
+ }
+}
+
PRE(sys_statx)
{
FUSE_COMPATIBLE_MAY_BLOCK();
@@ -4403,7 +4635,7 @@ PRE(sys_sigprocmask)
vki_sigset_t bigger_oldset;
PRINT("sys_sigprocmask ( %ld, %#lx, %#lx )", SARG1, ARG2, ARG3);
- PRE_REG_READ3(long, "sigprocmask",
+ PRE_REG_READ3(long, "sigprocmask",
int, how, vki_old_sigset_t *, set, vki_old_sigset_t *, oldset);
if (ARG2 != 0)
PRE_MEM_READ( "sigprocmask(set)", ARG2, sizeof(vki_old_sigset_t));
@@ -4421,7 +4653,7 @@ PRE(sys_sigprocmask)
bigger_set.sig[0] = *(vki_old_sigset_t*)set;
SET_STATUS_from_SysRes(
- VG_(do_sys_sigprocmask) ( tid, ARG1 /*how*/,
+ VG_(do_sys_sigprocmask) ( tid, ARG1 /*how*/,
set ? &bigger_set : NULL,
oldset ? &bigger_oldset : NULL)
);
@@ -4440,7 +4672,7 @@ POST(sys_sigprocmask)
}
/* Convert from non-RT to RT sigset_t's */
-static
+static
void convert_sigset_to_rt(const vki_old_sigset_t *oldset, vki_sigset_t *set)
{
VG_(sigemptyset)(set);
@@ -4537,6 +4769,7 @@ PRE(sys_signalfd)
}
POST(sys_signalfd)
{
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "signalfd", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -4558,6 +4791,7 @@ PRE(sys_signalfd4)
}
POST(sys_signalfd4)
{
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "signalfd4", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -4600,14 +4834,18 @@ PRE(sys_rt_sigaction)
if (ARG2 != 0
&& ! ML_(safe_to_deref)((void *)(Addr)ARG2,
sizeof(vki_sigaction_toK_t))) {
- VG_(umsg)("Warning: bad act handler address %p in rt_sigaction()\n",
- (void *)(Addr)ARG2);
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(umsg)("Warning: bad act handler address %p in rt_sigaction()\n",
+ (void *)(Addr)ARG2);
+ }
SET_STATUS_Failure ( VKI_EFAULT );
} else if ((ARG3 != 0
&& ! ML_(safe_to_deref)((void *)(Addr)ARG3,
sizeof(vki_sigaction_fromK_t)))) {
- VG_(umsg)("Warning: bad oldact handler address %p in rt_sigaction()\n",
- (void *)(Addr)ARG3);
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(umsg)("Warning: bad oldact handler address %p in rt_sigaction()\n",
+ (void *)(Addr)ARG3);
+ }
SET_STATUS_Failure ( VKI_EFAULT );
} else {
@@ -4632,7 +4870,7 @@ PRE(sys_rt_sigprocmask)
{
PRINT("sys_rt_sigprocmask ( %ld, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %"
FMT_REGWORD "u )", SARG1, ARG2, ARG3, ARG4);
- PRE_REG_READ4(long, "rt_sigprocmask",
+ PRE_REG_READ4(long, "rt_sigprocmask",
int, how, vki_sigset_t *, set, vki_sigset_t *, oldset,
vki_size_t, sigsetsize);
if (ARG2 != 0)
@@ -4647,20 +4885,24 @@ PRE(sys_rt_sigprocmask)
SET_STATUS_Failure( VKI_EINVAL );
else if (ARG2 != 0
&& ! ML_(safe_to_deref)((void *)(Addr)ARG2, sizeof(vki_sigset_t))) {
- VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n",
- (void *)(Addr)ARG2);
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n",
+ (void *)(Addr)ARG2);
+ }
SET_STATUS_Failure ( VKI_EFAULT );
}
else if (ARG3 != 0
&& ! ML_(safe_to_deref)((void *)(Addr)ARG3, sizeof(vki_sigset_t))) {
- VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n",
- (void *)(Addr)ARG3);
+ if (VG_(clo_verbosity) >= 1) {
+ VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n",
+ (void *)(Addr)ARG3);
+ }
SET_STATUS_Failure ( VKI_EFAULT );
}
else {
- SET_STATUS_from_SysRes(
- VG_(do_sys_sigprocmask) ( tid, ARG1 /*how*/,
+ SET_STATUS_from_SysRes(
+ VG_(do_sys_sigprocmask) ( tid, ARG1 /*how*/,
(vki_sigset_t*) (Addr)ARG2,
(vki_sigset_t*) (Addr)ARG3 )
);
@@ -4679,7 +4921,7 @@ POST(sys_rt_sigprocmask)
PRE(sys_rt_sigpending)
{
PRINT( "sys_rt_sigpending ( %#" FMT_REGWORD "x )", ARG1 );
- PRE_REG_READ2(long, "rt_sigpending",
+ PRE_REG_READ2(long, "rt_sigpending",
vki_sigset_t *, set, vki_size_t, sigsetsize);
PRE_MEM_WRITE( "rt_sigpending(set)", ARG1, sizeof(vki_sigset_t));
}
@@ -4694,10 +4936,10 @@ PRE(sys_rt_sigtimedwait)
PRINT("sys_rt_sigtimedwait ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %#"
FMT_REGWORD "x, %" FMT_REGWORD "u )",
ARG1, ARG2, ARG3, ARG4);
- PRE_REG_READ4(long, "rt_sigtimedwait",
+ PRE_REG_READ4(long, "rt_sigtimedwait",
const vki_sigset_t *, set, vki_siginfo_t *, info,
const struct timespec *, timeout, vki_size_t, sigsetsize);
- if (ARG1 != 0)
+ if (ARG1 != 0)
PRE_MEM_READ( "rt_sigtimedwait(set)", ARG1, sizeof(vki_sigset_t));
if (ARG2 != 0)
PRE_MEM_WRITE( "rt_sigtimedwait(info)", ARG2, sizeof(vki_siginfo_t) );
@@ -4717,11 +4959,11 @@ PRE(sys_rt_sigtimedwait_time64)
PRINT("sys_rt_sigtimedwait_time64 ( %#" FMT_REGWORD "x, %#"
FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )",
ARG1, ARG2, ARG3, ARG4);
- PRE_REG_READ4(long, "rt_sigtimedwait_time64",
+ PRE_REG_READ4(long, "rt_sigtimedwait_time64",
const vki_sigset_t *, set, vki_siginfo_t *, info,
const struct vki_timespec64 *, timeout,
vki_size_t, sigsetsize);
- if (ARG1 != 0)
+ if (ARG1 != 0)
PRE_MEM_READ( "rt_sigtimedwait_time64(set)", ARG1, sizeof(vki_sigset_t) );
if (ARG2 != 0)
PRE_MEM_WRITE( "rt_sigtimedwait_time64(info)", ARG2,
@@ -4739,7 +4981,7 @@ PRE(sys_rt_sigqueueinfo)
{
PRINT("sys_rt_sigqueueinfo(%ld, %ld, %#" FMT_REGWORD "x)",
SARG1, SARG2, ARG3);
- PRE_REG_READ3(long, "rt_sigqueueinfo",
+ PRE_REG_READ3(long, "rt_sigqueueinfo",
int, pid, int, sig, vki_siginfo_t *, uinfo);
if (ARG2 != 0)
PRE_MEM_READ( "rt_sigqueueinfo(uinfo)", ARG3, VKI_SI_MAX_SIZE );
@@ -4979,10 +5221,10 @@ PRE(sys_ipc)
void *, ptr);
Addr msgp;
Word msgtyp;
-
+
msgp = deref_Addr( tid, (Addr) (&((struct vki_ipc_kludge *)(Addr)ARG5)->msgp),
"msgrcv(msgp)" );
- msgtyp = deref_Addr( tid,
+ msgtyp = deref_Addr( tid,
(Addr) (&((struct vki_ipc_kludge *)(Addr)ARG5)->msgtyp),
"msgrcv(msgp)" );
@@ -5373,12 +5615,12 @@ PRE(sys_socketcall)
break;
case VKI_SYS_BIND:
- /* int bind(int sockfd, struct sockaddr *my_addr,
+ /* int bind(int sockfd, struct sockaddr *my_addr,
int addrlen); */
PRE_MEM_READ_ef( "socketcall.bind(args)", ARG2, 3*sizeof(Addr) );
ML_(generic_PRE_sys_bind)( tid, ARG2_0, ARG2_1, ARG2_2 );
break;
-
+
case VKI_SYS_LISTEN:
/* int listen(int s, int backlog); */
PRE_MEM_READ_ef( "socketcall.listen(args)", ARG2, 2*sizeof(Addr) );
@@ -5397,11 +5639,11 @@ PRE(sys_socketcall)
break;
case VKI_SYS_SENDTO:
- /* int sendto(int s, const void *msg, int len,
- unsigned int flags,
+ /* int sendto(int s, const void *msg, int len,
+ unsigned int flags,
const struct sockaddr *to, int tolen); */
PRE_MEM_READ_ef( "socketcall.sendto(args)", ARG2, 6*sizeof(Addr) );
- ML_(generic_PRE_sys_sendto)( tid, ARG2_0, ARG2_1, ARG2_2,
+ ML_(generic_PRE_sys_sendto)( tid, ARG2_0, ARG2_1, ARG2_2,
ARG2_3, ARG2_4, ARG2_5 );
break;
@@ -5415,10 +5657,10 @@ PRE(sys_socketcall)
/* int recvfrom(int s, void *buf, int len, unsigned int flags,
struct sockaddr *from, int *fromlen); */
PRE_MEM_READ_ef( "socketcall.recvfrom(args)", ARG2, 6*sizeof(Addr) );
- ML_(generic_PRE_sys_recvfrom)( tid, ARG2_0, ARG2_1, ARG2_2,
+ ML_(generic_PRE_sys_recvfrom)( tid, ARG2_0, ARG2_1, ARG2_2,
ARG2_3, ARG2_4, ARG2_5 );
break;
-
+
case VKI_SYS_RECV:
/* int recv(int s, void *buf, int len, unsigned int flags); */
/* man 2 recv says:
@@ -5431,25 +5673,25 @@ PRE(sys_socketcall)
break;
case VKI_SYS_CONNECT:
- /* int connect(int sockfd,
+ /* int connect(int sockfd,
struct sockaddr *serv_addr, int addrlen ); */
PRE_MEM_READ_ef( "socketcall.connect(args)", ARG2, 3*sizeof(Addr) );
ML_(generic_PRE_sys_connect)( tid, ARG2_0, ARG2_1, ARG2_2 );
break;
case VKI_SYS_SETSOCKOPT:
- /* int setsockopt(int s, int level, int optname,
+ /* int setsockopt(int s, int level, int optname,
const void *optval, int optlen); */
PRE_MEM_READ_ef( "socketcall.setsockopt(args)", ARG2, 5*sizeof(Addr) );
- ML_(linux_PRE_sys_setsockopt)( tid, ARG2_0, ARG2_1, ARG2_2,
+ ML_(linux_PRE_sys_setsockopt)( tid, ARG2_0, ARG2_1, ARG2_2,
ARG2_3, ARG2_4 );
break;
case VKI_SYS_GETSOCKOPT:
- /* int getsockopt(int s, int level, int optname,
+ /* int getsockopt(int s, int level, int optname,
void *optval, socklen_t *optlen); */
PRE_MEM_READ_ef( "socketcall.getsockopt(args)", ARG2, 5*sizeof(Addr) );
- ML_(linux_PRE_sys_getsockopt)( tid, ARG2_0, ARG2_1, ARG2_2,
+ ML_(linux_PRE_sys_getsockopt)( tid, ARG2_0, ARG2_1, ARG2_2,
ARG2_3, ARG2_4 );
break;
@@ -5476,7 +5718,7 @@ PRE(sys_socketcall)
ML_(generic_PRE_sys_sendmsg)( tid, "msg",
(struct vki_msghdr *)(Addr)ARG2_1 );
break;
-
+
case VKI_SYS_RECVMSG:
/* int recvmsg(int s, struct msghdr *msg, int flags); */
PRE_MEM_READ_ef("socketcall.recvmsg(args)", ARG2, 3*sizeof(Addr) );
@@ -5525,9 +5767,9 @@ POST(sys_socketcall)
switch (ARG1 /* request */) {
case VKI_SYS_SOCKETPAIR:
- r = ML_(generic_POST_sys_socketpair)(
- tid, VG_(mk_SysRes_Success)(RES),
- ARG2_0, ARG2_1, ARG2_2, ARG2_3
+ r = ML_(generic_POST_sys_socketpair)(
+ tid, VG_(mk_SysRes_Success)(RES),
+ ARG2_0, ARG2_1, ARG2_2, ARG2_3
);
SET_STATUS_from_SysRes(r);
break;
@@ -5538,10 +5780,10 @@ POST(sys_socketcall)
break;
case VKI_SYS_BIND:
- /* int bind(int sockfd, struct sockaddr *my_addr,
+ /* int bind(int sockfd, struct sockaddr *my_addr,
int addrlen); */
break;
-
+
case VKI_SYS_LISTEN:
/* int listen(int s, int backlog); */
break;
@@ -5550,7 +5792,7 @@ POST(sys_socketcall)
case VKI_SYS_ACCEPT4:
/* int accept(int s, struct sockaddr *addr, int *addrlen); */
/* int accept4(int s, struct sockaddr *addr, int *addrlen, int flags); */
- r = ML_(generic_POST_sys_accept)( tid, VG_(mk_SysRes_Success)(RES),
+ r = ML_(generic_POST_sys_accept)( tid, VG_(mk_SysRes_Success)(RES),
ARG2_0, ARG2_1, ARG2_2 );
SET_STATUS_from_SysRes(r);
break;
@@ -5579,7 +5821,7 @@ POST(sys_socketcall)
case VKI_SYS_GETSOCKOPT:
ML_(linux_POST_sys_getsockopt)( tid, VG_(mk_SysRes_Success)(RES),
- ARG2_0, ARG2_1,
+ ARG2_0, ARG2_1,
ARG2_2, ARG2_3, ARG2_4 );
break;
@@ -5589,7 +5831,7 @@ POST(sys_socketcall)
break;
case VKI_SYS_GETPEERNAME:
- ML_(generic_POST_sys_getpeername)( tid, VG_(mk_SysRes_Success)(RES),
+ ML_(generic_POST_sys_getpeername)( tid, VG_(mk_SysRes_Success)(RES),
ARG2_0, ARG2_1, ARG2_2 );
break;
@@ -5717,7 +5959,7 @@ PRE(sys_send)
PRINT("sys_send ( %ld, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#"
FMT_REGWORD "x )", SARG1, ARG2, ARG3, ARG4);
PRE_REG_READ4(long, "send",
- int, s, const void *, msg, vki_size_t, len,
+ int, s, const void *, msg, vki_size_t, len,
int, flags);
ML_(generic_PRE_sys_send)( tid, ARG1, ARG2, ARG3 );
@@ -5730,13 +5972,13 @@ PRE(sys_sendto)
FMT_REGWORD "u, %#" FMT_REGWORD "x, %ld )",
SARG1, ARG2, ARG3, ARG4, ARG5, SARG6);
PRE_REG_READ6(long, "sendto",
- int, s, const void *, msg, vki_size_t, len,
- unsigned int, flags,
+ int, s, const void *, msg, vki_size_t, len,
+ unsigned int, flags,
const struct sockaddr *, to, int, tolen);
ML_(generic_PRE_sys_sendto)(tid, ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
}
-PRE (sys_recv)
+PRE (sys_recv)
{
*flags |= SfMayBlock;
PRINT ("sys_recv ( %ld, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %"
@@ -5744,12 +5986,12 @@ PRE (sys_recv)
PRE_REG_READ4 (long, "recv", int, s, void *, buf, vki_size_t, len,
unsigned int, flags);
ML_ (generic_PRE_sys_recv) (tid, ARG1, ARG2, ARG3);
-}
+}
-POST (sys_recv)
+POST (sys_recv)
{
ML_ (generic_POST_sys_recv) (tid, RES, ARG1, ARG2, ARG3);
-}
+}
PRE(sys_recvfrom)
{
@@ -5869,31 +6111,91 @@ PRE(sys_openat)
{
HChar name[30]; // large enough
SysRes sres;
+ Bool proc_self_exe = False;
+
+ /* Check for /proc/self/exe or /proc//exe case
+ * first so that we can then use the later checks. */
+ VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
+ if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 )
+ && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0
+ || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/exe") == 0)) {
+ proc_self_exe = True;
+ }
if (ARG3 & VKI_O_CREAT) {
// 4-arg version
PRINT("sys_openat ( %ld, %#" FMT_REGWORD "x(%s), %ld, %ld )",
SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3, SARG4);
PRE_REG_READ4(long, "openat",
- int, dfd, const char *, filename, int, flags, int, mode);
+ int, dirfd, const char *, pathname, int, flags, int, mode);
} else {
// 3-arg version
PRINT("sys_openat ( %ld, %#" FMT_REGWORD "x(%s), %ld )",
SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3);
PRE_REG_READ3(long, "openat",
- int, dfd, const char *, filename, int, flags);
+ int, dirfd, const char *, pathname, int, flags);
}
- PRE_MEM_RASCIIZ( "openat(filename)", ARG2 );
+ PRE_MEM_RASCIIZ( "openat(pathname)", ARG2 );
- /* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD,
- filename is relative to cwd. When comparing dfd against AT_FDCWD,
+ // check that we are not trying to open the client exe for writing
+ if ((ARG3 & VKI_O_WRONLY) ||
+ (ARG3 & VKI_O_RDWR)) {
+ if (proc_self_exe) {
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ return;
+ } else {
+ vg_assert(VG_(resolved_exename));
+ if (!VG_(strncmp)(VG_(resolved_exename), "#!", 2)) {
+ goto no_client_write;
+ }
+ Int fd = ARG1;
+ const HChar* path = (const HChar*)ARG2;
+ if (ML_(safe_to_deref)(path, 1)) {
+ // we need something like a "ML_(safe_to_deref_path)" that does a binary search for the addressable length, and maybe nul
+ if (path[0] == '/') {
+ // ignore fd
+ HChar tmp[VKI_PATH_MAX];
+ if (VG_(realpath)(path, tmp)) {
+ if (!VG_(strcmp)(tmp, VG_(resolved_exename))) {
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ return;
+ }
+ }
+ } else {
+ if (fd == VKI_AT_FDCWD) {
+ HChar tmp[VKI_PATH_MAX];
+ if (VG_(realpath)(path, tmp)) {
+ if (!VG_(strcmp)(tmp, VG_(resolved_exename))) {
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ }
+ }
+ } else {
+ const HChar* dirname;
+ if (VG_(resolve_filename)(fd, &dirname) == False) {
+ goto no_client_write; // let the OS do the error handling
+ }
+ HChar tmp1[VKI_PATH_MAX];
+ VG_(snprintf)(tmp1, VKI_PATH_MAX, "%s/%s", dirname, path);
+ tmp1[VKI_PATH_MAX - 1] = '\0';
+ HChar tmp2[VKI_PATH_MAX];
+ if (VG_(realpath)(tmp1, tmp2)) {
+ if (!VG_(strcmp)(tmp2, VG_(resolved_exename))) {
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+no_client_write:
+
+ /* For absolute filenames, dirfd is ignored. If dirfd is AT_FDCWD,
+ filename is relative to cwd. When comparing dirfd against AT_FDCWD,
be sure only to compare the bottom 32 bits. */
- if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 )
- && *(Char *)(Addr)ARG2 != '/'
- && ((Int)ARG1) != ((Int)VKI_AT_FDCWD)
- && !ML_(fd_allowed)(ARG1, "openat", tid, False))
- SET_STATUS_Failure( VKI_EBADF );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "openat", tid, status);
/* Handle the case where the open is of /proc/self/cmdline or
/proc//cmdline, and just give it a copy of the fd for the
@@ -5902,7 +6204,7 @@ PRE(sys_openat)
VG_(sprintf)(name, "/proc/%d/cmdline", VG_(getpid)());
if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 )
- && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0
+ && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0
|| VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/cmdline") == 0)) {
sres = VG_(dup)( VG_(cl_cmdline_fd) );
SET_STATUS_from_SysRes( sres );
@@ -5918,7 +6220,7 @@ PRE(sys_openat)
VG_(sprintf)(name, "/proc/%d/auxv", VG_(getpid)());
if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 )
- && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0
+ && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0
|| VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/auxv") == 0)) {
sres = VG_(dup)( VG_(cl_auxv_fd) );
SET_STATUS_from_SysRes( sres );
@@ -5930,20 +6232,10 @@ PRE(sys_openat)
return;
}
- /* And for /proc/self/exe or /proc//exe case. */
+ if (proc_self_exe) {
- VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
- if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 )
- && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0
- || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/exe") == 0)) {
- sres = VG_(dup)( VG_(cl_exec_fd) );
- SET_STATUS_from_SysRes( sres );
- if (!sr_isError(sres)) {
- OffT off = VG_(lseek)( sr_Res(sres), 0, VKI_SEEK_SET );
- if (off < 0)
- SET_STATUS_Failure( VKI_EMFILE );
- }
- return;
+ // do the syscall with VG_(resolved_exename)
+ ARG2 = (Word)VG_(resolved_exename);
}
/* Otherwise handle normally */
@@ -5968,6 +6260,7 @@ PRE(sys_mkdirat)
*flags |= SfMayBlock;
PRINT("sys_mkdirat ( %ld, %#" FMT_REGWORD "x(%s), %ld )",
SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mkdirat", tid, status);
PRE_REG_READ3(long, "mkdirat",
int, dfd, const char *, pathname, int, mode);
PRE_MEM_RASCIIZ( "mkdirat(pathname)", ARG2 );
@@ -5978,6 +6271,7 @@ PRE(sys_mknodat)
FUSE_COMPATIBLE_MAY_BLOCK();
PRINT("sys_mknodat ( %ld, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%"
FMT_REGWORD "x )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4 );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mknodat", tid, status);
PRE_REG_READ4(long, "mknodat",
int, dfd, const char *, pathname, int, mode, unsigned, dev);
PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 );
@@ -5986,25 +6280,27 @@ PRE(sys_mknodat)
PRE(sys_fchownat)
{
FUSE_COMPATIBLE_MAY_BLOCK();
- PRINT("sys_fchownat ( %ld, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%"
- FMT_REGWORD "x )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4);
+ PRINT("sys_fchownat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%"
+ FMT_REGWORD "x )", SARG1, ARG2, (HChar*)ARG2, ARG3, ARG4);
PRE_REG_READ4(long, "fchownat",
int, dfd, const char *, path,
vki_uid_t, owner, vki_gid_t, group);
PRE_MEM_RASCIIZ( "fchownat(path)", ARG2 );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fchownat", tid, status);
}
PRE(sys_futimesat)
{
FUSE_COMPATIBLE_MAY_BLOCK();
- PRINT("sys_futimesat ( %ld, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",
- SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3);
+ PRINT("sys_futimesat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",
+ SARG1, ARG2, (HChar*)ARG2, ARG3);
PRE_REG_READ3(long, "futimesat",
int, dfd, char *, filename, struct timeval *, tvp);
if (ARG2 != 0)
PRE_MEM_RASCIIZ( "futimesat(filename)", ARG2 );
if (ARG3 != 0)
PRE_MEM_READ( "futimesat(tvp)", ARG3, 2 * sizeof(struct vki_timeval) );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "futimesat", tid, status);
}
PRE(sys_utimensat)
@@ -6014,6 +6310,7 @@ PRE(sys_utimensat)
FMT_REGWORD "x )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4);
PRE_REG_READ4(long, "utimensat",
int, dfd, char *, filename, struct timespec *, utimes, int, flags);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "utimensat", tid, status);
if (ARG2 != 0)
PRE_MEM_RASCIIZ( "utimensat(filename)", ARG2 );
if (ARG3 != 0) {
@@ -6045,6 +6342,7 @@ PRE(sys_utimensat_time64)
SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4);
PRE_REG_READ4(long, "utimensat_time64",
int, dfd, char *, filename, struct timespec *, utimes, int, flags);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "utimensat_time64", tid, status);
if (ARG2 != 0)
PRE_MEM_RASCIIZ( "utimensat_time64(filename)", ARG2 );
if (ARG3 != 0) {
@@ -6076,6 +6374,7 @@ PRE(sys_newfstatat)
SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3);
PRE_REG_READ3(long, "fstatat",
int, dfd, char *, file_name, struct stat *, buf);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "newfstatat", tid, status);
// See the comment about Rust in PRE(sys_statx). When glibc does support
// statx rust uses that instead of the system call, but glibc's statx is
// implemented in terms of fstatat, so the filename being NULL is
@@ -6098,6 +6397,7 @@ PRE(sys_unlinkat)
PRINT("sys_unlinkat ( %ld, %#" FMT_REGWORD "x(%s) )", SARG1, ARG2,
(HChar*)(Addr)ARG2);
PRE_REG_READ2(long, "unlinkat", int, dfd, const char *, pathname);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "unlinkat", tid, status);
PRE_MEM_RASCIIZ( "unlinkat(pathname)", ARG2 );
}
@@ -6110,6 +6410,7 @@ PRE(sys_renameat)
PRE_REG_READ4(long, "renameat",
int, olddfd, const char *, oldpath,
int, newdfd, const char *, newpath);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "renameat", tid, status);
PRE_MEM_RASCIIZ( "renameat(oldpath)", ARG2 );
PRE_MEM_RASCIIZ( "renameat(newpath)", ARG4 );
}
@@ -6124,6 +6425,8 @@ PRE(sys_renameat2)
int, olddfd, const char *, oldpath,
int, newdfd, const char *, newpath,
unsigned int, flags);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "renameat2(olddirfd)", tid, status);
+ ML_(fd_at_check_allowed)(SARG3, (const HChar*)ARG4, "renameat2(newdirfd)", tid, status);
PRE_MEM_RASCIIZ( "renameat2(oldpath)", ARG2 );
PRE_MEM_RASCIIZ( "renameat2(newpath)", ARG4 );
}
@@ -6138,6 +6441,7 @@ PRE(sys_linkat)
int, olddfd, const char *, oldpath,
int, newdfd, const char *, newpath,
int, flags);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "linkat", tid, status);
PRE_MEM_RASCIIZ( "linkat(oldpath)", ARG2);
PRE_MEM_RASCIIZ( "linkat(newpath)", ARG4);
}
@@ -6149,6 +6453,7 @@ PRE(sys_symlinkat)
"x(%s) )", ARG1, (HChar*)(Addr)ARG1, SARG2, ARG3, (HChar*)(Addr)ARG3);
PRE_REG_READ3(long, "symlinkat",
const char *, oldpath, int, newdfd, const char *, newpath);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "symlinkat", tid, status);
PRE_MEM_RASCIIZ( "symlinkat(oldpath)", ARG1 );
PRE_MEM_RASCIIZ( "symlinkat(newpath)", ARG3 );
}
@@ -6160,6 +6465,7 @@ PRE(sys_readlinkat)
FMT_REGWORD "u )", SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4);
PRE_REG_READ4(long, "readlinkat",
int, dfd, const char *, path, char *, buf, vki_size_t, bufsiz);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "readlinkat", tid, status);
PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 );
PRE_MEM_WRITE( "readlinkat(buf)", ARG3,ARG4 );
}
@@ -6169,6 +6475,7 @@ POST(sys_readlinkat)
HChar name[30]; // large enough
Word saved = SYSNO;
+ // @todo PJF why is this done in POST and not in PRE?
/*
* Handle the case where readlinkat is looking at /proc/self/exe or
* /proc//exe.
@@ -6178,7 +6485,7 @@ POST(sys_readlinkat)
&& (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0
|| VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/exe") == 0)) {
VG_(sprintf)(name, "/proc/self/fd/%d", VG_(cl_exec_fd));
- SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, (UWord)name,
+ SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, (UWord)name,
ARG3, ARG4));
}
@@ -6188,44 +6495,77 @@ POST(sys_readlinkat)
PRE(sys_fchmodat)
{
+ Int arg_1 = (Int) ARG1;
+ const HChar *path = (const HChar*) ARG2;
FUSE_COMPATIBLE_MAY_BLOCK();
- PRINT("sys_fchmodat ( %ld, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )",
- SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3);
+ PRINT("sys_fchmodat ( %d, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )",
+ arg_1, ARG2, path, ARG3);
PRE_REG_READ3(long, "fchmodat",
int, dfd, const char *, path, vki_mode_t, mode);
PRE_MEM_RASCIIZ( "fchmodat(path)", ARG2 );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fchmodat", tid, status);
+}
+
+PRE(sys_cachestat)
+{
+ PRINT("sys_cachestat ( %lu, %#lx, %#lx, %lu )", ARG1, ARG2, ARG3, ARG4);
+ PRE_REG_READ4(long, "cachestat",
+ unsigned long, fd, struct vki_cachestat_range *, cstat_range,
+ struct vki_cachestat*, cstat, unsigned long, flags);
+ if (!ML_(fd_allowed)(ARG1, "cachestat", tid, False))
+ SET_STATUS_Failure( VKI_EBADF );
+ const struct vki_cachestat_range *cstat_range = (struct vki_cachestat_range *)(Addr)ARG2;
+ PRE_MEM_READ("cachestat(cstat_range)", ARG2, sizeof(*cstat_range) );
+ const struct vki_cachestat *cstat = (struct vki_cachestat *)(Addr)ARG3;
+ PRE_MEM_WRITE("cachestat(cstat)", ARG3, sizeof(*cstat) );
+}
+
+POST(sys_cachestat)
+{
+ vg_assert(SUCCESS);
+ POST_MEM_WRITE(ARG3, sizeof(struct vki_cachestat));
}
PRE(sys_fchmodat2)
{
FUSE_COMPATIBLE_MAY_BLOCK();
- PRINT("sys_fchmodat2 ( %ld, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %"
+ PRINT("sys_fchmodat2 ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %"
FMT_REGWORD "u )",
- SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4);
+ SARG1, ARG2, (const HChar*)ARG2, ARG3, ARG4);
PRE_REG_READ4(long, "fchmodat2",
int, dfd, const char *, path, vki_mode_t, mode,
unsigned int, flags);
PRE_MEM_RASCIIZ( "fchmodat2(pathname)", ARG2 );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fchmodat2", tid, status);
}
PRE(sys_faccessat)
{
FUSE_COMPATIBLE_MAY_BLOCK();
- PRINT("sys_faccessat ( %ld, %#" FMT_REGWORD "x(%s), %ld )",
- SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3);
+ Int arg_1 = (Int) ARG1;
+ const HChar *path = (const HChar*) ARG2;
+ Int arg_3 = (Int) ARG3;
+ PRINT("sys_faccessat ( %d, %#" FMT_REGWORD "x(%s), %d )",
+ arg_1, ARG2, path, arg_3);
PRE_REG_READ3(long, "faccessat",
int, dfd, const char *, pathname, int, mode);
PRE_MEM_RASCIIZ( "faccessat(pathname)", ARG2 );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "faccessat", tid, status);
}
PRE(sys_faccessat2)
{
FUSE_COMPATIBLE_MAY_BLOCK();
- PRINT("sys_faccessat2 ( %ld, %#" FMT_REGWORD "x(%s), %ld, %ld )",
- SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3, SARG4);
+ Int arg_1 = (Int) ARG1;
+ const HChar *path = (const HChar*) ARG2;
+ Int arg_3 = (Int) ARG3;
+ Int arg_4 = (Int) ARG4;
+ PRINT("sys_faccessat2 ( %d, %#" FMT_REGWORD "x(%s), %d, %d )",
+ arg_1, ARG2, path, arg_3, arg_4);
PRE_REG_READ4(long, "faccessat2",
int, dfd, const char *, pathname, int, mode, int, flags);
PRE_MEM_RASCIIZ( "faccessat2(pathname)", ARG2 );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "faccessat2", tid, status);
}
PRE(sys_name_to_handle_at)
@@ -6270,6 +6610,7 @@ PRE(sys_open_by_handle_at)
POST(sys_open_by_handle_at)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "open_by_handle_at", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -6637,7 +6978,7 @@ PRE(sys_request_key)
FMT_REGWORD "x(%s), %ld )", ARG1, (HChar*)(Addr)ARG1, ARG2,
(HChar*)(Addr)ARG2, ARG3, (HChar*)(Addr)ARG3, SARG4);
PRE_REG_READ4(long, "request_key",
- const char *, type, const char *, description,
+ const char *, type, const char *, description,
const char *, callout_info, vki_key_serial_t, keyring);
PRE_MEM_RASCIIZ( "request_key(type)", ARG1);
PRE_MEM_RASCIIZ( "request_key(description)", ARG2);
@@ -6652,7 +6993,7 @@ PRE(sys_add_key)
ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4, SARG5);
PRE_REG_READ5(long, "add_key",
const char *, type, const char *, description,
- const void *, payload, vki_size_t, plen,
+ const void *, payload, vki_size_t, plen,
vki_key_serial_t, keyring);
PRE_MEM_RASCIIZ( "add_key(type)", ARG1);
PRE_MEM_RASCIIZ( "add_key(description)", ARG2);
@@ -6732,7 +7073,7 @@ PRE(sys_keyctl)
FMT_REGWORD "x(%s), %ld )", SARG2, ARG3, (HChar*)(Addr)ARG3,
ARG4, (HChar*)(Addr)ARG4, SARG5);
PRE_REG_READ5(long, "keyctl(KEYCTL_SEARCH)",
- int, option, vki_key_serial_t, keyring,
+ int, option, vki_key_serial_t, keyring,
const char *, type, const char *, description,
vki_key_serial_t, destring);
PRE_MEM_RASCIIZ("sys_keyctl(KEYCTL_SEARCH, type)", ARG3);
@@ -6742,7 +7083,7 @@ PRE(sys_keyctl)
PRINT("sys_keyctl ( KEYCTL_READ, %ld, %#" FMT_REGWORD "x, %" FMT_REGWORD
"u )", SARG2, ARG3, ARG4);
PRE_REG_READ4(long, "keyctl(KEYCTL_READ)",
- int, option, vki_key_serial_t, keyring,
+ int, option, vki_key_serial_t, keyring,
char *, buffer, vki_size_t, buflen);
if (ARG3 != (UWord)NULL)
PRE_MEM_WRITE("keyctl(KEYCTL_READ, buffer)", ARG3, ARG4);
@@ -6751,7 +7092,7 @@ PRE(sys_keyctl)
PRINT("sys_keyctl ( KEYCTL_INSTANTIATE, %ld, %#" FMT_REGWORD "x, %"
FMT_REGWORD "u, %ld )", SARG2, ARG3, ARG4, SARG5);
PRE_REG_READ5(long, "keyctl(KEYCTL_INSTANTIATE)",
- int, option, vki_key_serial_t, key,
+ int, option, vki_key_serial_t, key,
char *, payload, vki_size_t, plen,
vki_key_serial_t, keyring);
if (ARG3 != (UWord)NULL)
@@ -6761,7 +7102,7 @@ PRE(sys_keyctl)
PRINT("sys_keyctl ( KEYCTL_NEGATE, %ld, %" FMT_REGWORD "u, %ld )",
SARG2, ARG3, SARG4);
PRE_REG_READ4(long, "keyctl(KEYCTL_NEGATE)",
- int, option, vki_key_serial_t, key,
+ int, option, vki_key_serial_t, key,
unsigned, timeout, vki_key_serial_t, keyring);
break;
case VKI_KEYCTL_SET_REQKEY_KEYRING:
@@ -6843,6 +7184,8 @@ PRE(sys_finit_module)
PRE_REG_READ3(long, "finit_module",
int, fd, const char *, params, int, flags);
PRE_MEM_RASCIIZ("finit_module(params)", ARG2);
+ if ( !ML_(fd_allowed)(ARG1, "finit_module", tid, False) )
+ SET_STATUS_Failure( VKI_EBADF );
}
PRE(sys_delete_module)
@@ -7000,6 +7343,7 @@ PRE(sys_fcntl)
case VKI_F_GETSIG:
case VKI_F_GETLEASE:
case VKI_F_GETPIPE_SZ:
+ case VKI_F_CREATED_QUERY:
case VKI_F_GET_SEALS:
PRINT("sys_fcntl ( %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2);
PRE_REG_READ2(long, "fcntl", unsigned int, fd, unsigned int, cmd);
@@ -7089,8 +7433,9 @@ PRE(sys_fcntl)
default:
PRINT("sys_fcntl[UNKNOWN] ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %"
FMT_REGWORD "u )", ARG1, ARG2, ARG3);
- VG_(umsg)("Warning: unimplemented fcntl command: %" FMT_REGWORD "u\n",
- ARG2);
+ if (VG_(clo_verbosity) >= 1)
+ VG_(umsg)("Warning: unimplemented fcntl command: %" FMT_REGWORD "u\n",
+ ARG2);
SET_STATUS_Failure( VKI_EINVAL );
break;
}
@@ -7102,7 +7447,16 @@ PRE(sys_fcntl)
# endif
*flags |= SfMayBlock;
- if (!ML_(fd_allowed)(ARG1, "fcntl", tid, False)) {
+ /* F_GETFD is used to check if a file descriptor is valid, so only
+ make sure it isn't a valgrind fd, otherwise we might warn, with
+ --track-fds=bad for any bad fd. */
+ if (ARG2 == VKI_F_GETFD) {
+ if (ARG1 >= VG_(fd_soft_limit) ||
+ ARG1 == VG_(log_output_sink).fd ||
+ ARG1 == VG_(xml_output_sink).fd) {
+ SET_STATUS_Failure (VKI_EBADF);
+ }
+ } else if (!ML_(fd_allowed)(ARG1, "fcntl", tid, False)) {
SET_STATUS_Failure (VKI_EBADF);
}
}
@@ -7111,6 +7465,7 @@ POST(sys_fcntl)
{
vg_assert(SUCCESS);
if (ARG2 == VKI_F_DUPFD) {
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "fcntl(DUPFD)", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -7120,6 +7475,7 @@ POST(sys_fcntl)
}
}
else if (ARG2 == VKI_F_DUPFD_CLOEXEC) {
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "fcntl(DUPFD_CLOEXEC)", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -7208,7 +7564,7 @@ PRE(sys_fcntl64)
PRE_MEM_WRITE("fcntl(F_GETOWN_EX)", ARG3, sizeof(struct vki_f_owner_ex));
break;
}
-
+
# if defined(VGP_x86_linux)
if (ARG2 == VKI_F_SETLKW || ARG2 == VKI_F_SETLKW64)
# else
@@ -7216,8 +7572,17 @@ PRE(sys_fcntl64)
# endif
*flags |= SfMayBlock;
- if (!ML_(fd_allowed)(ARG1, "fcntl64", tid, False)) {
- SET_STATUS_Failure (VKI_EBADF);
+ /* F_GETFD is used to check if a file descriptor is valid, so only
+ make sure it isn't a valgrind fd, otherwise we might warn, with
+ --track-fds=bad for any bad fd. */
+ if (ARG2 == VKI_F_GETFD) {
+ if (ARG1 >= VG_(fd_soft_limit) ||
+ ARG1 == VG_(log_output_sink).fd ||
+ ARG1 == VG_(xml_output_sink).fd) {
+ SET_STATUS_Failure (VKI_EBADF);
+ }
+ } else if (!ML_(fd_allowed)(ARG1, "fcntl64", tid, False)) {
+ SET_STATUS_Failure (VKI_EBADF);
}
}
@@ -7225,6 +7590,7 @@ POST(sys_fcntl64)
{
vg_assert(SUCCESS);
if (ARG2 == VKI_F_DUPFD) {
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "fcntl64(DUPFD)", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -7234,6 +7600,7 @@ POST(sys_fcntl64)
}
}
else if (ARG2 == VKI_F_DUPFD_CLOEXEC) {
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "fcntl64(DUPFD_CLOEXEC)", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -7293,7 +7660,7 @@ PRE(sys_ioctl)
/* SCSI no operand */
case VKI_SCSI_IOCTL_DOORLOCK:
case VKI_SCSI_IOCTL_DOORUNLOCK:
-
+
/* CDROM stuff. */
case VKI_CDROM_DISC_STATUS:
case VKI_CDROMSTOP:
@@ -7407,7 +7774,7 @@ PRE(sys_ioctl)
case VKI_TCSETSW:
case VKI_TCSETSF:
PRE_MEM_READ( "ioctl(TCSET{S,SW,SF})", ARG3, sizeof(struct vki_termios) );
- break;
+ break;
case VKI_TCGETS:
PRE_MEM_WRITE( "ioctl(TCGETS)", ARG3, sizeof(struct vki_termios) );
break;
@@ -7759,7 +8126,7 @@ PRE(sys_ioctl)
PRE_MEM_READ( "ioctl(SIOCGIFMIIREG)",
(Addr)&((struct vki_mii_ioctl_data *)&((struct vki_ifreq *)(Addr)ARG3)->vki_ifr_data)->reg_num,
sizeof(((struct vki_mii_ioctl_data *)&((struct vki_ifreq *)(Addr)ARG3)->vki_ifr_data)->reg_num));
- PRE_MEM_WRITE( "ioctl(SIOCGIFMIIREG)", ARG3,
+ PRE_MEM_WRITE( "ioctl(SIOCGIFMIIREG)", ARG3,
sizeof(struct vki_ifreq));
break;
case VKI_SIOCGIFCONF: /* get iface list */
@@ -7800,7 +8167,7 @@ PRE(sys_ioctl)
case VKI_SIOCGARP: /* get ARP table entry */
PRE_MEM_WRITE( "ioctl(SIOCGARP)", ARG3, sizeof(struct vki_arpreq));
break;
-
+
case VKI_SIOCSIFFLAGS: /* set flags */
PRE_MEM_RASCIIZ( "ioctl(SIOCSIFFLAGS)",
(Addr)((struct vki_ifreq *)(Addr)ARG3)->vki_ifr_name );
@@ -7876,7 +8243,7 @@ PRE(sys_ioctl)
/* Routing table calls. */
case VKI_SIOCADDRT: /* add routing table entry */
case VKI_SIOCDELRT: /* delete routing table entry */
- PRE_MEM_READ( "ioctl(SIOCADDRT/DELRT)", ARG3,
+ PRE_MEM_READ( "ioctl(SIOCADDRT/DELRT)", ARG3,
sizeof(struct vki_rtentry));
break;
@@ -7966,7 +8333,7 @@ PRE(sys_ioctl)
case VKI_SOUND_PCM_READ_CHANNELS:
case VKI_SOUND_PCM_READ_BITS:
case VKI_SOUND_PCM_READ_FILTER:
- PRE_MEM_WRITE( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOR, int))",
+ PRE_MEM_WRITE( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOR, int))",
ARG3, sizeof(int));
break;
case VKI_SNDCTL_SEQ_CTRLRATE:
@@ -7984,9 +8351,9 @@ PRE(sys_ioctl)
case VKI_SNDCTL_TMR_SOURCE:
case VKI_SNDCTL_MIDI_PRETIME:
case VKI_SNDCTL_MIDI_MPUMODE:
- PRE_MEM_READ( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOWR, int))",
+ PRE_MEM_READ( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOWR, int))",
ARG3, sizeof(int));
- PRE_MEM_WRITE( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOWR, int))",
+ PRE_MEM_WRITE( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOWR, int))",
ARG3, sizeof(int));
break;
case VKI_SNDCTL_DSP_GETOSPACE:
@@ -7997,7 +8364,7 @@ PRE(sys_ioctl)
case VKI_SNDCTL_DSP_NONBLOCK:
break;
case VKI_SNDCTL_DSP_SETTRIGGER:
- PRE_MEM_READ( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOW, int))",
+ PRE_MEM_READ( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOW, int))",
ARG3, sizeof(int));
break;
@@ -8059,7 +8426,7 @@ PRE(sys_ioctl)
break;
case VKI_RTC_RD_TIME:
case VKI_RTC_ALM_READ:
- PRE_MEM_WRITE( "ioctl(RTC_RD_TIME/ALM_READ)",
+ PRE_MEM_WRITE( "ioctl(RTC_RD_TIME/ALM_READ)",
ARG3, sizeof(struct vki_rtc_time));
break;
case VKI_RTC_ALM_SET:
@@ -8189,7 +8556,7 @@ PRE(sys_ioctl)
PRE_MEM_READ( "ioctl(CDROMSUBCHNL (cdsc_format, char))",
(Addr) &(((struct vki_cdrom_subchnl*) (Addr)ARG3)->cdsc_format),
sizeof(((struct vki_cdrom_subchnl*) (Addr)ARG3)->cdsc_format));
- PRE_MEM_WRITE( "ioctl(CDROMSUBCHNL)", ARG3,
+ PRE_MEM_WRITE( "ioctl(CDROMSUBCHNL)", ARG3,
sizeof(struct vki_cdrom_subchnl));
break;
case VKI_CDROMREADMODE1: /*0x530d*/
@@ -8201,7 +8568,7 @@ PRE(sys_ioctl)
PRE_MEM_WRITE("ioctl(CDROMREADMODE2)", ARG3, VKI_CD_FRAMESIZE_RAW0);
break;
case VKI_CDROMREADTOCHDR:
- PRE_MEM_WRITE( "ioctl(CDROMREADTOCHDR)", ARG3,
+ PRE_MEM_WRITE( "ioctl(CDROMREADTOCHDR)", ARG3,
sizeof(struct vki_cdrom_tochdr));
break;
case VKI_CDROMREADTOCENTRY:
@@ -8211,7 +8578,7 @@ PRE(sys_ioctl)
PRE_MEM_READ( "ioctl(CDROMREADTOCENTRY (cdte_track, char))",
(Addr) &(((struct vki_cdrom_tocentry*) (Addr)ARG3)->cdte_track),
sizeof(((struct vki_cdrom_tocentry*) (Addr)ARG3)->cdte_track));
- PRE_MEM_WRITE( "ioctl(CDROMREADTOCENTRY)", ARG3,
+ PRE_MEM_WRITE( "ioctl(CDROMREADTOCENTRY)", ARG3,
sizeof(struct vki_cdrom_tocentry));
break;
case VKI_CDROMMULTISESSION: /* 0x5310 */
@@ -8236,7 +8603,7 @@ PRE(sys_ioctl)
PRE_MEM_WRITE( "ioctl(CDROMREADAUDIO).buf",
(Addr)(cra->buf), cra->nframes * VKI_CD_FRAMESIZE_RAW);
}
- break;
+ break;
case VKI_CDROMPLAYMSF:
PRE_MEM_READ( "ioctl(CDROMPLAYMSF)", ARG3, sizeof(struct vki_cdrom_msf));
break;
@@ -8454,19 +8821,19 @@ PRE(sys_ioctl)
break;
case VKI_KDSKBMODE:
break;
-
+
case VKI_KDGKBMETA:
PRE_MEM_WRITE( "ioctl(KDGKBMETA)", ARG3, sizeof(int) );
break;
case VKI_KDSKBMETA:
break;
-
+
case VKI_KDGKBLED:
PRE_MEM_WRITE( "ioctl(KDGKBLED)", ARG3, sizeof(char) );
break;
case VKI_KDSKBLED:
break;
-
+
case VKI_KDGKBENT:
PRE_MEM_READ( "ioctl(KDGKBENT).kb_table",
(Addr)&((struct vki_kbentry *)(Addr)ARG3)->kb_table,
@@ -8489,7 +8856,7 @@ PRE(sys_ioctl)
(Addr)&((struct vki_kbentry *)(Addr)ARG3)->kb_value,
sizeof(((struct vki_kbentry *)(Addr)ARG3)->kb_value) );
break;
-
+
case VKI_KDGKBSENT:
PRE_MEM_READ( "ioctl(KDGKBSENT).kb_func",
(Addr)&((struct vki_kbsentry *)(Addr)ARG3)->kb_func,
@@ -8505,14 +8872,14 @@ PRE(sys_ioctl)
PRE_MEM_RASCIIZ( "ioctl(KDSKBSENT).kb_string",
(Addr)((struct vki_kbsentry *)(Addr)ARG3)->kb_string );
break;
-
+
case VKI_KDGKBDIACR:
PRE_MEM_WRITE( "ioctl(KDGKBDIACR)", ARG3, sizeof(struct vki_kbdiacrs) );
break;
case VKI_KDSKBDIACR:
PRE_MEM_READ( "ioctl(KDSKBDIACR)", ARG3, sizeof(struct vki_kbdiacrs) );
break;
-
+
case VKI_KDGETKEYCODE:
PRE_MEM_READ( "ioctl(KDGETKEYCODE).scancode",
(Addr)&((struct vki_kbkeycode *)(Addr)ARG3)->scancode,
@@ -8529,7 +8896,7 @@ PRE(sys_ioctl)
(Addr)((struct vki_kbkeycode *)(Addr)ARG3)->keycode,
sizeof(((struct vki_kbkeycode *)(Addr)ARG3)->keycode) );
break;
-
+
case VKI_KDSIGACCEPT:
break;
@@ -8729,7 +9096,7 @@ PRE(sys_ioctl)
for (i=0; i < vkui->nmsgs; i++) {
struct vki_i2c_msg *msg = vkui->msgs + i;
PRE_MEM_READ("ioctl(I2C_RDWR).msgs", (Addr)msg, sizeof(struct vki_i2c_msg));
- if (msg->flags & VKI_I2C_M_RD)
+ if (msg->flags & VKI_I2C_M_RD)
PRE_MEM_WRITE("ioctl(I2C_RDWR).msgs.buf", (Addr)msg->buf, msg->len);
else
PRE_MEM_READ("ioctl(I2C_RDWR).msgs.buf", (Addr)msg->buf, msg->len);
@@ -8977,7 +9344,7 @@ PRE(sys_ioctl)
dlr->dev_num * sizeof(struct vki_hci_dev_req));
}
break;
-
+
case VKI_HCIINQUIRY:
if (ARG3) {
struct vki_hci_inquiry_req* ir =
@@ -10489,7 +10856,7 @@ PRE(sys_ioctl)
break;
}
break;
- }
+ }
}
POST(sys_ioctl)
@@ -10527,7 +10894,7 @@ POST(sys_ioctl)
at, it's possible to guess that the 7 word structure has
this form
- 0 1 2 3 4 5 6
+ 0 1 2 3 4 5 6
ioctl-number 0x1C ptr1 ptr1size ptr2 ptr2size aBitMask
Unfortunately that doesn't seem to work for some reason,
@@ -10619,7 +10986,7 @@ POST(sys_ioctl)
case VKI_TCSETSW:
case VKI_TCSETSF:
case VKI_IB_USER_MAD_ENABLE_PKEY:
- break;
+ break;
case VKI_TCGETS:
POST_MEM_WRITE( ARG3, sizeof(struct vki_termios) );
break;
@@ -10724,7 +11091,7 @@ POST(sys_ioctl)
break;
case VKI_SG_GET_SG_TABLESIZE:
POST_MEM_WRITE(ARG3, sizeof(int));
- break;
+ break;
case VKI_IIOCGETCPS:
POST_MEM_WRITE( ARG3, VKI_ISDN_MAX_CHANNELS * 2 * sizeof(unsigned long) );
@@ -10921,7 +11288,7 @@ POST(sys_ioctl)
case VKI_SIOCGARP: /* get ARP table entry */
POST_MEM_WRITE(ARG3, sizeof(struct vki_arpreq));
break;
-
+
case VKI_SIOCSIFFLAGS: /* set flags */
case VKI_SIOCSIFMAP: /* Set device parameters */
case VKI_SIOCSHWTSTAMP: /* Set hardware time stamping */
@@ -11218,7 +11585,7 @@ POST(sys_ioctl)
POST_MEM_WRITE( (Addr)(cra->buf), cra->nframes * VKI_CD_FRAMESIZE_RAW);
break;
}
-
+
case VKI_CDROMPLAYMSF:
break;
/* The following two are probably bogus (should check args
@@ -11373,46 +11740,46 @@ POST(sys_ioctl)
break;
case VKI_KDSKBMODE:
break;
-
+
case VKI_KDGKBMETA:
POST_MEM_WRITE( ARG3, sizeof(int) );
break;
case VKI_KDSKBMETA:
break;
-
+
case VKI_KDGKBLED:
POST_MEM_WRITE( ARG3, sizeof(char) );
break;
case VKI_KDSKBLED:
break;
-
+
case VKI_KDGKBENT:
POST_MEM_WRITE( (Addr)&((struct vki_kbentry *)(Addr)ARG3)->kb_value,
sizeof(((struct vki_kbentry *)(Addr)ARG3)->kb_value) );
break;
case VKI_KDSKBENT:
break;
-
+
case VKI_KDGKBSENT:
POST_MEM_WRITE( (Addr)((struct vki_kbsentry *)(Addr)ARG3)->kb_string,
sizeof(((struct vki_kbsentry *)(Addr)ARG3)->kb_string) );
break;
case VKI_KDSKBSENT:
break;
-
+
case VKI_KDGKBDIACR:
POST_MEM_WRITE( ARG3, sizeof(struct vki_kbdiacrs) );
break;
case VKI_KDSKBDIACR:
break;
-
+
case VKI_KDGETKEYCODE:
POST_MEM_WRITE( (Addr)((struct vki_kbkeycode *)(Addr)ARG3)->keycode,
sizeof(((struct vki_kbkeycode *)(Addr)ARG3)->keycode) );
break;
case VKI_KDSETKEYCODE:
break;
-
+
case VKI_KDSIGACCEPT:
break;
@@ -11532,7 +11899,7 @@ POST(sys_ioctl)
dir2 = _VKI_IOC_DIR(vkui->ioctl_code);
size2 = _VKI_IOC_SIZE(vkui->ioctl_code);
if (size2 > 0) {
- if (dir2 & _VKI_IOC_READ)
+ if (dir2 & _VKI_IOC_READ)
POST_MEM_WRITE((Addr)vkui->data, size2);
}
}
@@ -11554,7 +11921,7 @@ POST(sys_ioctl)
UInt i;
for (i=0; i < vkui->nmsgs; i++) {
struct vki_i2c_msg *msg = vkui->msgs + i;
- if (msg->flags & VKI_I2C_M_RD)
+ if (msg->flags & VKI_I2C_M_RD)
POST_MEM_WRITE((Addr)msg->buf, msg->len);
}
}
@@ -12658,12 +13025,12 @@ POST(sys_ioctl)
socketcall wrapper helpers
------------------------------------------------------------------ */
-void
-ML_(linux_PRE_sys_getsockopt) ( ThreadId tid,
+void
+ML_(linux_PRE_sys_getsockopt) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2,
UWord arg3, UWord arg4 )
{
- /* int getsockopt(int s, int level, int optname,
+ /* int getsockopt(int s, int level, int optname,
void *optval, socklen_t *optlen); */
Addr optval_p = arg3;
Addr optlen_p = arg4;
@@ -12673,7 +13040,7 @@ ML_(linux_PRE_sys_getsockopt) ( ThreadId tid,
"socketcall.getsockopt(optval)",
"socketcall.getsockopt(optlen)" );
if (arg1 == VKI_SOL_SCTP &&
- (arg2 == VKI_SCTP_GET_PEER_ADDRS ||
+ (arg2 == VKI_SCTP_GET_PEER_ADDRS ||
arg2 == VKI_SCTP_GET_LOCAL_ADDRS))
{
struct vki_sctp_getaddrs *ga = (struct vki_sctp_getaddrs*)arg3;
@@ -12684,7 +13051,7 @@ ML_(linux_PRE_sys_getsockopt) ( ThreadId tid,
}
}
-void
+void
ML_(linux_POST_sys_getsockopt) ( ThreadId tid,
SysRes res,
UWord arg0, UWord arg1, UWord arg2,
@@ -12700,7 +13067,7 @@ ML_(linux_POST_sys_getsockopt) ( ThreadId tid,
(arg2 == VKI_SCTP_GET_PEER_ADDRS ||
arg2 == VKI_SCTP_GET_LOCAL_ADDRS))
{
- struct vki_sctp_getaddrs *ga = (struct vki_sctp_getaddrs*)arg3;
+ struct vki_sctp_getaddrs *ga = (struct vki_sctp_getaddrs*)arg3;
struct vki_sockaddr *a = ga->addrs;
int i;
for (i = 0; i < ga->addr_num; i++) {
@@ -12715,17 +13082,17 @@ ML_(linux_POST_sys_getsockopt) ( ThreadId tid,
}
a = (struct vki_sockaddr*)((char*)a + sl);
}
- POST_MEM_WRITE( (Addr)ga->addrs, (char*)a - (char*)ga->addrs );
+ POST_MEM_WRITE( (Addr)ga->addrs, (char*)a - (char*)ga->addrs );
}
}
}
-void
-ML_(linux_PRE_sys_setsockopt) ( ThreadId tid,
+void
+ML_(linux_PRE_sys_setsockopt) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2,
UWord arg3, UWord arg4 )
{
- /* int setsockopt(int s, int level, int optname,
+ /* int setsockopt(int s, int level, int optname,
const void *optval, socklen_t optlen); */
Addr optval_p = arg3;
if (optval_p != (Addr)NULL) {
@@ -13348,6 +13715,7 @@ POST(sys_bpf)
case VKI_BPF_MAP_GET_FD_BY_ID:
case VKI_BPF_BTF_GET_FD_BY_ID:
case VKI_BPF_RAW_TRACEPOINT_OPEN:
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "bpf", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure(VKI_EMFILE);
@@ -13370,6 +13738,7 @@ POST(sys_bpf)
break;
case VKI_BPF_PROG_LOAD:
/* Return a file descriptor for loaded program, write into log_buf. */
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "bpf", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure(VKI_EMFILE);
@@ -13398,6 +13767,7 @@ POST(sys_bpf)
break;
case VKI_BPF_BTF_LOAD:
/* Return a file descriptor for BTF data, write into btf_log_buf. */
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "bpf", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure(VKI_EMFILE);
@@ -13556,6 +13926,7 @@ PRE(sys_io_uring_setup)
POST(sys_io_uring_setup)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "io_uring_setup", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -13621,7 +13992,7 @@ POST(sys_io_uring_register)
PRE(sys_execveat)
{
- PRINT("sys_execveat ( %lu, %#lx(%s), %#lx, %#lx, %lu", ARG1, ARG2, (char*)ARG2, ARG3, ARG4, ARG5);
+ PRINT("sys_execveat ( %lu, %#lx(%s), %#lx, %#lx, %lu", ARG1, ARG2, (char*)ARG2, ARG3, ARG4, ARG5);
PRE_REG_READ5(vki_off_t, "execveat",
int, fd, char *, filename, char **, argv, char **, envp, int, flags);
PRE_MEM_RASCIIZ( "execveat(filename)", ARG2);
@@ -13631,12 +14002,12 @@ PRE(sys_execveat)
return;
#endif
+ Int arg_1 = (Int) ARG1;
const HChar *path = (const HChar*) ARG2;
Addr arg_2 = ARG3;
Addr arg_3 = ARG4;
const HChar *buf;
HChar *abs_path = NULL;
- Bool check_at_symlink = False;
Bool check_pathptr = True;
if (ML_(safe_to_deref) (path, 1)) {
@@ -13644,8 +14015,12 @@ PRE(sys_execveat)
* and just pass the pathname, try to determine
* the absolute path otherwise. */
if (path[0] != '/') {
- /* Check dirfd is a valid fd. */
- if (!ML_(fd_allowed)(ARG1, "execveat", tid, False)) {
+ /* Check dirfd is a valid fd.
+ * BUT: allow special value of AT_FDCWD (-101) per the execveat(2) man page:
+ * If pathname is relative and dirfd is the special value AT_FDCWD,
+ * then pathname is interpreted relative to the current working directory
+ * of the calling process (like execve(2)). */
+ if (arg_1 != VKI_AT_FDCWD && !ML_(fd_allowed)(arg_1, "execveat", tid, False)) {
SET_STATUS_Failure( VKI_EBADF );
return;
}
@@ -13653,38 +14028,33 @@ PRE(sys_execveat)
set then dirfd describes the whole path. */
if (path[0] == '\0') {
if (ARG5 & VKI_AT_EMPTY_PATH) {
- if (VG_(resolve_filename)(ARG1, &buf)) {
+ if (VG_(resolve_filename)(arg_1, &buf)) {
path = buf;
check_pathptr = False;
}
}
- }
- else if (ARG1 == VKI_AT_FDCWD) {
- check_at_symlink = True;
- } else
- if (ARG5 & VKI_AT_SYMLINK_NOFOLLOW)
- check_at_symlink = True;
- else if (VG_(resolve_filename)(ARG1, &buf)) {
+ } else if (VG_(resolve_filename)(arg_1, &buf)) {
abs_path = VG_(malloc)("execveat",
(VG_(strlen)(buf) + 1
+ VG_(strlen)(path) + 1));
VG_(sprintf)(abs_path, "%s/%s", buf, path);
path = abs_path;
check_pathptr = False;
- }
- else
- path = NULL;
- if (check_at_symlink) {
- struct vg_stat statbuf;
- SysRes statres;
-
- statres = VG_(stat)(path, &statbuf);
- if (sr_isError(statres) || VKI_S_ISLNK(statbuf.mode)) {
- SET_STATUS_Failure( VKI_ELOOP );
- return;
- }
}
}
+ if (ARG5 & VKI_AT_SYMLINK_NOFOLLOW) {
+ struct vg_stat statbuf;
+ SysRes statres;
+ statres = VG_(stat)(path, &statbuf);
+ if (sr_isError(statres) || VKI_S_ISLNK(statbuf.mode)) {
+ SET_STATUS_Failure( VKI_ELOOP );
+ return;
+ }
+ }
+ if(ARG5 & ~(VKI_AT_SYMLINK_NOFOLLOW | VKI_AT_EMPTY_PATH)) {
+ SET_STATUS_Failure( VKI_EINVAL );
+ return;
+ }
} else {
SET_STATUS_Failure(VKI_EFAULT);
return;
@@ -13781,42 +14151,105 @@ PRE(sys_openat2)
{
HChar name[30]; // large enough
SysRes sres;
- struct vki_open_how * how;
+ struct vki_open_how* how = (struct vki_open_how *)ARG3;
+ Bool proc_self_exe = False;
+ Bool can_deref_how = how && ML_(safe_to_deref)(how, sizeof(*how));
+
+ // ARG4 is supposed to be sizeof(struct vki_open_how)
+ // but we can't trust it
+ if (can_deref_how) {
+ // check that we are not trying to open the client exe for writing
+ // this doesn't handle all of the RESOLVE options, there may be cases
+ // like RESOLVE_NO_XDEV and RESOLVE_BENEATH where the path is
+ // invalid and we might return the wrong errno
+ if (how->vki_resolve != VKI_RESOLVE_IN_ROOT &&
+ how->vki_resolve != VKI_RESOLVE_NO_MAGICLINKS) {
+ /* Check for /proc/self/exe or /proc//exe case
+ * first so that we can then use the later checks. */
+ VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
+ if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 )
+ && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0
+ || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/exe") == 0)) {
+ proc_self_exe = True;
+ }
+ }
+ }
PRINT("sys_openat2 ( %ld, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %ld )",
SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, SARG4);
PRE_REG_READ4(long, "openat2",
- int, dfd, const char *, filename, struct vki_open_how *, how, vki_size_t, size);
+ int, dirfd, const char *, pathname, struct vki_open_how *, how, vki_size_t, size);
- PRE_MEM_RASCIIZ( "openat2(filename)", ARG2 );
+ PRE_MEM_RASCIIZ( "openat2(pathname)", ARG2 );
PRE_MEM_READ( "openat2(how)", ARG3, sizeof(struct vki_open_how));
- /* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD,
- filename is relative to cwd. When comparing dfd against AT_FDCWD,
- be sure only to compare the bottom 32 bits. */
- if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 )
- && *(Char *)(Addr)ARG2 != '/'
- && ((Int)ARG1) != ((Int)VKI_AT_FDCWD)
- && !ML_(fd_allowed)(ARG1, "openat2", tid, False))
- SET_STATUS_Failure( VKI_EBADF );
-
- how = (struct vki_open_how *)ARG3;
-
- if (how && ML_(safe_to_deref) (how, sizeof(struct vki_open_how))) {
- if (how->vki_mode) {
- if (!(how->vki_flags & ((vki_uint64_t)VKI_O_CREAT | VKI_O_TMPFILE))) {
- SET_STATUS_Failure( VKI_EINVAL );
+ if (can_deref_how &&
+ ((how->vki_flags & VKI_O_WRONLY) ||
+ (how->vki_flags & VKI_O_RDWR))) {
+ if (proc_self_exe) {
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ return;
+ } else {
+ vg_assert(VG_(resolved_exename));
+ if (!VG_(strncmp)(VG_(resolved_exename), "#!", 2)) {
+ goto no_client_write;
+ }
+ Int fd = ARG1;
+ const HChar* path = (const HChar*)ARG2;
+ if (ML_(safe_to_deref)(path, 1)) {
+ // we need something like a "ML_(safe_to_deref_path)" that does a binary search for the addressable length, and maybe nul
+ if (path[0] == '/' && how->vki_resolve != VKI_RESOLVE_IN_ROOT) {
+ // absolute path, ignore fd
+ HChar tmp[VKI_PATH_MAX];
+ if (VG_(realpath)(path, tmp)) {
+ if (!VG_(strcmp)(tmp, VG_(resolved_exename))) {
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ return;
+ }
+ }
+ } else {
+ // relative or rooted path
+ // or RESOLVE_IN_ROOT
+ if (how->vki_resolve == VKI_RESOLVE_IN_ROOT) {
+ while (*path == '/' && *path != '\0') {
+ ++path;
+ }
+ }
+ if (fd == VKI_AT_FDCWD) {
+ HChar tmp[VKI_PATH_MAX];
+ if (VG_(realpath)(path, tmp)) {
+ if (!VG_(strcmp)(tmp, VG_(resolved_exename))) {
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ return;
+ }
+ }
+ } else {
+ // build absolute path from fd and path
+ const HChar* dirname;
+ if (VG_(resolve_filename)(fd, &dirname) == False) {
+ goto no_client_write; // let the OS do the error handling
+ }
+ HChar tmp1[VKI_PATH_MAX];
+ VG_(snprintf)(tmp1, VKI_PATH_MAX, "%s/%s", dirname, path);
+ tmp1[VKI_PATH_MAX - 1] = '\0';
+ HChar tmp2[VKI_PATH_MAX];
+ if (VG_(realpath)(tmp1, tmp2)) {
+ if (!VG_(strcmp)(tmp2, VG_(resolved_exename))) {
+ SET_STATUS_Failure( VKI_ETXTBSY );
+ return;
+ }
+ }
+ }
+ }
}
- }
- if (how->vki_resolve & ~((vki_uint64_t)VKI_RESOLVE_NO_XDEV |
- VKI_RESOLVE_NO_MAGICLINKS |
- VKI_RESOLVE_NO_SYMLINKS |
- VKI_RESOLVE_BENEATH |
- VKI_RESOLVE_IN_ROOT |
- VKI_RESOLVE_CACHED)) {
- SET_STATUS_Failure( VKI_EINVAL );
}
}
+ no_client_write:
+
+ /* For absolute filenames, dirfd is ignored. If dirfd is AT_FDCWD,
+ filename is relative to cwd. When comparing dirfd against AT_FDCWD,
+ be sure only to compare the bottom 32 bits. */
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "openat2", tid, status);
/* Handle the case where the open is of /proc/self/cmdline or
/proc//cmdline, and just give it a copy of the fd for the
@@ -13853,20 +14286,9 @@ PRE(sys_openat2)
return;
}
- /* And for /proc/self/exe or /proc//exe case. */
-
- VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
- if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 )
- && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0
- || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/exe") == 0)) {
- sres = VG_(dup)( VG_(cl_exec_fd) );
- SET_STATUS_from_SysRes( sres );
- if (!sr_isError(sres)) {
- OffT off = VG_(lseek)( sr_Res(sres), 0, VKI_SEEK_SET );
- if (off < 0)
- SET_STATUS_Failure( VKI_EMFILE );
- }
- return;
+ if (proc_self_exe) {
+ // do the syscall with VG_(resolved_exename)
+ ARG2 = (Word)VG_(resolved_exename);
}
/* Otherwise handle normally */
@@ -13876,6 +14298,7 @@ PRE(sys_openat2)
POST(sys_openat2)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "openat2", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -13892,6 +14315,7 @@ PRE(sys_pidfd_open)
POST(sys_pidfd_open)
{
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "pidfd", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -13910,6 +14334,7 @@ PRE(sys_pidfd_getfd)
POST(sys_pidfd_getfd)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "pidfd_getfd", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -13939,6 +14364,7 @@ PRE(sys_open_tree)
POST(sys_open_tree)
{
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "open_tree", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -13957,27 +14383,19 @@ PRE(sys_move_mount)
"%ld, %#" FMT_REGWORD "x(%s), %ld",
SARG1, ARG2, (HChar*)(Addr)ARG2,
SARG3, ARG4, (HChar*)(Addr)ARG4, SARG5);
- PRE_REG_READ5(long, "mount_move",
+ PRE_REG_READ5(long, "move_mount",
int, from_dfd, const char *, from_pathname,
int, to_dfd, const char*, to_pathname, int, flags);
- PRE_MEM_RASCIIZ( "mount_move(from_pathname)", ARG2);
+ PRE_MEM_RASCIIZ( "move_mount(from_pathname)", ARG2);
/* For absolute filenames, from_dfd is ignored. If from_dfd is AT_FDCWD,
from_pathname is relative to cwd. When comparing from_dfd against
AT_FDCWD, be sure only to compare the bottom 32 bits. */
- if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 )
- && *(Char *)(Addr)ARG2 != '/'
- && ((Int)ARG1) != ((Int)VKI_AT_FDCWD)
- && !ML_(fd_allowed)(ARG1, "mount_move", tid, False))
- SET_STATUS_Failure( VKI_EBADF );
- PRE_MEM_RASCIIZ( "mount_move(from_pathname)", ARG4);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "move_mount(from_dfd)", tid, status);
+ PRE_MEM_RASCIIZ( "move_mount(to_pathname)", ARG4);
/* For absolute filenames, to_dfd is ignored. If to_dfd is AT_FDCWD,
to_pathname is relative to cwd. When comparing to_dfd against
AT_FDCWD, be sure only to compare the bottom 32 bits. */
- if (ML_(safe_to_deref)( (void*)(Addr)ARG4, 1 )
- && *(Char *)(Addr)ARG4 != '/'
- && ((Int)ARG4) != ((Int)VKI_AT_FDCWD)
- && !ML_(fd_allowed)(ARG3, "mount_move", tid, False))
- SET_STATUS_Failure( VKI_EBADF );
+ ML_(fd_at_check_allowed)(SARG3, (const HChar*)ARG4, "move_mount(to_dfd)", tid, status);
}
/* int fsopen (const char *fs_name, unsigned int flags) */
@@ -13991,6 +14409,7 @@ PRE(sys_fsopen)
POST(sys_fsopen)
{
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "fsopen", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -14011,6 +14430,7 @@ PRE(sys_fsmount)
POST(sys_fsmount)
{
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "fsmount", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -14056,6 +14476,7 @@ PRE(sys_fspick)
POST(sys_fspick)
{
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "fspick", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -14076,6 +14497,7 @@ PRE(sys_userfaultfd)
POST(sys_userfaultfd)
{
vg_assert(SUCCESS);
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "userfaultfd", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
@@ -14085,6 +14507,19 @@ POST(sys_userfaultfd)
}
}
+PRE(sys_ustat)
+{
+ FUSE_COMPATIBLE_MAY_BLOCK();
+ PRINT("sys_ustat ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG2);
+ PRE_REG_READ2(long, "ustat", __vki_u32, dev, struct vki_ustat *, ubuf);
+ PRE_MEM_WRITE( "ustat(ubuf)", ARG2, sizeof(struct vki_ustat) );
+}
+
+POST(sys_ustat)
+{
+ POST_MEM_WRITE( ARG2, sizeof(struct vki_ustat) );
+}
+
#undef PRE
#undef POST
diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c
index 1a7f038d48..c7dbd6b92f 100644
--- a/coregrind/m_syswrap/syswrap-main.c
+++ b/coregrind/m_syswrap/syswrap-main.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -350,15 +350,14 @@ void do_syscall_for_client ( Int syscallno,
{
vki_sigset_t saved;
UWord err;
-# if defined(VGO_freebsd)
- Word real_syscallno;
-# endif
# if defined(VGO_linux)
err = ML_(do_syscall_for_client_WRK)(
syscallno, &tst->arch.vex,
syscall_mask, &saved, sizeof(vki_sigset_t)
);
# elif defined(VGO_freebsd)
+ Word real_syscallno;
+ VG_(sigemptyset)(&saved);
if (tst->arch.vex.guest_SC_CLASS == VG_FREEBSD_SYSCALL0)
real_syscallno = __NR_syscall;
else if (tst->arch.vex.guest_SC_CLASS == VG_FREEBSD_SYSCALL198)
@@ -2512,7 +2511,7 @@ void VG_(client_syscall) ( ThreadId tid, UInt trc )
/* do_syscall_for_client may not return if the syscall was
interrupted by a signal. In that case, flow of control is
- first to m_signals.async_sighandler, which calls
+ first to m_signals.async_signalhandler, which calls
VG_(fixup_guest_state_after_syscall_interrupted), which
fixes up the guest state, and possibly calls
VG_(post_syscall). Once that's done, control drops back
@@ -2723,9 +2722,9 @@ void VG_(post_syscall) (ThreadId tid)
However, the syscall may get interrupted by an async-signal. In
that case do_syscall_for_client/VG_(do_syscall6) do not
- return. Instead we wind up in m_signals.async_sighandler. We need
+ return. Instead we wind up in m_signals.async_signalhandler. We need
to fix up the guest state to make it look like the syscall was
- interrupted for guest. So async_sighandler calls here, and this
+ interrupted for guest. So async_signalhandler calls here, and this
does the fixup. Note that from here we wind up calling
VG_(post_syscall) too.
*/
diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c
index 3644a088e5..6132c9ff1a 100644
--- a/coregrind/m_syswrap/syswrap-mips32-linux.c
+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -551,6 +551,7 @@ PRE(sys_fstatat64)
SARG1, ARG2, (HChar*)ARG2, ARG3, ARG4);
PRE_REG_READ4(long, "fstatat64",
int, dfd, char *, file_name, struct stat64 *, buf, int, flags);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat64", tid, status);
PRE_MEM_RASCIIZ ("fstatat64(file_name)", ARG2);
PRE_MEM_WRITE ("fstatat64(buf)", ARG3, sizeof (struct vki_stat64));
}
@@ -826,7 +827,7 @@ static SyscallTableEntry syscall_main_table[] = {
//.. // (__NR_oldolduname, sys_olduname), // 59
GENX_ (__NR_umask, sys_umask), // 60
GENX_ (__NR_chroot, sys_chroot), // 61
- //.. // (__NR_ustat, sys_ustat) // 62
+ LINXY (__NR_ustat, sys_ustat), // 62
GENXY (__NR_dup2, sys_dup2), // 63
GENX_ (__NR_getppid, sys_getppid), // 64
GENX_ (__NR_getpgrp, sys_getpgrp), // 65
@@ -851,7 +852,7 @@ static SyscallTableEntry syscall_main_table[] = {
//.. // (__NR_oldlstat, sys_lstat), // 84
GENXY (__NR_readlink, sys_readlink), // 85
//.. // (__NR_uselib, sys_uselib), // 86
- //.. // (__NR_swapon, sys_swapon), // 87
+ LINX_ (__NR_swapon, sys_swapon), // 87
//.. // (__NR_reboot, sys_reboot), // 88
//.. // (__NR_readdir, old_readdir), // 89
PLAX_ (__NR_mmap, sys_mmap), // 90
@@ -879,13 +880,13 @@ static SyscallTableEntry syscall_main_table[] = {
//.. GENX_(__NR_idle, sys_ni_syscall), // 112
//.. // (__NR_vm86old, sys_vm86old), // 113
GENXY (__NR_wait4, sys_wait4), // 114
- //.. // (__NR_swapoff, sys_swapoff), // 115
+ LINX_ (__NR_swapoff, sys_swapoff), // 115
LINXY (__NR_sysinfo, sys_sysinfo), // 116
LINXY (__NR_ipc, sys_ipc), // 117
GENX_ (__NR_fsync, sys_fsync), // 118
PLAX_ (__NR_sigreturn, sys_sigreturn), // 119
LINX_ (__NR_clone, sys_clone), // 120
- //.. // (__NR_setdomainname, sys_setdomainname), // 121
+ LINX_ (__NR_setdomainname, sys_setdomainname), // 121
GENXY (__NR_uname, sys_newuname), // 122
//.. PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123
LINXY (__NR_adjtimex, sys_adjtimex), // 124
@@ -899,7 +900,7 @@ static SyscallTableEntry syscall_main_table[] = {
GENX_ (__NR_getpgid, sys_getpgid), // 132
GENX_ (__NR_fchdir, sys_fchdir), // 133
//.. // (__NR_bdflush, sys_bdflush), // 134
- //.. // (__NR_sysfs, sys_sysfs), // 135
+ LINXY (__NR_sysfs, sys_sysfs), // 135
LINX_ (__NR_personality, sys_personality), // 136
//.. GENX_(__NR_afs_syscall, sys_ni_syscall), // 137
LINX_ (__NR_setfsuid, sys_setfsuid), // 138
@@ -1175,12 +1176,19 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_ (__NR_faccessat2, sys_faccessat2), // 439
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+ LINX_(__NR_mount_setattr, sys_mount_setattr), // 442
+ LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443
LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445
LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446
+ LINX_(__NR_futex_waitv, sys_futex_waitv), // 449
+ LINXY(__NR_cachestat, sys_cachestat), // 451
LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
+ LINXY(__NR_statmount, sys_statmount), // 457
+ LINXY(__NR_listmount, sys_listmount), // 458
+ LINX_(__NR_mseal, sys_mseal), // 462
};
SyscallTableEntry* ML_(get_linux_syscall_entry) (UInt sysno)
diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c
index ba73b68d8f..238b1cda0d 100644
--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -215,12 +215,6 @@ SysRes sys_set_tls ( ThreadId tid, Addr tlsptr )
file, but that requires even more macro magic. */
DECL_TEMPLATE (mips_linux, sys_set_thread_area);
-DECL_TEMPLATE (mips_linux, sys_vmsplice);
-DECL_TEMPLATE (mips_linux, sys_ustat);
-DECL_TEMPLATE (mips_linux, sys_sysfs);
-DECL_TEMPLATE (mips_linux, sys_swapon);
-DECL_TEMPLATE (mips_linux, sys_swapoff);
-DECL_TEMPLATE (mips_linux, sys_setdomainname);
DECL_TEMPLATE (mips_linux, sys_sethostname);
DECL_TEMPLATE (mips_linux, sys_reboot);
DECL_TEMPLATE (mips_linux, sys_cacheflush);
@@ -232,14 +226,6 @@ DECL_TEMPLATE (mips_linux, sys_rt_sigreturn);
DECL_TEMPLATE (mips_linux, sys_pipe);
DECL_TEMPLATE (mips_linux, sys_fadvise64);
-PRE(sys_vmsplice)
-{
- PRINT("sys_vmsplice ( %ld, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %ld )",
- SARG1, ARG2, ARG3, SARG4);
- PRE_REG_READ4(long, "sys_vmsplice", int, fdin, struct vki_iovec *, v,
- vki_size_t, len, int, flags);
-}
-
PRE(sys_sched_rr_get_interval)
{
PRINT("sys_sched_rr_get_interval ( %ld, %#" FMT_REGWORD "x)", SARG1, ARG2);
@@ -248,31 +234,6 @@ PRE(sys_sched_rr_get_interval)
*flags |= SfMayBlock;
}
-PRE(sys_ustat)
-{
- PRINT("sys_ustat ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG2);
- PRE_REG_READ2(long, "ustat", int, flags, const void *, path);
-}
-
-PRE(sys_swapon)
-{
- PRINT("sys_swapon ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", ARG1, ARG2);
- PRE_REG_READ2(long, "swapon", const void *, path, int, flags);
-}
-
-PRE(sys_swapoff)
-{
- PRINT("sys_swapoff ( %#" FMT_REGWORD "x )", ARG1);
- PRE_REG_READ1(long, "swapoff", const void *, path);
-}
-
-PRE(sys_sysfs)
-{
- PRINT("sys_sysfs ( %ld, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",
- SARG1, ARG2, ARG3);
- PRE_REG_READ3(long, "sysfs", int, flags, int, desc, const void *, path);
-}
-
/* Very much MIPS specific */
PRE(sys_cacheflush)
{
@@ -297,12 +258,6 @@ PRE(sys_reboot)
*flags |= SfMayBlock;
}
-PRE(sys_setdomainname)
-{
- PRINT ("sys_setdomainname ( %#" FMT_REGWORD "x, %ld )", ARG1, SARG2);
- PRE_REG_READ2 (long, "setdomainname", const void *, name, int, len);
-}
-
PRE(sys_sethostname)
{
PRINT ("sys_sethostname ( %#" FMT_REGWORD "x, %ld )", ARG1, SARG2);
@@ -649,10 +604,10 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_ (__NR_utime, sys_utime),
GENX_ (__NR_mknod, sys_mknod),
LINX_ (__NR_personality, sys_personality),
- PLAX_ (__NR_ustat, sys_ustat),
+ LINXY (__NR_ustat, sys_ustat),
GENXY (__NR_statfs, sys_statfs),
GENXY (__NR_fstatfs, sys_fstatfs),
- PLAX_ (__NR_sysfs, sys_sysfs),
+ LINXY (__NR_sysfs, sys_sysfs),
GENX_ (__NR_getpriority, sys_getpriority),
GENX_ (__NR_setpriority, sys_setpriority),
LINXY (__NR_sched_setparam, sys_sched_setparam),
@@ -677,12 +632,13 @@ static SyscallTableEntry syscall_main_table[] = {
GENX_ (__NR_acct, sys_acct),
GENX_ (__NR_settimeofday, sys_settimeofday),
LINX_ (__NR_mount, sys_mount),
+ LINX_ (__NR_mount_setattr, sys_mount_setattr),
LINX_ (__NR_umount2, sys_umount),
- PLAX_ (__NR_swapon, sys_swapon),
- PLAX_ (__NR_swapoff, sys_swapoff),
+ LINX_ (__NR_swapon, sys_swapon),
+ LINX_ (__NR_swapoff, sys_swapoff),
PLAX_ (__NR_reboot, sys_reboot),
PLAX_ (__NR_sethostname, sys_sethostname),
- PLAX_ (__NR_setdomainname, sys_setdomainname),
+ LINX_ (__NR_setdomainname, sys_setdomainname),
GENX_ (__NR_create_module, sys_ni_syscall),
LINX_ (__NR_init_module, sys_init_module),
LINX_ (__NR_delete_module, sys_delete_module),
@@ -725,6 +681,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY (__NR_epoll_create1, sys_epoll_create1),
LINX_ (__NR_epoll_ctl, sys_epoll_ctl),
LINXY (__NR_epoll_wait, sys_epoll_wait),
+ LINX_ (__NR_remap_file_pages, sys_remap_file_pages),
PLAX_(__NR_rt_sigreturn,sys_rt_sigreturn),
#if defined(VGABI_N32)
LINXY(__NR_fcntl64, sys_fcntl64),
@@ -780,7 +737,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_ (__NR_splice, sys_splice),
LINX_ (__NR_sync_file_range, sys_sync_file_range),
LINX_ (__NR_tee, sys_tee),
- PLAX_ (__NR_vmsplice, sys_vmsplice),
+ LINXY (__NR_vmsplice, sys_vmsplice),
LINX_ (__NR_set_robust_list, sys_set_robust_list),
LINXY (__NR_get_robust_list, sys_get_robust_list),
LINXY (__NR_epoll_pwait, sys_epoll_pwait),
@@ -835,8 +792,14 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY (__NR_landlock_create_ruleset, sys_landlock_create_ruleset),
LINX_ (__NR_landlock_add_rule, sys_landlock_add_rule),
LINX_ (__NR_landlock_restrict_self, sys_landlock_restrict_self),
+ LINXY (__NR_cachestat, sys_cachestat),
LINX_ (__NR_fchmodat2, sys_fchmodat2),
LINXY (__NR_userfaultfd, sys_userfaultfd),
+ LINXY (__NR_statmount, sys_statmount),
+ LINXY (__NR_listmount, sys_listmount),
+ LINX_ (__NR_mseal, sys_mseal),
+ LINX_ (__NR_futex_waitv, sys_futex_waitv),
+ LINX_ (__NR_quotactl_fd, sys_quotactl_fd),
};
SyscallTableEntry * ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c
index 728607317c..bb20cd7d3b 100644
--- a/coregrind/m_syswrap/syswrap-nanomips-linux.c
+++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -382,10 +382,7 @@ DECL_TEMPLATE (mips_linux, sys_set_thread_area);
DECL_TEMPLATE (mips_linux, sys_ptrace);
DECL_TEMPLATE (mips_linux, sys_unshare);
DECL_TEMPLATE (mips_linux, sys_reboot);
-DECL_TEMPLATE (mips_linux, sys_setdomainname);
DECL_TEMPLATE (mips_linux, sys_sethostname);
-DECL_TEMPLATE (mips_linux, sys_swapon);
-DECL_TEMPLATE (mips_linux, sys_swapoff);
PRE(sys_mmap2)
{
@@ -514,30 +511,12 @@ PRE(sys_reboot)
*flags |= SfMayBlock;
}
-PRE(sys_setdomainname)
-{
- PRINT ("sys_setdomainname ( %#lx, %ld )", ARG1, SARG2);
- PRE_REG_READ2 (long, "setdomainname", const void *, name, int, len);
-}
-
PRE(sys_sethostname)
{
PRINT ("sys_sethostname ( %#lx, %ld )", ARG1, SARG2);
PRE_REG_READ2 (long, "sethostname", const void *, name, int, len);
}
-PRE(sys_swapon)
-{
- PRINT("sys_swapon ( %#lx, %#lx )", ARG1, ARG2);
- PRE_REG_READ2(long, "swapon", const void *, path, int, flags);
-}
-
-PRE(sys_swapoff)
-{
- PRINT("sys_swapoff ( %#lx )", ARG1);
- PRE_REG_READ1(long, "swapoff", const void *, path);
-}
-
#undef PRE
#undef POST
@@ -628,7 +607,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY (__NR_pselect6, sys_pselect6),
LINXY (__NR_ppoll, sys_ppoll),
LINXY (__NR_signalfd4, sys_signalfd4),
- LINX_ (__NR_vmsplice, sys_vmsplice),
+ LINXY (__NR_vmsplice, sys_vmsplice),
LINX_ (__NR_splice, sys_splice),
LINX_ (__NR_tee, sys_tee),
LINXY (__NR_readlinkat, sys_readlinkat),
@@ -712,7 +691,7 @@ static SyscallTableEntry syscall_main_table[] = {
GENX_ (__NR_setgroups, sys_setgroups),
GENXY (__NR_uname, sys_newuname),
PLAX_ (__NR_sethostname, sys_sethostname),
- PLAX_ (__NR_setdomainname, sys_setdomainname),
+ LINX_ (__NR_setdomainname, sys_setdomainname),
GENXY (__NR_getrusage, sys_getrusage),
GENX_ (__NR_umask, sys_umask),
LINXY (__NR_prctl, sys_prctl),
@@ -772,8 +751,8 @@ static SyscallTableEntry syscall_main_table[] = {
GENX_ (__NR_execve, sys_execve),
PLAX_ (__NR_mmap2, sys_mmap2),
LINX_ (__NR_fadvise64_64, sys_fadvise64_64),
- PLAX_ (__NR_swapon, sys_swapon),
- PLAX_ (__NR_swapoff, sys_swapoff),
+ LINX_ (__NR_swapon, sys_swapon),
+ LINX_ (__NR_swapoff, sys_swapoff),
GENXY (__NR_mprotect, sys_mprotect),
GENX_ (__NR_msync, sys_msync),
GENX_ (__NR_mlock, sys_mlock),
@@ -840,7 +819,12 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY (__NR_landlock_create_ruleset,sys_landlock_create_ruleset),
LINX_ (__NR_landlock_add_rule, sys_landlock_add_rule),
LINX_ (__NR_landlock_restrict_self, sys_landlock_restrict_self),
+ LINXY (__NR_cachestat, sys_cachestat),
LINX_ (__NR_fchmodat2, sys_fchmodat2),
+ LINXY (__NR_statmount, sys_statmount),
+ LINXY (__NR_listmount, sys_listmount),
+ LINX_ (__NR_mseal, sys_mseal),
+ LINX_ (__NR_futex_waitv, sys_futex_waitv),
};
SyscallTableEntry* ML_(get_linux_syscall_entry) (UInt sysno)
diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c
index 089a9a59b0..4d7e43130c 100644
--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -315,6 +315,7 @@ PRE(sys_fstatat64)
ARG3);
PRE_REG_READ3(long, "fstatat64",
int, dfd, char *, file_name, struct stat64 *, buf);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat64", tid, status);
PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 );
PRE_MEM_WRITE( "fstatat64(buf)", ARG3, sizeof(struct vki_stat64) );
}
@@ -685,7 +686,7 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_umask, sys_umask), // 60
GENX_(__NR_chroot, sys_chroot), // 61
-//.. // (__NR_ustat, sys_ustat) // 62 SVr4 -- deprecated
+ LINXY(__NR_ustat, sys_ustat), // 62 SVr4 -- deprecated
GENXY(__NR_dup2, sys_dup2), // 63
GENX_(__NR_getppid, sys_getppid), // 64
@@ -715,7 +716,7 @@ static SyscallTableEntry syscall_table[] = {
//..
GENXY(__NR_readlink, sys_readlink), // 85
//.. // (__NR_uselib, sys_uselib), // 86 */Linux
-//.. // (__NR_swapon, sys_swapon), // 87 */Linux
+ LINX_(__NR_swapon, sys_swapon), // 87 */Linux
//.. // (__NR_reboot, sys_reboot), // 88 */Linux
//.. // (__NR_readdir, old_readdir), // 89 -- superseded
@@ -749,14 +750,14 @@ static SyscallTableEntry syscall_table[] = {
//.. // (__NR_vm86old, sys_vm86old), // 113 x86/Linux-only
GENXY(__NR_wait4, sys_wait4), // 114
//..
-//.. // (__NR_swapoff, sys_swapoff), // 115 */Linux
+ LINX_(__NR_swapoff, sys_swapoff), // 115 */Linux
LINXY(__NR_sysinfo, sys_sysinfo), // 116
LINXY(__NR_ipc, sys_ipc), // 117
GENX_(__NR_fsync, sys_fsync), // 118
PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux
//..
LINX_(__NR_clone, sys_clone), // 120
-//.. // (__NR_setdomainname, sys_setdomainname), // 121 */*(?)
+ LINX_(__NR_setdomainname, sys_setdomainname), // 121
GENXY(__NR_uname, sys_newuname), // 122
//.. PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123
LINXY(__NR_adjtimex, sys_adjtimex), // 124
@@ -774,7 +775,7 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_fchdir, sys_fchdir), // 133
//.. // (__NR_bdflush, sys_bdflush), // 134 */Linux
//..
-//.. // (__NR_sysfs, sys_sysfs), // 135 SVr4
+ LINXY(__NR_sysfs, sys_sysfs), // 135 SVr4
LINX_(__NR_personality, sys_personality), // 136
//.. GENX_(__NR_afs_syscall, sys_ni_syscall), // 137
LINX_(__NR_setfsuid, sys_setfsuid), // 138
@@ -901,7 +902,7 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 237
LINXY(__NR_epoll_wait, sys_epoll_wait), // 238
-//.. // (__NR_remap_file_pages, sys_remap_file_pages), // 239 */Linux
+ LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 239 */Linux
LINXY(__NR_timer_create, sys_timer_create), // 240
LINXY(__NR_timer_settime, sys_timer_settime), // 241
LINXY(__NR_timer_gettime, sys_timer_gettime), // 242
@@ -1074,12 +1075,19 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+ LINX_ (__NR_mount_setattr, sys_mount_setattr), // 442
+ LINX_ (__NR_quotactl_fd, sys_quotactl_fd), // 443
LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445
LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446
+ LINX_(__NR_futex_waitv, sys_futex_waitv), // 449
+ LINXY(__NR_cachestat, sys_cachestat), // 451
LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
+ LINXY (__NR_statmount, sys_statmount), // 457
+ LINXY (__NR_listmount, sys_listmount), // 458
+ LINX_ (__NR_mseal, sys_mseal), // 462
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
index 007fa6336c..7f78e23ecd 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -363,7 +363,7 @@ asm(
void VG_(cleanup_thread) ( ThreadArchState* arch )
{
-}
+}
/* ---------------------------------------------------------------------
PRE/POST wrappers for ppc64/Linux-specific syscalls
@@ -399,7 +399,7 @@ PRE(sys_mmap)
unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, offset);
- r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5,
+ r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5,
(Off64T)ARG6 );
SET_STATUS_from_SysRes(r);
}
@@ -407,7 +407,7 @@ PRE(sys_mmap)
//zz PRE(sys_mmap2)
//zz {
//zz SysRes r;
-//zz
+//zz
//zz // Exactly like old_mmap() except:
//zz // - the file offset is specified in 4K units rather than bytes,
//zz // so that it can be used for files bigger than 2^32 bytes.
@@ -417,12 +417,12 @@ PRE(sys_mmap)
//zz unsigned long, start, unsigned long, length,
//zz unsigned long, prot, unsigned long, flags,
//zz unsigned long, fd, unsigned long, offset);
-//zz
-//zz r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5,
+//zz
+//zz r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5,
//zz 4096 * (Off64T)ARG6 );
//zz SET_STATUS_from_SysRes(r);
//zz }
-//zz
+//zz
//zz // XXX: lstat64/fstat64/stat64 are generic, but not necessarily
//zz // applicable to every architecture -- I think only to 32-bit archs.
//zz // We're going to need something like linux/core_os32.h for such
@@ -434,12 +434,12 @@ PRE(sys_mmap)
//zz PRE_MEM_RASCIIZ( "stat64(file_name)", ARG1 );
//zz PRE_MEM_WRITE( "stat64(buf)", ARG2, sizeof(struct vki_stat64) );
//zz }
-//zz
+//zz
//zz POST(sys_stat64)
//zz {
//zz POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) );
//zz }
-//zz
+//zz
//zz PRE(sys_lstat64)
//zz {
//zz PRINT("sys_lstat64 ( %p(%s), %p )",ARG1,ARG1,ARG2);
@@ -447,7 +447,7 @@ PRE(sys_mmap)
//zz PRE_MEM_RASCIIZ( "lstat64(file_name)", ARG1 );
//zz PRE_MEM_WRITE( "lstat64(buf)", ARG2, sizeof(struct vki_stat64) );
//zz }
-//zz
+//zz
//zz POST(sys_lstat64)
//zz {
//zz vg_assert(SUCCESS);
@@ -455,14 +455,14 @@ PRE(sys_mmap)
//zz POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) );
//zz }
//zz }
-//zz
+//zz
//zz PRE(sys_fstat64)
//zz {
//zz PRINT("sys_fstat64 ( %d, %p )",ARG1,ARG2);
//zz PRE_REG_READ2(long, "fstat64", unsigned long, fd, struct stat64 *, buf);
//zz PRE_MEM_WRITE( "fstat64(buf)", ARG2, sizeof(struct vki_stat64) );
//zz }
-//zz
+//zz
//zz POST(sys_fstat64)
//zz {
//zz POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) );
@@ -588,7 +588,7 @@ POST(sys_ptrace)
------------------------------------------------------------------ */
/* Add an ppc64-linux specific wrapper to a syscall table. */
-#define PLAX_(sysno, name) WRAPPER_ENTRY_X_(ppc64_linux, sysno, name)
+#define PLAX_(sysno, name) WRAPPER_ENTRY_X_(ppc64_linux, sysno, name)
#define PLAXY(sysno, name) WRAPPER_ENTRY_XY(ppc64_linux, sysno, name)
// This table maps from __NR_xxx syscall numbers (from
@@ -630,7 +630,7 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_setuid, sys_setuid), // 23
GENX_(__NR_getuid, sys_getuid), // 24
-// _____(__NR_stime, sys_stime), // 25
+ LINX_(__NR_stime, sys_stime), // 25
PLAXY(__NR_ptrace, sys_ptrace), // 26
GENX_(__NR_alarm, sys_alarm), // 27
// _____(__NR_oldfstat, sys_oldfstat), // 28
@@ -674,7 +674,7 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_umask, sys_umask), // 60
GENX_(__NR_chroot, sys_chroot), // 61
-// _____(__NR_ustat, sys_ustat), // 62
+ LINXY(__NR_ustat, sys_ustat), // 62
GENXY(__NR_dup2, sys_dup2), // 63
GENX_(__NR_getppid, sys_getppid), // 64
@@ -687,14 +687,14 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_setreuid, sys_setreuid), // 70
GENX_(__NR_setregid, sys_setregid), // 71
// _____(__NR_sigsuspend, sys_sigsuspend), // 72
-// _____(__NR_sigpending, sys_sigpending), // 73
-// _____(__NR_sethostname, sys_sethostname), // 74
+ LINXY(__NR_sigpending, sys_sigpending), // 73
+ GENX_(__NR_sethostname, sys_sethostname), // 74
GENX_(__NR_setrlimit, sys_setrlimit), // 75
-// _____(__NR_getrlimit, sys_getrlimit), // 76
+ GENXY(__NR_getrlimit, sys_getrlimit), // 76
GENXY(__NR_getrusage, sys_getrusage), // 77
GENXY(__NR_gettimeofday, sys_gettimeofday), // 78
-// _____(__NR_settimeofday, sys_settimeofday), // 79
+ GENX_(__NR_settimeofday, sys_settimeofday), // 79
GENXY(__NR_getgroups, sys_getgroups), // 80
GENX_(__NR_setgroups, sys_setgroups), // 81
@@ -704,7 +704,7 @@ static SyscallTableEntry syscall_table[] = {
GENXY(__NR_readlink, sys_readlink), // 85
// _____(__NR_uselib, sys_uselib), // 86
-// _____(__NR_swapon, sys_swapon), // 87
+ LINX_(__NR_swapon, sys_swapon), // 87
// _____(__NR_reboot, sys_reboot), // 88
// _____(__NR_readdir, sys_readdir), // 89
@@ -713,7 +713,7 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_truncate, sys_truncate), // 92
GENX_(__NR_ftruncate, sys_ftruncate), // 93
GENX_(__NR_fchmod, sys_fchmod), // 94
-
+
GENX_(__NR_fchown, sys_fchown), // 95
GENX_(__NR_getpriority, sys_getpriority), // 96
GENX_(__NR_setpriority, sys_setpriority), // 97
@@ -738,14 +738,14 @@ static SyscallTableEntry syscall_table[] = {
// _____(__NR_vm86, sys_vm86), // 113
GENXY(__NR_wait4, sys_wait4), // 114
-// _____(__NR_swapoff, sys_swapoff), // 115
+ LINX_(__NR_swapoff, sys_swapoff), // 115
LINXY(__NR_sysinfo, sys_sysinfo), // 116
LINXY(__NR_ipc, sys_ipc), // 117
GENX_(__NR_fsync, sys_fsync), // 118
// _____(__NR_sigreturn, sys_sigreturn), // 119
LINX_(__NR_clone, sys_clone), // 120
-// _____(__NR_setdomainname, sys_setdomainname), // 121
+ LINX_(__NR_setdomainname, sys_setdomainname), // 121
GENXY(__NR_uname, sys_newuname), // 122
// _____(__NR_modify_ldt, sys_modify_ldt), // 123
LINXY(__NR_adjtimex, sys_adjtimex), // 124
@@ -762,7 +762,7 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_fchdir, sys_fchdir), // 133
// _____(__NR_bdflush, sys_bdflush), // 134
-// _____(__NR_sysfs, sys_sysfs), // 135
+ LINXY(__NR_sysfs, sys_sysfs), // 135
LINX_(__NR_personality, sys_personality), // 136
// _____(__NR_afs_syscall, sys_afs_syscall), // 137
LINX_(__NR_setfsuid, sys_setfsuid), // 138
@@ -847,9 +847,9 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_fcntl64, sys_fcntl64), // 204 !!!!?? 32bit only */
GENX_(__NR_madvise, sys_madvise), // 205
-// _____(__NR_mincore, sys_mincore), // 206
+ GENXY(__NR_mincore, sys_mincore), // 206
LINX_(__NR_gettid, sys_gettid), // 207
-// _____(__NR_tkill, sys_tkill), // 208
+ LINXY(__NR_tkill, sys_tkill), // 208
LINX_(__NR_setxattr, sys_setxattr), // 209
LINX_(__NR_lsetxattr, sys_lsetxattr), // 210
@@ -884,7 +884,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_epoll_create, sys_epoll_create), // 236
LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 237
LINXY(__NR_epoll_wait, sys_epoll_wait), // 238
-// _____(__NR_remap_file_pages, sys_remap_file_pages), // 239
+ LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 239
LINXY(__NR_timer_create, sys_timer_create), // 240
LINXY(__NR_timer_settime, sys_timer_settime), // 241
@@ -934,6 +934,10 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_pselect6, sys_pselect6), // 280
LINXY(__NR_ppoll, sys_ppoll), // 281
+ LINX_(__NR_unshare, sys_unshare), // 282
+ LINX_(__NR_splice, sys_splice), // 283
+ LINX_(__NR_tee, sys_tee), // 284
+ LINXY(__NR_vmsplice, sys_vmsplice), // 285
LINXY(__NR_openat, sys_openat), // 286
LINX_(__NR_mkdirat, sys_mkdirat), // 287
@@ -972,6 +976,8 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_preadv, sys_preadv), // 320
LINX_(__NR_pwritev, sys_pwritev), // 321
LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 322
+ LINXY(__NR_fanotify_init, sys_fanotify_init), // 323
+ LINX_(__NR_fanotify_mark, sys_fanotify_mark), // 324
LINXY(__NR_prlimit64, sys_prlimit64), // 325
LINXY(__NR_socket, sys_socket), // 326
@@ -999,8 +1005,10 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_syncfs, sys_syncfs), // 348
LINXY(__NR_sendmmsg, sys_sendmmsg), // 349
+ LINX_(__NR_setns, sys_setns), // 350
LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 351
LINX_(__NR_process_vm_writev, sys_process_vm_writev),// 352
+ LINX_(__NR_kcmp, sys_kcmp), // 354
LINX_(__NR_sched_setattr, sys_sched_setattr), // 355
LINXY(__NR_sched_getattr, sys_sched_getattr), // 356
@@ -1008,6 +1016,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_getrandom, sys_getrandom), // 359
LINXY(__NR_memfd_create, sys_memfd_create), // 360
+ LINXY(__NR_bpf, sys_bpf), // 361
LINX_(__NR_execveat, sys_execveat), // 362
@@ -1023,7 +1032,10 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_rseq, sys_ni_syscall), // 387
LINX_(__NR_io_pgetevents, sys_io_pgetevents), // 388
-
+ LINX_(__NR_semtimedop, sys_semtimedop), // 392
+ LINXY(__NR_semctl, sys_semctl), // 394
+ LINXY(__NR_shmctl, sys_shmctl), // 396
+ LINXY(__NR_msgctl, sys_msgctl), // 402
LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
@@ -1041,12 +1053,19 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+ LINX_ (__NR_mount_setattr, sys_mount_setattr), // 442
+ LINX_ (__NR_quotactl_fd, sys_quotactl_fd), // 443
LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445
LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446
+ LINX_ (__NR_futex_waitv, sys_futex_waitv), // 449
+ LINXY (__NR_cachestat, sys_cachestat), // 451
LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
+ LINXY (__NR_statmount, sys_statmount), // 457
+ LINXY (__NR_listmount, sys_listmount), // 458
+ LINX_ (__NR_mseal, sys_mseal), // 462
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c
index ebf9c31053..78b1b6b42d 100644
--- a/coregrind/m_syswrap/syswrap-riscv64-linux.c
+++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -383,7 +383,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_pselect6, sys_pselect6), /* 72 */
LINXY(__NR_ppoll, sys_ppoll), /* 73 */
LINXY(__NR_signalfd4, sys_signalfd4), /* 74 */
- LINX_(__NR_vmsplice, sys_vmsplice), /* 75 */
+ LINXY(__NR_vmsplice, sys_vmsplice), /* 75 */
LINX_(__NR_splice, sys_splice), /* 76 */
LINX_(__NR_tee, sys_tee), /* 77 */
LINXY(__NR_readlinkat, sys_readlinkat), /* 78 */
@@ -468,6 +468,7 @@ static SyscallTableEntry syscall_main_table[] = {
GENX_(__NR_setgroups, sys_setgroups), /* 159 */
GENXY(__NR_uname, sys_newuname), /* 160 */
GENX_(__NR_sethostname, sys_sethostname), /* 161 */
+ LINX_(__NR_setdomainname, sys_setdomainname), /* 162 */
GENXY(__NR_getrlimit, sys_getrlimit), /* 163 */
GENX_(__NR_setrlimit, sys_setrlimit), /* 164 */
GENXY(__NR_getrusage, sys_getrusage), /* 165 */
@@ -529,6 +530,8 @@ static SyscallTableEntry syscall_main_table[] = {
GENX_(__NR_execve, sys_execve), /* 221 */
PLAX_(__NR_mmap, sys_mmap), /* 222 */
GENX_(__NR_fadvise64, sys_ni_syscall), /* 223 */
+ LINX_(__NR_swapon, sys_swapon), /* 224 */
+ LINX_(__NR_swapoff, sys_swapoff), /* 225 */
GENXY(__NR_mprotect, sys_mprotect), /* 226 */
GENX_(__NR_msync, sys_msync), /* 227 */
GENX_(__NR_mlock, sys_mlock), /* 228 */
@@ -537,6 +540,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_(__NR_munlockall, sys_munlockall), /* 231 */
GENXY(__NR_mincore, sys_mincore), /* 232 */
GENX_(__NR_madvise, sys_madvise), /* 233 */
+ LINX_(__NR_remap_file_pages, sys_remap_file_pages), /* 234 */
LINX_(__NR_mbind, sys_mbind), /* 235 */
LINXY(__NR_get_mempolicy, sys_get_mempolicy), /* 236 */
LINX_(__NR_set_mempolicy, sys_set_mempolicy), /* 237 */
@@ -593,11 +597,18 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_pidfd_getfd, sys_pidfd_getfd), /* 438 */
LINX_(__NR_faccessat2, sys_faccessat2), /* 439 */
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), /* 441 */
+ LINX_(__NR_mount_setattr, sys_mount_setattr), /* 442 */
+ LINX_(__NR_quotactl_fd, sys_quotactl_fd), /* 443 */
LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), /* 444 */
LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), /* 445 */
LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), /* 446 */
LINXY(__NR_memfd_secret, sys_memfd_secret), /* 447 */
+ LINX_(__NR_futex_waitv, sys_futex_waitv), /* 449 */
+ LINXY(__NR_cachestat, sys_cachestat), /* 451 */
LINX_(__NR_fchmodat2, sys_fchmodat2), /* 452 */
+ LINXY(__NR_statmount, sys_statmount), /* 457 */
+ LINXY(__NR_listmount, sys_listmount), /* 458 */
+ LINX_(__NR_mseal, sys_mseal), /* 462 */
};
SyscallTableEntry* ML_(get_linux_syscall_entry)(UInt sysno)
diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c
index 9191c2093d..c16b69731a 100644
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -485,7 +485,7 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_umask, sys_umask), // 60
GENX_(__NR_chroot, sys_chroot), // 61
-// ?????(__NR_ustat, sys_ustat), /* deprecated in favor of statfs */ // 62
+ LINXY(__NR_ustat, sys_ustat), /* deprecated in favor of statfs */ // 62
GENXY(__NR_dup2, sys_dup2), // 63
GENX_(__NR_getppid, sys_getppid), // 64
@@ -498,8 +498,8 @@ static SyscallTableEntry syscall_table[] = {
GENX_(70, sys_ni_syscall), /* unimplemented (by the kernel) */ // 70
GENX_(71, sys_ni_syscall), /* unimplemented (by the kernel) */ // 71
// ?????(__NR_sigsuspend, ), // 72
-// ?????(__NR_sigpending, ), // 73
-// ?????(__NR_sethostname, ), // 74
+ LINXY(__NR_sigpending, sys_sigpending), // 73
+ GENX_(__NR_sethostname, sys_sethostname), // 74
GENX_(__NR_setrlimit, sys_setrlimit), // 75
GENXY(76, sys_getrlimit), /* see also 191 */ // 76
@@ -515,7 +515,7 @@ static SyscallTableEntry syscall_table[] = {
GENXY(__NR_readlink, sys_readlink), // 85
// ?????(__NR_uselib, ), // 86
-// ?????(__NR_swapon, ), // 87
+ LINX_(__NR_swapon, sys_swapon), // 87
// ?????(__NR_reboot, ), // 88
GENX_(89, sys_ni_syscall), /* unimplemented (by the kernel) */ // 89
@@ -549,14 +549,14 @@ static SyscallTableEntry syscall_table[] = {
GENX_(113, sys_ni_syscall), /* unimplemented (by the kernel) */ // 113
GENXY(__NR_wait4, sys_wait4), // 114
-// ?????(__NR_swapoff, ), // 115
+ LINX_(__NR_swapoff, sys_swapoff), // 115
LINXY(__NR_sysinfo, sys_sysinfo), // 116
LINXY(__NR_ipc, sys_ipc), // 117
GENX_(__NR_fsync, sys_fsync), // 118
PLAX_(__NR_sigreturn, sys_sigreturn), // 119
LINX_(__NR_clone, sys_clone), // 120
-// ?????(__NR_setdomainname, ), // 121
+ LINX_(__NR_setdomainname, sys_setdomainname), // 121
GENXY(__NR_uname, sys_newuname), // 122
GENX_(123, sys_ni_syscall), /* unimplemented (by the kernel) */ // 123
// ?????(__NR_adjtimex, ), // 124
@@ -573,7 +573,7 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_fchdir, sys_fchdir), // 133
// ?????(__NR_bdflush, ), // 134
-// ?????(__NR_sysfs, ), // 135
+ LINXY(__NR_sysfs, sys_sysfs), // 135
LINX_(__NR_personality, sys_personality), // 136
GENX_(137, sys_ni_syscall), /* unimplemented (by the kernel) */ // 137
GENX_(138, sys_ni_syscall), /* unimplemented (by the kernel) */ // 138
@@ -731,7 +731,7 @@ static SyscallTableEntry syscall_table[] = {
GENXY(__NR_statfs64, sys_statfs64), // 265
GENXY(__NR_fstatfs64, sys_fstatfs64), // 266
-// ?????(__NR_remap_file_pages, ),
+ LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 267
GENX_(268, sys_ni_syscall), /* unimplemented (by the kernel) */ // 268
GENX_(269, sys_ni_syscall), /* unimplemented (by the kernel) */ // 269
@@ -832,6 +832,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_getrandom, sys_getrandom), // 349
LINXY(__NR_memfd_create, sys_memfd_create), // 350
+ LINXY(__NR_bpf, sys_bpf), // 351
LINX_(__NR_execveat, sys_execveat), // 354
@@ -864,6 +865,10 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_rseq, sys_ni_syscall), // 381
LINX_(__NR_io_pgetevents, sys_io_pgetevents), // 382
+ LINX_(__NR_semtimedop, sys_semtimedop), // 392
+ LINXY(__NR_semctl, sys_semctl), // 394
+ LINXY(__NR_shmctl, sys_shmctl), // 396
+ LINXY(__NR_msgctl, sys_msgctl), // 402
LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
@@ -881,6 +886,8 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+ LINX_(__NR_mount_setattr, sys_mount_setattr), // 442
+ LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443
LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445
@@ -888,7 +895,12 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_memfd_secret, sys_memfd_secret), // 447
+ LINX_ (__NR_futex_waitv, sys_futex_waitv), // 449
+ LINXY (__NR_cachestat, sys_cachestat), // 451
LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
+ LINXY (__NR_statmount, sys_statmount), // 457
+ LINXY (__NR_listmount, sys_listmount), // 458
+ LINX_ (__NR_mseal, sys_mseal), // 462
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c
index a5d34bc5d5..2665633f43 100644
--- a/coregrind/m_syswrap/syswrap-solaris.c
+++ b/coregrind/m_syswrap/syswrap-solaris.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1812,18 +1812,8 @@ PRE(sys_linkat)
PRE_MEM_RASCIIZ("linkat(path2)", ARG4);
/* Be strict but ignore fd1/fd2 for absolute path1/path2. */
- if (fd1 != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(fd1, "linkat", tid, False)) {
- SET_STATUS_Failure(VKI_EBADF);
- }
- if (fd2 != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG4, 1)
- && ((HChar *) ARG4)[0] != '/'
- && !ML_(fd_allowed)(fd2, "linkat", tid, False)) {
- SET_STATUS_Failure(VKI_EBADF);
- }
+ ML_(fd_at_check_allowed)(fd1, (const HChar*)ARG2, "linkat(efd)", tid, status);
+ ML_(fd_at_check_allowed)(fd2, (const HChar*)ARG4, "linkat(nfd)", tid, status);
*flags |= SfMayBlock;
}
@@ -1844,11 +1834,7 @@ PRE(sys_symlinkat)
PRE_MEM_RASCIIZ("symlinkat(path2)", ARG3);
/* Be strict but ignore fd for absolute path2. */
- if (fd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG3, 1)
- && ((HChar *) ARG3)[0] != '/'
- && !ML_(fd_allowed)(fd, "symlinkat", tid, False))
- SET_STATUS_Failure(VKI_EBADF);
+ ML_(fd_at_check_allowed)(fd, (const HChar*)ARG3, "symlinkat", tid, status);
*flags |= SfMayBlock;
}
@@ -2323,13 +2309,7 @@ PRE(sys_readlinkat)
PRE_MEM_WRITE("readlinkat(buf)", ARG3, ARG4);
/* Be strict but ignore dfd for absolute path. */
- if (dfd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(dfd, "readlinkat", tid, False)) {
- SET_STATUS_Failure(VKI_EBADF);
- return;
- }
+ ML_(fd_at_check_allowed)(dfd, (const HChar*)ARG2, "readlinkat", tid, status);
/* Handle the case where readlinkat is looking at /proc/self/path/a.out or
/proc//path/a.out. */
@@ -2364,6 +2344,8 @@ PRE(sys_fstat)
PRINT("sys_fstat ( %ld, %#lx )", SARG1, ARG2);
PRE_REG_READ2(long, "fstat", int, fildes, struct stat *, buf);
PRE_MEM_WRITE("fstat(buf)", ARG2, sizeof(struct vki_stat));
+ if (!ML_(fd_allowed)(ARG1, "fstat", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
POST(sys_fstat)
@@ -2388,11 +2370,7 @@ PRE(sys_frealpathat)
PRE_MEM_WRITE("frealpathat(buf)", ARG3, ARG4);
/* Be strict but ignore fd for absolute path. */
- if (fd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(fd, "frealpathat", tid, False))
- SET_STATUS_Failure(VKI_EBADF);
+ ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "frealpathat", tid, status);
}
POST(sys_frealpathat)
@@ -2531,11 +2509,7 @@ PRE(sys_faccessat)
PRE_MEM_RASCIIZ("faccessat(path)", ARG2);
/* Be strict but ignore fd for absolute path. */
- if (fd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(fd, "faccessat", tid, False))
- SET_STATUS_Failure(VKI_EBADF);
+ ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "faccessat", tid, status);
}
PRE(sys_mknodat)
@@ -2553,17 +2527,14 @@ PRE(sys_mknodat)
PRE_MEM_RASCIIZ("mknodat(fname)", ARG2);
/* Be strict but ignore fd for absolute path. */
- if (fd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(fd, "mknodat", tid, False))
- SET_STATUS_Failure(VKI_EBADF);
+ ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "mknodat", tid, status);
*flags |= SfMayBlock;
}
POST(sys_mknodat)
{
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "mknodat", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure(VKI_EMFILE);
@@ -3594,11 +3565,7 @@ PRE(sys_fchownat)
PRE_MEM_RASCIIZ("fchownat(path)", ARG2);
/* Be strict but ignore fd for absolute path. */
- if (fd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(fd, "fchownat", tid, False))
- SET_STATUS_Failure(VKI_EBADF);
+ ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "fchownat", tid, status);
}
PRE(sys_fdsync)
@@ -4142,18 +4109,8 @@ PRE(sys_renameat)
PRE_MEM_RASCIIZ("renameat(new)", ARG4);
/* Be strict but ignore fromfd/tofd for absolute old/new. */
- if (fromfd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(fromfd, "renameat", tid, False)) {
- SET_STATUS_Failure(VKI_EBADF);
- }
- if (tofd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG4, 1)
- && ((HChar *) ARG4)[0] != '/'
- && !ML_(fd_allowed)(tofd, "renameat", tid, False)) {
- SET_STATUS_Failure(VKI_EBADF);
- }
+ ML_(fd_at_check_allowed)(fromfd, (const HChar*)ARG2, "renameat(fromfd)", tid, status);
+ ML_(fd_at_check_allowed)(tofd, (const HChar*)ARG4, "renameat(tofd)", tid, status);
}
PRE(sys_unlinkat)
@@ -4172,11 +4129,7 @@ PRE(sys_unlinkat)
PRE_MEM_RASCIIZ("unlinkat(pathname)", ARG2);
/* Be strict but ignore dfd for absolute pathname. */
- if (dfd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(dfd, "unlinkat", tid, False))
- SET_STATUS_Failure(VKI_EBADF);
+ ML_(fd_at_check_allowed)(dfd, (const HChar*)ARG2, "unlinkat", tid, status);
}
PRE(sys_fstatat)
@@ -4200,11 +4153,7 @@ PRE(sys_fstatat)
PRE_MEM_WRITE("fstatat(buf)", ARG3, sizeof(struct vki_stat));
/* Be strict but ignore fildes for absolute path. */
- if (fd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(fd, "fstatat", tid, False))
- SET_STATUS_Failure(VKI_EBADF);
+ ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "fstatat", tid, status);
}
POST(sys_fstatat)
@@ -4238,6 +4187,7 @@ PRE(sys_openat)
PRE_MEM_RASCIIZ("openat(filename)", ARG2);
+ // @todo PJF use ML_(fd_at_check) and not return early here
/* Be strict but ignore fildes for absolute pathname. */
if (fd != VKI_AT_FDCWD
&& ML_(safe_to_deref)((void *) ARG2, 1)
@@ -5056,11 +5006,7 @@ PRE(sys_fchmodat)
PRE_MEM_RASCIIZ("fchmodat(path)", ARG2);
/* Be strict but ignore fd for absolute path. */
- if (fd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(fd, "fchmodat", tid, False))
- SET_STATUS_Failure(VKI_EBADF);
+ ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "fchmodat", tid, status);
}
PRE(sys_mkdirat)
@@ -5078,11 +5024,7 @@ PRE(sys_mkdirat)
PRE_MEM_RASCIIZ("mkdirat(path)", ARG2);
/* Be strict but ignore fd for absolute path. */
- if (fd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(fd, "mkdirat", tid, False))
- SET_STATUS_Failure(VKI_EBADF);
+ ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "mkdirat", tid, status);
}
static void do_statvfs_post(struct vki_statvfs *stats, ThreadId tid)
@@ -5274,11 +5216,7 @@ PRE(sys_utimesys)
PRE_MEM_READ("utimesys(times)", ARG4, 2 * sizeof(vki_timespec_t));
/* Be strict but ignore fd for absolute path. */
- if (fd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG3, 1)
- && ((HChar *) ARG3)[0] != '/'
- && !ML_(fd_allowed)(fd, "utimesys", tid, False))
- SET_STATUS_Failure(VKI_EBADF);
+ ML_(fd_at_check_allowed)(fd, (const HChar*)ARG3, "utimesys", tid, status);
break;
}
default:
@@ -5310,11 +5248,7 @@ PRE(sys_utimensat)
PRE_MEM_READ("utimensat(times)", ARG3, 2 * sizeof(vki_timespec_t));
/* Be strict but ignore fd for absolute path. */
- if (fd != VKI_AT_FDCWD
- && ML_(safe_to_deref)((void *) ARG2, 1)
- && ((HChar *) ARG2)[0] != '/'
- && !ML_(fd_allowed)(fd, "utimensat", tid, False))
- SET_STATUS_Failure(VKI_EBADF);
+ ML_(fd_at_check_allowed)(fd, (const HChar*)ARG2, "utimensat", tid, status);
}
#endif /* SOLARIS_UTIMENSAT_SYSCALL */
@@ -7786,6 +7720,7 @@ POST(sys_port)
Int opcode = ARG1 & VKI_PORT_CODE_MASK;
switch (opcode) {
case VKI_PORT_CREATE:
+ POST_newFd_RES;
if (!ML_(fd_allowed)(RES, "port", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure(VKI_EMFILE);
diff --git a/coregrind/m_syswrap/syswrap-x86-darwin.c b/coregrind/m_syswrap/syswrap-x86-darwin.c
index 49533e2533..7459ef83a2 100644
--- a/coregrind/m_syswrap/syswrap-x86-darwin.c
+++ b/coregrind/m_syswrap/syswrap-x86-darwin.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syswrap-x86-freebsd.c b/coregrind/m_syswrap/syswrap-x86-freebsd.c
index 0ad3dda264..1bb3d6fed2 100644
--- a/coregrind/m_syswrap/syswrap-x86-freebsd.c
+++ b/coregrind/m_syswrap/syswrap-x86-freebsd.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -679,18 +679,16 @@ PRE(sys_preadv)
int, fd, const struct iovec *, iov,
int, iovcnt, vki_uint32_t, MERGE64_FIRST(offset),
vki_uint32_t, MERGE64_SECOND(offset));
- if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) {
- SET_STATUS_Failure( VKI_EBADF );
- } else {
- if ((Int)ARG3 > 0)
- PRE_MEM_READ( "preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec) );
-
- if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) {
- vec = (struct vki_iovec *)(Addr)ARG2;
- for (i = 0; i < (Int)ARG3; i++)
- PRE_MEM_WRITE( "preadv(iov[...])",
- (Addr)vec[i].iov_base, vec[i].iov_len );
- }
+ if (!ML_(fd_allowed)(ARG1, "preadv", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
+ if ((Int)ARG3 > 0)
+ PRE_MEM_READ( "preadv(iov)", ARG2, ARG3 * sizeof(struct vki_iovec) );
+
+ if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) {
+ vec = (struct vki_iovec *)(Addr)ARG2;
+ for (i = 0; i < (Int)ARG3; i++)
+ PRE_MEM_WRITE( "preadv(iov[...])",
+ (Addr)vec[i].iov_base, vec[i].iov_len );
}
}
@@ -728,17 +726,15 @@ PRE(sys_pwritev)
int, iovcnt,
vki_uint32_t, MERGE64_FIRST(offset),
vki_uint32_t, MERGE64_SECOND(offset));
- if (!ML_(fd_allowed)(ARG1, "pwritev", tid, False)) {
+ if (!ML_(fd_allowed)(ARG1, "pwritev", tid, False))
SET_STATUS_Failure( VKI_EBADF );
- } else {
- if ((Int)ARG3 >= 0)
- PRE_MEM_READ( "pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) );
- if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) {
- vec = (struct vki_iovec *)(Addr)ARG2;
- for (i = 0; i < (Int)ARG3; i++)
- PRE_MEM_READ( "pwritev(iov[...])",
- (Addr)vec[i].iov_base, vec[i].iov_len );
- }
+ if ((Int)ARG3 >= 0)
+ PRE_MEM_READ( "pwritev(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) );
+ if (ML_(safe_to_deref)((struct vki_iovec *)ARG2, ARG3 * sizeof(struct vki_iovec))) {
+ vec = (struct vki_iovec *)(Addr)ARG2;
+ for (i = 0; i < (Int)ARG3; i++)
+ PRE_MEM_READ( "pwritev(iov[...])",
+ (Addr)vec[i].iov_base, vec[i].iov_len );
}
}
@@ -754,7 +750,8 @@ PRE(sys_sendfile)
int, fd, int, s, unsigned int, offset_low,
unsigned int, offset_high, size_t, nbytes,
void *, hdtr, vki_off_t *, sbytes, int, flags);
-
+ if (!ML_(fd_allowed)(ARG1, "sendfile", tid, False))
+ SET_STATUS_Failure( VKI_EBADF );
if (ARG6 != 0)
PRE_MEM_READ("sendfile(hdtr)", ARG6, sizeof(struct vki_sf_hdtr));
@@ -1091,8 +1088,7 @@ PRE(sys_pread)
if (!ML_(fd_allowed)(ARG1, "pread", tid, False))
SET_STATUS_Failure( VKI_EBADF );
- else
- PRE_MEM_WRITE( "pread(buf)", ARG2, ARG3 );
+ PRE_MEM_WRITE( "pread(buf)", ARG2, ARG3 );
}
POST(sys_pread)
@@ -1120,8 +1116,7 @@ PRE(sys_pwrite)
ok = True;
if (!ok)
SET_STATUS_Failure( VKI_EBADF );
- else
- PRE_MEM_READ( "pwrite(buf)", ARG2, ARG3 );
+ PRE_MEM_READ( "pwrite(buf)", ARG2, ARG3 );
}
// SYS_mmap 477
@@ -1147,10 +1142,12 @@ PRE(sys_lseek)
{
PRINT("sys_lseek ( %" FMT_REGWORD "d, %llu, %" FMT_REGWORD "d )", SARG1,MERGE64(ARG2,ARG3),SARG4);
PRE_REG_READ4(long, "lseek",
- unsigned int, fd,
+ int, fildes,
vki_uint32_t, MERGE64_FIRST(offset),
vki_uint32_t, MERGE64_SECOND(offset),
unsigned int, whence);
+ if (!ML_(fd_allowed)(ARG1, "lseek", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_truncate 479
@@ -1175,6 +1172,8 @@ PRE(sys_ftruncate)
PRE_REG_READ3(int, "ftruncate", int, fd,
vki_uint32_t, MERGE64_FIRST(length),
vki_uint32_t, MERGE64_SECOND(length));
+ if (!ML_(fd_allowed)(ARG1, "ftruncate", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_cpuset_setid 485
@@ -1258,6 +1257,8 @@ PRE(sys_posix_fallocate)
vki_uint32_t, MERGE64_SECOND(offset),
vki_uint32_t, MERGE64_FIRST(len),
vki_uint32_t, MERGE64_SECOND(len));
+ if (!ML_(fd_allowed)(ARG1, "posix_fallocate", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_posix_fadvise 531
@@ -1272,6 +1273,8 @@ PRE(sys_posix_fadvise)
vki_uint32_t, MERGE64_FIRST(len),
vki_uint32_t, MERGE64_SECOND(len),
int, advice);
+ if (!ML_(fd_allowed)(ARG1, "posix_fadvise", tid, False))
+ SET_STATUS_Failure(VKI_EBADF);
}
// SYS_wait6 532
@@ -1389,6 +1392,7 @@ PRE(sys_mknodat)
PRE_REG_READ5(long, "mknodat",
int, fd, const char *, path, vki_mode_t, mode, vki_uint32_t, MERGE64_FIRST(dev), vki_uint32_t, MERGE64_SECOND(idev))
PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 );
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "mknodat", tid, status);
}
// SYS_cpuset_getdomain 561
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
index d7f173cd91..423feac568 100644
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1032,6 +1032,7 @@ PRE(sys_fstatat64)
SARG1, ARG2, (HChar*)ARG2, ARG3, ARG4);
PRE_REG_READ4(long, "fstatat64",
int, dfd, char *, file_name, struct stat64 *, buf, int, flags);
+ ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "fstatat64", tid, status);
PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 );
PRE_MEM_WRITE( "fstatat64(buf)", ARG3, sizeof(struct vki_stat64) );
}
@@ -1230,7 +1231,7 @@ static SyscallTableEntry syscall_table[] = {
//zz
GENX_(__NR_umask, sys_umask), // 60
GENX_(__NR_chroot, sys_chroot), // 61
-//zz // (__NR_ustat, sys_ustat) // 62 SVr4 -- deprecated
+ LINXY(__NR_ustat, sys_ustat), // 62 SVr4 -- deprecated
GENXY(__NR_dup2, sys_dup2), // 63
GENX_(__NR_getppid, sys_getppid), // 64
@@ -1260,7 +1261,7 @@ static SyscallTableEntry syscall_table[] = {
//zz
GENXY(__NR_readlink, sys_readlink), // 85
//zz // (__NR_uselib, sys_uselib), // 86 */Linux
-//zz // (__NR_swapon, sys_swapon), // 87 */Linux
+ LINX_(__NR_swapon, sys_swapon), // 87 */Linux
//zz // (__NR_reboot, sys_reboot), // 88 */Linux
//zz // (__NR_readdir, old_readdir), // 89 -- superseded
//zz
@@ -1294,14 +1295,14 @@ static SyscallTableEntry syscall_table[] = {
PLAXY(__NR_vm86old, sys_vm86old), // 113 x86/Linux-only
GENXY(__NR_wait4, sys_wait4), // 114
//zz
-//zz // (__NR_swapoff, sys_swapoff), // 115 */Linux
+ LINX_(__NR_swapoff, sys_swapoff), // 115 */Linux
LINXY(__NR_sysinfo, sys_sysinfo), // 116
LINXY(__NR_ipc, sys_ipc), // 117
GENX_(__NR_fsync, sys_fsync), // 118
PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux
LINX_(__NR_clone, sys_clone), // 120
-//zz // (__NR_setdomainname, sys_setdomainname), // 121 */*(?)
+ LINX_(__NR_setdomainname, sys_setdomainname), // 121
GENXY(__NR_uname, sys_newuname), // 122
PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123
LINXY(__NR_adjtimex, sys_adjtimex), // 124
@@ -1320,7 +1321,7 @@ static SyscallTableEntry syscall_table[] = {
GENX_(__NR_fchdir, sys_fchdir), // 133
//zz // (__NR_bdflush, sys_bdflush), // 134 */Linux
//zz
-//zz // (__NR_sysfs, sys_sysfs), // 135 SVr4
+ LINXY(__NR_sysfs, sys_sysfs), // 135 SVr4
LINX_(__NR_personality, sys_personality), // 136
GENX_(__NR_afs_syscall, sys_ni_syscall), // 137
LINX_(__NR_setfsuid, sys_setfsuid16), // 138
@@ -1467,7 +1468,7 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 255
LINXY(__NR_epoll_wait, sys_epoll_wait), // 256
-//zz // (__NR_remap_file_pages, sys_remap_file_pages), // 257 */Linux
+ LINX_(__NR_remap_file_pages, sys_remap_file_pages), // 257 */Linux
LINX_(__NR_set_tid_address, sys_set_tid_address), // 258
LINXY(__NR_timer_create, sys_timer_create), // 259
@@ -1587,7 +1588,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_getrandom, sys_getrandom), // 355
LINXY(__NR_memfd_create, sys_memfd_create), // 356
-// LIN__(__NR_bpf, sys_ni_syscall), // 357
+ LINXY(__NR_bpf, sys_bpf), // 357
LINX_(__NR_execveat, sys_execveat), // 358
LINXY(__NR_socket, sys_socket), // 359
LINXY(__NR_socketpair, sys_socketpair), // 360
@@ -1623,11 +1624,19 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_io_pgetevents, sys_io_pgetevents), // 385
GENX_(__NR_rseq, sys_ni_syscall), // 386
+ LINX_(__NR_semget, sys_semget), // 393
+ LINXY(__NR_semctl, sys_semctl), // 394
+
LINX_(__NR_shmget, sys_shmget), // 395
LINX_(__NR_shmctl, sys_shmctl), // 396
LINX_(__NR_shmat, sys_shmat), // 397
LINX_(__NR_shmdt, sys_shmdt), // 398
+ LINX_(__NR_msgget, sys_msgget), // 399
+ LINX_(__NR_msgsnd, sys_msgsnd), // 400
+ LINXY(__NR_msgrcv, sys_msgrcv), // 401
+ LINXY(__NR_msgctl, sys_msgctl), // 402
+
LINXY(__NR_clock_gettime64, sys_clock_gettime64), // 403
LINX_(__NR_clock_settime64, sys_clock_settime64), // 404
@@ -1667,6 +1676,8 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+ LINX_(__NR_mount_setattr, sys_mount_setattr), // 442
+ LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443
LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445
@@ -1674,7 +1685,12 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_memfd_secret, sys_memfd_secret), // 447
+ LINX_(__NR_futex_waitv, sys_futex_waitv), // 449
+ LINXY(__NR_cachestat, sys_cachestat), // 451
LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
+ LINXY(__NR_statmount, sys_statmount), // 457
+ LINXY(__NR_listmount, sys_listmount), // 458
+ LINX_(__NR_mseal, sys_mseal), // 462
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/coregrind/m_syswrap/syswrap-x86-solaris.c b/coregrind/m_syswrap/syswrap-x86-solaris.c
index 59c36c1852..629e019819 100644
--- a/coregrind/m_syswrap/syswrap-x86-solaris.c
+++ b/coregrind/m_syswrap/syswrap-x86-solaris.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 8cb91b57d1..e9f844e0d5 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_threadstate.c b/coregrind/m_threadstate.c
index 85ae03569d..9b303bd14b 100644
--- a/coregrind/m_threadstate.c
+++ b/coregrind/m_threadstate.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c
index 58aa82ccf7..1362cd142a 100644
--- a/coregrind/m_tooliface.c
+++ b/coregrind/m_tooliface.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S
index 2c2cc0dc2a..0746fd0f18 100644
--- a/coregrind/m_trampoline.S
+++ b/coregrind/m_trampoline.S
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -604,6 +604,51 @@ VG_(ppc64_linux_REDIR_FOR_strchr):
.L1end:
+ /* this function is written using the "dotless" ABI convention */
+ .align 2
+ .globl VG_(ppc64_linux_REDIR_FOR_strcmp)
+#if !defined VGP_ppc64be_linux || _CALL_ELF == 2
+ /* Little Endian uses ELF version 2 */
+ .type VG_(ppc64_linux_REDIR_FOR_strcmp),@function
+VG_(ppc64_linux_REDIR_FOR_strcmp):
+#else
+ /* Big Endian uses ELF version 1 */
+ .section ".opd","aw"
+ .align 3
+VG_(ppc64_linux_REDIR_FOR_strcmp):
+ .quad .L.VG_(ppc64_linux_REDIR_FOR_strcmp),.TOC.@tocbase,0
+ .previous
+ .size VG_(ppc64_linux_REDIR_FOR_strcmp), \
+ .LFE0-.L.VG_(ppc64_linux_REDIR_FOR_strcmp)
+ .type VG_(ppc64_linux_REDIR_FOR_strcmp), @function
+
+.L.VG_(ppc64_linux_REDIR_FOR_strcmp):
+#endif
+#if _CALL_ELF == 2
+0: addis 2,12,.TOC.-0b@ha
+ addi 2,2,.TOC.-0b@l
+ .localentry VG_(ppc64_linux_REDIR_FOR_strcmp), .-VG_(ppc64_linux_REDIR_FOR_strcmp)
+#endif
+.LFB0:
+ .cfi_startproc
+ li 10,0
+.L3:
+ lbzx 8,3,10
+ lbzx 9,4,10
+ cmpwi 0,8,0
+ beq 0,.L2
+ cmpw 0,8,9
+ addi 10,10,1
+ beq 0,.L3
+.L2:
+ subf 3,9,8
+ extsw 3,3
+ blr
+ .long 0
+ .byte 0,0,0,0,0,0,0,0
+ .cfi_endproc
+.LFE0:
+
.global VG_(trampoline_stuff_end)
VG_(trampoline_stuff_end):
diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c
index 5da88cac7c..4f1c287cc1 100644
--- a/coregrind/m_translate.c
+++ b/coregrind/m_translate.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c
index cb6c5ad52e..2ed62e0050 100644
--- a/coregrind/m_transtab.c
+++ b/coregrind/m_transtab.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_ume/elf.c b/coregrind/m_ume/elf.c
index 5f2ac1fedb..20e0185cb4 100644
--- a/coregrind/m_ume/elf.c
+++ b/coregrind/m_ume/elf.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_ume/macho.c b/coregrind/m_ume/macho.c
index 6d65574e44..ec7257084e 100644
--- a/coregrind/m_ume/macho.c
+++ b/coregrind/m_ume/macho.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_ume/main.c b/coregrind/m_ume/main.c
index 229867e268..bca641eb25 100644
--- a/coregrind/m_ume/main.c
+++ b/coregrind/m_ume/main.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -42,6 +42,7 @@
#include "priv_ume.h"
+typedef Int (*load_function)( Int fd, const HChar *name, ExeInfo *info );
typedef struct {
Bool (*match_fn)(const void *hdr, SizeT len);
@@ -56,7 +57,7 @@ static ExeHandler exe_handlers[] = {
# else
# error "unknown OS"
# endif
- { VG_(match_script), VG_(load_script) },
+ { VG_(match_script), (load_function)VG_(load_script) },
};
#define EXE_HANDLER_COUNT (sizeof(exe_handlers)/sizeof(exe_handlers[0]))
diff --git a/coregrind/m_ume/priv_ume.h b/coregrind/m_ume/priv_ume.h
index 489fc75229..64b01467f0 100644
--- a/coregrind/m_ume/priv_ume.h
+++ b/coregrind/m_ume/priv_ume.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -45,7 +45,7 @@ extern Int VG_(load_macho) ( Int fd, const HChar *name, ExeInfo *info );
#endif
extern Bool VG_(match_script) ( const void *hdr, SizeT len );
-extern Int VG_(load_script) ( Int fd, const HChar *name, ExeInfo *info );
+extern Int VG_(load_script) ( Int fd, HChar *name, ExeInfo *info );
#endif // __PRIV_UME_H
diff --git a/coregrind/m_ume/script.c b/coregrind/m_ume/script.c
index 82d2477d3f..dfeb16a9e1 100644
--- a/coregrind/m_ume/script.c
+++ b/coregrind/m_ume/script.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -67,7 +67,7 @@ Bool VG_(match_script)(const void *hdr, SizeT len)
/* returns: 0 = success, non-0 is failure */
-Int VG_(load_script)(Int fd, const HChar* name, ExeInfo* info)
+Int VG_(load_script)(Int fd, HChar* name, ExeInfo* info)
{
HChar hdr[4096];
Int len = sizeof hdr;
@@ -124,7 +124,15 @@ Int VG_(load_script)(Int fd, const HChar* name, ExeInfo* info)
if (info->argv && info->argv[0] != NULL)
info->argv[0] = name;
- VG_(args_the_exename) = name;
+ vg_assert(VG_(args_the_exename));
+ if (name) {
+ if (name != VG_(args_the_exename)) {
+ VG_(free)((void*)VG_(args_the_exename));
+ VG_(args_the_exename) = VG_(strdup)("ume.ls.3", name);
+ }
+ } else {
+ VG_(args_the_exename) = name;
+ }
if (0)
VG_(printf)("#! script: interp_name=\"%s\" interp_args=\"%s\"\n",
diff --git a/coregrind/m_vki.c b/coregrind/m_vki.c
index 0cc1882a1d..d10c312955 100644
--- a/coregrind/m_vki.c
+++ b/coregrind/m_vki.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_vkiscnums.c b/coregrind/m_vkiscnums.c
index 76ae104afd..83bc622abf 100644
--- a/coregrind/m_vkiscnums.c
+++ b/coregrind/m_vkiscnums.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_wordfm.c b/coregrind/m_wordfm.c
index 07fdec9087..945297a42a 100644
--- a/coregrind/m_wordfm.c
+++ b/coregrind/m_wordfm.c
@@ -33,7 +33,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_xarray.c b/coregrind/m_xarray.c
index d9baab30ad..1b07039e3f 100644
--- a/coregrind/m_xarray.c
+++ b/coregrind/m_xarray.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_xtmemory.c b/coregrind/m_xtmemory.c
index ef68ae9d75..a6e6ceb6aa 100644
--- a/coregrind/m_xtmemory.c
+++ b/coregrind/m_xtmemory.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/m_xtree.c b/coregrind/m_xtree.c
index 16635ebb62..e20e7e9038 100644
--- a/coregrind/m_xtree.c
+++ b/coregrind/m_xtree.c
@@ -20,7 +20,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_addrinfo.h b/coregrind/pub_core_addrinfo.h
index 392c2d5bba..bb6cfb4952 100644
--- a/coregrind/pub_core_addrinfo.h
+++ b/coregrind/pub_core_addrinfo.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_aspacehl.h b/coregrind/pub_core_aspacehl.h
index db7c9fc757..9a41851580 100644
--- a/coregrind/pub_core_aspacehl.h
+++ b/coregrind/pub_core_aspacehl.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_aspacemgr.h b/coregrind/pub_core_aspacemgr.h
index b867108a22..070fa54951 100644
--- a/coregrind/pub_core_aspacemgr.h
+++ b/coregrind/pub_core_aspacemgr.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -340,7 +340,7 @@ extern Bool VG_(am_relocate_nooverlap_client)( /*OUT*/Bool* need_discard,
#else
# define VG_STACK_GUARD_SZB 8192 // 2 pages
#endif
-# define VG_DEFAULT_STACK_ACTIVE_SZB 1048576 // (4096 * 256) = 1Mb
+# define VG_DEFAULT_STACK_ACTIVE_SZB 1048576 // (4096 * 256) = 1Mb
typedef struct _VgStack VgStack;
diff --git a/coregrind/pub_core_basics.h b/coregrind/pub_core_basics.h
index 353e69ce84..a464643190 100644
--- a/coregrind/pub_core_basics.h
+++ b/coregrind/pub_core_basics.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_basics_asm.h b/coregrind/pub_core_basics_asm.h
index 405416fb13..511382a8c4 100644
--- a/coregrind/pub_core_basics_asm.h
+++ b/coregrind/pub_core_basics_asm.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_clientstate.h b/coregrind/pub_core_clientstate.h
index 06d0fe343b..573de81cee 100644
--- a/coregrind/pub_core_clientstate.h
+++ b/coregrind/pub_core_clientstate.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_clreq.h b/coregrind/pub_core_clreq.h
index 23b402a092..e2c83a1f1d 100644
--- a/coregrind/pub_core_clreq.h
+++ b/coregrind/pub_core_clreq.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_commandline.h b/coregrind/pub_core_commandline.h
index 1af0bbdba4..0daf7127f6 100644
--- a/coregrind/pub_core_commandline.h
+++ b/coregrind/pub_core_commandline.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_coredump.h b/coregrind/pub_core_coredump.h
index b302c1755d..316f949372 100644
--- a/coregrind/pub_core_coredump.h
+++ b/coregrind/pub_core_coredump.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_cpuid.h b/coregrind/pub_core_cpuid.h
index 794b9a9884..4a01d1a285 100644
--- a/coregrind/pub_core_cpuid.h
+++ b/coregrind/pub_core_cpuid.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_debuginfo.h b/coregrind/pub_core_debuginfo.h
index 08579e6f06..ad484c4c27 100644
--- a/coregrind/pub_core_debuginfo.h
+++ b/coregrind/pub_core_debuginfo.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_debuglog.h b/coregrind/pub_core_debuglog.h
index 17547216af..cd6dc9aa59 100644
--- a/coregrind/pub_core_debuglog.h
+++ b/coregrind/pub_core_debuglog.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_deduppoolalloc.h b/coregrind/pub_core_deduppoolalloc.h
index dde76bf594..3b3e31b30d 100644
--- a/coregrind/pub_core_deduppoolalloc.h
+++ b/coregrind/pub_core_deduppoolalloc.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_demangle.h b/coregrind/pub_core_demangle.h
index 1532251b21..29dc301c7e 100644
--- a/coregrind/pub_core_demangle.h
+++ b/coregrind/pub_core_demangle.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_dispatch.h b/coregrind/pub_core_dispatch.h
index 3ad66fceea..368f2bc578 100644
--- a/coregrind/pub_core_dispatch.h
+++ b/coregrind/pub_core_dispatch.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_dispatch_asm.h b/coregrind/pub_core_dispatch_asm.h
index db19f03708..ac63bc3243 100644
--- a/coregrind/pub_core_dispatch_asm.h
+++ b/coregrind/pub_core_dispatch_asm.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_errormgr.h b/coregrind/pub_core_errormgr.h
index d4bf2e7a8a..94e993e7a1 100644
--- a/coregrind/pub_core_errormgr.h
+++ b/coregrind/pub_core_errormgr.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_execontext.h b/coregrind/pub_core_execontext.h
index 7fe8575fe1..352d69d771 100644
--- a/coregrind/pub_core_execontext.h
+++ b/coregrind/pub_core_execontext.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_extension.h b/coregrind/pub_core_extension.h
index 39fa4dd8bc..80ad7941e4 100644
--- a/coregrind/pub_core_extension.h
+++ b/coregrind/pub_core_extension.h
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_gdbserver.h b/coregrind/pub_core_gdbserver.h
index 844337f9d9..b7eb1b0822 100644
--- a/coregrind/pub_core_gdbserver.h
+++ b/coregrind/pub_core_gdbserver.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_guest.h b/coregrind/pub_core_guest.h
index 0da9bc4b01..da035edac4 100644
--- a/coregrind/pub_core_guest.h
+++ b/coregrind/pub_core_guest.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_hashtable.h b/coregrind/pub_core_hashtable.h
index 5125389569..5bb81831cd 100644
--- a/coregrind/pub_core_hashtable.h
+++ b/coregrind/pub_core_hashtable.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_initimg.h b/coregrind/pub_core_initimg.h
index cfbd41f8b8..40ef71d049 100644
--- a/coregrind/pub_core_initimg.h
+++ b/coregrind/pub_core_initimg.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_inner.h b/coregrind/pub_core_inner.h
index 6632f58f35..4120712b95 100644
--- a/coregrind/pub_core_inner.h
+++ b/coregrind/pub_core_inner.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_libcassert.h b/coregrind/pub_core_libcassert.h
index 619c570acd..cc9d5a9fdd 100644
--- a/coregrind/pub_core_libcassert.h
+++ b/coregrind/pub_core_libcassert.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_libcbase.h b/coregrind/pub_core_libcbase.h
index fdeada4710..53b665c90a 100644
--- a/coregrind/pub_core_libcbase.h
+++ b/coregrind/pub_core_libcbase.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_libcfile.h b/coregrind/pub_core_libcfile.h
index dc243bf7fe..ac585986d7 100644
--- a/coregrind/pub_core_libcfile.h
+++ b/coregrind/pub_core_libcfile.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -110,9 +110,8 @@ extern Int VG_(mkstemp) ( const HChar* part_of_name, /*OUT*/HChar* fullname );
return if the working directory couldn't be found. */
extern void VG_(record_startup_wd) ( void );
-#if defined(VGO_freebsd)
+/* Resolves a path to a canonical absolute path */
extern Bool VG_(realpath)(const HChar *path, HChar *resolved);
-#endif
#endif // __PUB_CORE_LIBCFILE_H
diff --git a/coregrind/pub_core_libcprint.h b/coregrind/pub_core_libcprint.h
index 7d5c0d416f..e21a2ac408 100644
--- a/coregrind/pub_core_libcprint.h
+++ b/coregrind/pub_core_libcprint.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_libcproc.h b/coregrind/pub_core_libcproc.h
index 488aaf0caf..9391898afe 100644
--- a/coregrind/pub_core_libcproc.h
+++ b/coregrind/pub_core_libcproc.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_libcsetjmp.h b/coregrind/pub_core_libcsetjmp.h
index ed8e323ba3..bf04fb8abb 100644
--- a/coregrind/pub_core_libcsetjmp.h
+++ b/coregrind/pub_core_libcsetjmp.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_libcsignal.h b/coregrind/pub_core_libcsignal.h
index 312bae2f5d..394effb479 100644
--- a/coregrind/pub_core_libcsignal.h
+++ b/coregrind/pub_core_libcsignal.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_mach.h b/coregrind/pub_core_mach.h
index d85ab6854c..8ab46417a2 100644
--- a/coregrind/pub_core_mach.h
+++ b/coregrind/pub_core_mach.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_machine.h b/coregrind/pub_core_machine.h
index 555506a03b..b9f2d01028 100644
--- a/coregrind/pub_core_machine.h
+++ b/coregrind/pub_core_machine.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_mallocfree.h b/coregrind/pub_core_mallocfree.h
index df9648cea4..6276fda3a2 100644
--- a/coregrind/pub_core_mallocfree.h
+++ b/coregrind/pub_core_mallocfree.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -91,6 +91,7 @@ typedef Int ArenaId;
# error Unknown platform
#endif
+#if defined(VGO_linux)
/* This struct definition MUST match the system one. */
/* SVID2/XPG mallinfo structure */
struct vg_mallinfo {
@@ -106,6 +107,37 @@ struct vg_mallinfo {
int keepcost; /* top-most, releasable (via malloc_trim) space */
};
+/* This struct definition MUST match the system one. */
+/* SVID2/XPG mallinfo structure */
+struct vg_mallinfo2 {
+ SizeT arena; /* total space allocated from system */
+ SizeT ordblks; /* number of non-inuse chunks */
+ SizeT smblks; /* unused -- always zero */
+ SizeT hblks; /* number of mmapped regions */
+ SizeT hblkhd; /* total space in mmapped regions */
+ SizeT usmblks; /* unused -- always zero */
+ SizeT fsmblks; /* unused -- always zero */
+ SizeT uordblks; /* total allocated space */
+ SizeT fordblks; /* total non-inuse space */
+ SizeT keepcost; /* top-most, releasable (via malloc_trim) space */
+};
+#elif defined(VGO_solaris)
+
+struct vg_mallinfo {
+ unsigned long arena; /* total space in arena */
+ unsigned long ordblks; /* number of ordinary blocks */
+ unsigned long smblks; /* number of small blocks */
+ unsigned long hblks; /* number of holding blocks */
+ unsigned long hblkhd; /* space in holding block headers */
+ unsigned long usmblks; /* space in small blocks in use */
+ unsigned long fsmblks; /* space in free small blocks */
+ unsigned long uordblks; /* space in ordinary blocks in use */
+ unsigned long fordblks; /* space in free ordinary blocks */
+ unsigned long keepcost; /* cost of enabling keep option */
+};
+
+#endif
+
extern void* VG_(arena_malloc) ( ArenaId arena, const HChar* cc, SizeT nbytes );
extern void VG_(arena_free) ( ArenaId arena, void* ptr );
extern void* VG_(arena_calloc) ( ArenaId arena, const HChar* cc,
@@ -131,7 +163,12 @@ extern SizeT VG_(arena_malloc_usable_size) ( ArenaId aid, void* payload );
extern SizeT VG_(arena_redzone_size) ( ArenaId aid );
+#if defined(VGO_linux) || defined(VGO_solaris)
extern void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi );
+#endif
+#if defined(VGO_linux)
+extern void VG_(mallinfo2) ( ThreadId tid, struct vg_mallinfo2* mi );
+#endif
// VG_(arena_perm_malloc) is for permanent allocation of small blocks.
// See VG_(perm_malloc) in pub_tool_mallocfree.h for more details.
diff --git a/coregrind/pub_core_options.h b/coregrind/pub_core_options.h
index d8bc4736d8..6462ae90c8 100644
--- a/coregrind/pub_core_options.h
+++ b/coregrind/pub_core_options.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_oset.h b/coregrind/pub_core_oset.h
index 858c78dc57..8a5824f025 100644
--- a/coregrind/pub_core_oset.h
+++ b/coregrind/pub_core_oset.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_pathscan.h b/coregrind/pub_core_pathscan.h
index d84953ab21..0c4aa513cd 100644
--- a/coregrind/pub_core_pathscan.h
+++ b/coregrind/pub_core_pathscan.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -34,4 +34,6 @@
extern const HChar* VG_(find_executable) ( const HChar* exec );
-#endif // ndef __PUB_CORE_PATHSCAN_H
+extern Bool VG_(try_get_interp)(const HChar* args_exe, HChar* interp_out, SizeT max_interp_len);
+
+#endif // __PUB_CORE_PATHSCAN_H
diff --git a/coregrind/pub_core_poolalloc.h b/coregrind/pub_core_poolalloc.h
index 25bb5ad7b1..f67e3debe1 100644
--- a/coregrind/pub_core_poolalloc.h
+++ b/coregrind/pub_core_poolalloc.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_rangemap.h b/coregrind/pub_core_rangemap.h
index f680816ee8..463dfa82f5 100644
--- a/coregrind/pub_core_rangemap.h
+++ b/coregrind/pub_core_rangemap.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_redir.h b/coregrind/pub_core_redir.h
index 0cf0b009ea..2ffcd21fff 100644
--- a/coregrind/pub_core_redir.h
+++ b/coregrind/pub_core_redir.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_replacemalloc.h b/coregrind/pub_core_replacemalloc.h
index f26884c4fd..cd4969b488 100644
--- a/coregrind/pub_core_replacemalloc.h
+++ b/coregrind/pub_core_replacemalloc.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -53,7 +53,12 @@ struct vg_mallocfunc_info {
void (*tl___builtin_vec_delete_aligned)(ThreadId tid, void* p, SizeT n);
void* (*tl_realloc) (ThreadId tid, void* p, SizeT size);
SizeT (*tl_malloc_usable_size) (ThreadId tid, void* payload);
+#if defined(VGO_linux) || defined(VGO_solaris)
void (*mallinfo) (ThreadId tid, struct vg_mallinfo* mi);
+#endif
+#if defined(VGO_linux)
+ void (*mallinfo2) (ThreadId tid, struct vg_mallinfo2* mi);
+#endif
Bool clo_trace_malloc;
Bool clo_realloc_zero_bytes_frees;
};
diff --git a/coregrind/pub_core_sbprofile.h b/coregrind/pub_core_sbprofile.h
index 387da6b303..b7579c3cc7 100644
--- a/coregrind/pub_core_sbprofile.h
+++ b/coregrind/pub_core_sbprofile.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_scheduler.h b/coregrind/pub_core_scheduler.h
index d74eb06297..ed234f676f 100644
--- a/coregrind/pub_core_scheduler.h
+++ b/coregrind/pub_core_scheduler.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_seqmatch.h b/coregrind/pub_core_seqmatch.h
index 1ededd28c3..9d9059da3a 100644
--- a/coregrind/pub_core_seqmatch.h
+++ b/coregrind/pub_core_seqmatch.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_sigframe.h b/coregrind/pub_core_sigframe.h
index 1b8caeb69b..5680eee2ac 100644
--- a/coregrind/pub_core_sigframe.h
+++ b/coregrind/pub_core_sigframe.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_signals.h b/coregrind/pub_core_signals.h
index ae8555ba80..a27240490b 100644
--- a/coregrind/pub_core_signals.h
+++ b/coregrind/pub_core_signals.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_sparsewa.h b/coregrind/pub_core_sparsewa.h
index 1a230ce288..2cdc0b1ec7 100644
--- a/coregrind/pub_core_sparsewa.h
+++ b/coregrind/pub_core_sparsewa.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_stacks.h b/coregrind/pub_core_stacks.h
index ec1bc51e90..a360a16a70 100644
--- a/coregrind/pub_core_stacks.h
+++ b/coregrind/pub_core_stacks.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_stacktrace.h b/coregrind/pub_core_stacktrace.h
index 436702e4df..203e1c44b4 100644
--- a/coregrind/pub_core_stacktrace.h
+++ b/coregrind/pub_core_stacktrace.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_syscall.h b/coregrind/pub_core_syscall.h
index e1e066fccf..f8a5c3a418 100644
--- a/coregrind/pub_core_syscall.h
+++ b/coregrind/pub_core_syscall.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_syswrap.h b/coregrind/pub_core_syswrap.h
index d30dc90cf3..0b6fa5d74b 100644
--- a/coregrind/pub_core_syswrap.h
+++ b/coregrind/pub_core_syswrap.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_threadstate.h b/coregrind/pub_core_threadstate.h
index ae7cf6312b..e4b2c3938d 100644
--- a/coregrind/pub_core_threadstate.h
+++ b/coregrind/pub_core_threadstate.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h
index 492c06818f..069e603605 100644
--- a/coregrind/pub_core_tooliface.h
+++ b/coregrind/pub_core_tooliface.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h
index 11d791df7c..2ca144211b 100644
--- a/coregrind/pub_core_trampoline.h
+++ b/coregrind/pub_core_trampoline.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -97,6 +97,7 @@ extern void* VG_(ppc32_linux_REDIR_FOR_strchr)( void*, Int );
#if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
extern Addr VG_(ppc64_linux_SUBST_FOR_rt_sigreturn);
extern UInt VG_(ppc64_linux_REDIR_FOR_strlen)( void* );
+extern UInt VG_(ppc64_linux_REDIR_FOR_strcmp)( void*, void* );
extern void* VG_(ppc64_linux_REDIR_FOR_strchr)( void*, Int );
/* A label (sans dot) marking the ultra-magical return stub via which
all redirected and wrapped functions are made to "return" on
diff --git a/coregrind/pub_core_translate.h b/coregrind/pub_core_translate.h
index 6242a84b1d..d66ec423fc 100644
--- a/coregrind/pub_core_translate.h
+++ b/coregrind/pub_core_translate.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_transtab.h b/coregrind/pub_core_transtab.h
index cc70a29449..f151df988e 100644
--- a/coregrind/pub_core_transtab.h
+++ b/coregrind/pub_core_transtab.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_transtab_asm.h b/coregrind/pub_core_transtab_asm.h
index c14e24ebf0..19f57272d0 100644
--- a/coregrind/pub_core_transtab_asm.h
+++ b/coregrind/pub_core_transtab_asm.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_ume.h b/coregrind/pub_core_ume.h
index d6230fff77..45626ebdd9 100644
--- a/coregrind/pub_core_ume.h
+++ b/coregrind/pub_core_ume.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_vki.h b/coregrind/pub_core_vki.h
index 23ea92b7e1..db85ffb3b3 100644
--- a/coregrind/pub_core_vki.h
+++ b/coregrind/pub_core_vki.h
@@ -17,7 +17,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_vkiscnums.h b/coregrind/pub_core_vkiscnums.h
index ff94c626a4..9e1de3787e 100644
--- a/coregrind/pub_core_vkiscnums.h
+++ b/coregrind/pub_core_vkiscnums.h
@@ -16,7 +16,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_vkiscnums_asm.h b/coregrind/pub_core_vkiscnums_asm.h
index a4e162cdd6..830560d0c4 100644
--- a/coregrind/pub_core_vkiscnums_asm.h
+++ b/coregrind/pub_core_vkiscnums_asm.h
@@ -16,7 +16,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_wordfm.h b/coregrind/pub_core_wordfm.h
index f51dfabd93..c09ee2ad77 100644
--- a/coregrind/pub_core_wordfm.h
+++ b/coregrind/pub_core_wordfm.h
@@ -33,7 +33,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_xarray.h b/coregrind/pub_core_xarray.h
index 5069e0e88c..9b714b8b20 100644
--- a/coregrind/pub_core_xarray.h
+++ b/coregrind/pub_core_xarray.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_xtmemory.h b/coregrind/pub_core_xtmemory.h
index f389ed8bd3..7861c42ab8 100644
--- a/coregrind/pub_core_xtmemory.h
+++ b/coregrind/pub_core_xtmemory.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/pub_core_xtree.h b/coregrind/pub_core_xtree.h
index 27b234efb2..8b1c314e26 100644
--- a/coregrind/pub_core_xtree.h
+++ b/coregrind/pub_core_xtree.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c
index 5bec51d760..0b77e0537f 100644
--- a/coregrind/vg_preloaded.c
+++ b/coregrind/vg_preloaded.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -55,7 +55,7 @@
/* Note: The "MS" section flags are to remove duplicates. */
#define DEFINE_GDB_PY_SCRIPT(script_name) \
asm("\
-.pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n\
+.pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n\
.byte 1 /* Python */\n\
.asciz \"" script_name "\"\n\
.popsection \n\
diff --git a/coregrind/vgdb-invoker-freebsd.c b/coregrind/vgdb-invoker-freebsd.c
index df34e0a151..ec42ab23ad 100644
--- a/coregrind/vgdb-invoker-freebsd.c
+++ b/coregrind/vgdb-invoker-freebsd.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -260,7 +260,7 @@ Bool waitstopped (pid_t pid, int signal_expected, const char *msg)
ERROR(errno, "PT_LWPINFO failed: signal lost !!!!\n");
signal_queue_sz--;
} else {
- DEBUG(1, "waitstopped PTRACE_CONT, queuing signal %d"
+ DEBUG(1, "waitstopped PTRACE_CONTINUE, queuing signal %d"
" si_signo %d si_pid %d\n",
signal_received, newsiginfo->si_signo, newsiginfo->si_pid);
}
@@ -270,7 +270,7 @@ Bool waitstopped (pid_t pid, int signal_expected, const char *msg)
res = ptrace (PT_CONTINUE, pid, (caddr_t)1, signal_received);
}
if (res != 0) {
- ERROR(errno, "waitstopped PTRACE_CONT\n");
+ ERROR(errno, "waitstopped PTRACE_CONTINUE\n");
return False;
}
}
@@ -392,7 +392,7 @@ void restore_and_detach (pid_t pid)
if (signal_queue_sz > 0) {
int i;
for (i = 0; i < signal_queue_sz; i++) {
- DEBUG(1, "PTRACE_CONT to transmit queued signal %d\n",
+ DEBUG(1, "PTRACE_CONTINUE to transmit queued signal %d\n",
signal_queue[i].si_signo);
res = ptrace (PT_CONTINUE, pid_of_save_regs, (caddr_t)1,
signal_queue[i].si_signo);
@@ -561,6 +561,7 @@ Bool invoker_invoke_gdbserver (pid_t pid)
reg_mod.r_rip = shared64->invoke_gdbserver;
#elif defined(VGA_arm64)
reg_mod.x[0] = check;
+ sp &= ~0xf; // keep the stack aligned on 16 bytes ...
reg_mod.sp = sp;
reg_mod.elr = shared64->invoke_gdbserver;
/* put NULL return address in Link Register */
@@ -590,7 +591,7 @@ Bool invoker_invoke_gdbserver (pid_t pid)
pid_of_save_regs_continued = False;
- /* We PTRACE_CONT-inue pid.
+ /* We PTRACE_CONTINUE pid.
Either gdbserver will be invoked directly (if all
threads are interruptible) or gdbserver will be
called soon by the scheduler. In the first case,
@@ -609,7 +610,7 @@ Bool invoker_invoke_gdbserver (pid_t pid)
pid_of_save_regs_continued = True;
/* Wait for SIGSTOP generated by m_gdbserver.c give_control_back_to_vgdb */
stopped = waitstopped (pid, SIGSTOP,
- "waitpid status after PTRACE_CONT to invoke");
+ "waitpid status after PTRACE_CONTINUE to invoke");
if (stopped) {
/* Here pid has properly stopped on the break. */
pid_of_save_regs_continued = False;
diff --git a/coregrind/vgdb-invoker-none.c b/coregrind/vgdb-invoker-none.c
index 561638df90..5ae5e22fdf 100644
--- a/coregrind/vgdb-invoker-none.c
+++ b/coregrind/vgdb-invoker-none.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/vgdb-invoker-ptrace.c b/coregrind/vgdb-invoker-ptrace.c
index 3a6a455d03..d463553cef 100644
--- a/coregrind/vgdb-invoker-ptrace.c
+++ b/coregrind/vgdb-invoker-ptrace.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -271,10 +271,10 @@ Bool waitstopped (pid_t pid, int signal_expected, const char *msg)
msg, signal_expected);
p = waitpid(pid, &status, __WALL);
DEBUG(1, "after waitpid pid %d p %d status 0x%x %s\n", pid, p,
- status, status_image (status));
+ (unsigned)status, status_image (status));
if (p != pid) {
ERROR(errno, "%s waitpid pid %d in waitstopped %d status 0x%x %s\n",
- msg, pid, p, status, status_image (status));
+ msg, pid, p, (unsigned)status, status_image (status));
return False;
}
@@ -867,7 +867,7 @@ Bool invoker_invoke_gdbserver (pid_t pid)
web search '[patch] Fix syscall restarts for amd64->i386 biarch'
e.g. http://sourceware.org/ml/gdb-patches/2009-11/msg00592.html */
*(long *)&user_save.regs.rax = *(int*)&user_save.regs.rax;
- DEBUG(1, "Sign extending %8.8lx to %8.8lx\n",
+ DEBUG(1, "Sign extending %8.8llx to %8.8llx\n",
user_mod.regs.rax, user_save.regs.rax);
}
#elif defined(VGA_arm)
diff --git a/coregrind/vgdb-invoker-solaris.c b/coregrind/vgdb-invoker-solaris.c
index ac95bdb85c..f333767996 100644
--- a/coregrind/vgdb-invoker-solaris.c
+++ b/coregrind/vgdb-invoker-solaris.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c
index 409ceac5d6..8cf524a4f8 100644
--- a/coregrind/vgdb.c
+++ b/coregrind/vgdb.c
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -732,7 +732,7 @@ getpkt(char *buf, int fromfd, int ackfd)
break;
TSFPRINTF(stderr, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n",
- (c1 << 4) + c2, csum, buf);
+ (unsigned)((c1 << 4) + c2), (unsigned)csum, buf);
ssize_t res = 0;
while (res == 0) {
res = write(ackfd, "-", 1);
@@ -1080,7 +1080,7 @@ static ssize_t receive_packet(char *buf, int noackmode)
if (!(csum == (c1 << 4) + c2)) {
TSFPRINTF(stderr, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n",
- (c1 << 4) + c2, csum, buf);
+ (unsigned)((c1 << 4) + c2), (unsigned)csum, buf);
if (!noackmode)
if (!write_to_gdb ("-", 1))
return -1;
@@ -1418,6 +1418,7 @@ void do_multi_mode(int check_trials, int in_port)
#define QENVIRONMENTUNSET "QEnvironmentUnset"
#define QSETWORKINGDIR "QSetWorkingDir"
#define QTSTATUS "qTStatus"
+#define QEXECANDARGS "qExecAndArgs"
if (strncmp(QSUPPORTED, buf, strlen(QSUPPORTED)) == 0) {
DEBUG(1, "CASE %s\n", QSUPPORTED);
@@ -1669,6 +1670,10 @@ void do_multi_mode(int check_trials, int in_port)
DEBUG(1, "Got qfThreadInfo\n");
/* There are no threads yet, reply 'l' end of list. */
send_packet ("l", noackmode);
+ } else if (strcmp(QEXECANDARGS, buf) == 0) {
+ DEBUG(1, "Got qExecAndArgs\n");
+ /* We don't have any. */
+ send_packet ("U", noackmode);
} else if (buf[0] != '\0') {
// We didn't understand.
DEBUG(1, "Unknown packet received: '%s'\n", buf);
@@ -2072,7 +2077,11 @@ void usage(void)
" gdbserver has not processed a command after number seconds\n"
" --multi start in extended-remote mode, wait for gdb to tell us what to run\n"
" --valgrind, pass the path to valgrind to use. If not specified, the system valgrind will be launched.\n"
-" --vargs everything that follows is an argument for valgrind.\n"
+" --vargs Additional valgrind tool options (must be used with --multi).\n"
+" Everything following --vargs is passed to valgrind as tool options\n"
+" (like -q, --leak-check=full, --tool=helgrind, etc.). The program\n"
+" executable and its arguments are specified separately by GDB and\n"
+" should NOT be included here.\n"
" -l arg tells to show the list of running Valgrind gdbserver and then exit.\n"
" -T arg tells to add timestamps to vgdb information messages.\n"
" -D arg tells to show shared mem status and then exit.\n"
diff --git a/coregrind/vgdb.h b/coregrind/vgdb.h
index 03553296ba..2a0d4a8451 100644
--- a/coregrind/vgdb.h
+++ b/coregrind/vgdb.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/coregrind/vgstack.in b/coregrind/vgstack.in
new file mode 100644
index 0000000000..75ed868e96
--- /dev/null
+++ b/coregrind/vgstack.in
@@ -0,0 +1,158 @@
+#!/bin/sh
+
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
+# Copyright (C) 2025 Paul Floyd
+# pjfloyd@wanadoo.fr
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+# Print a stack trace of a running process.
+# Similar to the gcore command, but instead of creating a core file,
+# we simply have gdb print out the stack backtrace to the terminal.
+
+# This script is largely based on gstack/pstack from gdb.
+# There is a bit of extra filtering to remove gdb warnings,
+# the shell used is /bin/sh rather than bash.
+# The main functional change is that it 'uses target remote | vgdb'
+# instead of 'attach'.
+
+GDB=${GDB:-$(command -v gdb)}
+GDBARGS=${GDBARGS:-}
+AWK=${AWK:-}
+VERSION="@VERSION@"
+
+# Find an appropriate awk interpreter if one was not specified
+# via the environment.
+awk_prog=""
+if [ -z "$AWK" ]; then
+ for prog in gawk mawk nawk awk; do
+ awk_prog=$(command -v $prog)
+ test -n "$awk_prog" && break
+ done
+ AWK="$awk_prog"
+fi
+if [ ! -x "$AWK" ]; then
+ echo "$0: could not find usable awk interpreter" 1>&2
+ exit 2
+fi
+
+print_usage() {
+ echo "Usage: $0 [-h|--help] [-v|--version] PID"
+}
+
+print_try_help() {
+ echo "Try '$0 --help' for more information."
+}
+
+print_help() {
+ print_usage
+ echo "Print a stack trace of a running program"
+ echo
+ echo " -h, --help Print this message then exit."
+ echo " -v, --version Print version information then exit."
+}
+
+print_version() {
+ echo "${0}-${VERSION}"
+}
+
+# Parse options.
+while getopts hv-: OPT; do
+ if [ "$OPT" = "-" ]; then
+ OPT="${OPTARG%%=*}"
+ OPTARG="${OPTARG#'$OPT'}"
+ OPTARG="${OPTARG#=}"
+ fi
+
+ case "$OPT" in
+ h | help)
+ print_help
+ exit 0
+ ;;
+ v | version)
+ print_version
+ exit 0
+ ;;
+ \?)
+ # getopts has already output an error message.
+ print_try_help 1>&2
+ exit 2 ;;
+ *)
+ echo "$0: unrecognized option '--$OPT'" 1>&2
+ print_try_help 1>&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+# The sole remaining argument should be the PID of the process
+# whose backtrace is desired.
+if [ $# -ne 1 ]; then
+ print_usage 1>&2
+ exit 1
+fi
+
+PID=$1
+
+awk_script=$(cat << EOF
+BEGIN {
+ first=1
+ attach_okay=0
+}
+
+/ATTACHED/ {
+ attach_okay=1
+}
+
+/^#/ {
+ if (attach_okay) {
+ print \$0
+ }
+}
+
+/^Thread/ {
+ if (attach_okay) {
+ if (first == 0)
+ print ""
+ first=0
+ print \$0
+ }
+}
+
+/warning:/ {
+ next
+}
+
+END {
+if (attach_okay == 0)
+ exit 2
+}
+EOF
+ )
+
+# Run GDB and remove some unwanted noise.
+"$GDB" --quiet -nx $GDBARGS <&1 |
+set width 0
+set height 0
+set pagination no
+set debuginfod enabled off
+define vgdb-bt
+target remote | vgdb --pid=\$arg0
+echo "ATTACHED"
+thread apply all bt
+end
+vgdb-bt $PID
+EOF
+$AWK -- "$awk_script"
diff --git a/darwin11.supp b/darwin11.supp
index f2fd6f58a3..7f87399763 100644
--- a/darwin11.supp
+++ b/darwin11.supp
@@ -72,7 +72,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
################
diff --git a/darwin12.supp b/darwin12.supp
index d83982498c..c3f47c15b9 100644
--- a/darwin12.supp
+++ b/darwin12.supp
@@ -357,7 +357,6 @@
fun:malloc_zone_?alloc
...
fun:dyld_register_image_state_change_handler
- ...
}
{
@@ -367,7 +366,6 @@
fun:?alloc
...
fun:dyld_register_image_state_change_handler
- ...
}
{
@@ -378,7 +376,6 @@
...
fun:map_images_nolock
fun:map_images
- ...
}
{
@@ -389,7 +386,6 @@
...
fun:map_images_nolock
fun:map_images
- ...
}
{
@@ -399,7 +395,6 @@
fun:malloc_zone_?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -409,7 +404,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -419,7 +413,6 @@
fun:malloc_zone_?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -429,7 +422,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -439,7 +431,6 @@
fun:?alloc
...
fun:_libxpc_initializer
- ...
}
{
@@ -449,7 +440,6 @@
fun:malloc
fun:realloc
fun:new_sem_from_pool
- ...
}
##----------------------------------------------------------------------##
diff --git a/darwin13.supp b/darwin13.supp
index 6ef99e91c7..41478738f7 100644
--- a/darwin13.supp
+++ b/darwin13.supp
@@ -31,7 +31,6 @@
fun:_objc_init
fun:_os_object_init
fun:libSystem_initializer
- ...
}
{
@@ -41,7 +40,6 @@
fun:malloc_zone_?alloc
...
fun:dyld_register_image_state_change_handler
- ...
}
{
@@ -51,7 +49,6 @@
fun:?alloc
...
fun:dyld_register_image_state_change_handler
- ...
}
{
@@ -62,7 +59,6 @@
...
fun:map_images_nolock
fun:map_images
- ...
}
{
@@ -73,7 +69,6 @@
...
fun:map_images_nolock
fun:map_images
- ...
}
{
@@ -83,7 +78,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -93,7 +87,6 @@
fun:malloc_zone_?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -103,7 +96,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
{
diff --git a/darwin14.supp b/darwin14.supp
index 63fe2b4e67..8ba4e9d71e 100644
--- a/darwin14.supp
+++ b/darwin14.supp
@@ -32,7 +32,6 @@
fun:_os_object_init
fun:libdispatch_init
fun:libSystem_initializer
- ...
}
#{
@@ -52,7 +51,6 @@
fun:?alloc
...
fun:dyld_register_image_state_change_handler
- ...
}
{
@@ -63,7 +61,6 @@
...
fun:map_images_nolock
fun:map_images
- ...
}
{
@@ -74,7 +71,6 @@
...
fun:map_images_nolock
fun:map_images
- ...
}
{
@@ -84,7 +80,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -94,7 +89,6 @@
fun:malloc_zone_?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -104,7 +98,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
#{
@@ -131,7 +124,6 @@
fun:malloc_zone_memalign
...
fun:_ZN4dyld24initializeMainExecutableEv
- ...
}
{
@@ -141,7 +133,6 @@
fun:?alloc
...
fun:libSystem_atfork_child
- ...
}
{
@@ -152,7 +143,6 @@
fun:__smakebuf
...
fun:printf
- ...
}
############################################
diff --git a/darwin15.supp b/darwin15.supp
index a383d24b68..159e7f66c9 100644
--- a/darwin15.supp
+++ b/darwin15.supp
@@ -32,7 +32,6 @@
fun:_os_object_init
fun:libdispatch_init
fun:libSystem_initializer
- ...
}
{
@@ -41,7 +40,6 @@
fun:malloc_zone_?alloc
...
fun:dyld_register_image_state_change_handler
- ...
}
{
@@ -51,7 +49,6 @@
fun:?alloc
...
fun:dyld_register_image_state_change_handler
- ...
}
{
@@ -62,7 +59,6 @@
...
fun:map_images_nolock
fun:map_2_images
- ...
}
{
@@ -73,7 +69,6 @@
...
fun:map_images_nolock
fun:map_2_images
- ...
}
{
@@ -83,7 +78,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -93,7 +87,6 @@
fun:malloc_zone_?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -103,7 +96,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
#{
@@ -130,7 +122,6 @@
fun:malloc_zone_memalign
...
fun:_ZN4dyld24initializeMainExecutableEv
- ...
}
{
@@ -140,7 +131,6 @@
fun:?alloc
...
fun:libSystem_atfork_child
- ...
}
{
@@ -151,7 +141,6 @@
fun:__smakebuf
...
fun:printf
- ...
}
{
@@ -198,7 +187,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -208,7 +196,6 @@
fun:malloc_zone_memalign
...
fun:_ZN4dyld24initializeMainExecutableEv
- ...
}
diff --git a/darwin16.supp b/darwin16.supp
index 18dda6a703..ae31a97a9e 100644
--- a/darwin16.supp
+++ b/darwin16.supp
@@ -32,7 +32,6 @@
fun:_os_object_init
fun:libdispatch_init
fun:libSystem_initializer
- ...
}
{
@@ -41,7 +40,6 @@
fun:malloc_zone_?alloc
...
fun:dyld_register_image_state_change_handler
- ...
}
{
@@ -51,7 +49,6 @@
fun:?alloc
...
fun:dyld_register_image_state_change_handler
- ...
}
{
@@ -62,7 +59,6 @@
...
fun:map_images_nolock
fun:map_2_images
- ...
}
{
@@ -73,7 +69,6 @@
...
fun:map_images_nolock
fun:map_2_images
- ...
}
{
@@ -83,7 +78,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -93,7 +87,6 @@
fun:malloc_zone_?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -103,7 +96,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
#{
@@ -130,7 +122,6 @@
fun:malloc_zone_memalign
...
fun:_ZN4dyld24initializeMainExecutableEv
- ...
}
{
@@ -140,7 +131,6 @@
fun:?alloc
...
fun:libSystem_atfork_child
- ...
}
{
@@ -151,7 +141,6 @@
fun:__smakebuf
...
fun:printf
- ...
}
{
@@ -198,7 +187,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -208,7 +196,6 @@
fun:malloc_zone_memalign
...
fun:_ZN4dyld24initializeMainExecutableEv
- ...
}
@@ -529,7 +516,6 @@
Memcheck:Cond
fun:bcmp
fun:_ZN16ImageLoaderMachO18validateFirstPagesEPK21linkedit_data_commandiPKhmxRKN11ImageLoader11LinkContextE
- ...
}
{
@@ -537,7 +523,6 @@
Memcheck:Value8
fun:bcmp
fun:_ZN16ImageLoaderMachO18validateFirstPagesEPK21linkedit_data_commandiPKhmxRKN11ImageLoader11LinkContextE
- ...
}
{
diff --git a/darwin17.supp b/darwin17.supp
index e58b494222..996688654f 100644
--- a/darwin17.supp
+++ b/darwin17.supp
@@ -32,7 +32,6 @@
fun:_os_object_init
fun:libdispatch_init
fun:libSystem_initializer
- ...
}
{
@@ -41,7 +40,6 @@
fun:malloc_zone_?alloc
...
fun:dyld_register_image_state_change_handler
- ...
}
{
@@ -51,7 +49,6 @@
fun:?alloc
...
fun:dyld_register_image_state_change_handler
- ...
}
{
@@ -62,7 +59,6 @@
...
fun:map_images_nolock
fun:map_2_images
- ...
}
{
@@ -73,7 +69,6 @@
...
fun:map_images_nolock
fun:map_2_images
- ...
}
{
@@ -83,7 +78,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -93,7 +87,6 @@
fun:malloc_zone_?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -103,7 +96,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
#{
@@ -130,7 +122,6 @@
fun:malloc_zone_memalign
...
fun:_ZN4dyld24initializeMainExecutableEv
- ...
}
{
@@ -140,7 +131,6 @@
fun:?alloc
...
fun:libSystem_atfork_child
- ...
}
{
@@ -151,7 +141,6 @@
fun:__smakebuf
...
fun:printf
- ...
}
{
@@ -198,7 +187,6 @@
fun:?alloc
...
fun:libSystem_initializer
- ...
}
{
@@ -208,7 +196,6 @@
fun:malloc_zone_memalign
...
fun:_ZN4dyld24initializeMainExecutableEv
- ...
}
@@ -529,7 +516,6 @@
Memcheck:Cond
fun:bcmp
fun:_ZN16ImageLoaderMachO18validateFirstPagesEPK21linkedit_data_commandiPKhmxRKN11ImageLoader11LinkContextE
- ...
}
{
@@ -537,7 +523,6 @@
Memcheck:Value8
fun:bcmp
fun:_ZN16ImageLoaderMachO18validateFirstPagesEPK21linkedit_data_commandiPKhmxRKN11ImageLoader11LinkContextE
- ...
}
{
diff --git a/dhat/dh_main.c b/dhat/dh_main.c
index 9e6ec1c066..238d1c967f 100644
--- a/dhat/dh_main.c
+++ b/dhat/dh_main.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/dhat/dh_replace_strmem.c b/dhat/dh_replace_strmem.c
index a5099253a4..332a70bd84 100644
--- a/dhat/dh_replace_strmem.c
+++ b/dhat/dh_replace_strmem.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -21,9 +21,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
+ along with this program; if not, see .
The GNU General Public License is contained in the file COPYING.
*/
diff --git a/dhat/dh_test.js b/dhat/dh_test.js
index ee88e7b723..0f824441e2 100644
--- a/dhat/dh_test.js
+++ b/dhat/dh_test.js
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/dhat/dh_view.css b/dhat/dh_view.css
index 235fcbf4b6..34b1e15180 100644
--- a/dhat/dh_view.css
+++ b/dhat/dh_view.css
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/dhat/dh_view.js b/dhat/dh_view.js
index ffdea93033..312f307434 100644
--- a/dhat/dh_view.js
+++ b/dhat/dh_view.js
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/dhat/dhat.h b/dhat/dhat.h
index 97e1ade8fc..adf51e33bb 100644
--- a/dhat/dhat.h
+++ b/dhat/dhat.h
@@ -4,7 +4,7 @@
Notice that the following BSD-style license applies to this one
file (dhat.h) only. The rest of Valgrind is licensed under the
- terms of the GNU General Public License, version 2, unless
+ terms of the GNU General Public License, version 3, unless
otherwise indicated. See the COPYING file in the source
distribution for details.
@@ -50,7 +50,7 @@
Notice that the above BSD-style license applies to this one file
(memcheck.h) only. The entire rest of Valgrind is licensed under
- the terms of the GNU General Public License, version 2. See the
+ the terms of the GNU General Public License, version 3. See the
COPYING file in the source distribution for details.
----------------------------------------------------------------
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 68a3da5617..7e5ed389c5 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -4,10 +4,26 @@
## tools to do so is impractical / too difficult
##-------------------------------------------------------------
-# Comment out the next line to skip building print docs. The default
-# is not to skip building print docs. Note, after changing it
-# you need to re-run autogen.sh and configure to make it take effect.
-BUILD_ALL_DOCS=yes
+# Building documentation is a pain. It takes longish and requires certain
+# tools you may not have installed.
+# The variable BUILD_DOCS allows you to control what documentation gets
+# built:
+#
+# BUILD_DOCS=all builds all documentation
+# BUILD_DOCS=html builds HTML docs but skips building PDFs
+# BUILD_DOCS=none does not build any documentation
+#
+# Use it on the command line. E.g.: make dist BUILD_DOCS=none
+#
+ifndef BUILD_ALL_DOCS
+ BUILD_DOCS ?= all
+ else
+ ifeq "$(BUILD_ALL_DOCS)" "yes"
+ BUILD_DOCS ?= all
+ else
+ BUILD_DOCS ?= html
+ endif
+ endif
# Whether to run xmlto pdf --with-fop
# This is de fault, set to empty to use the default fo to pdf
@@ -46,10 +62,12 @@ EXTRA_DIST = \
internals/arm_thumb_notes_gdbserver.txt \
internals/avx-notes.txt \
internals/BIG_APP_NOTES.txt \
+ internals/c23-functions-HOWTO.txt \
internals/Darwin-debug.txt \
internals/Darwin-notes.txt \
internals/SPEC-notes.txt \
internals/directory-structure.txt \
+ internals/git-HOWTO.txt \
internals/howto_BUILD_KDE42.txt \
internals/howto_oprofile.txt \
internals/m_replacemalloc.txt \
@@ -66,6 +84,7 @@ EXTRA_DIST = \
internals/qemu-riscv64-linux-HOWTO.txt \
internals/register-uses.txt \
internals/s390-opcodes.csv \
+ internals/svn-HOWTO.txt \
internals/release-HOWTO.txt \
internals/segments-seginfos.txt \
internals/t-chaining-notes.txt \
@@ -76,6 +95,8 @@ EXTRA_DIST = \
internals/why-no-libc.txt \
internals/xml-output.txt \
internals/xml-output-protocol4.txt \
+ internals/xml-output-protocol5.txt \
+ internals/xml-output-protocol6.txt \
lib/line-wrap.xsl \
lib/vg_basic.css \
lib/vg-fo.xsl \
@@ -276,7 +297,7 @@ install-data-hook:
cp $$f $(DESTDIR)$(mandir)/man1; \
fi \
done
- ifeq ($(BUILD_ALL_DOCS),yes)
+ ifeq ($(BUILD_DOCS),all)
set -e; \
if test -r index.pdf ; then \
mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \
@@ -292,18 +313,23 @@ install-data-hook:
# This is done at 'make dist' time. It builds the html docs, print
# docs and man pages and copies them into the docs/ directory in the
# tarball.
- ifeq ($(BUILD_ALL_DOCS),yes)
+ ifeq ($(BUILD_DOCS),none)
+dist-hook:
+
+ else
+ ifeq ($(BUILD_DOCS),all)
dist-hook: FAQ.txt html-docs man-pages print-docs
cp -r html $(distdir)
cp FAQ.txt $(distdir)/..
cp *.1 $(distdir)
cp print/index.pdf $(distdir)
cp print/index.ps $(distdir)
- else
+ else
dist-hook: FAQ.txt html-docs man-pages
cp -r html $(distdir)
cp FAQ.txt $(distdir)/..
cp *.1 $(distdir)
+ endif
endif
distclean-local:
diff --git a/docs/internals/c23-functions-HOWTO.txt b/docs/internals/c23-functions-HOWTO.txt
new file mode 100644
index 0000000000..d3eecda2d0
--- /dev/null
+++ b/docs/internals/c23-functions-HOWTO.txt
@@ -0,0 +1,63 @@
+How to test new C23 functions
+-----------------------------
+
+C23 adds some new 'free' functions, 'free_sized' which offers the possibility
+of faster deallocation by providing the size of the allocation and
+'free_aligned_sized', the same with the allocation alignment thrown in.
+Here is roughly the draft that corresponds to the final standard
+https://open-std.org/JTC1/SC22/WG14/www/docs/n3220.pdf.
+
+Memcheck does have support for these functions (and detects errors
+when there is a mismatch between the size or alignment at allocation
+and at deallocation). It seems as though library implementers are
+being rather slow in providing implementations of these functions.
+At the time of writing (Sept 2025) only tcmalloc seems to have done so.
+snmalloc (not tested) does refer to free_sized in its source.
+
+Building tcmalloc
+-----------------
+There are 2 versions of tcmalloc (not counting the one used internally
+by Google). One is part of Google perftools (pperf package on Fedora,
+google-perftools package on FreeBSD). That's not the one that we want
+(it's more oriented to some performance with options for performance
+profiling of CPU and heap). The one that we want is just tcmalloc.
+https://github.com/google/tcmalloc
+
+You will need to clone the above repo. tcmalloc uses bazel as its
+build failure system. Helpfully you can't even build a usable
+tcmalloc library out of the box. I had to apply this patch
+
+diff --git a/tcmalloc/BUILD b/tcmalloc/BUILD
+index 6698b88c..69b2f531 100644
+--- a/tcmalloc/BUILD
++++ b/tcmalloc/BUILD
+@@ -1578,3 +1578,11 @@ cc_library(
+ ],
+ deps = ["@com_google_absl//absl/base:core_headers"],
+ )
++
++cc_binary(
++ name = "libtcmalloc.so",
++ deps = [":tcmalloc"],
++ linkshared = 1,
++ copts = TCMALLOC_DEFAULT_COPTS,
++)
++
+
+(found in the GH issues) and then run
+
+bazel build //tcmalloc:libtcmalloc.so
+
+Building a test executable
+--------------------------
+
+Assuming that you cloned tcmalloc in your home directory and that
+you have a test harness called test.cpp you should be able to build
+it with tcmalloc using
+
+ g++ -g -o test test.cpp -I ${HOME}/tcmalloc/tcmalloc \
+ -I ${HOME}/tcmalloc/bazel-tcmalloc/external/abseil-cpp+/ \
+ -I tcmalloc/ -L ${HOME}/tcmalloc/bazel-bin/tcmalloc/ \
+ -ltcmalloc -Wl,-rpath,${HOME}/tcmalloc/bazel-bin/tcmalloc
+
+ I haven't tried to use LD_PRELOAD to simply replace libc.so for allocation.
diff --git a/docs/internals/xml-output-protocol5.txt b/docs/internals/xml-output-protocol5.txt
index 046f59408d..a481361da3 100644
--- a/docs/internals/xml-output-protocol5.txt
+++ b/docs/internals/xml-output-protocol5.txt
@@ -37,3 +37,6 @@ The possible values are:
On exit the file descriptor is still open
+ FdBadUse
+
+ The file descriptor is (no longer) valid
diff --git a/docs/internals/xml-output-protocol6.txt b/docs/internals/xml-output-protocol6.txt
new file mode 100644
index 0000000000..071ed11825
--- /dev/null
+++ b/docs/internals/xml-output-protocol6.txt
@@ -0,0 +1,246 @@
+====================================================================
+
+11 May 2025
+
+Protocol 6 is now always used (unlike protocol 5 which was only
+used with--track-fds). The main difference is that the xml output
+now contains error summaries.
+
+====================================================================
+
+
+Global error summary
+--------------------
+
+Previously, the non-xml output contained a summary of errors and
+suppressions used, like this:
+
+==3166== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 3 from 3)
+
+This was not included in the xml output. Starting with protocol 6 it will
+be included. The above example would produce
+
+
+ 1
+ 1
+ 3
+ 3
+
+
+Memcheck heap and leak summaries
+--------------------------------
+
+Memcheck produces two summaries that were not generated for XML.
+These are the heap summary, such as
+
+==80874== HEAP SUMMARY:
+==80874== in use at exit: 720 bytes in 5 blocks
+==80874== total heap usage: 5 allocs, 0 frees, 720 bytes allocated
+
+This now generates with --xml=yes
+
+
+
+ 720
+ 5
+
+
+ 5
+ 0
+ 720
+
+
+
+false
+
+The final summary is the leak summary. An example of the non-xml output
+is as follows:
+
+==24152== LEAK SUMMARY:
+==24152== definitely lost: 48 bytes in 3 blocks
+==24152== indirectly lost: 32 bytes in 2 blocks
+==24152== possibly lost: 96 bytes in 6 blocks
+==24152== still reachable: 64 bytes in 4 blocks
+==24152== suppressed: 0 bytes in 0 blocks
+
+The example above now produces with xml output
+
+
+
+ 48
+ 3
+
+
+ 32
+ 2
+
+
+ 96
+ 6
+
+
+ 64
+ 4
+
+
+ 0
+ 0
+
+
+
+
+COMMON ELEMENTS
+---------------
+BYTES and BLOCKS elements are common to the HEAP and LEAK summaries.
+
+The BYTES element is
+
+* INT
+
+This field indicates the number of bytes of memory that are not deallocated
+at exit or user leak check.
+
+The BLOCKS element is
+
+* INT
+
+The block fields contains the number of blocks that have not been deallocated
+at exit or user leak check.
+
+
+HEAP SUMMARY
+------------
+
+The heap summary is contained in a heap_summary element. It contains the
+following sub-elements:
+
+* BYTES AND BLOCKS ELEMENTS
+
+The second sub-element of heap_summary indicates the total heap usage.
+
+* ALLOCS FREES AND BYTES ELEMENTS
+
+The ALLOCS element is
+
+* INT
+
+This indicates the total number of allocations during the program run.
+
+The FREES element is
+
+* INT
+
+This indicates the total number of deallocation during the program run.
+
+The BYTES element is
+
+* INT
+
+This indicates the total number of bytes allocated during the program run.
+
+
+ERROR SUMMARY
+-------------
+
+The error summary is contained in an error_summary element. It contains the
+following sub-elements:
+
+* INT
+
+This field indicates the number of unsuppressed errors that were encountered.
+
+* INT
+
+This field indicated the number of unique unsuppressed error contexts.
+
+* INT
+
+This is the number of errors that were suppressed.
+
+* INT
+
+This is the number of unique error contexts used by the suppressions.
+
+LEAK SUMMARY
+------------
+
+The leak summary is contained in a leak_summary element.
+
+The leak summary sub-elements are:
+
+* BYTES AND BLOCKS ELEMENTS
+
+Memory that was definitely lost.
+
+* BYTES AND BLOCKS ELEMENTS
+
+Memory that was indirectly lost.
+
+* BYTES AND BLOCKS ELEMENTS
+
+Memory that was lost but memcheck cannot determine if it is
+definitely lost or still reachable.
+
+* BYTES BLOCKS AND (optional) REACHABLE_HEURISTIC ELEMENTS
+
+Memory that was still reachable at exit or the user leak check.
+
+If the --leak-check-heuristics= option was used then the still_reachable element
+may contain further details on the memory and kind of heuristic that the block(s).
+correspond to.
+
+The REACHABLE_HEURISTIC format is
+
+ KIND
+ INT
+ INT
+
+
+KIND is one of:
+ none, stdstring, length64, newarray, multipleinheritance
+
+* BYTES AND BLOCK ELEMENTS
+
+Information concerning the amount leaked that was suppressed.
+
+
+Addendum
+--------
+
+Unfortunately the xml-output-protocol documents were not updated
+to reflect some of the memcheck error conditions that were added.
+This omission is being rectified here.
+
+* memcheck error element kind
+
+ Added on 2023-03-10
+
+ ReallocSizeZero
+
+ realloc() called with a size of zero.
+
+ Added on 2023-09-02
+
+ InvalidSizeAndAlignment
+
+ an aligned allocation was requested with an invalid size such
+ as a non-multiple of the alignment
+
+ InvalidAlignment
+
+ an alignment was used that is not allowed such as a non-power
+ of two
+
+ InvalidSize
+
+ a size of zero was used with an aligned allocation
+
+ MismatchedAllocateDeallocateSize
+
+ the size used for a sized deallocation does not match the
+ size of the allocated block
+
+ MismatchedAllocateDeallocateAlignment
+
+ the alignment used for a deallocation does not match the
+ alignment requested when the block was allocated
diff --git a/docs/xml/FAQ.xml b/docs/xml/FAQ.xml
index 201b365021..5d458a01be 100644
--- a/docs/xml/FAQ.xml
+++ b/docs/xml/FAQ.xml
@@ -541,6 +541,27 @@ int main(void)
+
+
+ Why does Valgrind hang when using tcmalloc?
+
+
+ This is because tcmalloc makes a recursive call in its initialisation code.
+ Under Valgrind that becomes either an infinite loop with optimised builds of tcmalloc
+ or a stack overflow crash with debug builds of it.
+
+ Your options are:
+
+ Do not use tcmalloc in the builds that you test with Valgrind.
+ Use an older version of tcmalloc. This problem started on 2024-03-24.
+ If you use gperftools 2.15 or older you should not have this problem.
+
+
+
+
+
+
+
diff --git a/docs/xml/manual-core-adv.xml b/docs/xml/manual-core-adv.xml
index d7944b8a15..3591cf731f 100644
--- a/docs/xml/manual-core-adv.xml
+++ b/docs/xml/manual-core-adv.xml
@@ -1424,7 +1424,9 @@ gdb prog
Options to run valgrind with, in extended-remote
mode. For example . Everything
following will be provided as arguments
- to valgrind as is.
+ to valgrind as is. This is only for supplying valgrind options.
+ The program executable and its arguments are specified separately
+ by GDB and should NOT be included here.
diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml
index ffcb8d4bf5..9ab09b51bf 100644
--- a/docs/xml/manual-core.xml
+++ b/docs/xml/manual-core.xml
@@ -886,29 +886,44 @@ in most cases. We group the available options by rough categories.
-
-
-
- When enabled, Valgrind will print out a list of open file
- descriptors on exit or on request, via the gdbserver monitor
- command v.info open_fds. Along with each
- file descriptor is printed a stack backtrace of where the file
- was opened and any details relating to the file descriptor such
- as the file name or socket details. Use to
- include reporting on stdin,
+
+
+
+ When enabled, Valgrind will track all file descriptor
+ usage. It will produce errors for bad file descriptor usage like
+ closing a file descriptor twice, using a file descriptor
+ (number) that was never created, or passing an already closed
+ file descriptor to a system call. It will also print out a list
+ of open file descriptors on exit. Or on request, via the
+ gdbserver monitor command v.info open_fds.
+
+ When an error is generated, or when listing the still open
+ file descriptors at exit, a stack backtrace of where the file
+ was opened is printed. If the file descriptor has already been
+ closed, it will also include a backtrace of where it was
+ previously closed. Any error will include details relating to
+ the file descriptor such as the file name or socket details.
+
+ Use to also include reporting
+ on stdin,
stdout and
- stderr.
+ stderr (or other inherited file
+ descriptors) at exit. If option is used,
+ then exclude reporting on leaked file descriptors at exit and
+ only produce errors about bad file decriptors usage.
-
+
When enabled, when the program opens a new file descriptor,
the highest available file descriptor is returned instead of the
- lowest one.
+ lowest one. Use to restrict the feature from
+ the 0/1/2 file descriptors as they're often used for stdout/stderr
+ redirection.
diff --git a/docs/xml/manual-intro.xml b/docs/xml/manual-intro.xml
index 5f84671fd6..9fa78f0728 100644
--- a/docs/xml/manual-intro.xml
+++ b/docs/xml/manual-intro.xml
@@ -85,7 +85,7 @@ install process; full details are given in the
README file in the distribution.
Valgrind is licensed under the ,
-version 2. The valgrind/*.h headers
+version 3. The valgrind/*.h headers
that you may wish to include in your code (eg.
valgrind.h, memcheck.h,
helgrind.h, etc.) are
@@ -97,9 +97,9 @@ Farrell, ISBN 1-56592-115-1, published by O'Reilly & Associates,
Inc.If you contribute code to Valgrind, please ensure your
-contributions are licensed as "GPLv2, or (at your option) any later
+contributions are licensed as "GPLv3, or (at your option) any later
version." This is so as to allow the possibility of easily upgrading
-the license to GPLv3 in future. If you want to modify code in the VEX
+the license to a future version. If you want to modify code in the VEX
subdirectory, please also see the file VEX/HACKING.README in the
distribution.
diff --git a/drd/drd.h b/drd/drd.h
index 88a5c6e9bd..679954e53b 100644
--- a/drd/drd.h
+++ b/drd/drd.h
@@ -3,7 +3,7 @@
Notice that the following BSD-style license applies to this one
file (drd.h) only. The rest of Valgrind is licensed under the
- terms of the GNU General Public License, version 2, unless
+ terms of the GNU General Public License, version 3, unless
otherwise indicated. See the COPYING file in the source
distribution for details.
@@ -50,7 +50,7 @@
Notice that the above BSD-style license applies to this one file
(drd.h) only. The entire rest of Valgrind is licensed under
- the terms of the GNU General Public License, version 2. See the
+ the terms of the GNU General Public License, version 3. See the
COPYING file in the source distribution for details.
----------------------------------------------------------------
diff --git a/drd/drd_barrier.c b/drd/drd_barrier.c
index 0d6d2136ae..c4387bb9c1 100644
--- a/drd/drd_barrier.c
+++ b/drd/drd_barrier.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_barrier.h b/drd/drd_barrier.h
index c8cda80b67..96582dadc1 100644
--- a/drd/drd_barrier.h
+++ b/drd/drd_barrier.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_basics.h b/drd/drd_basics.h
index f1e2001c72..702d3aacd3 100644
--- a/drd/drd_basics.h
+++ b/drd/drd_basics.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_bitmap.c b/drd/drd_bitmap.c
index 3bd7fa56bd..b6b88a895a 100644
--- a/drd/drd_bitmap.c
+++ b/drd/drd_bitmap.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_bitmap.h b/drd/drd_bitmap.h
index fa1506ed4f..b01c808551 100644
--- a/drd/drd_bitmap.h
+++ b/drd/drd_bitmap.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_clientobj.c b/drd/drd_clientobj.c
index 4815f712fe..c257bf17e4 100644
--- a/drd/drd_clientobj.c
+++ b/drd/drd_clientobj.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_clientobj.h b/drd/drd_clientobj.h
index 5a99f1e372..a3cd197bdc 100644
--- a/drd/drd_clientobj.h
+++ b/drd/drd_clientobj.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_clientreq.c b/drd/drd_clientreq.c
index 914d9a3482..e526a6bce2 100644
--- a/drd/drd_clientreq.c
+++ b/drd/drd_clientreq.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_clientreq.h b/drd/drd_clientreq.h
index e87927d0d1..1c437a4e6c 100644
--- a/drd/drd_clientreq.h
+++ b/drd/drd_clientreq.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_cond.c b/drd/drd_cond.c
index 0e35eb140c..ff68110977 100644
--- a/drd/drd_cond.c
+++ b/drd/drd_cond.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_cond.h b/drd/drd_cond.h
index c41b5935b5..386fdac3d8 100644
--- a/drd/drd_cond.h
+++ b/drd/drd_cond.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_darwin_intercepts.c b/drd/drd_darwin_intercepts.c
index 9b082173a1..b18defaf0c 100644
--- a/drd/drd_darwin_intercepts.c
+++ b/drd/drd_darwin_intercepts.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_error.c b/drd/drd_error.c
index d7928f9b78..82333439c2 100644
--- a/drd/drd_error.c
+++ b/drd/drd_error.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_error.h b/drd/drd_error.h
index 742cd43a04..87f2a8c126 100644
--- a/drd/drd_error.h
+++ b/drd/drd_error.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_hb.c b/drd/drd_hb.c
index 120bca2a76..c4efa0fb44 100644
--- a/drd/drd_hb.c
+++ b/drd/drd_hb.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_hb.h b/drd/drd_hb.h
index 8ac6f7d9ad..e7dfe97ab6 100644
--- a/drd/drd_hb.h
+++ b/drd/drd_hb.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_libstdcxx_intercepts.c b/drd/drd_libstdcxx_intercepts.c
index 18c7cd1227..3120cf6094 100644
--- a/drd/drd_libstdcxx_intercepts.c
+++ b/drd/drd_libstdcxx_intercepts.c
@@ -9,7 +9,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_load_store.c b/drd/drd_load_store.c
index a6fb874bfc..968ec885ef 100644
--- a/drd/drd_load_store.c
+++ b/drd/drd_load_store.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_load_store.h b/drd/drd_load_store.h
index 1bd7eccec5..241002ba45 100644
--- a/drd/drd_load_store.h
+++ b/drd/drd_load_store.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_main.c b/drd/drd_main.c
index 1f2ffc2a3a..455685a064 100644
--- a/drd/drd_main.c
+++ b/drd/drd_main.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_malloc_wrappers.c b/drd/drd_malloc_wrappers.c
index 72e9061818..682ba08a53 100644
--- a/drd/drd_malloc_wrappers.c
+++ b/drd/drd_malloc_wrappers.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_malloc_wrappers.h b/drd/drd_malloc_wrappers.h
index 31fd9946ce..11ceb7420c 100644
--- a/drd/drd_malloc_wrappers.h
+++ b/drd/drd_malloc_wrappers.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_mutex.c b/drd/drd_mutex.c
index 34d8c8260d..6ba57a96fc 100644
--- a/drd/drd_mutex.c
+++ b/drd/drd_mutex.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_mutex.h b/drd/drd_mutex.h
index 624b1d44a4..e16715f206 100644
--- a/drd/drd_mutex.h
+++ b/drd/drd_mutex.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c
index bb92101931..0cd7c0be62 100644
--- a/drd/drd_pthread_intercepts.c
+++ b/drd/drd_pthread_intercepts.c
@@ -9,7 +9,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1556,7 +1556,14 @@ sem_t* sem_open_intercept(const char *name, int oflag, mode_t mode,
CALL_FN_W_WWWW(ret, fn, name, oflag, mode, value);
// To do: figure out why gcc 9.2.1 miscompiles this function if the printf()
// call below is left out.
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-zero-length"
+#endif
printf("");
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ_DRD_POST_SEM_OPEN,
ret != SEM_FAILED ? ret : 0,
name, oflag, mode, value);
diff --git a/drd/drd_qtcore_intercepts.c b/drd/drd_qtcore_intercepts.c
index 31bde9fd46..cb4e8dab6a 100644
--- a/drd/drd_qtcore_intercepts.c
+++ b/drd/drd_qtcore_intercepts.c
@@ -9,7 +9,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_rwlock.c b/drd/drd_rwlock.c
index e5f8457218..46a6b5517d 100644
--- a/drd/drd_rwlock.c
+++ b/drd/drd_rwlock.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_rwlock.h b/drd/drd_rwlock.h
index c36eac44a6..885e0daac2 100644
--- a/drd/drd_rwlock.h
+++ b/drd/drd_rwlock.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_segment.c b/drd/drd_segment.c
index 2674914d0d..0ebb0c6735 100644
--- a/drd/drd_segment.c
+++ b/drd/drd_segment.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_segment.h b/drd/drd_segment.h
index 377b1bab86..d9a551d16b 100644
--- a/drd/drd_segment.h
+++ b/drd/drd_segment.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_semaphore.c b/drd/drd_semaphore.c
index 7984c7630f..9f79b2ee66 100644
--- a/drd/drd_semaphore.c
+++ b/drd/drd_semaphore.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_semaphore.h b/drd/drd_semaphore.h
index 46eed0578e..bf2ca566b7 100644
--- a/drd/drd_semaphore.h
+++ b/drd/drd_semaphore.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_strmem_intercepts.c b/drd/drd_strmem_intercepts.c
index ba82014df7..e37377ffc9 100644
--- a/drd/drd_strmem_intercepts.c
+++ b/drd/drd_strmem_intercepts.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_suppression.c b/drd/drd_suppression.c
index 8688bec977..b13cc600a0 100644
--- a/drd/drd_suppression.c
+++ b/drd/drd_suppression.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_thread.c b/drd/drd_thread.c
index 891967b039..745eaeb26a 100644
--- a/drd/drd_thread.c
+++ b/drd/drd_thread.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_thread.h b/drd/drd_thread.h
index 0f7d783733..e6dcc00f36 100644
--- a/drd/drd_thread.h
+++ b/drd/drd_thread.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_thread_bitmap.h b/drd/drd_thread_bitmap.h
index 2c7b0a91e0..e69201f475 100644
--- a/drd/drd_thread_bitmap.h
+++ b/drd/drd_thread_bitmap.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_vc.c b/drd/drd_vc.c
index 5705391f27..c8f6cec84b 100644
--- a/drd/drd_vc.c
+++ b/drd/drd_vc.c
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/drd_vc.h b/drd/drd_vc.h
index 0161be0f23..08c544af9d 100644
--- a/drd/drd_vc.h
+++ b/drd/drd_vc.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/pub_drd_bitmap.h b/drd/pub_drd_bitmap.h
index 4c5c1b6e5f..fb9d14ae16 100644
--- a/drd/pub_drd_bitmap.h
+++ b/drd/pub_drd_bitmap.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/scripts/download-and-build-splash2.in b/drd/scripts/download-and-build-splash2.in
old mode 100755
new mode 100644
diff --git a/drd/tests/Makefile.am b/drd/tests/Makefile.am
old mode 100755
new mode 100644
index 7fa1611a97..bf5daf247f
--- a/drd/tests/Makefile.am
+++ b/drd/tests/Makefile.am
@@ -578,7 +578,8 @@ endif
tsan_unittest_SOURCES = tsan_unittest.cpp
tsan_unittest_CXXFLAGS = $(AM_CXXFLAGS) \
- -DTHREAD_WRAPPERS='"tsan_thread_wrappers_pthread.h"'
+ -DTHREAD_WRAPPERS='"tsan_thread_wrappers_pthread.h"' \
+ @FLAG_W_NO_UNUSED_BUT_SET_VARIABLE@
unit_bitmap_CFLAGS = $(AM_CFLAGS) -O2 \
-DENABLE_DRD_CONSISTENCY_CHECKS \
diff --git a/drd/tests/annotate_barrier_xml.stderr.exp b/drd/tests/annotate_barrier_xml.stderr.exp
index b34c787e8e..702926c180 100644
--- a/drd/tests/annotate_barrier_xml.stderr.exp
+++ b/drd/tests/annotate_barrier_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6drd
@@ -284,7 +284,6 @@
Done.
-
FINISHED
@@ -323,5 +322,6 @@ Done.
...
-
+...
+
diff --git a/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit b/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit
index 888084b410..7688aaae74 100644
--- a/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit
+++ b/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit
@@ -2,7 +2,7 @@
-4
+6drd
@@ -287,7 +287,6 @@ uint64_t
Done.
-
FINISHED
@@ -298,5 +297,6 @@ Done.
...
-
+...
+
diff --git a/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit-clang b/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit-clang
index 13c7a9e5a3..057f96054a 100644
--- a/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit-clang
+++ b/drd/tests/annotate_trace_memory_xml.stderr.exp-32bit-clang
@@ -2,7 +2,7 @@
-4
+6drd
@@ -287,7 +287,6 @@ uint64_t
Done.
-
FINISHED
@@ -298,5 +297,6 @@ Done.
...
-
+...
+
diff --git a/drd/tests/annotate_trace_memory_xml.stderr.exp-64bit b/drd/tests/annotate_trace_memory_xml.stderr.exp-64bit
index 8a62b6c460..6f4e8ff4a9 100644
--- a/drd/tests/annotate_trace_memory_xml.stderr.exp-64bit
+++ b/drd/tests/annotate_trace_memory_xml.stderr.exp-64bit
@@ -2,7 +2,7 @@
-4
+6drd
@@ -251,7 +251,6 @@ uint64_t
Done.
-
FINISHED
@@ -262,5 +261,6 @@ Done.
...
-
+...
+
diff --git a/drd/tests/annotate_trace_memory_xml.stderr.exp-arm b/drd/tests/annotate_trace_memory_xml.stderr.exp-arm
index 2af2455ca0..146d6574d2 100644
--- a/drd/tests/annotate_trace_memory_xml.stderr.exp-arm
+++ b/drd/tests/annotate_trace_memory_xml.stderr.exp-arm
@@ -2,7 +2,7 @@
-4
+6drd
@@ -299,7 +299,6 @@ uint64_t
Done.
-
FINISHED
@@ -310,5 +309,6 @@ Done.
...
-
+...
+
diff --git a/drd/tests/annotate_trace_memory_xml.stderr.exp-mips32 b/drd/tests/annotate_trace_memory_xml.stderr.exp-mips32
index 9fc793a418..ef85978354 100644
--- a/drd/tests/annotate_trace_memory_xml.stderr.exp-mips32
+++ b/drd/tests/annotate_trace_memory_xml.stderr.exp-mips32
@@ -2,7 +2,7 @@
-4
+6drd
@@ -323,7 +323,6 @@ uint64_t
Done.
-
FINISHED
@@ -334,5 +333,6 @@ Done.
...
-
+...
+
diff --git a/drd/tests/bar_bad_xml.stderr.exp b/drd/tests/bar_bad_xml.stderr.exp
index 8539f75c77..603492527c 100644
--- a/drd/tests/bar_bad_xml.stderr.exp
+++ b/drd/tests/bar_bad_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6drd
@@ -204,7 +204,6 @@ destroy a barrier that has waiting threads
destroy a barrier that was never initialised
-
FINISHED
@@ -231,5 +230,6 @@ destroy a barrier that was never initialised
...
-
+...
+
diff --git a/drd/tests/bar_bad_xml.stderr.exp-freebsd b/drd/tests/bar_bad_xml.stderr.exp-freebsd
index 24ac7fe952..460d7f77a4 100644
--- a/drd/tests/bar_bad_xml.stderr.exp-freebsd
+++ b/drd/tests/bar_bad_xml.stderr.exp-freebsd
@@ -2,7 +2,7 @@
-4
+6drd
@@ -251,7 +251,6 @@ destroy a barrier that was never initialised
-
FINISHED
@@ -282,5 +281,6 @@ destroy a barrier that was never initialised
...
-
+...
+
diff --git a/drd/tests/bar_bad_xml.stderr.exp-no-barrier b/drd/tests/bar_bad_xml.stderr.exp-no-barrier
index 1b7db90d3e..26ee071ec1 100644
--- a/drd/tests/bar_bad_xml.stderr.exp-no-barrier
+++ b/drd/tests/bar_bad_xml.stderr.exp-no-barrier
@@ -2,7 +2,7 @@
-4
+6drd
@@ -209,5 +209,6 @@ destroy a barrier that was never initialised
...
-
+...
+
diff --git a/drd/tests/bar_bad_xml.stderr.exp-nohang b/drd/tests/bar_bad_xml.stderr.exp-nohang
index a47cd603b7..14e2fcf457 100644
--- a/drd/tests/bar_bad_xml.stderr.exp-nohang
+++ b/drd/tests/bar_bad_xml.stderr.exp-nohang
@@ -2,7 +2,7 @@
-4
+6drd
@@ -229,7 +229,6 @@ destroy a barrier that was never initialised
-
FINISHED
@@ -260,5 +259,6 @@ destroy a barrier that was never initialised
...
-
+...
+
diff --git a/drd/tests/bar_bad_xml.stderr.exp-solaris b/drd/tests/bar_bad_xml.stderr.exp-solaris
index acb965656e..59a0c89d51 100644
--- a/drd/tests/bar_bad_xml.stderr.exp-solaris
+++ b/drd/tests/bar_bad_xml.stderr.exp-solaris
@@ -2,7 +2,7 @@
-4
+6drd
@@ -276,7 +276,6 @@ destroy a barrier that was never initialised
-
FINISHED
@@ -311,5 +310,6 @@ destroy a barrier that was never initialised
...
-
+...
+
diff --git a/drd/tests/filter_error_count.in b/drd/tests/filter_error_count.in
old mode 100755
new mode 100644
diff --git a/drd/tests/filter_error_summary.in b/drd/tests/filter_error_summary.in
old mode 100755
new mode 100644
diff --git a/drd/tests/filter_stderr.in b/drd/tests/filter_stderr.in
old mode 100755
new mode 100644
diff --git a/drd/tests/filter_stderr_and_thread_no_and_offset.in b/drd/tests/filter_stderr_and_thread_no_and_offset.in
old mode 100755
new mode 100644
diff --git a/drd/tests/filter_thread_no.in b/drd/tests/filter_thread_no.in
old mode 100755
new mode 100644
diff --git a/drd/tests/filter_xml_and_thread_no.in b/drd/tests/filter_xml_and_thread_no.in
old mode 100755
new mode 100644
diff --git a/drd/tests/fp_race_xml.stderr.exp b/drd/tests/fp_race_xml.stderr.exp
index 05ffe71e52..17409062be 100644
--- a/drd/tests/fp_race_xml.stderr.exp
+++ b/drd/tests/fp_race_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6drd
@@ -81,7 +81,6 @@
drd_post_thread_join joiner = 1, joinee = 2, new vc: [ ... ]drd_thread_finished tid = 1
-
FINISHED
@@ -100,5 +99,6 @@
...
-
+...
+
diff --git a/drd/tests/fp_race_xml.stderr.exp-mips32-be b/drd/tests/fp_race_xml.stderr.exp-mips32-be
index 2960a39077..d5bfdd99fe 100644
--- a/drd/tests/fp_race_xml.stderr.exp-mips32-be
+++ b/drd/tests/fp_race_xml.stderr.exp-mips32-be
@@ -2,7 +2,7 @@
-4
+6drd
@@ -154,5 +154,6 @@
...
-
+...
+
diff --git a/drd/tests/fp_race_xml.stderr.exp-mips32-le b/drd/tests/fp_race_xml.stderr.exp-mips32-le
index a0edb5e894..d6703d6415 100644
--- a/drd/tests/fp_race_xml.stderr.exp-mips32-le
+++ b/drd/tests/fp_race_xml.stderr.exp-mips32-le
@@ -2,7 +2,7 @@
-4
+6drd
@@ -154,5 +154,6 @@
...
-
+...
+
diff --git a/drd/tests/fp_race_xml.stderr.exp-solaris b/drd/tests/fp_race_xml.stderr.exp-solaris
index 05ffe71e52..2063aa4f0e 100644
--- a/drd/tests/fp_race_xml.stderr.exp-solaris
+++ b/drd/tests/fp_race_xml.stderr.exp-solaris
@@ -2,7 +2,7 @@
-4
+6drd
diff --git a/drd/tests/monitor_example.cpp b/drd/tests/monitor_example.cpp
index 3237d16b9d..db11d45fd4 100644
--- a/drd/tests/monitor_example.cpp
+++ b/drd/tests/monitor_example.cpp
@@ -7,7 +7,7 @@
Notice that the following BSD-style license applies to this one
file (monitor_example.cpp) only. The rest of Valgrind is licensed
- under the terms of the GNU General Public License, version 2,
+ under the terms of the GNU General Public License, version 3,
unless otherwise indicated. See the COPYING file in the source
distribution for details.
@@ -53,7 +53,7 @@
Notice that the above BSD-style license applies to this one
file (monitor_example.cpp) only. The rest of Valgrind is licensed
- under the terms of the GNU General Public License, version 2,
+ under the terms of the GNU General Public License, version 3,
unless otherwise indicated. See the COPYING file in the source
distribution for details.
diff --git a/drd/tests/thread_name_freebsd.c b/drd/tests/thread_name_freebsd.c
index 0f4954ba7c..dbd342154c 100644
--- a/drd/tests/thread_name_freebsd.c
+++ b/drd/tests/thread_name_freebsd.c
@@ -20,7 +20,7 @@ static void* thread_func(void* argp)
{
const int thread_num = (ptrdiff_t)(argp);
pthread_mutex_t invalid_mutex;
- char thread_name[32];
+ char thread_name[33];
snprintf(thread_name, sizeof(thread_name),
"thread_func instance %d", thread_num + 1);
diff --git a/drd/tests/thread_name_xml.stderr.exp b/drd/tests/thread_name_xml.stderr.exp
index 36b53604e8..0e47f5fff4 100644
--- a/drd/tests/thread_name_xml.stderr.exp
+++ b/drd/tests/thread_name_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6drd
@@ -388,7 +388,6 @@ thread_func instance 10
-
FINISHED
@@ -439,5 +438,6 @@ thread_func instance 10
...
-
+...
+
diff --git a/drd/tests/timed_mutex.cpp b/drd/tests/timed_mutex.cpp
index fa7464ea5b..97ac320964 100644
--- a/drd/tests/timed_mutex.cpp
+++ b/drd/tests/timed_mutex.cpp
@@ -10,7 +10,7 @@ int global;
void f()
{
auto now=std::chrono::steady_clock::now();
- test_mutex.try_lock_until(now + std::chrono::seconds(11));
+ (void)test_mutex.try_lock_until(now + std::chrono::seconds(11));
--global;
std::this_thread::sleep_for(std::chrono::seconds(1));
test_mutex.unlock();
@@ -23,7 +23,7 @@ int main()
std::thread t(f);
std::this_thread::sleep_for(std::chrono::seconds(1));
auto now=std::chrono::steady_clock::now();
- test_mutex.try_lock_until(now + std::chrono::seconds(11));
+ (void)test_mutex.try_lock_until(now + std::chrono::seconds(11));
++global;
test_mutex.unlock();
t.join();
diff --git a/drd/tests/tsan_thread_wrappers_pthread.h b/drd/tests/tsan_thread_wrappers_pthread.h
index e022e5dece..24a29b8d51 100644
--- a/drd/tests/tsan_thread_wrappers_pthread.h
+++ b/drd/tests/tsan_thread_wrappers_pthread.h
@@ -7,7 +7,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/drd/tests/tsan_unittest.cpp b/drd/tests/tsan_unittest.cpp
index ab42740515..95cbb7ec97 100644
--- a/drd/tests/tsan_unittest.cpp
+++ b/drd/tests/tsan_unittest.cpp
@@ -7,7 +7,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/exp-bbv/bbv_main.c b/exp-bbv/bbv_main.c
index e632ea11f7..c7efd8b62c 100644
--- a/exp-bbv/bbv_main.c
+++ b/exp-bbv/bbv_main.c
@@ -16,7 +16,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/freebsd-drd.supp b/freebsd-drd.supp
index c0767aadf7..980d0db464 100644
--- a/freebsd-drd.supp
+++ b/freebsd-drd.supp
@@ -223,3 +223,17 @@
drd:ConflictingAccess
fun:thr_new
}
+{
+ DRD-FREEBSD15-EXTERRCTL
+ drd:ConflictingAccess
+ fun:exterrctl
+}
+{
+ DRD-FREEBSD15-_MALLOC_POSTFORK
+ drd:ConflictingAccess
+ obj:*/lib*/libc.so.7
+ obj:*/lib*/libc.so.7
+ obj:*/lib*/libc.so.7
+ fun:_malloc_postfork
+}
+
diff --git a/gdbserver_tests/Makefile.am b/gdbserver_tests/Makefile.am
old mode 100755
new mode 100644
diff --git a/gdbserver_tests/README_DEVELOPERS b/gdbserver_tests/README_DEVELOPERS
index c570f3e531..0a9f2846f6 100644
--- a/gdbserver_tests/README_DEVELOPERS
+++ b/gdbserver_tests/README_DEVELOPERS
@@ -15,7 +15,7 @@ or (to just run the gdbserver tests with another gdb):
make check
cd ..
gdbserver_tests/make_local_links /path/to/another/gdb
- perl tests/vg_regtest gdbserver_tests
+ tests/vg_regtest gdbserver_tests
The minimum version to run the tests is gdb >= 6.5.
Previous versions do not have the 'target remote |' command. It
@@ -30,11 +30,27 @@ if testing with a lower version).
Test behaviour with gdb < 7.0 is unknown: some might fail,
some might block or loop for a very long time.
-Some tests implies to have a vgdb "ptrace invoker" capable.
+Some tests imply having the vgdb "ptrace invoker" capability.
The prerequisite are established during make regtest (using marker files).
Each test verifies the prerequisite using the prereq: line.
+The invoker is implemented as follows on the currently supported OSes.
+
+------------------------------------------------------------
+| Linux | ptrace | vgdb-invoker-ptrace.c |
+| FreeBSD | ptrace | vgdb-invoker-freebsd.c |
+| Solaris | process control files | vgdb-invoker-solaris.c |
+| Darwin | not implemented | vgdb-invoker-none.c |
+------------------------------------------------------------
+
+The source files are all in coregrind/. ptrace is not part of any
+standardised interface like POSIX. That means that the Linux and
+FreeBSD implementations are very similar but there are some
+differences. Darwin not having an invoker means that it is not possible
+to interrupt Valgrind attached to GDB if it hangs. You will need to
+kill Valgrind and start again if that happens.
+
In case of failing tests
------------------------
When executed with a new gdb version and/or depending on the OS version,
@@ -45,7 +61,7 @@ You are welcome to fix such bugs by enhancing filter_gdb.
Alternatively, to report such problems, the best is to re-run
the gdbserver tests the following way:
- perl tests/vg_regtest --keep-unfiltered gdbserver_tests
+ tests/vg_regtest --keep-unfiltered gdbserver_tests
Then file a bug in bugzilla, giving the following information:
output of
diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in
old mode 100755
new mode 100644
index 681376e488..ccd48212dc
--- a/gdbserver_tests/filter_gdb.in
+++ b/gdbserver_tests/filter_gdb.in
@@ -149,6 +149,9 @@ s/__libc_do_syscall ().*/0x........ in syscall .../
# extra source code line
/libc-do-syscall.S/d
+# variation of the previous extra source code line
+/syscall_cancel.S/d
+
# anonymise kill syscall.
s/in kill ().*$/in syscall .../
@@ -282,6 +285,9 @@ s/^0x........ in \(\w\+ (\)/\1/
/^Missing debuginfo.*/d
/^Missing rpms.*/d
+# illumos, but only when building the port
+/\.\/gdb: warning: Couldn't determine a path for the index cache directory\./d
+
EOF
dir=`dirname $0`
diff --git a/gdbserver_tests/filter_memcheck_monitor.in b/gdbserver_tests/filter_memcheck_monitor.in
old mode 100755
new mode 100644
diff --git a/gdbserver_tests/filter_stderr.in b/gdbserver_tests/filter_stderr.in
old mode 100755
new mode 100644
diff --git a/gdbserver_tests/filter_vgdb.in b/gdbserver_tests/filter_vgdb.in
old mode 100755
new mode 100644
diff --git a/gdbserver_tests/hginfo.vgtest b/gdbserver_tests/hginfo.vgtest
index 0ea8ab4b34..af58a62bdb 100644
--- a/gdbserver_tests/hginfo.vgtest
+++ b/gdbserver_tests/hginfo.vgtest
@@ -5,6 +5,7 @@ vgopts: --tool=helgrind --ignore-thread-creation=yes --vgdb=yes --vgdb-error=0
prereq: test -e gdb.eval
stdout_filter: filter_make_empty
stderr_filter: filter_stderr
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ../helgrind/tests/hg01_all_ok
stdinB: hginfo.stdinB.gdb
diff --git a/gdbserver_tests/hgtls.vgtest b/gdbserver_tests/hgtls.vgtest
index 44bc4e1ec1..73453e15b7 100644
--- a/gdbserver_tests/hgtls.vgtest
+++ b/gdbserver_tests/hgtls.vgtest
@@ -4,6 +4,7 @@ vgopts: --tool=helgrind --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-hg
prereq: test -e gdb && test -e ../none/tests/tls && grep '^#define HAVE_TLS 1' ../config.h > /dev/null && grep '^#define HAVE_DLINFO_RTLD_DI_TLS_MODID 1' ../config.h > /dev/null
stdout_filter: filter_make_empty
stderr_filter: filter_make_empty
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ../none/tests/tls
stdinB: hgtls.stdinB.gdb
diff --git a/gdbserver_tests/mcblocklistsearch.vgtest b/gdbserver_tests/mcblocklistsearch.vgtest
index bced1cde84..5073bc396d 100644
--- a/gdbserver_tests/mcblocklistsearch.vgtest
+++ b/gdbserver_tests/mcblocklistsearch.vgtest
@@ -4,6 +4,7 @@ vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mc
prereq: test -e gdb.eval
stdout_filter: filter_make_empty
stderr_filter: filter_make_empty
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx 1>&2 ../memcheck/tests/leak-tree
stdinB: mcblocklistsearch.stdinB.gdb
diff --git a/gdbserver_tests/mcbreak.vgtest b/gdbserver_tests/mcbreak.vgtest
index d42fbd0d1a..ea4e163286 100644
--- a/gdbserver_tests/mcbreak.vgtest
+++ b/gdbserver_tests/mcbreak.vgtest
@@ -5,6 +5,7 @@ prog: t
vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mcbreak
stdout_filter: filter_gdb
stderr_filter: filter_make_empty
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ./t
stdinB: mcbreak.stdinB.gdb
diff --git a/gdbserver_tests/mcclean_after_fork.vgtest b/gdbserver_tests/mcclean_after_fork.vgtest
index 25ca471323..1261945456 100644
--- a/gdbserver_tests/mcclean_after_fork.vgtest
+++ b/gdbserver_tests/mcclean_after_fork.vgtest
@@ -3,6 +3,7 @@ prereq: test -e gdb
prog: clean_after_fork
vgopts: --tool=memcheck --vgdb=full --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mcclean_after_fork
stderr_filter: filter_memcheck_monitor
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ./clean_after_fork
stdinB: mcclean_after_fork.stdinB.gdb
diff --git a/gdbserver_tests/mcinfcallWSRU.vgtest b/gdbserver_tests/mcinfcallWSRU.vgtest
index af260ff202..91276a1081 100644
--- a/gdbserver_tests/mcinfcallWSRU.vgtest
+++ b/gdbserver_tests/mcinfcallWSRU.vgtest
@@ -10,6 +10,7 @@ vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mc
prereq: test -e gdb -a -f gdb.step && ! ../tests/os_test darwin
# filter_gdb to replace pid and Thread numbers in the output of the program:
stderr_filter: filter_gdb
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx 1>&2 ./sleepers
stdinB: mcinfcallWSRU.stdinB.gdb
diff --git a/gdbserver_tests/mcleak.vgtest b/gdbserver_tests/mcleak.vgtest
index 9cd96a0a24..0a7bd7a527 100644
--- a/gdbserver_tests/mcleak.vgtest
+++ b/gdbserver_tests/mcleak.vgtest
@@ -4,6 +4,7 @@ vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mc
prereq: test -e gdb
stdout_filter: filter_memcheck_monitor
stderr_filter: filter_memcheck_monitor
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ../memcheck/tests/leak-delta
stdinB: mcleak.stdinB.gdb
diff --git a/gdbserver_tests/mcmain_pic.vgtest b/gdbserver_tests/mcmain_pic.vgtest
index 418695edd3..776960e9f8 100644
--- a/gdbserver_tests/mcmain_pic.vgtest
+++ b/gdbserver_tests/mcmain_pic.vgtest
@@ -8,6 +8,7 @@ prog: main_pic
vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mcmain_pic
stdout_filter: filter_gdb
stderr_filter: filter_memcheck_monitor
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ./main_pic
stdinB: mcmain_pic.stdinB.gdb
diff --git a/gdbserver_tests/mcvabits.vgtest b/gdbserver_tests/mcvabits.vgtest
index 9ef834f1c6..7298b6569b 100644
--- a/gdbserver_tests/mcvabits.vgtest
+++ b/gdbserver_tests/mcvabits.vgtest
@@ -5,6 +5,7 @@ vgopts: --tool=memcheck --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mc
stdout_filter: filter_make_empty
stderr_filter: filter_make_empty
prereq: test -e gdb.eval
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ./t
stdinB: mcvabits.stdinB.gdb
diff --git a/gdbserver_tests/mcwatchpoints.vgtest b/gdbserver_tests/mcwatchpoints.vgtest
index c1152296c5..db41f6fe38 100644
--- a/gdbserver_tests/mcwatchpoints.vgtest
+++ b/gdbserver_tests/mcwatchpoints.vgtest
@@ -6,6 +6,7 @@ prog: watchpoints
vgopts: --tool=memcheck --vgdb=full --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mcwatchpoints
stdout_filter: filter_make_empty
stderr_filter: filter_memcheck_monitor
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ./watchpoints
stdinB: mcwatchpoints.stdinB.gdb
diff --git a/gdbserver_tests/mssnapshot.vgtest b/gdbserver_tests/mssnapshot.vgtest
index 20a558b728..7bf4b87539 100644
--- a/gdbserver_tests/mssnapshot.vgtest
+++ b/gdbserver_tests/mssnapshot.vgtest
@@ -4,6 +4,7 @@ prog: t
vgopts: --tool=massif --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-mssnapshot
stdout_filter: filter_make_empty
stderr_filter: filter_make_empty
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ./t
stdinB: mssnapshot.stdinB.gdb
diff --git a/gdbserver_tests/nlgone_abrt.vgtest b/gdbserver_tests/nlgone_abrt.vgtest
index e1e9f24fd7..4c326ebec3 100644
--- a/gdbserver_tests/nlgone_abrt.vgtest
+++ b/gdbserver_tests/nlgone_abrt.vgtest
@@ -5,6 +5,7 @@ args: abort
vgopts: -q --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlgone-abrt
stderr_filter: filter_stderr
prereq: test -e gdb
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ./gone
stdinB: nlgone_abrt.stdinB.gdb
diff --git a/gdbserver_tests/nlgone_return.vgtest b/gdbserver_tests/nlgone_return.vgtest
index 996f01c7b7..ddebea9978 100644
--- a/gdbserver_tests/nlgone_return.vgtest
+++ b/gdbserver_tests/nlgone_return.vgtest
@@ -5,6 +5,7 @@ args: return
vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlgone-return
stderr_filter: filter_stderr
prereq: test -e gdb
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ./gone
stdinB: nlgone_return.stdinB.gdb
diff --git a/gdbserver_tests/nlpasssigalrm.vgtest b/gdbserver_tests/nlpasssigalrm.vgtest
index 0450207a63..e9896f5d52 100644
--- a/gdbserver_tests/nlpasssigalrm.vgtest
+++ b/gdbserver_tests/nlpasssigalrm.vgtest
@@ -8,6 +8,7 @@ prog: passsigalrm
vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlpasssigalrm
stderr_filter: filter_stderr
prereq: test -e gdb
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ./passsigalrm
stdinB: nlpasssigalrm.stdinB.gdb
diff --git a/gdbserver_tests/nlself_invalidate.vgtest b/gdbserver_tests/nlself_invalidate.vgtest
index 2031130352..4a1955d35f 100644
--- a/gdbserver_tests/nlself_invalidate.vgtest
+++ b/gdbserver_tests/nlself_invalidate.vgtest
@@ -5,6 +5,7 @@ prog: self_invalidate
vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlself_invalidate
stderr_filter: filter_stderr
prereq: test -e gdb && ( ../tests/arch_test amd64 || ../tests/arch_test mips32 || ../tests/arch_test mips64 )
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ./self_invalidate
stdinB: nlself_invalidate.stdinB.gdb
diff --git a/gdbserver_tests/nlsigvgdb.vgtest b/gdbserver_tests/nlsigvgdb.vgtest
index 0b03b04055..ad69a129f4 100644
--- a/gdbserver_tests/nlsigvgdb.vgtest
+++ b/gdbserver_tests/nlsigvgdb.vgtest
@@ -8,6 +8,7 @@ args: 1 10000000 0 -S-S-S-S 1
vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlsigvgdb
stderr_filter: filter_stderr
prereq: test -e gdb -a -f vgdb.invoker
+envB: LC_ALL=C
progB: gdb
argsB: --quiet -l 60 --nx ./sleepers
stdinB: nlsigvgdb.stdinB.gdb
diff --git a/gdbserver_tests/sleepers.c b/gdbserver_tests/sleepers.c
index b433c19847..51d197a8e7 100644
--- a/gdbserver_tests/sleepers.c
+++ b/gdbserver_tests/sleepers.c
@@ -84,8 +84,11 @@ static void *sleeper_or_burner(void *v)
t[s->t].tv_usec = (sleepms % 1000) * 1000;
ret = select (0, NULL, NULL, NULL, &t[s->t]);
/* We only expect a timeout result or EINTR from the above. */
- if (ret != 0 && errno != EINTR)
- perror("unexpected result from select");
+ if (ret != 0 && errno != EINTR) {
+ char buf[64];
+ snprintf(buf, 64, "unexpected result (%d) from select", ret);
+ perror(buf);
+ }
}
if (burn > 0 && s->burn)
do_burn();
diff --git a/glibc-2.X-drd.supp.in b/glibc-2.X-drd.supp.in
index a75b4421fe..419ff2256c 100644
--- a/glibc-2.X-drd.supp.in
+++ b/glibc-2.X-drd.supp.in
@@ -40,7 +40,7 @@
{
drd-glibc-io-xsputn-mempcpy
drd:ConflictingAccess
- fun:__GI_mempcpy
+ fun:*mem*cpy
fun:_IO_*xsputn*
obj:@GLIBC_LIBC_PATH@
}
diff --git a/helgrind/helgrind.h b/helgrind/helgrind.h
index d6fa1f491a..afc2649c06 100644
--- a/helgrind/helgrind.h
+++ b/helgrind/helgrind.h
@@ -3,7 +3,7 @@
Notice that the above BSD-style license applies to this one file
(helgrind.h) only. The entire rest of Valgrind is licensed under
- the terms of the GNU General Public License, version 2. See the
+ the terms of the GNU General Public License, version 3. See the
COPYING file in the source distribution for details.
----------------------------------------------------------------
@@ -49,7 +49,7 @@
Notice that the above BSD-style license applies to this one file
(helgrind.h) only. The entire rest of Valgrind is licensed under
- the terms of the GNU General Public License, version 2. See the
+ the terms of the GNU General Public License, version 3. See the
COPYING file in the source distribution for details.
----------------------------------------------------------------
diff --git a/helgrind/hg_addrdescr.c b/helgrind/hg_addrdescr.c
index c13ad07e2d..8c4558472e 100644
--- a/helgrind/hg_addrdescr.c
+++ b/helgrind/hg_addrdescr.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/hg_addrdescr.h b/helgrind/hg_addrdescr.h
index 18d370d742..f859617e22 100644
--- a/helgrind/hg_addrdescr.h
+++ b/helgrind/hg_addrdescr.h
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/hg_basics.c b/helgrind/hg_basics.c
index 64e4470df1..1487d6b53d 100644
--- a/helgrind/hg_basics.c
+++ b/helgrind/hg_basics.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/hg_basics.h b/helgrind/hg_basics.h
index 534866b2ff..d62b47af74 100644
--- a/helgrind/hg_basics.h
+++ b/helgrind/hg_basics.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/hg_errors.c b/helgrind/hg_errors.c
index 638739dc6e..961513ccab 100644
--- a/helgrind/hg_errors.c
+++ b/helgrind/hg_errors.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/hg_errors.h b/helgrind/hg_errors.h
index 5824151c9a..a6b6a8530a 100644
--- a/helgrind/hg_errors.h
+++ b/helgrind/hg_errors.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c
index e639abca84..4bef0ab959 100644
--- a/helgrind/hg_intercepts.c
+++ b/helgrind/hg_intercepts.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -3550,7 +3550,7 @@ PTH_FUNC(sem_t*, semZuopen,
if (TRACE_SEM_FNS) {
fprintf(stderr, "<< sem_open(\"%s\",%ld,%lx,%lu) ",
- name,oflag,mode,value);
+ name,oflag,(unsigned long)mode,value);
fflush(stderr);
}
@@ -3790,7 +3790,7 @@ static long QMutex_tryLock_WRK(void* self)
void *, self, long, (ret & 0xFF) ? True : False);
if (TRACE_QT4_FNS) {
- fprintf(stderr, " :: Q::tryLock -> %lu >>\n", ret);
+ fprintf(stderr, " :: Q::tryLock -> %ld >>\n", ret);
}
return ret;
@@ -3827,7 +3827,7 @@ static long QMutex_tryLock_int_WRK(void* self, long arg2)
void *, self, long, (ret & 0xFF) ? True : False);
if (TRACE_QT4_FNS) {
- fprintf(stderr, " :: Q::tryLock(int) -> %lu >>\n", ret);
+ fprintf(stderr, " :: Q::tryLock(int) -> %ld >>\n", ret);
}
return ret;
diff --git a/helgrind/hg_lock_n_thread.c b/helgrind/hg_lock_n_thread.c
index f874e1defc..00e1b46b53 100644
--- a/helgrind/hg_lock_n_thread.c
+++ b/helgrind/hg_lock_n_thread.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/hg_lock_n_thread.h b/helgrind/hg_lock_n_thread.h
index 956fbdd8f4..fc13c14e29 100644
--- a/helgrind/hg_lock_n_thread.h
+++ b/helgrind/hg_lock_n_thread.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c
index 135c4d3b98..3f81a9d255 100644
--- a/helgrind/hg_main.c
+++ b/helgrind/hg_main.c
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/hg_wordset.c b/helgrind/hg_wordset.c
index ac4a700191..917947141f 100644
--- a/helgrind/hg_wordset.c
+++ b/helgrind/hg_wordset.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/hg_wordset.h b/helgrind/hg_wordset.h
index c7264b8d36..6a3131a982 100644
--- a/helgrind/hg_wordset.h
+++ b/helgrind/hg_wordset.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/libhb.h b/helgrind/libhb.h
index a6005ade0a..53e41c0d5d 100644
--- a/helgrind/libhb.h
+++ b/helgrind/libhb.h
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/libhb_core.c b/helgrind/libhb_core.c
index 0a084dd60d..302028acec 100644
--- a/helgrind/libhb_core.c
+++ b/helgrind/libhb_core.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am
old mode 100755
new mode 100644
index a299a226b3..b8c5fd0e78
--- a/helgrind/tests/Makefile.am
+++ b/helgrind/tests/Makefile.am
@@ -272,6 +272,7 @@ else
annotate_hbefore_CFLAGS = $(AM_CFLAGS)
endif
+tc09_bad_unlock_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_BUT_SET_VARIABLE@
bug322621_SOURCES = bug322621.cpp
if HAVE_CXX17
check_PROGRAMS += bug392331
diff --git a/helgrind/tests/bug392331.cpp b/helgrind/tests/bug392331.cpp
index ff26883b76..bd6cc5a236 100644
--- a/helgrind/tests/bug392331.cpp
+++ b/helgrind/tests/bug392331.cpp
@@ -16,7 +16,7 @@ bool processed = false;
void worker_thread()
{
// Wait until main() sends data
- std::unique_lock lk(m);
+ std::unique_lock lk(m);
cv.wait(lk, []{return ready;});
// after the wait, we own the lock.
@@ -40,7 +40,7 @@ int main()
data = "Example data";
// send data to the worker thread
{
- std::lock_guard lk(m);
+ std::lock_guard lk(m);
ready = true;
std::cout << "main() signals data ready for processing\n";
}
@@ -48,7 +48,7 @@ int main()
// wait for the worker
{
- std::unique_lock lk(m);
+ std::unique_lock lk(m);
cv.wait(lk, []{return processed;});
}
std::cout << "Back in main(), data = " << data << '\n';
diff --git a/helgrind/tests/filter_stderr.in b/helgrind/tests/filter_stderr.in
old mode 100755
new mode 100644
diff --git a/helgrind/tests/filter_xml b/helgrind/tests/filter_xml
index cc0b71ea07..0dc77f7a44 100755
--- a/helgrind/tests/filter_xml
+++ b/helgrind/tests/filter_xml
@@ -40,7 +40,9 @@ my %patterns = (
"0x([0-9a-zA-Z]+)" => "........",
"Using Valgrind-([^\\s]*)" => "X.Y.X",
"Copyright \\(C\\) ([0-9]{4}-[0-9]{4}).*" => "XXXX-YYYY",
- 'pthread_.*(@\*)' => ""
+ 'pthread_.*(@\*)' => "",
+ "(.*)" => "...",
+ "(.*)" => "..."
);
# List of XML sections to be ignored.
diff --git a/helgrind/tests/tc06_two_races_xml.stderr.exp b/helgrind/tests/tc06_two_races_xml.stderr.exp
index a442a285e3..8948505a73 100644
--- a/helgrind/tests/tc06_two_races_xml.stderr.exp
+++ b/helgrind/tests/tc06_two_races_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6helgrind
@@ -245,7 +245,6 @@
declared at tc06_two_races.c:9tc06_two_races.c9
-
FINISHED
@@ -255,5 +254,11 @@
...
-
+
+ 4
+ 4
+ ...
+ ...
+
+
diff --git a/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd b/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd
index 65a79a759b..e8cda5ff60 100644
--- a/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd
+++ b/helgrind/tests/tc06_two_races_xml.stderr.exp-freebsd
@@ -2,7 +2,7 @@
-4
+6helgrind
@@ -237,7 +237,6 @@
declared at tc06_two_races.c:9tc06_two_races.c9
-
FINISHED
@@ -247,5 +246,11 @@
...
-
+
+ 4
+ 4
+ ...
+ ...
+
+
diff --git a/include/pub_tool_addrinfo.h b/include/pub_tool_addrinfo.h
index e168500f10..98745349d8 100644
--- a/include/pub_tool_addrinfo.h
+++ b/include/pub_tool_addrinfo.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_aspacehl.h b/include/pub_tool_aspacehl.h
index 8f6fe8a79a..1ea594bddf 100644
--- a/include/pub_tool_aspacehl.h
+++ b/include/pub_tool_aspacehl.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_aspacemgr.h b/include/pub_tool_aspacemgr.h
index 479a71d9f4..2f4775d6eb 100644
--- a/include/pub_tool_aspacemgr.h
+++ b/include/pub_tool_aspacemgr.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_basics.h b/include/pub_tool_basics.h
index 155454bff4..ddf3cce3ce 100644
--- a/include/pub_tool_basics.h
+++ b/include/pub_tool_basics.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_basics_asm.h b/include/pub_tool_basics_asm.h
index 99f2ab18e7..b0b010abcc 100644
--- a/include/pub_tool_basics_asm.h
+++ b/include/pub_tool_basics_asm.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_clientstate.h b/include/pub_tool_clientstate.h
index e25a59702a..b9fe8df246 100644
--- a/include/pub_tool_clientstate.h
+++ b/include/pub_tool_clientstate.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -61,7 +61,7 @@ extern Int VG_(args_for_valgrind_noexecpass);
/* The name of the client executable, as specified on the command
line. */
-extern const HChar* VG_(args_the_exename);
+extern HChar* VG_(args_the_exename);
extern const HChar* VG_(resolved_exename);
diff --git a/include/pub_tool_clreq.h b/include/pub_tool_clreq.h
index 5ae18192c2..9b41ec9365 100644
--- a/include/pub_tool_clreq.h
+++ b/include/pub_tool_clreq.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_debuginfo.h b/include/pub_tool_debuginfo.h
index f18f98fb3d..2a55e3d356 100644
--- a/include/pub_tool_debuginfo.h
+++ b/include/pub_tool_debuginfo.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_deduppoolalloc.h b/include/pub_tool_deduppoolalloc.h
index 6e6c17ad54..e92d514218 100644
--- a/include/pub_tool_deduppoolalloc.h
+++ b/include/pub_tool_deduppoolalloc.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_errormgr.h b/include/pub_tool_errormgr.h
index 668afa9508..8130d712ac 100644
--- a/include/pub_tool_errormgr.h
+++ b/include/pub_tool_errormgr.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_execontext.h b/include/pub_tool_execontext.h
index 98c29b7e81..4f5d04ff8b 100644
--- a/include/pub_tool_execontext.h
+++ b/include/pub_tool_execontext.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_gdbserver.h b/include/pub_tool_gdbserver.h
index bf03add078..c60905ea49 100644
--- a/include/pub_tool_gdbserver.h
+++ b/include/pub_tool_gdbserver.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_guest.h b/include/pub_tool_guest.h
index 9e5c0c24a3..c206e5e601 100644
--- a/include/pub_tool_guest.h
+++ b/include/pub_tool_guest.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_hashtable.h b/include/pub_tool_hashtable.h
index 69d4148e44..bf7fe42e2a 100644
--- a/include/pub_tool_hashtable.h
+++ b/include/pub_tool_hashtable.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_libcassert.h b/include/pub_tool_libcassert.h
index a2ba8635a6..a469214ba3 100644
--- a/include/pub_tool_libcassert.h
+++ b/include/pub_tool_libcassert.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_libcbase.h b/include/pub_tool_libcbase.h
index b71066e25e..7fb7bf04de 100644
--- a/include/pub_tool_libcbase.h
+++ b/include/pub_tool_libcbase.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_libcfile.h b/include/pub_tool_libcfile.h
index ff4c0d3a57..780510581d 100644
--- a/include/pub_tool_libcfile.h
+++ b/include/pub_tool_libcfile.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -81,9 +81,7 @@ extern Int VG_(pipe) ( Int fd[2] );
extern Off64T VG_(lseek) ( Int fd, Off64T offset, Int whence );
extern SysRes VG_(stat) ( const HChar* file_name, struct vg_stat* buf );
-#if defined(VGO_freebsd)
extern SysRes VG_(lstat) ( const HChar* file_name, struct vg_stat* buf );
-#endif
extern Int VG_(fstat) ( Int fd, struct vg_stat* buf );
extern SysRes VG_(dup) ( Int oldfd );
extern SysRes VG_(dup2) ( Int oldfd, Int newfd );
diff --git a/include/pub_tool_libcprint.h b/include/pub_tool_libcprint.h
index 52c0f5764d..0e87129353 100644
--- a/include/pub_tool_libcprint.h
+++ b/include/pub_tool_libcprint.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_libcproc.h b/include/pub_tool_libcproc.h
index 49c10dae2e..c53285ec2c 100644
--- a/include/pub_tool_libcproc.h
+++ b/include/pub_tool_libcproc.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_libcsetjmp.h b/include/pub_tool_libcsetjmp.h
index e9638c3d04..97c509ca10 100644
--- a/include/pub_tool_libcsetjmp.h
+++ b/include/pub_tool_libcsetjmp.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_libcsignal.h b/include/pub_tool_libcsignal.h
index 8a772dec6a..abae53c113 100644
--- a/include/pub_tool_libcsignal.h
+++ b/include/pub_tool_libcsignal.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_machine.h b/include/pub_tool_machine.h
index 933dc8e12a..c3d55efcba 100644
--- a/include/pub_tool_machine.h
+++ b/include/pub_tool_machine.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_mallocfree.h b/include/pub_tool_mallocfree.h
index ef7096edee..7861ffa7a9 100644
--- a/include/pub_tool_mallocfree.h
+++ b/include/pub_tool_mallocfree.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_options.h b/include/pub_tool_options.h
index fec61e30fe..809fe0eb6b 100644
--- a/include/pub_tool_options.h
+++ b/include/pub_tool_options.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -419,6 +419,11 @@ extern Bool VG_(clo_keep_debuginfo);
/* Track open file descriptors? 0 = No, 1 = Yes, 2 = All (including std) */
extern UInt VG_(clo_track_fds);
+/* Whether to adjust file descriptor numbers. Yes does for all nonstd file
+ descriptors. High does for all file descriptors. */
+#define VG_MODIFY_FD_NO 0
+#define VG_MODIFY_FD_YES 1
+#define VG_MODIFY_FD_HIGH 2
extern UInt VG_(clo_modify_fds);
diff --git a/include/pub_tool_oset.h b/include/pub_tool_oset.h
index 3465396127..311df204d2 100644
--- a/include/pub_tool_oset.h
+++ b/include/pub_tool_oset.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_poolalloc.h b/include/pub_tool_poolalloc.h
index b4dd3a67c4..60bb575a6a 100644
--- a/include/pub_tool_poolalloc.h
+++ b/include/pub_tool_poolalloc.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_rangemap.h b/include/pub_tool_rangemap.h
index 02e125147d..f6bed2691f 100644
--- a/include/pub_tool_rangemap.h
+++ b/include/pub_tool_rangemap.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_redir.h b/include/pub_tool_redir.h
index 788db21293..c19fd3d97e 100644
--- a/include/pub_tool_redir.h
+++ b/include/pub_tool_redir.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_replacemalloc.h b/include/pub_tool_replacemalloc.h
index 914f9a823c..a118f18679 100644
--- a/include/pub_tool_replacemalloc.h
+++ b/include/pub_tool_replacemalloc.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_seqmatch.h b/include/pub_tool_seqmatch.h
index d3302ddb7c..a4204d1a40 100644
--- a/include/pub_tool_seqmatch.h
+++ b/include/pub_tool_seqmatch.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_signals.h b/include/pub_tool_signals.h
index f037cd5d7e..a6447dc3f9 100644
--- a/include/pub_tool_signals.h
+++ b/include/pub_tool_signals.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_sparsewa.h b/include/pub_tool_sparsewa.h
index c5b336bdae..108cf14038 100644
--- a/include/pub_tool_sparsewa.h
+++ b/include/pub_tool_sparsewa.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_stacktrace.h b/include/pub_tool_stacktrace.h
index cad840e1df..272e43abec 100644
--- a/include/pub_tool_stacktrace.h
+++ b/include/pub_tool_stacktrace.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_threadstate.h b/include/pub_tool_threadstate.h
index 0bf116e2b9..437e488d4e 100644
--- a/include/pub_tool_threadstate.h
+++ b/include/pub_tool_threadstate.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h
index 6b361ef8b6..01cefa6f08 100644
--- a/include/pub_tool_tooliface.h
+++ b/include/pub_tool_tooliface.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_transtab.h b/include/pub_tool_transtab.h
index 05a9fe5a3a..91f5709406 100644
--- a/include/pub_tool_transtab.h
+++ b/include/pub_tool_transtab.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_vki.h b/include/pub_tool_vki.h
index 7b6e71e11e..9ca5195dd8 100644
--- a/include/pub_tool_vki.h
+++ b/include/pub_tool_vki.h
@@ -17,7 +17,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_vkiscnums.h b/include/pub_tool_vkiscnums.h
index df766ecab9..641d11f9ef 100644
--- a/include/pub_tool_vkiscnums.h
+++ b/include/pub_tool_vkiscnums.h
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_vkiscnums_asm.h b/include/pub_tool_vkiscnums_asm.h
index e7aa879762..b5f61d41de 100644
--- a/include/pub_tool_vkiscnums_asm.h
+++ b/include/pub_tool_vkiscnums_asm.h
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_wordfm.h b/include/pub_tool_wordfm.h
index bbfaf18b51..371bba7a45 100644
--- a/include/pub_tool_wordfm.h
+++ b/include/pub_tool_wordfm.h
@@ -33,7 +33,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_xarray.h b/include/pub_tool_xarray.h
index becb879466..35ab20632c 100644
--- a/include/pub_tool_xarray.h
+++ b/include/pub_tool_xarray.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_xtmemory.h b/include/pub_tool_xtmemory.h
index e51b221c0d..bab6376d83 100644
--- a/include/pub_tool_xtmemory.h
+++ b/include/pub_tool_xtmemory.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/pub_tool_xtree.h b/include/pub_tool_xtree.h
index de2d31ef12..3593080bd7 100644
--- a/include/pub_tool_xtree.h
+++ b/include/pub_tool_xtree.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/valgrind.h.in b/include/valgrind.h.in
index f1710924aa..24a6599985 100644
--- a/include/valgrind.h.in
+++ b/include/valgrind.h.in
@@ -3,7 +3,7 @@
Notice that the following BSD-style license applies to this one
file (valgrind.h) only. The rest of Valgrind is licensed under the
- terms of the GNU General Public License, version 2, unless
+ terms of the GNU General Public License, version 3, unless
otherwise indicated. See the COPYING file in the source
distribution for details.
@@ -49,7 +49,7 @@
Notice that the above BSD-style license applies to this one file
(valgrind.h) only. The entire rest of Valgrind is licensed under
- the terms of the GNU General Public License, version 2. See the
+ the terms of the GNU General Public License, version 3. See the
COPYING file in the source distribution for details.
----------------------------------------------------------------
diff --git a/include/vki/vki-amd64-freebsd.h b/include/vki/vki-amd64-freebsd.h
index 44f4ce8c95..7db0e756d5 100644
--- a/include/vki/vki-amd64-freebsd.h
+++ b/include/vki/vki-amd64-freebsd.h
@@ -9,7 +9,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-amd64-linux.h b/include/vki/vki-amd64-linux.h
index 12cd65ac7c..53cc2c2520 100644
--- a/include/vki/vki-amd64-linux.h
+++ b/include/vki/vki-amd64-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -236,6 +236,7 @@ struct vki_sigcontext {
#define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */
#define VKI_MAP_32BIT 0x40 /* only give out 32bit addresses */
#define VKI_MAP_NORESERVE 0x4000 /* don't check for reservations */
+#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */
//----------------------------------------------------------------------
// From linux-2.6.9/include/asm-x86_64/fcntl.h
diff --git a/include/vki/vki-arm-linux.h b/include/vki/vki-arm-linux.h
index 7e0001c0cf..2d1a6adbbd 100644
--- a/include/vki/vki-arm-linux.h
+++ b/include/vki/vki-arm-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -233,6 +233,7 @@ struct vki_sigcontext {
#define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */
#define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */
#define VKI_MAP_NORESERVE 0x4000 /* don't check for reservations */
+#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */
//----------------------------------------------------------------------
// From linux-2.6.8.1/include/asm-i386/fcntl.h
diff --git a/include/vki/vki-arm64-freebsd.h b/include/vki/vki-arm64-freebsd.h
index e535fe7fee..406b0d87ca 100644
--- a/include/vki/vki-arm64-freebsd.h
+++ b/include/vki/vki-arm64-freebsd.h
@@ -7,7 +7,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-arm64-linux.h b/include/vki/vki-arm64-linux.h
index 2fc97e614f..f2de1aca00 100644
--- a/include/vki/vki-arm64-linux.h
+++ b/include/vki/vki-arm64-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -215,6 +215,7 @@ struct vki_sigcontext {
#define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */
#define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */
#define VKI_MAP_NORESERVE 0x4000 /* don't check for reservations */
+#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */
//----------------------------------------------------------------------
// From linux-3.10.5/uapi/include/asm-generic/fcntl.h
diff --git a/include/vki/vki-darwin.h b/include/vki/vki-darwin.h
index f7fcac60c6..93433d4f0b 100644
--- a/include/vki/vki-darwin.h
+++ b/include/vki/vki-darwin.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h
index 2539979995..b5c7c84bc9 100644
--- a/include/vki/vki-freebsd.h
+++ b/include/vki/vki-freebsd.h
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1526,6 +1526,7 @@ typedef enum vki_idtype {
#define VKI_MAP_STACK 0x400
#define VKI_MAP_ANON 0x1000 /* don't use a file */
#define VKI_MAP_ANONYMOUS VKI_MAP_ANON
+#define VKI_MAP_GUARD 0x00002000
#define VKI_MAP_ALIGNED(n) ((n) << VKI_MAP_ALIGNMENT_SHIFT)
#define VKI_MAP_ALIGNMENT_SHIFT 24
@@ -1857,12 +1858,19 @@ struct vki_ptrace_vm_entry {
#define VKI_I386_GET_GSBASE 9
#define VKI_I386_SET_GSBASE 10
#define VKI_I386_GET_XFPUSTATE 11
+#define VKI_I386_SET_PKRU 12
+#define VKI_I386_CLEAR_PKRU 13
#define VKI_AMD64_GET_FSBASE 128
#define VKI_AMD64_SET_FSBASE 129
#define VKI_AMD64_GET_GSBASE 130
#define VKI_AMD64_SET_GSBASE 131
-#define VKI_AMD64_GET_XFPUSTATE 132
+#define VKI_AMD64_GET_XFPUSTATE 132
+#define VKI_AMD64_SET_PKRU 133
+#define VKI_AMD64_CLEAR_PKRU 134
+#define VKI_AMD64_GET_TLSBASE 135
+#define VKI_AMD64_SET_TLSBASE 136
+
//----------------------------------------------------------------------
// From sys/module.h
@@ -2221,10 +2229,12 @@ struct vki_kinfo_file {
//----------------------------------------------------------------------
// From sys/kenv.h
//----------------------------------------------------------------------
-#define VKI_KENV_GET 0
-#define VKI_KENV_SET 1
-#define VKI_KENV_UNSET 2
-#define VKI_KENV_DUMP 3
+#define VKI_KENV_GET 0
+#define VKI_KENV_SET 1
+#define VKI_KENV_UNSET 2
+#define VKI_KENV_DUMP 3
+#define VKI_KENV_DUMP_LOADER 4
+#define VKI_KENV_DUMP_STATIC 5
//----------------------------------------------------------------------
// From sys/sysctl.h (and related)
@@ -2458,6 +2468,10 @@ struct vki_ps_strings {
/* added in FreeBSD 14 */
#define VKI_AT_USRSTACKBASE 35
#define VKI_AT_USRSTACKLIM 36
+/* added in FreeBSD 15 */
+#define AT_CHERI_STATS 37
+#define AT_HWCAP3 38
+#define AT_HWCAP4 39
/* AT_COUNT depends on the FreeBSD version, not currently used */
@@ -3258,7 +3272,7 @@ union vki_ccb {
#define VKI_CAMIOCOMMAND _VKI_IOWR(VKI_CAM_VERSION, 2, union vki_ccb)
//----------------------------------------------------------------------
-// From cam/scsi/scsi_all.h
+// From sys/ucred,h
//----------------------------------------------------------------------
struct vki_setcred {
vki_uid_t sc_uid; /* effective user id */
diff --git a/include/vki/vki-linux-io_uring.h b/include/vki/vki-linux-io_uring.h
index 5059c3010a..31dc63f019 100644
--- a/include/vki/vki-linux-io_uring.h
+++ b/include/vki/vki-linux-io_uring.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-linux-landlock.h b/include/vki/vki-linux-landlock.h
index e549ae93ef..5f70ecb4cd 100644
--- a/include/vki/vki-linux-landlock.h
+++ b/include/vki/vki-linux-landlock.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index 29e62ce863..3f9272f4d1 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -171,6 +171,25 @@ typedef struct {
typedef int __vki_kernel_key_t;
typedef int __vki_kernel_mqd_t;
+//----------------------------------------------------------------------
+// From pre-git history /include/linux/types.h
+//----------------------------------------------------------------------
+
+struct vki_ustat {
+#if defined(VGA_mips32) || defined(VGA_mips64) || defined(VGA_nanomips)
+ long f_tfree;
+#else
+ int f_tfree;
+#endif
+#if defined(VGA_s390x)
+ unsigned int f_tinode;
+#else
+ unsigned long f_tinode;
+#endif
+ char f_fname[6];
+ char f_fpack[6];
+};
+
//----------------------------------------------------------------------
// From linux-2.6.8.1/include/linux/types.h
//----------------------------------------------------------------------
@@ -1396,6 +1415,19 @@ struct vki_robust_list_head {
struct vki_robust_list __user *list_op_pending;
};
+/* Introduced in linux commit bf69bad38cf63d980e8a603f8d1bd1f85b5ed3d9 */
+struct vki_futex_waitv {
+ __vki_u64 val;
+ __vki_u64 uaddr;
+ __vki_u32 flags;
+ __vki_u32 __reserved;
+};
+
+struct vki__kernel_timespec {
+ long long tv_sec;
+ long long tv_nsec;
+};
+
//----------------------------------------------------------------------
// From linux-2.6.8.1/include/linux/errno.h
//----------------------------------------------------------------------
@@ -1514,6 +1546,7 @@ struct vki_dirent64 {
#define VKI_F_SETLEASE (VKI_F_LINUX_SPECIFIC_BASE + 0)
#define VKI_F_GETLEASE (VKI_F_LINUX_SPECIFIC_BASE + 1)
+#define VKI_F_CREATED_QUERY (VKI_F_LINUX_SPECIFIC_BASE + 4)
#define VKI_F_CANCELLK (VKI_F_LINUX_SPECIFIC_BASE + 5)
#define VKI_F_DUPFD_CLOEXEC (VKI_F_LINUX_SPECIFIC_BASE + 6)
@@ -3203,6 +3236,8 @@ struct vki_perf_event_attr {
#define VKI_PERF_EVENT_IOC_ID _VKI_IOR('$', 7, __vki_u64 *)
#define VKI_PERF_EVENT_IOC_SET_BPF _VKI_IOW('$', 8, __vki_u32)
+#define VKI_PERF_FLAG_FD_NO_GROUP (1UL << 0)
+
/*--------------------------------------------------------------------*/
// From linux-2.6.32.4/include/linux/getcpu.h
/*--------------------------------------------------------------------*/
@@ -5478,6 +5513,19 @@ struct vki_open_how {
#define VKI_CLOSE_RANGE_UNSHARE (1U << 1)
#define VKI_CLOSE_RANGE_CLOEXEC (1U << 2)
+struct vki_cachestat_range {
+ __vki_u64 off;
+ __vki_u64 len;
+};
+
+struct vki_cachestat {
+ __vki_u64 nr_cache;
+ __vki_u64 nr_dirty;
+ __vki_u64 nr_writeback;
+ __vki_u64 nr_evicted;
+ __vki_u64 nr_recently_evicted;
+};
+
//----------------------------------------------------------------------
// From linux/magic.h
//----------------------------------------------------------------------
@@ -5489,6 +5537,43 @@ struct vki__aio_sigset {
vki_size_t sigsetsize;
};
+//----------------------------------------------------------------------
+// From uapi/linux/mount.h
+//----------------------------------------------------------------------
+
+struct vki_mnt_id_req {
+ __vki_u32 size;
+ __vki_u32 spare;
+ __vki_u64 mnt_id;
+ __vki_u64 param;
+ __vki_u64 mnt_ns_id;
+};
+
+struct vki_statmount {
+ __vki_u32 size; /* Total size, including strings */
+ __vki_u32 mnt_opts; /* [str] Mount options of the mount */
+ __vki_u64 mask; /* What results were written */
+ __vki_u32 sb_dev_major; /* Device ID */
+ __vki_u32 sb_dev_minor;
+ __vki_u64 sb_magic; /* ..._SUPER_MAGIC */
+ __vki_u32 sb_flags; /* SB_{RDONLY,SYNCHRONOUS,DIRSYNC,LAZYTIME} */
+ __vki_u32 fs_type; /* [str] Filesystem type */
+ __vki_u64 mnt_id; /* Unique ID of mount */
+ __vki_u64 mnt_parent_id; /* Unique ID of parent (for root == mnt_id) */
+ __vki_u32 mnt_id_old; /* Reused IDs used in proc/.../mountinfo */
+ __vki_u32 mnt_parent_id_old;
+ __vki_u64 mnt_attr; /* MOUNT_ATTR_... */
+ __vki_u64 mnt_propagation; /* MS_{SHARED,SLAVE,PRIVATE,UNBINDABLE} */
+ __vki_u64 mnt_peer_group; /* ID of shared peer group */
+ __vki_u64 mnt_master; /* Mount receives propagation from this ID */
+ __vki_u64 propagate_from; /* Propagation from in current namespace */
+ __vki_u32 mnt_root; /* [str] Root of mount relative to root of fs */
+ __vki_u32 mnt_point; /* [str] Mountpoint relative to current root */
+ __vki_u64 mnt_ns_id; /* ID of the mount namespace */
+ __vki_u64 __spare2[49];
+ char str[]; /* Variable size part containing strings */
+};
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
diff --git a/include/vki/vki-machine-types-amd64-freebsd.h b/include/vki/vki-machine-types-amd64-freebsd.h
index 2963f4d86e..e505e05aeb 100644
--- a/include/vki/vki-machine-types-amd64-freebsd.h
+++ b/include/vki/vki-machine-types-amd64-freebsd.h
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-machine-types-arm64-freebsd.h b/include/vki/vki-machine-types-arm64-freebsd.h
index dda1f86d9d..68e5da3601 100644
--- a/include/vki/vki-machine-types-arm64-freebsd.h
+++ b/include/vki/vki-machine-types-arm64-freebsd.h
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-machine-types-x86-freebsd.h b/include/vki/vki-machine-types-x86-freebsd.h
index 70f0a2b3fb..c24adec9c5 100644
--- a/include/vki/vki-machine-types-x86-freebsd.h
+++ b/include/vki/vki-machine-types-x86-freebsd.h
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-mips32-linux.h b/include/vki/vki-mips32-linux.h
index 2d752e2ccb..9cdecbb25f 100644
--- a/include/vki/vki-mips32-linux.h
+++ b/include/vki/vki-mips32-linux.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -300,6 +300,7 @@ struct vki_sigcontext {
#define VKI_MAP_LOCKED 0x8000 /* pages are locked */
#define VKI_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
#define VKI_MAP_NONBLOCK 0x20000 /* do not block on IO */
+#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */
//----------------------------------------------------------------------
diff --git a/include/vki/vki-mips64-linux.h b/include/vki/vki-mips64-linux.h
index 527b0dae63..0b86485691 100644
--- a/include/vki/vki-mips64-linux.h
+++ b/include/vki/vki-mips64-linux.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -306,6 +306,7 @@ struct vki_sigcontext {
#define VKI_MAP_LOCKED 0x8000 /* pages are locked */
#define VKI_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
#define VKI_MAP_NONBLOCK 0x20000 /* do not block on IO */
+#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */
//----------------------------------------------------------------------
// From linux-2.6.35.9/include/asm-mips/fcntl.h
diff --git a/include/vki/vki-nanomips-linux.h b/include/vki/vki-nanomips-linux.h
index 7f4b6d9029..1b2b34c1e1 100644
--- a/include/vki/vki-nanomips-linux.h
+++ b/include/vki/vki-nanomips-linux.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -20,9 +20,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
+ along with this program; if not, see .
The GNU General Public License is contained in the file COPYING.
*/
diff --git a/include/vki/vki-posixtypes-amd64-linux.h b/include/vki/vki-posixtypes-amd64-linux.h
index 60bcd080f3..cb4d8c38bc 100644
--- a/include/vki/vki-posixtypes-amd64-linux.h
+++ b/include/vki/vki-posixtypes-amd64-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-posixtypes-arm-linux.h b/include/vki/vki-posixtypes-arm-linux.h
index 2b1ed9c782..1a56dd9449 100644
--- a/include/vki/vki-posixtypes-arm-linux.h
+++ b/include/vki/vki-posixtypes-arm-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-posixtypes-arm64-linux.h b/include/vki/vki-posixtypes-arm64-linux.h
index 94685f1276..53479d0df1 100644
--- a/include/vki/vki-posixtypes-arm64-linux.h
+++ b/include/vki/vki-posixtypes-arm64-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-posixtypes-mips32-linux.h b/include/vki/vki-posixtypes-mips32-linux.h
index 7f83c314e7..4234a6e3b3 100644
--- a/include/vki/vki-posixtypes-mips32-linux.h
+++ b/include/vki/vki-posixtypes-mips32-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-posixtypes-mips64-linux.h b/include/vki/vki-posixtypes-mips64-linux.h
index 61f476196e..26b741adaa 100644
--- a/include/vki/vki-posixtypes-mips64-linux.h
+++ b/include/vki/vki-posixtypes-mips64-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-posixtypes-nanomips-linux.h b/include/vki/vki-posixtypes-nanomips-linux.h
index b7976ec505..d2f7d831c1 100644
--- a/include/vki/vki-posixtypes-nanomips-linux.h
+++ b/include/vki/vki-posixtypes-nanomips-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -21,9 +21,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
+ along with this program; if not, see .
The GNU General Public License is contained in the file COPYING.
*/
diff --git a/include/vki/vki-posixtypes-ppc32-linux.h b/include/vki/vki-posixtypes-ppc32-linux.h
index db978fa8aa..31d506158c 100644
--- a/include/vki/vki-posixtypes-ppc32-linux.h
+++ b/include/vki/vki-posixtypes-ppc32-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-posixtypes-ppc64-linux.h b/include/vki/vki-posixtypes-ppc64-linux.h
index ae9d352a3b..468fc6c1b5 100644
--- a/include/vki/vki-posixtypes-ppc64-linux.h
+++ b/include/vki/vki-posixtypes-ppc64-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-posixtypes-riscv64-linux.h b/include/vki/vki-posixtypes-riscv64-linux.h
index b8dfc9ce73..b5a15359ad 100644
--- a/include/vki/vki-posixtypes-riscv64-linux.h
+++ b/include/vki/vki-posixtypes-riscv64-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-posixtypes-s390x-linux.h b/include/vki/vki-posixtypes-s390x-linux.h
index 0d0145acf2..f3b42f3646 100644
--- a/include/vki/vki-posixtypes-s390x-linux.h
+++ b/include/vki/vki-posixtypes-s390x-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-posixtypes-x86-linux.h b/include/vki/vki-posixtypes-x86-linux.h
index 2f3b72098e..c21b7c4826 100644
--- a/include/vki/vki-posixtypes-x86-linux.h
+++ b/include/vki/vki-posixtypes-x86-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-ppc32-linux.h b/include/vki/vki-ppc32-linux.h
index 6e6ca00da8..68f6aad394 100644
--- a/include/vki/vki-ppc32-linux.h
+++ b/include/vki/vki-ppc32-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-ppc64-linux.h b/include/vki/vki-ppc64-linux.h
index c557626101..edb8997073 100644
--- a/include/vki/vki-ppc64-linux.h
+++ b/include/vki/vki-ppc64-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-riscv64-linux.h b/include/vki/vki-riscv64-linux.h
index 5cc98b6ab1..a06e8b553a 100644
--- a/include/vki/vki-riscv64-linux.h
+++ b/include/vki/vki-riscv64-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -186,6 +186,7 @@ typedef struct vki_sigaltstack {
//----------------------------------------------------------------------
#define VKI_MAP_NORESERVE 0x4000 /* don't check for reservations */
+#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */
//----------------------------------------------------------------------
// From linux-6.0/include/uapi/linux/mman.h
diff --git a/include/vki/vki-s390x-linux.h b/include/vki/vki-s390x-linux.h
index 726f068a0a..21a25788cc 100644
--- a/include/vki/vki-s390x-linux.h
+++ b/include/vki/vki-s390x-linux.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-scnums-32bit-linux.h b/include/vki/vki-scnums-32bit-linux.h
index f276ddaedd..32259578ba 100644
--- a/include/vki/vki-scnums-32bit-linux.h
+++ b/include/vki/vki-scnums-32bit-linux.h
@@ -5,7 +5,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -45,5 +45,6 @@
#define __NR_rt_sigtimedwait_time64 421
#define __NR_futex_time64 422
#define __NR_sched_rr_get_interval_time64 423
+#define __NR_futex_waitv 449
#endif
diff --git a/include/vki/vki-scnums-amd64-linux.h b/include/vki/vki-scnums-amd64-linux.h
index 65134734a5..4ff66ddd52 100644
--- a/include/vki/vki-scnums-amd64-linux.h
+++ b/include/vki/vki-scnums-amd64-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -414,6 +414,7 @@
#define __NR_statx 332
#define __NR_io_pgetevents 333
#define __NR_rseq 334
+#define __NR_futex_waitv 449
#endif /* __VKI_SCNUMS_AMD64_LINUX_H */
diff --git a/include/vki/vki-scnums-arm-linux.h b/include/vki/vki-scnums-arm-linux.h
index 485db8b265..8aa639b023 100644
--- a/include/vki/vki-scnums-arm-linux.h
+++ b/include/vki/vki-scnums-arm-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -433,6 +433,7 @@
#define __NR_pkey_free 396
#define __NR_statx 397
#define __NR_rseq 398
+#define __NR_futex_waitv 449
diff --git a/include/vki/vki-scnums-arm64-linux.h b/include/vki/vki-scnums-arm64-linux.h
index 08d5690045..57cbc1d0cd 100644
--- a/include/vki/vki-scnums-arm64-linux.h
+++ b/include/vki/vki-scnums-arm64-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -325,6 +325,7 @@
#define __NR_statx 291
#define __NR_io_pgetevents 292
#define __NR_rseq 293
+#define __NR_futex_waitv 449
#undef __NR_syscalls
#define __NR_syscalls 294
diff --git a/include/vki/vki-scnums-darwin.h b/include/vki/vki-scnums-darwin.h
index 8eee21ec44..3a33520780 100644
--- a/include/vki/vki-scnums-darwin.h
+++ b/include/vki/vki-scnums-darwin.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h
index a92abb9a15..924434f3fc 100644
--- a/include/vki/vki-scnums-freebsd.h
+++ b/include/vki/vki-scnums-freebsd.h
@@ -10,7 +10,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -28,6 +28,7 @@
#define VKI_UNISTD_FREEBSD_H
#include "config.h"
+#include
// this is the syscall format used by e.g., libc functions like 'write'
// this is the one used 99.999% of the time
@@ -129,8 +130,16 @@
/* obs vhangup 76 */
/* obs vlimit 77 */
#define __NR_mincore 78
+#if defined(SYS_freebsd14_getgroups)
+#define __NR_freebsd14_getgroups 79
+#else
#define __NR_getgroups 79
+#endif
+#if defined(SYS_freebsd14_setgroups)
+#define __NR_freebsd14_setgroups 80
+#else
#define __NR_setgroups 80
+#endif
#define __NR_getpgrp 81
#define __NR_setpgid 82
#define __NR_setitimer 83
@@ -630,6 +639,20 @@
#define __NR_fchroot 590
#define __NR_setcred 591
+#define __NR_exterrctl 592
+#define __NR_inotify_add_watch_at 593
+#define __NR_inotify_rm_watch 594
+
+#if defined(SYS_freebsd14_getgroups)
+#define __NR_getgroups 595
+#endif
+#if defined(SYS_freebsd14_setgroups)
+#define __NR_setgroups 596
+#endif
+
+#define __NR_jail_attach_jd 597
+#define __NR_jail_remove_jd 598
+
#define __NR_fake_sigreturn 1000
#endif /* VKI_UNISTD_FREEBSD_H */
diff --git a/include/vki/vki-scnums-mips32-linux.h b/include/vki/vki-scnums-mips32-linux.h
index d4f8de15aa..539db119b1 100644
--- a/include/vki/vki-scnums-mips32-linux.h
+++ b/include/vki/vki-scnums-mips32-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -460,6 +460,9 @@
#define __NR_set_mempolicy_home_node (__NR_Linux + 450)
#define __NR_cachestat (__NR_Linux + 451)
#define __NR_fchmodat2 (__NR_Linux + 452)
+#define __NR_statmount (__NR_Linux + 457)
+#define __NR_listmount (__NR_Linux + 458)
+#define __NR_mseal (__NR_Linux + 462)
/*
* Offset of the last Linux o32 flavoured syscall
*/
diff --git a/include/vki/vki-scnums-mips64-linux.h b/include/vki/vki-scnums-mips64-linux.h
index c5291e31c6..a8fb5e2a8f 100644
--- a/include/vki/vki-scnums-mips64-linux.h
+++ b/include/vki/vki-scnums-mips64-linux.h
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -401,6 +401,7 @@
#define __NR_lsm_get_self_attr (__NR_Linux + 459)
#define __NR_lsm_set_self_attr (__NR_Linux + 460)
#define __NR_lsm_list_modules (__NR_Linux + 461)
+#define __NR_mseal (__NR_Linux + 462)
#elif defined(VGABI_N32)
diff --git a/include/vki/vki-scnums-nanomips-linux.h b/include/vki/vki-scnums-nanomips-linux.h
index 2b2d9efa93..792c4318c5 100644
--- a/include/vki/vki-scnums-nanomips-linux.h
+++ b/include/vki/vki-scnums-nanomips-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -21,9 +21,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
+ along with this program; if not, see .
The GNU General Public License is contained in the file COPYING.
*/
diff --git a/include/vki/vki-scnums-ppc32-linux.h b/include/vki/vki-scnums-ppc32-linux.h
index 08fa77df0d..09fb560fe6 100644
--- a/include/vki/vki-scnums-ppc32-linux.h
+++ b/include/vki/vki-scnums-ppc32-linux.h
@@ -4,6 +4,8 @@
/*--- vki-scnums-ppc32-linux.h ---*/
/*--------------------------------------------------------------------*/
+
+
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
@@ -13,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -416,6 +418,7 @@
#define __NR_pkey_free 385
#define __NR_pkey_mprotect 386
#define __NR_rseq 387
+#define __NR_futex_waitv 449
#endif /* __VKI_SCNUMS_PPC32_LINUX_H */
diff --git a/include/vki/vki-scnums-ppc64-linux.h b/include/vki/vki-scnums-ppc64-linux.h
index 6d8b2b508c..5b8e9a3da6 100644
--- a/include/vki/vki-scnums-ppc64-linux.h
+++ b/include/vki/vki-scnums-ppc64-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -409,6 +409,11 @@
#define __NR_pkey_mprotect 386
#define __NR_rseq 387
#define __NR_io_pgetevents 388
+#define __NR_semtimedop 392
+#define __NR_semctl 394
+#define __NR_shmctl 396
+#define __NR_msgctl 402
+#define __NR_futex_waitv 449
#endif /* __VKI_SCNUMS_PPC64_LINUX_H */
diff --git a/include/vki/vki-scnums-riscv64-linux.h b/include/vki/vki-scnums-riscv64-linux.h
index 17b6839f8a..aff49aeef6 100644
--- a/include/vki/vki-scnums-riscv64-linux.h
+++ b/include/vki/vki-scnums-riscv64-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -192,6 +192,7 @@
#define __NR_setgroups 159
#define __NR_uname 160
#define __NR_sethostname 161
+#define __NR_setdomainname 162
#define __NR_getrlimit 163
#define __NR_setrlimit 164
#define __NR_getrusage 165
@@ -253,6 +254,8 @@
#define __NR_execve 221
#define __NR3264_mmap 222
#define __NR3264_fadvise64 223
+#define __NR_swapon 224
+#define __NR_swapoff 225
#define __NR_mprotect 226
#define __NR_msync 227
#define __NR_mlock 228
@@ -261,6 +264,7 @@
#define __NR_munlockall 231
#define __NR_mincore 232
#define __NR_madvise 233
+#define __NR_remap_file_pages 234
#define __NR_mbind 235
#define __NR_get_mempolicy 236
#define __NR_set_mempolicy 237
@@ -308,6 +312,7 @@
#define __NR_close_range 436
#define __NR_faccessat2 439
#define __NR_memfd_secret 447
+#define __NR_futex_waitv 449
#define __NR_fcntl __NR3264_fcntl
#define __NR_statfs __NR3264_statfs
diff --git a/include/vki/vki-scnums-s390x-linux.h b/include/vki/vki-scnums-s390x-linux.h
index efb36b9917..38660e07bc 100644
--- a/include/vki/vki-scnums-s390x-linux.h
+++ b/include/vki/vki-scnums-s390x-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -314,6 +314,7 @@
#define __NR_seccomp 348
#define __NR_getrandom 349
#define __NR_memfd_create 350
+#define __NR_bpf 351
#define __NR_execveat 354
@@ -346,6 +347,11 @@
#define __NR_kexec_file_load 381
#define __NR_io_pgetevents 382
#define __NR_rseq 383
+#define __NR_semtimedop 392
+#define __NR_semctl 394
+#define __NR_shmctl 396
+#define __NR_msgctl 402
+#define __NR_futex_waitv 449
#define NR_syscalls 384
diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h
index 20346ca716..8efba61690 100644
--- a/include/vki/vki-scnums-shared-linux.h
+++ b/include/vki/vki-scnums-shared-linux.h
@@ -9,7 +9,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -48,12 +48,18 @@
#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_quotactl_fd 443
#define __NR_landlock_create_ruleset 444
#define __NR_landlock_add_rule 445
#define __NR_landlock_restrict_self 446
#define __NR_memfd_secret 447
+#define __NR_cachestat 451
#define __NR_fchmodat2 452
+#define __NR_statmount 457
+#define __NR_listmount 458
+#define __NR_mseal 462
#endif
diff --git a/include/vki/vki-scnums-solaris.h b/include/vki/vki-scnums-solaris.h
index 25bde39d84..e4d9bd8bd1 100644
--- a/include/vki/vki-scnums-solaris.h
+++ b/include/vki/vki-scnums-solaris.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-scnums-x86-linux.h b/include/vki/vki-scnums-x86-linux.h
index 5019321d39..b1afff14a6 100644
--- a/include/vki/vki-scnums-x86-linux.h
+++ b/include/vki/vki-scnums-x86-linux.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -429,6 +429,7 @@
#define __NR_msgsnd 400
#define __NR_msgrcv 401
#define __NR_msgctl 402
+#define __NR_futex_waitv 449
#endif /* __VKI_SCNUMS_X86_LINUX_H */
diff --git a/include/vki/vki-solaris-repcache.h b/include/vki/vki-solaris-repcache.h
index acac86f4dd..aeb9983249 100644
--- a/include/vki/vki-solaris-repcache.h
+++ b/include/vki/vki-solaris-repcache.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-solaris.h b/include/vki/vki-solaris.h
index 9c96ed19e1..8d9d687092 100644
--- a/include/vki/vki-solaris.h
+++ b/include/vki/vki-solaris.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -100,6 +100,7 @@ typedef uint32_t vki_u32;
#include
#define VKI_SEEK_SET SEEK_SET
+#define VKI_AT_SYMLINK_NOFOLLOW AT_SYMLINK_NOFOLLOW
#include
diff --git a/include/vki/vki-x86-freebsd.h b/include/vki/vki-x86-freebsd.h
index 60ca1040ba..3a092f87ba 100644
--- a/include/vki/vki-x86-freebsd.h
+++ b/include/vki/vki-x86-freebsd.h
@@ -16,7 +16,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-x86-linux.h b/include/vki/vki-x86-linux.h
index 5a5f9e5d82..e5d365e80c 100644
--- a/include/vki/vki-x86-linux.h
+++ b/include/vki/vki-x86-linux.h
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -271,6 +271,7 @@ struct vki_sigcontext {
#define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */
#define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */
#define VKI_MAP_NORESERVE 0x4000 /* don't check for reservations */
+#define VKI_MAP_FIXED_NOREPLACE 0x100000 /* fail EEXIST if fixed map fails */
//----------------------------------------------------------------------
// From linux-2.6.8.1/include/asm-i386/fcntl.h
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 3a544f556f..c2b5d055fe 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen-evtchn.h b/include/vki/vki-xen-evtchn.h
index a68292f555..f7f70d11fa 100644
--- a/include/vki/vki-xen-evtchn.h
+++ b/include/vki/vki-xen-evtchn.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen-gnttab.h b/include/vki/vki-xen-gnttab.h
index 33e9ba31e9..24ebbb5ffd 100644
--- a/include/vki/vki-xen-gnttab.h
+++ b/include/vki/vki-xen-gnttab.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen-hvm.h b/include/vki/vki-xen-hvm.h
index c6ce0d90b8..6775ed5d66 100644
--- a/include/vki/vki-xen-hvm.h
+++ b/include/vki/vki-xen-hvm.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen-memory.h b/include/vki/vki-xen-memory.h
index f8eccd5624..63384ce931 100644
--- a/include/vki/vki-xen-memory.h
+++ b/include/vki/vki-xen-memory.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen-mmuext.h b/include/vki/vki-xen-mmuext.h
index b0634afbb1..34922a7e5a 100644
--- a/include/vki/vki-xen-mmuext.h
+++ b/include/vki/vki-xen-mmuext.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen-physdev.h b/include/vki/vki-xen-physdev.h
index 807aeac5a2..1c82317164 100644
--- a/include/vki/vki-xen-physdev.h
+++ b/include/vki/vki-xen-physdev.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen-schedop.h b/include/vki/vki-xen-schedop.h
index 49ee30a6b1..35cfd1fbbf 100644
--- a/include/vki/vki-xen-schedop.h
+++ b/include/vki/vki-xen-schedop.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen-tmem.h b/include/vki/vki-xen-tmem.h
index ef3f72e5aa..898e185b20 100644
--- a/include/vki/vki-xen-tmem.h
+++ b/include/vki/vki-xen-tmem.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen-version.h b/include/vki/vki-xen-version.h
index e65b6d5098..57d28335d3 100644
--- a/include/vki/vki-xen-version.h
+++ b/include/vki/vki-xen-version.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen-x86.h b/include/vki/vki-xen-x86.h
index de654af478..55720501cd 100644
--- a/include/vki/vki-xen-x86.h
+++ b/include/vki/vki-xen-x86.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen-xsm.h b/include/vki/vki-xen-xsm.h
index ae30b24f59..520284d5a8 100644
--- a/include/vki/vki-xen-xsm.h
+++ b/include/vki/vki-xen-xsm.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/include/vki/vki-xen.h b/include/vki/vki-xen.h
index 2c91b4a209..3316f4cb7b 100644
--- a/include/vki/vki-xen.h
+++ b/include/vki/vki-xen.h
@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/lackey/lk_main.c b/lackey/lk_main.c
index 4d5e1e6924..ec4d8a7b5d 100644
--- a/lackey/lk_main.c
+++ b/lackey/lk_main.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/massif/ms_main.c b/massif/ms_main.c
index 0aed0890d2..94eca658ea 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -11,7 +11,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/massif/ms_print.in b/massif/ms_print.in
old mode 100755
new mode 100644
index a206ce4d62..ecd9f383ee
--- a/massif/ms_print.in
+++ b/massif/ms_print.in
@@ -12,7 +12,7 @@
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
+# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -75,7 +75,7 @@ usage: ms_print [options] massif-out-file
--y=<4..1000> graph height, in rows [20]
ms_print is Copyright (C) 2007-2017 Nicholas Nethercote.
- and licensed under the GNU General Public License, version 2.
+ and licensed under the GNU General Public License, version 3.
Bug reports, feedback, admiration, abuse, etc, to: njn\@valgrind.org.
END
diff --git a/massif/tests/Makefile.am b/massif/tests/Makefile.am
index ab781fa933..5992039c43 100644
--- a/massif/tests/Makefile.am
+++ b/massif/tests/Makefile.am
@@ -98,7 +98,7 @@ bug469146_CXXFLAGS = $(AM_CXXFLAGS) -O2 -fno-optimize-sibling-calls @FLAG_W_NO_U
new_cpp_SOURCES = new-cpp.cpp
overloaded_new_SOURCES = overloaded-new.cpp
# aligned new needs C++17
-overloaded_new_CXXFLAGS = $(AM_CXXFLAGS) -Wno-implicit-exception-spec-mismatch -Wno-missing-exception-spec -std=c++17
+overloaded_new_CXXFLAGS = $(AM_CXXFLAGS) @FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH@ @FLAG_W_NO_MISSING_EXCEPTION_SPEC@ @FLAG_W_NO_ATTRIBUTES@ -std=c++17
# Suppress warnings for issues we are testing for
alloc_fns_CFLAGS = $(AM_CFLAGS) -Wno-unused-result
@@ -109,6 +109,7 @@ deep_CFLAGS = $(AM_CFLAGS) -Wno-unused-result
ignoring_CFLAGS = $(AM_CFLAGS) -Wno-unused-result
insig_CFLAGS = $(AM_CFLAGS) -Wno-unused-result
long_names_CFLAGS = $(AM_CFLAGS) -Wno-unused-result
+malloc_usable_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@
one_CFLAGS = $(AM_CFLAGS) -Wno-unused-result
thresholds_CFLAGS = $(AM_CFLAGS) -Wno-unused-result
realloc_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_FREE_NONHEAP_OBJECT@
diff --git a/massif/tests/overloaded-new.cpp b/massif/tests/overloaded-new.cpp
index 5ad92894e9..edea12b742 100644
--- a/massif/tests/overloaded-new.cpp
+++ b/massif/tests/overloaded-new.cpp
@@ -19,7 +19,7 @@ __attribute__((noinline)) void* operator new (std::size_t n)
return (void*)12345;
}
-__attribute__((noinline)) void* operator new (std::size_t n, std::nothrow_t const &)
+__attribute__((noinline)) void* operator new (std::size_t n, std::nothrow_t const &) noexcept
{
return (void*)23456;
}
@@ -29,7 +29,7 @@ __attribute__((noinline)) void* operator new[] (std::size_t n)
return (void*)34567;
}
-__attribute__((noinline)) void* operator new[] (std::size_t n, std::nothrow_t const &)
+__attribute__((noinline)) void* operator new[] (std::size_t n, std::nothrow_t const &) noexcept
{
return (void*)45678;
}
@@ -54,12 +54,12 @@ __attribute__((noinline)) void* operator new[](std::size_t size, std::align_val_
return (void*)89012;
}
-__attribute__((noinline)) void operator delete (void* p)
+__attribute__((noinline)) void operator delete (void* p) noexcept
{
}
-__attribute__((noinline)) void operator delete[] (void* p)
+__attribute__((noinline)) void operator delete[] (void* p) noexcept
{
}
diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c
index a708b3f852..8dbeb15abc 100644
--- a/memcheck/mc_errors.c
+++ b/memcheck/mc_errors.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -77,7 +77,7 @@ typedef
Err_FishyValue,
Err_ReallocSizeZero,
Err_BadAlign,
- Err_BadSize,
+ Err_UnsafeZeroSize,
Err_SizeMismatch,
Err_AlignMismatch,
}
@@ -177,9 +177,7 @@ struct _MC_Error {
struct {
AddrInfo ai;
- SizeT size;
- const HChar *func;
- } BadSize;
+ } UnsafeZeroSize;
// Call to strcpy, memcpy, etc, with overlapping blocks.
struct {
@@ -799,15 +797,13 @@ void MC_(pp_Error) ( const Error* err )
}
break;
- case Err_BadSize:
+ case Err_UnsafeZeroSize:
if (xml) {
emit( " InvalidSize\n" );
- emit( " %s invalid size value: %lu\n",
- extra->Err.BadSize.func, extra->Err.BadSize.size );
+ emit( " Unsafe allocation with size of zero is implementation-defined\n");
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
} else {
- emit( "%s invalid size value: %lu\n",
- extra->Err.BadSize.func, extra->Err.BadSize.size );
+ emit( "Unsafe allocation with size of zero is implementation-defined\n");
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
}
break;
@@ -1028,13 +1024,10 @@ void MC_(record_bad_alignment) ( ThreadId tid, SizeT align, SizeT size, const HC
VG_(maybe_record_error)( tid, Err_BadAlign, /*addr*/0, /*s*/NULL, &extra );
}
-void MC_(record_bad_size) ( ThreadId tid, SizeT size, const HChar *function )
+void MC_(record_unsafe_zero_size) ( ThreadId tid )
{
- MC_Error extra;
tl_assert(VG_INVALID_THREADID != tid);
- extra.Err.BadSize.size= size;
- extra.Err.BadSize.func = function;
- VG_(maybe_record_error)( tid, Err_BadSize, /*addr*/0, /*s*/NULL, &extra );
+ VG_(maybe_record_error)( tid, Err_UnsafeZeroSize, /*addr*/0, /*s*/NULL, /*extra*/NULL );
}
void MC_(record_illegal_mempool_error) ( ThreadId tid, Addr a )
@@ -1222,6 +1215,7 @@ Bool MC_(eq_Error) ( VgRes res, const Error* e1, const Error* e2 )
case Err_Overlap:
case Err_Cond:
case Err_ReallocSizeZero:
+ case Err_UnsafeZeroSize:
return True;
case Err_FishyValue:
@@ -1253,11 +1247,6 @@ Bool MC_(eq_Error) ( VgRes res, const Error* e1, const Error* e2 )
extra2->Err.BadAlign.dealloc_align;
}
- case Err_BadSize:
- // sized delete mismatch
- return extra1->Err.BadSize.size ==
- extra2->Err.BadSize.size;
-
case Err_SizeMismatch:
return extra1->Err.SizeMismatch.size ==
extra2->Err.SizeMismatch.size;
@@ -1418,7 +1407,7 @@ UInt MC_(update_Error_extra)( const Error* err )
// we make it consistent with the others.
case Err_Leak:
case Err_BadAlign:
- case Err_BadSize:
+ case Err_UnsafeZeroSize:
case Err_SizeMismatch:
case Err_AlignMismatch:
return sizeof(MC_Error);
@@ -1578,10 +1567,10 @@ typedef
MempoolSupp, // Memory pool suppression.
FishyValueSupp, // Fishy value suppression.
ReallocSizeZeroSupp, // realloc size 0 suppression
- BadAlignSupp, // Alignment not 2
- BadSizeSupp, // aligned alloc with size 0
- SizeMismatch, // Sized deallocation did not match allocation size
- AlignMismatch, // Aligned deallocation did not match aligned allocation
+ BadAlignSupp, // Alignment not 2
+ UnsafeZeroSizeSupp, // aligned alloc with size 0
+ SizeMismatch, // Sized deallocation did not match allocation size
+ AlignMismatch, // Aligned deallocation did not match aligned allocation
}
MC_SuppKind;
@@ -1614,7 +1603,8 @@ Bool MC_(is_recognised_suppression) ( const HChar* name, Supp* su )
else if (VG_STREQ(name, "FishyValue")) skind = FishyValueSupp;
else if (VG_STREQ(name, "ReallocZero")) skind = ReallocSizeZeroSupp;
else if (VG_STREQ(name, "BadAlign")) skind = BadAlignSupp;
- else if (VG_STREQ(name, "BadSize")) skind = BadSizeSupp;
+ else if (VG_STREQ(name, "BadSize") || // old name for error before it got downgraded
+ VG_STREQ(name, "UnsafeZeroSize")) skind = UnsafeZeroSizeSupp;
else if (VG_STREQ(name, "SizeMismatch")) skind = SizeMismatch;
else if (VG_STREQ(name, "AlignMismatch")) skind = AlignMismatch;
else
@@ -1800,8 +1790,8 @@ Bool MC_(error_matches_suppression) ( const Error* err, const Supp* su )
case BadAlignSupp:
return (ekind == Err_BadAlign);
- case BadSizeSupp:
- return (ekind == Err_BadSize);
+ case UnsafeZeroSizeSupp:
+ return (ekind == Err_UnsafeZeroSize);
case SizeMismatch:
return (ekind == Err_SizeMismatch);
@@ -1835,7 +1825,7 @@ const HChar* MC_(get_error_name) ( const Error* err )
case Err_FishyValue: return "FishyValue";
case Err_ReallocSizeZero: return "ReallocZero";
case Err_BadAlign: return "BadAlign";
- case Err_BadSize: return "BadSize";
+ case Err_UnsafeZeroSize: return "UnsafeZeroSize";
case Err_SizeMismatch: return "SizeMismatch";
case Err_AlignMismatch: return "AlignMismatch";
case Err_Addr: {
diff --git a/memcheck/mc_include.h b/memcheck/mc_include.h
index acc595a745..c00b7d75f5 100644
--- a/memcheck/mc_include.h
+++ b/memcheck/mc_include.h
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -559,7 +559,7 @@ void MC_(record_illegal_mempool_error) ( ThreadId tid, Addr a );
void MC_(record_freemismatch_error) ( ThreadId tid, MC_Chunk* mc );
void MC_(record_realloc_size_zero) ( ThreadId tid, Addr a );
void MC_(record_bad_alignment) ( ThreadId tid, SizeT align, SizeT size, const HChar *msg);
-void MC_(record_bad_size) ( ThreadId tid, SizeT align, const HChar *function);
+void MC_(record_unsafe_zero_size) ( ThreadId tid);
void MC_(record_overlap_error) ( ThreadId tid, const HChar* function,
Addr src, Addr dst, SizeT szB );
diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c
index 83a2b74e2a..586bff448b 100644
--- a/memcheck/mc_leakcheck.c
+++ b/memcheck/mc_leakcheck.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1722,7 +1722,9 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp)
VG_(XT_delete)(leak_xt);
}
- if (VG_(clo_verbosity) > 0 && !VG_(clo_xml)) {
+ UInt (*umsg_or_xml)( const HChar *, ... )
+ = VG_(clo_xml) ? VG_(printf_xml) : VG_(umsg);
+ if (VG_(clo_verbosity) > 0) {
HChar d_bytes[31];
HChar d_blocks[31];
# define DBY(new,old) \
@@ -1732,23 +1734,42 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp)
MC_(snprintf_delta) (d_blocks, sizeof(d_blocks), (new), (old), \
lcp->deltamode)
- VG_(umsg)("LEAK SUMMARY:\n");
- VG_(umsg)(" definitely lost: %'lu%s bytes in %'lu%s blocks\n",
+ umsg_or_xml(VG_(clo_xml) ? "\n" : "LEAK SUMMARY:\n");
+ umsg_or_xml(VG_(clo_xml) ?
+ " \n"
+ " %'lu%s\n"
+ " %'lu%s\n"
+ " \n" :
+ " definitely lost: %'lu%s bytes in %'lu%s blocks\n",
MC_(bytes_leaked),
DBY (MC_(bytes_leaked), old_bytes_leaked),
MC_(blocks_leaked),
DBL (MC_(blocks_leaked), old_blocks_leaked));
- VG_(umsg)(" indirectly lost: %'lu%s bytes in %'lu%s blocks\n",
+ umsg_or_xml(VG_(clo_xml) ?
+ " \n"
+ " %'lu%s\n"
+ " %'lu%s\n"
+ " \n" :
+ " indirectly lost: %'lu%s bytes in %'lu%s blocks\n",
MC_(bytes_indirect),
DBY (MC_(bytes_indirect), old_bytes_indirect),
MC_(blocks_indirect),
DBL (MC_(blocks_indirect), old_blocks_indirect));
- VG_(umsg)(" possibly lost: %'lu%s bytes in %'lu%s blocks\n",
+ umsg_or_xml(VG_(clo_xml) ?
+ " \n"
+ " %'lu%s\n"
+ " %'lu%s\n"
+ " \n" :
+ " possibly lost: %'lu%s bytes in %'lu%s blocks\n",
MC_(bytes_dubious),
DBY (MC_(bytes_dubious), old_bytes_dubious),
MC_(blocks_dubious),
DBL (MC_(blocks_dubious), old_blocks_dubious));
- VG_(umsg)(" still reachable: %'lu%s bytes in %'lu%s blocks\n",
+ umsg_or_xml(VG_(clo_xml) ?
+ " \n"
+ " %'lu%s\n"
+ " %'lu%s\n" :
+ " still reachable: %'lu%s bytes in %'lu%s blocks\n",
MC_(bytes_reachable),
DBY (MC_(bytes_reachable), old_bytes_reachable),
MC_(blocks_reachable),
@@ -1756,15 +1777,21 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp)
for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++)
if (old_blocks_heuristically_reachable[i] > 0
|| MC_(blocks_heuristically_reachable)[i] > 0) {
- VG_(umsg)(" of which "
+ umsg_or_xml(VG_(clo_xml) ? "" : " of which "
"reachable via heuristic:\n");
break;
}
for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++)
if (old_blocks_heuristically_reachable[i] > 0
|| MC_(blocks_heuristically_reachable)[i] > 0)
- VG_(umsg)(" %-19s: "
- "%'lu%s bytes in %'lu%s blocks\n",
+ umsg_or_xml(VG_(clo_xml) ?
+ " \n"
+ " %ls\n"
+ " %'lu%s\n"
+ " %'lu%s\n"
+ " \n" :
+ " %-19s: "
+ "%'lu%s bytes in %'lu%s blocks\n",
pp_heuristic(i),
MC_(bytes_heuristically_reachable)[i],
DBY (MC_(bytes_heuristically_reachable)[i],
@@ -1772,32 +1799,41 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp)
MC_(blocks_heuristically_reachable)[i],
DBL (MC_(blocks_heuristically_reachable)[i],
old_blocks_heuristically_reachable[i]));
- VG_(umsg)(" suppressed: %'lu%s bytes in %'lu%s blocks\n",
- MC_(bytes_suppressed),
- DBY (MC_(bytes_suppressed), old_bytes_suppressed),
+ if (VG_(clo_xml) && MC_(bytes_reachable)) {
+ umsg_or_xml(" \n");
+ }
+ umsg_or_xml(VG_(clo_xml) ?
+ " \n"
+ " %'lu%s\n"
+ " %'lu%s\n"
+ " \n" :
+ " suppressed: %'lu%s bytes in %'lu%s blocks\n",
+ MC_(bytes_suppressed),
+ DBY (MC_(bytes_suppressed), old_bytes_suppressed),
MC_(blocks_suppressed),
DBL (MC_(blocks_suppressed), old_blocks_suppressed));
if (lcp->mode != LC_Full &&
(MC_(blocks_leaked) + MC_(blocks_indirect) +
MC_(blocks_dubious) + MC_(blocks_reachable)) > 0) {
if (lcp->requested_by_monitor_command)
- VG_(umsg)("To see details of leaked memory, "
- "give 'full' arg to leak_check\n");
+ umsg_or_xml(VG_(clo_xml) ? "" : "To see details of leaked memory, "
+ "give 'full' arg to leak_check\n");
else
- VG_(umsg)("Rerun with --leak-check=full to see details "
- "of leaked memory\n");
+ umsg_or_xml(VG_(clo_xml) ? "" : "Rerun with --leak-check=full to "
+ "see details of leaked memory\n");
}
if (lcp->mode == LC_Full &&
MC_(blocks_reachable) > 0 && !RiS(Reachable,lcp->show_leak_kinds)) {
- VG_(umsg)("Reachable blocks (those to which a pointer "
- "was found) are not shown.\n");
+ umsg_or_xml(VG_(clo_xml) ? "" : "Reachable blocks (those to which a "
+ "pointer was found) are not shown.\n");
if (lcp->requested_by_monitor_command)
- VG_(umsg)("To see them, add 'reachable any' args to leak_check\n");
+ umsg_or_xml(VG_(clo_xml) ? "" : "To see them, add 'reachable any' "
+ "args to leak_check\n");
else
- VG_(umsg)("To see them, rerun with: --leak-check=full "
- "--show-leak-kinds=all\n");
+ umsg_or_xml(VG_(clo_xml) ? "" : "To see them, rerun with: "
+ "--leak-check=full --show-leak-kinds=all\n");
}
- VG_(umsg)("\n");
+ umsg_or_xml(VG_(clo_xml) ? "\n\n" : "\n");
#undef DBL
#undef DBY
}
@@ -2056,11 +2092,17 @@ void MC_(detect_memory_leaks) ( ThreadId tid, LeakCheckParams* lcp)
VG_(OSetGen_Destroy) (lr_table);
lr_table = NULL;
}
- if (VG_(clo_verbosity) >= 1 && !VG_(clo_xml)) {
- VG_(umsg)("All heap blocks were freed -- no leaks are possible\n");
- VG_(umsg)("\n");
+ if (VG_(clo_verbosity) >= 1) {
+ if (!VG_(clo_xml)) {
+ VG_(umsg)("All heap blocks were freed -- no leaks are possible\n");
+ VG_(umsg)("\n");
+ } else
+ VG_(printf_xml)("true\n\n");
}
return;
+ } else {
+ if (VG_(clo_verbosity) >= 1 && VG_(clo_xml))
+ VG_(printf_xml)("false\n\n");
}
// Sanity check -- make sure they don't overlap. One exception is that
@@ -2301,4 +2343,3 @@ void MC_(who_points_at) ( Addr address, SizeT szB)
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
-
diff --git a/memcheck/mc_machine.c b/memcheck/mc_machine.c
index 34df0011ac..1d5c5c19f6 100644
--- a/memcheck/mc_machine.c
+++ b/memcheck/mc_machine.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -647,6 +647,7 @@ static Int get_otrack_shadow_offset_wrk ( Int offset, Int szB )
if (o == GOF(DFLAG) && sz == 8) return -1; /* slot used for %CH */
if (o == GOF(RIP) && sz == 8) return -1; /* slot unused */
if (o == GOF(IP_AT_SYSCALL) && sz == 8) return -1; /* slot unused */
+ if (o == GOF(TLSBASE) && sz == 8) return -1; /* slot unused */
if (o == GOF(IDFLAG) && sz == 8) return -1; /* slot used for %DH */
if (o == GOF(ACFLAG) && sz == 8) return -1; /* slot unused */
if (o == GOF(FS_CONST) && sz == 8) return -1; /* slot unused */
diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c
index 626d481d25..9a14f84360 100644
--- a/memcheck/mc_main.c
+++ b/memcheck/mc_main.c
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -7231,7 +7231,7 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret )
}
// size zero not allowed on all platforms (e.g. Illumos)
if (aligned_alloc_info->size == 0) {
- MC_(record_bad_size) ( tid, aligned_alloc_info->size, "memalign()" );
+ MC_(record_unsafe_zero_size) ( tid );
}
break;
case AllocKindPosixMemalign:
@@ -7243,7 +7243,7 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret )
MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , 0U, " (should be non-zero, a power of 2 and a multiple of sizeof(void*))" );
}
if (aligned_alloc_info->size == 0) {
- MC_(record_bad_size) ( tid, aligned_alloc_info->size, "posix_memalign()" );
+ MC_(record_unsafe_zero_size) ( tid);
}
break;
case AllocKindAlignedAlloc:
@@ -7257,7 +7257,7 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret )
MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , aligned_alloc_info->size, " (size should be a multiple of alignment)" );
}
if (aligned_alloc_info->size == 0) {
- MC_(record_bad_size) ( tid, aligned_alloc_info->size, "aligned_alloc()" );
+ MC_(record_unsafe_zero_size) ( tid );
}
break;
case AllocKindDeleteSized:
@@ -7279,7 +7279,7 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret )
}
break;
case AllocKindFreeAlignedSized:
- // same alignment checks as aligned_alloc
+ // same alignment checks as aligned_alloc, but allow a size of 0
if ((aligned_alloc_info->orig_alignment & (aligned_alloc_info->orig_alignment - 1)) != 0) {
MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , 0U, " (should be a power of 2)" );
}
@@ -7287,9 +7287,6 @@ static Bool mc_handle_client_request ( ThreadId tid, UWord* arg, UWord* ret )
aligned_alloc_info->size % aligned_alloc_info->orig_alignment != 0U) {
MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , aligned_alloc_info->size, " (size should be a multiple of alignment)" );
}
- if (aligned_alloc_info->size == 0) {
- MC_(record_bad_size) ( tid, aligned_alloc_info->size, "free_aligned_sized()" );
- }
mc = VG_(HT_lookup) ( MC_(malloc_list), (UWord)aligned_alloc_info->mem );
if (mc && aligned_alloc_info->orig_alignment != mc->alignB) {
MC_(record_align_mismatch_error) ( tid, mc, aligned_alloc_info->orig_alignment, False, "aligned_alloc/free_aligned_sized");
diff --git a/memcheck/mc_main_asm.c b/memcheck/mc_main_asm.c
index c221b800fb..eee1856d29 100644
--- a/memcheck/mc_main_asm.c
+++ b/memcheck/mc_main_asm.c
@@ -15,7 +15,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/memcheck/mc_malloc_wrappers.c b/memcheck/mc_malloc_wrappers.c
index 48f26902cd..ae50923c49 100644
--- a/memcheck/mc_malloc_wrappers.c
+++ b/memcheck/mc_malloc_wrappers.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -1229,8 +1229,6 @@ void MC_(print_malloc_stats) ( void )
if (VG_(clo_verbosity) == 0)
return;
- if (VG_(clo_xml))
- return;
/* Count memory still in use. */
VG_(HT_ResetIter)(MC_(malloc_list));
@@ -1239,6 +1237,27 @@ void MC_(print_malloc_stats) ( void )
nbytes += (ULong)mc->szB;
}
+ if (VG_(clo_xml)) {
+ VG_(printf_xml)(
+ "\n"
+ " \n"
+ " %'llu\n"
+ " %'lu\n"
+ " \n"
+ " \n"
+ " %'lu\n"
+ " %'lu\n"
+ " %'llu\n"
+ " \n"
+ "\n"
+ "\n",
+ nbytes, nblocks,
+ cmalloc_n_mallocs,
+ cmalloc_n_frees, cmalloc_bs_mallocd
+ );
+ return;
+ }
+
VG_(umsg)(
"HEAP SUMMARY:\n"
" in use at exit: %'llu bytes in %'lu blocks\n"
diff --git a/memcheck/mc_replace_strmem.c b/memcheck/mc_replace_strmem.c
index 5f026a6a4a..b4853a19a7 100644
--- a/memcheck/mc_replace_strmem.c
+++ b/memcheck/mc_replace_strmem.c
@@ -14,7 +14,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c
index 05e6d59afa..656b943ace 100644
--- a/memcheck/mc_translate.c
+++ b/memcheck/mc_translate.c
@@ -13,7 +13,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -2424,14 +2424,14 @@ IRAtom* expensiveCountTrailingZeroes ( MCEnv* mce, IROp czop,
tl_assert(sameKindedAtoms(atom,vatom));
switch (czop) {
- case Iop_Ctz32: case Iop_CtzNat32:
+ case Iop_CtzNat32:
ty = Ity_I32;
xorOp = Iop_Xor32;
subOp = Iop_Sub32;
andOp = Iop_And32;
one = mkU32(1);
break;
- case Iop_Ctz64: case Iop_CtzNat64:
+ case Iop_CtzNat64:
ty = Ity_I64;
xorOp = Iop_Xor64;
subOp = Iop_Sub64;
@@ -2499,14 +2499,14 @@ IRAtom* expensiveCountLeadingZeroes ( MCEnv* mce, IROp czop,
tl_assert(sameKindedAtoms(atom,vatom));
switch (czop) {
- case Iop_Clz32: case Iop_ClzNat32:
+ case Iop_ClzNat32:
ty = Ity_I32;
shrOp = Iop_Shr32;
notOp = Iop_Not32;
andOp = Iop_And32;
mkRight = mkRight32;
break;
- case Iop_Clz64: case Iop_ClzNat64:
+ case Iop_ClzNat64:
ty = Ity_I64;
shrOp = Iop_Shr64;
notOp = Iop_Not64;
@@ -5316,12 +5316,12 @@ IRExpr* expr2vbits_Unop ( MCEnv* mce, IROp op, IRAtom* atom )
case Iop_NegF16:
return mkPCastTo(mce, Ity_I16, vatom);
- case Iop_Ctz32: case Iop_CtzNat32:
- case Iop_Ctz64: case Iop_CtzNat64:
+ case Iop_CtzNat32:
+ case Iop_CtzNat64:
return expensiveCountTrailingZeroes(mce, op, atom, vatom);
- case Iop_Clz32: case Iop_ClzNat32:
- case Iop_Clz64: case Iop_ClzNat64:
+ case Iop_ClzNat32:
+ case Iop_ClzNat64:
return expensiveCountLeadingZeroes(mce, op, atom, vatom);
// PopCount32: this is slightly pessimistic. It is true that the
@@ -6064,7 +6064,7 @@ void do_shadow_Store ( MCEnv* mce,
case Ity_I32: c = IRConst_U32 (V_BITS32_DEFINED); break;
case Ity_I16: c = IRConst_U16 (V_BITS16_DEFINED); break;
case Ity_I8: c = IRConst_U8 (V_BITS8_DEFINED); break;
- default: VG_(tool_panic)("memcheck:do_shadow_Store(LE)");
+ default: VG_(tool_panic)("memcheck:do_shadow_Store");
}
vdata = IRExpr_Const( c );
}
diff --git a/memcheck/memcheck.h b/memcheck/memcheck.h
index 6a71a25666..0ab6d192a9 100644
--- a/memcheck/memcheck.h
+++ b/memcheck/memcheck.h
@@ -4,7 +4,7 @@
Notice that the following BSD-style license applies to this one
file (memcheck.h) only. The rest of Valgrind is licensed under the
- terms of the GNU General Public License, version 2, unless
+ terms of the GNU General Public License, version 3, unless
otherwise indicated. See the COPYING file in the source
distribution for details.
@@ -50,7 +50,7 @@
Notice that the above BSD-style license applies to this one file
(memcheck.h) only. The entire rest of Valgrind is licensed under
- the terms of the GNU General Public License, version 2. See the
+ the terms of the GNU General Public License, version 3. See the
COPYING file in the source distribution for details.
----------------------------------------------------------------
diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am
index 1ad475f540..920f262a68 100644
--- a/memcheck/tests/Makefile.am
+++ b/memcheck/tests/Makefile.am
@@ -68,11 +68,14 @@ endif
if VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD
SUBDIRS += amd64-freebsd
endif
+if VGCONF_PLATFORMS_INCLUDE_ARM64_FREEBSD
+SUBDIRS += arm64-freebsd
+endif
DIST_SUBDIRS = x86 amd64 arm64 ppc32 ppc64 s390x linux \
darwin solaris x86-linux amd64-linux arm64-linux riscv64-linux \
x86-solaris amd64-solaris mips32 mips64 \
- freebsd amd64-freebsd x86-freebsd \
+ freebsd amd64-freebsd arm64-freebsd x86-freebsd \
common .
dist_noinst_SCRIPTS = \
@@ -82,6 +85,7 @@ dist_noinst_SCRIPTS = \
filter_leak_cpp_interior \
filter_libc_variants \
filter_xml \
+ filter_xml_leak \
filter_strchr \
filter_varinfo3 \
filter_memcheck \
@@ -161,6 +165,9 @@ EXTRA_DIST = \
cxx17_aligned_new.stderr.exp cxx17_aligned_new.vgtest \
cxx17_aligned_new.stderr.exp_32 \
cxx17_aligned_new.stdout.exp \
+ duplicate_align_size_errors.stderr.exp \
+ duplicate_align_size_errors.stderr.exp-memalign \
+ duplicate_align_size_errors.vgtest \
sized_aligned_new_delete_args.stderr.exp \
sized_aligned_new_delete_args.vgtest \
sized_aligned_new_delete_misaligned1.stderr.exp \
@@ -257,9 +264,10 @@ EXTRA_DIST = \
leak-segv-jmp.vgtest leak-segv-jmp.stderr.exp \
lks.vgtest lks.stdout.exp lks.supp lks.stderr.exp \
long_namespace_xml.vgtest long_namespace_xml.stdout.exp \
- long_namespace_xml.stderr.exp \
+ long_namespace_xml.stderr.exp long_namespace_xml.stderr.exp-freebsd \
long-supps.vgtest long-supps.stderr.exp long-supps.supp \
mallinfo.stderr.exp mallinfo.vgtest \
+ mallinfo2.stderr.exp mallinfo2.vgtest \
malloc_free_fill.vgtest \
malloc_free_fill.stderr.exp \
malloc_usable.stderr.exp malloc_usable.vgtest \
@@ -354,6 +362,10 @@ EXTRA_DIST = \
realloc_size_zero.stderr.exp realloc_size_zero.stdout.exp-glibc \
realloc_size_zero.stdout.exp-other \
realloc_size_zero.vgtest \
+ realloc_size_zero_xml.stderr.exp \
+ realloc_size_zero_xml.stdout.exp \
+ realloc_size_zero_xml.stdout.exp-glibc \
+ realloc_size_zero_xml.vgtest \
realloc_size_zero_yes.stderr.exp realloc_size_zero_yes.stdout.exp \
realloc_size_zero_yes.vgtest \
realloc_size_zero_again_yes.stderr.exp \
@@ -516,6 +528,7 @@ check_PROGRAMS = \
leak-segv-jmp \
long-supps \
mallinfo \
+ mallinfo2 \
malloc_free_fill \
malloc_usable malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \
match-overrun \
@@ -606,6 +619,7 @@ endif
if HAVE_ALIGNED_CXX_ALLOC
check_PROGRAMS += cxx17_aligned_new sized_aligned_new_delete_args \
+ duplicate_align_size_errors \
new_aligned_delete_default \
sized_aligned_new_delete_misaligned1 \
sized_aligned_new_delete_misaligned2 \
@@ -624,9 +638,14 @@ check_PROGRAMS += reach_thread_register
endif
if HAVE_FSIZED_DEALLOCATION
-check_PROGRAMS += sized_delete new_delete_mismatch_size
+check_PROGRAMS += sized_delete
+endif
+
+if HAVE_ALIGN_VAL_T
+check_PROGRAMS += new_delete_mismatch_size
endif
+
if HAVE_GNU_STPNCPY
check_PROGRAMS += stpncpy
endif
@@ -672,11 +691,21 @@ leak_cpp_interior_SOURCES = leak_cpp_interior.cpp
# we are actually testing for at runtime.
accounting_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
badfree_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_FREE_NONHEAP_OBJECT@
-bug155125_CFLAGS = $(AM_CFLAGS) -Wno-unused-result @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
+bug155125_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNUSED_RESULT@ @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
bug472219_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+calloc_overflow_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
+malloc_usable_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@
mallinfo_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations
-malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
+if VGCONF_OS_IS_SOLARIS
+mallinfo_LDADD = -lmalloc
+endif
+mallinfo2_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations
+malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ @FLAG_W_NO_ALLOC_SIZE@
sbfragment_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations
+if VGCONF_OS_IS_SOLARIS
+sbfragment_LDADD = -lmalloc
+endif
+
strchr_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
big_debuginfo_symbol_SOURCES = big_debuginfo_symbol.cpp
@@ -687,6 +716,8 @@ bug340392_CFLAGS = $(AM_CFLAGS) -O3 @FLAG_W_NO_MAYBE_UNINITIALIZED@
if HAVE_ALIGNED_CXX_ALLOC
cxx17_aligned_new_SOURCES = cxx17_aligned_new.cpp
cxx17_aligned_new_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 @FLAG_W_NO_MISMATCHED_NEW_DELETE@
+duplicate_align_size_errors_SOURCES = duplicate_align_size_errors.cpp
+duplicate_align_size_errors_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17
new_aligned_delete_default_SOURCES = new_aligned_delete_default.cpp
new_aligned_delete_default_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17
sized_aligned_new_delete_args_SOURCES = sized_aligned_new_delete_args.cpp
@@ -699,6 +730,7 @@ sized_aligned_new_delete_misaligned3_SOURCES = sized_aligned_new_delete_misalign
sized_aligned_new_delete_misaligned3_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17 @FLAG_W_NO_UNUSED_VARIABLE@
if COMPILER_IS_CLANG
cxx17_aligned_new_CXXFLAGS += -fsized-deallocation
+duplicate_align_size_errors_CXXFLAGS += -fsized-deallocation
sized_aligned_new_delete_args_CXXFLAGS += -fsized-deallocation
sized_aligned_new_delete_misaligned1_CXXFLAGS += -fsized-deallocation
sized_aligned_new_delete_misaligned2_CXXFLAGS += -fsized-deallocation
@@ -791,6 +823,7 @@ partial_load_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_USE_AFTER_FREE@
reach_thread_register_CFLAGS = $(AM_CFLAGS) -O2
reach_thread_register_LDADD = -lpthread
+realloc3_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE@
realloc_size_zero_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_INCOMPATIBLE_POINTER_TYPES_DISCARDS_QUALIFIERS@
realloc_size_zero_mismatch_SOURCES = realloc_size_zero_mismatch.cpp
realloc_size_zero_mismatch_CXXFLAGS = $(AM_CXXFLAGS) @FLAG_W_NO_MISMATCHED_NEW_DELETE@
diff --git a/memcheck/tests/amd64-freebsd/Makefile.am b/memcheck/tests/amd64-freebsd/Makefile.am
index e33607f20e..378446d4cf 100644
--- a/memcheck/tests/amd64-freebsd/Makefile.am
+++ b/memcheck/tests/amd64-freebsd/Makefile.am
@@ -1,7 +1,7 @@
include $(top_srcdir)/Makefile.tool-tests.am
-dist_noinst_SCRIPTS = filter_stderr
+dist_noinst_SCRIPTS = filter_stderr filter_arg_check
EXTRA_DIST = \
posix_fadvise.vgtest \
@@ -11,14 +11,18 @@ EXTRA_DIST = \
reallocarray.vgtest \
reallocarray.stderr.exp \
reallocf.vgtest \
- reallocf.stderr.exp
+ reallocf.stderr.exp \
+ scalar_arg_check.vgtest \
+ scalar_arg_check.stderr.exp
check_PROGRAMS = \
- posix_fadvise posix_fallocate reallocarray reallocf
+ posix_fadvise posix_fallocate reallocarray reallocf scalar_arg_check
AM_CFLAGS += @FLAG_M64@
AM_CXXFLAGS += @FLAG_M64@
AM_CCASFLAGS += @FLAG_M64@
-posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
-posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
+
diff --git a/memcheck/tests/amd64-freebsd/filter_arg_check b/memcheck/tests/amd64-freebsd/filter_arg_check
new file mode 100755
index 0000000000..c1152cf836
--- /dev/null
+++ b/memcheck/tests/amd64-freebsd/filter_arg_check
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+# Only one test uses this which calls syscall(SYS_sendfile)
+# which is the only amd64 syscall that uses 7 arguments
+# The output includes --trace-syscalls=yes which is very verbose
+# but we only want to see the sendfile line
+
+# the libc signature for sendfile is
+# int sendfile(int fd, int s, off_t offset, size_t nbytes,
+# struct sf_hdtr *hdtr, off_t *sbytes, int flags);
+# The testcase uses values from 101 to 107 for the arguments
+# (to make it easy to match the testcase to the log output)
+# Some of the arguments are printed as hex, not too bad.
+# Argument 6 is an offset which seems to get added to some
+# variable length base address before being sent to the syscall.
+# I've checked with truss and ktrace, this doesn't come from Valgrind
+
+grep "SYSCALL.*sendfile" |
+sed 's/==.*//' |
+awk '{l=length($9);$9="0x"substr($9, l-2, l);print}' |
+sed -E 's/\[[0-9]+/[xxxxx/'
+
diff --git a/memcheck/tests/amd64-freebsd/scalar_arg_check.c b/memcheck/tests/amd64-freebsd/scalar_arg_check.c
new file mode 100644
index 0000000000..cfa6d4ea08
--- /dev/null
+++ b/memcheck/tests/amd64-freebsd/scalar_arg_check.c
@@ -0,0 +1,8 @@
+#include "../freebsd/scalar.h"
+
+int main(void)
+{
+ /* sendfile uses 7 args */
+ SY(SYS_sendfile, 101, 102, 103, 104, 105, 106, 107);
+}
+
diff --git a/memcheck/tests/amd64-freebsd/scalar_arg_check.stderr.exp b/memcheck/tests/amd64-freebsd/scalar_arg_check.stderr.exp
new file mode 100644
index 0000000000..7b9fc63632
--- /dev/null
+++ b/memcheck/tests/amd64-freebsd/scalar_arg_check.stderr.exp
@@ -0,0 +1 @@
+SYSCALL[xxxxx,1](393) sys_sendfile ( 101, 102, 103, 104, 0x69, 0x6a, 107 )
diff --git a/memcheck/tests/amd64-freebsd/scalar_arg_check.vgtest b/memcheck/tests/amd64-freebsd/scalar_arg_check.vgtest
new file mode 100644
index 0000000000..b5c15205e0
--- /dev/null
+++ b/memcheck/tests/amd64-freebsd/scalar_arg_check.vgtest
@@ -0,0 +1,3 @@
+prog: scalar_arg_check
+vgopts: -q --trace-syscalls=yes
+stderr_filter: filter_arg_check
diff --git a/memcheck/tests/amd64-linux/Makefile.am b/memcheck/tests/amd64-linux/Makefile.am
index 26e8c8ed54..a3b5df5a67 100644
--- a/memcheck/tests/amd64-linux/Makefile.am
+++ b/memcheck/tests/amd64-linux/Makefile.am
@@ -2,7 +2,9 @@
include $(top_srcdir)/Makefile.tool-tests.am
dist_noinst_SCRIPTS = \
- filter_stderr filter_defcfaexpr
+ filter_defcfaexpr filter_scalar filter_stderr
+
+noinst_HEADERS = scalar.h
EXTRA_DIST = \
access_below_sp_1.vgtest \
@@ -11,12 +13,14 @@ EXTRA_DIST = \
access_below_sp_2.stderr.exp access_below_sp_2.stdout.exp \
defcfaexpr.vgtest defcfaexpr.stderr.exp \
int3-amd64.vgtest int3-amd64.stderr.exp int3-amd64.stdout.exp \
+ scalar.stderr.exp scalar.vgtest \
reallocarray.vgtest reallocarray.stderr.exp
check_PROGRAMS = \
access_below_sp \
defcfaexpr \
- int3-amd64
+ int3-amd64 \
+ scalar
if HAVE_REALLOCARRAY
check_PROGRAMS += reallocarray
@@ -29,3 +33,4 @@ AM_CCASFLAGS += @FLAG_M64@
defcfaexpr_SOURCES = defcfaexpr.S
defcfaexpr_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
reallocarray_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
+scalar_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
diff --git a/memcheck/tests/amd64-linux/filter_scalar b/memcheck/tests/amd64-linux/filter_scalar
new file mode 100755
index 0000000000..ee19ffaf25
--- /dev/null
+++ b/memcheck/tests/amd64-linux/filter_scalar
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+# remove line numbers as they just cause larger patches
+sed "/: main /s/\(scalar.c\):[0-9]*)/\1)/" |
+
+../filter_stderr "$@"
+
diff --git a/memcheck/tests/amd64-linux/scalar.c b/memcheck/tests/amd64-linux/scalar.c
new file mode 100644
index 0000000000..fe133d8d2a
--- /dev/null
+++ b/memcheck/tests/amd64-linux/scalar.c
@@ -0,0 +1,87 @@
+#define _GNU_SOURCE
+
+#include "../../memcheck.h"
+#include "scalar.h"
+#include
+#include
+
+// Here we are trying to trigger every syscall error (scalar errors and
+// memory errors) for every syscall. We do this by passing a lot of bogus
+// arguments, mostly 0 and 1 (often it's 1 because NULL ptr args often aren't
+// checked for memory errors, or in order to have a non-zero length used
+// with some buffer). So most of the syscalls don't actually succeed and do
+// anything.
+//
+// Occasionally we have to be careful not to cause Valgrind to seg fault in
+// its pre-syscall wrappers; it does so because it can't know in general
+// when memory is unaddressable, and so tries to dereference it when doing
+// PRE_MEM_READ/PRE_MEM_WRITE calls. (Note that Memcheck will
+// always issue an error message immediately before these seg faults occur).
+//
+// The output has numbers like "3s 2m" for each syscall. "s" is short for
+// "scalar", ie. the argument itself is undefined. "m" is short for "memory",
+// ie. the argument points to memory which is unaddressable.
+
+int main(void)
+{
+ // uninitialised, but we know px[0] is 0x0
+ long* px = malloc(sizeof(long));
+ long x0 = px[0];
+ long res;
+
+ // All __NR_xxx numbers are taken from amd64
+
+ /* Check the syscall number 0 and 1 two trivial generic syscalls. */
+
+ /* __NR_read 0 */
+ /* Nb: here we are also getting an error from the syscall arg itself. */
+ GO(__NR_read, "1+3s 1m");
+ SY(__NR_read + x0, x0, x0, x0 + 1); FAIL;
+
+ /* __NR_write 1 */
+ GO(__NR_write, "3s 1m");
+ SY(__NR_write, x0, x0, x0 + 1); FAIL;
+
+ // __NR_exit 60
+ GO(__NR_exit, "below");
+ // (see below)
+
+ // __NR_getrlimit 97
+ GO(__NR_getrlimit, "2s 1m");
+ SY(__NR_getrlimit, x0, x0); FAIL;
+
+ // __NR_setrlimit 160
+ GO(__NR_setrlimit, "2s 1m");
+ SY(__NR_setrlimit, x0, x0); FAILx(EFAULT);
+
+ // __NR_waitid 247
+ GO(__NR_waitid, "5s 0m");
+ SY(__NR_waitid, x0, x0, x0, x0, x0); FAIL;
+
+ GO(__NR_waitid, "(infop,ru) 5s 2m");
+ SY(__NR_waitid, x0, x0, x0 + 1, x0, x0 + 1); FAIL;
+
+ // __NR_prlimit64 302
+ GO(__NR_prlimit64, "(nop) 4s 0m");
+ SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0, x0); SUCC;
+
+ GO(__NR_prlimit64, "(set) 4s 1m");
+ SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0 + 1, x0); FAILx(EFAULT);
+
+ GO(__NR_prlimit64, "(get) 4s 1m");
+ SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0, x0 + 1); FAILx(EFAULT);
+
+ GO(__NR_prlimit64, "(get+set) 4s 2m");
+ SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0 + 1, x0 + 1); FAILx(EFAULT);
+
+ // no such syscall...
+ GO(9999, "1e");
+ SY(9999); FAIL;
+
+ // __NR_exit 1
+ GO(__NR_exit, "1s 0m");
+ SY(__NR_exit, x0); FAIL;
+
+ assert(0);
+}
+
diff --git a/memcheck/tests/amd64-linux/scalar.h b/memcheck/tests/amd64-linux/scalar.h
new file mode 100644
index 0000000000..52f742e4ac
--- /dev/null
+++ b/memcheck/tests/amd64-linux/scalar.h
@@ -0,0 +1,65 @@
+#include "../../../include/vki/vki-scnums-x86-linux.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifndef __THROW
+#define __THROW
+#endif
+
+// Since we use vki_unistd.h, we can't include . So we have to
+// declare this ourselves.
+extern long int syscall (long int __sysno, ...) __THROW;
+
+// Thorough syscall scalar arg checking. Also serves as thorough checking
+// for (very) basic syscall use. Generally not trying to do anything
+// meaningful with the syscalls.
+
+#define GO(__NR_xxx, s) \
+ fprintf(stderr, "-----------------------------------------------------\n" \
+ "%3d:%20s %s\n" \
+ "-----------------------------------------------------\n", \
+ __NR_xxx, #__NR_xxx, s);
+
+#define SY res = syscall
+
+#define FAIL assert(-1 == res);
+#define SUCC assert(-1 != res);
+#define SUCC_OR_FAIL /* no test */
+
+#define FAILx(E) \
+ do { \
+ int myerrno = errno; \
+ if (-1 == res) { \
+ if (E == myerrno) { \
+ /* as expected */ \
+ } else { \
+ fprintf(stderr, "Expected error %s (%d), got %d\n", #E, E, myerrno); \
+ exit(1); \
+ } \
+ } else { \
+ fprintf(stderr, "Expected error %s (%d), got success\n", #E, E); \
+ exit(1); \
+ } \
+ } while (0);
+
+#define SUCC_OR_FAILx(E) \
+ do { \
+ int myerrno = errno; \
+ if (-1 == res) { \
+ if (E == myerrno) { \
+ /* as expected */ \
+ } else { \
+ fprintf(stderr, "Expected error %s (%d), got %d\n", #E, E, myerrno); \
+ exit(1); \
+ } \
+ } \
+ } while (0);
diff --git a/memcheck/tests/amd64-linux/scalar.stderr.exp b/memcheck/tests/amd64-linux/scalar.stderr.exp
new file mode 100644
index 0000000000..1757cc3eb4
--- /dev/null
+++ b/memcheck/tests/amd64-linux/scalar.stderr.exp
@@ -0,0 +1,246 @@
+-----------------------------------------------------
+ 0: __NR_read 1+3s 1m
+-----------------------------------------------------
+Syscall param (syscallno) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param read(fd) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param read(buf) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param read(count) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param read(buf) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+-----------------------------------------------------
+ 1: __NR_write 3s 1m
+-----------------------------------------------------
+Syscall param write(fd) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param write(buf) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param write(count) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param write(buf) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+-----------------------------------------------------
+ 60: __NR_exit below
+-----------------------------------------------------
+-----------------------------------------------------
+ 97: __NR_getrlimit 2s 1m
+-----------------------------------------------------
+Syscall param getrlimit(resource) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param getrlimit(rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param getrlimit(rlim) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+-----------------------------------------------------
+160: __NR_setrlimit 2s 1m
+-----------------------------------------------------
+Syscall param setrlimit(resource) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param setrlimit(rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param setrlimit(rlim) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+-----------------------------------------------------
+247: __NR_waitid 5s 0m
+-----------------------------------------------------
+Syscall param sys_waitid(which) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(infop) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(options) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(ru) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+-----------------------------------------------------
+247: __NR_waitid (infop,ru) 5s 2m
+-----------------------------------------------------
+Syscall param sys_waitid(which) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(infop) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(options) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(ru) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param waitid(infop) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param waitid(ru) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+-----------------------------------------------------
+302: __NR_prlimit64 (nop) 4s 0m
+-----------------------------------------------------
+Syscall param prlimit64(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(resource) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(new_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(old_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+-----------------------------------------------------
+302: __NR_prlimit64 (set) 4s 1m
+-----------------------------------------------------
+Syscall param prlimit64(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(resource) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(new_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(old_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param rlimit64(new_rlim) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+-----------------------------------------------------
+302: __NR_prlimit64 (get) 4s 1m
+-----------------------------------------------------
+Syscall param prlimit64(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(resource) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(new_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(old_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param rlimit64(old_rlim) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+-----------------------------------------------------
+302: __NR_prlimit64 (get+set) 4s 2m
+-----------------------------------------------------
+Syscall param prlimit64(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(resource) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(new_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(old_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param rlimit64(new_rlim) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param rlimit64(old_rlim) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+-----------------------------------------------------
+9999: 9999 1e
+-----------------------------------------------------
+WARNING: unhandled amd64-linux syscall: 9999
+You may be able to write your own handler.
+Read the file README_MISSING_SYSCALL_OR_IOCTL.
+Nevertheless we consider this a bug. Please report
+it at http://valgrind.org/support/bug_reports.html.
+-----------------------------------------------------
+ 60: __NR_exit 1s 0m
+-----------------------------------------------------
+Syscall param exit(status) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
diff --git a/memcheck/tests/amd64-linux/scalar.vgtest b/memcheck/tests/amd64-linux/scalar.vgtest
new file mode 100644
index 0000000000..81e72b0475
--- /dev/null
+++ b/memcheck/tests/amd64-linux/scalar.vgtest
@@ -0,0 +1,6 @@
+prog: scalar
+# Do not run under root
+prereq: [ `id -u` -ne 0 ]
+vgopts: -q --error-limit=no
+stderr_filter: filter_scalar
+args: < scalar.c
diff --git a/memcheck/tests/arm64-freebsd/Makefile.am b/memcheck/tests/arm64-freebsd/Makefile.am
new file mode 100644
index 0000000000..66523227ac
--- /dev/null
+++ b/memcheck/tests/arm64-freebsd/Makefile.am
@@ -0,0 +1,16 @@
+
+include $(top_srcdir)/Makefile.tool-tests.am
+
+dist_noinst_SCRIPTS = filter_stderr filter_arg_check
+
+EXTRA_DIST = \
+ scalar_arg_check.vgtest \
+ scalar_arg_check.stderr.exp
+
+check_PROGRAMS = \
+ scalar_arg_check
+
+AM_CFLAGS += @FLAG_M64@
+AM_CXXFLAGS += @FLAG_M64@
+AM_CCASFLAGS += @FLAG_M64@
+
diff --git a/memcheck/tests/arm64-freebsd/filter_arg_check b/memcheck/tests/arm64-freebsd/filter_arg_check
new file mode 100755
index 0000000000..c1152cf836
--- /dev/null
+++ b/memcheck/tests/arm64-freebsd/filter_arg_check
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+# Only one test uses this which calls syscall(SYS_sendfile)
+# which is the only amd64 syscall that uses 7 arguments
+# The output includes --trace-syscalls=yes which is very verbose
+# but we only want to see the sendfile line
+
+# the libc signature for sendfile is
+# int sendfile(int fd, int s, off_t offset, size_t nbytes,
+# struct sf_hdtr *hdtr, off_t *sbytes, int flags);
+# The testcase uses values from 101 to 107 for the arguments
+# (to make it easy to match the testcase to the log output)
+# Some of the arguments are printed as hex, not too bad.
+# Argument 6 is an offset which seems to get added to some
+# variable length base address before being sent to the syscall.
+# I've checked with truss and ktrace, this doesn't come from Valgrind
+
+grep "SYSCALL.*sendfile" |
+sed 's/==.*//' |
+awk '{l=length($9);$9="0x"substr($9, l-2, l);print}' |
+sed -E 's/\[[0-9]+/[xxxxx/'
+
diff --git a/memcheck/tests/arm64-freebsd/filter_stderr b/memcheck/tests/arm64-freebsd/filter_stderr
new file mode 100755
index 0000000000..a778e971fc
--- /dev/null
+++ b/memcheck/tests/arm64-freebsd/filter_stderr
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+../filter_stderr "$@"
diff --git a/memcheck/tests/arm64-freebsd/scalar_arg_check.c b/memcheck/tests/arm64-freebsd/scalar_arg_check.c
new file mode 120000
index 0000000000..629936bea6
--- /dev/null
+++ b/memcheck/tests/arm64-freebsd/scalar_arg_check.c
@@ -0,0 +1 @@
+../amd64-freebsd/scalar_arg_check.c
\ No newline at end of file
diff --git a/memcheck/tests/arm64-freebsd/scalar_arg_check.stderr.exp b/memcheck/tests/arm64-freebsd/scalar_arg_check.stderr.exp
new file mode 100644
index 0000000000..7b9fc63632
--- /dev/null
+++ b/memcheck/tests/arm64-freebsd/scalar_arg_check.stderr.exp
@@ -0,0 +1 @@
+SYSCALL[xxxxx,1](393) sys_sendfile ( 101, 102, 103, 104, 0x69, 0x6a, 107 )
diff --git a/memcheck/tests/arm64-freebsd/scalar_arg_check.vgtest b/memcheck/tests/arm64-freebsd/scalar_arg_check.vgtest
new file mode 120000
index 0000000000..5b2d7ffafc
--- /dev/null
+++ b/memcheck/tests/arm64-freebsd/scalar_arg_check.vgtest
@@ -0,0 +1 @@
+../amd64-freebsd/scalar_arg_check.vgtest
\ No newline at end of file
diff --git a/memcheck/tests/arm64/bug484935.c b/memcheck/tests/arm64/bug484935.c
index ff96f078ae..6ece707205 100644
--- a/memcheck/tests/arm64/bug484935.c
+++ b/memcheck/tests/arm64/bug484935.c
@@ -28,9 +28,9 @@ void* load_memory_content(void** ptr)
"LDR x2, [%1, #16]\n"
"mov %0, x0\n"
"mov x3, #2000\n"
- "loop:"
+ "1:\n"
" subs x3, x3, #1\n"
- " b.ne loop\n"
+ " b.ne 1b\n"
: "=r"(result)
: "r"(ptr)
: "x0", "x1", "x2", "x3");
diff --git a/memcheck/tests/bug445235_ada_demangle.vgtest b/memcheck/tests/bug445235_ada_demangle.vgtest
index d8d263351c..09f77b78ba 100644
--- a/memcheck/tests/bug445235_ada_demangle.vgtest
+++ b/memcheck/tests/bug445235_ada_demangle.vgtest
@@ -1,2 +1,5 @@
+# on macOS the C compiler adds more manging which fouls up
+# this test which relies on faking ada mangling in a C binary
+prereq: ! ../../tests/os_test darwin
prog: bug445235_ada_demangle
vgopts: -q
diff --git a/memcheck/tests/client-msg-as-xml.stderr.exp b/memcheck/tests/client-msg-as-xml.stderr.exp
index af97c61ab4..609f5826b4 100644
--- a/memcheck/tests/client-msg-as-xml.stderr.exp
+++ b/memcheck/tests/client-msg-as-xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -81,10 +81,13 @@
+...
+
...
-
+...
+
diff --git a/memcheck/tests/duplicate_align_size_errors.cpp b/memcheck/tests/duplicate_align_size_errors.cpp
index 3e0af0d160..15c6759588 100644
--- a/memcheck/tests/duplicate_align_size_errors.cpp
+++ b/memcheck/tests/duplicate_align_size_errors.cpp
@@ -6,9 +6,7 @@
int main()
{
- std::align_val_t misalign(static_cast(63U));
std::align_val_t zeroalign(static_cast(0U));
- std::align_val_t onealign(static_cast(1U));
std::align_val_t align(static_cast(64U));
std::align_val_t alignx2(static_cast(128U));
std::size_t size(32);
@@ -31,7 +29,7 @@ int main()
mem = nullptr;
}
- // Err.BadSize
+ // Err.UnsafeZeroSize
mem = aligned_alloc(64U, 0U);
if (mem)
{
diff --git a/memcheck/tests/duplicate_align_size_errors.stderr.exp b/memcheck/tests/duplicate_align_size_errors.stderr.exp
new file mode 100644
index 0000000000..871c1c9200
--- /dev/null
+++ b/memcheck/tests/duplicate_align_size_errors.stderr.exp
@@ -0,0 +1,30 @@
+Invalid alignment value: 0 (should be non-zero and a power of 2)
+ at 0x........: operator new(unsigned long, std::align_val_t, std::nothrow_t const&) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:19)
+
+Invalid alignment value: 0 (should be non-zero and a power of 2)
+ at 0x........: operator delete(void*, std::align_val_t, std::nothrow_t const&) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:20)
+
+Invalid size value: 100 alignment value: 64 (size should be a multiple of alignment)
+ at 0x........: aligned_alloc (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:25)
+
+Unsafe allocation with size of zero is implementation-defined
+ at 0x........: aligned_alloc (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:33)
+
+Mismatched new/delete size value: 33
+ at 0x........: operator delete(void*, unsigned long, std::align_val_t) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:43)
+ Address 0x........ is 0 bytes inside a block of size 32 alloc'd
+ at 0x........: operator new(unsigned long, std::align_val_t) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:42)
+
+Mismatched new[]/delete[] alignment alloc value: 64 dealloc value: 128
+ at 0x........: operator delete[](void*, unsigned long, std::align_val_t) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:48)
+ Address 0x........ is 0 bytes inside a block of size 32 alloc'd
+ at 0x........: operator new[](unsigned long, std::align_val_t) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:47)
+
diff --git a/memcheck/tests/duplicate_align_size_errors.stderr.exp-memalign b/memcheck/tests/duplicate_align_size_errors.stderr.exp-memalign
new file mode 100644
index 0000000000..16ecf7714b
--- /dev/null
+++ b/memcheck/tests/duplicate_align_size_errors.stderr.exp-memalign
@@ -0,0 +1,26 @@
+Invalid alignment value: 0 (should be non-zero and a power of 2)
+ at 0x........: operator new(unsigned long, std::align_val_t, std::nothrow_t const&) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:19)
+
+Invalid alignment value: 0 (should be non-zero and a power of 2)
+ at 0x........: operator delete(void*, std::align_val_t, std::nothrow_t const&) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:20)
+
+Unsafe allocation with size of zero is implementation-defined
+ at 0x........: memalign (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:33)
+
+Mismatched new/delete size value: 33
+ at 0x........: operator delete(void*, unsigned long, std::align_val_t) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:43)
+ Address 0x........ is 0 bytes inside a block of size 32 alloc'd
+ at 0x........: operator new(unsigned long, std::align_val_t) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:42)
+
+Mismatched new[]/delete[] alignment alloc value: 64 dealloc value: 128
+ at 0x........: operator delete[](void*, unsigned long, std::align_val_t) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:48)
+ Address 0x........ is 0 bytes inside a block of size 32 alloc'd
+ at 0x........: operator new[](unsigned long, std::align_val_t) (vg_replace_malloc.c:...)
+ by 0x........: main (duplicate_align_size_errors.cpp:47)
+
diff --git a/memcheck/tests/duplicate_align_size_errors.vgtest b/memcheck/tests/duplicate_align_size_errors.vgtest
new file mode 100644
index 0000000000..3e1d321d66
--- /dev/null
+++ b/memcheck/tests/duplicate_align_size_errors.vgtest
@@ -0,0 +1,5 @@
+prog: duplicate_align_size_errors
+prereq: test -e ./duplicate_align_size_errors
+vgopts: --show-mismatched-frees=yes -q
+stderr_filter: filter_size_t
+
diff --git a/memcheck/tests/exit_on_first_error_with_xml.stderr.exp b/memcheck/tests/exit_on_first_error_with_xml.stderr.exp
index 3a02ca5323..6061fc19a4 100644
--- a/memcheck/tests/exit_on_first_error_with_xml.stderr.exp
+++ b/memcheck/tests/exit_on_first_error_with_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
diff --git a/memcheck/tests/filter_dw4.in b/memcheck/tests/filter_dw4.in
old mode 100755
new mode 100644
diff --git a/memcheck/tests/filter_overlaperror.in b/memcheck/tests/filter_overlaperror.in
old mode 100755
new mode 100644
diff --git a/memcheck/tests/filter_stderr.in b/memcheck/tests/filter_stderr.in
old mode 100755
new mode 100644
diff --git a/memcheck/tests/filter_supp.in b/memcheck/tests/filter_supp.in
old mode 100755
new mode 100644
diff --git a/memcheck/tests/filter_xml b/memcheck/tests/filter_xml
index 9244706c36..2c63cddbcb 100755
--- a/memcheck/tests/filter_xml
+++ b/memcheck/tests/filter_xml
@@ -22,13 +22,20 @@ sed "s/operator delete\[\](void\*, unsigned int/operator delete[](void*, unsigne
sed "s/4294967295/18446744073709551615/" |
sed "s/malloc_zone_memalign/posix_memalign/" |
perl -p -e "s/(m_replacemalloc\/)?vg_replace_malloc.c/vg_replace_malloc.c/" |
+perl -0 -p -e "s/.*<\/heap_summary>/...<\/heap_summary>/s" |
+perl -0 -p -e "s/.*<\/error_summary>/...<\/error_summary>/s" |
+perl -0 -p -e "s/.*<\/leak_summary>/...<\/leak_summary>/s" |
perl -0 -p -e "s/.*<\/suppcounts>/...<\/suppcounts>/s" |
perl -p -e "s/
diff --git a/memcheck/tests/freebsd/aligned_allocs_supp.supp b/memcheck/tests/freebsd/aligned_allocs_supp.supp
index 56676481e7..122766f9c8 100644
--- a/memcheck/tests/freebsd/aligned_allocs_supp.supp
+++ b/memcheck/tests/freebsd/aligned_allocs_supp.supp
@@ -14,7 +14,7 @@
{
aligned_alloc bad size
- Memcheck:BadSize
+ Memcheck:UnsafeZeroSize
fun:aligned_alloc
fun:main
}
diff --git a/memcheck/tests/freebsd/bug470713.cpp b/memcheck/tests/freebsd/bug470713.cpp
index e07dba76b5..b49fb16642 100644
--- a/memcheck/tests/freebsd/bug470713.cpp
+++ b/memcheck/tests/freebsd/bug470713.cpp
@@ -18,29 +18,51 @@ int main(int argc, char **argv)
int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
size_t len;
- if (sysctl(mib, 4, NULL, &len, NULL, 0) != 0) {
- cout << "sysctl failed to get path length: " << std::strerror(errno) << '\n';
+ if (argc < 2)
+ {
+ std::cout << "ERROR: missing argument, expected \"" << argv[0] << " {absolute path of " << argv[0] << "}\"\n";
return -1;
}
+ if (sysctl(mib, 4, nullptr, &len, nullptr, 0) != 0) {
+ cout << "ERROR: sysctl failed to get path length: " << std::strerror(errno) << '\n';
+ return -1;
+ }
+
+ // not for regtest, path length may vary
+ // std::cout << "read length " << len << '\n';
+
std::unique_ptr aResult(new char[len]);
- if (sysctl(mib, 4, aResult.get(), &len, NULL, 0) != 0) {
- cout << "sysctl failed to get path: " << strerror(errno) << '\n';
+ if (sysctl(mib, 4, aResult.get(), &len, nullptr, 0) != 0) {
+ cout << "ERROR: sysctl failed to get path: " << strerror(errno) << '\n';
return -1;
}
if (string(aResult.get()) == argv[1]) {
- cout << "OK\n";
+ cout << "OK: got expected pathname\n";
+ } else {
+ cout << "ERROR: aResult " << aResult.get() << " argv[1] " << argv[1] << '\n';
+ }
+
+ if (sysctl(mib, 4, aResult.get(), nullptr, nullptr, 0) != 0) {
+ cout << "OK: sysctl failed with nullptr length: " << strerror(errno) << '\n';
+ } else {
+ cout << "ERROR: nullptr length sysctl succeeded when it should have failed\n";
+ }
+
+ size_t bad_len = len - 3U;
+ if (sysctl(mib, 4, aResult.get(), &bad_len, nullptr, 0) != 0) {
+ cout << "OK: sysctl failed to get path with bad_len: " << strerror(errno) << '\n';
} else {
- cout << "Not OK aResult " << aResult.get() << " argv[1] " << argv[1] << '\n';
+ cout << "ERROR: bad_len sysctl succeeded when it should have failed\n";
+ return -1;
}
- if (sysctl(mib, 4, NULL, NULL, NULL, 0) != -1) {
- cout << "OK syscall failed\n";
+ if (sysctl(mib, 4, nullptr, &len, nullptr, 0) != -1) {
+ cout << "OK: sysctl failed with nullptr name: " << strerror(errno) << '\n';
return -1;
} else {
- cout << "sysctl succeeded when it should have failed\n";
+ cout << "ERROR: nullptr name sysctl succeeded when it should have failed\n";
}
}
-
diff --git a/memcheck/tests/freebsd/bug470713.stdout.exp b/memcheck/tests/freebsd/bug470713.stdout.exp
index 2ba70ed13d..76dc05b5a0 100644
--- a/memcheck/tests/freebsd/bug470713.stdout.exp
+++ b/memcheck/tests/freebsd/bug470713.stdout.exp
@@ -1,2 +1,4 @@
-OK
-OK syscall failed
+OK: got expected pathname
+OK: sysctl failed with nullptr length: Cannot allocate memory
+OK: sysctl failed to get path with bad_len: Cannot allocate memory
+OK: sysctl failed with nullptr name: Cannot allocate memory
diff --git a/memcheck/tests/freebsd/delete_sized_mismatch_xml.stderr.exp b/memcheck/tests/freebsd/delete_sized_mismatch_xml.stderr.exp
index 55225906f9..f63cdadb90 100644
--- a/memcheck/tests/freebsd/delete_sized_mismatch_xml.stderr.exp
+++ b/memcheck/tests/freebsd/delete_sized_mismatch_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -116,12 +116,13 @@
-
FINISHED...
+...
+
...
@@ -135,5 +136,6 @@
...
-
+...
+
diff --git a/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp b/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp
index c555d9bdd3..93c66c70bf 100644
--- a/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp
+++ b/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp
@@ -11,7 +11,7 @@ Invalid alignment value: 40 (should be non-zero, a power of 2 and a multiple of
at 0x........: posix_memalign (vg_replace_malloc.c:...)
by 0x........: main (errno_aligned_allocs.c:20)
-aligned_alloc() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: aligned_alloc (vg_replace_malloc.c:...)
by 0x........: main (errno_aligned_allocs.c:60)
diff --git a/memcheck/tests/freebsd/exterrctl.cpp b/memcheck/tests/freebsd/exterrctl.cpp
new file mode 100644
index 0000000000..c93af3315f
--- /dev/null
+++ b/memcheck/tests/freebsd/exterrctl.cpp
@@ -0,0 +1,20 @@
+#include
+#include
+
+static long x0;
+
+int main()
+{
+ // int exterrctl(u_int op, u_int flags, void *ptr);
+ // op should be 0 or EXTERRCTLF_FORCE (1)
+ // flags EXTERRCTL_ENABLE EXTERRCTL_DISABLE EXTERRCTL_UD (1 2 3)
+ // see sys/sys/_uexterror.h for ptr
+ long *px{static_cast(malloc(2*sizeof(long)))};
+ x0 = px[0];
+
+ char *foo = new char [48+128];
+ delete [] foo;
+
+ exterrctl(x0, x0+2, x0+foo);
+}
+
diff --git a/memcheck/tests/freebsd/exterrctl.stderr.exp b/memcheck/tests/freebsd/exterrctl.stderr.exp
new file mode 100644
index 0000000000..59c7f2dc19
--- /dev/null
+++ b/memcheck/tests/freebsd/exterrctl.stderr.exp
@@ -0,0 +1,22 @@
+Syscall param exterrctl(op) contains uninitialised byte(s)
+ at 0x........: exterrctl (in /...libc...)
+ by 0x........: main (exterrctl.cpp:18)
+
+Syscall param exterrctl(flags) contains uninitialised byte(s)
+ at 0x........: exterrctl (in /...libc...)
+ by 0x........: main (exterrctl.cpp:18)
+
+Syscall param exterrctl(ptr) contains uninitialised byte(s)
+ at 0x........: exterrctl (in /...libc...)
+ by 0x........: main (exterrctl.cpp:18)
+
+Syscall param exterrctl(ptr) points to unaddressable byte(s)
+ at 0x........: exterrctl (in /...libc...)
+ by 0x........: main (exterrctl.cpp:18)
+ Address 0x........ is 0 bytes inside a block of size 176 free'd
+ at 0x........: ...operator delete[]... (vg_replace_malloc.c:...)
+ by 0x........: main (exterrctl.cpp:16)
+ Block was alloc'd at
+ at 0x........: ...operator new[]... (vg_replace_malloc.c:...)
+ by 0x........: main (exterrctl.cpp:15)
+
diff --git a/memcheck/tests/freebsd/exterrctl.vgtest b/memcheck/tests/freebsd/exterrctl.vgtest
new file mode 100644
index 0000000000..53d929be87
--- /dev/null
+++ b/memcheck/tests/freebsd/exterrctl.vgtest
@@ -0,0 +1,3 @@
+prereq: test -x ./exterrctl
+prog: exterrctl
+vgopts: -q
diff --git a/memcheck/tests/freebsd/filter_kenv b/memcheck/tests/freebsd/filter_kenv
new file mode 100755
index 0000000000..029d3c73f4
--- /dev/null
+++ b/memcheck/tests/freebsd/filter_kenv
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+../filter_stderr "$@" |
+
+# want to run without -q to see invalid action message
+# but the size of the kernel environment depends
+# on the FreeBSD version, so we want to filter the size of
+# KENV_DUMP allocation
+
+gsed 's/ [^ ]* bytes allocated/ XXX bytes allocated/'
diff --git a/memcheck/tests/freebsd/filter_scalar b/memcheck/tests/freebsd/filter_scalar
index 5461dce874..2741038d1d 100755
--- a/memcheck/tests/freebsd/filter_scalar
+++ b/memcheck/tests/freebsd/filter_scalar
@@ -15,6 +15,8 @@ sed '/at 0x........: syscall (in \/...libc...)/d' |
sed 's/SYS_freebsd12/ SYS/' |
sed 's/SYS_freebsd13/ SYS/' |
+sed 's/SYS_freebsd14/ SYS/' |
+sed 's/arm64-freebsd/amd64-freebsd/' |
# get rid of error limit message
diff --git a/memcheck/tests/freebsd/kenv.cpp b/memcheck/tests/freebsd/kenv.cpp
new file mode 100644
index 0000000000..0217ad32ae
--- /dev/null
+++ b/memcheck/tests/freebsd/kenv.cpp
@@ -0,0 +1,131 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+static long x0;
+
+int main(int argc, char** argv)
+{
+ long *px{static_cast(malloc(2*sizeof(long)))};
+ x0 = px[0];
+ try
+ {
+ const size_t bufSize{1024};
+ auto buf{std::make_unique(bufSize)};
+ std::string name{"bootfile"};
+ int res{kenv(KENV_GET, name.c_str(), buf.get(), bufSize)};
+
+ if (res == -1)
+ {
+ throw std::runtime_error("kenv get non-root");
+ }
+
+ if (argc > 1)
+ {
+ std::cout << buf.get() << '\n';
+ }
+
+ res = kenv(42*42, name.c_str(), buf.get(), bufSize);
+ if (res == 0)
+ {
+ throw std::runtime_error("kenv get bogus action succeeded");
+ }
+ if (errno != EINVAL)
+ {
+ std::stringstream ss;
+ ss << "kenv get bogus action wrong errno, expected " << EINVAL << " got " << errno;
+ throw std::runtime_error(ss.str());
+ }
+
+ res = kenv(KENV_GET, "zyxxy", buf.get(), bufSize);
+ if (res == 0)
+ {
+ throw std::runtime_error("kenv get bogus name succeeded");
+ }
+ if (errno != ENOENT)
+ {
+ std::stringstream ss;
+ ss << "kenv get bogus name wrong errno, expected " << ENOENT << " got " << errno;
+ throw std::runtime_error(ss.str());
+ }
+
+ res = kenv(KENV_DUMP, "this does not matter", nullptr, -1);
+ if (res == -1)
+ {
+ throw std::runtime_error("kenv dump to get size non-root");
+ }
+ if (argc > 1)
+ {
+ std::cout << "dump size " << res << '\n';
+ }
+ auto dump_buf{std::make_unique(res)};
+ char* uninitCharStar;
+ res = kenv(KENV_DUMP, uninitCharStar, dump_buf.get(), res);
+
+ if (argc > 1)
+ {
+ // the buffer contains nul separated eleements, this will just print the first
+ std::cout << dump_buf.get() << '\n';
+ }
+
+ if (0 == geteuid())
+ {
+ res = kenv(KENV_SET, "this", const_cast("that"), 5);
+ if (res == -1)
+ {
+ throw std::runtime_error("kenv set root");
+ }
+ res = kenv(KENV_SET, "this", const_cast("thing"), 6);
+ if (res == -1)
+ {
+ throw std::runtime_error("kenv set root");
+ }
+ res = kenv(KENV_UNSET, "this", const_cast("yes we have no bananas"), 42);
+ if (res == -1)
+ {
+ throw std::runtime_error("kenv set root");
+ }
+ }
+ else
+ {
+ // now try some things that will fail
+ int uninitInt;
+ res = kenv(KENV_SET, "this", const_cast("that"), uninitInt);
+ if (res != -1)
+ {
+ throw std::runtime_error("kenv set non-root succeeded");
+ }
+ if (errno != EPERM)
+ {
+ std::stringstream ss;
+ ss << "kenv get bogus action wrong errno, expected " << EPERM << " got " << errno;
+ throw std::runtime_error(ss.str());
+ }
+
+ // checks all the args
+ kenv(KENV_GET+x0, name.c_str()+x0, buf.get()+x0, 1024+x0);
+
+ // now some memory errors
+ char* freeName{new char[32]};
+ sprintf(freeName, "%s", "blah");
+ delete [] freeName;
+ kenv(KENV_GET, freeName, buf.get(), 32);
+ char* freeBuf{new char[32]};
+ delete [] freeBuf;
+ kenv(KENV_GET, name.c_str(), freeBuf, 32);
+ kenv(KENV_GET, name.c_str(), buf.get(), 2*bufSize);
+ }
+
+ }
+ catch (std::exception& e)
+ {
+ std::cout << "FAILED: " << e.what() << '\n';
+ exit(-1);
+ }
+ free(px);
+}
diff --git a/memcheck/tests/freebsd/kenv.stderr.exp b/memcheck/tests/freebsd/kenv.stderr.exp
new file mode 100644
index 0000000000..fc6b638684
--- /dev/null
+++ b/memcheck/tests/freebsd/kenv.stderr.exp
@@ -0,0 +1,55 @@
+
+Warning: bad or unimplemented kenv action: 1764
+Syscall param kenv(action) contains uninitialised byte(s)
+ at 0x........: kenv (in /...libc...)
+ by 0x........: main (kenv.cpp:111)
+
+Syscall param kenv(name) contains uninitialised byte(s)
+ at 0x........: kenv (in /...libc...)
+ by 0x........: main (kenv.cpp:111)
+
+Syscall param kenv(value) contains uninitialised byte(s)
+ at 0x........: kenv (in /...libc...)
+ by 0x........: main (kenv.cpp:111)
+
+Syscall param kenv(len) contains uninitialised byte(s)
+ at 0x........: kenv (in /...libc...)
+ by 0x........: main (kenv.cpp:111)
+
+Syscall param kenv(name) points to unaddressable byte(s)
+ at 0x........: kenv (in /...libc...)
+ by 0x........: main (kenv.cpp:117)
+ Address 0x........ is 0 bytes inside a block of size 32 free'd
+ at 0x........: ...operator delete[]... (vg_replace_malloc.c:...)
+ by 0x........: main (kenv.cpp:116)
+ Block was alloc'd at
+ at 0x........: ...operator new[]... (vg_replace_malloc.c:...)
+ by 0x........: main (kenv.cpp:114)
+
+Syscall param kenv(value) points to unaddressable byte(s)
+ at 0x........: kenv (in /...libc...)
+ by 0x........: main (kenv.cpp:120)
+ Address 0x........ is 0 bytes inside a block of size 32 free'd
+ at 0x........: ...operator delete[]... (vg_replace_malloc.c:...)
+ by 0x........: main (kenv.cpp:119)
+ Block was alloc'd at
+ at 0x........: ...operator new[]... (vg_replace_malloc.c:...)
+ by 0x........: main (kenv.cpp:118)
+
+Syscall param kenv(value) points to unaddressable byte(s)
+ at 0x........: kenv (in /...libc...)
+ by 0x........: main (kenv.cpp:121)
+ Address 0x........ is 0 bytes after a block of size 1,024 alloc'd
+ at 0x........: ...operator new[]... (vg_replace_malloc.c:...)
+ by 0x........: main (kenv.cpp:19)
+
+
+HEAP SUMMARY:
+ in use at exit: 0 bytes in 0 blocks
+ total heap usage: 5 allocs, 5 frees, XXX bytes allocated
+
+For a detailed leak analysis, rerun with: --leak-check=full
+
+Use --track-origins=yes to see where uninitialised values come from
+For lists of detected and suppressed errors, rerun with: -s
+ERROR SUMMARY: 7 errors from 7 contexts (suppressed: 0 from 0)
diff --git a/memcheck/tests/freebsd/kenv.vgtest b/memcheck/tests/freebsd/kenv.vgtest
new file mode 100644
index 0000000000..5c54fefd5d
--- /dev/null
+++ b/memcheck/tests/freebsd/kenv.vgtest
@@ -0,0 +1,2 @@
+prog: kenv
+stderr_filter: filter_kenv
diff --git a/memcheck/tests/freebsd/pdfork_pdkill.c b/memcheck/tests/freebsd/pdfork_pdkill.c
index db3e81bb4c..819773a4bc 100644
--- a/memcheck/tests/freebsd/pdfork_pdkill.c
+++ b/memcheck/tests/freebsd/pdfork_pdkill.c
@@ -77,6 +77,10 @@ int main(int argc, char *argv[]) {
pid_t pid;
pdgetpid(fd, &pid);
pdkill(fd, 9);
+ int res_close = close(fd);
+ if (-1 == res_close) {
+ perror("close");
+ }
} else {
fprintf(stderr, "parent: child exited\n");
}
@@ -90,10 +94,17 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "parent after 1st bad pdfork\n");
int anotherfd;
int badflag;
+ anotherfd = 2 + badflag;
+ anotherfd -= badflag;
+ // without this the last pdfork succeeds on arm64
+ badflag = -1 + anotherfd;
+ badflag -=anotherfd;
pid_t* pbadpid = malloc(sizeof(pid_t));
free(pbadpid);
pdgetpid(anotherfd, pbadpid);
pdfork(&anotherfd, badflag);
+ pdkill(*badfd, 9);
+ close(*badfd);
}
return EXIT_SUCCESS;
diff --git a/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp b/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp
index bab0469bad..163d46603c 100644
--- a/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp
+++ b/memcheck/tests/freebsd/pdfork_pdkill.stderr.exp
@@ -1,32 +1,32 @@
parent: kill fd 3
Syscall param pdfork(fdp) points to unaddressable byte(s)
...
- by 0x........: main (pdfork_pdkill.c:88)
+ by 0x........: main (pdfork_pdkill.c:92)
Address 0x........ is 0 bytes inside a block of size 4 free'd
at 0x........: free (vg_replace_malloc.c:...)
- by 0x........: main (pdfork_pdkill.c:87)
+ by 0x........: main (pdfork_pdkill.c:91)
Block was alloc'd at
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (pdfork_pdkill.c:86)
+ by 0x........: main (pdfork_pdkill.c:90)
parent after 1st bad pdfork
Syscall param pdgetpid(fd) contains uninitialised byte(s)
...
- by 0x........: main (pdfork_pdkill.c:95)
+ by 0x........: main (pdfork_pdkill.c:104)
Syscall param pdgetpid(pidp)) points to unaddressable byte(s)
...
- by 0x........: main (pdfork_pdkill.c:95)
+ by 0x........: main (pdfork_pdkill.c:104)
Address 0x........ is 0 bytes inside a block of size 4 free'd
at 0x........: free (vg_replace_malloc.c:...)
- by 0x........: main (pdfork_pdkill.c:94)
+ by 0x........: main (pdfork_pdkill.c:103)
Block was alloc'd at
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (pdfork_pdkill.c:93)
+ by 0x........: main (pdfork_pdkill.c:102)
Syscall param pdfork(flags) contains uninitialised byte(s)
...
- by 0x........: main (pdfork_pdkill.c:96)
+ by 0x........: main (pdfork_pdkill.c:105)
FILE DESCRIPTORS: 3 open (3 inherited) at exit.
Open file descriptor ...
diff --git a/memcheck/tests/freebsd/pdfork_pdkill.supp b/memcheck/tests/freebsd/pdfork_pdkill.supp
new file mode 100644
index 0000000000..47a836de92
--- /dev/null
+++ b/memcheck/tests/freebsd/pdfork_pdkill.supp
@@ -0,0 +1,25 @@
+{
+ arm64 suppression 1
+ Memcheck:Cond
+ fun:pdkill
+}
+
+{
+ arm64 suppression 2
+ Memcheck:Cond
+ fun:_*pdfork
+}
+
+
+{
+ arm64 suppression 3
+ Memcheck:Cond
+ fun:_close
+}
+
+{
+ arm64 suppression 4
+ Memcheck:Cond
+ fun:pdgetpid
+}
+
diff --git a/memcheck/tests/freebsd/pdfork_pdkill.vgtest b/memcheck/tests/freebsd/pdfork_pdkill.vgtest
index 066c16716a..a109ef6e13 100644
--- a/memcheck/tests/freebsd/pdfork_pdkill.vgtest
+++ b/memcheck/tests/freebsd/pdfork_pdkill.vgtest
@@ -1,4 +1,4 @@
prog: pdfork_pdkill
args: 10 2
-vgopts: -q --track-fds=all --child-silent-after-fork=yes
+vgopts: -q --track-fds=all --child-silent-after-fork=yes --suppressions=pdfork_pdkill.supp
stderr_filter: filter_pts
diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c
index eddde2f428..acb4b662e7 100644
--- a/memcheck/tests/freebsd/scalar.c
+++ b/memcheck/tests/freebsd/scalar.c
@@ -348,13 +348,23 @@ int main(void)
GO(SYS_mincore, "3s 1m");
SY(SYS_mincore, x0, x0+40960, x0); FAIL;
- /* SYS_getgroups 79 */
+ /* SYS_freeebsd14_getgroups 79 */
+#if defined(SYS_freebsd14_getgroups)
+ GO(SYS_freebsd14_getgroups, "2s 1m");
+ SY(SYS_freebsd14_getgroups, x0+1, x0+1); FAIL;
+#else
GO(SYS_getgroups, "2s 1m");
SY(SYS_getgroups, x0+1, x0+1); FAIL;
+#endif
- /* SYS_setgroups 80 */
+ /* SYS_freebsd14_setgroups 80 */
+#if defined(SYS_freebsd14_getgroups)
+ GO(SYS_freebsd14_setgroups, "2s 1m");
+ SY(SYS_freebsd14_setgroups, x0+1, x0+1); FAIL;
+#else
GO(SYS_setgroups, "2s 1m");
SY(SYS_setgroups, x0+1, x0+1); FAIL;
+#endif
/* SYS_getpgrp 81 */
GO(SYS_getpgrp, "0s 0m");
@@ -822,30 +832,30 @@ int main(void)
#endif
#else
FAKE_GO("220: SYS_freebsd7___semctl (IPC_STAT) 4s 1m");
- FAKE_SY("Syscall param semctl(semid) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7___semctl(semid) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param semctl(semnum) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param semctl(cmd) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param semctl(arg) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7___semctl(arg) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param sys_freebsd7___semctl(arg) points to unaddressable byte(s)\n");
+ FAKE_SY("Syscall param freebsd7___semctl(arg) points to unaddressable byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n");
FAKE_SY("\n");
FAKE_GO("220: SYS_freebsd7___semctl (bogus cmd) 3s 0m");
- FAKE_SY("Syscall param semctl(semid) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7___semctl(semid) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param semctl(semnum) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param semctl(cmd) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
#endif
@@ -871,31 +881,31 @@ int main(void)
#endif
#else
FAKE_GO("224: SYS_freebsd7_msgctl (set) 3s 1m");
- FAKE_SY("Syscall param msgctl(msqid) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param msgctl(cmd) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param msgctl(buf) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param msgctl(IPC_SET, buf) points to unaddressable byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_msgctl(IPC_SET, buf) points to unaddressable byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n");
FAKE_SY("\n");
FAKE_GO("224: SYS_freebsd7_msgctl (stat) 3s 1m");
- FAKE_SY("Syscall param msgctl(msqid) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param msgctl(cmd) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param msgctl(buf) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param msgctl(IPC_STAT, buf) points to unaddressable byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_msgctl(IPC_STAT, buf) points to unaddressable byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n");
FAKE_SY("\n");
@@ -928,24 +938,24 @@ int main(void)
#endif
#else
FAKE_GO("229: SYS_freebsd7_shmctl 3s 0m");
- FAKE_SY("Syscall param shmctl(shmid) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param shmctl(cmd) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param shmctl(buf) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
FAKE_GO("229: SYS_freebsd7_shmctl (bogus cmd) 3s 0m");
- FAKE_SY("Syscall param shmctl(shmid) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param shmctl(cmd) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
- FAKE_SY("Syscall param shmctl(buf) contains uninitialised byte(s)\n");
+ FAKE_SY("Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s)\n");
FAKE_SY(" ...\n");
FAKE_SY("\n");
@@ -1271,7 +1281,11 @@ int main(void)
/* SYS_sigwaitinfo 346 */
GO(SYS_sigwaitinfo, "2s 2m");
- SY(SYS_sigwaitinfo, x0+1, x0+2, x0+3); FAIL;
+ SY(SYS_sigwaitinfo, x0+1, x0+2); FAIL;
+
+ GO(SYS_sigwaitinfo, "(NULL info) 2s 1m");
+ SY(SYS_sigwaitinfo, x0, x0); FAIL;
+
/* SYS___acl_get_file 347 */
GO(SYS___acl_get_file, "3s 2m");
@@ -1405,9 +1419,6 @@ int main(void)
GO(SYS_kenv, "(KENV_DUMP) 4s 0m");
SY(SYS_kenv, x0+3, x0+2, x0+3, x0+4); FAIL;
- GO(SYS_kenv, "(bogus) 4s 0m");
- SY(SYS_kenv, x0+20, x0+2, x0+3, x0+4); FAIL;
-
/* SYS_lchflags 391 */
GO(SYS_lchflags, "2s 1m");
SY(SYS_lchflags, x0+1, x0+2); FAIL;
@@ -1552,6 +1563,10 @@ int main(void)
SY(SYS_sigwait, x0+1, x0+2); SUCC;
assert(res == EFAULT);
+ GO(SYS_sigwait, "(NULL ags) 2s 2m");
+ SY(SYS_sigwait, x0, x0); SUCC;
+ assert(res == EFAULT);
+
// thr_create 430
/* SYS_thr_exit 431 */
@@ -1984,13 +1999,13 @@ int main(void)
SY(SYS_posix_fallocate, x0+99999, x0+10, x0+20); SUCC;
#else
GO(SYS_posix_fallocate, "5s 0m");
- SY(SYS_posix_fallocate, x0+99999, x0, x0+10, x0, x0+20); SUCC;
+ SY(SYS_posix_fallocate, x0+9999, x0, x0+10, x0, x0+20); SUCC;
#endif
assert(res == EBADF);
/* SYS_posix_fadvise 531 */
GO(SYS_posix_fadvise, "4s 0m");
- SY(SYS_posix_fadvise, x0+99999, x0+10, x0+20, x0); SUCC;
+ SY(SYS_posix_fadvise, x0+9999, x0+10, x0+20, x0); SUCC;
assert(res == EBADF);
/* SYS_wait6 532 */
@@ -2164,7 +2179,7 @@ int main(void)
// __FreeBSD_version 1201522
// __FreeBSD_version 1300045
- /* SYS___sysctlbyname 570 */
+ /* SYS___sysctlbyname 570 */
GO(SYS___sysctlbyname, "(getoldlen) 3s 2m");
SY(SYS___sysctlbyname, x0, x0+1, NULL, x0+1, NULL, x0); FAIL;
@@ -2175,7 +2190,7 @@ int main(void)
SY(SYS___sysctlbyname, x0, x0+1, NULL, NULL, x0+1, x0+2); FAIL;
// FreeBSD 13 (and any backports)
- /* SYS_shm_open2 571 */
+ /* SYS_shm_open2 571 */
#if defined(SYS_shm_open2)
GO(SYS_shm_open2, " 5s 2m");
SY(SYS_shm_open2, x0+0xf00c, x0+1, x0+2, x0+3, x0+4); FAIL;
@@ -2230,7 +2245,7 @@ int main(void)
FAKE_SY("\n");
#endif
- /* SYS___realpathat 574 */
+ /* SYS___realpathat 574 */
#if defined(SYS___realpathat)
GO(SYS___realpathat, " 5s 2m");
SY(SYS___realpathat, x0+0xffff, x0, x0, x0+100, x0+2); FAIL;
@@ -2261,14 +2276,14 @@ int main(void)
FAKE_SY("\n");
#endif
- /* SYS_close_range 575 */
+ /* SYS_close_range 575 */
#if defined(SYS_close_range)
GO(SYS_close_range, "3s 0m");
SY(SYS_close_range, x0+5, x0+10, x0+12345); FAIL;
#else
#endif
- /* SYS___specialfd 577 */
+ /* SYS___specialfd 577 */
#if defined(SYS___specialfd)
GO(SYS___specialfd, "3s 1m");
SY(SYS___specialfd, x0+0xf000, x0+1, x0+10); FAIL;
@@ -2289,7 +2304,7 @@ int main(void)
FAKE_SY("\n");
#endif
- /* SYS_aio_writev 578 */
+ /* SYS_aio_writev 578 */
#if defined(SYS_aio_writev)
GO(SYS_aio_writev, "1s 1m");
SY(SYS_aio_writev, x0+1); FAIL;
@@ -2304,7 +2319,7 @@ int main(void)
FAKE_SY("\n");
#endif
- /* SYS_aio_readv 579 */
+ /* SYS_aio_readv 579 */
#if defined(SYS_aio_readv)
GO(SYS_aio_readv, "1s 1m");
SY(SYS_aio_readv, x0+1); FAIL;
@@ -2320,7 +2335,7 @@ int main(void)
#endif
// FreeBSD 15 (and any backports)
- /* SYS_kqueuex 583 */
+ /* SYS_kqueuex 583 */
#if defined(SYS_kqueuex)
GO(SYS_kqueuex, " 1s 0m");
SY(SYS_kqueuex, x0+123); FAIL;
@@ -2331,7 +2346,7 @@ int main(void)
FAKE_SY("\n");
#endif
- /* SYS_membarrier 584 */
+ /* SYS_membarrier 584 */
#if defined(SYS_membarrier)
GO(SYS_membarrier, " 3s 0m");
SY(SYS_membarrier, x0+123, x0+456, x0+789); FAIL;
@@ -2348,7 +2363,7 @@ int main(void)
FAKE_SY("\n");
#endif
- /* SYS_timerfd_create 585 */
+ /* SYS_timerfd_create 585 */
#if defined(SYS_timerfd_create)
GO(SYS_timerfd_create, " 2s 0m");
SY(SYS_timerfd_create, x0+123, x0+23456); FAIL;
@@ -2362,7 +2377,7 @@ int main(void)
FAKE_SY("\n");
#endif
- /* SYS_timerfd_gettime 586 */
+ /* SYS_timerfd_gettime 586 */
#if defined(SYS_timerfd_gettime)
GO(SYS_timerfd_gettime, " 2s 1m");
SY(SYS_timerfd_gettime, x0+100, x0); FAIL;
@@ -2380,7 +2395,7 @@ int main(void)
FAKE_SY("\n");
#endif
- /* SYS_timerfd_settime 587 */
+ /* SYS_timerfd_settime 587 */
#if defined(SYS_timerfd_settime)
GO(SYS_timerfd_settime, "4s 2m");
SY(SYS_timerfd_settime, x0+321, x0, x0+10, x0+5); FAIL;
@@ -2408,7 +2423,7 @@ int main(void)
FAKE_SY("\n");
#endif
- /* SYS_kcmp 588 */
+ /* SYS_kcmp 588 */
#if defined(SYS_kcmp)
GO(SYS_kcmp, "5s 0m");
SY(SYS_kcmp, x0+1, x0+2, x0+3, x0+4, x0+5);
@@ -2431,7 +2446,7 @@ int main(void)
FAKE_SY("\n");
#endif
- /* SYS_getrlimitusage 589 */
+ /* SYS_getrlimitusage 589 */
#if defined(SYS_getrlimitusage)
GO(SYS_getrlimitusage, "3s, 1m");
SY(SYS_getrlimitusage, x0+3, x0, x0+2);
@@ -2452,6 +2467,7 @@ int main(void)
FAKE_SY("\n");
#endif
+ /* SYS_fchroot 590 */
#if defined(SYS_fchroot)
GO(SYS_fchroot, "1s, 0m");
SY(SYS_fchroot, x0+1000);
@@ -2462,6 +2478,7 @@ int main(void)
FAKE_SY("\n");
#endif
+ /* SYS_setcred 591 */
#if defined(SYS_setcred)
GO(SYS_setcred, "3s, 1m");
SY(SYS_setcred, x0+100, x0+3, x0+50);
@@ -2482,6 +2499,106 @@ int main(void)
FAKE_SY("\n");
#endif
+ /* SYS_wxterrctl 592 */
+#if defined(SYS_exterrctl)
+ GO(SYS_exterrctl, "3s, 1m");
+ SY(SYS_exterrctl, x0, x0+1, x0+1);
+#else
+ FAKE_GO("592: SYS_exterrctl 3s, 1m");
+ FAKE_SY("Syscall param exterrctl(op) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param exterrctl(flags) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param exterrctl(ptr) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param exterrctl(ptr) points to unaddressable byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n");
+ FAKE_SY("\n");
+#endif
+
+ /* SYS_inotify_add_watch_at 593 */
+#if defined(SYS_inotify_add_watch_at)
+ GO(SYS_inotify_add_watch_at, "4s, 1m");
+ SY(SYS_inotify_add_watch_at, x0+99, x0+100, x0+1, x0+999999);
+#else
+ FAKE_GO("593:SYS_inotify_add_watch_at 4s, 1m");
+ FAKE_SY("Syscall param inotify_add_watch_at(fd) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param inotify_add_watch_at(dfd) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param inotify_add_watch_at(path) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param inotify_add_watch_at(mask) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param inotify_add_watch_at(path) points to unaddressable byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n");
+ FAKE_SY("\n");
+#endif
+
+ /* SYS_inotify_rm_watch 594 */
+#if defined(SYS_inotify_rm_watch)
+ GO(SYS_inotify_rm_watch, "2s, 0m");
+ SY(SYS_inotify_rm_watch, x0+1000, x0+1000);
+#else
+ FAKE_GO("594: SYS_inotify_rm_watch 2s, 0m");
+ FAKE_SY("Syscall param inotify_rm_watch(fd) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param inotify_rm_watch(wd) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+#endif
+
+ /* SYS_getgroups 595 */
+#if defined(SYS_freebsd14_getgroups)
+ GO(SYS_getgroups, "2s 1m");
+ SY(SYS_getgroups, x0+1, x0+1); FAIL;
+#else
+ FAKE_GO("595: SYS_getgroups 2s 1m");
+ FAKE_SY("Syscall param getgroups(size) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param getgroups(list) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param getgroups(list) points to unaddressable byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n");
+ FAKE_SY("\n");
+#endif
+
+ /* SYS_setgroups 596 */
+#if defined(SYS_freebsd14_getgroups)
+ GO(SYS_setgroups, "2s 1m");
+ SY(SYS_setgroups, x0+1, x0+1); FAIL;
+#else
+ FAKE_GO("596: SYS_setgroups 2s 1m");
+ FAKE_SY("Syscall param setgroups(size) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param setgroups(list) contains uninitialised byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY("\n");
+ FAKE_SY("Syscall param setgroups(list) points to unaddressable byte(s)\n");
+ FAKE_SY(" ...\n");
+ FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n");
+ FAKE_SY("\n");
+#endif
+
+ // no such syscall...
+ GO(9999, "1e");
+ SY(9999); FAIL;
+
+
/* SYS_exit 1 */
GO(SYS_exit, "1s 0m");
SY(SYS_exit, x0); FAIL;
diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp
index 59ed185242..2acb864e73 100644
--- a/memcheck/tests/freebsd/scalar.stderr.exp
+++ b/memcheck/tests/freebsd/scalar.stderr.exp
@@ -610,7 +610,6 @@ Syscall param mprotect(len) contains uninitialised byte(s)
Syscall param mprotect(prot) contains uninitialised byte(s)
...
-Warning: client syscall mprotect tried to modify addresses 0x........-0x........
---------------------------------------------------------
75: SYS_madvise 3s 0m
---------------------------------------------------------
@@ -1318,47 +1317,47 @@ Syscall param seteuid(uid) contains uninitialised byte(s)
---------------------------------------------------------
188: SYS_freebsd11_stat 2s 2m
---------------------------------------------------------
-Syscall param stat(path) contains uninitialised byte(s)
+Syscall param freebsd11_stat(path) contains uninitialised byte(s)
...
-Syscall param stat(sb) contains uninitialised byte(s)
+Syscall param freebsd11_stat(sb) contains uninitialised byte(s)
...
-Syscall param stat(path) points to unaddressable byte(s)
+Syscall param freebsd11_stat(path) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param stat(sb) points to unaddressable byte(s)
+Syscall param freebsd11_stat(sb) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
189: SYS_freebsd11_fstat 2s 1m
---------------------------------------------------------
-Syscall param fstat(fd) contains uninitialised byte(s)
+Syscall param freebsd11_fstat(fd) contains uninitialised byte(s)
...
-Syscall param fstat(sb) contains uninitialised byte(s)
+Syscall param freebsd11_fstat(sb) contains uninitialised byte(s)
...
-Syscall param fstat(sb) points to unaddressable byte(s)
+Syscall param freebsd11_fstat(sb) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
190: SYS_freebsd11_lstat 2s 2m
---------------------------------------------------------
-Syscall param lstat(path) contains uninitialised byte(s)
+Syscall param freebsd11_lstat(path) contains uninitialised byte(s)
...
-Syscall param lstat(sb) contains uninitialised byte(s)
+Syscall param freebsd11_lstat(sb) contains uninitialised byte(s)
...
-Syscall param lstat(path) points to unaddressable byte(s)
+Syscall param freebsd11_lstat(path) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param lstat(sb) points to unaddressable byte(s)
+Syscall param freebsd11_lstat(sb) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -1413,23 +1412,23 @@ Syscall param setrlimit(rlim) points to unaddressable byte(s)
---------------------------------------------------------
196:SYS_freebsd11_getdirentries 4s 2m
---------------------------------------------------------
-Syscall param getdirentries(fd) contains uninitialised byte(s)
+Syscall param freebsd11_getdirentries(fd) contains uninitialised byte(s)
...
-Syscall param getdirentries(buf) contains uninitialised byte(s)
+Syscall param freebsd11_getdirentries(buf) contains uninitialised byte(s)
...
-Syscall param getdirentries(nbytes) contains uninitialised byte(s)
+Syscall param freebsd11_getdirentries(nbytes) contains uninitialised byte(s)
...
-Syscall param getdirentries(basep) contains uninitialised byte(s)
+Syscall param freebsd11_getdirentries(basep) contains uninitialised byte(s)
...
-Syscall param getdirentries(buf) points to unaddressable byte(s)
+Syscall param freebsd11_getdirentries(buf) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param getdirentries(basep) points to unaddressable byte(s)
+Syscall param freebsd11_getdirentries(basep) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -1482,7 +1481,6 @@ Syscall param sysctl(oldlenp) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Warning: Bad oldlenp address 0x........ in sysctl
---------------------------------------------------------
202: SYS___sysctl (putnew) 4s 2m
---------------------------------------------------------
@@ -1583,32 +1581,32 @@ Syscall param poll(ufds.events) points to uninitialised byte(s)
---------------------------------------------------------
220: SYS_freebsd7___semctl (IPC_STAT) 4s 1m
---------------------------------------------------------
-Syscall param semctl(semid) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(semid) contains uninitialised byte(s)
...
-Syscall param semctl(semnum) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s)
...
-Syscall param semctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s)
...
-Syscall param semctl(arg) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(arg) contains uninitialised byte(s)
...
-Syscall param sys_freebsd7___semctl(arg) points to unaddressable byte(s)
+Syscall param freebsd7___semctl(arg) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
220: SYS_freebsd7___semctl (bogus cmd) 3s 0m
---------------------------------------------------------
-Syscall param semctl(semid) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(semid) contains uninitialised byte(s)
...
-Syscall param semctl(semnum) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s)
...
-Syscall param semctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s)
...
---------------------------------------------------------
@@ -1638,32 +1636,32 @@ Syscall param semop(nops) contains uninitialised byte(s)
---------------------------------------------------------
224: SYS_freebsd7_msgctl (set) 3s 1m
---------------------------------------------------------
-Syscall param msgctl(msqid) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s)
...
-Syscall param msgctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s)
...
-Syscall param msgctl(buf) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s)
...
-Syscall param msgctl(IPC_SET, buf) points to unaddressable byte(s)
+Syscall param freebsd7_msgctl(IPC_SET, buf) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
224: SYS_freebsd7_msgctl (stat) 3s 1m
---------------------------------------------------------
-Syscall param msgctl(msqid) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s)
...
-Syscall param msgctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s)
...
-Syscall param msgctl(buf) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s)
...
-Syscall param msgctl(IPC_STAT, buf) points to unaddressable byte(s)
+Syscall param freebsd7_msgctl(IPC_STAT, buf) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -1736,25 +1734,25 @@ Syscall param shmat(flag) contains uninitialised byte(s)
---------------------------------------------------------
229: SYS_freebsd7_shmctl 3s 0m
---------------------------------------------------------
-Syscall param shmctl(shmid) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s)
...
-Syscall param shmctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s)
...
-Syscall param shmctl(buf) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s)
...
---------------------------------------------------------
229: SYS_freebsd7_shmctl (bogus cmd) 3s 0m
---------------------------------------------------------
-Syscall param shmctl(shmid) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s)
...
-Syscall param shmctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s)
...
-Syscall param shmctl(buf) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s)
...
---------------------------------------------------------
@@ -2067,6 +2065,10 @@ Syscall param preadv(iovcnt) contains uninitialised byte(s)
Syscall param preadv(offset) contains uninitialised byte(s)
...
+Syscall param preadv(iov) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
---------------------------------------------------------
290: SYS_pwritev 4s 0m
---------------------------------------------------------
@@ -2082,6 +2084,10 @@ Syscall param pwritev(iovcnt) contains uninitialised byte(s)
Syscall param pwritev(offset) contains uninitialised byte(s)
...
+Syscall param pwritev(vector) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
---------------------------------------------------------
298: SYS_fhopen 2s 1m
---------------------------------------------------------
@@ -2430,7 +2436,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Warning: Bad oldset address 0x........ in sigprocmask
---------------------------------------------------------
340: SYS_sigprocmask 3s 2m
---------------------------------------------------------
@@ -2451,7 +2456,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Warning: Bad set handler address 0x........ in sigprocmask
---------------------------------------------------------
341: SYS_sigsuspend 1s 1m
---------------------------------------------------------
@@ -2513,6 +2517,19 @@ Syscall param sigwaitinfo(info) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
+---------------------------------------------------------
+346: SYS_sigwaitinfo (NULL info) 2s 1m
+---------------------------------------------------------
+Syscall param sigwaitinfo(set) contains uninitialised byte(s)
+ ...
+
+Syscall param sigwaitinfo(info) contains uninitialised byte(s)
+ ...
+
+Syscall param sigwaitinfo(set) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
---------------------------------------------------------
347: SYS___acl_get_file 3s 2m
---------------------------------------------------------
@@ -2820,33 +2837,33 @@ Syscall param getresgid(sgid) points to unaddressable byte(s)
---------------------------------------------------------
363: SYS_freebsd11_kevent 6s 3m
---------------------------------------------------------
-Syscall param kevent(fd) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(fd) contains uninitialised byte(s)
...
-Syscall param kevent(changelist) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(changelist) contains uninitialised byte(s)
...
-Syscall param kevent(nchanges) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(nchanges) contains uninitialised byte(s)
...
-Syscall param kevent(eventlist) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(eventlist) contains uninitialised byte(s)
...
-Syscall param kevent(nevents) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(nevents) contains uninitialised byte(s)
...
-Syscall param kevent(timeout) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(timeout) contains uninitialised byte(s)
...
-Syscall param kevent(changelist) points to unaddressable byte(s)
+Syscall param freebsd11_kevent(changelist) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param kevent(eventlist) points to unaddressable byte(s)
+Syscall param freebsd11_kevent(eventlist) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param kevent(timeout) points to unaddressable byte(s)
+Syscall param freebsd11_kevent(timeout) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -2972,37 +2989,26 @@ Syscall param kenv(name) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
+Syscall param kenv(value) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
---------------------------------------------------------
390: SYS_kenv (KENV_DUMP) 4s 0m
---------------------------------------------------------
Syscall param kenv(action) contains uninitialised byte(s)
...
-Syscall param kenv(name) contains uninitialised byte(s)
- ...
-
Syscall param kenv(value) contains uninitialised byte(s)
...
Syscall param kenv(len) contains uninitialised byte(s)
...
----------------------------------------------------------
-390: SYS_kenv (bogus) 4s 0m
----------------------------------------------------------
-Syscall param kenv(action) contains uninitialised byte(s)
- ...
-
-Syscall param kenv(name) contains uninitialised byte(s)
- ...
-
-Syscall param kenv(value) contains uninitialised byte(s)
- ...
-
-Syscall param kenv(len) contains uninitialised byte(s)
+Syscall param kenv(value) points to unaddressable byte(s)
...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Warning: Bad action 20 in kenv
---------------------------------------------------------
391: SYS_lchflags 2s 1m
---------------------------------------------------------
@@ -3064,16 +3070,16 @@ Syscall param sendfile(sbytes) points to unaddressable byte(s)
---------------------------------------------------------
395: SYS_freebsd11_getfsstat 3s 1m
---------------------------------------------------------
-Syscall param getfsstat(buf) contains uninitialised byte(s)
+Syscall param freebsd11_getfsstat(buf) contains uninitialised byte(s)
...
-Syscall param getfsstat(bufsize) contains uninitialised byte(s)
+Syscall param freebsd11_getfsstat(bufsize) contains uninitialised byte(s)
...
-Syscall param getfsstat(mode) contains uninitialised byte(s)
+Syscall param freebsd11_getfsstat(mode) contains uninitialised byte(s)
...
-Syscall param getfsstat(buf) points to unaddressable byte(s)
+Syscall param freebsd11_getfsstat(buf) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -3228,7 +3234,6 @@ Syscall param sigaction(oact) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Warning: bad act handler address 0x........ in sigaction()
---------------------------------------------------------
417: SYS_sigreturn 1s 1m
---------------------------------------------------------
@@ -3279,10 +3284,10 @@ Syscall param swapcontext(oucp) points to unaddressable byte(s)
---------------------------------------------------------
424: SYS_swapoff 1s 1m
---------------------------------------------------------
-Syscall param swapoff(special) contains uninitialised byte(s)
+Syscall param freebsd13_swapoff(special) contains uninitialised byte(s)
...
-Syscall param swapoff(special) points to unaddressable byte(s)
+Syscall param freebsd13_swapoff(special) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -3376,6 +3381,23 @@ Syscall param sigwait(sig) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
+---------------------------------------------------------
+429: SYS_sigwait (NULL ags) 2s 2m
+---------------------------------------------------------
+Syscall param sigwait(set) contains uninitialised byte(s)
+ ...
+
+Syscall param sigwait(sig) contains uninitialised byte(s)
+ ...
+
+Syscall param sigwait(set) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param sigwait(sig) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
---------------------------------------------------------
431: SYS_thr_exit other
---------------------------------------------------------
@@ -4175,11 +4197,11 @@ Syscall param fstatat(buf) contains uninitialised byte(s)
Syscall param fstatat(flag) contains uninitialised byte(s)
...
-Syscall param fstatat(path) points to unaddressable byte(s)
+Syscall param freebsd11_fstatat(path) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param fstatat(sb) points to unaddressable byte(s)
+Syscall param freebsd11_fstatat(sb) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -4264,19 +4286,19 @@ Syscall param mkfifoat(path) points to unaddressable byte(s)
---------------------------------------------------------
498: SYS_freebsd11_mknodat 4s 1m
---------------------------------------------------------
-Syscall param mknodat(dfd) contains uninitialised byte(s)
+Syscall param freebsd11_mknodat(dfd) contains uninitialised byte(s)
...
-Syscall param mknodat(pathname) contains uninitialised byte(s)
+Syscall param freebsd11_mknodat(pathname) contains uninitialised byte(s)
...
-Syscall param mknodat(mode) contains uninitialised byte(s)
+Syscall param freebsd11_mknodat(mode) contains uninitialised byte(s)
...
-Syscall param mknodat(dev) contains uninitialised byte(s)
+Syscall param freebsd11_mknodat(dev) contains uninitialised byte(s)
...
-Syscall param mknodat(pathname) points to unaddressable byte(s)
+Syscall param freebsd11_mknodat(pathname) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -5762,6 +5784,84 @@ Syscall param setcred(wcred) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
+---------------------------------------------------------
+592: SYS_exterrctl 3s, 1m
+---------------------------------------------------------
+Syscall param exterrctl(op) contains uninitialised byte(s)
+ ...
+
+Syscall param exterrctl(flags) contains uninitialised byte(s)
+ ...
+
+Syscall param exterrctl(ptr) contains uninitialised byte(s)
+ ...
+
+Syscall param exterrctl(ptr) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+593:SYS_inotify_add_watch_at 4s, 1m
+---------------------------------------------------------
+Syscall param inotify_add_watch_at(fd) contains uninitialised byte(s)
+ ...
+
+Syscall param inotify_add_watch_at(dfd) contains uninitialised byte(s)
+ ...
+
+Syscall param inotify_add_watch_at(path) contains uninitialised byte(s)
+ ...
+
+Syscall param inotify_add_watch_at(mask) contains uninitialised byte(s)
+ ...
+
+Syscall param inotify_add_watch_at(path) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+594: SYS_inotify_rm_watch 2s, 0m
+---------------------------------------------------------
+Syscall param inotify_rm_watch(fd) contains uninitialised byte(s)
+ ...
+
+Syscall param inotify_rm_watch(wd) contains uninitialised byte(s)
+ ...
+
+---------------------------------------------------------
+595: SYS_getgroups 2s 1m
+---------------------------------------------------------
+Syscall param getgroups(size) contains uninitialised byte(s)
+ ...
+
+Syscall param getgroups(list) contains uninitialised byte(s)
+ ...
+
+Syscall param getgroups(list) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+596: SYS_setgroups 2s 1m
+---------------------------------------------------------
+Syscall param setgroups(size) contains uninitialised byte(s)
+ ...
+
+Syscall param setgroups(list) contains uninitialised byte(s)
+ ...
+
+Syscall param setgroups(list) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+9999: 9999 1e
+---------------------------------------------------------
+WARNING: unhandled amd64-freebsd syscall: 9999
+You may be able to write your own handler.
+Read the file README_MISSING_SYSCALL_OR_IOCTL.
+Nevertheless we consider this a bug. Please report
+it at http://valgrind.org/support/bug_reports.html.
---------------------------------------------------------
1: SYS_exit 1s 0m
---------------------------------------------------------
diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86
index 6a532ae8e0..957ffb2058 100644
--- a/memcheck/tests/freebsd/scalar.stderr.exp-x86
+++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86
@@ -610,7 +610,6 @@ Syscall param mprotect(len) contains uninitialised byte(s)
Syscall param mprotect(prot) contains uninitialised byte(s)
...
-Warning: client syscall mprotect tried to modify addresses 0x........-0x........
---------------------------------------------------------
75: SYS_madvise 3s 0m
---------------------------------------------------------
@@ -1318,47 +1317,47 @@ Syscall param seteuid(uid) contains uninitialised byte(s)
---------------------------------------------------------
188: SYS_freebsd11_stat 2s 2m
---------------------------------------------------------
-Syscall param stat(path) contains uninitialised byte(s)
+Syscall param freebsd11_stat(path) contains uninitialised byte(s)
...
-Syscall param stat(sb) contains uninitialised byte(s)
+Syscall param freebsd11_stat(sb) contains uninitialised byte(s)
...
-Syscall param stat(path) points to unaddressable byte(s)
+Syscall param freebsd11_stat(path) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param stat(sb) points to unaddressable byte(s)
+Syscall param freebsd11_stat(sb) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
189: SYS_freebsd11_fstat 2s 1m
---------------------------------------------------------
-Syscall param fstat(fd) contains uninitialised byte(s)
+Syscall param freebsd11_fstat(fd) contains uninitialised byte(s)
...
-Syscall param fstat(sb) contains uninitialised byte(s)
+Syscall param freebsd11_fstat(sb) contains uninitialised byte(s)
...
-Syscall param fstat(sb) points to unaddressable byte(s)
+Syscall param freebsd11_fstat(sb) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
190: SYS_freebsd11_lstat 2s 2m
---------------------------------------------------------
-Syscall param lstat(path) contains uninitialised byte(s)
+Syscall param freebsd11_lstat(path) contains uninitialised byte(s)
...
-Syscall param lstat(sb) contains uninitialised byte(s)
+Syscall param freebsd11_lstat(sb) contains uninitialised byte(s)
...
-Syscall param lstat(path) points to unaddressable byte(s)
+Syscall param freebsd11_lstat(path) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param lstat(sb) points to unaddressable byte(s)
+Syscall param freebsd11_lstat(sb) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -1413,23 +1412,23 @@ Syscall param setrlimit(rlim) points to unaddressable byte(s)
---------------------------------------------------------
196:SYS_freebsd11_getdirentries 4s 2m
---------------------------------------------------------
-Syscall param getdirentries(fd) contains uninitialised byte(s)
+Syscall param freebsd11_getdirentries(fd) contains uninitialised byte(s)
...
-Syscall param getdirentries(buf) contains uninitialised byte(s)
+Syscall param freebsd11_getdirentries(buf) contains uninitialised byte(s)
...
-Syscall param getdirentries(nbytes) contains uninitialised byte(s)
+Syscall param freebsd11_getdirentries(nbytes) contains uninitialised byte(s)
...
-Syscall param getdirentries(basep) contains uninitialised byte(s)
+Syscall param freebsd11_getdirentries(basep) contains uninitialised byte(s)
...
-Syscall param getdirentries(buf) points to unaddressable byte(s)
+Syscall param freebsd11_getdirentries(buf) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param getdirentries(basep) points to unaddressable byte(s)
+Syscall param freebsd11_getdirentries(basep) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -1482,7 +1481,6 @@ Syscall param sysctl(oldlenp) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Warning: Bad oldlenp address 0x........ in sysctl
---------------------------------------------------------
202: SYS___sysctl (putnew) 4s 2m
---------------------------------------------------------
@@ -1583,32 +1581,32 @@ Syscall param poll(ufds.events) points to uninitialised byte(s)
---------------------------------------------------------
220: SYS_freebsd7___semctl (IPC_STAT) 4s 1m
---------------------------------------------------------
-Syscall param semctl(semid) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(semid) contains uninitialised byte(s)
...
-Syscall param semctl(semnum) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s)
...
-Syscall param semctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s)
...
-Syscall param semctl(arg) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(arg) contains uninitialised byte(s)
...
-Syscall param sys_freebsd7___semctl(arg) points to unaddressable byte(s)
+Syscall param freebsd7___semctl(arg) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
220: SYS_freebsd7___semctl (bogus cmd) 3s 0m
---------------------------------------------------------
-Syscall param semctl(semid) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(semid) contains uninitialised byte(s)
...
-Syscall param semctl(semnum) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(semnum) contains uninitialised byte(s)
...
-Syscall param semctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7___semctl(cmd) contains uninitialised byte(s)
...
---------------------------------------------------------
@@ -1638,32 +1636,32 @@ Syscall param semop(nops) contains uninitialised byte(s)
---------------------------------------------------------
224: SYS_freebsd7_msgctl (set) 3s 1m
---------------------------------------------------------
-Syscall param msgctl(msqid) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s)
...
-Syscall param msgctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s)
...
-Syscall param msgctl(buf) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s)
...
-Syscall param msgctl(IPC_SET, buf) points to unaddressable byte(s)
+Syscall param freebsd7_msgctl(IPC_SET, buf) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
224: SYS_freebsd7_msgctl (stat) 3s 1m
---------------------------------------------------------
-Syscall param msgctl(msqid) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(msqid) contains uninitialised byte(s)
...
-Syscall param msgctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(cmd) contains uninitialised byte(s)
...
-Syscall param msgctl(buf) contains uninitialised byte(s)
+Syscall param freebsd7_msgctl(buf) contains uninitialised byte(s)
...
-Syscall param msgctl(IPC_STAT, buf) points to unaddressable byte(s)
+Syscall param freebsd7_msgctl(IPC_STAT, buf) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -1736,25 +1734,25 @@ Syscall param shmat(flag) contains uninitialised byte(s)
---------------------------------------------------------
229: SYS_freebsd7_shmctl 3s 0m
---------------------------------------------------------
-Syscall param shmctl(shmid) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s)
...
-Syscall param shmctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s)
...
-Syscall param shmctl(buf) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s)
...
---------------------------------------------------------
229: SYS_freebsd7_shmctl (bogus cmd) 3s 0m
---------------------------------------------------------
-Syscall param shmctl(shmid) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(shmid) contains uninitialised byte(s)
...
-Syscall param shmctl(cmd) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(cmd) contains uninitialised byte(s)
...
-Syscall param shmctl(buf) contains uninitialised byte(s)
+Syscall param freebsd7_shmctl(buf) contains uninitialised byte(s)
...
---------------------------------------------------------
@@ -2070,6 +2068,10 @@ Syscall param preadv(offset_low) contains uninitialised byte(s)
Syscall param preadv(offset_high) contains uninitialised byte(s)
...
+Syscall param preadv(iov) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
---------------------------------------------------------
290: SYS_pwritev 5s 0m
---------------------------------------------------------
@@ -2088,6 +2090,10 @@ Syscall param pwritev(offset_low) contains uninitialised byte(s)
Syscall param pwritev(offset_high) contains uninitialised byte(s)
...
+Syscall param pwritev(vector) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
---------------------------------------------------------
298: SYS_fhopen 2s 1m
---------------------------------------------------------
@@ -2436,7 +2442,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Warning: Bad oldset address 0x........ in sigprocmask
---------------------------------------------------------
340: SYS_sigprocmask 3s 2m
---------------------------------------------------------
@@ -2457,7 +2462,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Warning: Bad set handler address 0x........ in sigprocmask
---------------------------------------------------------
341: SYS_sigsuspend 1s 1m
---------------------------------------------------------
@@ -2519,6 +2523,19 @@ Syscall param sigwaitinfo(info) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
+---------------------------------------------------------
+346: SYS_sigwaitinfo (NULL info) 2s 1m
+---------------------------------------------------------
+Syscall param sigwaitinfo(set) contains uninitialised byte(s)
+ ...
+
+Syscall param sigwaitinfo(info) contains uninitialised byte(s)
+ ...
+
+Syscall param sigwaitinfo(set) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
---------------------------------------------------------
347: SYS___acl_get_file 3s 2m
---------------------------------------------------------
@@ -2826,33 +2843,33 @@ Syscall param getresgid(sgid) points to unaddressable byte(s)
---------------------------------------------------------
363: SYS_freebsd11_kevent 6s 3m
---------------------------------------------------------
-Syscall param kevent(fd) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(fd) contains uninitialised byte(s)
...
-Syscall param kevent(changelist) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(changelist) contains uninitialised byte(s)
...
-Syscall param kevent(nchanges) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(nchanges) contains uninitialised byte(s)
...
-Syscall param kevent(eventlist) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(eventlist) contains uninitialised byte(s)
...
-Syscall param kevent(nevents) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(nevents) contains uninitialised byte(s)
...
-Syscall param kevent(timeout) contains uninitialised byte(s)
+Syscall param freebsd11_kevent(timeout) contains uninitialised byte(s)
...
-Syscall param kevent(changelist) points to unaddressable byte(s)
+Syscall param freebsd11_kevent(changelist) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param kevent(eventlist) points to unaddressable byte(s)
+Syscall param freebsd11_kevent(eventlist) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param kevent(timeout) points to unaddressable byte(s)
+Syscall param freebsd11_kevent(timeout) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -2978,37 +2995,26 @@ Syscall param kenv(name) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
+Syscall param kenv(value) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
---------------------------------------------------------
390: SYS_kenv (KENV_DUMP) 4s 0m
---------------------------------------------------------
Syscall param kenv(action) contains uninitialised byte(s)
...
-Syscall param kenv(name) contains uninitialised byte(s)
- ...
-
Syscall param kenv(value) contains uninitialised byte(s)
...
Syscall param kenv(len) contains uninitialised byte(s)
...
----------------------------------------------------------
-390: SYS_kenv (bogus) 4s 0m
----------------------------------------------------------
-Syscall param kenv(action) contains uninitialised byte(s)
- ...
-
-Syscall param kenv(name) contains uninitialised byte(s)
- ...
-
-Syscall param kenv(value) contains uninitialised byte(s)
- ...
-
-Syscall param kenv(len) contains uninitialised byte(s)
+Syscall param kenv(value) points to unaddressable byte(s)
...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Warning: Bad action 20 in kenv
---------------------------------------------------------
391: SYS_lchflags 2s 1m
---------------------------------------------------------
@@ -3073,16 +3079,16 @@ Syscall param sendfile(sbytes) points to unaddressable byte(s)
---------------------------------------------------------
395: SYS_freebsd11_getfsstat 3s 1m
---------------------------------------------------------
-Syscall param getfsstat(buf) contains uninitialised byte(s)
+Syscall param freebsd11_getfsstat(buf) contains uninitialised byte(s)
...
-Syscall param getfsstat(bufsize) contains uninitialised byte(s)
+Syscall param freebsd11_getfsstat(bufsize) contains uninitialised byte(s)
...
-Syscall param getfsstat(mode) contains uninitialised byte(s)
+Syscall param freebsd11_getfsstat(mode) contains uninitialised byte(s)
...
-Syscall param getfsstat(buf) points to unaddressable byte(s)
+Syscall param freebsd11_getfsstat(buf) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -3237,7 +3243,6 @@ Syscall param sigaction(oact) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Warning: bad act handler address 0x........ in sigaction()
---------------------------------------------------------
417: SYS_sigreturn 1s 1m
---------------------------------------------------------
@@ -3288,10 +3293,10 @@ Syscall param swapcontext(oucp) points to unaddressable byte(s)
---------------------------------------------------------
424: SYS_swapoff 1s 1m
---------------------------------------------------------
-Syscall param swapoff(special) contains uninitialised byte(s)
+Syscall param freebsd13_swapoff(special) contains uninitialised byte(s)
...
-Syscall param swapoff(special) points to unaddressable byte(s)
+Syscall param freebsd13_swapoff(special) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -3385,6 +3390,23 @@ Syscall param sigwait(sig) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
+---------------------------------------------------------
+429: SYS_sigwait (NULL ags) 2s 2m
+---------------------------------------------------------
+Syscall param sigwait(set) contains uninitialised byte(s)
+ ...
+
+Syscall param sigwait(sig) contains uninitialised byte(s)
+ ...
+
+Syscall param sigwait(set) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param sigwait(sig) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
---------------------------------------------------------
431: SYS_thr_exit other
---------------------------------------------------------
@@ -3943,7 +3965,7 @@ Syscall param mmap(offset_high) contains uninitialised byte(s)
---------------------------------------------------------
478: SYS_lseek 4s 0m
---------------------------------------------------------
-Syscall param lseek(fd) contains uninitialised byte(s)
+Syscall param lseek(fildes) contains uninitialised byte(s)
...
Syscall param lseek(offset_low) contains uninitialised byte(s)
@@ -4214,11 +4236,11 @@ Syscall param fstatat(buf) contains uninitialised byte(s)
Syscall param fstatat(flag) contains uninitialised byte(s)
...
-Syscall param fstatat(path) points to unaddressable byte(s)
+Syscall param freebsd11_fstatat(path) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-Syscall param fstatat(sb) points to unaddressable byte(s)
+Syscall param freebsd11_fstatat(sb) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -4303,19 +4325,19 @@ Syscall param mkfifoat(path) points to unaddressable byte(s)
---------------------------------------------------------
498: SYS_freebsd11_mknodat 4s 1m
---------------------------------------------------------
-Syscall param mknodat(dfd) contains uninitialised byte(s)
+Syscall param freebsd11_mknodat(dfd) contains uninitialised byte(s)
...
-Syscall param mknodat(pathname) contains uninitialised byte(s)
+Syscall param freebsd11_mknodat(pathname) contains uninitialised byte(s)
...
-Syscall param mknodat(mode) contains uninitialised byte(s)
+Syscall param freebsd11_mknodat(mode) contains uninitialised byte(s)
...
-Syscall param mknodat(dev) contains uninitialised byte(s)
+Syscall param freebsd11_mknodat(dev) contains uninitialised byte(s)
...
-Syscall param mknodat(pathname) points to unaddressable byte(s)
+Syscall param freebsd11_mknodat(pathname) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -5812,6 +5834,106 @@ Syscall param getrlimitusage(res) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
+---------------------------------------------------------
+590: SYS_fchroot 1s, 0m
+---------------------------------------------------------
+Syscall param fchroot(fd) contains uninitialised byte(s)
+ ...
+
+---------------------------------------------------------
+591: SYS_setcred 3s, 1m
+---------------------------------------------------------
+Syscall param setcred(flags) contains uninitialised byte(s)
+ ...
+
+Syscall param setcred(wcred) contains uninitialised byte(s)
+ ...
+
+Syscall param setcred(size) contains uninitialised byte(s)
+ ...
+
+Syscall param setcred(wcred) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+592: SYS_exterrctl 3s, 1m
+---------------------------------------------------------
+Syscall param exterrctl(op) contains uninitialised byte(s)
+ ...
+
+Syscall param exterrctl(flags) contains uninitialised byte(s)
+ ...
+
+Syscall param exterrctl(ptr) contains uninitialised byte(s)
+ ...
+
+Syscall param exterrctl(ptr) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+593:SYS_inotify_add_watch_at 4s, 1m
+---------------------------------------------------------
+Syscall param inotify_add_watch_at(fd) contains uninitialised byte(s)
+ ...
+
+Syscall param inotify_add_watch_at(dfd) contains uninitialised byte(s)
+ ...
+
+Syscall param inotify_add_watch_at(path) contains uninitialised byte(s)
+ ...
+
+Syscall param inotify_add_watch_at(mask) contains uninitialised byte(s)
+ ...
+
+Syscall param inotify_add_watch_at(path) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+594: SYS_inotify_rm_watch 2s, 0m
+---------------------------------------------------------
+Syscall param inotify_rm_watch(fd) contains uninitialised byte(s)
+ ...
+
+Syscall param inotify_rm_watch(wd) contains uninitialised byte(s)
+ ...
+
+---------------------------------------------------------
+595: SYS_getgroups 2s 1m
+---------------------------------------------------------
+Syscall param getgroups(size) contains uninitialised byte(s)
+ ...
+
+Syscall param getgroups(list) contains uninitialised byte(s)
+ ...
+
+Syscall param getgroups(list) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+596: SYS_setgroups 2s 1m
+---------------------------------------------------------
+Syscall param setgroups(size) contains uninitialised byte(s)
+ ...
+
+Syscall param setgroups(list) contains uninitialised byte(s)
+ ...
+
+Syscall param setgroups(list) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+9999: 9999 1e
+---------------------------------------------------------
+WARNING: unhandled x86-freebsd syscall: 9999
+You may be able to write your own handler.
+Read the file README_MISSING_SYSCALL_OR_IOCTL.
+Nevertheless we consider this a bug. Please report
+it at http://valgrind.org/support/bug_reports.html.
---------------------------------------------------------
1: SYS_exit 1s 0m
---------------------------------------------------------
diff --git a/memcheck/tests/freebsd/setcred.cpp b/memcheck/tests/freebsd/setcred.cpp
index 7553599dfc..1ae28f7f04 100644
--- a/memcheck/tests/freebsd/setcred.cpp
+++ b/memcheck/tests/freebsd/setcred.cpp
@@ -1,31 +1,70 @@
#include
#include
+#include
+#include
+#include
+
+static long x0;
int main()
{
+ long *px{static_cast(malloc(2*sizeof(long)))};
+ x0 = px[0];
struct setcred cred1;
struct setcred* cred2;
- int flags1{0};
- int flags2;
+ int flags1{SETCREDF_RUID};
+ int flags2{SETCREDF_SUPP_GROUPS};
size_t size1{sizeof(cred1)};
- size_t size2;
+ int ret;
std::memset(&cred1, 250, sizeof(cred1));
- // needs to be root to work correctly
- setcred(flags1, &cred1, size1);
+ // uninit
+ ret = setcred(flags2+x0, (struct setcred*)x0, size1+x0);
+ assert(ret == -1);
+ assert(errno == EFAULT);
+ errno = 0;
- // not accessible
- setcred(flags1, nullptr, size1);
+ // invalid flags
+ ret = setcred(9999+x0, &cred1, sizeof(cred1));
+ assert(ret == -1);
+ assert(errno == EINVAL);
+ errno = 0;
- // uninit
- setcred(flags2, cred2, size2);
+ // invalid size
+ ret = setcred(flags1, &cred1, 3+x0);
+ assert(ret == -1);
+ assert(errno == EINVAL);
+ errno = 0;
cred2 = new struct setcred;
// uninit memory
- setcred(flags1, cred2, size1);
+ ret = setcred(flags1, cred2, size1);
+ assert(ret == -1);
+ assert(errno == EPERM);
+ errno = 0;
+
+ // PJF these two calls to setcred were before the
+ // uninit one that is now first
+ // that was fine on arm64 but on amd64 the uninit
+ // call generated an extre Conditional jump ... error
+
+ // fairly mysterious, and usually that means that there
+ // is something wrong with the syscall wrapper
+
+ // needs to be root to work correctly
+ ret = setcred(flags1, &cred1, size1);
+ assert(ret == -1);
+ assert(errno == EPERM);
+ errno = 0;
+
+ // not accessible
+ ret = setcred(flags1, nullptr, size1);
+ assert(ret == -1);
+ assert(errno == EFAULT);
delete cred2;
+ free(px);
}
diff --git a/memcheck/tests/freebsd/setcred.stderr.exp b/memcheck/tests/freebsd/setcred.stderr.exp
index 1d9cecf8e3..5f84b4f288 100644
--- a/memcheck/tests/freebsd/setcred.stderr.exp
+++ b/memcheck/tests/freebsd/setcred.stderr.exp
@@ -1,30 +1,37 @@
-Syscall param setcred(wcred) points to unaddressable byte(s)
- at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:19)
- Address 0x........ is not stack'd, malloc'd or (recently) free'd
-
Syscall param setcred(flags) contains uninitialised byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:22)
+ by 0x........: main (setcred.cpp:23)
Syscall param setcred(wcred) contains uninitialised byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:22)
+ by 0x........: main (setcred.cpp:23)
Syscall param setcred(size) contains uninitialised byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:22)
+ by 0x........: main (setcred.cpp:23)
-Syscall param setcred(wcred) points to uninitialised byte(s)
+Syscall param setcred(wcred) points to unaddressable byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:22)
- Address 0x........ is on thread 1's stack
- in frame #2, created by __libc_start1 (???:)
+ by 0x........: main (setcred.cpp:23)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param setcred(flags) contains uninitialised byte(s)
+ at 0x........: setcred (in /...libc...)
+ by 0x........: main (setcred.cpp:29)
+
+Syscall param setcred(size) contains uninitialised byte(s)
+ at 0x........: setcred (in /...libc...)
+ by 0x........: main (setcred.cpp:35)
Syscall param setcred(wcred) points to uninitialised byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:27)
+ by 0x........: main (setcred.cpp:43)
Address 0x........ is 0 bytes inside a block of size 48 alloc'd
at 0x........: ...operator new... (vg_replace_malloc.c:...)
- by 0x........: main (setcred.cpp:24)
+ by 0x........: main (setcred.cpp:40)
+
+Syscall param setcred(wcred) points to unaddressable byte(s)
+ at 0x........: setcred (in /...libc...)
+ by 0x........: main (setcred.cpp:63)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
diff --git a/memcheck/tests/freebsd/timerfd.stderr.exp-x86 b/memcheck/tests/freebsd/timerfd.stderr.exp-x86
new file mode 100644
index 0000000000..708e50b165
--- /dev/null
+++ b/memcheck/tests/freebsd/timerfd.stderr.exp-x86
@@ -0,0 +1,40 @@
+Syscall param timerfd_create(clockid) contains uninitialised byte(s)
+ at 0x........: timerfd_create (in /...libc...)
+ by 0x........: main (timerfd.c:115)
+
+Syscall param timerfd_create(flags) contains uninitialised byte(s)
+ at 0x........: timerfd_create (in /...libc...)
+ by 0x........: main (timerfd.c:115)
+
+Syscall param timerfd_gettime(curr_value) points to unaddressable byte(s)
+ at 0x........: timerfd_gettime (in /...libc...)
+ by 0x........: main (timerfd.c:124)
+ Address 0x........ is 0 bytes after a block of size 14 alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (timerfd.c:108)
+
+Syscall param timerfd_settime(flags) contains uninitialised byte(s)
+ at 0x........: timerfd_settime (in /...libc...)
+ by 0x........: main (timerfd.c:130)
+
+Syscall param timerfd_settime(old_value) points to unaddressable byte(s)
+ at 0x........: timerfd_settime (in /...libc...)
+ by 0x........: main (timerfd.c:134)
+ Address 0x........ is 0 bytes after a block of size 14 alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (timerfd.c:109)
+
+Syscall param timerfd_gettime(fd) contains uninitialised byte(s)
+ at 0x........: timerfd_gettime (in /...libc...)
+ by 0x........: main (timerfd.c:139)
+
+Syscall param timerfd_settime(fd) contains uninitialised byte(s)
+ at 0x........: timerfd_settime (in /...libc...)
+ by 0x........: main (timerfd.c:141)
+
+FILE DESCRIPTORS: 4 open (3 inherited) at exit.
+Open file descriptor 3:
+ at 0x........: timerfd_create (in /...libc...)
+ by 0x........: main (timerfd.c:115)
+
+
diff --git a/memcheck/tests/gone_abrt_xml.stderr.exp b/memcheck/tests/gone_abrt_xml.stderr.exp
index b0faf73bdc..9f7b1f52fc 100644
--- a/memcheck/tests/gone_abrt_xml.stderr.exp
+++ b/memcheck/tests/gone_abrt_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -48,16 +48,18 @@ aborting ...
-
FINISHED...
+...
+
...
-
+...
+
diff --git a/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd b/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd
index c97485faf4..6f8d7ec922 100644
--- a/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd
+++ b/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -48,16 +48,18 @@ aborting ...
-
FINISHED...
+...
+
...
-
+...
+
diff --git a/memcheck/tests/gone_abrt_xml.stderr.exp-solaris b/memcheck/tests/gone_abrt_xml.stderr.exp-solaris
index a6c88df27e..1c307433fa 100644
--- a/memcheck/tests/gone_abrt_xml.stderr.exp-solaris
+++ b/memcheck/tests/gone_abrt_xml.stderr.exp-solaris
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -50,16 +50,18 @@ aborting ...
-
FINISHED...
+...
+
...
-
+...
+
diff --git a/memcheck/tests/gone_abrt_xml.vgtest b/memcheck/tests/gone_abrt_xml.vgtest
index dc18192d19..6e2c5d504b 100644
--- a/memcheck/tests/gone_abrt_xml.vgtest
+++ b/memcheck/tests/gone_abrt_xml.vgtest
@@ -1,5 +1,5 @@
prog: ../../gdbserver_tests/gone
args: abort
vgopts: --xml=yes --xml-fd=2 --log-file=/dev/null
-stderr_filter: filter_xml
+stderr_filter: filter_xml_leak
cleanup: rm -f vgcore.*
diff --git a/memcheck/tests/leak.h b/memcheck/tests/leak.h
index f9a2db290d..6b44503276 100644
--- a/memcheck/tests/leak.h
+++ b/memcheck/tests/leak.h
@@ -152,10 +152,10 @@
/* 32bit arm */
#define CLEAR_CALLER_SAVED_REGS \
do { \
- __asm__ __volatile__ ("mov %r0, $0\n\t"); \
- __asm__ __volatile__ ("mov %r1, $0\n\t"); \
- __asm__ __volatile__ ("mov %r2, $0\n\t"); \
- __asm__ __volatile__ ("mov %r3, $0\n\t"); \
+ __asm__ __volatile__ ("mov r0, $0\n\t"); \
+ __asm__ __volatile__ ("mov r1, $0\n\t"); \
+ __asm__ __volatile__ ("mov r2, $0\n\t"); \
+ __asm__ __volatile__ ("mov r3, $0\n\t"); \
} while (0)
#elif defined(__aarch64__)
/* 64bit arm */
diff --git a/memcheck/tests/linux/Makefile.am b/memcheck/tests/linux/Makefile.am
index 13d6a05af0..e28866fc18 100644
--- a/memcheck/tests/linux/Makefile.am
+++ b/memcheck/tests/linux/Makefile.am
@@ -143,6 +143,8 @@ dlclose_leak_LDFLAGS = $(AM_FLAG_M3264_PRI) \
-Wl,-rpath,$(top_builddir)/memcheck/tests/linux
enomem_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_USE_AFTER_FREE@
+memalign_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@
+
if HAVE_STRLCAT
strlcat_strlcpy_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_STRINGOP_OVERFLOW@
endif
diff --git a/memcheck/tests/linux/memalign.stderr.exp b/memcheck/tests/linux/memalign.stderr.exp
index ae9dc6e356..630af58f11 100644
--- a/memcheck/tests/linux/memalign.stderr.exp
+++ b/memcheck/tests/linux/memalign.stderr.exp
@@ -34,7 +34,7 @@ Invalid alignment value: 4097 (should be power of 2)
at 0x........: memalign (vg_replace_malloc.c:...)
by 0x........: main (memalign.c:78)
-memalign() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: memalign (vg_replace_malloc.c:...)
by 0x........: main (memalign.c:87)
diff --git a/memcheck/tests/linux/memalign.stderr.exp-musl b/memcheck/tests/linux/memalign.stderr.exp-musl
index 6d3d3ac980..61e9177e82 100644
--- a/memcheck/tests/linux/memalign.stderr.exp-musl
+++ b/memcheck/tests/linux/memalign.stderr.exp-musl
@@ -34,7 +34,7 @@ Invalid alignment value: 4097 (should be power of 2)
at 0x........: memalign (vg_replace_malloc.c:...)
by 0x........: main (memalign.c:145)
-memalign() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: memalign (vg_replace_malloc.c:...)
by 0x........: main (memalign.c:155)
diff --git a/memcheck/tests/long_namespace_xml.stderr.exp b/memcheck/tests/long_namespace_xml.stderr.exp
index 775fac002b..5229965921 100644
--- a/memcheck/tests/long_namespace_xml.stderr.exp
+++ b/memcheck/tests/long_namespace_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -80,12 +80,13 @@
-
FINISHED...
+...
+
...
@@ -95,5 +96,6 @@
...
-
+...
+
diff --git a/memcheck/tests/long_namespace_xml.stderr.exp-freebsd b/memcheck/tests/long_namespace_xml.stderr.exp-freebsd
new file mode 100644
index 0000000000..e4a9b08fc9
--- /dev/null
+++ b/memcheck/tests/long_namespace_xml.stderr.exp-freebsd
@@ -0,0 +1,103 @@
+
+
+
+
+6
+memcheck
+
+
+ ...
+ ...
+ ...
+ ...
+
+
+...
+...
+memcheck
+
+
+ ...
+
+ ./long_namespace_xml
+
+
+
+
+ RUNNING
+ ...
+
+
+
+ 0x........
+ ...
+ InvalidWrite
+ Invalid write of size 1
+
+
+ 0x........
+ ...
+ _ZN5304abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz5304ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ1fEv
+ ...
+ long_namespace_xml.cpp
+ ...
+
+
+ 0x........
+ ...
+ main
+ ...
+ long_namespace_xml.cpp
+ ...
+
+
+ Address 0x........ is 1 bytes after a block of size 4 alloc'd
+
+
+ 0x........
+ ...
+ malloc
+ ...
+ vg_replace_malloc.c
+ ...
+
+
+ 0x........
+ ...
+ _ZN5304abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz5304ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ1fEv
+ ...
+ long_namespace_xml.cpp
+ ...
+
+
+ 0x........
+ ...
+ main
+ ...
+ long_namespace_xml.cpp
+ ...
+
+
+
+
+
+ FINISHED
+ ...
+
+
+...
+
+...
+
+
+
+ ...
+ 0x........
+
+
+
+...
+
+...
+
+
diff --git a/memcheck/tests/mallinfo2.c b/memcheck/tests/mallinfo2.c
new file mode 100644
index 0000000000..8cdaa789e6
--- /dev/null
+++ b/memcheck/tests/mallinfo2.c
@@ -0,0 +1,133 @@
+#include "tests/malloc.h"
+#include
+#include
+#include // getopt()
+#include "../config.h"
+
+
+static int s_quiet = 0;
+
+
+#if defined(HAVE_MALLINFO2)
+static size_t check(size_t min, size_t max)
+{
+ struct mallinfo2 mi;
+ size_t used;
+
+ mi = mallinfo2();
+
+ if (! s_quiet)
+ {
+ printf("arena = %zu\n", mi.arena); /* non-mmapped space allocated from system */
+ printf("ordblks = %zu\n", mi.ordblks); /* number of free chunks */
+ printf("smblks = %zu\n", mi.smblks); /* number of fastbin blocks */
+ printf("hblks = %zu\n", mi.hblks); /* number of mmapped regions */
+ printf("hblkhd = %zu\n", mi.hblkhd); /* space in mmapped regions */
+ printf("usmblks = %zu\n", mi.usmblks); /* maximum total allocated space */
+ printf("fsmblks = %zu\n", mi.fsmblks); /* space available in freed fastbin blocks */
+ printf("uordblks = %zu\n", mi.uordblks); /* total allocated space */
+ printf("fordblks = %zu\n", mi.fordblks); /* total free space */
+ printf("keepcost = %zu\n", mi.keepcost); /* top-most, releasable (via malloc_trim) space */
+ printf("(min = %zu, max = %zu)\n", min, max);
+ printf("\n");
+ }
+
+ // size checks
+ used = mi.uordblks + mi.hblkhd;
+ if (used < min)
+ exit(1);
+
+ if (used > max)
+ exit(2);
+
+ // used should be reasonably close to min
+ // define "reasonably" as within 20%
+ if (used/5*4 > min)
+ exit(3);
+
+ // sanity checks
+ if ((mi.ordblks == 0) != (mi.fordblks == 0))
+ exit(10);
+
+ if ((mi.smblks == 0) != (mi.fsmblks == 0))
+ exit(11);
+
+ if ((mi.hblks == 0) != (mi.hblkhd == 0))
+ exit(12);
+
+ if (mi.keepcost > mi.fordblks)
+ exit(13);
+
+ if (mi.fsmblks > mi.fordblks)
+ exit(14);
+
+ // arena should be reasonably close to fordblks + uordblks
+ if (mi.arena < mi.fordblks + mi.uordblks)
+ exit(15);
+
+ if (mi.arena/5*4 > mi.fordblks + mi.uordblks)
+ exit(16);
+
+ return used;
+}
+#else
+static size_t check(size_t min, size_t max)
+{
+ if (! s_quiet)
+ {
+ printf("mallinfo() is not supported on this platform.\n");
+ printf("\n");
+ }
+ return 0;
+}
+#endif
+
+int main(int argc, char** argv)
+{
+ void* ptr[40];
+ int i;
+ size_t min, max;
+ int optchar;
+
+ while ((optchar = getopt(argc, argv, "q")) != EOF)
+ {
+ switch (optchar)
+ {
+ case 'q':
+ s_quiet = 1;
+ break;
+ default:
+ fprintf(stderr, "Usage: %s [-q].\n", argv[0]);
+ return 1;
+ }
+ }
+
+ min = 0;
+ for (i = 1; i <= 40; i++)
+ {
+ int size = i * i * 8;
+ min += size;
+ ptr[i - 1] = malloc(size);
+ };
+
+ max = check(min, (size_t)-1);
+
+ for (i = 1; i <= 20; i++)
+ {
+ int size = i * i * 8;
+ min -= size;
+ max -= size;
+ free(ptr[i - 1]);
+ };
+
+ check(min, max);
+
+ for ( ; i <= 40; i++)
+ {
+ free(ptr[i - 1]);
+ }
+
+ fprintf(stderr, "Success.\n");
+
+ return 0;
+}
diff --git a/memcheck/tests/mallinfo2.stderr.exp b/memcheck/tests/mallinfo2.stderr.exp
new file mode 100644
index 0000000000..65f7e5b13d
--- /dev/null
+++ b/memcheck/tests/mallinfo2.stderr.exp
@@ -0,0 +1,11 @@
+
+Success.
+
+HEAP SUMMARY:
+ in use at exit: ... bytes in ... blocks
+ total heap usage: ... allocs, ... frees, ... bytes allocated
+
+For a detailed leak analysis, rerun with: --leak-check=full
+
+For lists of detected and suppressed errors, rerun with: -s
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
diff --git a/memcheck/tests/mallinfo2.vgtest b/memcheck/tests/mallinfo2.vgtest
new file mode 100644
index 0000000000..ba76920727
--- /dev/null
+++ b/memcheck/tests/mallinfo2.vgtest
@@ -0,0 +1,3 @@
+prog: mallinfo2
+args: -q
+stderr_filter: filter_allocs
diff --git a/memcheck/tests/mismatches_xml.stderr.exp b/memcheck/tests/mismatches_xml.stderr.exp
index 95c77bf3c2..20e9a7ead4 100644
--- a/memcheck/tests/mismatches_xml.stderr.exp
+++ b/memcheck/tests/mismatches_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -292,12 +292,13 @@
-
FINISHED...
+...
+
...
@@ -327,5 +328,6 @@
...
-
+...
+
diff --git a/memcheck/tests/mismatches_xml.stderr.exp2 b/memcheck/tests/mismatches_xml.stderr.exp2
index 17972cd066..19eb022f37 100644
--- a/memcheck/tests/mismatches_xml.stderr.exp2
+++ b/memcheck/tests/mismatches_xml.stderr.exp2
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -380,12 +380,13 @@
-
FINISHED...
+...
+
...
@@ -423,5 +424,6 @@
...
-
+...
+
diff --git a/memcheck/tests/posix_memalign.stderr.exp b/memcheck/tests/posix_memalign.stderr.exp
index 3f8075f639..1c4701370b 100644
--- a/memcheck/tests/posix_memalign.stderr.exp
+++ b/memcheck/tests/posix_memalign.stderr.exp
@@ -1,4 +1,4 @@
-posix_memalign() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: posix_memalign (vg_replace_malloc.c:...)
by 0x........: main (posix_memalign.c:32)
diff --git a/memcheck/tests/posix_memalign_supp.supp b/memcheck/tests/posix_memalign_supp.supp
index a38ba23b0c..23572e40f1 100644
--- a/memcheck/tests/posix_memalign_supp.supp
+++ b/memcheck/tests/posix_memalign_supp.supp
@@ -1,7 +1,7 @@
{
posix_memalign size
- Memcheck:BadSize
+ Memcheck:UnsafeZeroSize
fun:posix_memalign
fun:main
}
@@ -15,8 +15,8 @@
# Darwin uses zones
{
- posix_memalign size
- Memcheck:BadSize
+ posix_memalign zero size
+ Memcheck:UnsafeZeroSize
fun:malloc_zone_memalign
fun:posix_memalign
fun:main
diff --git a/memcheck/tests/posix_memalign_xml.stderr.exp b/memcheck/tests/posix_memalign_xml.stderr.exp
index ad30c3d105..9941ebc661 100644
--- a/memcheck/tests/posix_memalign_xml.stderr.exp
+++ b/memcheck/tests/posix_memalign_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -32,7 +32,7 @@
0x...........InvalidSize
- posix_memalign() invalid size value: 0
+ Unsafe allocation with size of zero is implementation-defined0x........
@@ -278,12 +278,13 @@
-
FINISHED...
+...
+
...
@@ -329,5 +330,6 @@
...
-
+...
+
diff --git a/memcheck/tests/realloc_size_zero_xml.stderr.exp b/memcheck/tests/realloc_size_zero_xml.stderr.exp
new file mode 100644
index 0000000000..db198b7ce1
--- /dev/null
+++ b/memcheck/tests/realloc_size_zero_xml.stderr.exp
@@ -0,0 +1,87 @@
+
+
+
+
+6
+memcheck
+
+
+ ...
+ ...
+ ...
+ ...
+
+
+...
+...
+memcheck
+
+
+ ...
+
+ ./realloc_size_zero
+
+
+
+
+ RUNNING
+ ...
+
+
+
+ 0x........
+ ...
+ ReallocSizeZero
+ realloc() with size 0
+
+
+ 0x........
+ ...
+ realloc
+ ...
+ vg_replace_malloc.c
+ ...
+
+
+ 0x........
+ ...
+ main
+ ...
+ realloc_size_zero.c
+ ...
+
+
+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd
+
+
+ 0x........
+ ...
+ malloc
+ ...
+ vg_replace_malloc.c
+ ...
+
+
+ 0x........
+ ...
+ main
+ ...
+ realloc_size_zero.c
+ ...
+
+
+
+
+
+ FINISHED
+ ...
+
+
+
+
+ ...
+ 0x........
+
+
+
+
diff --git a/memcheck/tests/realloc_size_zero_xml.stdout.exp b/memcheck/tests/realloc_size_zero_xml.stdout.exp
new file mode 100644
index 0000000000..103f1d5ebc
--- /dev/null
+++ b/memcheck/tests/realloc_size_zero_xml.stdout.exp
@@ -0,0 +1,2 @@
+p not NULL after realloc 0
+p2 not NULL after realloc 0
diff --git a/memcheck/tests/realloc_size_zero_xml.stdout.exp-glibc b/memcheck/tests/realloc_size_zero_xml.stdout.exp-glibc
new file mode 100644
index 0000000000..ed2bcf0cd4
--- /dev/null
+++ b/memcheck/tests/realloc_size_zero_xml.stdout.exp-glibc
@@ -0,0 +1,2 @@
+p is NULL after realloc 0
+p2 not NULL after realloc 0
diff --git a/memcheck/tests/realloc_size_zero_xml.vgtest b/memcheck/tests/realloc_size_zero_xml.vgtest
new file mode 100644
index 0000000000..226289cb0a
--- /dev/null
+++ b/memcheck/tests/realloc_size_zero_xml.vgtest
@@ -0,0 +1,6 @@
+prog: realloc_size_zero
+vgopts: -q --xml=yes --xml-fd=2 --log-file=/dev/null --show-possibly-lost=no
+stderr_filter: filter_xml
+
+
+
diff --git a/memcheck/tests/s390x/Makefile.am b/memcheck/tests/s390x/Makefile.am
index 32a898ca5f..580fc1ee99 100644
--- a/memcheck/tests/s390x/Makefile.am
+++ b/memcheck/tests/s390x/Makefile.am
@@ -2,7 +2,7 @@ include $(top_srcdir)/Makefile.tool-tests.am
dist_noinst_SCRIPTS = filter_stderr
-INSN_TESTS = cdsg cli cu21 cu42 ltgjhe tmxx vstrc vfae vistr vstrs
+INSN_TESTS = cdsg cli cu21 cu42 ltgjhe tmxx vstrc vfae vistr vstrs vme
check_PROGRAMS = $(INSN_TESTS)
diff --git a/memcheck/tests/s390x/vme.c b/memcheck/tests/s390x/vme.c
new file mode 100644
index 0000000000..1e29b09884
--- /dev/null
+++ b/memcheck/tests/s390x/vme.c
@@ -0,0 +1,101 @@
+#define VECTOR __attribute__((vector_size(16)))
+
+typedef unsigned char VECTOR uchar_v;
+
+volatile char tmp;
+static const char use_idx[] = "01234567890abcdefghijklmnopqrstu";
+
+static void depend_on(uchar_v v)
+{
+ int val = 0;
+ for (int i = 0; i < 16; i++)
+ val += v[i];
+ tmp = use_idx[val & 31];
+}
+
+static void pretend_write(uchar_v* v) { __asm__("" : "=m"(*v) : :); }
+
+enum evenodd { even, odd };
+
+static uchar_v
+init_vec(uchar_v v, unsigned char es, enum evenodd e, unsigned char val)
+{
+ int mask = 1 << es;
+ int last = (mask - 1) & 15;
+
+ for (int i = 0; i < 16; i++) {
+ if ((i & mask) == (e == even ? 0 : mask))
+ v[i] = ((i & last) == last) ? val : 0;
+ }
+ return v;
+}
+
+#define GEN_TEST2(mnem, es) \
+ static void test_##mnem##_##es(uchar_v x, enum evenodd e) \
+ { \
+ uchar_v res; \
+ uchar_v a = init_vec(x, es, e, 2); \
+ uchar_v b = init_vec(x, es, e, 3); \
+ __asm__(#mnem " %[v1],%[v2],%[v3]," #es \
+ : [v1] "=v"(res) \
+ : [v2] "v"(a), [v3] "v"(b)); \
+ depend_on(res); \
+ }
+
+#define GEN_TEST3(mnem, es) \
+ static void test_##mnem##_##es(uchar_v x, enum evenodd e) \
+ { \
+ uchar_v z = { 0 }; \
+ uchar_v res; \
+ uchar_v a = init_vec(x, es, e, 2); \
+ uchar_v b = init_vec(x, es, e, 3); \
+ uchar_v c = init_vec(z, es, e, 4); \
+ __asm__(#mnem " %[v1],%[v2],%[v3],%[v4]," #es \
+ : [v1] "=v"(res) \
+ : [v2] "v"(a), [v3] "v"(b), [v4] "v"(c)); \
+ depend_on(res); \
+ }
+
+GEN_TEST2(vme, 0)
+GEN_TEST2(vme, 1)
+GEN_TEST2(vme, 2)
+GEN_TEST2(vmo, 2)
+GEN_TEST2(vmle, 1)
+GEN_TEST2(vmlo, 2)
+
+GEN_TEST3(vmae, 0)
+GEN_TEST3(vmale, 1)
+GEN_TEST3(vmao, 2)
+GEN_TEST3(vmalo, 2)
+
+static void do_valid(uchar_v x)
+{
+ test_vme_0(x, even);
+ test_vme_1(x, even);
+ test_vme_2(x, even);
+ test_vmo_2(x, odd);
+ test_vmle_1(x, even);
+ test_vmlo_2(x, odd);
+ test_vmae_0(x, even);
+ test_vmale_1(x, even);
+ test_vmao_2(x, odd);
+ test_vmalo_2(x, odd);
+}
+
+static void do_invalid(uchar_v x)
+{
+ test_vme_0(x, odd);
+ test_vme_1(x, odd);
+ test_vme_2(x, odd);
+ test_vmo_2(x, even);
+ test_vmale_1(x, odd);
+}
+
+int main(void)
+{
+ uchar_v x;
+ pretend_write(&x);
+ do_valid(x);
+ do_invalid(x);
+ return 0;
+}
diff --git a/memcheck/tests/s390x/vme.stderr.exp b/memcheck/tests/s390x/vme.stderr.exp
new file mode 100644
index 0000000000..a66b80b5d9
--- /dev/null
+++ b/memcheck/tests/s390x/vme.stderr.exp
@@ -0,0 +1,30 @@
+Use of uninitialised value of size 8
+ at 0x........: depend_on (vme.c:13)
+ by 0x........: test_vme_0 (vme.c:59)
+ by 0x........: do_invalid (vme.c:87)
+ by 0x........: main (vme.c:99)
+
+Use of uninitialised value of size 8
+ at 0x........: depend_on (vme.c:13)
+ by 0x........: test_vme_1 (vme.c:60)
+ by 0x........: do_invalid (vme.c:88)
+ by 0x........: main (vme.c:99)
+
+Use of uninitialised value of size 8
+ at 0x........: depend_on (vme.c:13)
+ by 0x........: test_vme_2 (vme.c:61)
+ by 0x........: do_invalid (vme.c:89)
+ by 0x........: main (vme.c:99)
+
+Use of uninitialised value of size 8
+ at 0x........: depend_on (vme.c:13)
+ by 0x........: test_vmo_2 (vme.c:62)
+ by 0x........: do_invalid (vme.c:90)
+ by 0x........: main (vme.c:99)
+
+Use of uninitialised value of size 8
+ at 0x........: depend_on (vme.c:13)
+ by 0x........: test_vmale_1 (vme.c:67)
+ by 0x........: do_invalid (vme.c:91)
+ by 0x........: main (vme.c:99)
+
diff --git a/none/tests/s390x/disasm-test/disasm-test.stdout.exp b/memcheck/tests/s390x/vme.stdout.exp
similarity index 100%
rename from none/tests/s390x/disasm-test/disasm-test.stdout.exp
rename to memcheck/tests/s390x/vme.stdout.exp
diff --git a/memcheck/tests/s390x/vme.vgtest b/memcheck/tests/s390x/vme.vgtest
new file mode 100644
index 0000000000..b35858ea63
--- /dev/null
+++ b/memcheck/tests/s390x/vme.vgtest
@@ -0,0 +1,2 @@
+prog: vme
+vgopts: -q
diff --git a/memcheck/tests/sized_aligned_new_delete_misaligned1_xml.stderr.exp b/memcheck/tests/sized_aligned_new_delete_misaligned1_xml.stderr.exp
index b8e230165c..5a2602b466 100644
--- a/memcheck/tests/sized_aligned_new_delete_misaligned1_xml.stderr.exp
+++ b/memcheck/tests/sized_aligned_new_delete_misaligned1_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -454,12 +454,13 @@
-
FINISHED...
+...
+
...
@@ -521,5 +522,6 @@
...
-
+...
+
diff --git a/memcheck/tests/sized_aligned_new_delete_misaligned2_xml.stderr.exp b/memcheck/tests/sized_aligned_new_delete_misaligned2_xml.stderr.exp
index 321ed1dce9..a785bd2369 100644
--- a/memcheck/tests/sized_aligned_new_delete_misaligned2_xml.stderr.exp
+++ b/memcheck/tests/sized_aligned_new_delete_misaligned2_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -58,6 +58,7 @@
new/new[] aligned failed and should throw an exception, but Valgrind
+
... cannot throw exceptions and so is aborting instead. Sorry.
@@ -95,6 +96,8 @@
...
+...
+
...
@@ -104,5 +107,6 @@
...
-
+...
+
diff --git a/memcheck/tests/sized_aligned_new_delete_misaligned3_xml.stderr.exp b/memcheck/tests/sized_aligned_new_delete_misaligned3_xml.stderr.exp
index f2fe0134bc..f7c23306ff 100644
--- a/memcheck/tests/sized_aligned_new_delete_misaligned3_xml.stderr.exp
+++ b/memcheck/tests/sized_aligned_new_delete_misaligned3_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -58,6 +58,7 @@
new/new[] aligned failed and should throw an exception, but Valgrind
+
... cannot throw exceptions and so is aborting instead. Sorry.
@@ -95,6 +96,8 @@
...
+...
+
...
@@ -104,5 +107,6 @@
...
-
+...
+
diff --git a/memcheck/tests/solaris/memalign.stderr.exp b/memcheck/tests/solaris/memalign.stderr.exp
index dd24412523..fa9e333a58 100644
--- a/memcheck/tests/solaris/memalign.stderr.exp
+++ b/memcheck/tests/solaris/memalign.stderr.exp
@@ -1,4 +1,4 @@
-memalign() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: memalign (vg_replace_malloc.c:...)
by 0x........: main (memalign.c:29)
diff --git a/memcheck/tests/solaris/scalar.stderr.exp b/memcheck/tests/solaris/scalar.stderr.exp
index d80bc27d07..e7951dae77 100644
--- a/memcheck/tests/solaris/scalar.stderr.exp
+++ b/memcheck/tests/solaris/scalar.stderr.exp
@@ -618,7 +618,6 @@ Syscall param shmsys_shmdt(opcode) contains uninitialised byte(s)
Syscall param shmsys_shmdt(shmaddr) contains uninitialised byte(s)
...
-Warning: client syscall shmdt tried to modify addresses 0x........-0x........
---------------------------------------------------------
52: SYS_shmsys (SHMGET) 4s 0m
---------------------------------------------------------
diff --git a/memcheck/tests/solaris/syscall_at.stderr.exp b/memcheck/tests/solaris/syscall_at.stderr.exp
index b49fda289f..59815bfa98 100644
--- a/memcheck/tests/solaris/syscall_at.stderr.exp
+++ b/memcheck/tests/solaris/syscall_at.stderr.exp
@@ -1,12 +1,12 @@
-Warning: invalid file descriptor 159879507 in syscall linkat()
-Warning: invalid file descriptor 159879508 in syscall linkat()
+Warning: invalid file descriptor 159879507 in syscall linkat(efd)()
+Warning: invalid file descriptor 159879508 in syscall linkat(nfd)()
Warning: invalid file descriptor 646349138 in syscall symlinkat()
Warning: invalid file descriptor 70680914 in syscall readlinkat()
Warning: invalid file descriptor 68362578 in syscall faccessat()
Warning: invalid file descriptor 70685266 in syscall fchownat()
-Warning: invalid file descriptor 70717779 in syscall renameat()
-Warning: invalid file descriptor 70717780 in syscall renameat()
+Warning: invalid file descriptor 70717779 in syscall renameat(fromfd)()
+Warning: invalid file descriptor 70717780 in syscall renameat(tofd)()
Warning: invalid file descriptor 123765074 in syscall unlinkat()
Warning: invalid file descriptor 1112625490 in syscall fstatat()
Warning: invalid file descriptor 151224658 in syscall openat()
diff --git a/memcheck/tests/threadname_xml.stderr.exp b/memcheck/tests/threadname_xml.stderr.exp
index 3f9e593e2f..1671b50a26 100644
--- a/memcheck/tests/threadname_xml.stderr.exp
+++ b/memcheck/tests/threadname_xml.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -191,6 +191,7 @@
I am in child_fn_1
+
0x...........
@@ -296,12 +297,15 @@
-
FINISHED...
+...
+
+...
+
...
@@ -327,5 +331,6 @@
...
-
+...
+
diff --git a/memcheck/tests/vbit-test/Makefile.am b/memcheck/tests/vbit-test/Makefile.am
index ded4ab1747..d406da76bd 100644
--- a/memcheck/tests/vbit-test/Makefile.am
+++ b/memcheck/tests/vbit-test/Makefile.am
@@ -48,7 +48,7 @@ vbit_test_CPPFLAGS = $(AM_CPPFLAGS_PRI) \
-I$(top_srcdir)/include \
-I$(top_srcdir)/memcheck \
-I$(top_srcdir)/VEX/pub
-vbit_test_CFLAGS = $(AM_CFLAGS_PRI)
+vbit_test_CFLAGS = $(AM_CFLAGS_PRI) -fhosted
vbit_test_DEPENDENCIES = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
vbit_test_LDADD = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
vbit_test_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@
@@ -67,7 +67,7 @@ vbit_test_sec_CPPFLAGS = $(AM_CPPFLAGS_SEC) \
-I$(top_srcdir)/include \
-I$(top_srcdir)/memcheck \
-I$(top_srcdir)/VEX/pub
-vbit_test_sec_CFLAGS = $(AM_CFLAGS_SEC) \
+vbit_test_sec_CFLAGS = $(AM_CFLAGS_SEC) -fhosted \
$(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
vbit_test_sec_DEPENDENCIES = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \
$(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
diff --git a/memcheck/tests/vbit-test/binary.c b/memcheck/tests/vbit-test/binary.c
index 4ac0435b00..c269236fd2 100644
--- a/memcheck/tests/vbit-test/binary.c
+++ b/memcheck/tests/vbit-test/binary.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/memcheck/tests/vbit-test/irops.c b/memcheck/tests/vbit-test/irops.c
index 4755ce41cc..46af4fa97b 100644
--- a/memcheck/tests/vbit-test/irops.c
+++ b/memcheck/tests/vbit-test/irops.c
@@ -9,7 +9,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -108,14 +108,10 @@ static irop_t irops[] = {
{ DEFOP(Iop_MullU16, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 },
{ DEFOP(Iop_MullU32, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 1 }, // mips asserts
{ DEFOP(Iop_MullU64, UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32, mips assert
- { DEFOP(Iop_Clz64, UNDEF_ALL), .s390x = 0, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32 asserts
- { DEFOP(Iop_Clz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 },
- { DEFOP(Iop_Ctz64, UNDEF_ALL), .s390x = 0, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 },
- { DEFOP(Iop_Ctz32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 },
- { DEFOP(Iop_ClzNat64, UNDEF_ALL), .s390x = 1, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, // ppc32 asserts
- { DEFOP(Iop_ClzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 },
- { DEFOP(Iop_CtzNat64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 },
- { DEFOP(Iop_CtzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 1, .mips32 =0, .mips64 = 0 },
+ { DEFOP(Iop_ClzNat64, UNDEF_ALL), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32 asserts
+ { DEFOP(Iop_ClzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 },
+ { DEFOP(Iop_CtzNat64, UNDEF_ALL), .s390x = 0, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 },
+ { DEFOP(Iop_CtzNat32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 1, .mips32 =0, .mips64 = 0 },
{ DEFOP(Iop_PopCount64, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 },
{ DEFOP(Iop_PopCount32, UNDEF_ALL), .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 },
{ DEFOP(Iop_CmpLT32S, UNDEF_ALL), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 },
@@ -1449,6 +1445,6 @@ get_irop(IROp op)
}
}
- fprintf(stderr, "unknown opcode %d\n", op);
+ fprintf(stderr, "unknown opcode %u\n", (unsigned)op);
exit(1);
}
diff --git a/memcheck/tests/vbit-test/main.c b/memcheck/tests/vbit-test/main.c
index db829dddaa..858a516c09 100644
--- a/memcheck/tests/vbit-test/main.c
+++ b/memcheck/tests/vbit-test/main.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -183,7 +183,7 @@ main(int argc, char *argv[])
valgrind_vex_init_for_iri(&iricb);
- switch (iricb.num_operands) {
+ switch (iricb.vbit.num_operands) {
case 1:
num_unary_tests += test_unary_op(op, data);
break;
diff --git a/memcheck/tests/vbit-test/qernary.c b/memcheck/tests/vbit-test/qernary.c
index 3e719110bc..265a1fd5b8 100644
--- a/memcheck/tests/vbit-test/qernary.c
+++ b/memcheck/tests/vbit-test/qernary.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/memcheck/tests/vbit-test/ternary.c b/memcheck/tests/vbit-test/ternary.c
index 96d392de79..1a326fb290 100644
--- a/memcheck/tests/vbit-test/ternary.c
+++ b/memcheck/tests/vbit-test/ternary.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/memcheck/tests/vbit-test/unary.c b/memcheck/tests/vbit-test/unary.c
index 836026597a..e6f51b7f4c 100644
--- a/memcheck/tests/vbit-test/unary.c
+++ b/memcheck/tests/vbit-test/unary.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/memcheck/tests/vbit-test/util.c b/memcheck/tests/vbit-test/util.c
index 63eabc8993..221289e8a5 100644
--- a/memcheck/tests/vbit-test/util.c
+++ b/memcheck/tests/vbit-test/util.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -25,25 +25,6 @@
#include // fprintf
#include // exit
#include // assert
-#if defined(__APPLE__)
-#include
-#define __BYTE_ORDER BYTE_ORDER
-#define __LITTLE_ENDIAN LITTLE_ENDIAN
-#elif defined(__sun)
-#define __LITTLE_ENDIAN 1234
-#define __BIG_ENDIAN 4321
-# if defined(_LITTLE_ENDIAN)
-# define __BYTE_ORDER __LITTLE_ENDIAN
-# else
-# define __BYTE_ORDER __BIG_ENDIAN
-# endif
-#elif defined(__linux__)
-#include
-#else
-#define __BYTE_ORDER BYTE_ORDER
-#define __LITTLE_ENDIAN LITTLE_ENDIAN
-#include
-#endif
#include
#include "vtest.h"
@@ -86,13 +67,13 @@ static void
print_value(FILE *fp, value_t val, unsigned num_bits)
{
switch (num_bits) {
- case 1: fprintf(fp, "%02x", val.u8); break;
+ case 1: fprintf(fp, "%01x", val.u32); break; // see comment in vbits.h
case 8: fprintf(fp, "%02x", val.u8); break;
case 16: fprintf(fp, "%04x", val.u16); break;
case 32: fprintf(fp, "%08x", val.u32); break;
case 64: fprintf(fp, "%016"PRIx64, val.u64); break;
case 128:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
fprintf(fp, "%016"PRIx64, val.u128[1]);
fprintf(fp, "%016"PRIx64, val.u128[0]);
} else {
@@ -101,7 +82,7 @@ print_value(FILE *fp, value_t val, unsigned num_bits)
}
break;
case 256:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
fprintf(fp, "%016"PRIx64, val.u256[3]);
fprintf(fp, "%016"PRIx64, val.u256[2]);
fprintf(fp, "%016"PRIx64, val.u256[1]);
diff --git a/memcheck/tests/vbit-test/valgrind.c b/memcheck/tests/vbit-test/valgrind.c
index c24a06d649..5450cc29ec 100644
--- a/memcheck/tests/vbit-test/valgrind.c
+++ b/memcheck/tests/vbit-test/valgrind.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -31,7 +31,7 @@
IRICB
new_iricb(const irop_t *op, test_data_t *data)
{
- IRICB cb;
+ IRICB_vbit_payload cb;
cb.op = op->op;
cb.result = (HWord)&data->result.value;
@@ -52,7 +52,7 @@ new_iricb(const irop_t *op, test_data_t *data)
cb.immediate_index = op->immediate_index;
cb.immediate_type = op->immediate_type;
- return cb;
+ return (IRICB) { .kind = IRICB_vbit, .vbit = cb };
}
@@ -64,7 +64,7 @@ valgrind_set_vbits(opnd_t *opnd)
{
unsigned rc, num_bytes;
- /* 1-bit wide values cannot be read. So we read a 4 bytes here */
+ /* 1-bit wide values cannot be read. So we read 4 bytes here */
num_bytes = opnd->type == Ity_I1 ? 4 : sizeof_irtype(opnd->type);
rc = VALGRIND_SET_VBITS(&opnd->value, &opnd->vbits.bits, num_bytes);
assert(rc == 1);
@@ -83,8 +83,8 @@ valgrind_get_vbits(opnd_t *opnd)
{
unsigned rc, num_bytes;
- /* 1-bit wide values cannot be stored. So we store them by writing a
- single byte */
+ /* 1-bit wide values cannot be stored. So we store them by writing
+ 4 bytes which is what ir_inject.c expects. */
num_bytes = opnd->type == Ity_I1 ? 4 : sizeof_irtype(opnd->type);
opnd->vbits.num_bits = bitsof_irtype(opnd->type);
rc = VALGRIND_GET_VBITS(&opnd->value, &opnd->vbits.bits, num_bytes);
diff --git a/memcheck/tests/vbit-test/vbit-test-sec.vgtest b/memcheck/tests/vbit-test/vbit-test-sec.vgtest
index 2d3c9389da..8d84e7e90b 100644
--- a/memcheck/tests/vbit-test/vbit-test-sec.vgtest
+++ b/memcheck/tests/vbit-test/vbit-test-sec.vgtest
@@ -1,3 +1,3 @@
prog: vbit-test-sec
prereq: test -x vbit-test-sec
-vgopts: -q --expensive-definedness-checks=yes
+vgopts: -q --expensive-definedness-checks=yes --vex-guest-chase=no
diff --git a/memcheck/tests/vbit-test/vbit-test.vgtest b/memcheck/tests/vbit-test/vbit-test.vgtest
index a05890566b..198c62351c 100644
--- a/memcheck/tests/vbit-test/vbit-test.vgtest
+++ b/memcheck/tests/vbit-test/vbit-test.vgtest
@@ -1,2 +1,2 @@
prog: vbit-test
-vgopts: -q --expensive-definedness-checks=yes
+vgopts: -q --expensive-definedness-checks=yes --vex-guest-chase=no
diff --git a/memcheck/tests/vbit-test/vbits.c b/memcheck/tests/vbit-test/vbits.c
index ca4bc72bdb..b4f7eb17cd 100644
--- a/memcheck/tests/vbit-test/vbits.c
+++ b/memcheck/tests/vbit-test/vbits.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -24,25 +24,6 @@
#include // fprintf
#include // assert
-#if defined(__APPLE__)
-#include
-#define __BYTE_ORDER BYTE_ORDER
-#define __LITTLE_ENDIAN LITTLE_ENDIAN
-#elif defined(__sun)
-#define __LITTLE_ENDIAN 1234
-#define __BIG_ENDIAN 4321
-# if defined(_LITTLE_ENDIAN)
-# define __BYTE_ORDER __LITTLE_ENDIAN
-# else
-# define __BYTE_ORDER __BIG_ENDIAN
-# endif
-#elif defined(__linux__)
-#include
-#else
-#include
-#define __BYTE_ORDER BYTE_ORDER
-#define __LITTLE_ENDIAN LITTLE_ENDIAN
-#endif
#include
#include "vbits.h"
#include "vtest.h"
@@ -79,7 +60,7 @@ print_vbits(FILE *fp, vbits_t v)
case 32: fprintf(fp, "%08x", v.bits.u32); break;
case 64: fprintf(fp, "%016"PRIx64, v.bits.u64); break;
case 128:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
fprintf(fp, "%016"PRIx64, v.bits.u128[1]);
fprintf(fp, "%016"PRIx64, v.bits.u128[0]);
} else {
@@ -88,7 +69,7 @@ print_vbits(FILE *fp, vbits_t v)
}
break;
case 256:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
fprintf(fp, "%016"PRIx64, v.bits.u256[3]);
fprintf(fp, "%016"PRIx64, v.bits.u256[2]);
fprintf(fp, "%016"PRIx64, v.bits.u256[1]);
@@ -340,7 +321,7 @@ undefined_vbits_Narrow256_AtoB(unsigned int src_num_bits,
}
}
}
- if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ if (! host_is_big_endian())
new.bits.u128[1] = new_value;
else
/* Big endian, swap the upper and lower 32-bits of new_value */
@@ -396,7 +377,7 @@ undefined_vbits_Narrow256_AtoB(unsigned int src_num_bits,
}
}
}
- if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ if (! host_is_big_endian())
new.bits.u128[0] = new_value;
else
/* Big endian, swap the upper and lower 32-bits of new_value */
@@ -472,12 +453,12 @@ truncate_vbits(vbits_t v, unsigned num_bits)
if (v.num_bits <= 64)
bits = get_bits64(v);
else if (v.num_bits == 128)
- if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ if (! host_is_big_endian())
bits = v.bits.u128[0];
else
bits = v.bits.u128[1];
else if (v.num_bits == 256)
- if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ if (! host_is_big_endian())
bits = v.bits.u256[0];
else
bits = v.bits.u256[3];
@@ -499,7 +480,7 @@ truncate_vbits(vbits_t v, unsigned num_bits)
if (num_bits == 128) {
assert(v.num_bits == 256);
/* From 256 bits to 128 */
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
new.bits.u128[0] = v.bits.u256[0];
new.bits.u128[1] = v.bits.u256[1];
} else {
@@ -539,7 +520,7 @@ left_vbits(vbits_t v, unsigned num_bits)
case 32: new.bits.u32 = bits & ~0u; break;
case 64: new.bits.u64 = bits & ~0ll; break;
case 128:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
new.bits.u128[0] = bits;
if (bits & (1ull << 63)) { // MSB is set
new.bits.u128[1] = ~0ull;
@@ -556,7 +537,7 @@ left_vbits(vbits_t v, unsigned num_bits)
}
break;
case 256:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
new.bits.u256[0] = bits;
if (bits & (1ull << 63)) { // MSB is set
new.bits.u256[1] = ~0ull;
@@ -587,7 +568,7 @@ left_vbits(vbits_t v, unsigned num_bits)
}
if (v.num_bits == 128) {
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
if (v.bits.u128[1] != 0) {
new.bits.u128[0] = v.bits.u128[0];
new.bits.u128[1] = left64(v.bits.u128[1]);
@@ -616,7 +597,7 @@ left_vbits(vbits_t v, unsigned num_bits)
assert(num_bits == 256);
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
uint64_t b1 = new.bits.u128[1];
uint64_t b0 = new.bits.u128[0];
@@ -725,7 +706,7 @@ concat_vbits(vbits_t v1, vbits_t v2)
case 32: new.bits.u64 = v1.bits.u32;
new.bits.u64 = (new.bits.u64 << 32) | v2.bits.u32; break;
case 64:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
new.bits.u128[0] = v2.bits.u64;
new.bits.u128[1] = v1.bits.u64;
} else {
@@ -734,7 +715,7 @@ concat_vbits(vbits_t v1, vbits_t v2)
}
break;
case 128:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
new.bits.u256[0] = v2.bits.u128[0];
new.bits.u256[1] = v2.bits.u128[1];
new.bits.u256[2] = v1.bits.u128[0];
@@ -765,13 +746,13 @@ upper_vbits(vbits_t v)
case 32: new.bits.u16 = v.bits.u32 >> 16; break;
case 64: new.bits.u32 = v.bits.u64 >> 32; break;
case 128:
- if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ if (! host_is_big_endian())
new.bits.u64 = v.bits.u128[1];
else
new.bits.u64 = v.bits.u128[0];
break;
case 256:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
new.bits.u128[0] = v.bits.u256[2];
new.bits.u128[1] = v.bits.u256[3];
} else {
@@ -806,7 +787,7 @@ zextend_vbits(vbits_t v, unsigned num_bits)
case 32: new.bits.u32 = bits; break;
case 64: new.bits.u64 = bits; break;
case 128:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
new.bits.u128[0] = bits;
new.bits.u128[1] = 0;
} else {
@@ -815,7 +796,7 @@ zextend_vbits(vbits_t v, unsigned num_bits)
}
break;
case 256:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
new.bits.u256[0] = bits;
new.bits.u256[1] = 0;
new.bits.u256[2] = 0;
@@ -836,7 +817,7 @@ zextend_vbits(vbits_t v, unsigned num_bits)
if (v.num_bits == 128) {
assert(num_bits == 256);
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
new.bits.u256[0] = v.bits.u128[0];
new.bits.u256[1] = v.bits.u128[1];
new.bits.u256[2] = 0;
@@ -892,7 +873,7 @@ onehot_vbits(unsigned bitno, unsigned num_bits)
case 32: new.bits.u32 = 1u << bitno; break;
case 64: new.bits.u64 = 1ull << bitno; break;
case 128:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
if (bitno < 64) {
new.bits.u128[0] = 1ull << bitno;
new.bits.u128[1] = 0;
@@ -911,7 +892,7 @@ onehot_vbits(unsigned bitno, unsigned num_bits)
}
break;
case 256:
- if (__BYTE_ORDER == __LITTLE_ENDIAN) {
+ if (! host_is_big_endian()) {
if (bitno < 64) {
new.bits.u256[0] = 1ull << bitno;
new.bits.u256[1] = 0;
diff --git a/memcheck/tests/vbit-test/vbits.h b/memcheck/tests/vbit-test/vbits.h
index 53ba328aa0..995f36cb35 100644
--- a/memcheck/tests/vbit-test/vbits.h
+++ b/memcheck/tests/vbit-test/vbits.h
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -48,7 +48,19 @@ typedef struct {
/* A type large enough to hold any IRType'd value. At this point
we do not expect to test with specific floating point values.
- So we don't need to represent them. */
+ So we don't need to represent them.
+
+ NOTE: Values of type Ity_I1 are stored in the u32 variant. This is
+ inconsistent with the way such values are stored elsewhere in VEX,
+ namely, in an 8-bit container. Why is that?
+ The reason is that libvex_ir.h does not provide an Iop_8to1 operator.
+ However, that would be needed in ir_inject.c when loading a 1-bit value
+ from memory (see function load_aux there). Instead of today's
+ return unop(Iop_32to1, IRExpr_Load(endian, Ity_I32, addr));
+ we'd like to write
+ return unop(Iop_8to1, IRExpr_Load(endian, Ity_I8, addr));
+ But cannot do. Grrrrr...
+ */
typedef union {
uint8_t u8;
uint16_t u16;
diff --git a/memcheck/tests/vbit-test/vtest.h b/memcheck/tests/vbit-test/vtest.h
index 5f2b2e03fb..907a31cfa7 100644
--- a/memcheck/tests/vbit-test/vtest.h
+++ b/memcheck/tests/vbit-test/vtest.h
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -250,6 +250,10 @@ static __inline__ unsigned bitsof_irtype(IRType type)
return type == Ity_I1 ? 1 : sizeof_irtype(type) * 8;
}
+static __inline__ int host_is_big_endian(void)
+{
+ return ((*(UShort *)(&(UInt){ 0x11223344 })) == 0x1122);
+}
/* Exported variables */
extern int verbose;
diff --git a/memcheck/tests/x86-freebsd/Makefile.am b/memcheck/tests/x86-freebsd/Makefile.am
index 913914a043..8c48506c2b 100644
--- a/memcheck/tests/x86-freebsd/Makefile.am
+++ b/memcheck/tests/x86-freebsd/Makefile.am
@@ -1,7 +1,7 @@
include $(top_srcdir)/Makefile.tool-tests.am
-dist_noinst_SCRIPTS = filter_stderr
+dist_noinst_SCRIPTS = filter_stderr filter_arg_check
EXTRA_DIST = \
posix_fadvise.vgtest \
@@ -9,15 +9,18 @@ EXTRA_DIST = \
posix_fadvise.stderr.exp \
posix_fallocate.stderr.exp \
reallocarray.vgtest \
- reallocarray.stderr.exp
+ reallocarray.stderr.exp \
+ scalar_arg_check.vgtest \
+ scalar_arg_check.stderr.exp
check_PROGRAMS = \
- posix_fadvise posix_fallocate reallocarray
+ posix_fadvise posix_fallocate reallocarray scalar_arg_check
# Linux also adds $(FLAG_MMMX) $(FLAG_MSSE) to the first two
AM_CFLAGS += @FLAG_M32@
AM_CXXFLAGS += @FLAG_M32@
AM_CCASFLAGS += @FLAG_M32@
-posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
-posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
diff --git a/memcheck/tests/x86-freebsd/filter_arg_check b/memcheck/tests/x86-freebsd/filter_arg_check
new file mode 100755
index 0000000000..f7bc245b78
--- /dev/null
+++ b/memcheck/tests/x86-freebsd/filter_arg_check
@@ -0,0 +1,20 @@
+#! /bin/sh
+
+# Only one test uses this which calls syscall(SYS_sendfile)
+# which is the only x86 syscall that uses 8 arguments
+# The output includes --trace-syscalls=yes which is very verbose
+# but we only want to see the sendfile line
+
+# the libc signature for sendfile is
+# int sendfile(int fd, int s, off_t offset, size_t nbytes,
+# struct sf_hdtr *hdtr, off_t *sbytes, int flags);
+# The testcase uses values from 101 to 108 for the arguments
+# (to make it easy to match the testcase to the log output)
+# Some of the arguments are printed as hex, not too bad.
+# Argument 3 is a 64bit value made up from the 32bit arguments
+# 3 and 4 resulting in 7 values in the expected.
+
+grep "SYSCALL.*sendfile" |
+sed 's/==.*//' |
+sed -E 's/\[[0-9]+/[xxxxx/'
+
diff --git a/memcheck/tests/x86-freebsd/scalar_arg_check.c b/memcheck/tests/x86-freebsd/scalar_arg_check.c
new file mode 100644
index 0000000000..c608150f2d
--- /dev/null
+++ b/memcheck/tests/x86-freebsd/scalar_arg_check.c
@@ -0,0 +1,8 @@
+#include "../freebsd/scalar.h"
+
+int main(void)
+{
+ /* sendfile uses 8 args */
+ SY(SYS_sendfile, 101, 102, 103, 104, 105, 106, 107, 108);
+}
+
diff --git a/memcheck/tests/x86-freebsd/scalar_arg_check.stderr.exp b/memcheck/tests/x86-freebsd/scalar_arg_check.stderr.exp
new file mode 100644
index 0000000000..354d16821d
--- /dev/null
+++ b/memcheck/tests/x86-freebsd/scalar_arg_check.stderr.exp
@@ -0,0 +1 @@
+SYSCALL[xxxxx,1](393) sys_sendfile ( 101, 102, 446676598887, 105, 0x6a, 0x6b, 108 )
diff --git a/memcheck/tests/x86-freebsd/scalar_arg_check.vgtest b/memcheck/tests/x86-freebsd/scalar_arg_check.vgtest
new file mode 120000
index 0000000000..5b2d7ffafc
--- /dev/null
+++ b/memcheck/tests/x86-freebsd/scalar_arg_check.vgtest
@@ -0,0 +1 @@
+../amd64-freebsd/scalar_arg_check.vgtest
\ No newline at end of file
diff --git a/memcheck/tests/x86-linux/Makefile.am b/memcheck/tests/x86-linux/Makefile.am
index e8de590b3e..434b1c085d 100644
--- a/memcheck/tests/x86-linux/Makefile.am
+++ b/memcheck/tests/x86-linux/Makefile.am
@@ -2,6 +2,7 @@
include $(top_srcdir)/Makefile.tool-tests.am
dist_noinst_SCRIPTS = \
+ filter_scalar \
filter_scalar_exit_group \
filter_stderr
diff --git a/memcheck/tests/x86-linux/filter_scalar b/memcheck/tests/x86-linux/filter_scalar
new file mode 100755
index 0000000000..5f0d3da056
--- /dev/null
+++ b/memcheck/tests/x86-linux/filter_scalar
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+# remove line numbers as they just cause larger patches
+sed "s/\(scalar.c\):[0-9]*)/\1)/" |
+
+../filter_stderr "$@"
+
diff --git a/memcheck/tests/x86-linux/scalar.c b/memcheck/tests/x86-linux/scalar.c
index fe36a47ef0..e6ff44fe0e 100644
--- a/memcheck/tests/x86-linux/scalar.c
+++ b/memcheck/tests/x86-linux/scalar.c
@@ -7,6 +7,7 @@
#include
#include // MREMAP_FIXED
#include
+#include
// Here we are trying to trigger every syscall error (scalar errors and
// memory errors) for every syscall. We do this by passing a lot of bogus
@@ -1272,10 +1273,30 @@ int main(void)
GO(__NR_sys_kexec_load, "ni");
SY(__NR_sys_kexec_load); FAIL;
+ // __NR_waitid 284
+ GO(__NR_waitid, "5s 0m");
+ SY(__NR_waitid, x0, x0, x0, x0, x0); FAIL;
+
+ GO(__NR_waitid, "(infop,ru) 5s 2m");
+ SY(__NR_waitid, x0, x0, x0 + 1, x0, x0 + 2); FAIL;
+
// __NR_epoll_create1 329
GO(__NR_epoll_create1, "1s 0m");
SY(__NR_epoll_create1, x0); SUCC_OR_FAIL;
+ // __NR_prlimit64 340
+ GO(__NR_prlimit64, "(nop) 4s 0m");
+ SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0, x0); SUCC;
+
+ GO(__NR_prlimit64, "(set) 4s 1m");
+ SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0 + 1, x0); FAILx(EFAULT);
+
+ GO(__NR_prlimit64, "(get) 4s 1m");
+ SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0, x0 + 1); FAILx(EFAULT);
+
+ GO(__NR_prlimit64, "(get+set) 4s 2m");
+ SY(__NR_prlimit64, x0, x0 + RLIMIT_NOFILE, x0 + 1, x0 + 1); FAILx(EFAULT);
+
// __NR_process_vm_readv 347
GO(__NR_process_vm_readv, "6s 2m");
SY(__NR_process_vm_readv, x0, x0, x0+1, x0, x0+1, x0); FAIL;
diff --git a/memcheck/tests/x86-linux/scalar.stderr.exp b/memcheck/tests/x86-linux/scalar.stderr.exp
index a2255991ed..3cbb0c6ff5 100644
--- a/memcheck/tests/x86-linux/scalar.stderr.exp
+++ b/memcheck/tests/x86-linux/scalar.stderr.exp
@@ -12,23 +12,23 @@
-----------------------------------------------------
Syscall param (syscallno) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:52)
+ by 0x........: main (scalar.c)
Syscall param read(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:52)
+ by 0x........: main (scalar.c)
Syscall param read(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:52)
+ by 0x........: main (scalar.c)
Syscall param read(count) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:52)
+ by 0x........: main (scalar.c)
Syscall param read(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:52)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -36,19 +36,19 @@ Syscall param read(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param write(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:56)
+ by 0x........: main (scalar.c)
Syscall param write(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:56)
+ by 0x........: main (scalar.c)
Syscall param write(count) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:56)
+ by 0x........: main (scalar.c)
Syscall param write(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:56)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -56,15 +56,15 @@ Syscall param write(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param open(filename) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:60)
+ by 0x........: main (scalar.c)
Syscall param open(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:60)
+ by 0x........: main (scalar.c)
Syscall param open(filename) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:60)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -72,33 +72,33 @@ Syscall param open(filename) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param open(mode) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:66)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
6: __NR_close 1s 0m
-----------------------------------------------------
Syscall param close(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:70)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
7: __NR_waitpid 3s 1m
-----------------------------------------------------
Syscall param waitpid(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:74)
+ by 0x........: main (scalar.c)
Syscall param waitpid(status) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:74)
+ by 0x........: main (scalar.c)
Syscall param waitpid(options) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:74)
+ by 0x........: main (scalar.c)
Syscall param waitpid(status) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:74)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -106,15 +106,15 @@ Syscall param waitpid(status) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param creat(pathname) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:78)
+ by 0x........: main (scalar.c)
Syscall param creat(mode) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:78)
+ by 0x........: main (scalar.c)
Syscall param creat(pathname) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:78)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -122,20 +122,20 @@ Syscall param creat(pathname) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param link(oldpath) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:82)
+ by 0x........: main (scalar.c)
Syscall param link(newpath) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:82)
+ by 0x........: main (scalar.c)
Syscall param link(oldpath) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:82)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param link(newpath) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:82)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -143,11 +143,11 @@ Syscall param link(newpath) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param unlink(pathname) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:86)
+ by 0x........: main (scalar.c)
Syscall param unlink(pathname) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:86)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -155,24 +155,24 @@ Syscall param unlink(pathname) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param execve(filename) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:90)
+ by 0x........: main (scalar.c)
Syscall param execve(argv) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:90)
+ by 0x........: main (scalar.c)
Syscall param execve(envp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:90)
+ by 0x........: main (scalar.c)
Syscall param execve(filename) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:90)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param execve(argv) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:90)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -180,24 +180,24 @@ Syscall param execve(argv) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param execve(filename) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:93)
+ by 0x........: main (scalar.c)
Syscall param execve(argv) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:93)
+ by 0x........: main (scalar.c)
Syscall param execve(envp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:93)
+ by 0x........: main (scalar.c)
Syscall param execve(filename) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:93)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param execve(argv) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:93)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -205,30 +205,30 @@ Syscall param execve(argv) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param execve(filename) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:97)
+ by 0x........: main (scalar.c)
Syscall param execve(argv) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:97)
+ by 0x........: main (scalar.c)
Syscall param execve(envp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:97)
+ by 0x........: main (scalar.c)
Syscall param execve(filename) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:97)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param execve(argv) points to uninitialised byte(s)
...
- by 0x........: main (scalar.c:97)
+ by 0x........: main (scalar.c)
Address 0x........ is on thread 1's stack
- in frame #1, created by main (scalar.c:29)
+ in frame #1, created by main (scalar.c)
Syscall param execve(argv[0]) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:97)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -236,30 +236,30 @@ Syscall param execve(argv[0]) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param execve(filename) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:100)
+ by 0x........: main (scalar.c)
Syscall param execve(argv) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:100)
+ by 0x........: main (scalar.c)
Syscall param execve(envp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:100)
+ by 0x........: main (scalar.c)
Syscall param execve(filename) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:100)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param execve(envp) points to uninitialised byte(s)
...
- by 0x........: main (scalar.c:100)
+ by 0x........: main (scalar.c)
Address 0x........ is on thread 1's stack
- in frame #1, created by main (scalar.c:29)
+ in frame #1, created by main (scalar.c)
Syscall param execve(envp[i]) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:100)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -267,11 +267,11 @@ Syscall param execve(envp[i]) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param chdir(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:104)
+ by 0x........: main (scalar.c)
Syscall param chdir(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:104)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -279,11 +279,11 @@ Syscall param chdir(path) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param time(t) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:108)
+ by 0x........: main (scalar.c)
Syscall param time(t) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:108)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -291,19 +291,19 @@ Syscall param time(t) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mknod(pathname) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:112)
+ by 0x........: main (scalar.c)
Syscall param mknod(mode) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:112)
+ by 0x........: main (scalar.c)
Syscall param mknod(dev) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:112)
+ by 0x........: main (scalar.c)
Syscall param mknod(pathname) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:112)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -311,15 +311,15 @@ Syscall param mknod(pathname) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param chmod(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:116)
+ by 0x........: main (scalar.c)
Syscall param chmod(mode) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:116)
+ by 0x........: main (scalar.c)
Syscall param chmod(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:116)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -336,15 +336,15 @@ Syscall param chmod(path) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param lseek(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:132)
+ by 0x........: main (scalar.c)
Syscall param lseek(offset) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:132)
+ by 0x........: main (scalar.c)
Syscall param lseek(whence) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:132)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
20: __NR_getpid 0s 0m
@@ -354,32 +354,32 @@ Syscall param lseek(whence) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param mount(source) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:140)
+ by 0x........: main (scalar.c)
Syscall param mount(target) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:140)
+ by 0x........: main (scalar.c)
Syscall param mount(type) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:140)
+ by 0x........: main (scalar.c)
Syscall param mount(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:140)
+ by 0x........: main (scalar.c)
Syscall param mount(data) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:140)
+ by 0x........: main (scalar.c)
Syscall param mount(target) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:140)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param mount(type) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:140)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -387,11 +387,11 @@ Syscall param mount(type) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param umount(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:144)
+ by 0x........: main (scalar.c)
Syscall param umount(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:144)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -399,7 +399,7 @@ Syscall param umount(path) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param setuid16(uid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:148)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
24: __NR_getuid 0s 0m
@@ -412,23 +412,23 @@ Syscall param setuid16(uid) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param ptrace(request) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:161)
+ by 0x........: main (scalar.c)
Syscall param ptrace(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:161)
+ by 0x........: main (scalar.c)
Syscall param ptrace(addr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:161)
+ by 0x........: main (scalar.c)
Syscall param ptrace(data) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:161)
+ by 0x........: main (scalar.c)
Syscall param ptrace(getregs) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:161)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -436,7 +436,7 @@ Syscall param ptrace(getregs) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param alarm(seconds) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:165)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
28: __NR_oldfstat n/a
@@ -449,20 +449,20 @@ Syscall param alarm(seconds) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param utime(filename) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:177)
+ by 0x........: main (scalar.c)
Syscall param utime(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:177)
+ by 0x........: main (scalar.c)
Syscall param utime(filename) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:177)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param utime(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:177)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -476,15 +476,15 @@ Syscall param utime(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param access(pathname) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:189)
+ by 0x........: main (scalar.c)
Syscall param access(mode) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:189)
+ by 0x........: main (scalar.c)
Syscall param access(pathname) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:189)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -492,7 +492,7 @@ Syscall param access(pathname) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param nice(inc) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:193)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
35: __NR_ftime ni
@@ -505,31 +505,31 @@ Syscall param nice(inc) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param kill(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:205)
+ by 0x........: main (scalar.c)
Syscall param kill(signal) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:205)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
38: __NR_rename 2s 2m
-----------------------------------------------------
Syscall param rename(oldpath) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:209)
+ by 0x........: main (scalar.c)
Syscall param rename(newpath) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:209)
+ by 0x........: main (scalar.c)
Syscall param rename(oldpath) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:209)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param rename(newpath) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:209)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -537,15 +537,15 @@ Syscall param rename(newpath) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mkdir(pathname) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:213)
+ by 0x........: main (scalar.c)
Syscall param mkdir(mode) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:213)
+ by 0x........: main (scalar.c)
Syscall param mkdir(pathname) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:213)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -553,11 +553,11 @@ Syscall param mkdir(pathname) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param rmdir(pathname) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:217)
+ by 0x........: main (scalar.c)
Syscall param rmdir(pathname) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:217)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -565,21 +565,21 @@ Syscall param rmdir(pathname) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param dup(oldfd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:221)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
42: __NR_pipe 1s 1m
-----------------------------------------------------
Syscall param pipe(filedes) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:225)
+ by 0x........: main (scalar.c)
More than 100 errors detected. Subsequent errors
will still be recorded, but in less detail than before.
Syscall param pipe(filedes) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:225)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -587,11 +587,11 @@ Syscall param pipe(filedes) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param times(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:229)
+ by 0x........: main (scalar.c)
Syscall param times(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:229)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -602,14 +602,14 @@ Syscall param times(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param brk(end_data_segment) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:237)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
46: __NR_setgid 1s 0m
-----------------------------------------------------
Syscall param setgid16(gid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:241)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
47: __NR_getgid 0s 0m
@@ -628,11 +628,11 @@ Syscall param setgid16(gid) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param acct(filename) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:261)
+ by 0x........: main (scalar.c)
Syscall param acct(filename) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:261)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -640,15 +640,15 @@ Syscall param acct(filename) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param umount2(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:265)
+ by 0x........: main (scalar.c)
Syscall param umount2(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:265)
+ by 0x........: main (scalar.c)
Syscall param umount2(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:265)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -659,19 +659,19 @@ Syscall param umount2(path) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param ioctl(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:274)
+ by 0x........: main (scalar.c)
Syscall param ioctl(request) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:274)
+ by 0x........: main (scalar.c)
Syscall param ioctl(arg) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:274)
+ by 0x........: main (scalar.c)
Syscall param ioctl(TCSET{S,SW,SF}) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:274)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -679,49 +679,49 @@ Syscall param ioctl(TCSET{S,SW,SF}) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param fcntl(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:280)
+ by 0x........: main (scalar.c)
Syscall param fcntl(cmd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:280)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
55: __NR_fcntl (DUPFD) 1s 0m
-----------------------------------------------------
Syscall param fcntl(arg) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:286)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
55: __NR_fcntl (GETLK) 1s 5m
-----------------------------------------------------
Syscall param fcntl(lock) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:292)
+ by 0x........: main (scalar.c)
Syscall param fcntl(lock->l_type) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:292)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param fcntl(lock->l_whence) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:292)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param fcntl(lock->l_start) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:292)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param fcntl(lock->l_len) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:292)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param fcntl(lock->l_pid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:292)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -732,11 +732,11 @@ Syscall param fcntl(lock->l_pid) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param setpgid(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:300)
+ by 0x........: main (scalar.c)
Syscall param setpgid(pgid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:300)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
58: __NR_ulimit ni
@@ -749,18 +749,18 @@ Syscall param setpgid(pgid) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param umask(mask) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:312)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
61: __NR_chroot 1s 1m
-----------------------------------------------------
Syscall param chroot(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:316)
+ by 0x........: main (scalar.c)
Syscall param chroot(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:316)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -771,11 +771,11 @@ Syscall param chroot(path) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param dup2(oldfd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:324)
+ by 0x........: main (scalar.c)
Syscall param dup2(newfd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:324)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
64: __NR_getppid 0s 0m
@@ -791,43 +791,43 @@ Syscall param dup2(newfd) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param sigaction(signum) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:340)
+ by 0x........: main (scalar.c)
Syscall param sigaction(act) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:340)
+ by 0x........: main (scalar.c)
Syscall param sigaction(oldact) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:340)
+ by 0x........: main (scalar.c)
Syscall param sigaction(act->sa_handler) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:340)
+ by 0x........: main (scalar.c)
Address 0x........ is 0 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (scalar.c:31)
+ by 0x........: main (scalar.c)
Syscall param sigaction(act->sa_mask) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:340)
+ by 0x........: main (scalar.c)
Address 0x........ is 4 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (scalar.c:31)
+ by 0x........: main (scalar.c)
Syscall param sigaction(act->sa_flags) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:340)
+ by 0x........: main (scalar.c)
Address 0x........ is 8 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (scalar.c:31)
+ by 0x........: main (scalar.c)
Syscall param sigaction(oldact) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:340)
+ by 0x........: main (scalar.c)
Address 0x........ is 0 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (scalar.c:31)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
68: __NR_sgetmask n/a
@@ -840,22 +840,22 @@ Syscall param sigaction(oldact) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param setreuid16(ruid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:352)
+ by 0x........: main (scalar.c)
Syscall param setreuid16(euid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:352)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
71: __NR_setregid 2s 0m
-----------------------------------------------------
Syscall param setregid16(rgid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:356)
+ by 0x........: main (scalar.c)
Syscall param setregid16(egid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:356)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
72: __NR_sigsuspend ignore
@@ -865,11 +865,11 @@ Syscall param setregid16(egid) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param sigpending(set) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:365)
+ by 0x........: main (scalar.c)
Syscall param sigpending(set) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:365)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -880,15 +880,15 @@ Syscall param sigpending(set) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param setrlimit(resource) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:373)
+ by 0x........: main (scalar.c)
Syscall param setrlimit(rlim) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:373)
+ by 0x........: main (scalar.c)
Syscall param setrlimit(rlim) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:373)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -896,15 +896,15 @@ Syscall param setrlimit(rlim) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param old_getrlimit(resource) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:377)
+ by 0x........: main (scalar.c)
Syscall param old_getrlimit(rlim) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:377)
+ by 0x........: main (scalar.c)
Syscall param old_getrlimit(rlim) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:377)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -912,15 +912,15 @@ Syscall param old_getrlimit(rlim) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param getrusage(who) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:381)
+ by 0x........: main (scalar.c)
Syscall param getrusage(usage) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:381)
+ by 0x........: main (scalar.c)
Syscall param getrusage(usage) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:381)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -928,20 +928,20 @@ Syscall param getrusage(usage) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param gettimeofday(tv) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:385)
+ by 0x........: main (scalar.c)
Syscall param gettimeofday(tz) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:385)
+ by 0x........: main (scalar.c)
Syscall param gettimeofday(tv) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:385)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param gettimeofday(tz) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:385)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -949,20 +949,20 @@ Syscall param gettimeofday(tz) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param settimeofday(tv) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:389)
+ by 0x........: main (scalar.c)
Syscall param settimeofday(tz) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:389)
+ by 0x........: main (scalar.c)
Syscall param settimeofday(tv) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:389)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param settimeofday(tz) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:389)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -970,15 +970,15 @@ Syscall param settimeofday(tz) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param getgroups16(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:393)
+ by 0x........: main (scalar.c)
Syscall param getgroups16(list) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:393)
+ by 0x........: main (scalar.c)
Syscall param getgroups16(list) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:393)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -986,15 +986,15 @@ Syscall param getgroups16(list) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param setgroups16(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:397)
+ by 0x........: main (scalar.c)
Syscall param setgroups16(list) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:397)
+ by 0x........: main (scalar.c)
Syscall param setgroups16(list) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:397)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1002,32 +1002,32 @@ Syscall param setgroups16(list) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param old_select(args) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:403)
+ by 0x........: main (scalar.c)
Syscall param old_select(args) points to uninitialised byte(s)
...
- by 0x........: main (scalar.c:403)
+ by 0x........: main (scalar.c)
Address 0x........ is on thread 1's stack
- in frame #1, created by main (scalar.c:29)
+ in frame #1, created by main (scalar.c)
Syscall param old_select(readfds) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:403)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param old_select(writefds) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:403)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param old_select(exceptfds) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:403)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param old_select(timeout) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:403)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1035,20 +1035,20 @@ Syscall param old_select(timeout) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param symlink(oldpath) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:408)
+ by 0x........: main (scalar.c)
Syscall param symlink(newpath) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:408)
+ by 0x........: main (scalar.c)
Syscall param symlink(oldpath) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:408)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param symlink(newpath) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:408)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1059,24 +1059,24 @@ Syscall param symlink(newpath) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param readlink(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:416)
+ by 0x........: main (scalar.c)
Syscall param readlink(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:416)
+ by 0x........: main (scalar.c)
Syscall param readlink(bufsiz) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:416)
+ by 0x........: main (scalar.c)
Syscall param readlink(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:416)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param readlink(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:416)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1096,39 +1096,39 @@ Syscall param readlink(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param old_mmap(args) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:438)
+ by 0x........: main (scalar.c)
Syscall param old_mmap(args) points to uninitialised byte(s)
...
- by 0x........: main (scalar.c:438)
+ by 0x........: main (scalar.c)
Address 0x........ is on thread 1's stack
- in frame #1, created by main (scalar.c:29)
+ in frame #1, created by main (scalar.c)
-----------------------------------------------------
91: __NR_munmap 2s 0m
-----------------------------------------------------
Syscall param munmap(start) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:443)
+ by 0x........: main (scalar.c)
Syscall param munmap(length) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:443)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
92: __NR_truncate 2s 1m
-----------------------------------------------------
Syscall param truncate(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:447)
+ by 0x........: main (scalar.c)
Syscall param truncate(length) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:447)
+ by 0x........: main (scalar.c)
Syscall param truncate(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:447)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1136,63 +1136,63 @@ Syscall param truncate(path) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param ftruncate(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:451)
+ by 0x........: main (scalar.c)
Syscall param ftruncate(length) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:451)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
94: __NR_fchmod 2s 0m
-----------------------------------------------------
Syscall param fchmod(fildes) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:455)
+ by 0x........: main (scalar.c)
Syscall param fchmod(mode) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:455)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
95: __NR_fchown 3s 0m
-----------------------------------------------------
Syscall param fchown16(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:459)
+ by 0x........: main (scalar.c)
Syscall param fchown16(owner) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:459)
+ by 0x........: main (scalar.c)
Syscall param fchown16(group) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:459)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
96: __NR_getpriority 2s 0m
-----------------------------------------------------
Syscall param getpriority(which) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:463)
+ by 0x........: main (scalar.c)
Syscall param getpriority(who) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:463)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
97: __NR_setpriority 3s 0m
-----------------------------------------------------
Syscall param setpriority(which) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:467)
+ by 0x........: main (scalar.c)
Syscall param setpriority(who) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:467)
+ by 0x........: main (scalar.c)
Syscall param setpriority(prio) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:467)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
98: __NR_profil ni
@@ -1202,20 +1202,20 @@ Syscall param setpriority(prio) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param statfs(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:475)
+ by 0x........: main (scalar.c)
Syscall param statfs(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:475)
+ by 0x........: main (scalar.c)
Syscall param statfs(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:475)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param statfs(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:475)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1223,15 +1223,15 @@ Syscall param statfs(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param fstatfs(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:479)
+ by 0x........: main (scalar.c)
Syscall param fstatfs(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:479)
+ by 0x........: main (scalar.c)
Syscall param fstatfs(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:479)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1239,15 +1239,15 @@ Syscall param fstatfs(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param ioperm(from) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:483)
+ by 0x........: main (scalar.c)
Syscall param ioperm(num) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:483)
+ by 0x........: main (scalar.c)
Syscall param ioperm(turn_on) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:483)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
102: __NR_socketcall XXX
@@ -1257,19 +1257,19 @@ Syscall param ioperm(turn_on) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param syslog(type) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:491)
+ by 0x........: main (scalar.c)
Syscall param syslog(bufp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:491)
+ by 0x........: main (scalar.c)
Syscall param syslog(len) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:491)
+ by 0x........: main (scalar.c)
Syscall param syslog(bufp) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:491)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1277,34 +1277,34 @@ Syscall param syslog(bufp) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param setitimer(which) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:495)
+ by 0x........: main (scalar.c)
Syscall param setitimer(value) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:495)
+ by 0x........: main (scalar.c)
Syscall param setitimer(ovalue) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:495)
+ by 0x........: main (scalar.c)
Syscall param setitimer(&value->it_interval) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:495)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param setitimer(&value->it_value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:495)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param setitimer(&ovalue->it_interval) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:495)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param setitimer(&ovalue->it_value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:495)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1312,20 +1312,20 @@ Syscall param setitimer(&ovalue->it_value) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param getitimer(which) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:499)
+ by 0x........: main (scalar.c)
Syscall param getitimer(value) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:499)
+ by 0x........: main (scalar.c)
Syscall param getitimer(&value->it_interval) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:499)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param getitimer(&value->it_value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:499)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1333,20 +1333,20 @@ Syscall param getitimer(&value->it_value) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param stat(file_name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:503)
+ by 0x........: main (scalar.c)
Syscall param stat(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:503)
+ by 0x........: main (scalar.c)
Syscall param stat(file_name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:503)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param stat(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:503)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1354,20 +1354,20 @@ Syscall param stat(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param lstat(file_name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:507)
+ by 0x........: main (scalar.c)
Syscall param lstat(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:507)
+ by 0x........: main (scalar.c)
Syscall param lstat(file_name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:507)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param lstat(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:507)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1375,15 +1375,15 @@ Syscall param lstat(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param fstat(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:511)
+ by 0x........: main (scalar.c)
Syscall param fstat(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:511)
+ by 0x........: main (scalar.c)
Syscall param fstat(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:511)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1394,7 +1394,7 @@ Syscall param fstat(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param iopl(level) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:519)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
111: __NR_vhangup 0s 0m
@@ -1410,28 +1410,28 @@ Syscall param iopl(level) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param wait4(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:535)
+ by 0x........: main (scalar.c)
Syscall param wait4(status) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:535)
+ by 0x........: main (scalar.c)
Syscall param wait4(options) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:535)
+ by 0x........: main (scalar.c)
Syscall param wait4(rusage) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:535)
+ by 0x........: main (scalar.c)
Syscall param wait4(status) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:535)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param wait4(rusage) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:535)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1442,11 +1442,11 @@ Syscall param wait4(rusage) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param sysinfo(info) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:543)
+ by 0x........: main (scalar.c)
Syscall param sysinfo(info) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:543)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1454,34 +1454,34 @@ Syscall param sysinfo(info) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param ipc(call) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:550)
+ by 0x........: main (scalar.c)
Syscall param ipc(first) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:550)
+ by 0x........: main (scalar.c)
Syscall param ipc(second) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:550)
+ by 0x........: main (scalar.c)
Syscall param ipc(third) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:550)
+ by 0x........: main (scalar.c)
Syscall param ipc(ptr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:550)
+ by 0x........: main (scalar.c)
Syscall param ipc(fifth) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:550)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
118: __NR_fsync 1s 0m
-----------------------------------------------------
Syscall param fsync(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:554)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
119: __NR_sigreturn n/a
@@ -1491,37 +1491,37 @@ Syscall param fsync(fd) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param clone(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:565)
+ by 0x........: main (scalar.c)
Syscall param clone(child_stack) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:565)
+ by 0x........: main (scalar.c)
Syscall param clone(parent_tidptr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:565)
+ by 0x........: main (scalar.c)
Syscall param clone(parent_tidptr) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:565)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param clone(tlsinfo) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:565)
+ by 0x........: main (scalar.c)
Syscall param clone(tlsinfo) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:565)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param clone(child_tidptr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:565)
+ by 0x........: main (scalar.c)
Syscall param clone(child_tidptr) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:565)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1532,11 +1532,11 @@ Syscall param clone(child_tidptr) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param uname(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:576)
+ by 0x........: main (scalar.c)
Syscall param uname(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:576)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1544,19 +1544,19 @@ Syscall param uname(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param modify_ldt(func) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:580)
+ by 0x........: main (scalar.c)
Syscall param modify_ldt(ptr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:580)
+ by 0x........: main (scalar.c)
Syscall param modify_ldt(bytecount) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:580)
+ by 0x........: main (scalar.c)
Syscall param modify_ldt(ptr) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:580)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1567,44 +1567,44 @@ Syscall param modify_ldt(ptr) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mprotect(addr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:589)
+ by 0x........: main (scalar.c)
Syscall param mprotect(len) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:589)
+ by 0x........: main (scalar.c)
Syscall param mprotect(prot) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:589)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
126: __NR_sigprocmask 3s 2m
-----------------------------------------------------
Syscall param sigprocmask(how) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:593)
+ by 0x........: main (scalar.c)
Syscall param sigprocmask(set) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:593)
+ by 0x........: main (scalar.c)
Syscall param sigprocmask(oldset) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:593)
+ by 0x........: main (scalar.c)
Syscall param sigprocmask(set) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:593)
+ by 0x........: main (scalar.c)
Address 0x........ is 0 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (scalar.c:31)
+ by 0x........: main (scalar.c)
Syscall param sigprocmask(oldset) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:593)
+ by 0x........: main (scalar.c)
Address 0x........ is 0 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (scalar.c:31)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
127: __NR_create_module ni
@@ -1614,24 +1614,24 @@ Syscall param sigprocmask(oldset) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param init_module(umod) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:601)
+ by 0x........: main (scalar.c)
Syscall param init_module(len) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:601)
+ by 0x........: main (scalar.c)
Syscall param init_module(uargs) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:601)
+ by 0x........: main (scalar.c)
Syscall param init_module(umod) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:601)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param init_module(uargs) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:601)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1645,23 +1645,23 @@ Syscall param init_module(uargs) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param quotactl(cmd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:613)
+ by 0x........: main (scalar.c)
Syscall param quotactl(special) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:613)
+ by 0x........: main (scalar.c)
Syscall param quotactl(id) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:613)
+ by 0x........: main (scalar.c)
Syscall param quotactl(addr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:613)
+ by 0x........: main (scalar.c)
Syscall param quotactl(special) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:613)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1669,14 +1669,14 @@ Syscall param quotactl(special) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param getpgid(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:617)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
133: __NR_fchdir 1s 0m
-----------------------------------------------------
Syscall param fchdir(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:621)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
134: __NR_bdflush n/a
@@ -1689,7 +1689,7 @@ Syscall param fchdir(fd) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param personality(persona) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:633)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
137: __NR_afs_syscall ni
@@ -1699,41 +1699,41 @@ Syscall param personality(persona) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param setfsuid16(uid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:641)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
139: __NR_setfsgid 1s 0m
-----------------------------------------------------
Syscall param setfsgid16(gid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:645)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
140: __NR__llseek 5s 1m
-----------------------------------------------------
Syscall param llseek(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:649)
+ by 0x........: main (scalar.c)
Syscall param llseek(offset_high) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:649)
+ by 0x........: main (scalar.c)
Syscall param llseek(offset_low) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:649)
+ by 0x........: main (scalar.c)
Syscall param llseek(result) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:649)
+ by 0x........: main (scalar.c)
Syscall param llseek(whence) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:649)
+ by 0x........: main (scalar.c)
Syscall param llseek(result) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:649)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1741,19 +1741,19 @@ Syscall param llseek(result) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param getdents(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:653)
+ by 0x........: main (scalar.c)
Syscall param getdents(dirp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:653)
+ by 0x........: main (scalar.c)
Syscall param getdents(count) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:653)
+ by 0x........: main (scalar.c)
Syscall param getdents(dirp) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:653)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1761,42 +1761,42 @@ Syscall param getdents(dirp) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param select(n) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:657)
+ by 0x........: main (scalar.c)
Syscall param select(readfds) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:657)
+ by 0x........: main (scalar.c)
Syscall param select(writefds) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:657)
+ by 0x........: main (scalar.c)
Syscall param select(exceptfds) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:657)
+ by 0x........: main (scalar.c)
Syscall param select(timeout) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:657)
+ by 0x........: main (scalar.c)
Syscall param select(readfds) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:657)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param select(writefds) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:657)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param select(exceptfds) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:657)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param select(timeout) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:657)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1804,30 +1804,30 @@ Syscall param select(timeout) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param flock(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:661)
+ by 0x........: main (scalar.c)
Syscall param flock(operation) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:661)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
144: __NR_msync 3s 1m
-----------------------------------------------------
Syscall param msync(start) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:665)
+ by 0x........: main (scalar.c)
Syscall param msync(length) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:665)
+ by 0x........: main (scalar.c)
Syscall param msync(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:665)
+ by 0x........: main (scalar.c)
Syscall param msync(start) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:665)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1835,19 +1835,19 @@ Syscall param msync(start) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param readv(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:669)
+ by 0x........: main (scalar.c)
Syscall param readv(vector) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:669)
+ by 0x........: main (scalar.c)
Syscall param readv(count) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:669)
+ by 0x........: main (scalar.c)
Syscall param readv(vector) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:669)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1855,19 +1855,19 @@ Syscall param readv(vector) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param writev(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:673)
+ by 0x........: main (scalar.c)
Syscall param writev(vector) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:673)
+ by 0x........: main (scalar.c)
Syscall param writev(count) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:673)
+ by 0x........: main (scalar.c)
Syscall param writev(vector) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:673)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1875,25 +1875,25 @@ Syscall param writev(vector) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param getsid(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:677)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
148: __NR_fdatasync 1s 0m
-----------------------------------------------------
Syscall param fdatasync(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:681)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
149: __NR__sysctl 1s 1m
-----------------------------------------------------
Syscall param sysctl(args) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:685)
+ by 0x........: main (scalar.c)
Syscall param sysctl(args) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:685)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1901,29 +1901,29 @@ Syscall param sysctl(args) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mlock(addr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:689)
+ by 0x........: main (scalar.c)
Syscall param mlock(len) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:689)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
151: __NR_munlock 2s 0m
-----------------------------------------------------
Syscall param munlock(addr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:693)
+ by 0x........: main (scalar.c)
Syscall param munlock(len) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:693)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
152: __NR_mlockall 1s 0m
-----------------------------------------------------
Syscall param mlockall(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:697)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
153: __NR_munlockall 0s 0m
@@ -1933,15 +1933,15 @@ Syscall param mlockall(flags) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param sched_setparam(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:705)
+ by 0x........: main (scalar.c)
Syscall param sched_setparam(p) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:705)
+ by 0x........: main (scalar.c)
Syscall param sched_setparam(p) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:705)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1949,15 +1949,15 @@ Syscall param sched_setparam(p) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param sched_getparam(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:709)
+ by 0x........: main (scalar.c)
Syscall param sched_getparam(p) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:709)
+ by 0x........: main (scalar.c)
Syscall param sched_getparam(p) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:709)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1965,19 +1965,19 @@ Syscall param sched_getparam(p) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param sched_setscheduler(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:713)
+ by 0x........: main (scalar.c)
Syscall param sched_setscheduler(policy) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:713)
+ by 0x........: main (scalar.c)
Syscall param sched_setscheduler(p) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:713)
+ by 0x........: main (scalar.c)
Syscall param sched_setscheduler(p) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:713)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -1985,7 +1985,7 @@ Syscall param sched_setscheduler(p) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param sched_getscheduler(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:717)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
158: __NR_sched_yield 0s 0m
@@ -1995,14 +1995,14 @@ Syscall param sched_getscheduler(pid) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param sched_get_priority_max(policy) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:725)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
160:__NR_sched_get_priority_min 1s 0m
-----------------------------------------------------
Syscall param sched_get_priority_min(policy) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:729)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
161:__NR_sched_rr_get_interval n/a
@@ -2012,20 +2012,20 @@ Syscall param sched_get_priority_min(policy) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param nanosleep(req) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:737)
+ by 0x........: main (scalar.c)
Syscall param nanosleep(rem) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:737)
+ by 0x........: main (scalar.c)
Syscall param nanosleep(req) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:737)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param nanosleep(rem) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:737)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2033,67 +2033,67 @@ Syscall param nanosleep(rem) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mremap(old_addr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:741)
+ by 0x........: main (scalar.c)
Syscall param mremap(old_size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:741)
+ by 0x........: main (scalar.c)
Syscall param mremap(new_size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:741)
+ by 0x........: main (scalar.c)
Syscall param mremap(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:741)
+ by 0x........: main (scalar.c)
Syscall param mremap(new_addr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:741)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
164: __NR_setresuid 3s 0m
-----------------------------------------------------
Syscall param setresuid16(ruid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:745)
+ by 0x........: main (scalar.c)
Syscall param setresuid16(euid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:745)
+ by 0x........: main (scalar.c)
Syscall param setresuid16(suid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:745)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
165: __NR_getresuid 3s 3m
-----------------------------------------------------
Syscall param getresuid16(ruid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:749)
+ by 0x........: main (scalar.c)
Syscall param getresuid16(euid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:749)
+ by 0x........: main (scalar.c)
Syscall param getresuid16(suid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:749)
+ by 0x........: main (scalar.c)
Syscall param getresuid16(ruid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:749)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param getresuid16(euid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:749)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param getresuid16(suid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:749)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2107,24 +2107,24 @@ Syscall param getresuid16(suid) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param poll(ufds) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:761)
+ by 0x........: main (scalar.c)
Syscall param poll(nfds) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:761)
+ by 0x........: main (scalar.c)
Syscall param poll(timeout) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:761)
+ by 0x........: main (scalar.c)
Syscall param poll(ufds.fd) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:761)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param poll(ufds.revents) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:761)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2135,44 +2135,44 @@ Syscall param poll(ufds.revents) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param setresgid16(rgid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:769)
+ by 0x........: main (scalar.c)
Syscall param setresgid16(egid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:769)
+ by 0x........: main (scalar.c)
Syscall param setresgid16(sgid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:769)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
171: __NR_getresgid 3s 3m
-----------------------------------------------------
Syscall param getresgid16(rgid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:773)
+ by 0x........: main (scalar.c)
Syscall param getresgid16(egid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:773)
+ by 0x........: main (scalar.c)
Syscall param getresgid16(sgid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:773)
+ by 0x........: main (scalar.c)
Syscall param getresgid16(rgid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:773)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param getresgid16(egid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:773)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param getresgid16(sgid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:773)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2180,43 +2180,43 @@ Syscall param getresgid16(sgid) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param prctl(option) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:777)
+ by 0x........: main (scalar.c)
Syscall param prctl(arg2) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:777)
+ by 0x........: main (scalar.c)
Syscall param prctl(arg3) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:777)
+ by 0x........: main (scalar.c)
Syscall param prctl(arg4) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:777)
+ by 0x........: main (scalar.c)
Syscall param prctl(arg5) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:777)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
172: __NR_prctl 2s 0m
-----------------------------------------------------
Syscall param prctl(option) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:782)
+ by 0x........: main (scalar.c)
Syscall param prctl(set-name) points to uninitialised byte(s)
...
- by 0x........: main (scalar.c:782)
+ by 0x........: main (scalar.c)
Address 0x........ is on thread 1's stack
- in frame #1, created by main (scalar.c:29)
+ in frame #1, created by main (scalar.c)
-----------------------------------------------------
172: __NR_prctl 1s 0m
-----------------------------------------------------
Syscall param prctl(option) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:787)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
173: __NR_rt_sigreturn n/a
@@ -2226,75 +2226,75 @@ Syscall param prctl(option) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param rt_sigaction(signum) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:795)
+ by 0x........: main (scalar.c)
Syscall param rt_sigaction(act) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:795)
+ by 0x........: main (scalar.c)
Syscall param rt_sigaction(oldact) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:795)
+ by 0x........: main (scalar.c)
Syscall param rt_sigaction(sigsetsize) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:795)
+ by 0x........: main (scalar.c)
Syscall param rt_sigaction(act->sa_handler) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:795)
+ by 0x........: main (scalar.c)
Address 0x........ is 4 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (scalar.c:31)
+ by 0x........: main (scalar.c)
Syscall param rt_sigaction(act->sa_mask) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:795)
+ by 0x........: main (scalar.c)
Address 0x........ is 16 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (scalar.c:31)
+ by 0x........: main (scalar.c)
Syscall param rt_sigaction(act->sa_flags) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:795)
+ by 0x........: main (scalar.c)
Address 0x........ is 8 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (scalar.c:31)
+ by 0x........: main (scalar.c)
Syscall param rt_sigaction(oldact) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:795)
+ by 0x........: main (scalar.c)
Address 0x........ is 4 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (scalar.c:31)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
175: __NR_rt_sigprocmask 4s 2m
-----------------------------------------------------
Syscall param rt_sigprocmask(how) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:799)
+ by 0x........: main (scalar.c)
Syscall param rt_sigprocmask(set) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:799)
+ by 0x........: main (scalar.c)
Syscall param rt_sigprocmask(oldset) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:799)
+ by 0x........: main (scalar.c)
Syscall param rt_sigprocmask(sigsetsize) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:799)
+ by 0x........: main (scalar.c)
Syscall param rt_sigprocmask(set) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:799)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param rt_sigprocmask(oldset) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:799)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2302,15 +2302,15 @@ Syscall param rt_sigprocmask(oldset) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param rt_sigpending(set) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:803)
+ by 0x........: main (scalar.c)
Syscall param rt_sigpending(sigsetsize) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:803)
+ by 0x........: main (scalar.c)
Syscall param rt_sigpending(set) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:803)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2318,33 +2318,33 @@ Syscall param rt_sigpending(set) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param rt_sigtimedwait(set) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:807)
+ by 0x........: main (scalar.c)
Syscall param rt_sigtimedwait(info) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:807)
+ by 0x........: main (scalar.c)
Syscall param rt_sigtimedwait(timeout) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:807)
+ by 0x........: main (scalar.c)
Syscall param rt_sigtimedwait(sigsetsize) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:807)
+ by 0x........: main (scalar.c)
Syscall param rt_sigtimedwait(set) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:807)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param rt_sigtimedwait(info) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:807)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param rt_sigtimedwait(timeout) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:807)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2352,19 +2352,19 @@ Syscall param rt_sigtimedwait(timeout) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param rt_sigqueueinfo(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:811)
+ by 0x........: main (scalar.c)
Syscall param rt_sigqueueinfo(sig) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:811)
+ by 0x........: main (scalar.c)
Syscall param rt_sigqueueinfo(uinfo) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:811)
+ by 0x........: main (scalar.c)
Syscall param rt_sigqueueinfo(uinfo) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:811)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2372,15 +2372,15 @@ Syscall param rt_sigqueueinfo(uinfo) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param rt_sigsuspend(mask) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:815)
+ by 0x........: main (scalar.c)
Syscall param rt_sigsuspend(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:815)
+ by 0x........: main (scalar.c)
Syscall param rt_sigsuspend(mask) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:815)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2388,27 +2388,27 @@ Syscall param rt_sigsuspend(mask) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param pread64(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:819)
+ by 0x........: main (scalar.c)
Syscall param pread64(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:819)
+ by 0x........: main (scalar.c)
Syscall param pread64(count) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:819)
+ by 0x........: main (scalar.c)
Syscall param pread64(offset_low) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:819)
+ by 0x........: main (scalar.c)
Syscall param pread64(offset_high) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:819)
+ by 0x........: main (scalar.c)
Syscall param pread64(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:819)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2416,27 +2416,27 @@ Syscall param pread64(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param pwrite64(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:823)
+ by 0x........: main (scalar.c)
Syscall param pwrite64(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:823)
+ by 0x........: main (scalar.c)
Syscall param pwrite64(count) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:823)
+ by 0x........: main (scalar.c)
Syscall param pwrite64(offset_low) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:823)
+ by 0x........: main (scalar.c)
Syscall param pwrite64(offset_high) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:823)
+ by 0x........: main (scalar.c)
Syscall param pwrite64(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:823)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2444,19 +2444,19 @@ Syscall param pwrite64(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param chown16(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:827)
+ by 0x........: main (scalar.c)
Syscall param chown16(owner) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:827)
+ by 0x........: main (scalar.c)
Syscall param chown16(group) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:827)
+ by 0x........: main (scalar.c)
Syscall param chown16(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:827)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2464,15 +2464,15 @@ Syscall param chown16(path) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param getcwd(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:831)
+ by 0x........: main (scalar.c)
Syscall param getcwd(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:831)
+ by 0x........: main (scalar.c)
Syscall param getcwd(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:831)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2480,20 +2480,20 @@ Syscall param getcwd(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param capget(header) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:835)
+ by 0x........: main (scalar.c)
Syscall param capget(data) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:835)
+ by 0x........: main (scalar.c)
Syscall param capget(header) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:835)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param capget(data) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:835)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2501,20 +2501,20 @@ Syscall param capget(data) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param capset(header) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:839)
+ by 0x........: main (scalar.c)
Syscall param capset(data) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:839)
+ by 0x........: main (scalar.c)
Syscall param capset(header) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:839)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param capset(data) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:839)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2522,58 +2522,58 @@ Syscall param capset(data) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param sigaltstack(ss) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:853)
+ by 0x........: main (scalar.c)
Syscall param sigaltstack(oss) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:853)
+ by 0x........: main (scalar.c)
Syscall param sigaltstack(ss->ss_sp) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:853)
+ by 0x........: main (scalar.c)
Address 0x........ is on thread 1's stack
- in frame #1, created by main (scalar.c:29)
+ in frame #1, created by main (scalar.c)
Syscall param sigaltstack(ss->ss_size) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:853)
+ by 0x........: main (scalar.c)
Address 0x........ is on thread 1's stack
- in frame #1, created by main (scalar.c:29)
+ in frame #1, created by main (scalar.c)
Syscall param sigaltstack(ss->ss_flags) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:853)
+ by 0x........: main (scalar.c)
Address 0x........ is on thread 1's stack
- in frame #1, created by main (scalar.c:29)
+ in frame #1, created by main (scalar.c)
Syscall param sigaltstack(oss) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:853)
+ by 0x........: main (scalar.c)
Address 0x........ is on thread 1's stack
- in frame #1, created by main (scalar.c:29)
+ in frame #1, created by main (scalar.c)
-----------------------------------------------------
187: __NR_sendfile 4s 1m
-----------------------------------------------------
Syscall param sendfile(out_fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:858)
+ by 0x........: main (scalar.c)
Syscall param sendfile(in_fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:858)
+ by 0x........: main (scalar.c)
Syscall param sendfile(offset) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:858)
+ by 0x........: main (scalar.c)
Syscall param sendfile(count) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:858)
+ by 0x........: main (scalar.c)
Syscall param sendfile(offset) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:858)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2581,46 +2581,46 @@ Syscall param sendfile(offset) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param getpmsg(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:864)
+ by 0x........: main (scalar.c)
Syscall param getpmsg(ctrl) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:864)
+ by 0x........: main (scalar.c)
Syscall param getpmsg(data) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:864)
+ by 0x........: main (scalar.c)
Syscall param getpmsg(bandp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:864)
+ by 0x........: main (scalar.c)
Syscall param getpmsg(flagsp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:864)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
189: __NR_putpmsg 5s 0m
-----------------------------------------------------
Syscall param putpmsg(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:870)
+ by 0x........: main (scalar.c)
Syscall param putpmsg(ctrl) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:870)
+ by 0x........: main (scalar.c)
Syscall param putpmsg(data) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:870)
+ by 0x........: main (scalar.c)
Syscall param putpmsg(band) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:870)
+ by 0x........: main (scalar.c)
Syscall param putpmsg(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:870)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
190: __NR_vfork other
@@ -2630,15 +2630,15 @@ Syscall param putpmsg(flags) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param getrlimit(resource) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:878)
+ by 0x........: main (scalar.c)
Syscall param getrlimit(rlim) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:878)
+ by 0x........: main (scalar.c)
Syscall param getrlimit(rlim) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:878)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2646,46 +2646,46 @@ Syscall param getrlimit(rlim) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mmap2(start) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:882)
+ by 0x........: main (scalar.c)
Syscall param mmap2(length) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:882)
+ by 0x........: main (scalar.c)
Syscall param mmap2(prot) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:882)
+ by 0x........: main (scalar.c)
Syscall param mmap2(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:882)
+ by 0x........: main (scalar.c)
Syscall param mmap2(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:882)
+ by 0x........: main (scalar.c)
Syscall param mmap2(offset) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:882)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
193: __NR_truncate64 3s 1m
-----------------------------------------------------
Syscall param truncate64(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:886)
+ by 0x........: main (scalar.c)
Syscall param truncate64(length_low) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:886)
+ by 0x........: main (scalar.c)
Syscall param truncate64(length_high) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:886)
+ by 0x........: main (scalar.c)
Syscall param truncate64(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:886)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2693,35 +2693,35 @@ Syscall param truncate64(path) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param ftruncate64(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:890)
+ by 0x........: main (scalar.c)
Syscall param ftruncate64(length_low) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:890)
+ by 0x........: main (scalar.c)
Syscall param ftruncate64(length_high) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:890)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
195: __NR_stat64 2s 2m
-----------------------------------------------------
Syscall param stat64(file_name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:894)
+ by 0x........: main (scalar.c)
Syscall param stat64(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:894)
+ by 0x........: main (scalar.c)
Syscall param stat64(file_name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:894)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param stat64(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:894)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2729,20 +2729,20 @@ Syscall param stat64(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param lstat64(file_name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:898)
+ by 0x........: main (scalar.c)
Syscall param lstat64(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:898)
+ by 0x........: main (scalar.c)
Syscall param lstat64(file_name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:898)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param lstat64(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:898)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2750,15 +2750,15 @@ Syscall param lstat64(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param fstat64(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:902)
+ by 0x........: main (scalar.c)
Syscall param fstat64(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:902)
+ by 0x........: main (scalar.c)
Syscall param fstat64(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:902)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2766,19 +2766,19 @@ Syscall param fstat64(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param lchown(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:906)
+ by 0x........: main (scalar.c)
Syscall param lchown(owner) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:906)
+ by 0x........: main (scalar.c)
Syscall param lchown(group) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:906)
+ by 0x........: main (scalar.c)
Syscall param lchown(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:906)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2798,37 +2798,37 @@ Syscall param lchown(path) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param setreuid(ruid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:926)
+ by 0x........: main (scalar.c)
Syscall param setreuid(euid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:926)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
204: __NR_setregid32 2s 0m
-----------------------------------------------------
Syscall param setregid(rgid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:930)
+ by 0x........: main (scalar.c)
Syscall param setregid(egid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:930)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
205: __NR_getgroups32 2s 1m
-----------------------------------------------------
Syscall param getgroups(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:934)
+ by 0x........: main (scalar.c)
Syscall param getgroups(list) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:934)
+ by 0x........: main (scalar.c)
Syscall param getgroups(list) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:934)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2836,15 +2836,15 @@ Syscall param getgroups(list) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param setgroups(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:938)
+ by 0x........: main (scalar.c)
Syscall param setgroups(list) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:938)
+ by 0x........: main (scalar.c)
Syscall param setgroups(list) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:938)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2852,59 +2852,59 @@ Syscall param setgroups(list) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param fchown(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:942)
+ by 0x........: main (scalar.c)
Syscall param fchown(owner) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:942)
+ by 0x........: main (scalar.c)
Syscall param fchown(group) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:942)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
208: __NR_setresuid32 3s 0m
-----------------------------------------------------
Syscall param setresuid(ruid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:946)
+ by 0x........: main (scalar.c)
Syscall param setresuid(euid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:946)
+ by 0x........: main (scalar.c)
Syscall param setresuid(suid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:946)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
209: __NR_getresuid32 3s 3m
-----------------------------------------------------
Syscall param getresuid(ruid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:950)
+ by 0x........: main (scalar.c)
Syscall param getresuid(euid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:950)
+ by 0x........: main (scalar.c)
Syscall param getresuid(suid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:950)
+ by 0x........: main (scalar.c)
Syscall param getresuid(ruid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:950)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param getresuid(euid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:950)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param getresuid(suid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:950)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2912,44 +2912,44 @@ Syscall param getresuid(suid) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param setresgid(rgid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:954)
+ by 0x........: main (scalar.c)
Syscall param setresgid(egid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:954)
+ by 0x........: main (scalar.c)
Syscall param setresgid(sgid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:954)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
211: __NR_getresgid32 3s 3m
-----------------------------------------------------
Syscall param getresgid(rgid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:958)
+ by 0x........: main (scalar.c)
Syscall param getresgid(egid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:958)
+ by 0x........: main (scalar.c)
Syscall param getresgid(sgid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:958)
+ by 0x........: main (scalar.c)
Syscall param getresgid(rgid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:958)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param getresgid(egid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:958)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param getresgid(sgid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:958)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2957,19 +2957,19 @@ Syscall param getresgid(sgid) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param chown(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:962)
+ by 0x........: main (scalar.c)
Syscall param chown(owner) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:962)
+ by 0x........: main (scalar.c)
Syscall param chown(group) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:962)
+ by 0x........: main (scalar.c)
Syscall param chown(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:962)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -2977,28 +2977,28 @@ Syscall param chown(path) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param setuid(uid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:966)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
214: __NR_setgid32 1s 0m
-----------------------------------------------------
Syscall param setgid(gid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:970)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
215: __NR_setfsuid32 1s 0m
-----------------------------------------------------
Syscall param setfsuid(uid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:974)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
216: __NR_setfsgid32 1s 0m
-----------------------------------------------------
Syscall param setfsgid(gid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:978)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
217: __NR_pivot_root n/a
@@ -3008,19 +3008,19 @@ Syscall param setfsgid(gid) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param mincore(start) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:986)
+ by 0x........: main (scalar.c)
Syscall param mincore(length) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:986)
+ by 0x........: main (scalar.c)
Syscall param mincore(vec) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:986)
+ by 0x........: main (scalar.c)
Syscall param mincore(vec) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:986)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3028,34 +3028,34 @@ Syscall param mincore(vec) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param madvise(start) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:990)
+ by 0x........: main (scalar.c)
Syscall param madvise(length) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:990)
+ by 0x........: main (scalar.c)
Syscall param madvise(advice) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:990)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
220: __NR_getdents64 3s 1m
-----------------------------------------------------
Syscall param getdents64(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:994)
+ by 0x........: main (scalar.c)
Syscall param getdents64(dirp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:994)
+ by 0x........: main (scalar.c)
Syscall param getdents64(count) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:994)
+ by 0x........: main (scalar.c)
Syscall param getdents64(dirp) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:994)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3063,25 +3063,25 @@ Syscall param getdents64(dirp) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param fcntl64(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1001)
+ by 0x........: main (scalar.c)
Syscall param fcntl64(cmd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1001)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
221: __NR_fcntl64 (DUPFD) 1s 0m
-----------------------------------------------------
Syscall param fcntl64(arg) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1005)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
221: __NR_fcntl64 (GETLK) 1s 0m
-----------------------------------------------------
Syscall param fcntl64(lock) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1011)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
222: 222 ni
@@ -3100,37 +3100,37 @@ Syscall param fcntl64(lock) contains uninitialised byte(s)
-----------------------------------------------------
Syscall param setxattr(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1031)
+ by 0x........: main (scalar.c)
Syscall param setxattr(name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1031)
+ by 0x........: main (scalar.c)
Syscall param setxattr(value) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1031)
+ by 0x........: main (scalar.c)
Syscall param setxattr(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1031)
+ by 0x........: main (scalar.c)
Syscall param setxattr(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1031)
+ by 0x........: main (scalar.c)
Syscall param setxattr(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1031)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param setxattr(name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1031)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param setxattr(value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1031)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3138,37 +3138,37 @@ Syscall param setxattr(value) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param lsetxattr(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1035)
+ by 0x........: main (scalar.c)
Syscall param lsetxattr(name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1035)
+ by 0x........: main (scalar.c)
Syscall param lsetxattr(value) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1035)
+ by 0x........: main (scalar.c)
Syscall param lsetxattr(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1035)
+ by 0x........: main (scalar.c)
Syscall param lsetxattr(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1035)
+ by 0x........: main (scalar.c)
Syscall param lsetxattr(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1035)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param lsetxattr(name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1035)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param lsetxattr(value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1035)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3176,32 +3176,32 @@ Syscall param lsetxattr(value) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param fsetxattr(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1039)
+ by 0x........: main (scalar.c)
Syscall param fsetxattr(name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1039)
+ by 0x........: main (scalar.c)
Syscall param fsetxattr(value) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1039)
+ by 0x........: main (scalar.c)
Syscall param fsetxattr(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1039)
+ by 0x........: main (scalar.c)
Syscall param fsetxattr(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1039)
+ by 0x........: main (scalar.c)
Syscall param fsetxattr(name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1039)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param fsetxattr(value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1039)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3209,33 +3209,33 @@ Syscall param fsetxattr(value) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param getxattr(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1043)
+ by 0x........: main (scalar.c)
Syscall param getxattr(name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1043)
+ by 0x........: main (scalar.c)
Syscall param getxattr(value) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1043)
+ by 0x........: main (scalar.c)
Syscall param getxattr(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1043)
+ by 0x........: main (scalar.c)
Syscall param getxattr(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1043)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param getxattr(name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1043)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param getxattr(value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1043)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3243,33 +3243,33 @@ Syscall param getxattr(value) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param lgetxattr(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1047)
+ by 0x........: main (scalar.c)
Syscall param lgetxattr(name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1047)
+ by 0x........: main (scalar.c)
Syscall param lgetxattr(value) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1047)
+ by 0x........: main (scalar.c)
Syscall param lgetxattr(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1047)
+ by 0x........: main (scalar.c)
Syscall param lgetxattr(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1047)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param lgetxattr(name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1047)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param lgetxattr(value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1047)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3277,28 +3277,28 @@ Syscall param lgetxattr(value) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param fgetxattr(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1051)
+ by 0x........: main (scalar.c)
Syscall param fgetxattr(name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1051)
+ by 0x........: main (scalar.c)
Syscall param fgetxattr(value) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1051)
+ by 0x........: main (scalar.c)
Syscall param fgetxattr(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1051)
+ by 0x........: main (scalar.c)
Syscall param fgetxattr(name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1051)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param fgetxattr(value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1051)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3306,24 +3306,24 @@ Syscall param fgetxattr(value) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param listxattr(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1055)
+ by 0x........: main (scalar.c)
Syscall param listxattr(list) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1055)
+ by 0x........: main (scalar.c)
Syscall param listxattr(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1055)
+ by 0x........: main (scalar.c)
Syscall param listxattr(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1055)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param listxattr(list) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1055)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3331,24 +3331,24 @@ Syscall param listxattr(list) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param llistxattr(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1059)
+ by 0x........: main (scalar.c)
Syscall param llistxattr(list) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1059)
+ by 0x........: main (scalar.c)
Syscall param llistxattr(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1059)
+ by 0x........: main (scalar.c)
Syscall param llistxattr(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1059)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param llistxattr(list) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1059)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3356,19 +3356,19 @@ Syscall param llistxattr(list) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param flistxattr(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1063)
+ by 0x........: main (scalar.c)
Syscall param flistxattr(list) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1063)
+ by 0x........: main (scalar.c)
Syscall param flistxattr(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1063)
+ by 0x........: main (scalar.c)
Syscall param flistxattr(list) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1063)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3376,20 +3376,20 @@ Syscall param flistxattr(list) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param removexattr(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1067)
+ by 0x........: main (scalar.c)
Syscall param removexattr(name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1067)
+ by 0x........: main (scalar.c)
Syscall param removexattr(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1067)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param removexattr(name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1067)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3397,20 +3397,20 @@ Syscall param removexattr(name) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param lremovexattr(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1071)
+ by 0x........: main (scalar.c)
Syscall param lremovexattr(name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1071)
+ by 0x........: main (scalar.c)
Syscall param lremovexattr(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1071)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param lremovexattr(name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1071)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3418,15 +3418,15 @@ Syscall param lremovexattr(name) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param fremovexattr(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1075)
+ by 0x........: main (scalar.c)
Syscall param fremovexattr(name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1075)
+ by 0x........: main (scalar.c)
Syscall param fremovexattr(name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1075)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3437,23 +3437,23 @@ Syscall param fremovexattr(name) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param sendfile64(out_fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1083)
+ by 0x........: main (scalar.c)
Syscall param sendfile64(in_fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1083)
+ by 0x........: main (scalar.c)
Syscall param sendfile64(offset) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1083)
+ by 0x........: main (scalar.c)
Syscall param sendfile64(count) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1083)
+ by 0x........: main (scalar.c)
Syscall param sendfile64(offset) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1083)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3461,28 +3461,28 @@ Syscall param sendfile64(offset) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param futex(futex) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1091)
+ by 0x........: main (scalar.c)
Syscall param futex(op) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1091)
+ by 0x........: main (scalar.c)
Syscall param futex(val) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1091)
+ by 0x........: main (scalar.c)
Syscall param futex(utime) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1091)
+ by 0x........: main (scalar.c)
Syscall param futex(futex) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1091)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param futex(timeout) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1091)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3490,19 +3490,19 @@ Syscall param futex(timeout) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param sched_setaffinity(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1095)
+ by 0x........: main (scalar.c)
Syscall param sched_setaffinity(len) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1095)
+ by 0x........: main (scalar.c)
Syscall param sched_setaffinity(mask) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1095)
+ by 0x........: main (scalar.c)
Syscall param sched_setaffinity(mask) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1095)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3510,19 +3510,19 @@ Syscall param sched_setaffinity(mask) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param sched_getaffinity(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1099)
+ by 0x........: main (scalar.c)
Syscall param sched_getaffinity(len) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1099)
+ by 0x........: main (scalar.c)
Syscall param sched_getaffinity(mask) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1099)
+ by 0x........: main (scalar.c)
Syscall param sched_getaffinity(mask) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1099)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3530,11 +3530,11 @@ Syscall param sched_getaffinity(mask) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param set_thread_area(u_info) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1103)
+ by 0x........: main (scalar.c)
Syscall param set_thread_area(u_info) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1103)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Warning: bad u_info address 0x........ in set_thread_area
@@ -3543,11 +3543,11 @@ Warning: bad u_info address 0x........ in set_thread_area
-----------------------------------------------------
Syscall param get_thread_area(u_info) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1107)
+ by 0x........: main (scalar.c)
Syscall param get_thread_area(u_info) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1107)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Warning: bad u_info address 0x........ in get_thread_area
@@ -3556,15 +3556,15 @@ Warning: bad u_info address 0x........ in get_thread_area
-----------------------------------------------------
Syscall param io_setup(nr_events) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1111)
+ by 0x........: main (scalar.c)
Syscall param io_setup(ctxp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1111)
+ by 0x........: main (scalar.c)
Syscall param io_setup(ctxp) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1111)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3572,39 +3572,39 @@ Syscall param io_setup(ctxp) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param io_destroy(ctx) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1124)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
247: __NR_io_getevents 5s 2m
-----------------------------------------------------
Syscall param io_getevents(ctx_id) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1129)
+ by 0x........: main (scalar.c)
Syscall param io_getevents(min_nr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1129)
+ by 0x........: main (scalar.c)
Syscall param io_getevents(nr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1129)
+ by 0x........: main (scalar.c)
Syscall param io_getevents(events) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1129)
+ by 0x........: main (scalar.c)
Syscall param io_getevents(timeout) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1129)
+ by 0x........: main (scalar.c)
Syscall param io_getevents(events) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1129)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param io_getevents(timeout) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1129)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3612,19 +3612,19 @@ Syscall param io_getevents(timeout) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param io_submit(ctx_id) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1133)
+ by 0x........: main (scalar.c)
Syscall param io_submit(nr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1133)
+ by 0x........: main (scalar.c)
Syscall param io_submit(iocbpp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1133)
+ by 0x........: main (scalar.c)
Syscall param io_submit(iocbpp) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1133)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3632,24 +3632,24 @@ Syscall param io_submit(iocbpp) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param io_cancel(ctx_id) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1137)
+ by 0x........: main (scalar.c)
Syscall param io_cancel(iocb) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1137)
+ by 0x........: main (scalar.c)
Syscall param io_cancel(result) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1137)
+ by 0x........: main (scalar.c)
Syscall param io_cancel(iocb) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1137)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param io_cancel(result) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1137)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3666,23 +3666,23 @@ Syscall param io_cancel(result) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param lookup_dcookie(cookie_low) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1153)
+ by 0x........: main (scalar.c)
Syscall param lookup_dcookie(cookie_high) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1153)
+ by 0x........: main (scalar.c)
Syscall param lookup_dcookie(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1153)
+ by 0x........: main (scalar.c)
Syscall param lookup_dcookie(len) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1153)
+ by 0x........: main (scalar.c)
Syscall param lookup_dcookie(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1153)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3690,30 +3690,30 @@ Syscall param lookup_dcookie(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param epoll_create(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1157)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
255: __NR_epoll_ctl 4s 1m
-----------------------------------------------------
Syscall param epoll_ctl(epfd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1161)
+ by 0x........: main (scalar.c)
Syscall param epoll_ctl(op) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1161)
+ by 0x........: main (scalar.c)
Syscall param epoll_ctl(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1161)
+ by 0x........: main (scalar.c)
Syscall param epoll_ctl(event) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1161)
+ by 0x........: main (scalar.c)
Syscall param epoll_ctl(event) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1161)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3721,23 +3721,23 @@ Syscall param epoll_ctl(event) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param epoll_wait(epfd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1165)
+ by 0x........: main (scalar.c)
Syscall param epoll_wait(events) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1165)
+ by 0x........: main (scalar.c)
Syscall param epoll_wait(maxevents) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1165)
+ by 0x........: main (scalar.c)
Syscall param epoll_wait(timeout) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1165)
+ by 0x........: main (scalar.c)
Syscall param epoll_wait(events) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1165)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3748,41 +3748,41 @@ Syscall param epoll_wait(events) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param set_tid_address(tidptr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1173)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
259: __NR_timer_create 3s 2m
-----------------------------------------------------
Syscall param timer_create(clockid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1177)
+ by 0x........: main (scalar.c)
Syscall param timer_create(evp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1177)
+ by 0x........: main (scalar.c)
Syscall param timer_create(timerid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1177)
+ by 0x........: main (scalar.c)
Syscall param timer_create(evp.sigev_value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1177)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param timer_create(evp.sigev_signo) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1177)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param timer_create(evp.sigev_notify) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1177)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param timer_create(timerid) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1177)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3790,28 +3790,28 @@ Syscall param timer_create(timerid) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param timer_settime(timerid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1181)
+ by 0x........: main (scalar.c)
Syscall param timer_settime(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1181)
+ by 0x........: main (scalar.c)
Syscall param timer_settime(value) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1181)
+ by 0x........: main (scalar.c)
Syscall param timer_settime(ovalue) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1181)
+ by 0x........: main (scalar.c)
Syscall param timer_settime(value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1181)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param timer_settime(ovalue) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1181)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3819,15 +3819,15 @@ Syscall param timer_settime(ovalue) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param timer_gettime(timerid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1185)
+ by 0x........: main (scalar.c)
Syscall param timer_gettime(value) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1185)
+ by 0x........: main (scalar.c)
Syscall param timer_gettime(value) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1185)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3835,29 +3835,29 @@ Syscall param timer_gettime(value) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param timer_getoverrun(timerid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1189)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
263: __NR_timer_delete 1s 0m
-----------------------------------------------------
Syscall param timer_delete(timerid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1193)
+ by 0x........: main (scalar.c)
-----------------------------------------------------
264: __NR_clock_settime 2s 1m
-----------------------------------------------------
Syscall param clock_settime(clk_id) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1197)
+ by 0x........: main (scalar.c)
Syscall param clock_settime(tp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1197)
+ by 0x........: main (scalar.c)
Syscall param clock_settime(tp) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1197)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3865,15 +3865,15 @@ Syscall param clock_settime(tp) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param clock_gettime(clk_id) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1201)
+ by 0x........: main (scalar.c)
Syscall param clock_gettime(tp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1201)
+ by 0x........: main (scalar.c)
Syscall param clock_gettime(tp) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1201)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3881,15 +3881,15 @@ Syscall param clock_gettime(tp) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param clock_getres(clk_id) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1205)
+ by 0x........: main (scalar.c)
Syscall param clock_getres(res) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1205)
+ by 0x........: main (scalar.c)
Syscall param clock_getres(res) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1205)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3900,24 +3900,24 @@ Syscall param clock_getres(res) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param statfs64(path) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1213)
+ by 0x........: main (scalar.c)
Syscall param statfs64(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1213)
+ by 0x........: main (scalar.c)
Syscall param statfs64(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1213)
+ by 0x........: main (scalar.c)
Syscall param statfs64(path) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1213)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param statfs64(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1213)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3925,19 +3925,19 @@ Syscall param statfs64(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param fstatfs64(fd) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1217)
+ by 0x........: main (scalar.c)
Syscall param fstatfs64(size) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1217)
+ by 0x........: main (scalar.c)
Syscall param fstatfs64(buf) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1217)
+ by 0x........: main (scalar.c)
Syscall param fstatfs64(buf) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1217)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3948,25 +3948,25 @@ Syscall param fstatfs64(buf) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param utimes(filename) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1225)
+ by 0x........: main (scalar.c)
Syscall param utimes(tvp) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1225)
+ by 0x........: main (scalar.c)
Syscall param utimes(filename) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1225)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param utimes(tvp[0]) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1225)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param utimes(tvp[1]) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1225)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -3989,33 +3989,33 @@ Syscall param utimes(tvp[1]) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mq_open(name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1249)
+ by 0x........: main (scalar.c)
Syscall param mq_open(oflag) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1249)
+ by 0x........: main (scalar.c)
Syscall param mq_open(mode) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1249)
+ by 0x........: main (scalar.c)
Syscall param mq_open(attr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1249)
+ by 0x........: main (scalar.c)
Syscall param mq_open(name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1249)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param mq_open(attr->mq_maxmsg) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1249)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param mq_open(attr->mq_msgsize) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1249)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -4023,11 +4023,11 @@ Syscall param mq_open(attr->mq_msgsize) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mq_unlink(name) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1253)
+ by 0x........: main (scalar.c)
Syscall param mq_unlink(name) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1253)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -4035,32 +4035,32 @@ Syscall param mq_unlink(name) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mq_timedsend(mqdes) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1257)
+ by 0x........: main (scalar.c)
Syscall param mq_timedsend(msg_ptr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1257)
+ by 0x........: main (scalar.c)
Syscall param mq_timedsend(msg_len) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1257)
+ by 0x........: main (scalar.c)
Syscall param mq_timedsend(msg_prio) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1257)
+ by 0x........: main (scalar.c)
Syscall param mq_timedsend(abs_timeout) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1257)
+ by 0x........: main (scalar.c)
Syscall param mq_timedsend(msg_ptr) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1257)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param mq_timedsend(abs_timeout) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1257)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -4068,37 +4068,37 @@ Syscall param mq_timedsend(abs_timeout) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mq_timedreceive(mqdes) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1261)
+ by 0x........: main (scalar.c)
Syscall param mq_timedreceive(msg_ptr) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1261)
+ by 0x........: main (scalar.c)
Syscall param mq_timedreceive(msg_len) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1261)
+ by 0x........: main (scalar.c)
Syscall param mq_timedreceive(msg_prio) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1261)
+ by 0x........: main (scalar.c)
Syscall param mq_timedreceive(abs_timeout) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1261)
+ by 0x........: main (scalar.c)
Syscall param mq_timedreceive(msg_ptr) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1261)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param mq_timedreceive(msg_prio) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1261)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param mq_timedreceive(abs_timeout) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1261)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -4106,15 +4106,15 @@ Syscall param mq_timedreceive(abs_timeout) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mq_notify(mqdes) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1265)
+ by 0x........: main (scalar.c)
Syscall param mq_notify(notification) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1265)
+ by 0x........: main (scalar.c)
Syscall param mq_notify(notification) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1265)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -4122,71 +4122,223 @@ Syscall param mq_notify(notification) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param mq_getsetattr(mqdes) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1269)
+ by 0x........: main (scalar.c)
Syscall param mq_getsetattr(mqstat) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1269)
+ by 0x........: main (scalar.c)
Syscall param mq_getsetattr(omqstat) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1269)
+ by 0x........: main (scalar.c)
Syscall param mq_getsetattr(mqstat->mq_flags) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1269)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param mq_getsetattr(omqstat) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1269)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
283: __NR_sys_kexec_load ni
-----------------------------------------------------
+-----------------------------------------------------
+284: __NR_waitid 5s 0m
+-----------------------------------------------------
+Syscall param sys_waitid(which) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(infop) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(options) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(ru) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+-----------------------------------------------------
+284: __NR_waitid (infop,ru) 5s 2m
+-----------------------------------------------------
+Syscall param sys_waitid(which) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(infop) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(options) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param sys_waitid(ru) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param waitid(infop) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param waitid(ru) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
-----------------------------------------------------
329: __NR_epoll_create1 1s 0m
-----------------------------------------------------
Syscall param epoll_create1(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1277)
+ by 0x........: main (scalar.c)
+
+-----------------------------------------------------
+340: __NR_prlimit64 (nop) 4s 0m
+-----------------------------------------------------
+Syscall param prlimit64(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(resource) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(new_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(old_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+-----------------------------------------------------
+340: __NR_prlimit64 (set) 4s 1m
+-----------------------------------------------------
+Syscall param prlimit64(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(resource) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(new_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(old_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param rlimit64(new_rlim) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+-----------------------------------------------------
+340: __NR_prlimit64 (get) 4s 1m
+-----------------------------------------------------
+Syscall param prlimit64(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(resource) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(new_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(old_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param rlimit64(old_rlim) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+-----------------------------------------------------
+340: __NR_prlimit64 (get+set) 4s 2m
+-----------------------------------------------------
+Syscall param prlimit64(pid) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(resource) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(new_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param prlimit64(old_rlim) contains uninitialised byte(s)
+ ...
+ by 0x........: main (scalar.c)
+
+Syscall param rlimit64(new_rlim) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param rlimit64(old_rlim) points to unaddressable byte(s)
+ ...
+ by 0x........: main (scalar.c)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
347:__NR_process_vm_readv 6s 2m
-----------------------------------------------------
Syscall param process_vm_readv(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1281)
+ by 0x........: main (scalar.c)
Syscall param process_vm_readv(lvec) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1281)
+ by 0x........: main (scalar.c)
Syscall param process_vm_readv(liovcnt) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1281)
+ by 0x........: main (scalar.c)
Syscall param process_vm_readv(rvec) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1281)
+ by 0x........: main (scalar.c)
Syscall param process_vm_readv(riovcnt) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1281)
+ by 0x........: main (scalar.c)
Syscall param process_vm_readv(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1281)
+ by 0x........: main (scalar.c)
Syscall param process_vm_readv(lvec) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1281)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param process_vm_readv(rvec) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1281)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -4194,36 +4346,36 @@ Syscall param process_vm_readv(rvec) points to unaddressable byte(s)
-----------------------------------------------------
Syscall param process_vm_writev(pid) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1285)
+ by 0x........: main (scalar.c)
Syscall param process_vm_writev(lvec) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1285)
+ by 0x........: main (scalar.c)
Syscall param process_vm_writev(liovcnt) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1285)
+ by 0x........: main (scalar.c)
Syscall param process_vm_writev(rvec) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1285)
+ by 0x........: main (scalar.c)
Syscall param process_vm_writev(riovcnt) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1285)
+ by 0x........: main (scalar.c)
Syscall param process_vm_writev(flags) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1285)
+ by 0x........: main (scalar.c)
Syscall param process_vm_writev(lvec) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1285)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param process_vm_writev(rvec) points to unaddressable byte(s)
...
- by 0x........: main (scalar.c:1285)
+ by 0x........: main (scalar.c)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -4239,5 +4391,5 @@ it at http://valgrind.org/support/bug_reports.html.
-----------------------------------------------------
Syscall param exit(status) contains uninitialised byte(s)
...
- by 0x........: main (scalar.c:1293)
+ by 0x........: main (scalar.c)
diff --git a/memcheck/tests/x86-linux/scalar.vgtest b/memcheck/tests/x86-linux/scalar.vgtest
index 53e87e8d75..81e72b0475 100644
--- a/memcheck/tests/x86-linux/scalar.vgtest
+++ b/memcheck/tests/x86-linux/scalar.vgtest
@@ -2,4 +2,5 @@ prog: scalar
# Do not run under root
prereq: [ `id -u` -ne 0 ]
vgopts: -q --error-limit=no
+stderr_filter: filter_scalar
args: < scalar.c
diff --git a/memcheck/tests/x86-linux/scalar_openat2.stderr.exp b/memcheck/tests/x86-linux/scalar_openat2.stderr.exp
index 367da9dbf2..c666f9fb48 100644
--- a/memcheck/tests/x86-linux/scalar_openat2.stderr.exp
+++ b/memcheck/tests/x86-linux/scalar_openat2.stderr.exp
@@ -1,11 +1,11 @@
-----------------------------------------------------
437: __NR_openat2 4s 2m
-----------------------------------------------------
-Syscall param openat2(dfd) contains uninitialised byte(s)
+Syscall param openat2(dirfd) contains uninitialised byte(s)
...
by 0x........: main (scalar_openat2.c:15)
-Syscall param openat2(filename) contains uninitialised byte(s)
+Syscall param openat2(pathname) contains uninitialised byte(s)
...
by 0x........: main (scalar_openat2.c:15)
@@ -17,7 +17,7 @@ Syscall param openat2(size) contains uninitialised byte(s)
...
by 0x........: main (scalar_openat2.c:15)
-Syscall param openat2(filename) points to unaddressable byte(s)
+Syscall param openat2(pathname) points to unaddressable byte(s)
...
by 0x........: main (scalar_openat2.c:15)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
diff --git a/memcheck/tests/x86/filter_pushfpopf.in b/memcheck/tests/x86/filter_pushfpopf.in
old mode 100755
new mode 100644
diff --git a/memcheck/tests/xml1.stderr.exp b/memcheck/tests/xml1.stderr.exp
index 3eba805995..8ff61a5312 100644
--- a/memcheck/tests/xml1.stderr.exp
+++ b/memcheck/tests/xml1.stderr.exp
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -344,12 +344,13 @@
Syscall param exit(status) contains uninitialised byte(s)
-
FINISHED...
+...
+
0x...........
@@ -403,6 +404,8 @@
+...
+
...
@@ -432,5 +435,6 @@
...
-
+...
+
diff --git a/memcheck/tests/xml1.stderr.exp-s390x-mvc b/memcheck/tests/xml1.stderr.exp-s390x-mvc
index e1abac28a1..d7bf2095e9 100644
--- a/memcheck/tests/xml1.stderr.exp-s390x-mvc
+++ b/memcheck/tests/xml1.stderr.exp-s390x-mvc
@@ -2,7 +2,7 @@
-4
+6memcheck
@@ -344,12 +344,13 @@
Syscall param exit(status) contains uninitialised byte(s)
-
FINISHED...
+...
+
0x...........
@@ -403,6 +404,8 @@
+...
+
...
@@ -432,5 +435,6 @@
...
-
+...
+
diff --git a/mpi/libmpiwrap.c b/mpi/libmpiwrap.c
index 2fa1cb8fe0..3d08bc9fa5 100644
--- a/mpi/libmpiwrap.c
+++ b/mpi/libmpiwrap.c
@@ -9,7 +9,7 @@
Notice that the following BSD-style license applies to this one
file (mpiwrap.c) only. The rest of Valgrind is licensed under the
- terms of the GNU General Public License, version 2, unless
+ terms of the GNU General Public License, version 3, unless
otherwise indicated. See the COPYING file in the source
distribution for details.
diff --git a/none/nl_main.c b/none/nl_main.c
index 6d4da55ccd..17b55e4b67 100644
--- a/none/nl_main.c
+++ b/none/nl_main.c
@@ -12,7 +12,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am
index 6305044ca6..a95d66436d 100644
--- a/none/tests/Makefile.am
+++ b/none/tests/Makefile.am
@@ -24,7 +24,7 @@ if VGCONF_ARCHS_INCLUDE_ARM64
SUBDIRS += arm64
endif
if VGCONF_ARCHS_INCLUDE_S390X
-SUBDIRS += s390x
+SUBDIRS += s390x s390x/disasm-test
endif
if VGCONF_ARCHS_INCLUDE_MIPS32
SUBDIRS += mips32
@@ -77,7 +77,8 @@ if VGCONF_PLATFORMS_INCLUDE_X86_FREEBSD
SUBDIRS += x86-freebsd
endif
-DIST_SUBDIRS = x86 amd64 ppc32 ppc64 arm arm64 s390x mips32 mips64 nanomips \
+DIST_SUBDIRS = x86 amd64 ppc32 ppc64 arm arm64 s390x s390x/disasm-test \
+ mips32 mips64 nanomips \
riscv64 linux darwin solaris freebsd amd64-linux x86-linux \
amd64-darwin x86-darwin amd64-solaris x86-solaris x86-freebsd \
scripts .
@@ -91,7 +92,8 @@ dist_noinst_SCRIPTS = \
filter_stderr \
filter_timestamp \
filter_xml \
- allexec_prepare_prereq
+ allexec_prepare_prereq \
+ filter_sort
noinst_HEADERS = fdleak.h
@@ -158,6 +160,7 @@ EXTRA_DIST = \
fdleak_fcntl.stderr.exp fdleak_fcntl.vgtest \
fdleak_fcntl_xml.stderr.exp fdleak_fcntl_xml.vgtest \
fdleak_ipv4.stderr.exp fdleak_ipv4.stdout.exp fdleak_ipv4.vgtest \
+ fdleak_ipv4_xml.stderr.exp-ppc64be \
fdleak_ipv4_xml.stderr.exp-ppc64le \
fdleak_ipv4_xml.stderr.exp fdleak_ipv4_xml.stdout.exp \
fdleak_ipv4_xml.vgtest fdleak_ipv4_xml.stderr.exp-nomain \
@@ -272,8 +275,10 @@ EXTRA_DIST = \
fdbaduse.stderr.exp fdbaduse.vgtest \
use_after_close.stderr.exp use_after_close.vgtest \
track_new.stderr.exp track_new.stdout.exp \
- track_new.vgtest track_new.stderr.exp-illumos
-
+ track_new.vgtest track_new.stderr.exp-illumos \
+ track_yes.vgtest track_high.vgtest \
+ track_yes.stderr.exp track_high.stderr.exp \
+ track_bad.vgtest track_bad.stderr.exp
check_PROGRAMS = \
args \
@@ -331,7 +336,9 @@ check_PROGRAMS = \
file_dclose \
fdbaduse \
use_after_close \
- track_new
+ track_new \
+ track_std \
+ track_bad
if HAVE_STATIC_LIBC
if ! VGCONF_OS_IS_LINUX
diff --git a/none/tests/arm64/Makefile.am b/none/tests/arm64/Makefile.am
index 95a74e2b8a..4fa101d777 100644
--- a/none/tests/arm64/Makefile.am
+++ b/none/tests/arm64/Makefile.am
@@ -55,7 +55,7 @@ if HAVE_SHA3
check_PROGRAMS += sha512_v82
endif
-if HAVE_CXX17
+if HAVE_CONSTEXPR_IF
check_PROGRAMS += fcvta_s_u frinta_frintn
endif
diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp
index d2f3e5d6a8..5d3ea05697 100644
--- a/none/tests/cmdline1.stdout.exp
+++ b/none/tests/cmdline1.stdout.exp
@@ -28,9 +28,13 @@ usage: valgrind [options] prog-and-args
--vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none]
where event is one of:
startup exit abexit valgrindabexit all none
- --track-fds=no|yes|all track open file descriptors? [no]
- all includes reporting inherited file descriptors
- --modify-fds=no|high modify newly open file descriptors? [no]
+ --track-fds=no|yes|all|bad track open file descriptors? [no]
+ all also reports on open inherited file
+ descriptors at exit (e.g. stdin/out/err)
+ bad only reports on file descriptor usage
+ errors and doesn't list open file descriptors
+ at exit
+ --modify-fds=no|yes|high modify newly open file descriptors? [no]
--time-stamp=no|yes add timestamps to log messages? [no]
--log-fd= log messages to file descriptor [2=stderr]
--log-file= log messages to
diff --git a/none/tests/cmdline1.stdout.exp-non-linux b/none/tests/cmdline1.stdout.exp-non-linux
index d36db3976e..9b044e78a1 100644
--- a/none/tests/cmdline1.stdout.exp-non-linux
+++ b/none/tests/cmdline1.stdout.exp-non-linux
@@ -28,9 +28,13 @@ usage: valgrind [options] prog-and-args
--vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none]
where event is one of:
startup exit abexit valgrindabexit all none
- --track-fds=no|yes|all track open file descriptors? [no]
- all includes reporting inherited file descriptors
- --modify-fds=no|high modify newly open file descriptors? [no]
+ --track-fds=no|yes|all|bad track open file descriptors? [no]
+ all also reports on open inherited file
+ descriptors at exit (e.g. stdin/out/err)
+ bad only reports on file descriptor usage
+ errors and doesn't list open file descriptors
+ at exit
+ --modify-fds=no|yes|high modify newly open file descriptors? [no]
--time-stamp=no|yes add timestamps to log messages? [no]
--log-fd= log messages to file descriptor [2=stderr]
--log-file= log messages to
diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp
index 9a49757461..2ed4fc02e8 100644
--- a/none/tests/cmdline2.stdout.exp
+++ b/none/tests/cmdline2.stdout.exp
@@ -28,9 +28,13 @@ usage: valgrind [options] prog-and-args
--vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none]
where event is one of:
startup exit abexit valgrindabexit all none
- --track-fds=no|yes|all track open file descriptors? [no]
- all includes reporting inherited file descriptors
- --modify-fds=no|high modify newly open file descriptors? [no]
+ --track-fds=no|yes|all|bad track open file descriptors? [no]
+ all also reports on open inherited file
+ descriptors at exit (e.g. stdin/out/err)
+ bad only reports on file descriptor usage
+ errors and doesn't list open file descriptors
+ at exit
+ --modify-fds=no|yes|high modify newly open file descriptors? [no]
--time-stamp=no|yes add timestamps to log messages? [no]
--log-fd= log messages to file descriptor [2=stderr]
--log-file= log messages to
@@ -202,6 +206,7 @@ usage: valgrind [options] prog-and-args
--vex-iropt-verbosity=<0..9> [0]
--vex-iropt-level=<0..2> [2]
--vex-iropt-unroll-thresh=<0..400> [120]
+ --vex-iropt-fold-expr=no|yes [yes]
--vex-guest-max-insns=<1..100> [50]
--vex-guest-chase=no|yes [yes]
Precise exception control. Possible values for 'mode' are as follows
diff --git a/none/tests/cmdline2.stdout.exp-non-linux b/none/tests/cmdline2.stdout.exp-non-linux
index 5a44b3bfac..19c282b7f6 100644
--- a/none/tests/cmdline2.stdout.exp-non-linux
+++ b/none/tests/cmdline2.stdout.exp-non-linux
@@ -28,9 +28,13 @@ usage: valgrind [options] prog-and-args
--vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none]
where event is one of:
startup exit abexit valgrindabexit all none
- --track-fds=no|yes|all track open file descriptors? [no]
- all includes reporting inherited file descriptors
- --modify-fds=no|high modify newly open file descriptors? [no]
+ --track-fds=no|yes|all|bad track open file descriptors? [no]
+ all also reports on open inherited file
+ descriptors at exit (e.g. stdin/out/err)
+ bad only reports on file descriptor usage
+ errors and doesn't list open file descriptors
+ at exit
+ --modify-fds=no|yes|high modify newly open file descriptors? [no]
--time-stamp=no|yes add timestamps to log messages? [no]
--log-fd= log messages to file descriptor [2=stderr]
--log-file= log messages to
@@ -200,6 +204,7 @@ usage: valgrind [options] prog-and-args
--vex-iropt-verbosity=<0..9> [0]
--vex-iropt-level=<0..2> [2]
--vex-iropt-unroll-thresh=<0..400> [120]
+ --vex-iropt-fold-expr=no|yes [yes]
--vex-guest-max-insns=<1..100> [50]
--vex-guest-chase=no|yes [yes]
Precise exception control. Possible values for 'mode' are as follows
diff --git a/none/tests/double_close_range_xml.stderr.exp b/none/tests/double_close_range_xml.stderr.exp
index c21a2bcdd0..22027dc1a5 100644
--- a/none/tests/double_close_range_xml.stderr.exp
+++ b/none/tests/double_close_range_xml.stderr.exp
@@ -2,7 +2,7 @@
-5
+6none
@@ -123,7 +123,6 @@ Double closing range (5, 7).
-
FINISHED...
@@ -140,6 +139,4 @@ Double closing range (5, 7).
-
-
diff --git a/none/tests/fdleak.h b/none/tests/fdleak.h
index f0a6eac493..9225dd3dab 100644
--- a/none/tests/fdleak.h
+++ b/none/tests/fdleak.h
@@ -17,28 +17,4 @@
res; \
})
-/*
- * The macro below closes file descriptors inherited from the process
- * that forked the current process. Close these file descriptors right
- * after the start of main() in order to get consistent results across
- * different releases. Known behavior:
- * - Fedora Core 1's Perl opens /dev/pts/2 as fd 10.
- * - For Ubuntu 8.04, see also
- * https://bugs.launchpad.net/ubuntu/+source/seahorse/+bug/235184
- */
-static void close_inherited (void) {
- struct stat sb;
- int i; int max_fds = sysconf (_SC_OPEN_MAX);
- if (max_fds < 0)
- max_fds = 1024; /* Fallback if sysconf fails, returns -1. */
-
- /* Only leave 0 (stdin), 1 (stdout) and 2 (stderr) open. */
- for (i = 3; i < max_fds; i++)
- if (fstat (i, &sb) != -1) /* Test if the file descriptor exists first. */
- close(i);
-}
-#define CLOSE_INHERITED_FDS close_inherited ()
-/* Note that the following would be nicer, but close_range is fairly new. */
-// #define CLOSE_INHERITED_FDS close_range (3, ~0U, 0)
-
#endif /* _FDLEAK_H_ */
diff --git a/none/tests/fdleak_cmsg.c b/none/tests/fdleak_cmsg.c
index d4300bcf2d..638bca3d2c 100644
--- a/none/tests/fdleak_cmsg.c
+++ b/none/tests/fdleak_cmsg.c
@@ -159,7 +159,7 @@ int main (int argc, char **argv)
{
int pid, status;
- CLOSE_INHERITED_FDS;
+
pid = getpid();
sprintf(filea, "/tmp/data1.%d", pid);
diff --git a/none/tests/fdleak_cmsg_xml.stderr.exp b/none/tests/fdleak_cmsg_xml.stderr.exp
index 39b739be70..2fbb664b43 100644
--- a/none/tests/fdleak_cmsg_xml.stderr.exp
+++ b/none/tests/fdleak_cmsg_xml.stderr.exp
@@ -2,7 +2,7 @@
-5
+6none
@@ -37,7 +37,6 @@
...
-
FINISHED...
@@ -150,6 +149,4 @@
...
-
-
diff --git a/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le b/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le
index 6294094eb9..1ab6c6fe0f 100644
--- a/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le
+++ b/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le
@@ -2,7 +2,7 @@
-5
+6none
diff --git a/none/tests/fdleak_creat.c b/none/tests/fdleak_creat.c
index 3c7c40174d..e3fc033978 100644
--- a/none/tests/fdleak_creat.c
+++ b/none/tests/fdleak_creat.c
@@ -7,7 +7,7 @@ int main (int argc, char **argv)
{
char filename[24];
- CLOSE_INHERITED_FDS;
+
sprintf(filename, "/tmp/file.%ld", (long) getpid());
(void) DO( creat(filename, 0) );
diff --git a/none/tests/fdleak_creat_xml.stderr.exp b/none/tests/fdleak_creat_xml.stderr.exp
index fbdc261d61..5c585a2249 100644
--- a/none/tests/fdleak_creat_xml.stderr.exp
+++ b/none/tests/fdleak_creat_xml.stderr.exp
@@ -2,7 +2,7 @@
-5
+6none
@@ -36,7 +36,6 @@
...
-
FINISHED...
@@ -88,6 +87,4 @@
...
-
-
diff --git a/none/tests/fdleak_dup.c b/none/tests/fdleak_dup.c
index f526121e2e..c4fedbee3c 100644
--- a/none/tests/fdleak_dup.c
+++ b/none/tests/fdleak_dup.c
@@ -6,7 +6,7 @@ int main (int argc, char **argv)
{
int s;
- CLOSE_INHERITED_FDS;
+
s = DO( open("/dev/null", O_RDONLY) );
(void) DO( dup(s) );
diff --git a/none/tests/fdleak_dup2.c b/none/tests/fdleak_dup2.c
index 96a7271c69..02d641649e 100644
--- a/none/tests/fdleak_dup2.c
+++ b/none/tests/fdleak_dup2.c
@@ -7,7 +7,7 @@ int main (int argc, char **argv)
int s1;
int s2;
- CLOSE_INHERITED_FDS;
+
s1 = DO( open("/dev/null", O_RDONLY) );
s2 = DO( open("/dev/null", O_RDONLY) );
diff --git a/none/tests/fdleak_dup2_xml.stderr.exp b/none/tests/fdleak_dup2_xml.stderr.exp
index 318093bd39..de6ed78330 100644
--- a/none/tests/fdleak_dup2_xml.stderr.exp
+++ b/none/tests/fdleak_dup2_xml.stderr.exp
@@ -2,7 +2,7 @@
-5
+6none
@@ -36,7 +36,6 @@
...
-
FINISHED...
@@ -126,6 +125,4 @@
...
-
-
diff --git a/none/tests/fdleak_dup_xml.stderr.exp b/none/tests/fdleak_dup_xml.stderr.exp
index 3fc08d342e..f56d837673 100644
--- a/none/tests/fdleak_dup_xml.stderr.exp
+++ b/none/tests/fdleak_dup_xml.stderr.exp
@@ -2,7 +2,7 @@
-5
+6none
@@ -36,7 +36,6 @@
...
-
FINISHED...
@@ -107,6 +106,4 @@
...
-
-
diff --git a/none/tests/fdleak_fcntl.c b/none/tests/fdleak_fcntl.c
index c57a2608b6..909c260924 100644
--- a/none/tests/fdleak_fcntl.c
+++ b/none/tests/fdleak_fcntl.c
@@ -7,7 +7,7 @@ int main (int argc, char **argv)
{
int s1;
- CLOSE_INHERITED_FDS;
+
s1 = DO( open("/dev/null", O_RDONLY) );
(void) DO( fcntl(s1, F_DUPFD, s1) );
diff --git a/none/tests/fdleak_fcntl_xml.stderr.exp b/none/tests/fdleak_fcntl_xml.stderr.exp
index 4f33dc9e36..81605e2ae4 100644
--- a/none/tests/fdleak_fcntl_xml.stderr.exp
+++ b/none/tests/fdleak_fcntl_xml.stderr.exp
@@ -2,7 +2,7 @@
-5
+6none
@@ -36,7 +36,6 @@
...
-
FINISHED...
@@ -107,6 +106,4 @@
...
-
-
diff --git a/none/tests/fdleak_ipv4.c b/none/tests/fdleak_ipv4.c
index 05f2977620..8313ef75d2 100644
--- a/none/tests/fdleak_ipv4.c
+++ b/none/tests/fdleak_ipv4.c
@@ -80,7 +80,7 @@ int main (int argc, char **argv)
{
int pid, status;
- CLOSE_INHERITED_FDS;
+
if ((pid = fork()) == 0) {
server();
diff --git a/none/tests/fdleak_ipv4_xml.stderr.exp b/none/tests/fdleak_ipv4_xml.stderr.exp
index 38797041a1..e55277422d 100644
--- a/none/tests/fdleak_ipv4_xml.stderr.exp
+++ b/none/tests/fdleak_ipv4_xml.stderr.exp
@@ -2,7 +2,7 @@
-5
+6none
@@ -101,7 +101,6 @@
-
FINISHED...
@@ -143,5 +142,11 @@
-
+
+ 2
+ 2
+ 0
+ 0
+
+
diff --git a/none/tests/fdleak_ipv4_xml.stderr.exp-nomain b/none/tests/fdleak_ipv4_xml.stderr.exp-nomain
index 8eaa4f20fa..e55277422d 100644
--- a/none/tests/fdleak_ipv4_xml.stderr.exp-nomain
+++ b/none/tests/fdleak_ipv4_xml.stderr.exp-nomain
@@ -2,7 +2,7 @@
-5
+6none
@@ -52,6 +52,14 @@
fdleak_ipv4.c70
+
+ 0x........
+ ...
+ main
+ ...
+ fdleak_ipv4.c
+ 90
+
Previously closed
@@ -63,6 +71,14 @@
fdleak_ipv4.c69
+
+ 0x........
+ ...
+ main
+ ...
+ fdleak_ipv4.c
+ 90
+
Originally opened
@@ -74,10 +90,17 @@
fdleak_ipv4.c68
+
+ 0x........
+ ...
+ main
+ ...
+ fdleak_ipv4.c
+ 90
+
-
FINISHED...
@@ -119,5 +142,11 @@
-
+
+ 2
+ 2
+ 0
+ 0
+
+
diff --git a/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64be b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64be
new file mode 100644
index 0000000000..204592a557
--- /dev/null
+++ b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64be
@@ -0,0 +1,128 @@
+
+
+
+
+6
+none
+
+
+ Nulgrind, the minimal Valgrind tool
+ Copyright...
+ Using Valgrind...
+ Command: ./fdleak_ipv4
+
+
+...
+...
+none
+
+
+
+ ...
+ --command-line-only=yes
+ --memcheck:leak-check=no
+ --tool=none
+ --track-fds=yes
+ --xml=yes
+ --xml-fd=2
+ --child-silent-after-fork=yes
+
+
+ ...
+
+
+
+
+ RUNNING
+ ...
+
+
+
+ 0x........
+ ...
+ FdBadClose
+ 4
+ ...
+
+
+ 0x........
+ ...
+ client
+ ...
+ fdleak_ipv4.c
+ 70
+
+
+ Previously closed
+
+
+ 0x........
+ ...
+ client
+ ...
+ fdleak_ipv4.c
+ 69
+
+
+ Originally opened
+
+
+ 0x........
+ ...
+ client
+ ...
+ fdleak_ipv4.c
+ 68
+
+
+
+
+
+ FINISHED
+ ...
+
+
+
+ 0x........
+ ...
+ FdNotClosed
+ 3
+ ...
+
+
+ 0x........
+ ...
+ client
+ ...
+ fdleak_ipv4.c
+ 51
+
+
+ 0x........
+ ...
+ main
+ ...
+ fdleak_ipv4.c
+ 90
+
+
+
+
+
+
+ 1
+ 0x........
+
+
+
+
+
+
+
+ 2
+ 2
+ 0
+ 0
+
+
+
diff --git a/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le
index df413b6289..27c304f47a 100644
--- a/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le
+++ b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le
@@ -2,7 +2,7 @@
-5
+6none
@@ -101,7 +101,6 @@
-
FINISHED...
@@ -135,5 +134,11 @@
-
+
+ 2
+ 2
+ 0
+ 0
+
+
diff --git a/none/tests/fdleak_open.c b/none/tests/fdleak_open.c
index cf6a35e97c..7b02553633 100644
--- a/none/tests/fdleak_open.c
+++ b/none/tests/fdleak_open.c
@@ -4,7 +4,7 @@
int main (int argc, char **argv)
{
- CLOSE_INHERITED_FDS;
+
(void) DO( open("/dev/null", O_RDONLY) );
diff --git a/none/tests/fdleak_open_xml.stderr.exp b/none/tests/fdleak_open_xml.stderr.exp
index 2cde2d1904..5e67f9d25b 100644
--- a/none/tests/fdleak_open_xml.stderr.exp
+++ b/none/tests/fdleak_open_xml.stderr.exp
@@ -2,7 +2,7 @@
-5
+6none
@@ -36,7 +36,6 @@
...
-
FINISHED...
@@ -61,6 +60,4 @@
-
-
diff --git a/none/tests/fdleak_pipe.c b/none/tests/fdleak_pipe.c
index 82ff24e885..0a2d7102cf 100644
--- a/none/tests/fdleak_pipe.c
+++ b/none/tests/fdleak_pipe.c
@@ -5,7 +5,7 @@ int main (int argc, char **argv)
{
int fds[2];
- CLOSE_INHERITED_FDS;
+
(void) DO( pipe(fds) );
diff --git a/none/tests/fdleak_pipe_xml.stderr.exp b/none/tests/fdleak_pipe_xml.stderr.exp
index 2abb5a2660..2fb93ce906 100644
--- a/none/tests/fdleak_pipe_xml.stderr.exp
+++ b/none/tests/fdleak_pipe_xml.stderr.exp
@@ -2,7 +2,7 @@
-5
+6none
@@ -36,7 +36,6 @@
...
-
FINISHED...
@@ -78,6 +77,4 @@
-
-
diff --git a/none/tests/fdleak_socketpair.c b/none/tests/fdleak_socketpair.c
index 6205920041..bd3a9b8a3b 100644
--- a/none/tests/fdleak_socketpair.c
+++ b/none/tests/fdleak_socketpair.c
@@ -8,7 +8,7 @@ int main (int argc, char **argv)
{
int fds[2];
- CLOSE_INHERITED_FDS;
+
(void) DO( socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, fds) );
diff --git a/none/tests/fdleak_socketpair_xml.stderr.exp b/none/tests/fdleak_socketpair_xml.stderr.exp
index bdd31860d8..6d2e2b41b4 100644
--- a/none/tests/fdleak_socketpair_xml.stderr.exp
+++ b/none/tests/fdleak_socketpair_xml.stderr.exp
@@ -2,7 +2,7 @@
-5
+6none
@@ -36,7 +36,6 @@
...
-
FINISHED...
@@ -78,6 +77,4 @@
-
-
diff --git a/none/tests/fdleak_socketpair_xml.stderr.exp-illumos b/none/tests/fdleak_socketpair_xml.stderr.exp-illumos
index f01a80440a..8b578188e9 100644
--- a/none/tests/fdleak_socketpair_xml.stderr.exp-illumos
+++ b/none/tests/fdleak_socketpair_xml.stderr.exp-illumos
@@ -2,7 +2,7 @@
-5
+6none
@@ -36,7 +36,6 @@
...
-
FINISHED...
@@ -78,6 +77,4 @@
-
-
diff --git a/none/tests/file_dclose.c b/none/tests/file_dclose.c
index b3f864ef99..3b7b127bb4 100644
--- a/none/tests/file_dclose.c
+++ b/none/tests/file_dclose.c
@@ -20,7 +20,7 @@ closefile (const char *f, int fd)
int main ()
{
- CLOSE_INHERITED_FDS;
+
const char *TMPFILE = "file_dclose.tmp";
int fd;
diff --git a/none/tests/file_dclose_xml.stderr.exp b/none/tests/file_dclose_xml.stderr.exp
index 4e4bd773cb..c6a25d510f 100644
--- a/none/tests/file_dclose_xml.stderr.exp
+++ b/none/tests/file_dclose_xml.stderr.exp
@@ -2,7 +2,7 @@
-5
+6none
@@ -96,7 +96,6 @@ time passes and we close 3 again
-
FINISHED...
@@ -109,6 +108,4 @@ time passes and we close 3 again
-
-
diff --git a/none/tests/file_dclose_xml.stderr.exp-nomain b/none/tests/file_dclose_xml.stderr.exp-nomain
index b0cfc10c5f..bd424eaed9 100644
--- a/none/tests/file_dclose_xml.stderr.exp-nomain
+++ b/none/tests/file_dclose_xml.stderr.exp-nomain
@@ -2,7 +2,7 @@
-5
+6none
@@ -80,7 +80,6 @@ time passes and we close 3 again
-
FINISHED...
@@ -93,6 +92,4 @@ time passes and we close 3 again
-
-
diff --git a/none/tests/filter_sort b/none/tests/filter_sort
new file mode 100755
index 0000000000..5c376236c2
--- /dev/null
+++ b/none/tests/filter_sort
@@ -0,0 +1,2 @@
+#!/bin/sh
+sort
diff --git a/none/tests/freebsd/Makefile.am b/none/tests/freebsd/Makefile.am
index 5d209c6d27..2353865276 100644
--- a/none/tests/freebsd/Makefile.am
+++ b/none/tests/freebsd/Makefile.am
@@ -1,19 +1,12 @@
include $(top_srcdir)/Makefile.tool-tests.am
-dist_noinst_SCRIPTS = filter_stderr test.sh filter_452274 filter_auxv filter_fdleak auxv_script
+dist_noinst_SCRIPTS = filter_stderr test.sh filter_452274 filter_auxv \
+ filter_pre_auxv filter_fdleak auxv_script
EXTRA_DIST = \
auxv.vgtest \
- auxv.stderr.exp \
- auxv.stderr.exp-32on64 \
- auxv.stderr.exp-freebsd13 \
- auxv.stderr.exp-freebsd131 \
- auxv.stderr.exp-freebsd14 \
- auxv.stderr.exp-arm64 \
auxv_script.vgtest \
- auxv_script.stderr.exp \
- auxv_script.stderr.exp-arm64 \
bug452274.vgtest \
bug452274.stderr.exp \
bug498317.vgtest bug498317.stderr.exp \
@@ -53,6 +46,12 @@ EXTRA_DIST = \
ksh_test.ksh \
ksh_test.stderr.exp \
ksh_test.stdout.exp \
+ open_client.vgtest \
+ open_client.stderr.exp \
+ readlinkat.vgtest \
+ readlinkat.stderr.exp \
+ readlinkat2.vgtest \
+ readlinkat2.stderr.exp \
sanity_level_thread.vgtest \
sanity_level_thread.stderr.exp \
swapcontext.vgtest \
@@ -69,8 +68,9 @@ EXTRA_DIST = \
usrstack.stdout.exp
check_PROGRAMS = \
- auxv bug452274 bug498317 bug499212 fexecve hello_world osrel \
- proc_pid_file sanity_level_thread swapcontext umtx_shm_creat usrstack
+ auxv bug452274 bug498317 bug499212 fexecve hello_world open_client \
+ osrel proc_pid_file readlinkat readlinkat2 sanity_level_thread swapcontext \
+ umtx_shm_creat usrstack
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
@@ -80,8 +80,12 @@ osrel_CFLAGS = ${AM_CFLAGS}
swapcontext_CFLAGS = ${AM_CFLAGS}
hello_world_SOURCES = hello_world.cpp
-
+open_client_SOURCES = open_client.cpp
proc_pid_file_SOURCES = proc_pid_file.cpp
+readlinkat_SOURCES = readlinkat.cpp
+readlinkat_CXXFLAGS = ${AM_CXXFLAGS} @FLAG_W_NO_UNINITIALIZED@
+readlinkat2_SOURCES = readlinkat2.cpp
+readlinkat2_CXXFLAGS = ${AM_CXXFLAGS} @FLAG_W_NO_UNINITIALIZED@
sanity_level_thread_SOURCES = sanity_level_thread.cpp
sanity_level_thread_LDFLAGS = ${AM_LDFLAGS} -pthread
diff --git a/none/tests/freebsd/auxv.c b/none/tests/freebsd/auxv.c
index c49e606ea0..6712053dac 100644
--- a/none/tests/freebsd/auxv.c
+++ b/none/tests/freebsd/auxv.c
@@ -48,7 +48,10 @@ Elf_AuxStr aux_map[] = {
{"AT_KPRELOAD", 34},
{"AT_USRSTACKBASE", 35},
{"AT_USRSTACKLIM", 36},
-// {"AT_COUNT", 37},
+ {"AT_CHERI_STATS", 37},
+ {"AT_HWCAP3", 38},
+ {"AT_HWCAP4", 39},
+// {"AT_COUNT", 40},
};
int main(int argc, char* argv[], char* envp[])
diff --git a/none/tests/freebsd/auxv.stderr.exp b/none/tests/freebsd/auxv.stderr.exp
deleted file mode 100644
index e106f06af8..0000000000
--- a/none/tests/freebsd/auxv.stderr.exp
+++ /dev/null
@@ -1,18 +0,0 @@
-val: AT_PHDR int: 03 ptr: 0x........
-val: AT_PHENT int: 04 ptr: 0x........
-val: AT_PHNUM int: 05 ptr: 0x........
-val: AT_PAGESZ int: 06 ptr: 0x........
-val: AT_FLAGS int: 08 ptr: 0x........
-val: AT_ENTRY int: 09 ptr: 0x........
-val: AT_BASE int: 07 ptr: 0x........
-val: AT_EHDRFLAGS int: 24 ptr: 0x........
-val: AT_EXECPATH int: 15 ptr: 0x........
-EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv
-val: AT_OSRELDATE int: 18 ptr: 0x........
-val: AT_CANARY int: 16 ptr: 0x........
-val: AT_CANARYLEN int: 17 ptr: 0x........
-val: AT_NCPUS int: 19 ptr: 0x........
-val: AT_PAGESIZES int: 20 ptr: 0x........
-val: AT_PAGESIZESLEN int: 21 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_STACKPROT int: 23 ptr: 0x........
diff --git a/none/tests/freebsd/auxv.stderr.exp-32on64 b/none/tests/freebsd/auxv.stderr.exp-32on64
deleted file mode 100644
index db7060abce..0000000000
--- a/none/tests/freebsd/auxv.stderr.exp-32on64
+++ /dev/null
@@ -1,28 +0,0 @@
-val: AT_PHDR int: 03 ptr: 0x........
-val: AT_PHENT int: 04 ptr: 0x........
-val: AT_PHNUM int: 05 ptr: 0x........
-val: AT_PAGESZ int: 06 ptr: 0x........
-val: AT_FLAGS int: 08 ptr: 0x........
-val: AT_ENTRY int: 09 ptr: 0x........
-val: AT_BASE int: 07 ptr: 0x........
-val: AT_EHDRFLAGS int: 24 ptr: 0x........
-val: AT_EXECPATH int: 15 ptr: 0x........
-EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv
-val: AT_OSRELDATE int: 18 ptr: 0x........
-val: AT_CANARY int: 16 ptr: 0x........
-val: AT_CANARYLEN int: 17 ptr: 0x........
-val: AT_NCPUS int: 19 ptr: 0x........
-val: AT_PAGESIZES int: 20 ptr: 0x........
-val: AT_PAGESIZESLEN int: 21 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_STACKPROT int: 23 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_ARGC int: 28 ptr: 0x........
-val: AT_ARGV int: 29 ptr: 0x........
-ARGV: ./auxv
-val: AT_ENVC int: 30 ptr: 0x........
-val: AT_ENVV int: 31 ptr: 0x........
-val: AT_PS_STRINGS int: 32 ptr: 0x........
-PS_STRINGS ARGV: ./auxv
-val: AT_USRSTACKBASE int: 35 ptr: 0x........
-val: AT_USRSTACKLIM int: 36 ptr: 0x........
diff --git a/none/tests/freebsd/auxv.stderr.exp-arm64 b/none/tests/freebsd/auxv.stderr.exp-arm64
deleted file mode 100644
index 738a284dcb..0000000000
--- a/none/tests/freebsd/auxv.stderr.exp-arm64
+++ /dev/null
@@ -1,30 +0,0 @@
-val: AT_PHDR int: 03 ptr: 0x........
-val: AT_PHENT int: 04 ptr: 0x........
-val: AT_PHNUM int: 05 ptr: 0x........
-val: AT_PAGESZ int: 06 ptr: 0x........
-val: AT_FLAGS int: 08 ptr: 0x........
-val: AT_ENTRY int: 09 ptr: 0x........
-val: AT_BASE int: 07 ptr: 0x........
-val: AT_EHDRFLAGS int: 24 ptr: 0x........
-val: AT_EXECPATH int: 15 ptr: 0x........
-EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv
-val: AT_OSRELDATE int: 18 ptr: 0x........
-val: AT_CANARY int: 16 ptr: 0x........
-val: AT_CANARYLEN int: 17 ptr: 0x........
-val: AT_NCPUS int: 19 ptr: 0x........
-val: AT_PAGESIZES int: 20 ptr: 0x........
-val: AT_PAGESIZESLEN int: 21 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_STACKPROT int: 23 ptr: 0x........
-val: AT_HWCAP int: 25 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_ARGC int: 28 ptr: 0x........
-val: AT_ARGV int: 29 ptr: 0x........
-ARGV: ./auxv
-val: AT_ENVC int: 30 ptr: 0x........
-val: AT_ENVV int: 31 ptr: 0x........
-val: AT_PS_STRINGS int: 32 ptr: 0x........
-PS_STRINGS ARGV: ./auxv
-val: AT_USRSTACKBASE int: 35 ptr: 0x........
-val: AT_USRSTACKLIM int: 36 ptr: 0x........
diff --git a/none/tests/freebsd/auxv.stderr.exp-freebsd13 b/none/tests/freebsd/auxv.stderr.exp-freebsd13
deleted file mode 100644
index 1740ed9b47..0000000000
--- a/none/tests/freebsd/auxv.stderr.exp-freebsd13
+++ /dev/null
@@ -1,26 +0,0 @@
-val: AT_PHDR int: 03 ptr: 0x........
-val: AT_PHENT int: 04 ptr: 0x........
-val: AT_PHNUM int: 05 ptr: 0x........
-val: AT_PAGESZ int: 06 ptr: 0x........
-val: AT_FLAGS int: 08 ptr: 0x........
-val: AT_ENTRY int: 09 ptr: 0x........
-val: AT_BASE int: 07 ptr: 0x........
-val: AT_EHDRFLAGS int: 24 ptr: 0x........
-val: AT_EXECPATH int: 15 ptr: 0x........
-EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv
-val: AT_OSRELDATE int: 18 ptr: 0x........
-val: AT_CANARY int: 16 ptr: 0x........
-val: AT_CANARYLEN int: 17 ptr: 0x........
-val: AT_NCPUS int: 19 ptr: 0x........
-val: AT_PAGESIZES int: 20 ptr: 0x........
-val: AT_PAGESIZESLEN int: 21 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_STACKPROT int: 23 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_ARGC int: 28 ptr: 0x........
-val: AT_ARGV int: 29 ptr: 0x........
-ARGV: ./auxv
-val: AT_ENVC int: 30 ptr: 0x........
-val: AT_ENVV int: 31 ptr: 0x........
-val: AT_PS_STRINGS int: 32 ptr: 0x........
-PS_STRINGS ARGV: ./auxv
diff --git a/none/tests/freebsd/auxv.stderr.exp-freebsd131 b/none/tests/freebsd/auxv.stderr.exp-freebsd131
deleted file mode 100644
index 7010bfa9c6..0000000000
--- a/none/tests/freebsd/auxv.stderr.exp-freebsd131
+++ /dev/null
@@ -1,27 +0,0 @@
-val: AT_PHDR int: 03 ptr: 0x........
-val: AT_PHENT int: 04 ptr: 0x........
-val: AT_PHNUM int: 05 ptr: 0x........
-val: AT_PAGESZ int: 06 ptr: 0x........
-val: AT_FLAGS int: 08 ptr: 0x........
-val: AT_ENTRY int: 09 ptr: 0x........
-val: AT_BASE int: 07 ptr: 0x........
-val: AT_EHDRFLAGS int: 24 ptr: 0x........
-val: AT_EXECPATH int: 15 ptr: 0x........
-EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv
-val: AT_OSRELDATE int: 18 ptr: 0x........
-val: AT_CANARY int: 16 ptr: 0x........
-val: AT_CANARYLEN int: 17 ptr: 0x........
-val: AT_NCPUS int: 19 ptr: 0x........
-val: AT_PAGESIZES int: 20 ptr: 0x........
-val: AT_PAGESIZESLEN int: 21 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_STACKPROT int: 23 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_ARGC int: 28 ptr: 0x........
-val: AT_ARGV int: 29 ptr: 0x........
-ARGV: ./auxv
-val: AT_ENVC int: 30 ptr: 0x........
-val: AT_ENVV int: 31 ptr: 0x........
-val: AT_PS_STRINGS int: 32 ptr: 0x........
-PS_STRINGS ARGV: ./auxv
-val: AT_IGNORE int: 01 ptr: 0x........
diff --git a/none/tests/freebsd/auxv.stderr.exp-freebsd14 b/none/tests/freebsd/auxv.stderr.exp-freebsd14
deleted file mode 100644
index dcca09f63c..0000000000
--- a/none/tests/freebsd/auxv.stderr.exp-freebsd14
+++ /dev/null
@@ -1,29 +0,0 @@
-val: AT_PHDR int: 03 ptr: 0x........
-val: AT_PHENT int: 04 ptr: 0x........
-val: AT_PHNUM int: 05 ptr: 0x........
-val: AT_PAGESZ int: 06 ptr: 0x........
-val: AT_FLAGS int: 08 ptr: 0x........
-val: AT_ENTRY int: 09 ptr: 0x........
-val: AT_BASE int: 07 ptr: 0x........
-val: AT_EHDRFLAGS int: 24 ptr: 0x........
-val: AT_EXECPATH int: 15 ptr: 0x........
-EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv
-val: AT_OSRELDATE int: 18 ptr: 0x........
-val: AT_CANARY int: 16 ptr: 0x........
-val: AT_CANARYLEN int: 17 ptr: 0x........
-val: AT_NCPUS int: 19 ptr: 0x........
-val: AT_PAGESIZES int: 20 ptr: 0x........
-val: AT_PAGESIZESLEN int: 21 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_STACKPROT int: 23 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_ARGC int: 28 ptr: 0x........
-val: AT_ARGV int: 29 ptr: 0x........
-ARGV: ./auxv
-val: AT_ENVC int: 30 ptr: 0x........
-val: AT_ENVV int: 31 ptr: 0x........
-val: AT_PS_STRINGS int: 32 ptr: 0x........
-PS_STRINGS ARGV: ./auxv
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_USRSTACKBASE int: 35 ptr: 0x........
-val: AT_USRSTACKLIM int: 36 ptr: 0x........
diff --git a/none/tests/freebsd/auxv.vgtest b/none/tests/freebsd/auxv.vgtest
index 098f301342..a2643a0796 100644
--- a/none/tests/freebsd/auxv.vgtest
+++ b/none/tests/freebsd/auxv.vgtest
@@ -1,4 +1,6 @@
+prereq: ./auxv 2>&1 | ./filter_pre_auxv > auxv.stderr.exp
prog: auxv
vgopts: -q
stderr_filter: filter_auxv
+post: rm auxv.stderr.exp
diff --git a/none/tests/freebsd/auxv_script.stderr.exp b/none/tests/freebsd/auxv_script.stderr.exp
deleted file mode 100644
index dcca09f63c..0000000000
--- a/none/tests/freebsd/auxv_script.stderr.exp
+++ /dev/null
@@ -1,29 +0,0 @@
-val: AT_PHDR int: 03 ptr: 0x........
-val: AT_PHENT int: 04 ptr: 0x........
-val: AT_PHNUM int: 05 ptr: 0x........
-val: AT_PAGESZ int: 06 ptr: 0x........
-val: AT_FLAGS int: 08 ptr: 0x........
-val: AT_ENTRY int: 09 ptr: 0x........
-val: AT_BASE int: 07 ptr: 0x........
-val: AT_EHDRFLAGS int: 24 ptr: 0x........
-val: AT_EXECPATH int: 15 ptr: 0x........
-EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv
-val: AT_OSRELDATE int: 18 ptr: 0x........
-val: AT_CANARY int: 16 ptr: 0x........
-val: AT_CANARYLEN int: 17 ptr: 0x........
-val: AT_NCPUS int: 19 ptr: 0x........
-val: AT_PAGESIZES int: 20 ptr: 0x........
-val: AT_PAGESIZESLEN int: 21 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_STACKPROT int: 23 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_ARGC int: 28 ptr: 0x........
-val: AT_ARGV int: 29 ptr: 0x........
-ARGV: ./auxv
-val: AT_ENVC int: 30 ptr: 0x........
-val: AT_ENVV int: 31 ptr: 0x........
-val: AT_PS_STRINGS int: 32 ptr: 0x........
-PS_STRINGS ARGV: ./auxv
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_USRSTACKBASE int: 35 ptr: 0x........
-val: AT_USRSTACKLIM int: 36 ptr: 0x........
diff --git a/none/tests/freebsd/auxv_script.stderr.exp-arm64 b/none/tests/freebsd/auxv_script.stderr.exp-arm64
deleted file mode 100644
index 738a284dcb..0000000000
--- a/none/tests/freebsd/auxv_script.stderr.exp-arm64
+++ /dev/null
@@ -1,30 +0,0 @@
-val: AT_PHDR int: 03 ptr: 0x........
-val: AT_PHENT int: 04 ptr: 0x........
-val: AT_PHNUM int: 05 ptr: 0x........
-val: AT_PAGESZ int: 06 ptr: 0x........
-val: AT_FLAGS int: 08 ptr: 0x........
-val: AT_ENTRY int: 09 ptr: 0x........
-val: AT_BASE int: 07 ptr: 0x........
-val: AT_EHDRFLAGS int: 24 ptr: 0x........
-val: AT_EXECPATH int: 15 ptr: 0x........
-EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv
-val: AT_OSRELDATE int: 18 ptr: 0x........
-val: AT_CANARY int: 16 ptr: 0x........
-val: AT_CANARYLEN int: 17 ptr: 0x........
-val: AT_NCPUS int: 19 ptr: 0x........
-val: AT_PAGESIZES int: 20 ptr: 0x........
-val: AT_PAGESIZESLEN int: 21 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_STACKPROT int: 23 ptr: 0x........
-val: AT_HWCAP int: 25 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_IGNORE int: 01 ptr: 0x........
-val: AT_ARGC int: 28 ptr: 0x........
-val: AT_ARGV int: 29 ptr: 0x........
-ARGV: ./auxv
-val: AT_ENVC int: 30 ptr: 0x........
-val: AT_ENVV int: 31 ptr: 0x........
-val: AT_PS_STRINGS int: 32 ptr: 0x........
-PS_STRINGS ARGV: ./auxv
-val: AT_USRSTACKBASE int: 35 ptr: 0x........
-val: AT_USRSTACKLIM int: 36 ptr: 0x........
diff --git a/none/tests/freebsd/auxv_script.vgtest b/none/tests/freebsd/auxv_script.vgtest
index ccd450a9a2..b2afe075e8 100644
--- a/none/tests/freebsd/auxv_script.vgtest
+++ b/none/tests/freebsd/auxv_script.vgtest
@@ -1,4 +1,6 @@
+prereq: ./auxv_script 2>&1 | ./filter_pre_auxv > auxv_script.stderr.exp
prog: auxv_script
vgopts: -q
stderr_filter: filter_auxv
+post: rm auxv_script.stderr.exp
diff --git a/none/tests/freebsd/bug452274.vgtest b/none/tests/freebsd/bug452274.vgtest
index 30b1179a61..23092b1381 100644
--- a/none/tests/freebsd/bug452274.vgtest
+++ b/none/tests/freebsd/bug452274.vgtest
@@ -1,3 +1,4 @@
+prereq: [ `sysctl -n kern.vm_guest` = "none" ]
prog: bug452274
vgopts: -q
stderr_filter: filter_452274
diff --git a/none/tests/freebsd/filter_pre_auxv b/none/tests/freebsd/filter_pre_auxv
new file mode 100755
index 0000000000..37c63683a3
--- /dev/null
+++ b/none/tests/freebsd/filter_pre_auxv
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# filters all auxv values that are not supported by Valgrind
+
+./filter_auxv |
+
+awk '/AT_TIMEKEEP/{$2="AT_IGNORE";$4="01"}{print}' |
+awk '/AT_HWCAP2/{$2="AT_IGNORE";$4="01"}{print}' |
+awk '/AT_HWCAP3/{$2="AT_IGNORE";$4="01"}{print}' |
+awk '/AT_HWCAP4/{$2="AT_IGNORE";$4="01"}{print}' |
+awk '/AT_BSDFLAGS/{$2="AT_IGNORE";$4="01"}{print}' |
+awk '/AT_KPRELOAD/{$2="AT_IGNORE";$4="01"}{print}'
diff --git a/none/tests/freebsd/open_client.cpp b/none/tests/freebsd/open_client.cpp
new file mode 100644
index 0000000000..54fb63b0e7
--- /dev/null
+++ b/none/tests/freebsd/open_client.cpp
@@ -0,0 +1,108 @@
+// For Bug 505673
+// Valgrind crashes with an internal error and SIGBUS when the guest tries to open its own file with O_WRONLY|O_CREAT|O_TRUNC
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main(int argc, char** argv)
+{
+ std::vector flags{O_WRONLY|O_CREAT|O_TRUNC, O_WRONLY, O_RDWR};
+
+ // On FreeBSD libc open uses syscall openat (at least on 14.2)
+ for (auto f : flags)
+ {
+ int res = open(argv[0], f, 0666);
+ if (-1 != res)
+ {
+ throw std::runtime_error("open should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+
+ // repeat the above, but with syscall SYS_open
+ for (auto f : flags)
+ {
+ int res = syscall(SYS_open, argv[0], f, 0666);
+ if (-1 != res)
+ {
+ throw std::runtime_error("open should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+
+ int dotdot;
+ if ((dotdot = open("..", O_DIRECTORY | O_RDONLY)) == -1)
+ {
+ throw std::runtime_error("failed to open ..");
+ }
+ else
+ {
+ for (auto f : flags)
+ {
+ int res = openat(dotdot, "freebsd/open_client", f, 0666);
+ if (-1 != res)
+ {
+ throw std::runtime_error("open should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+ }
+ close(dotdot);
+
+ chdir("..");
+
+ // check that relative paths work
+ for (auto f : flags)
+ {
+ int res = open("freebsd/open_client", f, 0666);
+ if (-1 != res)
+ {
+ throw std::runtime_error("open should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+
+ for (auto f : flags)
+ {
+ int res = syscall(SYS_open, "freebsd/open_client", f, 0666);
+ if (-1 != res)
+ {
+ throw std::runtime_error("open should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+}
diff --git a/none/tests/x86-freebsd/445032.stderr.exp b/none/tests/freebsd/open_client.stderr.exp
similarity index 100%
rename from none/tests/x86-freebsd/445032.stderr.exp
rename to none/tests/freebsd/open_client.stderr.exp
diff --git a/none/tests/freebsd/open_client.vgtest b/none/tests/freebsd/open_client.vgtest
new file mode 100644
index 0000000000..12b148de4e
--- /dev/null
+++ b/none/tests/freebsd/open_client.vgtest
@@ -0,0 +1,3 @@
+prog: open_client
+vgopts: -q
+
diff --git a/none/tests/freebsd/proc_pid_file.vgtest b/none/tests/freebsd/proc_pid_file.vgtest
index 0361a5982b..bcbae3ad3f 100644
--- a/none/tests/freebsd/proc_pid_file.vgtest
+++ b/none/tests/freebsd/proc_pid_file.vgtest
@@ -1,3 +1,4 @@
+prereq: test -d /proc
prog: proc_pid_file
vgopts: -q
diff --git a/none/tests/freebsd/readlinkat.cpp b/none/tests/freebsd/readlinkat.cpp
new file mode 100644
index 0000000000..25c142f4de
--- /dev/null
+++ b/none/tests/freebsd/readlinkat.cpp
@@ -0,0 +1,74 @@
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main()
+{
+ char linkedPath[MAXPATHLEN];
+ char currentDirectory[MAXPATHLEN];
+
+ getcwd(currentDirectory, MAXPATHLEN);
+ std::string absolutePath{currentDirectory};
+ absolutePath += "/readlinkat_link.cpp";
+
+ ssize_t res = readlinkat(AT_FDCWD, "readlinkat_link.cpp", linkedPath, MAXPATHLEN);
+ if (res == -1)
+ {
+ std::cerr << "Error: readlinkat test 1 failed\n";
+ }
+ else
+ {
+ if (!strcmp(linkedPath, "readlink.cpp"))
+ {
+ std::cerr << "Error: readlinkat test 1 unexpected resolved path - " << linkedPath << '\n';
+ }
+ }
+
+ int dotdot;
+ if ((dotdot = open("..", O_DIRECTORY | O_RDONLY)) == -1)
+ {
+ throw std::runtime_error("failed to open .");
+ }
+ else
+ {
+ res = readlinkat(dotdot, "freebsd/readlinkat_link.cpp", linkedPath, MAXPATHLEN);
+ if (res == -1)
+ {
+ std::cerr << "Error: readlinkat test 2 failed\n";
+ }
+ else
+ {
+ if (!strcmp(linkedPath, "readlink.cpp"))
+ {
+ std::cerr << "Error: readlinkat test 2 unexpected resolved path - " << linkedPath << '\n';
+ }
+ }
+ }
+ close(dotdot);
+
+ chdir("..");
+ res = readlinkat(AT_FDCWD, "freebsd/readlinkat_link.cpp", linkedPath, MAXPATHLEN);
+ if (res == -1)
+ {
+ std::cerr << "Error: readlinkat test 3 failed\n";
+ }
+ if (!strcmp(linkedPath, "readlink.cpp"))
+ {
+ std::cerr << "Error: readlinkat test 3 unexpected resolved path - " << linkedPath << '\n';
+ }
+
+ int uninit;
+ res = readlinkat(uninit, absolutePath.c_str(), linkedPath, MAXPATHLEN);
+ if (res == -1)
+ {
+ std::cerr << "Error: readlinkat test 4 failed\n";
+ }
+ if (!strcmp(linkedPath, "readlink.cpp"))
+ {
+ std::cerr << "Error: readlinkat test 4 unexpected resolved path - " << linkedPath << '\n';
+ }
+
+}
diff --git a/none/tests/freebsd/readlinkat.stderr.exp b/none/tests/freebsd/readlinkat.stderr.exp
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/none/tests/freebsd/readlinkat.vgtest b/none/tests/freebsd/readlinkat.vgtest
new file mode 100644
index 0000000000..4942f8ca95
--- /dev/null
+++ b/none/tests/freebsd/readlinkat.vgtest
@@ -0,0 +1,4 @@
+prereq: rm -f readlinkat_link.cpp && ln -s readlinkat.cpp readlinkat_link.cpp
+prog: readlinkat
+vgopts: -q
+post: rm -f readlinkat_link.cpp
diff --git a/none/tests/freebsd/readlinkat2.cpp b/none/tests/freebsd/readlinkat2.cpp
new file mode 100644
index 0000000000..0aef71d7f7
--- /dev/null
+++ b/none/tests/freebsd/readlinkat2.cpp
@@ -0,0 +1,57 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main(int argc, char** argv)
+{
+ char linkedPath[MAXPATHLEN];
+ char selfAbsolutePath[MAXPATHLEN];
+ auto pid{getpid()};
+ std::string pidString{std::to_string(pid)};
+ std::string procPidFile{std::string("/proc/") + pidString + "/file"};
+ realpath(argv[0], selfAbsolutePath);
+ std::string selfAbsolutePathString(selfAbsolutePath);
+
+ ssize_t res = readlinkat(AT_FDCWD, "/proc/curproc/file", linkedPath, MAXPATHLEN);
+ if (res == -1)
+ {
+ std::cerr << "Error: readlinkat test 1 failed\n";
+ }
+ else
+ {
+ if (selfAbsolutePathString != linkedPath)
+ {
+ std::cerr << "Error: readlinkat test 1 unexpected resolved path - " << linkedPath << '\n';
+ }
+ }
+
+ res = readlinkat(AT_FDCWD, procPidFile.c_str(), linkedPath, MAXPATHLEN);
+ if (res == -1)
+ {
+ std::cerr << "Error: readlinkat test 2 failed\n";
+ }
+ else
+ {
+ if (selfAbsolutePathString != linkedPath)
+ {
+ std::cerr << "Error: readlinkat test 2 unexpected resolved path - " << linkedPath << '\n';
+ }
+ }
+
+ // @todo PJF do some tests with cwd as /proc /proc/PID and /proc/curproc
+ // and a rlative path to 'file'
+ // not yet implemented in Valgrind
+ chdir("/proc");
+
+ // @todo PJF do some tests as above but with fd as /proc /proc/PID and /proc/curproc
+ int slash;
+ if ((slash = open("/", O_DIRECTORY | O_RDONLY)) == -1)
+ {
+ throw std::runtime_error("failed to open /");
+ }
+ close(slash);
+}
diff --git a/none/tests/freebsd/readlinkat2.stderr.exp b/none/tests/freebsd/readlinkat2.stderr.exp
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/none/tests/freebsd/readlinkat2.vgtest b/none/tests/freebsd/readlinkat2.vgtest
new file mode 100644
index 0000000000..1decb1ee0b
--- /dev/null
+++ b/none/tests/freebsd/readlinkat2.vgtest
@@ -0,0 +1,4 @@
+# FreeBSD doesn't always have a /proc filesystem
+prereq: test -d /proc
+prog: readlinkat2
+vgopts: -q
diff --git a/none/tests/iropt-test/Makefile.am b/none/tests/iropt-test/Makefile.am
new file mode 100644
index 0000000000..f4d1e9afa7
--- /dev/null
+++ b/none/tests/iropt-test/Makefile.am
@@ -0,0 +1,83 @@
+include $(top_srcdir)/Makefile.all.am
+
+EXTRA_DIST = iropt-test.vgtest iropt-test.stderr.exp \
+ iropt-test-sec.vgtest iropt-test-sec.stderr.exp \
+ irops.tab
+
+dist_noinst_SCRIPTS = filter_stderr
+
+#----------------------------------------------------------------------------
+# Headers
+#----------------------------------------------------------------------------
+
+pkginclude_HEADERS =
+noinst_HEADERS = vtest.h
+
+#----------------------------------------------------------------------------
+# iropt_test
+#----------------------------------------------------------------------------
+
+noinst_PROGRAMS = iropt-test
+
+if VGCONF_HAVE_PLATFORM_SEC
+noinst_PROGRAMS += iropt-test-sec
+endif
+
+if VGCONF_OS_IS_DARWIN
+noinst_DSYMS = $(noinst_PROGRAMS)
+endif
+
+SOURCES = \
+ main.c \
+ unary.c \
+ binary.c \
+ util.c \
+ valgrind.c
+
+# The link flags for this are tricky, because we want to build it for
+# both the primary and secondary platforms, and add
+# "-Wl,-read_only_relocs -Wl,suppress" to whichever of those is x86-darwin,
+# if any. Hence there's a double-nested conditional that adds to the
+# LDFLAGS in both cases.
+
+iropt_test_SOURCES = $(SOURCES)
+iropt_test_CPPFLAGS = $(AM_CPPFLAGS_PRI) \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/memcheck \
+ -I$(top_srcdir)/VEX/pub
+iropt_test_CFLAGS = $(AM_CFLAGS_PRI) -fhosted
+iropt_test_DEPENDENCIES = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
+iropt_test_LDADD = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
+iropt_test_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@
+# If there is no secondary platform, and the platforms include x86-darwin,
+# then the primary platform must be x86-darwin. Hence:
+if ! VGCONF_HAVE_PLATFORM_SEC
+if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
+iropt_test_LDFLAGS += -Wl,-read_only_relocs -Wl,suppress
+endif
+endif
+
+if VGCONF_HAVE_PLATFORM_SEC
+iropt_test_sec_SOURCES = $(SOURCES)
+iropt_test_sec_CPPFLAGS = $(AM_CPPFLAGS_SEC) \
+ $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/memcheck \
+ -I$(top_srcdir)/VEX/pub
+iropt_test_sec_CFLAGS = $(AM_CFLAGS_SEC) -fhosted \
+ $(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+iropt_test_sec_DEPENDENCIES = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \
+ $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
+iropt_test_sec_LDADD = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \
+ $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
+iropt_test_sec_LDFLAGS = $(AM_CFLAGS_SEC) @LIB_UBSAN@ \
+ $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+endif
+# If there is a secondary platform, and the platforms include x86-darwin,
+# then the primary platform must be amd64-darwin and the secondary platform
+# must be x86-darwin. Hence:
+if VGCONF_HAVE_PLATFORM_SEC
+if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
+iropt_test_sec_LDFLAGS += -Wl,-read_only_relocs -Wl,suppress
+endif
+endif
diff --git a/none/tests/iropt-test/binary.c b/none/tests/iropt-test/binary.c
new file mode 100644
index 0000000000..285a3cab0a
--- /dev/null
+++ b/none/tests/iropt-test/binary.c
@@ -0,0 +1,479 @@
+/* -*- mode: C; c-basic-offset: 3; -*- */
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2025 Florian Krohm
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see .
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include // printf
+#include // UINT64_MAX
+#include "vtest.h"
+
+static uint64_t get_expected_value(const irop_t *, const test_data_t *);
+static void run_tests(const irop_t *, test_data_t *);
+static void run_shift_tests(const irop_t *, test_data_t *);
+static int is_shift_op(IROp);
+static int ok_to_run(IROp op, uint64_t, uint64_t);
+
+
+void
+test_binary_op(const irop_t *op, test_data_t *data)
+{
+ if (is_shift_op(op->op))
+ run_shift_tests(op, data);
+ else
+ run_tests(op, data);
+}
+
+
+static void
+run_selected_tests(const irop_t *op, test_data_t *data)
+{
+ opnd_t *opnd_l = &data->opnds[0];
+ opnd_t *opnd_r = &data->opnds[1];
+ unsigned num_val_l, num_val_r;
+ const uint64_t *values_l = get_selected_values(opnd_l->type, &num_val_l);
+ const uint64_t *values_r = get_selected_values(opnd_r->type, &num_val_r);
+
+ for (unsigned i = 0; i < num_val_l; ++i) {
+ opnd_l->value = values_l[i];
+ for (unsigned j = 0; j < num_val_r; ++j) {
+ opnd_r->value = values_r[j];
+
+ if (ok_to_run(op->op, opnd_l->value, opnd_r->value))
+ valgrind_execute_test(op, data, get_expected_value(op, data));
+ }
+ }
+}
+
+
+/* Test with pseudo-random numbers */
+static void
+run_random_tests(const irop_t *op, test_data_t *data)
+{
+ opnd_t *opnd_l = &data->opnds[0];
+ opnd_t *opnd_r = &data->opnds[1];
+
+ /* 1-bit wide operands are tested exhaustively. Skip random tests. */
+ if (opnd_l->type == Ity_I1 && opnd_r->type == Ity_I1) return;
+
+ unsigned num_tests = 0;
+ while (num_tests < num_random_tests) {
+ opnd_l->value = get_random_value(opnd_l->type);
+ opnd_r->value = get_random_value(opnd_r->type);
+
+ if (ok_to_run(op->op, opnd_l->value, opnd_r->value)) {
+ valgrind_execute_test(op, data, get_expected_value(op, data));
+ ++num_tests;
+ }
+ }
+}
+
+
+/* OP is a shift operator. */
+static void
+run_shift_tests(const irop_t *op, test_data_t *data)
+{
+ opnd_t *opnd_l = &data->opnds[0];
+ opnd_t *opnd_r = &data->opnds[1];
+ unsigned num_shiftee;
+ const uint64_t *shiftee = get_selected_values(opnd_l->type, &num_shiftee);
+ unsigned max_shift_amount = bitsof_irtype(opnd_r->type) - 1;
+
+ /* Shift selected values with all possible shift amounts */
+ for (unsigned i = 0; i < num_shiftee; ++i) {
+ opnd_l->value = shiftee[i];
+ for (unsigned j = 0; j < max_shift_amount; ++j) {
+ opnd_r->value = j;
+
+ valgrind_execute_test(op, data, get_expected_value(op, data));
+ }
+ }
+
+ /* Shift random values with random shift amounts */
+ for (unsigned i = 0; i < num_random_tests; ++i) {
+ opnd_l->value = get_random_value(opnd_l->type);
+ opnd_r->value = get_random_value(opnd_r->type) & max_shift_amount;
+
+ valgrind_execute_test(op, data, get_expected_value(op, data));
+ }
+}
+
+
+static void
+run_tests(const irop_t *op, test_data_t *data)
+{
+ run_selected_tests(op, data);
+ run_random_tests(op, data);
+}
+
+
+/* Compute the expected result of a binary operation. */
+static uint64_t
+get_expected_value(const irop_t *op, const test_data_t *data)
+{
+ uint64_t opnd_l = data->opnds[0].value;
+ uint64_t opnd_r = data->opnds[1].value;
+ uint64_t expected;
+
+ switch (op->op) {
+ case Iop_Add8:
+ case Iop_Add16:
+ case Iop_Add32:
+ case Iop_Add64:
+ expected = opnd_l + opnd_r;
+ break;
+
+ case Iop_Sub8:
+ case Iop_Sub16:
+ case Iop_Sub32:
+ case Iop_Sub64:
+ expected = opnd_l - opnd_r;
+ break;
+
+ case Iop_Mul8:
+ case Iop_MullU8: {
+ uint8_t u8l = opnd_l;
+ uint8_t u8r = opnd_r;
+ expected = u8l * u8r;
+ break;
+ }
+ case Iop_Mul16:
+ case Iop_MullU16: {
+ uint16_t u16l = opnd_l;
+ uint16_t u16r = opnd_r;
+ expected = u16l * u16r;
+ break;
+ }
+ case Iop_Mul32:
+ case Iop_MullU32: {
+ uint32_t u32l = opnd_l;
+ uint32_t u32r = opnd_r;
+ expected = (uint64_t)u32l * (uint64_t)u32r;
+ break;
+ }
+
+ case Iop_Mul64:
+ expected = opnd_l * opnd_r;
+ break;
+
+ case Iop_MullS8: {
+ uint8_t u8l = opnd_l;
+ uint8_t u8r = opnd_r;
+ int8_t s8l = (int8_t)u8l;
+ int8_t s8r = (int8_t)u8r;
+ expected = (int16_t)s8l * (int16_t)s8r;
+ break;
+ }
+ case Iop_MullS16: {
+ uint16_t u16l = opnd_l;
+ uint16_t u16r = opnd_r;
+ int16_t s16l = (int16_t)u16l;
+ int16_t s16r = (int16_t)u16r;
+ expected = (int32_t)s16l * (int32_t)s16r;
+ break;
+ }
+ case Iop_MullS32:
+ expected = (int64_t)(int32_t)opnd_l * (int64_t)(int32_t)opnd_r;
+ break;
+
+ case Iop_DivU32:
+ case Iop_DivU64:
+ expected = opnd_l / opnd_r;
+ break;
+
+ case Iop_DivS32:
+ expected = (int32_t)opnd_l / (int32_t)opnd_r;
+ break;
+
+ case Iop_DivS64:
+ expected = (int64_t)opnd_l / (int64_t)opnd_r;
+ break;
+
+ case Iop_DivU32E:
+ expected = (opnd_l << 32) / opnd_r;
+ break;
+
+ case Iop_DivS32E:
+ expected = (int64_t)(opnd_l << 32) / (int32_t)opnd_r;
+ break;
+
+ case Iop_DivModU32to32: {
+ uint32_t q = opnd_l / opnd_r;
+ uint32_t r = opnd_l % opnd_r;
+ expected = ((uint64_t)r << 32) | q;
+ break;
+ }
+
+ case Iop_DivModS32to32: {
+ int32_t q = (int32_t)opnd_l / (int32_t)opnd_r;
+ int32_t r = (int32_t)opnd_l % (int32_t)opnd_r;
+ expected = ((uint64_t)r << 32) | (uint32_t)q;
+ break;
+ }
+
+ case Iop_DivModU64to32: {
+ uint64_t q = opnd_l / opnd_r;
+ uint64_t r = opnd_l % opnd_r;
+ expected = (r << 32) | q;
+ break;
+ }
+
+ case Iop_DivModS64to32: {
+ int64_t q = (int64_t)opnd_l / (int32_t)opnd_r;
+ int32_t r = (int64_t)opnd_l % (int32_t)opnd_r;
+ expected = ((uint64_t)r << 32) | (uint32_t)q;
+ break;
+ }
+
+ case Iop_Shl8:
+ case Iop_Shl16:
+ case Iop_Shl32:
+ case Iop_Shl64:
+ expected = opnd_l << opnd_r;
+ break;
+
+ case Iop_Shr8:
+ case Iop_Shr16:
+ case Iop_Shr32:
+ case Iop_Shr64:
+ expected = opnd_l >> opnd_r;
+ break;
+
+ case Iop_Sar8:
+ expected = ((int64_t)(opnd_l << 56) >> 56) >> opnd_r;
+ break;
+
+ case Iop_Sar16:
+ expected = ((int64_t)(opnd_l << 48) >> 48) >> opnd_r;
+ break;
+
+ case Iop_Sar32:
+ expected = ((int64_t)(opnd_l << 32) >> 32) >> opnd_r;
+ break;
+
+ case Iop_Sar64:
+ expected = (int64_t)opnd_l >> opnd_r;
+ break;
+
+ case Iop_Or1:
+ case Iop_Or8:
+ case Iop_Or16:
+ case Iop_Or32:
+ case Iop_Or64:
+ expected = opnd_l | opnd_r;
+ break;
+
+ case Iop_And1:
+ case Iop_And8:
+ case Iop_And16:
+ case Iop_And32:
+ case Iop_And64:
+ expected = opnd_l & opnd_r;
+ break;
+
+ case Iop_Xor8:
+ case Iop_Xor16:
+ case Iop_Xor32:
+ case Iop_Xor64:
+ expected = opnd_l ^ opnd_r;
+ break;
+
+ case Iop_CmpEQ8:
+ case Iop_CmpEQ16:
+ case Iop_CmpEQ32:
+ case Iop_CmpEQ64:
+ case Iop_CasCmpEQ8:
+ case Iop_CasCmpEQ16:
+ case Iop_CasCmpEQ32:
+ case Iop_CasCmpEQ64:
+ expected = opnd_l == opnd_r;
+ break;
+
+ case Iop_CmpNE8:
+ case Iop_CmpNE16:
+ case Iop_CmpNE32:
+ case Iop_CmpNE64:
+ case Iop_CasCmpNE8:
+ case Iop_CasCmpNE16:
+ case Iop_CasCmpNE32:
+ case Iop_CasCmpNE64:
+ case Iop_ExpCmpNE8:
+ case Iop_ExpCmpNE16:
+ case Iop_ExpCmpNE32:
+ case Iop_ExpCmpNE64:
+ expected = opnd_l != opnd_r;
+ break;
+
+ case Iop_CmpLT32U:
+ case Iop_CmpLT64U:
+ expected = opnd_l < opnd_r;
+ break;
+
+ case Iop_CmpLT32S: {
+ uint32_t u32l = opnd_l & UINT32_MAX;
+ uint32_t u32r = opnd_r & UINT32_MAX;
+ int32_t s32l = (int32_t)u32l;
+ int32_t s32r = (int32_t)u32r;
+ expected = s32l < s32r;
+ break;
+ }
+
+ case Iop_CmpLT64S:
+ expected = (int64_t)opnd_l < (int64_t)opnd_r;
+ break;
+
+ case Iop_CmpLE32U:
+ case Iop_CmpLE64U:
+ expected = opnd_l <= opnd_r;
+ break;
+
+ case Iop_CmpLE32S: {
+ uint32_t u32l = opnd_l & UINT32_MAX;
+ uint32_t u32r = opnd_r & UINT32_MAX;
+ int32_t s32l = (int32_t)u32l;
+ int32_t s32r = (int32_t)u32r;
+ expected = s32l <= s32r;
+ break;
+ }
+
+ case Iop_CmpLE64S:
+ expected = (int64_t)opnd_l <= (int64_t)opnd_r;
+ break;
+
+ case Iop_CmpORD32U:
+ case Iop_CmpORD64U:
+ expected = (opnd_l < opnd_r) ? 8 : (opnd_l > opnd_r) ? 4 : 2;
+ break;
+
+ case Iop_CmpORD32S: {
+ uint32_t u32l = opnd_l & UINT32_MAX;
+ uint32_t u32r = opnd_r & UINT32_MAX;
+ int32_t s32l = (int32_t)u32l;
+ int32_t s32r = (int32_t)u32r;
+ expected = (s32l < s32r) ? 8 : (s32l > s32r) ? 4 : 2;
+ break;
+ }
+ case Iop_CmpORD64S: {
+ int64_t opnd_ls = (int64_t)opnd_l;
+ int64_t opnd_rs = (int64_t)opnd_r;
+ expected = (opnd_ls < opnd_rs) ? 8 : (opnd_ls > opnd_rs) ? 4 : 2;
+ break;
+ }
+
+ case Iop_Max32U:
+ opnd_l &= UINT32_MAX;
+ opnd_r &= UINT32_MAX;
+ expected = opnd_l > opnd_r ? opnd_l : opnd_r;
+ break;
+
+ case Iop_8HLto16:
+ expected = (opnd_l << 8) | opnd_r;
+ break;
+
+ case Iop_16HLto32:
+ expected = (opnd_l << 16) | opnd_r;
+ break;
+
+ case Iop_32HLto64:
+ expected = (opnd_l << 32) | opnd_r;
+ break;
+
+ default:
+ panic("%s: operator %s not handled\n", __func__, op->name);
+ }
+
+ /* Truncate to width of result type */
+ switch (bitsof_irtype(op->result_type)) {
+ case 1: expected &= 0x1; break;
+ case 8: expected &= UINT8_MAX; break;
+ case 16: expected &= UINT16_MAX; break;
+ case 32: expected &= UINT32_MAX; break;
+ case 64: expected &= UINT64_MAX; break;
+ default:
+ panic(__func__);
+ }
+
+ return expected;
+}
+
+
+static int
+is_shift_op(IROp op)
+{
+ switch (op) {
+ case Iop_Shl8: case Iop_Shl16: case Iop_Shl32: case Iop_Shl64:
+ case Iop_Shr8: case Iop_Shr16: case Iop_Shr32: case Iop_Shr64:
+ case Iop_Sar8: case Iop_Sar16: case Iop_Sar32: case Iop_Sar64:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+
+static int
+ok_to_run(IROp op, uint64_t o1, uint64_t o2)
+{
+ switch (op) {
+ /* Division by zero -- not good */
+ case Iop_DivU32: case Iop_DivU64:
+ case Iop_DivS32: case Iop_DivS64:
+ case Iop_DivU32E:
+ case Iop_DivS32E:
+ case Iop_DivModU32to32:
+ return o2 != 0;
+
+ /* Check that result can be represented */
+ case Iop_DivModU64to32: {
+ uint64_t dividend = o1;
+ uint32_t divisor = o2;
+
+ if (divisor == 0) return 0;
+ uint64_t q = dividend / divisor; // always safe
+ return q <= UINT32_MAX;
+ }
+
+ case Iop_DivModS64to32: {
+ int64_t dividend = o1;
+ int32_t divisor = o2;
+
+ if (divisor == 0) return 0;
+ /* Division may trap on overflow */
+ if (divisor == -1 && o1 == (0x1ULL << 63)) // INT64_MIN
+ return 0;
+ int64_t q = dividend / divisor;
+ return q <= INT32_MAX && q >= INT32_MIN;
+ }
+
+ case Iop_DivModS32to32: {
+ int32_t divisor = o2;
+
+ if (divisor == 0) return 0;
+ /* Division may trap on overflow */
+ if (divisor == -1 && o1 == (0x1UL << 31)) // INT32_MIN
+ return 0;
+ return 1;
+ }
+
+ default:
+ return 1;
+ }
+}
diff --git a/none/tests/iropt-test/filter_stderr b/none/tests/iropt-test/filter_stderr
new file mode 100755
index 0000000000..5337954d0f
--- /dev/null
+++ b/none/tests/iropt-test/filter_stderr
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Nothing to filter.
+sed 's/BLA/BLA/'
diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab
new file mode 100644
index 0000000000..b8cfd4ce62
--- /dev/null
+++ b/none/tests/iropt-test/irops.tab
@@ -0,0 +1,272 @@
+/* -*- mode: C; c-basic-offset: 3; -*- */
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2025 Florian Krohm
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see .
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#define OPNAME(op) #op, Iop_##op
+
+#define A(x) ARCH_##x
+
+#define ARCH_ppc32 0x0001
+#define ARCH_ppc64be 0x0002
+#define ARCH_ppc64le 0x0004
+#define ARCH_ppc64 (ARCH_ppc64be | ARCH_ppc64le)
+#define ARCH_ppc (ARCH_ppc32 | ARCH_ppc64)
+#define ARCH_amd64 0x0008
+#define ARCH_x86 0x0010
+#define ARCH_s390 0x0020
+#define ARCH_mips32 0x0040
+#define ARCH_mips64 0x0080
+#define ARCH_mipsx (ARCH_mips32 | ARCH_mips64) // ARCH_mips does not work
+#define ARCH_ALL 0x00FF // OR of all above
+
+/* FIXME: Add support for nanomips, arm, and riscv.
+ When doing so ARCH_ALL needs to be adjusted */
+#if 0
+#define ARCH_nanomips 0x0100
+#define ARCH_arm 0x0200
+#define ARCH_arm64 0x0400
+#define ARCH_riscv64 0x0800
+#endif
+
+#define ONLY(x) .enabled_arch = A(x)
+#define ONLY2(x1,x2) .enabled_arch = A(x1) | A(x2)
+#define EXCEPT(x) .enabled_arch = ARCH_ALL & ~A(x)
+#define EXCEPT2(x1,x2) .enabled_arch = ARCH_ALL & ~(A(x1) | A(x2))
+#define EXCEPT3(x1,x2,x3) .enabled_arch = ARCH_ALL & ~(A(x1) | A(x2) | A(x3))
+
+/* Definition of IROps:
+ - no IROps having floating point operands or result
+ - no IROPs having vector operands or results (V128, V256)
+ - no IROPs having integer operands or results with more than 64 bit
+*/
+ // UNARY
+ { OPNAME(Not1), Ity_I1, 1, Ity_I1, },
+ { OPNAME(Not8), Ity_I8, 1, Ity_I8, },
+ { OPNAME(Not16), Ity_I16, 1, Ity_I16, },
+ { OPNAME(Not32), Ity_I32, 1, Ity_I32, },
+ { OPNAME(Not64), Ity_I64, 1, Ity_I64, },
+
+ { OPNAME(1Uto8), Ity_I8, 1, Ity_I1, },
+// { OPNAME(1Uto16), Ity_I16, 1, Ity_I1, }, // missing in libvex_ir.h
+ { OPNAME(1Uto32), Ity_I32, 1, Ity_I1, },
+ { OPNAME(1Uto64), Ity_I64, 1, Ity_I1, EXCEPT3(ppc32,x86,mips32) },
+
+ { OPNAME(1Sto8), Ity_I8, 1, Ity_I1, },
+ { OPNAME(1Sto16), Ity_I16, 1, Ity_I1, },
+ { OPNAME(1Sto32), Ity_I32, 1, Ity_I1, },
+ { OPNAME(1Sto64), Ity_I64, 1, Ity_I1, },
+
+ { OPNAME(8Uto16), Ity_I16, 1, Ity_I8, },
+ { OPNAME(8Uto32), Ity_I32, 1, Ity_I8, },
+ { OPNAME(8Uto64), Ity_I64, 1, Ity_I8, EXCEPT2(ppc32, x86) },
+
+ { OPNAME(8Sto16), Ity_I16, 1, Ity_I8, },
+ { OPNAME(8Sto32), Ity_I32, 1, Ity_I8, },
+ { OPNAME(8Sto64), Ity_I64, 1, Ity_I8, EXCEPT2(ppc32, x86) },
+
+ { OPNAME(16Uto32), Ity_I32, 1, Ity_I16, },
+ { OPNAME(16Uto64), Ity_I64, 1, Ity_I16, EXCEPT(ppc32) },
+ { OPNAME(16Sto32), Ity_I32, 1, Ity_I16, },
+ { OPNAME(16Sto64), Ity_I64, 1, Ity_I16, EXCEPT2(ppc32, x86) },
+
+ { OPNAME(32Uto64), Ity_I64, 1, Ity_I32, },
+ { OPNAME(32Sto64), Ity_I64, 1, Ity_I32, },
+
+// { OPNAME(8to1), Ity_I1, 1, Ity_I8, }, // missing in libvex_ir.h
+
+// { OPNAME(16to1), Ity_I1, 1, Ity_I16, }, // missing in libvex_ir.h
+ { OPNAME(16to8), Ity_I8, 1, Ity_I16, },
+ { OPNAME(16HIto8), Ity_I8, 1, Ity_I16, },
+
+ { OPNAME(32to1), Ity_I1, 1, Ity_I32, },
+ { OPNAME(32to8), Ity_I8, 1, Ity_I32, },
+ { OPNAME(32to16), Ity_I16, 1, Ity_I32, },
+ { OPNAME(32HIto16), Ity_I16, 1, Ity_I32, },
+
+ { OPNAME(64to1), Ity_I1, 1, Ity_I64, EXCEPT2(ppc32, x86) },
+ { OPNAME(64to8), Ity_I8, 1, Ity_I64, EXCEPT2(ppc32, x86) },
+ { OPNAME(64to16), Ity_I16, 1, Ity_I64, EXCEPT3(ppc32, x86, mips32) },
+ { OPNAME(64to32), Ity_I32, 1, Ity_I64, },
+ { OPNAME(64HIto32), Ity_I32, 1, Ity_I64, },
+
+// { OPNAME(128to64), Ity_I64, 1, Ity_I128, }, // 128 bit
+// { OPNAME(128HIto64), Ity_I64, 1, Ity_I128, }, // 128 bit
+
+ { OPNAME(CmpNEZ8), Ity_I1, 1, Ity_I8, },
+ { OPNAME(CmpNEZ16), Ity_I1, 1, Ity_I16, EXCEPT(ppc) },
+ { OPNAME(CmpNEZ32), Ity_I1, 1, Ity_I32, },
+ { OPNAME(CmpNEZ64), Ity_I1, 1, Ity_I64, },
+
+ { OPNAME(CmpwNEZ32), Ity_I32, 1, Ity_I32 },
+ { OPNAME(CmpwNEZ64), Ity_I64, 1, Ity_I64 },
+
+ { OPNAME(Left8), Ity_I8, 1, Ity_I8 },
+ { OPNAME(Left16), Ity_I16, 1, Ity_I16 },
+ { OPNAME(Left32), Ity_I32, 1, Ity_I32 },
+ { OPNAME(Left64), Ity_I64, 1, Ity_I64 },
+
+ { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32, EXCEPT2(amd64, s390) },
+ { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64, EXCEPT3(ppc32, x86, mips32) },
+
+ { OPNAME(CtzNat32), Ity_I32, 1, Ity_I32, ONLY2(ppc, x86) },
+ { OPNAME(CtzNat64), Ity_I64, 1, Ity_I64, ONLY2(ppc64, amd64) },
+
+ { OPNAME(PopCount32), Ity_I32, 1, Ity_I32, ONLY(ppc) },
+ { OPNAME(PopCount64), Ity_I64, 1, Ity_I64, ONLY(ppc64) },
+
+ // BINARY
+ { OPNAME(Add8), Ity_I8, 2, Ity_I8, Ity_I8 },
+ { OPNAME(Add16), Ity_I16, 2, Ity_I16, Ity_I16 },
+ { OPNAME(Add32), Ity_I32, 2, Ity_I32, Ity_I32 },
+ { OPNAME(Add64), Ity_I64, 2, Ity_I64, Ity_I64 },
+
+ { OPNAME(Sub8), Ity_I8, 2, Ity_I8, Ity_I8 },
+ { OPNAME(Sub16), Ity_I16, 2, Ity_I16, Ity_I16 },
+ { OPNAME(Sub32), Ity_I32, 2, Ity_I32, Ity_I32 },
+ { OPNAME(Sub64), Ity_I64, 2, Ity_I64, Ity_I64, EXCEPT(ppc32) },
+
+ { OPNAME(Mul8), Ity_I8, 2, Ity_I8, Ity_I8, ONLY(s390) },
+ { OPNAME(Mul16), Ity_I16, 2, Ity_I16, Ity_I16, EXCEPT2(ppc, mipsx) },
+ { OPNAME(Mul32), Ity_I32, 2, Ity_I32, Ity_I32, },
+ { OPNAME(Mul64), Ity_I64, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, x86) },
+
+ { OPNAME(MullU8), Ity_I16, 2, Ity_I8, Ity_I8, EXCEPT(ppc) },
+ { OPNAME(MullU16), Ity_I32, 2, Ity_I16, Ity_I16, EXCEPT(ppc) },
+ { OPNAME(MullU32), Ity_I64, 2, Ity_I32, Ity_I32, },
+// { OPNAME(MullU64), Ity_I128, 2, Ity_I64, Ity_I64, }, // 128 bit
+
+ { OPNAME(MullS8), Ity_I16, 2, Ity_I8, Ity_I8, EXCEPT(ppc) },
+ { OPNAME(MullS16), Ity_I32, 2, Ity_I16, Ity_I16, EXCEPT(ppc) },
+ { OPNAME(MullS32), Ity_I64, 2, Ity_I32, Ity_I32, },
+// { OPNAME(MullS64), Ity_I128, 2, Ity_I64, Ity_I64, }, // 128 bit
+
+ { OPNAME(DivU32), Ity_I32, 2, Ity_I32, Ity_I32, ONLY2(ppc, mipsx) },
+ { OPNAME(DivU64), Ity_I64, 2, Ity_I64, Ity_I64, ONLY2(ppc64, mips64) },
+// { OPNAME(DivU128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit
+
+ { OPNAME(DivS32), Ity_I32, 2, Ity_I32, Ity_I32, ONLY2(ppc, mipsx) },
+ { OPNAME(DivS64), Ity_I64, 2, Ity_I64, Ity_I64, ONLY2(ppc64, mips64) },
+// { OPNAME(DivS128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit
+
+ { OPNAME(DivU32E), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) },
+// { OPNAME(DivU64E), Ity_I64, 2, Ity_I64, Ity_I64, }, // 128 bit
+// { OPNAME(DivU128E), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit
+
+ { OPNAME(DivS32E), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) },
+// { OPNAME(DivS64E), Ity_I32, 2, Ity_I32, Ity_I32, }, // 128 bit
+// { OPNAME(DivS128E), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit
+
+ { OPNAME(DivModU32to32), Ity_I64, 2, Ity_I32, Ity_I32, ONLY(mipsx) },
+ { OPNAME(DivModU64to32), Ity_I64, 2, Ity_I64, Ity_I32, EXCEPT2(ppc, mipsx) },
+// { OPNAME(DivModU64to64), Ity_I64, 2, Ity_I64, Ity_I128 }, // 128 bit
+// { OPNAME(DivModU128to64), Ity_I128, 2, Ity_I64, Ity_I128 }, // 128 bit
+
+ { OPNAME(DivModS32to32), Ity_I64, 2, Ity_I32, Ity_I32, ONLY(mipsx) },
+ { OPNAME(DivModS64to32), Ity_I64, 2, Ity_I64, Ity_I32, EXCEPT2(ppc, mipsx) },
+// { OPNAME(DivModS64to64), Ity_I64, 2, Ity_I64, Ity_I128 }, // 128 bit
+// { OPNAME(DivModU128to64), Ity_I128, 2, Ity_I64, Ity_I128 }, // 128 bit
+
+// { OPNAME(ModU128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit
+// { OPNAME(ModS128), Ity_I128, 2, Ity_I128, Ity_I128 }, // 128 bit
+
+ { OPNAME(Shl8), Ity_I8, 2, Ity_I8, Ity_I8, EXCEPT(mipsx) },
+ { OPNAME(Shl16), Ity_I16, 2, Ity_I16, Ity_I8, EXCEPT(mipsx) },
+ { OPNAME(Shl32), Ity_I32, 2, Ity_I32, Ity_I8 },
+ { OPNAME(Shl64), Ity_I64, 2, Ity_I64, Ity_I8, EXCEPT(ppc32) },
+
+ { OPNAME(Shr8), Ity_I8, 2, Ity_I8, Ity_I8, EXCEPT(mipsx) },
+ { OPNAME(Shr16), Ity_I16, 2, Ity_I16, Ity_I8 },
+ { OPNAME(Shr32), Ity_I32, 2, Ity_I32, Ity_I8 },
+ { OPNAME(Shr64), Ity_I64, 2, Ity_I64, Ity_I8, EXCEPT(ppc32) },
+
+ { OPNAME(Sar8), Ity_I8, 2, Ity_I8, Ity_I8, EXCEPT(mipsx) },
+ { OPNAME(Sar16), Ity_I16, 2, Ity_I16, Ity_I8 },
+ { OPNAME(Sar32), Ity_I32, 2, Ity_I32, Ity_I8 },
+ { OPNAME(Sar64), Ity_I64, 2, Ity_I64, Ity_I8, EXCEPT(ppc32) },
+
+ { OPNAME(Or1), Ity_I1, 2, Ity_I1, Ity_I1 },
+ { OPNAME(Or8), Ity_I8, 2, Ity_I8, Ity_I8 },
+ { OPNAME(Or16), Ity_I16, 2, Ity_I16, Ity_I16 },
+ { OPNAME(Or32), Ity_I32, 2, Ity_I32, Ity_I32 },
+ { OPNAME(Or64), Ity_I64, 2, Ity_I64, Ity_I64 },
+
+ { OPNAME(And1), Ity_I1, 2, Ity_I1, Ity_I1 },
+ { OPNAME(And8), Ity_I8, 2, Ity_I8, Ity_I8 },
+ { OPNAME(And16), Ity_I16, 2, Ity_I16, Ity_I16 },
+ { OPNAME(And32), Ity_I32, 2, Ity_I32, Ity_I32 },
+ { OPNAME(And64), Ity_I64, 2, Ity_I64, Ity_I64 },
+
+// { OPNAME(Xor1), Ity_I1, 2, Ity_I1, Ity_I1 }, // missing in libvex_ir.h
+ { OPNAME(Xor8), Ity_I8, 2, Ity_I8, Ity_I8 },
+ { OPNAME(Xor16), Ity_I16, 2, Ity_I16, Ity_I16 },
+ { OPNAME(Xor32), Ity_I32, 2, Ity_I32, Ity_I32 },
+ { OPNAME(Xor64), Ity_I64, 2, Ity_I64, Ity_I64 },
+
+ { OPNAME(CmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT(ppc) },
+ { OPNAME(CmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT(ppc) },
+ { OPNAME(CmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32, },
+ { OPNAME(CmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT(ppc32) },
+
+ { OPNAME(CmpNE8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT2(ppc, mipsx) },
+ { OPNAME(CmpNE16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT2(ppc, mipsx) },
+ { OPNAME(CmpNE32), Ity_I1, 2, Ity_I32, Ity_I32, },
+ { OPNAME(CmpNE64), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc32, mips32) },
+
+ { OPNAME(CmpLT32U), Ity_I1, 2, Ity_I32, Ity_I32, },
+ { OPNAME(CmpLT64U), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT3(ppc32, x86, mips32) },
+
+ { OPNAME(CmpLT32S), Ity_I1, 2, Ity_I32, Ity_I32, },
+ { OPNAME(CmpLT64S), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT3(ppc32, x86, mips32) },
+
+ { OPNAME(CmpLE32U), Ity_I1, 2, Ity_I32, Ity_I32, },
+ { OPNAME(CmpLE64U), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT3(ppc32, x86, mipsx) },
+
+ { OPNAME(CmpLE32S), Ity_I1, 2, Ity_I32, Ity_I32, },
+ { OPNAME(CmpLE64S), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT3(ppc32, x86, mips32) },
+
+ { OPNAME(CasCmpEQ8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT2(ppc, mipsx) },
+ { OPNAME(CasCmpEQ16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT2(ppc, mipsx) },
+ { OPNAME(CasCmpEQ32), Ity_I1, 2, Ity_I32, Ity_I32, EXCEPT(ppc) },
+ { OPNAME(CasCmpEQ64), Ity_I1, 2, Ity_I64, Ity_I64, EXCEPT2(ppc, x86) },
+
+ { OPNAME(CasCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8, EXCEPT2(ppc, mipsx) },
+ { OPNAME(CasCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16, EXCEPT2(ppc, mipsx) },
+ { OPNAME(CasCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32, EXCEPT2(ppc, mipsx) },
+ { OPNAME(CasCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64, ONLY2(s390, amd64) },
+
+ { OPNAME(ExpCmpNE8), Ity_I1, 2, Ity_I8, Ity_I8, ONLY(s390) },
+ { OPNAME(ExpCmpNE16), Ity_I1, 2, Ity_I16, Ity_I16, ONLY2(s390, x86) },
+ { OPNAME(ExpCmpNE32), Ity_I1, 2, Ity_I32, Ity_I32, EXCEPT2(ppc, mipsx) },
+ { OPNAME(ExpCmpNE64), Ity_I1, 2, Ity_I64, Ity_I64, ONLY2(s390, amd64) },
+
+ { OPNAME(CmpORD32U), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) },
+ { OPNAME(CmpORD32S), Ity_I32, 2, Ity_I32, Ity_I32, ONLY(ppc) },
+ { OPNAME(CmpORD64U), Ity_I64, 2, Ity_I64, Ity_I64, ONLY(ppc64) },
+ { OPNAME(CmpORD64S), Ity_I64, 2, Ity_I64, Ity_I64, ONLY(ppc64) },
+
+ { OPNAME(Max32U), Ity_I32, 2, Ity_I32, Ity_I32 },
+
+ { OPNAME(8HLto16), Ity_I16, 2, Ity_I8, Ity_I8, EXCEPT(ppc) },
+ { OPNAME(16HLto32), Ity_I32, 2, Ity_I16, Ity_I16, EXCEPT(ppc) },
+ { OPNAME(32HLto64), Ity_I64, 2, Ity_I32, Ity_I32, },
+// { OPNAME(64HLto128), Ity_I128, 2, Ity_I64, Ity_I64, }, // 128 bit
diff --git a/none/tests/iropt-test/iropt-test-sec.stderr.exp b/none/tests/iropt-test/iropt-test-sec.stderr.exp
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/none/tests/iropt-test/iropt-test-sec.vgtest b/none/tests/iropt-test/iropt-test-sec.vgtest
new file mode 100644
index 0000000000..82da4ab070
--- /dev/null
+++ b/none/tests/iropt-test/iropt-test-sec.vgtest
@@ -0,0 +1,5 @@
+prog: iropt-test-sec
+prereq: test -x iropt-test-sec
+#args: -v -v -r10
+args: -r100
+vgopts: -q --vex-guest-chase=no
diff --git a/none/tests/iropt-test/iropt-test.stderr.exp b/none/tests/iropt-test/iropt-test.stderr.exp
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/none/tests/iropt-test/iropt-test.vgtest b/none/tests/iropt-test/iropt-test.vgtest
new file mode 100644
index 0000000000..9136b105c9
--- /dev/null
+++ b/none/tests/iropt-test/iropt-test.vgtest
@@ -0,0 +1,4 @@
+prog: iropt-test
+#args: -v -v -r10
+args: -r100
+vgopts: -q --vex-guest-chase=no
diff --git a/none/tests/iropt-test/main.c b/none/tests/iropt-test/main.c
new file mode 100644
index 0000000000..25c312b2e4
--- /dev/null
+++ b/none/tests/iropt-test/main.c
@@ -0,0 +1,217 @@
+/* -*- mode: C; c-basic-offset: 3; -*- */
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2025 Florian Krohm
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see .
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include // assert
+#include // printf
+#include // malloc
+#include // memset
+#include "valgrind.h" // RUNNING_ON_VALGRIND
+#include "vtest.h"
+
+/* Table of IROps. */
+static irop_t irops[] = {
+ #include "irops.tab"
+};
+
+static void check_irops_table(void);
+static test_data_t *new_test_data(const irop_t *);
+static int is_enabled(const irop_t *);
+
+int verbose = 0;
+unsigned num_random_tests;
+
+
+int
+main(int argc, char *argv[])
+{
+// FIXME: temporarily until ppc and mips have been fixed
+#if !defined(__s390x__) && !defined(__i386__) && !defined(__x86_64__)
+ return 0;
+#endif
+ assert(sizeof(long long) == 8);
+ srand48(42L);
+
+ for (int i = 1; i < argc; ++i) {
+ if (strcmp(argv[i], "-v") == 0)
+ ++verbose;
+ else if (strncmp(argv[i], "-r", 2) == 0) {
+ num_random_tests = atoi(argv[i] + 2);
+ } else if (strcmp(argv[i], "--help") == 0) {
+ printf("\niropt-test [ -v | --help ]\n");
+ printf("\n\t -rNUM number of random tests per IRop\n");
+ printf("\n\t -v verbose mode; shows IROps being tested\n");
+ printf("\n\t -v -v verbose mode, extreme edition\n\n");
+ return 0;
+ } else {
+ printf("%s ? Nothing happens.\n", argv[i]);
+ return 1;
+ }
+ }
+
+ if (! RUNNING_ON_VALGRIND) {
+ fprintf(stderr, "*** This program needs to run under valgrind.\n");
+ return 1;
+ }
+
+ check_irops_table();
+
+ setbuf(stdout, NULL); // make stdout unbuffered
+
+ for (unsigned i = 0; i < NUM_EL(irops); ++i) {
+ const irop_t *op = irops +i;
+
+ if (! is_enabled(op)) continue;
+
+ if (verbose)
+ printf("Testing operator %s\n", op->name);
+
+ test_data_t *data = new_test_data(op);
+
+ IRICB *iricb = new_iricb(op, data);
+
+ valgrind_vex_init_for_iri(iricb);
+
+ switch (op->num_opnds) {
+ case 1:
+ test_unary_op(op, data);
+ break;
+
+ case 2:
+ test_binary_op(op, data);
+ break;
+
+ default:
+ panic("operator %s not handled", op->name);
+ }
+
+ free(data);
+ }
+
+ return 0;
+}
+
+
+static void
+check_irops_table(void)
+{
+ for (unsigned i = 0; i < sizeof irops / sizeof *irops; ++i) {
+ const irop_t *op = irops +i;
+
+ IRType t_res, t_opnd1, t_opnd2, t_opnd3, t_opnd4;
+
+ typeOfPrimop(op->op, &t_res, &t_opnd1, &t_opnd2, &t_opnd3, &t_opnd4);
+
+ if (op->result_type != t_res ||
+ op->opnd1_type != t_opnd1 ||
+ (op->num_opnds == 2 && op->opnd2_type != t_opnd2))
+ panic("%s: type mismatch\n", op->name);
+ }
+}
+
+
+static test_data_t *
+new_test_data(const irop_t *op)
+{
+ test_data_t *data = malloc(sizeof *data);
+
+ memset(data, 0x0, sizeof *data); // initialise
+
+ data->result_fold.type = op->result_type;
+ data->result_nofold.type = op->result_type;
+
+ data->opnds[0].type = op->opnd1_type;
+ if (op->num_opnds > 1)
+ data->opnds[1].type = op->opnd2_type;
+
+ return data;
+}
+
+
+static int
+is_enabled(const irop_t *op)
+{
+ /* For convenience of specification in irops.tab a zero value
+ means that the IROp is implemented. */
+ if (op->enabled_arch == 0) return 1;
+
+#ifdef __x86_64__
+ return op->enabled_arch & ARCH_amd64;
+#endif
+#ifdef __i386__
+ return op->enabled_arch & ARCH_x86;
+#endif
+#ifdef __s390x__
+ return op->enabled_arch & ARCH_s390;
+#endif
+#ifdef __mips__
+ return op->enabled_arch & ((__mips == 64) ? ARCH_mips64 : ARCH_mips32);
+#endif
+#ifdef __powerpc__ /* defined for both 32-bit and 64-bit */
+#define MIN_POWER_ISA "../../../tests/min_power_isa"
+ int rc;
+
+ switch (op->op) {
+ case Iop_DivS64E:
+ case Iop_DivU64E:
+ case Iop_DivU32E:
+ case Iop_DivS32E:
+ /* IROps require a processor that supports ISA 2.06 (Power 7)
+ or newer */
+ rc = system(MIN_POWER_ISA " 2.06 ") / 256;
+ break;
+
+ case Iop_DivU128:
+ case Iop_DivS128:
+ case Iop_DivU128E:
+ case Iop_DivS128E:
+ case Iop_ModU128:
+ case Iop_ModS128:
+ /* IROps require a processor that supports ISA 3.10 (Power 10)
+ or newer */
+ rc = system(MIN_POWER_ISA " 3.1 ") / 256;
+ break;
+
+ default:
+ rc = 0;
+ break;
+ }
+
+ /* MIN_POWER_ISA returns 0 if the underlying HW supports the specified
+ ISA or newer. Returns 1 if the HW does not support the specified ISA.
+ Returns 2 on error. */
+ switch (rc) {
+ case 0:
+#ifdef __powerpc64__
+ return op->enabled_arch & ARCH_ppc64;
+#endif
+ return op->enabled_arch & ARCH_ppc32;
+ case 1:
+ return 0;
+ default:
+ panic("min_power_isa() return code is invalid.\n");
+ }
+#endif
+
+ return 0;
+}
diff --git a/none/tests/iropt-test/unary.c b/none/tests/iropt-test/unary.c
new file mode 100644
index 0000000000..26962381de
--- /dev/null
+++ b/none/tests/iropt-test/unary.c
@@ -0,0 +1,286 @@
+/* -*- mode: C; c-basic-offset: 3; -*- */
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2025 Florian Krohm
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see .
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include // printf
+#include // rand
+#include // UINT64_MAX
+#include "vtest.h"
+
+static void run_selected_tests(const irop_t *, test_data_t *);
+static void run_random_tests(const irop_t *, test_data_t *);
+static uint64_t get_expected_value(const irop_t *, const test_data_t *);
+static uint64_t left(uint64_t, unsigned);
+static uint32_t popcount(uint64_t);
+static uint32_t clz(uint64_t, unsigned);
+static uint32_t ctz(uint64_t, unsigned);
+
+
+void
+test_unary_op(const irop_t *op, test_data_t *data)
+{
+ opnd_t *opnd = &data->opnds[0];
+
+ switch (opnd->type) {
+ case Ity_I1:
+ case Ity_I8: {
+ /* Exhaustive */
+ unsigned max = (1 << bitsof_irtype(opnd->type)) - 1;
+ for (unsigned i = 0; i <= max; ++i) {
+ opnd->value = i;
+
+ valgrind_execute_test(op, data, get_expected_value(op, data));
+ }
+ break;
+ }
+
+ case Ity_I16:
+ case Ity_I32:
+ case Ity_I64:
+ run_selected_tests(op, data);
+ run_random_tests(op, data);
+ break;
+
+ default:
+ panic(__func__);
+ }
+}
+
+
+static void
+run_selected_tests(const irop_t *op, test_data_t *data)
+{
+ opnd_t *opnd = &data->opnds[0];
+ unsigned num_val;
+ const uint64_t *values = get_selected_values(opnd->type, &num_val);
+
+ for (unsigned i = 0; i < num_val; ++i) {
+ opnd->value = values[i];
+
+ valgrind_execute_test(op, data, get_expected_value(op, data));
+ }
+}
+
+
+/* Test with pseudo-random numbers */
+static void
+run_random_tests(const irop_t *op, test_data_t *data)
+{
+ opnd_t *opnd = &data->opnds[0];
+
+ for (unsigned i = 0; i < num_random_tests; ++i) {
+ opnd->value = get_random_value(opnd->type);
+
+ valgrind_execute_test(op, data, get_expected_value(op, data));
+ }
+}
+
+
+/* Compute the expected result of a unary operation. */
+static uint64_t
+get_expected_value(const irop_t *op, const test_data_t *data)
+{
+ uint64_t opnd = data->opnds[0].value;
+ uint64_t expected;
+
+ switch (op->op) {
+ case Iop_Not1: expected = ~opnd & 0x1; break;
+ case Iop_Not8: expected = ~opnd & UINT8_MAX; break;
+ case Iop_Not16: expected = ~opnd & UINT16_MAX; break;
+ case Iop_Not32: expected = ~opnd & UINT32_MAX; break;
+ case Iop_Not64: expected = ~opnd & UINT64_MAX; break;
+
+ case Iop_1Uto8: expected = opnd; break;
+// case Iop_1Uto16: expected = opnd; break;
+ case Iop_1Uto32: expected = opnd; break;
+ case Iop_1Uto64: expected = opnd; break;
+
+ case Iop_1Sto8:
+ expected = sign_extend(opnd, 1) & UINT8_MAX;
+ break;
+ case Iop_1Sto16:
+ expected = sign_extend(opnd, 1) & UINT16_MAX;
+ break;
+ case Iop_1Sto32:
+ expected = sign_extend(opnd, 1) & UINT32_MAX;
+ break;
+ case Iop_1Sto64:
+ expected = sign_extend(opnd, 1) & UINT64_MAX;
+ break;
+
+ case Iop_8Uto16: expected = opnd; break;
+ case Iop_8Uto32: expected = opnd; break;
+ case Iop_8Uto64: expected = opnd; break;
+
+ case Iop_8Sto16:
+ expected = sign_extend(opnd, 8) & UINT16_MAX;
+ break;
+ case Iop_8Sto32:
+ expected = sign_extend(opnd, 8) & UINT32_MAX;
+ break;
+ case Iop_8Sto64:
+ expected = sign_extend(opnd, 8) & UINT64_MAX;
+ break;
+
+ case Iop_16Uto32: expected = opnd; break;
+ case Iop_16Uto64: expected = opnd; break;
+
+ case Iop_16Sto32:
+ expected = sign_extend(opnd, 16) & UINT32_MAX;
+ break;
+ case Iop_16Sto64:
+ expected = sign_extend(opnd, 16) & UINT64_MAX;
+ break;
+
+ case Iop_32Uto64: expected = opnd; break;
+
+ case Iop_32Sto64:
+ expected = sign_extend(opnd, 32) & UINT64_MAX;
+ break;
+
+// case Iop_8to1: expected = opnd & 0x1; break;
+// case Iop_16to1: expected = opnd & 0x1; break;
+ case Iop_16to8: expected = opnd & UINT8_MAX; break;
+ case Iop_16HIto8: expected = opnd >> 8; break;
+ break;
+
+ case Iop_32to1: expected = opnd & 0x1; break;
+ case Iop_32to8: expected = opnd & UINT8_MAX; break;
+ case Iop_32to16: expected = opnd & UINT16_MAX; break;
+ case Iop_32HIto16: expected = opnd >> 16; break;
+
+ case Iop_64to1: expected = opnd & 0x1; break;
+ case Iop_64to8: expected = opnd & UINT8_MAX; break;
+ case Iop_64to16: expected = opnd & UINT16_MAX; break;
+ case Iop_64to32: expected = opnd & UINT32_MAX; break;
+ case Iop_64HIto32: expected = opnd >> 32; break;
+
+ case Iop_CmpNEZ8:
+ case Iop_CmpNEZ16:
+ case Iop_CmpNEZ32:
+ case Iop_CmpNEZ64:
+ expected = opnd != 0;
+ break;
+
+ case Iop_CmpwNEZ32: expected = opnd == 0 ? 0 : UINT32_MAX; break;
+ case Iop_CmpwNEZ64: expected = opnd == 0 ? 0 : UINT64_MAX; break;
+
+ case Iop_Left8: expected = left(opnd, 8); break;
+ case Iop_Left16: expected = left(opnd, 16); break;
+ case Iop_Left32: expected = left(opnd, 32); break;
+ case Iop_Left64: expected = left(opnd, 64); break;
+
+ case Iop_PopCount32:
+ case Iop_PopCount64:
+ expected = popcount(opnd);
+ break;
+
+ case Iop_ClzNat32: expected = clz(opnd, 32); break;
+ case Iop_ClzNat64: expected = clz(opnd, 64); break;
+
+ case Iop_CtzNat32: expected = ctz(opnd, 32); break;
+ case Iop_CtzNat64: expected = ctz(opnd, 64); break;
+
+ default:
+ panic("%s: operator %s not handled\n", __func__, op->name);
+ }
+
+ return expected;
+}
+
+
+/* An implementation for Iop_Left/8/16/32/64.
+ The semantics of those operators are defined in Section 2.5 of
+ https://valgrind.org/docs/memcheck2005.pdf as follows:
+
+ Iop_Left(v) is the same as v, except that all bits to the left of the
+ rightmost 1-bit in v are set. */
+static uint64_t
+left(uint64_t val, unsigned width)
+{
+ uint64_t ret = 0;
+
+ /* Find the rightmost 1-bit, then sign-extend. */
+ for (unsigned bit = 0; bit < width; ++bit) {
+ if (val & ((uint64_t)1 << bit)) {
+ ret = (int64_t)((uint64_t)val << (63 - bit)) >> (63 - bit);
+ break;
+ }
+ }
+
+ /* Truncate to desired width */
+ switch (width) {
+ case 8: return ret & UINT8_MAX;
+ case 16: return ret & UINT16_MAX;
+ case 32: return ret & UINT32_MAX;
+ case 64: return ret & UINT64_MAX;
+ default:
+ panic(__func__);
+ }
+}
+
+
+/* Naive implementation of counting 1-bits */
+static uint32_t
+popcount(uint64_t value)
+{
+ uint32_t count;
+
+ for (count = 0; value != 0; value >>= 1) {
+ count += value & 1;
+ }
+ return count;
+}
+
+
+static uint32_t
+clz(uint64_t value, unsigned num_bits)
+{
+ unsigned last_seen_1bit = 0;
+
+ for (int i = 1; i <= num_bits; ++i) {
+ if (value & 0x1)
+ last_seen_1bit = i;
+ value >>= 1;
+ }
+ return num_bits - last_seen_1bit;
+}
+
+
+static uint32_t
+ctz(uint64_t value, unsigned num_bits )
+{
+ unsigned count = 0;
+ unsigned num_nibbles = num_bits / 4;
+
+ for (unsigned i = 0; i < num_nibbles; ++i) {
+ UInt nibble = value & 0xF;
+ if ((nibble & 0x1) == 0x1) return count;
+ if ((nibble & 0x2) == 0x2) return count + 1;
+ if ((nibble & 0x4) == 0x4) return count + 2;
+ if ((nibble & 0x8) == 0x8) return count + 3;
+ count += 4;
+ value >>= 4;
+ }
+ return count;
+}
diff --git a/none/tests/iropt-test/util.c b/none/tests/iropt-test/util.c
new file mode 100644
index 0000000000..694edb4db9
--- /dev/null
+++ b/none/tests/iropt-test/util.c
@@ -0,0 +1,139 @@
+/* -*- mode: C; c-basic-offset: 3; -*- */
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2025 Florian Krohm
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see .
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include // fprintf
+#include // exit
+#include // va_list
+#include // PRIx...
+#include "vtest.h"
+
+
+/* Something bad happened. Cannot continue. */
+void __attribute__((noreturn))
+panic(const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ fprintf(stderr, "*** OOPS: ");
+ vfprintf(stderr, fmt, args);
+ fputc('\n', stderr);
+ va_end(args);
+ exit(1);
+}
+
+
+void
+print_value(FILE *fp, uint64_t val, unsigned num_bits)
+{
+ switch (num_bits) {
+ case 1: fprintf(fp, "%01" PRIx64, val); break;
+ case 8: fprintf(fp, "%02" PRIx64, val); break;
+ case 16: fprintf(fp, "%04" PRIx64, val); break;
+ case 32: fprintf(fp, "%08" PRIx64, val); break;
+ case 64: fprintf(fp, "%016" PRIx64, val); break;
+ case 128:
+ case 256:
+ /* fall through */
+ default:
+ panic("%s: num_bits = %u", __func__, num_bits);
+ }
+}
+
+
+unsigned
+bitsof_irtype(IRType ty)
+{
+ switch (ty) {
+ case Ity_I1: return 1;
+ case Ity_I8: return 8;
+ case Ity_I16: return 16;
+ case Ity_I32: return 32;
+ case Ity_I64: return 64;
+ default:
+ panic(__func__);
+ }
+}
+
+
+uint64_t
+get_random_value(IRType type)
+{
+ uint64_t val = mrand48();
+
+ switch (type) {
+ case Ity_I1: return val & 0x1;
+ case Ity_I8: return val & UINT8_MAX;
+ case Ity_I16: return val & UINT16_MAX;
+ case Ity_I32: return val & UINT32_MAX;
+ case Ity_I64:
+ val <<= 32;
+ val |= mrand48();
+ return val;
+
+ default:
+ panic(__func__);
+ }
+}
+
+
+const uint64_t *
+get_selected_values(IRType type, unsigned *num_val)
+{
+ static const uint64_t values_1bit[] = { 0, 1 };
+ static const uint64_t values_8bit[] = { 0, 1, 2,
+ INT8_MAX - 1, INT8_MAX, (uint8_t)INT8_MIN, (uint8_t)INT8_MIN + 1,
+ UINT8_MAX - 1, UINT8_MAX };
+ static const uint64_t values_16bit[] = { 0, 1, 2,
+ INT8_MAX - 1, INT8_MAX, (uint8_t)INT8_MIN, (uint8_t)INT8_MIN + 1,
+ UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1,
+ INT16_MAX - 1, INT16_MAX, (uint16_t)INT16_MIN, (uint16_t)INT16_MIN + 1,
+ UINT16_MAX - 1, UINT16_MAX };
+ static const uint64_t values_32bit[] = { 0, 1, 2,
+ INT8_MAX - 1, INT8_MAX, (uint8_t)INT8_MIN, (uint8_t)INT8_MIN + 1,
+ UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1,
+ INT16_MAX - 1, INT16_MAX, (uint16_t)INT16_MIN, (uint16_t)INT16_MIN + 1,
+ UINT16_MAX - 1, UINT16_MAX, UINT16_MAX + 1,
+ INT32_MAX - 1, INT32_MAX, (uint32_t)INT32_MIN, (uint32_t)INT32_MIN + 1,
+ UINT32_MAX - 1, UINT32_MAX };
+ static const uint64_t values_64bit[] = { 0, 1, 2,
+ INT8_MAX - 1, INT8_MAX, (uint8_t)INT8_MIN, (uint8_t)INT8_MIN + 1,
+ UINT8_MAX - 1, UINT8_MAX, UINT8_MAX + 1,
+ INT16_MAX - 1, INT16_MAX, (uint16_t)INT16_MIN, (uint16_t)INT16_MIN + 1,
+ UINT16_MAX - 1, UINT16_MAX, UINT16_MAX + 1,
+ INT32_MAX - 1, INT32_MAX, (uint32_t)INT32_MIN, (uint32_t)INT32_MIN + 1,
+ UINT32_MAX - 1, UINT32_MAX, (uint64_t)UINT32_MAX + 1,
+ INT64_MAX - 1, INT64_MAX, (uint64_t)INT64_MIN, (uint64_t)INT64_MIN + 1,
+ UINT64_MAX - 1, UINT64_MAX };
+
+ switch (type) {
+ case Ity_I1: *num_val = NUM_EL(values_1bit); return values_1bit;
+ case Ity_I8: *num_val = NUM_EL(values_8bit); return values_8bit;
+ case Ity_I16: *num_val = NUM_EL(values_16bit); return values_16bit;
+ case Ity_I32: *num_val = NUM_EL(values_32bit); return values_32bit;
+ case Ity_I64: *num_val = NUM_EL(values_64bit); return values_64bit;
+ default:
+ panic(__func__);
+ }
+}
diff --git a/none/tests/iropt-test/valgrind.c b/none/tests/iropt-test/valgrind.c
new file mode 100644
index 0000000000..1456cfc897
--- /dev/null
+++ b/none/tests/iropt-test/valgrind.c
@@ -0,0 +1,157 @@
+/* -*- mode: C; c-basic-offset: 3; -*- */
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2025 Florian Krohm
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see .
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include // memset
+#include "valgrind.h" // VALGRIND_VEX_INJECT_IR
+#include "vtest.h"
+
+#define host_is_big_endian() ((*(short *)(&(int){ 0x11223344 })) == 0x1122)
+
+static IRICB iricb;
+
+/* Return a completely initialised control block */
+IRICB *
+new_iricb(const irop_t *op, test_data_t *data)
+{
+ IRICB_iropt_payload cb;
+
+ memset(&cb, 0x0, sizeof cb);
+
+ cb.op = op->op;
+ cb.result_fold = (HWord)&data->result_fold.value;
+ cb.result_nofold = (HWord)&data->result_nofold.value;
+ cb.opnd1 = (HWord)&data->opnds[0].value;
+ cb.opnd2 = (HWord)&data->opnds[1].value;
+ cb.t_result = data->result_fold.type;
+ cb.t_opnd1 = data->opnds[0].type;
+ cb.t_opnd2 = data->opnds[1].type;
+
+ cb.num_operands = op->num_opnds;
+
+ iricb.kind = IRICB_iropt;
+ iricb.iropt = cb;
+
+ return &iricb;
+}
+
+
+/* Insert a client request that will initialize VEX for IR injection */
+void
+valgrind_vex_init_for_iri(IRICB *cb)
+{
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__VEX_INIT_FOR_IRI, cb, 0,0,0,0);
+}
+
+
+/* Insert a special opcode that will cause VEX to inject an IR stmt based
+ on the information passed in the IRICB (in valgrind_vex_init_for_iri). */
+static void
+valgrind_vex_inject_ir(void)
+{
+ VALGRIND_VEX_INJECT_IR();
+}
+
+
+/* Execute the test under valgrind. Well, yes, we're not really executing
+ it here, just preparing for it... */
+void
+valgrind_execute_test(const irop_t *op, test_data_t *data, uint64_t expected)
+{
+ if (verbose > 1) {
+ printf("---------- Running a test\n");
+
+ for (unsigned i = 0; i < op->num_opnds; ++i) {
+ const opnd_t *opnd = data->opnds + i;
+ printf("opnd %u: value = ", i);
+ print_value(stdout, opnd->value, bitsof_irtype(opnd->type));
+ printf("\n");
+ }
+ }
+
+ VALGRIND_CLO_CHANGE("--vex-iropt-fold-expr=yes");
+ valgrind_vex_inject_ir();
+ VALGRIND_CLO_CHANGE("--vex-iropt-fold-expr=no");
+ valgrind_vex_inject_ir();
+
+ uint64_t result_fold = data->result_fold.value;
+ uint64_t result_nofold = data->result_nofold.value;
+ unsigned num_result_bits = bitsof_irtype(data->result_fold.type);
+
+// printf("NOFOLD RESULT = %016lx\n", result_nofold);
+
+ if (host_is_big_endian()) {
+ switch (num_result_bits) {
+ case 8:
+ result_fold >>= 56;
+ result_nofold >>= 56;
+ break;
+ case 16:
+ result_fold >>= 48;
+ result_nofold >>= 48;
+ break;
+ case 1: /* See comment in vbit-test/vbits.h */
+ case 32:
+ result_fold >>= 32;
+ result_nofold >>= 32;
+ break;
+ case 64:
+ break;
+ default:
+ panic("%s: #bits = %u not handled\n", __func__, num_result_bits);
+ }
+ }
+
+ if (verbose > 1) {
+ printf("result fold: value = ");
+ print_value(stdout, result_fold, num_result_bits);
+ printf("\n");
+ printf("result nofold: value = ");
+ print_value(stdout, result_nofold, num_result_bits);
+ printf("\n");
+ printf("expected: value = ");
+ print_value(stdout, expected, num_result_bits);
+ printf("\n");
+ }
+
+ /* Check result */
+ if (result_fold != result_nofold || result_fold != expected) {
+ fprintf(stderr, "*** Incorrect result for operator %s\n", op->name);
+
+ for (unsigned i = 0; i < op->num_opnds; ++i) {
+ const opnd_t *opnd = data->opnds + i;
+ fprintf(stderr, " opnd %u: ", i);
+ print_value(stderr, opnd->value, bitsof_irtype(opnd->type));
+ fprintf(stderr, "\n");
+ }
+ fprintf(stderr, " result fold: ");
+ print_value(stderr, result_fold, num_result_bits);
+ fprintf(stderr, "\n");
+ fprintf(stderr, " result nofold: ");
+ print_value(stderr, result_nofold, num_result_bits);
+ fprintf(stderr, "\n");
+ fprintf(stderr, " result expected: ");
+ print_value(stderr, expected, num_result_bits);
+ fprintf(stderr, "\n");
+ }
+}
diff --git a/none/tests/iropt-test/vtest.h b/none/tests/iropt-test/vtest.h
new file mode 100644
index 0000000000..96c0902f1e
--- /dev/null
+++ b/none/tests/iropt-test/vtest.h
@@ -0,0 +1,94 @@
+/* -*- mode: C; c-basic-offset: 3; -*- */
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2025 Florian Krohm
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see .
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef VTEST_H
+#define VTEST_H
+
+/* Main header file for the iropt tester */
+
+#include // uint64_t
+#include // FILE
+#include "libvex.h" // IROp
+
+/* Everything we want to know about an IROp */
+typedef struct {
+ const char *name;
+ IROp op;
+ IRType result_type;
+ unsigned num_opnds;
+ IRType opnd1_type;
+ IRType opnd2_type;
+ unsigned enabled_arch;
+} irop_t;
+
+
+/* The maximum number of input operands */
+#define MAX_OPERANDS 2
+
+/* An operand of an IROp (also used for the result) */
+typedef struct {
+ IRType type;
+ uint64_t value;
+} opnd_t;
+
+
+/* Carries the data needed to execute and evaluate a test. I.e.
+ inputs and result. */
+typedef struct {
+ opnd_t result_fold;
+ opnd_t result_nofold;
+ opnd_t opnds[MAX_OPERANDS];
+} test_data_t;
+
+
+/* Convenience macros */
+#define NUM_EL(x) (sizeof x / sizeof *(x))
+
+/* Sign-extend VAL which is NUM_BITS wide to 64 bit */
+#define sign_extend(val, num_bits) \
+ ((int64_t)((val) << (64 - (num_bits))) >> (64 - (num_bits)))
+
+
+/* Function prototypes */
+void print_value(FILE *, uint64_t, unsigned);
+
+void test_unary_op(const irop_t *, test_data_t *);
+void test_binary_op(const irop_t *, test_data_t *);
+
+void valgrind_vex_init_for_iri(IRICB *);
+void valgrind_execute_test(const irop_t *, test_data_t *, uint64_t);
+
+IRICB *new_iricb(const irop_t *, test_data_t *);
+
+void panic(const char *, ...) __attribute__((noreturn));
+
+unsigned bitsof_irtype(IRType);
+uint64_t get_random_value(IRType);
+const uint64_t *get_selected_values(IRType, unsigned *);
+
+/* Exported variables */
+extern int verbose;
+extern unsigned num_random_tests;
+
+#endif // VTEST_H
diff --git a/none/tests/linux/Makefile.am b/none/tests/linux/Makefile.am
index dbb535902e..55426e2b26 100644
--- a/none/tests/linux/Makefile.am
+++ b/none/tests/linux/Makefile.am
@@ -8,7 +8,9 @@ EXTRA_DIST = \
brk-overflow1.stderr.exp brk-overflow1.vgtest \
brk-overflow2.stderr.exp brk-overflow2.vgtest \
bug498317.stderr.exp bug498317.supp bug498317.vgtest \
+ bug506910.stderr.exp bug506910.vgtest \
clonev.stdout.exp clonev.stderr.exp clonev.vgtest \
+ getdents_filter.stderr.exp getdents_filter.stdout.exp getdents_filter.vgtest \
membarrier.stderr.exp membarrier.vgtest \
mremap.stderr.exp mremap.stderr.exp-glibc27 mremap.stdout.exp \
mremap.vgtest \
@@ -17,6 +19,7 @@ EXTRA_DIST = \
mremap4.stderr.exp mremap4.vgtest \
mremap5.stderr.exp mremap5.vgtest \
mremap6.stderr.exp mremap6.vgtest \
+ open_client.stderr.exp open_client.vgtest \
pthread-stack.stderr.exp pthread-stack.vgtest \
stack-overflow.stderr.exp stack-overflow.vgtest
@@ -26,6 +29,7 @@ check_PROGRAMS = \
brk-overflow2 \
bug498317 \
clonev \
+ getdents_filter \
mremap \
mremap2 \
mremap3 \
@@ -35,6 +39,10 @@ check_PROGRAMS = \
pthread-stack \
stack-overflow
+if HAVE_OPENAT2
+ check_PROGRAMS += bug506910 open_client
+endif
+
if HAVE_NR_MEMBARRIER
check_PROGRAMS += membarrier
endif
@@ -44,6 +52,10 @@ AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
# Special needs
+if HAVE_OPENAT2
+bug506910_SOURCES = bug506910.cpp
+open_client_SOURCES = open_client.cpp
+endif
clonev_LDADD = -lpthread
pthread_stack_LDADD = -lpthread
diff --git a/none/tests/linux/bug506910.cpp b/none/tests/linux/bug506910.cpp
new file mode 100644
index 0000000000..2dbadf56a2
--- /dev/null
+++ b/none/tests/linux/bug506910.cpp
@@ -0,0 +1,44 @@
+// For Bug 5056910
+// openat2 with RESOLVE_NO_MAGICLINKS succeeds on /proc/self/exe
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main(int argc, char** argv)
+{
+ auto pid = getpid();
+ auto ppe = std::string("/proc/") + std::to_string(pid) + "/exe";
+#if defined(SYS_openat2)
+ struct open_how oh = { .flags=O_RDONLY, .mode=0UL, .resolve=RESOLVE_NO_MAGICLINKS };
+ int res = syscall(SYS_openat2, AT_FDCWD, "/proc/self/exe", &oh, sizeof(oh));
+ if (-1 != res)
+ {
+ throw std::runtime_error("openat2 should have failed");
+ }
+ else
+ {
+ if (errno != ELOOP)
+ {
+ throw std::runtime_error("errno should be ELOOP");
+ }
+ }
+
+ res = syscall(SYS_openat2, AT_FDCWD, ppe.c_str(), &oh, sizeof(oh));
+ if (-1 != res)
+ {
+ throw std::runtime_error("openat2 should have failed");
+ }
+ else
+ {
+ if (errno != ELOOP)
+ {
+ throw std::runtime_error("errno should be ELOOP");
+ }
+ }
+#endif
+}
diff --git a/none/tests/s390x/bfp-1.stderr.exp b/none/tests/linux/bug506910.stderr.exp
similarity index 100%
rename from none/tests/s390x/bfp-1.stderr.exp
rename to none/tests/linux/bug506910.stderr.exp
diff --git a/none/tests/linux/bug506910.vgtest b/none/tests/linux/bug506910.vgtest
new file mode 100644
index 0000000000..b23362548e
--- /dev/null
+++ b/none/tests/linux/bug506910.vgtest
@@ -0,0 +1,2 @@
+prereq: test -x bug506910
+prog: bug506910
diff --git a/none/tests/linux/getdents_filter.c b/none/tests/linux/getdents_filter.c
new file mode 100644
index 0000000000..361659f51d
--- /dev/null
+++ b/none/tests/linux/getdents_filter.c
@@ -0,0 +1,162 @@
+/* Regression test for bug #331311: Valgrind file descriptors visible in /proc/self/fd and /proc/self/fdinfo */
+
+#define _GNU_SOURCE
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+struct linux_dirent64 {
+ ino64_t d_ino;
+ off64_t d_off;
+ unsigned short d_reclen;
+ unsigned char d_type;
+ char d_name[];
+};
+
+/* Small buffer size to test retry logic when all entries get filtered */
+#define SMALL_BUF_SIZE 64
+
+/* Helper function to scan a /proc directory and print numeric FD entries with a prefix.
+ Returns 0 on success, -1 if directory unavailable */
+static int scan_proc_fd_directory(const char *dir_path, const char *prefix)
+{
+ DIR *d = opendir(dir_path);
+ if (d == NULL) {
+ printf("%s not available\n", dir_path);
+ return -1;
+ }
+
+ struct dirent *entry;
+ while ((entry = readdir(d)) != NULL) {
+ if (entry->d_name[0] == '.')
+ continue;
+
+ char *endptr;
+ long fd = strtol(entry->d_name, &endptr, 10);
+ if (*endptr == '\0' && fd >= 0) {
+ if (prefix) {
+ printf("%s:%ld\n", prefix, fd);
+ } else {
+ printf("%ld\n", fd);
+ }
+ }
+ }
+ closedir(d);
+ return 0;
+}
+
+/*
+ * Test retry logic with raw getdents syscall and small buffer.
+ *
+ * This test validates the filtering refill mechanism in syswrap-generic.c.
+ * When using a tiny buffer (64 bytes), getdents may return only Valgrind FDs
+ * in a single call. The filtering code should detect this (new_size == 0) and
+ * automatically retry the syscall to get more entries until it finds client FDs
+ * or reaches EOF. This prevents the client from seeing empty results when
+ * Valgrind FDs get filtered out.
+ */
+static void test_retry_logic_with_small_buffer(void)
+{
+ int fd;
+ char buf[SMALL_BUF_SIZE];
+ long nread;
+ struct linux_dirent64 *d;
+
+ printf("retry_test_start\n");
+
+ fd = open("/proc/self/fd", O_RDONLY | O_DIRECTORY);
+ if (fd == -1) {
+ printf("retry_test_unavailable\n");
+ return;
+ }
+
+ /*
+ * Use raw getdents syscall with tiny 64-byte buffer. This forces multiple
+ * syscalls since each directory entry is typically 20+ bytes. Some calls
+ * may return only Valgrind FDs, which will trigger the retry mechanism.
+ */
+ for (;;) {
+ /* Note, using getdents64 since some linux arches don't implement
+ the 32bit getdents. */
+ nread = syscall(SYS_getdents64, fd, buf, SMALL_BUF_SIZE);
+
+ if (nread == -1) {
+ printf("retry_test_error\n");
+ close(fd);
+ return;
+ }
+
+ if (nread == 0) {
+ break; /* EOF - no more entries */
+ }
+
+ /* Print client FD entries found in this buffer (excluding . and ..) */
+ for (size_t bpos = 0; bpos < nread;) {
+ d = (struct linux_dirent64 *)(buf + bpos);
+ if (strcmp(d->d_name, ".") != 0 && strcmp(d->d_name, "..") != 0) {
+ char *endptr;
+ long fd_num = strtol(d->d_name, &endptr, 10);
+ if (*endptr == '\0' && fd_num >= 0) {
+ printf("retry:%ld\n", fd_num);
+ }
+ }
+ bpos += d->d_reclen;
+ }
+ }
+
+ close(fd);
+ printf("retry_test_end\n");
+}
+
+int main(void)
+{
+ /* Test 0: Retry logic with small buffer (tests the filtering refill mechanism) */
+ test_retry_logic_with_small_buffer();
+
+ /* Test 1: /proc/self/fd should have Valgrind FDs filtered out */
+ if (scan_proc_fd_directory("/proc/self/fd", NULL) == -1) {
+ return 0; /* Skip remaining tests if /proc/self/fd unavailable */
+ }
+
+ /* Test 2: /proc/self/fdinfo should have Valgrind FDs filtered out */
+ scan_proc_fd_directory("/proc/self/fdinfo", "fdinfo");
+
+ /* Test 3: Regular directory should show all numbered files */
+ DIR *d;
+ struct dirent *entry;
+ if (mkdir("testdir", 0755) == 0) {
+ FILE *f1 = fopen("testdir/1000", "w");
+ FILE *f2 = fopen("testdir/1001", "w");
+ if (f1) { fprintf(f1, "test"); fclose(f1); }
+ if (f2) { fprintf(f2, "test"); fclose(f2); }
+
+ d = opendir("testdir");
+ if (d != NULL) {
+ while ((entry = readdir(d)) != NULL) {
+ if (entry->d_name[0] != '.') {
+ char *endptr;
+ long num = strtol(entry->d_name, &endptr, 10);
+ if (*endptr == '\0' && num >= 1000) {
+ printf("regular:%ld\n", num);
+ }
+ }
+ }
+ closedir(d);
+ }
+
+ unlink("testdir/1000");
+ unlink("testdir/1001");
+ rmdir("testdir");
+ }
+
+
+ return 0;
+}
diff --git a/none/tests/linux/getdents_filter.stderr.exp b/none/tests/linux/getdents_filter.stderr.exp
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/none/tests/linux/getdents_filter.stdout.exp b/none/tests/linux/getdents_filter.stdout.exp
new file mode 100644
index 0000000000..7d29d0f664
--- /dev/null
+++ b/none/tests/linux/getdents_filter.stdout.exp
@@ -0,0 +1,16 @@
+0
+1
+2
+3
+fdinfo:0
+fdinfo:1
+fdinfo:2
+fdinfo:3
+regular:1000
+regular:1001
+retry:0
+retry:1
+retry:2
+retry:3
+retry_test_end
+retry_test_start
diff --git a/none/tests/linux/getdents_filter.vgtest b/none/tests/linux/getdents_filter.vgtest
new file mode 100644
index 0000000000..612ebcec27
--- /dev/null
+++ b/none/tests/linux/getdents_filter.vgtest
@@ -0,0 +1,3 @@
+prog: getdents_filter
+vgopts: -q
+stdout_filter: ../filter_sort
diff --git a/none/tests/linux/open_client.cpp b/none/tests/linux/open_client.cpp
new file mode 100644
index 0000000000..2052286d49
--- /dev/null
+++ b/none/tests/linux/open_client.cpp
@@ -0,0 +1,195 @@
+// For Bug 505673
+// Valgrind crashes with an internal error and SIGBUS when the guest tries to open its own file with O_WRONLY|O_CREAT|O_TRUNC
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main(int argc, char** argv)
+{
+ std::vector<__u64> flags{O_WRONLY|O_CREAT|O_TRUNC, O_WRONLY, O_RDWR};
+ auto pid = getpid();
+ auto ppe = std::string("/proc/") + std::to_string(pid) + "/exe";
+ std::vector names{argv[0], "/proc/self/exe", ppe};
+ int dotdot;
+
+ for (const auto& n : names)
+ {
+ for (auto f : flags)
+ {
+ int res = open(n.c_str(), f, 0666);
+ if (-1 != res)
+ {
+ throw std::runtime_error("open should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+
+#if defined(SYS_open)
+ for (auto f : flags)
+ {
+ int res = syscall(SYS_open, n.c_str(), f, 0666);
+
+ if (-1 != res)
+ {
+ throw std::runtime_error("open should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+#endif
+ }
+
+ if ((dotdot = open("..", O_DIRECTORY | O_RDONLY)) == -1)
+ {
+ throw std::runtime_error("failed to open ,.");
+ }
+ else
+ {
+ for (auto f : flags)
+ {
+ int res = openat(dotdot, "linux/open_client", f, 0666);
+ if (-1 != res)
+ {
+ throw std::runtime_error("open should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+ }
+
+#if defined(SYS_openat2)
+ for (const auto& n : names)
+ {
+ for (auto f : flags)
+ {
+ struct open_how oh = { .flags=f, .mode=((f&static_cast<__u64>(O_CREAT))?0666UL:0UL), .resolve=0 };
+ int res = syscall(SYS_openat2, AT_FDCWD, n.c_str(), &oh, sizeof(oh));
+ if (-1 != res)
+ {
+ throw std::runtime_error("openat2 should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+ }
+
+ for (auto f : flags)
+ {
+ struct open_how oh = { .flags=f, .mode=((f&static_cast<__u64>(O_CREAT))?0666UL:0UL), .resolve=0 };
+ int res = syscall(SYS_openat2, dotdot, "linux/open_client", &oh, sizeof(oh));
+ if (-1 != res)
+ {
+ throw std::runtime_error("openat2 should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+
+ for (auto f : flags)
+ {
+ struct open_how oh = { .flags=f, .mode=((f&static_cast<__u64>(O_CREAT))?0666UL:0UL), .resolve=RESOLVE_IN_ROOT };
+ int res = syscall(SYS_openat2, dotdot, "/linux/open_client", &oh, sizeof(oh));
+ if (-1 != res)
+ {
+ throw std::runtime_error("openat2 should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+#endif
+
+ close(dotdot);
+
+ chdir("..");
+
+ // check that relative paths work
+ for (auto f : flags)
+ {
+ int res = open("linux/open_client", f, 0666);
+ if (-1 != res)
+ {
+ throw std::runtime_error("open should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+
+#if defined(SYS_open)
+ for (auto f : flags)
+ {
+ int res = syscall(SYS_open, "linux/open_client", f, 0666);
+ if (-1 != res)
+ {
+ throw std::runtime_error("open should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+#endif
+
+#if defined(SYS_openat2)
+ for (auto f : flags)
+ {
+ struct open_how oh = { .flags=f, .mode=((f&static_cast<__u64>(O_CREAT))?0666UL:0UL), .resolve=0 };
+ int res = syscall(SYS_openat2, AT_FDCWD, "linux/open_client", &oh, sizeof(oh));
+ if (-1 != res)
+ {
+ throw std::runtime_error("openat2 should have failed");
+ }
+ else
+ {
+ if (errno != ETXTBSY)
+ {
+ throw std::runtime_error("errno should be ETXTBSY");
+ }
+ }
+ }
+#endif
+}
diff --git a/none/tests/linux/open_client.stderr.exp b/none/tests/linux/open_client.stderr.exp
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/none/tests/linux/open_client.vgtest b/none/tests/linux/open_client.vgtest
new file mode 100644
index 0000000000..05eba98bb5
--- /dev/null
+++ b/none/tests/linux/open_client.vgtest
@@ -0,0 +1,3 @@
+prereq: test -x open_client
+prog: open_client
+vgopts: -q
diff --git a/none/tests/ppc64/test_isa_3_1_AT.c b/none/tests/ppc64/test_isa_3_1_AT.c
index e9db9cc9a5..f31f994530 100644
--- a/none/tests/ppc64/test_isa_3_1_AT.c
+++ b/none/tests/ppc64/test_isa_3_1_AT.c
@@ -19,8 +19,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, see .
*/
#include
diff --git a/none/tests/ppc64/test_isa_3_1_Misc.c b/none/tests/ppc64/test_isa_3_1_Misc.c
index 78ca1534ae..93be288ee7 100644
--- a/none/tests/ppc64/test_isa_3_1_Misc.c
+++ b/none/tests/ppc64/test_isa_3_1_Misc.c
@@ -19,8 +19,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, see .
*/
#include
diff --git a/none/tests/ppc64/test_isa_3_1_R1_RT.c b/none/tests/ppc64/test_isa_3_1_R1_RT.c
index 241d6cf41f..1416078709 100644
--- a/none/tests/ppc64/test_isa_3_1_R1_RT.c
+++ b/none/tests/ppc64/test_isa_3_1_R1_RT.c
@@ -19,8 +19,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, see .
*/
#include
diff --git a/none/tests/ppc64/test_isa_3_1_R1_XT.c b/none/tests/ppc64/test_isa_3_1_R1_XT.c
index bd30bfd62f..6c1080469d 100644
--- a/none/tests/ppc64/test_isa_3_1_R1_XT.c
+++ b/none/tests/ppc64/test_isa_3_1_R1_XT.c
@@ -19,8 +19,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, see .
*/
#include
diff --git a/none/tests/ppc64/test_isa_3_1_RT.c b/none/tests/ppc64/test_isa_3_1_RT.c
index 9e2e352f89..95dcbfd630 100644
--- a/none/tests/ppc64/test_isa_3_1_RT.c
+++ b/none/tests/ppc64/test_isa_3_1_RT.c
@@ -19,8 +19,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, see .
*/
#include
diff --git a/none/tests/ppc64/test_isa_3_1_VRT.c b/none/tests/ppc64/test_isa_3_1_VRT.c
index 5df2360059..a72f2e47e0 100644
--- a/none/tests/ppc64/test_isa_3_1_VRT.c
+++ b/none/tests/ppc64/test_isa_3_1_VRT.c
@@ -19,8 +19,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, see .
*/
#include
diff --git a/none/tests/ppc64/test_isa_3_1_XT.c b/none/tests/ppc64/test_isa_3_1_XT.c
index 905c179517..fb96243aab 100644
--- a/none/tests/ppc64/test_isa_3_1_XT.c
+++ b/none/tests/ppc64/test_isa_3_1_XT.c
@@ -19,8 +19,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, see .
*/
#include
diff --git a/none/tests/rlimit64_nofile.c b/none/tests/rlimit64_nofile.c
index 54c3edf73a..d94f78dc9b 100644
--- a/none/tests/rlimit64_nofile.c
+++ b/none/tests/rlimit64_nofile.c
@@ -15,7 +15,7 @@ int main(int argc, char **argv)
struct rlimit64 newrlim;
int fd;
- CLOSE_INHERITED_FDS;
+
if (getrlimit64(RLIMIT_NOFILE, &oldrlim) < 0)
{
diff --git a/none/tests/rlimit_nofile.c b/none/tests/rlimit_nofile.c
index 4410c3e489..084f94b3b7 100644
--- a/none/tests/rlimit_nofile.c
+++ b/none/tests/rlimit_nofile.c
@@ -14,7 +14,7 @@ int main(int argc, char **argv)
struct rlimit newrlim;
int fd;
- CLOSE_INHERITED_FDS;
+
if (getrlimit(RLIMIT_NOFILE, &oldrlim) < 0)
{
diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am
index 88ee52e7a1..dda923acc6 100644
--- a/none/tests/s390x/Makefile.am
+++ b/none/tests/s390x/Makefile.am
@@ -1,17 +1,17 @@
include $(top_srcdir)/Makefile.tool-tests.am
-dist_noinst_SCRIPTS = filter_stderr
+dist_noinst_SCRIPTS = filter_stderr bfp-emit.pl emwarn-gen.pl
-INSN_TESTS = clc clcle cvb cvd icm lpr tcxb lam_stam xc mvst add sub mul \
+INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \
and or xor insert div srst fold_And16 flogr sub_EI add_EI \
and_EI or_EI xor_EI insert_EI mul_GE add_GE condloadstore \
- op_exception fgx stck stckf stcke stfle cksm mvcl clcl troo \
+ op_exception stck stckf stcke stfle cksm mvcl clcl troo \
trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \
cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \
- ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \
- rounding-1 rounding-2 rounding-3 rounding-4 rounding-5 bfp-1 \
- bfp-2 bfp-3 bfp-4 srnm srnmb comp-1 comp-2 exrl tmll tm stmg \
- ex clst mvc test_fork test_sig rounding-6 rxsbg popcnt \
+ ex_sig ex_clone cu14 cu14_1 cu41 ecag fpext_warn fpext_fail \
+ bfp-fpc bfp-306054 \
+ bfp-muldiv comp-1 comp-2 exrl tmll tm stmg \
+ ex clst mvc test_fork test_sig rxsbg popcnt \
high-word traps \
spechelper-alr spechelper-algr \
spechelper-slr spechelper-slgr \
@@ -22,37 +22,37 @@ INSN_TESTS = clc clcle cvb cvd icm lpr tcxb lam_stam xc mvst add sub mul \
vector_float add-z14 sub-z14 mul-z14 bic \
misc3 vec2 vec2_float \
dfp-1 dfp-2 dfp-3 dfp-4 dfpconv dfpext dfptest pfpo srnmt \
- fpext fixbr
+ hfp
+
+if HAS_MLONG_DOUBLE_128
+INSN_TESTS += bfp-arith bfp-compare bfp-convert bfp-load bfp-tdc
+endif
check_PROGRAMS = $(INSN_TESTS) \
allexec \
op00
-noinst_HEADERS = vector.h
+noinst_HEADERS = add.h and.h div.h dfp_utils.h insert.h mul.h opcodes.h \
+ or.h rounding.h sub.h svc.h table.h test.h vector.h xor.h
EXTRA_DIST = \
$(addsuffix .stderr.exp,$(INSN_TESTS)) \
$(addsuffix .stdout.exp,$(INSN_TESTS)) \
$(addsuffix .vgtest,$(INSN_TESTS)) \
+ bfp-arith.vgtest bfp-arith.stdout.exp bfp-arith.stderr.exp \
+ bfp-compare.vgtest bfp-compare.stdout.exp bfp-compare.stderr.exp \
+ bfp-convert.vgtest bfp-convert.stdout.exp bfp-convert.stderr.exp \
+ bfp-load.vgtest bfp-load.stdout.exp bfp-load.stderr.exp \
+ bfp-tdc.vgtest bfp-tdc.stdout.exp bfp-tdc.stderr.exp \
+ bfp-emit.vgtest bfp-emit.stderr.exp bfp-emit.post.exp \
+ bfp-XxC.vgtest bfp-XxC.stderr.exp bfp-XxC.post.exp \
ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \
ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \
- ecag.stdout.exp-z16 \
+ ecag.stdout.exp-z16 ecag.stdout.exp-z17 \
op00.stderr.exp op00.vgtest \
- fixbr.vgtest fixbr.stderr.exp fixbr.stdout.exp \
- fpext.vgtest fpext.stderr.exp fpext.stdout.exp \
- fpext_fail.vgtest fpext_fail.stderr.exp fpext_fail.stdout.exp \
- test.h opcodes.h add.h and.h div.h insert.h dfp_utils.h \
- mul.h or.h sub.h xor.h table.h svc.h rounding.h \
- dfp-1.stderr.exp dfp-1.stdout.exp dfp-1.vgtest \
- dfp-2.stderr.exp dfp-2.stdout.exp dfp-2.vgtest \
- dfp-3.stderr.exp dfp-3.stdout.exp dfp-3.vgtest \
- dfp-4.stderr.exp dfp-4.stdout.exp dfp-4.vgtest \
- dfptest.stderr.exp dfptest.stdout.exp dfptest.vgtest \
- dfpext.stderr.exp dfpext.stdout.exp dfpext.vgtest \
- dfpconv.stderr.exp dfpconv.stdout.exp dfpconv.vgtest \
- srnmt.stderr.exp srnmt.stdout.exp srnmt.vgtest \
- stfle.stdout.exp-z16 \
- pfpo.stderr.exp pfpo.stdout.exp pfpo.vgtest
+ dfp-XxC.vgtest dfp-XxC.stderr.exp dfp-XxC.post.exp \
+ dfp-XiC.vgtest dfp-XiC.stderr.exp dfp-XiC.post.exp \
+ stfle.stdout.exp-z16
AM_CFLAGS += @FLAG_M64@
AM_CXXFLAGS += @FLAG_M64@
@@ -71,3 +71,8 @@ vector_integer_CFLAGS = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=4
vector_float_CFLAGS = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=4
vec2_CFLAGS = $(AM_CFLAGS) -march=z13
vec2_float_CFLAGS = $(AM_CFLAGS) -march=z13
+bfp_arith_CFLAGS = $(AM_CFLAGS) -mlong-double-128
+bfp_compare_CFLAGS = $(AM_CFLAGS) -mlong-double-128
+bfp_convert_CFLAGS = $(AM_CFLAGS) -mlong-double-128
+bfp_load_CFLAGS = $(AM_CFLAGS) -mlong-double-128
+bfp_tdc_CFLAGS = $(AM_CFLAGS) -mlong-double-128
diff --git a/none/tests/s390x/bfp-1.c b/none/tests/s390x/bfp-1.c
deleted file mode 100644
index 2cf558e241..0000000000
--- a/none/tests/s390x/bfp-1.c
+++ /dev/null
@@ -1,93 +0,0 @@
-#include
-
-/* Simple test to see that basic operators are mapped
- correctly. Uses default rounding mode. */
-
-volatile double d1, d2;
-volatile float f1, f2;
-
-void fadd8(void)
-{
- printf("%f + %f = %f\n", d1, d2, d1 + d2);
-}
-
-void fsub8(void)
-{
- printf("%f - %f = %f\n", d1, d2, d1 - d2);
-}
-
-void fmul8(void)
-{
- printf("%f * %f = %f\n", d1, d2, d1 * d2);
-}
-
-void fdiv8(void)
-{
- printf("%f / %f = %f\n", d1, d2, d1 / d2);
-}
-
-void fadd4(void)
-{
- register float r1 asm("f1") = f1;
- register float r2 asm("f2") = f2;
-
- __asm__ volatile ("aebr %[r1],%[r2]\n\t"
- : [r1] "+f"(r1)
- : [r2] "f"(r2) : "cc");
- printf("%f + %f = %f\n", f1, f2, r1);
-}
-
-void fsub4(void)
-{
- register float r1 asm("f1") = f1;
- register float r2 asm("f2") = f2;
-
- __asm__ volatile ("sebr %[r1],%[r2]\n\t"
- : [r1] "+f"(r1)
- : [r2] "f"(r2) : "cc");
- printf("%f - %f = %f\n", f1, f2, r1);
-}
-
-void fmul4(void)
-{
- register float r1 asm("f1") = f1;
- register float r2 asm("f2") = f2;
-
- __asm__ volatile ("meebr %[r1],%[r2]\n\t"
- : [r1] "+f"(r1)
- : [r2] "f"(r2) : "cc");
- printf("%f * %f = %f\n", f1, f2, r1);
-}
-
-void fdiv4(void)
-{
- register float r1 asm("f1") = f1;
- register float r2 asm("f2") = f2;
-
- __asm__ volatile ("debr %[r1],%[r2]\n\t"
- : [r1] "+f"(r1)
- : [r2] "f"(r2) : "cc");
- printf("%f / %f = %f\n", f1, f2, r1);
-}
-
-
-int main()
-{
- printf("double arithmetic\n");
- d1 = 10.5;
- d2 = 1.25;
- fadd8();
- fsub8();
- fmul8();
- fdiv8();
-
- printf("float arithmetic\n");
- f1 = 10.5f;
- f2 = 1.25f;
- fadd4();
- fsub4();
- fmul4();
- fdiv4();
-
- return 0;
-}
diff --git a/none/tests/s390x/bfp-1.stdout.exp b/none/tests/s390x/bfp-1.stdout.exp
deleted file mode 100644
index 023c598648..0000000000
--- a/none/tests/s390x/bfp-1.stdout.exp
+++ /dev/null
@@ -1,10 +0,0 @@
-double arithmetic
-10.500000 + 1.250000 = 11.750000
-10.500000 - 1.250000 = 9.250000
-10.500000 * 1.250000 = 13.125000
-10.500000 / 1.250000 = 8.400000
-float arithmetic
-10.500000 + 1.250000 = 11.750000
-10.500000 - 1.250000 = 9.250000
-10.500000 * 1.250000 = 13.125000
-10.500000 / 1.250000 = 8.400000
diff --git a/none/tests/s390x/bfp-1.vgtest b/none/tests/s390x/bfp-1.vgtest
deleted file mode 100644
index 9d67c4abbf..0000000000
--- a/none/tests/s390x/bfp-1.vgtest
+++ /dev/null
@@ -1 +0,0 @@
-prog: bfp-1
diff --git a/none/tests/s390x/bfp-2.c b/none/tests/s390x/bfp-2.c
deleted file mode 100644
index 73349eddd2..0000000000
--- a/none/tests/s390x/bfp-2.c
+++ /dev/null
@@ -1,128 +0,0 @@
-#include
-
-/* Test various BFP ops:
- - square root
- - load negative
- - load positive
- - load complement
-*/
-
-void sqebr(float in)
-{
- float out;
-
- __asm__ volatile("sqebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
- printf("sqebr %f -> %f\n", in, out);
-}
-
-void sqdbr(double in)
-{
- double out;
-
- __asm__ volatile("sqdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
- printf("sqdbr %f -> %f\n", in, out);
-}
-
-void lnebr(float in)
-{
- float out;
-
- __asm__ volatile("lnebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
- printf("lnebr %f -> %f\n", in, out);
-}
-
-void lndbr(double in)
-{
- double out;
-
- __asm__ volatile("lndbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
- printf("lndbr %f -> %f\n", in, out);
-}
-
-void lpebr(float in)
-{
- float out;
-
- __asm__ volatile("lpebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
- printf("lpebr %f -> %f\n", in, out);
-}
-
-void lpdbr(double in)
-{
- double out;
-
- __asm__ volatile("lpdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
- printf("lpdbr %f -> %f\n", in, out);
-}
-
-void lcebr(float in)
-{
- float out;
-
- __asm__ volatile("lcebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
- printf("lcebr %f -> %f\n", in, out);
-}
-
-void lcdbr(double in)
-{
- double out;
-
- __asm__ volatile("lcdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
- printf("lcdbr %f -> %f\n", in, out);
-}
-
-void lder(double prev, float in)
-{
- unsigned long out;
-
- __asm__ volatile("lder %[prev],%[in]\n\t"
- "std %[prev],%[out]" :
- [out]"=R"(out) : [prev]"f"(prev), [in]"f"(in));
- printf("lder %f -> %lx\n", in, out);
-}
-
-void lde(double prev, float in)
-{
- unsigned long out;
-
- __asm__ volatile("lde %[prev],%[in]\n\t"
- "std %[prev],%[out]" :
- [out]"=R"(out) : [prev]"f"(prev), [in]"R"(in));
- printf("lde %f -> %lx\n", in, out);
-}
-
-int main(void)
-{
- // square root
- sqebr(121.0f); // 4 byte values
- sqdbr(144.0); // 8 bytes values
-
- // load negative
- lnebr(-2.5f); // 4 byte values
- lnebr(12.5f); // 4 byte values
-
- lndbr(-0.5); // 8 byte values
- lndbr(42.5); // 8 byte values
-
- // load positive
- lpebr(-2.5f); // 4 byte values
- lpebr(12.5f); // 4 byte values
-
- lpdbr(-0.5); // 8 byte values
- lpdbr(42.5); // 8 byte values
-
- // load complement
- lcebr(-23.5f); // 4 byte values
- lcebr(123.5f); // 4 byte values
-
- lcdbr(-17.5); // 8 byte values
- lcdbr(234.5); // 8 byte values
-
- // load lengthened
- lder(0.2, 321.5f);
- lder(0.9, -8388607.f);
- lde(0.2, -321.5f);
- lde(0.9, 8388607.f);
-
- return 0;
-}
diff --git a/none/tests/s390x/bfp-2.stdout.exp b/none/tests/s390x/bfp-2.stdout.exp
deleted file mode 100644
index b1bc484c5d..0000000000
--- a/none/tests/s390x/bfp-2.stdout.exp
+++ /dev/null
@@ -1,18 +0,0 @@
-sqebr 121.000000 -> 11.000000
-sqdbr 144.000000 -> 12.000000
-lnebr -2.500000 -> -2.500000
-lnebr 12.500000 -> -12.500000
-lndbr -0.500000 -> -0.500000
-lndbr 42.500000 -> -42.500000
-lpebr -2.500000 -> 2.500000
-lpebr 12.500000 -> 12.500000
-lpdbr -0.500000 -> 0.500000
-lpdbr 42.500000 -> 42.500000
-lcebr -23.500000 -> 23.500000
-lcebr 123.500000 -> -123.500000
-lcdbr -17.500000 -> 17.500000
-lcdbr 234.500000 -> -234.500000
-lder 321.500000 -> 43a0c00000000000
-lder -8388607.000000 -> cafffffe00000000
-lde -321.500000 -> c3a0c00000000000
-lde 8388607.000000 -> 4afffffe00000000
diff --git a/none/tests/s390x/bfp-2.vgtest b/none/tests/s390x/bfp-2.vgtest
deleted file mode 100644
index 239b8f985d..0000000000
--- a/none/tests/s390x/bfp-2.vgtest
+++ /dev/null
@@ -1 +0,0 @@
-prog: bfp-2
diff --git a/none/tests/s390x/bfp-3.vgtest b/none/tests/s390x/bfp-3.vgtest
deleted file mode 100644
index 8088d7d646..0000000000
--- a/none/tests/s390x/bfp-3.vgtest
+++ /dev/null
@@ -1 +0,0 @@
-prog: bfp-3
diff --git a/none/tests/s390x/rounding-1.c b/none/tests/s390x/bfp-306054.c
similarity index 100%
rename from none/tests/s390x/rounding-1.c
rename to none/tests/s390x/bfp-306054.c
diff --git a/none/tests/s390x/bfp-2.stderr.exp b/none/tests/s390x/bfp-306054.stderr.exp
similarity index 100%
rename from none/tests/s390x/bfp-2.stderr.exp
rename to none/tests/s390x/bfp-306054.stderr.exp
diff --git a/none/tests/s390x/rounding-1.stdout.exp b/none/tests/s390x/bfp-306054.stdout.exp
similarity index 100%
rename from none/tests/s390x/rounding-1.stdout.exp
rename to none/tests/s390x/bfp-306054.stdout.exp
diff --git a/none/tests/s390x/bfp-306054.vgtest b/none/tests/s390x/bfp-306054.vgtest
new file mode 100644
index 0000000000..3948f34274
--- /dev/null
+++ b/none/tests/s390x/bfp-306054.vgtest
@@ -0,0 +1 @@
+prog: bfp-306054
diff --git a/none/tests/s390x/bfp-4.stdout.exp b/none/tests/s390x/bfp-4.stdout.exp
deleted file mode 100644
index bc81ea6cec..0000000000
--- a/none/tests/s390x/bfp-4.stdout.exp
+++ /dev/null
@@ -1,80 +0,0 @@
-cebr: 3.14 == 3.14
-ceb: 3.14 == 3.14
-kebr: 3.14 == 3.14
-keb: 3.14 == 3.14
-cdbr: 3.14 == 3.14
-cdb: 3.14 == 3.14
-kdbr: 3.14 == 3.14
-kdb: 3.14 == 3.14
-cxbr: 3.14 == 3.14
-kxbr: 3.14 == 3.14
-cebr: -2.78 < 2.78
-ceb: -2.78 < 2.78
-kebr: -2.78 < 2.78
-keb: -2.78 < 2.78
-cdbr: -2.78 < 2.78
-cdb: -2.78 < 2.78
-kdbr: -2.78 < 2.78
-kdb: -2.78 < 2.78
-cxbr: -2.78 < 2.78
-kxbr: -2.78 < 2.78
-cebr: inf == inf
-ceb: inf == inf
-kebr: inf == inf
-keb: inf == inf
-cdbr: inf == inf
-cdb: inf == inf
-kdbr: inf == inf
-kdb: inf == inf
-cxbr: inf == inf
-kxbr: inf == inf
-cebr: inf > -inf
-ceb: inf > -inf
-kebr: inf > -inf
-keb: inf > -inf
-cdbr: inf > -inf
-cdb: inf > -inf
-kdbr: inf > -inf
-kdb: inf > -inf
-cxbr: inf > -inf
-kxbr: inf > -inf
-cebr: -inf == -inf
-ceb: -inf == -inf
-kebr: -inf == -inf
-keb: -inf == -inf
-cdbr: -inf == -inf
-cdb: -inf == -inf
-kdbr: -inf == -inf
-kdb: -inf == -inf
-cxbr: -inf == -inf
-kxbr: -inf == -inf
-cebr: inf > 1
-ceb: inf > 1
-kebr: inf > 1
-keb: inf > 1
-cdbr: inf > 1
-cdb: inf > 1
-kdbr: inf > 1
-kdb: inf > 1
-cxbr: inf > 1
-kxbr: inf > 1
-cebr: -inf < -1
-ceb: -inf < -1
-kebr: -inf < -1
-keb: -inf < -1
-cdbr: -inf < -1
-cdb: -inf < -1
-kdbr: -inf < -1
-kdb: -inf < -1
-cxbr: -inf < -1
-kxbr: -inf < -1
-cebr: 0 == -0
-ceb: 0 == -0
-kebr: 0 == -0
-keb: 0 == -0
-cdbr: 0 == -0
-cdb: 0 == -0
-kdbr: 0 == -0
-kdb: 0 == -0
-cxbr: 0 == -0
-kxbr: 0 == -0
diff --git a/none/tests/s390x/bfp-4.vgtest b/none/tests/s390x/bfp-4.vgtest
deleted file mode 100644
index b800aa313f..0000000000
--- a/none/tests/s390x/bfp-4.vgtest
+++ /dev/null
@@ -1 +0,0 @@
-prog: bfp-4
diff --git a/none/tests/s390x/bfp-XxC.post.exp b/none/tests/s390x/bfp-XxC.post.exp
new file mode 100644
index 0000000000..4e63c6b4e6
--- /dev/null
+++ b/none/tests/s390x/bfp-XxC.post.exp
@@ -0,0 +1,234 @@
+
+============================================================
+BFP CONVERT FROM FIXED
+============================================================
+Testing: cefbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cdfbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cxfbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cegbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cdgbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cxgbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+
+============================================================
+BFP CONVERT FROM LOGICAL
+============================================================
+Testing: celfbr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cdlfbr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cxlfbr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: celgbr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cdlgbr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cxlgbr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+
+============================================================
+BFP CONVERT TO FIXED
+============================================================
+Testing: cfebra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cfdbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cfxbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cgebra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cgdbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cgxbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+
+============================================================
+BFP CONVERT TO LOGICAL
+============================================================
+Testing: clfebr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: clfdbr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: clfxbr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: clgebr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: clgdbr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: clgxbr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+
+============================================================
+BFP LOAD FP INTEGER
+============================================================
+Testing: fiebra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: fidbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: fixbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+
+============================================================
+BFP LOAD ROUNDED
+============================================================
+Testing: ledbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: ldxbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: lexbra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
diff --git a/none/tests/s390x/bfp-3.stderr.exp b/none/tests/s390x/bfp-XxC.stderr.exp
similarity index 100%
rename from none/tests/s390x/bfp-3.stderr.exp
rename to none/tests/s390x/bfp-XxC.stderr.exp
diff --git a/none/tests/s390x/bfp-XxC.vgtest b/none/tests/s390x/bfp-XxC.vgtest
new file mode 100644
index 0000000000..af289c94ad
--- /dev/null
+++ b/none/tests/s390x/bfp-XxC.vgtest
@@ -0,0 +1,3 @@
+prereq: ../../../tests/s390x_features s390x-fpext
+prog: /bin/true
+post: ./emwarn-gen.pl --bfp-XxC
diff --git a/none/tests/s390x/bfp-arith.c b/none/tests/s390x/bfp-arith.c
new file mode 100644
index 0000000000..e69b7cf027
--- /dev/null
+++ b/none/tests/s390x/bfp-arith.c
@@ -0,0 +1,99 @@
+#include
+#include
+#include
+
+/* Making sure that the condition code of arithmetic BFP ops is
+ set correctly.
+
+ Multiply and square root are covered by bfp-emit.pl
+*/
+
+volatile int cc;
+
+#define TEST_INSN(insn, fmt, opnd1, opnd2) \
+ do { \
+ __typeof__(opnd1) v1 = opnd1; \
+ __typeof__(opnd2) v2 = opnd2; \
+ __asm__ volatile(insn " %[r1],%[r2]\n\t" \
+ "ipm %[psw]\n\t" \
+ "srl %[psw],28\n\t" \
+ : [psw]"=d"(cc) \
+ : [r1]"f"(v1), [r2]"f"(v2) \
+ : "cc"); \
+ printf("%s r1 = "fmt" r2 = "fmt" --> cc = %d\n", \
+ insn, opnd1, opnd2, cc); \
+ } while (0)
+
+
+static void aebr(float r1, float r2)
+{
+ TEST_INSN("aebr", "%g", r1, r2);
+}
+
+static void adbr(double r1, double r2)
+{
+ TEST_INSN("adbr", "%g", r1, r2);
+}
+
+static void axbr(long double r1, long double r2)
+{
+ TEST_INSN("axbr", "%Lg", r1, r2);
+}
+
+static void sebr(float r1, float r2)
+{
+ TEST_INSN("sebr", "%g", r1, r2);
+}
+
+static void sdbr(double r1, double r2)
+{
+ TEST_INSN("sdbr", "%g", r1, r2);
+}
+
+static void sxbr(long double r1, long double r2)
+{
+ TEST_INSN("sxbr", "%Lg", r1, r2);
+}
+
+int main()
+{
+ assert(sizeof(long double) == 16); // ensure 128 bit wide
+
+ printf("32-bit ADD\n");
+ aebr(2.5f, -2.5f);
+ aebr(4.75f, -6.25f);
+ aebr(-2.5f, 8.5f);
+ aebr(NAN, 0);
+
+ printf("64-bit ADD\n");
+ adbr(2.5, -2.5);
+ adbr(4.75, -6.25);
+ adbr(-2.5, 8.5);
+ adbr(NAN, 0);
+
+ printf("128-bit ADD\n");
+ axbr(2.5L, -2.5L);
+ axbr(4.75L, -6.25L);
+ axbr(-2.5L, 8.5L);
+ axbr(NAN, 0);
+
+ printf("32-bit SUBTRACT\n");
+ sebr(2.5f, 2.5f);
+ sebr(4.75f, 6.25f);
+ sebr(8.5f, 2.5f);
+ sebr(NAN, 0);
+
+ printf("64-bit SUBTRACT\n");
+ sdbr(2.5, 2.5);
+ sdbr(4.75, 6.25);
+ sdbr(8.5, 2.5f);
+ sdbr(NAN, 0);
+
+ printf("128-bit SUBTRACT\n");
+ sxbr(2.5f, 2.5);
+ sxbr(4.75f, 6.25);
+ sxbr(8.5f, 2.5);
+ sxbr(NAN, 0);
+
+ return 0;
+}
diff --git a/none/tests/s390x/bfp-4.stderr.exp b/none/tests/s390x/bfp-arith.stderr.exp
similarity index 100%
rename from none/tests/s390x/bfp-4.stderr.exp
rename to none/tests/s390x/bfp-arith.stderr.exp
diff --git a/none/tests/s390x/bfp-arith.stdout.exp b/none/tests/s390x/bfp-arith.stdout.exp
new file mode 100644
index 0000000000..237b5b3c82
--- /dev/null
+++ b/none/tests/s390x/bfp-arith.stdout.exp
@@ -0,0 +1,30 @@
+32-bit ADD
+aebr r1 = 2.5 r2 = -2.5 --> cc = 0
+aebr r1 = 4.75 r2 = -6.25 --> cc = 1
+aebr r1 = -2.5 r2 = 8.5 --> cc = 2
+aebr r1 = nan r2 = 0 --> cc = 3
+64-bit ADD
+adbr r1 = 2.5 r2 = -2.5 --> cc = 0
+adbr r1 = 4.75 r2 = -6.25 --> cc = 1
+adbr r1 = -2.5 r2 = 8.5 --> cc = 2
+adbr r1 = nan r2 = 0 --> cc = 3
+128-bit ADD
+axbr r1 = 2.5 r2 = -2.5 --> cc = 0
+axbr r1 = 4.75 r2 = -6.25 --> cc = 1
+axbr r1 = -2.5 r2 = 8.5 --> cc = 2
+axbr r1 = nan r2 = 0 --> cc = 3
+32-bit SUBTRACT
+sebr r1 = 2.5 r2 = 2.5 --> cc = 0
+sebr r1 = 4.75 r2 = 6.25 --> cc = 1
+sebr r1 = 8.5 r2 = 2.5 --> cc = 2
+sebr r1 = nan r2 = 0 --> cc = 3
+64-bit SUBTRACT
+sdbr r1 = 2.5 r2 = 2.5 --> cc = 0
+sdbr r1 = 4.75 r2 = 6.25 --> cc = 1
+sdbr r1 = 8.5 r2 = 2.5 --> cc = 2
+sdbr r1 = nan r2 = 0 --> cc = 3
+128-bit SUBTRACT
+sxbr r1 = 2.5 r2 = 2.5 --> cc = 0
+sxbr r1 = 4.75 r2 = 6.25 --> cc = 1
+sxbr r1 = 8.5 r2 = 2.5 --> cc = 2
+sxbr r1 = nan r2 = 0 --> cc = 3
diff --git a/none/tests/s390x/bfp-arith.vgtest b/none/tests/s390x/bfp-arith.vgtest
new file mode 100644
index 0000000000..19b58a066f
--- /dev/null
+++ b/none/tests/s390x/bfp-arith.vgtest
@@ -0,0 +1 @@
+prog: bfp-arith
diff --git a/none/tests/s390x/bfp-4.c b/none/tests/s390x/bfp-compare.c
similarity index 72%
rename from none/tests/s390x/bfp-4.c
rename to none/tests/s390x/bfp-compare.c
index 02315b6f9d..35d5018b69 100644
--- a/none/tests/s390x/bfp-4.c
+++ b/none/tests/s390x/bfp-compare.c
@@ -1,4 +1,8 @@
+// FIXME rename bfp-compare.c
+
#include
+#include
+#include
static const char *const cmp_result_str[] = {
"==", "<", ">", "??"
@@ -86,16 +90,31 @@ static void do_compare(float a, float b)
int main(void)
{
- float inf = 1.f / 0.;
- float neg_inf = -1.f / 0.;
+ assert(sizeof(long double) == 16);
do_compare(3.14f, 3.14f);
do_compare(-2.78f, 2.78f);
- do_compare(inf, inf);
- do_compare(inf, neg_inf);
- do_compare(neg_inf, neg_inf);
- do_compare(inf, 1.f);
- do_compare(neg_inf, -1.f);
- do_compare(1.f / inf, -1.f / inf);
+ do_compare( INFINITY, INFINITY);
+ do_compare( INFINITY, -INFINITY);
+ do_compare(-INFINITY, -INFINITY);
+ do_compare(-INFINITY, INFINITY);
+ do_compare( INFINITY, 1.f);
+ do_compare(-INFINITY, -1.f);
+ do_compare( 1.f, INFINITY);
+ do_compare(-1.f, -INFINITY);
+
+ do_compare( NAN, NAN);
+ do_compare( NAN, -NAN);
+ do_compare(-NAN, NAN);
+ do_compare(-NAN, -NAN);
+ do_compare( NAN, INFINITY);
+ do_compare( NAN, -INFINITY);
+ do_compare(-NAN, INFINITY);
+ do_compare(-NAN, -INFINITY);
+ do_compare( NAN, 1.5);
+ do_compare(-NAN, -1.5);
+ do_compare( 1.5, NAN);
+ do_compare(-1.5, -NAN);
+ do_compare(1.f / INFINITY, -1.f / INFINITY);
return 0;
}
diff --git a/none/tests/s390x/fgx.stderr.exp b/none/tests/s390x/bfp-compare.stderr.exp
similarity index 100%
rename from none/tests/s390x/fgx.stderr.exp
rename to none/tests/s390x/bfp-compare.stderr.exp
diff --git a/none/tests/s390x/bfp-compare.stdout.exp b/none/tests/s390x/bfp-compare.stdout.exp
new file mode 100644
index 0000000000..b81f3f6e24
--- /dev/null
+++ b/none/tests/s390x/bfp-compare.stdout.exp
@@ -0,0 +1,230 @@
+cebr: 3.14 == 3.14
+ceb: 3.14 == 3.14
+kebr: 3.14 == 3.14
+keb: 3.14 == 3.14
+cdbr: 3.14 == 3.14
+cdb: 3.14 == 3.14
+kdbr: 3.14 == 3.14
+kdb: 3.14 == 3.14
+cxbr: 3.14 == 3.14
+kxbr: 3.14 == 3.14
+cebr: -2.78 < 2.78
+ceb: -2.78 < 2.78
+kebr: -2.78 < 2.78
+keb: -2.78 < 2.78
+cdbr: -2.78 < 2.78
+cdb: -2.78 < 2.78
+kdbr: -2.78 < 2.78
+kdb: -2.78 < 2.78
+cxbr: -2.78 < 2.78
+kxbr: -2.78 < 2.78
+cebr: inf == inf
+ceb: inf == inf
+kebr: inf == inf
+keb: inf == inf
+cdbr: inf == inf
+cdb: inf == inf
+kdbr: inf == inf
+kdb: inf == inf
+cxbr: inf == inf
+kxbr: inf == inf
+cebr: inf > -inf
+ceb: inf > -inf
+kebr: inf > -inf
+keb: inf > -inf
+cdbr: inf > -inf
+cdb: inf > -inf
+kdbr: inf > -inf
+kdb: inf > -inf
+cxbr: inf > -inf
+kxbr: inf > -inf
+cebr: -inf == -inf
+ceb: -inf == -inf
+kebr: -inf == -inf
+keb: -inf == -inf
+cdbr: -inf == -inf
+cdb: -inf == -inf
+kdbr: -inf == -inf
+kdb: -inf == -inf
+cxbr: -inf == -inf
+kxbr: -inf == -inf
+cebr: -inf < inf
+ceb: -inf < inf
+kebr: -inf < inf
+keb: -inf < inf
+cdbr: -inf < inf
+cdb: -inf < inf
+kdbr: -inf < inf
+kdb: -inf < inf
+cxbr: -inf < inf
+kxbr: -inf < inf
+cebr: inf > 1
+ceb: inf > 1
+kebr: inf > 1
+keb: inf > 1
+cdbr: inf > 1
+cdb: inf > 1
+kdbr: inf > 1
+kdb: inf > 1
+cxbr: inf > 1
+kxbr: inf > 1
+cebr: -inf < -1
+ceb: -inf < -1
+kebr: -inf < -1
+keb: -inf < -1
+cdbr: -inf < -1
+cdb: -inf < -1
+kdbr: -inf < -1
+kdb: -inf < -1
+cxbr: -inf < -1
+kxbr: -inf < -1
+cebr: 1 < inf
+ceb: 1 < inf
+kebr: 1 < inf
+keb: 1 < inf
+cdbr: 1 < inf
+cdb: 1 < inf
+kdbr: 1 < inf
+kdb: 1 < inf
+cxbr: 1 < inf
+kxbr: 1 < inf
+cebr: -1 > -inf
+ceb: -1 > -inf
+kebr: -1 > -inf
+keb: -1 > -inf
+cdbr: -1 > -inf
+cdb: -1 > -inf
+kdbr: -1 > -inf
+kdb: -1 > -inf
+cxbr: -1 > -inf
+kxbr: -1 > -inf
+cebr: nan ?? nan
+ceb: nan ?? nan
+kebr: nan ?? nan
+keb: nan ?? nan
+cdbr: nan ?? nan
+cdb: nan ?? nan
+kdbr: nan ?? nan
+kdb: nan ?? nan
+cxbr: nan ?? nan
+kxbr: nan ?? nan
+cebr: nan ?? -nan
+ceb: nan ?? -nan
+kebr: nan ?? -nan
+keb: nan ?? -nan
+cdbr: nan ?? -nan
+cdb: nan ?? -nan
+kdbr: nan ?? -nan
+kdb: nan ?? -nan
+cxbr: nan ?? -nan
+kxbr: nan ?? -nan
+cebr: -nan ?? nan
+ceb: -nan ?? nan
+kebr: -nan ?? nan
+keb: -nan ?? nan
+cdbr: -nan ?? nan
+cdb: -nan ?? nan
+kdbr: -nan ?? nan
+kdb: -nan ?? nan
+cxbr: -nan ?? nan
+kxbr: -nan ?? nan
+cebr: -nan ?? -nan
+ceb: -nan ?? -nan
+kebr: -nan ?? -nan
+keb: -nan ?? -nan
+cdbr: -nan ?? -nan
+cdb: -nan ?? -nan
+kdbr: -nan ?? -nan
+kdb: -nan ?? -nan
+cxbr: -nan ?? -nan
+kxbr: -nan ?? -nan
+cebr: nan ?? inf
+ceb: nan ?? inf
+kebr: nan ?? inf
+keb: nan ?? inf
+cdbr: nan ?? inf
+cdb: nan ?? inf
+kdbr: nan ?? inf
+kdb: nan ?? inf
+cxbr: nan ?? inf
+kxbr: nan ?? inf
+cebr: nan ?? -inf
+ceb: nan ?? -inf
+kebr: nan ?? -inf
+keb: nan ?? -inf
+cdbr: nan ?? -inf
+cdb: nan ?? -inf
+kdbr: nan ?? -inf
+kdb: nan ?? -inf
+cxbr: nan ?? -inf
+kxbr: nan ?? -inf
+cebr: -nan ?? inf
+ceb: -nan ?? inf
+kebr: -nan ?? inf
+keb: -nan ?? inf
+cdbr: -nan ?? inf
+cdb: -nan ?? inf
+kdbr: -nan ?? inf
+kdb: -nan ?? inf
+cxbr: -nan ?? inf
+kxbr: -nan ?? inf
+cebr: -nan ?? -inf
+ceb: -nan ?? -inf
+kebr: -nan ?? -inf
+keb: -nan ?? -inf
+cdbr: -nan ?? -inf
+cdb: -nan ?? -inf
+kdbr: -nan ?? -inf
+kdb: -nan ?? -inf
+cxbr: -nan ?? -inf
+kxbr: -nan ?? -inf
+cebr: nan ?? 1.5
+ceb: nan ?? 1.5
+kebr: nan ?? 1.5
+keb: nan ?? 1.5
+cdbr: nan ?? 1.5
+cdb: nan ?? 1.5
+kdbr: nan ?? 1.5
+kdb: nan ?? 1.5
+cxbr: nan ?? 1.5
+kxbr: nan ?? 1.5
+cebr: -nan ?? -1.5
+ceb: -nan ?? -1.5
+kebr: -nan ?? -1.5
+keb: -nan ?? -1.5
+cdbr: -nan ?? -1.5
+cdb: -nan ?? -1.5
+kdbr: -nan ?? -1.5
+kdb: -nan ?? -1.5
+cxbr: -nan ?? -1.5
+kxbr: -nan ?? -1.5
+cebr: 1.5 ?? nan
+ceb: 1.5 ?? nan
+kebr: 1.5 ?? nan
+keb: 1.5 ?? nan
+cdbr: 1.5 ?? nan
+cdb: 1.5 ?? nan
+kdbr: 1.5 ?? nan
+kdb: 1.5 ?? nan
+cxbr: 1.5 ?? nan
+kxbr: 1.5 ?? nan
+cebr: -1.5 ?? -nan
+ceb: -1.5 ?? -nan
+kebr: -1.5 ?? -nan
+keb: -1.5 ?? -nan
+cdbr: -1.5 ?? -nan
+cdb: -1.5 ?? -nan
+kdbr: -1.5 ?? -nan
+kdb: -1.5 ?? -nan
+cxbr: -1.5 ?? -nan
+kxbr: -1.5 ?? -nan
+cebr: 0 == -0
+ceb: 0 == -0
+kebr: 0 == -0
+keb: 0 == -0
+cdbr: 0 == -0
+cdb: 0 == -0
+kdbr: 0 == -0
+kdb: 0 == -0
+cxbr: 0 == -0
+kxbr: 0 == -0
diff --git a/none/tests/s390x/bfp-compare.vgtest b/none/tests/s390x/bfp-compare.vgtest
new file mode 100644
index 0000000000..8bc91934ce
--- /dev/null
+++ b/none/tests/s390x/bfp-compare.vgtest
@@ -0,0 +1 @@
+prog: bfp-compare
diff --git a/none/tests/s390x/bfp-convert.c b/none/tests/s390x/bfp-convert.c
new file mode 100644
index 0000000000..1d0502e41f
--- /dev/null
+++ b/none/tests/s390x/bfp-convert.c
@@ -0,0 +1,325 @@
+/* Test "convert to fixed" and "convert to logical" insns.
+
+ We already know via bfp-emit.pl:
+
+ Testing: cfebr %r0,0,%f1
+ Frontend: cfebr %r0,0,%f1
+ Assembly: cfebr %r5,0,%f7
+
+ Testing: celfbr %f0,0,%r1,0
+ Frontend: celfbr %f0,0,%r1,0
+ Assembly: celfbr %f7,0,%r4,0
+
+ So the only thing to test for here is the condition code.
+
+ Note, no testing for "convert from ..." insns here, as they are
+ covered in bfd-emit.pl and do not set the condition code.
+*/
+#include
+#include
+#include
+#include
+#include "rounding.h"
+
+#define convert_to_int(opcode,src_type,dst_type,round,value,fmt) \
+ do { \
+ src_type src = value; \
+ dst_type dst; \
+ unsigned cc; \
+ \
+ __asm__ volatile (opcode " %[dst]," #round ",%[src]\n\t" \
+ "ipm %[cc]\n\t" \
+ "srl %[cc],28\n\t" \
+ : [dst]"=d"(dst), [cc]"=d"(cc) \
+ : [src]"f"(src) \
+ : "cc"); \
+ \
+ printf("%s "fmt"\tcc = %u\n", opcode, src, cc); \
+ \
+ __asm__ volatile (opcode "a %[dst]," #round ",%[src],0\n\t" \
+ "ipm %[cc]\n\t" \
+ "srl %[cc],28\n\t" \
+ : [dst]"=d"(dst), [cc]"=d"(cc) \
+ : [src]"f"(src) \
+ : "cc"); \
+ \
+ printf("%sa "fmt"\tcc = %u\n", opcode, src, cc); \
+} while (0)
+
+#define convert_to_logical(opcode,src_type,dst_type,round,value,fmt) \
+ do { \
+ src_type src = value; \
+ dst_type dst; \
+ unsigned cc; \
+ \
+ __asm__ volatile (opcode " %[dst]," #round ",%[src], 0\n\t" \
+ "ipm %[cc]\n\t" \
+ "srl %[cc],28\n\t" \
+ : [dst]"=d"(dst), [cc]"=d"(cc) \
+ : [src]"f"(src) \
+ : "cc"); \
+ \
+ printf("%s "fmt"\tcc = %u\n", opcode, src, cc); \
+} while (0)
+
+/* Convenience macros */
+#define cfebr(value,round) \
+ convert_to_int("cfebr",float,int32_t,round,value,"%f")
+#define cfdbr(value,round) \
+ convert_to_int("cfdbr",double,int32_t,round,value,"%f")
+#define cfxbr(value,round) \
+ convert_to_int("cfxbr",long double,int32_t,round,value,"%Lf")
+#define cgebr(value,round) \
+ convert_to_int("cgebr",float,int64_t,round,value,"%f")
+#define cgdbr(value,round) \
+ convert_to_int("cgdbr",double,int64_t,round,value,"%f")
+#define cgxbr(value,round) \
+ convert_to_int("cgxbr",long double,int64_t,round,value,"%Lf")
+
+#define clfebr(value,round) \
+ convert_to_logical("clfebr",float,uint32_t,round,value,"%f")
+#define clfdbr(value,round) \
+ convert_to_logical("clfdbr",double,uint32_t,round,value,"%f")
+#define clfxbr(value,round) \
+ convert_to_logical("clfxbr",long double,uint32_t,round,value,"%Lf")
+#define clgebr(value,round) \
+ convert_to_logical("clgebr",float,uint64_t,round,value,"%f")
+#define clgdbr(value,round) \
+ convert_to_logical("clgdbr",double,uint64_t,round,value,"%f")
+#define clgxbr(value,round) \
+ convert_to_logical("clgxbr",long double,uint64_t,round,value,"%Lf")
+
+#define convert_to_int_m3_tests(mode) \
+ printf("...setting M3 rounding mode to %s\n", m3_rtext(mode)); \
+ \
+ /* f32 -> i32 */ \
+ printf("......f32 -> i32\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ cfebr(values[j], mode); \
+ \
+ /* f32 -> i64 */ \
+ printf("......f32 -> i64\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ cgebr(values[j], mode); \
+ \
+ /* f64 -> i32 */ \
+ printf("......f64 -> i32\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ cfdbr(values[j], mode); \
+ \
+ /* f64 -> i64 */ \
+ printf("......f64 -> i64\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ cgdbr(values[j], mode); \
+ \
+ /* f128 -> i32 */ \
+ printf("......f128 -> i32\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ cfxbr(values[j], mode); \
+ \
+ /* f128 -> i64 */ \
+ printf("......f128 -> i64\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ cgxbr(values[j], mode);
+
+#define convert_to_logical_m3_tests(mode) \
+ printf("...setting M3 rounding mode to %s\n", m3_rtext(mode)); \
+ \
+ /* f32 -> u32 */ \
+ printf("......f32 -> u32\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ clfebr(values[j], mode); \
+ \
+ /* f32 -> u64 */ \
+ printf("......f32 -> u64\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ clgebr(values[j], mode); \
+ \
+ /* f64 -> u32 */ \
+ printf("......f64 -> u32\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ clfdbr(values[j], mode); \
+ \
+ /* f64 -> u64 */ \
+ printf("......f64 -> u64\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ clgdbr(values[j], mode); \
+ \
+ /* f128 -> u32 */ \
+ printf("......f128 -> u32\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ clfxbr(values[j], mode); \
+ \
+ /* f128 -> u64 */ \
+ printf("......f128 -> u64\n"); \
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j) \
+ clgxbr(values[j], mode);
+
+static void
+set_rounding_mode(unsigned mode)
+{
+ __asm__ volatile ("sfpc %[r1]" : : [r1]"d"(mode));
+}
+
+static const char *
+fpc_rtext(unsigned fpc_round)
+{
+ switch (fpc_round) {
+ case FPC_BFP_ROUND_NEAREST_EVEN: return "[-> near]";
+ case FPC_BFP_ROUND_ZERO: return "[-> zero]";
+ case FPC_BFP_ROUND_POSINF: return "[-> +inf]";
+ case FPC_BFP_ROUND_NEGINF: return "[-> -inf]";
+ case FPC_BFP_ROUND_PREPARE_SHORT: return "[-> prepare-short]";
+ }
+ assert(0);
+}
+
+static const char *
+m3_rtext(unsigned m3_round)
+{
+ switch (m3_round) {
+ case M3_BFP_ROUND_PER_FPC: return "[per fpc]";
+ case M3_BFP_ROUND_NEAREST_AWAY: return "[-> near away]";
+ case M3_BFP_ROUND_PREPARE_SHORT: return "[-> prepare-short]";
+ case M3_BFP_ROUND_NEAREST_EVEN: return "[-> near away]";
+ case M3_BFP_ROUND_ZERO: return "[-> zero]";
+ case M3_BFP_ROUND_POSINF: return "[-> +inf]";
+ case M3_BFP_ROUND_NEGINF: return "[-> -inf]";
+ }
+ assert(0);
+}
+
+/* Can be converted to 64-bit and 128-bit values without issues. */
+static const float values[] = {
+ 0.0f, -1.0f, 2.0f, NAN, INFINITY
+};
+
+static void
+convert_to_int_fpc_tests(unsigned mode)
+{
+ set_rounding_mode(mode);
+
+ /* f32 -> i32 */
+ printf("......f32 -> i32\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ cfebr(values[j], M3_BFP_ROUND_PER_FPC);
+
+ /* f32 -> i64 */
+ printf("......f32 -> i64\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ cgebr(values[j], M3_BFP_ROUND_PER_FPC);
+
+ /* f64 -> i32 */
+ printf("......f64 -> i32\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ cfdbr(values[j], M3_BFP_ROUND_PER_FPC);
+
+ /* f64 -> i64 */
+ printf("......f64 -> i64\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ cgdbr(values[j], M3_BFP_ROUND_PER_FPC);
+
+ /* f128 -> i32 */
+ printf("......f128 -> i32\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ cfxbr(values[j], M3_BFP_ROUND_PER_FPC);
+
+ /* f128 -> i64 */
+ printf("......f128 -> i64\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ cgxbr(values[j], M3_BFP_ROUND_PER_FPC);
+}
+
+#if 0
+static void
+convert_to_logical_fpc_tests(unsigned mode)
+{
+ set_rounding_mode(mode);
+
+ /* f32 -> u32 */
+ printf("......f32 -> u32\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ clfebr(values[j], M3_BFP_ROUND_PER_FPC);
+
+ /* f32 -> u64 */
+ printf("......f32 -> u64\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ clgebr(values[j], M3_BFP_ROUND_PER_FPC);
+
+ /* f64 -> u32 */
+ printf("......f64 -> u32\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ clfdbr(values[j], M3_BFP_ROUND_PER_FPC);
+
+ /* f64 -> u64 */
+ printf("......f64 -> u64\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ clgdbr(values[j], M3_BFP_ROUND_PER_FPC);
+
+ /* f128 -> u32 */
+ printf("......f128 -> u32\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ clfxbr(values[j], M3_BFP_ROUND_PER_FPC);
+
+ /* f128 -> u64 */
+ printf("......f128 -> u64\n");
+ for (int j = 0; j < sizeof values / sizeof values[0]; ++j)
+ clgxbr(values[j], M3_BFP_ROUND_PER_FPC);
+}
+#endif
+
+int
+main(void)
+{
+ assert(sizeof(long double) == 16);
+
+ static const unsigned fpc_rmodes[] = {
+ FPC_BFP_ROUND_NEAREST_EVEN,
+ FPC_BFP_ROUND_ZERO,
+ FPC_BFP_ROUND_POSINF,
+ FPC_BFP_ROUND_NEGINF,
+ FPC_BFP_ROUND_PREPARE_SHORT
+ };
+
+ //----------------------------------------------------------
+ // Convert to int
+ //----------------------------------------------------------
+ printf("============ Convert to int =============\n");
+ printf("Rounding as 'per FPC'\n");
+ for (int i = 0; i < sizeof fpc_rmodes / sizeof fpc_rmodes[0]; ++i) {
+ printf("...setting FPC rounding mode to %s\n", fpc_rtext(fpc_rmodes[i]));
+ convert_to_int_fpc_tests(fpc_rmodes[i]);
+ }
+
+ printf("Rounding as 'per M3'\n");
+ convert_to_int_m3_tests(1); // M3_BFP_ROUND_NEAREST_AWAY
+ convert_to_int_m3_tests(3); // M3_BFP_ROUND_PREPARE_SHORT
+ convert_to_int_m3_tests(4); // M3_BFP_ROUND_NEAREST_EVEN
+ convert_to_int_m3_tests(5); // M3_BFP_ROUND_ZERO
+ convert_to_int_m3_tests(6); // M3_BFP_ROUND_POSINF
+ convert_to_int_m3_tests(7); // M3_BFP_ROUND_NEGINF
+
+ //----------------------------------------------------------
+ // Convert to logical
+ //----------------------------------------------------------
+#if 0
+ /* Disabled until condition code weirdness has been cleared up.
+ Negative floating point number --> cc = 3. Seems wrong to me. */
+ putchar('\n');
+ printf("============ Convert to logical =============\n");
+ printf("Rounding as 'per FPC'\n");
+ for (int i = 0; i < sizeof fpc_rmodes / sizeof fpc_rmodes[0]; ++i) {
+ printf("...setting FPC rounding mode to %s\n", fpc_rtext(fpc_rmodes[i]));
+ convert_to_logical_fpc_tests(fpc_rmodes[i]);
+ }
+
+ printf("Rounding as 'per M3'\n");
+ convert_to_logical_m3_tests(1); // M3_BFP_ROUND_NEAREST_AWAY
+ convert_to_logical_m3_tests(3); // M3_BFP_ROUND_PREPARE_SHORT
+ convert_to_logical_m3_tests(4); // M3_BFP_ROUND_NEAREST_EVEN
+ convert_to_logical_m3_tests(5); // M3_BFP_ROUND_ZERO
+ convert_to_logical_m3_tests(6); // M3_BFP_ROUND_POSINF
+ convert_to_logical_m3_tests(7); // M3_BFP_ROUND_NEGINF
+#endif
+ return 0;
+}
diff --git a/none/tests/s390x/fixbr.stderr.exp b/none/tests/s390x/bfp-convert.stderr.exp
similarity index 100%
rename from none/tests/s390x/fixbr.stderr.exp
rename to none/tests/s390x/bfp-convert.stderr.exp
diff --git a/none/tests/s390x/bfp-convert.stdout.exp b/none/tests/s390x/bfp-convert.stdout.exp
new file mode 100644
index 0000000000..c5a17ebd43
--- /dev/null
+++ b/none/tests/s390x/bfp-convert.stdout.exp
@@ -0,0 +1,740 @@
+============ Convert to int =============
+Rounding as 'per FPC'
+...setting FPC rounding mode to [-> near]
+......f32 -> i32
+cfebr 0.000000 cc = 0
+cfebra 0.000000 cc = 0
+cfebr -1.000000 cc = 1
+cfebra -1.000000 cc = 1
+cfebr 2.000000 cc = 2
+cfebra 2.000000 cc = 2
+cfebr nan cc = 3
+cfebra nan cc = 3
+cfebr inf cc = 3
+cfebra inf cc = 3
+......f32 -> i64
+cgebr 0.000000 cc = 0
+cgebra 0.000000 cc = 0
+cgebr -1.000000 cc = 1
+cgebra -1.000000 cc = 1
+cgebr 2.000000 cc = 2
+cgebra 2.000000 cc = 2
+cgebr nan cc = 3
+cgebra nan cc = 3
+cgebr inf cc = 3
+cgebra inf cc = 3
+......f64 -> i32
+cfdbr 0.000000 cc = 0
+cfdbra 0.000000 cc = 0
+cfdbr -1.000000 cc = 1
+cfdbra -1.000000 cc = 1
+cfdbr 2.000000 cc = 2
+cfdbra 2.000000 cc = 2
+cfdbr nan cc = 3
+cfdbra nan cc = 3
+cfdbr inf cc = 3
+cfdbra inf cc = 3
+......f64 -> i64
+cgdbr 0.000000 cc = 0
+cgdbra 0.000000 cc = 0
+cgdbr -1.000000 cc = 1
+cgdbra -1.000000 cc = 1
+cgdbr 2.000000 cc = 2
+cgdbra 2.000000 cc = 2
+cgdbr nan cc = 3
+cgdbra nan cc = 3
+cgdbr inf cc = 3
+cgdbra inf cc = 3
+......f128 -> i32
+cfxbr 0.000000 cc = 0
+cfxbra 0.000000 cc = 0
+cfxbr -1.000000 cc = 1
+cfxbra -1.000000 cc = 1
+cfxbr 2.000000 cc = 2
+cfxbra 2.000000 cc = 2
+cfxbr nan cc = 3
+cfxbra nan cc = 3
+cfxbr inf cc = 3
+cfxbra inf cc = 3
+......f128 -> i64
+cgxbr 0.000000 cc = 0
+cgxbra 0.000000 cc = 0
+cgxbr -1.000000 cc = 1
+cgxbra -1.000000 cc = 1
+cgxbr 2.000000 cc = 2
+cgxbra 2.000000 cc = 2
+cgxbr nan cc = 3
+cgxbra nan cc = 3
+cgxbr inf cc = 3
+cgxbra inf cc = 3
+...setting FPC rounding mode to [-> zero]
+......f32 -> i32
+cfebr 0.000000 cc = 0
+cfebra 0.000000 cc = 0
+cfebr -1.000000 cc = 1
+cfebra -1.000000 cc = 1
+cfebr 2.000000 cc = 2
+cfebra 2.000000 cc = 2
+cfebr nan cc = 3
+cfebra nan cc = 3
+cfebr inf cc = 3
+cfebra inf cc = 3
+......f32 -> i64
+cgebr 0.000000 cc = 0
+cgebra 0.000000 cc = 0
+cgebr -1.000000 cc = 1
+cgebra -1.000000 cc = 1
+cgebr 2.000000 cc = 2
+cgebra 2.000000 cc = 2
+cgebr nan cc = 3
+cgebra nan cc = 3
+cgebr inf cc = 3
+cgebra inf cc = 3
+......f64 -> i32
+cfdbr 0.000000 cc = 0
+cfdbra 0.000000 cc = 0
+cfdbr -1.000000 cc = 1
+cfdbra -1.000000 cc = 1
+cfdbr 2.000000 cc = 2
+cfdbra 2.000000 cc = 2
+cfdbr nan cc = 3
+cfdbra nan cc = 3
+cfdbr inf cc = 3
+cfdbra inf cc = 3
+......f64 -> i64
+cgdbr 0.000000 cc = 0
+cgdbra 0.000000 cc = 0
+cgdbr -1.000000 cc = 1
+cgdbra -1.000000 cc = 1
+cgdbr 2.000000 cc = 2
+cgdbra 2.000000 cc = 2
+cgdbr nan cc = 3
+cgdbra nan cc = 3
+cgdbr inf cc = 3
+cgdbra inf cc = 3
+......f128 -> i32
+cfxbr 0.000000 cc = 0
+cfxbra 0.000000 cc = 0
+cfxbr -1.000000 cc = 1
+cfxbra -1.000000 cc = 1
+cfxbr 2.000000 cc = 2
+cfxbra 2.000000 cc = 2
+cfxbr nan cc = 3
+cfxbra nan cc = 3
+cfxbr inf cc = 3
+cfxbra inf cc = 3
+......f128 -> i64
+cgxbr 0.000000 cc = 0
+cgxbra 0.000000 cc = 0
+cgxbr -1.000000 cc = 1
+cgxbra -1.000000 cc = 1
+cgxbr 2.000000 cc = 2
+cgxbra 2.000000 cc = 2
+cgxbr nan cc = 3
+cgxbra nan cc = 3
+cgxbr inf cc = 3
+cgxbra inf cc = 3
+...setting FPC rounding mode to [-> +inf]
+......f32 -> i32
+cfebr 0.000000 cc = 0
+cfebra 0.000000 cc = 0
+cfebr -1.000000 cc = 1
+cfebra -1.000000 cc = 1
+cfebr 2.000000 cc = 2
+cfebra 2.000000 cc = 2
+cfebr nan cc = 3
+cfebra nan cc = 3
+cfebr inf cc = 3
+cfebra inf cc = 3
+......f32 -> i64
+cgebr 0.000000 cc = 0
+cgebra 0.000000 cc = 0
+cgebr -1.000000 cc = 1
+cgebra -1.000000 cc = 1
+cgebr 2.000000 cc = 2
+cgebra 2.000000 cc = 2
+cgebr nan cc = 3
+cgebra nan cc = 3
+cgebr inf cc = 3
+cgebra inf cc = 3
+......f64 -> i32
+cfdbr 0.000000 cc = 0
+cfdbra 0.000000 cc = 0
+cfdbr -1.000000 cc = 1
+cfdbra -1.000000 cc = 1
+cfdbr 2.000000 cc = 2
+cfdbra 2.000000 cc = 2
+cfdbr nan cc = 3
+cfdbra nan cc = 3
+cfdbr inf cc = 3
+cfdbra inf cc = 3
+......f64 -> i64
+cgdbr 0.000000 cc = 0
+cgdbra 0.000000 cc = 0
+cgdbr -1.000000 cc = 1
+cgdbra -1.000000 cc = 1
+cgdbr 2.000000 cc = 2
+cgdbra 2.000000 cc = 2
+cgdbr nan cc = 3
+cgdbra nan cc = 3
+cgdbr inf cc = 3
+cgdbra inf cc = 3
+......f128 -> i32
+cfxbr 0.000000 cc = 0
+cfxbra 0.000000 cc = 0
+cfxbr -1.000000 cc = 1
+cfxbra -1.000000 cc = 1
+cfxbr 2.000000 cc = 2
+cfxbra 2.000000 cc = 2
+cfxbr nan cc = 3
+cfxbra nan cc = 3
+cfxbr inf cc = 3
+cfxbra inf cc = 3
+......f128 -> i64
+cgxbr 0.000000 cc = 0
+cgxbra 0.000000 cc = 0
+cgxbr -1.000000 cc = 1
+cgxbra -1.000000 cc = 1
+cgxbr 2.000000 cc = 2
+cgxbra 2.000000 cc = 2
+cgxbr nan cc = 3
+cgxbra nan cc = 3
+cgxbr inf cc = 3
+cgxbra inf cc = 3
+...setting FPC rounding mode to [-> -inf]
+......f32 -> i32
+cfebr 0.000000 cc = 0
+cfebra 0.000000 cc = 0
+cfebr -1.000000 cc = 1
+cfebra -1.000000 cc = 1
+cfebr 2.000000 cc = 2
+cfebra 2.000000 cc = 2
+cfebr nan cc = 3
+cfebra nan cc = 3
+cfebr inf cc = 3
+cfebra inf cc = 3
+......f32 -> i64
+cgebr 0.000000 cc = 0
+cgebra 0.000000 cc = 0
+cgebr -1.000000 cc = 1
+cgebra -1.000000 cc = 1
+cgebr 2.000000 cc = 2
+cgebra 2.000000 cc = 2
+cgebr nan cc = 3
+cgebra nan cc = 3
+cgebr inf cc = 3
+cgebra inf cc = 3
+......f64 -> i32
+cfdbr 0.000000 cc = 0
+cfdbra 0.000000 cc = 0
+cfdbr -1.000000 cc = 1
+cfdbra -1.000000 cc = 1
+cfdbr 2.000000 cc = 2
+cfdbra 2.000000 cc = 2
+cfdbr nan cc = 3
+cfdbra nan cc = 3
+cfdbr inf cc = 3
+cfdbra inf cc = 3
+......f64 -> i64
+cgdbr 0.000000 cc = 0
+cgdbra 0.000000 cc = 0
+cgdbr -1.000000 cc = 1
+cgdbra -1.000000 cc = 1
+cgdbr 2.000000 cc = 2
+cgdbra 2.000000 cc = 2
+cgdbr nan cc = 3
+cgdbra nan cc = 3
+cgdbr inf cc = 3
+cgdbra inf cc = 3
+......f128 -> i32
+cfxbr 0.000000 cc = 0
+cfxbra 0.000000 cc = 0
+cfxbr -1.000000 cc = 1
+cfxbra -1.000000 cc = 1
+cfxbr 2.000000 cc = 2
+cfxbra 2.000000 cc = 2
+cfxbr nan cc = 3
+cfxbra nan cc = 3
+cfxbr inf cc = 3
+cfxbra inf cc = 3
+......f128 -> i64
+cgxbr 0.000000 cc = 0
+cgxbra 0.000000 cc = 0
+cgxbr -1.000000 cc = 1
+cgxbra -1.000000 cc = 1
+cgxbr 2.000000 cc = 2
+cgxbra 2.000000 cc = 2
+cgxbr nan cc = 3
+cgxbra nan cc = 3
+cgxbr inf cc = 3
+cgxbra inf cc = 3
+...setting FPC rounding mode to [-> prepare-short]
+......f32 -> i32
+cfebr 0.000000 cc = 0
+cfebra 0.000000 cc = 0
+cfebr -1.000000 cc = 1
+cfebra -1.000000 cc = 1
+cfebr 2.000000 cc = 2
+cfebra 2.000000 cc = 2
+cfebr nan cc = 3
+cfebra nan cc = 3
+cfebr inf cc = 3
+cfebra inf cc = 3
+......f32 -> i64
+cgebr 0.000000 cc = 0
+cgebra 0.000000 cc = 0
+cgebr -1.000000 cc = 1
+cgebra -1.000000 cc = 1
+cgebr 2.000000 cc = 2
+cgebra 2.000000 cc = 2
+cgebr nan cc = 3
+cgebra nan cc = 3
+cgebr inf cc = 3
+cgebra inf cc = 3
+......f64 -> i32
+cfdbr 0.000000 cc = 0
+cfdbra 0.000000 cc = 0
+cfdbr -1.000000 cc = 1
+cfdbra -1.000000 cc = 1
+cfdbr 2.000000 cc = 2
+cfdbra 2.000000 cc = 2
+cfdbr nan cc = 3
+cfdbra nan cc = 3
+cfdbr inf cc = 3
+cfdbra inf cc = 3
+......f64 -> i64
+cgdbr 0.000000 cc = 0
+cgdbra 0.000000 cc = 0
+cgdbr -1.000000 cc = 1
+cgdbra -1.000000 cc = 1
+cgdbr 2.000000 cc = 2
+cgdbra 2.000000 cc = 2
+cgdbr nan cc = 3
+cgdbra nan cc = 3
+cgdbr inf cc = 3
+cgdbra inf cc = 3
+......f128 -> i32
+cfxbr 0.000000 cc = 0
+cfxbra 0.000000 cc = 0
+cfxbr -1.000000 cc = 1
+cfxbra -1.000000 cc = 1
+cfxbr 2.000000 cc = 2
+cfxbra 2.000000 cc = 2
+cfxbr nan cc = 3
+cfxbra nan cc = 3
+cfxbr inf cc = 3
+cfxbra inf cc = 3
+......f128 -> i64
+cgxbr 0.000000 cc = 0
+cgxbra 0.000000 cc = 0
+cgxbr -1.000000 cc = 1
+cgxbra -1.000000 cc = 1
+cgxbr 2.000000 cc = 2
+cgxbra 2.000000 cc = 2
+cgxbr nan cc = 3
+cgxbra nan cc = 3
+cgxbr inf cc = 3
+cgxbra inf cc = 3
+Rounding as 'per M3'
+...setting M3 rounding mode to [-> near away]
+......f32 -> i32
+cfebr 0.000000 cc = 0
+cfebra 0.000000 cc = 0
+cfebr -1.000000 cc = 1
+cfebra -1.000000 cc = 1
+cfebr 2.000000 cc = 2
+cfebra 2.000000 cc = 2
+cfebr nan cc = 3
+cfebra nan cc = 3
+cfebr inf cc = 3
+cfebra inf cc = 3
+......f32 -> i64
+cgebr 0.000000 cc = 0
+cgebra 0.000000 cc = 0
+cgebr -1.000000 cc = 1
+cgebra -1.000000 cc = 1
+cgebr 2.000000 cc = 2
+cgebra 2.000000 cc = 2
+cgebr nan cc = 3
+cgebra nan cc = 3
+cgebr inf cc = 3
+cgebra inf cc = 3
+......f64 -> i32
+cfdbr 0.000000 cc = 0
+cfdbra 0.000000 cc = 0
+cfdbr -1.000000 cc = 1
+cfdbra -1.000000 cc = 1
+cfdbr 2.000000 cc = 2
+cfdbra 2.000000 cc = 2
+cfdbr nan cc = 3
+cfdbra nan cc = 3
+cfdbr inf cc = 3
+cfdbra inf cc = 3
+......f64 -> i64
+cgdbr 0.000000 cc = 0
+cgdbra 0.000000 cc = 0
+cgdbr -1.000000 cc = 1
+cgdbra -1.000000 cc = 1
+cgdbr 2.000000 cc = 2
+cgdbra 2.000000 cc = 2
+cgdbr nan cc = 3
+cgdbra nan cc = 3
+cgdbr inf cc = 3
+cgdbra inf cc = 3
+......f128 -> i32
+cfxbr 0.000000 cc = 0
+cfxbra 0.000000 cc = 0
+cfxbr -1.000000 cc = 1
+cfxbra -1.000000 cc = 1
+cfxbr 2.000000 cc = 2
+cfxbra 2.000000 cc = 2
+cfxbr nan cc = 3
+cfxbra nan cc = 3
+cfxbr inf cc = 3
+cfxbra inf cc = 3
+......f128 -> i64
+cgxbr 0.000000 cc = 0
+cgxbra 0.000000 cc = 0
+cgxbr -1.000000 cc = 1
+cgxbra -1.000000 cc = 1
+cgxbr 2.000000 cc = 2
+cgxbra 2.000000 cc = 2
+cgxbr nan cc = 3
+cgxbra nan cc = 3
+cgxbr inf cc = 3
+cgxbra inf cc = 3
+...setting M3 rounding mode to [-> prepare-short]
+......f32 -> i32
+cfebr 0.000000 cc = 0
+cfebra 0.000000 cc = 0
+cfebr -1.000000 cc = 1
+cfebra -1.000000 cc = 1
+cfebr 2.000000 cc = 2
+cfebra 2.000000 cc = 2
+cfebr nan cc = 3
+cfebra nan cc = 3
+cfebr inf cc = 3
+cfebra inf cc = 3
+......f32 -> i64
+cgebr 0.000000 cc = 0
+cgebra 0.000000 cc = 0
+cgebr -1.000000 cc = 1
+cgebra -1.000000 cc = 1
+cgebr 2.000000 cc = 2
+cgebra 2.000000 cc = 2
+cgebr nan cc = 3
+cgebra nan cc = 3
+cgebr inf cc = 3
+cgebra inf cc = 3
+......f64 -> i32
+cfdbr 0.000000 cc = 0
+cfdbra 0.000000 cc = 0
+cfdbr -1.000000 cc = 1
+cfdbra -1.000000 cc = 1
+cfdbr 2.000000 cc = 2
+cfdbra 2.000000 cc = 2
+cfdbr nan cc = 3
+cfdbra nan cc = 3
+cfdbr inf cc = 3
+cfdbra inf cc = 3
+......f64 -> i64
+cgdbr 0.000000 cc = 0
+cgdbra 0.000000 cc = 0
+cgdbr -1.000000 cc = 1
+cgdbra -1.000000 cc = 1
+cgdbr 2.000000 cc = 2
+cgdbra 2.000000 cc = 2
+cgdbr nan cc = 3
+cgdbra nan cc = 3
+cgdbr inf cc = 3
+cgdbra inf cc = 3
+......f128 -> i32
+cfxbr 0.000000 cc = 0
+cfxbra 0.000000 cc = 0
+cfxbr -1.000000 cc = 1
+cfxbra -1.000000 cc = 1
+cfxbr 2.000000 cc = 2
+cfxbra 2.000000 cc = 2
+cfxbr nan cc = 3
+cfxbra nan cc = 3
+cfxbr inf cc = 3
+cfxbra inf cc = 3
+......f128 -> i64
+cgxbr 0.000000 cc = 0
+cgxbra 0.000000 cc = 0
+cgxbr -1.000000 cc = 1
+cgxbra -1.000000 cc = 1
+cgxbr 2.000000 cc = 2
+cgxbra 2.000000 cc = 2
+cgxbr nan cc = 3
+cgxbra nan cc = 3
+cgxbr inf cc = 3
+cgxbra inf cc = 3
+...setting M3 rounding mode to [-> near away]
+......f32 -> i32
+cfebr 0.000000 cc = 0
+cfebra 0.000000 cc = 0
+cfebr -1.000000 cc = 1
+cfebra -1.000000 cc = 1
+cfebr 2.000000 cc = 2
+cfebra 2.000000 cc = 2
+cfebr nan cc = 3
+cfebra nan cc = 3
+cfebr inf cc = 3
+cfebra inf cc = 3
+......f32 -> i64
+cgebr 0.000000 cc = 0
+cgebra 0.000000 cc = 0
+cgebr -1.000000 cc = 1
+cgebra -1.000000 cc = 1
+cgebr 2.000000 cc = 2
+cgebra 2.000000 cc = 2
+cgebr nan cc = 3
+cgebra nan cc = 3
+cgebr inf cc = 3
+cgebra inf cc = 3
+......f64 -> i32
+cfdbr 0.000000 cc = 0
+cfdbra 0.000000 cc = 0
+cfdbr -1.000000 cc = 1
+cfdbra -1.000000 cc = 1
+cfdbr 2.000000 cc = 2
+cfdbra 2.000000 cc = 2
+cfdbr nan cc = 3
+cfdbra nan cc = 3
+cfdbr inf cc = 3
+cfdbra inf cc = 3
+......f64 -> i64
+cgdbr 0.000000 cc = 0
+cgdbra 0.000000 cc = 0
+cgdbr -1.000000 cc = 1
+cgdbra -1.000000 cc = 1
+cgdbr 2.000000 cc = 2
+cgdbra 2.000000 cc = 2
+cgdbr nan cc = 3
+cgdbra nan cc = 3
+cgdbr inf cc = 3
+cgdbra inf cc = 3
+......f128 -> i32
+cfxbr 0.000000 cc = 0
+cfxbra 0.000000 cc = 0
+cfxbr -1.000000 cc = 1
+cfxbra -1.000000 cc = 1
+cfxbr 2.000000 cc = 2
+cfxbra 2.000000 cc = 2
+cfxbr nan cc = 3
+cfxbra nan cc = 3
+cfxbr inf cc = 3
+cfxbra inf cc = 3
+......f128 -> i64
+cgxbr 0.000000 cc = 0
+cgxbra 0.000000 cc = 0
+cgxbr -1.000000 cc = 1
+cgxbra -1.000000 cc = 1
+cgxbr 2.000000 cc = 2
+cgxbra 2.000000 cc = 2
+cgxbr nan cc = 3
+cgxbra nan cc = 3
+cgxbr inf cc = 3
+cgxbra inf cc = 3
+...setting M3 rounding mode to [-> zero]
+......f32 -> i32
+cfebr 0.000000 cc = 0
+cfebra 0.000000 cc = 0
+cfebr -1.000000 cc = 1
+cfebra -1.000000 cc = 1
+cfebr 2.000000 cc = 2
+cfebra 2.000000 cc = 2
+cfebr nan cc = 3
+cfebra nan cc = 3
+cfebr inf cc = 3
+cfebra inf cc = 3
+......f32 -> i64
+cgebr 0.000000 cc = 0
+cgebra 0.000000 cc = 0
+cgebr -1.000000 cc = 1
+cgebra -1.000000 cc = 1
+cgebr 2.000000 cc = 2
+cgebra 2.000000 cc = 2
+cgebr nan cc = 3
+cgebra nan cc = 3
+cgebr inf cc = 3
+cgebra inf cc = 3
+......f64 -> i32
+cfdbr 0.000000 cc = 0
+cfdbra 0.000000 cc = 0
+cfdbr -1.000000 cc = 1
+cfdbra -1.000000 cc = 1
+cfdbr 2.000000 cc = 2
+cfdbra 2.000000 cc = 2
+cfdbr nan cc = 3
+cfdbra nan cc = 3
+cfdbr inf cc = 3
+cfdbra inf cc = 3
+......f64 -> i64
+cgdbr 0.000000 cc = 0
+cgdbra 0.000000 cc = 0
+cgdbr -1.000000 cc = 1
+cgdbra -1.000000 cc = 1
+cgdbr 2.000000 cc = 2
+cgdbra 2.000000 cc = 2
+cgdbr nan cc = 3
+cgdbra nan cc = 3
+cgdbr inf cc = 3
+cgdbra inf cc = 3
+......f128 -> i32
+cfxbr 0.000000 cc = 0
+cfxbra 0.000000 cc = 0
+cfxbr -1.000000 cc = 1
+cfxbra -1.000000 cc = 1
+cfxbr 2.000000 cc = 2
+cfxbra 2.000000 cc = 2
+cfxbr nan cc = 3
+cfxbra nan cc = 3
+cfxbr inf cc = 3
+cfxbra inf cc = 3
+......f128 -> i64
+cgxbr 0.000000 cc = 0
+cgxbra 0.000000 cc = 0
+cgxbr -1.000000 cc = 1
+cgxbra -1.000000 cc = 1
+cgxbr 2.000000 cc = 2
+cgxbra 2.000000 cc = 2
+cgxbr nan cc = 3
+cgxbra nan cc = 3
+cgxbr inf cc = 3
+cgxbra inf cc = 3
+...setting M3 rounding mode to [-> +inf]
+......f32 -> i32
+cfebr 0.000000 cc = 0
+cfebra 0.000000 cc = 0
+cfebr -1.000000 cc = 1
+cfebra -1.000000 cc = 1
+cfebr 2.000000 cc = 2
+cfebra 2.000000 cc = 2
+cfebr nan cc = 3
+cfebra nan cc = 3
+cfebr inf cc = 3
+cfebra inf cc = 3
+......f32 -> i64
+cgebr 0.000000 cc = 0
+cgebra 0.000000 cc = 0
+cgebr -1.000000 cc = 1
+cgebra -1.000000 cc = 1
+cgebr 2.000000 cc = 2
+cgebra 2.000000 cc = 2
+cgebr nan cc = 3
+cgebra nan cc = 3
+cgebr inf cc = 3
+cgebra inf cc = 3
+......f64 -> i32
+cfdbr 0.000000 cc = 0
+cfdbra 0.000000 cc = 0
+cfdbr -1.000000 cc = 1
+cfdbra -1.000000 cc = 1
+cfdbr 2.000000 cc = 2
+cfdbra 2.000000 cc = 2
+cfdbr nan cc = 3
+cfdbra nan cc = 3
+cfdbr inf cc = 3
+cfdbra inf cc = 3
+......f64 -> i64
+cgdbr 0.000000 cc = 0
+cgdbra 0.000000 cc = 0
+cgdbr -1.000000 cc = 1
+cgdbra -1.000000 cc = 1
+cgdbr 2.000000 cc = 2
+cgdbra 2.000000 cc = 2
+cgdbr nan cc = 3
+cgdbra nan cc = 3
+cgdbr inf cc = 3
+cgdbra inf cc = 3
+......f128 -> i32
+cfxbr 0.000000 cc = 0
+cfxbra 0.000000 cc = 0
+cfxbr -1.000000 cc = 1
+cfxbra -1.000000 cc = 1
+cfxbr 2.000000 cc = 2
+cfxbra 2.000000 cc = 2
+cfxbr nan cc = 3
+cfxbra nan cc = 3
+cfxbr inf cc = 3
+cfxbra inf cc = 3
+......f128 -> i64
+cgxbr 0.000000 cc = 0
+cgxbra 0.000000 cc = 0
+cgxbr -1.000000 cc = 1
+cgxbra -1.000000 cc = 1
+cgxbr 2.000000 cc = 2
+cgxbra 2.000000 cc = 2
+cgxbr nan cc = 3
+cgxbra nan cc = 3
+cgxbr inf cc = 3
+cgxbra inf cc = 3
+...setting M3 rounding mode to [-> -inf]
+......f32 -> i32
+cfebr 0.000000 cc = 0
+cfebra 0.000000 cc = 0
+cfebr -1.000000 cc = 1
+cfebra -1.000000 cc = 1
+cfebr 2.000000 cc = 2
+cfebra 2.000000 cc = 2
+cfebr nan cc = 3
+cfebra nan cc = 3
+cfebr inf cc = 3
+cfebra inf cc = 3
+......f32 -> i64
+cgebr 0.000000 cc = 0
+cgebra 0.000000 cc = 0
+cgebr -1.000000 cc = 1
+cgebra -1.000000 cc = 1
+cgebr 2.000000 cc = 2
+cgebra 2.000000 cc = 2
+cgebr nan cc = 3
+cgebra nan cc = 3
+cgebr inf cc = 3
+cgebra inf cc = 3
+......f64 -> i32
+cfdbr 0.000000 cc = 0
+cfdbra 0.000000 cc = 0
+cfdbr -1.000000 cc = 1
+cfdbra -1.000000 cc = 1
+cfdbr 2.000000 cc = 2
+cfdbra 2.000000 cc = 2
+cfdbr nan cc = 3
+cfdbra nan cc = 3
+cfdbr inf cc = 3
+cfdbra inf cc = 3
+......f64 -> i64
+cgdbr 0.000000 cc = 0
+cgdbra 0.000000 cc = 0
+cgdbr -1.000000 cc = 1
+cgdbra -1.000000 cc = 1
+cgdbr 2.000000 cc = 2
+cgdbra 2.000000 cc = 2
+cgdbr nan cc = 3
+cgdbra nan cc = 3
+cgdbr inf cc = 3
+cgdbra inf cc = 3
+......f128 -> i32
+cfxbr 0.000000 cc = 0
+cfxbra 0.000000 cc = 0
+cfxbr -1.000000 cc = 1
+cfxbra -1.000000 cc = 1
+cfxbr 2.000000 cc = 2
+cfxbra 2.000000 cc = 2
+cfxbr nan cc = 3
+cfxbra nan cc = 3
+cfxbr inf cc = 3
+cfxbra inf cc = 3
+......f128 -> i64
+cgxbr 0.000000 cc = 0
+cgxbra 0.000000 cc = 0
+cgxbr -1.000000 cc = 1
+cgxbra -1.000000 cc = 1
+cgxbr 2.000000 cc = 2
+cgxbra 2.000000 cc = 2
+cgxbr nan cc = 3
+cgxbra nan cc = 3
+cgxbr inf cc = 3
+cgxbra inf cc = 3
diff --git a/none/tests/s390x/bfp-convert.vgtest b/none/tests/s390x/bfp-convert.vgtest
new file mode 100644
index 0000000000..11cd11c527
--- /dev/null
+++ b/none/tests/s390x/bfp-convert.vgtest
@@ -0,0 +1,2 @@
+prog: bfp-convert
+prereq: ../../../tests/s390x_features s390x-fpext
diff --git a/none/tests/s390x/bfp-emit.pl b/none/tests/s390x/bfp-emit.pl
new file mode 100755
index 0000000000..6604497137
--- /dev/null
+++ b/none/tests/s390x/bfp-emit.pl
@@ -0,0 +1,472 @@
+#!/usr/bin/env perl
+
+#--------------------------------------------------------------------
+# For a subset of the available BFP insns the following is true:
+#
+# For a BFP insn X in the guest code the very same insn will be
+# emitted in the jitted code.
+#
+# This is because IR optimisers do not touch floating point IROps.
+# Meaning: if we can show that for insn X the same insn X is emitted
+# we do not need to proof read results of floating point computations.
+# Exceptions are: checking order of operands for non-commutative
+# operators and condition code computation. This is done elsewhere.
+#
+# Here we do the following:
+# Craft a tiny program using insns X. Run valgrind on it, trace IR
+# generation and assembly. Check the output making sure that insn X
+# appears once in the "Frontend" section and once in the "Assembly"
+# section.
+#
+# Below is a complete list of all BFP insns as of SA22-7832-14.
+#--------------------------------------------------------------------
+
+use strict;
+use warnings;
+use Cwd 'abs_path';
+
+my $rootdir = get_rootdir();
+my $runone = "$rootdir/auxprogs/s390-runone";
+my $valgrind = "$rootdir/vg-in-place";
+my $valargs = "-q --tool=none --trace-notbelow=0 --trace-flags=10000001";
+
+
+# Instructions that are always mapped independent of any rounding mode
+# or whatever.
+my %insn_map = (
+ # l[cnp]dfr cannot be disinguished from l[cnp]dbr because they
+ # use the same IROp.
+ "lcdfr" => "lcdbr",
+ "lndfr" => "lndbr",
+ "lpdfr" => "lpdbr",
+
+ # The "and signal" part is currently ignored
+ "kebr" => "cebr",
+ "kdbr" => "cdbr",
+ "kxbr" => "cxbr",
+
+ # c[fg][edx]br and c[fg][edx]bra differ only in the presence of an m4
+ # field. That field cannot be represented in VEX IR and is therefore
+ # ignored and assumed to be zero.
+ "cfebra" => "cfebr",
+ "cfdbra" => "cfdbr",
+ "cfxbra" => "cfxbr",
+ "cgebra" => "cgebr",
+ "cgdbra" => "cgdbr",
+ "cgxbra" => "cgxbr",
+
+ # cdfbra 32-bit int --> 64-bit BFP Iop_I32StoF64 has no rounding
+ # cxfbra 32-bit int --> 128-bit BFP Iop_I32StoF128 has no rounding mode
+ # cxgbra 64-bit int --> 128-bit BFP Iop_I64StoF128 has no rounding mode
+ "cdfbra" => "cdfbr",
+ "cxfbra" => "cxfbr",
+ "cxgbra" => "cxgbr",
+
+ # fi[edx]br and fi[edx]bra differ only in the presence of an m4 field.
+ # That field cannot be represented in VEX IR and is therefore ignored
+ # and assumed to be zero.
+ "fiebra" => "fiebr",
+ "fidbra" => "fidbr",
+ "fixbra" => "fixbr",
+);
+
+&main;
+
+sub main
+{
+ #-----------------------------------------------------------------------
+ # POP Chapter 9: Floating-Point Overview and Support Instructions
+ #-----------------------------------------------------------------------
+
+ # CONVERT BFP TO HFP not implemented
+ # CONVERT HFP TO BFP not implemented
+ # COPY SIGN insn not mapped one-to-one
+ # EXTRACT FPC just guest state access
+ # LOAD just guest state access
+
+ header("LOAD COMPLEMENT");
+ test_insn("lcdfr %f0,%f1", \&mapper);
+
+ # LOAD FPC just guest state access
+ # LOAD FPC AND SIGNAL not implemented
+
+ header("LOAD FPR FROM GR");
+ test_insn("ldgr %f0,%r1");
+
+ header("LOAD GR FROM FPR");
+ test_insn("lgdr %r0,%f1");
+
+ header("LOAD NEGATIVE");
+ test_insn("lndfr %f0,%f1", \&mapper);
+
+ header("LOAD POSITIVE");
+ test_insn("lpdfr %f0,%f1", \&mapper);
+
+ header("LOAD ZERO");
+ test_insn("lzer %f0");
+ test_insn("lzdr %f0");
+ # test_insn("lzxr %f0") insn not mapped one-to-one
+
+ # PFPO insn not mapped one-to-one
+ # SET BFP ROUNDING MODE insn not mapped one-to-one
+ # SET DFP ROUNDING MODE insn not mapped one-to-one
+ # SET FPC just guest state access
+ # SET FPC AND SIGNAL not implemented
+ # STORE insn not mapped one-to-one
+ # STORE FPC just store + guest state access
+
+ #----------------------------------------------------------------------
+ # POP Chapter 19: Binary-Floating-Point Instructions
+ #----------------------------------------------------------------------
+
+ header("ADD");
+ test_insn("aebr %f0,%f1");
+ test_insn("adbr %f0,%f1");
+ test_insn("axbr %f0,%f1");
+
+ header("COMPARE");
+ test_insn("cebr %f0,%f1");
+ test_insn("cdbr %f0,%f1");
+ test_insn("cxbr %f0,%f1");
+
+ header("COMPARE AND SIGNAL");
+ test_insn("kebr %f0,%f1", \&mapper);
+ test_insn("kdbr %f0,%f1", \&mapper);
+ test_insn("kxbr %f0,%f1", \&mapper);
+
+ header("CONVERT FROM FIXED");
+ test_insn("cefbr %f0,%r1");
+ test_insn("cdfbr %f0,%r1");
+ test_insn("cxfbr %f0,%r1");
+ test_insn("cegbr %f0,%r1");
+ test_insn("cdgbr %f0,%r1");
+ test_insn("cxgbr %f0,%r1");
+ foreach my $mode (0, 1, 3, 4, 5, 6, 7)
+ {
+ test_insn("cefbra %f0,$mode,%r1,0", \&mapper);
+ test_insn("cdfbra %f0,$mode,%r1,0", \&mapper);
+ test_insn("cxfbra %f0,$mode,%r1,0", \&mapper);
+ test_insn("cegbra %f0,$mode,%r1,0", \&mapper);
+ test_insn("cdgbra %f0,$mode,%r1,0", \&mapper);
+ test_insn("cxgbra %f0,$mode,%r1,0", \&mapper);
+ }
+
+ header("CONVERT FROM LOGICAL");
+ # cdlfbr 32-bit uint --> 64-bit BFP Iop_I32UtoF64 has no rounding mode
+ # cxlfbr 32-bit uint --> 128-bit BFP Iop_I32UtoF128 has no rounding mode
+ # cxlgbr 64-bit uint --> 128-bit BFP Iop_I64UtoF128 has no rounding mode
+ # For those rounding mode 4 is chosen when emitting.
+ foreach my $mode (0, 1, 3, 4, 5, 6, 7)
+ {
+ test_insn("celfbr %f0,$mode,%r1,0", \&mapper);
+ test_insn("cdlfbr %f0,$mode,%r1,0", \&mapper);
+ test_insn("cxlfbr %f0,$mode,%r1,0", \&mapper);
+ test_insn("celgbr %f0,$mode,%r1,0", \&mapper);
+ test_insn("cdlgbr %f0,$mode,%r1,0", \&mapper);
+ test_insn("cxlgbr %f0,$mode,%r1,0", \&mapper);
+ }
+
+ header("CONVERT TO FIXED");
+ foreach my $mode (0, 1, 3, 4, 5, 6, 7)
+ {
+ test_insn("cfebr %r0,$mode,%f1");
+ test_insn("cfdbr %r0,$mode,%f1");
+ test_insn("cfxbr %r0,$mode,%f1");
+ test_insn("cgebr %r0,$mode,%f1");
+ test_insn("cgdbr %r0,$mode,%f1");
+ test_insn("cgxbr %r0,$mode,%f1");
+ }
+ foreach my $mode (0, 1, 3, 4, 5, 6, 7)
+ {
+ test_insn("cfebra %r0,$mode,%f1,0", \&mapper);
+ test_insn("cfdbra %r0,$mode,%f1,0", \&mapper);
+ test_insn("cfxbra %r0,$mode,%f1,0", \&mapper);
+ test_insn("cgebra %r0,$mode,%f1,0", \&mapper);
+ test_insn("cgdbra %r0,$mode,%f1,0", \&mapper);
+ test_insn("cgxbra %r0,$mode,%f1,0", \&mapper);
+ }
+
+ header("CONVERT TO LOGICAL");
+ foreach my $mode (0, 1, 3, 4, 5, 6, 7)
+ {
+ test_insn("clfebr %r0,$mode,%f1,0");
+ test_insn("clfdbr %r0,$mode,%f1,0");
+ test_insn("clfxbr %r0,$mode,%f1,0");
+ test_insn("clgebr %r0,$mode,%f1,0");
+ test_insn("clgdbr %r0,$mode,%f1,0");
+ test_insn("clgxbr %r0,$mode,%f1,0");
+ }
+
+ header("DIVIDE");
+ test_insn("debr %f0,%f1");
+ test_insn("ddbr %f0,%f1");
+ test_insn("dxbr %f0,%f1");
+
+ # echo "DIVIDE TO INTEGER" not implemented
+ # echo "LOAD AND TEST" insn not mapped one-to-one
+
+ header("LOAD COMPLEMENT");
+ test_insn("lcebr %f0,%f1");
+ test_insn("lcdbr %f0,%f1");
+ test_insn("lcxbr %f0,%f1");
+
+ header("LOAD FP INTEGER");
+ foreach my $mode (0, 1, 3, 4, 5, 6, 7)
+ {
+ test_insn("fiebr %f0,$mode,%f1");
+ test_insn("fidbr %f0,$mode,%f1");
+ test_insn("fixbr %f0,$mode,%f1");
+ }
+ foreach my $mode (0, 1, 3, 4, 5, 6, 7)
+ {
+ test_insn("fiebra %f0,$mode,%f1,0", \&mapper);
+ test_insn("fidbra %f0,$mode,%f1,0", \&mapper);
+ test_insn("fixbra %f0,$mode,%f1,0", \&mapper);
+ }
+
+ header("LOAD LENGTHENED");
+ test_insn("ldebr %f0,%f1");
+ test_insn("lxdbr %f0,%f1");
+ test_insn("lxebr %f0,%f1");
+
+ header("LOAD NEGATIVE");
+ test_insn("lnebr %f0,%f1");
+ test_insn("lndbr %f0,%f1");
+ #test_insn("lnxbr %f0,%f1"); insn not mapped one-to-one
+
+ header("LOAD POSITIVE");
+ test_insn("lpebr %f0,%f1");
+ test_insn("lpdbr %f0,%f1");
+ test_insn("lpxbr %f0,%f1");
+
+ header("LOAD ROUNDED");
+ test_insn("ledbr %f0,%f1");
+ test_insn("ldxbr %f0,%f1");
+ test_insn("lexbr %f0,%f1");
+ foreach my $mode (0, 1, 3, 4, 5, 6, 7)
+ {
+ test_insn("ledbra %f0,$mode,%f1,0", \&mapper);
+ test_insn("ldxbra %f0,$mode,%f1,0", \&mapper);
+ test_insn("lexbra %f0,$mode,%f1,0", \&mapper);
+ }
+
+ header("MULTIPLY");
+ test_insn("meebr %f0,%f1");
+ test_insn("mdbr %f0,%f1");
+ test_insn("mxbr %f0,%f1");
+ # mdebr not implemented
+ # mxdbr not implemented
+
+ header("MULTIPLY AND ADD");
+ test_insn("maebr %f0,%f1,%f2");
+ test_insn("madbr %f0,%f1,%f2");
+
+ header("MULTIPLY AND SUBTRACT");
+ test_insn("msebr %f0,%f1,%f2");
+ test_insn("msdbr %f0,%f1,%f2");
+
+ header("SQUARE ROOT");
+ test_insn("sqebr %f0,%f1");
+ test_insn("sqdbr %f0,%f1");
+ test_insn("sqxbr %f0,%f1");
+
+ header("SUBTRACT");
+ test_insn("sebr %f0,%f1");
+ test_insn("sdbr %f0,%f1");
+ test_insn("sxbr %f0,%f1");
+
+ # TEST DATA CLASS insn not mapped one-to-one
+ exit 0;
+}
+
+sub mapper
+{
+ my ($mnm, @opnds) = @_;
+
+ my $mapped = $insn_map{$mnm};
+ if ($mapped) {
+ return $mapped;
+ }
+
+ $mapped = $mnm;
+ if ($opnds[1] eq "0") {
+ if ($mnm eq "cefbra" ||
+ $mnm eq "cegbra" || $mnm eq "cdgbra" ||
+ $mnm eq "ledbra" || $mnm eq "ldxbra" || $mnm eq "lexbra") {
+ $mapped =~ s/a//;
+ }
+ }
+ return $mapped;
+}
+
+sub test_insn
+{
+ my ($insn) = @_;
+ my ($mnm, @opnds) = disect_insn($insn);
+ print "Testing: $insn\n";
+
+ my $exe = "xxbfp-$mnm";
+ my $cfile = "$exe.c";
+
+ # Create template
+ `$runone --template --insn=\"$insn\" > $cfile`;
+
+ # Compile
+ my $stderr = `$runone --build $cfile 2>&1`;
+ if ($? != 0) {
+ error("runone failed\n$stderr");
+ return;
+ }
+
+ # Run valgrind
+ my $stdout = `$valgrind $valargs ./$exe 2>&1`;
+
+ # Parse the output from valgrind
+ # Need to find the "interesting" insns in the stream. There is exactly
+ # one such insn in the "frontend" part and in the "assembly" part.
+ #
+ # Let
+ # - U be the unmodified mnemonic
+ # - M be the mapped mnemonic
+ # - F be the mnemonic in the "frontend" section
+ # - A be the mnemonic in the "frontend" section
+ #
+ # There are 4 cases to distinguish:
+ # 1) F == U and A == U e.g aebr
+ # 2) F == U and A == M e.g. kebr (F == kebr , A == cebr)
+ # 3) F == M and A == U does not occur
+ # 4) F == M and A == M e.g. cefbra with rounding mode == 0 --> cefbr
+ #
+ my $mapped = $mnm;
+ if (scalar @_ == 2) {
+ my $mapfunc = $_[1];
+ $mapped = $mapfunc->($mnm, @opnds);
+ }
+
+ my $U = $mnm;
+ my $M = $mapped;
+
+ my $output = "";
+ my $in_frontend = 0;
+ my $in_assembly = 0;
+ my $frontend_insn = "";
+ my $assembly_insn = "";
+ my @lines = split /\n/,$stdout;
+ for my $line (@lines) {
+ if ($line =~ /Front end/) {
+ $in_frontend = 1;
+# $output .= "$line\n";
+ next;
+ } elsif ($line =~ /Assembly/) {
+ $in_frontend = 0;
+ $in_assembly = 1;
+# $output .= "$line\n";
+ next;
+ }
+ if ($in_frontend) {
+ # insns begin in column #1 and are in lower case
+ if ($line =~ /^[a-z]/) {
+ my $F = $line;
+ $F =~ s/\s.*//;
+ if ($F eq $U || $F eq $M) {
+ $output .= "Frontend: $line\n";
+ }
+ }
+ next;
+ }
+ if ($in_assembly) {
+ # Skip v-insns
+ next if ($line =~ /^v-/);
+ # insns begin in column #1 and are in lower case
+ if ($line =~ /^[a-z]/) {
+ my $A = $line;
+ $A =~ s/\s.*//;
+ if ($A eq $U || $A eq $M) {
+ $output .= "Assembly: $line\n";
+ }
+ }
+ next;
+ }
+ }
+ print "$output";
+
+ # Check result
+ my $rc = check_valgrind_output($mnm, $output);
+
+ # Remove files
+ if ($rc == 0) {
+ unlink ($exe, $cfile, "$exe.s", "$exe.s.orig");
+ }
+}
+
+sub check_valgrind_output
+{
+ my ($mnm, $stdout) = @_;
+
+ my @lines = split /\n/,$stdout;
+ my $num_lines = scalar @lines;
+
+ if ($num_lines != 2) {
+ error("$mnm: Expected 2 lines; found $num_lines");
+ for my $line (@lines) {
+ print "LINE |$line|\n";
+ }
+ return 1;
+ }
+ if ($lines[0] !~ "Frontend") {
+ error("$mnm: Unrecognised line |$lines[0]|");
+ return 1;
+ }
+ if ($lines[1] !~ "Assembly") {
+ error("$mnm: Unrecognised line |$lines[1]|");
+ return 1;
+ }
+ return 0;
+}
+
+sub disect_insn
+{
+ my ($insn) = @_;
+ my ($mnm, $opnd_string) = ($insn, "");
+
+ if ($insn =~ /^([a-zA-Z][a-zA-A0-9]*)\s+(.*)$/) {
+ $mnm = $1;
+ $opnd_string = $2;
+ }
+
+ my @opnds = split /\s*,\s*/, $opnd_string;
+
+ return ($mnm, @opnds);
+}
+
+sub get_rootdir
+{
+ my $dir = ".";
+ while (abs_path($dir) ne "/") {
+ if (-e "$dir/AUTHORS") {
+ return abs_path($dir);
+ }
+ $dir = "$dir/..";
+ }
+ fatal("Coud not determine root directory. \"AUTHORS\" file not found\n");
+}
+
+sub header
+{
+ my ($txt) = @_;
+
+ print "============================================================\n";
+ print "$txt\n";
+ print "============================================================\n";
+}
+
+sub error
+{
+ print STDERR "*** $_[0]\n";
+}
+
+sub fatal
+{
+ error($_[0]);
+ exit 1;
+}
diff --git a/none/tests/s390x/bfp-emit.post.exp b/none/tests/s390x/bfp-emit.post.exp
new file mode 100644
index 0000000000..b0a9ab36f0
--- /dev/null
+++ b/none/tests/s390x/bfp-emit.post.exp
@@ -0,0 +1,1050 @@
+============================================================
+LOAD COMPLEMENT
+============================================================
+Testing: lcdfr %f0,%f1
+Frontend: lcdfr %f0,%f1
+Assembly: lcdbr %f6,%f7
+============================================================
+LOAD FPR FROM GR
+============================================================
+Testing: ldgr %f0,%r1
+Frontend: ldgr %f0,%r1
+Assembly: ldgr %f7,%r5
+============================================================
+LOAD GR FROM FPR
+============================================================
+Testing: lgdr %r0,%f1
+Frontend: lgdr %r0,%f1
+Assembly: lgdr %r5,%f7
+============================================================
+LOAD NEGATIVE
+============================================================
+Testing: lndfr %f0,%f1
+Frontend: lndfr %f0,%f1
+Assembly: lndbr %f6,%f7
+============================================================
+LOAD POSITIVE
+============================================================
+Testing: lpdfr %f0,%f1
+Frontend: lpdfr %f0,%f1
+Assembly: lpdbr %f6,%f7
+============================================================
+LOAD ZERO
+============================================================
+Testing: lzer %f0
+Frontend: lzer %f0
+Assembly: lzer %f7
+Testing: lzdr %f0
+Frontend: lzdr %f0
+Assembly: lzdr %f7
+============================================================
+ADD
+============================================================
+Testing: aebr %f0,%f1
+Frontend: aebr %f0,%f1
+Assembly: aebr %f7,%f6
+Testing: adbr %f0,%f1
+Frontend: adbr %f0,%f1
+Assembly: adbr %f7,%f6
+Testing: axbr %f0,%f1
+Frontend: axbr %f0,%f1
+Assembly: axbr %f12,%f13
+============================================================
+COMPARE
+============================================================
+Testing: cebr %f0,%f1
+Frontend: cebr %f0,%f1
+Assembly: cebr %f7,%f6
+Testing: cdbr %f0,%f1
+Frontend: cdbr %f0,%f1
+Assembly: cdbr %f7,%f6
+Testing: cxbr %f0,%f1
+Frontend: cxbr %f0,%f1
+Assembly: cxbr %f12,%f13
+============================================================
+COMPARE AND SIGNAL
+============================================================
+Testing: kebr %f0,%f1
+Frontend: kebr %f0,%f1
+Assembly: cebr %f7,%f6
+Testing: kdbr %f0,%f1
+Frontend: kdbr %f0,%f1
+Assembly: cdbr %f7,%f6
+Testing: kxbr %f0,%f1
+Frontend: kxbr %f0,%f1
+Assembly: cxbr %f12,%f13
+============================================================
+CONVERT FROM FIXED
+============================================================
+Testing: cefbr %f0,%r1
+Frontend: cefbr %f0,%r1
+Assembly: cefbr %f7,%r4
+Testing: cdfbr %f0,%r1
+Frontend: cdfbr %f0,%r1
+Assembly: cdfbr %f7,%r5
+Testing: cxfbr %f0,%r1
+Frontend: cxfbr %f0,%r1
+Assembly: cxfbr %f12,%r5
+Testing: cegbr %f0,%r1
+Frontend: cegbr %f0,%r1
+Assembly: cegbr %f7,%r4
+Testing: cdgbr %f0,%r1
+Frontend: cdgbr %f0,%r1
+Assembly: cdgbr %f7,%r4
+Testing: cxgbr %f0,%r1
+Frontend: cxgbr %f0,%r1
+Assembly: cxgbr %f12,%r5
+Testing: cefbra %f0,0,%r1,0
+Frontend: cefbr %f0,%r1
+Assembly: cefbr %f7,%r4
+Testing: cdfbra %f0,0,%r1,0
+Frontend: cdfbr %f0,%r1
+Assembly: cdfbr %f7,%r5
+Testing: cxfbra %f0,0,%r1,0
+Frontend: cxfbr %f0,%r1
+Assembly: cxfbr %f12,%r5
+Testing: cegbra %f0,0,%r1,0
+Frontend: cegbr %f0,%r1
+Assembly: cegbr %f7,%r4
+Testing: cdgbra %f0,0,%r1,0
+Frontend: cdgbr %f0,%r1
+Assembly: cdgbr %f7,%r4
+Testing: cxgbra %f0,0,%r1,0
+Frontend: cxgbr %f0,%r1
+Assembly: cxgbr %f12,%r5
+Testing: cefbra %f0,1,%r1,0
+Frontend: cefbra %f0,1,%r1,0
+Assembly: cefbra %f7,1,%r5,0
+Testing: cdfbra %f0,1,%r1,0
+Frontend: cdfbra %f0,1,%r1,0
+Assembly: cdfbr %f7,%r5
+Testing: cxfbra %f0,1,%r1,0
+Frontend: cxfbra %f0,1,%r1,0
+Assembly: cxfbr %f12,%r5
+Testing: cegbra %f0,1,%r1,0
+Frontend: cegbra %f0,1,%r1,0
+Assembly: cegbra %f7,1,%r5,0
+Testing: cdgbra %f0,1,%r1,0
+Frontend: cdgbra %f0,1,%r1,0
+Assembly: cdgbra %f7,1,%r5,0
+Testing: cxgbra %f0,1,%r1,0
+Frontend: cxgbra %f0,1,%r1,0
+Assembly: cxgbr %f12,%r5
+Testing: cefbra %f0,3,%r1,0
+Frontend: cefbra %f0,3,%r1,0
+Assembly: cefbra %f7,3,%r5,0
+Testing: cdfbra %f0,3,%r1,0
+Frontend: cdfbra %f0,3,%r1,0
+Assembly: cdfbr %f7,%r5
+Testing: cxfbra %f0,3,%r1,0
+Frontend: cxfbra %f0,3,%r1,0
+Assembly: cxfbr %f12,%r5
+Testing: cegbra %f0,3,%r1,0
+Frontend: cegbra %f0,3,%r1,0
+Assembly: cegbra %f7,3,%r5,0
+Testing: cdgbra %f0,3,%r1,0
+Frontend: cdgbra %f0,3,%r1,0
+Assembly: cdgbra %f7,3,%r5,0
+Testing: cxgbra %f0,3,%r1,0
+Frontend: cxgbra %f0,3,%r1,0
+Assembly: cxgbr %f12,%r5
+Testing: cefbra %f0,4,%r1,0
+Frontend: cefbra %f0,4,%r1,0
+Assembly: cefbra %f7,4,%r5,0
+Testing: cdfbra %f0,4,%r1,0
+Frontend: cdfbra %f0,4,%r1,0
+Assembly: cdfbr %f7,%r5
+Testing: cxfbra %f0,4,%r1,0
+Frontend: cxfbra %f0,4,%r1,0
+Assembly: cxfbr %f12,%r5
+Testing: cegbra %f0,4,%r1,0
+Frontend: cegbra %f0,4,%r1,0
+Assembly: cegbra %f7,4,%r5,0
+Testing: cdgbra %f0,4,%r1,0
+Frontend: cdgbra %f0,4,%r1,0
+Assembly: cdgbra %f7,4,%r5,0
+Testing: cxgbra %f0,4,%r1,0
+Frontend: cxgbra %f0,4,%r1,0
+Assembly: cxgbr %f12,%r5
+Testing: cefbra %f0,5,%r1,0
+Frontend: cefbra %f0,5,%r1,0
+Assembly: cefbra %f7,5,%r5,0
+Testing: cdfbra %f0,5,%r1,0
+Frontend: cdfbra %f0,5,%r1,0
+Assembly: cdfbr %f7,%r5
+Testing: cxfbra %f0,5,%r1,0
+Frontend: cxfbra %f0,5,%r1,0
+Assembly: cxfbr %f12,%r5
+Testing: cegbra %f0,5,%r1,0
+Frontend: cegbra %f0,5,%r1,0
+Assembly: cegbra %f7,5,%r5,0
+Testing: cdgbra %f0,5,%r1,0
+Frontend: cdgbra %f0,5,%r1,0
+Assembly: cdgbra %f7,5,%r5,0
+Testing: cxgbra %f0,5,%r1,0
+Frontend: cxgbra %f0,5,%r1,0
+Assembly: cxgbr %f12,%r5
+Testing: cefbra %f0,6,%r1,0
+Frontend: cefbra %f0,6,%r1,0
+Assembly: cefbra %f7,6,%r5,0
+Testing: cdfbra %f0,6,%r1,0
+Frontend: cdfbra %f0,6,%r1,0
+Assembly: cdfbr %f7,%r5
+Testing: cxfbra %f0,6,%r1,0
+Frontend: cxfbra %f0,6,%r1,0
+Assembly: cxfbr %f12,%r5
+Testing: cegbra %f0,6,%r1,0
+Frontend: cegbra %f0,6,%r1,0
+Assembly: cegbra %f7,6,%r5,0
+Testing: cdgbra %f0,6,%r1,0
+Frontend: cdgbra %f0,6,%r1,0
+Assembly: cdgbra %f7,6,%r5,0
+Testing: cxgbra %f0,6,%r1,0
+Frontend: cxgbra %f0,6,%r1,0
+Assembly: cxgbr %f12,%r5
+Testing: cefbra %f0,7,%r1,0
+Frontend: cefbra %f0,7,%r1,0
+Assembly: cefbra %f7,7,%r5,0
+Testing: cdfbra %f0,7,%r1,0
+Frontend: cdfbra %f0,7,%r1,0
+Assembly: cdfbr %f7,%r5
+Testing: cxfbra %f0,7,%r1,0
+Frontend: cxfbra %f0,7,%r1,0
+Assembly: cxfbr %f12,%r5
+Testing: cegbra %f0,7,%r1,0
+Frontend: cegbra %f0,7,%r1,0
+Assembly: cegbra %f7,7,%r5,0
+Testing: cdgbra %f0,7,%r1,0
+Frontend: cdgbra %f0,7,%r1,0
+Assembly: cdgbra %f7,7,%r5,0
+Testing: cxgbra %f0,7,%r1,0
+Frontend: cxgbra %f0,7,%r1,0
+Assembly: cxgbr %f12,%r5
+============================================================
+CONVERT FROM LOGICAL
+============================================================
+Testing: celfbr %f0,0,%r1,0
+Frontend: celfbr %f0,0,%r1,0
+Assembly: celfbr %f7,0,%r4,0
+Testing: cdlfbr %f0,0,%r1,0
+Frontend: cdlfbr %f0,0,%r1,0
+Assembly: cdlfbr %f7,4,%r5,0
+Testing: cxlfbr %f0,0,%r1,0
+Frontend: cxlfbr %f0,0,%r1,0
+Assembly: cxlfbr %f12,4,%r5,0
+Testing: celgbr %f0,0,%r1,0
+Frontend: celgbr %f0,0,%r1,0
+Assembly: celgbr %f7,0,%r4,0
+Testing: cdlgbr %f0,0,%r1,0
+Frontend: cdlgbr %f0,0,%r1,0
+Assembly: cdlgbr %f7,0,%r4,0
+Testing: cxlgbr %f0,0,%r1,0
+Frontend: cxlgbr %f0,0,%r1,0
+Assembly: cxlgbr %f12,4,%r5,0
+Testing: celfbr %f0,1,%r1,0
+Frontend: celfbr %f0,1,%r1,0
+Assembly: celfbr %f7,1,%r5,0
+Testing: cdlfbr %f0,1,%r1,0
+Frontend: cdlfbr %f0,1,%r1,0
+Assembly: cdlfbr %f7,4,%r5,0
+Testing: cxlfbr %f0,1,%r1,0
+Frontend: cxlfbr %f0,1,%r1,0
+Assembly: cxlfbr %f12,4,%r5,0
+Testing: celgbr %f0,1,%r1,0
+Frontend: celgbr %f0,1,%r1,0
+Assembly: celgbr %f7,1,%r5,0
+Testing: cdlgbr %f0,1,%r1,0
+Frontend: cdlgbr %f0,1,%r1,0
+Assembly: cdlgbr %f7,1,%r5,0
+Testing: cxlgbr %f0,1,%r1,0
+Frontend: cxlgbr %f0,1,%r1,0
+Assembly: cxlgbr %f12,4,%r5,0
+Testing: celfbr %f0,3,%r1,0
+Frontend: celfbr %f0,3,%r1,0
+Assembly: celfbr %f7,3,%r5,0
+Testing: cdlfbr %f0,3,%r1,0
+Frontend: cdlfbr %f0,3,%r1,0
+Assembly: cdlfbr %f7,4,%r5,0
+Testing: cxlfbr %f0,3,%r1,0
+Frontend: cxlfbr %f0,3,%r1,0
+Assembly: cxlfbr %f12,4,%r5,0
+Testing: celgbr %f0,3,%r1,0
+Frontend: celgbr %f0,3,%r1,0
+Assembly: celgbr %f7,3,%r5,0
+Testing: cdlgbr %f0,3,%r1,0
+Frontend: cdlgbr %f0,3,%r1,0
+Assembly: cdlgbr %f7,3,%r5,0
+Testing: cxlgbr %f0,3,%r1,0
+Frontend: cxlgbr %f0,3,%r1,0
+Assembly: cxlgbr %f12,4,%r5,0
+Testing: celfbr %f0,4,%r1,0
+Frontend: celfbr %f0,4,%r1,0
+Assembly: celfbr %f7,4,%r5,0
+Testing: cdlfbr %f0,4,%r1,0
+Frontend: cdlfbr %f0,4,%r1,0
+Assembly: cdlfbr %f7,4,%r5,0
+Testing: cxlfbr %f0,4,%r1,0
+Frontend: cxlfbr %f0,4,%r1,0
+Assembly: cxlfbr %f12,4,%r5,0
+Testing: celgbr %f0,4,%r1,0
+Frontend: celgbr %f0,4,%r1,0
+Assembly: celgbr %f7,4,%r5,0
+Testing: cdlgbr %f0,4,%r1,0
+Frontend: cdlgbr %f0,4,%r1,0
+Assembly: cdlgbr %f7,4,%r5,0
+Testing: cxlgbr %f0,4,%r1,0
+Frontend: cxlgbr %f0,4,%r1,0
+Assembly: cxlgbr %f12,4,%r5,0
+Testing: celfbr %f0,5,%r1,0
+Frontend: celfbr %f0,5,%r1,0
+Assembly: celfbr %f7,5,%r5,0
+Testing: cdlfbr %f0,5,%r1,0
+Frontend: cdlfbr %f0,5,%r1,0
+Assembly: cdlfbr %f7,4,%r5,0
+Testing: cxlfbr %f0,5,%r1,0
+Frontend: cxlfbr %f0,5,%r1,0
+Assembly: cxlfbr %f12,4,%r5,0
+Testing: celgbr %f0,5,%r1,0
+Frontend: celgbr %f0,5,%r1,0
+Assembly: celgbr %f7,5,%r5,0
+Testing: cdlgbr %f0,5,%r1,0
+Frontend: cdlgbr %f0,5,%r1,0
+Assembly: cdlgbr %f7,5,%r5,0
+Testing: cxlgbr %f0,5,%r1,0
+Frontend: cxlgbr %f0,5,%r1,0
+Assembly: cxlgbr %f12,4,%r5,0
+Testing: celfbr %f0,6,%r1,0
+Frontend: celfbr %f0,6,%r1,0
+Assembly: celfbr %f7,6,%r5,0
+Testing: cdlfbr %f0,6,%r1,0
+Frontend: cdlfbr %f0,6,%r1,0
+Assembly: cdlfbr %f7,4,%r5,0
+Testing: cxlfbr %f0,6,%r1,0
+Frontend: cxlfbr %f0,6,%r1,0
+Assembly: cxlfbr %f12,4,%r5,0
+Testing: celgbr %f0,6,%r1,0
+Frontend: celgbr %f0,6,%r1,0
+Assembly: celgbr %f7,6,%r5,0
+Testing: cdlgbr %f0,6,%r1,0
+Frontend: cdlgbr %f0,6,%r1,0
+Assembly: cdlgbr %f7,6,%r5,0
+Testing: cxlgbr %f0,6,%r1,0
+Frontend: cxlgbr %f0,6,%r1,0
+Assembly: cxlgbr %f12,4,%r5,0
+Testing: celfbr %f0,7,%r1,0
+Frontend: celfbr %f0,7,%r1,0
+Assembly: celfbr %f7,7,%r5,0
+Testing: cdlfbr %f0,7,%r1,0
+Frontend: cdlfbr %f0,7,%r1,0
+Assembly: cdlfbr %f7,4,%r5,0
+Testing: cxlfbr %f0,7,%r1,0
+Frontend: cxlfbr %f0,7,%r1,0
+Assembly: cxlfbr %f12,4,%r5,0
+Testing: celgbr %f0,7,%r1,0
+Frontend: celgbr %f0,7,%r1,0
+Assembly: celgbr %f7,7,%r5,0
+Testing: cdlgbr %f0,7,%r1,0
+Frontend: cdlgbr %f0,7,%r1,0
+Assembly: cdlgbr %f7,7,%r5,0
+Testing: cxlgbr %f0,7,%r1,0
+Frontend: cxlgbr %f0,7,%r1,0
+Assembly: cxlgbr %f12,4,%r5,0
+============================================================
+CONVERT TO FIXED
+============================================================
+Testing: cfebr %r0,0,%f1
+Frontend: cfebr %r0,0,%f1
+Assembly: cfebr %r5,0,%f7
+Testing: cfdbr %r0,0,%f1
+Frontend: cfdbr %r0,0,%f1
+Assembly: cfdbr %r5,0,%f7
+Testing: cfxbr %r0,0,%f1
+Frontend: cfxbr %r0,0,%f1
+Assembly: cfxbr %r5,0,%f13
+Testing: cgebr %r0,0,%f1
+Frontend: cgebr %r0,0,%f1
+Assembly: cgebr %r5,0,%f7
+Testing: cgdbr %r0,0,%f1
+Frontend: cgdbr %r0,0,%f1
+Assembly: cgdbr %r5,0,%f7
+Testing: cgxbr %r0,0,%f1
+Frontend: cgxbr %r0,0,%f1
+Assembly: cgxbr %r5,0,%f13
+Testing: cfebr %r0,1,%f1
+Frontend: cfebr %r0,1,%f1
+Assembly: cfebr %r5,1,%f7
+Testing: cfdbr %r0,1,%f1
+Frontend: cfdbr %r0,1,%f1
+Assembly: cfdbr %r5,1,%f7
+Testing: cfxbr %r0,1,%f1
+Frontend: cfxbr %r0,1,%f1
+Assembly: cfxbr %r5,1,%f13
+Testing: cgebr %r0,1,%f1
+Frontend: cgebr %r0,1,%f1
+Assembly: cgebr %r5,1,%f7
+Testing: cgdbr %r0,1,%f1
+Frontend: cgdbr %r0,1,%f1
+Assembly: cgdbr %r5,1,%f7
+Testing: cgxbr %r0,1,%f1
+Frontend: cgxbr %r0,1,%f1
+Assembly: cgxbr %r5,1,%f13
+Testing: cfebr %r0,3,%f1
+Frontend: cfebr %r0,3,%f1
+Assembly: cfebr %r5,3,%f7
+Testing: cfdbr %r0,3,%f1
+Frontend: cfdbr %r0,3,%f1
+Assembly: cfdbr %r5,3,%f7
+Testing: cfxbr %r0,3,%f1
+Frontend: cfxbr %r0,3,%f1
+Assembly: cfxbr %r5,3,%f13
+Testing: cgebr %r0,3,%f1
+Frontend: cgebr %r0,3,%f1
+Assembly: cgebr %r5,3,%f7
+Testing: cgdbr %r0,3,%f1
+Frontend: cgdbr %r0,3,%f1
+Assembly: cgdbr %r5,3,%f7
+Testing: cgxbr %r0,3,%f1
+Frontend: cgxbr %r0,3,%f1
+Assembly: cgxbr %r5,3,%f13
+Testing: cfebr %r0,4,%f1
+Frontend: cfebr %r0,4,%f1
+Assembly: cfebr %r5,4,%f7
+Testing: cfdbr %r0,4,%f1
+Frontend: cfdbr %r0,4,%f1
+Assembly: cfdbr %r5,4,%f7
+Testing: cfxbr %r0,4,%f1
+Frontend: cfxbr %r0,4,%f1
+Assembly: cfxbr %r5,4,%f13
+Testing: cgebr %r0,4,%f1
+Frontend: cgebr %r0,4,%f1
+Assembly: cgebr %r5,4,%f7
+Testing: cgdbr %r0,4,%f1
+Frontend: cgdbr %r0,4,%f1
+Assembly: cgdbr %r5,4,%f7
+Testing: cgxbr %r0,4,%f1
+Frontend: cgxbr %r0,4,%f1
+Assembly: cgxbr %r5,4,%f13
+Testing: cfebr %r0,5,%f1
+Frontend: cfebr %r0,5,%f1
+Assembly: cfebr %r5,5,%f7
+Testing: cfdbr %r0,5,%f1
+Frontend: cfdbr %r0,5,%f1
+Assembly: cfdbr %r5,5,%f7
+Testing: cfxbr %r0,5,%f1
+Frontend: cfxbr %r0,5,%f1
+Assembly: cfxbr %r5,5,%f13
+Testing: cgebr %r0,5,%f1
+Frontend: cgebr %r0,5,%f1
+Assembly: cgebr %r5,5,%f7
+Testing: cgdbr %r0,5,%f1
+Frontend: cgdbr %r0,5,%f1
+Assembly: cgdbr %r5,5,%f7
+Testing: cgxbr %r0,5,%f1
+Frontend: cgxbr %r0,5,%f1
+Assembly: cgxbr %r5,5,%f13
+Testing: cfebr %r0,6,%f1
+Frontend: cfebr %r0,6,%f1
+Assembly: cfebr %r5,6,%f7
+Testing: cfdbr %r0,6,%f1
+Frontend: cfdbr %r0,6,%f1
+Assembly: cfdbr %r5,6,%f7
+Testing: cfxbr %r0,6,%f1
+Frontend: cfxbr %r0,6,%f1
+Assembly: cfxbr %r5,6,%f13
+Testing: cgebr %r0,6,%f1
+Frontend: cgebr %r0,6,%f1
+Assembly: cgebr %r5,6,%f7
+Testing: cgdbr %r0,6,%f1
+Frontend: cgdbr %r0,6,%f1
+Assembly: cgdbr %r5,6,%f7
+Testing: cgxbr %r0,6,%f1
+Frontend: cgxbr %r0,6,%f1
+Assembly: cgxbr %r5,6,%f13
+Testing: cfebr %r0,7,%f1
+Frontend: cfebr %r0,7,%f1
+Assembly: cfebr %r5,7,%f7
+Testing: cfdbr %r0,7,%f1
+Frontend: cfdbr %r0,7,%f1
+Assembly: cfdbr %r5,7,%f7
+Testing: cfxbr %r0,7,%f1
+Frontend: cfxbr %r0,7,%f1
+Assembly: cfxbr %r5,7,%f13
+Testing: cgebr %r0,7,%f1
+Frontend: cgebr %r0,7,%f1
+Assembly: cgebr %r5,7,%f7
+Testing: cgdbr %r0,7,%f1
+Frontend: cgdbr %r0,7,%f1
+Assembly: cgdbr %r5,7,%f7
+Testing: cgxbr %r0,7,%f1
+Frontend: cgxbr %r0,7,%f1
+Assembly: cgxbr %r5,7,%f13
+Testing: cfebra %r0,0,%f1,0
+Frontend: cfebr %r0,0,%f1
+Assembly: cfebr %r5,0,%f7
+Testing: cfdbra %r0,0,%f1,0
+Frontend: cfdbr %r0,0,%f1
+Assembly: cfdbr %r5,0,%f7
+Testing: cfxbra %r0,0,%f1,0
+Frontend: cfxbr %r0,0,%f1
+Assembly: cfxbr %r5,0,%f13
+Testing: cgebra %r0,0,%f1,0
+Frontend: cgebr %r0,0,%f1
+Assembly: cgebr %r5,0,%f7
+Testing: cgdbra %r0,0,%f1,0
+Frontend: cgdbr %r0,0,%f1
+Assembly: cgdbr %r5,0,%f7
+Testing: cgxbra %r0,0,%f1,0
+Frontend: cgxbr %r0,0,%f1
+Assembly: cgxbr %r5,0,%f13
+Testing: cfebra %r0,1,%f1,0
+Frontend: cfebr %r0,1,%f1
+Assembly: cfebr %r5,1,%f7
+Testing: cfdbra %r0,1,%f1,0
+Frontend: cfdbr %r0,1,%f1
+Assembly: cfdbr %r5,1,%f7
+Testing: cfxbra %r0,1,%f1,0
+Frontend: cfxbr %r0,1,%f1
+Assembly: cfxbr %r5,1,%f13
+Testing: cgebra %r0,1,%f1,0
+Frontend: cgebr %r0,1,%f1
+Assembly: cgebr %r5,1,%f7
+Testing: cgdbra %r0,1,%f1,0
+Frontend: cgdbr %r0,1,%f1
+Assembly: cgdbr %r5,1,%f7
+Testing: cgxbra %r0,1,%f1,0
+Frontend: cgxbr %r0,1,%f1
+Assembly: cgxbr %r5,1,%f13
+Testing: cfebra %r0,3,%f1,0
+Frontend: cfebr %r0,3,%f1
+Assembly: cfebr %r5,3,%f7
+Testing: cfdbra %r0,3,%f1,0
+Frontend: cfdbr %r0,3,%f1
+Assembly: cfdbr %r5,3,%f7
+Testing: cfxbra %r0,3,%f1,0
+Frontend: cfxbr %r0,3,%f1
+Assembly: cfxbr %r5,3,%f13
+Testing: cgebra %r0,3,%f1,0
+Frontend: cgebr %r0,3,%f1
+Assembly: cgebr %r5,3,%f7
+Testing: cgdbra %r0,3,%f1,0
+Frontend: cgdbr %r0,3,%f1
+Assembly: cgdbr %r5,3,%f7
+Testing: cgxbra %r0,3,%f1,0
+Frontend: cgxbr %r0,3,%f1
+Assembly: cgxbr %r5,3,%f13
+Testing: cfebra %r0,4,%f1,0
+Frontend: cfebr %r0,4,%f1
+Assembly: cfebr %r5,4,%f7
+Testing: cfdbra %r0,4,%f1,0
+Frontend: cfdbr %r0,4,%f1
+Assembly: cfdbr %r5,4,%f7
+Testing: cfxbra %r0,4,%f1,0
+Frontend: cfxbr %r0,4,%f1
+Assembly: cfxbr %r5,4,%f13
+Testing: cgebra %r0,4,%f1,0
+Frontend: cgebr %r0,4,%f1
+Assembly: cgebr %r5,4,%f7
+Testing: cgdbra %r0,4,%f1,0
+Frontend: cgdbr %r0,4,%f1
+Assembly: cgdbr %r5,4,%f7
+Testing: cgxbra %r0,4,%f1,0
+Frontend: cgxbr %r0,4,%f1
+Assembly: cgxbr %r5,4,%f13
+Testing: cfebra %r0,5,%f1,0
+Frontend: cfebr %r0,5,%f1
+Assembly: cfebr %r5,5,%f7
+Testing: cfdbra %r0,5,%f1,0
+Frontend: cfdbr %r0,5,%f1
+Assembly: cfdbr %r5,5,%f7
+Testing: cfxbra %r0,5,%f1,0
+Frontend: cfxbr %r0,5,%f1
+Assembly: cfxbr %r5,5,%f13
+Testing: cgebra %r0,5,%f1,0
+Frontend: cgebr %r0,5,%f1
+Assembly: cgebr %r5,5,%f7
+Testing: cgdbra %r0,5,%f1,0
+Frontend: cgdbr %r0,5,%f1
+Assembly: cgdbr %r5,5,%f7
+Testing: cgxbra %r0,5,%f1,0
+Frontend: cgxbr %r0,5,%f1
+Assembly: cgxbr %r5,5,%f13
+Testing: cfebra %r0,6,%f1,0
+Frontend: cfebr %r0,6,%f1
+Assembly: cfebr %r5,6,%f7
+Testing: cfdbra %r0,6,%f1,0
+Frontend: cfdbr %r0,6,%f1
+Assembly: cfdbr %r5,6,%f7
+Testing: cfxbra %r0,6,%f1,0
+Frontend: cfxbr %r0,6,%f1
+Assembly: cfxbr %r5,6,%f13
+Testing: cgebra %r0,6,%f1,0
+Frontend: cgebr %r0,6,%f1
+Assembly: cgebr %r5,6,%f7
+Testing: cgdbra %r0,6,%f1,0
+Frontend: cgdbr %r0,6,%f1
+Assembly: cgdbr %r5,6,%f7
+Testing: cgxbra %r0,6,%f1,0
+Frontend: cgxbr %r0,6,%f1
+Assembly: cgxbr %r5,6,%f13
+Testing: cfebra %r0,7,%f1,0
+Frontend: cfebr %r0,7,%f1
+Assembly: cfebr %r5,7,%f7
+Testing: cfdbra %r0,7,%f1,0
+Frontend: cfdbr %r0,7,%f1
+Assembly: cfdbr %r5,7,%f7
+Testing: cfxbra %r0,7,%f1,0
+Frontend: cfxbr %r0,7,%f1
+Assembly: cfxbr %r5,7,%f13
+Testing: cgebra %r0,7,%f1,0
+Frontend: cgebr %r0,7,%f1
+Assembly: cgebr %r5,7,%f7
+Testing: cgdbra %r0,7,%f1,0
+Frontend: cgdbr %r0,7,%f1
+Assembly: cgdbr %r5,7,%f7
+Testing: cgxbra %r0,7,%f1,0
+Frontend: cgxbr %r0,7,%f1
+Assembly: cgxbr %r5,7,%f13
+============================================================
+CONVERT TO LOGICAL
+============================================================
+Testing: clfebr %r0,0,%f1,0
+Frontend: clfebr %r0,0,%f1,0
+Assembly: clfebr %r5,0,%f7,0
+Testing: clfdbr %r0,0,%f1,0
+Frontend: clfdbr %r0,0,%f1,0
+Assembly: clfdbr %r5,0,%f7,0
+Testing: clfxbr %r0,0,%f1,0
+Frontend: clfxbr %r0,0,%f1,0
+Assembly: clfxbr %r5,0,%f13,0
+Testing: clgebr %r0,0,%f1,0
+Frontend: clgebr %r0,0,%f1,0
+Assembly: clgebr %r5,0,%f7,0
+Testing: clgdbr %r0,0,%f1,0
+Frontend: clgdbr %r0,0,%f1,0
+Assembly: clgdbr %r5,0,%f7,0
+Testing: clgxbr %r0,0,%f1,0
+Frontend: clgxbr %r0,0,%f1,0
+Assembly: clgxbr %r5,0,%f13,0
+Testing: clfebr %r0,1,%f1,0
+Frontend: clfebr %r0,1,%f1,0
+Assembly: clfebr %r5,1,%f7,0
+Testing: clfdbr %r0,1,%f1,0
+Frontend: clfdbr %r0,1,%f1,0
+Assembly: clfdbr %r5,1,%f7,0
+Testing: clfxbr %r0,1,%f1,0
+Frontend: clfxbr %r0,1,%f1,0
+Assembly: clfxbr %r5,1,%f13,0
+Testing: clgebr %r0,1,%f1,0
+Frontend: clgebr %r0,1,%f1,0
+Assembly: clgebr %r5,1,%f7,0
+Testing: clgdbr %r0,1,%f1,0
+Frontend: clgdbr %r0,1,%f1,0
+Assembly: clgdbr %r5,1,%f7,0
+Testing: clgxbr %r0,1,%f1,0
+Frontend: clgxbr %r0,1,%f1,0
+Assembly: clgxbr %r5,1,%f13,0
+Testing: clfebr %r0,3,%f1,0
+Frontend: clfebr %r0,3,%f1,0
+Assembly: clfebr %r5,3,%f7,0
+Testing: clfdbr %r0,3,%f1,0
+Frontend: clfdbr %r0,3,%f1,0
+Assembly: clfdbr %r5,3,%f7,0
+Testing: clfxbr %r0,3,%f1,0
+Frontend: clfxbr %r0,3,%f1,0
+Assembly: clfxbr %r5,3,%f13,0
+Testing: clgebr %r0,3,%f1,0
+Frontend: clgebr %r0,3,%f1,0
+Assembly: clgebr %r5,3,%f7,0
+Testing: clgdbr %r0,3,%f1,0
+Frontend: clgdbr %r0,3,%f1,0
+Assembly: clgdbr %r5,3,%f7,0
+Testing: clgxbr %r0,3,%f1,0
+Frontend: clgxbr %r0,3,%f1,0
+Assembly: clgxbr %r5,3,%f13,0
+Testing: clfebr %r0,4,%f1,0
+Frontend: clfebr %r0,4,%f1,0
+Assembly: clfebr %r5,4,%f7,0
+Testing: clfdbr %r0,4,%f1,0
+Frontend: clfdbr %r0,4,%f1,0
+Assembly: clfdbr %r5,4,%f7,0
+Testing: clfxbr %r0,4,%f1,0
+Frontend: clfxbr %r0,4,%f1,0
+Assembly: clfxbr %r5,4,%f13,0
+Testing: clgebr %r0,4,%f1,0
+Frontend: clgebr %r0,4,%f1,0
+Assembly: clgebr %r5,4,%f7,0
+Testing: clgdbr %r0,4,%f1,0
+Frontend: clgdbr %r0,4,%f1,0
+Assembly: clgdbr %r5,4,%f7,0
+Testing: clgxbr %r0,4,%f1,0
+Frontend: clgxbr %r0,4,%f1,0
+Assembly: clgxbr %r5,4,%f13,0
+Testing: clfebr %r0,5,%f1,0
+Frontend: clfebr %r0,5,%f1,0
+Assembly: clfebr %r5,5,%f7,0
+Testing: clfdbr %r0,5,%f1,0
+Frontend: clfdbr %r0,5,%f1,0
+Assembly: clfdbr %r5,5,%f7,0
+Testing: clfxbr %r0,5,%f1,0
+Frontend: clfxbr %r0,5,%f1,0
+Assembly: clfxbr %r5,5,%f13,0
+Testing: clgebr %r0,5,%f1,0
+Frontend: clgebr %r0,5,%f1,0
+Assembly: clgebr %r5,5,%f7,0
+Testing: clgdbr %r0,5,%f1,0
+Frontend: clgdbr %r0,5,%f1,0
+Assembly: clgdbr %r5,5,%f7,0
+Testing: clgxbr %r0,5,%f1,0
+Frontend: clgxbr %r0,5,%f1,0
+Assembly: clgxbr %r5,5,%f13,0
+Testing: clfebr %r0,6,%f1,0
+Frontend: clfebr %r0,6,%f1,0
+Assembly: clfebr %r5,6,%f7,0
+Testing: clfdbr %r0,6,%f1,0
+Frontend: clfdbr %r0,6,%f1,0
+Assembly: clfdbr %r5,6,%f7,0
+Testing: clfxbr %r0,6,%f1,0
+Frontend: clfxbr %r0,6,%f1,0
+Assembly: clfxbr %r5,6,%f13,0
+Testing: clgebr %r0,6,%f1,0
+Frontend: clgebr %r0,6,%f1,0
+Assembly: clgebr %r5,6,%f7,0
+Testing: clgdbr %r0,6,%f1,0
+Frontend: clgdbr %r0,6,%f1,0
+Assembly: clgdbr %r5,6,%f7,0
+Testing: clgxbr %r0,6,%f1,0
+Frontend: clgxbr %r0,6,%f1,0
+Assembly: clgxbr %r5,6,%f13,0
+Testing: clfebr %r0,7,%f1,0
+Frontend: clfebr %r0,7,%f1,0
+Assembly: clfebr %r5,7,%f7,0
+Testing: clfdbr %r0,7,%f1,0
+Frontend: clfdbr %r0,7,%f1,0
+Assembly: clfdbr %r5,7,%f7,0
+Testing: clfxbr %r0,7,%f1,0
+Frontend: clfxbr %r0,7,%f1,0
+Assembly: clfxbr %r5,7,%f13,0
+Testing: clgebr %r0,7,%f1,0
+Frontend: clgebr %r0,7,%f1,0
+Assembly: clgebr %r5,7,%f7,0
+Testing: clgdbr %r0,7,%f1,0
+Frontend: clgdbr %r0,7,%f1,0
+Assembly: clgdbr %r5,7,%f7,0
+Testing: clgxbr %r0,7,%f1,0
+Frontend: clgxbr %r0,7,%f1,0
+Assembly: clgxbr %r5,7,%f13,0
+============================================================
+DIVIDE
+============================================================
+Testing: debr %f0,%f1
+Frontend: debr %f0,%f1
+Assembly: debr %f7,%f6
+Testing: ddbr %f0,%f1
+Frontend: ddbr %f0,%f1
+Assembly: ddbr %f7,%f6
+Testing: dxbr %f0,%f1
+Frontend: dxbr %f0,%f1
+Assembly: dxbr %f12,%f13
+============================================================
+LOAD COMPLEMENT
+============================================================
+Testing: lcebr %f0,%f1
+Frontend: lcebr %f0,%f1
+Assembly: lcebr %f6,%f7
+Testing: lcdbr %f0,%f1
+Frontend: lcdbr %f0,%f1
+Assembly: lcdbr %f6,%f7
+Testing: lcxbr %f0,%f1
+Frontend: lcxbr %f0,%f1
+Assembly: lcxbr %f12,%f13
+============================================================
+LOAD FP INTEGER
+============================================================
+Testing: fiebr %f0,0,%f1
+Frontend: fiebr %f0,0,%f1
+Assembly: fiebr %f6,0,%f7
+Testing: fidbr %f0,0,%f1
+Frontend: fidbr %f0,0,%f1
+Assembly: fidbr %f6,0,%f7
+Testing: fixbr %f0,0,%f1
+Frontend: fixbr %f0,0,%f1
+Assembly: fixbr %f0,0,%f4
+Testing: fiebr %f0,1,%f1
+Frontend: fiebr %f0,1,%f1
+Assembly: fiebr %f6,1,%f7
+Testing: fidbr %f0,1,%f1
+Frontend: fidbr %f0,1,%f1
+Assembly: fidbr %f6,1,%f7
+Testing: fixbr %f0,1,%f1
+Frontend: fixbr %f0,1,%f1
+Assembly: fixbr %f0,1,%f4
+Testing: fiebr %f0,3,%f1
+Frontend: fiebr %f0,3,%f1
+Assembly: fiebr %f6,3,%f7
+Testing: fidbr %f0,3,%f1
+Frontend: fidbr %f0,3,%f1
+Assembly: fidbr %f6,3,%f7
+Testing: fixbr %f0,3,%f1
+Frontend: fixbr %f0,3,%f1
+Assembly: fixbr %f0,3,%f4
+Testing: fiebr %f0,4,%f1
+Frontend: fiebr %f0,4,%f1
+Assembly: fiebr %f6,4,%f7
+Testing: fidbr %f0,4,%f1
+Frontend: fidbr %f0,4,%f1
+Assembly: fidbr %f6,4,%f7
+Testing: fixbr %f0,4,%f1
+Frontend: fixbr %f0,4,%f1
+Assembly: fixbr %f0,4,%f4
+Testing: fiebr %f0,5,%f1
+Frontend: fiebr %f0,5,%f1
+Assembly: fiebr %f6,5,%f7
+Testing: fidbr %f0,5,%f1
+Frontend: fidbr %f0,5,%f1
+Assembly: fidbr %f6,5,%f7
+Testing: fixbr %f0,5,%f1
+Frontend: fixbr %f0,5,%f1
+Assembly: fixbr %f0,5,%f4
+Testing: fiebr %f0,6,%f1
+Frontend: fiebr %f0,6,%f1
+Assembly: fiebr %f6,6,%f7
+Testing: fidbr %f0,6,%f1
+Frontend: fidbr %f0,6,%f1
+Assembly: fidbr %f6,6,%f7
+Testing: fixbr %f0,6,%f1
+Frontend: fixbr %f0,6,%f1
+Assembly: fixbr %f0,6,%f4
+Testing: fiebr %f0,7,%f1
+Frontend: fiebr %f0,7,%f1
+Assembly: fiebr %f6,7,%f7
+Testing: fidbr %f0,7,%f1
+Frontend: fidbr %f0,7,%f1
+Assembly: fidbr %f6,7,%f7
+Testing: fixbr %f0,7,%f1
+Frontend: fixbr %f0,7,%f1
+Assembly: fixbr %f0,7,%f4
+Testing: fiebra %f0,0,%f1,0
+Frontend: fiebr %f0,0,%f1
+Assembly: fiebr %f6,0,%f7
+Testing: fidbra %f0,0,%f1,0
+Frontend: fidbr %f0,0,%f1
+Assembly: fidbr %f6,0,%f7
+Testing: fixbra %f0,0,%f1,0
+Frontend: fixbr %f0,0,%f1
+Assembly: fixbr %f0,0,%f4
+Testing: fiebra %f0,1,%f1,0
+Frontend: fiebr %f0,1,%f1
+Assembly: fiebr %f6,1,%f7
+Testing: fidbra %f0,1,%f1,0
+Frontend: fidbr %f0,1,%f1
+Assembly: fidbr %f6,1,%f7
+Testing: fixbra %f0,1,%f1,0
+Frontend: fixbr %f0,1,%f1
+Assembly: fixbr %f0,1,%f4
+Testing: fiebra %f0,3,%f1,0
+Frontend: fiebr %f0,3,%f1
+Assembly: fiebr %f6,3,%f7
+Testing: fidbra %f0,3,%f1,0
+Frontend: fidbr %f0,3,%f1
+Assembly: fidbr %f6,3,%f7
+Testing: fixbra %f0,3,%f1,0
+Frontend: fixbr %f0,3,%f1
+Assembly: fixbr %f0,3,%f4
+Testing: fiebra %f0,4,%f1,0
+Frontend: fiebr %f0,4,%f1
+Assembly: fiebr %f6,4,%f7
+Testing: fidbra %f0,4,%f1,0
+Frontend: fidbr %f0,4,%f1
+Assembly: fidbr %f6,4,%f7
+Testing: fixbra %f0,4,%f1,0
+Frontend: fixbr %f0,4,%f1
+Assembly: fixbr %f0,4,%f4
+Testing: fiebra %f0,5,%f1,0
+Frontend: fiebr %f0,5,%f1
+Assembly: fiebr %f6,5,%f7
+Testing: fidbra %f0,5,%f1,0
+Frontend: fidbr %f0,5,%f1
+Assembly: fidbr %f6,5,%f7
+Testing: fixbra %f0,5,%f1,0
+Frontend: fixbr %f0,5,%f1
+Assembly: fixbr %f0,5,%f4
+Testing: fiebra %f0,6,%f1,0
+Frontend: fiebr %f0,6,%f1
+Assembly: fiebr %f6,6,%f7
+Testing: fidbra %f0,6,%f1,0
+Frontend: fidbr %f0,6,%f1
+Assembly: fidbr %f6,6,%f7
+Testing: fixbra %f0,6,%f1,0
+Frontend: fixbr %f0,6,%f1
+Assembly: fixbr %f0,6,%f4
+Testing: fiebra %f0,7,%f1,0
+Frontend: fiebr %f0,7,%f1
+Assembly: fiebr %f6,7,%f7
+Testing: fidbra %f0,7,%f1,0
+Frontend: fidbr %f0,7,%f1
+Assembly: fidbr %f6,7,%f7
+Testing: fixbra %f0,7,%f1,0
+Frontend: fixbr %f0,7,%f1
+Assembly: fixbr %f0,7,%f4
+============================================================
+LOAD LENGTHENED
+============================================================
+Testing: ldebr %f0,%f1
+Frontend: ldebr %f0,%f1
+Assembly: ldebr %f6,%f7
+Testing: lxdbr %f0,%f1
+Frontend: lxdbr %f0,%f1
+Assembly: lxdbr %f12,%f7
+Testing: lxebr %f0,%f1
+Frontend: lxebr %f0,%f1
+Assembly: lxebr %f12,%f7
+============================================================
+LOAD NEGATIVE
+============================================================
+Testing: lnebr %f0,%f1
+Frontend: lnebr %f0,%f1
+Assembly: lnebr %f6,%f7
+Testing: lndbr %f0,%f1
+Frontend: lndbr %f0,%f1
+Assembly: lndbr %f6,%f7
+============================================================
+LOAD POSITIVE
+============================================================
+Testing: lpebr %f0,%f1
+Frontend: lpebr %f0,%f1
+Assembly: lpebr %f6,%f7
+Testing: lpdbr %f0,%f1
+Frontend: lpdbr %f0,%f1
+Assembly: lpdbr %f6,%f7
+Testing: lpxbr %f0,%f1
+Frontend: lpxbr %f0,%f1
+Assembly: lpxbr %f12,%f13
+============================================================
+LOAD ROUNDED
+============================================================
+Testing: ledbr %f0,%f1
+Frontend: ledbr %f0,%f1
+Assembly: ledbr %f6,%f7
+Testing: ldxbr %f0,%f1
+Frontend: ldxbr %f0,%f1
+Assembly: ldxbr %f12,%f13
+Testing: lexbr %f0,%f1
+Frontend: lexbr %f0,%f1
+Assembly: lexbr %f12,%f13
+Testing: ledbra %f0,0,%f1,0
+Frontend: ledbr %f0,%f1
+Assembly: ledbr %f6,%f7
+Testing: ldxbra %f0,0,%f1,0
+Frontend: ldxbr %f0,%f1
+Assembly: ldxbr %f12,%f13
+Testing: lexbra %f0,0,%f1,0
+Frontend: lexbr %f0,%f1
+Assembly: lexbr %f12,%f13
+Testing: ledbra %f0,1,%f1,0
+Frontend: ledbra %f0,1,%f1,0
+Assembly: ledbra %f6,1,%f7,0
+Testing: ldxbra %f0,1,%f1,0
+Frontend: ldxbra %f0,1,%f1,0
+Assembly: ldxbra %f12,1,%f13,0
+Testing: lexbra %f0,1,%f1,0
+Frontend: lexbra %f0,1,%f1,0
+Assembly: lexbra %f12,1,%f13,0
+Testing: ledbra %f0,3,%f1,0
+Frontend: ledbra %f0,3,%f1,0
+Assembly: ledbra %f6,3,%f7,0
+Testing: ldxbra %f0,3,%f1,0
+Frontend: ldxbra %f0,3,%f1,0
+Assembly: ldxbra %f12,3,%f13,0
+Testing: lexbra %f0,3,%f1,0
+Frontend: lexbra %f0,3,%f1,0
+Assembly: lexbra %f12,3,%f13,0
+Testing: ledbra %f0,4,%f1,0
+Frontend: ledbra %f0,4,%f1,0
+Assembly: ledbra %f6,4,%f7,0
+Testing: ldxbra %f0,4,%f1,0
+Frontend: ldxbra %f0,4,%f1,0
+Assembly: ldxbra %f12,4,%f13,0
+Testing: lexbra %f0,4,%f1,0
+Frontend: lexbra %f0,4,%f1,0
+Assembly: lexbra %f12,4,%f13,0
+Testing: ledbra %f0,5,%f1,0
+Frontend: ledbra %f0,5,%f1,0
+Assembly: ledbra %f6,5,%f7,0
+Testing: ldxbra %f0,5,%f1,0
+Frontend: ldxbra %f0,5,%f1,0
+Assembly: ldxbra %f12,5,%f13,0
+Testing: lexbra %f0,5,%f1,0
+Frontend: lexbra %f0,5,%f1,0
+Assembly: lexbra %f12,5,%f13,0
+Testing: ledbra %f0,6,%f1,0
+Frontend: ledbra %f0,6,%f1,0
+Assembly: ledbra %f6,6,%f7,0
+Testing: ldxbra %f0,6,%f1,0
+Frontend: ldxbra %f0,6,%f1,0
+Assembly: ldxbra %f12,6,%f13,0
+Testing: lexbra %f0,6,%f1,0
+Frontend: lexbra %f0,6,%f1,0
+Assembly: lexbra %f12,6,%f13,0
+Testing: ledbra %f0,7,%f1,0
+Frontend: ledbra %f0,7,%f1,0
+Assembly: ledbra %f6,7,%f7,0
+Testing: ldxbra %f0,7,%f1,0
+Frontend: ldxbra %f0,7,%f1,0
+Assembly: ldxbra %f12,7,%f13,0
+Testing: lexbra %f0,7,%f1,0
+Frontend: lexbra %f0,7,%f1,0
+Assembly: lexbra %f12,7,%f13,0
+============================================================
+MULTIPLY
+============================================================
+Testing: meebr %f0,%f1
+Frontend: meebr %f0,%f1
+Assembly: meebr %f7,%f6
+Testing: mdbr %f0,%f1
+Frontend: mdbr %f0,%f1
+Assembly: mdbr %f7,%f6
+Testing: mxbr %f0,%f1
+Frontend: mxbr %f0,%f1
+Assembly: mxbr %f12,%f13
+============================================================
+MULTIPLY AND ADD
+============================================================
+Testing: maebr %f0,%f1,%f2
+Frontend: maebr %f0,%f1,%f2
+Assembly: maebr %f5,%f7,%f6
+Testing: madbr %f0,%f1,%f2
+Frontend: madbr %f0,%f1,%f2
+Assembly: madbr %f5,%f7,%f6
+============================================================
+MULTIPLY AND SUBTRACT
+============================================================
+Testing: msebr %f0,%f1,%f2
+Frontend: msebr %f0,%f1,%f2
+Assembly: msebr %f5,%f7,%f6
+Testing: msdbr %f0,%f1,%f2
+Frontend: msdbr %f0,%f1,%f2
+Assembly: msdbr %f5,%f7,%f6
+============================================================
+SQUARE ROOT
+============================================================
+Testing: sqebr %f0,%f1
+Frontend: sqebr %f0,%f1
+Assembly: sqebr %f6,%f7
+Testing: sqdbr %f0,%f1
+Frontend: sqdbr %f0,%f1
+Assembly: sqdbr %f6,%f7
+Testing: sqxbr %f0,%f1
+Frontend: sqxbr %f0,%f1
+Assembly: sqxbr %f12,%f13
+============================================================
+SUBTRACT
+============================================================
+Testing: sebr %f0,%f1
+Frontend: sebr %f0,%f1
+Assembly: sebr %f7,%f6
+Testing: sdbr %f0,%f1
+Frontend: sdbr %f0,%f1
+Assembly: sdbr %f7,%f6
+Testing: sxbr %f0,%f1
+Frontend: sxbr %f0,%f1
+Assembly: sxbr %f12,%f13
diff --git a/none/tests/s390x/fpconv.stderr.exp b/none/tests/s390x/bfp-emit.stderr.exp
similarity index 100%
rename from none/tests/s390x/fpconv.stderr.exp
rename to none/tests/s390x/bfp-emit.stderr.exp
diff --git a/none/tests/s390x/bfp-emit.vgtest b/none/tests/s390x/bfp-emit.vgtest
new file mode 100644
index 0000000000..4bfcbac228
--- /dev/null
+++ b/none/tests/s390x/bfp-emit.vgtest
@@ -0,0 +1,3 @@
+prereq: ../../../tests/s390x_features s390x-fpext
+prog: /bin/true
+post: ./bfp-emit.pl
diff --git a/none/tests/s390x/bfp-fpc.c b/none/tests/s390x/bfp-fpc.c
new file mode 100644
index 0000000000..0862c5b040
--- /dev/null
+++ b/none/tests/s390x/bfp-fpc.c
@@ -0,0 +1,178 @@
+#include
+#include
+#include
+#include "opcodes.h"
+#include "rounding.h"
+
+/* Instructions modifying / querying the FPC register:
+ EFPC, LFPC, SFPC, STFPC, SRNM, SRNMB.
+
+ No tests for SFASR and LFAS asa they are not implemented */
+
+void
+sfpc(unsigned mode)
+{
+ register unsigned r asm("1") = mode;
+ __asm__ volatile ( SFPC(1) : : "d"(r) );
+}
+
+unsigned
+get_rounding_mode(void)
+{
+ unsigned fpc1;
+ uint64_t fpc2 = ~(uint64_t)0;
+
+ __asm__ volatile ("stfpc %0" : "=Q"(fpc1));
+ __asm__ volatile ("efpc %0" : "+d"(fpc2));
+
+ assert((fpc1 & 0x7) == (fpc2 & 0x7));
+ assert((fpc2 >> 32) == 0xFFFFFFFF);
+
+ return fpc1 & 0x7;
+}
+
+#define srnm(b,d) \
+ ({ \
+ __asm__ volatile ("srnm %[displ] (%[base])\n\t" \
+ : : [base]"a"(b), [displ]"L"(d)); \
+ })
+
+#define srnmb(b,d) \
+ ({ \
+ __asm__ volatile ("srnmb %[displ] (%[base])\n\t" \
+ : : [base]"a"(b), [displ]"L"(d)); \
+ })
+
+int main(void)
+{
+ /* Order of rounding modes is such that the first rounding mode in
+ the list differs from the default rounding mode which is
+ FPC_BFP_ROUND_NEAREST_EVEN. */
+ const unsigned rmodes[] = {
+ FPC_BFP_ROUND_ZERO,
+ FPC_BFP_ROUND_POSINF,
+ FPC_BFP_ROUND_NEGINF,
+ FPC_BFP_ROUND_PREPARE_SHORT,
+ FPC_BFP_ROUND_NEAREST_EVEN,
+ };
+
+ int initial = get_rounding_mode();
+ assert(initial == FPC_BFP_ROUND_NEAREST_EVEN);
+
+ printf("initial rounding mode: %u\n", initial);
+
+ printf("Setting FPC rounding mode via SFPC\n");
+ for (int i = 0; i < sizeof rmodes / sizeof rmodes[0]; ++i) {
+ printf("setting rounding mode to %u\n", rmodes[i]);
+ sfpc(rmodes[i]);
+ printf("...checking: %u\n", get_rounding_mode());
+ }
+
+ putchar('\n');
+ printf("Setting FPC rounding mode via SRNM\n");
+ /* Only rounding modes 0,1,2,3 are valid for SRNM */
+
+ /* Rounding mode --> base register */
+ printf(".... using base register\n");
+ printf("setting rounding mode to %u\n", 0);
+ srnm(0, 0);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 1);
+ srnm(1, 0);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 2);
+ srnm(2, 0);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 3);
+ srnm(3, 0);
+ printf("...checking: %u\n", get_rounding_mode());
+
+ /* Rounding mode --> displacement */
+ printf(".... using displacement\n");
+ printf("setting rounding mode to %u\n", 0);
+ srnm(0, 0);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 1);
+ srnm(0, 1);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 2);
+ srnm(0, 2);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 3);
+ srnm(0, 3);
+ printf("...checking: %u\n", get_rounding_mode());
+
+ putchar('\n');
+ printf("Setting FPC rounding mode via SRNMB\n");
+ /* All rounding modes allowed */
+
+ /* Rounding mode --> base register */
+ printf(".... using base register\n");
+ printf("setting rounding mode to %u\n", 0);
+ srnmb(0, 0);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 1);
+ srnmb(1, 0);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 2);
+ srnmb(2, 0);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 3);
+ srnmb(3, 0);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 7);
+ srnmb(7, 0);
+ printf("...checking: %u\n", get_rounding_mode());
+
+ /* Rounding mode --> displacement */
+ printf(".... using displacement\n");
+ printf("setting rounding mode to %u\n", 0);
+ srnmb(0, 0);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 1);
+ srnmb(0, 1);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 2);
+ srnmb(0, 2);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 3);
+ srnmb(0, 3);
+ printf("...checking: %u\n", get_rounding_mode());
+ printf("setting rounding mode to %u\n", 7);
+ srnmb(0, 7);
+ printf("...checking: %u\n", get_rounding_mode());
+
+ putchar('\n');
+ printf("SRNM specific checks\n");
+ /* Making sure base reg and displacement are added. */
+ srnm(1,2); // 1 + 2 = 3
+ printf("rounding mode = %u\n", get_rounding_mode());
+ /* Making sure extra bits get masked away */
+ srnm(0,0xfff); /* 3 */
+ printf("rounding mode = %u\n", get_rounding_mode());
+ srnm(0xfff,0); /* 3 */
+ printf("rounding mode = %u\n", get_rounding_mode());
+ srnm(0xfff,0xfff); /* 3 */
+ printf("rounding mode = %u\n", get_rounding_mode());
+ srnm(3,3); /* 2 */
+ printf("rounding mode = %u\n", get_rounding_mode());
+
+ putchar('\n');
+ printf("SRNMB specific checks\n");
+ /* Making sure base reg and displacement are added. */
+ srnmb(3,4); // 3 + 4 = 7
+ printf("rounding mode = %u\n", get_rounding_mode());
+
+ putchar('\n');
+ printf("LFPC\n");
+ unsigned fpcval;
+
+ sfpc(3); /* Set rounding mode to 3 */
+ printf("rounding mode = %u\n", get_rounding_mode());
+ __asm__ volatile ("stfpc %0" : "=Q"(fpcval)); /* Store FPC -> fpcval; */
+ fpcval = (fpcval & ~0x7) | 0x2; /* modify rounding mode bits */
+ __asm__ volatile ("lfpc %0" : "=Q"(fpcval));
+ printf("rounding mode = %u\n", get_rounding_mode());
+
+ return 0;
+}
diff --git a/none/tests/s390x/fpext.stderr.exp b/none/tests/s390x/bfp-fpc.stderr.exp
similarity index 100%
rename from none/tests/s390x/fpext.stderr.exp
rename to none/tests/s390x/bfp-fpc.stderr.exp
diff --git a/none/tests/s390x/bfp-fpc.stdout.exp b/none/tests/s390x/bfp-fpc.stdout.exp
new file mode 100644
index 0000000000..6e6c2c9ef6
--- /dev/null
+++ b/none/tests/s390x/bfp-fpc.stdout.exp
@@ -0,0 +1,70 @@
+initial rounding mode: 0
+Setting FPC rounding mode via SFPC
+setting rounding mode to 1
+...checking: 1
+setting rounding mode to 2
+...checking: 2
+setting rounding mode to 3
+...checking: 3
+setting rounding mode to 7
+...checking: 7
+setting rounding mode to 0
+...checking: 0
+
+Setting FPC rounding mode via SRNM
+.... using base register
+setting rounding mode to 0
+...checking: 0
+setting rounding mode to 1
+...checking: 1
+setting rounding mode to 2
+...checking: 2
+setting rounding mode to 3
+...checking: 3
+.... using displacement
+setting rounding mode to 0
+...checking: 0
+setting rounding mode to 1
+...checking: 1
+setting rounding mode to 2
+...checking: 2
+setting rounding mode to 3
+...checking: 3
+
+Setting FPC rounding mode via SRNMB
+.... using base register
+setting rounding mode to 0
+...checking: 0
+setting rounding mode to 1
+...checking: 1
+setting rounding mode to 2
+...checking: 2
+setting rounding mode to 3
+...checking: 3
+setting rounding mode to 7
+...checking: 7
+.... using displacement
+setting rounding mode to 0
+...checking: 0
+setting rounding mode to 1
+...checking: 1
+setting rounding mode to 2
+...checking: 2
+setting rounding mode to 3
+...checking: 3
+setting rounding mode to 7
+...checking: 7
+
+SRNM specific checks
+rounding mode = 3
+rounding mode = 3
+rounding mode = 3
+rounding mode = 2
+rounding mode = 2
+
+SRNMB specific checks
+rounding mode = 7
+
+LFPC
+rounding mode = 3
+rounding mode = 2
diff --git a/none/tests/s390x/bfp-fpc.vgtest b/none/tests/s390x/bfp-fpc.vgtest
new file mode 100644
index 0000000000..d7306a2e32
--- /dev/null
+++ b/none/tests/s390x/bfp-fpc.vgtest
@@ -0,0 +1,2 @@
+prog: bfp-fpc
+prereq: ../../../tests/s390x_features s390x-fpext
diff --git a/none/tests/s390x/bfp-load.c b/none/tests/s390x/bfp-load.c
new file mode 100644
index 0000000000..e5d862e697
--- /dev/null
+++ b/none/tests/s390x/bfp-load.c
@@ -0,0 +1,168 @@
+#include
+#include
+#include
+
+/* Test various BFP ops:
+ - load and test
+ - load zero
+*/
+
+#define LOADxxx(insn, initial, type, fmt) \
+ do { \
+ int cc; \
+ type in = initial; \
+ type out = 17; \
+ __asm__ volatile("cr 0,0\n\t /* clear cc */\n\t" \
+ insn " %[r1],%[r2]\n\t" \
+ "ipm %[psw]\n\t" \
+ "srl %[psw],28\n\t" \
+ : [r1]"=f"(out), [psw]"=d"(cc) \
+ : [r2]"f"(in) \
+ : "cc"); \
+ printf(insn " " fmt " -> " fmt " cc = %d\n", in, out, cc); \
+ } while (0)
+
+void lzxr(void)
+{
+ long double value;
+
+ __builtin_memset(&value, 0xff, sizeof value);
+ __asm__ volatile("lzxr %[r1]" : [r1]"=f"(value));
+
+ printf("lzxr --> ");
+ for (unsigned i = 0; i < sizeof(long double); ++i) {
+ if (i % 4 == 0) putchar(' ');
+ unsigned byte = ((char *)&value)[i];
+ printf("%02u", byte);
+ }
+ putchar ('\n');
+}
+
+int main(void)
+{
+ assert(sizeof(long double) == 16);
+
+ printf("LOAD AND TEST short BFP\n");
+ LOADxxx("ltebr", 100.0f, float, "%f");
+ LOADxxx("ltebr", -10.5f, float, "%f");
+ LOADxxx("ltebr", 0.0f, float, "%f");
+ LOADxxx("ltebr", NAN, float, "%f");
+ LOADxxx("ltebr", -NAN, float, "%f");
+ LOADxxx("ltebr", INFINITY, float, "%f");
+ LOADxxx("ltebr", -INFINITY, float, "%f");
+
+ printf("LOAD AND TEST long BFP\n");
+ LOADxxx("ltdbr", 100.0, double, "%f");
+ LOADxxx("ltdbr", -10.5, double, "%f");
+ LOADxxx("ltdbr", 0.0, double, "%f");
+ LOADxxx("ltdbr", NAN, double, "%f");
+ LOADxxx("ltdbr", INFINITY, double, "%f");
+ LOADxxx("ltdbr", -INFINITY, double, "%f");
+
+ printf("LOAD AND TEST extended BFP\n");
+ LOADxxx("ltxbr", 100.0L, long double, "%Lf");
+ LOADxxx("ltxbr", -10.5L, long double, "%Lf");
+ LOADxxx("ltxbr", 0.0L, long double, "%Lf");
+ LOADxxx("ltxbr", NAN, long double, "%Lf");
+ LOADxxx("ltxbr", INFINITY, long double, "%Lf");
+ LOADxxx("ltxbr", -INFINITY, long double, "%Lf");
+
+ putchar('\n');
+ printf("LOAD NEGATIVE short BFP\n");
+ LOADxxx("lnebr", 0.0f, float, "%f");
+ LOADxxx("lnebr", -0.0f, float, "%f");
+ LOADxxx("lnebr", 123.0f, float, "%f");
+ LOADxxx("lnebr", -12.0f, float, "%f");
+ LOADxxx("lnebr", NAN, float, "%f");
+ LOADxxx("lnebr", -NAN, float, "%f");
+ LOADxxx("lnebr", INFINITY, float, "%f");
+ LOADxxx("lnebr", -INFINITY, float, "%f");
+
+ printf("LOAD NEGATIVE long BFP\n");
+ LOADxxx("lndbr", 0.0, double, "%f");
+ LOADxxx("lndbr", -0.0, double, "%f");
+ LOADxxx("lndbr", 123.0, double, "%f");
+ LOADxxx("lndbr", -12.0, double, "%f");
+ LOADxxx("lndbr", NAN, double, "%f");
+ LOADxxx("lndbr", -NAN, double, "%f");
+ LOADxxx("lndbr", INFINITY, double, "%f");
+ LOADxxx("lndbr", -INFINITY, double, "%f");
+
+ printf("LOAD NEGATIVE extended BFP\n");
+ LOADxxx("lnxbr", 0.0L, long double, "%Lf");
+ LOADxxx("lnxbr", -0.0L, long double, "%Lf");
+ LOADxxx("lnxbr", 123.0L, long double, "%Lf");
+ LOADxxx("lnxbr", -12.0L, long double, "%Lf");
+ LOADxxx("lnxbr", NAN, long double, "%Lf");
+ LOADxxx("lnxbr", -NAN, long double, "%Lf");
+ LOADxxx("lnxbr", INFINITY, long double, "%Lf");
+ LOADxxx("lnxbr", -INFINITY, long double, "%Lf");
+
+ putchar('\n');
+ printf("LOAD POSITIVE short BFP\n");
+ LOADxxx("lpebr", 0.0f, float, "%f");
+ LOADxxx("lpebr", -0.0f, float, "%f");
+ LOADxxx("lpebr", 123.0f, float, "%f");
+ LOADxxx("lpebr", -12.0f, float, "%f");
+ LOADxxx("lpebr", NAN, float, "%f");
+ LOADxxx("lpebr", -NAN, float, "%f");
+ LOADxxx("lpebr", INFINITY, float, "%f");
+ LOADxxx("lpebr", -INFINITY, float, "%f");
+
+ printf("LOAD POSITIVE long BFP\n");
+ LOADxxx("lpdbr", 0.0, double, "%f");
+ LOADxxx("lpdbr", -0.0, double, "%f");
+ LOADxxx("lpdbr", 123.0, double, "%f");
+ LOADxxx("lpdbr", -12.0, double, "%f");
+ LOADxxx("lpdbr", NAN, double, "%f");
+ LOADxxx("lpdbr", -NAN, double, "%f");
+ LOADxxx("lpdbr", INFINITY, double, "%f");
+ LOADxxx("lpdbr", -INFINITY, double, "%f");
+
+ printf("LOAD POSITIVE extended BFP\n");
+ LOADxxx("lpxbr", 0.0L, long double, "%Lf");
+ LOADxxx("lpxbr", -0.0L, long double, "%Lf");
+ LOADxxx("lpxbr", 123.0L, long double, "%Lf");
+ LOADxxx("lpxbr", -12.0L, long double, "%Lf");
+ LOADxxx("lpxbr", NAN, long double, "%Lf");
+ LOADxxx("lpxbr", -NAN, long double, "%Lf");
+ LOADxxx("lpxbr", INFINITY, long double, "%Lf");
+ LOADxxx("lpxbr", -INFINITY, long double, "%Lf");
+
+ putchar('\n');
+ printf("LOAD COMPLEMENT short BFP\n");
+ LOADxxx("lcebr", 0.0f, float, "%f");
+ LOADxxx("lcebr", -0.0f, float, "%f");
+ LOADxxx("lcebr", 123.0f, float, "%f");
+ LOADxxx("lcebr", -12.0f, float, "%f");
+ LOADxxx("lcebr", NAN, float, "%f");
+ LOADxxx("lcebr", -NAN, float, "%f");
+ LOADxxx("lcebr", INFINITY, float, "%f");
+ LOADxxx("lcebr", -INFINITY, float, "%f");
+
+ printf("LOAD COMPLEMENT long BFP\n");
+ LOADxxx("lcdbr", 0.0, double, "%f");
+ LOADxxx("lcdbr", -0.0, double, "%f");
+ LOADxxx("lcdbr", 123.0, double, "%f");
+ LOADxxx("lcdbr", -12.0, double, "%f");
+ LOADxxx("lcdbr", NAN, double, "%f");
+ LOADxxx("lcdbr", -NAN, double, "%f");
+ LOADxxx("lcdbr", INFINITY, double, "%f");
+ LOADxxx("lcdbr", -INFINITY, double, "%f");
+
+ printf("LOAD COMPLEMENT extended BFP\n");
+ LOADxxx("lcxbr", 0.0L, long double, "%Lf");
+ LOADxxx("lcxbr", -0.0L, long double, "%Lf");
+ LOADxxx("lcxbr", 123.0L, long double, "%Lf");
+ LOADxxx("lcxbr", -12.0L, long double, "%Lf");
+ LOADxxx("lcxbr", NAN, long double, "%Lf");
+ LOADxxx("lcxbr", -NAN, long double, "%Lf");
+ LOADxxx("lcxbr", INFINITY, long double, "%Lf");
+ LOADxxx("lcxbr", -INFINITY, long double, "%Lf");
+
+ putchar('\n');
+ printf("LOAD ZERO\n");
+ lzxr();
+
+ return 0;
+}
diff --git a/none/tests/s390x/rounding-1.stderr.exp b/none/tests/s390x/bfp-load.stderr.exp
similarity index 100%
rename from none/tests/s390x/rounding-1.stderr.exp
rename to none/tests/s390x/bfp-load.stderr.exp
diff --git a/none/tests/s390x/bfp-load.stdout.exp b/none/tests/s390x/bfp-load.stdout.exp
new file mode 100644
index 0000000000..a2c287c366
--- /dev/null
+++ b/none/tests/s390x/bfp-load.stdout.exp
@@ -0,0 +1,109 @@
+LOAD AND TEST short BFP
+ltebr 100.000000 -> 100.000000 cc = 2
+ltebr -10.500000 -> -10.500000 cc = 1
+ltebr 0.000000 -> 0.000000 cc = 0
+ltebr nan -> nan cc = 3
+ltebr -nan -> -nan cc = 3
+ltebr inf -> inf cc = 2
+ltebr -inf -> -inf cc = 1
+LOAD AND TEST long BFP
+ltdbr 100.000000 -> 100.000000 cc = 2
+ltdbr -10.500000 -> -10.500000 cc = 1
+ltdbr 0.000000 -> 0.000000 cc = 0
+ltdbr nan -> nan cc = 3
+ltdbr inf -> inf cc = 2
+ltdbr -inf -> -inf cc = 1
+LOAD AND TEST extended BFP
+ltxbr 100.000000 -> 100.000000 cc = 2
+ltxbr -10.500000 -> -10.500000 cc = 1
+ltxbr 0.000000 -> 0.000000 cc = 0
+ltxbr nan -> nan cc = 3
+ltxbr inf -> inf cc = 2
+ltxbr -inf -> -inf cc = 1
+
+LOAD NEGATIVE short BFP
+lnebr 0.000000 -> -0.000000 cc = 0
+lnebr -0.000000 -> -0.000000 cc = 0
+lnebr 123.000000 -> -123.000000 cc = 1
+lnebr -12.000000 -> -12.000000 cc = 1
+lnebr nan -> -nan cc = 3
+lnebr -nan -> -nan cc = 3
+lnebr inf -> -inf cc = 1
+lnebr -inf -> -inf cc = 1
+LOAD NEGATIVE long BFP
+lndbr 0.000000 -> -0.000000 cc = 0
+lndbr -0.000000 -> -0.000000 cc = 0
+lndbr 123.000000 -> -123.000000 cc = 1
+lndbr -12.000000 -> -12.000000 cc = 1
+lndbr nan -> -nan cc = 3
+lndbr -nan -> -nan cc = 3
+lndbr inf -> -inf cc = 1
+lndbr -inf -> -inf cc = 1
+LOAD NEGATIVE extended BFP
+lnxbr 0.000000 -> -0.000000 cc = 0
+lnxbr -0.000000 -> -0.000000 cc = 0
+lnxbr 123.000000 -> -123.000000 cc = 1
+lnxbr -12.000000 -> -12.000000 cc = 1
+lnxbr nan -> -nan cc = 3
+lnxbr -nan -> -nan cc = 3
+lnxbr inf -> -inf cc = 1
+lnxbr -inf -> -inf cc = 1
+
+LOAD POSITIVE short BFP
+lpebr 0.000000 -> 0.000000 cc = 0
+lpebr -0.000000 -> 0.000000 cc = 0
+lpebr 123.000000 -> 123.000000 cc = 2
+lpebr -12.000000 -> 12.000000 cc = 2
+lpebr nan -> nan cc = 3
+lpebr -nan -> nan cc = 3
+lpebr inf -> inf cc = 2
+lpebr -inf -> inf cc = 2
+LOAD POSITIVE long BFP
+lpdbr 0.000000 -> 0.000000 cc = 0
+lpdbr -0.000000 -> 0.000000 cc = 0
+lpdbr 123.000000 -> 123.000000 cc = 2
+lpdbr -12.000000 -> 12.000000 cc = 2
+lpdbr nan -> nan cc = 3
+lpdbr -nan -> nan cc = 3
+lpdbr inf -> inf cc = 2
+lpdbr -inf -> inf cc = 2
+LOAD POSITIVE extended BFP
+lpxbr 0.000000 -> 0.000000 cc = 0
+lpxbr -0.000000 -> 0.000000 cc = 0
+lpxbr 123.000000 -> 123.000000 cc = 2
+lpxbr -12.000000 -> 12.000000 cc = 2
+lpxbr nan -> nan cc = 3
+lpxbr -nan -> nan cc = 3
+lpxbr inf -> inf cc = 2
+lpxbr -inf -> inf cc = 2
+
+LOAD COMPLEMENT short BFP
+lcebr 0.000000 -> -0.000000 cc = 0
+lcebr -0.000000 -> 0.000000 cc = 0
+lcebr 123.000000 -> -123.000000 cc = 1
+lcebr -12.000000 -> 12.000000 cc = 2
+lcebr nan -> -nan cc = 3
+lcebr -nan -> nan cc = 3
+lcebr inf -> -inf cc = 1
+lcebr -inf -> inf cc = 2
+LOAD COMPLEMENT long BFP
+lcdbr 0.000000 -> -0.000000 cc = 0
+lcdbr -0.000000 -> 0.000000 cc = 0
+lcdbr 123.000000 -> -123.000000 cc = 1
+lcdbr -12.000000 -> 12.000000 cc = 2
+lcdbr nan -> -nan cc = 3
+lcdbr -nan -> nan cc = 3
+lcdbr inf -> -inf cc = 1
+lcdbr -inf -> inf cc = 2
+LOAD COMPLEMENT extended BFP
+lcxbr 0.000000 -> -0.000000 cc = 0
+lcxbr -0.000000 -> 0.000000 cc = 0
+lcxbr 123.000000 -> -123.000000 cc = 1
+lcxbr -12.000000 -> 12.000000 cc = 2
+lcxbr nan -> -nan cc = 3
+lcxbr -nan -> nan cc = 3
+lcxbr inf -> -inf cc = 1
+lcxbr -inf -> inf cc = 2
+
+LOAD ZERO
+lzxr --> 00000000 00000000 00000000 00000000
diff --git a/none/tests/s390x/bfp-load.vgtest b/none/tests/s390x/bfp-load.vgtest
new file mode 100644
index 0000000000..3e1dfc7db6
--- /dev/null
+++ b/none/tests/s390x/bfp-load.vgtest
@@ -0,0 +1 @@
+prog: bfp-load
diff --git a/none/tests/s390x/bfp-3.c b/none/tests/s390x/bfp-muldiv.c
similarity index 57%
rename from none/tests/s390x/bfp-3.c
rename to none/tests/s390x/bfp-muldiv.c
index 857e1c83ff..d7d66f2632 100644
--- a/none/tests/s390x/bfp-3.c
+++ b/none/tests/s390x/bfp-muldiv.c
@@ -1,7 +1,9 @@
#include
+#include
/* Test BFP multiply and add/sub 32/64-bit. There are no such insns
- working with 128-bit data */
+ working with 128-bit data.
+ Also test division making sure operand order is preserved. */
void maebr(float v1, float v2, float v3)
{
@@ -39,8 +41,40 @@ void msdbr(double v1, double v2, double v3)
printf("msdbr %f * %f - %f -> %f\n", v2, v3, v1, r1);
}
+static void debr(float v1, float v2)
+{
+ float r1 = v1;
+
+ __asm__ volatile("debr %[r1],%[r2]"
+ : [r1]"+f"(v1)
+ : [r2]"f"(v2));
+ printf("debr %f / %f -> %f\n", r1, v2, v1);
+}
+
+static void ddbr(double v1, double v2)
+{
+ double r1 = v1;
+
+ __asm__ volatile("ddbr %[r1],%[r2]"
+ : [r1]"+f"(v1)
+ : [r2]"f"(v2));
+ printf("ddbr %f / %f -> %f\n", r1, v2, v1);
+}
+
+static void dxbr(long double v1, long double v2)
+{
+ long double r1 = v1;
+
+ __asm__ volatile("dxbr %[r1],%[r2]"
+ : [r1]"+f"(v1)
+ : [r2]"f"(v2));
+ printf("dxbr %Lf / %Lf -> %Lf\n", r1, v2, v1);
+}
+
int main(void)
{
+ assert(sizeof(long double) == 16);
+
// multiply and add
maebr(10.5f, 20.25, 3.0); // 4 byte values
madbr(-10.5, 42.75, -2.0); // 8 byte values
@@ -49,5 +83,10 @@ int main(void)
msebr(10.5f, 20.25, 3.0); // 4 byte values
msdbr(-10.5, 42.75, -2.0); // 8 byte values
+ /* Just checking that the operand order is not mixed up. */
+ debr(10.0f, 2.0f);
+ ddbr(10.0, 2.0);
+ dxbr(10.0L, 2.0L);
+
return 0;
}
diff --git a/none/tests/s390x/rounding-2.stderr.exp b/none/tests/s390x/bfp-muldiv.stderr.exp
similarity index 100%
rename from none/tests/s390x/rounding-2.stderr.exp
rename to none/tests/s390x/bfp-muldiv.stderr.exp
diff --git a/none/tests/s390x/bfp-3.stdout.exp b/none/tests/s390x/bfp-muldiv.stdout.exp
similarity index 64%
rename from none/tests/s390x/bfp-3.stdout.exp
rename to none/tests/s390x/bfp-muldiv.stdout.exp
index bd9e5c49c3..b1eb0a72e8 100644
--- a/none/tests/s390x/bfp-3.stdout.exp
+++ b/none/tests/s390x/bfp-muldiv.stdout.exp
@@ -2,3 +2,6 @@ maebr 20.250000 * 3.000000 + 10.500000 -> 71.250000
madbr 42.750000 * -2.000000 + -10.500000 -> -96.000000
msebr 20.250000 * 3.000000 - 10.500000 -> 50.250000
msdbr 42.750000 * -2.000000 - -10.500000 -> -75.000000
+debr 10.000000 / 2.000000 -> 5.000000
+ddbr 10.000000 / 2.000000 -> 5.000000
+dxbr 10.000000 / 2.000000 -> 5.000000
diff --git a/none/tests/s390x/bfp-muldiv.vgtest b/none/tests/s390x/bfp-muldiv.vgtest
new file mode 100644
index 0000000000..df1275fa7e
--- /dev/null
+++ b/none/tests/s390x/bfp-muldiv.vgtest
@@ -0,0 +1 @@
+prog: bfp-muldiv
diff --git a/none/tests/s390x/bfp-tdc.c b/none/tests/s390x/bfp-tdc.c
new file mode 100644
index 0000000000..a8b6769efc
--- /dev/null
+++ b/none/tests/s390x/bfp-tdc.c
@@ -0,0 +1,140 @@
+/* TEST DATA CLASS
+
+ Test for subnormal numbers is missing. I do not know how */
+#include
+#include // NAN
+#include // DBL_MIN
+#include
+
+#define ZERO_P (1 << 11)
+#define ZERO_N (1 << 10)
+#define NORM_P (1 << 9)
+#define NORM_N (1 << 8)
+#define SUBNORM_P (1 << 7)
+#define SUBNORM_N (1 << 6)
+#define INF_P (1 << 5)
+#define INF_N (1 << 4)
+#define QNAN_P (1 << 3)
+#define QNAN_N (1 << 2)
+#define SNAN_P (1 << 1)
+#define SNAN_N (1 << 0)
+
+static struct what {
+ unsigned bitno;
+ unsigned mask;
+ const char *str;
+} whatsit[] = {
+ { 63, SNAN_N, "Signaling Nan with sign bit negative" },
+ { 62, SNAN_P, "Signaling Nan with sign bit posative" },
+ { 61, QNAN_N, "Quiet Nan with sign bit negative" },
+ { 60, QNAN_P, "Quiet Nan with sign bit posative" },
+ { 59, INF_N, "Infinity with sign bit negative" },
+ { 58, INF_P, "Infinity with sign bit positive" },
+ { 57, SUBNORM_N, "Subnormal number with sign bit negative" },
+ { 56, SUBNORM_N, "Subnormal number with sign bit positive" },
+ { 55, NORM_N, "Normal number with sign bit negative" },
+ { 54, NORM_P, "Normal number with sign bit positive" },
+ { 53, ZERO_N, "Zero with sign bit negative" },
+ { 52, ZERO_P, "Zero with sign bit positive" }
+};
+
+#define TDC(insn, type, value, m) \
+ ({ \
+ int cc; \
+ type r1 = value; \
+ \
+ __asm__ volatile(#insn " %[r1],0(%[mask])\n\t" \
+ "ipm %[psw]\n\t" \
+ "srl %[psw],28\n\t" \
+ : [psw]"+d"(cc) \
+ : [r1]"f"(r1), [mask]"a"(m) \
+ : "cc"); \
+ cc; \
+ })
+
+static void
+do_tceb(float value)
+{
+ for (int i = 0; i < sizeof(whatsit) / sizeof(*whatsit); ++i) {
+ int ccv = TDC(tceb, float, value, whatsit[i].mask);
+ if (ccv == 1)
+ printf("value = %f\t\tcc = %d %s\n", value, ccv,
+ whatsit[i].str);
+ }
+}
+
+static void
+do_tcdb(double value)
+{
+ for (int i = 0; i < sizeof(whatsit) / sizeof(*whatsit); ++i) {
+ int ccv = TDC(tcdb, double, value, whatsit[i].mask);
+ if (ccv == 1)
+ printf("value = %f\t\tcc = %d %s\n", value, ccv,
+ whatsit[i].str);
+ }
+}
+
+static void
+do_tcxb(long double value)
+{
+ for (int i = 0; i < sizeof(whatsit) / sizeof(*whatsit); ++i) {
+ int ccv = TDC(tcxb, long double, value, whatsit[i].mask);
+ if (ccv == 1)
+ printf("value = %Lf\t\tcc = %d %s\n", value, ccv,
+ whatsit[i].str);
+ }
+}
+
+int
+main(void)
+{
+ assert(sizeof(long double) == 16);
+
+ printf("32-bit tests\n");
+ do_tceb(0.0f);
+ do_tceb(-0.0f);
+ do_tceb(3.0f);
+ do_tceb(-3.0f);
+ do_tceb(NAN);
+ do_tceb(-NAN);
+ do_tceb(INFINITY);
+ do_tceb(-INFINITY);
+ do_tceb(__builtin_nansf(""));
+ do_tceb(-__builtin_nansf(""));
+ do_tceb(FLT_MIN / 2);
+ do_tceb(-FLT_MIN / 2);
+
+ printf("\n64-bit tests\n");
+ do_tcdb(0.0);
+ do_tcdb(-0.0);
+ do_tcdb(3.0);
+ do_tcdb(-3.0);
+ do_tcdb(NAN);
+ do_tcdb(-NAN);
+ do_tcdb(INFINITY);
+ do_tcdb(-INFINITY);
+ do_tcdb(__builtin_nans(""));
+ do_tcdb(-__builtin_nans(""));
+ do_tcdb(DBL_MIN / 2);
+ do_tcdb(-DBL_MIN / 2);
+
+ printf("\n128-bit tests\n");
+ do_tcxb(0.0L);
+ do_tcxb(-0.0L);
+ do_tcxb(3.0L);
+ do_tcxb(-3.0L);
+ do_tcxb(NAN);
+ do_tcxb(-NAN);
+ do_tcxb(INFINITY);
+ do_tcxb(-INFINITY);
+ do_tcxb(__builtin_nansl(""));
+ do_tcxb(-__builtin_nansl(""));
+#if 0
+ /* Figuring out subnormal numbers for 128-bit BFP is left as
+ an exercise.. */
+ do_tcdb(LDBL_MIN / 2);
+ do_tcdb(-LDBL_MIN / 2);
+#endif
+
+ return 0;
+}
diff --git a/none/tests/s390x/rounding-3.stderr.exp b/none/tests/s390x/bfp-tdc.stderr.exp
similarity index 100%
rename from none/tests/s390x/rounding-3.stderr.exp
rename to none/tests/s390x/bfp-tdc.stderr.exp
diff --git a/none/tests/s390x/bfp-tdc.stdout.exp b/none/tests/s390x/bfp-tdc.stdout.exp
new file mode 100644
index 0000000000..032287b590
--- /dev/null
+++ b/none/tests/s390x/bfp-tdc.stdout.exp
@@ -0,0 +1,39 @@
+32-bit tests
+value = 0.000000 cc = 1 Zero with sign bit positive
+value = -0.000000 cc = 1 Zero with sign bit negative
+value = 3.000000 cc = 1 Normal number with sign bit positive
+value = -3.000000 cc = 1 Normal number with sign bit negative
+value = nan cc = 1 Quiet Nan with sign bit posative
+value = -nan cc = 1 Quiet Nan with sign bit negative
+value = inf cc = 1 Infinity with sign bit positive
+value = -inf cc = 1 Infinity with sign bit negative
+value = nan cc = 1 Signaling Nan with sign bit posative
+value = -nan cc = 1 Signaling Nan with sign bit negative
+value = -0.000000 cc = 1 Subnormal number with sign bit negative
+value = -0.000000 cc = 1 Subnormal number with sign bit positive
+
+64-bit tests
+value = 0.000000 cc = 1 Zero with sign bit positive
+value = -0.000000 cc = 1 Zero with sign bit negative
+value = 3.000000 cc = 1 Normal number with sign bit positive
+value = -3.000000 cc = 1 Normal number with sign bit negative
+value = nan cc = 1 Quiet Nan with sign bit posative
+value = -nan cc = 1 Quiet Nan with sign bit negative
+value = inf cc = 1 Infinity with sign bit positive
+value = -inf cc = 1 Infinity with sign bit negative
+value = nan cc = 1 Signaling Nan with sign bit posative
+value = -nan cc = 1 Signaling Nan with sign bit negative
+value = -0.000000 cc = 1 Subnormal number with sign bit negative
+value = -0.000000 cc = 1 Subnormal number with sign bit positive
+
+128-bit tests
+value = 0.000000 cc = 1 Zero with sign bit positive
+value = -0.000000 cc = 1 Zero with sign bit negative
+value = 3.000000 cc = 1 Normal number with sign bit positive
+value = -3.000000 cc = 1 Normal number with sign bit negative
+value = nan cc = 1 Quiet Nan with sign bit posative
+value = -nan cc = 1 Quiet Nan with sign bit negative
+value = inf cc = 1 Infinity with sign bit positive
+value = -inf cc = 1 Infinity with sign bit negative
+value = nan cc = 1 Signaling Nan with sign bit posative
+value = -nan cc = 1 Signaling Nan with sign bit negative
diff --git a/none/tests/s390x/bfp-tdc.vgtest b/none/tests/s390x/bfp-tdc.vgtest
new file mode 100644
index 0000000000..306de25ab1
--- /dev/null
+++ b/none/tests/s390x/bfp-tdc.vgtest
@@ -0,0 +1 @@
+prog: bfp-tdc
diff --git a/none/tests/s390x/cvb.c b/none/tests/s390x/cvb.c
index ce5f9e405c..3f928a6b21 100644
--- a/none/tests/s390x/cvb.c
+++ b/none/tests/s390x/cvb.c
@@ -1,104 +1,89 @@
+#include
#include
-static unsigned long test[] ={
- 0x000000000000000a,
- 0x000000000000001a,
- 0x000000000000012a,
- 0x000000000000123a,
- 0x000000000001234a,
- 0x000000000012345a,
- 0x000000000123456a,
- 0x000000001234567a,
- 0x000000012345678a,
- 0x000000123456789a,
- 0x000001234567890a,
- 0x000000000000000b,
- 0x000000000000001b,
- 0x000000000000012b,
- 0x000000000000123b,
- 0x000000000001234b,
- 0x000000000012345b,
- 0x000000000123456b,
- 0x000000001234567b,
- 0x000000012345678b,
- 0x000000123456789b,
- 0x000001234567890b,
- 0x000000000000000c,
- 0x000000000000001c,
- 0x000000000000012c,
- 0x000000000000123c,
- 0x000000000001234c,
- 0x000000000012345c,
- 0x000000000123456c,
- 0x000000001234567c,
- 0x000000012345678c,
- 0x000000123456789c,
- 0x000001234567890c,
- 0x000000000000000d,
- 0x000000000000001d,
- 0x000000000000012d,
- 0x000000000000123d,
- 0x000000000001234d,
- 0x000000000012345d,
- 0x000000000123456d,
- 0x000000001234567d,
- 0x000000012345678d,
- 0x000000123456789d,
- 0x000001234567890d,
- 0x000000000000000e,
- 0x000000000000001e,
- 0x000000000000012e,
- 0x000000000000123e,
- 0x000000000001234e,
- 0x000000000012345e,
- 0x000000000123456e,
- 0x000000001234567e,
- 0x000000012345678e,
- 0x000000123456789e,
- 0x000001234567890e,
- 0x000000000000000f,
- 0x000000000000001f,
- 0x000000000000012f,
- 0x000000000000123f,
- 0x000000000001234f,
- 0x000000000012345f,
- 0x000000000123456f,
- 0x000000001234567f,
- 0x000000012345678f,
- 0x000000123456789f,
- 0x000001234567890f,
- /* min and max */
- 0x000002147483647c,
- 0x000002147483648d,
-
-/* fixs390: we also need to check if invalid values cause a fixed-point-devide exception.
- Not yet implemented. */
-/* 0x000002147483648c,
- 0x000002147483649d,
- 0x00000000000000fa, */
-
+/* Valid values (excluding sign code) */
+static const unsigned long valid[] = {
+ 0x0000000000000000,
+ 0x0000000000000010,
+ 0x0000000000000120,
+ 0x0000000000001230,
+ 0x0000000000012340,
+ 0x0000000000123450,
+ 0x0000000001234560,
+ 0x0000000012345670,
+ 0x0000000123456780,
+ 0x0000001234567890,
+ 0x0000012345678900,
};
+/* Boundary values (excluding sign code) */
+static const unsigned long max = 0x0000021474836470;
+static const unsigned long min = 0x0000021474836480;
+
+/* Valid sign codes */
+static const unsigned sign_code_pos[] = { 0xa, 0xc, 0xe, 0xf };
+static const unsigned sign_code_neg[] = { 0xb, 0xd };
+
+#define NUM_EL(x) (sizeof(x) / sizeof(*(x)))
-static signed int dec_to_hex(unsigned long *addr)
+/* The value pointed to by ADDR is valid including sign code. */
+static signed int
+dec_to_hex(unsigned long *addr)
{
- register signed int res asm("2") = 0;
- register unsigned long *_addr asm("4") = addr;
+ long res;
+ int res1, res2;
- asm volatile(
- " cvb %0,0(0,%1)"
- : "=d" (res) : "d" (_addr) : "memory");
- return res & 0xffffffff;
-}
+ res = 0;
+ asm volatile("cvb %0,0(0,%1)"
+ : "+d" (res) : "a" (addr) : "memory");
+
+ // bits [0:31] ought to be unchanged
+ // Catch bits that are set but shouldn't be
+ assert((res >> 32) == 0);
+ res1 = (int)res;
+ res = -1;
+ asm volatile("cvb %0,0(0,%1)"
+ : "+d" (res) : "a" (addr) : "memory");
+ // bits [0:31] ought to be unchanged
+ // Catch bits that are cleared but shouldn't be
+ assert((res >> 32) == -1);
+ res2 = (int)(res & 0xffffffff);
+ // Successful conversion
+ assert(res1 == res2);
-int main()
+ return res1;
+}
+
+int main(void)
{
- int i;
+ for (int sign_code = 0xa; sign_code <= 0xf; ++sign_code) {
+ printf("Testing in-range values with sign code 0x%x\n", sign_code);
+ for (int i = 0; i < NUM_EL(valid); ++i) {
+ unsigned long value = valid[i] | sign_code;
+ printf("0x%016lx --> %d\n", value, dec_to_hex(&value));
+ }
+ }
+ printf("\n");
+
+ printf("Testing max. value 0x%lx\n", max >> 4);
+ for (int i = 0; i < NUM_EL(sign_code_pos); ++i) {
+ unsigned sign_code = sign_code_pos[i];
+ unsigned long value = max | sign_code;
+ printf("0x%016lx --> %d\n", value, dec_to_hex(&value));
+ }
+ printf("\n");
+
+ printf("Testing min. value 0x%lx\n", min >> 4);
+ for (int i = 0; i < NUM_EL(sign_code_neg); ++i) {
+ unsigned sign_code = sign_code_neg[i];
+ unsigned long value = min | sign_code;
+ printf("0x%016lx --> %d\n", value, dec_to_hex(&value));
+ }
+
+ /* fixs390: check behaviour for invalid values, out-of-range values and values with invalid sign code */
- for (i = 0; i < sizeof(test) / sizeof(test[0]); i++)
- printf("%d\n", dec_to_hex(&test[i]));
- return 0;
+ return 0;
}
diff --git a/none/tests/s390x/cvb.stdout.exp b/none/tests/s390x/cvb.stdout.exp
index 35d6a600fe..268ea354d2 100644
--- a/none/tests/s390x/cvb.stdout.exp
+++ b/none/tests/s390x/cvb.stdout.exp
@@ -1,68 +1,82 @@
-0
-1
-12
-123
-1234
-12345
-123456
-1234567
-12345678
-123456789
-1234567890
-0
--1
--12
--123
--1234
--12345
--123456
--1234567
--12345678
--123456789
--1234567890
-0
-1
-12
-123
-1234
-12345
-123456
-1234567
-12345678
-123456789
-1234567890
-0
--1
--12
--123
--1234
--12345
--123456
--1234567
--12345678
--123456789
--1234567890
-0
-1
-12
-123
-1234
-12345
-123456
-1234567
-12345678
-123456789
-1234567890
-0
-1
-12
-123
-1234
-12345
-123456
-1234567
-12345678
-123456789
-1234567890
-2147483647
--2147483648
+Testing in-range values with sign code 0xa
+0x000000000000000a --> 0
+0x000000000000001a --> 1
+0x000000000000012a --> 12
+0x000000000000123a --> 123
+0x000000000001234a --> 1234
+0x000000000012345a --> 12345
+0x000000000123456a --> 123456
+0x000000001234567a --> 1234567
+0x000000012345678a --> 12345678
+0x000000123456789a --> 123456789
+0x000001234567890a --> 1234567890
+Testing in-range values with sign code 0xb
+0x000000000000000b --> 0
+0x000000000000001b --> -1
+0x000000000000012b --> -12
+0x000000000000123b --> -123
+0x000000000001234b --> -1234
+0x000000000012345b --> -12345
+0x000000000123456b --> -123456
+0x000000001234567b --> -1234567
+0x000000012345678b --> -12345678
+0x000000123456789b --> -123456789
+0x000001234567890b --> -1234567890
+Testing in-range values with sign code 0xc
+0x000000000000000c --> 0
+0x000000000000001c --> 1
+0x000000000000012c --> 12
+0x000000000000123c --> 123
+0x000000000001234c --> 1234
+0x000000000012345c --> 12345
+0x000000000123456c --> 123456
+0x000000001234567c --> 1234567
+0x000000012345678c --> 12345678
+0x000000123456789c --> 123456789
+0x000001234567890c --> 1234567890
+Testing in-range values with sign code 0xd
+0x000000000000000d --> 0
+0x000000000000001d --> -1
+0x000000000000012d --> -12
+0x000000000000123d --> -123
+0x000000000001234d --> -1234
+0x000000000012345d --> -12345
+0x000000000123456d --> -123456
+0x000000001234567d --> -1234567
+0x000000012345678d --> -12345678
+0x000000123456789d --> -123456789
+0x000001234567890d --> -1234567890
+Testing in-range values with sign code 0xe
+0x000000000000000e --> 0
+0x000000000000001e --> 1
+0x000000000000012e --> 12
+0x000000000000123e --> 123
+0x000000000001234e --> 1234
+0x000000000012345e --> 12345
+0x000000000123456e --> 123456
+0x000000001234567e --> 1234567
+0x000000012345678e --> 12345678
+0x000000123456789e --> 123456789
+0x000001234567890e --> 1234567890
+Testing in-range values with sign code 0xf
+0x000000000000000f --> 0
+0x000000000000001f --> 1
+0x000000000000012f --> 12
+0x000000000000123f --> 123
+0x000000000001234f --> 1234
+0x000000000012345f --> 12345
+0x000000000123456f --> 123456
+0x000000001234567f --> 1234567
+0x000000012345678f --> 12345678
+0x000000123456789f --> 123456789
+0x000001234567890f --> 1234567890
+
+Testing max. value 0x2147483647
+0x000002147483647a --> 2147483647
+0x000002147483647c --> 2147483647
+0x000002147483647e --> 2147483647
+0x000002147483647f --> 2147483647
+
+Testing min. value 0x2147483648
+0x000002147483648b --> -2147483648
+0x000002147483648d --> -2147483648
diff --git a/none/tests/s390x/dfp-XiC.post.exp b/none/tests/s390x/dfp-XiC.post.exp
new file mode 100644
index 0000000000..e51ad83302
--- /dev/null
+++ b/none/tests/s390x/dfp-XiC.post.exp
@@ -0,0 +1,36 @@
+
+============================================================
+DFP LOAD LENGTHENED
+============================================================
+Testing: ldetr 0,0,8
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-invalid-operation-exception
+ control (XiC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-invalid-operation exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: lxdtr 0,0,8
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-invalid-operation-exception
+ control (XiC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-invalid-operation exceptions will not be suppressed.
+ at 0x........: (below main)
+
+
+============================================================
+DFP LOAD ROUNDED
+============================================================
+Testing: ledtr 0,0,0,8
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-invalid-operation-exception
+ control (XiC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-invalid-operation exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: ldxtr 0,0,0,8
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-invalid-operation-exception
+ control (XiC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-invalid-operation exceptions will not be suppressed.
+ at 0x........: (below main)
+
diff --git a/none/tests/s390x/rounding-4.stderr.exp b/none/tests/s390x/dfp-XiC.stderr.exp
similarity index 100%
rename from none/tests/s390x/rounding-4.stderr.exp
rename to none/tests/s390x/dfp-XiC.stderr.exp
diff --git a/none/tests/s390x/dfp-XiC.vgtest b/none/tests/s390x/dfp-XiC.vgtest
new file mode 100644
index 0000000000..bea81fbee8
--- /dev/null
+++ b/none/tests/s390x/dfp-XiC.vgtest
@@ -0,0 +1,3 @@
+prereq: ../../../tests/s390x_features s390x-fpext && ../../../tests/s390x_features s390x-dfp
+prog: /bin/true
+post: ./emwarn-gen.pl --dfp-XiC
diff --git a/none/tests/s390x/dfp-XxC.post.exp b/none/tests/s390x/dfp-XxC.post.exp
new file mode 100644
index 0000000000..a3af320116
--- /dev/null
+++ b/none/tests/s390x/dfp-XxC.post.exp
@@ -0,0 +1,146 @@
+
+============================================================
+DFP CONVERT FROM FIXED
+============================================================
+Testing: cdgtra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cxgtra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cdftr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cxftr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+
+============================================================
+DFP CONVERT FROM LOGICAL
+============================================================
+Testing: cdlgtr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cxlgtr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cdlftr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cxlftr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+
+============================================================
+DFP CONVERT TO FIXED
+============================================================
+Testing: cgdtra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cgxtra 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cfdtr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: cfxtr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+
+============================================================
+DFP CONVERT TO LOGICAL
+============================================================
+Testing: clgdtr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: clgxtr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: clfdtr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: clfxtr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+
+============================================================
+DFP LOAD ROUNDED
+============================================================
+Testing: ledtr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
+Testing: ldxtr 0,0,0,4
+Emulation warning: unsupported action:
+ Encountered an insn with the IEEE-inexact-exception control
+ (XxC) bit set to 1. This is not supported. Continuing anyway.
+ IEEE-inexact exceptions will not be suppressed.
+ at 0x........: (below main)
+
diff --git a/none/tests/s390x/rounding-5.stderr.exp b/none/tests/s390x/dfp-XxC.stderr.exp
similarity index 100%
rename from none/tests/s390x/rounding-5.stderr.exp
rename to none/tests/s390x/dfp-XxC.stderr.exp
diff --git a/none/tests/s390x/dfp-XxC.vgtest b/none/tests/s390x/dfp-XxC.vgtest
new file mode 100644
index 0000000000..681c300a12
--- /dev/null
+++ b/none/tests/s390x/dfp-XxC.vgtest
@@ -0,0 +1,3 @@
+prereq: ../../../tests/s390x_features s390x-fpext && ../../../tests/s390x_features s390x-dfp
+prog: /bin/true
+post: ./emwarn-gen.pl --dfp-XxC
diff --git a/none/tests/s390x/disasm-test/Makefile.am b/none/tests/s390x/disasm-test/Makefile.am
index 61d4f31963..150f38b321 100644
--- a/none/tests/s390x/disasm-test/Makefile.am
+++ b/none/tests/s390x/disasm-test/Makefile.am
@@ -1,6 +1,6 @@
-include $(top_srcdir)/Makefile.all.am
+include $(top_srcdir)/Makefile.tool-tests.am
-EXTRA_DIST = disasm-test.vgtest disasm-test.stderr.exp disasm-test.stdout.exp \
+EXTRA_DIST = disasm-test.vgtest disasm-test.stderr.exp \
disasm-test.post.exp
dist_noinst_SCRIPTS = filter_stderr
@@ -29,7 +29,7 @@ disasm_test_SOURCES = $(SOURCES)
disasm_test_CPPFLAGS = $(AM_CPPFLAGS_PRI) \
-I$(top_srcdir)/VEX/pub \
-I$(top_srcdir)/VEX/priv
-disasm_test_CFLAGS = $(AM_CFLAGS_PRI)
+disasm_test_CFLAGS = $(AM_CFLAGS_PRI) -fhosted
disasm_test_DEPENDENCIES = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
disasm_test_LDADD = $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
disasm_test_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@
diff --git a/none/tests/s390x/disasm-test/disasm-test.post.exp b/none/tests/s390x/disasm-test/disasm-test.post.exp
index 34722229c0..0f31f36ca6 100644
--- a/none/tests/s390x/disasm-test/disasm-test.post.exp
+++ b/none/tests/s390x/disasm-test/disasm-test.post.exp
@@ -1,4 +1,4 @@
-Total: 148751 tests generated
-Total: 148659 insns verified
+Total: 148776 tests generated
+Total: 148684 insns verified
Total: 0 disassembly mismatches
Total: 92 specification exceptions
diff --git a/none/tests/s390x/disasm-test/disasm-test.stderr.exp b/none/tests/s390x/disasm-test/disasm-test.stderr.exp
index 139597f9cb..e69de29bb2 100644
--- a/none/tests/s390x/disasm-test/disasm-test.stderr.exp
+++ b/none/tests/s390x/disasm-test/disasm-test.stderr.exp
@@ -1,2 +0,0 @@
-
-
diff --git a/none/tests/s390x/disasm-test/filter_stderr b/none/tests/s390x/disasm-test/filter_stderr
index f4c67057ee..17cc8adf58 100755
--- a/none/tests/s390x/disasm-test/filter_stderr
+++ b/none/tests/s390x/disasm-test/filter_stderr
@@ -1,3 +1,4 @@
#!/bin/sh
-../../filter_stderr "$@"
+# Nothing to filter.
+true
diff --git a/none/tests/s390x/disasm-test/generate.c b/none/tests/s390x/disasm-test/generate.c
index 408fe370e0..abde6bfef9 100644
--- a/none/tests/s390x/disasm-test/generate.c
+++ b/none/tests/s390x/disasm-test/generate.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/none/tests/s390x/disasm-test/main.c b/none/tests/s390x/disasm-test/main.c
index aa362b511e..7805a1859d 100644
--- a/none/tests/s390x/disasm-test/main.c
+++ b/none/tests/s390x/disasm-test/main.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/none/tests/s390x/disasm-test/main.h b/none/tests/s390x/disasm-test/main.h
index 8c51b1dc20..cdf75d2416 100644
--- a/none/tests/s390x/disasm-test/main.h
+++ b/none/tests/s390x/disasm-test/main.h
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/none/tests/s390x/disasm-test/objdump.c b/none/tests/s390x/disasm-test/objdump.c
index 7100e47420..cabb0af7cc 100644
--- a/none/tests/s390x/disasm-test/objdump.c
+++ b/none/tests/s390x/disasm-test/objdump.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -153,17 +153,6 @@ read_objdump(const char *file)
char *dis_insn = p;
- /* Remove symbolic jump targets, if any. E.g. change
- 1b68: c0 e5 ff ff fd a4 brasl %r14,16b0 to
- 1b68: c0 e5 ff ff fd a4 brasl %r14,16b0
- */
- p = strchr(p, '<');
- if (p) {
- *p-- = '\0';
- while (isspace(*p)) // remove trailing white space
- *p-- = '\0';
- }
-
if (strncmp(dis_insn, mark, strlen(mark)) == 0) {
if (marker_seen)
break; // we're done
diff --git a/none/tests/s390x/disasm-test/objdump.h b/none/tests/s390x/disasm-test/objdump.h
index 388943f7a7..ac6f72e277 100644
--- a/none/tests/s390x/disasm-test/objdump.h
+++ b/none/tests/s390x/disasm-test/objdump.h
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/none/tests/s390x/disasm-test/opcode.c b/none/tests/s390x/disasm-test/opcode.c
index e638c973c5..86cd642f3f 100644
--- a/none/tests/s390x/disasm-test/opcode.c
+++ b/none/tests/s390x/disasm-test/opcode.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -965,6 +965,7 @@ static const char *opcodes[] = {
"pfpo", // pfpo
"srnm d12(b2)",
"srnmb d12(b2)", // fpext
+ "srnmt d12(b2)",
"sfpc r1",
// sfasr not implemented
"ste f1,d12(x2,b2)",
@@ -976,6 +977,8 @@ static const char *opcodes[] = {
// Chapter 10: Control Instructions not implemented
// Chapter 14: I/O Instructions not implemented
// Chapter 18: Hexadecimal-Floating-Point Instructions not implemented
+ "lder f1,f2",
+ "lde f1,d12(x2,b2)",
// Chapter 19: Binary-Floating-Point Instructions
// Register pairs: 0-2 1-3 4-6 5-7 8-10 9-11 12-14 13-15
@@ -1154,12 +1157,12 @@ static const char *opcodes[] = {
"dxtr f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13}",
"ddtra f1,f2,f3,m4",
"dxtra f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},m4",
- "eedtr f1,f2",
- "eextr f1,f2:{0,1,4,5,8,9,12,13}",
- "esdtr f1,f2",
- "esxtr f1,f2:{0,1,4,5,8,9,12,13}",
- "iedtr f1,f3,f2",
- "iextr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},f2",
+ "eedtr r1,f2",
+ "eextr r1,f2:{0,1,4,5,8,9,12,13}",
+ "esdtr r1,f2",
+ "esxtr r1,f2:{0,1,4,5,8,9,12,13}",
+ "iedtr f1,f3,r2",
+ "iextr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},r2",
"ltdtr f1,f2",
"ltxtr f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13}",
// fidtr not implemented
@@ -1174,8 +1177,8 @@ static const char *opcodes[] = {
"mxtra f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},m4",
"qadtr f1,f3,f2,m4",
"qaxtr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},m4",
- "rrdtr f1,f3,f2,m4",
- "rrxtr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},f2,m4",
+ "rrdtr f1,f3,r2,m4",
+ "rrxtr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},r2,m4",
"sldt f1,f3,d12(x2,b2)",
"slxt f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},d12(x2,b2)",
"srdt f1,f3,d12(x2,b2)",
@@ -1408,11 +1411,11 @@ parse_int(const char *p, int is_unsigned, long long *val)
error("integer expected\n");
return p;
}
- if (is_unsigned && val < 0) {
+ if (is_unsigned && *val < 0) {
error("unsigned value expected\n");
return p;
}
- return skip_digits(val < 0 ? p + 1 : p);
+ return skip_digits(*val < 0 ? p + 1 : p);
}
@@ -1834,7 +1837,7 @@ get_opcode_by_name(const char *name)
{
unsigned len = strlen(name);
- for (int i = 0; i < num_opcodes; ++i) {
+ for (unsigned i = 0; i < num_opcodes; ++i) {
const char *op = opcodes[i];
if (strncmp(op, name, len) == 0 &&
(op[len] == ' ' || op[len] == '\0'))
@@ -1966,9 +1969,9 @@ parse_opcode(const char *spec)
if (debug) {
printf("opcode: |%s|\n", opc->name);
- for (int i = 0; i < opc->num_opnds; ++i) {
+ for (unsigned i = 0; i < opc->num_opnds; ++i) {
const opnd *d = opc->opnds + i;
- printf("opnd %2d: %-8s type: %-5s", i, d->name,
+ printf("opnd %2u: %-8s type: %-5s", i, d->name,
opnd_kind_as_string(d->kind));
if (d->kind != OPND_D12XB && d->kind != OPND_D12B &&
d->kind != OPND_D20XB && d->kind != OPND_D20B &&
@@ -1977,7 +1980,7 @@ parse_opcode(const char *spec)
if (d->allowed_values) {
printf(" values:");
unsigned nval = d->allowed_values[0];
- for (int j = 1; j <= nval; ++j) {
+ for (unsigned j = 1; j <= nval; ++j) {
if (d->is_unsigned)
printf(" %u", (unsigned)d->allowed_values[j]);
else
@@ -2005,7 +2008,7 @@ get_opcode_by_index(unsigned ix)
void
release_opcode(opcode *opc)
{
- for (int i = 0; i < opc->num_opnds; ++i) {
+ for (unsigned i = 0; i < opc->num_opnds; ++i) {
const opnd *q = opc->opnds + i;
free(q->name);
free(q->allowed_values);
@@ -2026,7 +2029,7 @@ static const char *unit_tests[] = {
"err1 m", "err2 m2:", "err3 m3:s", "err4 m4:s5",
"err5 m5{", "err6 m6:{", "err7 m7:{}", "err8 m8:{1", "err9 m9:{1,",
"err10 m0:{2..}", "err11 m11:{2..1}", "err12 m11:u{1,2}",
- "err13 m13:r", "err14 m14:u"
+ "err13 m13:r", "err14 m14:u", "err15 q1:u5{-1},q2:u8{3..1}"
};
@@ -2037,6 +2040,6 @@ run_unit_tests(void)
debug = 1;
- for (int i = 0; i < num_tests; ++i)
+ for (unsigned i = 0; i < num_tests; ++i)
parse_opcode(unit_tests[i]);
}
diff --git a/none/tests/s390x/disasm-test/verify.c b/none/tests/s390x/disasm-test/verify.c
index 2d6fe48c05..b80e270e30 100644
--- a/none/tests/s390x/disasm-test/verify.c
+++ b/none/tests/s390x/disasm-test/verify.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
@@ -121,27 +121,63 @@ disasm_same(const char *from_objdump, const char *from_vex,
const char *p2 = from_vex;
while (42) {
+ while (isspace(*p1))
+ ++p1;
+ while (isspace(*p2))
+ ++p2;
if (*p1 == '\0' && *p2 == '\0')
return 1;
if (*p1 == '\0' || *p2 == '\0')
return 0;
+
+ if (*p1 == *p2) {
+ ++p1;
+ ++p2;
+ continue;
+ }
+
+ /* Consider the case where the VEX disassembly has ".+integer"
+ or ".-integer" and the objdump disassembly has an hex address
+ possibly followed by a symbolic address, e.g. . */
+ if (*p2++ != '.') return 0;
+
+ long long offset_in_bytes = 0;
+ unsigned long long target_address = 0;
+
+ while (isxdigit(*p1)) {
+ target_address *= 16;
+ if (isdigit(*p1))
+ target_address += *p1 - '0';
+ else {
+ int c = tolower(*p1);
+ if (c >= 'a' && c <= 'f')
+ target_address += 10 + c - 'a';
+ else
+ return 0; // error
+ }
+ ++p1;
+ }
while (isspace(*p1))
++p1;
- while (isspace(*p2))
+ if (*p1 == '<') {
+ while (*p1++ != '>')
+ ;
+ }
+
+ int is_negative = 0;
+ if (*p2 == '-') {
+ is_negative = 1;
+ ++p2;
+ } else if (*p2 == '+')
+ ++p2;
+ while (isdigit(*p2)) {
+ offset_in_bytes *= 10;
+ offset_in_bytes += *p2 - '0';
++p2;
- if (*p1 != *p2) {
- long long offset_in_bytes;
- unsigned long long target_address;
-
- /* Consider the case where the VEX disassembly has ".+integer"
- or ".-integer" and the objdump disassembly has an
- address. */
- if (*p2++ != '.') return 0;
- if (sscanf(p2, "%lld", &offset_in_bytes) != 1) return 0;
- if (sscanf(p1, "%llx", &target_address) != 1) return 0;
- return address + offset_in_bytes == target_address;
}
- ++p1;
- ++p2;
+ if (is_negative)
+ offset_in_bytes *= -1;
+
+ if (address + offset_in_bytes != target_address) return 0;
}
}
diff --git a/none/tests/s390x/disasm-test/vex.c b/none/tests/s390x/disasm-test/vex.c
index 39d940371c..7d80ceadd2 100644
--- a/none/tests/s390x/disasm-test/vex.c
+++ b/none/tests/s390x/disasm-test/vex.c
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/none/tests/s390x/disasm-test/vex.h b/none/tests/s390x/disasm-test/vex.h
index 0a9510b519..627c1e55e1 100644
--- a/none/tests/s390x/disasm-test/vex.h
+++ b/none/tests/s390x/disasm-test/vex.h
@@ -8,7 +8,7 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
diff --git a/none/tests/s390x/ecag.stdout.exp-z17 b/none/tests/s390x/ecag.stdout.exp-z17
new file mode 100644
index 0000000000..4708b2a835
--- /dev/null
+++ b/none/tests/s390x/ecag.stdout.exp-z17
@@ -0,0 +1,21 @@
+L1 topology: separate data and instruction; private
+L1 cache line size data: 256
+L1 cache line size insn: 256
+L1 total cachesize data: 131072
+L1 total cachesize insn: 131072
+L1 set. assoc. data: 8
+L1 set. assoc. insn: 8
+L2 topology: unified data and instruction; private
+L2 cache line size data: 256
+L2 cache line size insn: 256
+L2 total cachesize data: 37748736
+L2 total cachesize insn: 37748736
+L2 set. assoc. data: 18
+L2 set. assoc. insn: 18
+L3 topology: unified data and instruction; shared
+L3 cache line size data: 256
+L3 cache line size insn: 256
+L3 total cachesize data: 377487360
+L3 total cachesize insn: 377487360
+L3 set. assoc. data: 180
+L3 set. assoc. insn: 180
diff --git a/none/tests/s390x/emwarn-gen.pl b/none/tests/s390x/emwarn-gen.pl
new file mode 100755
index 0000000000..00f2644f42
--- /dev/null
+++ b/none/tests/s390x/emwarn-gen.pl
@@ -0,0 +1,179 @@
+#!/usr/bin/env perl
+
+#--------------------------------------------------------------------
+# Create testcases for checking BFP/DFP emulation warnings
+#
+# This machinery is to circumwent valgrind's limitation of at most
+# 3 emulation warnings per emulation kind.
+#--------------------------------------------------------------------
+
+use strict;
+use warnings;
+use Cwd 'abs_path';
+use Getopt::Long;
+
+my $rootdir = get_rootdir();
+my $runone = "$rootdir/auxprogs/s390-runone";
+my $valgrind = "$rootdir/vg-in-place";
+my $valargs = "-q --tool=none --show-emwarns=yes";
+
+&main;
+
+sub main
+{
+ GetOptions("bfp-XxC" => sub { test_bfp_XxC(); },
+ "dfp-XiC" => sub { test_dfp_XiC(); },
+ "dfp-XxC" => sub { test_dfp_XxC(); },
+ ) or exit 1;
+ exit 0;
+}
+
+sub test_bfp_XxC
+{
+ header("BFP CONVERT FROM FIXED");
+ run_insn_test("cefbra 0,0,0,4");
+ run_insn_test("cdfbra 0,0,0,4");
+ run_insn_test("cxfbra 0,0,0,4");
+ run_insn_test("cegbra 0,0,0,4");
+ run_insn_test("cdgbra 0,0,0,4");
+ run_insn_test("cxgbra 0,0,0,4");
+
+ header("BFP CONVERT FROM LOGICAL");
+ run_insn_test("celfbr 0,0,0,4");
+ run_insn_test("cdlfbr 0,0,0,4");
+ run_insn_test("cxlfbr 0,0,0,4");
+ run_insn_test("celgbr 0,0,0,4");
+ run_insn_test("cdlgbr 0,0,0,4");
+ run_insn_test("cxlgbr 0,0,0,4");
+
+ header("BFP CONVERT TO FIXED");
+ run_insn_test("cfebra 0,0,0,4");
+ run_insn_test("cfdbra 0,0,0,4");
+ run_insn_test("cfxbra 0,0,0,4");
+ run_insn_test("cgebra 0,0,0,4");
+ run_insn_test("cgdbra 0,0,0,4");
+ run_insn_test("cgxbra 0,0,0,4");
+
+ header("BFP CONVERT TO LOGICAL");
+ run_insn_test("clfebr 0,0,0,4");
+ run_insn_test("clfdbr 0,0,0,4");
+ run_insn_test("clfxbr 0,0,0,4");
+ run_insn_test("clgebr 0,0,0,4");
+ run_insn_test("clgdbr 0,0,0,4");
+ run_insn_test("clgxbr 0,0,0,4");
+
+ header("BFP LOAD FP INTEGER");
+ run_insn_test("fiebra 0,0,0,4");
+ run_insn_test("fidbra 0,0,0,4");
+ run_insn_test("fixbra 0,0,0,4");
+
+ header("BFP LOAD ROUNDED");
+ run_insn_test("ledbra 0,0,0,4");
+ run_insn_test("ldxbra 0,0,0,4");
+ run_insn_test("lexbra 0,0,0,4");
+}
+
+sub test_dfp_XxC
+{
+ header("DFP CONVERT FROM FIXED");
+ run_insn_test("cdgtra 0,0,0,4");
+ run_insn_test("cxgtra 0,0,0,4");
+ run_insn_test("cdftr 0,0,0,4");
+ run_insn_test("cxftr 0,0,0,4");
+
+ header("DFP CONVERT FROM LOGICAL");
+ run_insn_test("cdlgtr 0,0,0,4");
+ run_insn_test("cxlgtr 0,0,0,4");
+ run_insn_test("cdlftr 0,0,0,4");
+ run_insn_test("cxlftr 0,0,0,4");
+
+ header("DFP CONVERT TO FIXED");
+ run_insn_test("cgdtra 0,0,0,4");
+ run_insn_test("cgxtra 0,0,0,4");
+ run_insn_test("cfdtr 0,0,0,4");
+ run_insn_test("cfxtr 0,0,0,4");
+
+ header("DFP CONVERT TO LOGICAL");
+ run_insn_test("clgdtr 0,0,0,4");
+ run_insn_test("clgxtr 0,0,0,4");
+ run_insn_test("clfdtr 0,0,0,4");
+ run_insn_test("clfxtr 0,0,0,4");
+
+ header("DFP LOAD ROUNDED");
+ run_insn_test("ledtr 0,0,0,4");
+ run_insn_test("ldxtr 0,0,0,4");
+}
+
+sub test_dfp_XiC
+{
+ header("DFP LOAD LENGTHENED");
+ run_insn_test("ldetr 0,0,8");
+ run_insn_test("lxdtr 0,0,8");
+
+ header("DFP LOAD ROUNDED");
+ run_insn_test("ledtr 0,0,0,8");
+ run_insn_test("ldxtr 0,0,0,8");
+}
+
+sub run_insn_test
+{
+ my ($insn) = @_;
+ $insn =~ s/\s+/ /g;
+ my ($mnm) = $insn;
+
+ $mnm =~ s/\s.*//;
+ print "Testing: $insn\n";
+
+ my $exe = "xxemwarn-$mnm";
+ my $cfile = "$exe.c";
+
+ # Create template
+ `$runone --template --insn=\"$insn\" > $cfile`;
+
+ # Compile
+ my $stderr = `$runone --build $cfile 2>&1`;
+ if ($? != 0) {
+ error("runone failed\n$stderr");
+ return;
+ }
+
+ # Run valgrind
+ my $output = `$valgrind $valargs ./$exe 2>&1 | ./filter_stderr`;
+ print STDOUT "$output\n";
+
+ # Remove files
+ unlink ($exe, $cfile, "$exe.s", "$exe.s.orig");
+}
+
+sub get_rootdir
+{
+ my $dir = ".";
+ while (abs_path($dir) ne "/") {
+ if (-e "$dir/AUTHORS") {
+ return abs_path($dir);
+ }
+ $dir = "$dir/..";
+ }
+ fatal("Coud not determine root directory. \"AUTHORS\" file not found\n");
+}
+
+sub header
+{
+ my ($txt) = @_;
+
+ print "\n";
+ print "============================================================\n";
+ print "$txt\n";
+ print "============================================================\n";
+}
+
+sub error
+{
+ print STDERR "*** $_[0]\n";
+}
+
+sub fatal
+{
+ error($_[0]);
+ exit 1;
+}
diff --git a/none/tests/s390x/fgx.c b/none/tests/s390x/fgx.c
deleted file mode 100644
index 6c7905395b..0000000000
--- a/none/tests/s390x/fgx.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include