Skip to content

Commit bf40f4b

Browse files
committed
Merge tag 'probes-fixes-v6.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull probes fixes from Masami Hiramatsu: - fprobe: Even if there is a memory allocation failure, try to remove the addresses recorded until then from the filter. Previously we just skipped it. - tracing: dynevent: Add a missing lockdown check on dynevent. This dynevent is the interface for all probe events. Thus if there is no check, any probe events can be added after lock down the tracefs. * tag 'probes-fixes-v6.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tracing: dynevent: Add a missing lockdown check on dynevent tracing: fprobe: Fix to remove recorded module addresses from filter
2 parents d0ca0df + 456c32e commit bf40f4b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

kernel/trace/fprobe.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,9 @@ static int fprobe_addr_list_add(struct fprobe_addr_list *alist, unsigned long ad
428428
{
429429
unsigned long *addrs;
430430

431-
if (alist->index >= alist->size)
432-
return -ENOMEM;
431+
/* Previously we failed to expand the list. */
432+
if (alist->index == alist->size)
433+
return -ENOSPC;
433434

434435
alist->addrs[alist->index++] = addr;
435436
if (alist->index < alist->size)
@@ -489,7 +490,7 @@ static int fprobe_module_callback(struct notifier_block *nb,
489490
for (i = 0; i < FPROBE_IP_TABLE_SIZE; i++)
490491
fprobe_remove_node_in_module(mod, &fprobe_ip_table[i], &alist);
491492

492-
if (alist.index < alist.size && alist.index > 0)
493+
if (alist.index > 0)
493494
ftrace_set_filter_ips(&fprobe_graph_ops.ops,
494495
alist.addrs, alist.index, 1, 0);
495496
mutex_unlock(&fprobe_mutex);

kernel/trace/trace_dynevent.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ static int dyn_event_open(struct inode *inode, struct file *file)
230230
{
231231
int ret;
232232

233+
ret = security_locked_down(LOCKDOWN_TRACEFS);
234+
if (ret)
235+
return ret;
236+
233237
ret = tracing_check_open_get_tr(NULL);
234238
if (ret)
235239
return ret;

0 commit comments

Comments
 (0)