All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Alice Ryhl" <aliceryhl@google.com>,
	"Tariq Toukan" <tariqt@nvidia.com>,
	linux-rdma@vger.kernel.org, "Miguel Ojeda" <ojeda@kernel.org>,
	"Matthew Wilcox" <willy@infradead.org>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Kees Cook" <keescook@chromium.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Martijn Coenen" <maco@android.com>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	rust-for-linux@vger.kernel.org,
	"Christian Brauner" <brauner@kernel.org>
Subject: Re: [PATCH v7 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST
Date: Sun, 22 Sep 2024 09:16:36 -0400	[thread overview]
Message-ID: <ZvAYtImQujuiHIVe@sashalap> (raw)
In-Reply-To: <de6cb179-b21f-4e2d-a329-da5c4a138878@app.fastmail.com>

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

  reply	other threads:[~2024-09-22 13:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28 14:58 [PATCH v7 0/4] Memory management patches needed by Rust Binder Alice Ryhl
2024-05-28 14:58 ` [PATCH v7 1/4] rust: uaccess: add userspace pointers Alice Ryhl
2024-05-28 14:58 ` [PATCH v7 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST Alice Ryhl
2024-06-11 21:44   ` Andrew Morton
2024-09-22  7:08   ` Sasha Levin
2024-09-22  7:52     ` Arnd Bergmann
2024-09-22 13:16       ` Sasha Levin [this message]
2024-05-28 14:58 ` [PATCH v7 3/4] rust: uaccess: add typed accessors for userspace pointers Alice Ryhl
2024-05-28 14:58 ` [PATCH v7 4/4] rust: add abstraction for `struct page` Alice Ryhl
2024-06-10 20:46   ` Abdiel Janulgue
2024-06-11  8:51     ` Alice Ryhl
2024-07-09  8:02 ` [PATCH v7 0/4] Memory management patches needed by Rust Binder Miguel Ojeda
2024-07-09  9:46   ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZvAYtImQujuiHIVe@sashalap \
    --to=sashal@kernel.org \
    --cc=a.hindborg@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=arnd@arndb.de \
    --cc=arve@android.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=brauner@kernel.org \
    --cc=cmllamas@google.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@joelfernandes.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maco@android.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=tariqt@nvidia.com \
    --cc=tkjos@android.com \
    --cc=tmgross@umich.edu \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wedsonaf@gmail.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.