From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Ingo Molnar <mingo@elte.hu>
Cc: "J.A. Magallon" <jamagallon@able.es>,
linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
tytso@mit.edu
Subject: Re: Stack traces in 2.6.9-rc2-mm4
Date: Tue, 28 Sep 2004 17:49:19 +1000 [thread overview]
Message-ID: <4159177F.7030803@yahoo.com.au> (raw)
In-Reply-To: <20040928072123.GA15177@elte.hu>
Ingo Molnar wrote:
> * J.A. Magallon <jamagallon@able.es> wrote:
>
>
>>I got the same on another place...
>>
>>Sep 28 00:48:51 werewolf kernel: using smp_processor_id() in preemptible
>>code: X/4012
>>Sep 28 00:48:51 werewolf kernel: [smp_processor_id+135/141]
>>smp_processor_id+0x87/0x8d
>>Sep 28 00:48:51 werewolf kernel: [add_timer_randomness+314/365]
>>add_timer_randomness+0x13a/0x16d
>>Sep 28 00:48:51 werewolf kernel: [<b0206733>]
>>add_timer_randomness+0x13a/0x16d
>>Sep 28 00:48:51 werewolf kernel: [input_event+85/999]
>>input_event+0x55/0x3e7
>
>
> the one below should fix this: a certain codepath in the random driver
> relied on vt_ioctl() being under the BKL and implicitly disabling
> preemption. The code wasnt buggy upstream but it's slighly unrobust so i
> think we want the fix upstream too, independently of the remove-bkl
> patch. This change has been in the -VP patchset for some time so it
> should work fine.
>
> Ingo
>
> --- linux/drivers/char/random.c.orig
> +++ linux/drivers/char/random.c
> @@ -807,10 +807,11 @@ static void add_timer_randomness(struct
> long delta, delta2, delta3;
> int entropy = 0;
>
> + preempt_disable();
> /* if over the trickle threshold, use only 1 in 4096 samples */
> if ( random_state->entropy_count > trickle_thresh &&
> (__get_cpu_var(trickle_count)++ & 0xfff))
> - return;
> + goto out;
>
It looks like upstream code *is* buggy because that is a non-atomic
RMW operation on the per-cpu var, no? Hence you must disable preempt.
next prev parent reply other threads:[~2004-09-28 8:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-27 8:01 Stack traces in 2.6.9-rc2-mm4 Reuben Farrelly
2004-09-27 8:23 ` Nick Piggin
2004-09-27 8:57 ` Ingo Molnar
2004-09-27 9:14 ` Reuben Farrelly
2004-09-27 23:12 ` J.A. Magallon
2004-09-28 7:21 ` Ingo Molnar
2004-09-28 7:49 ` Nick Piggin [this message]
2004-09-28 10:24 ` Ingo Molnar
2004-09-28 10:48 ` Nick Piggin
2004-09-30 21:58 ` J.A. Magallon
2004-09-30 22:56 ` Ingo Molnar
2004-09-30 23:16 ` J.A. Magallon
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=4159177F.7030803@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=jamagallon@able.es \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tytso@mit.edu \
/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