diff --git a/qtfs/include/symbol_wrapper.h b/qtfs/include/symbol_wrapper.h index 7b9e0d74a46845256c2bdf64957e7773bee82b32..4ce500f80de32357ae3b76e45ab4d944131fb94c 100644 --- a/qtfs/include/symbol_wrapper.h +++ b/qtfs/include/symbol_wrapper.h @@ -28,10 +28,6 @@ struct qtfs_kallsyms { struct task_struct *(*find_get_task_by_vpid)(pid_t nr); long (*do_mount)(const char *, const char __user *, const char *, unsigned long, void *); -#ifdef __aarch64__ - int (*set_memory_ro)(unsigned long, int); - int (*set_memory_rw)(unsigned long, int); -#endif }; extern struct qtfs_kallsyms qtfs_kern_syms; @@ -75,15 +71,16 @@ static inline int make_ro(unsigned long address) #endif #ifdef __aarch64__ +extern void (*update_mapping_prot)(phys_addr_t phys, unsigned long virt, phys_addr_t size, pgprot_t prot); static inline int make_rw(unsigned long address) { - qtfs_kern_syms.set_memory_rw(address, 1); + update_mapping_prot(__pa_symbol(address & PAGE_MASK), (unsigned long)(address & PAGE_MASK), PAGE_SIZE, PAGE_KERNEL); return 0; } static inline int make_ro(unsigned long address) { - qtfs_kern_syms.set_memory_ro(address, 1); + update_mapping_prot(__pa_symbol(address & PAGE_MASK), (unsigned long)(address & PAGE_MASK), PAGE_SIZE, PAGE_KERNEL_RO); return 0; } diff --git a/qtfs/qtfs_common/symbol_wrapper.c b/qtfs/qtfs_common/symbol_wrapper.c index ea81893156ef642afa74addbc728ac2c36df0c3a..5ceaf5f099714384fc562f1c709e88fb56a934bd 100644 --- a/qtfs/qtfs_common/symbol_wrapper.c +++ b/qtfs/qtfs_common/symbol_wrapper.c @@ -54,6 +54,8 @@ struct pt_regs; regs->r9 = (unsigned long)x6; #endif #ifdef __aarch64__ +void (*update_mapping_prot)(phys_addr_t phys, unsigned long virt, phys_addr_t size, pgprot_t prot); + // symbols not finded in sys call table enum qtfs_sym_a64 { A64_NR_UNLINK = 0, @@ -128,10 +130,12 @@ int qtfs_kallsyms_hack_init(void) #endif #ifdef __aarch64__ - KSYMS(set_memory_ro, int (*)(unsigned long, int)); - KSYMS_NULL_RETURN(qtfs_kern_syms.set_memory_ro); - KSYMS(set_memory_rw, int (*)(unsigned long, int)); - KSYMS_NULL_RETURN(qtfs_kern_syms.set_memory_rw); + update_mapping_prot = (void *)qtfs_kallsyms_lookup_name("update_mapping_prot"); + if (update_mapping_prot == NULL) { + qtfs_err("failed to init memory protect handler"); + return -1; + } + #pragma GCC diagnostic ignored "-Wint-conversion" symbols_a64[A64_NR_UNLINK] = (unsigned long)qtfs_kallsyms_lookup_name("__arm64_sys_unlink"); KSYMS_NULL_RETURN(symbols_a64[A64_NR_UNLINK]); diff --git a/qtfs/qtfs_server/fsops.c b/qtfs/qtfs_server/fsops.c index 1e21abe4cdb917851348d03152cd29e2d3ba90f6..f2f3749ef9783c8c08c2447d8163988a96e0e782 100644 --- a/qtfs/qtfs_server/fsops.c +++ b/qtfs/qtfs_server/fsops.c @@ -680,7 +680,7 @@ static int handle_readdir(struct qtserver_arg *arg) rsp->d.ret = QTFS_OK; rsp->d.vldcnt = buf.vldcnt; rsp->d.over = (req->pos == rsp->d.pos) ? 1 : 0; - qtfs_info("handle readdir ret:%d, pos:%lld path:%s, valid count:%d, leftcount:%d validbyte:%u\n", + qtfs_info("handle readdir ret:%d, pos:%lld path:%s, valid count:%d, leftcount:%d validbyte:%lu\n", ret, req->pos, req->path, buf.vldcnt, buf.count, req->count - buf.count); filp_close(file, NULL);