Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 317072 Details for
Bug 458022
kernel: random32: seeding improvement [rhel-4.8]
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
backported patch
linux-kernel-test.patch (text/plain), 2.23 KB, created by
Vitaly Mayatskikh
on 2008-09-18 13:04:20 UTC
(
hide
)
Description:
backported patch
Filename:
MIME Type:
Creator:
Vitaly Mayatskikh
Created:
2008-09-18 13:04:20 UTC
Size:
2.23 KB
patch
obsolete
>diff --git a/net/core/utils.c b/net/core/utils.c >index 9c584f8..2f4861e 100644 >--- a/net/core/utils.c >+++ b/net/core/utils.c >@@ -79,23 +79,12 @@ static u32 __net_random(struct nrnd_state *state) > return (state->s1 ^ state->s2 ^ state->s3); > } > >-static void __net_srandom(struct nrnd_state *state, unsigned long s) >+/* >+ * Handle minimum values for seeds >+ */ >+static inline u32 __seed(u32 x, u32 m) > { >- if (s == 0) >- s = 1; /* default seed is 1 */ >- >-#define LCG(n) (69069 * n) >- state->s1 = LCG(s); >- state->s2 = LCG(state->s1); >- state->s3 = LCG(state->s2); >- >- /* "warm it up" */ >- __net_random(state); >- __net_random(state); >- __net_random(state); >- __net_random(state); >- __net_random(state); >- __net_random(state); >+ return (x < m) ? x + m : x; > } > > >@@ -111,9 +100,15 @@ unsigned long net_random(void) > > void net_srandom(unsigned long entropy) > { >- struct nrnd_state *state = &get_cpu_var(net_rand_state); >- __net_srandom(state, state->s1^entropy); >- put_cpu_var(state); >+ int i; >+ /* >+ * No locking on the CPUs, but then somewhat random results are, well, >+ * expected. >+ */ >+ for_each_possible_cpu (i) { >+ struct nrnd_state *state = &per_cpu(net_rand_state, i); >+ state->s1 = __seed(state->s1 ^ entropy, 1); >+ } > } > > void __init net_random_init(void) >@@ -122,7 +117,19 @@ void __init net_random_init(void) > > for (i = 0; i < NR_CPUS; i++) { > struct nrnd_state *state = &per_cpu(net_rand_state,i); >- __net_srandom(state, i+jiffies); >+ >+#define LCG(x) ((x) * 69069) /* super-duper LCG */ >+ state->s1 = __seed(LCG(i + jiffies), 1); >+ state->s2 = __seed(LCG(state->s1), 7); >+ state->s3 = __seed(LCG(state->s2), 15); >+ >+ /* "warm it up" */ >+ __net_random(state); >+ __net_random(state); >+ __net_random(state); >+ __net_random(state); >+ __net_random(state); >+ __net_random(state); > } > } > >@@ -134,7 +141,15 @@ static int net_random_reseed(void) > get_random_bytes(seed, sizeof(seed)); > for (i = 0; i < NR_CPUS; i++) { > struct nrnd_state *state = &per_cpu(net_rand_state,i); >- __net_srandom(state, seed[i]); >+ u32 seeds[3]; >+ >+ get_random_bytes(&seeds, sizeof(seeds)); >+ state->s1 = __seed(seeds[0], 1); >+ state->s2 = __seed(seeds[1], 7); >+ state->s3 = __seed(seeds[2], 15); >+ >+ /* mix it in */ >+ __net_random(state); > } > return 0; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 458022
:
317070
|
317071
| 317072 |
317073
|
317074
|
317075