public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Vasily Gorbik <gor@linux.ibm.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux-Arch <linux-arch@vger.kernel.org>,
	Russell King <rmk@armlinux.org.uk>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	Helge Deller <deller@kernel.org>,
	Huacai Chen <chenhuacai@loongson.cn>,
	Will Deacon <will@kernel.org>
Subject: Re: Attempting to unify some user space copying APIs
Date: Sat, 28 Mar 2026 05:14:05 +0100	[thread overview]
Message-ID: <ttcld3h@ub.hpns> (raw)
In-Reply-To: <CAHk-=wgg1QVWNWG-UCFo1hx0zqrPnB3qhPzUTrWNft+MtXQXig@mail.gmail.com>

On Fri, Mar 27, 2026 at 05:20:57PM -0700, Linus Torvalds wrote:
> I'm sending this out to the architecture maintainer list (and a random
> collection of arch maintainers that I just took from "recent pull
> requests") in the hope that people can test this on platforms that I'm
> too incompetent to check myself (read: I haven't installed all the
> cross-compiler environments).
...
>  arch/arm64/include/asm/uaccess.h   | 36 ++++++++++++++----------------
>  arch/powerpc/include/asm/uaccess.h |  4 ++--
>  arch/powerpc/lib/pmem.c            |  4 ++--
>  arch/x86/include/asm/uaccess_64.h  | 13 +++++------
>  arch/x86/lib/usercopy_64.c         |  2 +-
>  lib/iov_iter.c                     | 19 +++++++++++-----
>  6 files changed, 42 insertions(+), 36 deletions(-)

On s390 this builds and runs fine.

One thing I noticed: copy_from_user_iter is clean - the boilerplate just
wraps raw_copy_from_user which has no instrumentation of its own.

copy_from_user_iter_nocache is a bit different: the boilerplate wraps
the actor with instrument_copy_from_user_before/after, but the nocache
actors already instrument internally.

On s390 (and all arches without ARCH_HAS_NOCACHE_UACCESS) the generic
__copy_from_user_inatomic_nocache calls __copy_from_user_inatomic
which does its own instrument_copy_from_user_before/after around
raw_copy_from_user, so we end up with double kasan/kcsan/kmsan calls.

On x86 __copy_from_user_inatomic_nocache only does a bare
kasan_check_write(), so that one gets doubled, while kcsan and kmsan are
newly added through the boilerplate.

I only looked at s390 and compared to x86.

  parent reply	other threads:[~2026-03-28  4:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-28  0:20 Attempting to unify some user space copying APIs Linus Torvalds
2026-03-28  2:46 ` Helge Deller
2026-03-28  4:14 ` Vasily Gorbik [this message]
2026-03-28 16:46   ` Linus Torvalds
2026-03-28 18:52     ` Linus Torvalds
2026-03-29  2:18   ` Linus Torvalds
2026-03-28 12:16 ` Huacai Chen
2026-03-28 12:32 ` Madhavan Srinivasan

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=ttcld3h@ub.hpns \
    --to=gor@linux.ibm.com \
    --cc=chenhuacai@loongson.cn \
    --cc=deller@kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=maddy@linux.ibm.com \
    --cc=rmk@armlinux.org.uk \
    --cc=torvalds@linux-foundation.org \
    --cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox