Compare commits
311 Commits
NikolayMar
...
ldv/next
Author | SHA1 | Date | |
---|---|---|---|
2c8b6de913 | |||
f414d9e3ba | |||
04512207ac | |||
3798b04eab | |||
b9a262af78 | |||
bc87159e49 | |||
77265f5d49 | |||
88d842435e | |||
9c529cda68 | |||
3ef1efa2d1 | |||
17a1b88f8e | |||
be27e07c97 | |||
48f74df7d3 | |||
63de2e2055 | |||
2b31eeb6c1 | |||
4ba813df47 | |||
d0d79b4b7e | |||
536d2af968 | |||
bfff2ebaa6 | |||
25a73fb12f | |||
cf36cc7c78 | |||
91cdd32f65 | |||
3e93457d5f | |||
cd5b418320 | |||
cab745b842 | |||
d6c71dd061 | |||
51bd6db1ef | |||
27739ebccc | |||
2087d82fc7 | |||
2ecf1d5c2b | |||
721476cb78 | |||
333079522a | |||
38ea49ad11 | |||
c065838680 | |||
0954bf0ec8 | |||
3adbab7c2b | |||
a55f5485c6 | |||
95e1e717ac | |||
e3d913d5fb | |||
e850f7f95c | |||
2a750e9a9f | |||
6b662a84b4 | |||
665dd0ece8 | |||
cd933c16c9 | |||
6c9cfeaaa4 | |||
88863bf3ed | |||
5be335ceaa | |||
7e15b04b20 | |||
40771886ec | |||
09d91633d1 | |||
92e347b556 | |||
73fa3d6822 | |||
62b47db1ac | |||
e95c9ec4d1 | |||
2479d313e7 | |||
00d0c29d14 | |||
1448070a00 | |||
b967e34d70 | |||
d0ae0b3dca | |||
476b03b33a | |||
73f565d1b8 | |||
986a55423e | |||
b2c63fa897 | |||
8a5feb1cb3 | |||
f6869581d4 | |||
fa35f3e87d | |||
2b84c24551 | |||
4964cf3765 | |||
63144af13f | |||
b3f92b39f1 | |||
8c3b410bac | |||
d1a0f700f1 | |||
692dbd2c3d | |||
004e6b5b7a | |||
bc04bb238c | |||
7273c6fb3c | |||
e3b80cb65f | |||
7488ce9e23 | |||
86d073674e | |||
b93d52fe3d | |||
c6782f144a | |||
bf195a8455 | |||
e1f15583e0 | |||
c40270dd87 | |||
5be511bf86 | |||
1f84eefc40 | |||
217eccfba5 | |||
51d89ef0a0 | |||
917c2ccf3a | |||
bcd5cdddec | |||
afc80cdb3f | |||
26e1435f91 | |||
f476724ea1 | |||
1dc2a5313c | |||
114249603e | |||
a4fb2fbdde | |||
0933b30869 | |||
956dc3ed36 | |||
f11fb909d7 | |||
6f9cf06b99 | |||
c4c993b642 | |||
97c3deca54 | |||
384e286e5d | |||
ab30fe571d | |||
ca2121efef | |||
2482e7caba | |||
f9163e811b | |||
98306f2c05 | |||
d30aacd4ec | |||
b4b01268bb | |||
341eb0859d | |||
eca7e95886 | |||
422ecbe675 | |||
7a4c6b715d | |||
62267a93f4 | |||
f9e5f12b7c | |||
2649c8c8b6 | |||
e2d2dc699f | |||
846e277d0f | |||
e471c53d1d | |||
5f7f0b6c85 | |||
4c9516cc9b | |||
c12d2de112 | |||
5c62e29237 | |||
6726f218f7 | |||
7a7f6c6a7c | |||
6d6d5bc480 | |||
4370024753 | |||
3960969554 | |||
be3ba52a4d | |||
5993d50813 | |||
f5b9ee4945 | |||
e78becf8b9 | |||
9eeab98448 | |||
96df4b36f6 | |||
f708bcfa45 | |||
305e47a9ae | |||
762d8e06bf | |||
af39dee46c | |||
d7cbc89824 | |||
5aba529854 | |||
92b04d4a22 | |||
4b0130a7d0 | |||
750cdcba9c | |||
302cf02757 | |||
a5918bf7e6 | |||
4499e109ec | |||
201e01dbac | |||
ac2f6695cd | |||
da048e91a1 | |||
cfb86ab4e9 | |||
92d020787f | |||
cbbf708b4d | |||
c3ac40611c | |||
8a56b8a1b7 | |||
38e0f55602 | |||
9a969eb670 | |||
ef859a2702 | |||
54fc755c56 | |||
7c08fe37a1 | |||
a302982576 | |||
f561173367 | |||
9f4b5992fe | |||
79878e783c | |||
298f29a15b | |||
6177e74134 | |||
b05d2667e9 | |||
fdfc68a984 | |||
3f10639284 | |||
618d4ed497 | |||
9b5d56054c | |||
f3b38739d5 | |||
288b872266 | |||
1d7b8edda9 | |||
45afd0c7a3 | |||
dac524ad98 | |||
587d1d5663 | |||
00bfa52a81 | |||
5d18b8cdef | |||
25a4cafa90 | |||
6e7da52286 | |||
930864b083 | |||
3926f4a07d | |||
24535be245 | |||
4fa680e63f | |||
fb7c51690e | |||
df7dd5aa66 | |||
e8d95392ad | |||
fe8861f6b4 | |||
f7d175b562 | |||
701fd04d8a | |||
cde23ff80c | |||
6b141f643a | |||
d029a5efd1 | |||
eded21f5c0 | |||
9624d9f09d | |||
db5235d0e9 | |||
cf174ac87a | |||
f9578731fc | |||
9aa1efde58 | |||
44e21ae30d | |||
ccee090b78 | |||
1df0986c75 | |||
9d2848e517 | |||
14ae61f37b | |||
2d88ec9e39 | |||
538cf68f12 | |||
9725de9c22 | |||
7b0d371b3f | |||
f0ec4e696c | |||
ed29ac33bb | |||
e286b9cbc0 | |||
5ee385e2eb | |||
99300f217b | |||
e38143b00e | |||
0f09267db0 | |||
b89a69dec2 | |||
a264eb3b65 | |||
150655ca3e | |||
c1154d21a6 | |||
33e8748587 | |||
5f3b52cd32 | |||
95cf8b343f | |||
11e24ca2a4 | |||
f22adb0c7c | |||
a6ab0251f0 | |||
c20a515b6d | |||
22f0253f33 | |||
d7da491c34 | |||
769946f50a | |||
6757946d39 | |||
090bd651d3 | |||
6215963cde | |||
5771116f98 | |||
76cdf04c31 | |||
197014937c | |||
0930b2303e | |||
594cd12cd6 | |||
656de0c59f | |||
cc1da1e9fd | |||
dad8828327 | |||
e9e2dec950 | |||
2eb862c260 | |||
a72d6cdea0 | |||
90eee029a9 | |||
3ecff1d391 | |||
150197054f | |||
49f45ff291 | |||
7ecd1096bf | |||
8f9a7721d5 | |||
c5c5b53d7f | |||
1b5b5b76b5 | |||
860ccdefea | |||
ad2c9352a6 | |||
6fd0508195 | |||
9ccd194f1d | |||
27aa9e77df | |||
3dbffb74cc | |||
2b96d4c477 | |||
15dad53761 | |||
7a4582e357 | |||
f23ff6cebf | |||
965e18c407 | |||
de6e322986 | |||
44a99c878b | |||
fd5765aad8 | |||
048d1885fa | |||
7374607613 | |||
2756a36f25 | |||
06de4ac148 | |||
b39cb830af | |||
4a48f6b3e8 | |||
8ca67afef8 | |||
03d4f01e31 | |||
b7416438b8 | |||
ba5656519f | |||
ba9d45c374 | |||
028d869b95 | |||
546181b267 | |||
da5dbc6b1f | |||
3c4e4cdab9 | |||
610a776a74 | |||
fbb176a7ca | |||
15003d43d0 | |||
a219217119 | |||
14e385877d | |||
de412d1f2a | |||
34c47e1d1d | |||
bc8a91c115 | |||
b54134352a | |||
59974bed26 | |||
af4146c06e | |||
a7e1c1a8ca | |||
490194a7df | |||
9a7661cc62 | |||
2b6e074846 | |||
3afef04492 | |||
f52ff7d49c | |||
6ef3718d6b | |||
451c269e80 | |||
dea01d8d83 | |||
2cc81216cb | |||
8f996fc157 | |||
6527c044f3 | |||
b27397a7d2 | |||
bff4578491 | |||
be8985d455 | |||
380d205bb8 | |||
3fedf07869 | |||
4a329a0677 | |||
883617d8b7 |
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/* export-ignore
|
||||
/README-github_gitlab-autogenerated-archives.txt -export-ignore
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -12,6 +12,8 @@
|
||||
/.version
|
||||
/CREDITS
|
||||
/ChangeLog
|
||||
/INSTALL
|
||||
/README
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
/bpf_attr_check.c
|
||||
@ -34,6 +36,7 @@
|
||||
/libmpers-m32.a
|
||||
/libmpers-mx32.a
|
||||
/libstrace.a
|
||||
/linux/linux
|
||||
/m32_funcs.h
|
||||
/m32_printer_decls.h
|
||||
/m32_printer_defs.h
|
||||
@ -52,15 +55,14 @@
|
||||
/native_printer_decls.h
|
||||
/native_printer_defs.h
|
||||
/printers.h
|
||||
/README
|
||||
/scno.h
|
||||
/sen.h
|
||||
/stamp-h1
|
||||
/strace
|
||||
/strace-*.tar.gz
|
||||
/strace-*.tar.xz
|
||||
/strace.1
|
||||
/strace-log-merge.1
|
||||
/strace.1
|
||||
/strace.dsc
|
||||
/strace.spec
|
||||
/sys_func.h
|
||||
|
@ -1,4 +1,4 @@
|
||||
image: "ubuntu:17.10"
|
||||
image: "ubuntu:18.04"
|
||||
|
||||
before_script:
|
||||
- ci/install-dependencies.sh
|
||||
@ -8,6 +8,15 @@ variables:
|
||||
SLEEP_A_BIT: "sleep 0.2"
|
||||
VERBOSE: "1"
|
||||
|
||||
gcc-x86_64-libdw-mainline:
|
||||
stage: test
|
||||
script: ci/run-build-and-tests.sh
|
||||
variables:
|
||||
CC: "gcc"
|
||||
TARGET: "x86_64"
|
||||
STACKTRACE: "libdw"
|
||||
KHEADERS: "torvalds/linux"
|
||||
|
||||
gcc-x86_64-libdw:
|
||||
stage: test
|
||||
script: ci/run-build-and-tests.sh
|
||||
|
@ -24,7 +24,11 @@ matrix:
|
||||
- STACKTRACE=libunwind
|
||||
- CHECK=coverage
|
||||
- KHEADERS=torvalds/linux
|
||||
- KBRANCH=v4.17
|
||||
- compiler: gcc-8
|
||||
env:
|
||||
- TARGET=x86_64
|
||||
- STACKTRACE=libunwind
|
||||
- KHEADERS=torvalds/linux
|
||||
- compiler: gcc
|
||||
env:
|
||||
- TARGET=x86_64
|
||||
|
30
COPYING
30
COPYING
@ -7,24 +7,14 @@ Copyright (c) 1998-2001 Wichert Akkerman <wakkerma@deephackmode.org>
|
||||
Copyright (c) 2001-2018 The strace developers.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
strace is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2.1 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
strace 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 LGPL-2.1-or-later for more details.
|
||||
|
||||
strace test suite is provided under the terms of the GNU General Public License
|
||||
version 2 or later, see tests/COPYING for more details.
|
||||
|
@ -5,5 +5,5 @@ that are needed to build strace. Some of these files are generated by tools
|
||||
from the GNU Autoconf and GNU Automake packages.
|
||||
|
||||
Note: rather than running `autoreconf` directly, please invoke `./bootstrap`
|
||||
script and follow the instructions given in [INSTALL](INSTALL) file for further
|
||||
script and follow the instructions given in [INSTALL](README-configure) file for further
|
||||
building and installation.
|
||||
|
501
LGPL-2.1-or-later
Normal file
501
LGPL-2.1-or-later
Normal file
@ -0,0 +1,501 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom
|
||||
to share and change it. By contrast, the GNU General Public Licenses are
|
||||
intended to guarantee your freedom to share and change free software--to
|
||||
make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some specially
|
||||
designated software packages--typically libraries--of the Free Software
|
||||
Foundation and other authors who decide to use it. You can use it too,
|
||||
but we suggest you first think carefully about whether this license or
|
||||
the ordinary General Public License is the better strategy to use in
|
||||
any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
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 and use pieces of it in
|
||||
new free programs; and that you are informed that you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide complete
|
||||
object files to the recipients, so that they can relink them with the
|
||||
library after making changes to the library and recompiling it. And you
|
||||
must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that there
|
||||
is no warranty for the free library. Also, if the library is modified
|
||||
by someone else and passed on, the recipients should know that what they
|
||||
have is not the original version, so that the original author's reputation
|
||||
will not be affected by problems that might be introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot effectively
|
||||
restrict the users of a free program by obtaining a restrictive license
|
||||
from a patent holder. Therefore, we insist that any patent license
|
||||
obtained for a version of the library must be consistent with the full
|
||||
freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License. This license, the GNU Lesser General
|
||||
Public License, applies to certain designated libraries, and is quite
|
||||
different from the ordinary General Public License. We use this license
|
||||
for certain libraries in order to permit linking those libraries into
|
||||
non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using a
|
||||
shared library, the combination of the two is legally speaking a combined
|
||||
work, a derivative of the original library. The ordinary General Public
|
||||
License therefore permits such linking only if the entire combination
|
||||
fits its criteria of freedom. The Lesser General Public License permits
|
||||
more lax criteria for linking other code with the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to encourage
|
||||
the widest possible use of a certain library, so that it becomes a
|
||||
de-facto standard. To achieve this, non-free programs must be allowed
|
||||
to use the library. A more frequent case is that a free library does
|
||||
the same job as widely used non-free libraries. In this case, there
|
||||
is little to gain by limiting the free library to free software only,
|
||||
so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of free
|
||||
software. For example, permission to use the GNU C Library in non-free
|
||||
programs enables many more people to use the whole GNU operating system,
|
||||
as well as its variant, the GNU/Linux operating system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is linked
|
||||
with the Library has the freedom and the wherewithal to run that program
|
||||
using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License"). Each
|
||||
licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on
|
||||
the Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, 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 library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of running
|
||||
a program using the Library is not restricted, and output from such
|
||||
a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete 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 distribute a copy of this License along with the Library.
|
||||
|
||||
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 Library or any portion of
|
||||
it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge
|
||||
to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or table,
|
||||
the facility still operates, and performs whatever part of its
|
||||
purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots
|
||||
has a purpose that is entirely well-defined independent of
|
||||
the application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square root
|
||||
function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
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 Library, 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 Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume
|
||||
of a storage or distribution medium does not bring the other work
|
||||
under the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To
|
||||
do this, you must alter all the notices that refer to this License,
|
||||
so that they refer to the ordinary GNU General Public License,
|
||||
version 2, instead of to this License. (If a newer version than
|
||||
version 2 of the ordinary GNU General Public License has appeared,
|
||||
then you can specify that version instead if you wish.) Do not make
|
||||
any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the
|
||||
Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative
|
||||
of it, under Section 2) in object code or executable form under the
|
||||
terms of Sections 1 and 2 above provided that you 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.
|
||||
|
||||
If distribution of 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 satisfies the requirement to distribute the
|
||||
source code, even though third parties are not compelled to copy the
|
||||
source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library,
|
||||
but is designed to work with the Library by being compiled or linked
|
||||
with it, is called a "work that uses the Library". Such a work, in
|
||||
isolation, is not a derivative work of the Library, and therefore
|
||||
falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License. Section
|
||||
6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header
|
||||
file that is part of the Library, the object code for the work may
|
||||
be a derivative work of the Library even though the source code is
|
||||
not. Whether this is true is especially significant if the work can
|
||||
be linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure
|
||||
layouts and accessors, and small macros and small inline functions
|
||||
(ten lines or less in length), then the use of the object file
|
||||
is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section
|
||||
6. Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or link
|
||||
a "work that uses the Library" with the Library to produce a work
|
||||
containing portions of the Library, and distribute that work under
|
||||
terms of your choice, provided that the terms permit modification
|
||||
of the work for the customer's own use and reverse engineering for
|
||||
debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered
|
||||
by this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do
|
||||
one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and
|
||||
(2) will operate properly with a modified version of the library,
|
||||
if the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least three
|
||||
years, to give the same user the materials specified in Subsection
|
||||
6a, above, for a charge no more than the cost of performing this
|
||||
distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be 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.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you
|
||||
cannot use both them and the Library together in an executable that
|
||||
you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise permitted,
|
||||
and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities. This
|
||||
must be distributed under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the
|
||||
Library except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense, link with, or distribute the
|
||||
Library 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.
|
||||
|
||||
9. 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 Library or its derivative works. These actions
|
||||
are prohibited by law if you do not accept this License. Therefore,
|
||||
by modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on
|
||||
the Library), the recipient automatically receives a license from
|
||||
the original licensor to copy, distribute, link with or modify the
|
||||
Library 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 with this License.
|
||||
|
||||
11. 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 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 Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library
|
||||
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 Library.
|
||||
|
||||
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.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library 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.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser 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 Library
|
||||
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 Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
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
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE
|
||||
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
|
||||
AND/OR OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. 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 LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN
|
||||
IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES. END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of
|
||||
the ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. 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 the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and an idea of what it does.>
|
||||
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
your school, if any, to sign a "copyright disclaimer" for the library,
|
||||
if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
< signature of Ty Coon > , 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
108
Makefile.am
108
Makefile.am
@ -7,27 +7,7 @@
|
||||
# Copyright (c) 2002-2018 The strace developers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
if HAVE_M32_RUNTIME
|
||||
TESTS_M32 = tests-m32
|
||||
@ -93,7 +73,6 @@ strace_SOURCES = \
|
||||
aio.c \
|
||||
alpha.c \
|
||||
arch_defs.h \
|
||||
basic_actions.c \
|
||||
basic_filters.c \
|
||||
bind.c \
|
||||
bjm.c \
|
||||
@ -145,19 +124,18 @@ strace_SOURCES = \
|
||||
fetch_struct_stat.c \
|
||||
fetch_struct_stat64.c \
|
||||
fetch_struct_statfs.c \
|
||||
fetch_struct_xfs_quotastat.c \
|
||||
file_handle.c \
|
||||
file_ioctl.c \
|
||||
filter_action.c \
|
||||
filter_expression.c \
|
||||
filter_parse.c \
|
||||
filter_qualify.c \
|
||||
filter.c \
|
||||
filter.h \
|
||||
filter_qualify.c \
|
||||
flock.c \
|
||||
flock.h \
|
||||
fs_x_ioctl.c \
|
||||
futex.c \
|
||||
gcc_compat.h \
|
||||
get_personality.c \
|
||||
get_personality.h \
|
||||
get_robust_list.c \
|
||||
getcpu.c \
|
||||
getcwd.c \
|
||||
@ -182,6 +160,7 @@ strace_SOURCES = \
|
||||
kexec.c \
|
||||
keyctl.c \
|
||||
keyctl_kdf_params.h \
|
||||
kill_save_errno.h \
|
||||
kvm.c \
|
||||
largefile_wrappers.h \
|
||||
ldt.c \
|
||||
@ -208,15 +187,15 @@ strace_SOURCES = \
|
||||
msghdr.h \
|
||||
mtd.c \
|
||||
native_defs.h \
|
||||
nbd_ioctl.c \
|
||||
negated_errno.h \
|
||||
net.c \
|
||||
netlink.c \
|
||||
netlink.h \
|
||||
netlink_crypto.c \
|
||||
netlink_inet_diag.c \
|
||||
netlink_kobject_uevent.c \
|
||||
netlink_kobject_uevent.h \
|
||||
netlink_sock_diag.h \
|
||||
netlink_inet_diag.c \
|
||||
netlink_netfilter.c \
|
||||
netlink_netlink_diag.c \
|
||||
netlink_packet_diag.c \
|
||||
@ -225,6 +204,7 @@ strace_SOURCES = \
|
||||
netlink_selinux.c \
|
||||
netlink_smc_diag.c \
|
||||
netlink_sock_diag.c \
|
||||
netlink_sock_diag.h \
|
||||
netlink_unix_diag.c \
|
||||
nlattr.c \
|
||||
nlattr.h \
|
||||
@ -245,10 +225,13 @@ strace_SOURCES = \
|
||||
pkeys.c \
|
||||
poll.c \
|
||||
prctl.c \
|
||||
print_aio_sigset.c \
|
||||
print_dev_t.c \
|
||||
print_group_req.c \
|
||||
print_fields.h \
|
||||
print_group_req.c \
|
||||
print_ifindex.c \
|
||||
print_instruction_pointer.c \
|
||||
print_kernel_version.c \
|
||||
print_mac.c \
|
||||
print_mq_attr.c \
|
||||
print_msgbuf.c \
|
||||
@ -268,7 +251,10 @@ strace_SOURCES = \
|
||||
process_vm.c \
|
||||
ptp.c \
|
||||
ptrace.h \
|
||||
ptrace_syscall_info.c \
|
||||
ptrace_syscall_info.h \
|
||||
quota.c \
|
||||
random_ioctl.c \
|
||||
readahead.c \
|
||||
readlink.c \
|
||||
reboot.c \
|
||||
@ -321,8 +307,8 @@ strace_SOURCES = \
|
||||
statx.c \
|
||||
statx.h \
|
||||
strace.c \
|
||||
string_to_uint.h \
|
||||
string_to_uint.c \
|
||||
string_to_uint.h \
|
||||
swapon.c \
|
||||
syscall.c \
|
||||
sysctl.c \
|
||||
@ -351,7 +337,9 @@ strace_SOURCES = \
|
||||
utimes.c \
|
||||
v4l2.c \
|
||||
wait.c \
|
||||
wait.h \
|
||||
xattr.c \
|
||||
xfs_quota_stat.h \
|
||||
xlat.c \
|
||||
xlat.h \
|
||||
xmalloc.c \
|
||||
@ -403,6 +391,8 @@ EXTRA_DIST = \
|
||||
CREDITS \
|
||||
ChangeLog \
|
||||
ChangeLog-CVS \
|
||||
LGPL-2.1-or-later \
|
||||
README-configure \
|
||||
README-linux-ptrace \
|
||||
debian/changelog \
|
||||
debian/compat \
|
||||
@ -430,9 +420,8 @@ EXTRA_DIST = \
|
||||
linux/64/ioctls_inc.h \
|
||||
linux/64/syscallent.h \
|
||||
linux/aarch64/arch_defs_.h \
|
||||
linux/aarch64/arch_get_personality.c \
|
||||
linux/aarch64/arch_regs.c \
|
||||
linux/aarch64/arch_regs.h \
|
||||
linux/aarch64/arch_rt_sigframe.c \
|
||||
linux/aarch64/arch_sigreturn.c \
|
||||
linux/aarch64/get_error.c \
|
||||
linux/aarch64/get_scno.c \
|
||||
@ -451,8 +440,6 @@ EXTRA_DIST = \
|
||||
linux/alpha/arch_defs_.h \
|
||||
linux/alpha/arch_getrval2.c \
|
||||
linux/alpha/arch_regs.c \
|
||||
linux/alpha/arch_regs.h \
|
||||
linux/alpha/arch_rt_sigframe.c \
|
||||
linux/alpha/arch_sigreturn.c \
|
||||
linux/alpha/errnoent.h \
|
||||
linux/alpha/get_error.c \
|
||||
@ -468,8 +455,6 @@ EXTRA_DIST = \
|
||||
linux/alpha/syscallent.h \
|
||||
linux/alpha/userent.h \
|
||||
linux/arc/arch_regs.c \
|
||||
linux/arc/arch_regs.h \
|
||||
linux/arc/arch_rt_sigframe.c \
|
||||
linux/arc/get_error.c \
|
||||
linux/arc/get_scno.c \
|
||||
linux/arc/get_syscall_args.c \
|
||||
@ -482,11 +467,10 @@ EXTRA_DIST = \
|
||||
linux/arch_defs_.h \
|
||||
linux/arch_kvm.c \
|
||||
linux/arch_regs.h \
|
||||
linux/arch_rt_sigframe.c \
|
||||
linux/arch_sigreturn.c \
|
||||
linux/arm/arch_defs_.h \
|
||||
linux/arm/arch_regs.c \
|
||||
linux/arm/arch_regs.h \
|
||||
linux/arm/arch_rt_sigframe.c \
|
||||
linux/arm/arch_sigreturn.c \
|
||||
linux/arm/get_error.c \
|
||||
linux/arm/get_scno.c \
|
||||
@ -501,8 +485,6 @@ EXTRA_DIST = \
|
||||
linux/arm/syscallent.h \
|
||||
linux/arm/userent.h \
|
||||
linux/avr32/arch_regs.c \
|
||||
linux/avr32/arch_regs.h \
|
||||
linux/avr32/arch_rt_sigframe.c \
|
||||
linux/avr32/get_error.c \
|
||||
linux/avr32/get_scno.c \
|
||||
linux/avr32/get_syscall_args.c \
|
||||
@ -515,7 +497,6 @@ EXTRA_DIST = \
|
||||
linux/avr32/userent.h \
|
||||
linux/bfin/arch_defs_.h \
|
||||
linux/bfin/arch_regs.c \
|
||||
linux/bfin/arch_rt_sigframe.c \
|
||||
linux/bfin/get_error.c \
|
||||
linux/bfin/get_scno.c \
|
||||
linux/bfin/get_syscall_args.c \
|
||||
@ -528,12 +509,12 @@ EXTRA_DIST = \
|
||||
linux/bfin/set_scno.c \
|
||||
linux/bfin/syscallent.h \
|
||||
linux/bfin/userent.h \
|
||||
linux/check_scno.c \
|
||||
linux/dummy.h \
|
||||
linux/errnoent.h \
|
||||
linux/getregs_old.h \
|
||||
linux/hppa/arch_defs_.h \
|
||||
linux/hppa/arch_regs.c \
|
||||
linux/hppa/arch_regs.h \
|
||||
linux/hppa/arch_rt_sigframe.c \
|
||||
linux/hppa/errnoent.h \
|
||||
linux/hppa/get_error.c \
|
||||
@ -548,10 +529,9 @@ EXTRA_DIST = \
|
||||
linux/hppa/set_scno.c \
|
||||
linux/hppa/signalent.h \
|
||||
linux/hppa/syscallent.h \
|
||||
linux/i386/arch_kvm.c \
|
||||
linux/i386/arch_defs_.h \
|
||||
linux/i386/arch_kvm.c \
|
||||
linux/i386/arch_regs.c \
|
||||
linux/i386/arch_regs.h \
|
||||
linux/i386/arch_rt_sigframe.c \
|
||||
linux/i386/arch_sigreturn.c \
|
||||
linux/i386/get_error.c \
|
||||
@ -585,7 +565,6 @@ EXTRA_DIST = \
|
||||
linux/inet_diag.h \
|
||||
linux/m68k/arch_defs_.h \
|
||||
linux/m68k/arch_regs.c \
|
||||
linux/m68k/arch_regs.h \
|
||||
linux/m68k/arch_rt_sigframe.c \
|
||||
linux/m68k/arch_sigreturn.c \
|
||||
linux/m68k/get_error.c \
|
||||
@ -600,7 +579,6 @@ EXTRA_DIST = \
|
||||
linux/m68k/syscallent.h \
|
||||
linux/m68k/userent.h \
|
||||
linux/metag/arch_regs.c \
|
||||
linux/metag/arch_regs.h \
|
||||
linux/metag/arch_rt_sigframe.c \
|
||||
linux/metag/get_error.c \
|
||||
linux/metag/get_scno.c \
|
||||
@ -613,7 +591,6 @@ EXTRA_DIST = \
|
||||
linux/metag/syscallent.h \
|
||||
linux/microblaze/arch_defs_.h \
|
||||
linux/microblaze/arch_regs.c \
|
||||
linux/microblaze/arch_rt_sigframe.c \
|
||||
linux/microblaze/arch_sigreturn.c \
|
||||
linux/microblaze/get_error.c \
|
||||
linux/microblaze/get_scno.c \
|
||||
@ -629,8 +606,6 @@ EXTRA_DIST = \
|
||||
linux/mips/arch_defs_.h \
|
||||
linux/mips/arch_getrval2.c \
|
||||
linux/mips/arch_regs.c \
|
||||
linux/mips/arch_regs.h \
|
||||
linux/mips/arch_rt_sigframe.c \
|
||||
linux/mips/arch_sigreturn.c \
|
||||
linux/mips/errnoent.h \
|
||||
linux/mips/genstub.sh \
|
||||
@ -653,8 +628,6 @@ EXTRA_DIST = \
|
||||
linux/netlink_diag.h \
|
||||
linux/nios2/arch_defs_.h \
|
||||
linux/nios2/arch_regs.c \
|
||||
linux/nios2/arch_regs.h \
|
||||
linux/nios2/arch_rt_sigframe.c \
|
||||
linux/nios2/get_error.c \
|
||||
linux/nios2/get_scno.c \
|
||||
linux/nios2/get_syscall_args.c \
|
||||
@ -666,8 +639,6 @@ EXTRA_DIST = \
|
||||
linux/nios2/syscallent.h \
|
||||
linux/nr_prefix.c \
|
||||
linux/or1k/arch_regs.c \
|
||||
linux/or1k/arch_regs.h \
|
||||
linux/or1k/arch_rt_sigframe.c \
|
||||
linux/or1k/get_error.c \
|
||||
linux/or1k/get_scno.c \
|
||||
linux/or1k/get_syscall_args.c \
|
||||
@ -681,7 +652,6 @@ EXTRA_DIST = \
|
||||
linux/packet_diag.h \
|
||||
linux/powerpc/arch_defs_.h \
|
||||
linux/powerpc/arch_regs.c \
|
||||
linux/powerpc/arch_regs.h \
|
||||
linux/powerpc/arch_rt_sigframe.c \
|
||||
linux/powerpc/arch_sigreturn.c \
|
||||
linux/powerpc/errnoent.h \
|
||||
@ -698,8 +668,8 @@ EXTRA_DIST = \
|
||||
linux/powerpc/syscallent.h \
|
||||
linux/powerpc/userent.h \
|
||||
linux/powerpc64/arch_defs_.h \
|
||||
linux/powerpc64/arch_get_personality.c \
|
||||
linux/powerpc64/arch_regs.c \
|
||||
linux/powerpc64/arch_regs.h \
|
||||
linux/powerpc64/arch_rt_sigframe.c \
|
||||
linux/powerpc64/arch_sigreturn.c \
|
||||
linux/powerpc64/errnoent.h \
|
||||
@ -719,11 +689,11 @@ EXTRA_DIST = \
|
||||
linux/powerpc64/syscallent.h \
|
||||
linux/powerpc64/syscallent1.h \
|
||||
linux/powerpc64/userent.h \
|
||||
linux/ptrace_pokeuser.c \
|
||||
linux/raw_syscall.h \
|
||||
linux/riscv/arch_defs_.h \
|
||||
linux/riscv/arch_get_personality.c \
|
||||
linux/riscv/arch_regs.c \
|
||||
linux/riscv/arch_regs.h \
|
||||
linux/riscv/arch_rt_sigframe.c \
|
||||
linux/riscv/get_error.c \
|
||||
linux/riscv/get_scno.c \
|
||||
linux/riscv/get_syscall_args.c \
|
||||
@ -739,8 +709,6 @@ EXTRA_DIST = \
|
||||
linux/rt_sigframe.h \
|
||||
linux/s390/arch_defs_.h \
|
||||
linux/s390/arch_regs.c \
|
||||
linux/s390/arch_regs.h \
|
||||
linux/s390/arch_rt_sigframe.c \
|
||||
linux/s390/arch_sigreturn.c \
|
||||
linux/s390/get_error.c \
|
||||
linux/s390/get_scno.c \
|
||||
@ -756,9 +724,8 @@ EXTRA_DIST = \
|
||||
linux/s390/userent0.h \
|
||||
linux/s390/userent1.h \
|
||||
linux/s390x/arch_defs_.h \
|
||||
linux/s390x/arch_get_personality.c \
|
||||
linux/s390x/arch_regs.c \
|
||||
linux/s390x/arch_regs.h \
|
||||
linux/s390x/arch_rt_sigframe.c \
|
||||
linux/s390x/arch_sigreturn.c \
|
||||
linux/s390x/get_error.c \
|
||||
linux/s390x/get_scno.c \
|
||||
@ -777,7 +744,6 @@ EXTRA_DIST = \
|
||||
linux/sh/arch_defs_.h \
|
||||
linux/sh/arch_getrval2.c \
|
||||
linux/sh/arch_regs.c \
|
||||
linux/sh/arch_rt_sigframe.c \
|
||||
linux/sh/get_error.c \
|
||||
linux/sh/get_scno.c \
|
||||
linux/sh/get_syscall_args.c \
|
||||
@ -793,7 +759,6 @@ EXTRA_DIST = \
|
||||
linux/sh64/arch_defs_.h \
|
||||
linux/sh64/arch_regs.c \
|
||||
linux/sh64/arch_regs.h \
|
||||
linux/sh64/arch_rt_sigframe.c \
|
||||
linux/sh64/get_error.c \
|
||||
linux/sh64/get_scno.c \
|
||||
linux/sh64/get_syscall_args.c \
|
||||
@ -807,14 +772,13 @@ EXTRA_DIST = \
|
||||
linux/sh64/syscallent.h \
|
||||
linux/sh64/userent.h \
|
||||
linux/shuffle_scno.c \
|
||||
linux/signal.h.in \
|
||||
linux/signalent.h \
|
||||
linux/smc_diag.h \
|
||||
linux/sock_diag.h \
|
||||
linux/sparc/arch_defs_.h \
|
||||
linux/sparc/arch_getrval2.c \
|
||||
linux/sparc/arch_regs.c \
|
||||
linux/sparc/arch_regs.h \
|
||||
linux/sparc/arch_rt_sigframe.c \
|
||||
linux/sparc/arch_sigreturn.c \
|
||||
linux/sparc/errnoent.h \
|
||||
linux/sparc/get_error.c \
|
||||
@ -830,9 +794,9 @@ EXTRA_DIST = \
|
||||
linux/sparc/syscallent.h \
|
||||
linux/sparc/userent.h \
|
||||
linux/sparc64/arch_defs_.h \
|
||||
linux/sparc64/arch_get_personality.c \
|
||||
linux/sparc64/arch_getrval2.c \
|
||||
linux/sparc64/arch_regs.c \
|
||||
linux/sparc64/arch_regs.h \
|
||||
linux/sparc64/arch_rt_sigframe.c \
|
||||
linux/sparc64/arch_sigreturn.c \
|
||||
linux/sparc64/errnoent.h \
|
||||
@ -854,9 +818,8 @@ EXTRA_DIST = \
|
||||
linux/subcall.h \
|
||||
linux/syscall.h \
|
||||
linux/tile/arch_defs_.h \
|
||||
linux/tile/arch_get_personality.c \
|
||||
linux/tile/arch_regs.c \
|
||||
linux/tile/arch_regs.h \
|
||||
linux/tile/arch_rt_sigframe.c \
|
||||
linux/tile/arch_sigreturn.c \
|
||||
linux/tile/get_error.c \
|
||||
linux/tile/get_scno.c \
|
||||
@ -876,11 +839,13 @@ EXTRA_DIST = \
|
||||
linux/userent.h \
|
||||
linux/userent0.h \
|
||||
linux/x32/arch_defs_.h \
|
||||
linux/x32/arch_get_personality.c \
|
||||
linux/x32/arch_kvm.c \
|
||||
linux/x32/arch_regs.c \
|
||||
linux/x32/arch_regs.h \
|
||||
linux/x32/arch_rt_sigframe.c \
|
||||
linux/x32/arch_sigreturn.c \
|
||||
linux/x32/check_scno.c \
|
||||
linux/x32/get_error.c \
|
||||
linux/x32/get_scno.c \
|
||||
linux/x32/get_syscall_args.c \
|
||||
@ -888,6 +853,7 @@ EXTRA_DIST = \
|
||||
linux/x32/ioctls_arch1.h \
|
||||
linux/x32/ioctls_inc0.h \
|
||||
linux/x32/ioctls_inc1.h \
|
||||
linux/x32/ptrace_pokeuser.c \
|
||||
linux/x32/raw_syscall.h \
|
||||
linux/x32/rt_sigframe.h \
|
||||
linux/x32/set_error.c \
|
||||
@ -897,6 +863,7 @@ EXTRA_DIST = \
|
||||
linux/x32/syscallent1.h \
|
||||
linux/x32/userent.h \
|
||||
linux/x86_64/arch_defs_.h \
|
||||
linux/x86_64/arch_get_personality.c \
|
||||
linux/x86_64/arch_kvm.c \
|
||||
linux/x86_64/arch_regs.c \
|
||||
linux/x86_64/arch_regs.h \
|
||||
@ -923,7 +890,6 @@ EXTRA_DIST = \
|
||||
linux/x86_64/syscallent2.h \
|
||||
linux/x86_64/userent.h \
|
||||
linux/xtensa/arch_regs.c \
|
||||
linux/xtensa/arch_rt_sigframe.c \
|
||||
linux/xtensa/get_error.c \
|
||||
linux/xtensa/get_scno.c \
|
||||
linux/xtensa/get_syscall_args.c \
|
||||
@ -1045,7 +1011,7 @@ CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
|
||||
ioctl_iocdef.h ioctl_iocdef.i \
|
||||
bpf_attr_check.c native_printer_decls.h native_printer_defs.h \
|
||||
printers.h sen.h sys_func.h
|
||||
DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
|
||||
DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h linux/linux/signal.h
|
||||
|
||||
include scno.am
|
||||
|
||||
|
106
NEWS
106
NEWS
@ -1,9 +1,101 @@
|
||||
Noteworthy changes in release ?.?? (????-??-??)
|
||||
===============================================
|
||||
|
||||
* Changes in command line syntax
|
||||
* New syntax for -e option for filter-based expressions.
|
||||
Traditional syntax is also supported.
|
||||
* Improvements
|
||||
* Enhanced xlat styles support configured by -X option.
|
||||
* Updated lists of BPF_*, BTRFS_*, FAN_*, IFLA_*, KERN_*, KVM_CAP_*, NDA_*,
|
||||
NETNSA_*, NT_*, PR_*, REL_*, SECCOMP_*, SCTP_*, UDP_*, V4L2_*, and *_MAGIC
|
||||
constants.
|
||||
|
||||
* Bug fixes
|
||||
* Fixed strace-k test on alpha.
|
||||
* Fixed build on mips o32.
|
||||
* Fixed build on NOMMU architectures.
|
||||
|
||||
Noteworthy changes in release 4.26 (2018-12-26)
|
||||
===============================================
|
||||
|
||||
* License
|
||||
* The test suite is now provided under the terms of
|
||||
the GNU General Public License version 2 or later.
|
||||
* All the rest of strace is now provided under the terms of
|
||||
the GNU Lesser General Public License version 2.1 or later.
|
||||
|
||||
* Changes in behavior
|
||||
* If strace is interrupted by a signal it handles (currently
|
||||
one of HUP, INT, QUIT, PIPE, or TERM), strace terminates
|
||||
itself with this signal.
|
||||
|
||||
* Improvements
|
||||
* Implemented obtainment of system call information using
|
||||
PTRACE_GET_SYSCALL_INFO ptrace API.
|
||||
* Implemented decoding of PTRACE_GET_SYSCALL_INFO ptrace request.
|
||||
* Implemented decoding of BLKGETZONESZ, BLKGETNRZONES, and RND* ioctl
|
||||
commands.
|
||||
* Enhanced xlat styles support configured by -X option.
|
||||
* Enhanced internet address formatting in structureless contexts.
|
||||
* Enhanced decoding of getsockopt SO_ERROR option.
|
||||
* Enhanced error diagnostics when the first exec fails.
|
||||
* Added %net as a short form of %network in syscall specifications.
|
||||
* Updated lists of ABS_*, BPF_*, FAN_*, IFA_*, IFLA_*, KVM_CAP_*, NETLINK_*,
|
||||
NTF_*, PR_SPEC_*, REL_*, SOL_*, TCA_*, and V4L2_* constants.
|
||||
* Updated lists of ioctl commands from Linux 4.20.
|
||||
* Enhanced manual page.
|
||||
|
||||
* Bug fixes
|
||||
* Fixed "xlat_idx: Unexpected xlat value 0" warnings.
|
||||
* Fixed sthyi output format on s390.
|
||||
* Documented -X option in strace -h output.
|
||||
|
||||
Noteworthy changes in release 4.25 (2018-10-30)
|
||||
===============================================
|
||||
|
||||
* Improvements
|
||||
* Implemented decoding of KVM_CHECK_EXTENSION and NBD_* ioctl commands.
|
||||
* Implemented decoding of SOL_XDP socket option names.
|
||||
* Implemented decoding of AF_PACKET protocols in socket syscall.
|
||||
* Implemented decoding of AF_AX25 and AF_X25 addresses, protocols,
|
||||
and options.
|
||||
* Implemented stack trace printing on receiving signals.
|
||||
* Enhanced xlat styles support configured by -X option.
|
||||
* Enhanced decoding of IFLA_*, NETCONFA_*, and SMC_DIAG_* netlink attributes.
|
||||
* Wired up io_pgetevents syscall on arm, sparc, and sparc64.
|
||||
* Updated lists of AF_*, AUDIT_*, BPF_*, IFLA_*, IN_*, IPSTATS_*,
|
||||
IPV4_DEVCONF_*, NT_*, SCTP_*, SO_*, SOCK_*, SOL_*, and V4L2_* constants.
|
||||
* Updated lists of ioctl commands from Linux 4.19.
|
||||
|
||||
* Bug fixes
|
||||
* Fixed decoding of bit sets in evdev ioctl commands.
|
||||
* Fixed decoding of EVIOCGBIT(0, ...) ioctl commands.
|
||||
* Fixed test suite for the case when mlockall and unimplemented syscalls
|
||||
are explicitly disabled by a seccomp filter.
|
||||
|
||||
Noteworthy changes in release 4.24 (2018-08-14)
|
||||
===============================================
|
||||
|
||||
* Improvements
|
||||
* Implemented decoding of kvm vcpu exit reason (-e kvm=vcpu option),
|
||||
requires Linux kernel version 4.16.0 or higher.
|
||||
* Implemented decoding of KVM_SET_CPUID2 and KVM_GET_*_CPUID ioctl commands.
|
||||
* Enhanced decoding of corner cases of SO_LINGER, SO_PEERCRED,
|
||||
and PACKET_STATISTICS getsockopt options.
|
||||
* Wired up io_pgetevents and rseq syscalls on hppa, microblaze, mips, powerpc,
|
||||
and s390.
|
||||
* Updated lists of AUDIT_*, BPF_*, IFA_*, IFLA_*, RTA_*, RTPROT_*, TCP_*,
|
||||
TRAP_*, and UDP_* constants.
|
||||
* Updated lists of ioctl commands from Linux 4.18.
|
||||
|
||||
* Bug fixes
|
||||
* Fixed decoding of Q_XGETQSTAT on non-native personalities.
|
||||
* Fixed race condition in aio test.
|
||||
* Fixed build with Bionic libc.
|
||||
* Fixed build with glibc-2.28.
|
||||
* Fixed build in exotic systemd-nspawn based environments.
|
||||
* Fixed build on s390 with kernel headers that do not contain Linux commit
|
||||
v3.10-rc1~201^2~11.
|
||||
|
||||
Noteworthy changes in release 4.23 (2018-06-14)
|
||||
===============================================
|
||||
|
||||
* Changes in behaviour
|
||||
* On x32 personality, 64-bit syscalls (such as readv) are now shown with "#64"
|
||||
@ -15,6 +107,7 @@ Noteworthy changes in release ?.?? (????-??-??)
|
||||
regardless of -e raw qualification settings. One can specify
|
||||
-X raw for displaying raw error numbers unconditionally.
|
||||
* Unfetchable addresses inside arrays are now printed as comments.
|
||||
* Obsolete IA-32 mode syscall names are no longer printed on ia64.
|
||||
|
||||
* Improvements
|
||||
* Implemented libdw backend for -k option, configured at build time
|
||||
@ -23,6 +116,10 @@ Noteworthy changes in release ?.?? (????-??-??)
|
||||
using --enable-stacktrace option.
|
||||
* Added -X option for configuring xlat output formatting (addresses
|
||||
Debian bug #692915).
|
||||
* Added support for personality designation ("64", "32", or "x32") to syscall
|
||||
qualifications in -e trace expressions.
|
||||
* Implemented injection of syscalls with no side effects as an alternative
|
||||
to injection of an invalid syscall (-e inject=SET:syscall= expression).
|
||||
* Improved support for reproducible builds (addresses Debian bug #896016).
|
||||
* Implemented decoding of BPF_PROG_QUERY and BPF_RAW_TRACEPOINT_OPEN bpf
|
||||
syscall commands.
|
||||
@ -36,6 +133,8 @@ Noteworthy changes in release ?.?? (????-??-??)
|
||||
* Enhanced decoding of BTRFS_*, FS_IOC_*, SIOCGIFHWADDR, and SIOCSIFHWADDR
|
||||
ioctl commands.
|
||||
* Enhanced decoding of AF_BLUETOOTH socket addresses.
|
||||
* Implemented decoding of io_pgetevent syscall.
|
||||
* Wired up rseq syscall.
|
||||
* Updated lists of ADJ_*, BPF_*, BPF_F_*, BPF_PROG_TYPE_*, ETH_P_*, FPE_*,
|
||||
IFF_*, IPPROTO_*, MAP_*, MS_*, MSG_*, NETLINK_*, PACKET_*, PROT_*, SCTP_*,
|
||||
SECCOMP_FILTER_FLAG_*, SEGV_*, SEM_*, SHM_*, SW_*, V4L2_CID_*,
|
||||
@ -46,6 +145,7 @@ Noteworthy changes in release ?.?? (????-??-??)
|
||||
* Fixed decoding of msgtyp argument of msgrcv syscall.
|
||||
* Fixed fallback definitions for F_*, MCL_*, MSG_ZEROCOPY, SI_*,
|
||||
and SOL_SOCKET constants.
|
||||
* Fixed -e trace=%pure expression on mips.
|
||||
|
||||
Noteworthy changes in release 4.22 (2018-04-05)
|
||||
===============================================
|
||||
|
@ -15,10 +15,10 @@ Basic Installation
|
||||
Briefly, the shell command './configure && make && make install' should
|
||||
configure, build, and install this package. The following more-detailed
|
||||
instructions are generic; see the 'README' file for instructions
|
||||
specific to this package. Some packages provide this 'INSTALL' file but
|
||||
do not implement all of the features documented below. The lack of an
|
||||
optional feature in a given package is not necessarily a bug. More
|
||||
recommendations for GNU packages can be found in *note Makefile
|
||||
specific to this package. Some packages provide this 'README-configure'
|
||||
file but do not implement all of the features documented below. The
|
||||
lack of an optional feature in a given package is not necessarily a bug.
|
||||
More recommendations for GNU packages can be found in *note Makefile
|
||||
Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The 'configure' shell script attempts to guess correct values for
|
11
README-github_gitlab-autogenerated-archives.txt
Normal file
11
README-github_gitlab-autogenerated-archives.txt
Normal file
@ -0,0 +1,11 @@
|
||||
github/gitlab autogenerated archives are not supported
|
||||
======================================================
|
||||
|
||||
This information applies to bundles automatically generated
|
||||
by github and gitlab.
|
||||
|
||||
strace's program version is maintained using git-version-gen script, therefore,
|
||||
building strace depends on "git describe" (a full git clone is needed for this)
|
||||
or, alternatively, a .tarball-version file. Neither github nor gitlab can
|
||||
provide the latter, they also do not allow to inject a .tarball-version file
|
||||
during export archiving.
|
@ -3,12 +3,15 @@ strace - the linux syscall tracer
|
||||
|
||||
This is [strace](https://strace.io) -- a diagnostic, debugging and instructional userspace utility with a traditional command-line interface for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as [ptrace](http://man7.org/linux/man-pages/man2/ptrace.2.html).
|
||||
|
||||
strace is released under a Berkeley-style license at the request of Paul Kranenburg; see the file [COPYING](COPYING) for details.
|
||||
strace is released under the terms of [the GNU Lesser General Public License version 2.1 or later](LGPL-2.1-or-later); see the file [COPYING](COPYING) for details.
|
||||
strace test suite is released under the terms of [the GNU General Public License version 2 or later](tests/GPL-2.0-or-later); see the file [tests/COPYING](tests/COPYING) for details.
|
||||
|
||||
See the file [NEWS](NEWS) for information on what has changed in recent versions.
|
||||
|
||||
Please read the file [INSTALL-git](INSTALL-git.md) for installation instructions.
|
||||
|
||||
Please take a look at [the guide for new contributors](https://strace.io/wiki/NewContributorGuide) if you want to get involved in strace development.
|
||||
|
||||
The user discussion and development of strace take place on [the strace mailing list](https://lists.strace.io/mailman/listinfo/strace-devel) -- everyone is welcome to post bug reports, feature requests, comments and patches to strace-devel@lists.strace.io. The mailing list archives are available at https://lists.strace.io/pipermail/strace-devel/ and other archival sites.
|
||||
|
||||
The GIT repository of strace is available at [GitHub](https://github.com/strace/strace/) and [GitLab](https://gitlab.com/strace/strace/).
|
||||
|
7
access.c
7
access.c
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
|
24
affinity.c
24
affinity.c
@ -1,29 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2004 Roland McGrath <roland@redhat.com>
|
||||
* Copyright (c) 2009-2016 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2009-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
85
aio.c
85
aio.c
@ -3,36 +3,18 @@
|
||||
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
|
||||
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
|
||||
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
|
||||
* Copyright (c) 1999-2017 The strace developers.
|
||||
* Copyright (c) 1999-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "print_fields.h"
|
||||
#include <linux/aio_abi.h>
|
||||
|
||||
#include "xlat/aio_cmds.h"
|
||||
|
||||
SYS_FUNC(io_setup)
|
||||
{
|
||||
if (entering(tcp))
|
||||
@ -56,28 +38,22 @@ enum iocb_sub {
|
||||
static enum iocb_sub
|
||||
tprint_lio_opcode(unsigned int cmd)
|
||||
{
|
||||
static const struct {
|
||||
const char *name;
|
||||
enum iocb_sub sub;
|
||||
} cmds[] = {
|
||||
{ "IOCB_CMD_PREAD", SUB_COMMON },
|
||||
{ "IOCB_CMD_PWRITE", SUB_COMMON },
|
||||
{ "IOCB_CMD_FSYNC", SUB_NONE },
|
||||
{ "IOCB_CMD_FDSYNC", SUB_NONE },
|
||||
{ "IOCB_CMD_PREADX", SUB_NONE },
|
||||
{ "IOCB_CMD_POLL", SUB_NONE },
|
||||
{ "IOCB_CMD_NOOP", SUB_NONE },
|
||||
{ "IOCB_CMD_PREADV", SUB_VECTOR },
|
||||
{ "IOCB_CMD_PWRITEV", SUB_VECTOR },
|
||||
static const enum iocb_sub subs[] = {
|
||||
[IOCB_CMD_PREAD] = SUB_COMMON,
|
||||
[IOCB_CMD_PWRITE] = SUB_COMMON,
|
||||
[IOCB_CMD_FSYNC] = SUB_NONE,
|
||||
[IOCB_CMD_FDSYNC] = SUB_NONE,
|
||||
[IOCB_CMD_PREADX] = SUB_NONE,
|
||||
[IOCB_CMD_POLL] = SUB_NONE,
|
||||
[IOCB_CMD_NOOP] = SUB_NONE,
|
||||
[IOCB_CMD_PREADV] = SUB_VECTOR,
|
||||
[IOCB_CMD_PWRITEV] = SUB_VECTOR,
|
||||
};
|
||||
|
||||
if (cmd < ARRAY_SIZE(cmds)) {
|
||||
tprints(cmds[cmd].name);
|
||||
return cmds[cmd].sub;
|
||||
}
|
||||
tprintf("%u", cmd);
|
||||
tprints_comment("IOCB_CMD_???");
|
||||
return SUB_NONE;
|
||||
printxval_indexn_ex(ARRSZ_PAIR(aio_cmds) - 1, cmd, "IOCB_CMD_???",
|
||||
XLAT_STYLE_FMT_U);
|
||||
|
||||
return cmd < ARRAY_SIZE(subs) ? subs[cmd] : SUB_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -129,6 +105,8 @@ print_iocb_header(struct tcb *tcp, const struct iocb *cb)
|
||||
static void
|
||||
print_iocb(struct tcb *tcp, const struct iocb *cb)
|
||||
{
|
||||
tprints("{");
|
||||
|
||||
enum iocb_sub sub = print_iocb_header(tcp, cb);
|
||||
|
||||
switch (sub) {
|
||||
@ -160,6 +138,8 @@ print_iocb(struct tcb *tcp, const struct iocb *cb)
|
||||
case SUB_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
tprints("}");
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -174,10 +154,8 @@ print_iocbp(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
|
||||
addr = *(kernel_ulong_t *) elem_buf;
|
||||
}
|
||||
|
||||
tprints("{");
|
||||
if (!umove_or_printaddr(tcp, addr, &cb))
|
||||
print_iocb(tcp, &cb);
|
||||
tprints("}");
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -238,7 +216,8 @@ SYS_FUNC(io_cancel)
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_FUNC(io_getevents)
|
||||
static int
|
||||
print_io_getevents(struct tcb *tcp, bool has_usig)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
printaddr(tcp->u_arg[0]);
|
||||
@ -251,13 +230,27 @@ SYS_FUNC(io_getevents)
|
||||
tfetch_mem, print_io_event, 0);
|
||||
tprints(", ");
|
||||
/*
|
||||
* Since the timeout parameter is read by the kernel
|
||||
* Since the timeout and usig parameters are read by the kernel
|
||||
* on entering syscall, it has to be decoded the same way
|
||||
* whether the syscall has failed or not.
|
||||
*/
|
||||
temporarily_clear_syserror(tcp);
|
||||
print_timespec(tcp, tcp->u_arg[4]);
|
||||
if (has_usig) {
|
||||
tprints(", ");
|
||||
print_aio_sigset(tcp, tcp->u_arg[5]);
|
||||
}
|
||||
restore_cleared_syserror(tcp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_FUNC(io_getevents)
|
||||
{
|
||||
return print_io_getevents(tcp, false);
|
||||
}
|
||||
|
||||
SYS_FUNC(io_pgetevents)
|
||||
{
|
||||
return print_io_getevents(tcp, true);
|
||||
}
|
||||
|
22
alpha.c
22
alpha.c
@ -3,27 +3,7 @@
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
13
arch_defs.h
13
arch_defs.h
@ -1,8 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
/* Architecture-specific definitions. */
|
||||
#ifndef STRACE_ARCH_DEFS_H
|
||||
#define STRACE_ARCH_DEFS_H
|
||||
# define STRACE_ARCH_DEFS_H
|
||||
|
||||
#include "arch_defs_.h"
|
||||
#include "linux/arch_defs_.h"
|
||||
# include "arch_defs_.h"
|
||||
# include "linux/arch_defs_.h"
|
||||
|
||||
#endif /* !STRACE_ARCH_DEFS_H */
|
||||
|
124
basic_actions.c
124
basic_actions.c
@ -1,124 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "filter.h"
|
||||
|
||||
bool
|
||||
is_traced(struct tcb *tcp)
|
||||
{
|
||||
return traced(tcp);
|
||||
}
|
||||
|
||||
bool
|
||||
not_injected(struct tcb *tcp)
|
||||
{
|
||||
return !inject(tcp);
|
||||
}
|
||||
|
||||
void
|
||||
apply_trace(struct tcb *tcp, void *priv_data)
|
||||
{
|
||||
tcp->qual_flg |= QUAL_TRACE;
|
||||
}
|
||||
|
||||
void
|
||||
apply_raw(struct tcb *tcp, void *priv_data)
|
||||
{
|
||||
tcp->qual_flg |= QUAL_RAW;
|
||||
}
|
||||
|
||||
void
|
||||
apply_abbrev(struct tcb *tcp, void *priv_data)
|
||||
{
|
||||
tcp->qual_flg |= QUAL_ABBREV;
|
||||
}
|
||||
|
||||
void
|
||||
apply_verbose(struct tcb *tcp, void *priv_data)
|
||||
{
|
||||
tcp->qual_flg |= QUAL_VERBOSE;
|
||||
}
|
||||
|
||||
void
|
||||
apply_inject(struct tcb *tcp, void *priv_data)
|
||||
{
|
||||
struct inject_opts *opts = priv_data;
|
||||
|
||||
tcp->qual_flg |= QUAL_INJECT;
|
||||
if (!tcp->inject_vec[current_personality])
|
||||
tcp->inject_vec[current_personality] =
|
||||
xcalloc(nsyscalls, sizeof(struct inject_opts));
|
||||
if (scno_in_range(tcp->scno)
|
||||
&& !tcp->inject_vec[current_personality][tcp->scno].data.flags)
|
||||
tcp->inject_vec[current_personality][tcp->scno] = *opts;
|
||||
}
|
||||
|
||||
static void *
|
||||
parse_inject_common(const char *str, bool fault_tokens_only,
|
||||
const char *description)
|
||||
{
|
||||
struct inject_opts *opts = xmalloc(sizeof(struct inject_opts));
|
||||
char *copy = xstrdup(str);
|
||||
|
||||
parse_inject_common_args(copy, opts, fault_tokens_only, false);
|
||||
if (!opts->data.flags)
|
||||
error_msg_and_die("invalid %s argument '%s'",
|
||||
description, str ? str : "");
|
||||
free(copy);
|
||||
return opts;
|
||||
}
|
||||
|
||||
void *
|
||||
parse_inject(const char *str)
|
||||
{
|
||||
return parse_inject_common(str, false, "inject");
|
||||
}
|
||||
|
||||
void
|
||||
apply_fault(struct tcb *tcp, void *priv_data)
|
||||
{
|
||||
apply_inject(tcp, priv_data);
|
||||
}
|
||||
|
||||
void *
|
||||
parse_fault(const char *str)
|
||||
{
|
||||
return parse_inject_common(str, true, "fault");
|
||||
}
|
||||
|
||||
void
|
||||
apply_read(struct tcb *tcp, void *_priv_data)
|
||||
{
|
||||
tcp->qual_flg |= QUAL_READ;
|
||||
}
|
||||
|
||||
void
|
||||
apply_write(struct tcb *tcp, void *_priv_data)
|
||||
{
|
||||
tcp->qual_flg |= QUAL_WRITE;
|
||||
}
|
262
basic_filters.c
262
basic_filters.c
@ -3,49 +3,86 @@
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "number_set.h"
|
||||
#include "filter.h"
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
#include "filter.h"
|
||||
#include "number_set.h"
|
||||
#include "xstring.h"
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether a @-separated personality specification suffix is present.
|
||||
* Personality suffix is a one of strings stored in personality_designators
|
||||
* array.
|
||||
*
|
||||
* @param[in] s Specification string to check.
|
||||
* @param[out] p Where to store personality number if it is found.
|
||||
* @return If personality is found, the provided string is copied without
|
||||
* suffix and returned as a result (callee should de-alllocate it
|
||||
* with free() after use), and personality number is written to p.
|
||||
* Otherwise, NULL is returned and p is untouched.
|
||||
*/
|
||||
static char *
|
||||
qualify_syscall_separate_personality(const char *s, unsigned int *p)
|
||||
{
|
||||
char *pos = strchr(s, '@');
|
||||
|
||||
if (!pos)
|
||||
return NULL;
|
||||
|
||||
for (unsigned int i = 0; i < SUPPORTED_PERSONALITIES; i++) {
|
||||
if (!strcmp(pos + 1, personality_designators[i])) {
|
||||
*p = i;
|
||||
return xstrndup(s, pos - s);
|
||||
}
|
||||
}
|
||||
|
||||
error_msg_and_help("incorrect personality designator '%s'"
|
||||
" in qualification '%s'", pos + 1, s);
|
||||
}
|
||||
|
||||
static bool
|
||||
qualify_syscall_number_personality(int n, unsigned int p,
|
||||
struct number_set *set)
|
||||
{
|
||||
if ((unsigned int) n >= nsyscall_vec[p])
|
||||
return false;
|
||||
|
||||
add_number_to_set_array(n, set, p);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
qualify_syscall_number(const char *s, struct number_set *set)
|
||||
{
|
||||
int n = string_to_uint(s);
|
||||
unsigned int p;
|
||||
char *num_str = qualify_syscall_separate_personality(s, &p);
|
||||
int n;
|
||||
|
||||
if (num_str) {
|
||||
n = string_to_uint(num_str);
|
||||
free(num_str);
|
||||
|
||||
if (n < 0)
|
||||
return false;
|
||||
|
||||
return qualify_syscall_number_personality(n, p, set);
|
||||
}
|
||||
|
||||
n = string_to_uint(s);
|
||||
if (n < 0)
|
||||
return false;
|
||||
|
||||
bool done = false;
|
||||
|
||||
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
|
||||
if ((unsigned) n >= nsyscall_vec[p])
|
||||
continue;
|
||||
add_number_to_set_array(n, set, p);
|
||||
done = true;
|
||||
}
|
||||
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p)
|
||||
done |= qualify_syscall_number_personality(n, p, set);
|
||||
|
||||
return done;
|
||||
}
|
||||
@ -75,12 +112,26 @@ qualify_syscall_regex(const char *s, struct number_set *set)
|
||||
for (unsigned int i = 0; i < nsyscall_vec[p]; ++i) {
|
||||
if (!sysent_vec[p][i].sys_name)
|
||||
continue;
|
||||
|
||||
rc = regexec(&preg, sysent_vec[p][i].sys_name,
|
||||
0, NULL, 0);
|
||||
|
||||
if (rc == REG_NOMATCH) {
|
||||
char name_buf[128];
|
||||
char *pos = stpcpy(name_buf,
|
||||
sysent_vec[p][i].sys_name);
|
||||
|
||||
(void) xappendstr(name_buf, pos, "@%s",
|
||||
personality_designators[p]);
|
||||
|
||||
rc = regexec(&preg, name_buf, 0, NULL, 0);
|
||||
}
|
||||
|
||||
if (rc == REG_NOMATCH)
|
||||
continue;
|
||||
else if (rc)
|
||||
regerror_msg_and_die(rc, &preg, "regexec", s);
|
||||
|
||||
add_number_to_set_array(i, set, p);
|
||||
found = true;
|
||||
}
|
||||
@ -91,7 +142,7 @@ qualify_syscall_regex(const char *s, struct number_set *set)
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
lookup_class(const char *s, bool qualify_mode)
|
||||
lookup_class(const char *s)
|
||||
{
|
||||
static const struct {
|
||||
const char *name;
|
||||
@ -103,6 +154,7 @@ lookup_class(const char *s, bool qualify_mode)
|
||||
{ "%process", TRACE_PROCESS },
|
||||
{ "%signal", TRACE_SIGNAL },
|
||||
{ "%ipc", TRACE_IPC },
|
||||
{ "%net", TRACE_NETWORK },
|
||||
{ "%network", TRACE_NETWORK },
|
||||
{ "%stat", TRACE_STAT },
|
||||
{ "%lstat", TRACE_LSTAT },
|
||||
@ -123,8 +175,6 @@ lookup_class(const char *s, bool qualify_mode)
|
||||
};
|
||||
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(syscall_class); ++i) {
|
||||
if (!qualify_mode && *s != '%')
|
||||
break;
|
||||
if (strcmp(s, syscall_class[i].name) == 0)
|
||||
return syscall_class[i].value;
|
||||
}
|
||||
@ -133,9 +183,9 @@ lookup_class(const char *s, bool qualify_mode)
|
||||
}
|
||||
|
||||
static bool
|
||||
qualify_syscall_class(const char *s, struct number_set *set, bool qualify_mode)
|
||||
qualify_syscall_class(const char *s, struct number_set *set)
|
||||
{
|
||||
const unsigned int n = lookup_class(s, qualify_mode);
|
||||
const unsigned int n = lookup_class(s);
|
||||
if (!n)
|
||||
return false;
|
||||
|
||||
@ -166,24 +216,42 @@ scno_by_name(const char *s, unsigned int p, kernel_long_t start)
|
||||
}
|
||||
|
||||
static bool
|
||||
qualify_syscall_name(const char *s, struct number_set *set)
|
||||
qualify_syscall_name_personality(const char *s, unsigned int p,
|
||||
struct number_set *set)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
|
||||
for (kernel_long_t scno = 0;
|
||||
(scno = scno_by_name(s, p, scno)) >= 0;
|
||||
++scno) {
|
||||
add_number_to_set_array(scno, set, p);
|
||||
found = true;
|
||||
}
|
||||
for (kernel_long_t scno = 0; (scno = scno_by_name(s, p, scno)) >= 0;
|
||||
++scno) {
|
||||
add_number_to_set_array(scno, set, p);
|
||||
found = true;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
static bool
|
||||
qualify_syscall(const char *token, struct number_set *set, bool qualify_mode)
|
||||
qualify_syscall_name(const char *s, struct number_set *set)
|
||||
{
|
||||
unsigned int p;
|
||||
char *name_str = qualify_syscall_separate_personality(s, &p);
|
||||
bool found = false;
|
||||
|
||||
if (name_str) {
|
||||
found = qualify_syscall_name_personality(name_str, p, set);
|
||||
free(name_str);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p)
|
||||
found |= qualify_syscall_name_personality(s, p, set);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
static bool
|
||||
qualify_syscall(const char *token, struct number_set *set)
|
||||
{
|
||||
bool ignore_fail = false;
|
||||
|
||||
@ -195,7 +263,7 @@ qualify_syscall(const char *token, struct number_set *set, bool qualify_mode)
|
||||
return qualify_syscall_number(token, set) || ignore_fail;
|
||||
if (*token == '/')
|
||||
return qualify_syscall_regex(token + 1, set) || ignore_fail;
|
||||
return qualify_syscall_class(token, set, qualify_mode)
|
||||
return qualify_syscall_class(token, set)
|
||||
|| qualify_syscall_name(token, set)
|
||||
|| ignore_fail;
|
||||
}
|
||||
@ -205,8 +273,7 @@ qualify_syscall(const char *token, struct number_set *set, bool qualify_mode)
|
||||
* according to STR specification.
|
||||
*/
|
||||
void
|
||||
qualify_syscall_tokens(const char *const str, struct number_set *const set,
|
||||
bool qualify_mode)
|
||||
qualify_syscall_tokens(const char *const str, struct number_set *const set)
|
||||
{
|
||||
/* Clear all sets. */
|
||||
clear_number_set_array(set, SUPPORTED_PERSONALITIES);
|
||||
@ -216,15 +283,9 @@ qualify_syscall_tokens(const char *const str, struct number_set *const set,
|
||||
* of the remaining specification.
|
||||
*/
|
||||
const char *s = str;
|
||||
if (qualify_mode) {
|
||||
/*
|
||||
* Each leading ! character means inversion
|
||||
* of the remaining specification.
|
||||
*/
|
||||
while (*s == '!') {
|
||||
invert_number_set_array(set, SUPPORTED_PERSONALITIES);
|
||||
++s;
|
||||
}
|
||||
while (*s == '!') {
|
||||
invert_number_set_array(set, SUPPORTED_PERSONALITIES);
|
||||
++s;
|
||||
}
|
||||
|
||||
if (strcmp(s, "none") == 0) {
|
||||
@ -253,7 +314,7 @@ qualify_syscall_tokens(const char *const str, struct number_set *const set,
|
||||
|
||||
for (const char *token = strtok_r(copy, ",", &saveptr);
|
||||
token; token = strtok_r(NULL, ",", &saveptr)) {
|
||||
done = qualify_syscall(token, set, qualify_mode);
|
||||
done = qualify_syscall(token, set);
|
||||
if (!done)
|
||||
error_msg_and_die("invalid system call '%s'", token);
|
||||
}
|
||||
@ -264,33 +325,12 @@ qualify_syscall_tokens(const char *const str, struct number_set *const set,
|
||||
error_msg_and_die("invalid system call '%s'", str);
|
||||
}
|
||||
|
||||
void *
|
||||
parse_syscall_filter(const char *str, bool qualify_mode)
|
||||
{
|
||||
struct number_set *set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
|
||||
qualify_syscall_tokens(str, set, qualify_mode);
|
||||
return set;
|
||||
}
|
||||
|
||||
bool
|
||||
run_syscall_filter(struct tcb *tcp, void *priv_data)
|
||||
{
|
||||
return is_number_in_set_array(tcp->scno, priv_data, current_personality);
|
||||
}
|
||||
|
||||
void
|
||||
free_syscall_filter(void *priv_data)
|
||||
{
|
||||
free_number_set_array(priv_data, SUPPORTED_PERSONALITIES);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add numbers to SET according to STR specification.
|
||||
*/
|
||||
void
|
||||
qualify_tokens(const char *const str, struct number_set *const set,
|
||||
string_to_uint_func func, const char *const name,
|
||||
bool qualify_mode)
|
||||
string_to_uint_func func, const char *const name)
|
||||
{
|
||||
/* Clear the set. */
|
||||
clear_number_set_array(set, 1);
|
||||
@ -300,15 +340,9 @@ qualify_tokens(const char *const str, struct number_set *const set,
|
||||
* of the remaining specification.
|
||||
*/
|
||||
const char *s = str;
|
||||
if (qualify_mode) {
|
||||
/*
|
||||
* Each leading ! character means inversion
|
||||
* of the remaining specification.
|
||||
*/
|
||||
while (*s == '!') {
|
||||
invert_number_set_array(set, 1);
|
||||
++s;
|
||||
}
|
||||
while (*s == '!') {
|
||||
invert_number_set_array(set, 1);
|
||||
++s;
|
||||
}
|
||||
|
||||
if (strcmp(s, "none") == 0) {
|
||||
@ -349,55 +383,3 @@ qualify_tokens(const char *const str, struct number_set *const set,
|
||||
if (number < 0)
|
||||
error_msg_and_die("invalid %s '%s'", name, str);
|
||||
}
|
||||
|
||||
void *
|
||||
parse_fd_filter(const char *str, bool qualify_mode)
|
||||
{
|
||||
struct number_set *set = alloc_number_set_array(1);
|
||||
qualify_tokens(str, set, string_to_uint, "descriptor", qualify_mode);
|
||||
return set;
|
||||
}
|
||||
|
||||
static bool
|
||||
is_fd_in_set(struct tcb *tcp, int fd, void *data) {
|
||||
return fd < 0 ? false : is_number_in_set(fd, data);
|
||||
}
|
||||
|
||||
bool
|
||||
run_fd_filter(struct tcb *tcp, void *priv_data)
|
||||
{
|
||||
return match_fd_common(tcp, &is_fd_in_set, priv_data);
|
||||
}
|
||||
|
||||
void
|
||||
free_fd_filter(void *priv_data)
|
||||
{
|
||||
free_number_set_array(priv_data, 1);
|
||||
}
|
||||
|
||||
void *
|
||||
parse_path_filter(const char *path, bool qualify_mode)
|
||||
{
|
||||
struct path_set *set = xcalloc(1, sizeof(struct path_set));
|
||||
|
||||
pathtrace_select_set(path, set);
|
||||
return set;
|
||||
}
|
||||
|
||||
bool
|
||||
run_path_filter(struct tcb *tcp, void *priv_data)
|
||||
{
|
||||
return pathtrace_match_set(tcp, priv_data);
|
||||
}
|
||||
|
||||
void
|
||||
free_path_filter(void *priv_data)
|
||||
{
|
||||
struct path_set *set = priv_data;
|
||||
|
||||
for (unsigned int i = 0; i < set->num_selected; ++i)
|
||||
free((char *) set->paths_selected[i]);
|
||||
free(set->paths_selected);
|
||||
free(set);
|
||||
return;
|
||||
}
|
||||
|
24
bind.c
24
bind.c
@ -3,30 +3,10 @@
|
||||
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
|
||||
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
|
||||
* Copyright (c) 1996-2000 Wichert Akkerman <wichert@cistron.nl>
|
||||
* Copyright (c) 1999-2017 The strace developers.
|
||||
* Copyright (c) 1999-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
24
bjm.c
24
bjm.c
@ -3,30 +3,10 @@
|
||||
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
|
||||
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
|
||||
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
|
||||
* Copyright (c) 1999-2017 The strace developers.
|
||||
* Copyright (c) 1999-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
81
block.c
81
block.c
@ -4,27 +4,7 @@
|
||||
* Copyright (c) 2011-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
@ -65,60 +45,15 @@ typedef struct blk_user_trace_setup {
|
||||
uint32_t pid;
|
||||
} struct_blk_user_trace_setup;
|
||||
|
||||
/* Provide fall-back definitions for BLK* ioctls */
|
||||
#define XLAT_MACROS_ONLY
|
||||
#include "xlat/block_ioctl_cmds.h"
|
||||
#undef XLAT_MACROS_ONLY
|
||||
|
||||
#include MPERS_DEFS
|
||||
|
||||
#include "print_fields.h"
|
||||
|
||||
#ifndef BLKPG
|
||||
# define BLKPG _IO(0x12, 105)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ioctl numbers <= 114 are present in Linux 2.4. The following ones have been
|
||||
* added since then and headers containing them may not be available on every
|
||||
* system.
|
||||
*/
|
||||
|
||||
#ifndef BLKTRACESETUP
|
||||
# define BLKTRACESETUP _IOWR(0x12, 115, struct_blk_user_trace_setup)
|
||||
#endif
|
||||
#ifndef BLKTRACESTART
|
||||
# define BLKTRACESTART _IO(0x12, 116)
|
||||
#endif
|
||||
#ifndef BLKTRACESTOP
|
||||
# define BLKTRACESTOP _IO(0x12, 117)
|
||||
#endif
|
||||
#ifndef BLKTRACETEARDOWN
|
||||
# define BLKTRACETEARDOWN _IO(0x12, 118)
|
||||
#endif
|
||||
#ifndef BLKDISCARD
|
||||
# define BLKDISCARD _IO(0x12, 119)
|
||||
#endif
|
||||
#ifndef BLKIOMIN
|
||||
# define BLKIOMIN _IO(0x12, 120)
|
||||
#endif
|
||||
#ifndef BLKIOOPT
|
||||
# define BLKIOOPT _IO(0x12, 121)
|
||||
#endif
|
||||
#ifndef BLKALIGNOFF
|
||||
# define BLKALIGNOFF _IO(0x12, 122)
|
||||
#endif
|
||||
#ifndef BLKPBSZGET
|
||||
# define BLKPBSZGET _IO(0x12, 123)
|
||||
#endif
|
||||
#ifndef BLKDISCARDZEROES
|
||||
# define BLKDISCARDZEROES _IO(0x12, 124)
|
||||
#endif
|
||||
#ifndef BLKSECDISCARD
|
||||
# define BLKSECDISCARD _IO(0x12, 125)
|
||||
#endif
|
||||
#ifndef BLKROTATIONAL
|
||||
# define BLKROTATIONAL _IO(0x12, 126)
|
||||
#endif
|
||||
#ifndef BLKZEROOUT
|
||||
# define BLKZEROOUT _IO(0x12, 127)
|
||||
#endif
|
||||
|
||||
#include "xlat/blkpg_ops.h"
|
||||
|
||||
static void
|
||||
@ -181,6 +116,8 @@ MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp,
|
||||
case BLKIOMIN:
|
||||
case BLKIOOPT:
|
||||
case BLKDISCARDZEROES:
|
||||
case BLKGETZONESZ:
|
||||
case BLKGETNRZONES:
|
||||
if (entering(tcp))
|
||||
return 0;
|
||||
tprints(", ");
|
||||
@ -204,7 +141,6 @@ MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp,
|
||||
printnum_ulong(tcp, arg);
|
||||
break;
|
||||
|
||||
#ifdef HAVE_BLKGETSIZE64
|
||||
/* returns an uint64_t */
|
||||
case BLKGETSIZE64:
|
||||
if (entering(tcp))
|
||||
@ -212,7 +148,6 @@ MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp,
|
||||
tprints(", ");
|
||||
printnum_int64(tcp, arg, "%" PRIu64);
|
||||
break;
|
||||
#endif
|
||||
|
||||
/* takes a pair of uint64_t */
|
||||
case BLKDISCARD:
|
||||
|
@ -1,4 +1,9 @@
|
||||
#!/bin/sh -eu
|
||||
#
|
||||
# Copyright (c) 2014-2018 The strace developers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
./m4/gen_bpf_attr_m4.sh
|
||||
./generate_mpers_am.sh
|
||||
@ -26,7 +31,7 @@ for m in m32 mx32; do
|
||||
done
|
||||
done
|
||||
|
||||
for f in README; do
|
||||
for f in README INSTALL; do
|
||||
cp "dist/$f" .
|
||||
done
|
||||
|
||||
|
29
bpf.c
29
bpf.c
@ -4,27 +4,7 @@
|
||||
* Copyright (c) 2015-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
@ -292,11 +272,8 @@ BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)
|
||||
/* kern_version field was added in Linux commit v4.1-rc1~84^2~50. */
|
||||
if (len <= offsetof(struct BPF_PROG_LOAD_struct, kern_version))
|
||||
break;
|
||||
tprintf(", kern_version=KERNEL_VERSION(%u, %u, %u)",
|
||||
attr.kern_version >> 16,
|
||||
(attr.kern_version >> 8) & 0xFF,
|
||||
attr.kern_version & 0xFF);
|
||||
|
||||
tprints(", kern_version=");
|
||||
print_kernel_version(attr.kern_version);
|
||||
/* prog_flags field was added in Linux commit v4.12-rc2~34^2~29^2~2. */
|
||||
if (len <= offsetof(struct BPF_PROG_LOAD_struct, prog_flags))
|
||||
break;
|
||||
|
128
bpf_attr.h
128
bpf_attr.h
@ -2,31 +2,11 @@
|
||||
* Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifndef STRACE_BPF_ATTR_H
|
||||
#define STRACE_BPF_ATTR_H
|
||||
# define STRACE_BPF_ATTR_H
|
||||
|
||||
/*
|
||||
* The policy is that all fields of type uint64_t in this header file
|
||||
@ -39,21 +19,21 @@
|
||||
* v4.16-rc1~123^2~109^2~5^2~4.
|
||||
*/
|
||||
|
||||
#ifndef BPF_OBJ_NAME_LEN
|
||||
# define BPF_OBJ_NAME_LEN 16U
|
||||
#else
|
||||
# if BPF_OBJ_NAME_LEN != 16U
|
||||
# error "Unexpected value of BPF_OBJ_NAME_LEN"
|
||||
# ifndef BPF_OBJ_NAME_LEN
|
||||
# define BPF_OBJ_NAME_LEN 16U
|
||||
# else
|
||||
# if BPF_OBJ_NAME_LEN != 16U
|
||||
# error "Unexpected value of BPF_OBJ_NAME_LEN"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef BPF_TAG_SIZE
|
||||
# define BPF_TAG_SIZE 8
|
||||
#else
|
||||
# if BPF_TAG_SIZE != 8
|
||||
# error "Unexpected value of BPF_TAG_SIZE"
|
||||
# ifndef BPF_TAG_SIZE
|
||||
# define BPF_TAG_SIZE 8
|
||||
# else
|
||||
# if BPF_TAG_SIZE != 8
|
||||
# error "Unexpected value of BPF_TAG_SIZE"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
struct BPF_MAP_CREATE_struct {
|
||||
uint32_t map_type;
|
||||
@ -67,9 +47,9 @@ struct BPF_MAP_CREATE_struct {
|
||||
uint32_t map_ifindex;
|
||||
};
|
||||
|
||||
#define BPF_MAP_CREATE_struct_size \
|
||||
# define BPF_MAP_CREATE_struct_size \
|
||||
sizeof(struct BPF_MAP_CREATE_struct)
|
||||
#define expected_BPF_MAP_CREATE_struct_size 48
|
||||
# define expected_BPF_MAP_CREATE_struct_size 48
|
||||
|
||||
struct BPF_MAP_LOOKUP_ELEM_struct {
|
||||
uint32_t map_fd;
|
||||
@ -77,9 +57,9 @@ struct BPF_MAP_LOOKUP_ELEM_struct {
|
||||
uint64_t ATTRIBUTE_ALIGNED(8) value;
|
||||
};
|
||||
|
||||
#define BPF_MAP_LOOKUP_ELEM_struct_size \
|
||||
# define BPF_MAP_LOOKUP_ELEM_struct_size \
|
||||
sizeof(struct BPF_MAP_LOOKUP_ELEM_struct)
|
||||
#define expected_BPF_MAP_LOOKUP_ELEM_struct_size 24
|
||||
# define expected_BPF_MAP_LOOKUP_ELEM_struct_size 24
|
||||
|
||||
struct BPF_MAP_UPDATE_ELEM_struct {
|
||||
uint32_t map_fd;
|
||||
@ -88,18 +68,18 @@ struct BPF_MAP_UPDATE_ELEM_struct {
|
||||
uint64_t ATTRIBUTE_ALIGNED(8) flags;
|
||||
};
|
||||
|
||||
#define BPF_MAP_UPDATE_ELEM_struct_size \
|
||||
# define BPF_MAP_UPDATE_ELEM_struct_size \
|
||||
sizeof(struct BPF_MAP_UPDATE_ELEM_struct)
|
||||
#define expected_BPF_MAP_UPDATE_ELEM_struct_size 32
|
||||
# define expected_BPF_MAP_UPDATE_ELEM_struct_size 32
|
||||
|
||||
struct BPF_MAP_DELETE_ELEM_struct {
|
||||
uint32_t map_fd;
|
||||
uint64_t ATTRIBUTE_ALIGNED(8) key;
|
||||
};
|
||||
|
||||
#define BPF_MAP_DELETE_ELEM_struct_size \
|
||||
# define BPF_MAP_DELETE_ELEM_struct_size \
|
||||
sizeof(struct BPF_MAP_DELETE_ELEM_struct)
|
||||
#define expected_BPF_MAP_DELETE_ELEM_struct_size 16
|
||||
# define expected_BPF_MAP_DELETE_ELEM_struct_size 16
|
||||
|
||||
struct BPF_MAP_GET_NEXT_KEY_struct {
|
||||
uint32_t map_fd;
|
||||
@ -107,9 +87,9 @@ struct BPF_MAP_GET_NEXT_KEY_struct {
|
||||
uint64_t ATTRIBUTE_ALIGNED(8) next_key;
|
||||
};
|
||||
|
||||
#define BPF_MAP_GET_NEXT_KEY_struct_size \
|
||||
# define BPF_MAP_GET_NEXT_KEY_struct_size \
|
||||
sizeof(struct BPF_MAP_GET_NEXT_KEY_struct)
|
||||
#define expected_BPF_MAP_GET_NEXT_KEY_struct_size 24
|
||||
# define expected_BPF_MAP_GET_NEXT_KEY_struct_size 24
|
||||
|
||||
struct BPF_PROG_LOAD_struct {
|
||||
uint32_t prog_type;
|
||||
@ -126,9 +106,9 @@ struct BPF_PROG_LOAD_struct {
|
||||
uint32_t expected_attach_type;
|
||||
};
|
||||
|
||||
#define BPF_PROG_LOAD_struct_size \
|
||||
# define BPF_PROG_LOAD_struct_size \
|
||||
offsetofend(struct BPF_PROG_LOAD_struct, expected_attach_type)
|
||||
#define expected_BPF_PROG_LOAD_struct_size 72
|
||||
# define expected_BPF_PROG_LOAD_struct_size 72
|
||||
|
||||
struct BPF_OBJ_PIN_struct {
|
||||
uint64_t ATTRIBUTE_ALIGNED(8) pathname;
|
||||
@ -136,12 +116,12 @@ struct BPF_OBJ_PIN_struct {
|
||||
uint32_t file_flags;
|
||||
};
|
||||
|
||||
#define BPF_OBJ_PIN_struct_size \
|
||||
# define BPF_OBJ_PIN_struct_size \
|
||||
sizeof(struct BPF_OBJ_PIN_struct)
|
||||
#define expected_BPF_OBJ_PIN_struct_size 16
|
||||
# define expected_BPF_OBJ_PIN_struct_size 16
|
||||
|
||||
#define BPF_OBJ_GET_struct BPF_OBJ_PIN_struct
|
||||
#define BPF_OBJ_GET_struct_size BPF_OBJ_PIN_struct_size
|
||||
# define BPF_OBJ_GET_struct BPF_OBJ_PIN_struct
|
||||
# define BPF_OBJ_GET_struct_size BPF_OBJ_PIN_struct_size
|
||||
|
||||
struct BPF_PROG_ATTACH_struct {
|
||||
uint32_t target_fd;
|
||||
@ -150,9 +130,9 @@ struct BPF_PROG_ATTACH_struct {
|
||||
uint32_t attach_flags;
|
||||
};
|
||||
|
||||
#define BPF_PROG_ATTACH_struct_size \
|
||||
# define BPF_PROG_ATTACH_struct_size \
|
||||
sizeof(struct BPF_PROG_ATTACH_struct)
|
||||
#define expected_BPF_PROG_ATTACH_struct_size 16
|
||||
# define expected_BPF_PROG_ATTACH_struct_size 16
|
||||
|
||||
struct BPF_PROG_DETACH_struct {
|
||||
uint32_t target_fd;
|
||||
@ -160,9 +140,9 @@ struct BPF_PROG_DETACH_struct {
|
||||
uint32_t attach_type;
|
||||
};
|
||||
|
||||
#define BPF_PROG_DETACH_struct_size \
|
||||
# define BPF_PROG_DETACH_struct_size \
|
||||
sizeof(struct BPF_PROG_DETACH_struct)
|
||||
#define expected_BPF_PROG_DETACH_struct_size 12
|
||||
# define expected_BPF_PROG_DETACH_struct_size 12
|
||||
|
||||
struct BPF_PROG_TEST_RUN_struct /* test */ {
|
||||
uint32_t prog_fd;
|
||||
@ -175,9 +155,9 @@ struct BPF_PROG_TEST_RUN_struct /* test */ {
|
||||
uint32_t duration;
|
||||
};
|
||||
|
||||
#define BPF_PROG_TEST_RUN_struct_size \
|
||||
# define BPF_PROG_TEST_RUN_struct_size \
|
||||
sizeof(struct BPF_PROG_TEST_RUN_struct)
|
||||
#define expected_BPF_PROG_TEST_RUN_struct_size 40
|
||||
# define expected_BPF_PROG_TEST_RUN_struct_size 40
|
||||
|
||||
struct BPF_PROG_GET_NEXT_ID_struct {
|
||||
uint32_t start_id;
|
||||
@ -185,12 +165,12 @@ struct BPF_PROG_GET_NEXT_ID_struct {
|
||||
uint32_t open_flags;
|
||||
};
|
||||
|
||||
#define BPF_PROG_GET_NEXT_ID_struct_size \
|
||||
# define BPF_PROG_GET_NEXT_ID_struct_size \
|
||||
sizeof(struct BPF_PROG_GET_NEXT_ID_struct)
|
||||
#define expected_BPF_PROG_GET_NEXT_ID_struct_size 12
|
||||
# define expected_BPF_PROG_GET_NEXT_ID_struct_size 12
|
||||
|
||||
#define BPF_MAP_GET_NEXT_ID_struct BPF_PROG_GET_NEXT_ID_struct
|
||||
#define BPF_MAP_GET_NEXT_ID_struct_size BPF_PROG_GET_NEXT_ID_struct_size
|
||||
# define BPF_MAP_GET_NEXT_ID_struct BPF_PROG_GET_NEXT_ID_struct
|
||||
# define BPF_MAP_GET_NEXT_ID_struct_size BPF_PROG_GET_NEXT_ID_struct_size
|
||||
|
||||
struct BPF_PROG_GET_FD_BY_ID_struct {
|
||||
uint32_t prog_id;
|
||||
@ -198,9 +178,9 @@ struct BPF_PROG_GET_FD_BY_ID_struct {
|
||||
uint32_t open_flags;
|
||||
};
|
||||
|
||||
#define BPF_PROG_GET_FD_BY_ID_struct_size \
|
||||
# define BPF_PROG_GET_FD_BY_ID_struct_size \
|
||||
sizeof(struct BPF_PROG_GET_FD_BY_ID_struct)
|
||||
#define expected_BPF_PROG_GET_FD_BY_ID_struct_size 12
|
||||
# define expected_BPF_PROG_GET_FD_BY_ID_struct_size 12
|
||||
|
||||
struct BPF_MAP_GET_FD_BY_ID_struct {
|
||||
uint32_t map_id;
|
||||
@ -208,9 +188,9 @@ struct BPF_MAP_GET_FD_BY_ID_struct {
|
||||
uint32_t open_flags;
|
||||
};
|
||||
|
||||
#define BPF_MAP_GET_FD_BY_ID_struct_size \
|
||||
# define BPF_MAP_GET_FD_BY_ID_struct_size \
|
||||
sizeof(struct BPF_MAP_GET_FD_BY_ID_struct)
|
||||
#define expected_BPF_MAP_GET_FD_BY_ID_struct_size 12
|
||||
# define expected_BPF_MAP_GET_FD_BY_ID_struct_size 12
|
||||
|
||||
struct BPF_OBJ_GET_INFO_BY_FD_struct /* info */ {
|
||||
uint32_t bpf_fd;
|
||||
@ -218,9 +198,9 @@ struct BPF_OBJ_GET_INFO_BY_FD_struct /* info */ {
|
||||
uint64_t ATTRIBUTE_ALIGNED(8) info;
|
||||
};
|
||||
|
||||
#define BPF_OBJ_GET_INFO_BY_FD_struct_size \
|
||||
# define BPF_OBJ_GET_INFO_BY_FD_struct_size \
|
||||
sizeof(struct BPF_OBJ_GET_INFO_BY_FD_struct)
|
||||
#define expected_BPF_OBJ_GET_INFO_BY_FD_struct_size 16
|
||||
# define expected_BPF_OBJ_GET_INFO_BY_FD_struct_size 16
|
||||
|
||||
struct BPF_PROG_QUERY_struct /* query */ {
|
||||
uint32_t target_fd;
|
||||
@ -231,18 +211,18 @@ struct BPF_PROG_QUERY_struct /* query */ {
|
||||
uint32_t prog_cnt;
|
||||
};
|
||||
|
||||
#define BPF_PROG_QUERY_struct_size \
|
||||
# define BPF_PROG_QUERY_struct_size \
|
||||
offsetofend(struct BPF_PROG_QUERY_struct, prog_cnt)
|
||||
#define expected_BPF_PROG_QUERY_struct_size 28
|
||||
# define expected_BPF_PROG_QUERY_struct_size 28
|
||||
|
||||
struct BPF_RAW_TRACEPOINT_OPEN_struct /* raw_tracepoint */ {
|
||||
uint64_t ATTRIBUTE_ALIGNED(8) name;
|
||||
uint32_t prog_fd;
|
||||
};
|
||||
|
||||
#define BPF_RAW_TRACEPOINT_OPEN_struct_size \
|
||||
# define BPF_RAW_TRACEPOINT_OPEN_struct_size \
|
||||
offsetofend(struct BPF_RAW_TRACEPOINT_OPEN_struct, prog_fd)
|
||||
#define expected_BPF_RAW_TRACEPOINT_OPEN_struct_size 12
|
||||
# define expected_BPF_RAW_TRACEPOINT_OPEN_struct_size 12
|
||||
|
||||
struct bpf_map_info_struct {
|
||||
uint32_t type;
|
||||
@ -261,9 +241,9 @@ struct bpf_map_info_struct {
|
||||
uint64_t ATTRIBUTE_ALIGNED(8) netns_ino; /* skip check */
|
||||
};
|
||||
|
||||
#define bpf_map_info_struct_size \
|
||||
# define bpf_map_info_struct_size \
|
||||
sizeof(struct bpf_map_info_struct)
|
||||
#define expected_bpf_map_info_struct_size 64
|
||||
# define expected_bpf_map_info_struct_size 64
|
||||
|
||||
struct bpf_prog_info_struct {
|
||||
uint32_t type;
|
||||
@ -287,8 +267,8 @@ struct bpf_prog_info_struct {
|
||||
uint64_t ATTRIBUTE_ALIGNED(8) netns_ino; /* skip check */
|
||||
};
|
||||
|
||||
#define bpf_prog_info_struct_size \
|
||||
# define bpf_prog_info_struct_size \
|
||||
sizeof(struct bpf_prog_info_struct)
|
||||
#define expected_bpf_prog_info_struct_size 104
|
||||
# define expected_bpf_prog_info_struct_size 104
|
||||
|
||||
#endif /* !STRACE_BPF_ATTR_H */
|
||||
|
22
bpf_filter.c
22
bpf_filter.c
@ -5,27 +5,7 @@
|
||||
* Copyright (c) 2017-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
26
bpf_filter.h
26
bpf_filter.h
@ -1,34 +1,14 @@
|
||||
/*
|
||||
* Classic BPF filter block.
|
||||
*
|
||||
* Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifndef STRACE_BPF_FILTER_H
|
||||
#define STRACE_BPF_FILTER_H
|
||||
# define STRACE_BPF_FILTER_H
|
||||
|
||||
struct bpf_filter_block {
|
||||
uint16_t code;
|
||||
|
@ -1,5 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifndef STRACE_BPF_FPROG_H
|
||||
#define STRACE_BPF_FPROG_H
|
||||
# define STRACE_BPF_FPROG_H
|
||||
|
||||
struct bpf_fprog {
|
||||
unsigned short len;
|
||||
|
@ -1,30 +1,10 @@
|
||||
/*
|
||||
* Decoder of seccomp filter programs.
|
||||
*
|
||||
* Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -2,29 +2,10 @@
|
||||
* Decoder of socket filter programs.
|
||||
*
|
||||
* Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2017-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
156
btrfs.c
156
btrfs.c
@ -3,37 +3,17 @@
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef HAVE_LINUX_BTRFS_H
|
||||
|
||||
#include DEF_MPERS_TYPE(struct_btrfs_ioctl_dev_replace_args)
|
||||
#include DEF_MPERS_TYPE(struct_btrfs_ioctl_send_args)
|
||||
#include DEF_MPERS_TYPE(struct_btrfs_ioctl_received_subvol_args)
|
||||
#include DEF_MPERS_TYPE(struct_btrfs_ioctl_vol_args_v2)
|
||||
# include DEF_MPERS_TYPE(struct_btrfs_ioctl_dev_replace_args)
|
||||
# include DEF_MPERS_TYPE(struct_btrfs_ioctl_send_args)
|
||||
# include DEF_MPERS_TYPE(struct_btrfs_ioctl_received_subvol_args)
|
||||
# include DEF_MPERS_TYPE(struct_btrfs_ioctl_vol_args_v2)
|
||||
|
||||
# include <linux/btrfs.h>
|
||||
|
||||
@ -52,8 +32,8 @@ typedef struct btrfs_ioctl_vol_args_v2
|
||||
|
||||
#ifdef HAVE_LINUX_BTRFS_H
|
||||
|
||||
#include "print_fields.h"
|
||||
#include <linux/fs.h>
|
||||
# include "print_fields.h"
|
||||
# include <linux/fs.h>
|
||||
|
||||
/*
|
||||
* Prior to Linux 3.12, the BTRFS_IOC_DEFAULT_SUBVOL used u64 in
|
||||
@ -61,15 +41,15 @@ typedef struct btrfs_ioctl_vol_args_v2
|
||||
*/
|
||||
typedef __u64 u64;
|
||||
|
||||
#ifndef HAVE_STRUCT_BTRFS_IOCTL_FEATURE_FLAGS_COMPAT_FLAGS
|
||||
# ifndef HAVE_STRUCT_BTRFS_IOCTL_FEATURE_FLAGS_COMPAT_FLAGS
|
||||
struct btrfs_ioctl_feature_flags {
|
||||
uint64_t compat_flags;
|
||||
uint64_t compat_ro_flags;
|
||||
uint64_t incompat_flags;
|
||||
};
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifndef HAVE_STRUCT_BTRFS_IOCTL_DEFRAG_RANGE_ARGS_START
|
||||
# ifndef HAVE_STRUCT_BTRFS_IOCTL_DEFRAG_RANGE_ARGS_START
|
||||
struct btrfs_ioctl_defrag_range_args {
|
||||
uint64_t start;
|
||||
uint64_t len;
|
||||
@ -78,37 +58,37 @@ struct btrfs_ioctl_defrag_range_args {
|
||||
uint32_t compress_type;
|
||||
uint32_t unused[4];
|
||||
};
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifndef BTRFS_LABEL_SIZE
|
||||
# define BTRFS_LABEL_SIZE 256
|
||||
#endif
|
||||
# ifndef BTRFS_LABEL_SIZE
|
||||
# define BTRFS_LABEL_SIZE 256
|
||||
# endif
|
||||
|
||||
#ifndef BTRFS_IOC_QUOTA_RESCAN
|
||||
# ifndef BTRFS_IOC_QUOTA_RESCAN
|
||||
struct btrfs_ioctl_quota_rescan_args {
|
||||
uint64_t flags, progress, reserved[6];
|
||||
};
|
||||
# define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \
|
||||
# define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \
|
||||
struct btrfs_ioctl_quota_rescan_args)
|
||||
# define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \
|
||||
# define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \
|
||||
struct btrfs_ioctl_quota_rescan_args)
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifndef BTRFS_IOC_QUOTA_RESCAN_WAIT
|
||||
# define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46)
|
||||
#endif
|
||||
# ifndef BTRFS_IOC_QUOTA_RESCAN_WAIT
|
||||
# define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46)
|
||||
# endif
|
||||
|
||||
#ifndef BTRFS_IOC_GET_FEATURES
|
||||
# define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
|
||||
# ifndef BTRFS_IOC_GET_FEATURES
|
||||
# define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
|
||||
struct btrfs_ioctl_feature_flags)
|
||||
# define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \
|
||||
# define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \
|
||||
struct btrfs_ioctl_feature_flags[2])
|
||||
# define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
|
||||
# define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
|
||||
struct btrfs_ioctl_feature_flags[3])
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifndef BTRFS_IOC_TREE_SEARCH_V2
|
||||
# define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \
|
||||
# ifndef BTRFS_IOC_TREE_SEARCH_V2
|
||||
# define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \
|
||||
struct btrfs_ioctl_search_args_v2)
|
||||
struct btrfs_ioctl_search_args_v2 {
|
||||
struct btrfs_ioctl_search_key key; /* in/out - search parameters */
|
||||
@ -117,34 +97,34 @@ struct btrfs_ioctl_search_args_v2 {
|
||||
* to store item */
|
||||
uint64_t buf[0]; /* out - found items */
|
||||
};
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#include "xlat/btrfs_balance_args.h"
|
||||
#include "xlat/btrfs_balance_ctl_cmds.h"
|
||||
#include "xlat/btrfs_balance_flags.h"
|
||||
#include "xlat/btrfs_balance_state.h"
|
||||
#include "xlat/btrfs_compress_types.h"
|
||||
#include "xlat/btrfs_cont_reading_from_srcdev_mode.h"
|
||||
#include "xlat/btrfs_defrag_flags.h"
|
||||
#include "xlat/btrfs_dev_replace_cmds.h"
|
||||
#include "xlat/btrfs_dev_replace_results.h"
|
||||
#include "xlat/btrfs_dev_replace_state.h"
|
||||
#include "xlat/btrfs_dev_stats_flags.h"
|
||||
#include "xlat/btrfs_dev_stats_values.h"
|
||||
#include "xlat/btrfs_features_compat.h"
|
||||
#include "xlat/btrfs_features_compat_ro.h"
|
||||
#include "xlat/btrfs_features_incompat.h"
|
||||
#include "xlat/btrfs_key_types.h"
|
||||
#include "xlat/btrfs_logical_ino_args_flags.h"
|
||||
#include "xlat/btrfs_qgroup_ctl_cmds.h"
|
||||
#include "xlat/btrfs_qgroup_inherit_flags.h"
|
||||
#include "xlat/btrfs_qgroup_limit_flags.h"
|
||||
#include "xlat/btrfs_qgroup_status_flags.h"
|
||||
#include "xlat/btrfs_scrub_flags.h"
|
||||
#include "xlat/btrfs_send_flags.h"
|
||||
#include "xlat/btrfs_snap_flags_v2.h"
|
||||
#include "xlat/btrfs_space_info_flags.h"
|
||||
#include "xlat/btrfs_tree_objectids.h"
|
||||
# include "xlat/btrfs_balance_args.h"
|
||||
# include "xlat/btrfs_balance_ctl_cmds.h"
|
||||
# include "xlat/btrfs_balance_flags.h"
|
||||
# include "xlat/btrfs_balance_state.h"
|
||||
# include "xlat/btrfs_compress_types.h"
|
||||
# include "xlat/btrfs_cont_reading_from_srcdev_mode.h"
|
||||
# include "xlat/btrfs_defrag_flags.h"
|
||||
# include "xlat/btrfs_dev_replace_cmds.h"
|
||||
# include "xlat/btrfs_dev_replace_results.h"
|
||||
# include "xlat/btrfs_dev_replace_state.h"
|
||||
# include "xlat/btrfs_dev_stats_flags.h"
|
||||
# include "xlat/btrfs_dev_stats_values.h"
|
||||
# include "xlat/btrfs_features_compat.h"
|
||||
# include "xlat/btrfs_features_compat_ro.h"
|
||||
# include "xlat/btrfs_features_incompat.h"
|
||||
# include "xlat/btrfs_key_types.h"
|
||||
# include "xlat/btrfs_logical_ino_args_flags.h"
|
||||
# include "xlat/btrfs_qgroup_ctl_cmds.h"
|
||||
# include "xlat/btrfs_qgroup_inherit_flags.h"
|
||||
# include "xlat/btrfs_qgroup_limit_flags.h"
|
||||
# include "xlat/btrfs_qgroup_status_flags.h"
|
||||
# include "xlat/btrfs_scrub_flags.h"
|
||||
# include "xlat/btrfs_send_flags.h"
|
||||
# include "xlat/btrfs_snap_flags_v2.h"
|
||||
# include "xlat/btrfs_space_info_flags.h"
|
||||
# include "xlat/btrfs_tree_objectids.h"
|
||||
|
||||
static inline char
|
||||
prnibble(char v)
|
||||
@ -155,7 +135,7 @@ prnibble(char v)
|
||||
}
|
||||
|
||||
/* 8-4-4-4-12 = 36 characters */
|
||||
#define UUID_STRING_SIZE 36
|
||||
# define UUID_STRING_SIZE 36
|
||||
|
||||
/* Formats uuid, returns 0 if it's all zeroes */
|
||||
static int
|
||||
@ -242,9 +222,9 @@ btrfs_print_qgroup_limit(const struct btrfs_qgroup_limit *lim)
|
||||
tprints("}");
|
||||
}
|
||||
|
||||
#define btrfs_print_key_type(prefix_, where_, field_) \
|
||||
# define btrfs_print_key_type(prefix_, where_, field_) \
|
||||
PRINT_FIELD_XVAL_U((prefix_), (where_), field_, btrfs_key_types, NULL)
|
||||
#define btrfs_print_objectid(prefix_, where_, field_) \
|
||||
# define btrfs_print_objectid(prefix_, where_, field_) \
|
||||
PRINT_FIELD_XVAL_U((prefix_), (where_), field_, btrfs_tree_objectids, \
|
||||
NULL)
|
||||
|
||||
@ -738,9 +718,9 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
|
||||
struct btrfs_ioctl_fs_info_args args;
|
||||
char uuid[UUID_STRING_SIZE+1];
|
||||
uint32_t nodesize, sectorsize, clone_alignment;
|
||||
#ifndef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE
|
||||
# ifndef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE
|
||||
uint32_t *reserved32;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (entering(tcp))
|
||||
return 0;
|
||||
@ -749,16 +729,16 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
|
||||
if (umove_or_printaddr(tcp, arg, &args))
|
||||
break;
|
||||
|
||||
#ifdef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE
|
||||
# ifdef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE
|
||||
nodesize = args.nodesize,
|
||||
sectorsize = args.sectorsize,
|
||||
clone_alignment = args.clone_alignment;
|
||||
#else
|
||||
# else
|
||||
reserved32 = (void *) args.reserved;
|
||||
nodesize = reserved32[0];
|
||||
sectorsize = reserved32[1];
|
||||
clone_alignment = reserved32[2];
|
||||
#endif
|
||||
# endif
|
||||
btrfs_unparse_uuid(args.fsid, uuid);
|
||||
|
||||
PRINT_FIELD_U("{", args, max_id);
|
||||
@ -912,11 +892,11 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
|
||||
|
||||
tprintf(", flags=");
|
||||
printflags64(btrfs_logical_ino_args_flags,
|
||||
#ifdef HAVE_STRUCT_BTRFS_IOCTL_LOGICAL_INO_ARGS_FLAGS
|
||||
# ifdef HAVE_STRUCT_BTRFS_IOCTL_LOGICAL_INO_ARGS_FLAGS
|
||||
args.flags
|
||||
#else
|
||||
# else
|
||||
args.reserved[3]
|
||||
#endif
|
||||
# endif
|
||||
, "BTRFS_LOGICAL_INO_ARGS_???");
|
||||
PRINT_FIELD_ADDR64(", ", args, inodes);
|
||||
tprints("}");
|
||||
@ -1282,9 +1262,9 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
|
||||
|
||||
case BTRFS_IOC_CLONE: /* FICLONE */
|
||||
case BTRFS_IOC_CLONE_RANGE: /* FICLONERANGE */
|
||||
#ifdef BTRFS_IOC_FILE_EXTENT_SAME
|
||||
# ifdef BTRFS_IOC_FILE_EXTENT_SAME
|
||||
case BTRFS_IOC_FILE_EXTENT_SAME: /* FIDEDUPERANGE */
|
||||
#endif
|
||||
# endif
|
||||
/*
|
||||
* FICLONE, FICLONERANGE, and FIDEDUPERANGE started out as
|
||||
* btrfs ioctls and the code was kept for the generic
|
||||
|
52
cacheflush.c
52
cacheflush.c
@ -4,30 +4,10 @@
|
||||
* Copyright (c) 2010 Carmelo Amoroso <carmelo.amoroso@st.com>
|
||||
* Copyright (c) 2015 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
|
||||
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2014-2017 The strace developers.
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
@ -40,15 +20,15 @@
|
||||
# include "xlat/cacheflush_scope.h"
|
||||
|
||||
static const struct xlat cacheflush_flags[] = {
|
||||
#ifdef FLUSH_CACHE_BOTH
|
||||
# ifdef FLUSH_CACHE_BOTH
|
||||
XLAT(FLUSH_CACHE_BOTH),
|
||||
#endif
|
||||
#ifdef FLUSH_CACHE_DATA
|
||||
# endif
|
||||
# ifdef FLUSH_CACHE_DATA
|
||||
XLAT(FLUSH_CACHE_DATA),
|
||||
#endif
|
||||
#ifdef FLUSH_CACHE_INSN
|
||||
# endif
|
||||
# ifdef FLUSH_CACHE_INSN
|
||||
XLAT(FLUSH_CACHE_INSN),
|
||||
#endif
|
||||
# endif
|
||||
XLAT_END
|
||||
};
|
||||
|
||||
@ -92,18 +72,18 @@ SYS_FUNC(cacheflush)
|
||||
|
||||
#ifdef SH
|
||||
static const struct xlat cacheflush_flags[] = {
|
||||
#ifdef CACHEFLUSH_D_INVAL
|
||||
# ifdef CACHEFLUSH_D_INVAL
|
||||
XLAT(CACHEFLUSH_D_INVAL),
|
||||
#endif
|
||||
#ifdef CACHEFLUSH_D_WB
|
||||
# endif
|
||||
# ifdef CACHEFLUSH_D_WB
|
||||
XLAT(CACHEFLUSH_D_WB),
|
||||
#endif
|
||||
#ifdef CACHEFLUSH_D_PURGE
|
||||
# endif
|
||||
# ifdef CACHEFLUSH_D_PURGE
|
||||
XLAT(CACHEFLUSH_D_PURGE),
|
||||
#endif
|
||||
#ifdef CACHEFLUSH_I
|
||||
# endif
|
||||
# ifdef CACHEFLUSH_I
|
||||
XLAT(CACHEFLUSH_I),
|
||||
#endif
|
||||
# endif
|
||||
XLAT_END
|
||||
};
|
||||
|
||||
|
24
capability.c
24
capability.c
@ -2,30 +2,10 @@
|
||||
* Copyright (c) 2000 Wichert Akkerman <wakkerma@debian.org>
|
||||
* Copyright (c) 2011 Denys Vlasenko <dvlasenk@redhat.com>
|
||||
* Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2014-2017 The strace developers.
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
7
caps0.h
7
caps0.h
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
CAP_CHOWN,
|
||||
CAP_DAC_OVERRIDE,
|
||||
CAP_DAC_READ_SEARCH,
|
||||
|
7
caps1.h
7
caps1.h
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
CAP_MAC_OVERRIDE,
|
||||
CAP_MAC_ADMIN,
|
||||
CAP_SYSLOG,
|
||||
|
7
chdir.c
7
chdir.c
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
SYS_FUNC(chdir)
|
||||
|
7
chmod.c
7
chmod.c
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
static void
|
||||
|
@ -1,16 +1,30 @@
|
||||
#!/bin/sh -ex
|
||||
#
|
||||
# Copyright (c) 2018 The strace developers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
type sudo >/dev/null 2>&1 && sudo=sudo || sudo=
|
||||
common_packages='autoconf automake faketime file gawk gcc-multilib git gzip libbluetooth-dev make xz-utils'
|
||||
|
||||
retry_if_failed()
|
||||
{
|
||||
for i in `seq 0 99`; do
|
||||
"$@" && i= && break || sleep 1
|
||||
done
|
||||
[ -z "$i" ]
|
||||
}
|
||||
|
||||
updated=
|
||||
apt_get_install()
|
||||
{
|
||||
[ -n "$updated" ] || {
|
||||
$sudo apt-get -qq update
|
||||
retry_if_failed $sudo apt-get -qq update
|
||||
updated=1
|
||||
}
|
||||
$sudo apt-get -qq --no-install-suggests --no-install-recommends \
|
||||
retry_if_failed $sudo \
|
||||
apt-get -qq --no-install-suggests --no-install-recommends \
|
||||
install -y "$@"
|
||||
}
|
||||
|
||||
@ -36,13 +50,27 @@ clone_repo()
|
||||
;;
|
||||
esac
|
||||
|
||||
git clone --depth=1 ${branch:+--branch $branch} "$src" "$dst"
|
||||
retry_if_failed \
|
||||
git clone --depth=1 ${branch:+--branch $branch} "$src" "$dst"
|
||||
}
|
||||
|
||||
case "$CC" in
|
||||
gcc-*)
|
||||
retry_if_failed \
|
||||
$sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
apt_get_install $common_packages "$CC"-multilib
|
||||
;;
|
||||
clang*)
|
||||
apt_get_install $common_packages "$CC"
|
||||
;;
|
||||
*)
|
||||
apt_get_install $common_packages
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$KHEADERS" in
|
||||
*/*)
|
||||
clone_repo https://github.com/"$KHEADERS" kernel ${KBRANCH-}
|
||||
apt_get_install $common_packages
|
||||
$sudo make -C kernel headers_install INSTALL_HDR_PATH=/opt/kernel
|
||||
$sudo rm -rf kernel
|
||||
KHEADERS_INC=/opt/kernel/include
|
||||
@ -53,19 +81,8 @@ case "$KHEADERS" in
|
||||
esac
|
||||
|
||||
case "$CC" in
|
||||
gcc)
|
||||
apt_get_install $common_packages
|
||||
;;
|
||||
gcc-*)
|
||||
$sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
apt_get_install $common_packages "$CC"-multilib
|
||||
;;
|
||||
clang*)
|
||||
apt_get_install $common_packages "$CC"
|
||||
;;
|
||||
musl-gcc)
|
||||
clone_repo strace/musl musl
|
||||
apt_get_install $common_packages
|
||||
cd musl
|
||||
CC=gcc
|
||||
build=
|
||||
@ -103,7 +120,8 @@ esac
|
||||
case "${CHECK-}" in
|
||||
coverage)
|
||||
apt_get_install lcov
|
||||
pip install --user codecov
|
||||
retry_if_failed \
|
||||
pip install --user codecov
|
||||
;;
|
||||
valgrind)
|
||||
apt_get_install valgrind
|
||||
|
@ -1,4 +1,9 @@
|
||||
#!/bin/sh -ex
|
||||
#
|
||||
# Copyright (c) 2018 The strace developers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS='--disable-dependency-tracking'
|
||||
export DISTCHECK_CONFIGURE_FLAGS
|
||||
@ -33,6 +38,7 @@ case "${STACKTRACE-}" in
|
||||
;;
|
||||
esac
|
||||
|
||||
CPPFLAGS=
|
||||
case "$KHEADERS" in
|
||||
*/*)
|
||||
CPPFLAGS='-isystem /opt/kernel/include'
|
||||
@ -62,7 +68,7 @@ $CC -print-multi-lib ||:
|
||||
make --version |head -1
|
||||
autoconf --version |head -1
|
||||
automake --version |head -1
|
||||
kver="$(printf '%s\n%s\n' '#include <linux/version.h>' 'LINUX_VERSION_CODE' | $CC -E -P -)"
|
||||
kver="$(printf '%s\n%s\n' '#include <linux/version.h>' 'LINUX_VERSION_CODE' | $CC $CPPFLAGS -E -P -)"
|
||||
printf 'kernel-headers %s.%s.%s\n' $(($kver/65536)) $(($kver/256%256)) $(($kver%256))
|
||||
echo 'END OF BUILD ENVIRONMENT INFORMATION'
|
||||
|
||||
|
28
clone.c
28
clone.c
@ -7,27 +7,7 @@
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
@ -111,8 +91,10 @@ SYS_FUNC(clone)
|
||||
tprints("flags=");
|
||||
if (!printflags64(clone_flags, flags & ~CSIGNAL, NULL))
|
||||
sep = "";
|
||||
if ((flags & CSIGNAL) != 0)
|
||||
tprintf("%s%s", sep, signame(flags & CSIGNAL));
|
||||
if ((flags & CSIGNAL) != 0) {
|
||||
tprints(sep);
|
||||
printsignal(flags & CSIGNAL);
|
||||
}
|
||||
if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID
|
||||
|CLONE_CHILD_CLEARTID|CLONE_SETTLS)) == 0)
|
||||
return 0;
|
||||
|
57
configure.ac
57
configure.ac
@ -8,27 +8,7 @@
|
||||
# Copyright (c) 2002-2018 The strace developers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT([strace],
|
||||
@ -318,6 +298,9 @@ AC_CHECK_TYPES(m4_normalize([
|
||||
struct ptrace_peeksiginfo_args
|
||||
]),,, [#include <sys/ptrace.h>])
|
||||
|
||||
# For kernels that do not have v3.10-rc1~201^2~11
|
||||
AC_CHECK_TYPES([s390_compat_regs],,, [#include <asm/ptrace.h>])
|
||||
|
||||
AC_CHECK_TYPES(m4_normalize([
|
||||
struct flock,
|
||||
struct flock64,
|
||||
@ -394,7 +377,6 @@ AC_CHECK_HEADERS(m4_normalize([
|
||||
linux/falloc.h
|
||||
linux/fib_rules.h
|
||||
linux/fiemap.h
|
||||
linux/genetlink.h
|
||||
linux/hiddev.h
|
||||
linux/if_addr.h
|
||||
linux/if_link.h
|
||||
@ -575,11 +557,31 @@ AC_CHECK_TYPES(m4_normalize([
|
||||
]),,, [#include <linux/ptp_clock.h>])
|
||||
|
||||
AC_CHECK_TYPES(m4_normalize([
|
||||
struct kvm_cpuid2,
|
||||
struct kvm_regs,
|
||||
struct kvm_sregs,
|
||||
struct kvm_userspace_memory_region
|
||||
]),,, [#include <linux/kvm.h>])
|
||||
|
||||
saved_CPPFLAGS="$CPPFLAGS"
|
||||
|
||||
AC_CACHE_CHECK([whether <linux/signal.h> can be used along with <signal.h>],
|
||||
[st_cv_linux_signal],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <signal.h>
|
||||
#include <linux/signal.h>]],[])],
|
||||
[st_cv_linux_signal=yes],
|
||||
[st_cv_linux_signal=no])])
|
||||
if test "x$st_cv_linux_signal" = xno; then
|
||||
mkdir -p linux/linux
|
||||
cp $srcdir/linux/signal.h.in linux/linux/signal.h
|
||||
CPPFLAGS="$CPPFLAGS -Ilinux"
|
||||
fi
|
||||
|
||||
AC_CHECK_TYPES([struct __aio_sigset],,, [#include <linux/aio_abi.h>])
|
||||
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
|
||||
AC_CHECK_HEADERS([linux/btrfs.h], [
|
||||
AC_CHECK_MEMBERS(m4_normalize([
|
||||
struct btrfs_ioctl_feature_flags.compat_flags,
|
||||
@ -643,6 +645,8 @@ AC_CHECK_DECLS(m4_normalize([
|
||||
KERN_MAX_LOCK_DEPTH,
|
||||
KERN_NMI_WATCHDOG,
|
||||
KERN_PANIC_ON_NMI,
|
||||
KERN_PANIC_ON_WARN,
|
||||
KERN_PANIC_PRINT,
|
||||
NET_LLC,
|
||||
NET_NETFILTER,
|
||||
NET_DCCP,
|
||||
@ -765,15 +769,6 @@ AC_CHECK_MEMBERS(m4_normalize([
|
||||
#include <linux/types.h>
|
||||
#include <linux/videodev2.h>])
|
||||
|
||||
AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <stdlib.h>
|
||||
#include <linux/fs.h>], [return !BLKGETSIZE64;])],
|
||||
[ac_cv_have_blkgetsize64=yes], [ac_cv_have_blkgetsize64=no])]
|
||||
if test $ac_cv_have_blkgetsize64 = yes; then
|
||||
AC_DEFINE([HAVE_BLKGETSIZE64], [1], [Define to 1 if you have BLKGETSIZE64.])
|
||||
fi)
|
||||
|
||||
AC_CHECK_SIZEOF([long])
|
||||
SIZEOF_LONG="$ac_cv_sizeof_long"
|
||||
AC_SUBST(SIZEOF_LONG)
|
||||
|
@ -1,28 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -1,4 +1,9 @@
|
||||
#! /bin/sh
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2017-2018 The strace developers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
: ${YEAR_FILE:=$1}
|
||||
: ${DEFAULT_YEAR:=$2}
|
||||
@ -14,7 +19,7 @@ year=
|
||||
[ -f "${YEAR_FILE}" ] && year="$(cat "${YEAR_FILE}")"
|
||||
|
||||
[ -n "${year}" ] ||
|
||||
year="$(date -u +%Y -d "$(git show --format=format:%cD --no-patch)")"
|
||||
year="$(date -u +%Y -d "$(git show -s --format=format:%cD)")"
|
||||
|
||||
[ -n "${year}" ] ||
|
||||
year="${DEFAULT_YEAR}"
|
||||
|
22
count.c
22
count.c
@ -11,27 +11,7 @@
|
||||
* Copyright (c) 2006-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
24
debian/changelog.in
vendored
24
debian/changelog.in
vendored
@ -4,6 +4,30 @@ strace (@PACKAGE_VERSION@-1) experimental; urgency=low
|
||||
|
||||
-- Strace <@PACKAGE_BUGREPORT@> @DEB_CHANGELOGTIME@
|
||||
|
||||
strace (4.26-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version.
|
||||
|
||||
-- Dmitry V. Levin <ldv@altlinux.org> Wed, 26 Dec 2018 18:25:10 +0000
|
||||
|
||||
strace (4.25-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version.
|
||||
|
||||
-- Dmitry V. Levin <ldv@altlinux.org> Tue, 30 Oct 2018 08:09:10 +0000
|
||||
|
||||
strace (4.24-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version.
|
||||
|
||||
-- Dmitry V. Levin <ldv@altlinux.org> Tue, 14 Aug 2018 00:01:02 +0000
|
||||
|
||||
strace (4.23-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version.
|
||||
|
||||
-- Dmitry V. Levin <ldv@altlinux.org> Thu, 14 Jun 2018 11:00:00 +0000
|
||||
|
||||
strace (4.22-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version.
|
||||
|
30
debian/copyright
vendored
30
debian/copyright
vendored
@ -14,24 +14,14 @@ Copyright (c) 1998-2001 Wichert Akkerman <wakkerma@deephackmode.org>
|
||||
Copyright (c) 2001-2018 The strace developers.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
strace is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2.1 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
strace 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 LGPL-2.1-or-later for more details.
|
||||
|
||||
strace test suite is provided under the terms of the GNU General Public License
|
||||
version 2 or later, see tests/COPYING for more details.
|
||||
|
22
delay.c
22
delay.c
@ -2,27 +2,7 @@
|
||||
* Copyright (c) 2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
24
delay.h
24
delay.h
@ -2,31 +2,11 @@
|
||||
* Copyright (c) 2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifndef STRACE_DELAY_H
|
||||
#define STRACE_DELAY_H
|
||||
# define STRACE_DELAY_H
|
||||
|
||||
uint16_t alloc_delay_data(void);
|
||||
void fill_delay_data(uint16_t delay_idx, int intval, bool isenter);
|
||||
|
22
desc.c
22
desc.c
@ -6,27 +6,7 @@
|
||||
* Copyright (c) 1999-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
24
dirent.c
24
dirent.c
@ -4,30 +4,10 @@
|
||||
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
|
||||
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
|
||||
* Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2014-2017 The strace developers.
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
24
dirent64.c
24
dirent64.c
@ -4,30 +4,10 @@
|
||||
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
|
||||
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
|
||||
* Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2015-2017 The strace developers.
|
||||
* Copyright (c) 2015-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
134
dist/INSTALL
vendored
Normal file
134
dist/INSTALL
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
0. BUILD REQUIREMENTS
|
||||
|
||||
- Sane POSIX shell.
|
||||
- gcc-like compiler that supports C99 and some GNU extensions (namely, empty
|
||||
structures, empty definitions, zero length arrays, ranged designated
|
||||
initialisers).
|
||||
- libc. GNU libc and musl are supported.
|
||||
- Linux UAPI headers.
|
||||
- GNU Make.
|
||||
- GNU coreutils.
|
||||
- For running test suite: gawk, grep, sed, runtime environment for all
|
||||
personalities.
|
||||
- Requirements for optional features are documented in their description.
|
||||
|
||||
1. CONFIGURATION AND OPTIONAL FEATURES
|
||||
|
||||
Configuration is done using GNU Autoconf-generated configure script.
|
||||
Please refer to the README-configure file for generic information regarding
|
||||
configure usage.
|
||||
|
||||
In addition to standard configure options, strace's configure file provides
|
||||
the following options:
|
||||
|
||||
1.1. Additional build and testing hardening
|
||||
|
||||
--enable-gcc-Werror turn on gcc's -Werror option
|
||||
--enable-code-coverage Whether to enable code coverage support
|
||||
--with-gcov=GCOV use given GCOV for coverage (GCOV=gcov).
|
||||
--enable-valgrind Whether to enable Valgrind on the unit tests
|
||||
--disable-valgrind-memcheck
|
||||
Whether to skip memcheck during the Valgrind tests
|
||||
--disable-valgrind-helgrind
|
||||
Whether to skip helgrind during the Valgrind tests
|
||||
--disable-valgrind-drd Whether to skip drd during the Valgrind tests
|
||||
--enable-valgrind-sgcheck
|
||||
Whether to use sgcheck during the Valgrind tests
|
||||
|
||||
1.2. Optional features
|
||||
|
||||
1.2.1. Multiple personalities support
|
||||
|
||||
--enable-mpers=yes|no|check|m32|mx32
|
||||
whether to enable multiple personalities support
|
||||
required for proper decoding of structures used by
|
||||
tracees with personalities that differ from the
|
||||
personality of strace, default is yes.
|
||||
|
||||
Personality is a way system call is performed (in terms of ABI). For example,
|
||||
Linux kernel on multiple 64-bit architectures that evolve from their 32-bit
|
||||
counterparts have support for running 32-bit binaries with 32-bit system call
|
||||
ABI, and that system call ABI constitutes a separate personality in strace's
|
||||
terms. Another example is 32-on-64 bit ABI; while exploiting the same way for
|
||||
performing system calls as native 64-bit system calls, this ABI has different
|
||||
type sizes and, as a result, also constitutes a separate personality; the only
|
||||
such ABI that is currently supported by strace is x32 on x86_64. This is
|
||||
important as different ABIs use different alignments and type sizes, as a
|
||||
result, fields in structures in unions have different offsets on different
|
||||
ABIs. In order to be able to correctly parse all the structures used in various
|
||||
system calls and ioctl commands, strace compiles these structure definitions
|
||||
for these different ABI and then parses DWARF of these compiled definitions in
|
||||
order to generate proper structure definitions that compiled with decoder code.
|
||||
Taking the aforementioned into account, there are the following requirements:
|
||||
|
||||
- gawk (at least version 3)
|
||||
- Ability to compile for m32 personality (on architectures where it is supported)
|
||||
- On x86_64, x32, powerpc64, sparc64, riscv64, tile64: gcc -m32
|
||||
- s390x: gcc -m31
|
||||
- AArch64: a separate compiler for armv7 EABI
|
||||
- See information about configuration in "1.3.2. AArch64: AArch32 support"
|
||||
- Ability to compile for mx32 personality (on architectures where it is supported)
|
||||
- On x86_64: gcc -mx32
|
||||
- For tests: runtime support (linker, libc, and loader)
|
||||
|
||||
1.2.2. Stack unwinding (-k option)
|
||||
|
||||
--with-libunwind use libunwind to implement stack tracing support
|
||||
--with-libiberty use libiberty to demangle symbols in stack trace
|
||||
|
||||
1.3. Architecture-specific features
|
||||
|
||||
1.3.1. ARMv7: OABI support
|
||||
|
||||
--enable-arm-oabi enable OABI support on ARM EABI
|
||||
|
||||
1.3.2. AArch64: AArch32 support
|
||||
|
||||
CC_FOR_M32
|
||||
CPP_FOR_M32
|
||||
CFLAGS_FOR_M32
|
||||
CPPFLAGS_FOR_M32
|
||||
|
||||
1.4. Miscellanea
|
||||
|
||||
1.4.1. Static build configuration
|
||||
|
||||
For static linking, provide LDFLAGS='-static -pthread'.
|
||||
|
||||
1.4.2. Cross-compilation configuration
|
||||
|
||||
2. BUILDING
|
||||
|
||||
make
|
||||
make V=1
|
||||
|
||||
3. TESTING
|
||||
|
||||
make check
|
||||
|
||||
TESTS='list of tests'
|
||||
VALGRIND_FLAGS
|
||||
TIMEOUT_DURATION
|
||||
|
||||
BTRFS_MOUNTPOINT
|
||||
|
||||
4. ADDITIONAL TARGETS
|
||||
|
||||
make code-coverage-capture
|
||||
make code-coverage-capture CODE_COVERAGE_BRANCH_COVERAGE=
|
||||
|
||||
5. INSTALLATION
|
||||
|
||||
make install
|
||||
|
||||
6. PACKAGING
|
||||
|
||||
6.1. Distribution tarball
|
||||
|
||||
./make-dist
|
||||
|
||||
Requires git
|
||||
|
||||
6.2. dpkg package
|
||||
|
||||
6.3. RPM package
|
14
dist/README
vendored
14
dist/README
vendored
@ -4,19 +4,29 @@ and tamper with interactions between processes and the Linux kernel, which
|
||||
include system calls, signal deliveries, and changes of process state.
|
||||
The operation of strace is made possible by the kernel feature known as ptrace.
|
||||
|
||||
strace is released under a Berkeley-style license at the request
|
||||
of Paul Kranenburg; see the file COPYING for details.
|
||||
strace is released under the terms of the GNU Lesser General Public License
|
||||
version 2.1 or later; see the file COPYING for details.
|
||||
strace test suite is released under the terms of the GNU General Public License
|
||||
version 2 or later; see the file tests/COPYING for details.
|
||||
|
||||
See the file CREDITS for a list of authors and other contributors.
|
||||
See the file INSTALL for compilation and installation instructions.
|
||||
See the file NEWS for information on what has changed in recent versions.
|
||||
See the file README-hacking for information related to strace development.
|
||||
|
||||
The project's homepage is at
|
||||
https://strace.io
|
||||
|
||||
The GIT repository of strace is available at
|
||||
https://github.com/strace/strace/ and https://gitlab.com/strace/strace/
|
||||
|
||||
strace has a mailing list:
|
||||
strace-devel@lists.strace.io
|
||||
|
||||
Everyone is welcome to post bug reports, feature requests, comments
|
||||
and patches to the list. The mailing list archives are available at
|
||||
https://lists.strace.io/pipermail/strace-devel/
|
||||
|
||||
System requirements:
|
||||
* Linux kernel >= 2.6.18 is recommended. Older versions might still work
|
||||
but they haven't been thoroughly tested with this release.
|
||||
|
24
dm.c
24
dm.c
@ -8,27 +8,7 @@
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
@ -118,7 +98,7 @@ dm_decode_values(struct tcb *tcp, const unsigned int code,
|
||||
}
|
||||
}
|
||||
|
||||
#include "xlat/dm_flags.h"
|
||||
# include "xlat/dm_flags.h"
|
||||
|
||||
static void
|
||||
dm_decode_flags(const struct dm_ioctl *ioc)
|
||||
|
24
dyxlat.c
24
dyxlat.c
@ -1,27 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2017 The strace developers.
|
||||
* Copyright (c) 2017-2018 The strace developers.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
24
epoll.c
24
epoll.c
@ -2,30 +2,10 @@
|
||||
* Copyright (c) 2004-2007 Ulrich Drepper <drepper@redhat.com>
|
||||
* Copyright (c) 2004 Roland McGrath <roland@redhat.com>
|
||||
* Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2015-2017 The strace developers.
|
||||
* Copyright (c) 2015-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -1,28 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2017 The strace developers.
|
||||
* Copyright (c) 1999-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -4,38 +4,18 @@
|
||||
* package. Variable 'program_invocation_name' and function 'die()'
|
||||
* have to be defined globally.
|
||||
*
|
||||
* Copyright (c) 2001-2017 The strace developers.
|
||||
* Copyright (c) 2001-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifndef STRACE_ERROR_PRINTS_H
|
||||
#define STRACE_ERROR_PRINTS_H
|
||||
# define STRACE_ERROR_PRINTS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
# include <stdbool.h>
|
||||
|
||||
#include "gcc_compat.h"
|
||||
# include "gcc_compat.h"
|
||||
|
||||
extern bool debug_flag;
|
||||
|
||||
@ -51,29 +31,29 @@ void error_msg_and_die(const char *fmt, ...)
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
|
||||
|
||||
/* Wrappers for if (debug_flag) error_msg(...) */
|
||||
#define debug_msg(...) \
|
||||
# define debug_msg(...) \
|
||||
do { \
|
||||
if (debug_flag) \
|
||||
error_msg(__VA_ARGS__); \
|
||||
} while (0)
|
||||
#define debug_perror_msg(...) \
|
||||
# define debug_perror_msg(...) \
|
||||
do { \
|
||||
if (debug_flag) \
|
||||
perror_msg(__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
/* Simple wrappers for providing function name in error messages */
|
||||
#define error_func_msg(fmt_, ...) \
|
||||
# define error_func_msg(fmt_, ...) \
|
||||
error_msg("%s: " fmt_, __func__, ##__VA_ARGS__)
|
||||
#define perror_func_msg(fmt_, ...) \
|
||||
# define perror_func_msg(fmt_, ...) \
|
||||
perror_msg("%s: " fmt_, __func__, ##__VA_ARGS__)
|
||||
#define debug_func_msg(fmt_, ...) \
|
||||
# define debug_func_msg(fmt_, ...) \
|
||||
debug_msg("%s: " fmt_, __func__, ##__VA_ARGS__)
|
||||
#define debug_func_perror_msg(fmt_, ...) \
|
||||
# define debug_func_perror_msg(fmt_, ...) \
|
||||
debug_perror_msg("%s: " fmt_, __func__, ##__VA_ARGS__)
|
||||
#define error_func_msg_and_die(fmt_, ...) \
|
||||
# define error_func_msg_and_die(fmt_, ...) \
|
||||
error_msg_and_die("%s: " fmt_, __func__, ##__VA_ARGS__)
|
||||
#define perror_func_msg_and_die(fmt_, ...) \
|
||||
# define perror_func_msg_and_die(fmt_, ...) \
|
||||
perror_msg_and_die("%s: " fmt_, __func__, ##__VA_ARGS__)
|
||||
|
||||
#endif /* !STRACE_ERROR_PRINTS_H */
|
||||
|
38
evdev.c
38
evdev.c
@ -4,32 +4,13 @@
|
||||
* Copyright (c) 2015-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include "xlat/evdev_abs.h"
|
||||
#include "xlat/evdev_ev.h"
|
||||
|
||||
#ifdef HAVE_LINUX_INPUT_H
|
||||
|
||||
@ -47,7 +28,6 @@
|
||||
# include "xlat/evdev_relative_axes.h"
|
||||
# include "xlat/evdev_snd.h"
|
||||
# include "xlat/evdev_switch.h"
|
||||
# include "xlat/evdev_sync.h"
|
||||
|
||||
# ifndef SYN_MAX
|
||||
# define SYN_MAX 0xf
|
||||
@ -171,10 +151,10 @@ decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg,
|
||||
tprints(", ");
|
||||
|
||||
unsigned int size;
|
||||
if ((kernel_ulong_t) tcp->u_rval > max_nr)
|
||||
if ((kernel_ulong_t) tcp->u_rval > max_nr / 8)
|
||||
size = max_nr;
|
||||
else
|
||||
size = tcp->u_rval;
|
||||
size = tcp->u_rval * 8;
|
||||
char decoded_arg[size];
|
||||
|
||||
if (umove_or_printaddr(tcp, arg, &decoded_arg))
|
||||
@ -206,9 +186,9 @@ decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg,
|
||||
return RVAL_IOCTL_DECODED;
|
||||
}
|
||||
|
||||
#define decode_bitset(tcp_, arg_, decode_nr_, max_nr_, dflt_, xt_) \
|
||||
# define decode_bitset(tcp_, arg_, decode_nr_, max_nr_, dflt_, xt_) \
|
||||
decode_bitset_((tcp_), (arg_), (decode_nr_), (max_nr_), \
|
||||
(dflt_), ARRAY_SIZE(decode_nr_), (xt_))
|
||||
(dflt_), ARRAY_SIZE(decode_nr_) - 1, (xt_))
|
||||
|
||||
# ifdef EVIOCGMTSLOTS
|
||||
static int
|
||||
@ -258,9 +238,9 @@ bit_ioctl(struct tcb *const tcp, const unsigned int ev_nr,
|
||||
const kernel_ulong_t arg)
|
||||
{
|
||||
switch (ev_nr) {
|
||||
case EV_SYN:
|
||||
return decode_bitset(tcp, arg, evdev_sync,
|
||||
SYN_MAX, "SYN_???", XT_INDEXED);
|
||||
case 0:
|
||||
return decode_bitset(tcp, arg, evdev_ev,
|
||||
EV_MAX, "EV_???", XT_SORTED);
|
||||
case EV_KEY:
|
||||
return decode_bitset(tcp, arg, evdev_keycode,
|
||||
KEY_MAX, "KEY_???", XT_INDEXED);
|
||||
|
@ -4,34 +4,14 @@
|
||||
* Copyright (c) 2015-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef HAVE_LINUX_INPUT_H
|
||||
|
||||
#include DEF_MPERS_TYPE(struct_ff_effect)
|
||||
# include DEF_MPERS_TYPE(struct_ff_effect)
|
||||
|
||||
# include <linux/ioctl.h>
|
||||
# include <linux/input.h>
|
||||
|
24
eventfd.c
24
eventfd.c
@ -1,29 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Ulrich Drepper <drepper@redhat.com>
|
||||
* Copyright (c) 2008-2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2008-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
24
execve.c
24
execve.c
@ -6,30 +6,10 @@
|
||||
* Copyright (c) 2007 Roland McGrath <roland@redhat.com>
|
||||
* Copyright (c) 2011-2012 Denys Vlasenko <vda.linux@googlemail.com>
|
||||
* Copyright (c) 2010-2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2014-2017 The strace developers.
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
36
f_owner_ex.h
36
f_owner_ex.h
@ -2,40 +2,20 @@
|
||||
* Copyright (c) 2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifndef STRACE_F_OWNER_EX_H
|
||||
#define STRACE_F_OWNER_EX_H
|
||||
# define STRACE_F_OWNER_EX_H
|
||||
|
||||
#include <linux/fcntl.h>
|
||||
# include <linux/fcntl.h>
|
||||
|
||||
#if defined HAVE_STRUCT_F_OWNER_EX
|
||||
# if defined HAVE_STRUCT_F_OWNER_EX
|
||||
typedef struct f_owner_ex struct_kernel_f_owner_ex;
|
||||
#elif defined HAVE_STRUCT___KERNEL_F_OWNER_EX
|
||||
# elif defined HAVE_STRUCT___KERNEL_F_OWNER_EX
|
||||
typedef struct __kernel_f_owner_ex struct_kernel_f_owner_ex;
|
||||
#else
|
||||
# error struct f_owner_ex definition not found in <linux/fcntl.h>
|
||||
#endif
|
||||
# else
|
||||
# error struct f_owner_ex definition not found in <linux/fcntl.h>
|
||||
# endif
|
||||
|
||||
#endif /* !STRACE_F_OWNER_EX_H */
|
||||
|
24
fadvise.c
24
fadvise.c
@ -5,30 +5,10 @@
|
||||
* Copyright (c) 2009 Andreas Schwab <schwab@redhat.com>
|
||||
* Copyright (c) 2009 Kirill A. Shutemov <kirill@shutemov.name>
|
||||
* Copyright (c) 2011-2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2014-2017 The strace developers.
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef HAVE_LINUX_FALLOC_H
|
||||
|
24
fanotify.c
24
fanotify.c
@ -1,29 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2014-2017 The strace developers.
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
SYS_FUNC(fchownat)
|
||||
|
26
fcntl.c
26
fcntl.c
@ -3,30 +3,10 @@
|
||||
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
|
||||
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
|
||||
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
|
||||
* Copyright (c) 1999-2017 The strace developers.
|
||||
* Copyright (c) 1999-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
@ -134,7 +114,7 @@ print_fcntl(struct tcb *tcp)
|
||||
break;
|
||||
case F_SETSIG:
|
||||
tprints(", ");
|
||||
tprints(signame(tcp->u_arg[2]));
|
||||
printsignal(tcp->u_arg[2]);
|
||||
break;
|
||||
case F_GETOWN:
|
||||
case F_GETPIPE_SZ:
|
||||
|
@ -1,28 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -2,27 +2,7 @@
|
||||
* Copyright (c) 2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -1,29 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2015-2017 The strace developers.
|
||||
* Copyright (c) 2015-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018 Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include DEF_MPERS_TYPE(struct_keyctl_kdf_params)
|
||||
|
@ -1,28 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -1,28 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -1,29 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2016-2017 The strace developers.
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -1,29 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2016-2017 The strace developers.
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -1,29 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2016-2017 The strace developers.
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
42
fetch_struct_xfs_quotastat.c
Normal file
42
fetch_struct_xfs_quotastat.c
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include DEF_MPERS_TYPE(struct_xfs_dqstats)
|
||||
|
||||
#include "xfs_quota_stat.h"
|
||||
typedef struct xfs_dqstats struct_xfs_dqstats;
|
||||
|
||||
#include MPERS_DEFS
|
||||
|
||||
MPERS_PRINTER_DECL(bool, fetch_struct_quotastat, struct tcb *const tcp,
|
||||
const kernel_ulong_t data, void *p)
|
||||
{
|
||||
struct xfs_dqstats *dq = p;
|
||||
struct_xfs_dqstats dqstat;
|
||||
|
||||
if (umove_or_printaddr(tcp, data, &dqstat))
|
||||
return false;
|
||||
|
||||
dq->qs_version = dqstat.qs_version;
|
||||
dq->qs_flags = dqstat.qs_flags;
|
||||
dq->qs_pad = dqstat.qs_pad;
|
||||
dq->qs_uquota.qfs_ino = dqstat.qs_uquota.qfs_ino;
|
||||
dq->qs_uquota.qfs_nblks = dqstat.qs_uquota.qfs_nblks;
|
||||
dq->qs_uquota.qfs_nextents = dqstat.qs_uquota.qfs_nextents;
|
||||
dq->qs_gquota.qfs_ino = dqstat.qs_gquota.qfs_ino;
|
||||
dq->qs_gquota.qfs_nblks = dqstat.qs_gquota.qfs_nblks;
|
||||
dq->qs_gquota.qfs_nextents = dqstat.qs_gquota.qfs_nextents;
|
||||
dq->qs_incoredqs = dqstat.qs_incoredqs;
|
||||
dq->qs_btimelimit = dqstat.qs_btimelimit;
|
||||
dq->qs_itimelimit = dqstat.qs_itimelimit;
|
||||
dq->qs_rtbtimelimit = dqstat.qs_rtbtimelimit;
|
||||
dq->qs_bwarnlimit = dqstat.qs_bwarnlimit;
|
||||
dq->qs_iwarnlimit = dqstat.qs_iwarnlimit;
|
||||
return true;
|
||||
}
|
@ -1,4 +1,9 @@
|
||||
#! /bin/sh
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2017-2018 The strace developers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
if [ "$1" = "-f" ]; then
|
||||
shift
|
||||
@ -22,7 +27,7 @@ date=
|
||||
[ -f "${DATE_FILE}" ] && date="$(cat "${DATE_FILE}")"
|
||||
|
||||
[ -n "${date}" ] ||
|
||||
date="$(git log -n 1 --format=format:%cD --no-patch "${FILE}")"
|
||||
date="$(git log -s -n 1 --format=format:%cD "${FILE}")"
|
||||
|
||||
[ -n "${date}" ] ||
|
||||
date="${DEFAULT_DATE}"
|
||||
|
@ -1,29 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2015-2017 The strace developers.
|
||||
* Copyright (c) 2015-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
24
file_ioctl.c
24
file_ioctl.c
@ -1,29 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Jeff Mahoney <jeffm@suse.com>
|
||||
* Copyright (c) 2016-2017 The strace developers.
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
122
filter.c
122
filter.c
@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "filter.h"
|
||||
|
||||
#define FILTER_TYPE(name) \
|
||||
{#name, parse_ ## name ## _filter, run_ ## name ## _filter, \
|
||||
free_ ## name ## _filter}
|
||||
/* End of FILTER_TYPE definition. */
|
||||
|
||||
static const struct filter_type {
|
||||
const char *name;
|
||||
void *(*parse_filter)(const char *, bool);
|
||||
bool (*run_filter)(struct tcb *, void *);
|
||||
void (*free_priv_data)(void *);
|
||||
} filter_types[] = {
|
||||
FILTER_TYPE(syscall),
|
||||
FILTER_TYPE(fd),
|
||||
FILTER_TYPE(path),
|
||||
};
|
||||
#undef FILTER_TYPE
|
||||
|
||||
struct filter {
|
||||
const struct filter_type *type;
|
||||
void *priv_data;
|
||||
};
|
||||
|
||||
static const struct filter_type *
|
||||
lookup_filter_type(const char *str)
|
||||
{
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(filter_types); i++) {
|
||||
if (!strcmp(filter_types[i].name, str))
|
||||
return &filter_types[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct filter *
|
||||
add_filter_to_array(struct filter **filters, unsigned int *nfilters,
|
||||
const char *name)
|
||||
{
|
||||
const struct filter_type *type = lookup_filter_type(name);
|
||||
struct filter *filter;
|
||||
|
||||
if (!type)
|
||||
error_msg_and_die("invalid filter '%s'", name);
|
||||
*filters = xreallocarray(*filters, ++(*nfilters),
|
||||
sizeof(struct filter));
|
||||
filter = &((*filters)[*nfilters - 1]);
|
||||
filter->type = type;
|
||||
return filter;
|
||||
}
|
||||
|
||||
void
|
||||
parse_filter(struct filter *filter, const char *str, bool qualify_mode)
|
||||
{
|
||||
filter->priv_data = filter->type->parse_filter(str, qualify_mode);
|
||||
}
|
||||
|
||||
static bool
|
||||
run_filter(struct tcb *tcp, struct filter *filter)
|
||||
{
|
||||
return filter->type->run_filter(tcp, filter->priv_data);
|
||||
}
|
||||
|
||||
void
|
||||
run_filters(struct tcb *tcp, struct filter *filters, unsigned int nfilters,
|
||||
bool *variables_buf)
|
||||
{
|
||||
for (unsigned int i = 0; i < nfilters; ++i)
|
||||
variables_buf[i] = run_filter(tcp, &filters[i]);
|
||||
}
|
||||
|
||||
void
|
||||
free_filter(struct filter *filter)
|
||||
{
|
||||
if (!filter)
|
||||
return;
|
||||
filter->type->free_priv_data(filter->priv_data);
|
||||
}
|
||||
|
||||
void
|
||||
set_filters_qualify_mode(struct filter **filters, unsigned int *nfilters)
|
||||
{
|
||||
for (unsigned int i = 0; i < *nfilters - 1; ++i)
|
||||
free_filter(*filters + i);
|
||||
(*filters)[0] = (*filters)[*nfilters - 1];
|
||||
*filters = xreallocarray(*filters, 1, sizeof(struct filter));
|
||||
*nfilters = 1;
|
||||
}
|
||||
|
||||
void
|
||||
set_filter_priv_data(struct filter *filter, void *priv_data)
|
||||
{
|
||||
if (filter)
|
||||
filter->priv_data = priv_data;
|
||||
}
|
110
filter.h
110
filter.h
@ -3,119 +3,17 @@
|
||||
* Copyright (c) 2017-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifndef STRACE_FILTER_H
|
||||
#define STRACE_FILTER_H
|
||||
# define STRACE_FILTER_H
|
||||
|
||||
struct number_set;
|
||||
|
||||
struct filter;
|
||||
|
||||
struct filter_action;
|
||||
|
||||
struct bool_expression;
|
||||
|
||||
typedef int (*string_to_uint_func)(const char *);
|
||||
|
||||
void qualify_tokens(const char *str, struct number_set *set,
|
||||
string_to_uint_func func, const char *name,
|
||||
bool qualify_mode);
|
||||
void qualify_syscall_tokens(const char *str, struct number_set *set,
|
||||
bool qualify_mode);
|
||||
void parse_inject_common_args(char *, struct inject_opts *,
|
||||
const bool fault_tokens_only, bool qualify_mode);
|
||||
bool is_traced(struct tcb *);
|
||||
bool not_injected(struct tcb *);
|
||||
|
||||
typedef bool (*match_fd_func)(struct tcb *, int, void *);
|
||||
int match_fd_common(struct tcb *, match_fd_func, void *);
|
||||
|
||||
/* filter api */
|
||||
struct filter* add_filter_to_array(struct filter **, unsigned int *nfilters,
|
||||
const char *name);
|
||||
void parse_filter(struct filter *, const char *str, bool qualify_mode);
|
||||
void run_filters(struct tcb *, struct filter *, unsigned int, bool *);
|
||||
void free_filter(struct filter *);
|
||||
void set_filters_qualify_mode(struct filter **, unsigned int *nfilters);
|
||||
void set_filter_priv_data(struct filter *, void *);
|
||||
|
||||
/* filter action api */
|
||||
struct filter *create_filter(struct filter_action *, const char *name);
|
||||
struct filter_action *find_or_add_action(const char *);
|
||||
void set_qualify_mode(struct filter_action *);
|
||||
void parse_filter_action(const char *, const char *, const char *);
|
||||
void set_filter_action_priv_data(struct filter_action *, void *);
|
||||
|
||||
/* filter expression api */
|
||||
struct bool_expression *create_expression();
|
||||
bool run_expression(struct bool_expression *, bool *, unsigned int);
|
||||
void set_expression_qualify_mode(struct bool_expression *);
|
||||
void expression_add_filter_and(struct bool_expression *, unsigned int);
|
||||
void parse_filter_expression(struct bool_expression *, const char *,
|
||||
struct filter_action *, unsigned int);
|
||||
|
||||
void parse_qualify_action(const char *, const char *, const char *);
|
||||
|
||||
#define DECL_FILTER(name) \
|
||||
extern void * \
|
||||
parse_ ## name ## _filter(const char *, bool); \
|
||||
extern bool \
|
||||
run_ ## name ## _filter(struct tcb *, void *); \
|
||||
extern void \
|
||||
free_ ## name ## _filter(void *) \
|
||||
/* End of DECL_FILTER definition. */
|
||||
|
||||
DECL_FILTER(syscall);
|
||||
DECL_FILTER(fd);
|
||||
DECL_FILTER(path);
|
||||
#undef DECL_FILTER
|
||||
|
||||
#define DECL_FILTER_ACTION(name) \
|
||||
extern void \
|
||||
apply_ ## name(struct tcb *, void *) \
|
||||
/* End of DECL_FILTER_ACTION definition. */
|
||||
|
||||
DECL_FILTER_ACTION(trace);
|
||||
DECL_FILTER_ACTION(raw);
|
||||
DECL_FILTER_ACTION(abbrev);
|
||||
DECL_FILTER_ACTION(verbose);
|
||||
DECL_FILTER_ACTION(inject);
|
||||
DECL_FILTER_ACTION(fault);
|
||||
DECL_FILTER_ACTION(read);
|
||||
DECL_FILTER_ACTION(write);
|
||||
DECL_FILTER_ACTION(stacktrace);
|
||||
#undef DECL_FILTER_ACTION
|
||||
|
||||
#define DECL_FILTER_ACTION_PARSER(name) \
|
||||
extern void * \
|
||||
parse_ ## name(const char *); \
|
||||
/* End of DECL_FILTER_ACTION_PARSER definition. */
|
||||
|
||||
#define parse_NULL NULL
|
||||
DECL_FILTER_ACTION_PARSER(inject);
|
||||
DECL_FILTER_ACTION_PARSER(fault);
|
||||
#undef DECL_FILTER_ACTION_PARSER
|
||||
string_to_uint_func func, const char *name);
|
||||
void qualify_syscall_tokens(const char *str, struct number_set *set);
|
||||
|
||||
#endif /* !STRACE_FILTER_H */
|
||||
|
234
filter_action.c
234
filter_action.c
@ -1,234 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "filter.h"
|
||||
|
||||
#define FILTER_ACTION_TYPE(NAME, PRIORITY, FLAG, PARSER, PREFILTER) \
|
||||
{#NAME, PRIORITY, FLAG, parse_ ## PARSER, PREFILTER, apply_ ## NAME}
|
||||
/* End of FILTER_ACTION_TYPE definition. */
|
||||
|
||||
static const struct filter_action_type {
|
||||
const char *name;
|
||||
/* The highest priority is 0. */
|
||||
unsigned int priority;
|
||||
unsigned int qual_flg;
|
||||
void * (*parse_args)(const char *);
|
||||
bool (*prefilter)(struct tcb *);
|
||||
void (*apply)(struct tcb *, void *);
|
||||
} action_types[] = {
|
||||
FILTER_ACTION_TYPE(trace, 0, QUAL_TRACE, NULL, NULL),
|
||||
FILTER_ACTION_TYPE(inject, 1, QUAL_INJECT, inject, not_injected),
|
||||
FILTER_ACTION_TYPE(fault, 1, QUAL_INJECT, fault, not_injected),
|
||||
FILTER_ACTION_TYPE(raw, 2, QUAL_RAW, NULL, is_traced),
|
||||
FILTER_ACTION_TYPE(abbrev, 2, QUAL_ABBREV, NULL, is_traced),
|
||||
FILTER_ACTION_TYPE(verbose, 2, QUAL_VERBOSE, NULL, is_traced),
|
||||
FILTER_ACTION_TYPE(read, 2, QUAL_READ, NULL, is_traced),
|
||||
FILTER_ACTION_TYPE(write, 2, QUAL_WRITE, NULL, is_traced),
|
||||
# ifdef ENABLE_STACKTRACE
|
||||
FILTER_ACTION_TYPE(stacktrace, 2, QUAL_STACKTRACE, NULL, is_traced),
|
||||
# endif
|
||||
};
|
||||
#undef FILTER_ACTION_TYPE
|
||||
|
||||
struct filter_action {
|
||||
/* Used to correct order of actions with the same priority. */
|
||||
unsigned int id;
|
||||
const struct filter_action_type *type;
|
||||
struct bool_expression *expr;
|
||||
unsigned int nfilters;
|
||||
struct filter *filters;
|
||||
void *priv_data;
|
||||
};
|
||||
|
||||
static unsigned int default_flags = DEFAULT_QUAL_FLAGS;
|
||||
static struct filter_action *filter_actions;
|
||||
static unsigned int nfilter_actions;
|
||||
|
||||
static bool *variables_buf;
|
||||
|
||||
/*
|
||||
* Compares action priorities. If actions have the same priority,
|
||||
* uses LIFO order.
|
||||
*/
|
||||
static int
|
||||
compare_action_priority(const void *a, const void *b)
|
||||
{
|
||||
const struct filter_action *action_a = a;
|
||||
const struct filter_action *action_b = b;
|
||||
unsigned int priority_a = action_a->type->priority;
|
||||
unsigned int priority_b = action_b->type->priority;
|
||||
|
||||
if (priority_a != priority_b) {
|
||||
return (priority_a < priority_b) ? -1 : 1;
|
||||
} else {
|
||||
return (action_a->id > action_b->id) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
inject_path_tracing(void)
|
||||
{
|
||||
struct filter_action *action = find_or_add_action("trace");
|
||||
struct filter *path_filter;
|
||||
|
||||
if (!action->nfilters)
|
||||
filtering_parse("trace=all");
|
||||
path_filter = add_filter_to_array(&action->filters, &action->nfilters,
|
||||
"path");
|
||||
set_filter_priv_data(path_filter, &global_path_set);
|
||||
expression_add_filter_and(action->expr, action->nfilters - 1);
|
||||
}
|
||||
|
||||
void
|
||||
filtering_parsing_finish(void)
|
||||
{
|
||||
unsigned int maxfilters = 0;
|
||||
|
||||
/* Inject path filter into trace action. */
|
||||
if (tracing_paths)
|
||||
inject_path_tracing();
|
||||
|
||||
/* Sort actions by priority */
|
||||
if (nfilter_actions == 0)
|
||||
return;
|
||||
qsort(filter_actions, nfilter_actions, sizeof(struct filter_action),
|
||||
&compare_action_priority);
|
||||
|
||||
/* Allocate variables_buf sufficient for any action */
|
||||
for (unsigned int i = 0; i < nfilter_actions; ++i) {
|
||||
if (filter_actions[i].nfilters > maxfilters)
|
||||
maxfilters = filter_actions[i].nfilters;
|
||||
}
|
||||
variables_buf = xcalloc(maxfilters, sizeof(bool));
|
||||
}
|
||||
|
||||
static const struct filter_action_type *
|
||||
lookup_filter_action_type(const char *str)
|
||||
{
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(action_types); ++i) {
|
||||
if (!strcmp(action_types[i].name, str))
|
||||
return &action_types[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct filter_action *
|
||||
add_action(const struct filter_action_type *type)
|
||||
{
|
||||
struct filter_action *action;
|
||||
|
||||
/* Update default_flags */
|
||||
if (default_flags & type->qual_flg)
|
||||
default_flags &= ~type->qual_flg;
|
||||
|
||||
/* Enable stack tracing. */
|
||||
#ifdef ENABLE_STACKTRACE
|
||||
if (type->qual_flg & QUAL_STACKTRACE)
|
||||
stack_trace_enabled = true;
|
||||
#endif
|
||||
|
||||
filter_actions = xreallocarray(filter_actions, ++nfilter_actions,
|
||||
sizeof(struct filter_action));
|
||||
action = &filter_actions[nfilter_actions - 1];
|
||||
memset(action, 0, sizeof(*action));
|
||||
action->id = nfilter_actions - 1;
|
||||
action->type = type;
|
||||
action->expr = create_expression();
|
||||
return action;
|
||||
}
|
||||
|
||||
struct filter_action *
|
||||
find_or_add_action(const char *name)
|
||||
{
|
||||
const struct filter_action_type *type = lookup_filter_action_type(name);
|
||||
|
||||
if (!type)
|
||||
error_msg_and_die("invalid filter action '%s'", name);
|
||||
/* If action takes arguments, add new action */
|
||||
if (type->parse_args)
|
||||
return add_action(type);
|
||||
|
||||
for (unsigned int i = 0; i < nfilter_actions; ++i) {
|
||||
if (filter_actions[i].type == type)
|
||||
return &filter_actions[i];
|
||||
}
|
||||
return add_action(type);
|
||||
}
|
||||
|
||||
void
|
||||
parse_filter_action(const char *action_name, const char *expr, const char *args)
|
||||
{
|
||||
struct filter_action *action = find_or_add_action(action_name);
|
||||
|
||||
parse_filter_expression(action->expr, expr, action, action->nfilters);
|
||||
if (args && !action->type->parse_args)
|
||||
error_msg("%s action takes no arguments, ignored arguments "
|
||||
"'%s'", action->type->name, args);
|
||||
action->priv_data = action->type->parse_args
|
||||
? action->type->parse_args(args) : NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
run_filter_action(struct tcb *tcp, struct filter_action *action)
|
||||
{
|
||||
if (action->type->prefilter && !action->type->prefilter(tcp))
|
||||
return;
|
||||
run_filters(tcp, action->filters, action->nfilters, variables_buf);
|
||||
if (run_expression(action->expr, variables_buf, action->nfilters))
|
||||
action->type->apply(tcp, action->priv_data);
|
||||
}
|
||||
|
||||
struct filter *
|
||||
create_filter(struct filter_action *action, const char *name)
|
||||
{
|
||||
return add_filter_to_array(&action->filters, &action->nfilters, name);
|
||||
}
|
||||
|
||||
void
|
||||
set_qualify_mode(struct filter_action *action)
|
||||
{
|
||||
set_filters_qualify_mode(&action->filters, &action->nfilters);
|
||||
set_expression_qualify_mode(action->expr);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
filter_syscall(struct tcb *tcp)
|
||||
{
|
||||
tcp->qual_flg |= default_flags;
|
||||
for (unsigned int i = 0; i < nfilter_actions; ++i)
|
||||
run_filter_action(tcp, &filter_actions[i]);
|
||||
}
|
||||
|
||||
void
|
||||
set_filter_action_priv_data(struct filter_action *action, void *priv_data)
|
||||
{
|
||||
if (action)
|
||||
action->priv_data = priv_data;
|
||||
}
|
@ -1,458 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include <stdarg.h>
|
||||
#include "filter.h"
|
||||
|
||||
extern bool is_space_ascii(char);
|
||||
extern bool is_allowed_in_name(char);
|
||||
|
||||
struct expression_token {
|
||||
enum token_type {
|
||||
TOK_VARIABLE,
|
||||
TOK_OPERATOR
|
||||
} type;
|
||||
union token_data {
|
||||
unsigned int variable_id;
|
||||
enum operator_type {
|
||||
OP_NOT,
|
||||
OP_AND,
|
||||
OP_OR
|
||||
} operator_id;
|
||||
} data;
|
||||
};
|
||||
|
||||
/* Pseudo-operator used for parsing */
|
||||
#define OP_PARENTHESIS 3
|
||||
|
||||
struct bool_expression {
|
||||
unsigned int ntokens;
|
||||
struct expression_token *tokens;
|
||||
};
|
||||
|
||||
struct bool_expression *
|
||||
create_expression(void)
|
||||
{
|
||||
return xcalloc(1, sizeof(struct bool_expression));
|
||||
}
|
||||
|
||||
static void
|
||||
reallocate_expression(struct bool_expression *const expr,
|
||||
const unsigned int new_ntokens)
|
||||
{
|
||||
if (!expr)
|
||||
error_msg_and_die("invalid expression");
|
||||
expr->tokens = xreallocarray(expr->tokens, new_ntokens,
|
||||
sizeof(*expr->tokens));
|
||||
if (new_ntokens > expr->ntokens)
|
||||
memset(expr->tokens + expr->ntokens, 0,
|
||||
sizeof(*expr->tokens) * (new_ntokens - expr->ntokens));
|
||||
expr->ntokens = new_ntokens;
|
||||
}
|
||||
|
||||
static void
|
||||
add_variable_token(struct bool_expression *expr, unsigned int id)
|
||||
{
|
||||
struct expression_token token;
|
||||
token.type = TOK_VARIABLE;
|
||||
token.data.variable_id = id;
|
||||
reallocate_expression(expr, expr->ntokens + 1);
|
||||
expr->tokens[expr->ntokens - 1] = token;
|
||||
}
|
||||
|
||||
static void
|
||||
add_operator_token(struct bool_expression *expr, int op) {
|
||||
struct expression_token token;
|
||||
token.type = TOK_OPERATOR;
|
||||
token.data.operator_id = op;
|
||||
reallocate_expression(expr, expr->ntokens + 1);
|
||||
expr->tokens[expr->ntokens - 1] = token;
|
||||
}
|
||||
|
||||
void
|
||||
expression_add_filter_and(struct bool_expression *expr, unsigned int filter_id)
|
||||
{
|
||||
add_variable_token(expr, filter_id);
|
||||
add_operator_token(expr, OP_AND);
|
||||
}
|
||||
|
||||
void
|
||||
set_expression_qualify_mode(struct bool_expression *expr)
|
||||
{
|
||||
if (!expr)
|
||||
error_msg_and_die("invalid expression");
|
||||
reallocate_expression(expr, 1);
|
||||
expr->tokens[0].type = TOK_VARIABLE;
|
||||
expr->tokens[0].data.variable_id = 0;
|
||||
}
|
||||
|
||||
ATTRIBUTE_FORMAT((printf, 3, 4))
|
||||
static int
|
||||
printf_append(char **ptr, char *end, const char *fmt, ...)
|
||||
{
|
||||
int ret;
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
ret = vsnprintf(*ptr, end - *ptr, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
*ptr += MIN(ret, end - *ptr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Print full diagnostics for corrupted expression */
|
||||
ATTRIBUTE_NORETURN
|
||||
static void
|
||||
handle_corrupted_expression(struct bool_expression *expr, bool *stack,
|
||||
unsigned int stack_size, unsigned int current_pos,
|
||||
bool *variables, unsigned int variables_num)
|
||||
{
|
||||
char *buf, *pos, *end;
|
||||
unsigned int buf_size;
|
||||
unsigned int i;
|
||||
|
||||
/* Calculate buffer size. */
|
||||
buf_size = sizeof("corrupted filter expression:");
|
||||
buf_size += sizeof("expression (ntokens = ):")
|
||||
+ 3 * sizeof(unsigned int)
|
||||
+ (sizeof("op_") + 3 * sizeof(int)) * expr->ntokens;
|
||||
buf_size += sizeof("variables (nvariables = ):") + 3 * sizeof(int)
|
||||
+ sizeof("false") * variables_num;
|
||||
buf_size += sizeof("current position: ") + 3 * sizeof(int);
|
||||
buf_size += sizeof("stack (stack_size = ):") + 3 * sizeof(int)
|
||||
+ sizeof("false") * stack_size;
|
||||
|
||||
buf = xcalloc(buf_size, 1);
|
||||
pos = buf;
|
||||
end = buf + buf_size;
|
||||
|
||||
printf_append(&pos, end, "corrupted filter expression:\n");
|
||||
|
||||
/* Print expression. */
|
||||
printf_append(&pos, end, "expression (ntokens = %u):", expr->ntokens);
|
||||
for (i = 0; i < expr->ntokens; ++i) {
|
||||
switch (expr->tokens[i].type) {
|
||||
case TOK_VARIABLE:
|
||||
printf_append(&pos, end, " v_%u",
|
||||
expr->tokens[i].data.variable_id);
|
||||
break;
|
||||
case TOK_OPERATOR:
|
||||
switch (expr->tokens[i].data.operator_id) {
|
||||
case OP_NOT:
|
||||
printf_append(&pos, end, " not");
|
||||
break;
|
||||
case OP_AND:
|
||||
printf_append(&pos, end, " and");
|
||||
break;
|
||||
case OP_OR:
|
||||
printf_append(&pos, end, " or");
|
||||
break;
|
||||
default:
|
||||
printf_append(&pos, end, " op_%d",
|
||||
expr->tokens[i].data.operator_id);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf_append(&pos, end, " ?_%d", expr->tokens[i].type);
|
||||
}
|
||||
}
|
||||
printf_append(&pos, end, "\n");
|
||||
|
||||
/* Print variables. */
|
||||
printf_append(&pos, end, "variables (nvariables = %u):", variables_num);
|
||||
for (i = 0; i < variables_num; ++i)
|
||||
printf_append(&pos, end, !variables[i] ? " false" : " true");
|
||||
printf_append(&pos, end, "\n");
|
||||
|
||||
printf_append(&pos, end, "current position: %u\n", current_pos);
|
||||
|
||||
/* Print current stack state. */
|
||||
printf_append(&pos, end, "stack (stack_size = %u):", stack_size);
|
||||
for (i = 0; i < stack_size; ++i)
|
||||
printf_append(&pos, end, !stack[i] ? " false" : " true");
|
||||
|
||||
error_msg_and_die("%s", buf);
|
||||
}
|
||||
|
||||
#define MAX_STACK_SIZE 32
|
||||
|
||||
bool
|
||||
run_expression(struct bool_expression *expr, bool *variables,
|
||||
unsigned int variables_num)
|
||||
{
|
||||
bool stack[MAX_STACK_SIZE];
|
||||
unsigned int stack_size = 0;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < expr->ntokens; ++i) {
|
||||
struct expression_token *tok = &expr->tokens[i];
|
||||
|
||||
switch (tok->type) {
|
||||
case TOK_VARIABLE:
|
||||
if (stack_size == MAX_STACK_SIZE)
|
||||
handle_corrupted_expression(expr, stack,
|
||||
stack_size, i,
|
||||
variables,
|
||||
variables_num);
|
||||
|
||||
if (tok->data.variable_id >= variables_num)
|
||||
handle_corrupted_expression(expr, stack,
|
||||
stack_size, i,
|
||||
variables,
|
||||
variables_num);
|
||||
stack[stack_size++] = variables[tok->data.variable_id];
|
||||
break;
|
||||
case TOK_OPERATOR:
|
||||
switch (tok->data.operator_id) {
|
||||
case OP_NOT:
|
||||
if (stack_size == 0)
|
||||
handle_corrupted_expression(expr, stack,
|
||||
stack_size, i,
|
||||
variables,
|
||||
variables_num);
|
||||
stack[stack_size - 1] = !stack[stack_size - 1];
|
||||
break;
|
||||
case OP_AND:
|
||||
if (stack_size < 2)
|
||||
handle_corrupted_expression(expr, stack,
|
||||
stack_size, i,
|
||||
variables,
|
||||
variables_num);
|
||||
stack[stack_size - 2] = stack[stack_size - 2]
|
||||
&& stack[stack_size - 1];
|
||||
--stack_size;
|
||||
break;
|
||||
case OP_OR:
|
||||
if (stack_size < 2)
|
||||
handle_corrupted_expression(expr, stack,
|
||||
stack_size, i,
|
||||
variables,
|
||||
variables_num);
|
||||
stack[stack_size - 2] = stack[stack_size - 2]
|
||||
|| stack[stack_size - 1];
|
||||
--stack_size;
|
||||
break;
|
||||
default:
|
||||
handle_corrupted_expression(expr, stack,
|
||||
stack_size, i,
|
||||
variables,
|
||||
variables_num);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (stack_size != 1)
|
||||
handle_corrupted_expression(expr, stack, stack_size, i,
|
||||
variables, variables_num);
|
||||
return stack[0];
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse operator and add operator length to str and pos.
|
||||
* Return -1 if no operator found.
|
||||
*/
|
||||
static int
|
||||
parse_operator(char **str, unsigned int *pos)
|
||||
{
|
||||
#define _OP(s, op) { s, sizeof(s) - 1, op }
|
||||
struct {
|
||||
const char *str;
|
||||
int len;
|
||||
enum operator_type op;
|
||||
} ops[] = {
|
||||
_OP("!", OP_NOT),
|
||||
_OP("not", OP_NOT),
|
||||
_OP("&&", OP_AND),
|
||||
_OP("and", OP_AND),
|
||||
_OP("||", OP_OR),
|
||||
_OP("or", OP_OR),
|
||||
};
|
||||
#undef _OP
|
||||
char *p = *str;
|
||||
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(ops); i++) {
|
||||
if (!strncmp(p, ops[i].str, ops[i].len) &&
|
||||
(!is_allowed_in_name(ops[i].str[0]) ||
|
||||
!is_allowed_in_name(p[ops[i].len]))) {
|
||||
*str += ops[i].len - 1;
|
||||
*pos += ops[i].len - 1;
|
||||
return ops[i].op;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static char *
|
||||
unescape_argument(char **str)
|
||||
{
|
||||
char *p;
|
||||
char *p_new;
|
||||
bool escaped = false;
|
||||
unsigned int size = 1;
|
||||
char *new_str = xcalloc(strlen(*str) + 1, 1);
|
||||
|
||||
for (p = *str, p_new = new_str; *p; ++p) {
|
||||
if (!escaped) {
|
||||
if (*p == '\\') {
|
||||
escaped = true;
|
||||
continue;
|
||||
} else if (is_space_ascii(*p) || *p == ')' || *p == '|'
|
||||
|| *p == '&') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
escaped = false;
|
||||
*(p_new++) = *p;
|
||||
size++;
|
||||
}
|
||||
*str = p - 1;
|
||||
return xreallocarray(new_str, size, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
push_operator(int *stack, unsigned int *stack_size, int op)
|
||||
{
|
||||
if (*stack_size == MAX_STACK_SIZE)
|
||||
error_msg_and_die("stack overflow (expression is too complex)");
|
||||
stack[*stack_size] = op;
|
||||
(*stack_size)++;
|
||||
}
|
||||
|
||||
static bool
|
||||
is_higher_priority(int op_a, int op_b)
|
||||
{
|
||||
bool op_priority[] = {
|
||||
[OP_NOT] = 2,
|
||||
[OP_AND] = 1,
|
||||
[OP_OR] = 0,
|
||||
};
|
||||
return op_priority[op_a] > op_priority[op_b];
|
||||
}
|
||||
|
||||
void
|
||||
parse_filter_expression(struct bool_expression *expr, const char *str,
|
||||
struct filter_action *action, unsigned int start_id)
|
||||
{
|
||||
enum {
|
||||
WAIT_FILTER,
|
||||
FILTER_NAME,
|
||||
FILTER_ARG,
|
||||
WAIT_OPERATOR,
|
||||
} state = WAIT_FILTER;
|
||||
unsigned int variable_id = start_id;
|
||||
/* Current stack stack_size */
|
||||
unsigned int st_size = 0;
|
||||
int stack[MAX_STACK_SIZE];
|
||||
char *copy = xstrdup(str);
|
||||
struct filter *cur_filter = NULL;
|
||||
char *filter_name = NULL;
|
||||
char *filter_arg = NULL;
|
||||
int op;
|
||||
unsigned int pos = 0;
|
||||
|
||||
for (char *p = copy; *p; ++p, ++pos) {
|
||||
switch (state) {
|
||||
case WAIT_FILTER:
|
||||
if (*p == '(') {
|
||||
push_operator(stack, &st_size, OP_PARENTHESIS);
|
||||
} else if ((op = parse_operator(&p, &pos)) >= 0) {
|
||||
if (op == OP_NOT) {
|
||||
push_operator(stack, &st_size, op);
|
||||
} else {
|
||||
error_msg_and_die("invalid operator "
|
||||
"at '%s':%u",
|
||||
str, pos);
|
||||
}
|
||||
} else if (!is_space_ascii(*p)) {
|
||||
filter_name = p;
|
||||
state = FILTER_NAME;
|
||||
}
|
||||
break;
|
||||
|
||||
case FILTER_NAME:
|
||||
if (is_space_ascii(*p)) {
|
||||
*p = '\0';
|
||||
cur_filter = create_filter(action, filter_name);
|
||||
filter_arg = NULL;
|
||||
state = FILTER_ARG;
|
||||
}
|
||||
break;
|
||||
|
||||
case FILTER_ARG:
|
||||
if (!filter_arg && is_space_ascii(*p))
|
||||
break;
|
||||
filter_arg = unescape_argument(&p);
|
||||
parse_filter(cur_filter, filter_arg, false);
|
||||
free(filter_arg);
|
||||
add_variable_token(expr, variable_id++);
|
||||
state = WAIT_OPERATOR;
|
||||
break;
|
||||
|
||||
case WAIT_OPERATOR:
|
||||
if (is_space_ascii(*p))
|
||||
break;
|
||||
if (*p == ')') {
|
||||
while ((st_size > 0) &&
|
||||
(stack[st_size - 1] != OP_PARENTHESIS)) {
|
||||
op = stack[--st_size];
|
||||
add_operator_token(expr, op);
|
||||
}
|
||||
--st_size;
|
||||
break;
|
||||
}
|
||||
op = parse_operator(&p, &pos);
|
||||
if (op < 0 || op == OP_NOT)
|
||||
error_msg_and_die("invalid operator at '%s':%u",
|
||||
str, pos);
|
||||
|
||||
/* Pop operators with higher priority. */
|
||||
while ((st_size > 0) &&
|
||||
(stack[st_size - 1] != OP_PARENTHESIS) &&
|
||||
is_higher_priority(stack[st_size - 1], op))
|
||||
add_operator_token(expr, stack[--st_size]);
|
||||
|
||||
push_operator(stack, &st_size, op);
|
||||
state = WAIT_FILTER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(copy);
|
||||
if (state != WAIT_OPERATOR)
|
||||
error_msg_and_die("unfinished filter expression '%s'", str);
|
||||
|
||||
while (st_size > 0)
|
||||
add_operator_token(expr, stack[--st_size]);
|
||||
if (start_id > 0)
|
||||
add_operator_token(expr, OP_OR);
|
||||
}
|
252
filter_parse.c
252
filter_parse.c
@ -1,252 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "filter.h"
|
||||
|
||||
bool
|
||||
is_space_ascii(char c)
|
||||
{
|
||||
return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') ||
|
||||
(c == '\v') || (c == '\f');
|
||||
}
|
||||
|
||||
bool
|
||||
is_allowed_in_name(char c)
|
||||
{
|
||||
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')
|
||||
|| (c >= '0' && c <= '9') || (c == '_');
|
||||
}
|
||||
|
||||
/*
|
||||
* Split expression into action name, filter expression or qualify set
|
||||
* and action arguments.
|
||||
*/
|
||||
void
|
||||
filtering_parse(const char *str)
|
||||
{
|
||||
enum parsing_states {
|
||||
F_EMPTY,
|
||||
F_BEGIN,
|
||||
F_QUAL_SET,
|
||||
F_FILT_EXPR,
|
||||
F_QUAL_ARGS,
|
||||
F_FILT_ARGS,
|
||||
F_END,
|
||||
} state = F_EMPTY;
|
||||
const char *begin = NULL;
|
||||
const char *action_name = "trace";
|
||||
const char *main_part = NULL;
|
||||
const char *args = NULL;
|
||||
bool action_specified = false;
|
||||
bool escaped = false;
|
||||
int parentheses_count = 0;
|
||||
/* Used to store position of last terminating parenthesis. */
|
||||
char *expression_end = NULL;
|
||||
/* Used to provide diagnostics. */
|
||||
unsigned int pos = 0;
|
||||
char *copy = xstrdup(str);
|
||||
|
||||
for (char *p = copy; *p; ++p, ++pos) {
|
||||
switch (state) {
|
||||
case F_EMPTY:
|
||||
switch (*p) {
|
||||
/* trace(), action name omitted */
|
||||
case '(':
|
||||
parentheses_count++;
|
||||
main_part = p;
|
||||
state = F_FILT_EXPR;
|
||||
break;
|
||||
/* missing action name */
|
||||
case '=':
|
||||
*p = '\0';
|
||||
error_msg_and_die("invalid filter action '%s'",
|
||||
copy);
|
||||
default:
|
||||
if (is_space_ascii(*p)) {
|
||||
break;
|
||||
} else if (!strncmp(p, "not", 3) && *(p + 3) &&
|
||||
(is_space_ascii(*(p + 3)) ||
|
||||
*(p + 3) == '(')) {
|
||||
main_part = p;
|
||||
state = F_FILT_EXPR;
|
||||
break;
|
||||
} else {
|
||||
begin = p;
|
||||
state = F_BEGIN;
|
||||
}
|
||||
}
|
||||
if (state != F_BEGIN)
|
||||
break;
|
||||
/* else fall through to check for qualify set */
|
||||
ATTRIBUTE_FALLTHROUGH;
|
||||
|
||||
case F_BEGIN:
|
||||
switch (*p) {
|
||||
/* action(...) */
|
||||
case '(':
|
||||
if (*begin == '!') {
|
||||
main_part = begin;
|
||||
} else {
|
||||
action_name = begin;
|
||||
action_specified = true;
|
||||
*p = '\0';
|
||||
main_part = p + 1;
|
||||
}
|
||||
state = F_FILT_EXPR;
|
||||
parentheses_count++;
|
||||
break;
|
||||
/* action=... */
|
||||
case '=':
|
||||
action_name = begin;
|
||||
action_specified = true;
|
||||
*p = '\0';
|
||||
main_part = p + 1;
|
||||
state = F_QUAL_SET;
|
||||
break;
|
||||
case ':':
|
||||
main_part = begin;
|
||||
*p = '\0';
|
||||
args = p + 1;
|
||||
state = F_QUAL_ARGS;
|
||||
break;
|
||||
case ';':
|
||||
error_msg_and_die("invalid arguments position "
|
||||
"'%s':%u",
|
||||
str, pos);
|
||||
/* qualify set without action. */
|
||||
case ',':
|
||||
case '?':
|
||||
case '/':
|
||||
case '%':
|
||||
case '-':
|
||||
main_part = begin;
|
||||
state = F_QUAL_SET;
|
||||
break;
|
||||
default:
|
||||
/* new expression without action. */
|
||||
if (is_space_ascii(*p)) {
|
||||
main_part = begin;
|
||||
state = F_FILT_EXPR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case F_QUAL_SET:
|
||||
if (*p == ':') {
|
||||
*p = '\0';
|
||||
args = p + 1;
|
||||
state = F_QUAL_ARGS;
|
||||
}
|
||||
break;
|
||||
|
||||
case F_FILT_EXPR:
|
||||
if (!escaped) {
|
||||
switch (*p) {
|
||||
case ';':
|
||||
if (parentheses_count != 1 ||
|
||||
!action_specified)
|
||||
error_msg_and_die("invalid "
|
||||
"arguments "
|
||||
"position "
|
||||
"'%s':%u",
|
||||
str, pos);
|
||||
*p = '\0';
|
||||
args = p + 1;
|
||||
state = F_FILT_ARGS;
|
||||
break;
|
||||
case '(':
|
||||
parentheses_count++;
|
||||
break;
|
||||
case ')':
|
||||
if (parentheses_count <= 0)
|
||||
error_msg_and_die("unexpected "
|
||||
"')' at "
|
||||
"'%s':%u",
|
||||
str, pos);
|
||||
parentheses_count--;
|
||||
expression_end = p;
|
||||
if (action_specified &&
|
||||
parentheses_count == 0)
|
||||
state = F_END;
|
||||
break;
|
||||
case '\\':
|
||||
escaped = true;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
escaped = false;
|
||||
break;
|
||||
|
||||
case F_QUAL_ARGS:
|
||||
break;
|
||||
case F_FILT_ARGS:
|
||||
if (!escaped) {
|
||||
switch (*p) {
|
||||
case ')':
|
||||
parentheses_count--;
|
||||
expression_end = p;
|
||||
state = F_END;
|
||||
break;
|
||||
case '\\':
|
||||
escaped = true;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
escaped = false;
|
||||
break;
|
||||
case F_END:
|
||||
if (!is_space_ascii(*p))
|
||||
error_msg_and_die("unexpected '%c' at "
|
||||
"'%s':%u", *p, str, pos);
|
||||
}
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case F_EMPTY:
|
||||
main_part = copy;
|
||||
parse_qualify_action(action_name, main_part, args);
|
||||
break;
|
||||
case F_BEGIN:
|
||||
main_part = begin;
|
||||
ATTRIBUTE_FALLTHROUGH;
|
||||
case F_QUAL_SET:
|
||||
case F_QUAL_ARGS:
|
||||
parse_qualify_action(action_name, main_part, args);
|
||||
break;
|
||||
case F_FILT_EXPR:
|
||||
case F_FILT_ARGS:
|
||||
case F_END:
|
||||
if (parentheses_count != 0)
|
||||
error_msg_and_die("missing ')' in '%s'", str);
|
||||
if (action_specified && expression_end)
|
||||
*expression_end = '\0';
|
||||
parse_filter_action(action_name, main_part, args);
|
||||
break;
|
||||
}
|
||||
free(copy);
|
||||
}
|
370
filter_qualify.c
370
filter_qualify.c
@ -3,27 +3,7 @@
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
@ -33,8 +13,21 @@
|
||||
#include "delay.h"
|
||||
#include "retval.h"
|
||||
|
||||
struct number_set *read_set;
|
||||
struct number_set *write_set;
|
||||
struct number_set *signal_set;
|
||||
|
||||
static struct number_set *abbrev_set;
|
||||
static struct number_set *inject_set;
|
||||
static struct number_set *raw_set;
|
||||
static struct number_set *trace_set;
|
||||
static struct number_set *verbose_set;
|
||||
|
||||
/* Only syscall numbers are personality-specific so far. */
|
||||
struct inject_personality_data {
|
||||
uint16_t scno;
|
||||
};
|
||||
|
||||
static int
|
||||
sigstr_to_uint(const char *s)
|
||||
{
|
||||
@ -44,9 +37,12 @@ sigstr_to_uint(const char *s)
|
||||
if (strncasecmp(s, "SIG", 3) == 0)
|
||||
s += 3;
|
||||
|
||||
for (int i = 0; i <= 255; ++i) {
|
||||
for (int i = 1; i <= 255; ++i) {
|
||||
const char *name = signame(i);
|
||||
|
||||
if (!name)
|
||||
continue;
|
||||
|
||||
if (strncasecmp(name, "SIG", 3) != 0)
|
||||
continue;
|
||||
|
||||
@ -94,6 +90,7 @@ parse_delay_token(const char *input, struct inject_opts *fopts, bool isenter)
|
||||
|
||||
static bool
|
||||
parse_inject_token(const char *const token, struct inject_opts *const fopts,
|
||||
struct inject_personality_data *const pdata,
|
||||
const bool fault_tokens_only)
|
||||
{
|
||||
const char *val;
|
||||
@ -129,6 +126,27 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts,
|
||||
/* F == F+0 */
|
||||
fopts->step = 0;
|
||||
}
|
||||
} else if ((val = STR_STRIP_PREFIX(token, "syscall=")) != token) {
|
||||
if (fopts->data.flags & INJECT_F_SYSCALL)
|
||||
return false;
|
||||
|
||||
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
|
||||
kernel_long_t scno = scno_by_name(val, p, 0);
|
||||
|
||||
if (scno < 0)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* We want to inject only pure system calls with no side
|
||||
* effects.
|
||||
*/
|
||||
if (!(sysent_vec[p][scno].sys_flags & TRACE_PURE))
|
||||
return false;
|
||||
|
||||
pdata[p].scno = scno;
|
||||
}
|
||||
|
||||
fopts->data.flags |= INJECT_F_SYSCALL;
|
||||
} else if ((val = STR_STRIP_PREFIX(token, "error=")) != token) {
|
||||
if (fopts->data.flags & (INJECT_F_ERROR | INJECT_F_RETVAL))
|
||||
return false;
|
||||
@ -212,144 +230,186 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts,
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
parse_inject_common_args(char *const str, struct inject_opts *const opts,
|
||||
const bool fault_tokens_only, const bool qualify_mode)
|
||||
static const char *
|
||||
parse_inject_expression(char *const str,
|
||||
struct inject_opts *const fopts,
|
||||
struct inject_personality_data *const pdata,
|
||||
const bool fault_tokens_only)
|
||||
{
|
||||
char *saveptr = NULL;
|
||||
const char *delim = qualify_mode ? ":" : ";";
|
||||
if (str[0] == '\0' || str[0] == ':')
|
||||
return "";
|
||||
|
||||
*opts = (struct inject_opts) {
|
||||
char *saveptr = NULL;
|
||||
const char *name = strtok_r(str, ":", &saveptr);
|
||||
|
||||
char *token;
|
||||
while ((token = strtok_r(NULL, ":", &saveptr))) {
|
||||
if (!parse_inject_token(token, fopts, pdata, fault_tokens_only))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_read(const char *const str)
|
||||
{
|
||||
if (!read_set)
|
||||
read_set = alloc_number_set_array(1);
|
||||
qualify_tokens(str, read_set, string_to_uint, "descriptor");
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_write(const char *const str)
|
||||
{
|
||||
if (!write_set)
|
||||
write_set = alloc_number_set_array(1);
|
||||
qualify_tokens(str, write_set, string_to_uint, "descriptor");
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_signals(const char *const str)
|
||||
{
|
||||
if (!signal_set)
|
||||
signal_set = alloc_number_set_array(1);
|
||||
qualify_tokens(str, signal_set, sigstr_to_uint, "signal");
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_trace(const char *const str)
|
||||
{
|
||||
if (!trace_set)
|
||||
trace_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
|
||||
qualify_syscall_tokens(str, trace_set);
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_abbrev(const char *const str)
|
||||
{
|
||||
if (!abbrev_set)
|
||||
abbrev_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
|
||||
qualify_syscall_tokens(str, abbrev_set);
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_verbose(const char *const str)
|
||||
{
|
||||
if (!verbose_set)
|
||||
verbose_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
|
||||
qualify_syscall_tokens(str, verbose_set);
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_raw(const char *const str)
|
||||
{
|
||||
if (!raw_set)
|
||||
raw_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
|
||||
qualify_syscall_tokens(str, raw_set);
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_inject_common(const char *const str,
|
||||
const bool fault_tokens_only,
|
||||
const char *const description)
|
||||
{
|
||||
struct inject_opts opts = {
|
||||
.first = 1,
|
||||
.step = 1,
|
||||
.data = {
|
||||
.delay_idx = -1
|
||||
}
|
||||
};
|
||||
struct inject_personality_data pdata[SUPPORTED_PERSONALITIES] = { { 0 } };
|
||||
char *copy = xstrdup(str);
|
||||
const char *name =
|
||||
parse_inject_expression(copy, &opts, pdata, fault_tokens_only);
|
||||
if (!name)
|
||||
error_msg_and_die("invalid %s '%s'", description, str);
|
||||
|
||||
for (char *token = str ? strtok_r(str, delim, &saveptr) : NULL;
|
||||
token; token = strtok_r(NULL, delim, &saveptr)) {
|
||||
if (!parse_inject_token(token, opts, fault_tokens_only)) {
|
||||
/* return an error by resetting inject flags */
|
||||
opts->data.flags = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
struct number_set *tmp_set =
|
||||
alloc_number_set_array(SUPPORTED_PERSONALITIES);
|
||||
qualify_syscall_tokens(name, tmp_set);
|
||||
|
||||
/* If neither of retval, error, signal or delay is specified, then ... */
|
||||
if (!opts->data.flags) {
|
||||
if (fault_tokens_only) {
|
||||
/* in fault= syntax the default error code is ENOSYS. */
|
||||
opts->data.rval_idx = retval_new(ENOSYS);
|
||||
opts->data.flags |= INJECT_F_ERROR;
|
||||
} else {
|
||||
/* in inject= syntax this is not allowed. */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_signals(const char *const main_part, const char *const args)
|
||||
{
|
||||
if (!signal_set)
|
||||
signal_set = alloc_number_set_array(1);
|
||||
|
||||
qualify_tokens(main_part, signal_set, sigstr_to_uint, "signal", true);
|
||||
if (args)
|
||||
error_msg("signal action takes no arguments, ignored arguments "
|
||||
"'%s'", args);
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_filter(const char *const main_part, const char *const args,
|
||||
const char *const action_name, const char *const filter_type)
|
||||
{
|
||||
struct filter_action *action = find_or_add_action(action_name);
|
||||
struct filter *filter = create_filter(action, filter_type);
|
||||
|
||||
parse_filter(filter, main_part, true);
|
||||
if (args)
|
||||
error_msg("%s action takes no arguments, ignored arguments "
|
||||
"'%s'", action_name, args);
|
||||
set_qualify_mode(action);
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_read(const char *const main_part, const char *const args)
|
||||
{
|
||||
qualify_filter(main_part, args, "read", "fd");
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_write(const char *const main_part, const char *const args)
|
||||
{
|
||||
qualify_filter(main_part, args, "write", "fd");
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_trace(const char *const main_part, const char *const args)
|
||||
{
|
||||
qualify_filter(main_part, args, "trace", "syscall");
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_abbrev(const char *const main_part, const char *const args)
|
||||
{
|
||||
qualify_filter(main_part, args, "abbrev", "syscall");
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_verbose(const char *const main_part, const char *const args)
|
||||
{
|
||||
qualify_filter(main_part, args, "verbose", "syscall");
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_raw(const char *const main_part, const char *const args)
|
||||
{
|
||||
qualify_filter(main_part, args, "raw", "syscall");
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_inject_common(const char *const main_part, const char *const args,
|
||||
const bool fault_tokens_only,
|
||||
const char *const description)
|
||||
{
|
||||
struct inject_opts *opts = xmalloc(sizeof(struct inject_opts));
|
||||
char *copy = xstrdup(args);
|
||||
struct filter_action *action;
|
||||
struct filter *filter;
|
||||
|
||||
action = find_or_add_action(fault_tokens_only ? "fault" : "inject");
|
||||
filter = create_filter(action, "syscall");
|
||||
parse_filter(filter, main_part, true);
|
||||
set_qualify_mode(action);
|
||||
parse_inject_common_args(copy, opts, fault_tokens_only, true);
|
||||
|
||||
if (!opts->data.flags)
|
||||
error_msg_and_die("invalid %s argument '%s'", description,
|
||||
args ? args : "");
|
||||
free(copy);
|
||||
|
||||
set_filter_action_priv_data(action, opts);
|
||||
/* If neither of retval, error, signal or delay is specified, then ... */
|
||||
if (!(opts.data.flags & INJECT_ACTION_FLAGS)) {
|
||||
if (fault_tokens_only) {
|
||||
/* in fault= syntax the default error code is ENOSYS. */
|
||||
opts.data.rval_idx = retval_new(ENOSYS);
|
||||
opts.data.flags |= INJECT_F_ERROR;
|
||||
} else {
|
||||
/* in inject= syntax this is not allowed. */
|
||||
error_msg_and_die("invalid %s '%s'", description, str);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize inject_vec according to tmp_set.
|
||||
* Merge tmp_set into inject_set.
|
||||
*/
|
||||
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
|
||||
if (number_set_array_is_empty(tmp_set, p))
|
||||
continue;
|
||||
|
||||
if (!inject_set) {
|
||||
inject_set =
|
||||
alloc_number_set_array(SUPPORTED_PERSONALITIES);
|
||||
}
|
||||
if (!inject_vec[p]) {
|
||||
inject_vec[p] = xcalloc(nsyscall_vec[p],
|
||||
sizeof(*inject_vec[p]));
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < nsyscall_vec[p]; ++i) {
|
||||
if (is_number_in_set_array(i, tmp_set, p)) {
|
||||
add_number_to_set_array(i, inject_set, p);
|
||||
inject_vec[p][i] = opts;
|
||||
|
||||
/* Copy per-personality data. */
|
||||
inject_vec[p][i].data.scno =
|
||||
pdata[p].scno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free_number_set_array(tmp_set, SUPPORTED_PERSONALITIES);
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_fault(const char *const main_part, const char *const args)
|
||||
qualify_fault(const char *const str)
|
||||
{
|
||||
qualify_inject_common(main_part, args, true, "fault");
|
||||
qualify_inject_common(str, true, "fault argument");
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_inject(const char *const main_part, const char *const args)
|
||||
qualify_inject(const char *const str)
|
||||
{
|
||||
qualify_inject_common(main_part, args, false, "inject");
|
||||
qualify_inject_common(str, false, "inject argument");
|
||||
}
|
||||
|
||||
static void
|
||||
qualify_kvm(const char *const str)
|
||||
{
|
||||
if (strcmp(str, "vcpu") == 0) {
|
||||
#ifdef HAVE_LINUX_KVM_H
|
||||
if (os_release >= KERNEL_VERSION(4, 16, 0))
|
||||
kvm_run_structure_decoder_init();
|
||||
else
|
||||
error_msg("-e kvm=vcpu option needs"
|
||||
" Linux 4.16.0 or higher");
|
||||
#else
|
||||
error_msg("-e kvm=vcpu option is not implemented"
|
||||
" for this architecture");
|
||||
#endif
|
||||
} else {
|
||||
error_msg_and_die("invalid -e kvm= argument: '%s'", str);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct qual_options {
|
||||
const char *name;
|
||||
void (*qualify)(const char *, const char *);
|
||||
void (*qualify)(const char *);
|
||||
} qual_options[] = {
|
||||
{ "trace", qualify_trace },
|
||||
{ "t", qualify_trace },
|
||||
@ -370,22 +430,40 @@ static const struct qual_options {
|
||||
{ "w", qualify_write },
|
||||
{ "fault", qualify_fault },
|
||||
{ "inject", qualify_inject },
|
||||
{ "kvm", qualify_kvm },
|
||||
};
|
||||
|
||||
void
|
||||
parse_qualify_action(const char *action_name, const char *main_part,
|
||||
const char *args)
|
||||
qualify(const char *str)
|
||||
{
|
||||
const struct qual_options *opt = NULL;
|
||||
const struct qual_options *opt = qual_options;
|
||||
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(qual_options); ++i) {
|
||||
if (!strcmp(action_name, qual_options[i].name)) {
|
||||
opt = &qual_options[i];
|
||||
break;
|
||||
}
|
||||
const char *name = qual_options[i].name;
|
||||
const size_t len = strlen(name);
|
||||
const char *val = str_strip_prefix_len(str, name, len);
|
||||
|
||||
if (val == str || *val != '=')
|
||||
continue;
|
||||
str = val + 1;
|
||||
opt = &qual_options[i];
|
||||
break;
|
||||
}
|
||||
|
||||
if (!opt)
|
||||
error_msg_and_die("invalid filter action '%s'", action_name);
|
||||
opt->qualify(main_part ? main_part : "", args);
|
||||
opt->qualify(str);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
qual_flags(const unsigned int scno)
|
||||
{
|
||||
return (is_number_in_set_array(scno, trace_set, current_personality)
|
||||
? QUAL_TRACE : 0)
|
||||
| (is_number_in_set_array(scno, abbrev_set, current_personality)
|
||||
? QUAL_ABBREV : 0)
|
||||
| (is_number_in_set_array(scno, verbose_set, current_personality)
|
||||
? QUAL_VERBOSE : 0)
|
||||
| (is_number_in_set_array(scno, raw_set, current_personality)
|
||||
? QUAL_RAW : 0)
|
||||
| (is_number_in_set_array(scno, inject_set, current_personality)
|
||||
? QUAL_INJECT : 0);
|
||||
}
|
||||
|
24
flock.c
24
flock.c
@ -3,30 +3,10 @@
|
||||
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
|
||||
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
|
||||
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
|
||||
* Copyright (c) 1999-2017 The strace developers.
|
||||
* Copyright (c) 1999-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
48
flock.h
48
flock.h
@ -1,50 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2015-2017 The strace developers.
|
||||
* Copyright (c) 2015-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifndef STRACE_FLOCK_H
|
||||
#define STRACE_FLOCK_H
|
||||
# define STRACE_FLOCK_H
|
||||
|
||||
#include <linux/fcntl.h>
|
||||
# include <linux/fcntl.h>
|
||||
|
||||
#if defined HAVE_STRUCT_FLOCK
|
||||
# if defined HAVE_STRUCT_FLOCK
|
||||
typedef struct flock struct_kernel_flock;
|
||||
#elif defined HAVE_STRUCT___KERNEL_FLOCK
|
||||
# elif defined HAVE_STRUCT___KERNEL_FLOCK
|
||||
typedef struct __kernel_flock struct_kernel_flock;
|
||||
#else
|
||||
# error struct flock definition not found in <linux/fcntl.h>
|
||||
#endif
|
||||
# else
|
||||
# error struct flock definition not found in <linux/fcntl.h>
|
||||
# endif
|
||||
|
||||
#if defined HAVE_STRUCT_FLOCK64
|
||||
# if defined HAVE_STRUCT_FLOCK64
|
||||
typedef struct flock64 struct_kernel_flock64;
|
||||
#elif defined HAVE_STRUCT___KERNEL_FLOCK64
|
||||
# elif defined HAVE_STRUCT___KERNEL_FLOCK64
|
||||
typedef struct __kernel_flock64 struct_kernel_flock64;
|
||||
#else
|
||||
# error struct flock64 definition not found in <linux/fcntl.h>
|
||||
#endif
|
||||
# else
|
||||
# error struct flock64 definition not found in <linux/fcntl.h>
|
||||
# endif
|
||||
|
||||
#endif /* !STRACE_FLOCK_H */
|
||||
|
24
fs_x_ioctl.c
24
fs_x_ioctl.c
@ -1,30 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
|
||||
* Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2016-2017 The strace developers.
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
SYS_FUNC(fstatfs)
|
||||
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
SYS_FUNC(fstatfs64)
|
||||
|
31
futex.c
31
futex.c
@ -3,30 +3,10 @@
|
||||
* Copyright (c) 2007-2008 Ulrich Drepper <drepper@redhat.com>
|
||||
* Copyright (c) 2009 Andreas Schwab <schwab@redhat.com>
|
||||
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* Copyright (c) 2014-2017 The strace developers.
|
||||
* Copyright (c) 2014-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
@ -41,6 +21,7 @@
|
||||
# define FUTEX_OP_OPARG_SHIFT 8
|
||||
#endif
|
||||
|
||||
#include "xlat/futexbitset.h"
|
||||
#include "xlat/futexops.h"
|
||||
#include "xlat/futexwakeops.h"
|
||||
#include "xlat/futexwakecmps.h"
|
||||
@ -74,11 +55,13 @@ SYS_FUNC(futex)
|
||||
tprintf(", %u", val);
|
||||
tprints(", ");
|
||||
print_timespec(tcp, timeout);
|
||||
tprintf(", %#x", val3);
|
||||
tprints(", ");
|
||||
printxval(futexbitset, val3, NULL);
|
||||
break;
|
||||
case FUTEX_WAKE_BITSET:
|
||||
tprintf(", %u", val);
|
||||
tprintf(", %#x", val3);
|
||||
tprints(", ");
|
||||
printxval(futexbitset, val3, NULL);
|
||||
break;
|
||||
case FUTEX_REQUEUE:
|
||||
tprintf(", %u", val);
|
||||
|
181
gcc_compat.h
181
gcc_compat.h
@ -3,111 +3,118 @@
|
||||
* Copyright (c) 2015-2018 The strace developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifndef STRACE_GCC_COMPAT_H
|
||||
#define STRACE_GCC_COMPAT_H
|
||||
# define STRACE_GCC_COMPAT_H
|
||||
|
||||
#if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define GNUC_PREREQ(maj, min) \
|
||||
# if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define GNUC_PREREQ(maj, min) \
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
#else
|
||||
# define __attribute__(x) /* empty */
|
||||
# define GNUC_PREREQ(maj, min) 0
|
||||
#endif
|
||||
# else
|
||||
# define GNUC_PREREQ(maj, min) 0
|
||||
# endif
|
||||
|
||||
#if GNUC_PREREQ(2, 5)
|
||||
# define ATTRIBUTE_NORETURN __attribute__((__noreturn__))
|
||||
#else
|
||||
# define ATTRIBUTE_NORETURN /* empty */
|
||||
#endif
|
||||
# if defined __clang__ && defined __clang_major__ && defined __clang_minor__
|
||||
# define CLANG_PREREQ(maj, min) \
|
||||
((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min))
|
||||
# else
|
||||
# define CLANG_PREREQ(maj, min) 0
|
||||
# endif
|
||||
|
||||
#if GNUC_PREREQ(2, 7)
|
||||
# define ATTRIBUTE_FORMAT(args) __attribute__((__format__ args))
|
||||
# define ATTRIBUTE_ALIGNED(arg) __attribute__((__aligned__(arg)))
|
||||
# define ATTRIBUTE_PACKED __attribute__((__packed__))
|
||||
#else
|
||||
# define ATTRIBUTE_FORMAT(args) /* empty */
|
||||
# define ATTRIBUTE_ALIGNED(arg) /* empty */
|
||||
# define ATTRIBUTE_PACKED /* empty */
|
||||
#endif
|
||||
# if !(GNUC_PREREQ(2, 0) || CLANG_PREREQ(1, 0))
|
||||
# define __attribute__(x) /* empty */
|
||||
# endif
|
||||
|
||||
#if GNUC_PREREQ(3, 0)
|
||||
# define SAME_TYPE(x, y) __builtin_types_compatible_p(typeof(x), typeof(y))
|
||||
# define FAIL_BUILD_ON_ZERO(expr) (sizeof(int[-1 + 2 * !!(expr)]) * 0)
|
||||
# if GNUC_PREREQ(2, 5)
|
||||
# define ATTRIBUTE_NORETURN __attribute__((__noreturn__))
|
||||
# else
|
||||
# define ATTRIBUTE_NORETURN /* empty */
|
||||
# endif
|
||||
|
||||
# if GNUC_PREREQ(2, 7)
|
||||
# define ATTRIBUTE_FORMAT(args) __attribute__((__format__ args))
|
||||
# define ATTRIBUTE_ALIGNED(arg) __attribute__((__aligned__(arg)))
|
||||
# define ATTRIBUTE_PACKED __attribute__((__packed__))
|
||||
# else
|
||||
# define ATTRIBUTE_FORMAT(args) /* empty */
|
||||
# define ATTRIBUTE_ALIGNED(arg) /* empty */
|
||||
# define ATTRIBUTE_PACKED /* empty */
|
||||
# endif
|
||||
|
||||
# if GNUC_PREREQ(3, 0)
|
||||
# define SAME_TYPE(x, y) __builtin_types_compatible_p(typeof(x), typeof(y))
|
||||
# define FAIL_BUILD_ON_ZERO(expr) (sizeof(int[-1 + 2 * !!(expr)]) * 0)
|
||||
/* &(a)[0] is a pointer and not an array, shouldn't be treated as the same */
|
||||
# define MUST_BE_ARRAY(a) FAIL_BUILD_ON_ZERO(!SAME_TYPE((a), &(a)[0]))
|
||||
#else
|
||||
# define SAME_TYPE(x, y) 0
|
||||
# define MUST_BE_ARRAY(a) 0
|
||||
#endif
|
||||
# define MUST_BE_ARRAY(a) FAIL_BUILD_ON_ZERO(!SAME_TYPE((a), &(a)[0]))
|
||||
# else
|
||||
# define SAME_TYPE(x, y) 0
|
||||
# define MUST_BE_ARRAY(a) 0
|
||||
# endif
|
||||
|
||||
#if GNUC_PREREQ(3, 0)
|
||||
# define ATTRIBUTE_MALLOC __attribute__((__malloc__))
|
||||
#else
|
||||
# define ATTRIBUTE_MALLOC /* empty */
|
||||
#endif
|
||||
# if GNUC_PREREQ(3, 0)
|
||||
# define ATTRIBUTE_MALLOC __attribute__((__malloc__))
|
||||
# else
|
||||
# define ATTRIBUTE_MALLOC /* empty */
|
||||
# endif
|
||||
|
||||
#if GNUC_PREREQ(3, 1)
|
||||
# define ATTRIBUTE_NOINLINE __attribute__((__noinline__))
|
||||
#else
|
||||
# define ATTRIBUTE_NOINLINE /* empty */
|
||||
#endif
|
||||
# if GNUC_PREREQ(3, 1)
|
||||
# define ATTRIBUTE_NOINLINE __attribute__((__noinline__))
|
||||
# else
|
||||
# define ATTRIBUTE_NOINLINE /* empty */
|
||||
# endif
|
||||
|
||||
#if GNUC_PREREQ(4, 0)
|
||||
# define ATTRIBUTE_SENTINEL __attribute__((__sentinel__))
|
||||
#else
|
||||
# define ATTRIBUTE_SENTINEL /* empty */
|
||||
#endif
|
||||
# if GNUC_PREREQ(4, 0)
|
||||
# define ATTRIBUTE_SENTINEL __attribute__((__sentinel__))
|
||||
# else
|
||||
# define ATTRIBUTE_SENTINEL /* empty */
|
||||
# endif
|
||||
|
||||
#if GNUC_PREREQ(4, 1)
|
||||
# define ALIGNOF(t_) __alignof__(t_)
|
||||
#else
|
||||
# define ALIGNOF(t_) (sizeof(struct { char x_; t_ y_; }) - sizeof(t_))
|
||||
#endif
|
||||
# if GNUC_PREREQ(4, 1)
|
||||
# define ALIGNOF(t_) __alignof__(t_)
|
||||
# else
|
||||
# define ALIGNOF(t_) (sizeof(struct { char x_; t_ y_; }) - sizeof(t_))
|
||||
# endif
|
||||
|
||||
#if GNUC_PREREQ(4, 3)
|
||||
# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args))
|
||||
#else
|
||||
# define ATTRIBUTE_ALLOC_SIZE(args) /* empty */
|
||||
#endif
|
||||
# if GNUC_PREREQ(4, 3)
|
||||
# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args))
|
||||
# else
|
||||
# define ATTRIBUTE_ALLOC_SIZE(args) /* empty */
|
||||
# endif
|
||||
|
||||
#if GNUC_PREREQ(7, 0)
|
||||
# define ATTRIBUTE_FALLTHROUGH __attribute__((__fallthrough__))
|
||||
#else
|
||||
# define ATTRIBUTE_FALLTHROUGH ((void) 0)
|
||||
#endif
|
||||
# if GNUC_PREREQ(7, 0)
|
||||
# define ATTRIBUTE_FALLTHROUGH __attribute__((__fallthrough__))
|
||||
# else
|
||||
# define ATTRIBUTE_FALLTHROUGH ((void) 0)
|
||||
# endif
|
||||
|
||||
#if GNUC_PREREQ(6, 0)
|
||||
# define DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE \
|
||||
# if CLANG_PREREQ(2, 8)
|
||||
# define DIAG_PUSH_IGNORE_OVERRIDE_INIT \
|
||||
_Pragma("clang diagnostic push"); \
|
||||
_Pragma("clang diagnostic ignored \"-Winitializer-overrides\"");
|
||||
# define DIAG_POP_IGNORE_OVERRIDE_INIT \
|
||||
_Pragma("clang diagnostic pop");
|
||||
# elif GNUC_PREREQ(4, 2)
|
||||
# define DIAG_PUSH_IGNORE_OVERRIDE_INIT \
|
||||
_Pragma("GCC diagnostic push"); \
|
||||
_Pragma("GCC diagnostic ignored \"-Woverride-init\"");
|
||||
# define DIAG_POP_IGNORE_OVERRIDE_INIT \
|
||||
_Pragma("GCC diagnostic pop");
|
||||
# else
|
||||
# define DIAG_PUSH_IGNORE_OVERRIDE_INIT /* empty */
|
||||
# define DIAG_POP_IGNORE_OVERRIDE_INIT /* empty */
|
||||
# endif
|
||||
|
||||
# if GNUC_PREREQ(6, 0)
|
||||
# define DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE \
|
||||
_Pragma("GCC diagnostic push"); \
|
||||
_Pragma("GCC diagnostic ignored \"-Wtautological-compare\"");
|
||||
# define DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE \
|
||||
# define DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE \
|
||||
_Pragma("GCC diagnostic pop");
|
||||
#else
|
||||
# define DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE /* empty */
|
||||
# define DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE /* empty */
|
||||
#endif
|
||||
# else
|
||||
# define DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE /* empty */
|
||||
# define DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE /* empty */
|
||||
# endif
|
||||
|
||||
#endif /* !STRACE_GCC_COMPAT_H */
|
||||
|
@ -2,27 +2,7 @@
|
||||
# Copyright (c) 2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
input="$1"
|
||||
shift
|
||||
|
@ -1,4 +1,9 @@
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# Copyright (c) 2015-2018 The strace developers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
list="$(sed -r -n '/^strace_SOURCES[[:space:]]*=/,/^[[:space:]]*# end of strace_SOURCES/ s/^[[:space:]]*([[:alnum:]][^.]*\.c)[[:space:]]*\\$/\1/p' Makefile.am |
|
||||
xargs -r grep -Elx '#[[:space:]]*include[[:space:]]+MPERS_DEFS' |
|
||||
|
@ -1,4 +1,9 @@
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# Copyright (c) 2015-2018 The strace developers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
echo 'enum {'
|
||||
echo 'SEN_printargs = 0,'
|
||||
|
14
get_personality.c
Normal file
14
get_personality.c
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#if SUPPORTED_PERSONALITIES > 1
|
||||
# include "get_personality.h"
|
||||
# include <linux/audit.h>
|
||||
# include "arch_get_personality.c"
|
||||
#endif
|
16
get_personality.h
Normal file
16
get_personality.h
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifndef STRACE_GET_PERSONALITY_H
|
||||
# define STRACE_GET_PERSONALITY_H
|
||||
|
||||
# include "ptrace.h"
|
||||
|
||||
extern int
|
||||
get_personality_from_syscall_info(const struct ptrace_syscall_info *);
|
||||
|
||||
#endif /* !STRACE_GET_PERSONALITY_H */
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user