On 13.05.25 17:46, Oleg Nesterov wrote:
On 05/13, Jiri Olsa wrote:
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -581,8 +581,8 @@ int uprobe_write_opcode(struct arch_uprobe *auprobe, struct
vm_area_struct *vma,
out:
/* Revert back reference counter if instruction update failed. */
- if (ret < 0 && is_register && ref_ctr_updated)
- update_ref_ctr(uprobe, mm, -1);
+ if (ret < 0 && ref_ctr_updated)
+ update_ref_ctr(uprobe, mm, is_register ? -1 : 1);
Acked-by: Oleg Nesterov <[email protected]>
And just in case, I agree this has nothing to do with the recent changes from
David.
BTW, I stumbled over this when doing the rework.
Back then, I was wondering if this is to handle the case where
un-registering effectively fails because someone MADV_DONTNEED'ed the page.
But, we only perform the update_ref_ctr() after verify_opcode(), so that
does not apply.
With proper Fixes:
Acked-by: David Hildenbrand <[email protected]>
--
Cheers,
David / dhildenb