Skip to content

Commit 460a75a

Browse files
committed
Merge tag 'trace-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt: - Do not stop trace events in modules if TAINT_TEST is set - Do not clobber mount options when tracefs is mounted a second time - Prevent crash of kprobes in gate area - Add static annotation to some non global functions - Add some entries into the MAINTAINERS file - Fix check of event_mutex held when accessing trigger list - Add some __init/__exit annotations - Fix reporting of what called hardirq_{enable,disable}_ip function * tag 'trace-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracefs: Only clobber mode/uid/gid on remount if asked kprobes: Prohibit probes in gate area rv/reactor: add __init/__exit annotations to module init/exit funcs tracing: Fix to check event_mutex is held while accessing trigger list tracing: hold caller_addr to hardirq_{enable,disable}_ip tracepoint: Allow trace events in modules with TAINT_TEST MAINTAINERS: add scripts/tracing/ to TRACING MAINTAINERS: Add Runtime Verification (RV) entry rv/monitors: Make monitor's automata definition static
2 parents f448dda + 47311db commit 460a75a

File tree

10 files changed

+49
-19
lines changed

10 files changed

+49
-19
lines changed

MAINTAINERS

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17745,6 +17745,17 @@ L: [email protected]
1774517745
S: Maintained
1774617746
F: drivers/infiniband/ulp/rtrs/
1774717747

17748+
RUNTIME VERIFICATION (RV)
17749+
M: Daniel Bristot de Oliveira <[email protected]>
17750+
M: Steven Rostedt <[email protected]>
17751+
17752+
S: Maintained
17753+
F: Documentation/trace/rv/
17754+
F: include/linux/rv.h
17755+
F: include/rv/
17756+
F: kernel/trace/rv/
17757+
F: tools/verification/
17758+
1774817759
RXRPC SOCKETS (AF_RXRPC)
1774917760
M: David Howells <[email protected]>
1775017761
M: Marc Dionne <[email protected]>
@@ -20611,6 +20622,7 @@ F: include/*/ftrace.h
2061120622
F: include/linux/trace*.h
2061220623
F: include/trace/
2061320624
F: kernel/trace/
20625+
F: scripts/tracing/
2061420626
F: tools/testing/selftests/ftrace/
2061520627

2061620628
TRACING MMIO ACCESSES (MMIOTRACE)

fs/tracefs/inode.c

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ struct tracefs_mount_opts {
141141
kuid_t uid;
142142
kgid_t gid;
143143
umode_t mode;
144+
/* Opt_* bitfield. */
145+
unsigned int opts;
144146
};
145147

146148
enum {
@@ -241,6 +243,7 @@ static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts)
241243
kgid_t gid;
242244
char *p;
243245

246+
opts->opts = 0;
244247
opts->mode = TRACEFS_DEFAULT_MODE;
245248

246249
while ((p = strsep(&data, ",")) != NULL) {
@@ -275,24 +278,36 @@ static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts)
275278
* but traditionally tracefs has ignored all mount options
276279
*/
277280
}
281+
282+
opts->opts |= BIT(token);
278283
}
279284

280285
return 0;
281286
}
282287

283-
static int tracefs_apply_options(struct super_block *sb)
288+
static int tracefs_apply_options(struct super_block *sb, bool remount)
284289
{
285290
struct tracefs_fs_info *fsi = sb->s_fs_info;
286291
struct inode *inode = d_inode(sb->s_root);
287292
struct tracefs_mount_opts *opts = &fsi->mount_opts;
288293

289-
inode->i_mode &= ~S_IALLUGO;
290-
inode->i_mode |= opts->mode;
294+
/*
295+
* On remount, only reset mode/uid/gid if they were provided as mount
296+
* options.
297+
*/
298+
299+
if (!remount || opts->opts & BIT(Opt_mode)) {
300+
inode->i_mode &= ~S_IALLUGO;
301+
inode->i_mode |= opts->mode;
302+
}
291303

292-
inode->i_uid = opts->uid;
304+
if (!remount || opts->opts & BIT(Opt_uid))
305+
inode->i_uid = opts->uid;
293306

294-
/* Set all the group ids to the mount option */
295-
set_gid(sb->s_root, opts->gid);
307+
if (!remount || opts->opts & BIT(Opt_gid)) {
308+
/* Set all the group ids to the mount option */
309+
set_gid(sb->s_root, opts->gid);
310+
}
296311

297312
return 0;
298313
}
@@ -307,7 +322,7 @@ static int tracefs_remount(struct super_block *sb, int *flags, char *data)
307322
if (err)
308323
goto fail;
309324

310-
tracefs_apply_options(sb);
325+
tracefs_apply_options(sb, true);
311326

312327
fail:
313328
return err;
@@ -359,7 +374,7 @@ static int trace_fill_super(struct super_block *sb, void *data, int silent)
359374

