Bug 12547 - vmalloc_fault handling in x86_64
Summary: vmalloc_fault handling in x86_64
Status: CLOSED CODE_FIX
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Andrew Morton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-26 19:08 UTC by Ajith Kumar B
Modified: 2009-03-20 06:04 UTC (History)
0 users

See Also:
Kernel Version: 2.6.18
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Ajith Kumar B 2009-01-26 19:08:34 UTC
I was going through the vmalloc fault handling for x86_64 and am unclear about the following lines in the vmalloc_fault() function.

pgd = pgd_offset(current->mm ?: &init_mm, address);
pgd_ref = pgd_offset_k(address);

Here the intention is to get the pgd corresponding to the current process and sync it up with the pgd in init_mm(obtained from pgd_offset_k). However, for kernel threads current->mm is NULL and hence
pgd = pgd_offset(init_mm, address) = pgd_ref which means the fault handler returns without setting the pgd entry in the MM structure in the context of which the kernel thread has faulted. This could lead to never-ending faults and busy looping of kernel threads like pdflush.
So, shouldn't the
pgd = pgd_offset(current->mm ?: &init_mm, address);
be
pgd = pgd_offset(current->active_mm ?: &init_mm, address);
Comment 1 Andrew Morton 2009-01-26 19:17:39 UTC
2.6.18 is very old, sorry.  I don't think any of that code is there any more.
Comment 2 Ajith Kumar B 2009-01-26 19:53:59 UTC
I observed that it is fixed in 2.6.28.1.  

commit 87a071a978a7defb98c278afbae066a670a973de
Author: Andi Kleen <andi@firstfloor.org>
Date:   Fri Jan 9 12:17:43 2009 -0800

Thanks,
Ajith

Note You need to log in before you can comment on or make changes to this bug.