* [PATCH] kexec: extend KCORE_ELF_HEADERS_SIZE for large memory
@ 2010-08-23 21:18 Cliff Wickman
2010-08-24 1:22 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Cliff Wickman @ 2010-08-23 21:18 UTC (permalink / raw)
To: kexec; +Cc: horms
A customer has seen the kexec command exhaust its buffer for the ELF headers
from /proc/kcore. It found 147 program headers, which requires a buffer of
over 8k.
(This overflow was on an SGI UV with an extremely large memory, hence
many ram ranges.)
The default buffer size of 4k is configured in KCORE_ELF_HEADERS_SIZE.
The easy solution would probably be to increase the buffer to 16k.
That is room for 291 entries, on x86_64.
You might want to make the command dynamically enlarge the buffer when
it is found to be too small, but I don't think this command's use of a
little more memory is of concern. So there is probably no reason to
change the program logic in this area.
Diffed against kexec-tools-2.0.2
Signed-off-by: Cliff Wickman <cpw@sgi.com>
---
kexec/crashdump.h | 4 ++--
kexec/kexec-elf.c | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
Index: kexec-tools-2.0.2/kexec/crashdump.h
===================================================================
--- kexec-tools-2.0.2.orig/kexec/crashdump.h
+++ kexec-tools-2.0.2/kexec/crashdump.h
@@ -7,8 +7,8 @@ extern int get_xen_vmcoreinfo(uint64_t *
/* Need to find a better way to determine per cpu notes section size. */
#define MAX_NOTE_BYTES 1024
-/* Expecting ELF headers to fit in 4K. Increase it if you need more. */
-#define KCORE_ELF_HEADERS_SIZE 4096
+/* Expecting ELF headers to fit in 16K. Increase it if you need more. */
+#define KCORE_ELF_HEADERS_SIZE 16384
/* The address of the ELF header is passed to the secondary kernel
* using the kernel command line option memmap=nnn.
* The smallest unit the kernel accepts is in kilobytes,
Index: kexec-tools-2.0.2/kexec/kexec-elf.c
===================================================================
--- kexec-tools-2.0.2.orig/kexec/kexec-elf.c
+++ kexec-tools-2.0.2/kexec/kexec-elf.c
@@ -8,6 +8,7 @@
#include <boot/elf_boot.h>
#include "kexec.h"
#include "kexec-elf.h"
+#include "crashdump.h"
static const int probe_debug = 0;
@@ -389,6 +390,9 @@ static int build_mem_phdrs(const char *b
phdr_size *= ehdr->e_phnum;
if ((uintmax_t)(ehdr->e_phoff + phdr_size) > (uintmax_t)len) {
/* The program header did not fit in the file buffer */
+ fprintf(stderr, "%d segments require a %ld-byte buffer\n",
+ ehdr->e_phnum, ehdr->e_phoff + phdr_size);
+ fprintf(stderr, "KCORE_ELF_HEADERS_SIZE %d too small\n", KCORE_ELF_HEADERS_SIZE);
if (probe_debug) {
fprintf(stderr, "ELF program segment truncated\n");
}
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] kexec: extend KCORE_ELF_HEADERS_SIZE for large memory
2010-08-23 21:18 [PATCH] kexec: extend KCORE_ELF_HEADERS_SIZE for large memory Cliff Wickman
@ 2010-08-24 1:22 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2010-08-24 1:22 UTC (permalink / raw)
To: Cliff Wickman; +Cc: kexec
On Mon, Aug 23, 2010 at 04:18:05PM -0500, Cliff Wickman wrote:
>
> A customer has seen the kexec command exhaust its buffer for the ELF headers
> from /proc/kcore. It found 147 program headers, which requires a buffer of
> over 8k.
> (This overflow was on an SGI UV with an extremely large memory, hence
> many ram ranges.)
> The default buffer size of 4k is configured in KCORE_ELF_HEADERS_SIZE.
>
> The easy solution would probably be to increase the buffer to 16k.
> That is room for 291 entries, on x86_64.
>
> You might want to make the command dynamically enlarge the buffer when
> it is found to be too small, but I don't think this command's use of a
> little more memory is of concern. So there is probably no reason to
> change the program logic in this area.
Thanks Cliff,
applied.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-24 1:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-23 21:18 [PATCH] kexec: extend KCORE_ELF_HEADERS_SIZE for large memory Cliff Wickman
2010-08-24 1:22 ` Simon Horman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.