From d068bd441cbd82867249970d699a4702bec2ad6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E6=B5=A9?= Date: Thu, 16 Mar 2023 14:33:50 +0800 Subject: [PATCH] fit for linux kernel 6.1 --- CMakeLists.txt | 1 + Makefile | 1 + core/agent.c | 3 +-- core/session_manager.c | 2 -- core/smc_smp.c | 3 ++- core/tc_client_driver.c | 13 ------------- 6 files changed, 5 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ef9ef8..d503196 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,7 @@ set(CMAKE_EXTRA_FLAGS "${CMAKE_EXTRA_FLAGS} -DCONFIG_AUTH_SUPPORT_UNAME -DCONFIG set(CMAKE_EXTRA_FLAGS "${CMAKE_EXTRA_FLAGS} -I${PROJECT_SOURCE_DIR}/libboundscheck/include/ -I${PROJECT_SOURCE_DIR} -I${PROJECT_SOURCE_DIR}/auth -I${PROJECT_SOURCE_DIR}/core") set(CMAKE_EXTRA_FLAGS "${CMAKE_EXTRA_FLAGS} -I${PROJECT_SOURCE_DIR}/tlogger -I${PROJECT_SOURCE_DIR}/tzdriver_internal/kthread_affinity -I${PROJECT_SOURCE_DIR}/tzdriver_internal/include") set(CMAKE_EXTRA_FLAGS "${CMAKE_EXTRA_FLAGS} -I${PROJECT_SOURCE_DIR}/tzdriver_internal/tee_trace_event") +set(CMAKE_EXTRA_FLAGS "${CMAKE_EXTRA_FLAGS} -isystem /usr/lib/gcc/aarch64-linux-gnu/10.3.1/include") # Compile .ko file add_custom_target(${TARGET_NAME} ALL COMMAND @echo "Compiling module ${TARGET_NAME}.ko...") diff --git a/Makefile b/Makefile index a5eb619..acbcc68 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ endif KPATH := /usr/src/kernels KDIR := $(KPATH)/$(shell ls $(KPATH)) +EXTRA_CFLAGS += -isystem /usr/lib/gcc/aarch64-linux-gnu/10.3.1/include EXTRA_CFLAGS += -fstack-protector-strong -DCONFIG_TEELOG -DCONFIG_TZDRIVER_MODULE -DCONFIG_TEECD_AUTH -DCONFIG_PAGES_MEM=y -DCONFIG_CLOUDSERVER_TEECD_AUTH EXTRA_CFLAGS += -I$(PWD)/libboundscheck/include/ -I$(PWD) -I$(PWD)/auth -I$(PWD)/core -I$(PWD)/tzdriver_internal/tee_trace_event EXTRA_CFLAGS += -I$(PWD)/tlogger -I$(PWD)/tzdriver_internal/kthread_affinity -I$(PWD)/tzdriver_internal/include diff --git a/core/agent.c b/core/agent.c index 7a1bee9..b5d0f37 100644 --- a/core/agent.c +++ b/core/agent.c @@ -119,7 +119,7 @@ char *get_proc_dpath(char *path, int path_len) return NULL; } - exe_file = get_mm_exe_file(mm); + exe_file = mm->exe_file; if (!exe_file) { mmput(mm); return NULL; @@ -129,7 +129,6 @@ char *get_proc_dpath(char *path, int path_len) path_get(&base_path); dpath = d_path(&base_path, path, MAX_PATH_SIZE); path_put(&base_path); - fput(exe_file); mmput(mm); return dpath; diff --git a/core/session_manager.c b/core/session_manager.c index adf2a1d..48e21c5 100644 --- a/core/session_manager.c +++ b/core/session_manager.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -1355,7 +1354,6 @@ int tc_client_session_ioctl(struct file *file, unsigned int cmd, tee_trace_add_event(INVOKE_CMD_END, 0); break; default: - freezer_count(); tloge("invalid cmd:0x%x!\n", cmd); return ret; } diff --git a/core/smc_smp.c b/core/smc_smp.c index a7a2fea..8857c7e 100644 --- a/core/smc_smp.c +++ b/core/smc_smp.c @@ -126,7 +126,7 @@ unsigned long g_shadow_thread_id = 0; static struct task_struct *g_siq_thread; static struct task_struct *g_smc_svc_thread; static struct task_struct *g_ipi_helper_thread; -static DEFINE_KTHREAD_WORKER(g_ipi_helper_worker); +static struct kthread_worker g_ipi_helper_worker; enum cmd_reuse { CLEAR, /* clear this cmd index */ @@ -2068,6 +2068,7 @@ static int init_smc_related_rsrc(const struct device *class_dev) koadpt_kthread_bind_mask(g_siq_thread, &new_mask); /* some products specify the cpu that kthread need to bind */ tz_kthread_bind_mask(g_siq_thread); + kthread_init_worker(&g_ipi_helper_worker); g_ipi_helper_thread = kthread_create(kthread_worker_fn, &g_ipi_helper_worker, "ipihelper"); if (IS_ERR_OR_NULL(g_ipi_helper_thread)) { diff --git a/core/tc_client_driver.c b/core/tc_client_driver.c index 7c63c3a..f3f0d7a 100644 --- a/core/tc_client_driver.c +++ b/core/tc_client_driver.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -739,15 +738,9 @@ static int tc_client_agent_ioctl(const struct file *file, unsigned int cmd, static void handle_cmd_prepare(unsigned int cmd) { - if (cmd == TC_NS_CLIENT_IOCTL_SES_OPEN_REQ || - cmd == TC_NS_CLIENT_IOCTL_SES_CLOSE_REQ || - cmd == TC_NS_CLIENT_IOCTL_SEND_CMD_REQ) - freezer_do_not_count(); - if (cmd != TC_NS_CLIENT_IOCTL_WAIT_EVENT && cmd != TC_NS_CLIENT_IOCTL_SEND_EVENT_RESPONSE) livepatch_down_read_sem(); - return; } static void handle_cmd_finish(unsigned int cmd) @@ -755,12 +748,6 @@ static void handle_cmd_finish(unsigned int cmd) if (cmd != TC_NS_CLIENT_IOCTL_WAIT_EVENT && cmd != TC_NS_CLIENT_IOCTL_SEND_EVENT_RESPONSE) livepatch_up_read_sem(); - - if (cmd == TC_NS_CLIENT_IOCTL_SES_OPEN_REQ || - cmd == TC_NS_CLIENT_IOCTL_SES_CLOSE_REQ || - cmd == TC_NS_CLIENT_IOCTL_SEND_CMD_REQ) - freezer_count(); - return; } static long tc_private_ioctl(struct file *file, unsigned int cmd, -- Gitee