After Unix98 PTY driver "virtualization" was reverted, we have to manually set sysfs permissions for ptmx. This, however, is currently impossible, because tty_class is still virtualized, which makes ve.sysfs_permissions ignore it (see sysfs_perms_set).
This patch is a quick-fix which simply creates/destroys ptmx device in ve namespace on container start/stop. It must be dropped when commit 6022450d12653 ("ve/tty: make tty_class VE-namespace aware") is reverted. Signed-off-by: Vladimir Davydov <vdavy...@parallels.com> --- drivers/tty/pty.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index bd17a459af67..529046b79b0d 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -818,6 +818,32 @@ err_file: return retval; } +static int ve_unix98_pty_init(void *data) +{ + struct ve_struct *ve = data; + struct device *dev; + + dev = device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), ve, "ptmx"); + if (IS_ERR(dev)) { + pr_warn("Failed to create ptmx device for ve %s: %ld\n", + ve->ve_name, PTR_ERR(dev)); + return PTR_ERR(dev); + } + return 0; +} + +static void ve_unix98_pty_fini(void *data) +{ + device_destroy_namespace(tty_class, MKDEV(TTYAUX_MAJOR, 2), data); +} + +static struct ve_hook ve_unix98_pty_hook = { + .init = ve_unix98_pty_init, + .fini = ve_unix98_pty_fini, + .priority = HOOK_PRIO_DEFAULT, + .owner = THIS_MODULE, +}; + static struct file_operations ptmx_fops; static void __init unix98_pty_init(void) @@ -882,6 +908,7 @@ static void __init unix98_pty_init(void) register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) panic("Couldn't register /dev/ptmx driver"); device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); + ve_hook_register(VE_SS_CHAIN, &ve_unix98_pty_hook); } #else -- 2.1.4 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel