iOS Kernel Heap Armageddon - Hakim

iOS Kernel Heap Armageddon - Hakim iOS Kernel Heap Armageddon - Hakim

28.11.2014 Views

Let‘s have a look at _MALLOC() Stefan Esser • iOS Kernel Heap Armageddon REVISITED • July 2012 • 22

_MALLOC() • _MALLOC() is a wrapper around kalloc() • it adds the blocksize as additional heap meta data • so the caller does not need to keep track of allocated size • it refuses to allocate 0 byte sizes size + 4 ⎧ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎩ size data Stefan Esser • iOS Kernel Heap Armageddon REVISITED • July 2012 • 23

_MALLOC()<br />

• _MALLOC() is a wrapper around kalloc()<br />

• it adds the blocksize as additional heap meta data<br />

• so the caller does not need to keep track of allocated size<br />

• it refuses to allocate 0 byte sizes<br />

size + 4<br />

⎧<br />

⎪<br />

⎪<br />

⎪<br />

⎨<br />

⎪<br />

⎪<br />

⎪<br />

⎩<br />

size<br />

data<br />

Stefan Esser • <strong>iOS</strong> <strong>Kernel</strong> <strong>Heap</strong> <strong>Armageddon</strong> REVISITED • July 2012 •<br />

23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!