The purpose of the Memory Tagging Extension (MTE) is to decrease the likelihood of memory misuse due to programmer mistakes or deliberate attacks on software.
MTE does the following:
When and how to tag memory is a choice made by software. In some cases existing software can be relinked with libraries that already use MTE to get extra protection. Sometimes the software itself will have to be modified to handle tagged memory.
In the case of this learning path, applications using the memory allocator will likely need no changes. However, the memory allocator itself will need changes as it must manage the memory tags.
The source code shown in this path is based on the allocator from the Write a Dynamic Memory Allocator learning path. Subsequent modifications have been made to the code to support MTE.
The main operations for a dynamic memory allocator are as follows:
malloc
in C)free
in C)All of these are low level operations which need to be aware of memory tagging.
Understanding how and why these operations protect memory requires some understanding of the potential attacks on the allocator.
Therefore, we will first present the source code of the allocator and guide you through building it. Then you can use it to understand the example attacks that are shown later.