Skip to contentSkip to conversation

PATCH: Fix for 4KB kernel corruption

Linux-ia64 Siddha, Suresh B 3 participants 5 messages Nov 16, 2001 – Nov 19, 2001

lore
Share & tools
lore
#0 lore raw

Hi,

4KB page size kernel is broken on Lion with 8GB memory. ia64_boot_param structure was getting corrupted. Appended patch fixes this problem.

PAGE_ALIGN is required because: rsvd_region[i].end need not be page aligned and in the next iteration of the for loop this can potentially become bootmap_start. This can lead to corruption of rsvd_region[i] as init_bootmem() takes the pfn of bootmap_start and initialises the bootmem.

Thanks,
Suresh

diff -u linux-2.4.14/arch/ia64/kernel/setup.c~
linux-2.4.14/arch/ia64/kernel/setup.c

arch/ia64/kernel/setup.c Thu Nov 15 16:28:01 2001 renamed from arch/ia64/kernel/setup.c~ Thu Nov 15 16:27:23 2001 +1 -1
@@ -175,7 +175,7 @@
                /* nothing more available in this segment */
                if (range_end = end) return 0;
 
-               free_start = rsvd_region[i].end;
+               free_start = PAGE_ALIGN(rsvd_region[i].end);
        }
        return 0;
 }
#1 lore raw

Hi,

4KB page size kernel is broken on Lion with 8GB memory. ia64_boot_param structure was getting corrupted. Appended patch fixes this problem.

PAGE_ALIGN is required because: rsvd_region[i].end need not be page aligned and in the next iteration of the for loop this can potentially become bootmap_start. This can lead to corruption of rsvd_region[i] as init_bootmem() takes the pfn of bootmap_start and initialises the bootmem.

Thanks,
Suresh

diff -u linux-2.4.14/arch/ia64/kernel/setup.c~
linux-2.4.14/arch/ia64/kernel/setup.c

arch/ia64/kernel/setup.c Thu Nov 15 16:28:01 2001 renamed from arch/ia64/kernel/setup.c~ Thu Nov 15 16:27:23 2001 +1 -1
@@ -175,7 +175,7 @@
                /* nothing more available in this segment */
                if (range_end = end) return 0;
 
-               free_start = rsvd_region[i].end;
+               free_start = PAGE_ALIGN(rsvd_region[i].end);
        }
        return 0;
 }
#2 lore raw
In reply to Siddha, Suresh B

Hi Siddha,

Can this corruption happen with on lion with 4Go of memory also ?

Thanks,

Philippe.

Quoted 32 lines · Suresh B

Hi,

4KB page size kernel is broken on Lion with 8GB memory. ia64_boot_param structure was getting corrupted. Appended patch fixes this problem.

PAGE_ALIGN is required because: rsvd_region[i].end need not be page aligned and in the next iteration of the for loop this can potentially become bootmap_start. This can lead to corruption of rsvd_region[i] as init_bootmem() takes the pfn of bootmap_start and initialises the bootmem.

Thanks,
Suresh

diff -u linux-2.4.14/arch/ia64/kernel/setup.c~
linux-2.4.14/arch/ia64/kernel/setup.c

arch/ia64/kernel/setup.c Thu Nov 15 16:28:01 2001 renamed from arch/ia64/kernel/setup.c~ Thu Nov 15 16:27:23 2001 +1 -1
@@ -175,7 +175,7 @@
                /* nothing more available in this segment */
                if (range_end = end) return 0;
 
-               free_start = rsvd_region[i].end;
+               free_start = PAGE_ALIGN(rsvd_region[i].end);
        }
        return 0;
 }

_______________________________________________
Linux-IA64 mailing list
[email protected]
http://lists.linuxia64.org/lists/listinfo/linux-ia64

#3 lore raw
In reply to Siddha, Suresh B

Hi Philippe,

You may or mayn't see this problem. It depends up on the EFI memory map. In our case, it is so happening that bootmap is allocated from the end of one of the reserved regions and corrupting that reserved region.

Thanks,
Suresh

Quoted 57 lines

-----Original Message-----
From: Philippe Gramoullé [mailto:[email protected]]
Sent: Friday, November 16, 2001 2:24 AM
To: Siddha, Suresh B
Cc: [email protected]
Subject: Re: [Linux-ia64] PATCH: Fix for 4KB kernel corruption

Hi Siddha,

Can this corruption happen with on lion with 4Go of memory also ?

Thanks,

Philippe.

Quoted 4 lines · Suresh B

Hi,

4KB page size kernel is broken on Lion with 8GB memory.

ia64_boot_param

Quoted 3 lines

structure was getting corrupted. Appended patch fixes this problem.

PAGE_ALIGN is required because: rsvd_region[i].end need not

be page aligned

Quoted 1 line

and in the next iteration of the for loop this can

potentially become

Quoted 2 lines

bootmap_start. This can lead to corruption of rsvd_region[i] as init_bootmem() takes the pfn of bootmap_start and

initialises the bootmem.

Quoted 7 lines

Thanks,
Suresh

diff -u linux-2.4.14/arch/ia64/kernel/setup.c~
linux-2.4.14/arch/ia64/kernel/setup.c
--- linux-2.4.14/arch/ia64/kernel/setup.c~ Thu Nov 15

16:27:23 2001

Quoted 1 line

+++ linux-2.4.14/arch/ia64/kernel/setup.c Thu Nov 15

16:28:01 2001

Quoted 14 lines
arch/ia64/kernel/setup.c Thu Nov 15 16:28:01 2001 renamed from arch/ia64/kernel/setup.c~ Thu Nov 15 16:27:23 2001 +1 -1
@@ -175,7 +175,7 @@
                /* nothing more available in this segment */
                if (range_end == end) return 0;
 
-               free_start = rsvd_region[i].end;
+               free_start = PAGE_ALIGN(rsvd_region[i].end);
        }
        return 0;
 }

_______________________________________________
Linux-IA64 mailing list
[email protected]
http://lists.linuxia64.org/lists/listinfo/linux-ia64

#4 lore raw
In reply to Siddha, Suresh B
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Suresh B

Suresh> Hi, 4KB page size kernel is broken on Lion with 8GB Suresh> memory. ia64_boot_param structure was getting Suresh> corrupted. Appended patch fixes this problem.

Thanks I applied the patch and also make sure the end address is page aligned. It's not strictly needed, but it's cleaner that way (since the bootmap size is measured as a page count).

	--david