selftests/rseq: Fix: work-around asm goto compiler bugs

gcc and clang each have their own compiler bugs with respect to asm
goto. Implement a work-around for compiler versions known to have those
bugs.

gcc prior to 4.8.2 miscompiles asm goto.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670

gcc prior to 8.1.0 miscompiles asm goto at O1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103908

clang prior to version 13.0.1 miscompiles asm goto at O2.
https://github.com/llvm/llvm-project/issues/52735

Work around these issues by adding a volatile inline asm with
memory clobber in the fallthrough after the asm goto and at each
label target.  Emit this for all compilers in case other similar
issues are found in the future.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220124171253.22072-14-mathieu.desnoyers@efficios.com
This commit is contained in:
Mathieu Desnoyers 2022-01-24 12:12:51 -05:00 committed by Peter Zijlstra
parent 94c5cf2a0e
commit b53823fb2e
7 changed files with 245 additions and 6 deletions

View File

@ -0,0 +1,30 @@
/* SPDX-License-Identifier: LGPL-2.1-only OR MIT */
/*
* rseq/compiler.h
*
* Work-around asm goto compiler bugs.
*
* (C) Copyright 2021 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*/
#ifndef RSEQ_COMPILER_H
#define RSEQ_COMPILER_H
/*
* gcc prior to 4.8.2 miscompiles asm goto.
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
*
* gcc prior to 8.1.0 miscompiles asm goto at O1.
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103908
*
* clang prior to version 13.0.1 miscompiles asm goto at O2.
* https://github.com/llvm/llvm-project/issues/52735
*
* Work around these issues by adding a volatile inline asm with
* memory clobber in the fallthrough after the asm goto and at each
* label target. Emit this for all compilers in case other similar
* issues are found in the future.
*/
#define rseq_after_asm_goto() asm volatile ("" : : : "memory")
#endif /* RSEQ_COMPILER_H_ */

View File

@ -195,16 +195,21 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -263,16 +268,21 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -317,12 +327,15 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
, error1
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
#endif
}
@ -384,16 +397,21 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -456,16 +474,21 @@ int rseq_cmpeqv_trystorev_storev_release(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -532,18 +555,24 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
, error1, error2, error3
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("1st expected value comparison failed");
error3:
rseq_after_asm_goto();
rseq_bug("2nd expected value comparison failed");
#endif
}
@ -652,16 +681,21 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -771,16 +805,21 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}

View File

@ -242,17 +242,21 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -300,16 +304,21 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -348,12 +357,15 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
, error1
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
#endif
}
@ -402,17 +414,21 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -461,17 +477,21 @@ int rseq_cmpeqv_trystorev_storev_release(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -522,19 +542,24 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
, error1, error2, error3
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
error3:
rseq_after_asm_goto();
rseq_bug("2nd expected value comparison failed");
#endif
}
@ -584,17 +609,21 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -644,17 +673,21 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}

View File

@ -254,16 +254,21 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -322,16 +327,21 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -378,12 +388,15 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
, error1
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
#endif
}
@ -442,16 +455,21 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -512,16 +530,21 @@ int rseq_cmpeqv_trystorev_storev_release(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -583,18 +606,24 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
, error1, error2, error3
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("1st expected value comparison failed");
error3:
rseq_after_asm_goto();
rseq_bug("2nd expected value comparison failed");
#endif
}
@ -659,16 +688,21 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -735,16 +769,21 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}

View File

@ -178,16 +178,21 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -248,16 +253,21 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -301,12 +311,15 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
, error1
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
#endif
}
@ -364,16 +377,21 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -443,18 +461,24 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
, error1, error2, error3
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("1st expected value comparison failed");
error3:
rseq_after_asm_goto();
rseq_bug("2nd expected value comparison failed");
#endif
}
@ -555,16 +579,21 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}

View File

@ -152,16 +152,21 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -220,16 +225,21 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -269,12 +279,15 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
, error1
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
#endif
}
@ -387,16 +400,21 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -464,18 +482,24 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
, error1, error2, error3
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("1st expected value comparison failed");
error3:
rseq_after_asm_goto();
rseq_bug("2nd expected value comparison failed");
#endif
}
@ -574,16 +598,21 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -730,16 +759,21 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -798,16 +832,21 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -847,12 +886,15 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
, error1
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
#endif
}
@ -909,16 +951,21 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -977,16 +1024,21 @@ int rseq_cmpeqv_trystorev_storev_release(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
@ -1047,18 +1099,24 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
, error1, error2, error3
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("1st expected value comparison failed");
error3:
rseq_after_asm_goto();
rseq_bug("2nd expected value comparison failed");
#endif
}
@ -1161,16 +1219,21 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}
@ -1274,16 +1337,21 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect,
, error1, error2
#endif
);
rseq_after_asm_goto();
return 0;
abort:
rseq_after_asm_goto();
RSEQ_INJECT_FAILED
return -1;
cmpfail:
rseq_after_asm_goto();
return 1;
#ifdef RSEQ_COMPARE_TWICE
error1:
rseq_after_asm_goto();
rseq_bug("cpu_id comparison failed");
error2:
rseq_after_asm_goto();
rseq_bug("expected value comparison failed");
#endif
}

View File

@ -17,6 +17,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "rseq-abi.h"
#include "compiler.h"
/*
* Empty code injection macros, override when testing.