linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the random tree with Linus' tree
@ 2013-11-04  6:04 Stephen Rothwell
  2013-11-04 12:39 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2013-11-04  6:04 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-next, linux-kernel, Greg Kroah-Hartman

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

Hi Ted,

Today's linux-next merge of the random tree got a conflict in
drivers/base/core.c between commit 63967685605b ("driver core: add
#include <linux/sysfs.h> to core files") from Linus' tree and commit
f0ed2b943a53 ("random: use device attach events for entropy") from the
random 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 drivers/base/core.c
index 67b180d855b2,5e98fc379d0f..000000000000
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@@ -26,7 -26,7 +26,8 @@@
  #include <linux/async.h>
  #include <linux/pm_runtime.h>
  #include <linux/netdevice.h>
 +#include <linux/sysfs.h>
+ #include <linux/random.h>
  
  #include "base.h"
  #include "power/power.h"

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: linux-next: manual merge of the random tree with Linus' tree
  2013-11-04  6:04 linux-next: manual merge of the random tree with Linus' tree Stephen Rothwell
@ 2013-11-04 12:39 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2013-11-04 12:39 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Theodore Ts'o, linux-next, linux-kernel

On Mon, Nov 04, 2013 at 05:04:11PM +1100, Stephen Rothwell wrote:
> Hi Ted,
> 
> Today's linux-next merge of the random tree got a conflict in
> drivers/base/core.c between commit 63967685605b ("driver core: add
> #include <linux/sysfs.h> to core files") from Linus' tree and commit
> f0ed2b943a53 ("random: use device attach events for entropy") from the
> random tree.
> 
> I fixed it up (see below) and can carry the fix as necessary (no action
> is required).

I think Ted is going to drop this patch from his tree as it didn't work
properly, right Ted?

thanks,

greg k-h

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

* linux-next: manual merge of the random tree with Linus' tree
@ 2022-10-07  4:54 Stephen Rothwell
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2022-10-07  4:54 UTC (permalink / raw)
  To: Theodore Ts'o, Jason A. Donenfeld
  Cc: Javier Martinez Canillas, Linux Kernel Mailing List,
	Linux Next Mailing List, Maíra Canal

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

Hi all,

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

  drivers/gpu/drm/selftests/test-drm_buddy.c

between commit:

  932da861956a ("drm: selftest: convert drm_buddy selftest to KUnit")

from Linus' tree and commit:

  87b2389e69dd ("treewide: use get_random_u32() when possible")

from the random tree.

I fixed it up (I deleted the file and applied the following merge fix
patch) 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.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Fri, 7 Oct 2022 15:46:52 +1100
Subject: [PATCH] drm: selftest: fix up for "convert drm_buddy selftest to KUnit"

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/gpu/drm/tests/drm_buddy_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c b/drivers/gpu/drm/tests/drm_buddy_test.c
index 7a2b2d6bc3fe..62f69589a72d 100644
--- a/drivers/gpu/drm/tests/drm_buddy_test.c
+++ b/drivers/gpu/drm/tests/drm_buddy_test.c
@@ -729,7 +729,7 @@ static void drm_test_buddy_alloc_limit(struct kunit *test)
 static int drm_buddy_init_test(struct kunit *test)
 {
 	while (!random_seed)
-		random_seed = get_random_int();
+		random_seed = get_random_u32();
 
 	return 0;
 }
-- 
2.35.1

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* linux-next: manual merge of the random tree with Linus' tree
@ 2017-07-14  1:57 Stephen Rothwell
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2017-07-14  1:57 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Rik van Riel,
	Andrew Morton, Jason A. Donenfeld

Hi all,

[I think I have reported this before ...]

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

  include/linux/random.h

between commit:

  022c204040f3 ("random,stackprotect: introduce get_random_canary function")

from Linus' tree and commit:

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

from the random 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 1fa0dc880bd7,4aecc339558d..000000000000
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@@ -57,27 -58,31 +58,52 @@@ static inline unsigned long get_random_
  #endif
  }
  
 +/*
 + * 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;
 +}
 +
+ /* 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
+ 
  unsigned long randomize_page(unsigned long start, unsigned long range);
  
  u32 prandom_u32(void);

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

* linux-next: manual merge of the random tree with Linus' tree
@ 2014-03-19  5:56 Stephen Rothwell
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2014-03-19  5:56 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-next, linux-kernel, Kees Cook, H. Peter Anvin

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

Hi Theodore,

Today's linux-next merge of the random tree got a conflict in
arch/x86/include/asm/archrandom.h between commit 5bfce5ef55cb ("x86,
kaslr: Provide randomness functions") from Linus' tree and commits
e3be36e60bdc ("x86, random: Enable the RDSEED instruction") and
91a60dc7aa88 ("random: Add arch_has_random[_seed]()") from the random 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/include/asm/archrandom.h
index e6a92455740e,c7ed4a61e928..000000000000
--- a/arch/x86/include/asm/archrandom.h
+++ b/arch/x86/include/asm/archrandom.h
@@@ -39,20 -42,16 +42,30 @@@
  
  #ifdef CONFIG_ARCH_RANDOM
  
 +/* Instead of arch_get_random_long() when alternatives haven't run. */
 +static inline int rdrand_long(unsigned long *v)
 +{
 +	int ok;
 +	asm volatile("1: " RDRAND_LONG "\n\t"
 +		     "jc 2f\n\t"
 +		     "decl %0\n\t"
 +		     "jnz 1b\n\t"
 +		     "2:"
 +		     : "=r" (ok), "=a" (*v)
 +		     : "0" (RDRAND_RETRY_LOOPS));
 +	return ok;
 +}
 +
+ /* A single attempt at RDSEED */
+ static inline bool rdseed_long(unsigned long *v)
+ {
+ 	unsigned char ok;
+ 	asm volatile(RDSEED_LONG "\n\t"
+ 		     "setc %0"
+ 		     : "=qm" (ok), "=a" (*v));
+ 	return ok;
+ }
+ 
  #define GET_RANDOM(name, type, rdrand, nop)			\
  static inline int name(type *v)					\
  {								\
@@@ -80,15 -95,14 +109,21 @@@ GET_SEED(arch_get_random_seed_int, unsi
  GET_RANDOM(arch_get_random_long, unsigned long, RDRAND_LONG, ASM_NOP3);
  GET_RANDOM(arch_get_random_int, unsigned int, RDRAND_INT, ASM_NOP3);
  
+ GET_SEED(arch_get_random_seed_long, unsigned long, RDSEED_LONG, ASM_NOP4);
+ GET_SEED(arch_get_random_seed_int, unsigned int, RDSEED_INT, ASM_NOP4);
+ 
  #endif /* CONFIG_X86_64 */
  
+ #define arch_has_random()	static_cpu_has(X86_FEATURE_RDRAND)
+ #define arch_has_random_seed()	static_cpu_has(X86_FEATURE_RDSEED)
+ 
 +#else
 +
 +static inline int rdrand_long(unsigned long *v)
 +{
 +	return 0;
 +}
 +
  #endif  /* CONFIG_ARCH_RANDOM */
  
  extern void x86_init_rdrand(struct cpuinfo_x86 *c);

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* linux-next: manual merge of the random tree with Linus' tree
@ 2013-09-23  4:04 Stephen Rothwell
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2013-09-23  4:04 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-next, linux-kernel, Frederic Weisbecker

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

Hi Theodore,

Today's linux-next merge of the random tree got a conflict in init/main.c
between commit 65f382fd0c8f ("context_tracking: Ground setup for static
key use") from Linus' tree and commit 382521d2478b ("random: run
random_int_secret_init() run after all late_initcalls") from the random
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 init/main.c
index af310af,586cd33..0000000
--- a/init/main.c
+++ b/init/main.c
@@@ -75,7 -75,7 +75,8 @@@
  #include <linux/blkdev.h>
  #include <linux/elevator.h>
  #include <linux/sched_clock.h>
 +#include <linux/context_tracking.h>
+ #include <linux/random.h>
  
  #include <asm/io.h>
  #include <asm/bugs.h>

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2022-10-07  4:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-04  6:04 linux-next: manual merge of the random tree with Linus' tree Stephen Rothwell
2013-11-04 12:39 ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2022-10-07  4:54 Stephen Rothwell
2017-07-14  1:57 Stephen Rothwell
2014-03-19  5:56 Stephen Rothwell
2013-09-23  4:04 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).