Skip to contentSkip to conversation

x86: Fix PAGE_OFFSET for kernels since 4.20

PATCH Applied Donald Buczek 4 participants 13 messages Aug 30, 2019 – Sep 16, 2019

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

PATCH 1/1 x86: Fix PAGE_OFFSET for kernels since 4.20

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

Update to new address accordingly.

---
 kexec/arch/i386/crashdump-x86.c | 2 ++
 kexec/arch/i386/crashdump-x86.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
kexec/arch/i386/crashdump-x86.c +2 -0
index a2aea31..c79791f 100644
@@ -61,6 +61,8 @@ static int get_kernel_page_offset(struct kexec_info *UNUSED(info),
 
 		if (kv < KERNEL_VERSION(2, 6, 27))
 			elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_2_6_27;
+		else if (kv < KERNEL_VERSION(4, 20, 0))
+			elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_4_20_0;
 		else
 			elf_info->page_offset = X86_64_PAGE_OFFSET;
 	}
kexec/arch/i386/crashdump-x86.h +2 -1
index ddee19f..e4fdc82 100644
@@ -13,7 +13,8 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 
 #define X86_64__START_KERNEL_map	0xffffffff80000000ULL
 #define X86_64_PAGE_OFFSET_PRE_2_6_27	0xffff810000000000ULL
-#define X86_64_PAGE_OFFSET		0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET_PRE_4_20_0	0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET	0xffff888000000000ULL
 
 #define X86_64_MAXMEM        		0x3fffffffffffUL
 
Signature · 7 lines
2.22.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw
Quoted 4 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

A good catch and necessary fix, thanks.

Does it have issue in makedumpfile?

#ifdef __x86_64__

#define __PAGE_OFFSET_ORIG      (0xffff810000000000) /* 2.6.26, or former */
#define __PAGE_OFFSET_2_6_27    (0xffff880000000000) /* 2.6.27, or later  */
#define __PAGE_OFFSET_5LEVEL    (0xff10000000000000) /* 5-level page table */ 

...
#endif

Thanks
Baoquan

Quoted 42 lines

Update to new address accordingly.

---
 kexec/arch/i386/crashdump-x86.c | 2 ++
 kexec/arch/i386/crashdump-x86.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
kexec/arch/i386/crashdump-x86.c +2 -0
index a2aea31..c79791f 100644
@@ -61,6 +61,8 @@ static int get_kernel_page_offset(struct kexec_info *UNUSED(info),
 
 		if (kv < KERNEL_VERSION(2, 6, 27))
 			elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_2_6_27;
+		else if (kv < KERNEL_VERSION(4, 20, 0))
+			elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_4_20_0;
 		else
 			elf_info->page_offset = X86_64_PAGE_OFFSET;
 	}
kexec/arch/i386/crashdump-x86.h +2 -1
index ddee19f..e4fdc82 100644
@@ -13,7 +13,8 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 
 #define X86_64__START_KERNEL_map	0xffffffff80000000ULL
 #define X86_64_PAGE_OFFSET_PRE_2_6_27	0xffff810000000000ULL
-#define X86_64_PAGE_OFFSET		0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET_PRE_4_20_0	0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET	0xffff888000000000ULL
 
 #define X86_64_MAXMEM        		0x3fffffffffffUL
 
Signature · 7 lines
2.22.0


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

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

#2 lore raw

Dear Baoquan,

Quoted 9 lines · Baoquan He
Quoted 4 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

A good catch and necessary fix, thanks.

Does it have issue in makedumpfile?

We don't use makedumpfile. We use cp /proc/vmcore /mnt/crash.vmcore in the panic kernel.

Without this patch, the file /mnt/crash.vmcore has the wrong vaddr in the elf headers and can't be processed by gdb or crash.

With this patch, the file has the correct vaddr an can be processed by gdb and crash.

Btw: I've got four strange error replies for my mail.

    Date: 30 Aug 2019 05:13:31 EDT
    From: [email protected]
    To: [email protected]
        Message to [email protected] failed.

I hope, my patch reaches the right people anyway.

Best
Donald

Quoted 53 lines

#ifdef __x86_64__

