Thread (5 messages) flat view 5 messages, 2 authors, 2019-12-09

Re: [PATCH] powerpc: Fix __clear_user() with KUAP enabled

From: Andrew Donnellan <hidden>
Date: 2019-12-09 13:33:35

On 9/12/19 10:50 pm, Christophe Leroy wrote:
quoted
-extern unsigned long __clear_user(void __user *addr, unsigned long 
size);
+extern unsigned long clear_user_asm(void __user *addr, unsigned long 
size);
  static inline unsigned long clear_user(void __user *addr, unsigned 
long size)
  {
@@ -409,12 +409,17 @@ static inline unsigned long clear_user(void 
__user *addr, unsigned long size)
      might_fault();
      if (likely(access_ok(addr, size))) {
          allow_write_to_user(addr, size);
-        ret = __clear_user(addr, size);
+        ret = clear_user_asm(addr, size);
          prevent_write_to_user(addr, size);
      }
What about changing the above by the following ?

        if (likely(access_ok(addr, size)))        ret = 
__clear_user(addr, size);
quoted
      return ret;
  }
+static inline unsigned long __clear_user(void __user *addr, unsigned 
long size)
+{
+        return clear_user(addr, size);
+}
+
Then

static inline unsigned long __clear_user(void __user *addr, unsigned 
long size)
{
     allow_write_to_user(addr, size);
     ret = clear_user_asm(addr, size);
     prevent_write_to_user(addr, size);

     return ret;
}
This is exactly the patch I initially wrote, I ran it past mpe privately 
and he suggested aliasing clear_user() -> __clear_user() instead, as 
there's not much point keeping a separate path around for a single user 
for a basically non-existent performance gain.

-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd@linux.ibm.com             IBM Australia Limited
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help