From 9ba4ace39fdfe22268daca9f28c5df384ae462cf Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Wed, 20 Jun 2007 01:07:04 +1000 Subject: [PATCH 1/2] [POWERPC] PowerPC: Prevent data exception in kernel space (32-bit) The "is_exec" branch of the protection check in do_page_fault() didn't do anything on 32-bit PowerPC. So if a userland program jumps to a page with Linux protection flags "---p", all the tests happily fall through, and handle_mm_fault() is called, which in turn calls handle_pte_fault(), which calls update_mmu_cache(), which goes flush the dcache to a page with no access rights. Boom. This fixes it. Signed-off-by: Segher Boessenkool Cc: Johannes Berg Signed-off-by: Paul Mackerras --- arch/powerpc/mm/fault.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index bfe901353142..115b25f50bf8 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -279,14 +279,13 @@ good_area: #endif /* CONFIG_8xx */ if (is_exec) { -#ifdef CONFIG_PPC64 +#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) /* protection fault */ if (error_code & DSISR_PROTFAULT) goto bad_area; if (!(vma->vm_flags & VM_EXEC)) goto bad_area; -#endif -#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) +#else pte_t *ptep; pmd_t *pmdp; From c5f226c7e95bf318879fb6ae02fc0dfb0f6d408c Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Wed, 20 Jun 2007 15:17:29 +1000 Subject: [PATCH 2/2] [POWERPC] Fix powermac late initcall to only run on powermac Current ppc64_defconfig kernel fails to boot on iSeries, dying with: Unable to handle kernel paging request for data at address 0x00000000 Faulting instruction address: 0xc00000000071b258 Oops: Kernel access of bad area, sig: 11 [#1] SMP NR_CPUS=32 iSeries NIP [c00000000071b258] .iSeries_src_init+0x34/0x64 LR [c000000000701bb4] .kernel_init+0x1fc/0x3bc Call Trace: [c000000007d0be30] [0000000000008000] 0x8000 (unreliable) [c000000007d0bea0] [c000000000701bb4] .kernel_init+0x1fc/0x3bc [c000000007d0bf90] [c0000000000262d4] .kernel_thread+0x4c/0x68 Instruction dump: e922cba8 3880ffff 78840420 f8010010 f821ff91 60000000 e8090000 78095fe3 4182002c e922cb58 e862cbb0 e9290140 f8410028 7c0903a6 e9690010 Kernel panic - not syncing: Attempted to kill init! This happens because some powermac code unconditionally sets ppc_md.progress to NULL. This patch makes sure the powermac late initcall is only run on powermac machines. Signed-off-by: Tony Breeds Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/powermac/setup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 956571526a57..7ccb9236e8b4 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c @@ -454,6 +454,9 @@ static int initializing = 1; static int pmac_late_init(void) { + if (!machine_is(powermac)) + return -ENODEV; + initializing = 0; /* this is udbg (which is __init) and we can later use it during * cpu hotplug (in smp_core99_kick_cpu) */