| .. | .. |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | */ |
|---|
| 8 | 8 | #include <linux/seq_file.h> |
|---|
| 9 | +#include <linux/security.h> |
|---|
| 9 | 10 | #include <linux/uaccess.h> |
|---|
| 10 | 11 | #include <linux/kernel.h> |
|---|
| 11 | 12 | #include <linux/ftrace.h> |
|---|
| .. | .. |
|---|
| 95 | 96 | if (val == MODULE_STATE_COMING) |
|---|
| 96 | 97 | hold_module_trace_bprintk_format(start, end); |
|---|
| 97 | 98 | } |
|---|
| 98 | | - return 0; |
|---|
| 99 | + return NOTIFY_OK; |
|---|
| 99 | 100 | } |
|---|
| 100 | 101 | |
|---|
| 101 | 102 | /* |
|---|
| .. | .. |
|---|
| 115 | 116 | * section, then we need to read the link list pointers. The trick is |
|---|
| 116 | 117 | * we pass the address of the string to the seq function just like |
|---|
| 117 | 118 | * we do for the kernel core formats. To get back the structure that |
|---|
| 118 | | - * holds the format, we simply use containerof() and then go to the |
|---|
| 119 | + * holds the format, we simply use container_of() and then go to the |
|---|
| 119 | 120 | * next format in the list. |
|---|
| 120 | 121 | */ |
|---|
| 121 | 122 | static const char ** |
|---|
| .. | .. |
|---|
| 173 | 174 | module_trace_bprintk_format_notify(struct notifier_block *self, |
|---|
| 174 | 175 | unsigned long val, void *data) |
|---|
| 175 | 176 | { |
|---|
| 176 | | - return 0; |
|---|
| 177 | + return NOTIFY_OK; |
|---|
| 177 | 178 | } |
|---|
| 178 | 179 | static inline const char ** |
|---|
| 179 | 180 | find_next_mod_format(int start_index, void *v, const char **fmt, loff_t *pos) |
|---|
| .. | .. |
|---|
| 305 | 306 | if (!*fmt) |
|---|
| 306 | 307 | return 0; |
|---|
| 307 | 308 | |
|---|
| 308 | | - seq_printf(m, "0x%lx : \"", 0L); |
|---|
| 309 | + seq_printf(m, "0x%lx : \"", *(unsigned long *)fmt); |
|---|
| 309 | 310 | |
|---|
| 310 | 311 | /* |
|---|
| 311 | 312 | * Tabs and new lines need to be converted. |
|---|
| .. | .. |
|---|
| 348 | 349 | static int |
|---|
| 349 | 350 | ftrace_formats_open(struct inode *inode, struct file *file) |
|---|
| 350 | 351 | { |
|---|
| 352 | + int ret; |
|---|
| 353 | + |
|---|
| 354 | + ret = security_locked_down(LOCKDOWN_TRACEFS); |
|---|
| 355 | + if (ret) |
|---|
| 356 | + return ret; |
|---|
| 357 | + |
|---|
| 351 | 358 | return seq_open(file, &show_format_seq_ops); |
|---|
| 352 | 359 | } |
|---|
| 353 | 360 | |
|---|
| .. | .. |
|---|
| 360 | 367 | |
|---|
| 361 | 368 | static __init int init_trace_printk_function_export(void) |
|---|
| 362 | 369 | { |
|---|
| 363 | | - struct dentry *d_tracer; |
|---|
| 370 | + int ret; |
|---|
| 364 | 371 | |
|---|
| 365 | | - d_tracer = tracing_init_dentry(); |
|---|
| 366 | | - if (IS_ERR(d_tracer)) |
|---|
| 372 | + ret = tracing_init_dentry(); |
|---|
| 373 | + if (ret) |
|---|
| 367 | 374 | return 0; |
|---|
| 368 | 375 | |
|---|
| 369 | | - trace_create_file("printk_formats", 0444, d_tracer, |
|---|
| 376 | + trace_create_file("printk_formats", 0444, NULL, |
|---|
| 370 | 377 | NULL, &ftrace_formats_fops); |
|---|
| 371 | 378 | |
|---|
| 372 | 379 | return 0; |
|---|