Andrew Cooper
2013-Oct-28 11:30 UTC
[PATCH] libelf: improve errors in elf_xen_note_check()
I recently debugged an isolated failure to boot, with no information other
than the logs.
The "Will only load images built for the generic loader or Linux
images"
string was missing a newline, leading to the subsequent error being appended
to this line, rather than having its own line with correctly identified
function.
Furthermore, error messages which state "param containing $FOO is not
$BAR" is
fairly useless for debugging without identifying which bad $FOO caused the
failure.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
I have CC''d both Xen and Tools maintainers as I am not sure who is most
appropriate to review/ack. Strictly speaking, the code lives in the Xen
subtree, but is arguably more toolstack code than Xen code.
---
xen/common/libelf/libelf-dominfo.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/xen/common/libelf/libelf-dominfo.c
b/xen/common/libelf/libelf-dominfo.c
index 25dd892..6120dd4 100644
--- a/xen/common/libelf/libelf-dominfo.c
+++ b/xen/common/libelf/libelf-dominfo.c
@@ -374,7 +374,9 @@ static elf_errorstatus elf_xen_note_check(struct elf_binary
*elf,
strncmp(parms->guest_os, "linux", 5)) )
{
elf_err(elf, "%s: ERROR: Will only load images built for the
generic "
- "loader or Linux images", __FUNCTION__);
+ "loader or Linux images (Not ''%.*s'' and
''%.*s'')\n",
+ __FUNCTION__, (int)sizeof(parms->loader), parms->loader,
+ (int)sizeof(parms->guest_os), parms->guest_os);
return -1;
}
@@ -382,7 +384,8 @@ static elf_errorstatus elf_xen_note_check(struct elf_binary
*elf,
strncmp(parms->xen_ver, "xen-3.0", 7) )
{
elf_err(elf, "%s: ERROR: Xen will only load images built "
- "for Xen v3.0\n", __FUNCTION__);
+ "for Xen v3.0 (Not ''%.*s'')\n",
__FUNCTION__,
+ (int)sizeof(parms->xen_ver), parms->xen_ver);
return -1;
}
return 0;
--
1.7.10.4
Ian Jackson
2013-Oct-28 14:51 UTC
Re: [PATCH] libelf: improve errors in elf_xen_note_check()
Andrew Cooper writes ("[PATCH] libelf: improve errors in
elf_xen_note_check()"):> I recently debugged an isolated failure to boot, with no information other
> than the logs.
Thanks for this patch.
> I have CC''d both Xen and Tools maintainers as I am not sure who is
most
> appropriate to review/ack. Strictly speaking, the code lives in the Xen
> subtree, but is arguably more toolstack code than Xen code.
I was the last person to mess substantially with libelf so I decided
that I was the right person to review this.
I trust no-one objects. If they do I may send a patch to MAINTAINERS :-).
Thanks,
Ian.
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>