Skip to content

Commit

Permalink
lockdown: Prohibit PCMCIA CIS storage when the kernel is locked down
Browse files Browse the repository at this point in the history
Prohibit replacement of the PCMCIA Card Information Structure when the
kernel is locked down.

Suggested-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Matthew Garrett <mjg59@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: James Morris <jmorris@namei.org>
David Howells authored and James Morris committed Aug 20, 2019
1 parent 6ea0e81 commit 3f19cad
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/pcmcia/cistpl.c
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
#include <linux/pci.h>
#include <linux/ioport.h>
#include <linux/io.h>
#include <linux/security.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>

@@ -1575,6 +1576,10 @@ static ssize_t pccard_store_cis(struct file *filp, struct kobject *kobj,
struct pcmcia_socket *s;
int error;

error = security_locked_down(LOCKDOWN_PCMCIA_CIS);
if (error)
return error;

s = to_socket(container_of(kobj, struct device, kobj));

if (off)
1 change: 1 addition & 0 deletions include/linux/security.h
Original file line number Diff line number Diff line change
@@ -111,6 +111,7 @@ enum lockdown_reason {
LOCKDOWN_IOPORT,
LOCKDOWN_MSR,
LOCKDOWN_ACPI_TABLES,
LOCKDOWN_PCMCIA_CIS,
LOCKDOWN_INTEGRITY_MAX,
LOCKDOWN_CONFIDENTIALITY_MAX,
};
1 change: 1 addition & 0 deletions security/lockdown/lockdown.c
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = {
[LOCKDOWN_IOPORT] = "raw io port access",
[LOCKDOWN_MSR] = "raw MSR access",
[LOCKDOWN_ACPI_TABLES] = "modifying ACPI tables",
[LOCKDOWN_PCMCIA_CIS] = "direct PCMCIA CIS storage",
[LOCKDOWN_INTEGRITY_MAX] = "integrity",
[LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality",
};

0 comments on commit 3f19cad

Please sign in to comment.