3 ms·
Here is the issue: https://source.android.com/docs/security/test/tagged-pointers https://source.android.com/docs/security/test/tagged-pointer... Android is ta
by kazinator 4y ago
Here is the issue:
https://source.android.com/docs/security/test/tagged-pointers https://source.android.com/docs/security/test/tagged-pointer...
Android is tagging the top byte of a pointer to check for misuses, like a pointer into the stack being passed to free() and such.
I have successfully worked around it. The only pointers affected by this that we care about are Lisp heap objects. These are allocated in large block.
When we allocate a heap block, we clear the top 16 bits of the pointer, and save that value in heap->tag.
Then, if and when we free that heap block, instead of calling free(heap), we first mask back the heap->tag that we stripped away and free the resulting pointer.
Everything builds on a Pixel 4a; tests pass.
In spite of the rude language in that Android documentation, whereby some troglodytes disparage the work of their superiors, and give grave admonishments, it's possible to peacefully coexist.