[Bug 192238] New: rtld-elf should use powerof2(); nmaskwords must not be zero

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Jul 29 11:44:05 UTC 2014


            Bug ID: 192238
           Summary: rtld-elf should use powerof2(); nmaskwords must not be
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: Needs Triage
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: conrad.meyer at 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

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.

More information about the freebsd-bugs mailing list