Patch "tty: allow TIOCSLCKTRMIOS with CAP_CHECKPOINT_RESTORE" has been added to the 6.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    tty: allow TIOCSLCKTRMIOS with CAP_CHECKPOINT_RESTORE

to the 6.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tty-allow-tiocslcktrmios-with-cap_checkpoint_restore.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 85655386eaef056ee0c06ea7a0117c3ece7e50f0
Author: Adrian Reber <areber@xxxxxxxxxx>
Date:   Fri Dec 8 15:36:56 2023 +0100

    tty: allow TIOCSLCKTRMIOS with CAP_CHECKPOINT_RESTORE
    
    [ Upstream commit e0f25b8992345aa5f113da2815f5add98738c611 ]
    
    The capability CAP_CHECKPOINT_RESTORE was introduced to allow non-root
    users to checkpoint and restore processes as non-root with CRIU.
    
    This change extends CAP_CHECKPOINT_RESTORE to enable the CRIU option
    '--shell-job' as non-root. CRIU's man-page describes the '--shell-job'
    option like this:
    
      Allow one to dump shell jobs. This implies the restored task will
      inherit session and process group ID from the criu itself. This option
      also allows to migrate a single external tty connection, to migrate
      applications like top.
    
    TIOCSLCKTRMIOS can only be done if the process has CAP_SYS_ADMIN and
    this change extends it to CAP_SYS_ADMIN or CAP_CHECKPOINT_RESTORE.
    
    With this change it is possible to checkpoint and restore processes
    which have a tty connection as non-root if CAP_CHECKPOINT_RESTORE is
    set.
    
    Acked-by: Christian Brauner <brauner@xxxxxxxxxx>
    Signed-off-by: Adrian Reber <areber@xxxxxxxxxx>
    Acked-by: Andrei Vagin <avagin@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20231208143656.1019-1-areber@xxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 4b499301a3db..85de90eebc7b 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -844,7 +844,7 @@ int tty_mode_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
 			ret = -EFAULT;
 		return ret;
 	case TIOCSLCKTRMIOS:
-		if (!capable(CAP_SYS_ADMIN))
+		if (!checkpoint_restore_ns_capable(&init_user_ns))
 			return -EPERM;
 		copy_termios_locked(real_tty, &kterm);
 		if (user_termios_to_kernel_termios(&kterm,
@@ -861,7 +861,7 @@ int tty_mode_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
 			ret = -EFAULT;
 		return ret;
 	case TIOCSLCKTRMIOS:
-		if (!capable(CAP_SYS_ADMIN))
+		if (!checkpoint_restore_ns_capable(&init_user_ns))
 			return -EPERM;
 		copy_termios_locked(real_tty, &kterm);
 		if (user_termios_to_kernel_termios_1(&kterm,




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux