* [PATCH 5.1 89/96] MIPS: Fix bounds check virt_addr_valid [not found] <20190708150526.234572443@linuxfoundation.org> @ 2019-07-08 15:14 ` Greg Kroah-Hartman 2019-07-08 15:14 ` [PATCH 5.1 90/96] MIPS: Add missing EHB in mtc0 -> mfc0 sequence Greg Kroah-Hartman 2019-07-08 15:14 ` [PATCH 5.1 91/96] MIPS: have "plain" make calls build dtbs for selected platforms Greg Kroah-Hartman 2 siblings, 0 replies; 3+ messages in thread From: Greg Kroah-Hartman @ 2019-07-08 15:14 UTC (permalink / raw) To: linux-kernel Cc: Greg Kroah-Hartman, stable, Paul Burton, Hauke Mehrtens, ralf, jhogan, f4bug, linux-mips, ysu, jcristau From: Hauke Mehrtens <hauke@hauke-m.de> commit d6ed083f5cc621e15c15b56c3b585fd524dbcb0f upstream. The bounds check used the uninitialized variable vaddr, it should use the given parameter kaddr instead. When using the uninitialized value the compiler assumed it to be 0 and optimized this function to just return 0 in all cases. This should make the function check the range of the given address and only do the page map check in case it is in the expected range of virtual addresses. Fixes: 074a1e1167af ("MIPS: Bounds check virt_addr_valid") Cc: stable@vger.kernel.org # v4.12+ Cc: Paul Burton <paul.burton@mips.com> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: ralf@linux-mips.org Cc: jhogan@kernel.org Cc: f4bug@amsat.org Cc: linux-mips@vger.kernel.org Cc: ysu@wavecomp.com Cc: jcristau@debian.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- arch/mips/mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/mips/mm/mmap.c +++ b/arch/mips/mm/mmap.c @@ -203,7 +203,7 @@ unsigned long arch_randomize_brk(struct int __virt_addr_valid(const volatile void *kaddr) { - unsigned long vaddr = (unsigned long)vaddr; + unsigned long vaddr = (unsigned long)kaddr; if ((vaddr < PAGE_OFFSET) || (vaddr >= MAP_BASE)) return 0; ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 5.1 90/96] MIPS: Add missing EHB in mtc0 -> mfc0 sequence. [not found] <20190708150526.234572443@linuxfoundation.org> 2019-07-08 15:14 ` [PATCH 5.1 89/96] MIPS: Fix bounds check virt_addr_valid Greg Kroah-Hartman @ 2019-07-08 15:14 ` Greg Kroah-Hartman 2019-07-08 15:14 ` [PATCH 5.1 91/96] MIPS: have "plain" make calls build dtbs for selected platforms Greg Kroah-Hartman 2 siblings, 0 replies; 3+ messages in thread From: Greg Kroah-Hartman @ 2019-07-08 15:14 UTC (permalink / raw) To: linux-kernel Cc: Greg Kroah-Hartman, stable, Dmitry Korotin, Paul Burton, linux-mips From: Dmitry Korotin <dkorotin@wavecomp.com> commit 0b24cae4d535045f4c9e177aa228d4e97bad212c upstream. Add a missing EHB (Execution Hazard Barrier) in mtc0 -> mfc0 sequence. Without this execution hazard barrier it's possible for the value read back from the KScratch register to be the value from before the mtc0. Reproducible on P5600 & P6600. The hazard is documented in the MIPS Architecture Reference Manual Vol. III: MIPS32/microMIPS32 Privileged Resource Architecture (MD00088), rev 6.03 table 8.1 which includes: Producer | Consumer | Hazard ----------|----------|---------------------------- mtc0 | mfc0 | any coprocessor 0 register Signed-off-by: Dmitry Korotin <dkorotin@wavecomp.com> [paul.burton@mips.com: - Commit message tweaks. - Add Fixes tags. - Mark for stable back to v3.15 where P5600 support was introduced.] Signed-off-by: Paul Burton <paul.burton@mips.com> Fixes: 3d8bfdd03072 ("MIPS: Use C0_KScratch (if present) to hold PGD pointer.") Fixes: 829dcc0a956a ("MIPS: Add MIPS P5600 probe support") Cc: linux-mips@vger.kernel.org Cc: stable@vger.kernel.org # v3.15+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- arch/mips/mm/tlbex.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c @@ -391,6 +391,7 @@ static struct work_registers build_get_w static void build_restore_work_registers(u32 **p) { if (scratch_reg >= 0) { + uasm_i_ehb(p); UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); return; } @@ -668,10 +669,12 @@ static void build_restore_pagemask(u32 * uasm_i_mtc0(p, 0, C0_PAGEMASK); uasm_il_b(p, r, lid); } - if (scratch_reg >= 0) + if (scratch_reg >= 0) { + uasm_i_ehb(p); UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); - else + } else { UASM_i_LW(p, 1, scratchpad_offset(0), 0); + } } else { /* Reset default page size */ if (PM_DEFAULT_MASK >> 16) { @@ -938,10 +941,12 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_i_jr(p, ptr); if (mode == refill_scratch) { - if (scratch_reg >= 0) + if (scratch_reg >= 0) { + uasm_i_ehb(p); UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); - else + } else { UASM_i_LW(p, 1, scratchpad_offset(0), 0); + } } else { uasm_i_nop(p); } @@ -1258,6 +1263,7 @@ build_fast_tlb_refill_handler (u32 **p, UASM_i_MTC0(p, odd, C0_ENTRYLO1); /* load it */ if (c0_scratch_reg >= 0) { + uasm_i_ehb(p); UASM_i_MFC0(p, scratch, c0_kscratch(), c0_scratch_reg); build_tlb_write_entry(p, l, r, tlb_random); uasm_l_leave(l, *p); @@ -1603,15 +1609,17 @@ static void build_setup_pgd(void) uasm_i_dinsm(&p, a0, 0, 29, 64 - 29); uasm_l_tlbl_goaround1(&l, p); UASM_i_SLL(&p, a0, a0, 11); - uasm_i_jr(&p, 31); UASM_i_MTC0(&p, a0, C0_CONTEXT); + uasm_i_jr(&p, 31); + uasm_i_ehb(&p); } else { /* PGD in c0_KScratch */ - uasm_i_jr(&p, 31); if (cpu_has_ldpte) UASM_i_MTC0(&p, a0, C0_PWBASE); else UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg); + uasm_i_jr(&p, 31); + uasm_i_ehb(&p); } #else #ifdef CONFIG_SMP @@ -1625,13 +1633,16 @@ static void build_setup_pgd(void) UASM_i_LA_mostly(&p, a2, pgdc); UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2); #endif /* SMP */ - uasm_i_jr(&p, 31); /* if pgd_reg is allocated, save PGD also to scratch register */ - if (pgd_reg != -1) + if (pgd_reg != -1) { UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg); - else + uasm_i_jr(&p, 31); + uasm_i_ehb(&p); + } else { + uasm_i_jr(&p, 31); uasm_i_nop(&p); + } #endif if (p >= (u32 *)tlbmiss_handler_setup_pgd_end) panic("tlbmiss_handler_setup_pgd space exceeded"); ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 5.1 91/96] MIPS: have "plain" make calls build dtbs for selected platforms [not found] <20190708150526.234572443@linuxfoundation.org> 2019-07-08 15:14 ` [PATCH 5.1 89/96] MIPS: Fix bounds check virt_addr_valid Greg Kroah-Hartman 2019-07-08 15:14 ` [PATCH 5.1 90/96] MIPS: Add missing EHB in mtc0 -> mfc0 sequence Greg Kroah-Hartman @ 2019-07-08 15:14 ` Greg Kroah-Hartman 2 siblings, 0 replies; 3+ messages in thread From: Greg Kroah-Hartman @ 2019-07-08 15:14 UTC (permalink / raw) To: linux-kernel Cc: Greg Kroah-Hartman, stable, Cedric Hombourger, Paul Burton, linux-mips From: Cedric Hombourger <Cedric_Hombourger@mentor.com> commit 637dfa0fad6d91a9a709dc70549a6d20fa77f615 upstream. scripts/package/builddeb calls "make dtbs_install" after executing a plain make (i.e. no build targets specified). It will fail if dtbs were not built beforehand. Match the arm64 architecture where DTBs get built by the "all" target. Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com> [paul.burton@mips.com: s/builddep/builddeb] Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: linux-mips@vger.kernel.org Cc: stable@vger.kernel.org # v4.1+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- arch/mips/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -17,6 +17,7 @@ archscripts: scripts_basic $(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs KBUILD_DEFCONFIG := 32r2el_defconfig +KBUILD_DTBS := dtbs # # Select the object file format to substitute into the linker script. @@ -384,7 +385,7 @@ quiet_cmd_64 = OBJCOPY $@ vmlinux.64: vmlinux $(call cmd,64) -all: $(all-y) +all: $(all-y) $(KBUILD_DTBS) # boot $(boot-y): $(vmlinux-32) FORCE ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-08 15:35 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20190708150526.234572443@linuxfoundation.org> 2019-07-08 15:14 ` [PATCH 5.1 89/96] MIPS: Fix bounds check virt_addr_valid Greg Kroah-Hartman 2019-07-08 15:14 ` [PATCH 5.1 90/96] MIPS: Add missing EHB in mtc0 -> mfc0 sequence Greg Kroah-Hartman 2019-07-08 15:14 ` [PATCH 5.1 91/96] MIPS: have "plain" make calls build dtbs for selected platforms Greg Kroah-Hartman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).