본문 바로가기

Heap analysis/glibc 2.23

(glibc 2.23)check_malloced_chunk

해당 함수를 malloc함수에서 재할당할 청크의 주소를 반환하기 전에 호출된다

do_check_remalloced_chunk를 호출하고 청크에 PREV_INUSE비트가 설정되어 있는지 확인한다 

 

/*
   Properties of nonrecycled chunks at the point they are malloced
 */

static void
do_check_malloced_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T s)
{
  /* same as recycled case ... */
  do_check_remalloced_chunk (av, p, s);

  /*
     ... plus,  must obey implementation invariant that prev_inuse is
     always true of any allocated chunk; i.e., that each allocated
     chunk borders either a previously allocated and still in-use
     chunk, or the base of its memory arena. This is ensured
     by making all allocations from the `lowest' part of any found
     chunk.  This does not necessarily hold however for chunks
     recycled via fastbins.
   */

  assert (prev_inuse (p));
}
  • do_check_remalloced_chunk 호출
  • prev_inuse가 설정 되어있는지 검사

 


사용된 함수 및 매크로

 

do_check_remalloced_chunk 참고글

 

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

(glibc 2.23) _int_free  (0) 2022.04.25
(glibc 2.23) unlink  (0) 2022.04.22
(glibc 2.23) free  (0) 2022.03.23
(glibc 2.23) do_check_free_chunk  (0) 2022.03.22
(glibc 2.23) do_check_chunk  (0) 2022.03.01