lkml.org 
[lkml]   [2014]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.12 045/104] sparc64: Fix executable bit testing in set_pmd_at() paths.
    Date
    From: "David S. Miller" <davem@davemloft.net>

    3.12-stable review patch. If anyone has any objections, please let me know.

    ===============

    [ Upstream commit 5b1e94fa439a3227beefad58c28c17f68287a8e9 ]

    This code was mistakenly using the exec bit from the PMD in all
    cases, even when the PMD isn't a huge PMD.

    If it's not a huge PMD, test the exec bit in the individual ptes down
    in tlb_batch_pmd_scan().

    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>
    ---
    arch/sparc/mm/tlb.c | 17 ++++++++++-------
    1 file changed, 10 insertions(+), 7 deletions(-)

    diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
    index 7a91f288c708..b87ad6c5a8ab 100644
    --- a/arch/sparc/mm/tlb.c
    +++ b/arch/sparc/mm/tlb.c
    @@ -135,7 +135,7 @@ no_cache_flush:

    #ifdef CONFIG_TRANSPARENT_HUGEPAGE
    static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr,
    - pmd_t pmd, bool exec)
    + pmd_t pmd)
    {
    unsigned long end;
    pte_t *pte;
    @@ -143,8 +143,11 @@ static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr,
    pte = pte_offset_map(&pmd, vaddr);
    end = vaddr + HPAGE_SIZE;
    while (vaddr < end) {
    - if (pte_val(*pte) & _PAGE_VALID)
    + if (pte_val(*pte) & _PAGE_VALID) {
    + bool exec = pte_exec(*pte);
    +
    tlb_batch_add_one(mm, vaddr, exec);
    + }
    pte++;
    vaddr += PAGE_SIZE;
    }
    @@ -178,13 +181,13 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
    }

    if (!pmd_none(orig)) {
    - bool exec = ((pmd_val(orig) & PMD_HUGE_EXEC) != 0);
    -
    addr &= HPAGE_MASK;
    - if (pmd_val(orig) & PMD_ISHUGE)
    + if (pmd_val(orig) & PMD_ISHUGE) {
    + bool exec = ((pmd_val(orig) & PMD_HUGE_EXEC) != 0);
    +
    tlb_batch_add_one(mm, addr, exec);
    - else
    - tlb_batch_pmd_scan(mm, addr, orig, exec);
    + } else
    + tlb_batch_pmd_scan(mm, addr, orig);
    }
    }

    --
    2.0.4


    \
     
     \ /
      Last update: 2014-08-20 14:21    [W:2.496 / U:0.624 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site