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 security/security.c (1 of 38 files). Show all
Unified · Split
| @@ -3185,7 +3185,7 @@ int security_file_truncate(struct file *file) · 3184 unmodified lines | ||
| 3185 | 3185 | * |
| 3186 | 3186 | * Return: Returns a zero on success, negative values on failure. |
| 3187 | 3187 | */ |
| 3188 | −int security_task_alloc(struct task_struct *task, unsigned long clone_flags) | |
| 3188 | +int security_task_alloc(struct task_struct *task, u64 clone_flags) | |
| 3189 | 3189 | { |
| 3190 | 3190 | int rc = lsm_task_alloc(task); |
| 3191 | 3191 | |