shmem: init on stack vmas
Subsystems (3)
PATCH 1/1 shmem: init on stack vmas
We were hitting a weird bug with our cgroup stuff because shmem uses on stack vmas. These aren't properly init'ed so we'd have garbage in vma->mm and bad things would happen. Fix this by just init'ing to empty structs. Thanks,
--- mm/shmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/shmem.c +2 -2
@@ -911,7 +911,7 @@ static struct mempolicy *shmem_get_sbmpol(struct shmem_sb_info *sbinfo)static struct page *shmem_swapin (swp_entry_t swap,gfp_t gfp,struct shmem_inode_info *info,pgoff_t index) { -struct vm_area_struct pvma; +struct vm_area_struct pvma = {};struct page *page;/* Create a pseudo vma that just contains the policy */
@@ -932,7 +932,7 @@ static struct page *shmem_swapin(swp_entry_t swap, gfp_t gfp,static struct page *shmem_alloc_page (gfp_t gfp,struct shmem_inode_info *info,pgoff_t index) { -struct vm_area_struct pvma; +struct vm_area_struct pvma = {};struct page *page;/* Create a pseudo vma that just contains the policy */
Signature · 7 lines
1.8.3.1 -- 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>
Quoted 3 lines · Josef Bacik
We were hitting a weird bug with our cgroup stuff because shmem uses on stack vmas. These aren't properly init'ed so we'd have garbage in
vma->mmand bad things would happen. Fix this by just init'ing to empty structs. Thanks,
...
mm/shmem.c static struct mempolicy *shmem_get_sbmpol(struct shmem_sb_info *sbinfo) · line 914
Quoted 5 lines
static struct page *shmem_swapin(swp_entry_t swap,
gfp_tgfp,mm/shmem.c +1
-1struct shmem_inode_info *info, pgoff_t index) { -struct vm_area_struct pvma; +struct vm_area_struct pvma = {};
What does that code do if it needs an mm and doesn't find one?
Quoted 11 lines · Dave Hansen
Quoted 3 lines · Josef Bacik
We were hitting a weird bug with our cgroup stuff because shmem uses on stack vmas. These aren't properly init'ed so we'd have garbage in
vma->mmand bad things would happen. Fix this by just init'ing to empty structs. Thanks,...
Review
Quoted 5 lines
static struct page *shmem_swapin(swp_entry_t swap,
gfp_tgfp,
structshmem_inode_info*info,pgoff_tindex)
{(quoted diff) +1
-1- struct vm_area_struct pvma; + struct vm_area_struct pvma = {};What does that code do if it needs an mm and doesn't find one?
We have checks for if (vma->mm && some other shit) so we expect NULLs for stuff we don't care about. Thanks,
Josef