powerpc: Move default security feature flags
authorMauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Sat, 26 May 2018 04:27:46 +0000 (14:27 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:51:53 +0000 (07:51 +0200)
commit e7347a86830f38dc3e40c8f7e28c04412b12a2e7 upstream.

This moves the definition of the default security feature flags
(i.e., enabled by default) closer to the security feature flags.

This can be used to restore current flags to the default flags.

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/include/asm/security_features.h
arch/powerpc/kernel/security.c

index 400a9050e0359c38aa0e4745df0c35ded6c890d0..fa4d2e1cf772c883ec4bf77822c660bfe167711a 100644 (file)
@@ -63,4 +63,12 @@ static inline bool security_ftr_enabled(unsigned long feature)
 // Firmware configuration indicates user favours security over performance
 #define SEC_FTR_FAVOUR_SECURITY                0x0000000000000200ull
 
+
+// Features enabled by default
+#define SEC_FTR_DEFAULT \
+       (SEC_FTR_L1D_FLUSH_HV | \
+        SEC_FTR_L1D_FLUSH_PR | \
+        SEC_FTR_BNDS_CHK_SPEC_BAR | \
+        SEC_FTR_FAVOUR_SECURITY)
+
 #endif /* _ASM_POWERPC_SECURITY_FEATURES_H */
index 2cee3dcd231b0a1ecdb727be62cc4a6d44364119..bab5a27ea8056c8317340716d33ff084e08d3b2b 100644 (file)
 #include <asm/security_features.h>
 
 
-unsigned long powerpc_security_features __read_mostly = \
-       SEC_FTR_L1D_FLUSH_HV | \
-       SEC_FTR_L1D_FLUSH_PR | \
-       SEC_FTR_BNDS_CHK_SPEC_BAR | \
-       SEC_FTR_FAVOUR_SECURITY;
-
+unsigned long powerpc_security_features __read_mostly = SEC_FTR_DEFAULT;
 
 ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf)
 {