Commit Graph

6381 Commits

Author SHA1 Message Date
6675b67366 tests: do not include <stdbool.h> in files that include "tests.h"
Starting with commit v4.21-37-g4f63bc70ca95012d72e288fc3c1eeb3ba26068a4,
<stdbool.h> is included by tests.h, so all tests that already include
"tests.h" do not need to include <stdbool.h>.

* tests/btrfs.c: Do not include <stdbool.h>.
* tests/file_handle.c: Likewise.
* tests/futex.c: Likewise.
* tests/ioctl_dm.c: Likewise.
* tests/ioctl_loop.c: Likewise.
* tests/ioctl_sock_gifconf.c: Likewise.
* tests/keyctl.c: Likewise.
* tests/mq_sendrecv.c: Likewise.
* tests/perf_event_open.c: Likewise.
* tests/s390_guarded_storage.c: Likewise.
* tests/s390_pci_mmio_read_write.c: Likewise.
* tests/s390_sthyi.c: Likewise.
* tests/xet_thread_area_x86.c: Likewise.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
08b4355d9c tests: check printing of block/char device numbers in -yy mode
* tests/dev-yy.c: New file.
* tests/pure_executables.list: Add dev-yy.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (dev-yy): New test.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
48feeb3723 printfd: print character/block device number in -yy mode
* util.c: Include <sys/stat.h>, <sys/sysmacros.h>,
and "largefile_wrappers.h".
(printsocket, printdev): New functions.
(printfd): Move socket matching/printing logic to printsocket.  Check
also for printdev.  Escape opening angle bracket in addition to closing angle
bracket as it can show up as a separator in printdev.
* tests/fsync-y.c: Update expected output.
* strace.1.in: Mention this.
* NEWS: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
6d36a70868 util.c: escape closing angle bracket in printfd
* util.c (printfd): Use print_quoted_string_ex instead of
print_quoted_string, specify ">" as escape_chars argument.
* tests/fsync-y.c (main): Update expected output.
* NEWS: Mention it.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
0b732f7e9d util.c: add support for additional escape characters in string_quote
Quotes are not always used to denote string limits; printfd uses angle
brackets for that, for example.  As result, mechanism for supplying
set of additional characters in order to avoid ambiguities regarding
the end of the quoted string is needed.

* defs.h (string_quote): Add escape_chars parameter.
(print_quoted_string_ex): New function prototype.
* util.c (string_quote): Add escape_chars parameter.
(print_quoted_string_ex): Rename from print_quoted_string, add
escape_chars parameter, pass it to string_quote call.
(print_quoted_string): Turn into a thin wrapper around
print_quoted_string_ex.
(printstr_ex): Pass NULL as escape_chars argument of string_quote call.
* socketutils.c (unix_parse_response): Pass NULL as escape_chars
argument of string_quote call.
* tests/print_quoted_string.c (print_octal): New function.
print_quoted_memory_ex): Use it.  Add escape_chars parameter.
(print_quoted_memory): Pass NULL as escape_chars argument
of print_quoted_memory_ex call.
* tests/tests.h (print_quoted_string_ex, print_quoted_memory_ex): Add
escape_chars parameter.
* tests/fsync-y.c: Pass NULL as escape_chars argument of
print_quoted_string_ex call.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
e196eebea4 tests: check file name printing in strace -y mode
* tests/fsync-y.c: New file.
* tests/.gitignore: Add fsync-y.
* tests/Makefile.am (check_PROGRAMS): Likewise.
* tests/gen_tests.in (fsync-y): New test.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
eda9b3d227 tests: add print_quoted_string_ex and print_quoted_memory_ex functions
* tests/tests.h (print_quoted_string_ex, print_quoted_memory_ex): New
declarations.
* tests/print_quoted_string.c (print_quoted_string_ex): New function,
a thin wrapper around print_quoted_memory_ex wrapper.
(print_quoted_memory_ex): Rename from print_quoted_memory, add quote
argument.
(print_quoted_memory): Turn into a thin wrapper around
print_quoted_memory_ex.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
69430cd977 tests: check escaping in string printing
* tests/test_printstrn.c (test_print_memory): New function.
(test_printstrn): Use it.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
f6f7b82d4b Do not go full octal if the next char is '8' or '9'
* util.c (string_quote): Change the upper limit for the next character
in unabbreviated octal printing from '9' to '7'.
* tests/print_quoted_string.c (print_quoted_memory): Likewise.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
2b4c03fcdb tests: fix abbreviated octal escape check in print_quoted_memory
* tests/print_quoted_string.c (print_quoted_memory): Check the next
character after octal-escaped one instead of the first one in the
string.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
1f64f75320 util.c: reduce indentation in non-hexadecimal case in string_quote
As it is already too deep there.

