Hello community,
here is the log from the commit of package lkcdutils
checked in at Fri Apr 28 21:13:33 CEST 2006.
--------
--- lkcdutils/lkcdutils.changes 2006-04-24 10:08:10.000000000 +0200
+++ STABLE/lkcdutils/lkcdutils.changes 2006-04-28 14:36:11.000000000 +0200
@@ -1,0 +2,7 @@
+Fri Apr 28 14:34:35 CEST 2006 - hare(a)suse.de
+
+- Fix access to anonymous structs (#169406)
+- Fix crash with 'page' command (#169447)
+- Remove obsolete lkcdutils-ia64-fujitsu.patch
+
+-------------------------------------------------------------------
Old:
----
lkcdutils-ia64-fujitsu.patch
New:
----
lkcdutils-anon-structs.patch
lkcdutils-fix-page-cmd.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ lkcdutils.spec ++++++
--- /var/tmp/diff_new_pack.hgGYjc/_old 2006-04-28 21:13:19.000000000 +0200
+++ /var/tmp/diff_new_pack.hgGYjc/_new 2006-04-28 21:13:19.000000000 +0200
@@ -14,7 +14,7 @@
BuildRequires: glib2-devel libelf popt-devel
Summary: Linux Kernel Crash Dump (LKCD) Utilities
Version: 7.0.1
-Release: 15
+Release: 18
License: GPL
Group: System/Kernel
# Original source is from Sourceforge CVS:
@@ -41,7 +41,8 @@
Patch15: lkcdutils-handle-version-9.patch
Patch16: lkcdutils-s390-args-crash
Patch17: lkcdutils-4level-pgtable.patch
-Patch20: lkcdutils-ia64-fujitsu.patch
+Patch18: lkcdutils-anon-structs.patch
+Patch19: lkcdutils-fix-page-cmd.patch
Patch71: lkcdutils-netdump-secure_mode.patch
Patch75: lkcdutils-netdump-doc.patch
Patch76: lkcdutils-savedump.patch
@@ -90,6 +91,8 @@
%patch15 -p3
%patch16 -p1
%patch17 -p0
+%patch18 -p1
+%patch19 -p1
cp %{S:4} PATCHES
%build
@@ -171,6 +174,10 @@
#/usr/sbin/netdump-login-client
%changelog -n lkcdutils
+* Fri Apr 28 2006 - hare(a)suse.de
+- Fix access to anonymous structs (#169406)
+- Fix crash with 'page' command (#169447)
+- Remove obsolete lkcdutils-ia64-fujitsu.patch
* Mon Apr 24 2006 - hare(a)suse.de
- Fixed script name in /etc/init.d/boot.lkcd (#164964)
- Fix 4-Level Pagetable dumps (#166312)
++++++ lkcdutils-anon-structs.patch ++++++
diff -Naur -x CVS -x '*.gz' -Naur lkcdutils/lcrash/eval.c lkcdutils-anon/lcrash/eval.c
--- lkcdutils/lcrash/eval.c 2005-05-17 11:34:07.000000000 -0700
+++ lkcdutils-anon/lcrash/eval.c 2006-04-25 10:27:51.908485574 -0700
@@ -6,7 +6,7 @@
* Created by Silicon Graphics, Inc.
* Contributions by IBM, and others
*
- * Copyright (C) 1999 - 2005 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 1999 - 2006 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2001, 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
*
* This program is free software; you can redistribute it and/or modify
@@ -2582,6 +2582,7 @@
static node_t *
replace(node_t *np, int flags)
{
+ int offset;
uint64_t value;
node_t *q;
@@ -2682,6 +2683,15 @@
free_type(tp);
return((node_t *)NULL);
}
+
+ /* We can't just use the offset value
+ * for the member. That's because it
+ * may be from an anonymous struct or
+ * union within another struct
+ * definition.
+ */
+ offset = kl_get_member_offset(kltp,
+ np->right->name);
np->type = member_to_type(kltmp, flags);
if (!np->type) {
set_eval_error(E_BAD_MEMBER);
@@ -2699,12 +2709,12 @@
np->operator = 0;
addr = 0;
if (np->left->flags & POINTER_FLAG) {
- addr = np->left->value +
- kltmp->kl_offset;
+ addr = np->left->value +
+ offset;
} else if (np->left->flags &
ADDRESS_FLAG) {
- addr = np->left->address +
- kltmp->kl_offset;
+ addr = np->left->address +
+ offset;
}
if (addr) {
np->address = addr;
diff -Naur -x CVS -x '*.gz' -Naur lkcdutils/lib/libklib/include/kl_typeinfo.h lkcdutils-anon/lib/libklib/include/kl_typeinfo.h
--- lkcdutils/lib/libklib/include/kl_typeinfo.h 2005-05-17 11:34:12.000000000 -0700
+++ lkcdutils-anon/lib/libklib/include/kl_typeinfo.h 2006-04-25 10:28:40.517040417 -0700
@@ -7,7 +7,7 @@
* Created by Silicon Graphics, Inc.
* Contributions by IBM, NEC, and others
*
- * Copyright (C) 1999 - 2005 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 1999 - 2006 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2001, 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
* Copyright 2000 Junichi Nomura, NEC Solutions <j-nomura(a)ce.jp.nec.com>
*
@@ -50,6 +50,7 @@
#define TYP_TYPESTRING_FLG 0x02
#define TYP_INCOMPLETE_FLG 0x04
#define TYP_XREFERENCE_FLG 0x08
+#define TYP_ANONYMOUS_FLG 0x10 /* Denotes anonymous union or struct */
#define NO_INDENT 0x01000000
#define SUPPRESS_NAME 0x02000000
@@ -158,15 +159,19 @@
kltype_t * /* kltype_t pointer */,
char * /* member name */);
-kltype_t *kl_find_member(
+int kl_get_member_offset(
+ kltype_t * /* kltype_t pointer */,
+ char * /* member name */);
+
+int kl_is_member(
char * /* struct name */,
char * /* member name */);
-int kl_member_offset(
+kltype_t *kl_member(
char * /* struct name */,
char * /* member name */);
-int kl_is_member(
+int kl_member_offset(
char * /* struct name */,
char * /* member name */);
diff -Naur -x CVS -x '*.gz' -Naur lkcdutils/lib/libklib/kl_dwarf.c lkcdutils-anon/lib/libklib/kl_dwarf.c
--- lkcdutils/lib/libklib/kl_dwarf.c 2006-01-11 11:19:24.000000000 -0800
+++ lkcdutils-anon/lib/libklib/kl_dwarf.c 2006-04-25 10:28:53.101184057 -0700
@@ -8,7 +8,7 @@
* Contributions by SGI
*
* Copyright (C) 2004 International Business Machines Corp.
- * Copyright (C) 2004, 2005 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 2004-2006 Silicon Graphics, Inc. All rights reserved.
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser Public License as published by
@@ -1026,6 +1026,15 @@
if(!source)
return;
+ /* First, check to see if this is an anonymous union or struct...
+ */
+ if (!strcmp(source->kl_typestr, KL_TYPESTR_STRUCT) ||
+ !strcmp(source->kl_typestr, KL_TYPESTR_STRUCT" ") ||
+ !strcmp(source->kl_typestr, KL_TYPESTR_UNION) ||
+ !strcmp(source->kl_typestr, KL_TYPESTR_UNION" ")) {
+ source->kl_flags |= TYP_ANONYMOUS_FLG;
+ }
+
/* For each member, find realtype */
kltype_t *member = source->kl_member;
for(; member; member = member->kl_member) {
@@ -1037,8 +1046,13 @@
process its members */
if(member->kl_realtype->kl_type == KLT_STRUCT ||
member->kl_realtype->kl_type == KLT_UNION ) {
-
process_struct_members(member->kl_realtype);
+ if (member->kl_realtype->kl_flags & TYP_ANONYMOUS_FLG) {
+ /* Make sure the member reflects the fact that
+ * this is an anonymous type.
+ */
+ member->kl_flags |= TYP_ANONYMOUS_FLG;
+ }
}
}
}
diff -Naur -x CVS -x '*.gz' -Naur lkcdutils/lib/libklib/kl_typeinfo.c lkcdutils-anon/lib/libklib/kl_typeinfo.c
--- lkcdutils/lib/libklib/kl_typeinfo.c 2005-05-17 11:34:12.000000000 -0700
+++ lkcdutils-anon/lib/libklib/kl_typeinfo.c 2006-04-25 10:29:11.089389377 -0700
@@ -7,7 +7,7 @@
* Created by Silicon Graphics, Inc.
* Contributions by IBM, NEC, and others
*
- * Copyright (C) 1999 - 2005 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 1999 - 2006 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2001, 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
* Copyright 2000 Junichi Nomura, NEC Solutions <j-nomura(a)ce.jp.nec.com>
*
@@ -248,7 +248,13 @@
if ((mp = kltp->kl_member)) {
while (mp) {
- if (!strcmp(mp->kl_name, f)) {
+ if (mp->kl_flags & TYP_ANONYMOUS_FLG) {
+ kltype_t *amp;
+
+ if ((amp = kl_get_member(mp->kl_realtype, f))) {
+ return(amp);
+ }
+ } else if (!strcmp(mp->kl_name, f)) {
break;
}
mp = mp->kl_member;
@@ -258,10 +264,10 @@
}
/*
- * kl_find_member()
+ * kl_member()
*/
kltype_t *
-kl_find_member(char *s, char *f)
+kl_member(char *s, char *f)
{
kltype_t *kltp, *mp = NULL;
@@ -276,18 +282,55 @@
return(mp);
}
+
+/*
+ * kl_get_member_offset()
+ */
+int
+kl_get_member_offset(kltype_t *kltp, char *f)
+{
+ kltype_t *mp;
+
+ if ((mp = kltp->kl_member)) {
+ while (mp) {
+ if (mp->kl_flags & TYP_ANONYMOUS_FLG) {
+ int off;
+
+ /* Drill down to see if the member we are looking for is in
+ * an anonymous union or struct. Since this call is recursive,
+ * the drill down may actually be multi-layer.
+ */
+ off = kl_get_member_offset(mp->kl_realtype, f);
+ if (off >= 0) {
+ return(mp->kl_offset + off);
+ }
+ } else if (!strcmp(mp->kl_name, f)) {
+ return(mp->kl_offset);
+ }
+ mp = mp->kl_member;
+ }
+ }
+ return(-1);
+}
+
/*
* kl_member_offset()
*/
int
kl_member_offset(char *s, char *f)
{
- kltype_t *mp;
+ int off = -1;
+ kltype_t *kltp;
- if ((mp = kl_find_member(s, f))) {
- return(mp->kl_offset);
- }
- return(-1);
+ if (!(kltp = kl_find_type(s, (KLT_STRUCT|KLT_UNION)))) {
+ if ((kltp = kl_find_type(s, KLT_TYPEDEF))) {
+ kltp = kl_realtype(kltp, 0);
+ }
+ }
+ if (kltp) {
+ off = kl_get_member_offset(kltp, f);
+ }
+ return(off);
}
/*
@@ -298,7 +341,7 @@
{
kltype_t *mp;
- if ((mp = kl_find_member(s, f))) {
+ if ((mp = kl_member(s, f))) {
return(1);
}
return(0);
@@ -312,7 +355,7 @@
{
kltype_t *mp;
- if ((mp = kl_find_member(s, f))) {
+ if ((mp = kl_member(s, f))) {
return(mp->kl_size);
}
return(0);
@@ -1048,7 +1091,7 @@
fprintf(ofp, "%s{\n", kltp->kl_typestr);
} else {
if (buf) {
- if (level) {
+ if (level && !(kltp->kl_flags & TYP_ANONYMOUS_FLG)) {
fprintf(ofp, "%s = %s{\n",
kltp->kl_name, kltp->kl_typestr);
} else {
@@ -1108,7 +1151,8 @@
if (ptr || ((kltp->kl_size == 0) && buf)) {
fprintf(ofp, "}");
} else if ((kltp->kl_type == KLT_MEMBER) &&
- !(orig_flags & SUPPRESS_NAME)) {
+ !(orig_flags & SUPPRESS_NAME) &&
+ !(kltp->kl_flags & TYP_ANONYMOUS_FLG)) {
fprintf(ofp, "} %s", kltp->kl_name);
} else {
fprintf(ofp, "}");
++++++ lkcdutils-fix-page-cmd.patch ++++++
diff -Naur -x CVS -x '*.gz' -Naur lkcdutils/lcrash/struct.c lkcdutils-page/lcrash/struct.c
--- lkcdutils/lcrash/struct.c 2005-09-10 00:59:57.000000000 -0700
+++ lkcdutils-page/lcrash/struct.c 2006-04-25 10:39:13.676266406 -0700
@@ -6,7 +6,7 @@
* Created by Silicon Graphics, Inc.
* Contributions by IBM, and others
*
- * Copyright (C) 1999 - 2005 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 1999 - 2006 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2001, 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
*
* This program is free software; you can redistribute it and/or modify
@@ -320,13 +320,25 @@
page_banner(FILE *ofp, int flags)
{
print_banner(ofp, "%> ADDR% PGNO COUNT "
- "%> FLAGS% %> VIRTUAL%", flags);
+ "%> FLAGS% %>", flags);
}
+#define PRINT_DELIM \
+ if (cnt) { \
+ fprintf(ofp, ", "); \
+ } else { \
+ fprintf(ofp, " "); \
+ } \
+ cnt++;
+
+
+
void
print_page_struct(kaddr_t addr, void *pp, int flags,
unsigned long pgno, FILE *ofp)
{
+ int cnt = 0;
+
print_value(ofp, "", ADDR64(addr), 8, ADDR_FLG);
print_value(ofp, " ", (uint64_t)pgno, 12, UNSIGNED_FLG);
if (LINUX_2_6_X(KL_LINUX_RELEASE)) {
@@ -338,62 +350,85 @@
}
print_value(ofp, " ", ADDR64(KL_UINT(pp, "page", "flags")),
8, ADDR_FLG);
- print_value(ofp, " ", ADDR64(KL_UINT(pp, "page", "virtual")),
- 8, ADDR_FLG);
+
fprintf(ofp, "\n");
if (flags & C_FULL) {
fprintf(ofp, "\n");
+
if (kl_is_member("page", "next")) {
- print_value(ofp, " NEXT:",
+ PRINT_DELIM;
+ print_value(ofp, "NEXT:",
ADDR64(KL_UINT(pp, "page", "next")),
0, ADDR_FLG);
- print_value(ofp, ", PREV:",
+ PRINT_DELIM;
+ print_value(ofp, "PREV:",
ADDR64(KL_UINT(pp, "page", "prev")),
0, ADDR_FLG);
fprintf(ofp, "\n");
} else if (kl_is_member("page", "lru")) {
- print_value(ofp, " NEXT:",
+ PRINT_DELIM;
+ print_value(ofp, "NEXT:",
ADDR64(KL_UINT(K_PTR(pp, "page", "lru"),
"list_head", "next")), 0, ADDR_FLG);
- print_value(ofp, ", PREV:",
+ PRINT_DELIM;
+ print_value(ofp, "PREV:",
ADDR64(KL_UINT(K_PTR(pp, "page", "lru"),
"list_head", "prev")), 0, ADDR_FLG);
fprintf(ofp, "\n");
}
+ cnt = 0;
if (kl_is_member("page", "next_hash")) {
- print_value(ofp, " NEXT_HASH:",
+ PRINT_DELIM;
+ print_value(ofp, "NEXT_HASH:",
ADDR64(KL_UINT(pp, "page", "next_hash")),
0, ADDR_FLG);
fprintf(ofp, "\n");
}
- print_value(ofp, " MAPPING:",
- ADDR64(KL_UINT(pp, "page", "mapping")),
- 0, ADDR_FLG);
- print_value(ofp, ", MAPCOUNT:",
- ADDR64(KL_UINT(pp, "page", "mapcount")),
- 0, ADDR_FLG);
- print_value(ofp, ", INDEX:",
- ADDR64(KL_UINT(pp, "page", "index")),
+ cnt = 0;
+ if (kl_is_member("page", "mapcount")) {
+ PRINT_DELIM;
+ print_value(ofp, "MAPCOUNT:",
+ INT64(KL_UINT(pp, "page", "mapcount")),
+ 0, SIGNED_FLG);
+ } else if (kl_is_member("page", "_mapcount")) {
+ PRINT_DELIM;
+ print_value(ofp, "MAPCOUNT:",
+ INT64(KL_UINT(pp, "page", "_mapcount")),
+ 0, SIGNED_FLG);
+ }
+
+
+ if (kl_is_member("page", "private")) {
+ PRINT_DELIM;
+ print_value(ofp, "PRIVATE:",
+ INT64(KL_UINT(pp, "page", "private")),
+ 0, UNSIGNED_FLG);
+ }
+
+ if (kl_is_member("page", "mapping")) {
+ PRINT_DELIM;
+ print_value(ofp, "MAPPING:",
+ ADDR64(KL_UINT(pp, "page", "mapping")),
+ 0, ADDR_FLG);
+ }
+
+ PRINT_DELIM;
+ print_value(ofp, "INDEX:",
+ INT64(KL_UINT(pp, "page", "index")),
0, UNSIGNED_FLG);
fprintf(ofp, "\n");
+ cnt = 0;
+ PRINT_DELIM;
if (kl_is_member("page", "virtual")) {
- print_value(ofp, " VIRTUAL:",
+ print_value(ofp, "VIRTUAL:",
ADDR64(KL_UINT(pp, "page", "virtual")),
0, ADDR_FLG);
fprintf(ofp, "\n");
}
-
- if (kl_is_member("page", "private")) {
- print_value(ofp, " PRIVATE:",
- ADDR64(KL_UINT(pp, "page", "private")),
- 0, ADDR_FLG);
- fprintf(ofp, "\n");
- }
-
fprintf(ofp, "\n\n");
}
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...