Date: Sat, 1 Oct 2005 21:57:53 +0100 (BST) From: Gavin Atkinson <gavin.atkinson@ury.york.ac.uk> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/86805: [PATCH] savecore fails to byteswap architectureversion field Message-ID: <200510012057.j91Kvr7h008146@buffy.york.ac.uk> Resent-Message-ID: <200510012100.j91L0XEA079632@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 86805 >Category: bin >Synopsis: [PATCH] savecore fails to byteswap architectureversion field >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Oct 01 21:00:33 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Gavin Atkinson >Release: FreeBSD 6.0-BETA5 i386 >Organization: >Environment: System: FreeBSD buffy.york.ac.uk 6.0-BETA5 FreeBSD 6.0-BETA5 #1: Fri Sep 30 12:26:25 BST 2005 root@buffy.york.ac.uk:/usr/obj/usr/src/sys/BUFFY i386 >Description: When savecore runs and finds a core, it will create an info.X file with an ASCII representation of the dump header. Five of the fields within this header are supposed to be in "dump byte order", which is the same as network byte order (see the comment in sys/kerneldump.h). The current version of the AMD64 dump is 2, however the contents of the info file corresponding to an amd64 dump is as follows: wiggum# cat /var/crash/info.0 Dump header from device /dev/da0s1b Architecture: amd64 Architecture Version: 33554432 [...] Note that 33554432 = 0x02000000, i.e. it needs to be byte swapped but hasn't been. This problem isn't amd64 specific, it seems to affect all little-endian platforms, and was introduced (seemingly accidentally) in version 1.71 of src/sbin/savecore.c See http://lists.freebsd.org/pipermail/freebsd-hackers/2005-May/012028.html for an i386 example of the bug. >How-To-Repeat: Panic a system with dumps enabled, look at /var/crash/info.X and compare the architecture version to that defined in /usr/include/sys/kerneldump.h >Fix: --- savecore.diff begins here --- Index: src/sbin/savecore/savecore.c =================================================================== RCS file: /usr/cvs/src/sbin/savecore/savecore.c,v retrieving revision 1.76 diff -u -r1.76 savecore.c --- src/sbin/savecore/savecore.c 13 Sep 2005 19:15:28 -0000 1.76 +++ src/sbin/savecore/savecore.c 1 Oct 2005 20:30:47 -0000 @@ -107,7 +107,8 @@ fprintf(f, "Dump header from device %s\n", device); fprintf(f, " Architecture: %s\n", h->architecture); - fprintf(f, " Architecture Version: %u\n", h->architectureversion); + fprintf(f, " Architecture Version: %u\n", + dtoh32(h->architectureversion)); dumplen = dtoh64(h->dumplength); fprintf(f, " Dump Length: %lldB (%lld MB)\n", (long long)dumplen, (long long)(dumplen >> 20)); --- savecore.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510012057.j91Kvr7h008146>
