Skip to contentSkip to conversation

linux-next: manual merge of the kspp tree with the arm64 tree

DISCUSSION Stephen Rothwell 2 participants 4 messages Jul 18, 2016 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi Kees,

Today's linux-next merge of the kspp tree got a conflict in:

arch/arm64/include/asm/uaccess.h

between commit:

bffe1baff5d5 ("arm64: kasan: instrument user memory access API")

from the arm64 tree and commit:

b19e7f50f056 ("arm64/uaccess: Enable hardened usercopy")

from the kspp tree.

I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Signature · 26 lines
Cheers,
Stephen Rothwell

diff --cc arch/arm64/include/asm/uaccess.h
index 5e834d10b291,1779cbdb7838..000000000000
--- a/arch/arm64/include/asm/uaccess.h
+++ b/arch/arm64/include/asm/uaccess.h
@@@ -264,14 -276,14 +264,15 @@@ extern unsigned long __must_check __cle
  
  static inline unsigned long __must_check __copy_from_user(void *to, const void __user *from, unsigned long n)
  {
 +	kasan_check_write(to, n);
- 	return  __arch_copy_from_user(to, from, n);
+ 	check_object_size(to, n, false);
+ 	return __arch_copy_from_user(to, from, n);
  }
  
  static inline unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n)
  {
 -	check_object_size(from, n, true);
 +	kasan_check_read(from, n);
- 	return  __arch_copy_to_user(to, from, n);
+ 	return __arch_copy_to_user(to, from, n);
  }
  
  static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n)
#1 lore raw
Quoted 37 lines · Stephen Rothwell

Hi Kees,

Today's linux-next merge of the kspp tree got a conflict in:

arch/arm64/include/asm/uaccess.h

between commit:

bffe1baff5d5 ("arm64: kasan: instrument user memory access API")

from the arm64 tree and commit:

b19e7f50f056 ("arm64/uaccess: Enable hardened usercopy")

from the kspp tree.

I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

--
Cheers,
Stephen Rothwell

arch/arm64/include/asm/uaccess.h +0 -1
diff --cc arch/arm64/include/asm/uaccess.h
index 5e834d10b291,1779cbdb7838..000000000000
@@@ -264,14 -276,14 +264,15 @@@ extern unsigned long __must_check __cle
 
  static inline unsigned long __must_check __copy_from_user(void *to, const void __user *from, unsigned long n)
  {
 +      kasan_check_write(to, n);
-       return  __arch_copy_from_user(to, from, n);

arch/arm64/include/asm/uaccess.h

Quoted 10 lines
arch/arm64/include/asm/uaccess.h +3 -1
+       check_object_size(to, n, false);
+       return __arch_copy_from_user(to, from, n);
  }
 
  static inline unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n)
  {
 -      check_object_size(from, n, true);
 +      kasan_check_read(from, n);
-       return  __arch_copy_to_user(to, from, n);
+       return __arch_copy_to_user(to, from, n);

If I'm reading correctly, this second fixup is wrong. It should read;

    kasan_check_read(from, n);
    check_object_size(from, n, true);
    return __arch_copy_to_user(to, from, n);

(i.e. fix double space between "return" and "__arch_copy..." in both chunks and add check_object_size() calls after the kasan calls in both chunks.

-Kees

Signature · 2 lines
Kees Cook
Brillo & Chrome OS Security
#2 lore raw

Hi Kees,

Quoted 10 lines · On Sun, 17 Jul 2016 21:49:40 -0700 Kees Cook <[email protected]> wrote:

If I'm reading correctly, this second fixup is wrong. It should read;

    kasan_check_read(from, n);
    check_object_size(from, n, true);
    return __arch_copy_to_user(to, from, n);

(i.e. fix double space between "return" and "__arch_copy..." in both chunks and add check_object_size() calls after the kasan calls in both chunks.

Yep, sorry. I will fix it up tomorrow.

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw
Quoted 10 lines · Stephen Rothwell

Hi Kees,

Quoted 7 lines · On Sun, 17 Jul 2016 21:49:40 -0700 Kees Cook <[email protected]> wrote:

If I'm reading correctly, this second fixup is wrong. It should read;

    kasan_check_read(from, n);
    check_object_size(from, n, true);
    return __arch_copy_to_user(to, from, n);
Quoted 5 lines
Quoted 3 lines

(i.e. fix double space between "return" and "__arch_copy..." in both chunks and add check_object_size() calls after the kasan calls in both chunks.

Yep, sorry. I will fix it up tomorrow.

Cool, thanks! :)

-Kees

Signature · 2 lines
Kees Cook
Brillo & Chrome OS Security