lkml.org 
[lkml]   [2020]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v4 19/23] kprobes: Remove kretprobe hash
Date

> -----Original Message-----
> From: Masami Hiramatsu <mhiramat@kernel.org>
>
> @@ -1311,24 +1257,23 @@ void kprobe_busy_end(void)
> void kprobe_flush_task(struct task_struct *tk)
> {
> struct kretprobe_instance *ri;
> - struct hlist_head *head;
> - struct hlist_node *tmp;
> - unsigned long hash, flags = 0;
> + struct llist_node *node;
>
> + /* Early boot, not yet initialized. */
> if (unlikely(!kprobes_initialized))
> - /* Early boot. kretprobe_table_locks not yet initialized. */
> return;
>
> kprobe_busy_begin();
>
> - hash = hash_ptr(tk, KPROBE_HASH_BITS);
> - head = &kretprobe_inst_table[hash];
> - kretprobe_table_lock(hash, &flags);
> - hlist_for_each_entry_safe(ri, tmp, head, hlist) {
> - if (ri->task == tk)
> - recycle_rp_inst(ri);
> + node = current->kretprobe_instances.first;
> + current->kretprobe_instances.first = NULL;

I think we are flushing tk instead of current here.
After fixing this to tk, the NULL pointer deference is gone!

> +
> + while (node) {
> + ri = container_of(node, struct kretprobe_instance, llist);
> + node = node->next;
> +
> + recycle_rp_inst(ri);
> }
> - kretprobe_table_unlock(hash, &flags);
>
> kprobe_busy_end();
> }

TREND MICRO EMAIL NOTICE

The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system.

For details about what personal information we collect and why, please see our Privacy Notice on our website at: Read privacy policy<http://www.trendmicro.com/privacy>
\
 
 \ /
  Last update: 2020-08-28 21:32    [W:0.113 / U:0.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site