[New-bugs-announce] [issue43131] MMAP duplicate reads and writes on ARM64 platform

Paul Swirhun report at bugs.python.org
Thu Feb 4 17:45:15 EST 2021


New submission from Paul Swirhun <paulswirhun at gmail.com>:

mmap (example, as used in python-periphery) duplicates writes, compared to devmem and a c-periphery on an ARM64 platform (Zynq/Petalinux/Yocto). There are various other reports of duplicated writes using mmap suggesting it is a bug. Example:

fd = os.open("/dev/mem", os.O_RDWR | os.O_SYNC)
mapping = mmap.mmap(fd, 4096, flags=mmap.MAP_SHARED, prot=(mmap.PROT_READ | mmap.PROT_WRITE), offset=0x80000000)
mapping.write(bytearray([0x0,]* 4))  # results in 2 writes, should be 1
mapping.write(bytearray([0x0,]* 8))  # results in 4 writes, should be 1-2 depending on bus width (32b vs 64b)
# OR:
mapping[0:4] = struct.pack("=L", 0x0)  # results in 2 writes, should be 1

----------
components: Library (Lib)
messages: 386501
nosy: psswirhun
priority: normal
severity: normal
status: open
title: MMAP duplicate reads and writes on ARM64 platform
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43131>
_______________________________________


More information about the New-bugs-announce mailing list