Bug 180363

Summary: WTF Hasher: disallow -0. and NaNs
Product: WebKit Reporter: JF Bastien <jfbastien>
Component: Web Template FrameworkAssignee: JF Bastien <jfbastien>
Status: RESOLVED WONTFIX    
Severity: Normal CC: achristensen, benjamin, cdumez, cmarcelo, darin, dbates, ews-watchlist, jfbastien, mmaxfield, sam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 180318    
Bug Blocks:    
Attachments:
Description Flags
patch
jfbastien: commit-queue-
patch
jfbastien: commit-queue-
patch
jfbastien: commit-queue-
patch jfbastien: commit-queue-

JF Bastien
Reported 2017-12-04 10:03:03 PST
I want to see if we can just outright disallow them by adding a debug check that we never hash them. This is based on a discussion here: https://bugs.webkit.org/show_bug.cgi?id=180318 Let's see what the tests say, and if anyone has opinions. Original comment: I've been thinking about this, and I think there are 3 things we could plausibly want: 1. Deal with bits only, treating -0. != +0. and all NaNs with different payload as different (and same payload as the same). 2. Deal with IEEE-754 semantics, treating -0. == +0., and all NaNs as different. 3. Ban -0. and all NaNs from hashing. I think these all make sense in different context, but choosing 1. and 2. requires knowing what situation we're in! It seems like 3. is the most conservative thing to do if we don't know how hashing is used.
Attachments
patch (3.80 KB, patch)
2017-12-04 10:04 PST, JF Bastien
jfbastien: commit-queue-
patch (3.80 KB, patch)
2017-12-04 10:47 PST, JF Bastien
jfbastien: commit-queue-
patch (4.40 KB, patch)
2017-12-04 12:46 PST, JF Bastien
jfbastien: commit-queue-
patch (4.75 KB, patch)
2017-12-04 16:29 PST, JF Bastien
jfbastien: commit-queue-
JF Bastien
Comment 1 2017-12-04 10:04:34 PST
JF Bastien
Comment 2 2017-12-04 10:47:54 PST
Created attachment 328362 [details] patch Fix typo.
JF Bastien
Comment 3 2017-12-04 12:46:17 PST
Created attachment 328377 [details] patch Missing include.
EWS Watchlist
Comment 4 2017-12-04 12:49:18 PST
Attachment 328377 [details] did not pass style-queue: ERROR: Source/WTF/wtf/Hasher.h:26: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
JF Bastien
Comment 5 2017-12-04 16:29:21 PST
Created attachment 328406 [details] patch Comment out long-running test. FWIW I also test that all 16-bit values hash uniquely (they do) and that the collision rate is low for 32-bit values (it's 3%). I haven't checked the clustering of collisions in 32-bit. Presumably if we wanted to prevent hashflood we'd use another hash and we would mix in a per-process salt anyways.
JF Bastien
Comment 6 2018-02-01 10:09:01 PST
Not sure we want to do this. Closing.
Note You need to log in before you can comment on or make changes to this bug.