lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090210194955.GU11872@woodchuck>
Date:	Tue, 10 Feb 2009 19:49:55 +0000
From:	Alexander Clouter <alex@...riz.org.uk>
To:	Herbert Xu <herbert@...dor.apana.org.au>
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org
Subject: Re: [PATCHv2] hw_random: add timeriomem-rng driver

Hi,

* Alexander Clouter <alex@...riz.org.uk> [2009-02-10 19:39:04+0000]:
> 
> * Herbert Xu <herbert@...dor.apana.org.au> [2009-02-10 15:57:49+1100]:
> > 
> > Sorry, but this just doesn't work for O_NONBLOCK reads.  What'll
> > happen is that the first failed read will return -EAGAIN, and when
> > we're called again immediately (because hwrng polling support is
> > non-existant), it'll just read the data right away because now
> > there is no timer.
> >
> My original code[1] approach, with timer_pending() in there, would have 
> been okay then, right?
> ----
> if (timer_pending(&timeriomem_rng_timer)) {
>   if (!wait)
>     return 0;
> 
>   del_timer_sync(&timeriomem_rng_timer);
>   delay = timeriomem_rng_timer.expires - jiffies;
> 
>   schedule_timeout_uninterruptible(delay);
> }
> ----
> 
> [snipped]
> > 
> > Instead of deleting the timer above, why not create a rng->present
> > variable which you set to zero here, and the timer sets it to
> > non-zero.  Then you just need to return rng->present in your
> > data_present function.
> > 
> Sounds fair, better than the timer_pending approach and easier to 
> understand.
> 
Actually, as timer_pending() just reads a field in timer_list (or so 
says the 'manual'), would it not be a waste to have a second effectively 
duplicate variable?  In a blocking read of data_presnt you would have to 
have del_timer_sync() anyway...the two approaches would be identical 
except for the rng->present variable approach would force us to waste a 
whole extra bit of ram?

Should I keep with my old original timer_pending() approach?

Of course I could be talking rubbish...

Cheers

-- 
Alexander Clouter
.sigmonster says: So many men; so little time.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