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. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
This commit is contained in:
parent
3247343118
commit
803200e24a
1 changed files with 5 additions and 5 deletions
|
@ -330,7 +330,7 @@ int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned
|
||||||
int __weak
|
int __weak
|
||||||
set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr)
|
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)
|
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;
|
struct address_space *mapping = uprobe->inode->i_mapping;
|
||||||
loff_t offs = uprobe->offset;
|
loff_t offs = uprobe->offset;
|
||||||
void *insn = uprobe->arch.insn;
|
void *insn = &uprobe->arch.insn;
|
||||||
int size = MAX_UINSN_BYTES;
|
int size = sizeof(uprobe->arch.insn);
|
||||||
int len, err = -EIO;
|
int len, err = -EIO;
|
||||||
|
|
||||||
/* Copy only available bytes, -EIO if nothing was read */
|
/* 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;
|
goto out;
|
||||||
|
|
||||||
ret = -ENOTSUPP;
|
ret = -ENOTSUPP;
|
||||||
if (is_trap_insn((uprobe_opcode_t *)uprobe->arch.insn))
|
if (is_trap_insn((uprobe_opcode_t *)&uprobe->arch.insn))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = arch_uprobe_analyze_insn(&uprobe->arch, mm, vaddr);
|
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 */
|
/* Initialize the slot */
|
||||||
copy_to_page(area->page, xol_vaddr,
|
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.
|
* We probably need flush_icache_user_range() but it needs vma.
|
||||||
* This should work on supported architectures too.
|
* This should work on supported architectures too.
|
||||||
|
|
Loading…
Reference in a new issue