linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] shmem: init on stack vmas
@ 2014-01-13 18:46 Josef Bacik
  2014-01-13 20:32 ` Dave Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Josef Bacik @ 2014-01-13 18:46 UTC (permalink / raw)
  To: linux-mm, linux-fsdevel

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,

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 mm/shmem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 902a148..ee6b834 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -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 */
-- 
1.8.3.1

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] shmem: init on stack vmas
  2014-01-13 18:46 [PATCH] shmem: init on stack vmas Josef Bacik
@ 2014-01-13 20:32 ` Dave Hansen
  2014-01-13 20:35   ` Josef Bacik
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Hansen @ 2014-01-13 20:32 UTC (permalink / raw)
  To: Josef Bacik, linux-mm, linux-fsdevel

On 01/13/2014 10:46 AM, Josef Bacik wrote:
> 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,
...
>  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 = {};

What does that code do if it needs an mm and doesn't find one?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] shmem: init on stack vmas
  2014-01-13 20:32 ` Dave Hansen
@ 2014-01-13 20:35   ` Josef Bacik
  0 siblings, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2014-01-13 20:35 UTC (permalink / raw)
  To: Dave Hansen, linux-mm, linux-fsdevel


On 01/13/2014 03:32 PM, Dave Hansen wrote:
> On 01/13/2014 10:46 AM, Josef Bacik wrote:
>> 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,
> ...
>>   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 = {};
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-13 20:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13 18:46 [PATCH] shmem: init on stack vmas Josef Bacik
2014-01-13 20:32 ` Dave Hansen
2014-01-13 20:35   ` Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).