* util.c (string_quote): Add string_ended label, jump there
after the loop in "if (usehex)" case.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
3c0be8d36d util.c: fix switch statement indentation in string_quote
While we are here, let's also remove unnecessary break statement
in the default case.
2018-03-01 01:00:24 +00:00
42bedfc093 Replace fopen_for_input and fopen_for_output with fopen_stream
* largefile_wrappers.h (fopen_for_input, fopen_for_output): Replace
with fopen_stream.
* mmap_cache.c (fopen_for_input) Likewise.
* strace.c (fopen_for_output): Likewise.
2018-02-27 13:14:38 +00:00
Eugene Syromyatnikov
413c085e59 Update the list of INET_DIAG_BC_* operators
* linux/inet_diag.h (INET_DIAG_BC_S_EQ, INET_DIAG_BC_D_EQ): New
enumeration items introduced by linux kernel commit v4.16-rc1~123^2~259.
* xlat/inet_diag_bytecodes.in (INET_DIAG_BC_S_EQ, INET_DIAG_BC_D_EQ): New
constants.
* NEWS: Mention it.
2018-02-27 13:14:38 +00:00
Eugene Syromyatnikov
0d592163cd xlat: update the list of SCHED_FLAG_* constants
* xlat/sched_flags.in (SCHED_FLAG_RECLAIM, SCHED_FLAG_DL_OVERRUN): New
constants introduced by linux kernel commits v4.13-rc1~205^2~27 and
v4.16-rc1~164^2~8, respectively.
(SCHED_FLAG_RESET_ON_FORK): Add constant value.
* tests/sched_xetattr.c: Update expected output.
* NEWS: Mention it.
2018-02-27 13:14:38 +00:00
Eugene Syromyatnikov
fc52b3e265 xlat: provide fallback definitions for arch-independent poll event flags
* xlat/pollflags.in (POLLIN, POLLPRI, POLLOUT, POLLRDNORM, POLLRDBAND,
POLLERR, POLLHUP, POLLNVAL, POLL_BUSY_LOOP): Add constant values.
2018-02-27 13:14:38 +00:00
Eugene Syromyatnikov
176c894c91 xlat: update the list of poll event flags
POLL_BUSY_LOOP was introduced by linux kernel commit v3.11-rc1~64^2~129
as POLL_LL and then renamed in v3.11-rc1~64^2~9.  POLLRDHUP was
introduced by linux kernel commit v2.6.17-rc1~796.  POLLMSG and
POLLREMOVE predate git repository.  POLLFREE was introduced by linux
kernel commit v3.3-rc5~8 for internal use only.

* xlat/pollflags.in (POLLMSG, POLLREMOVE, POLLRDHUP, POLL_BUSY_LOOP):
New constants.
* NEWS: Mention it.
2018-02-27 13:14:38 +00:00
Eugene Syromyatnikov
a3b09b9c3b xlat: add arch-specific si_codes constants
Based on Linux commits v4.16-rc1~159^2~17, v4.16-rc1~159^2~16,
v4.16-rc1~159^2~15, and v4.16-rc1~159^2~14.

