Commit 2273d5cc authored by Linus Torvalds's avatar Linus Torvalds

Merge branches 'core-urgent-for-linus', 'perf-urgent-for-linus' and...

Merge branches 'core-urgent-for-linus', 'perf-urgent-for-linus' and 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pulling latest branches from Ingo:

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  memblock: Fix size aligning of memblock_alloc_base_nid()

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf probe: Ensure offset provided is not greater than function length without DWARF info too
  perf tools: Ensure comm string is properly terminated
  perf probe: Ensure offset provided is not greater than function length
  perf evlist: Return first evsel for non-sample event on old kernel
  perf/hwbp: Fix a possible memory leak

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  CPU hotplug, cpusets, suspend: Don't touch cpusets during suspend/resume
...@@ -651,10 +651,10 @@ int __init init_hw_breakpoint(void) ...@@ -651,10 +651,10 @@ int __init init_hw_breakpoint(void)
err_alloc: err_alloc:
for_each_possible_cpu(err_cpu) { for_each_possible_cpu(err_cpu) {
if (err_cpu == cpu)
break;
for (i = 0; i < TYPE_MAX; i++) for (i = 0; i < TYPE_MAX; i++)
kfree(per_cpu(nr_task_bp_pinned[i], cpu)); kfree(per_cpu(nr_task_bp_pinned[i], cpu));
if (err_cpu == cpu)
break;
} }
return -ENOMEM; return -ENOMEM;
......
...@@ -6728,7 +6728,7 @@ int __init sched_create_sysfs_power_savings_entries(struct device *dev) ...@@ -6728,7 +6728,7 @@ int __init sched_create_sysfs_power_savings_entries(struct device *dev)
static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action, static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
void *hcpu) void *hcpu)
{ {
switch (action & ~CPU_TASKS_FROZEN) { switch (action) {
case CPU_ONLINE: case CPU_ONLINE:
case CPU_DOWN_FAILED: case CPU_DOWN_FAILED:
cpuset_update_active_cpus(); cpuset_update_active_cpus();
...@@ -6741,7 +6741,7 @@ static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action, ...@@ -6741,7 +6741,7 @@ static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action, static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
void *hcpu) void *hcpu)
{ {
switch (action & ~CPU_TASKS_FROZEN) { switch (action) {
case CPU_DOWN_PREPARE: case CPU_DOWN_PREPARE:
cpuset_update_active_cpus(); cpuset_update_active_cpus();
return NOTIFY_OK; return NOTIFY_OK;
......
...@@ -99,9 +99,6 @@ phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t start, ...@@ -99,9 +99,6 @@ phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t start,
phys_addr_t this_start, this_end, cand; phys_addr_t this_start, this_end, cand;
u64 i; u64 i;
/* align @size to avoid excessive fragmentation on reserved array */
size = round_up(size, align);
/* pump up @end */ /* pump up @end */
if (end == MEMBLOCK_ALLOC_ACCESSIBLE) if (end == MEMBLOCK_ALLOC_ACCESSIBLE)
end = memblock.current_limit; end = memblock.current_limit;
...@@ -731,6 +728,9 @@ static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size, ...@@ -731,6 +728,9 @@ static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
{ {
phys_addr_t found; phys_addr_t found;
/* align @size to avoid excessive fragmentation on reserved array */
size = round_up(size, align);
found = memblock_find_in_range_node(0, max_addr, size, align, nid); found = memblock_find_in_range_node(0, max_addr, size, align, nid);
if (found && !memblock_reserve(found, size)) if (found && !memblock_reserve(found, size))
return found; return found;
......
...@@ -74,6 +74,7 @@ static pid_t perf_event__get_comm_tgid(pid_t pid, char *comm, size_t len) ...@@ -74,6 +74,7 @@ static pid_t perf_event__get_comm_tgid(pid_t pid, char *comm, size_t len)
if (size >= len) if (size >= len)
size = len - 1; size = len - 1;
memcpy(comm, name, size); memcpy(comm, name, size);
comm[size] = '\0';
} else if (memcmp(bf, "Tgid:", 5) == 0) { } else if (memcmp(bf, "Tgid:", 5) == 0) {
char *tgids = bf + 5; char *tgids = bf + 5;
......
...@@ -349,6 +349,10 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id) ...@@ -349,6 +349,10 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
hlist_for_each_entry(sid, pos, head, node) hlist_for_each_entry(sid, pos, head, node)
if (sid->id == id) if (sid->id == id)
return sid->evsel; return sid->evsel;
if (!perf_evlist__sample_id_all(evlist))
return list_entry(evlist->entries.next, struct perf_evsel, node);
return NULL; return NULL;
} }
......
...@@ -1867,6 +1867,12 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev, ...@@ -1867,6 +1867,12 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
tev->point.symbol); tev->point.symbol);
ret = -ENOENT; ret = -ENOENT;
goto error; goto error;
} else if (tev->point.offset > sym->end - sym->start) {
pr_warning("Offset specified is greater than size of %s\n",
tev->point.symbol);
ret = -ENOENT;
goto error;
} }
return 1; return 1;
......
...@@ -672,7 +672,7 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf) ...@@ -672,7 +672,7 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf)
static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr, static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr,
bool retprobe, struct probe_trace_point *tp) bool retprobe, struct probe_trace_point *tp)
{ {
Dwarf_Addr eaddr; Dwarf_Addr eaddr, highaddr;
const char *name; const char *name;
/* Copy the name of probe point */ /* Copy the name of probe point */
...@@ -683,6 +683,16 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr, ...@@ -683,6 +683,16 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr,
dwarf_diename(sp_die)); dwarf_diename(sp_die));
return -ENOENT; return -ENOENT;
} }
if (dwarf_highpc(sp_die, &highaddr) != 0) {
pr_warning("Failed to get end address of %s\n",
dwarf_diename(sp_die));
return -ENOENT;
}
if (paddr > highaddr) {
pr_warning("Offset specified is greater than size of %s\n",
dwarf_diename(sp_die));
return -EINVAL;
}
tp->symbol = strdup(name); tp->symbol = strdup(name);
if (tp->symbol == NULL) if (tp->symbol == NULL)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment