lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+mHjF7+HF9y2AfdqECfXfh_VTZoOe8O0mD3gD-Ysg+g0k8Ang@mail.gmail.com>
Date: Thu, 15 Jan 2026 20:50:39 +0900
From: 김동현 <austin.lkml@...il.com>
To: Florian Schmaus <florian.schmaus@...asip.com>
Cc: Paul Walmsley <pjw@...nel.org>, Palmer Dabbelt <palmer@...belt.com>, 
	Albert Ou <aou@...s.berkeley.edu>, Alexandre Ghiti <alex@...ti.fr>, linux-riscv@...ts.infradead.org, 
	linux-kernel@...r.kernel.org, Austin Kim <austindh.kim@...il.com>
Subject: Re: [PATCH] riscv: mm: define copy_user_page() as copy_page()

Hello,

2026년 1월 13일 (화) 오후 10:42, Florian Schmaus <florian.schmaus@...asip.com>님이 작성:
>
> Currently, the implementation of copy_user_page() is identical to
> copy_page().
>
> Align riscv with other architectures (alpha, arc, arm64, hexagon,
> longarch, m68k, openrisc, s390, um, xtensa) and map copy_user_page()
> to copy_page() given that their implementation is identical.
>
> In addition to following a common pattern, this centralizes the
> implementation. Any changes to the underlying page copy logic (e.g.,
> for CHERI) will now automatically propagate to copy_user_page().
>
> Signed-off-by: Florian Schmaus <florian.schmaus@...asip.com>
> ---
>  arch/riscv/include/asm/page.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
> index ffe213ad65a4..3c517bc9eac5 100644
> --- a/arch/riscv/include/asm/page.h
> +++ b/arch/riscv/include/asm/page.h
> @@ -51,8 +51,7 @@ void clear_page(void *page);
>  #define copy_page(to, from)                    memcpy((to), (from), PAGE_SIZE)
>
>  #define clear_user_page(pgaddr, vaddr, page)   clear_page(pgaddr)
> -#define copy_user_page(vto, vfrom, vaddr, topg) \
> -                       memcpy((vto), (vfrom), PAGE_SIZE)
> +#define copy_user_page(vto, vfrom, vaddr, topg) copy_page(vto, vfrom)

Here are the observation over this patch:

1. After compiling with 'CROSS_COMPILE=riscv64-linux-gnu-' option,
the following is the corresponding statement for copy_user_page() in
preprocessed file.

 do { do { __attribute__((__noreturn__)) extern void
__compiletime_assert_333(void) __attribute__((__error__("BUILD_BUG_ON
failed: " "__same_type((vto), struct page *)"))); if
(!(!(__builtin_types_compatible_p(typeof((vto)), typeof(struct page
*))))) __compiletime_assert_333(); } while (0); __kunmap_atomic(vto);
} while (0);

Output is the same - before/after patch: That means that the generated
risc-v instruction is the same.

2. copy_user_page() is only used in dax file system (fs/dax.c)

3. With the new patch, the full compilation for all of the code happens.

BR,
Austin Kim
>
>  /*
>   * Use struct definitions to apply C type checking
> --
> 2.52.0
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