Skip to content

Commit 7caedbb

Browse files
nathanchancemimizohar
authored andcommitted
integrity: Eliminate weak definition of arch_get_secureboot()
security/integrity/secure_boot.c contains a single __weak function, which breaks recordmcount when building with clang: $ make -skj"$(nproc)" ARCH=powerpc LLVM=1 ppc64_defconfig security/integrity/secure_boot.o Cannot find symbol for section 2: .text. security/integrity/secure_boot.o: failed Introduce a Kconfig symbol, CONFIG_HAVE_ARCH_GET_SECUREBOOT, to indicate that an architecture provides a definition of arch_get_secureboot(). Provide a static inline stub when this symbol is not defined to achieve the same effect as the __weak function, allowing secure_boot.c to be removed altogether. Move the s390 definition of arch_get_secureboot() out of the CONFIG_KEXEC_FILE block to ensure it is always available, as it does not actually depend on KEXEC_FILE. Reported-by: Arnd Bergmann <arnd@arndb.de> Fixes: 31a6a07 ("integrity: Make arch_ima_get_secureboot integrity-wide") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent 5d05360 commit 7caedbb

7 files changed

Lines changed: 15 additions & 22 deletions

File tree

arch/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,4 +1841,7 @@ config ARCH_WANTS_PRE_LINK_VMLINUX
18411841
config ARCH_HAS_CPU_ATTACK_VECTORS
18421842
bool
18431843

1844+
config HAVE_ARCH_GET_SECUREBOOT
1845+
def_bool EFI
1846+
18441847
endmenu

arch/powerpc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,7 @@ config PPC_SECURE_BOOT
10611061
depends on IMA_ARCH_POLICY
10621062
imply IMA_SECURE_AND_OR_TRUSTED_BOOT
10631063
select PSERIES_PLPKS if PPC_PSERIES
1064+
select HAVE_ARCH_GET_SECUREBOOT
10641065
help
10651066
Systems with firmware secure boot enabled need to define security
10661067
policies to extend secure boot to the OS. This config allows a user

arch/s390/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ config S390
181181
select GENERIC_IOREMAP if PCI
182182
select HAVE_ALIGNED_STRUCT_PAGE
183183
select HAVE_ARCH_AUDITSYSCALL
184+
select HAVE_ARCH_GET_SECUREBOOT
184185
select HAVE_ARCH_JUMP_LABEL
185186
select HAVE_ARCH_JUMP_LABEL_RELATIVE
186187
select HAVE_ARCH_KASAN

arch/s390/kernel/ipl.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2388,6 +2388,11 @@ void __no_stack_protector s390_reset_system(void)
23882388
diag_amode31_ops.diag308_reset();
23892389
}
23902390

2391+
bool arch_get_secureboot(void)
2392+
{
2393+
return ipl_secure_flag;
2394+
}
2395+
23912396
#ifdef CONFIG_KEXEC_FILE
23922397

23932398
int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf,
@@ -2505,11 +2510,6 @@ void *ipl_report_finish(struct ipl_report *report)
25052510
return buf;
25062511
}
25072512

2508-
bool arch_get_secureboot(void)
2509-
{
2510-
return ipl_secure_flag;
2511-
}
2512-
25132513
int ipl_report_free(struct ipl_report *report)
25142514
{
25152515
struct ipl_report_component *comp, *ncomp;

include/linux/secure_boot.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010

1111
#include <linux/types.h>
1212

13+
#ifdef CONFIG_HAVE_ARCH_GET_SECUREBOOT
1314
/*
1415
* Returns true if the platform secure boot is enabled.
1516
* Returns false if disabled or not supported.
1617
*/
1718
bool arch_get_secureboot(void);
19+
#else
20+
static inline bool arch_get_secureboot(void) { return false; }
21+
#endif
1822

1923
#endif /* _LINUX_SECURE_BOOT_H */

security/integrity/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
obj-$(CONFIG_INTEGRITY) += integrity.o
77

8-
integrity-y := iint.o secure_boot.o
8+
integrity-y := iint.o
99
integrity-$(CONFIG_INTEGRITY_AUDIT) += integrity_audit.o
1010
integrity-$(CONFIG_INTEGRITY_SIGNATURE) += digsig.o
1111
integrity-$(CONFIG_INTEGRITY_ASYMMETRIC_KEYS) += digsig_asymmetric.o

security/integrity/secure_boot.c

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)