From: Stanislav Kinsbursky <skinsbur...@parallels.com> Logic inherited from rhel6: instead of doing something, echo passed command in container.
https://jira.sw.ru/browse/PSBM-20664 Signed-off-by: Stanislav Kinsbursky <skinsbur...@parallels.com> ========================== Original comment: It's backport of patch: diff-ve-fake-sysrq-trigger-in-ct-20091002 Patch from Konstantin Khorenko <khore...@openvz.org>: provides /proc/sysrq-trigger file inside a Container - Oracle 11g Release 1 RAC needs this. Writing to the file inside a CT leads to nothing, first 10 writes are logged. https://bugzilla.sw.ru/show_bug.cgi?id=448149 ========================== (cherry picked from vz7 commit 103e7fa4e8e182287162a202cbab188fdec8509f) Signed-off-by: Konstantin Khorenko <khore...@virtuozzo.com> Cherry-picked from vz8 commit 579cc5b6f2f5 ("VE/sysrq-trigger: make it VE-namespace aware"). Fix log limiting. Signed-off-by: Nikita Yushchenko <nikita.yushche...@virtuozzo.com> --- drivers/tty/sysrq.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index 6628792431dc..be9b2a150e3c 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c @@ -51,6 +51,7 @@ #include <linux/syscalls.h> #include <linux/of.h> #include <linux/rcupdate.h> +#include <linux/ve.h> #include <asm/ptrace.h> #include <asm/irq_regs.h> @@ -1152,10 +1153,18 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf, { if (count) { char c; + struct ve_struct *cur = get_exec_env(); + static int pnum = 10; if (get_user(c, buf)) return -EFAULT; - __handle_sysrq(c, false); + if (ve_is_super(cur)) + __handle_sysrq(c, false); + else if (pnum > 0) { + printk("SysRq: CT#%s sent '%c' magic key.\n", + cur->ve_name, c); + pnum--; + } } return count; @@ -1168,7 +1177,7 @@ static const struct proc_ops sysrq_trigger_proc_ops = { static void sysrq_init_procfs(void) { - if (!proc_create("sysrq-trigger", S_IWUSR, NULL, + if (!proc_create("sysrq-trigger", S_ISVTX | S_IWUSR, NULL, &sysrq_trigger_proc_ops)) pr_err("Failed to register proc interface\n"); } -- 2.30.2 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel