Re: [PATCH v3 2/3] treewide: Switch memcpy() users of 'task->comm' to a more safer implementation
From: kernel test robot
Date: Thu May 08 2025 - 08:22:18 EST
Hi Bhupesh,
kernel test robot noticed the following build errors:
[auto build test ERROR on trace/for-next]
[also build test ERROR on tip/sched/core akpm-mm/mm-everything linus/master v6.15-rc5 next-20250508]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Bhupesh/exec-Remove-obsolete-comments/20250507-190740
base: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link: https://lore.kernel.org/r/20250507110444.963779-3-bhupesh%40igalia.com
patch subject: [PATCH v3 2/3] treewide: Switch memcpy() users of 'task->comm' to a more safer implementation
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20250508/202505082038.A5ejhbR4-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250508/202505082038.A5ejhbR4-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505082038.A5ejhbR4-lkp@xxxxxxxxx/
All errors (new ones prefixed by >>):
In file included from include/trace/define_trace.h:119,
from include/trace/events/sched.h:856,
from kernel/sched/core.c:84:
include/trace/events/sched.h: In function 'do_trace_event_raw_event_sched_switch':
>> include/trace/events/sched.h:245:24: error: 'struct trace_event_raw_sched_switch' has no member named 'comm'
245 | __entry->comm[TASK_COMM_LEN - 1] = '\0';
| ^~
include/trace/trace_events.h:427:11: note: in definition of macro '__DECLARE_EVENT_CLASS'
427 | { assign; } \
| ^~~~~~
include/trace/trace_events.h:435:23: note: in expansion of macro 'PARAMS'
435 | PARAMS(assign), PARAMS(print)) \
| ^~~~~~
include/trace/trace_events.h:40:9: note: in expansion of macro 'DECLARE_EVENT_CLASS'
40 | DECLARE_EVENT_CLASS(name, \
| ^~~~~~~~~~~~~~~~~~~
include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS'
44 | PARAMS(assign), \
| ^~~~~~
include/trace/events/sched.h:224:1: note: in expansion of macro 'TRACE_EVENT'
224 | TRACE_EVENT(sched_switch,
| ^~~~~~~~~~~
include/trace/events/sched.h:243:9: note: in expansion of macro 'TP_fast_assign'
243 | TP_fast_assign(
| ^~~~~~~~~~~~~~
In file included from include/trace/define_trace.h:120,
from include/trace/events/sched.h:856,
from kernel/sched/core.c:84:
include/trace/events/sched.h: In function 'do_perf_trace_sched_switch':
>> include/trace/events/sched.h:245:24: error: 'struct trace_event_raw_sched_switch' has no member named 'comm'
245 | __entry->comm[TASK_COMM_LEN - 1] = '\0';
| ^~
include/trace/perf.h:51:11: note: in definition of macro '__DECLARE_EVENT_CLASS'
51 | { assign; } \
| ^~~~~~
include/trace/perf.h:67:23: note: in expansion of macro 'PARAMS'
67 | PARAMS(assign), PARAMS(print)) \
| ^~~~~~
include/trace/trace_events.h:40:9: note: in expansion of macro 'DECLARE_EVENT_CLASS'
40 | DECLARE_EVENT_CLASS(name, \
| ^~~~~~~~~~~~~~~~~~~
include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS'
44 | PARAMS(assign), \
| ^~~~~~
include/trace/events/sched.h:224:1: note: in expansion of macro 'TRACE_EVENT'
224 | TRACE_EVENT(sched_switch,
| ^~~~~~~~~~~
include/trace/events/sched.h:243:9: note: in expansion of macro 'TP_fast_assign'
243 | TP_fast_assign(
| ^~~~~~~~~~~~~~
vim +245 include/trace/events/sched.h
225
226 TP_PROTO(bool preempt,
227 struct task_struct *prev,
228 struct task_struct *next,
229 unsigned int prev_state),
230
231 TP_ARGS(preempt, prev, next, prev_state),
232
233 TP_STRUCT__entry(
234 __array( char, prev_comm, TASK_COMM_LEN )
235 __field( pid_t, prev_pid )
236 __field( int, prev_prio )
237 __field( long, prev_state )
238 __array( char, next_comm, TASK_COMM_LEN )
239 __field( pid_t, next_pid )
240 __field( int, next_prio )
241 ),
242
243 TP_fast_assign(
244 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
> 245 __entry->comm[TASK_COMM_LEN - 1] = '\0';
246 __entry->prev_pid = prev->pid;
247 __entry->prev_prio = prev->prio;
248 __entry->prev_state = __trace_sched_switch_state(preempt, prev_state, prev);
249 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
250 __entry->next_comm[TASK_COMM_LEN - 1] = '\0';
251 __entry->next_pid = next->pid;
252 __entry->next_prio = next->prio;
253 /* XXX SCHED_DEADLINE */
254 ),
255
256 TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s%s ==> next_comm=%s next_pid=%d next_prio=%d",
257 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
258
259 (__entry->prev_state & (TASK_REPORT_MAX - 1)) ?
260 __print_flags(__entry->prev_state & (TASK_REPORT_MAX - 1), "|",
261 { TASK_INTERRUPTIBLE, "S" },
262 { TASK_UNINTERRUPTIBLE, "D" },
263 { __TASK_STOPPED, "T" },
264 { __TASK_TRACED, "t" },
265 { EXIT_DEAD, "X" },
266 { EXIT_ZOMBIE, "Z" },
267 { TASK_PARKED, "P" },
268 { TASK_DEAD, "I" }) :
269 "R",
270
271 __entry->prev_state & TASK_REPORT_MAX ? "+" : "",
272 __entry->next_comm, __entry->next_pid, __entry->next_prio)
273 );
274
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki