This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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 dynamic-link/18177] possible typo in an "and"-"shift-right" operation with ARCH_LA_PLTEXIT


https://sourceware.org/bugzilla/show_bug.cgi?id=18177

--- Comment #2 from J.N. <je.nunez at yahoo dot ca> ---

Related to Andreas Schwab's point, the &= in line 325 clears the previous,
higher bits of enterxit if any had been set in previous [cnt] iterations (flags
doesn't seem to be accumulative across the for-loop).

We have kept seeing, and the "Logical-AND" in lines 304-305 is different to the
"Logical-OR" in lines 219-222 of elf/dl-sym.c, ie., in dl-runtime.c it is
required both LA_FLG_BINDFROM and LA_FLG_BINDTO, but in dl-sym.c either flag is
enough (in order to call afct->symbind()) -although the purpose of both
locations is not the same, and this could be related to misunderstanding the
documentation of rtld-audit(7) on these two LA_FLG_BIND* flags, if both need to
be set or only one is enough (sorry, this paragraph can be a misunderstanding
with the rtld-audit(7) documentation).


elf/dl-runtime.c:

       280    /* Determine whether any of the two participating DSOs is
       281       interested in auditing.  */
       282    if ((l->l_audit_any_plt | result->l_audit_any_plt) != 0)
       283      {
       284    unsigned int flags = 0;
       ...
       300        for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
       301          {
       302            /* XXX Check whether both DSOs must request action or
       303               only one */
       304            if ((l->l_audit[cnt].bindflags & LA_FLG_BINDFROM) != 0
- AND -305                && (result->l_audit[cnt].bindflags & LA_FLG_BINDTO)
!= 0)
       306              {
       307                if (afct->symbind != NULL)
       308                  {
       309                    uintptr_t new_value
       310                      = afct->symbind (&sym, reloc_result->boundndx,
       311                                       &l->l_audit[cnt].cookie,
       312                                       &result->l_audit[cnt].cookie,
       313                                       &flags,
       314                                       strtab2 + defsym->st_name);
       315                    if (new_value != (uintptr_t) sym.st_value)
       316                      {
       317                        flags |= LA_SYMB_ALTVALUE;
       318                        sym.st_value = new_value;
       319                      }
       320                  }
       321
       322                /* Remember the results for every audit library and
       323                   store a summary in the first two bits.  */
       324                reloc_result->enterexit
****** 325                  &= flags & (LA_SYMB_NOPLTENTER |
LA_SYMB_NOPLTEXIT);
       326                reloc_result->enterexit
       327                  |= ((flags & (LA_SYMB_NOPLTENTER |
LA_SYMB_NOPLTEXIT))
       328                      << ((cnt + 1) * 2));

elf/dl-sym.c:

       207    if ((match->l_audit_any_plt | result->l_audit_any_plt) != 0)
       208      {
       209        unsigned int altvalue = 0;
       210        struct audit_ifaces *afct = GLRO(dl_audit);
       211        /* Synthesize a symbol record where the st_value field is
       212           the result.  */
       213        ElfW(Sym) sym = *ref;
       214        sym.st_value = (ElfW(Addr)) value;
       215
       216        for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
       217          {
       218            if (afct->symbind != NULL
       219                && ((match->l_audit[cnt].bindflags & LA_FLG_BINDFROM)
       220                    != 0
- OR - 221                    || ((result->l_audit[cnt].bindflags &
LA_FLG_BINDTO)
       222                        != 0)))
       223              {
       224                unsigned int flags = altvalue | LA_SYMB_DLSYM;
       225                uintptr_t new_value
       226                  = afct->symbind (&sym, ndx,
       227                                   &match->l_audit[cnt].cookie,
       228                                   &result->l_audit[cnt].cookie,
       229                                   &flags, strtab + ref->st_name);
       230                if (new_value != (uintptr_t) sym.st_value)
       231                  {
      ...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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