Skip to content

Commit 09b3d87

Browse files
fthaingeertu
authored andcommitted
m68k: Fix kernel_clone_args.flags in m68k_clone()
Stan Johnson recently reported a failure from the 'dump' command: DUMP: Date of this level 0 dump: Fri Aug 9 23:37:15 2024 DUMP: Dumping /dev/sda (an unlisted file system) to /dev/null DUMP: Label: none DUMP: Writing 10 Kilobyte records DUMP: mapping (Pass I) [regular files] DUMP: mapping (Pass II) [directories] DUMP: estimated 3595695 blocks. DUMP: Context save fork fails in parent 671 The dump program uses the clone syscall with the CLONE_IO flag, that is, flags == 0x80000000. When that value is promoted from long int to u64 by m68k_clone(), it undergoes sign-extension. The new value includes CLONE_INTO_CGROUP so the validation in cgroup_css_set_fork() fails and the syscall returns -EBADF. Avoid sign-extension by casting to u32. Reported-by: Stan Johnson <[email protected]> Closes: https://lists.debian.org/debian-68k/2024/08/msg00000.html Fixes: 6aabc1f ("m68k: Implement copy_thread_tls()") Signed-off-by: Finn Thain <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/3463f1e5d4e95468dc9f3368f2b78ffa7b72199b.1723335149.git.fthain@linux-m68k.org Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent 61eb040 commit 09b3d87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/m68k/kernel/process.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ asmlinkage int m68k_clone(struct pt_regs *regs)
117117
{
118118
/* regs will be equal to current_pt_regs() */
119119
struct kernel_clone_args args = {
120-
.flags = regs->d1 & ~CSIGNAL,
120+
.flags = (u32)(regs->d1) & ~CSIGNAL,
121121
.pidfd = (int __user *)regs->d3,
122122
.child_tid = (int __user *)regs->d4,
123123
.parent_tid = (int __user *)regs->d3,

0 commit comments

Comments
 (0)