#define __PAGE_OFFSET_ORIG      (0xffff810000000000) /* 2.6.26, or former */
#define __PAGE_OFFSET_2_6_27    (0xffff880000000000) /* 2.6.27, or later  */
#define __PAGE_OFFSET_5LEVEL    (0xff10000000000000) /* 5-level page table */

...
#endif

Thanks
Baoquan

Quoted 42 lines

Update to new address accordingly.

---
  kexec/arch/i386/crashdump-x86.c | 2 ++
  kexec/arch/i386/crashdump-x86.h | 3 ++-
  2 files changed, 4 insertions(+), 1 deletion(-)
kexec/arch/i386/crashdump-x86.c +2 -0
index a2aea31..c79791f 100644
@@ -61,6 +61,8 @@ static int get_kernel_page_offset(struct kexec_info *UNUSED(info),
 
  		if (kv < KERNEL_VERSION(2, 6, 27))
  			elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_2_6_27;
+		else if (kv < KERNEL_VERSION(4, 20, 0))
+			elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_4_20_0;
  		else
  			elf_info->page_offset = X86_64_PAGE_OFFSET;
  	}
kexec/arch/i386/crashdump-x86.h +2 -1
index ddee19f..e4fdc82 100644
@@ -13,7 +13,8 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 
  #define X86_64__START_KERNEL_map	0xffffffff80000000ULL
  #define X86_64_PAGE_OFFSET_PRE_2_6_27	0xffff810000000000ULL
-#define X86_64_PAGE_OFFSET		0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET_PRE_4_20_0	0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET	0xffff888000000000ULL
 
  #define X86_64_MAXMEM        		0x3fffffffffffUL
 
Signature · 7 lines
2.22.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Signature · 8 lines
Donald Buczek
[email protected]
Tel: +49 30 8413 1433

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#3 lore raw
Quoted 10 lines · Donald Buczek

Dear Baoquan,

Quoted 6 lines · Baoquan He
Quoted 4 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

Quoted 5 lines
Quoted 3 lines

A good catch and necessary fix, thanks.

Does it have issue in makedumpfile?

We don't use makedumpfile. We use cp /proc/vmcore /mnt/crash.vmcore in the panic kernel.

That shouldn't be a problem in makedumpfile as we have a generic way to calculate the PAGE_OFFSET value there from the PT_LOADs in the '/proc/kcore' file (which I mentioned in the other email conversation, see [0]):

