Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
py/gc: Ensure a gap of one byte after the ATB.
Prior to this fix the follow crash occurred. With a GC layout of: GC layout: alloc table at 0x3fd80428, length 32001 bytes, 128004 blocks finaliser table at 0x3fd88129, length 16001 bytes, 128008 blocks pool at 0x3fd8bfc0, length 2048064 bytes, 128004 blocks Block 128003 is an AT_HEAD and eventually is passed to gc_mark_subtree. This causes gc_mark_subtree to call ATB_GET_KIND(128004). When block 1 is created with a finaliser, the first byte of the finaliser table becomes 0x2, but ATB_GET_KIND(128004) reads these bits as AT_TAIL, and then gc_mark_subtree references past the end of the heap, which happened to be past the end of PSRAM on the esp32-s2. The fix in this commit is to ensure there is a one-byte gap after the ATB filled permanently with AT_FREE. Fixes issue micropython#7116. See also adafruit#5021 Signed-off-by: Jeff Epler <jepler@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
- Loading branch information