[issue41013] test_os.test_memfd_create() fails on AMD64 FreeBSD Shared 3.x

Kyle Evans report at bugs.python.org
Thu Jun 18 10:06:50 EDT 2020


Kyle Evans <kevans at FreeBSD.org> added the comment:

I think it's too early to look at this, I'll circle back another time. :-) I got a minute and extracted the relevant test, but I guess there must have been some fundamental transcription error:

import os

fd = os.memfd_create("Hi", os.MFD_CLOEXEC)
if fd == -1:
    print("boo")
    os.exit(1)

if os.get_inheritable(fd):
    print("inheritable, boo")
    os.exit(1)

with open(fd, "wb", closefd=False) as f:
    f.write(b'memfd_create')
    if f.tell() != 12:
        print("Hork")
        os.exit(1)
    print("What?")

print("Done")

When I run this with python3.9, I get:

...
 3038 100554: shm_open2(SHM_ANON,O_RDWR|O_CLOEXEC,00,0,"memfd:Hi") = 3 (0x3)
 3038 100554: fcntl(3,F_GETFD,)          = 1 (0x1)
 3038 100554: fstat(3,{ mode=---------- ,inode=10,size=0,blksize=4096 }) = 0 (0x0)
 3038 100554: ioctl(3,TIOCGETA,0x7fffffffe2a0)   ERR#25 'Inappropriate ioctl for device'
 3038 100554: lseek(3,0x0,SEEK_CUR)      = 0 (0x0)
 3038 100554: lseek(3,0x0,SEEK_CUR)      = 0 (0x0)
 3038 100554: write(3,"memfd_create",12)     = 0 (0x0)
 3038 100554: write(3,"memfd_create",12)     = 0 (0x0)
 3038 100554: write(3,"memfd_create",12)     = 0 (0x0)
 3038 100554: write(3,"memfd_create",12)     = 0 (0x0)
 3038 100554: write(3,"memfd_create",12)     = 0 (0x0)
(ad infinitum)

So in my local repro, Python is looping forever on successful write() for reasons I'm not immediately sure of.

----------

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


More information about the Python-bugs-list mailing list