History

Merge tag 'noinstr-x86-kvm-2020-05-16' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into HEAD

Paolo Bonzini committed 6 years ago

Commit 9d5272f2 parents febd668 3a7c8fa868 files · +8779 −4517Browse files

Showing the changes to kernel (21 of 868 files). Show all

Unified · Split

21 files
  1. kernel/audit.c +3 −0
  2. kernel/bpf/cpumap.c +1 −1
  3. kernel/bpf/syscall.c +10 −3
  4. kernel/bpf/verifier.c +28 −10
  5. kernel/events/core.c +10 −3
  6. kernel/exit.c +1 −0
  7. kernel/kcov.c +2 −2
  8. kernel/locking/lockdep.c +65 −21
  9. kernel/power/hibernate.c +7 −0
  10. kernel/sched/core.c +2 −7
  11. kernel/signal.c +5 −1
  12. kernel/trace/Kconfig +0 −1
  13. kernel/trace/ftrace.c +1 −0
  14. kernel/trace/preemptirq_delay_test.c +24 −6
  15. kernel/trace/trace.c +15 −1
  16. kernel/trace/trace_boot.c +8 −12
  17. kernel/trace/trace_events_hist.c +7 −0
  18. kernel/trace/trace_kprobe.c +7 −1
  19. kernel/trace/trace_preemptirq.c +39 −0
  20. kernel/trace/tracing_map.c +3 −3
  21. kernel/umh.c +5 −0
