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);
      kbind(0x171d762ebd8,0x8,0x7f7ffffde1f8)
      kbind 0
      ioctl(0,TIOCGETA,0x7f7ffffde2f0)
      ioctl 0


EuroBSDCon 2014 Copyright © 2014 Philip Guenther