summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/kexec.h17
-rw-r--r--kernel/kexec_file.c4
2 files changed, 13 insertions, 8 deletions
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 08b8b9d00f97..8c5819d1a808 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -99,14 +99,19 @@ struct compat_kexec_segment {
#ifdef CONFIG_KEXEC_FILE
struct purgatory_info {
- /* Pointer to elf header of read only purgatory */
- Elf_Ehdr *ehdr;
-
- /* Pointer to purgatory sechdrs which are modifiable */
+ /*
+ * Pointer to elf header at the beginning of kexec_purgatory.
+ * Note: kexec_purgatory is read only
+ */
+ const Elf_Ehdr *ehdr;
+ /*
+ * Temporary, modifiable buffer for sechdrs used for relocation.
+ * This memory can be freed post image load.
+ */
Elf_Shdr *sechdrs;
/*
- * Temporary buffer location where purgatory is loaded and relocated
- * This memory can be freed post image load
+ * Temporary, modifiable buffer for stripped purgatory used for
+ * relocation. This memory can be freed post image load.
*/
void *purgatory_buf;
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 81ba4f782486..12cf9c9ff0bc 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -941,7 +941,7 @@ int kexec_load_purgatory(struct kimage *image, unsigned long min,
if (kexec_purgatory_size <= 0)
return -EINVAL;
- pi->ehdr = (Elf_Ehdr *)kexec_purgatory;
+ pi->ehdr = (const Elf_Ehdr *)kexec_purgatory;
ret = __kexec_load_purgatory(image, min, max, top_down);
if (ret)
@@ -965,9 +965,9 @@ out:
static Elf_Sym *kexec_purgatory_find_symbol(struct purgatory_info *pi,
const char *name)
{
+ const Elf_Ehdr *ehdr;
Elf_Sym *syms;
Elf_Shdr *sechdrs;
- Elf_Ehdr *ehdr;
int i, k;
const char *strtab;