Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jul 2014 11:44:05 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 192238] New: rtld-elf should use powerof2(); nmaskwords must not be zero
Message-ID:  <bug-192238-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192238

            Bug ID: 192238
           Summary: rtld-elf should use powerof2(); nmaskwords must not be
                    zero
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: Needs Triage
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: conrad.meyer@isilon.com

>From DT_GNU_HASH parsing:

==========================================================
/* Number of bitmask words is required to be power of 2 */
nmw_power2 = ((nmaskwords & (nmaskwords - 1)) == 0);
obj->maskwords_bm_gnu = nmaskwords - 1;

...

obj->valid_hash_gnu = nmw_power2 && obj->nbuckets_gnu > 0 &&
    obj->buckets_gnu != NULL;
==========================================================

The nmw_power2 statement can be rewritten using the powerof2() macro from
sys/param.h:

nmw_power2 = powerof2(nmaskwords);

And valid_hash_gnu should probably include '&& nmaskwords > 0' (see underflow
in obj->maskwords_bm_gnu if nmaskwords is less than 1).

I may eventually get around to attaching a patch, but this isn't a priority for
us (just something that came up reviewing a similar change to the kernel
linker, which will end up on bugzilla sometime soon).

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-192238-8>