[PATCH v3 09/17] treewide: Change list_sort to use const pointers

Christoph Hellwig hch at infradead.org
Wed Mar 24 07:10:08 GMT 2021


On Tue, Mar 23, 2021 at 01:39:38PM -0700, Sami Tolvanen wrote:
> 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 <ndesaulniers at google.com>
> Signed-off-by: Sami Tolvanen <samitolvanen at google.com>

Looks good:
Reviewed-by: Christoph Hellwig <hch at lst.de>



More information about the linux-arm-kernel mailing list