Skip to contentSkip to conversation

FYI: x86_64 bug when using gdb with vmcore

DISCUSSION Dave Anderson 2 participants 2 messages Feb 17, 2010 – Feb 18, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 571350993.1786101266414411140.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com

#1 lore raw
Quoted 30 lines · ----- "Simon Horman
Quoted 21 lines · Dave Anderson

The kexec/arch/x86_64/crashdump-x86_64.h file contains a stale PAGE_OFFSET value. In 2.6.27 it was changed from 0xffff810000000000UL to 0xffff880000000000UL. This is only a problem when using gdb with the vmlinux/vmcore pair, because gdb relies upon the PT_LOAD segment's p_vaddr values in the ELF header to be correct.

Anyway, in the RHEL6 kexec-tools, this simple patch was made:

(quoted diff) +1 -1
-#define PAGE_OFFSET            0xffff810000000000UL
+#define PAGE_OFFSET            0xffff880000000000UL

which is OK since the RHEL6 version of kexec-tools will only be used with RHEL6 kernels.

But for backwards compatibility, the better way to do it would be to check the utsname of the running kernel, and use the right value.

Quoted 5 lines

But again, this is only required for gdb usage. The crash utility (and makedumpfile) make kernel version checks to determine which x86_64 PAGE_OFFSET value is applicable, and don't rely on the ELF header p_vaddr values for the unity-mapped regions.

Hi Dave,

Quoted 1 line

Something like this?

Looks good to me -- all except for the second "if" statement/typo below:

Quoted 5 lines
(quoted diff) +5 -0
+int arch_init(void)
+{
+	int kv;
+
+	kv = kernel_version();

Review

Quoted 10 lines
(quoted diff) +10 -0
+	if (kv < 0)
+		return -1;
+
+	if (kv < KERNEL_VERSION(2, 4, 27))
+		page_offset = PAGE_OFFSET_PRE_2_6_27;
+	else
+		page_offset = PAGE_OFFSET;
+
+	return 0;
+}

Thanks,
Dave

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

#2 lore raw
Quoted 33 lines · Dave Anderson
Quoted 30 lines · ----- "Simon Horman
Quoted 21 lines · Dave Anderson

The kexec/arch/x86_64/crashdump-x86_64.h file contains a stale PAGE_OFFSET value. In 2.6.27 it was changed from 0xffff810000000000UL to 0xffff880000000000UL. This is only a problem when using gdb with the vmlinux/vmcore pair, because gdb relies upon the PT_LOAD segment's p_vaddr values in the ELF header to be correct.

Anyway, in the RHEL6 kexec-tools, this simple patch was made:

(quoted diff) +1 -1
-#define PAGE_OFFSET            0xffff810000000000UL
+#define PAGE_OFFSET            0xffff880000000000UL

which is OK since the RHEL6 version of kexec-tools will only be used with RHEL6 kernels.

But for backwards compatibility, the better way to do it would be to check the utsname of the running kernel, and use the right value.

Quoted 5 lines

But again, this is only required for gdb usage. The crash utility (and makedumpfile) make kernel version checks to determine which x86_64 PAGE_OFFSET value is applicable, and don't rely on the ELF header p_vaddr values for the unity-mapped regions.

Hi Dave,

Quoted 3 lines
Quoted 1 line

Something like this?

Looks good to me -- all except for the second "if" statement/typo below:

Thanks, 2.4.27 was a special time for me :-)

I've fixed that up and pushed the commit.

Quoted 10 lines
Quoted 10 lines
(quoted diff) +10 -0
+int arch_init(void)
+{
+	int kv;
+
+	kv = kernel_version();
+	if (kv < 0)
+		return -1;
+
+	if (kv < KERNEL_VERSION(2, 4, 27))
+		page_offset = PAGE_OFFSET_PRE_2_6_27;
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+	else
+		page_offset = PAGE_OFFSET;
+
+	return 0;
+}

Thanks,
Dave

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