Hi,

I tried to run armv6 /bin/sh in a chroot on an
amd64 host using qemu-arm-static.
It failed on invalid argument to mmap.

# cp /usr/local/bin/qemu-arm-static /chroots/armv6/root/
# chroot /chroots/armv6 /root/qemu-arm-static /bin/sh
/lib/libedit.so.7: mmap of entire address space failed: Invalid argument

rtld-elf only passes MAP_GUARD but ktrace shows mmap
is called with MAP_FIXED and MAP_ANON too.
I think qemu-user-static adds the flags in bsd-user/mmap.c target_mmap().
Does the qemu-user-static port need patching to support MAP_GUARD?

ktrace snipet:
  1072 qemu-arm-static CALL
openat(AT_FDCWD,0xf4ff9020,0x300000<O_RDONLY|O_CLOEXEC|O_VERIFY>)
  1072 qemu-arm-static NAMI  "/lib/libc.so.7"
  1072 qemu-arm-static RET   openat 3
  1072 qemu-arm-static CALL  fstat(0x3,0x7ffffffe9680)
  1072 qemu-arm-static STRU  struct stat {dev=687931144, ino=192007,
mode=0100444, nlink=1, uid=0, gid=0, rdev=1548632,
atime=1498921861.605975000, mtime=1498921861.608547000,
ctime=1498921861.609724000, birthtime=1498921861.605973000,
size=1720888, blksize=32768, blocks=3456, flags=0x20000 }
  1072 qemu-arm-static RET   fstat 0
  1072 qemu-arm-static CALL
mmap(0xf4ff7000,0x1000,0x1<PROT_READ>,0x41012<MAP_PRIVATE|MAP_FIXED|MAP_ANON|MAP_PREFAULT_READ>,0xffffffff,0)
  1072 qemu-arm-static RET   mmap 4110381056/0xf4ff7000
  1072 qemu-arm-static CALL
mmap(0xf4ff7000,0x1000,0x1<PROT_READ>,0x40012<MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ>,0x3,0)
  1072 qemu-arm-static RET   mmap 4110381056/0xf4ff7000
  1072 qemu-arm-static CALL
mmap(0xf4e37000,0x1c0000,0<PROT_NONE>,0x3010<MAP_FIXED|MAP_ANON|MAP_GUARD>,0xffffffff,0)
  1072 qemu-arm-static RET   mmap -1 errno 22 Invalid argument

Thanks,
Guy
_______________________________________________
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to