All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch/m68k/kernel/sys_m68k: Add missing mmap_read_lock() to sys_cacheflush()
@ 2021-04-07 20:00 Liam Howlett
  2021-04-08 16:34 ` Liam Howlett
  2021-04-12  7:24 ` Geert Uytterhoeven
  0 siblings, 2 replies; 4+ messages in thread
From: Liam Howlett @ 2021-04-07 20:00 UTC (permalink / raw)
  To: Geert Uytterhoeven, linux-m68k, linux-kernel
  Cc: Laurent Dufour, Vlastimil Babka, Daniel Jordan,
	Michel Lespinasse, 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.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
 arch/m68k/kernel/sys_m68k.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 1c235d8f53f3..f55bdcb8e4f1 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -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;
 
-- 
2.30.0

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

* Re: [PATCH] arch/m68k/kernel/sys_m68k: Add missing mmap_read_lock() to sys_cacheflush()
  2021-04-07 20:00 [PATCH] arch/m68k/kernel/sys_m68k: Add missing mmap_read_lock() to sys_cacheflush() Liam Howlett
@ 2021-04-08 16:34 ` Liam Howlett
  2021-04-08 16:38   ` Matthew Wilcox
  2021-04-12  7:24 ` Geert Uytterhoeven
  1 sibling, 1 reply; 4+ messages in thread
From: Liam Howlett @ 2021-04-08 16:34 UTC (permalink / raw)
  To: Geert Uytterhoeven, linux-m68k, linux-kernel, linux-mm
  Cc: Laurent Dufour, Vlastimil Babka, Daniel Jordan, Michel Lespinasse

[-- Attachment #1: Type: text/plain, Size: 870 bytes --]

Forgot the fixes line.

* Liam Howlett <liam.howlett@oracle.com> [210407 16:00]:
> 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.
> 
> Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
> ---
>  arch/m68k/kernel/sys_m68k.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
> index 1c235d8f53f3..f55bdcb8e4f1 100644
> --- a/arch/m68k/kernel/sys_m68k.c
> +++ b/arch/m68k/kernel/sys_m68k.c
> @@ -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;
>  
> -- 
> 2.30.0

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-arch-m68k-kernel-sys_m68k-Add-missing-mmap_read_lock.patch --]
[-- Type: text/x-diff; name="0001-arch-m68k-kernel-sys_m68k-Add-missing-mmap_read_lock.patch", Size: 1086 bytes --]

From aeee71b15f54426f02f41a4408afbd0b5acab7ec Mon Sep 17 00:00:00 2001
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
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())
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
 arch/m68k/kernel/sys_m68k.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 1c235d8f53f3..f55bdcb8e4f1 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -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;
 
-- 
2.30.0


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

* Re: [PATCH] arch/m68k/kernel/sys_m68k: Add missing mmap_read_lock() to sys_cacheflush()
  2021-04-08 16:34 ` Liam Howlett
@ 2021-04-08 16:38   ` Matthew Wilcox
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2021-04-08 16:38 UTC (permalink / raw)
  To: Liam Howlett
  Cc: Geert Uytterhoeven, linux-m68k, linux-kernel, linux-mm,
	Laurent Dufour, Vlastimil Babka, Daniel Jordan,
	Michel Lespinasse

On Thu, Apr 08, 2021 at 04:34:20PM +0000, Liam Howlett wrote:
> 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())
> Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

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?


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

* Re: [PATCH] arch/m68k/kernel/sys_m68k: Add missing mmap_read_lock() to sys_cacheflush()
  2021-04-07 20:00 [PATCH] arch/m68k/kernel/sys_m68k: Add missing mmap_read_lock() to sys_cacheflush() Liam Howlett
  2021-04-08 16:34 ` Liam Howlett
@ 2021-04-12  7:24 ` Geert Uytterhoeven
  1 sibling, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2021-04-12  7:24 UTC (permalink / raw)
  To: Liam Howlett
  Cc: linux-m68k, linux-kernel, Laurent Dufour, Vlastimil Babka,
	Daniel Jordan, Michel Lespinasse

On Wed, Apr 7, 2021 at 10:00 PM Liam Howlett <liam.howlett@oracle.com> wrote:
> 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.
>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k for-v5.13 branch.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

end of thread, other threads:[~2021-04-12  7:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 20:00 [PATCH] arch/m68k/kernel/sys_m68k: Add missing mmap_read_lock() to sys_cacheflush() Liam Howlett
2021-04-08 16:34 ` Liam Howlett
2021-04-08 16:38   ` Matthew Wilcox
2021-04-12  7:24 ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.