tracing: Two minor fixes for 6.13
Subsystems (2)
Steven Rostedt
maintainercover tracing: Two minor fixes for 6.13
Two minor tracing fixes for 6.13:
- Add "const" to "char *" in event structure field that gets assigned literals.
- Check size of input passed into the tracing cpumask file.
If a too large of an input gets passed into the cpumask file, it could trigger a warning in the bitmask parsing code.
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/fixes
Head SHA1: 98feccbf32cfdde8c722bc4587aaa60ee5ac33f0
Christian Göttsche (1):
tracing: Constify string literal data member in struct trace_event_call
Lizhi Xu (1):
tracing: Prevent bad count for tracing_cpumask_write
----
include/linux/trace_events.h | 2 +- kernel/trace/trace.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
Steven Rostedt
maintainerPATCH 1/2 tracing: Constify string literal data member in struct trace_event_call
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <[email protected]>
The name member of the struct trace_event_call is assigned with generated string literals; declare them pointer to read-only.
Reported by clang:
security/landlock/syscalls.c:179:1: warning: initializing 'char *' with an expression of type 'const char[34]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
179 | SYSCALL_DEFINE3(landlock_create_ruleset,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
180 | const struct landlock_ruleset_attr __user *const, attr,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
181 | const size_t, size, const __u32, flags)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:226:36: note: expanded from macro 'SYSCALL_DEFINE3'
226 | #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:234:2: note: expanded from macro 'SYSCALL_DEFINEx'
234 | SYSCALL_METADATA(sname, x, __VA_ARGS__) \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:184:2: note: expanded from macro 'SYSCALL_METADATA'
184 | SYSCALL_TRACE_ENTER_EVENT(sname); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:151:30: note: expanded from macro 'SYSCALL_TRACE_ENTER_EVENT'
151 | .name = "sys_enter"#sname, \
| ^~~~~~~~~~~~~~~~~--- include/linux/trace_events.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/trace_events.h +1 -1
@@ -364,7 +364,7 @@ struct trace_event_call {struct list_head list;struct trace_event_class *class;union { -char *name; +const char *name;/* Set TRACE_EVENT_FL_TRACEPOINT flag when using "tp" */ struct tracepoint *tp; };
Signature · 1 line
2.45.2
Steven Rostedt
maintainerPATCH 2/2 tracing: Prevent bad count for tracing_cpumask_write
In reply to Steven RostedtFrom: Lizhi Xu <[email protected]>
If a large count is provided, it will trigger a warning in bitmap_parse_user. Also check zero for it.
--- kernel/trace/trace.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/trace/trace.c +3 -0
@@ -5087,6 +5087,9 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,cpumask_var_t tracing_cpumask_new;int err; +if (count ==0 || count >KMALLOC_MAX_SIZE ) +return -EINVAL ; +if (!zalloc_cpumask_var (&tracing_cpumask_new,GFP_KERNEL ))return -ENOMEM ;
Signature · 1 line
2.45.2