[NFC][cfi] Update diagnostic tests for better location matching (#194557)
This commit is contained in:
@@ -33,7 +33,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: runtime error: control flow integrity check for type 'void *()' failed during indirect function call
|
// CHECK: runtime error: control flow integrity check for type 'void *()' failed during indirect function call
|
||||||
// CHECK: dso_symbol defined here
|
// CHECK: cross-dso-diagnostic.cpp:[[@LINE-13]]: note: dso_symbol defined here
|
||||||
// CHECK: check failed in {{.*}}_exe_suffix, destination function located in {{.*}}[[DSONAME]]
|
// CHECK: check failed in {{.*}}_exe_suffix, destination function located in {{.*}}[[DSONAME]]
|
||||||
void *S = fp(); // trigger cfi-icall failure
|
void *S = fp(); // trigger cfi-icall failure
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ int main(int argc, char *argv[]) {
|
|||||||
void *p;
|
void *p;
|
||||||
if (argv[1][0] == 'i') {
|
if (argv[1][0] == 'i') {
|
||||||
// ICALL-DIAG: runtime error: control flow integrity check for type 'void *(int)' failed during indirect function call
|
// ICALL-DIAG: runtime error: control flow integrity check for type 'void *(int)' failed during indirect function call
|
||||||
// ICALL-DIAG-NEXT: note: create_B() defined here
|
// ICALL-DIAG-NEXT: dynamic.so+0x{{[[:xdigit:]]+}}): note: create_B() defined here
|
||||||
// ICALL-NODIAG-NOT: runtime error: control flow integrity check {{.*}} during indirect function call
|
// ICALL-NODIAG-NOT: runtime error: control flow integrity check {{.*}} during indirect function call
|
||||||
p = ((void *(*)(int))create_B)(42);
|
p = ((void *(*)(int))create_B)(42);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ void f() {
|
|||||||
// CHECK: =2=
|
// CHECK: =2=
|
||||||
fprintf(stderr, "=2=\n");
|
fprintf(stderr, "=2=\n");
|
||||||
// CFI-DIAG: runtime error: control flow integrity check for type 'void (int)' failed during indirect function call
|
// CFI-DIAG: runtime error: control flow integrity check for type 'void (int)' failed during indirect function call
|
||||||
// CFI-DIAG-NEXT: note: g() defined here
|
// CFI-DIAG-NEXT: ({{.*}}exe+0x{{[[:xdigit:]]+}}): note: g() defined here
|
||||||
((void (*)(int))g)(42); // UB here
|
((void (*)(int))g)(42); // UB here
|
||||||
// CHECK-DIAG: =3=
|
// CHECK-DIAG: =3=
|
||||||
// CHECK-NOT: =3=
|
// CHECK-NOT: =3=
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ int main() {
|
|||||||
// CHECK: =2=
|
// CHECK: =2=
|
||||||
fprintf(stderr, "=2=\n");
|
fprintf(stderr, "=2=\n");
|
||||||
// CFI-DIAG: runtime error: control flow integrity check for type 'void (int)' failed during indirect function call
|
// CFI-DIAG: runtime error: control flow integrity check for type 'void (int)' failed during indirect function call
|
||||||
// CFI-DIAG-NEXT: note: f() defined here
|
// CFI-DIAG-NEXT: ({{.*}}dynamic.so+0x{{[[:xdigit:]]+}}): note: f() defined here
|
||||||
((void (*)(int))f)(42); // UB here
|
((void (*)(int))f)(42); // UB here
|
||||||
// CHECK-DIAG: =3=
|
// CHECK-DIAG: =3=
|
||||||
// CHECK-NOT: =3=
|
// CHECK-NOT: =3=
|
||||||
|
|||||||
@@ -9,8 +9,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void f() {
|
void f() {}
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
// CFI: 1
|
// CFI: 1
|
||||||
@@ -18,7 +17,7 @@ int main() {
|
|||||||
fprintf(stderr, "1\n");
|
fprintf(stderr, "1\n");
|
||||||
|
|
||||||
// CFI-DIAG: runtime error: control flow integrity check for type 'void (int)' failed during indirect function call
|
// CFI-DIAG: runtime error: control flow integrity check for type 'void (int)' failed during indirect function call
|
||||||
// CFI-DIAG: f defined here
|
// CFI-DIAG: bad-signature.c:[[@LINE-8]]: note: f defined here
|
||||||
((void (*)(int))f)(42); // UB here
|
((void (*)(int))f)(42); // UB here
|
||||||
|
|
||||||
// CFI-NOT: 2
|
// CFI-NOT: 2
|
||||||
|
|||||||
Reference in New Issue
Block a user