360375
sb->s_op = &tracefs_super_operations;
361376

362-
tracefs_apply_options(sb);
377+
tracefs_apply_options(sb, false);
363378

364379
return 0;
365380

kernel/kprobes.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,7 @@ static int check_kprobe_address_safe(struct kprobe *p,
15621562
/* Ensure it is not in reserved area nor out of text */
15631563
if (!(core_kernel_text((unsigned long) p->addr) ||
15641564
is_module_text_address((unsigned long) p->addr)) ||
1565+
in_gate_area_no_mm((unsigned long) p->addr) ||
15651566
within_kprobe_blacklist((unsigned long) p->addr) ||
15661567
jump_label_text_reserved(p->addr, p->addr) ||
15671568
static_call_text_reserved(p->addr, p->addr) ||

kernel/trace/rv/monitors/wip/wip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct automaton_wip {
2727
bool final_states[state_max_wip];
2828
};
2929

30-
struct automaton_wip automaton_wip = {
30+
static struct automaton_wip automaton_wip = {
3131
.state_names = {
3232
"preemptive",
3333
"non_preemptive"

kernel/trace/rv/monitors/wwnr/wwnr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct automaton_wwnr {
2727
bool final_states[state_max_wwnr];
2828
};
2929

30-
struct automaton_wwnr automaton_wwnr = {
30+
static struct automaton_wwnr automaton_wwnr = {
3131
.state_names = {
3232
"not_running",
3333
"running"

kernel/trace/rv/reactor_panic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ static struct rv_reactor rv_panic = {
2424
.react = rv_panic_reaction
2525
};
2626

27-
static int register_react_panic(void)
27+
static int __init register_react_panic(void)
2828
{
2929
rv_register_reactor(&rv_panic);
3030
return 0;
3131
}
3232

33-
static void unregister_react_panic(void)
33+
static void __exit unregister_react_panic(void)
3434
{
3535
rv_unregister_reactor(&rv_panic);
3636
}

kernel/trace/rv/reactor_printk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ static struct rv_reactor rv_printk = {
2323
.react = rv_printk_reaction
2424
};
2525

26-
static int register_react_printk(void)
26+
static int __init register_react_printk(void)
2727
{
2828
rv_register_reactor(&rv_printk);
2929
return 0;
3030
}
3131

32-
static void unregister_react_printk(void)
32+
static void __exit unregister_react_printk(void)
3333
{
3434
rv_unregister_reactor(&rv_printk);
3535
}

kernel/trace/trace_events_trigger.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ static bool check_user_trigger(struct trace_event_file *file)
142142
{
143143
struct event_trigger_data *data;
144144

145-
list_for_each_entry_rcu(data, &file->triggers, list) {
145+
list_for_each_entry_rcu(data, &file->triggers, list,
146+
lockdep_is_held(&event_mutex)) {
146147
if (data->flags & EVENT_TRIGGER_FL_PROBE)
147148
continue;
148149
return true;

kernel/trace/trace_preemptirq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ __visible void trace_hardirqs_on_caller(unsigned long caller_addr)
9595
}
9696

9797
lockdep_hardirqs_on_prepare();
98-
lockdep_hardirqs_on(CALLER_ADDR0);
98+
lockdep_hardirqs_on(caller_addr);
9999
}
100100
EXPORT_SYMBOL(trace_hardirqs_on_caller);
101101
NOKPROBE_SYMBOL(trace_hardirqs_on_caller);
102102

103103
__visible void trace_hardirqs_off_caller(unsigned long caller_addr)
104104
{
105-
lockdep_hardirqs_off(CALLER_ADDR0);
105+
lockdep_hardirqs_off(caller_addr);
106106

107107
if (!this_cpu_read(tracing_irq_cpu)) {
108108
this_cpu_write(tracing_irq_cpu, 1);

kernel/tracepoint.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,8 @@ static void for_each_tracepoint_range(
571571
bool trace_module_has_bad_taint(struct module *mod)
572572
{
573573
return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP) |
574-
(1 << TAINT_UNSIGNED_MODULE));
574+
(1 << TAINT_UNSIGNED_MODULE) |
575+
(1 << TAINT_TEST));
575576
}
576577

577578
static BLOCKING_NOTIFIER_HEAD(tracepoint_notify_list);
@@ -647,7 +648,7 @@ static int tracepoint_module_coming(struct module *mod)
647648
/*
648649
* We skip modules that taint the kernel, especially those with different
649650
* module headers (for forced load), to make sure we don't cause a crash.
650-
* Staging, out-of-tree, and unsigned GPL modules are fine.
651+
* Staging, out-of-tree, unsigned GPL, and test modules are fine.
651652
*/
652653
if (trace_module_has_bad_taint(mod))
653654
return 0;

0 commit comments

Comments
 (0)