static int
get_page_offset_x86_64(void)
{
<..snip..>

    if (get_num_pt_loads()) {
        /*
         * Linux 4.19 (only) adds KCORE_REMAP PT_LOADs, which have
         * virt_start < __START_KERNEL_map, to /proc/kcore. In order
         * not to select them, we select the last valid PT_LOAD.
         */
        for (i = 0;
            get_pt_load(i, &phys_start, NULL, &virt_start, NULL);
            i++) {
            if (virt_start != NOT_KV_ADDR
                    && virt_start < __START_KERNEL_map
                    && phys_start != NOT_PADDR) {
                page_offset = virt_start - phys_start;
            }
        }
        if (page_offset) {
            info->page_offset = page_offset;
            DEBUG_MSG("page_offset  : %lx (pt_load)\n",
                info->page_offset);
            return TRUE;
        }
    }

<..snip..>

Also as I mentioned in the other thread, I don't think adding different MACRO value for a kernel version is a long-term maintainable approach. Instead I am working on adding a similar functionality as present in makedumpfile to make the PAGE_OFFSET calculation generic. Only if we fail to calculate PAGE_OFFSET through a generic method should we fall back on MACRO values for backward compatibility.

I will try to post the patch for reviews by tomorrow.

[0]. https://lkml.org/lkml/2019/8/28/1060

Thanks,
Bhupesh

Quoted 66 lines

Without this patch, the file /mnt/crash.vmcore has the wrong vaddr in the elf headers and can't be processed by gdb or crash.

With this patch, the file has the correct vaddr an can be processed by gdb and crash.

Btw: I've got four strange error replies for my mail.

     Date: 30 Aug 2019 05:13:31 EDT
     From: [email protected]
     To: [email protected]
         Message to [email protected] failed.

I hope, my patch reaches the right people anyway.

Best
Donald

Quoted 49 lines

#ifdef __x86_64__

#define __PAGE_OFFSET_ORIG      (0xffff810000000000) /* 2.6.26, or former */
#define __PAGE_OFFSET_2_6_27    (0xffff880000000000) /* 2.6.27, or later  */
#define __PAGE_OFFSET_5LEVEL    (0xff10000000000000) /* 5-level page table */

...
#endif

Thanks
Baoquan

Quoted 38 lines

Update to new address accordingly.

---
  kexec/arch/i386/crashdump-x86.c | 2 ++
  kexec/arch/i386/crashdump-x86.h | 3 ++-
  2 files changed, 4 insertions(+), 1 deletion(-)
kexec/arch/i386/crashdump-x86.c +2 -0
index a2aea31..c79791f 100644
@@ -61,6 +61,8 @@ static int get_kernel_page_offset(struct kexec_info *UNUSED(info),
 
             if (kv < KERNEL_VERSION(2, 6, 27))
                     elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_2_6_27;
+            else if (kv < KERNEL_VERSION(4, 20, 0))
+                    elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_4_20_0;
             else
                     elf_info->page_offset = X86_64_PAGE_OFFSET;
     }
kexec/arch/i386/crashdump-x86.h +2 -2
index ddee19f..e4fdc82 100644
@@ -13,7 +13,8 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 
  #define X86_64__START_KERNEL_map   0xffffffff80000000ULL
  #define X86_64_PAGE_OFFSET_PRE_2_6_27      0xffff810000000000ULL
-#define X86_64_PAGE_OFFSET          0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET_PRE_4_20_0       0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET  0xffff888000000000ULL
 
  #define X86_64_MAXMEM                      0x3fffffffffffUL
 
--

2.22.0

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

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

--
Donald Buczek
[email protected]
Tel: +49 30 8413 1433

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

#4 lore raw

Dear Baoquan,

Quoted 48 lines · Bhupesh Sharma
Quoted 10 lines · Donald Buczek

Dear Baoquan,

Quoted 6 lines · Baoquan He
Quoted 4 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

Quoted 5 lines
Quoted 3 lines

A good catch and necessary fix, thanks.

Does it have issue in makedumpfile?

We don't use makedumpfile. We use cp /proc/vmcore /mnt/crash.vmcore in the panic kernel.

That shouldn't be a problem in makedumpfile as we have a generic way to calculate the PAGE_OFFSET value there from the PT_LOADs in the '/proc/kcore' file (which I mentioned in the other email conversation, see [0]):

static int
get_page_offset_x86_64(void)
{
<..snip..>

     if (get_num_pt_loads()) {
         /*
          * Linux 4.19 (only) adds KCORE_REMAP PT_LOADs, which have
          * virt_start < __START_KERNEL_map, to /proc/kcore. In order
          * not to select them, we select the last valid PT_LOAD.
          */
         for (i = 0;
             get_pt_load(i, &phys_start, NULL, &virt_start, NULL);
             i++) {
             if (virt_start != NOT_KV_ADDR
                     && virt_start < __START_KERNEL_map
                     && phys_start != NOT_PADDR) {
                 page_offset = virt_start - phys_start;
             }
         }
         if (page_offset) {
             info->page_offset = page_offset;
             DEBUG_MSG("page_offset  : %lx (pt_load)\n",
                 info->page_offset);
             return TRUE;
         }
     }
Quoted 8 lines

<..snip..>

Also as I mentioned in the other thread, I don't think adding different MACRO value for a kernel version is a long-term maintainable approach. Instead I am working on adding a similar functionality as present in makedumpfile to make the PAGE_OFFSET calculation generic. Only if we fail to calculate PAGE_OFFSET through a generic method should we fall back on MACRO values for backward compatibility.

Very good,.

Quoted 1 line

I will try to post the patch for reviews by tomorrow.

I'll be happy to test that.

Best
Donald

Quoted 82 lines

[0]. https://lkml.org/lkml/2019/8/28/1060

Thanks,
Bhupesh

Quoted 76 lines

Without this patch, the file /mnt/crash.vmcore has the wrong vaddr in the elf headers and can't be processed by gdb or crash.

With this patch, the file has the correct vaddr an can be processed by gdb and crash.

Btw: I've got four strange error replies for my mail.

      Date: 30 Aug 2019 05:13:31 EDT
      From: [email protected]
      To: [email protected]
          Message to [email protected] failed.

I hope, my patch reaches the right people anyway.

Best
Donald

Quoted 45 lines

#ifdef __x86_64__

#define __PAGE_OFFSET_ORIG      (0xffff810000000000) /* 2.6.26, or former */
#define __PAGE_OFFSET_2_6_27    (0xffff880000000000) /* 2.6.27, or later  */
#define __PAGE_OFFSET_5LEVEL    (0xff10000000000000) /* 5-level page table */

...
#endif

Thanks
Baoquan

Quoted 34 lines

Update to new address accordingly.

---
   kexec/arch/i386/crashdump-x86.c | 2 ++
   kexec/arch/i386/crashdump-x86.h | 3 ++-
   2 files changed, 4 insertions(+), 1 deletion(-)
kexec/arch/i386/crashdump-x86.c +2 -0
index a2aea31..c79791f 100644
@@ -61,6 +61,8 @@ static int get_kernel_page_offset(struct kexec_info *UNUSED(info),
 
              if (kv < KERNEL_VERSION(2, 6, 27))
                      elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_2_6_27;
+            else if (kv < KERNEL_VERSION(4, 20, 0))
+                    elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_4_20_0;
              else
                      elf_info->page_offset = X86_64_PAGE_OFFSET;
      }
kexec/arch/i386/crashdump-x86.h +2 -1
index ddee19f..e4fdc82 100644
@@ -13,7 +13,8 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 
   #define X86_64__START_KERNEL_map   0xffffffff80000000ULL
   #define X86_64_PAGE_OFFSET_PRE_2_6_27      0xffff810000000000ULL
-#define X86_64_PAGE_OFFSET          0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET_PRE_4_20_0       0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET  0xffff888000000000ULL
 
   #define X86_64_MAXMEM                      0x3fffffffffffUL
 
Quoted 8 lines
Quoted 8 lines

--
2.22.0

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

--
Donald Buczek
[email protected]
Tel: +49 30 8413 1433

Signature · 8 lines
Donald Buczek
[email protected]
Tel: +49 30 8413 1433

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#5 lore raw
In reply to Bhupesh Sharma
Quoted 13 lines · Bhupesh Sharma
Quoted 12 lines · Donald Buczek

Dear Baoquan,

Quoted 8 lines · Baoquan He
Quoted 4 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

A good catch and necessary fix, thanks.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Does it have issue in makedumpfile?

We don't use makedumpfile. We use cp /proc/vmcore /mnt/crash.vmcore in the panic kernel.

That shouldn't be a problem in makedumpfile as we have a generic way to calculate the PAGE_OFFSET value there from the PT_LOADs in the '/proc/kcore' file (which I mentioned in the other email conversation, see [0]):

Yeah, right.

Quoted 36 lines

static int
get_page_offset_x86_64(void)
{
<..snip..>

    if (get_num_pt_loads()) {
        /*
         * Linux 4.19 (only) adds KCORE_REMAP PT_LOADs, which have
         * virt_start < __START_KERNEL_map, to /proc/kcore. In order
         * not to select them, we select the last valid PT_LOAD.
         */
        for (i = 0;
            get_pt_load(i, &phys_start, NULL, &virt_start, NULL);
            i++) {
            if (virt_start != NOT_KV_ADDR
                    && virt_start < __START_KERNEL_map
                    && phys_start != NOT_PADDR) {
                page_offset = virt_start - phys_start;
            }
        }
        if (page_offset) {
            info->page_offset = page_offset;
            DEBUG_MSG("page_offset  : %lx (pt_load)\n",
                info->page_offset);
            return TRUE;
        }
    }

<..snip..>

Also as I mentioned in the other thread, I don't think adding different MACRO value for a kernel version is a long-term maintainable approach. Instead I am working on adding a similar functionality as present in makedumpfile to make the PAGE_OFFSET calculation generic. Only if we fail to calculate PAGE_OFFSET through a generic method should we fall back on MACRO values for backward compatibility.

Quoted 3 lines

I will try to post the patch for reviews by tomorrow.

[0]. https://lkml.org/lkml/2019/8/28/1060

Sounds a good idea, thanks for the effort.

Thanks
Baoquan

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

Applied
#6 lore raw
In reply to Donald Buczek
Quoted 6 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

Update to new address accordingly.

Thanks, applied for inclusion in v2.0.20.

Quoted 35 lines
---
 kexec/arch/i386/crashdump-x86.c | 2 ++
 kexec/arch/i386/crashdump-x86.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
kexec/arch/i386/crashdump-x86.c +2 -0
index a2aea31..c79791f 100644
@@ -61,6 +61,8 @@ static int get_kernel_page_offset(struct kexec_info *UNUSED(info),
 
 		if (kv < KERNEL_VERSION(2, 6, 27))
 			elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_2_6_27;
+		else if (kv < KERNEL_VERSION(4, 20, 0))
+			elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_4_20_0;
 		else
 			elf_info->page_offset = X86_64_PAGE_OFFSET;
 	}
kexec/arch/i386/crashdump-x86.h +2 -1
index ddee19f..e4fdc82 100644
@@ -13,7 +13,8 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 
 #define X86_64__START_KERNEL_map	0xffffffff80000000ULL
 #define X86_64_PAGE_OFFSET_PRE_2_6_27	0xffff810000000000ULL
-#define X86_64_PAGE_OFFSET		0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET_PRE_4_20_0	0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET	0xffff888000000000ULL
 
 #define X86_64_MAXMEM        		0x3fffffffffffUL
 
Signature · 1 line
2.22.0

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

#7 lore raw

Dear Simon,

Quoted 9 lines · Simon Horman
Quoted 6 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

Update to new address accordingly.

Thanks, applied for inclusion in v2.0.20.

I must admit, that I overlooked that d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") was backported to 4.19.5 as 4074ca7d8a18 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging").

Bhupesh Sharma wanted to look into a a dynamic solution, which, of course, would be better. But if you still want to include this (e.g. as the fallback for the dynamic solution), you might want to replace the patch with the following one, which selects the new PAGE_OFFSET starting from kernel version 4.19.5 instead of 4.20.0.

Donald

Quoted 1 line

8------------------------------------------------------8<

x86: Fix PAGE_OFFSET for kernels since 4.19.5

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

The patch was backported to 4.19.5 as 4074ca7d8a18 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging").

Update to new address accordingly.

kexec/arch/i386/crashdump-x86.c +2 -0
index a2aea31..f9d1998 100644
@@ -61,6 +61,8 @@ static int get_kernel_page_offset(struct kexec_info *UNUSED(info),
 
                if (kv < KERNEL_VERSION(2, 6, 27))
                        elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_2_6_27;
+               else if (kv < KERNEL_VERSION(4, 19, 5))
+                       elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_4_19_5;
                else
                        elf_info->page_offset = X86_64_PAGE_OFFSET;
        }
kexec/arch/i386/crashdump-x86.h +2 -1
index ddee19f..6cd8826 100644
@@ -13,7 +13,8 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 
 #define X86_64__START_KERNEL_map       0xffffffff80000000ULL
 #define X86_64_PAGE_OFFSET_PRE_2_6_27  0xffff810000000000ULL
-#define X86_64_PAGE_OFFSET             0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET_PRE_4_19_5  0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET     0xffff888000000000ULL
 
 #define X86_64_MAXMEM                  0x3fffffffffffUL
 

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

#8 lore raw

Sorry Guys,

Quoted 10 lines · Donald Buczek

Dear Simon,

Quoted 6 lines · Simon Horman
Quoted 5 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Update to new address accordingly.

Thanks, applied for inclusion in v2.0.20.

I must admit, that I overlooked that d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") was backported to 4.19.5 as 4074ca7d8a18 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging").

Bhupesh Sharma wanted to look into a a dynamic solution, which, of course, would be better. But if you still want to include this (e.g. as the fallback for the dynamic solution), you might want to replace the patch with the following one, which selects the new PAGE_OFFSET starting from kernel version 4.19.5 instead of 4.20.0.

I was in a conference last week and was not able to connect to my test machine(s) to develop and test a more generic fix, as I suggested in my earlier message.

I will try to work on and send a generic fix in a couple of days.

Thanks.
Bhupesh

Quoted 34 lines

Donald

Quoted 1 line

8------------------------------------------------------8<

x86: Fix PAGE_OFFSET for kernels since 4.19.5

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

The patch was backported to 4.19.5 as 4074ca7d8a18 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging").

Update to new address accordingly.

kexec/arch/i386/crashdump-x86.c +2 -0
index a2aea31..f9d1998 100644
@@ -61,6 +61,8 @@ static int get_kernel_page_offset(struct kexec_info *UNUSED(info),
 
                 if (kv < KERNEL_VERSION(2, 6, 27))
                         elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_2_6_27;
+               else if (kv < KERNEL_VERSION(4, 19, 5))
+                       elf_info->page_offset = X86_64_PAGE_OFFSET_PRE_4_19_5;
                 else
                         elf_info->page_offset = X86_64_PAGE_OFFSET;
         }
kexec/arch/i386/crashdump-x86.h +0 -0
index ddee19f..6cd8826 100644

kexec/arch/i386/crashdump-x86.h int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline, · line 20

Quoted 9 lines
kexec/arch/i386/crashdump-x86.h +2 -1
@@ -13,7 +13,8 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
 
  #define X86_64__START_KERNEL_map       0xffffffff80000000ULL
  #define X86_64_PAGE_OFFSET_PRE_2_6_27  0xffff810000000000ULL
-#define X86_64_PAGE_OFFSET             0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET_PRE_4_19_5  0xffff880000000000ULL
+#define X86_64_PAGE_OFFSET     0xffff888000000000ULL
 
  #define X86_64_MAXMEM                  0x3fffffffffffUL
 

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

#9 lore raw
Quoted 19 lines · Bhupesh Sharma

Sorry Guys,

Quoted 16 lines · Donald Buczek

Dear Simon,

Quoted 9 lines · Simon Horman
Quoted 6 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

Update to new address accordingly.

Thanks, applied for inclusion in v2.0.20.

I must admit, that I overlooked that d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") was backported to 4.19.5 as 4074ca7d8a18 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging").

