From 8b3262c00d6feccdccd6567d27687ae4b64c54bd Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Mon, 16 Jan 2012 16:46:04 +1000 Subject: m68knommu: fix syscall tracing stuck process The return path from an exception was checking too many bits in the thread_info->flags, and getting stuck calling do_signal(). There was no work to do, we should only be checking the low 8 bits (as per comments and definitions in arch/m68k/include/asm/thread_info.h). This fixes the stuck process problem when using strace. Signed-off-by: Greg Ungerer --- arch/m68k/platform/coldfire/entry.S | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/m68k/platform/coldfire/entry.S b/arch/m68k/platform/coldfire/entry.S index 863889fc31c9..281e38c2b6c7 100644 --- a/arch/m68k/platform/coldfire/entry.S +++ b/arch/m68k/platform/coldfire/entry.S @@ -136,7 +136,7 @@ Luser_return: movel %sp,%d1 /* get thread_info pointer */ andl #-THREAD_SIZE,%d1 /* at base of kernel stack */ movel %d1,%a0 - movel %a0@(TINFO_FLAGS),%d1 /* get thread_info->flags */ + moveb %a0@(TINFO_FLAGS+3),%d1 /* thread_info->flags (low 8 bits) */ jne Lwork_to_do /* still work to do */ Lreturn: @@ -148,8 +148,6 @@ Lwork_to_do: btst #TIF_NEED_RESCHED,%d1 jne reschedule - /* GERG: do we need something here for TRACEing?? */ - Lsignal_return: subql #4,%sp /* dummy return address */ SAVE_SWITCH_STACK -- cgit v1.2.3-59-g8ed1b From 57e00098cc0e43d001c9c8a018a1f8396faa0d16 Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Tue, 10 Jan 2012 14:06:07 +0100 Subject: m68k: Add shared bit to Coldfire kernel page entries We had problems accessing our NOR flash trough mtd. The system always got stuck at attaching UBI using ubiattach if booted from NFS or after mounting squashfs as rootfs directly from NOR flash. After some testing of the new changes introduced from v3.2-rc1 to v3.2-rc7 we had to apply the following patch to get mtd working again. [gerg: The problem was ultimately caused by allocated kernel pages not having the shared (SG) bit set. Without the SG bit set the MMU will look for page matches incorporating the ASID as well. Things like module regions allocated using vmalloc would fault when other processes run. ] Signed-off-by: Alexander Stein Signed-off-by: Greg Ungerer --- arch/m68k/include/asm/mcf_pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/m68k/include/asm/mcf_pgtable.h b/arch/m68k/include/asm/mcf_pgtable.h index 756bde4fb4f8..3c793682e5d9 100644 --- a/arch/m68k/include/asm/mcf_pgtable.h +++ b/arch/m68k/include/asm/mcf_pgtable.h @@ -78,7 +78,8 @@ | CF_PAGE_READABLE \ | CF_PAGE_WRITABLE \ | CF_PAGE_EXEC \ - | CF_PAGE_SYSTEM) + | CF_PAGE_SYSTEM \ + | CF_PAGE_SHARED) #define PAGE_COPY __pgprot(CF_PAGE_VALID \ | CF_PAGE_ACCESSED \ -- cgit v1.2.3-59-g8ed1b From 3372f5a7d005dd42e754490fed6a0171c4a018c6 Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Mon, 23 Jan 2012 15:45:56 +0100 Subject: m68k: Do not set global share for non-kernel shared pages If the SG bit is set in MMUTR the page is accessible for all userspace processes (ignoring the ASID). So a process might randomly access a page from a different process which had a shared page (from shared memory) in its context. Signed-off-by: Alexander Stein Signed-off-by: Greg Ungerer --- arch/m68k/mm/mcfmmu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c index babd5a97cdcb..875b800ef0dd 100644 --- a/arch/m68k/mm/mcfmmu.c +++ b/arch/m68k/mm/mcfmmu.c @@ -87,7 +87,7 @@ void __init paging_init(void) int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word) { - unsigned long flags, mmuar; + unsigned long flags, mmuar, mmutr; struct mm_struct *mm; pgd_t *pgd; pmd_t *pmd; @@ -137,9 +137,10 @@ int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word) if (!pte_dirty(*pte) && !KMAPAREA(mmuar)) set_pte(pte, pte_wrprotect(*pte)); - mmu_write(MMUTR, (mmuar & PAGE_MASK) | (asid << MMUTR_IDN) | - (((int)(pte->pte) & (int)CF_PAGE_MMUTR_MASK) - >> CF_PAGE_MMUTR_SHIFT) | MMUTR_V); + mmutr = (mmuar & PAGE_MASK) | (asid << MMUTR_IDN) | MMUTR_V; + if ((mmuar < TASK_UNMAPPED_BASE) || (mmuar >= TASK_SIZE)) + mmutr |= (pte->pte & CF_PAGE_MMUTR_MASK) >> CF_PAGE_MMUTR_SHIFT; + mmu_write(MMUTR, mmutr); mmu_write(MMUDR, (pte_val(*pte) & PAGE_MASK) | ((pte->pte) & CF_PAGE_MMUDR_MASK) | MMUDR_SZ_8KB | MMUDR_X); -- cgit v1.2.3-59-g8ed1b