Skip to content

Commit

Permalink
exec/x86: [fix] incorrect opcode in set_h2g_target macro
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksiiOleksenko committed Aug 1, 2024
1 parent 83e113a commit 03837f1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/x86/executor/macro_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ static inline size_t start_macro_set_h2g_target(macro_args_t args, uint8_t *dest
APPEND_BYTES_TO_DEST(0x49, 0xbb);
APPEND_U64_TO_DEST(vmcb_hva_addr);
// ASM: mov r11, [r11]
APPEND_BYTES_TO_DEST(0x49, 0x8b, 0x1b);
APPEND_BYTES_TO_DEST(0x4d, 0x8b, 0x1b);
// ASM: add r11, VMCB_RIP_OFFSET
APPEND_BYTES_TO_DEST(0x49, 0x81, 0xc3);
APPEND_U32_TO_DEST(VMCB_RIP_OFFSET);
Expand Down
2 changes: 1 addition & 1 deletion tests/x86_tests/acceptance.bats
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function intel_only() {
@test "Feature: VM test case" {
if cat /proc/cpuinfo | grep -e "vmx" -e "svm" >/dev/null; then
echo "1" > /sys/x86_executor/enable_hpa_gpa_collisions
assert_no_violation "$fuzz_opt -t $ASM_DIR/vmx_switch.asm -c $CONF_DIR/vm-switch.yaml -i 20"
assert_no_violation "$fuzz_opt -t $ASM_DIR/vm_switch.asm -c $CONF_DIR/vm-switch.yaml -i 20"

echo "Testing page table allocation..."
run cat /sys/x86_executor/dbg_guest_page_tables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
.function_main1:

.function_main2:
.macro.measurement_start:
.macro.set_h2g_target.actor2.function_a2:
.macro.set_g2h_target.main.function_fin:
.macro.switch_h2g.actor2:

.function_fin:
.macro.landing_g2h:
.macro.measurement_end:
nop

# ----------------------------- actor 2 ------------------------------------------------------------
.section .data.actor2
.function_a2:
.macro.landing_h2g:
.macro.measurement_start:
.macro.measurement_end:

.macro.switch_g2h.main:

# ----------------------------- exit ------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions tests/x86_tests/kernel_module.bats
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function set_default_config() {

# execute one dummy run to set Executor into the default config and to load the test case
nruns=1000
threshold=$((nruns - 1))
threshold=900

tmpasm=$(mktemp /tmp/revizor-test.XXXXXX.asm)
tmpbin=$(mktemp /tmp/revizor-test.XXXXXX.o)
Expand Down Expand Up @@ -264,7 +264,7 @@ function set_default_config() {

# execute one dummy run to set Executor into the default config and to load the test case
nruns=1000
threshold=$((nruns - 1))
threshold=900

tmpasm=$(mktemp /tmp/revizor-test.XXXXXX.asm)
tmpbin=$(mktemp /tmp/revizor-test.XXXXXX.o)
Expand Down

0 comments on commit 03837f1

Please sign in to comment.