* xlat/sigbus_codes.in (BUS_OPFETCH): New constant.
* xlat/sigfpe_codes.in (FPE_MDAOVF, __FPE_DECOVF, __FPE_DECDIV,
__FPE_DECERR, __FPE_INVASC, __FPE_INVDEC): New constants.
* xlat/sigill_codes.in (ILL_ILLPARAOP, ILL_ILLEXCPT, ILL_CPLB_VI,
ILL_CPLB_MISS, ILL_CPLB_MULHIT, ILL_DBLFLT, ILL_HARDWALL, ILL_BADIADDR,
__ILL_BREAK, __ILL_BNDMOD): Likewise.
* xlat/sigsegv_codes.in (SEGV_STACKFLOW, __SEGV_PSTKOVF): Likewise.
* xlat/sigtrap_codes.in (TRAP_STEP, TRAP_TRACEFLOW, TRAP_WATCHPT,
TRAP_ILLTRAP): Likewise.
* NEWS: Mention it.
2018-02-27 13:14:38 +00:00
Eugene Syromyatnikov
d824282814 rtnl_tc: support new TCA_* attributes
* xlat/rtnl_tc_attrs.in (TCA_HW_OFFLOAD, TCA_INGRESS_BLOCK,
TCA_EGRESS_BLOCK): New constants introduced by linux kernel commits
v4.15-rc4~13^2~5^2~2 and v4.16-rc1~123^2~139^2~5.
* rtnl_tc.c (tcmsg_nla_decoders) <TCA_HW_OFFLOAD, TCA_INGRESS_BLOCK,
TCA_EGRESS_BLOCK>: New items.
2018-02-27 13:14:38 +00:00
Eugene Syromyatnikov
27e141b442 rtnl_link: add decoding of new IFLA_* attributes
* xlat/rtnl_link_attrs.in (IFLA_NEW_NETNSID, IFLA_IF_NETNSID,
IFLA_CARRIER_UP_COUNT, IFLA_CARRIER_DOWN_COUNT, IFLA_NEW_IFINDEX): New
constants introduced by linux kernel commits v4.15-rc1~84^2~557,
v4.15-rc1~84^2~133^2, v4.16-rc1~123^2~91, and v4.16-rc1~123^2~24^2.
* rtnl_link.c (ifinfomsg_nla_decoders) <IFLA_NEW_NETNSID,
IFLA_IF_NETNSID, IFLA_CARRIER_UP_COUNT, IFLA_CARRIER_DOWN_COUNT,
IFLA_NEW_IFINDEX>: New items.
2018-02-27 13:14:38 +00:00
Eugene Syromyatnikov
53ebefe984 rtnl_link: implement IFLA_EVENT_* decoding
* rtnl_link.c (decode_ifla_event): New function.
(ifinfomsg_nla_decoders) <[IFLA_EVENT]>: Use it.
* xlat/rtnl_ifla_events.in: New file.
* NEWS: Mention it.
2018-02-27 13:14:38 +00:00
Eugene Syromyatnikov
2e5510da5f xlat: update the list of RWF_* constants
* xlat/rwf_flags.in (RWF_APPEND): New constant introduced by linux
kernel commit v4.16-rc1~145^2~7.
* NEWS: Mention it.
2018-02-27 13:14:38 +00:00
Eugene Syromyatnikov
d2f152e969 tests: check decoding of ip6:port pairs associated with socket descriptors
* tests/net-yy-inet.c: Generalise test.
* tests/net-yy-inet6.c: New file.
* tests/pure_executables.list: Add net-yy-inet6.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (net-yy-inet6): New entry.
2018-02-27 00:17:47 +00:00
Eugene Syromyatnikov
85e2e24e19 Print IPv6 addresses in brackets
Follow a common practice for printing address:port pair to distinguish
address parts delimiter from address/port delimiter.

* socketutils.c (inet_parse_response) <ob, cb>: New variables,
initialise them to open/closing brackets or empty strings based
on address family.
(inet_parse_response): Print ob and cb around src_buf and dst_buf.
* NEWS: Mention this improvement.
2018-02-27 00:17:47 +00:00
53571cba0f strace.spec.in: add gcc to build requirements
There are rumors in circulation that some rpm-based distributions
are going to exclude gcc from their default build environments.
Workaround this policy silliness by adding gcc to build requirements.

* strace.spec.in (BuildRequires): Add gcc.
2018-02-26 23:22:24 +00:00
fd4c976cf9 Move definitions of fopen_for_input to largefile_wrappers.h
* largefile_wrappers.h (fopen_for_input): Define along with
fopen_for_output.
* mmap_cache.c: Include "largefile_wrappers.h".
(fopen_for_input): Remove.
2018-02-26 23:22:24 +00:00
bbeee0be62 Introduce mmap_cache.h
Let's avoid bloating defs.h and introduce a separate header for
mmap_cache.

