Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1262789

[PATCH] arm: Use kernel mm when updating section permissions

From Laura Abbott <labbott@fedoraproject.org>
Newsgroups linux.kernel
Subject [PATCH] arm: Use kernel mm when updating section permissions
Date 2015-11-05 02:10 +0100
Message-ID <qrhdU-89c-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Currently, read only permissions are not being applied even
when CONFIG_DEBUG_RODATA is set. This is because section_update
uses current->mm for adjusting the page tables. current->mm
need not be equivalent to the kernel version. Use pgd_offset_k
to get the proper page directory for updating.

Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
---
I found this while trying to convince myself of something.
Dumping the page table via debugfs and writing to kernel text were both
showing the lack of mappings. This was observed on QEMU. Maybe it's just a
QEMUism but if not it probably should go to stable.
---
 arch/arm/mm/init.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 8a63b4c..4bb936a 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -629,11 +629,9 @@ static struct section_perm ro_perms[] = {
 static inline void section_update(unsigned long addr, pmdval_t mask,
 				  pmdval_t prot)
 {
-	struct mm_struct *mm;
 	pmd_t *pmd;
 
-	mm = current->active_mm;
-	pmd = pmd_offset(pud_offset(pgd_offset(mm, addr), addr), addr);
+	pmd = pmd_offset(pud_offset(pgd_offset_k(addr), addr), addr);
 
 #ifdef CONFIG_ARM_LPAE
 	pmd[0] = __pmd((pmd_val(pmd[0]) & mask) | prot);
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] arm: Use kernel mm when updating section permissions Laura Abbott <labbott@fedoraproject.org> - 2015-11-05 02:10 +0100
  Re: [PATCH] arm: Use kernel mm when updating section permissions Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-11-05 10:50 +0100
    Re: [PATCH] arm: Use kernel mm when updating section permissions Laura Abbott <labbott@redhat.com> - 2015-11-05 17:30 +0100
      Re: [PATCH] arm: Use kernel mm when updating section permissions Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-11-05 17:30 +0100
        Re: [PATCH] arm: Use kernel mm when updating section permissions Laura Abbott <labbott@redhat.com> - 2015-11-06 02:10 +0100
          Re: [PATCH] arm: Use kernel mm when updating section permissions Kees Cook <keescook@chromium.org> - 2015-11-06 02:20 +0100
            Re: [PATCH] arm: Use kernel mm when updating section permissions Laura Abbott <labbott@redhat.com> - 2015-11-06 19:50 +0100
              Re: [PATCH] arm: Use kernel mm when updating section permissions Kees Cook <keescook@chromium.org> - 2015-11-06 20:10 +0100
                Re: [PATCH] arm: Use kernel mm when updating section permissions Kees Cook <keescook@chromium.org> - 2015-11-06 20:20 +0100
                Re: [PATCH] arm: Use kernel mm when updating section permissions Kevin Hilman <khilman@kernel.org> - 2015-11-06 21:20 +0100
                Re: [PATCH] arm: Use kernel mm when updating section permissions Kees Cook <keescook@chromium.org> - 2015-11-06 21:30 +0100
                Re: [PATCH] arm: Use kernel mm when updating section permissions Kevin Hilman <khilman@kernel.org> - 2015-11-06 22:10 +0100
                Re: [PATCH] arm: Use kernel mm when updating section permissions Kees Cook <keescook@chromium.org> - 2015-11-06 22:30 +0100
                Re: [PATCH] arm: Use kernel mm when updating section permissions Kevin Hilman <khilman@kernel.org> - 2015-11-06 23:40 +0100
                Re: [PATCH] arm: Use kernel mm when updating section permissions Kevin Hilman <khilman@kernel.org> - 2015-11-07 00:10 +0100
                Re: [PATCH] arm: Use kernel mm when updating section permissions Kees Cook <keescook@chromium.org> - 2015-11-07 00:50 +0100
              Re: [PATCH] arm: Use kernel mm when updating section permissions Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-11-06 21:50 +0100
                Re: [PATCH] arm: Use kernel mm when updating section permissions Laura Abbott <labbott@redhat.com> - 2015-11-07 00:50 +0100
                Re: [PATCH] arm: Use kernel mm when updating section permissions Kees Cook <keescook@chromium.org> - 2015-11-07 00:50 +0100
                Re: [PATCH] arm: Use kernel mm when updating section permissions Laura Abbott <labbott@redhat.com> - 2015-11-07 01:30 +0100

csiph-web