Forum: Ruby-core [ruby-trunk - Bug #9172][Open] siphash faulty on arm little endian with word align - missing code

6f5feca7d22ab14b9ae0827f901ea325?d=identicon&s=25 prahal (Alban Browaeys) (Guest)
on 2013-11-28 13:02
(Received via mailing list)
Issue #9172 has been reported by prahal (Alban Browaeys).

----------------------------------------
Bug #9172: siphash faulty on arm little endian with word align - missing
code
https://bugs.ruby-lang.org/issues/9172

Author: prahal (Alban Browaeys)
Status: Open
Priority: High
Assignee:
Category:
Target version: current: 2.1.0
ruby -v: ruby 1.9.3p448 (2013-06-27 revision 41675) [arm-linux-eabihf]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


siphash.c check for "little endian+unaligned word access" and
"bigendian". But my arch : armv7-a cortex a9 is little endian word
aligned. This discard the loop that reduce the input below 8 bytes and a
case when the leftover is four bytes.
https://github.com/ruby/ruby/commit/525cb66467ff22...
and
https://github.com/ruby/ruby/commit/525cb66467ff22...

I found this issue via bundler as it uses the hash of an array (the
collision is "sub-setter".hash and "discoverer".hash has they both share
all other fields (platform and version both at 0.0.2).
I reported it back then as public
https://github.com/bundler/bundler/issues/2724

extracts:

- testcase: "collision.rb"
# on arm (odroid u2)
#$ ruby ~/collision.rb
#708079652
#708079652

require 'rubygems'

p ["discoverer", Gem::Version.new("0.0.2"), "ruby"].hash
p ["sub-setter", Gem::Version.new("0.0.2"), "ruby"].hash


NB: For now I rebuild with those check for UNALIGNED_WORD_ACCESS removed
and
at least I get way less conflict . This is no proper fix though.
054b5f6b8afdd5f6190bad08e46cd782?d=identicon&s=25 zzak (Zachary Scott) (Guest)
on 2013-11-28 13:26
(Received via mailing list)
Issue #9172 has been updated by zzak (Zachary Scott).

Status changed from Open to Assigned
Assignee set to nobu (Nobuyoshi Nakada)

nobu what do you think?

what is "collision.rb"?
----------------------------------------
Bug #9172: siphash faulty on arm little endian with word align - missing
code
https://bugs.ruby-lang.org/issues/9172#change-43227

Author: prahal (Alban Browaeys)
Status: Assigned
Priority: High
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version: current: 2.1.0
ruby -v: ruby 1.9.3p448 (2013-06-27 revision 41675) [arm-linux-eabihf]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


siphash.c check for "little endian+unaligned word access" and
"bigendian". But my arch : armv7-a cortex a9 is little endian word
aligned. This discard the loop that reduce the input below 8 bytes and a
case when the leftover is four bytes.
https://github.com/ruby/ruby/commit/525cb66467ff22...
and
https://github.com/ruby/ruby/commit/525cb66467ff22...

I found this issue via bundler as it uses the hash of an array (the
collision is "sub-setter".hash and "discoverer".hash has they both share
all other fields (platform and version both at 0.0.2).
I reported it back then as public
https://github.com/bundler/bundler/issues/2724

extracts:

- testcase: "collision.rb"
# on arm (odroid u2)
#$ ruby ~/collision.rb
#708079652
#708079652

require 'rubygems'

p ["discoverer", Gem::Version.new("0.0.2"), "ruby"].hash
p ["sub-setter", Gem::Version.new("0.0.2"), "ruby"].hash


NB: For now I rebuild with those check for UNALIGNED_WORD_ACCESS removed
and
at least I get way less conflict . This is no proper fix though.
F24ff61beb80aa5f13371aa22a35619c?d=identicon&s=25 mame (Yusuke Endoh) (Guest)
on 2013-11-28 14:54
(Received via mailing list)
Issue #9172 has been updated by mame (Yusuke Endoh).


I confirmed the issue on my BeagleBone Black.

    $ ./miniruby -ve 'p ["discoverer".hash, "sub-setter".hash]'
    ruby 2.1.0dev (2013-11-28 trunk 43540) [armv7l-linux-eabihf]
    [-51053038, -51053038]

I think this is a bug of the siphash-c upstream:

https://github.com/emboss/siphash-c/blob/master/sr...

The bug was introduced by nobu, interestingly.

https://github.com/emboss/siphash-c/commit/99ff3a0...

--
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Bug #9172: siphash faulty on arm little endian with word align - missing
code
https://bugs.ruby-lang.org/issues/9172#change-43230

Author: prahal (Alban Browaeys)
Status: Assigned
Priority: High
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version: current: 2.1.0
ruby -v: ruby 1.9.3p448 (2013-06-27 revision 41675) [arm-linux-eabihf]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


siphash.c check for "little endian+unaligned word access" and
"bigendian". But my arch : armv7-a cortex a9 is little endian word
aligned. This discard the loop that reduce the input below 8 bytes and a
case when the leftover is four bytes.
https://github.com/ruby/ruby/commit/525cb66467ff22...
and
https://github.com/ruby/ruby/commit/525cb66467ff22...

I found this issue via bundler as it uses the hash of an array (the
collision is "sub-setter".hash and "discoverer".hash has they both share
all other fields (platform and version both at 0.0.2).
I reported it back then as public
https://github.com/bundler/bundler/issues/2724

extracts:

- testcase: "collision.rb"
# on arm (odroid u2)
#$ ruby ~/collision.rb
#708079652
#708079652

require 'rubygems'

p ["discoverer", Gem::Version.new("0.0.2"), "ruby"].hash
p ["sub-setter", Gem::Version.new("0.0.2"), "ruby"].hash


NB: For now I rebuild with those check for UNALIGNED_WORD_ACCESS removed
and
at least I get way less conflict . This is no proper fix though.
This topic is locked and can not be replied to.