ARM Linux table format Recording format - unused bits?

I need to use two PTE bits to save a custom state value that my kernel module will use when catching page protection errors.

I am developing on a Galaxy Nexus that has an ARM Cortex A9 (I assume ARM v7). Linux kernel version 3.0.31. Linux PTE definitions are as follows (from arch/arm/include/asm/pgtable.h :

 /* * "Linux" PTE definitions. * * We keep two sets of PTEs - the hardware and the linux version. * This allows greater flexibility in the way we map the Linux bits * onto the hardware tables, and allows us to have YOUNG and DIRTY * bits. * * The PTE table pointer refers to the hardware entries; the "Linux" * entries are stored 1024 bytes below. */ #define L_PTE_PRESENT (_AT(pteval_t, 1) << 0) #define L_PTE_YOUNG (_AT(pteval_t, 1) << 1) #define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ #define L_PTE_DIRTY (_AT(pteval_t, 1) << 6) #define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) #define L_PTE_USER (_AT(pteval_t, 1) << 8) #define L_PTE_XN (_AT(pteval_t, 1) << 9) #define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */ 

Just by looking at this list of definitions, it seems that bits 3,4,5 are available, as well as bits 11 and above. However, I know that for the number of pages (PFN, I think), the 20 most significant bits are used [31:12], so I cannot use them.

Can I use bits [5: 3] freely or will this create problems? I spent hours searching for the answer to this question, but I can find documentation on how Linux uses the PTE bits for x86.

UPDATE

I have compiled a list of what I think will be every bit of PTE.

 bit 0 PRESENT bit 1 YOUNG bit 2 MEMORY TYPES 0 B FILE (only when not PRESENT) bit 3 MEMORY TYPES 1 C bit 4 AP0 bit 5 AP1 bit 6 DIRTY bit 7 RD_ONLY bit 8 USER bit 9 XN bit 10 SHARED bit 11 EXT_NG (no idea what this is) bit 12 |---| ... |PFN| bit 31 |---| 

Unfortunately, I see no way to specify read or write permissions, but somehow mmap still works with PROT_NONE . I know how to specify read permissions or R / W, but I still need to know how to set the page to not have permissions.

+6
source share
1 answer

Can you try to clear the current bit in pte, which will cause the page to crash?

0
source

All Articles