All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Micay <danielmicay@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>, Kees Cook <keescook@chromium.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ley Foon Tan <lftan@altera.com>,
	nios2-dev@lists.rocketboards.org,
	Laura Abbott <labbott@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: nios2 crash due to 'init/main.c: extract early boot entropy from the passed cmdline'
Date: Mon, 11 Sep 2017 14:25:51 -0400	[thread overview]
Message-ID: <1505154351.14903.1.camel@gmail.com> (raw)
In-Reply-To: <20170911173516.GB27315@roeck-us.net>

On Mon, 2017-09-11 at 10:35 -0700, Guenter Roeck wrote:
> On Mon, Sep 11, 2017 at 09:36:00AM -0700, Kees Cook wrote:
> > On Sat, Sep 9, 2017 at 8:58 PM, Guenter Roeck <linux@roeck-us.net>
> > wrote:
> > > Hi,
> > > 
> > > I noticed that nios2 images crash in mainline. Bisect points to
> > > commit
> > > 33d72f3822d7 ("init/main.c: extract early boot entropy from the
> > > passed
> > > cmdline").  Bisect log is attached.
> > > 
> > > As far as I can see, the problem is seen because
> > > add_device_randomness()
> > > calls random_get_entropy(). However, the underlying timer function
> > > used by the nios2 architecture (nios2_timer_read) is not yet
> > > initialized,
> > > causing a NULL pointer access and crash. A sample crash log is at
> > >         http://kerneltests.org/builders/qemu-nios2-master/builds/1
> > > 75/steps/qemubuildcommand/logs/stdio
> > 
> > Oh, yikes. Do you have a full call trace? (Does this come through
> > get_cycles() or via the It seems like we could either initialize the
> > timer earlier or allow it to fall back when not initialized...
> > 
> 
> nios2 doesn't give me a traceback. I followed it by adding debug
> messages.
> The code path is through get_cycles().
> 
> On nios2:
> 
> static u64 nios2_timer_read(struct clocksource *cs)
> {
> 	struct nios2_clocksource *nios2_cs = to_nios2_clksource(cs);
> 	unsigned long flags;
> 	u32 count;
> 
> 	local_irq_save(flags);
> 	count = read_timersnapshot(&nios2_cs->timer);	// <- not
> initialized
> 	local_irq_restore(flags);
> 
> 	/* Counter is counting down */
> 	return ~count;
> }
> 
> cycles_t get_cycles(void)
> {
>         return nios2_timer_read(&nios2_cs.cs);
> }
> EXPORT_SYMBOL(get_cycles);
> 
> Guenter

Maybe it should WARN and return 0 for now if that's NULL?

  reply	other threads:[~2017-09-11 18:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-10  3:58 nios2 crash due to 'init/main.c: extract early boot entropy from the passed cmdline' Guenter Roeck
2017-09-11 16:36 ` Kees Cook
2017-09-11 17:35   ` Guenter Roeck
2017-09-11 18:25     ` Daniel Micay [this message]
2017-09-11 18:41       ` Kees Cook
2017-09-11 19:09         ` Laura Abbott

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=1505154351.14903.1.camel@gmail.com \
    --to=danielmicay@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=keescook@chromium.org \
    --cc=labbott@redhat.com \
    --cc=lftan@altera.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=nios2-dev@lists.rocketboards.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.