Files
Linux/include/linux
Sami Tolvanen 4f0f586bf0 treewide: Change list_sort to use const pointers
list_sort() internally casts the comparison function passed to it
to a different type with constant struct list_head pointers, and
uses this pointer to call the functions, which trips indirect call
Control-Flow Integrity (CFI) checking.

Instead of removing the consts, this change defines the
list_cmp_func_t type and changes the comparison function types of
all list_sort() callers to use const pointers, thus avoiding type
mismatches.

Suggested-by: Nick Desaulniers <[email protected]>
Signed-off-by: Sami Tolvanen <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Tested-by: Nick Desaulniers <[email protected]>
Tested-by: Nathan Chancellor <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
2021-04-08 16:04:22 -07:00
..
…
…
…
…
…
…
2021-02-02 00:16:57 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-04-08 16:04:21 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-02-26 09:41:03 -08:00
2021-04-08 16:04:20 -07:00
2021-02-17 14:07:48 +01:00
…
…
…
…
…
2021-04-08 16:04:20 -07:00
2021-04-08 16:04:20 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-02-08 12:28:07 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-02-11 13:24:44 -08:00
…
…
…
…
…
…
…
…
…
…
2021-04-08 16:04:20 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-02-26 09:41:03 -08:00
…
…
…
…
…
…
…
2021-02-17 14:12:42 +01:00
…
…
…
2021-02-26 09:41:02 -08:00
…
…
…
…
…
…
2021-02-26 09:41:03 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-02-26 09:41:03 -08:00
…
…
…
…
…
…
…
…
2021-03-13 11:27:30 -08:00
2021-04-08 16:04:21 -07:00
…
…
2021-04-08 16:04:20 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-02-16 16:11:14 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-02-02 10:26:12 +01:00
…
…
…
…
…
…
…
2021-02-17 13:17:49 -08:00
…
…
…
…
…
…
…
…
…
…
2021-02-26 09:40:59 -08:00
…
…
2021-02-03 19:05:50 +01:00
…
…
…
2021-04-08 16:04:20 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-02-26 09:41:03 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-03-02 17:25:46 -07:00
…
2021-02-20 10:13:32 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2021-02-09 12:27:29 -05:00
…
2021-02-13 17:17:53 +01:00
…
…
…
…
…
…
…
…
…
…
…
…
2021-02-01 13:20:07 -07:00
…
…
…
…
…
2021-02-09 12:15:07 +01:00
…
…
…
…
…
…
…
…
…
…
2021-03-30 13:42:33 -04:00
…
…
…
…
…
…
…
…
2021-02-08 22:58:55 +01:00
…