본문 바로가기

Heap analysis/glibc 2.29

(glibc 2.29) tcache_put

전체 코드 아래 더보기

더보기
/* Caller must ensure that we know tc_idx is valid and there's room
   for more chunks.  */
static __always_inline void
tcache_put (mchunkptr chunk, size_t tc_idx)
{
  tcache_entry *e = (tcache_entry *) chunk2mem (chunk);
  assert (tc_idx < TCACHE_MAX_BINS);

  /* Mark this chunk as "in the tcache" so the test in _int_free will
     detect a double free.  */
  e->key = tcache;

  e->next = tcache->entries[tc_idx];
  tcache->entries[tc_idx] = e;
  ++(tcache->counts[tc_idx]);
}

추가된 코드


  /* Mark this chunk as "in the tcache" so the test in _int_free will
     detect a double free.  */
  e->key = tcache;

double free 검증하는 key값을 tcache로 채우는 코드가 추가되었다

'Heap analysis > glibc 2.29' 카테고리의 다른 글

(glibc 2.29) get_max_fast  (0) 2022.07.30
(glibc 2.29) tcache_get  (0) 2022.05.19
(glibc 2.29) tcache_init  (0) 2022.05.19
(glibc 2.29) _int_free  (0) 2022.05.15
(glibc 2.29) free  (0) 2022.05.15