This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug runtime/13546] New: improve map hashing


http://sourceware.org/bugzilla/show_bug.cgi?id=13546

             Bug #: 13546
           Summary: improve map hashing
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: runtime
        AssignedTo: systemtap@sourceware.org
        ReportedBy: fche@redhat.com
    Classification: Unclassified


The runtime/map* functions have several weaknesses w.r.t. hashing
that we should improve.

1) HASH_TABLE_BITS/SIZE should probably be a function of MAXMAPENTRIES.
2) str_hash() should be more hashy.  It looks rather wimpy.
3) With deliberate hash-collision-inducing data conceivably fed to stap,
   we should investigate salting the map FOO_hash functions with some
   runtime-random value, such as a few bytes collected at startup time with
   get_random_bytes(), as in

static unsigned long stap_hash_seed; /* init during module startup */
static unsigned int int64_hash (const int64_t v)
{
        return (unsigned int)hash_long (((unsigned long)v) ^ stap_hash_seed,
                                        HASH_TABLE_BITS);
}
/* and similarly for str_hash */

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]