From d99fc1e55364db64a2fd9a4df19b134beca10f34 Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Fri, 17 Jul 2020 01:56:37 +0000 Subject: [PATCH] compel: remove "addr_" from offset variable names It removes the potential confusion when it comes to virtual address vs offsets. Further, doing so makes naming more consistent with the rest of the parasite_blob_desc struct. Signed-off-by: Nicolas Viennot --- compel/include/infect-priv.h | 4 ++-- compel/include/uapi/infect.h | 4 ++-- compel/src/lib/handle-elf.c | 4 ++-- compel/src/lib/infect.c | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/compel/include/infect-priv.h b/compel/include/infect-priv.h index ec6dd455d..8e1f990d5 100644 --- a/compel/include/infect-priv.h +++ b/compel/include/infect-priv.h @@ -33,8 +33,8 @@ struct parasite_ctl { unsigned long parasite_ip; /* service routine start ip */ - unsigned int *addr_cmd; /* addr for command */ - void *addr_args; /* address for arguments */ + unsigned int *cmd; /* address for command */ + void *args; /* address for arguments */ unsigned long args_size; int tsock; /* transport socket for transferring fds */ diff --git a/compel/include/uapi/infect.h b/compel/include/uapi/infect.h index dbcb7fc85..aebaa8f75 100644 --- a/compel/include/uapi/infect.h +++ b/compel/include/uapi/infect.h @@ -152,8 +152,8 @@ struct parasite_blob_desc { size_t bsize; size_t nr_gotpcrel; unsigned long parasite_ip_off; - unsigned long addr_cmd_off; - unsigned long addr_arg_off; + unsigned long cmd_off; + unsigned long args_off; compel_reloc_t *relocs; unsigned int nr_relocs; } hdr; diff --git a/compel/src/lib/handle-elf.c b/compel/src/lib/handle-elf.c index 6b54d5544..6fb0fb37f 100644 --- a/compel/src/lib/handle-elf.c +++ b/compel/src/lib/handle-elf.c @@ -699,9 +699,9 @@ int __handle_elf(void *mem, size_t size) pr_out("\t\tpbd->hdr.parasite_ip_off = " "%s_sym__export_parasite_head_start_compat;\n", opts.prefix); pr_out("#endif /* CONFIG_COMPAT */\n"); - pr_out("\tpbd->hdr.addr_cmd_off = " + pr_out("\tpbd->hdr.cmd_off = " "%s_sym__export_parasite_cmd;\n", opts.prefix); - pr_out("\tpbd->hdr.addr_arg_off = " + pr_out("\tpbd->hdr.args_off = " "%s_sym__export_parasite_args;\n", opts.prefix); pr_out("\tpbd->hdr.relocs = %s_relocs;\n", opts.prefix); pr_out("\tpbd->hdr.nr_relocs = " diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c index 3abbb4e2f..94a1883ab 100644 --- a/compel/src/lib/infect.c +++ b/compel/src/lib/infect.c @@ -612,7 +612,7 @@ static int parasite_init_daemon(struct parasite_ctl *ctl) user_regs_struct_t regs; struct ctl_msg m = { }; - *ctl->addr_cmd = PARASITE_CMD_INIT_DAEMON; + *ctl->cmd = PARASITE_CMD_INIT_DAEMON; args = compel_parasite_args(ctl, struct parasite_init_args); @@ -905,8 +905,8 @@ int compel_infect(struct parasite_ctl *ctl, unsigned long nr_threads, unsigned l pr_info("Putting parasite blob into %p->%p\n", ctl->local_map, ctl->remote_map); ctl->parasite_ip = (unsigned long)(ctl->remote_map + ctl->pblob.hdr.parasite_ip_off); - ctl->addr_cmd = ctl->local_map + ctl->pblob.hdr.addr_cmd_off; - ctl->addr_args = ctl->local_map + ctl->pblob.hdr.addr_arg_off; + ctl->cmd = ctl->local_map + ctl->pblob.hdr.cmd_off; + ctl->args = ctl->local_map + ctl->pblob.hdr.args_off; memcpy(ctl->local_map, ctl->pblob.hdr.mem, ctl->pblob.hdr.bsize); compel_relocs_apply(ctl->local_map, ctl->remote_map, &ctl->pblob); @@ -1364,7 +1364,7 @@ int compel_cure(struct parasite_ctl *ctl) void *compel_parasite_args_p(struct parasite_ctl *ctl) { - return ctl->addr_args; + return ctl->args; } void *compel_parasite_args_s(struct parasite_ctl *ctl, unsigned long args_size) @@ -1382,7 +1382,7 @@ int compel_run_in_thread(struct parasite_thread_ctl *tctl, unsigned int cmd) user_regs_struct_t regs = octx->regs; int ret; - *ctl->addr_cmd = cmd; + *ctl->cmd = cmd; ret = parasite_run(pid, PTRACE_CONT, ctl->parasite_ip, stack, ®s, octx); if (ret == 0)