Re: Rgeression: 2.6.30-rc6-git3 build error - ICE fromdrivers/char/random.c

From: Linus Torvalds
Date: Tue May 19 2009 - 14:10:07 EST




On Tue, 19 May 2009, Martin Knoblauch wrote:
> >
> > Ok, so can you do two other simple tests:
> >
> > - just remove the "+ (long)&ret" entirely.
> >
> > Now, usually gcc doesn't have issues with non-asm things, but that's an
> > odd way of getting the current stack address by lookin gat the address
> > of a variable that hasn't even been used, so maybe it triggers some
> > untested codepath in gcc (and thus the bug).
> >
>
> Removing above fixes the ICE. It does so in both the original and the patched version.
>
> Removing get_cycles() has no effect wrt. the ICE.

Oh wow. Ok, I suggested it, but I have to admit that I didn't really think
that it would be the &ret thing.

Very interesting fragility in your gcc version.

Anyway, that part of the garbage is much less interesting than the cycle
counter (the stack pointer will be the same for the same process and
callchain anyway - and 'current->pid' is already gives difference answers
for different processes), so I'll just remove it.

We could replace it with something like __builtin_frame_address(0) or
whatever, but I don't know which gcc version _that_ was introduced in, so
I suspect I should just get rid of it as not being worth it.

I guess getting rid of 'jiffies' is also worth it. Even at its very worst,
'get_cycles()' should return jiffy-level information, so adding in jiffies
doesn't add anything to it.

So I'll just commit this. But I'd like to have a final "tested-by" from
you, since I don't have access to your version of gcc on any of my
machines.

Linus
---
drivers/char/random.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index b2ced39..b361f45 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1673,7 +1673,7 @@ unsigned int get_random_int(void)
int ret;

keyptr = get_keyptr();
- hash[0] += current->pid + jiffies + get_cycles() + (int)(long)&ret;
+ hash[0] += current->pid + get_cycles();

ret = half_md4_transform(hash, keyptr->secret);
put_cpu_var(get_random_int_hash);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/