powerpc/security: Show powerpc_security_features in debugfs [Linux 5.2]

powerpc/security: Show powerpc_security_features in debugfs [Linux 5.2]

This Linux kernel change "powerpc/security: Show powerpc_security_features in debugfs" is included in the Linux 5.2 release. This change is authored by Michael Ellerman <mpe [at] ellerman.id.au> on Tue Apr 9 23:14:20 2019 +1000. The commit for this change in Linux stable tree is 398af57 (patch).

powerpc/security: Show powerpc_security_features in debugfs

This can be helpful for debugging problems with the security feature
flags, especially on guests where the flags come from the hypervisor
via an hcall and so can't be observed in the device tree.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

There are 8 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 arch/powerpc/kernel/security.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c
index b33bafb..d6ba696 100644
--- a/arch/powerpc/kernel/security.c
+++ b/arch/powerpc/kernel/security.c
@@ -104,6 +104,14 @@ static __init int barrier_nospec_debugfs_init(void)
    return 0;
 }
 device_initcall(barrier_nospec_debugfs_init);
+
+static __init int security_feature_debugfs_init(void)
+{
+   debugfs_create_x64("security_features", 0400, powerpc_debugfs_root,
+              (u64 *)&powerpc_security_features);
+   return 0;
+}
+device_initcall(security_feature_debugfs_init);
 #endif /* CONFIG_DEBUG_FS */

 #ifdef CONFIG_PPC_FSL_BOOK3E

Leave a Reply

Your email address will not be published. Required fields are marked *