lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 10 Jan 2020 15:47:41 +0800
From:   yeyunfeng <yeyunfeng@...wei.com>
To:     <catalin.marinas@....com>, <will@...nel.org>,
        <anshuman.khandual@....com>, <akpm@...ux-foundation.org>,
        <willy@...radead.org>, <yeyunfeng@...wei.com>,
        <ard.biesheuvel@....com>, <tglx@...utronix.de>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>
CC:     <hushiyuan@...wei.com>, <linfeilong@...wei.com>
Subject: [PATCH] arm64: mm: support setting page attributes for debug
 situation

When rodata_full is set or pagealloc debug is enabled, block mappings or
contiguou hints are no longer used for linear address area. Therefore,
support setting page attributes in this case is useful for debugging
memory corruption problems.

Signed-off-by: Yunfeng Ye <yeyunfeng@...wei.com>
---
 arch/arm64/mm/pageattr.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c
index 9ce7bd9d4d9c..823143534a93 100644
--- a/arch/arm64/mm/pageattr.c
+++ b/arch/arm64/mm/pageattr.c
@@ -65,6 +65,9 @@ static int change_memory_common(unsigned long addr, int numpages,
 		WARN_ON_ONCE(1);
 	}

+	if (!numpages)
+		return 0;
+
 	/*
 	 * Kernel VA mappings are always live, and splitting live section
 	 * mappings into page mappings may cause TLB conflicts. This means
@@ -81,11 +84,18 @@ static int change_memory_common(unsigned long addr, int numpages,
 	area = find_vm_area((void *)addr);
 	if (!area ||
 	    end > (unsigned long)area->addr + area->size ||
-	    !(area->flags & VM_ALLOC))
+	    !(area->flags & VM_ALLOC)) {
+
+		/*
+		 * When rodata_full is set, or pagealloc debug is enabled,
+		 * the linear address is mapped with NO_BLOCK_MAPPINGS or
+		 * NO_CONT_MAPPINGS flags, so splitting is never needed.
+		 */
+		if (rodata_full || debug_pagealloc_enabled())
+			return __change_memory_common(start, size, set_mask,
+							clear_mask);
 		return -EINVAL;
-
-	if (!numpages)
-		return 0;
+	}

 	/*
 	 * If we are manipulating read-only permissions, apply the same
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