kernel/audit.c+3−0
@@ -1326,6 +1326,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 1325 unmodified lines
13261326 case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2:
13271327 if (!audit_enabled && msg_type != AUDIT_USER_AVC)
13281328 return 0;
1329+ /* exit early if there isn't at least one character to print */
1330+ if (data_len < 2)
1331+ return -EINVAL;
13291332
13301333 err = audit_filter(msg_type, AUDIT_FILTER_USER);
13311334 if (err == 1) { /* match or error */
kernel/bpf/cpumap.c+1−1
@@ -469,7 +469,7 @@ static int cpu_map_update_elem(struct bpf_map *map, void *key, void *value, · 468 unmodified lines
469469 return -EOVERFLOW;
470470
471471 /* Make sure CPU is a valid possible cpu */
472− if (!cpu_possible(key_cpu))
472+ if (key_cpu >= nr_cpumask_bits || !cpu_possible(key_cpu))
473473 return -ENODEV;
474474
475475 if (qsize == 0) {
kernel/bpf/syscall.c+10−3
@@ -2283,7 +2283,7 @@ static void bpf_link_show_fdinfo(struct seq_file *m, struct file *filp) · 2282 unmodified lines
22832283 }
22842284 #endif
22852285
2286−const struct file_operations bpf_link_fops = {
2286+static const struct file_operations bpf_link_fops = {
22872287 #ifdef CONFIG_PROC_FS
22882288 .show_fdinfo = bpf_link_show_fdinfo,
22892289 #endif
@@ -3628,8 +3628,10 @@ static int link_update(union bpf_attr *attr) · 1338 unmodified lines
36283628 return PTR_ERR(link);
36293629
36303630 new_prog = bpf_prog_get(attr->link_update.new_prog_fd);
3631− if (IS_ERR(new_prog))
3632− return PTR_ERR(new_prog);
3631+ if (IS_ERR(new_prog)) {
3632+ ret = PTR_ERR(new_prog);
3633+ goto out_put_link;
3634+ }
36333635
36343636 if (flags & BPF_F_REPLACE) {
36353637 old_prog = bpf_prog_get(attr->link_update.old_prog_fd);
@@ -3638,6 +3640,9 @@ static int link_update(union bpf_attr *attr) · 2 unmodified lines
36383640 old_prog = NULL;
36393641 goto out_put_progs;
36403642 }
3643+ } else if (attr->link_update.old_prog_fd) {
3644+ ret = -EINVAL;
3645+ goto out_put_progs;
36413646 }
36423647
36433648 #ifdef CONFIG_CGROUP_BPF
@@ -3653,6 +3658,8 @@ out_put_progs: · 9 unmodified lines
36533658 bpf_prog_put(old_prog);
36543659 if (ret)
36553660 bpf_prog_put(new_prog);
3661+out_put_link:
3662+ bpf_link_put(link);
36563663 return ret;
36573664 }
36583665
kernel/bpf/verifier.c+28−10
@@ -2118,6 +2118,15 @@ static bool register_is_const(struct bpf_reg_state *reg) · 2117 unmodified lines
21182118 return reg->type == SCALAR_VALUE && tnum_is_const(reg->var_off);
21192119 }
21202120
2121+static bool __is_pointer_value(bool allow_ptr_leaks,
2122+ const struct bpf_reg_state *reg)
2123+{
2124+ if (allow_ptr_leaks)
2125+ return false;
2126+
2127+ return reg->type != SCALAR_VALUE;
2128+}
2129+
21212130 static void save_register_state(struct bpf_func_state *state,
21222131 int spi, struct bpf_reg_state *reg)
21232132 {
@@ -2308,6 +2317,16 @@ static int check_stack_read(struct bpf_verifier_env *env, · 184 unmodified lines
23082317 * which resets stack/reg liveness for state transitions
23092318 */
23102319 state->regs[value_regno].live |= REG_LIVE_WRITTEN;
2320+ } else if (__is_pointer_value(env->allow_ptr_leaks, reg)) {
2321+ /* If value_regno==-1, the caller is asking us whether
2322+ * it is acceptable to use this value as a SCALAR_VALUE
2323+ * (e.g. for XADD).
2324+ * We must not allow unprivileged callers to do that
2325+ * with spilled pointers.
2326+ */
2327+ verbose(env, "leaking pointer from stack off %d\n",
2328+ off);
2329+ return -EACCES;
23112330 }
23122331 mark_reg_read(env, reg, reg->parent, REG_LIVE_READ64);
23132332 } else {
@@ -2673,15 +2692,6 @@ static int check_sock_access(struct bpf_verifier_env *env, int insn_idx, · 359 unmodified lines
26732692 return -EACCES;
26742693 }
26752694
2676−static bool __is_pointer_value(bool allow_ptr_leaks,
2677− const struct bpf_reg_state *reg)
2678−{
2679− if (allow_ptr_leaks)
2680− return false;
2681−
2682− return reg->type != SCALAR_VALUE;
2683−}
2684−
26852695 static struct bpf_reg_state *reg_state(struct bpf_verifier_env *env, int regno)
26862696 {
26872697 return cur_regs(env) + regno;
@@ -3089,7 +3099,7 @@ static int check_ptr_to_btf_access(struct bpf_verifier_env *env, · 401 unmodified lines
30893099 if (ret < 0)
30903100 return ret;
30913101
3092− if (atype == BPF_READ) {
3102+ if (atype == BPF_READ && value_regno >= 0) {
30933103 if (ret == SCALAR_VALUE) {
30943104 mark_reg_unknown(env, regs, value_regno);
30953105 return 0;
@@ -10487,6 +10497,7 @@ static int check_attach_btf_id(struct bpf_verifier_env *env) · 7391 unmodified lines
1048710497 return -EINVAL;
1048810498 }
1048910499 env->ops = bpf_verifier_ops[tgt_prog->type];
10500+ prog->expected_attach_type = tgt_prog->expected_attach_type;
1049010501 }
1049110502 if (!tgt_prog->jited) {
1049210503 verbose(env, "Can attach to only JITed progs\n");
@@ -10831,6 +10842,13 @@ err_release_maps: · 338 unmodified lines
1083110842 * them now. Otherwise free_used_maps() will release them.
1083210843 */
1083310844 release_maps(env);
10845+
10846+ /* extension progs temporarily inherit the attach_type of their targets
10847+ for verification purposes, so set it back to zero before returning
10848+ */
10849+ if (env->prog->type == BPF_PROG_TYPE_EXT)
10850+ env->prog->expected_attach_type = 0;
10851+
1083410852 *prog = env->prog;
1083510853 err_unlock:
1083610854 if (!is_priv)
kernel/events/core.c+10−3
@@ -7491,10 +7491,17 @@ static void perf_event_task_output(struct perf_event *event, · 7490 unmodified lines
74917491 goto out;
74927492
74937493 task_event->event_id.pid = perf_event_pid(event, task);
7494− task_event->event_id.ppid = perf_event_pid(event, current);
7495−
74967494 task_event->event_id.tid = perf_event_tid(event, task);
7497− task_event->event_id.ptid = perf_event_tid(event, current);
7495+
7496+ if (task_event->event_id.header.type == PERF_RECORD_EXIT) {
7497+ task_event->event_id.ppid = perf_event_pid(event,
7498+ task->real_parent);
7499+ task_event->event_id.ptid = perf_event_pid(event,
7500+ task->real_parent);
7501+ } else { /* PERF_RECORD_FORK */
7502+ task_event->event_id.ppid = perf_event_pid(event, current);
7503+ task_event->event_id.ptid = perf_event_tid(event, current);
7504+ }
74987505
74997506 task_event->event_id.time = perf_event_clock(event);
75007507
kernel/exit.c+1−0
@@ -219,6 +219,7 @@ repeat: · 218 unmodified lines
219219
220220 write_unlock_irq(&tasklist_lock);
221221 proc_flush_pid(thread_pid);
222+ put_pid(thread_pid);
222223 release_thread(p);
223224 put_task_struct_rcu_user(p);
224225
kernel/kcov.c+2−2
@@ -740,8 +740,8 @@ static const struct file_operations kcov_fops = { · 739 unmodified lines
740740 * kcov_remote_handle() with KCOV_SUBSYSTEM_COMMON as the subsystem id and an
741741 * arbitrary 4-byte non-zero number as the instance id). This common handle
742742 * then gets saved into the task_struct of the process that issued the
743− * KCOV_REMOTE_ENABLE ioctl. When this proccess issues system calls that spawn
744− * kernel threads, the common handle must be retrived via kcov_common_handle()
743+ * KCOV_REMOTE_ENABLE ioctl. When this process issues system calls that spawn
744+ * kernel threads, the common handle must be retrieved via kcov_common_handle()
745745 * and passed to the spawned threads via custom annotations. Those kernel
746746 * threads must in turn be annotated with kcov_remote_start(common_handle) and
747747 * kcov_remote_stop(). All of the threads that are spawned by the same process
kernel/locking/lockdep.c+65−21
@@ -3635,13 +3635,10 @@ mark_held_locks(struct task_struct *curr, enum lock_usage_bit base_bit) · 3634 unmodified lines
36353635 /*
36363636 * Hardirqs will be enabled:
36373637 */
3638−static void __trace_hardirqs_on_caller(unsigned long ip)
3638+static void __trace_hardirqs_on_caller(void)
36393639 {
36403640 struct task_struct *curr = current;
36413641
3642− /* we'll do an OFF -> ON transition: */
3643− curr->hardirqs_enabled = 1;
3644−
36453642 /*
36463643 * We are going to turn hardirqs on, so set the
36473644 * usage bit for all held locks:
@@ -3654,15 +3651,19 @@ static void __trace_hardirqs_on_caller(unsigned long ip) · 6 unmodified lines
36543651 * this bit from being set before)
36553652 */
36563653 if (curr->softirqs_enabled)
3657− if (!mark_held_locks(curr, LOCK_ENABLED_SOFTIRQ))
3658− return;
3659−
3660− curr->hardirq_enable_ip = ip;
3661− curr->hardirq_enable_event = ++curr->irq_events;
3662− debug_atomic_inc(hardirqs_on_events);
3654+ mark_held_locks(curr, LOCK_ENABLED_SOFTIRQ);
36633655 }
36643656
3665−void lockdep_hardirqs_on(unsigned long ip)
3657+/**
3658+ * lockdep_hardirqs_on_prepare - Prepare for enabling interrupts
3659+ * @ip: Caller address
3660+ *
3661+ * Invoked before a possible transition to RCU idle from exit to user or
3662+ * guest mode. This ensures that all RCU operations are done before RCU
3663+ * stops watching. After the RCU transition lockdep_hardirqs_on() has to be
3664+ * invoked to set the final state.
3665+ */
3666+void lockdep_hardirqs_on_prepare(unsigned long ip)
36663667 {
36673668 if (unlikely(!debug_locks || current->lockdep_recursion))
36683669 return;
@@ -3698,20 +3699,62 @@ void lockdep_hardirqs_on(unsigned long ip) · 29 unmodified lines
36983699 if (DEBUG_LOCKS_WARN_ON(current->hardirq_context))
36993700 return;
37003701
3702+ current->hardirq_chain_key = current->curr_chain_key;
3703+
37013704 current->lockdep_recursion++;
3702− __trace_hardirqs_on_caller(ip);
3705+ __trace_hardirqs_on_caller();
37033706 lockdep_recursion_finish();
37043707 }
3705−NOKPROBE_SYMBOL(lockdep_hardirqs_on);
3708+EXPORT_SYMBOL_GPL(lockdep_hardirqs_on_prepare);
3709+
3710+void noinstr lockdep_hardirqs_on(unsigned long ip)
3711+{
3712+ struct task_struct *curr = current;
3713+
3714+ if (unlikely(!debug_locks || curr->lockdep_recursion))
3715+ return;
3716+
3717+ if (curr->hardirqs_enabled) {
3718+ /*
3719+ * Neither irq nor preemption are disabled here
3720+ * so this is racy by nature but losing one hit
3721+ * in a stat is not a big deal.
3722+ */
3723+ __debug_atomic_inc(redundant_hardirqs_on);
3724+ return;
3725+ }
3726+
3727+ /*
3728+ * We're enabling irqs and according to our state above irqs weren't
3729+ * already enabled, yet we find the hardware thinks they are in fact
3730+ * enabled.. someone messed up their IRQ state tracing.
3731+ */
3732+ if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
3733+ return;
3734+
3735+ /*
3736+ * Ensure the lock stack remained unchanged between
3737+ * lockdep_hardirqs_on_prepare() and lockdep_hardirqs_on().
3738+ */
3739+ DEBUG_LOCKS_WARN_ON(current->hardirq_chain_key !=
3740+ current->curr_chain_key);
3741+
3742+ /* we'll do an OFF -> ON transition: */
3743+ curr->hardirqs_enabled = 1;
3744+ curr->hardirq_enable_ip = ip;
3745+ curr->hardirq_enable_event = ++curr->irq_events;
3746+ debug_atomic_inc(hardirqs_on_events);
3747+}
3748+EXPORT_SYMBOL_GPL(lockdep_hardirqs_on);
37063749
37073750 /*
37083751 * Hardirqs were disabled:
37093752 */
3710−void lockdep_hardirqs_off(unsigned long ip)
3753+void noinstr lockdep_hardirqs_off(unsigned long ip)
37113754 {
37123755 struct task_struct *curr = current;
37133756
3714− if (unlikely(!debug_locks || current->lockdep_recursion))
3757+ if (unlikely(!debug_locks || curr->lockdep_recursion))
37153758 return;
37163759
37173760 /*
@@ -3729,10 +3772,11 @@ void lockdep_hardirqs_off(unsigned long ip) · 11 unmodified lines
37293772 curr->hardirq_disable_ip = ip;
37303773 curr->hardirq_disable_event = ++curr->irq_events;
37313774 debug_atomic_inc(hardirqs_off_events);
3732− } else
3775+ } else {
37333776 debug_atomic_inc(redundant_hardirqs_off);
3777+ }
37343778 }
3735−NOKPROBE_SYMBOL(lockdep_hardirqs_off);
3779+EXPORT_SYMBOL_GPL(lockdep_hardirqs_off);
37363780
37373781 /*
37383782 * Softirqs will be enabled:
@@ -4408,8 +4452,8 @@ static void print_unlock_imbalance_bug(struct task_struct *curr, · 669 unmodified lines
44084452 dump_stack();
44094453 }
44104454
4411−static int match_held_lock(const struct held_lock *hlock,
4412− const struct lockdep_map *lock)
4455+static noinstr int match_held_lock(const struct held_lock *hlock,
4456+ const struct lockdep_map *lock)
44134457 {
44144458 if (hlock->instance == lock)
44154459 return 1;
@@ -4696,7 +4740,7 @@ __lock_release(struct lockdep_map *lock, unsigned long ip) · 280 unmodified lines
46964740 return 0;
46974741 }
46984742
4699−static nokprobe_inline
4743+static __always_inline
47004744 int __lock_is_held(const struct lockdep_map *lock, int read)
47014745 {
47024746 struct task_struct *curr = current;
@@ -4956,7 +5000,7 @@ void lock_release(struct lockdep_map *lock, unsigned long ip) · 253 unmodified lines
49565000 }
49575001 EXPORT_SYMBOL_GPL(lock_release);
49585002
4959−int lock_is_held_type(const struct lockdep_map *lock, int read)
5003+noinstr int lock_is_held_type(const struct lockdep_map *lock, int read)
49605004 {
49615005 unsigned long flags;
49625006 int ret = 0;
kernel/power/hibernate.c+7−0
@@ -898,6 +898,13 @@ static int software_resume(void) · 897 unmodified lines
898898 error = freeze_processes();
899899 if (error)
900900 goto Close_Finish;
901+
902+ error = freeze_kernel_threads();
903+ if (error) {
904+ thaw_processes();
905+ goto Close_Finish;
906+ }
907+
901908 error = load_image_and_restore();
902909 thaw_processes();
903910 Finish:
kernel/sched/core.c+2−7
@@ -1232,13 +1232,8 @@ static void uclamp_fork(struct task_struct *p) · 1231 unmodified lines
12321232 return;
12331233
12341234 for_each_clamp_id(clamp_id) {
1235− unsigned int clamp_value = uclamp_none(clamp_id);
1236−
1237− /* By default, RT tasks always get 100% boost */
1238− if (unlikely(rt_task(p) && clamp_id == UCLAMP_MIN))
1239− clamp_value = uclamp_none(UCLAMP_MAX);
1240−
1241− uclamp_se_set(&p->uclamp_req[clamp_id], clamp_value, false);
1235+ uclamp_se_set(&p->uclamp_req[clamp_id],
1236+ uclamp_none(clamp_id), false);
12421237 }
12431238 }
12441239
kernel/signal.c+5−1
@@ -1989,8 +1989,12 @@ bool do_notify_parent(struct task_struct *tsk, int sig) · 1988 unmodified lines
19891989 if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN)
19901990 sig = 0;
19911991 }
1992+ /*
1993+ * Send with __send_signal as si_pid and si_uid are in the
1994+ * parent's namespaces.
1995+ */
19921996 if (valid_signal(sig) && sig)
1993− __group_send_sig_info(sig, &info, tsk->parent);
1997+ __send_signal(sig, &info, tsk->parent, PIDTYPE_TGID, false);
19941998 __wake_up_parent(tsk, tsk->parent);
19951999 spin_unlock_irqrestore(&psig->siglock, flags);
19962000
kernel/trace/Kconfig+0−1
@@ -466,7 +466,6 @@ config PROFILE_ANNOTATED_BRANCHES · 465 unmodified lines
466466 config PROFILE_ALL_BRANCHES
467467 bool "Profile all if conditionals" if !FORTIFY_SOURCE
468468 select TRACE_BRANCH_PROFILING
469− imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives
470469 help
471470 This tracer profiles all branch conditions. Every if ()
472471 taken in the kernel is recorded whether it hit or miss.
kernel/trace/ftrace.c+1−0
@@ -5165,6 +5165,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr) · 5164 unmodified lines
51655165 list_del_rcu(&direct->next);
51665166 synchronize_rcu_tasks();
51675167 kfree(direct);
5168+ kfree(entry);
51685169 ftrace_direct_func_count--;
51695170 }
51705171 }
kernel/trace/preemptirq_delay_test.c+24−6
@@ -113,22 +113,42 @@ static int preemptirq_delay_run(void *data) · 112 unmodified lines
113113
114114 for (i = 0; i < s; i++)
115115 (testfuncs[i])(i);
116+
117+ set_current_state(TASK_INTERRUPTIBLE);
118+ while (!kthread_should_stop()) {
119+ schedule();
120+ set_current_state(TASK_INTERRUPTIBLE);
121+ }
122+
123+ __set_current_state(TASK_RUNNING);
124+
116125 return 0;
117126 }
118127
119−static struct task_struct *preemptirq_start_test(void)
128+static int preemptirq_run_test(void)
120129 {
130+ struct task_struct *task;
131+
121132 char task_name[50];
122133
123134 snprintf(task_name, sizeof(task_name), "%s_test", test_mode);
124− return kthread_run(preemptirq_delay_run, NULL, task_name);
135+ task = kthread_run(preemptirq_delay_run, NULL, task_name);
136+ if (IS_ERR(task))
137+ return PTR_ERR(task);
138+ if (task)
139+ kthread_stop(task);
140+ return 0;
125141 }
126142
127143
128144 static ssize_t trigger_store(struct kobject *kobj, struct kobj_attribute *attr,
129145 const char *buf, size_t count)
130146 {
131− preemptirq_start_test();
147+ ssize_t ret;
148+
149+ ret = preemptirq_run_test();
150+ if (ret)
151+ return ret;
132152 return count;
133153 }
134154
@@ -148,11 +168,9 @@ static struct kobject *preemptirq_delay_kobj; · 13 unmodified lines
148168
149169 static int __init preemptirq_delay_init(void)
150170 {
151− struct task_struct *test_task;
152171 int retval;
153172
154− test_task = preemptirq_start_test();
155− retval = PTR_ERR_OR_ZERO(test_task);
173+ retval = preemptirq_run_test();
156174 if (retval != 0)
157175 return retval;
158176
kernel/trace/trace.c+15−1
@@ -947,7 +947,8 @@ int __trace_bputs(unsigned long ip, const char *str) · 946 unmodified lines
947947 EXPORT_SYMBOL_GPL(__trace_bputs);
948948
949949 #ifdef CONFIG_TRACER_SNAPSHOT
950−void tracing_snapshot_instance_cond(struct trace_array *tr, void *cond_data)
950+static void tracing_snapshot_instance_cond(struct trace_array *tr,
951+ void *cond_data)
951952 {
952953 struct tracer *tracer = tr->current_trace;
953954 unsigned long flags;
@@ -8525,6 +8526,19 @@ static int allocate_trace_buffers(struct trace_array *tr, int size) · 7571 unmodified lines
85258526 */
85268527 allocate_snapshot = false;
85278528 #endif
8529+
8530+ /*
8531+ * Because of some magic with the way alloc_percpu() works on
8532+ * x86_64, we need to synchronize the pgd of all the tables,
8533+ * otherwise the trace events that happen in x86_64 page fault
8534+ * handlers can't cope with accessing the chance that a
8535+ * alloc_percpu()'d memory might be touched in the page fault trace
8536+ * event. Oh, and we need to audit all other alloc_percpu() and vmalloc()
8537+ * calls in tracing, because something might get triggered within a
8538+ * page fault trace event!
8539+ */
8540+ vmalloc_sync_mappings();
8541+
85288542 return 0;
85298543 }
85308544
kernel/trace/trace_boot.c+8−12
@@ -95,24 +95,20 @@ trace_boot_add_kprobe_event(struct xbc_node *node, const char *event) · 94 unmodified lines
9595 struct xbc_node *anode;
9696 char buf[MAX_BUF_LEN];
9797 const char *val;
98− int ret;
98+ int ret = 0;
9999
100− kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
100+ xbc_node_for_each_array_value(node, "probes", anode, val) {
101+ kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
101102
102− ret = kprobe_event_gen_cmd_start(&cmd, event, NULL);
103− if (ret)
104− return ret;
103+ ret = kprobe_event_gen_cmd_start(&cmd, event, val);
104+ if (ret)
105+ break;
105106
106− xbc_node_for_each_array_value(node, "probes", anode, val) {
107− ret = kprobe_event_add_field(&cmd, val);
107+ ret = kprobe_event_gen_cmd_end(&cmd);
108108 if (ret)
109− return ret;
109+ pr_err("Failed to add probe: %s\n", buf);
110110 }
111111
112− ret = kprobe_event_gen_cmd_end(&cmd);
113− if (ret)
114− pr_err("Failed to add probe: %s\n", buf);
115−
116112 return ret;
117113 }
118114 #else
kernel/trace/trace_events_hist.c+7−0
@@ -3320,6 +3320,9 @@ static void __destroy_hist_field(struct hist_field *hist_field) · 3319 unmodified lines
33203320 kfree(hist_field->name);
33213321 kfree(hist_field->type);
33223322
3323+ kfree(hist_field->system);
3324+ kfree(hist_field->event_name);
3325+
33233326 kfree(hist_field);
33243327 }
33253328
@@ -4382,6 +4385,7 @@ static struct hist_field *create_var(struct hist_trigger_data *hist_data, · 1056 unmodified lines
43824385 goto out;
43834386 }
43844387
4388+ var->ref = 1;
43854389 var->flags = HIST_FIELD_FL_VAR;
43864390 var->var.idx = idx;
43874391 var->var.hist_data = var->hist_data = hist_data;
@@ -5011,6 +5015,9 @@ static void destroy_field_vars(struct hist_trigger_data *hist_data) · 623 unmodified lines
50115015
50125016 for (i = 0; i < hist_data->n_field_vars; i++)
50135017 destroy_field_var(hist_data->field_vars[i]);
5018+
5019+ for (i = 0; i < hist_data->n_save_vars; i++)
5020+ destroy_field_var(hist_data->save_vars[i]);
50145021 }
50155022
50165023 static void save_field_var(struct hist_trigger_data *hist_data,
kernel/trace/trace_kprobe.c+7−1
@@ -453,7 +453,7 @@ static bool __within_notrace_func(unsigned long addr) · 452 unmodified lines
453453
454454 static bool within_notrace_func(struct trace_kprobe *tk)
455455 {
456− unsigned long addr = addr = trace_kprobe_address(tk);
456+ unsigned long addr = trace_kprobe_address(tk);
457457 char symname[KSYM_NAME_LEN], *p;
458458
459459 if (!__within_notrace_func(addr))
@@ -940,6 +940,9 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init); · 480 unmodified lines
940940 * complete command or only the first part of it; in the latter case,
941941 * kprobe_event_add_fields() can be used to add more fields following this.
942942 *
943+ * Unlikely the synth_event_gen_cmd_start(), @loc must be specified. This
944+ * returns -EINVAL if @loc == NULL.
945+ *
943946 * Return: 0 if successful, error otherwise.
944947 */
945948 int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, bool kretprobe,
@@ -953,6 +956,9 @@ int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, bool kretprobe, · 7 unmodified lines
953956 if (cmd->type != DYNEVENT_TYPE_KPROBE)
954957 return -EINVAL;
955958
959+ if (!loc)
960+ return -EINVAL;
961+
956962 if (kretprobe)
957963 snprintf(buf, MAX_EVENT_NAME_LEN, "r:kprobes/%s", name);
958964 else
kernel/trace/trace_preemptirq.c+39−0
@@ -19,6 +19,24 @@ · 18 unmodified lines
1919 /* Per-cpu variable to prevent redundant calls when IRQs already off */
2020 static DEFINE_PER_CPU(int, tracing_irq_cpu);
2121
22+/*
23+ * Like trace_hardirqs_on() but without the lockdep invocation. This is
24+ * used in the low level entry code where the ordering vs. RCU is important
25+ * and lockdep uses a staged approach which splits the lockdep hardirq
26+ * tracking into a RCU on and a RCU off section.
27+ */
28+void trace_hardirqs_on_prepare(void)
29+{
30+ if (this_cpu_read(tracing_irq_cpu)) {
31+ if (!in_nmi())
32+ trace_irq_enable(CALLER_ADDR0, CALLER_ADDR1);
33+ tracer_hardirqs_on(CALLER_ADDR0, CALLER_ADDR1);
34+ this_cpu_write(tracing_irq_cpu, 0);
35+ }
36+}
37+EXPORT_SYMBOL(trace_hardirqs_on_prepare);
38+NOKPROBE_SYMBOL(trace_hardirqs_on_prepare);
39+
2240 void trace_hardirqs_on(void)
2341 {
2442 if (this_cpu_read(tracing_irq_cpu)) {
@@ -28,11 +46,31 @@ void trace_hardirqs_on(void) · 3 unmodified lines
2846 this_cpu_write(tracing_irq_cpu, 0);
2947 }
3048
49+ lockdep_hardirqs_on_prepare(CALLER_ADDR0);
3150 lockdep_hardirqs_on(CALLER_ADDR0);
3251 }
3352 EXPORT_SYMBOL(trace_hardirqs_on);
3453 NOKPROBE_SYMBOL(trace_hardirqs_on);
3554
55+/*
56+ * Like trace_hardirqs_off() but without the lockdep invocation. This is
57+ * used in the low level entry code where the ordering vs. RCU is important
58+ * and lockdep uses a staged approach which splits the lockdep hardirq
59+ * tracking into a RCU on and a RCU off section.
60+ */
61+void trace_hardirqs_off_prepare(void)
62+{
63+ if (!this_cpu_read(tracing_irq_cpu)) {
64+ this_cpu_write(tracing_irq_cpu, 1);
65+ tracer_hardirqs_off(CALLER_ADDR0, CALLER_ADDR1);
66+ if (!in_nmi())
67+ trace_irq_disable(CALLER_ADDR0, CALLER_ADDR1);
68+ }
69+
70+}
71+EXPORT_SYMBOL(trace_hardirqs_off_prepare);
72+NOKPROBE_SYMBOL(trace_hardirqs_off_prepare);
73+
3674 void trace_hardirqs_off(void)
3775 {
3876 if (!this_cpu_read(tracing_irq_cpu)) {
@@ -56,6 +94,7 @@ __visible void trace_hardirqs_on_caller(unsigned long caller_addr) · 17 unmodified lines
5694 this_cpu_write(tracing_irq_cpu, 0);
5795 }
5896
97+ lockdep_hardirqs_on_prepare(CALLER_ADDR0);
5998 lockdep_hardirqs_on(CALLER_ADDR0);
6099 }
61100 EXPORT_SYMBOL(trace_hardirqs_on_caller);
kernel/trace/tracing_map.c+3−3
@@ -283,7 +283,7 @@ int tracing_map_add_key_field(struct tracing_map *map, · 282 unmodified lines
283283 return idx;
284284 }
285285
286−void tracing_map_array_clear(struct tracing_map_array *a)
286+static void tracing_map_array_clear(struct tracing_map_array *a)
287287 {
288288 unsigned int i;
289289
@@ -294,7 +294,7 @@ void tracing_map_array_clear(struct tracing_map_array *a) · 4 unmodified lines
294294 memset(a->pages[i], 0, PAGE_SIZE);
295295 }
296296
297−void tracing_map_array_free(struct tracing_map_array *a)
297+static void tracing_map_array_free(struct tracing_map_array *a)
298298 {
299299 unsigned int i;
300300
@@ -316,7 +316,7 @@ void tracing_map_array_free(struct tracing_map_array *a) · 15 unmodified lines
316316 kfree(a);
317317 }
318318
319−struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts,
319+static struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts,
320320 unsigned int entry_size)
321321 {
322322 struct tracing_map_array *a;
kernel/umh.c+5−0
@@ -544,6 +544,11 @@ EXPORT_SYMBOL_GPL(fork_usermode_blob); · 543 unmodified lines
544544 * Runs a user-space application. The application is started
545545 * asynchronously if wait is not set, and runs as a child of system workqueues.
546546 * (ie. it runs with full root capabilities and optimized affinity).
547+ *
548+ * Note: successful return value does not guarantee the helper was called at
549+ * all. You can't rely on sub_info->{init,cleanup} being called even for
550+ * UMH_WAIT_* wait modes as STATIC_USERMODEHELPER_PATH="" turns all helpers
551+ * into a successful no-op.
547552 */
548553 int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
549554 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t