73544 Commits

Author SHA1 Message Date
Sergej Schumilo
eb1b6e6da6 change pre_image error message to debug msg 2022-12-15 11:23:53 +01:00
Steffen Schulz
2f869ed3e1 replace printf + exit() with nyx_abort()
- Replace instances of error/printf + exit(1) with nyx_abort(), except
  for one instance where we don't give any useful error and a plain
  assert() seems more appropriate

- Remove [Qemu-Nyx] and Error: in arguments to nyx_error()
2022-12-15 11:23:53 +01:00
Steffen Schulz
56491f8d11 turn error_report() back to nyx_error()
(error_report goes to qemu monitor, but we want to use log for easy redirect)
2022-12-15 11:23:53 +01:00
Steffen Schulz
31c509b171 replace most fprintf with nyx_error/warn/debug/abort
- printf that looks like debug/status info or disabled by macro/comments
  mostly turned to corresponding nyx_debug()
- printf followed by exit/abort/assert turned to nyx_error(),
  or nyx_abort() if the error is unlikely to need backtrace/gdb
- non-fatal error/warning messages turned to nyx_warn()
- few hardcoded printf remain, e.g. hexdump and debug helpers
2022-12-15 11:23:53 +01:00
Steffen Schulz
b40f7c60e9 more missing newlines, fix use of warn/error
- replace several hardcoded fprintf()
- use of warn vs error or nyx_abort()
- several more missing newlines
- fixed up messages
2022-12-15 11:23:53 +01:00
Steffen Schulz
0675844956 Add nyx_warn() and prefix tags
Use qemu_log() everywhere so we have a single log on stderr or -D <logfile>.
2022-12-15 11:23:53 +01:00
Steffen Schulz
ab4fbeadef better nyx_abort()
Let nyx_abort() take a format string and replace instances of
fprintf/nyx_debug with subsequent nyx_abort / abort / assert.
2022-12-15 11:23:53 +01:00
Steffen Schulz
e6159806aa use nyx_error/printf/abort() also in sig handlers 2022-11-22 09:58:32 +01:00
Steffen Schulz
1609eee66a wait for gdb attach only when compiled for debug
Waiting for gdb attach is not useful/expected for normal use and has
a tendendency to create hanging qemu instances.
2022-11-22 09:58:32 +01:00
Steffen Schulz
3be0ec292e fix req_stream_data_bulk() return size
Hypercall failed to handle the default case where 0 < ret_value < 4096.
The handler keeps looping over num_addresses, returning a too large
overall file size to the guest.

For a 4 byte test file, hget_bulk() would fetch + write 960 bytes.

Also moved struct definition to header + set __attribute__((packed)).
2022-11-21 07:05:27 +01:00
Steffen Schulz
f1bb7b29c4 check for successful chdir() 2022-11-21 06:50:29 +01:00
Sergej Schumilo
8a88edc2a1 auto-apply clang-format
- including vl.c & kvm-all.c
2022-10-16 23:51:13 +02:00
Sergej Schumilo
976d8e8329 minor fix (file_helper.c) 2022-10-16 23:51:13 +02:00
Sergej Schumilo
6e0a6ccbda add "clang-format on/off" comments
to enable auto-formatting of vl.c & kvm-all.c
2022-10-16 23:51:13 +02:00
Sergej Schumilo
e4269fc973 manual code cleanups (reviewed)
Tried to minimize actual code modifcations but we got
- several comments/printf messages edited to meet line limits
- occasionally switch some lines to put declarations or printfs in blocks
- couple more places marked TODO or FIXME to avoid non-trivial changes
- fixed PAGE_SIZE define in helpers.h to avoid redeclaration warning
- remove several chunks of dead or commented code

Co-authored-by: Steffen Schulz <steffen.schulz@intel.com>
2022-10-16 23:51:13 +02:00
Steffen Schulz
949ab6c9f9 add a .clang-format for Qemu style plus various fixes
Based on bab9fdd5d1/.clang-format
2022-10-16 23:51:13 +02:00
Sergej Schumilo
80f22f77d6 fix usage of nyx_debug_p() (add missing prefix) 2022-09-22 05:19:45 +02:00
Steffen Schulz
e83025a145 replace custom printf with nyx_<level>() wrappers
This introduces generic printf wrappers to replace the various
instances of debug_printf, fprintf, QEMU_PR_PRINTF etc.

