mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-06 09:25:22 +02:00
ANDROID: rust_binder: fix CFI failure in rust_shrink_free_page
Bindgen currently turns C enums into a typedef for `unsigned int`. This normally works, but means that rustc will generate the wrong CFI tags for functions that use C enums as parameters or return types. To work around this, introduce an intermediate C function that "converts" from C enum to unsigned int. Bug: 335105888 Change-Id: I5d49e69d24333c1f421a4e579c04ca38019a303b Signed-off-by: Alice Ryhl <aliceryhl@google.com>
This commit is contained in:
parent
741b6ae073
commit
ed1360bdfa
|
@ -29,6 +29,7 @@
|
|||
#include <linux/fs.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/list_lru.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/refcount.h>
|
||||
#include <linux/sched/signal.h>
|
||||
|
@ -38,6 +39,19 @@
|
|||
#include <linux/wait.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
unsigned int rust_shrink_free_page(struct list_head *item,
|
||||
struct list_lru_one *list, spinlock_t *lock,
|
||||
void *cb_arg);
|
||||
|
||||
enum lru_status
|
||||
rust_helper_rust_shrink_free_page_wrap(struct list_head *item,
|
||||
struct list_lru_one *list,
|
||||
spinlock_t *lock, void *cb_arg)
|
||||
{
|
||||
return rust_shrink_free_page(item, list, lock, cb_arg);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rust_helper_rust_shrink_free_page_wrap);
|
||||
|
||||
__noreturn void rust_helper_BUG(void)
|
||||
{
|
||||
BUG();
|
||||
|
|
|
@ -630,7 +630,7 @@ unsafe extern "C" fn rust_shrink_scan(
|
|||
unsafe {
|
||||
bindings::list_lru_walk(
|
||||
shrinker.list_lru.get(),
|
||||
Some(rust_shrink_free_page),
|
||||
Some(bindings::rust_shrink_free_page_wrap),
|
||||
ptr::null_mut(),
|
||||
nr_to_scan,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user