From: Paul Floyd Date: Mon, 1 Jun 2026 10:48:14 +0000 (+0200) Subject: Regtest: fox for new none x86 bug520856-x86 test X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eef70bec133f4209f7d24d1399b4202ea6b58e2a;p=thirdparty%2Fvalgrind.git Regtest: fox for new none x86 bug520856-x86 test A problem with the jumped to skip address with some versions of GCC. Fix it by junping in the inline assembler. --- diff --git a/none/tests/x86/Makefile.am b/none/tests/x86/Makefile.am index ff42aecbf..bc7d72c96 100644 --- a/none/tests/x86/Makefile.am +++ b/none/tests/x86/Makefile.am @@ -46,7 +46,7 @@ EXTRA_DIST = \ bug135421-x86.stderr.exp bug135421-x86.stdout.exp bug135421-x86.vgtest \ bug137714-x86.stdout.exp bug137714-x86.vgtest \ bug152818-x86.stderr.exp bug152818-x86.stdout.exp bug152818-x86.vgtest \ - bug520856-x86.vgtest \ + bug520856-x86.vgtest bug520856-x86.stdout.exp \ cet_nops.stdout.exp cet_nops.vgtest \ cmpxchg8b.stderr.exp cmpxchg8b.stdout.exp cmpxchg8b.vgtest \ cpuid.stderr.exp cpuid.stdout.exp cpuid.vgtest \ diff --git a/none/tests/x86/bug520856-x86.c b/none/tests/x86/bug520856-x86.c index 6212d1a2b..5cc04ea56 100644 --- a/none/tests/x86/bug520856-x86.c +++ b/none/tests/x86/bug520856-x86.c @@ -1,27 +1,26 @@ -/* test_cs_jmp.c - regression test for CS-prefixed indirect jmp */ +/* Test for CS-prefixed indirect jmp. + * The previous version had a problem loading the skip address on illumos + * This version uses all inline asm and jumps around an int 3 to avoid + * crashing with SIGTRAP. Prints "ok" on success. +*/ #include static void test(void) { - /* A CS-prefixed indirect jmp through a register is simpler: - 2E FF E0 = cs jmp *%eax - This uses the same 0x2E/0xFF path without a complex SIB byte */ - int dummy = (int)&&skip; __asm__ volatile ( - "movl %0, %%eax\n\t" - ".byte 0x2E, 0xFF, 0xE0\n\t" /* cs jmp *%eax */ - : - : "r"(dummy) - : "eax" + "leal 1f, %%eax\n\t" + ".byte 0x2E, 0xFF, 0xE0\n\t" + ".int 3\n\t" + "1:\n\t" + : + : + : "eax" ); - // should skip this - printf("failed\n"); -skip: - return; } int main(void) { test(); + printf("ok\n"); return 0; } diff --git a/none/tests/x86/bug520856-x86.stdout.exp b/none/tests/x86/bug520856-x86.stdout.exp new file mode 100644 index 000000000..9766475a4 --- /dev/null +++ b/none/tests/x86/bug520856-x86.stdout.exp @@ -0,0 +1 @@ +ok