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, 16 Mar 2010 15:25:17 -0700
From:	Roland Dreier <rdreier@...co.com>
To:	"Robert P. J. Day" <rpjday@...shcourse.ca>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: kfifo:  possible weird violation of what should be invariant

 >   sure, the code seems to work, but allowing the internal values of a
 > kfifo to contain invalid values on a regular basis would seem to make
 > a mess of, say, tracing or debugging.  making sure that offset values
 > actually lie within their valid range would seem to be one of those
 > ASSERT() things that should always be true, should it not?  is there a
 > reason the design is like this?

Actually I believe having the values be free-running without clamping
them makes the code much simpler -- the reason being that you preserve
the invariant of "in" always being ahead of "out".  If you reduce the
pointers modulo the size, then you end up having a lot of code that has
two cases: one to handle "in > out", and one to handle "in < out because
in has wrapped and out hasn't yet".

 - R.
-- 
Roland Dreier  <rolandd@...co.com>
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
--
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