Thread (17 messages) 17 messages, 2 authors, 2021-02-25

Re: [PATCH v6 01/10] powerpc/uaccess: Add unsafe_copy_from_user

flat view

From: Christophe Leroy <hidden>
Date: 2021-02-23 17:16:14


Le 21/02/2021 à 02:23, Christopher M. Riedl a écrit :
quoted hunk ↗ jump to hunk
Just wrap __copy_tofrom_user() for the usual 'unsafe' pattern which
accepts a label to goto on error.

Signed-off-by: Christopher M. Riedl <redacted>
Reviewed-by: Daniel Axtens <redacted>
---
  arch/powerpc/include/asm/uaccess.h | 3 +++
  1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index 78e2a3990eab..33b2de642120 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -487,6 +487,9 @@ user_write_access_begin(const void __user *ptr, size_t len)
  #define unsafe_put_user(x, p, e) \
  	__unsafe_put_user_goto((__typeof__(*(p)))(x), (p), sizeof(*(p)), e)
  
+#define unsafe_copy_from_user(d, s, l, e) \
+	unsafe_op_wrap(__copy_tofrom_user((__force void __user *)d, s, l), e)
+
Could we perform same as unsafe_copy_to_user() instead of calling an external function which is banned in principle inside uaccess blocks ?

  #define unsafe_copy_to_user(d, s, l, e) \
  do {									\
  	u8 __user *_dst = (u8 __user *)(d);				\
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help