mtd: phram,slram: Disable when the kernel is locked down
authorBen Hutchings <ben@decadent.org.uk>
Fri, 30 Aug 2019 14:54:24 +0000 (15:54 +0100)
committerSalvatore Bonaccorso <carnil@debian.org>
Tue, 13 Dec 2022 20:46:50 +0000 (20:46 +0000)
commit08b5cc8d33fd6b3e56f69404c64284349cbff697
tree9252f7113dee8ec4ee4b4436e739db2ccc3902a5
parent4202250e245c9b63560a834365726c3ce8653ec9
mtd: phram,slram: Disable when the kernel is locked down

Forwarded: https://lore.kernel.org/linux-security-module/20190830154720.eekfjt6c4jzvlbfz@decadent.org.uk/

These drivers allow mapping arbitrary memory ranges as MTD devices.
This should be disabled to preserve the kernel's integrity when it is
locked down.

* Add the HWPARAM flag to the module parameters
* When slram is built-in, it uses __setup() to read kernel parameters,
  so add an explicit check security_locked_down() check

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Matthew Garrett <mjg59@google.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Joern Engel <joern@lazybastard.org>
Cc: linux-mtd@lists.infradead.org
Gbp-Pq: Topic features/all/lockdown
Gbp-Pq: Name mtd-disable-slram-and-phram-when-locked-down.patch
drivers/mtd/devices/phram.c
drivers/mtd/devices/slram.c