提交 3f47107c 编写于 作者: O Oleg Nesterov

uprobes: Change write_opcode() to use copy_*page()

Change write_opcode() to use copy_highpage() + copy_to_page()
and simplify the code.
Signed-off-by: NOleg Nesterov <oleg@redhat.com>
Acked-by: NAnton Arapov <anton@redhat.com>
Acked-by: NSrikar Dronamraju <srikar@linux.vnet.ibm.com>
上级 5669ccee
...@@ -255,7 +255,6 @@ static int write_opcode(struct mm_struct *mm, unsigned long vaddr, ...@@ -255,7 +255,6 @@ static int write_opcode(struct mm_struct *mm, unsigned long vaddr,
uprobe_opcode_t opcode) uprobe_opcode_t opcode)
{ {
struct page *old_page, *new_page; struct page *old_page, *new_page;
void *vaddr_old, *vaddr_new;
struct vm_area_struct *vma; struct vm_area_struct *vma;
int ret; int ret;
...@@ -276,15 +275,8 @@ static int write_opcode(struct mm_struct *mm, unsigned long vaddr, ...@@ -276,15 +275,8 @@ static int write_opcode(struct mm_struct *mm, unsigned long vaddr,
__SetPageUptodate(new_page); __SetPageUptodate(new_page);
/* copy the page now that we've got it stable */ copy_highpage(new_page, old_page);
vaddr_old = kmap_atomic(old_page); copy_to_page(new_page, vaddr, &opcode, UPROBE_SWBP_INSN_SIZE);
vaddr_new = kmap_atomic(new_page);
memcpy(vaddr_new, vaddr_old, PAGE_SIZE);
memcpy(vaddr_new + (vaddr & ~PAGE_MASK), &opcode, UPROBE_SWBP_INSN_SIZE);
kunmap_atomic(vaddr_new);
kunmap_atomic(vaddr_old);
ret = anon_vma_prepare(vma); ret = anon_vma_prepare(vma);
if (ret) if (ret)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册