Syscall(mknod) is incorrectly successful on ppc systems

On PowerPC systems the following short check fails:

errno = 0;

unsigned long dev = 0xfacefeed00000000ULL | makedev(1, 7);
syscall(__NR_mknod, "/", S_IFCHR | 0777, dev);

if (errno != EEXIST) {
	perror("mknod");
	exit(1);
}

(see github repository: [1])

On ppc mknod is successful, but it should fail with EEXISTS (as “/” exists). Other architectures are fine [2].

If 0xfacefeed00000000ULL magic is removed from dev, the check passes on pcc too. Although the choice of this dev value might seem irrational, this kind of or-ing is frequently used is strace tests, where mknod test started failing about a week ago [3].

[1] https://github.com/AkosUzonyi/travis-ppc-bugreport
[2] https://travis-ci.org/github/AkosUzonyi/travis-ppc-bugreport/builds/720778638
[3] https://travis-ci.com/github/strace/strace/builds

Imprint