Extend the ucall framework to offer GUEST_PRINTF() and GUEST_ASSERT_FMT() in selftests. This will allow for better and easier guest debugging. v2 -> v3 - s/kvm_vsnprintf/guest_vsnprintf/ [Sean] - GUEST_ASSERT on error in guest_vsnprintf() [Sean] - Added "Fixes" tag to patch #3 [Sean] - Removed memset to zero ucall.buffer to save cycles [Sean] - Added REPORT_GUEST_PRINTF() for the host [Sean] - Removed ucall_fmt2() and squashed it into __GUEST_ASSERT_FMT [Sean] - Fixed stack overflow in guest_print_test Sean called out - Refactored test_limits() in guest_print_test to account for updates v1 -> v2: - Added a proper selftest [Sean] - Added support for snprintf [Shaoqin] - Added ucall_nr_pages_required() [Sean] - Added ucall_fmt2() for GUEST_ASSERT_FMT() - Dropped the original version of printf.c [Sean] - Dropped patches 1-2 and 8 [Sean] Aaron Lewis (5): KVM: selftests: Add strnlen() to the string overrides KVM: selftests: Add guest_snprintf() to KVM selftests KVM: selftests: Add additional pages to the guest to accommodate ucall KVM: selftests: Add string formatting options to ucall KVM: selftests: Add a selftest for guest prints and formatted asserts tools/testing/selftests/kvm/Makefile | 3 + .../testing/selftests/kvm/guest_print_test.c | 222 +++++++++++++ .../testing/selftests/kvm/include/test_util.h | 3 + .../selftests/kvm/include/ucall_common.h | 24 ++ .../testing/selftests/kvm/lib/guest_sprintf.c | 307 ++++++++++++++++++ tools/testing/selftests/kvm/lib/kvm_util.c | 4 + .../selftests/kvm/lib/string_override.c | 9 + .../testing/selftests/kvm/lib/ucall_common.c | 22 ++ 8 files changed, 594 insertions(+) create mode 100644 tools/testing/selftests/kvm/guest_print_test.c create mode 100644 tools/testing/selftests/kvm/lib/guest_sprintf.c -- 2.41.0.rc0.172.g3f132b7071-goog