Quoted 7 lines
Quoted 1 line

Bhupesh Sharma wanted to look into a a dynamic solution, which, of course, would be better. But if you still want to include this (e.g. as the fallback for the dynamic solution), you might want to replace the patch with the following one, which selects the new PAGE_OFFSET starting from kernel version 4.19.5 instead of 4.20.0.

I was in a conference last week and was not able to connect to my test machine(s) to develop and test a more generic fix, as I suggested in my earlier message.

I will try to work on and send a generic fix in a couple of days.

Thanks,

I think it would be best if this patch, 23b67f048dde ("x86: Fix PAGE_OFFSET for kernels since 4.20"), was reverted.

Donald, Bhupesh, what do you think?

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

#10 lore raw
Quoted 28 lines · Simon Horman
Quoted 19 lines · Bhupesh Sharma

Sorry Guys,

Quoted 16 lines · Donald Buczek

Dear Simon,

Quoted 9 lines · Simon Horman
Quoted 6 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

Update to new address accordingly.

Thanks, applied for inclusion in v2.0.20.

I must admit, that I overlooked that d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") was backported to 4.19.5 as 4074ca7d8a18 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging").

Quoted 7 lines
Quoted 1 line

Bhupesh Sharma wanted to look into a a dynamic solution, which, of course, would be better. But if you still want to include this (e.g. as the fallback for the dynamic solution), you might want to replace the patch with the following one, which selects the new PAGE_OFFSET starting from kernel version 4.19.5 instead of 4.20.0.

