uprobes: typeof(arch_uprobe->insn) cleanups
Subsystems (3)
Oleg Nesterov
maintainercover uprobes: typeof(arch_uprobe->insn) cleanups
Hello.
Ananth, could you please explicitly ack or nack 2/2 ? It is really simple, but obviously I can't test it. And even if it is correct it should be merged only if you like it, this is the minor cleanup.
Oleg.
Oleg Nesterov
maintainerPATCH 1/2 uprobes: Don't assume that arch_uprobe->insn/ixol is u8[MAX_UINSN_BYTES]
arch_uprobe should be opaque as much as possible to the generic code, but currently it assumes that insn/ixol must be u8[] of the known size. Remove this unnecessary dependency, we can use "&" and and sizeof() with the same effect.
--- kernel/events/uprobes.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
kernel/events/uprobes.c +5 -5
@@ -330,7 +330,7 @@ int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, unsignedint __weak set_orig_insn (struct arch_uprobe *auprobe,struct mm_struct *mm,unsigned long vaddr) { -return uprobe_write_opcode (mm, vaddr, *(uprobe_opcode_t *)auprobe->insn); +return uprobe_write_opcode (mm, vaddr, *(uprobe_opcode_t *)&auprobe->insn); }static int match_uprobe (struct uprobe *l,struct uprobe *r)
@@ -529,8 +529,8 @@ static int copy_insn(struct uprobe *uprobe, struct file *filp) {struct address_space *mapping = uprobe->inode->i_mapping;loff_t offs = uprobe->offset; -void *insn = uprobe->arch.insn; -int size =MAX_UINSN_BYTES ; +void *insn = &uprobe->arch.insn; +int size =sizeof (uprobe->arch.insn);int len, err = -EIO ;/* Copy only available bytes, -EIO if nothing was read */
@@ -569,7 +569,7 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file, goto out; ret = -ENOTSUPP ; -if (is_trap_insn ((uprobe_opcode_t *)uprobe->arch.insn)) +if (is_trap_insn ((uprobe_opcode_t *)&uprobe->arch.insn)) goto out; ret =arch_uprobe_analyze_insn (&uprobe->arch, mm, vaddr);
@@ -1264,7 +1264,7 @@ static unsigned long xol_get_insn_slot(struct uprobe *uprobe)/* Initialize the slot */ copy_to_page (area->page, xol_vaddr, - uprobe->arch.ixol,sizeof (uprobe->arch.ixol)); + &uprobe->arch.ixol,sizeof (uprobe->arch.ixol));/* * We probably need flush_icache_user_range() but it needs vma. * This should work on supported architectures too.
Signature · 1 line
1.5.5.1
Oleg Nesterov
maintainerPATCH 2/2 uprobes/powerpc: Kill arch_uprobe->ainsn
In reply to Oleg Nesterovpowerpc has both arch_uprobe->insn and arch_uprobe->ainsn to make the generic code happy. This is no longer needed after the previous change, powerpc can just use "u32 insn".
--- arch/powerpc/include/asm/uprobes.h | 5 ++--- arch/powerpc/kernel/uprobes.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/uprobes.h +2 -3
@@ -36,9 +36,8 @@ typedef ppc_opcode_t uprobe_opcode_t;struct arch_uprobe {union { -u8 insn[MAX_UINSN_BYTES ]; -u8 ixol[MAX_UINSN_BYTES ]; -u32 ainsn; +u32 insn; +u32 ixol; }; };
arch/powerpc/kernel/uprobes.c +1 -1
@@ -186,7 +186,7 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)* emulate_step() returns 1 if the insn was successfully emulated. * For all other cases, we need to single-step in hardware. */ - ret =emulate_step (regs, auprobe->ainsn); + ret =emulate_step (regs, auprobe->insn);if (ret >0 )return true;
Signature · 1 line
1.5.5.1
Re: [PATCH 2/2] uprobes/powerpc: Kill arch_uprobe->ainsn
Quoted 5 lines · Oleg Nesterov
powerpc has both
arch_uprobe->insnandarch_uprobe->ainsnto make the generic code happy. This is no longer needed after the previous change, powerpc can just use "u32 insn".Signed-off-by Oleg Nesterov <[email protected]>
Re: [PATCH 1/2] uprobes: Don't assume that arch_uprobe->insn/ixol is u8[MAX_UINSN_BYTES]
In reply to Oleg NesterovQuoted 6 lines · Oleg Nesterov
arch_uprobeshould be opaque as much as possible to the generic code, but currently it assumes that insn/ixol must be u8[] of the known size. Remove this unnecessary dependency, we can use "&" and andsizeof()with the same effect.Signed-off-by Oleg Nesterov <[email protected]>
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
Re: [PATCH 2/2] uprobes/powerpc: Kill arch_uprobe->ainsn
In reply to Oleg NesterovQuoted 31 lines · Oleg Nesterov
powerpc has both
arch_uprobe->insnandarch_uprobe->ainsnto make the generic code happy. This is no longer needed after the previous change, powerpc can just use "u32 insn".Signed-off-by Oleg Nesterov <[email protected]>--- arch/powerpc/include/asm/uprobes.h | 5 ++--- arch/powerpc/kernel/uprobes.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-)arch/powerpc/include/asm/uprobes.h +2
-3@@ -36,9 +36,8 @@ typedef ppc_opcode_t uprobe_opcode_t;struct arch_uprobe {union { -u8 insn[MAX_UINSN_BYTES ]; -u8 ixol[MAX_UINSN_BYTES ]; -u32 ainsn; +u32 insn; +u32 ixol; }; };arch/powerpc/kernel/uprobes.c +0
-0
arch/powerpc/kernel/uprobes.c bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) · line 191
Quoted 7 lines
arch/powerpc/kernel/uprobes.c +1
-1@@ -186,7 +186,7 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)* emulate_step() returns 1 if the insn was successfully emulated. * For all other cases, we need to single-step in hardware. */ - ret =emulate_step (regs, auprobe->ainsn); + ret =emulate_step (regs, auprobe->insn);if (ret >0 )return true;
Thanks Oleg.
Ananth
Quoted 6 lines · Oleg Nesterov
Hello.
Ananth, could you please explicitly ack or nack 2/2 ? It is really simple, but obviously I can't test it. And even if it is correct it should be merged only if you like it, this is the minor cleanup.
The changes look good and I have acked it.
Thanks Oleg!
Ananth