linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v7 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST
       [not found]   ` <Zu_CeRfMKyyt4E5O@sashalap>
@ 2024-09-22  7:52     ` Arnd Bergmann
  2024-09-22 13:16       ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2024-09-22  7:52 UTC (permalink / raw)
  To: Sasha Levin, Alice Ryhl, Tariq Toukan, linux-rdma
  Cc: Miguel Ojeda, Matthew Wilcox, Alexander Viro, Andrew Morton,
	Kees Cook, Alex Gaynor, Wedson Almeida Filho, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas, Suren Baghdasaryan,
	Trevor Gross, linux-mm, linux-kernel, rust-for-linux,
	Christian Brauner

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@arndb.de>
>>
>>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?

     Arnd

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v7 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST
  2024-09-22  7:52     ` [PATCH v7 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST Arnd Bergmann
@ 2024-09-22 13:16       ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2024-09-22 13:16 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alice Ryhl, Tariq Toukan, linux-rdma, Miguel Ojeda,
	Matthew Wilcox, Alexander Viro, Andrew Morton, Kees Cook,
	Alex Gaynor, Wedson Almeida Filho, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas, Suren Baghdasaryan,
	Trevor Gross, linux-mm, linux-kernel, rust-for-linux,
	Christian Brauner

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@arndb.de>
>>>
>>>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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-22 13:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240528-alice-mm-v7-0-78222c31b8f4@google.com>
     [not found] ` <20240528-alice-mm-v7-2-78222c31b8f4@google.com>
     [not found]   ` <Zu_CeRfMKyyt4E5O@sashalap>
2024-09-22  7:52     ` [PATCH v7 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST Arnd Bergmann
2024-09-22 13:16       ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).