The description of EINVAL in mknod(2) is wrong:

     [EINVAL]           The process is running within an alternate root
                        directory, as created by chroot(2).

Even if a process chroot()s back to /, it can't create a device node.

The program below exits with EINVAL:

#include <sys/stat.h>
#include <unistd.h>

int main() {
    chroot("/");
    if (mknod("/t", 0x21b6, 0x1600) == -1) /* stdin amd64 */
        err(1, "mknod");
}

On Sat, Jun 7, 2014 at 2:42 PM, Miod Vallat <m...@online.fr> wrote:
>> >> Is this some kind of security protection ?
>> >
>> > of course... see mknod(2).
>>
>> i read it and still does not understand.
>
> Check the description of EINVAL.

Reply via email to