I was in a conference last week and was not able to connect to my test machine(s) to develop and test a more generic fix, as I suggested in my earlier message.

I will try to work on and send a generic fix in a couple of days.

Quoted 7 lines

Thanks,

I think it would be best if this patch, 23b67f048dde ("x86: Fix PAGE_OFFSET for kernels since 4.20"), was reverted.

Donald, Bhupesh, what do you think?

The original patch is technically correct and fixes the problem for 4.20 kernels, so I don't know, why it should be reverted.

My replacement patch was to address 4.19 kernels as well. But if the original patch has already been comitted and published, it should not be replaced of course. 4.20 kernels should be addressed by a separate patch on top of it instead.

As I'm not subscribed to the kexec list, I may have missed the latest news, however.

Best
Donald

Signature · 8 lines
Donald Buczek
[email protected]
Tel: +49 30 8413 1433

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#11 lore raw
In reply to Simon Horman

Hi Simon,

Quoted 29 lines · Simon Horman
Quoted 19 lines · Bhupesh Sharma

Sorry Guys,

Quoted 16 lines · Donald Buczek

Dear Simon,

Quoted 9 lines · Simon Horman
Quoted 6 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

Update to new address accordingly.

Thanks, applied for inclusion in v2.0.20.

I must admit, that I overlooked that d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") was backported to 4.19.5 as 4074ca7d8a18 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging").

Quoted 7 lines
Quoted 1 line

Bhupesh Sharma wanted to look into a a dynamic solution, which, of course, would be better. But if you still want to include this (e.g. as the fallback for the dynamic solution), you might want to replace the patch with the following one, which selects the new PAGE_OFFSET starting from kernel version 4.19.5 instead of 4.20.0.

I was in a conference last week and was not able to connect to my test machine(s) to develop and test a more generic fix, as I suggested in my earlier message.

I will try to work on and send a generic fix in a couple of days.

Quoted 7 lines

Thanks,

I think it would be best if this patch, 23b67f048dde ("x86: Fix PAGE_OFFSET for kernels since 4.20"), was reverted.

Donald, Bhupesh, what do you think?

I am still working on a correct fix for this issue, so I would think we can keep Donald' patch for now.
Once my fix is ready and it is accepted after reviews, I think we can revert Donald's patch.

Thanks,
Bhupesh

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

#12 lore raw
Quoted 42 lines · Donald Buczek
Quoted 28 lines · Simon Horman
Quoted 19 lines · Bhupesh Sharma

Sorry Guys,

Quoted 16 lines · Donald Buczek

Dear Simon,

Quoted 9 lines · Simon Horman
Quoted 6 lines · Donald Buczek

Linux kernel commit d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") changed the base of the direct mapping from 0xffff880000000000 to 0xffff888000000000. This was merged into v4.20-rc2.

