In the Linux kernel, the following vulnerability has been resolved:
perf sched: Fix register_pid() overflow, strcpy, and BUG_ON
register_pid() has several issues when processing untrusted perf.data:
- Integer overflow: (pid + 1) * sizeof(struct task_desc *) can wrap
- Heap buffer overflow: strcpy(task->comm, comm) copies the
- BUG_ON on allocation failure: perf.data is untrusted input, so
- Realloc of sched->tasks assigned directly back, leaking the old
Cap pid at PID_MAX_LIMIT (4194304, matching the kernel's maximum on 64-bit), replace strcpy with strlcpy, guard against NULL comm, replace BUG_ON with NULL returns using safe realloc patterns, and add NULL checks in callers that dereference the result.