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)
committerBen Hutchings <benh@debian.org>
Mon, 19 May 2025 17:24:37 +0000 (19:24 +0200)
commit677d990e773ea3fdc28fdfeb4e815e888b3344d5
treee51e7dfabd4a92be41a47f0e2990ca08a6fd59a1
parent67b9375276431ee696b7444f6d25354f97086e4f
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