mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Martin Knoblauch <spamtrap@knobisoft.de>
Cc: Matt Mackall <mpm@selenic.com>, Ingo Molnar <mingo@elte.hu>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Rgeression: 2.6.30-rc6-git3 build error - ICE from drivers/char/random.c
Date: Tue, 19 May 2009 11:08:38 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.01.0905191055410.3301@localhost.localdomain> (raw)
In-Reply-To: <950448.6018.qm@web32607.mail.mud.yahoo.com>



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);

  reply	other threads:[~2009-05-19 18:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-18 13:29 Martin Knoblauch
2009-05-18 20:34 ` Matt Mackall
2009-05-18 22:29   ` Linus Torvalds
2009-05-19  9:20     ` Martin Knoblauch
2009-05-19 15:09       ` Linus Torvalds
2009-05-19 17:52         ` Martin Knoblauch
2009-05-19 18:08           ` Linus Torvalds [this message]
2009-05-19 18:24             ` Linus Torvalds
2009-05-19 19:00               ` Martin Knoblauch
2009-05-20  7:53               ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2009-05-18 12:58 Martin Knoblauch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.01.0905191055410.3301@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mpm@selenic.com \
    --cc=spamtrap@knobisoft.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®