1 // SPDX-License-Identifier: GPL-2.0
3 * This is for all the tests relating directly to Control Flow Integrity.
7 static int called_count
;
9 /* Function taking one argument, without a return value. */
10 static noinline
void lkdtm_increment_void(int *counter
)
15 /* Function taking one argument, returning int. */
16 static noinline
int lkdtm_increment_int(int *counter
)
23 * This tries to call an indirect function with a mismatched prototype.
25 void lkdtm_CFI_FORWARD_PROTO(void)
28 * Matches lkdtm_increment_void()'s prototype, but not
29 * lkdtm_increment_int()'s prototype.
33 pr_info("Calling matched prototype ...\n");
34 func
= lkdtm_increment_void
;
37 pr_info("Calling mismatched prototype ...\n");
38 func
= (void *)lkdtm_increment_int
;
41 pr_info("Fail: survived mismatched prototype function call!\n");