Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1290583 > unrolled thread
| Started by | Xishi Qiu <qiuxishi@huawei.com> |
|---|---|
| First post | 2015-12-13 09:50 +0100 |
| Last post | 2015-12-13 09:50 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
x86: a question about protection_map Xishi Qiu <qiuxishi@huawei.com> - 2015-12-13 09:50 +0100
| From | Xishi Qiu <qiuxishi@huawei.com> |
|---|---|
| Date | 2015-12-13 09:50 +0100 |
| Subject | x86: a question about protection_map |
| Message-ID | <qFavT-62Z-1@gated-at.bofh.it> |
When we use mprotect to change the page prot, I find "__P001" and "__P011"
are the same. So how we detect the write/read?
pgprot_t protection_map[16] = {
__P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
};
pgprot_t vm_get_page_prot(unsigned long vm_flags)
{
return __pgprot(pgprot_val(protection_map[vm_flags &
(VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
pgprot_val(arch_vm_get_page_prot(vm_flags)));
}
#define __P001 PAGE_READONLY
#define __P011 PAGE_COPY
#define PAGE_COPY_NOEXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | \
_PAGE_ACCESSED | _PAGE_NX)
#define PAGE_COPY PAGE_COPY_NOEXEC
#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | \
_PAGE_ACCESSED | _PAGE_NX)
Thanks,
Xishi Qiu
--
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 top | Article view | linux.kernel
csiph-web