Skip to content

Commit 794edf3

Browse files
dhowellsxjamesmorris
authored andcommitted
lockdown: Lock down TIOCSSERIAL
Lock down TIOCSSERIAL as that can be used to change the ioport and irq settings on a serial port. This only appears to be an issue for the serial drivers that use the core serial code. All other drivers seem to either ignore attempts to change port/irq or give an error. Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Matthew Garrett <mjg59@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Signed-off-by: James Morris <jmorris@namei.org>
1 parent 3f19cad commit 794edf3

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎drivers/tty/serial/serial_core.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/serial_core.h>
2323
#include <linux/delay.h>
2424
#include <linux/mutex.h>
25+
#include <linux/security.h>
2526

2627
#include <linux/irq.h>
2728
#include <linux/uaccess.h>
@@ -862,6 +863,10 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
862863
goto check_and_exit;
863864
}
864865

866+
retval = security_locked_down(LOCKDOWN_TIOCSSERIAL);
867+
if (retval && (change_irq || change_port))
868+
goto exit;
869+
865870
/*
866871
* Ask the low level driver to verify the settings.
867872
*/

‎include/linux/security.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ enum lockdown_reason {
112112
LOCKDOWN_MSR,
113113
LOCKDOWN_ACPI_TABLES,
114114
LOCKDOWN_PCMCIA_CIS,
115+
LOCKDOWN_TIOCSSERIAL,
115116
LOCKDOWN_INTEGRITY_MAX,
116117
LOCKDOWN_CONFIDENTIALITY_MAX,
117118
};

‎security/lockdown/lockdown.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = {
2727
[LOCKDOWN_MSR] = "raw MSR access",
2828
[LOCKDOWN_ACPI_TABLES] = "modifying ACPI tables",
2929
[LOCKDOWN_PCMCIA_CIS] = "direct PCMCIA CIS storage",
30+
[LOCKDOWN_TIOCSSERIAL] = "reconfiguration of serial port IO",
3031
[LOCKDOWN_INTEGRITY_MAX] = "integrity",
3132
[LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality",
3233
};

0 commit comments

Comments
 (0)