Update to new address accordingly.

Thanks, applied for inclusion in v2.0.20.

I must admit, that I overlooked that d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging") was backported to 4.19.5 as 4074ca7d8a18 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging").

Quoted 7 lines
Quoted 1 line

Bhupesh Sharma wanted to look into a a dynamic solution, which, of course, would be better. But if you still want to include this (e.g. as the fallback for the dynamic solution), you might want to replace the patch with the following one, which selects the new PAGE_OFFSET starting from kernel version 4.19.5 instead of 4.20.0.

I was in a conference last week and was not able to connect to my test machine(s) to develop and test a more generic fix, as I suggested in my earlier message.

I will try to work on and send a generic fix in a couple of days.

Quoted 7 lines

Thanks,

I think it would be best if this patch, 23b67f048dde ("x86: Fix PAGE_OFFSET for kernels since 4.20"), was reverted.

Donald, Bhupesh, what do you think?

The original patch is technically correct and fixes the problem for 4.20 kernels, so I don't know, why it should be reverted.

My replacement patch was to address 4.19 kernels as well. But if the original patch has already been comitted and published, it should not be replaced of course. 4.20 kernels should be addressed by a separate patch on top of it instead.

As I'm not subscribed to the kexec list, I may have missed the latest news, however.

Quoted 5 lines · Bhupesh Sharma

Hi Simon,

Quoted 2 lines · Simon Horman

On Mon, Sep 09, 2019 at 10:33:11AM +0530, Bhupesh Sharma wrote:

...

Quoted 8 lines
Quoted 7 lines

Thanks,

I think it would be best if this patch, 23b67f048dde ("x86: Fix PAGE_OFFSET for kernels since 4.20"), was reverted.

Donald, Bhupesh, what do you think?

Quoted 8 lines

I am still working on a correct fix for this issue, so I would think we can keep Donald' patch for now.
Once my fix is ready and it is accepted after reviews, I think we can revert Donald's patch.

Thanks,
Bhupesh

Thanks Donald, thanks Bhupesh.

I will leave 23b67f048dde ("x86: Fix PAGE_OFFSET for kernels since 4.20") in the tree and look forward to the follow-up work from Bhupesh.

Kind regards,
Simon

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