Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6788477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:29:26+00:00 2026-05-26T17:29:26+00:00

I am working with linux kernel 2.6.38 and have a question about two fields

  • 0

I am working with linux kernel 2.6.38 and have a question about two fields of a vm_area_struct, vm_flags and vm_page_prot. If I mmap private anonymous memory to be readable and writable, and then I print out the two fields of the created vm_area_struct, I see that the low 8 bits of vm_flags are 0x73 and the low 8 bits of vm_page_prot are 0x25. I am running x86 32-bit, and my constants are

VM_READ=0x01
VM_WRITE=0x02
VM_EXEC=0x04

Thus, it appears my vm_flags says the memory is read/write but the vm_page_prot says it is only readable (the executable flag is meaningless on x86). My understanding is that vm_page_prot is supposed to reflect the protection of page table entries of pages in the VM region. As I go onto read/write memory in the mmaped area in userspace, the page faulting mechanism work correctly, setting the PTE’s of the appropriate pages. Some pages (if I only read from them) are mapped to the special zero page frame with the PTE set to read only while other pages that are written to have the PTE set to read/write. This is expected behavior…in fact, from mm/memory.c:

static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
    unsigned long address, pte_t *page_table, pmd_t *pmd,
    unsigned int flags)
{
    ...
    entry = pte_mkspecial(pfn_pte(my_zero_pfn(address), vma->vm_page_prot));
    ...
}

My question is what determines vm_page_prot. My guess is that vm_page_prot is somehow a most restrictive combination (intersection) of all page permissions within the VM region, whereas vm_flags actually describes the true intentions of how the memory should act.

Does anyone have any good articles on what the exact purposes/differences of the two fields are?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:29:27+00:00Added an answer on May 26, 2026 at 5:29 pm

    Notice the C types of these two fields. vm_page_prot‘s type is pgprot_t, which is a arch level data type, meaning it can be applied directly to the PTEs of the underlying architecture. On x86 32-bit, this field stores the content of the proper protection bits for the PTEs of the VMA. vm_flags, on the contrary, is an arch-independent field, whose bits are defined in linux/mm.h. There are numerous VM_* bits, and they extend heavily over just the simple flags of READ, WRITE, and EXEC.

    So it looks to me that vm_page_prot is a form of a cached conversion from vm_flags, which stores the proper protection bits for the underlying architecture. Notice that in many areas where a PTE is formed in the VMA, pgprot_t is being used almost directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a system on which currently linux kernel and microwindows windowing
I have a (from what I can tell) perfectly working Linux setup (Ubuntu 8.04)
Actually I have a file . I am working in linux environment. I need
Iam working on Ubuntu.(Linux) I want to redirect from the page one.php to two.php,
I'm working on a Linux based server system in which there are two network
I'm working on a Linux kernel module for a 2.6.x kernel and I need
I'm working on developing a GUI for the recompilation of Linux kernel. For this
I am working on x86_64 machine. My linux kernel is also 64 bit kernel.
So I have an interesting design problem. I am working on SLES 9+ Linux,
On an x86 system, I have a Linux kernel module (watcher module) that gets

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.