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, 12 May 2023 04:08:40 +0000 (05:08 +0100)
commit697b8fa5eed680d07b750f74aaf85a9e8cf657f0
treea26acb6999f711d44e2e3c183538e0089929384a
parenta11720ecda5e88ca846afda4e102feb18efb877e
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