Prev Next Secure Lazy Binding Slide #17

ld.so: before and after

      /* set the GOT to RW */
      sigprocmask(SIG_BLOCK, &allsigs, &savedmask);
      spinlock_lock(&bind_lock);                /* libpthread cb */
      mprotect(object->got_start, object->got_size, PROT_READ|PROT_WRITE);
      *(Elf_Addr *)addr = newval;
      /* put the GOT back to RO */
      mprotect(object->got_start, object->got_size, PROT_READ);
      spinlock_unlock(&bind_lock);              /* libpthread cb */
      sigprocmask(SIG_SETMASK, &curset, NULL);
      kbind(addr, sizeof(Elf_Addr), &newval);

continued...


EuroBSDCon 2014 Copyright © 2014 Philip Guenther