From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 856311CB33E; Mon, 14 Oct 2024 14:53:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728917630; cv=none; b=CwbfU9IvN7E4n/md3xYL451LBngqMzXPM0sTTaGzhcxz2r88hVtXbuygWxGS507Ae5SvvoUJr5uGeQJSEOV8RxbZXG96U3fO8Nf1ZcOc69+22mEZQfuXYQrCumuvtvSyRMp74LE/kT5PpXKZyv0a9ZcTDJ6yHjNswpkMs/JAgIo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728917630; c=relaxed/simple; bh=JO+dXeTvo+wtEWrPJB20OyTeMoEFvGH/mShp2wfdmJo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NjXH3/6lDNDk5EwjggIRRJBnj9pQ1w3hm8XkKXKAd382imIQ3GlInglvtX5d2pKZ45H5bp9rEwTec7+3Eje2Z2eEKSdMlGROWOJnP34Yd50ob1djQkaYcKQulEDxmwnDbqn/asLWDiOpKcXJG/EirDDkNywW23qDfkOvq/OmyjE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XhAJXHVU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XhAJXHVU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F1AFC4CEC3; Mon, 14 Oct 2024 14:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728917630; bh=JO+dXeTvo+wtEWrPJB20OyTeMoEFvGH/mShp2wfdmJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XhAJXHVUGBwSSqj/Oae5DyIY/iUU7CO4WjRR+nRnHvhsoLWTWNjXZ6yxjcq6KaswG rIRXgGhILW6hgk0+05q/v3lc0X2LxBHA6q64WNVbiWvdL2kGCWe6yeY1sm7/tY+y6M BA2vCEsG4GUpiwUMU1dL6HHct3K5fAJPsKiNWwuU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Stan Johnson , Finn Thain , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 6.1 086/798] m68k: Fix kernel_clone_args.flags in m68k_clone() Date: Mon, 14 Oct 2024 16:10:40 +0200 Message-ID: <20241014141221.311501874@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241014141217.941104064@linuxfoundation.org> References: <20241014141217.941104064@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Finn Thain [ Upstream commit 09b3d870faa7bc3e96c0978ab3cf4e96e4b15571 ] 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 Closes: https://lists.debian.org/debian-68k/2024/08/msg00000.html Fixes: 6aabc1facdb2 ("m68k: Implement copy_thread_tls()") Signed-off-by: Finn Thain Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/3463f1e5d4e95468dc9f3368f2b78ffa7b72199b.1723335149.git.fthain@linux-m68k.org Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/m68k/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index 2cb4a61bcfacb..81347e7704c5b 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -115,7 +115,7 @@ asmlinkage int m68k_clone(struct pt_regs *regs) { /* regs will be equal to current_pt_regs() */ struct kernel_clone_args args = { - .flags = regs->d1 & ~CSIGNAL, + .flags = (u32)(regs->d1) & ~CSIGNAL, .pidfd = (int __user *)regs->d3, .child_tid = (int __user *)regs->d4, .parent_tid = (int __user *)regs->d3, -- 2.43.0