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]
Date:	Tue, 7 Jul 2009 10:08:56 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Martin Schwidefsky <schwidefsky@...ibm.com>
cc:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	john stultz <johnstul@...ibm.com>
Subject: Re: [PATCH] optimized ktime_get[_ts] for GENERIC_TIME=y

Martin,

On Tue, 7 Jul 2009, Martin Schwidefsky wrote:
> On Mon, 6 Jul 2009 22:31:39 +0200 (CEST)
> Thomas Gleixner <tglx@...utronix.de> wrote:
> 
> > On Mon, 6 Jul 2009, Martin Schwidefsky wrote:
> > > +ktime_t ktime_get(void)
> > > +{
> > > +	cycle_t cycle_now, cycle_delta;
> > > +	struct timespec time;
> > > +	unsigned long seq;
> > > +	s64 nsecs;
> > > +
> > > +	do {
> > > +		seq = read_seqbegin(&xtime_lock);
> > > +		time.tv_sec = xtime.tv_sec + wall_to_monotonic.tv_sec;
> > > +		time.tv_nsec = xtime.tv_nsec + wall_to_monotonic.tv_nsec;
> > 
> > That's actually a violation of the timespec semantics. tv_nsec can end
> > up greater than (10^9 - 1). Please use separate sec and nsec variables.
> 
> Well the tv_sec/tv_nsec fields of a timespec are long values. But its
> no problem to switch to local variables.

Right. I'm not worried about an overflow of the variable. I was about
to suggest using timespec_to_ktime() to fix the !SCALAR problem when I
noticed that the timespec is possibly not normalized. Not using a
timespec makes the code more obvious I think.

Thanks,

	tglx

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