linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the akpm-current tree with the random tree
@ 2017-06-08  6:28 Stephen Rothwell
  2017-06-28  6:03 ` Stephen Rothwell
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2017-06-08  6:28 UTC (permalink / raw)
  To: Andrew Morton, Theodore Ts'o
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
	Jason A. Donenfeld, Rik van Riel

Hi all,

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

  include/linux/random.h

between commit:

  60473a13020f ("random: add get_random_{bytes,u32,u64,int,long,once}_wait family")

from the random tree and commit:

  d7802aa82f66 ("random,stackprotect: introduce get_random_canary function")

from the akpm-current 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

diff --cc include/linux/random.h
index 4aecc339558d,1fa0dc880bd7..000000000000
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@@ -58,31 -57,27 +58,52 @@@ static inline unsigned long get_random_
  #endif
  }
  
 +/* Calls wait_for_random_bytes() and then calls get_random_bytes(buf, nbytes).
 + * Returns the result of the call to wait_for_random_bytes. */
 +static inline int get_random_bytes_wait(void *buf, int nbytes)
 +{
 +	int ret = wait_for_random_bytes();
 +	if (unlikely(ret))
 +		return ret;
 +	get_random_bytes(buf, nbytes);
 +	return 0;
 +}
 +
 +#define declare_get_random_var_wait(var) \
 +	static inline int get_random_ ## var ## _wait(var *out) { \
 +		int ret = wait_for_random_bytes(); \
 +		if (unlikely(ret)) \
 +			return ret; \
 +		*out = get_random_ ## var(); \
 +		return 0; \
 +	}
 +declare_get_random_var_wait(u32)
 +declare_get_random_var_wait(u64)
 +declare_get_random_var_wait(int)
 +declare_get_random_var_wait(long)
 +#undef declare_get_random_var
 +
+ /*
+  * On 64-bit architectures, protect against non-terminated C string overflows
+  * by zeroing out the first byte of the canary; this leaves 56 bits of entropy.
+  */
+ #ifdef CONFIG_64BIT
+ # ifdef __LITTLE_ENDIAN
+ #  define CANARY_MASK 0xffffffffffffff00UL
+ # else /* big endian, 64 bits: */
+ #  define CANARY_MASK 0x00ffffffffffffffUL
+ # endif
+ #else /* 32 bits: */
+ # define CANARY_MASK 0xffffffffUL
+ #endif
+ 
+ static inline unsigned long get_random_canary(void)
+ {
+ 	unsigned long val = get_random_long();
+ 
+ 	return val & CANARY_MASK;
+ }
+ 
  unsigned long randomize_page(unsigned long start, unsigned long range);
  
  u32 prandom_u32(void);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: manual merge of the akpm-current tree with the random tree
  2017-06-08  6:28 linux-next: manual merge of the akpm-current tree with the random tree Stephen Rothwell
@ 2017-06-28  6:03 ` Stephen Rothwell
  2017-06-29 21:04   ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2017-06-28  6:03 UTC (permalink / raw)
  To: Andrew Morton, Theodore Ts'o
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
	Jason A. Donenfeld, Rik van Riel

Hi Andrew,

[Yes, top posting :-)]

With the merge window approaching, just a reminder that this conflict
still exists.

