Interestingly, faccessat2() does correctly return ENOSYS when using a simple chroot instead of systemd-nspawn:
ubuntu@test-s390x:~/h$ sudo systemd-nspawn
Spawning container h on /home/ubuntu/h.
Press ^] three times within 1s to kill container.
root@h:~# test -x /bin/bash || echo "fail"
fail
root@h:~# exit
logout
Container h exited successfully.
ubuntu@test-s390x:~/h$ sudo chroot .
root@test-s390x:/# test -x /bin/bash || echo "fail"
root@test-s390x:/#
Interestingly, faccessat2() does correctly return ENOSYS when using a simple chroot instead of systemd-nspawn:
ubuntu@ test-s390x: ~/h$ sudo systemd-nspawn test-s390x: ~/h$ sudo chroot .
Spawning container h on /home/ubuntu/h.
Press ^] three times within 1s to kill container.
root@h:~# test -x /bin/bash || echo "fail"
fail
root@h:~# exit
logout
Container h exited successfully.
ubuntu@
root@test-s390x:/# test -x /bin/bash || echo "fail"
root@test-s390x:/#
and to verify, stracing bash:
faccessat2( AT_FDCWD, "/bin/bash", X_OK, AT_EACCESS) = -1 ENOSYS (Function not implemented)
faccessat(AT_FDCWD, "/bin/bash", X_OK) = 0