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 E5537637; Sun, 22 Sep 2024 13:16:38 +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=1727010999; cv=none; b=pmhPUazS9Zt7J+MvT/IjzjG607Kr0LjwX5cRqXhRs0O39hYCAk4pHQjytWaBgCMTwLm4J1bHs0GjXwa3dCt3Y6ClxpMSad1OOCSNFiFxaRMttRFNtkolc1Rw3s1Qfew5srqPNfSQi0Q/0fV9RdJre2XuHZfL1dntG0uw0hIhcR0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727010999; c=relaxed/simple; bh=3rRxgBShBqpcovq3vY/cbRQuMcbMgN8wYzfCKoUgETc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tUeG8QPJ9GeSYsAAWRevUhypyU4ivffRyPA9nX6nFxavTRG9HKaKTU+eOtVxMtzMuHQXSWcgaqHlh7iXYENxzPGZduswyvFaARNPyWkwnH9aq/x7KtvJJWw0OroEOruN5E/3WZyZr+PAqcdtT8Uvryywv8Bcm+lO6LbHxi9Cjrw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Irk/UfnB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Irk/UfnB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23012C4CEC3; Sun, 22 Sep 2024 13:16:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727010998; bh=3rRxgBShBqpcovq3vY/cbRQuMcbMgN8wYzfCKoUgETc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Irk/UfnBn6jTTFmkWa1K7ZeS+4/YWB2bCmxuN1B7ZVJjaodHUx5aFeM2ehw4DuxzX b66W57SuuU7jqJa8j5lZiqkwHxV6rQrPUxovtTUFwA8cGYLkaPmtqtc1RzOa1sXNe2 tfMXAghm/WeLXreLVI59kwqR3Wj0xO/kfP35KdhSVKK/BsioPfZFm6SLhwKQKS4j8j oHewziQjOaM/JwLiDQjfw9MVNft6DoB21oX7ltnQ/rVSi4zGoBODdHKuTMCpmTNip8 6hQAqjYOnKo8GZCFWZ7WBtEWoxOXDQKqvnCGjGVmdCNW3V/loH39rSJoGii63rnXW1 LKPS7udjAsubA== Date: Sun, 22 Sep 2024 09:16:36 -0400 From: Sasha Levin To: Arnd Bergmann Cc: Alice Ryhl , Tariq Toukan , linux-rdma@vger.kernel.org, Miguel Ojeda , Matthew Wilcox , Alexander Viro , Andrew Morton , Kees Cook , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Greg Kroah-Hartman , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Trevor Gross , linux-mm@kvack.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Christian Brauner Subject: Re: [PATCH v7 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST Message-ID: References: <20240528-alice-mm-v7-0-78222c31b8f4@google.com> <20240528-alice-mm-v7-2-78222c31b8f4@google.com> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: On Sun, Sep 22, 2024 at 07:52:34AM +0000, Arnd Bergmann wrote: >On Sun, Sep 22, 2024, at 07:08, Sasha Levin wrote: >> On Tue, May 28, 2024 at 02:58:03PM +0000, Alice Ryhl wrote: >>>From: Arnd Bergmann >>> >>>Rust code needs to be able to access _copy_from_user and _copy_to_user >>>so that it can skip the check_copy_size check in cases where the length >>>is known at compile-time, mirroring the logic for when C code will skip >>>check_copy_size. To do this, we ensure that exported versions of these >>>methods are available when CONFIG_RUST is enabled. >>> >>>Alice has verified that this patch passes the CONFIG_TEST_USER_COPY test >>>on x86 using the Android cuttlefish emulator. >> >> Hi folks, >> >> I've noticed a build failure using GCC 9.5.0 on arm64 allmodconfig >> builds: >> >> In file included from ./arch/arm64/include/asm/preempt.h:6, >> from ./include/linux/preempt.h:79, >> from ./include/linux/alloc_tag.h:11, >> from ./include/linux/percpu.h:5, >> from ./include/linux/context_tracking_state.h:5, >> from ./include/linux/hardirq.h:5, >> from drivers/net/ethernet/mellanox/mlx4/cq.c:37: >> In function 'check_copy_size', >> inlined from 'mlx4_init_user_cqes' at >> ./include/linux/uaccess.h:203:7: >> ./include/linux/thread_info.h:244:4: error: call to '__bad_copy_from' >> declared with attribute error: copy source size is too small >> 244 | __bad_copy_from(); >> | ^~~~~~~~~~~~~~~~~ >> make[7]: *** [scripts/Makefile.build:244: >> drivers/net/ethernet/mellanox/mlx4/cq.o] Error 1 >> >> I do not have CONFIG_RUST enabled in those builds. >> >> I've bisected the issue (twice!) and bisection points to this patch >> which landed upstream as 1f9a8286bc0c ("uaccess: always export >> _copy_[from|to]_user with CONFIG_RUST"). >> >> Reverting said commit on top of Linus's tree fixes the build breakage. > >Right, it seems we still need the fix I posted in > >https://lore.kernel.org/lkml/20230418114730.3674657-1-arnd@kernel.org/ > >Tariq, should I resend this with your Reviewed-by, or can you >apply it from the old version and make sure it finds its way >into mainline and 6.11? The patch above fixes the build issue for me, thanks! -- Thanks, Sasha