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 3F0C93370F6; Fri, 17 Oct 2025 14:59:31 +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=1760713171; cv=none; b=BzZy3cE8pfWXTFb4ppB8Al24Pd2K6WvMyEhWLUXKjSsPZJGZoHF9op0Zw0s/fwWGkMAAcpwROCZNNbwqiohht+qnqUsjmjzcAuYfbRWwNVL1wJYSPBv/DYyRBEZyJCBNDsdlxrl3PkLWjns/pjh4vJNdkaRlY2PwL5+TPoYTK6A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760713171; c=relaxed/simple; bh=hBVlUDe83yNCPDz1mAQiaDHfiyDe2/Xnn3NWZjJ5SC0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AvUN7QJO87xCk18VXSJrQJGfQTpKBEJlXTNKvSEEyDMOsgVE7U7SP7fP/mGUO3h3Y6ZkynwD+8iPRlWcizPd+D6Sd3wlrPf4/O4dA9wcT9OTvqI+zsTyZZYXEqorTwtTQkiOoqM1IeqPVgFs/yEpDN9Ho6Sj/WB4dXrrmZk4GUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aAw7th1t; 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="aAw7th1t" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B88DDC4CEE7; Fri, 17 Oct 2025 14:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760713171; bh=hBVlUDe83yNCPDz1mAQiaDHfiyDe2/Xnn3NWZjJ5SC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aAw7th1tLCV6h+VCQdF7ZeKPrC5pNRJZ51kTT5sPgseLJ2FH26znkIHOtMGAMElm/ nxRHghae9OhcSd3ZJ5J+fn/30rYMOV9rTLfnStaMqh51NRgBqdGdX3/4Br18OBOs84 7tVTUugv9nOACgWPlN0vFQk5j80tczrDx+TXkxak= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Simon Schuster , David Hildenbrand , Lorenzo Stoakes , Arnd Bergmann , Christian Brauner Subject: [PATCH 6.1 072/168] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64) Date: Fri, 17 Oct 2025 16:52:31 +0200 Message-ID: <20251017145131.679234866@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251017145129.000176255@linuxfoundation.org> References: <20251017145129.000176255@linuxfoundation.org> User-Agent: quilt/0.69 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: Simon Schuster commit 04ff48239f46e8b493571e260bd0e6c3a6400371 upstream. 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. However, the signature of the copy_* helper functions (e.g., copy_sighand) used by copy_process was not adapted. As such, they truncate the flags on any 32-bit architectures that supports clone3 (arc, arm, csky, m68k, microblaze, mips32, openrisc, parisc32, powerpc32, riscv32, x86-32 and xtensa). For copy_sighand with CLONE_CLEAR_SIGHAND being an actual u64 constant, this triggers an observable bug in kernel selftest clone3_clear_sighand: if (clone_flags & CLONE_CLEAR_SIGHAND) in function copy_sighand within fork.c will always fail given: unsigned long /* == uint32_t */ clone_flags #define CLONE_CLEAR_SIGHAND 0x100000000ULL This commit fixes the bug by always passing clone_flags to copy_sighand via their declared u64 type, invariant of architecture-dependent integer sizes. Fixes: b612e5df4587 ("clone3: add CLONE_CLEAR_SIGHAND") Cc: stable@vger.kernel.org # linux-5.5+ Signed-off-by: Simon Schuster Link: https://lore.kernel.org/20250901-nios2-implement-clone3-v2-1-53fcf5577d57@siemens-energy.com Acked-by: David Hildenbrand Reviewed-by: Lorenzo Stoakes Reviewed-by: Arnd Bergmann Signed-off-by: Christian Brauner Signed-off-by: Greg Kroah-Hartman --- kernel/fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1641,7 +1641,7 @@ static int copy_files(unsigned long clon return 0; } -static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk) +static int copy_sighand(u64 clone_flags, struct task_struct *tsk) { struct sighand_struct *sig;