Skip to content

Commit e2ae8ab

Browse files
keestorvalds
authored andcommitted
kexec_file: adjust declaration of kexec_purgatory
Defining kexec_purgatory as a zero-length char array upsets compile time size checking. Since this is built on a per-arch basis, define it as an unsized char array (like is done for other similar things, e.g. linker sections). This silences the warning generated by the future CONFIG_FORTIFY_SOURCE, which did not like the memcmp() of a "0 byte" array. This drops the __weak and uses an extern instead, since both users define kexec_purgatory. Link: http://lkml.kernel.org/r/1497903987-21002-4-git-send-email-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Daniel Micay <danielmicay@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 3e2c044 commit e2ae8ab

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

kernel/kexec_file.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@
2626
#include <linux/vmalloc.h>
2727
#include "kexec_internal.h"
2828

29-
/*
30-
* Declare these symbols weak so that if architecture provides a purgatory,
31-
* these will be overridden.
32-
*/
33-
char __weak kexec_purgatory[0];
34-
size_t __weak kexec_purgatory_size = 0;
35-
3629
static int kexec_calculate_store_digests(struct kimage *image);
3730

3831
/* Architectures can provide this probe function */

kernel/kexec_internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ extern struct mutex kexec_mutex;
1717
#ifdef CONFIG_KEXEC_FILE
1818
#include <linux/purgatory.h>
1919
void kimage_file_post_load_cleanup(struct kimage *image);
20+
extern char kexec_purgatory[];
21+
extern size_t kexec_purgatory_size;
2022
#else /* CONFIG_KEXEC_FILE */
2123
static inline void kimage_file_post_load_cleanup(struct kimage *image) { }
2224
#endif /* CONFIG_KEXEC_FILE */

0 commit comments

Comments
 (0)