TritonDataCenter / smartos-live

For more information, please see http://smartos.org/ For any questions that aren't answered there, please join the SmartOS discussion list: https://smartos.topicbox.com/groups/smartos-discuss
1.57k stars 246 forks source link

lx: mkfifo blocks forever in Gentoo LX zone #967

Open ismell opened 3 years ago

ismell commented 3 years ago

SmartOS version: 20201118T153314Z

Install the gentoo lx zone from here: https://github.com/ismell/gentoo-lx-brand-image-builder

Then try the following:

mkfifo -m 600 /tmp/foo3

The command will block forever.

Using truss we can see the brand call that blocks:

# /native/usr/bin/truss mkfifo -m 600 /tmp/foo3
...

lwp_sigmask(SIG_SETMASK, 0x00000000, 0x00000000, 0x00000000, 0x00000000) = 0xFFBFFEFF [0xFFFFFFFF]
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 4294967295, 0) = 0x7FFFEF0D0000
getcontext(0x7FFFEF0D0040)
sysconfig(_CONFIG_STACK_PROT)           = 3
mmap(0x00000000, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, 4294967295, 0) = 0x7FFFEF08F000
brand(147, 0x7FFFEF0CF000, 0x7FFFEF392E80, 0xFFFFFFFF, 0x00000000) = 0
getcontext(0x7FFFFFEFEE60)
brand(139, 0x7FFFFFEFEE60, 0x00000000, 0x00000000, 0x000003FF) = 0
mknod("/tmp/foo9", 010600, 0x00000000)      = 0
brand(130, 0x7FFFEF0CECA0, 0x00000085, 0x00000000, 0x00000000) = 0
jasonbking commented 3 years ago

Currently, mknod() in LX is a no-op (since most stuff shouldn't need to be talking to drivers directly). That's almost certainly part of the problem. I suspect it wouldn't be too difficult to allow FIFOs, and either ignore or error for other types of devices.

That LX mknod doesn't return an error today leads me to believe there's probably software out there that do try to create explicit device nodes that will fail if it returns an error, but otherwise seems to ignore it.