Skip to content

Commit a084aee

Browse files
Michael Holzheugregkh
authored andcommitted
s390/kdump: Use "LINUX" ELF note name instead of "CORE"
commit a4a81d8eebdc1d209d034f62a082a5131e4242b5 upstream. In binutils/libbfd (bfd/elf.c) it is enforced that all s390 specific ELF notes like e.g. NT_S390_PREFIX or NT_S390_CTRS have "LINUX" specified as note name. Otherwise the notes are ignored. For /proc/vmcore we currently use "CORE" for these notes. Up to now this has not been a real problem because the dump analysis tool "crash" does not check the note name. But it will break all programs that use libbfd for processing ELF notes. So fix this and use "LINUX" for all s390 specific notes to comply with libbfd. Reported-by: Philipp Rudo <prudo@linux.vnet.ibm.com> Reviewed-by: Philipp Rudo <prudo@linux.vnet.ibm.com> Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b0e8570 commit a084aee

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

arch/s390/kernel/crash_dump.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y)))
2424
#define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y))))
2525

26+
#define LINUX_NOTE_NAME "LINUX"
27+
2628
static struct memblock_region oldmem_region;
2729

2830
static struct memblock_type oldmem_type = {
@@ -312,7 +314,7 @@ static void *nt_fpregset(void *ptr, struct save_area *sa)
312314
static void *nt_s390_timer(void *ptr, struct save_area *sa)
313315
{
314316
return nt_init(ptr, NT_S390_TIMER, &sa->timer, sizeof(sa->timer),
315-
KEXEC_CORE_NOTE_NAME);
317+
LINUX_NOTE_NAME);
316318
}
317319

318320
/*
@@ -321,7 +323,7 @@ static void *nt_s390_timer(void *ptr, struct save_area *sa)
321323
static void *nt_s390_tod_cmp(void *ptr, struct save_area *sa)
322324
{
323325
return nt_init(ptr, NT_S390_TODCMP, &sa->clk_cmp,
324-
sizeof(sa->clk_cmp), KEXEC_CORE_NOTE_NAME);
326+
sizeof(sa->clk_cmp), LINUX_NOTE_NAME);
325327
}
326328

327329
/*
@@ -330,7 +332,7 @@ static void *nt_s390_tod_cmp(void *ptr, struct save_area *sa)
330332
static void *nt_s390_tod_preg(void *ptr, struct save_area *sa)
331333
{
332334
return nt_init(ptr, NT_S390_TODPREG, &sa->tod_reg,
333-
sizeof(sa->tod_reg), KEXEC_CORE_NOTE_NAME);
335+
sizeof(sa->tod_reg), LINUX_NOTE_NAME);
334336
}
335337

336338
/*
@@ -339,7 +341,7 @@ static void *nt_s390_tod_preg(void *ptr, struct save_area *sa)
339341
static void *nt_s390_ctrs(void *ptr, struct save_area *sa)
340342
{
341343
return nt_init(ptr, NT_S390_CTRS, &sa->ctrl_regs,
342-
sizeof(sa->ctrl_regs), KEXEC_CORE_NOTE_NAME);
344+
sizeof(sa->ctrl_regs), LINUX_NOTE_NAME);
343345
}
344346

345347
/*
@@ -348,7 +350,7 @@ static void *nt_s390_ctrs(void *ptr, struct save_area *sa)
348350
static void *nt_s390_prefix(void *ptr, struct save_area *sa)
349351
{
350352
return nt_init(ptr, NT_S390_PREFIX, &sa->pref_reg,
351-
sizeof(sa->pref_reg), KEXEC_CORE_NOTE_NAME);
353+
sizeof(sa->pref_reg), LINUX_NOTE_NAME);
352354
}
353355

354356
/*
@@ -357,7 +359,7 @@ static void *nt_s390_prefix(void *ptr, struct save_area *sa)
357359
static void *nt_s390_vx_high(void *ptr, __vector128 *vx_regs)
358360
{
359361
return nt_init(ptr, NT_S390_VXRS_HIGH, &vx_regs[16],
360-
16 * sizeof(__vector128), KEXEC_CORE_NOTE_NAME);
362+
16 * sizeof(__vector128), LINUX_NOTE_NAME);
361363
}
362364

363365
/*
@@ -370,12 +372,12 @@ static void *nt_s390_vx_low(void *ptr, __vector128 *vx_regs)
370372
int i;
371373

372374
note = (Elf64_Nhdr *)ptr;
373-
note->n_namesz = strlen(KEXEC_CORE_NOTE_NAME) + 1;
375+
note->n_namesz = strlen(LINUX_NOTE_NAME) + 1;
374376
note->n_descsz = 16 * 8;
375377
note->n_type = NT_S390_VXRS_LOW;
376378
len = sizeof(Elf64_Nhdr);
377379

378-
memcpy(ptr + len, KEXEC_CORE_NOTE_NAME, note->n_namesz);
380+
memcpy(ptr + len, LINUX_NOTE_NAME, note->n_namesz);
379381
len = roundup(len + note->n_namesz, 4);
380382

381383
ptr += len;

0 commit comments

Comments
 (0)