Re: [PATCH v7 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <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.

Right, it seems we still need the fix I posted in

https://lore.kernel.org/lkml/20230418114730.3674657-1-arnd@xxxxxxxxxx/

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux