Skip to contentSkip to conversation

vmalloc fault

DISCUSSION Simon Jeons 2 participants 5 messages Apr 26, 2013 Memory management

lore
Share & tools
lore
#0 lore raw

Hi all,

1. Why vmalloc fault need sync user process page table with kernel page table instead of using kernel page table directly?

2. Why do_swap_page doesn't set present flag?

3. When enable DEBUG_PAGEALLOC(catch use-after-free bug), if user process alloc pages from zone_normal(which is direct mapping) when fallback, this page which allocated for user process will set present flag in related pte, correct? but why also set present flag for kernel direct mapping? Does kernel have any requirement to access it?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 4 lines · Simon Jeons

Hi all,

1. Why vmalloc fault need sync user process page table with kernel page table instead of using kernel page table directly?

Each process has its own PGD, into which both kernel and user PMDs (or PUDs) are mapped. It is possible the PGD is missing some pointers, that need to be filled in at fault time.

Quoted 1 line

2. Why do_swap_page doesn't set present flag?

It does. Look at how vm_get_page_prot works.

Quoted 5 lines

3. When enable DEBUG_PAGEALLOC(catch use-after-free bug), if user process alloc pages from zone_normal(which is direct mapping) when fallback, this page which allocated for user process will set present flag in related pte, correct? but why also set present flag for kernel direct mapping? Does kernel have any requirement to access it?

Signature · 7 lines
All rights reversed

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#2 lore raw

Morning Rik, so early.

Quoted 9 lines · Rik van Riel
Quoted 4 lines · Simon Jeons

Hi all,

1. Why vmalloc fault need sync user process page table with kernel page table instead of using kernel page table directly?

Each process has its own PGD, into which both kernel and user PMDs (or PUDs) are mapped. It is possible the PGD is missing some pointers, that need to be filled in at fault time.

It seems that you miss my question. I mean why sync page table between user process and init_mm.pgd, can user process use init_mm.pgd page table directly when access vmalloc memory? ;-)

Quoted 4 lines
Quoted 2 lines

2. Why do_swap_page doesn't set present flag?

It does. Look at how vm_get_page_prot works.

Got it.

Quoted 8 lines
Quoted 6 lines

3. When enable DEBUG_PAGEALLOC(catch use-after-free bug), if user process alloc pages from zone_normal(which is direct mapping) when fallback, this page which allocated for user process will set present flag in related pte, correct? but why also set present flag for kernel direct mapping? Does kernel have any requirement to access it?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 8 lines · Simon Jeons

Morning Rik, so early.

Quoted 6 lines · Rik van Riel
Quoted 4 lines · Simon Jeons

Hi all,

1. Why vmalloc fault need sync user process page table with kernel page table instead of using kernel page table directly?

Quoted 7 lines
Quoted 3 lines

Each process has its own PGD, into which both kernel and user PMDs (or PUDs) are mapped. It is possible the PGD is missing some pointers, that need to be filled in at fault time.

It seems that you miss my question. I mean why sync page table between user process and init_mm.pgd, can user process use init_mm.pgd page table directly when access vmalloc memory? ;-)

init_mm.pgd is never used as an actual mmu context after bootup.

Quoted 16 lines
Quoted 4 lines
Quoted 2 lines

2. Why do_swap_page doesn't set present flag?

It does. Look at how vm_get_page_prot works.

Got it.

Quoted 8 lines
Quoted 6 lines

3. When enable DEBUG_PAGEALLOC(catch use-after-free bug), if user process alloc pages from zone_normal(which is direct mapping) when fallback, this page which allocated for user process will set present flag in related pte, correct? but why also set present flag for kernel direct mapping? Does kernel have any requirement to access it?

Signature · 7 lines
All rights reversed

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#4 lore raw
Quoted 13 lines · Rik van Riel
Quoted 12 lines · Simon Jeons

Morning Rik, so early.

Quoted 9 lines · Rik van Riel
Quoted 4 lines · Simon Jeons

Hi all,

1. Why vmalloc fault need sync user process page table with kernel page table instead of using kernel page table directly?

Each process has its own PGD, into which both kernel and user PMDs (or PUDs) are mapped. It is possible the PGD is missing some pointers, that need to be filled in at fault time.

Quoted 21 lines
Quoted 3 lines

It seems that you miss my question. I mean why sync page table between user process and init_mm.pgd, can user process use init_mm.pgd page table directly when access vmalloc memory? ;-)

init_mm.pgd is never used as an actual mmu context after bootup.

Quoted 15 lines
Quoted 4 lines
Quoted 2 lines

2. Why do_swap_page doesn't set present flag?

It does. Look at how vm_get_page_prot works.

Got it.

Quoted 8 lines
Quoted 6 lines

3. When enable DEBUG_PAGEALLOC(catch use-after-free bug), if user process alloc pages from zone_normal(which is direct mapping) when fallback, this page which allocated for user process will set present flag in related pte, correct? but why also set present flag for kernel direct mapping? Does kernel have any requirement to access it?

Could you also answer this question? Thanks in advance. ;-) Is there something confuse you in my question?

Quoted 3 lines
Quoted 1 line

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>