On Tue, May 28, 2024 at 02:58:03PM +0000, Alice Ryhl wrote:
From: Arnd Bergmann <arnd@xxxxxxxx> 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. -- Thanks, Sasha