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>
Fri, 1 Nov 2024 04:23:37 +0000 (05:23 +0100)
commitf6dd17531e56e17227f909c64a83c57a55ea594a
treedccf2dda64ebe51252cec313dd81ac032e8686b0
parent9e201e6e07c0f1a79bdbcaf245e2fc862f51f3f5
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