Several more hardcoded printf() are still present and should probably be
replaced with nyx_debug_p().
2022-09-22 05:07:37 +02:00
Steffen Schulz
f91ff284ee switch debug logging to use qemu_log_mask()
Default qemu_log is written to stderr, or logged to file with -D
Additional qemu_log_masked(LOG_NYX) can be enabled with -d nyx
2022-09-22 05:07:37 +02:00
Steffen Schulz
bd34c46b85 fix printf format string errors 2022-09-22 05:07:37 +02:00
Steffen Schulz
ab668227f9 add NYX_DEBUG option in debug mode 2022-09-22 05:07:37 +02:00
Steffen Schulz
d407bab254 No vm_start() on snapshot restore (fixes #29)
Actual vm_start() performed by caller in vl.c. This extra vm_start()
breaks "qemu -S" function in combination with snapshot loads.
2022-09-07 20:11:21 +02:00
Sergej Schumilo
4df041cd8e
Merge pull request #22 from il-steffen/page_cache_racing
Page cache racing
2022-05-25 10:52:52 +02:00
Steffen Schulz
6a336d0d3a Revert "page_cache: auto-create workdir files or resume based on existing files"
This reverts commit b8995723775c5ee75355ef4e87922cec359245e5.
2022-05-25 01:06:50 +02:00
Steffen Schulz
c93998e817 Revert "page_cache: use file lock also for read access"
This reverts commit 5c24050a645b0db69a806cb100f4e263ca191838.
2022-05-25 01:06:38 +02:00
Sergej Schumilo
5c8cf793ec
Merge pull request #21 from schumilo/qemu-nyx-4.2.0
various build script fixes
2022-05-11 19:55:34 +02:00
Sergej Schumilo
847a32fbf2 update libxdc submodule 2022-05-11 19:53:55 +02:00
Sergej Schumilo
dd901b5f84 fix build script (error in non-static mode) 2022-05-11 19:53:11 +02:00
Sergej Schumilo
b39169eca6 don’t install libxdc or libcapstone (in non-static mode) 2022-05-11 19:50:43 +02:00
Sergej Schumilo
54f4d2f1ab check arguments before compiling dependencies 2022-05-11 19:40:57 +02:00
Sergej Schumilo
ab7ee8223c
Merge pull request #15 from il-steffen/buildfixes
compile.sh fixes
2022-05-11 19:14:26 +02:00
Sergej Schumilo
f66671d93b
Merge pull request #20 from schumilo/qemu-nyx-4.2.0
various bug fixes from dev branch
2022-05-11 18:03:52 +02:00
Sergej Schumilo
108fa3baf9 fix starved bug in vanilla kvm mode (caused by reading of uninitialized memory) 2022-05-11 18:00:12 +02:00
Steffen Schulz
d4ba169bea Remove superfluous printf
Extra printf just spams the console on startup..
2022-05-11 18:00:11 +02:00
Steffen Schulz
9e56f6731e fix timeout detection to only reset on VM reset
reset_timeout_detection() is already called at end of NEXT_PAYLOAD
handler to properly re-init the timer on every new execution.

Remove the additional call in synchronization_lock() which prevents
proper timeout on targets that do a lot of hprintf().

Also remove extra call in synchronization_lock_timeout_found() which
really just seems to be a duplicate with no observable effect.

To reproduce, run a harness that uses hprintf() in infinite loop. It
will take longer due to execute due to userland overhead but should
eventually return with aux_buffer/runtime similar to configured timeout.
2022-05-11 18:00:11 +02:00
Steffen Schulz
35809c5207 cleanup timeout_detection 2022-05-11 18:00:11 +02:00
Steffen Schulz
a2ee5ef587 fix runtime_usec wraparound in aux_buffer
To reproduce the issue, launch fast running harness with aux_buffer->timeout_usec=0 and timeout_sec=1
2022-05-11 18:00:11 +02:00
Sergej Schumilo
9959725652 fix warning: in vl.c 2022-05-11 18:00:11 +02:00
Sergej Schumilo
e6c25cbdee fix warning: remove unused variables 2022-05-11 18:00:11 +02:00
Steffen Schulz
02d6e1545c allow to override libxdc/capstone repo locations
Fetch submodules only if either LIBXDC_ROOT or CAPSTONE_ROOT are empty.
2022-04-27 01:40:45 +02:00
Steffen Schulz
ec36a3551f extra LDFLAGS needed for libxdc dev version + ptdump_static
Note sure why -Llibxdc is needed when libxdc Makefile contains -L.?
2022-04-27 01:30:36 +02:00
Steffen Schulz
c3bbf86ddd avoid hardcoded paths in configure script
Allows calling configure with custom libxdc/capstone locations
2022-04-27 00:45:48 +02:00
Steffen Schulz
5846b4b094 cosmetic overhaul for compile_qemu_nyx.sh 2022-04-27 00:38:55 +02:00
Sergej Schumilo
00da434bec
Merge pull request #13 from schumilo/qemu-nyx-4.2.0
fix oobs read (in shadow_memory_read_page_frame)
2022-04-18 19:27:19 +02:00
Sergej Schumilo
2c3b7a7873 fix oobs read (in shadow_memory_read_page_frame) 2022-04-18 19:24:58 +02:00
Sergej Schumilo
fc39d1d5da
Merge pull request #11 from schumilo/qemu-nyx-4.2.0
improve shadow_memory_read_physical_memory()
2022-04-09 06:51:44 +02:00
Sergej Schumilo
72a95d8bfb improve shadow_memory_read_physical_memory()
this patch removes several limitations (size & alignment)
2022-04-09 06:50:19 +02:00
Sergej Schumilo
1acaa75a8b
Merge pull request #10 from nyx-fuzz/qemu-nyx-4.2.0-dev-intel
push qemu-nyx-4.2.0-dev-intel to qemu-nyx-4.2.0
2022-04-07 11:04:36 +02:00
Sergej Schumilo
d86e2b05a4
Merge pull request #9 from schumilo/qemu-nyx-4.2.0-dev-intel
several changes
2022-04-07 11:01:57 +02:00
Sergej Schumilo
758e65871b update NYX_HOST_VERSION 2022-04-07 10:58:16 +02:00