WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Allocate Xen kexec/kdump elfnote sections

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Allocate Xen kexec/kdump elfnote sections of the correct size.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 01 Feb 2007 13:35:09 -0800
Delivery-date: Thu, 01 Feb 2007 13:36:26 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1170339337 0
# Node ID 0a4cbad6752c4740b2b823581e3a61aa9ad53a64
# Parent  f45de0fe8a15cd6f335f378e3038b84fa3c7050d
Allocate Xen kexec/kdump elfnote sections of the correct size.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/common/kexec.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff -r f45de0fe8a15 -r 0a4cbad6752c xen/common/kexec.c
--- a/xen/common/kexec.c        Thu Feb 01 13:44:35 2007 +0000
+++ b/xen/common/kexec.c        Thu Feb 01 14:15:37 2007 +0000
@@ -131,10 +131,18 @@ __initcall(register_crashdump_trigger);
 
 static void setup_note(Elf_Note *n, const char *name, int type, int descsz)
 {
-    strlcpy(ELFNOTE_NAME(n), name, INT_MAX);
-    n->namesz = strlen(name);
+    int l = strlen(name) + 1;
+    strlcpy(ELFNOTE_NAME(n), name, l);
+    n->namesz = l;
     n->descsz = descsz;
     n->type = type;
+}
+
+static int sizeof_note(const char *name, int descsz)
+{
+    return (sizeof(Elf_Note) +
+            ELFNOTE_ALIGN(sizeof(name)) +
+            ELFNOTE_ALIGN(descsz));
 }
 
 #define kexec_get(x)      kexec_get_##x
@@ -162,16 +170,17 @@ static int kexec_get(cpu)(xen_kexec_rang
 static int kexec_get(cpu)(xen_kexec_range_t *range)
 {
     int nr = range->nr;
-    int nr_bytes = sizeof(Elf_Note) * 2
-        + ELFNOTE_ALIGN(sizeof(ELF_Prstatus))
-        + ELFNOTE_ALIGN(sizeof(crash_xen_core_t));
+    int nr_bytes = 0;
 
     if ( nr < 0 || nr >= num_present_cpus() )
         return -EINVAL;
 
+    nr_bytes += sizeof_note("CORE", sizeof(ELF_Prstatus));
+    nr_bytes += sizeof_note("Xen", sizeof(crash_xen_core_t));
+
     /* The Xen info note is included in CPU0's range. */
     if ( nr == 0 )
-        nr_bytes += sizeof(Elf_Note) + ELFNOTE_ALIGN(sizeof(crash_xen_info_t));
+        nr_bytes += sizeof_note("Xen", sizeof(crash_xen_info_t));
 
     if ( per_cpu(crash_notes, nr) == NULL )
     {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Allocate Xen kexec/kdump elfnote sections of the correct size., Xen patchbot-unstable <=