'vm_flags' is important field in the 'struct vm_area_struct'.

struct vm_area_struct {
/* The first cache line has the info for VMA tree walking. */

unsigned long vm_start; /* Our start address within vm_mm. */
unsigned long vm_end; /* The first byte after our end address
   within vm_mm. */

/* linked list of VM areas per task, sorted by address */
struct vm_area_struct *vm_next, *vm_prev;

...
unsigned long vm_flags; /* Flags, see mm.h. */

'vm_flags' can be seen when using crash utility program as below.

crash64 > vm 5533
PID: 5533  TASK: ffffffc4da6d4340 CPU: 5  COMMAND: "sh"
    MM        PGD     RSS  TOTAL_VM
ffffffc50cdbbc40 ffffffc4e2efc000 3036k  33588k
   VMA      START    END   FLAGS FILE
ffffffc4dde36528 55686d3000 55686de000  871 /system/bin/sh 
ffffffc4dde36f78 55686de000 556871b000  874 /system/bin/sh //<<-
ffffffc4e42f6948 556871b000 556871c000 100873 /system/bin/sh
ffffffc4dde377b8 556871c000 556871e000 100871 /system/bin/sh

We can refer to the corresponding attribute of 'vm_flags' in 'include/linux/mm.h' 

include/linux/mm.h
/*
 * vm_flags in vm_area_struct, see mm_types.h.
 * When changing, update also include/trace/events/mmflags.h
 */
#define VM_NONE 0x00000000

#define VM_READ 0x00000001 /* currently active flags */
#define VM_WRITE 0x00000002
#define VM_EXEC 0x00000004
#define VM_SHARED 0x00000008

/* mprotect() hardcodes VM_MAYREAD >> 4 == VM_READ, and so for r/w/x bits. */
#define VM_MAYREAD 0x00000010 /* limits for mprotect() etc */
#define VM_MAYWRITE 0x00000020
#define VM_MAYEXEC 0x00000040
#define VM_MAYSHARE 0x00000080

#define VM_GROWSDOWN 0x00000100 /* general info on the segment */
#define VM_UFFD_MISSING 0x00000200 /* missing pages tracking */
#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
#define VM_UFFD_WP 0x00001000 /* wrprotect pages tracking */

#define VM_LOCKED 0x00002000
#define VM_IO           0x00004000 /* Memory mapped I/O or similar */

+ Recent posts