Skip to contentSkip to conversation

arch/m68k/kernel/sys_m68k: Add missing mmap_read_lock() to sys_cacheflush()

PATCH In review Liam Howlett 3 participants 4 messages Apr 7, 2021 – Apr 12, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/m68k/kernel/sys_m68k: Add missing mmap_read_lock() to sys_cacheflush()

When the superuser flushes the entire cache, the mmap_read_lock() is not taken, but mmap_read_unlock() is called. Add the missing mmap_read_lock() call.

---
 arch/m68k/kernel/sys_m68k.c | 2 ++
 1 file changed, 2 insertions(+)
arch/m68k/kernel/sys_m68k.c +2 -0
index 1c235d8f53f3..f55bdcb8e4f1 100644
@@ -388,6 +388,8 @@ sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
 		ret = -EPERM;
 		if (!capable(CAP_SYS_ADMIN))
 			goto out;
+
+		mmap_read_lock(current->mm);
 	} else {
 		struct vm_area_struct *vma;
 
Signature · 1 line
2.30.0
#1 lore raw

Forgot the fixes line.

Quoted 24 lines · Liam Howlett

When the superuser flushes the entire cache, the mmap_read_lock() is not taken, but mmap_read_unlock() is called. Add the missing mmap_read_lock() call.

---
 arch/m68k/kernel/sys_m68k.c | 2 ++
 1 file changed, 2 insertions(+)
arch/m68k/kernel/sys_m68k.c +2 -0
index 1c235d8f53f3..f55bdcb8e4f1 100644
@@ -388,6 +388,8 @@ sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
 		ret = -EPERM;
 		if (!capable(CAP_SYS_ADMIN))
 			goto out;
+
+		mmap_read_lock(current->mm);
 	} else {
 		struct vm_area_struct *vma;
 
Signature · 1 line
2.30.0

From aeee71b15f54426f02f41a4408afbd0b5acab7ec Mon Sep 17 00:00:00 2001
From: "Liam R. Howlett" <[email protected]>
Date: Wed, 7 Apr 2021 11:39:06 -0400
Subject: [PATCH] arch/m68k/kernel/sys_m68k: Add missing mmap_read_lock() to
sys_cacheflush()

When the superuser flushes the entire cache, the mmap_read_lock() is not taken, but mmap_read_unlock() is called. Add the missing mmap_read_lock() call.

Fixes cd2567b6850b (m68k: call find_vma with the mmap_sem held in

sys_cacheflush())

---
 arch/m68k/kernel/sys_m68k.c | 2 ++
 1 file changed, 2 insertions(+)
arch/m68k/kernel/sys_m68k.c +2 -0
index 1c235d8f53f3..f55bdcb8e4f1 100644
@@ -388,6 +388,8 @@ sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
 		ret = -EPERM;
 		if (!capable(CAP_SYS_ADMIN))
 			goto out;
+
+		mmap_read_lock(current->mm);
 	} else {
 		struct vm_area_struct *vma;
 
Signature · 1 line
2.30.0
Reviewed-by
#2 lore raw
Quoted 7 lines · Liam Howlett

When the superuser flushes the entire cache, the mmap_read_lock() is not taken, but mmap_read_unlock() is called. Add the missing mmap_read_lock() call.

Fixes cd2567b6850b (m68k: call find_vma with the mmap_sem held in

sys_cacheflush())

Although if it's been broken since 2014, maybe the ability of the superuser to flush the entire cache is not needed any more and can be removed?

maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Liam Howlett
Quoted 5 lines · Liam Howlett

When the superuser flushes the entire cache, the mmap_read_lock() is not taken, but mmap_read_unlock() is called. Add the missing mmap_read_lock() call.

i.e. will queue in the m68k for-v5.13 branch.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds