Skip to contentSkip to conversation

mm: /proc/pid/smaps_rollup: fix no vma's null-deref

PATCH In review Seth Jenkins 3 participants 5 messages Oct 26, 2022 – Oct 27, 2022 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: /proc/pid/smaps_rollup: fix no vma's null-deref

Commit 258f669e7e88 ("mm: /proc/pid/smaps_rollup: convert to single value seq_file") introduced a null-deref if there are no vma's in the task in show_smaps_rollup.

Fixes 258f669e7e88 ("mm: /proc/pid/smaps_rollup: convert to single value seq_file")

---
c4c84f06285e on upstream resolves this issue, but a fix must still be applied to stable trees 4.19-5.19.

 fs/proc/task_mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/task_mmu.c +1 -1
index 4e0023643f8b..1e7bbc0873a4 100644
@@ -969,7 +969,7 @@ static int show_smaps_rollup(struct seq_file *m, void *v)
 		vma = vma->vm_next;
 	}
 
-	show_vma_header_prefix(m, priv->mm->mmap->vm_start,
+	show_vma_header_prefix(m, priv->mm->mmap ? priv->mm->mmap->vm_start : 0,
 			       last_vma_end, 0, 0, 0, 0);
 	seq_pad(m, ' ');
 	seq_puts(m, "[rollup]\n");
Signature · 1 line
2.38.0.rc1.362.ged0d419d3c-goog
maintainer
#1 lore raw
Quoted 10 lines · Seth Jenkins

Commit 258f669e7e88 ("mm: /proc/pid/smaps_rollup: convert to single value seq_file") introduced a null-deref if there are no vma's in the task in show_smaps_rollup.

Fixes 258f669e7e88 ("mm: /proc/pid/smaps_rollup: convert to single value seq_file")

---
c4c84f06285e on upstream resolves this issue, but a fix must still be applied to stable trees 4.19-5.19.

And you need to document really really really well why we can not take that upstream commit please.

Also note that 5.19.y is end-of-life.

Please fix up and resend.

thanks,

greg k-h

#2 lore raw

Hi Greg,

The upstream commit that fixed the issue was not an intentional fix AFAIK, but a refactor to switch to maple tree VMA lookups. I was under the impression that there were no plans to backport maple trees back to stable trees but do let me know if that presumption is incorrect. Assuming they're not getting backported, what do you think of this instead:
c4c84f06285e on upstream resolves this issue as part of the switch to using maple trees for VMA lookups, but a fix must still be applied to stable trees 4.19-5.19.

Quoted 23 lines · Greg KH
Quoted 10 lines · Seth Jenkins

Commit 258f669e7e88 ("mm: /proc/pid/smaps_rollup: convert to single value seq_file") introduced a null-deref if there are no vma's in the task in show_smaps_rollup.

Fixes 258f669e7e88 ("mm: /proc/pid/smaps_rollup: convert to single value seq_file")

---
c4c84f06285e on upstream resolves this issue, but a fix must still be applied to stable trees 4.19-5.19.

And you need to document really really really well why we can not take that upstream commit please.

Also note that 5.19.y is end-of-life.

Please fix up and resend.

thanks,

greg k-h

#3 lore raw
Quoted 6 lines · Seth Jenkins

Hi Greg,

The upstream commit that fixed the issue was not an intentional fix AFAIK, but a refactor to switch to maple tree VMA lookups. I was under the impression that there were no plans to backport maple trees back to stable trees but do let me know if that presumption is incorrect.

Backporting the maple tree to earlier kernels would be a giant upheaval. I doubt it could ever be justified; certainly the need for this patch would not be sufficient. Not only would we have to backport the maple tree data structure itself (which could be justified), but we'd also have to redo the conversion of the VMAs from rbtree to maple tree.

Quoted 30 lines

Assuming they're not getting backported, what do you think of this instead:
c4c84f06285e on upstream resolves this issue as part of the switch to using maple trees for VMA lookups, but a fix must still be applied to stable trees 4.19-5.19.

Quoted 23 lines · Greg KH
Quoted 10 lines · Seth Jenkins

Commit 258f669e7e88 ("mm: /proc/pid/smaps_rollup: convert to single value seq_file") introduced a null-deref if there are no vma's in the task in show_smaps_rollup.

Fixes 258f669e7e88 ("mm: /proc/pid/smaps_rollup: convert to single value seq_file")

---
c4c84f06285e on upstream resolves this issue, but a fix must still be applied to stable trees 4.19-5.19.

And you need to document really really really well why we can not take that upstream commit please.

Also note that 5.19.y is end-of-life.

Please fix up and resend.

thanks,

greg k-h

maintainer
#4 lore raw
In reply to Seth Jenkins

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Quoted 8 lines · Seth Jenkins

Hi Greg,

The upstream commit that fixed the issue was not an intentional fix AFAIK, but a refactor to switch to maple tree VMA lookups. I was under the impression that there were no plans to backport maple trees back to stable trees but do let me know if that presumption is incorrect. Assuming they're not getting backported, what do you think of this instead:

Yes, as Matthew said, backporting maple trees is not a good idea, we don't want that.

Quoted 3 lines

c4c84f06285e on upstream resolves this issue as part of the switch to using maple trees for VMA lookups, but a fix must still be applied to stable trees 4.19-5.19.

That's better, yes. Please add that and resend a new version.

thanks,

greg k-h