* defs.h (struct mmap_cache_t, enum mmap_cache_protection,
enum mmap_cache_rebuild_result, mmap_cache_enable, mmap_cache_is_enabled,
mmap_cache_invalidate, mmap_cache_delete, mmap_cache_rebuild_if_invalid,
mmap_cache_search): Move ...
* mmap_cache.h: ... to this new file.
* Makefile.am (strace_SOURCES): Add mmap_cache.h.
* mmap_cache.c: Include mmap_cache.h.
* strace.c: Likewise.
* syscall.c: Likewise.
* unwind.c: Likewise.
2018-02-26 23:22:24 +00:00
Masatake YAMATO
12f7d721e2 mmap_cache: record device major and minor numbers
* defs.h (struct mmap_cache_t): Add major and minor fields.
* mmap_cache.c (build_mmap_cache): Record device major and minor numbers.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-02-26 23:22:24 +00:00
Masatake YAMATO
c4e4ca97bc mmap_cache: add function to enable mmap_cache
mmap_cache was enabled indirectly via unwind feature.  As now mmap_cache
can be used by other part of strace, a way to enable mmap_cache directly
is needed.

* defs.h (mmap_cache_enable, mmap_cache_is_enabled): New function
prototypes.
* mmap_cache.c (use_mmap_cache): New file local variable.
(mmap_cache_enable, mmap_cache_is_enabled): New functions.
* syscall.c (syscall_exiting_decode): Use mmap_cache_is_enabled()
instead of stack_trace_enabled.
* unwind.c (unwind_init): Invoke mmap_cache_enable.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-02-26 23:22:24 +00:00
Masatake YAMATO
7f041ed0d9 mmap_cache, unwind: lift up mmap_cache_delete invocation from unwind.c
mmap_cache_delete function used to be called by destructor of unwind
related code.  Now that other parts can use mmap cache,
mmap_cache_delete is called separately from unwind_tcb_fin.

* unwind.c (unwind_tcb_fin): Move mmap_cache_delete invocation ...
* strace.c (droptcb): ... here.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-02-26 23:22:24 +00:00
Masatake YAMATO
71d33e5e3e mmap_cache: record protection bits
To make mmap_cache reusable, records protection bits of mmap entries.

* defs.h (mmap_cache_protection): New enum.
* mmap_cache.c (build_mmpa_cache): Don't ignore entries that are not
executable, just record the protection bits here.
* unwind.c (print_stack_frame): Ignore entries that are not executable.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-02-26 23:22:24 +00:00
Masatake YAMATO
2bb35360c2 mmap_cache: move code for searching a mmap cache from unwind
print_stack_frame function in unwind.c searches a mmap entry in mmap
cache.  The found entry is then used for unwinding.  However, a function
searching for a mmap entry may be useful for other purposes than
unwinding.

This change re-factors the function; code for searching an entry is
now defined as a stand-alone function named mmap_cache_search.

* defs.h (mmap_cache_search): New function prototype.
print_stack_frame.
* mmap_cached.c (mmap_cache_search): New function derived from
print_stack_frame.
* unwind.c (print_stack_frame): Use it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-02-26 23:22:24 +00:00
Masatake YAMATO
8fd4ef9bef mmap_cache: new subsystem derived from unwind.c
For making mmap cache code reusable from other areas in strace than
unwind, mmap cache related code and unwind related code should be
separated.

This change moves the most of mmap cache code from unwind.c
to mmap_cache.c, a new file.

* unwind.c: Move mmap_cache implementation ...
* mmap_cache.c: ... to this new file.
* Makefile.am (strace_SOURCES): add mmap_cache.c.
* defs.h (struct tcb): Move mmap_cache, mmap_cache_size, and
mmap_cache_generation fields out of [USE_LIBUNWIND] condition.
(mmap_cache_invalidate, mmap_cache_delete,
mmap_cache_rebuild_if_invalid): New function prototypes.
(struct mmap_cache_t, enum mmap_cache_rebuild_result): Move from
unwind.c.
* syscall.c (syscall_exiting_decode): Replace unwind_cache_invalidate
with mmap_cache_invalidate.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-02-26 23:22:24 +00:00
Masatake YAMATO
a40806919f unwind: lift up unw_flush_cache from mmap cache management code
For making mmap cache code reusable from other areas in strace
than unwind, mmap cache related code and unwind related code
should be separated.

