With the introduction of clone3 in commit 7f192e3cd316 ("fork: add clone3") the effective bit width of clone_flags on all architectures was increased from 32-bit to 64-bit, with a new type of u64 for the flags. However, for most consumers of clone_flags the interface was not changed from the previous type of unsigned long. While this works fine as long as none of the new 64-bit flag bits (CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still undesirable in terms of the principle of least surprise. Thus, this commit fixes all relevant interfaces of callees to sys_clone3/copy_process (excluding the architecture-specific copy_thread) to consistently pass clone_flags as u64, so that no truncation to 32-bit integers occurs on 32-bit architectures.
Showing the changes to include/trace (1 of 38 files). Show all
Unified · Split
| @@ -8,14 +8,14 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | TRACE_EVENT(task_newtask, |
| 10 | 10 | |
| 11 | − TP_PROTO(struct task_struct *task, unsigned long clone_flags), | |
| 11 | + TP_PROTO(struct task_struct *task, u64 clone_flags), | |
| 12 | 12 | |
| 13 | 13 | TP_ARGS(task, clone_flags), |
| 14 | 14 | |
| 15 | 15 | TP_STRUCT__entry( |
| 16 | 16 | __field( pid_t, pid) |
| 17 | 17 | __array( char, comm, TASK_COMM_LEN) |
| 18 | − __field( unsigned long, clone_flags) | |
| 18 | + __field( u64, clone_flags) | |
| 19 | 19 | __field( short, oom_score_adj) |
| 20 | 20 | ), |
| 21 | 21 | |
| @@ -26,7 +26,7 @@ TRACE_EVENT(task_newtask, · 4 unmodified lines | ||
| 26 | 26 | __entry->oom_score_adj = task->signal->oom_score_adj; |
| 27 | 27 | ), |
| 28 | 28 | |
| 29 | − TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%hd", | |
| 29 | + TP_printk("pid=%d comm=%s clone_flags=%llx oom_score_adj=%hd", | |
| 30 | 30 | __entry->pid, __entry->comm, |
| 31 | 31 | __entry->clone_flags, __entry->oom_score_adj) |
| 32 | 32 | ); |