On Thu, 8 Jun 2017 16:28:12 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the akpm-current tree got a conflict in:
> 
>   include/linux/random.h
> 
> between commit:
> 
>   60473a13020f ("random: add get_random_{bytes,u32,u64,int,long,once}_wait family")
> 
> from the random tree and commit:
> 
>   d7802aa82f66 ("random,stackprotect: introduce get_random_canary function")
> 
> from the akpm-current 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
> 
> diff --cc include/linux/random.h
> index 4aecc339558d,1fa0dc880bd7..000000000000
> --- a/include/linux/random.h
> +++ b/include/linux/random.h
> @@@ -58,31 -57,27 +58,52 @@@ static inline unsigned long get_random_
>   #endif
>   }
>   
>  +/* Calls wait_for_random_bytes() and then calls get_random_bytes(buf, nbytes).
>  + * Returns the result of the call to wait_for_random_bytes. */
>  +static inline int get_random_bytes_wait(void *buf, int nbytes)
>  +{
>  +	int ret = wait_for_random_bytes();
>  +	if (unlikely(ret))
>  +		return ret;
>  +	get_random_bytes(buf, nbytes);
>  +	return 0;
>  +}
>  +
>  +#define declare_get_random_var_wait(var) \
>  +	static inline int get_random_ ## var ## _wait(var *out) { \
>  +		int ret = wait_for_random_bytes(); \
>  +		if (unlikely(ret)) \
>  +			return ret; \
>  +		*out = get_random_ ## var(); \
>  +		return 0; \
>  +	}
>  +declare_get_random_var_wait(u32)
>  +declare_get_random_var_wait(u64)
>  +declare_get_random_var_wait(int)
>  +declare_get_random_var_wait(long)
>  +#undef declare_get_random_var
>  +
> + /*
> +  * On 64-bit architectures, protect against non-terminated C string overflows
> +  * by zeroing out the first byte of the canary; this leaves 56 bits of entropy.
> +  */
> + #ifdef CONFIG_64BIT
> + # ifdef __LITTLE_ENDIAN
> + #  define CANARY_MASK 0xffffffffffffff00UL
> + # else /* big endian, 64 bits: */
> + #  define CANARY_MASK 0x00ffffffffffffffUL
> + # endif
> + #else /* 32 bits: */
> + # define CANARY_MASK 0xffffffffUL
> + #endif
> + 
> + static inline unsigned long get_random_canary(void)
> + {
> + 	unsigned long val = get_random_long();
> + 
> + 	return val & CANARY_MASK;
> + }
> + 
>   unsigned long randomize_page(unsigned long start, unsigned long range);
>   
>   u32 prandom_u32(void);

-- 
Cheers,
Stephen Rothwell

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: manual merge of the akpm-current tree with the random tree
  2017-06-28  6:03 ` Stephen Rothwell
@ 2017-06-29 21:04   ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2017-06-29 21:04 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Theodore Ts'o, Linux-Next Mailing List,
	Linux Kernel Mailing List, Jason A. Donenfeld, Rik van Riel

On Wed, 28 Jun 2017 16:03:48 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi Andrew,
> 
> [Yes, top posting :-)]
> 
> With the merge window approaching, just a reminder that this conflict
> still exists.

huh, it was only a teeny thing.

I moved 

randomstackprotect-introduce-get_random_canary-function.patch
forkrandom-use-get_random_canary-to-set-tsk-stack_canary.patch
x86-ascii-armor-the-x86_64-boot-init-stack-canary.patch
arm64-ascii-armor-the-arm64-boot-init-stack-canary.patch
sh64-ascii-armor-the-sh64-boot-init-stack-canary.patch

to be post-linux-next and refreshed, so it should be good now.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the akpm-current tree with the random tree
@ 2014-07-18  7:44 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2014-07-18  7:44 UTC (permalink / raw)
  To: Andrew Morton, Theodore Ts'o; +Cc: linux-next, linux-kernel, Vivek Goyal

[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]

Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
arch/x86/syscalls/syscall_64.tbl between commit 69d7b7939c24 ("random:
introduce getrandom(2) system call") from the random tree and commit
f5e74a5d7743 ("kexec: new syscall kexec_file_load() declaration") from
the akpm-current tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc arch/x86/syscalls/syscall_64.tbl
index 6705032c0520,6d3545914821..000000000000
--- a/arch/x86/syscalls/syscall_64.tbl
+++ b/arch/x86/syscalls/syscall_64.tbl
@@@ -323,7 -323,7 +323,8 @@@
  314	common	sched_setattr		sys_sched_setattr
  315	common	sched_getattr		sys_sched_getattr
  316	common	renameat2		sys_renameat2
 -317	common	kexec_file_load		sys_kexec_file_load
 +317	common	getrandom		sys_getrandom
++318	common	kexec_file_load		sys_kexec_file_load
  
  #
  # x32-specific system call numbers start at 512 to avoid cache impact

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-29 21:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-08  6:28 linux-next: manual merge of the akpm-current tree with the random tree Stephen Rothwell
2017-06-28  6:03 ` Stephen Rothwell
2017-06-29 21:04   ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2014-07-18  7:44 Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).