This change is one of the steps for the separation.  It moves
unw_flush_cache function call from the core of mmap cache code
to upper level code.

* unwind.c (mmap_cache_rebuild_result): New enum.
(rebuild_cache_if_invalid): Return MMAP_CACHE_REBUILD_* instead of
a bool value.
(build_mmap_cache): Don't call unw_flush_cache here.
(unwind_print_stacktrace, unwind_capture_stacktrace): Call
unw_flush_cache here instead.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-02-26 23:22:24 +00:00
73166c3fd1 debian: sync with 4.21-1 package
Versioned dependency on debhelper is not updated for backwards
compatibility.

* debian/changelog.in: Fix ancient changelog entries.
* debian/control (Build-Depends): Add dependency on libbluetooth-dev.
(Standards-Version): Update to 4.1.3.
(Vcs-Git, Vcs-Browser): Move from alioth to salsa.d.o.
(strace, strace-udeb) <Architecture>: Change to linux-any.
(strace64, strace-udeb) <Priority>: Change to optional.
* debian/rules: Use /usr/share/dpkg/architecture.mk instead of manually
setting build variables.
(configure): New target.
(build/Makefile, build-udeb/Makefile, build64/Makefile): Depend on it.
(binary-arch): Use build64/strace.1 for strace64 subpackage.
* debian/strace.manpages: Add build/ prefix.
* debian/strace64.manpages: Add build64/ prefix.
2018-02-25 00:31:14 +00:00
Eugene Syromyatnikov
3e13994e67 m4/mpers.m4: fix mpers name in comments added to config.h
* m4/mpers.m4 (st_MPERS_STRUCT_STAT): Use mpers_name instead of
MPERS_NAME in comments generated by AC_DEFINE.

Fixes: v4.14~169 ("mpers.m4: check for struct stat64, struct stat, and their members")
2018-02-24 23:06:51 +00:00
4078b012ae mpers.awk: use stdint.h instead of inttypes.h
As <inttypes.h> is included in files generated by mpers.awk to obtain
definitions of uintNN_t types provided by <stdint.h>, replace the former
header with the latter.

* mpers.awk: Use <stdint.h> instead of <inttypes.h>.
* mpers_test.sh: Update expected output.
2018-02-24 20:42:03 +00:00
003c02745f Wipe out references to defunct sourceforge
The old location of strace-devel mailing list is defunct, it used to
lose email messages and sometimes did not deliver any mails for days.

The mailing list has been moved to strace-devel@lists.strace.io.

* CREDITS.in: Update the mailing list address.
(Zhang Le): Update email address.
* README: Update the mailing list address.
* README.md: Likewise.
* configure.ac (AC_INIT): Likewise.
* strace.1.in (.SH REPORTING BUGS): Likewise.
* strace-log-merge.1.in (.SH REPORTING BUGS): Likewise.
* sched.c (SYS_FUNC(sched_getattr)): Update the mailing list reference.
* tests/scno_tampering.sh: Likewise.
* qemu_multiarch_testing/README: Update git repository address.
* NEWS: Mention the change of the mailing list address.

Closes: https://github.com/strace/strace/issues/38
2018-02-23 23:18:56 +00:00
6ebf6c4f9e m68k: fix build
When <sys/reg.h> is included after <linux/ptrace.h>, the build fails
on m68k with the following diagnostics:

  In file included from /usr/include/linux/ptrace.h:101:0,
                   from ptrace.h:51,
                   from sigreturn.c:2:
  /usr/include/m68k-linux-gnu/sys/reg.h:26:3: error: expected identifier
  before numeric constant
     PT_D1 = 0,
     ^

Apparently, the only architecture where strace needs definitions
provided by <sys/reg.h> is x86_64, other three (m68k, tile, and x86)
are fine with definitions already provided by <linux/ptrace.h>.

Fix the issue by getting rid of <sys/reg.h> and defining necessary
macros in linux/x86_64/arch_regs.h file.

* configure.ac (AC_CHECK_HEADERS): Remove sys/reg.h.
* regs.h: Do not include <sys/reg.h>.
* linux/x86_64/arch_regs.h (R15, R14, R13, R12, RBP, RBX, R11, R10,
R9, R8, RAX, RCX, RDX, RSI, RDI, ORIG_RAX, RIP, CS, EFLAGS, RSP, SS,
FS_BASE, GS_BASE, DS, ES, FS, GS): New macros.
* NEWS: Mention this fix.

Fixes: v4.21~21 ("Include <sys/ptrace.h> early")
2018-02-21 23:03:27 +00:00
51d40516df Demote sourceforge.net
https://sourceforge.net/p/strace/code/ is defunct: it doesn't accept
new commits for too long.
Likewise, https://sourceforge.net/projects/strace/files/ doesn't accept
new files for too long.

* README.md: Remove sourceforge.net URL.
* debian/copyright: Replace the sourceforge.net based strace project URL
with a github based one.
* strace.spec.in (Source): Likewise.
2018-02-15 11:07:03 +00:00
17e6678219 Update copyright headers
* COPYING: Update copyright year number range.
* debian/copyright: Sync with COPYING.
2018-02-15 11:07:03 +00:00
70e76c39cd Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.21-1.
* strace.spec.in: Likewise.
2018-02-14 03:00:00 +00:00
51630c2002 Prepare for 4.21 release
* NEWS: Update for 4.21 release.
2018-02-13 23:00:00 +00:00
Eugene Syromyatnikov
9748b92038 tests/s390_sthyi.c: skip the test if s390_sthyi returns an error
tests/s390_sthyi.c (main): replace error_msg_and_fail with
error_msg_and_skip if rc is non-zero.
2018-02-13 22:57:27 +00:00
daaf8ab7fe Update copyright headers
Headers updated automatically using maint/update_copyright_years.sh
script.
2018-02-13 22:00:00 +00:00
Eugene Syromyatnikov
3e97bf63fc Remove old and unused maintenance scripts
Firewell, last witnesses of bygone era.

* linux/sparc/gen.pl: Remove.
* linux/x86_64/gentab.pl: Likewise.
* xlate.el: Likewise.
* Makefile.am (EXTRA_DIST): Remove them.

Suggested-by: Elvira Khabirova <lineprinter@altlinux.org>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-02-13 21:36:08 +00:00
ae8c1d5cc7 Consistently use MAX_ERRNO_VALUE
* filter_qualify.c (parse_inject_token): Replace 4095
with MAX_ERRNO_VALUE.
* negated_errno.h (is_negated_errno): Likewise.  Remove redundant
comment.
2018-02-13 05:05:13 +00:00
4b36fd69f7 Export SIZEOF_LONG and SIZEOF_KERNEL_LONG_T to tests
* configure.ac (AC_SUBST): Add SIZEOF_LONG and SIZEOF_KERNEL_LONG_T.
* tests/Makefile.am (SIZEOF_LONG, SIZEOF_KERNEL_LONG_T): New variables.
(AM_TEST_LOG_FLAGS): Pass them.
* bootstrap: Substitute them.
2018-02-13 04:17:08 +00:00
Eugene Syromyatnikov
101621d4c7 tests: avoid ioctl_kvm_run test failure when built with gcc -O0
When built with -O0, gcc (rightfully) generates function prologue, which
results in writing %rbp to the stack, causing premature KVM_EXIT_MMIO.
It could be possible to avoid such problems by "naked" attribute but,
unfortunately, the latter is not available on x86 with older GCC.
A trick suggested in [1] is used instead: assembly is moved
to the global scope.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50242#c3

* tests/ioctl_kvm_run.c (code): Remove function.
Add globally scoped __asm__ with the function code and its size.
(code, code_size): New extern symbols declarations.
(run_kvm): Remove code_size definition and initialization.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-02-13 03:12:29 +00:00
Eugene Syromyatnikov
9730e10317 tests/ioctl_kvm_run.c: add KVM_EXIT_MMIO diagnostics
As it has proven itself useful.

* tests/ioctl_kvm_run.c (run_kvm) <case KVM_EXIT_MMIO:>: Fail
on unexpected KVM_EXIT_MMIO, providing relevant diagnostics.
2018-02-13 03:12:29 +00:00