xref: /linux/drivers/android/binder/page_range_helper.c (revision 4f38da1f027ea2c9f01bb71daa7a299c191b6940)
1*eafedbc7SAlice Ryhl // SPDX-License-Identifier: GPL-2.0
2*eafedbc7SAlice Ryhl 
3*eafedbc7SAlice Ryhl /* C helper for page_range.rs to work around a CFI violation.
4*eafedbc7SAlice Ryhl  *
5*eafedbc7SAlice Ryhl  * Bindgen currently pretends that `enum lru_status` is the same as an integer.
6*eafedbc7SAlice Ryhl  * This assumption is fine ABI-wise, but once you add CFI to the mix, it
7*eafedbc7SAlice Ryhl  * triggers a CFI violation because `enum lru_status` gets a different CFI tag.
8*eafedbc7SAlice Ryhl  *
9*eafedbc7SAlice Ryhl  * This file contains a workaround until bindgen can be fixed.
10*eafedbc7SAlice Ryhl  *
11*eafedbc7SAlice Ryhl  * Copyright (C) 2025 Google LLC.
12*eafedbc7SAlice Ryhl  */
13*eafedbc7SAlice Ryhl #include "page_range_helper.h"
14*eafedbc7SAlice Ryhl 
15*eafedbc7SAlice Ryhl unsigned int rust_shrink_free_page(struct list_head *item,
16*eafedbc7SAlice Ryhl 				   struct list_lru_one *list,
17*eafedbc7SAlice Ryhl 				   void *cb_arg);
18*eafedbc7SAlice Ryhl 
19*eafedbc7SAlice Ryhl enum lru_status
20*eafedbc7SAlice Ryhl rust_shrink_free_page_wrap(struct list_head *item, struct list_lru_one *list,
21*eafedbc7SAlice Ryhl 			   void *cb_arg)
22*eafedbc7SAlice Ryhl {
23*eafedbc7SAlice Ryhl 	return rust_shrink_free_page(item, list, cb_arg);
24*eafedbc7SAlice Ryhl }
25