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]
Message-ID: <5783710E.3070602@huawei.com>
Date:	Mon, 11 Jul 2016 18:12:30 +0800
From:	Xishi Qiu <qiuxishi@...wei.com>
To:	<alan@...rguk.ukuu.org.uk>
CC:	Linux MM <linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>
Subject: a question about protection_map[]

Hi,

We can use mprotect to set read only or read/write.

mprotect_fixup()
	vma_set_page_prot()
		vm_pgprot_modify()
			vm_get_page_prot()
				protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]

The following code shows that prots from __P001(PROT_READ) and __P010(PROT_WRITE)
are the same, so how does it distinguish read only or read/write from mprotect?

pgprot_t protection_map[16] = {
	__P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
	__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
};

#define __P001	PAGE_READONLY
#define __P010	PAGE_COPY

#define PAGE_READONLY		__pgprot(_PAGE_PRESENT | _PAGE_USER |	\
					 _PAGE_ACCESSED | _PAGE_NX)

#define PAGE_COPY_NOEXEC	__pgprot(_PAGE_PRESENT | _PAGE_USER |	\
					 _PAGE_ACCESSED | _PAGE_NX)
#define PAGE_COPY		PAGE_COPY_NOEXEC


Thanks,
Xishi Qiu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