Skip to contentSkip to conversation

Parse 64 bit VMCOREINFO on 32 bit userland

PATCH In review Bernhard Walle 2 participants 6 messages Nov 27, 2008 – Dec 1, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Parse 64 bit VMCOREINFO on 32 bit userland

This bug fixes the problem that on a 32 bit userland makedumpfile (as common on the PPC platform) the parsing of the 64 bit VMCOREINFO fails with:

   # makedumpfile -c /home/sachin/dump/vmcore vmcore.filtered
   read_vmcoreinfo_symbol: Invalid data in /tmp/vmcoreinfowVoyJK:
   SYMBOL(mem_section)=c000000000bb4400

We just need to assume that the symbols are always 'unsigned long long' (64 bit) instead of 'unsigned long' (native pointer size on Linux platforms).

---
 makedumpfile.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
makedumpfile.c +3 -4
@@ -13,7 +13,6 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-#include <stdlib.h>
 #include "makedumpfile.h"
 
 struct symbol_table	symbol_table;
@@ -2274,7 +2273,7 @@ read_vmcoreinfo_basic_info(void)
 unsigned long
 read_vmcoreinfo_symbol(char *str_symbol)
 {
-	unsigned long symbol = NOT_FOUND_SYMBOL;
+	unsigned long long symbol = NOT_FOUND_SYMBOL;
 	char buf[BUFSIZE_FGETS], *endp;
 	unsigned int i;
 
@@ -2291,8 +2290,8 @@ read_vmcoreinfo_symbol(char *str_symbol)
 		if (buf[i - 1] == '\n')
 			buf[i - 1] = '\0';
 		if (strncmp(buf, str_symbol, strlen(str_symbol)) == 0) {
-			symbol = strtoul(buf + strlen(str_symbol), &endp, 16);
-			if ((!symbol || symbol == ULONG_MAX)
+			symbol = strtoull(buf + strlen(str_symbol), &endp, 16);
+			if ((!symbol || symbol == ULONGLONG_MAX)
 			    || strlen(endp) != 0) {
 				ERRMSG("Invalid data in %s: %s",
 				    info->name_vmcoreinfo, buf);

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw

Hi Bernhard,

Quoted 9 lines · Bernhard Walle

This bug fixes the problem that on a 32 bit userland makedumpfile (as common on the PPC platform) the parsing of the 64 bit VMCOREINFO fails with:

   # makedumpfile -c /home/sachin/dump/vmcore vmcore.filtered
   read_vmcoreinfo_symbol: Invalid data in /tmp/vmcoreinfowVoyJK:
   SYMBOL(mem_section)=c000000000bb4400

We just need to assume that the symbols are always 'unsigned long long' (64 bit) instead of 'unsigned long' (native pointer size on Linux platforms).

I agree with this patch basically. But I have not tested kdump on PPC64 platform (PPC32 also) and I don't know it well. So may I ask a question ?

For PPC64 kdump, is it common thing that makedumpfile runs on PPC32 ? In other words, do you use PPC32 kernel as 2nd-kernel for PPC64 kdump ?

makedumpfile.c line 16

Quoted 13 lines
---
 makedumpfile.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
makedumpfile.c +0 -1
@@ -13,7 +13,6 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-#include <stdlib.h>

This is not related to this purpose, but this is reasonable and will be merged as the other patch ;-)

makedumpfile.c read_vmcoreinfo_basic_info(void) · line 2273

Quoted 5 lines
makedumpfile.c +0 -0
 #include "makedumpfile.h"
 
 struct symbol_table	symbol_table;
@@ -2274,7 +2273,7 @@ read_vmcoreinfo_basic_info(void)
 unsigned long

unsigned long long ?

Quoted 9 lines
makedumpfile.c +1 -1
 read_vmcoreinfo_symbol(char *str_symbol)
 {
-	unsigned long symbol = NOT_FOUND_SYMBOL;
+	unsigned long long symbol = NOT_FOUND_SYMBOL;
 	char buf[BUFSIZE_FGETS], *endp;
 	unsigned int i;
 

makedumpfile.c read_vmcoreinfo_symbol(char *str_symbol) · line 2297

Quoted 10 lines
makedumpfile.c +2 -2
@@ -2291,8 +2290,8 @@ read_vmcoreinfo_symbol(char *str_symbol)
 		if (buf[i - 1] == '\n')
 			buf[i - 1] = '\0';
 		if (strncmp(buf, str_symbol, strlen(str_symbol)) == 0) {
-			symbol = strtoul(buf + strlen(str_symbol), &endp, 16);
-			if ((!symbol || symbol == ULONG_MAX)
+			symbol = strtoull(buf + strlen(str_symbol), &endp, 16);
+			if ((!symbol || symbol == ULONGLONG_MAX)
 			    || strlen(endp) != 0) {
 				ERRMSG("Invalid data in %s: %s",
 				    info->name_vmcoreinfo, buf);

Thanks
Ken'ichi Ohmichi

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw

Hi Ken'ichi,

Quoted 8 lines · Ken'ichi Ohmichi
Quoted 7 lines · Bernhard Walle

This bug fixes the problem that on a 32 bit userland makedumpfile (as common on the PPC platform) the parsing of the 64 bit VMCOREINFO fails with:

   # makedumpfile -c /home/sachin/dump/vmcore vmcore.filtered
   read_vmcoreinfo_symbol: Invalid data in /tmp/vmcoreinfowVoyJK:
   SYMBOL(mem_section)=c000000000bb4400
Quoted 8 lines
Quoted 2 lines

We just need to assume that the symbols are always 'unsigned long long' (64 bit) instead of 'unsigned long' (native pointer size on Linux platforms).

I agree with this patch basically. But I have not tested kdump on PPC64 platform (PPC32 also) and I don't know it well. So may I ask a question ?

For PPC64 kdump, is it common thing that makedumpfile runs on PPC32 ? In other words, do you use PPC32 kernel as 2nd-kernel for PPC64 kdump ?

No. Both kernels are 64 bit. The system does not boot with a 32 bit kernel (it's not like x86-64 where the system is entirely i386 compatible from the beginning).

But for openSUSE and SLES 9/SLES 10 at least -- that are the only distributions I know on PPC [1] --, the userland is 90 % ppc32 and only some small stuff is ppc64 (like an additional 64 bit C library and stuff that is absolutely needed to be 64 bit like crash since that's not yet capable of debugging 64 bit dumps on 32 bit).

Having that said, every tool that not needs to be 64 bit is a plus. Some month ago I already sent patches to 'fix' makedumpfile for 64 bit kernels and you accepted them.

Regards,
Bernhard

[1] I'm not in the PPC team, so I don't know that platform very well, either. And I personally don't like that approach (64 bit kernel, 32 bit userland) very much because it does cause trouble, but I cannot make decisions. ;-)

Signature · 6 lines
Bernhard Walle, SUSE LINUX Products GmbH, Architecture Development

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#3 lore raw

Hi Bernhard,

Thank you for the explanation.

Quoted 19 lines · Bernhard Walle
Quoted 7 lines
Quoted 7 lines

This bug fixes the problem that on a 32 bit userland makedumpfile (as common on the PPC platform) the parsing of the 64 bit VMCOREINFO fails with:

   # makedumpfile -c /home/sachin/dump/vmcore vmcore.filtered
   read_vmcoreinfo_symbol: Invalid data in /tmp/vmcoreinfowVoyJK:
   SYMBOL(mem_section)=c000000000bb4400
Quoted 7 lines
Quoted 2 lines

We just need to assume that the symbols are always 'unsigned long long' (64 bit) instead of 'unsigned long' (native pointer size on Linux platforms).

I agree with this patch basically. But I have not tested kdump on PPC64 platform (PPC32 also) and I don't know it well. So may I ask a question ?

For PPC64 kdump, is it common thing that makedumpfile runs on PPC32 ? In other words, do you use PPC32 kernel as 2nd-kernel for PPC64 kdump ?

No. Both kernels are 64 bit. The system does not boot with a 32 bit kernel (it's not like x86-64 where the system is entirely i386 compatible from the beginning).

Quoted 5 lines

But for openSUSE and SLES 9/SLES 10 at least -- that are the only distributions I know on PPC [1] --, the userland is 90 % ppc32 and only some small stuff is ppc64 (like an additional 64 bit C library and stuff that is absolutely needed to be 64 bit like crash since that's not yet capable of debugging 64 bit dumps on 32 bit).

I think it is better that makedumpfile for PPC64 is compiled with 64 bit like the crash utility, because I guess that PPC32 makedumpfile annot run with option '-d 2+' on PPC64 machine even if this patch is merged. Could you please use makedumpfile compiled with 64 bit for PPC64 ?

'unsigned long' is native pointer size on Linux platforms as you said, and makedumpfile reads many pointers into 'unsigned long' variables by readmem() function like the following:

get_mm_flatmem(void)

 {
        unsigned long mem_map;

        if (!readmem(VADDR, SYMBOL(mem_map), &mem_map, sizeof mem_map)
            || !mem_map) {
                ERRMSG("Can't get the address of mem_map.\n");
                return FALSE;
        }

'unsigned long' of PPC32 is 32 bit, so PPC32 makedumpfile cannot read 64 bit pointer. If they will be changed to 'unsigned long long'(64 bit), makedumpfile reads invalid area on 32 bit machine. Then this change is not acceptable.

Quoted 3 lines

Having that said, every tool that not needs to be 64 bit is a plus. Some month ago I already sent patches to 'fix' makedumpfile for 64 bit kernels and you accepted them.

This patch is different purpose from the patch you sent some month ago:

[PATCH] Fix vmcoreinfo generation on 32bit hosts for 64bit kernels
http://lists.infradead.org/pipermail/kexec/2008-June/001945.html

The patch you sent some month ago is for generating the vmcoreinfo file of PPC64 on PPC32 machine, but this patch is for executing PPC32 makedumpfile for PPC64 kdump. I accepted the former, but I don't like the latter because of the above reason.

Quoted 4 lines

[1] I'm not in the PPC team, so I don't know that platform very well, either. And I personally don't like that approach (64 bit kernel, 32 bit userland) very much because it does cause trouble, but I cannot make decisions. ;-)

You are right. This approach (64 bit kernel, 32 bit userland) causes trouble, and I also don't like it.

Thanks
Ken'ichi Ohmichi

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#4 lore raw
Quoted 5 lines · Ken'ichi Ohmichi

'unsigned long' of PPC32 is 32 bit, so PPC32 makedumpfile cannot read 64 bit pointer. If they will be changed to 'unsigned long long'(64 bit), makedumpfile reads invalid area on 32 bit machine. Then this change is not acceptable.

Agreed. I think we need to ship 64 bit makedumpfile.

Bernhard

Signature · 6 lines
Bernhard Walle, SUSE Linux Products GmbH, Architecture Development

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#5 lore raw
In reply to Ken'ichi Ohmichi
Quoted 7 lines · Ken'ichi Ohmichi
Quoted 7 lines
---
 makedumpfile.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
Quoted 10 lines

makedumpfile.c line 16

Quoted 7 lines
makedumpfile.c +0 -1
@@ -13,7 +13,6 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-#include <stdlib.h>

This is not related to this purpose, but this is reasonable and will be merged as the other patch ;-)

Yes ;)

Quoted 4 lines

makedumpfile.c read_vmcoreinfo_basic_info(void) · line 2273

Quoted 2 lines
makedumpfile.c +0 -0
@@ -2274,7 +2273,7 @@ read_vmcoreinfo_basic_info(void)
 unsigned long

unsigned long long ?

Right! Thanks for catching that. It worked in my case without that, but probably because the symbol wasn't needed and only parsed with -c -D0.

I'll send a new patch later when I'm in the office ...

Bernhard

Signature · 6 lines
Bernhard Walle, SUSE LINUX Products GmbH, Architecture Development

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec