Tcache
Ubuntu 17.04 에서 glibc 2.6 버전이 릴리즈 되었는데 tcache_entry와 tcache_perthread_struct라는 구조체가 새로 추가되었다.
특징
- Single linked list(단일 연결 구조)를 이루고 있다.
- Consolidate를 하지 않는다.
- LIFO 구조를 가지고 있다.
- Pointer가 오직 next chunk만 포함하고 있다.
- 기본적으로 Chunk Size는 24 ~ 1032 bytes 이다. (32bit : 12 ~ 516 bytes)
1 | /* This is another arbitrary limit, which tunables can change. Each |
tcache bin 한 개당 기본적으로 7개의 Chunk를 가질 수 있다.
1 |
|
1 | tcache_put (mchunkptr chunk, size_t tc_idx) |
1 | /* Caller must ensure that we know tc_idx is valid and there's |
tcache_put과 tcache_get 함수는 _int_free 와 __libc_malloc 함수가 시작할때 호출된다.
tacace_get은 할당된 크기의 영역이 요청될때 0x408보다 작으면 호출된다.