linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/ldt: Initialize the context lock for init_mm
@ 2019-07-01 17:33 Sebastian Andrzej Siewior
  2019-07-01 17:49 ` Nadav Amit
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2019-07-01 17:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: x86, Peter Zijlstra, Andy Lutomirski, Nadav Amit

The mutex mm->context->lock for init_mm is not initialized for init_mm.
This wasn't a problem because it remained unused. This changed however
since commit
	4fc19708b165c ("x86/alternatives: Initialize temporary mm for patching")

Initialize the mutex for init_mm.

Fixes: 4fc19708b165c ("x86/alternatives: Initialize temporary mm for patching")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---

The rwsem `ldt_usr_sem' is also not initialized for init_mm. No idea if
we want this.

 arch/x86/include/asm/mmu.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/mmu.h b/arch/x86/include/asm/mmu.h
index 5ff3e8af2c205..e78c7db878018 100644
--- a/arch/x86/include/asm/mmu.h
+++ b/arch/x86/include/asm/mmu.h
@@ -59,6 +59,7 @@ typedef struct {
 #define INIT_MM_CONTEXT(mm)						\
 	.context = {							\
 		.ctx_id = 1,						\
+		.lock = __MUTEX_INITIALIZER(mm.context.lock),		\
 	}
 
 void leave_mm(int cpu);
-- 
2.20.1


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

* Re: [PATCH] x86/ldt: Initialize the context lock for init_mm
  2019-07-01 17:33 [PATCH] x86/ldt: Initialize the context lock for init_mm Sebastian Andrzej Siewior
@ 2019-07-01 17:49 ` Nadav Amit
  2019-07-03  8:28 ` [tip:x86/urgent] " tip-bot for Sebastian Andrzej Siewior
  2019-07-09 12:02 ` tip-bot for Sebastian Andrzej Siewior
  2 siblings, 0 replies; 4+ messages in thread
From: Nadav Amit @ 2019-07-01 17:49 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, x86, Peter Zijlstra, Andy Lutomirski

> On Jul 1, 2019, at 10:33 AM, Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> 
> The mutex mm->context->lock for init_mm is not initialized for init_mm.
> This wasn't a problem because it remained unused. This changed however
> since commit
> 	4fc19708b165c ("x86/alternatives: Initialize temporary mm for patching")
> 
> Initialize the mutex for init_mm.
> 
> Fixes: 4fc19708b165c ("x86/alternatives: Initialize temporary mm for patching")
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> 
> The rwsem `ldt_usr_sem' is also not initialized for init_mm. No idea if
> we want this.

I cannot see why not (but it would need to depend on CONFIG_MODIFY_LDT_SYSCALL)

> 
> arch/x86/include/asm/mmu.h | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/include/asm/mmu.h b/arch/x86/include/asm/mmu.h
> index 5ff3e8af2c205..e78c7db878018 100644
> --- a/arch/x86/include/asm/mmu.h
> +++ b/arch/x86/include/asm/mmu.h
> @@ -59,6 +59,7 @@ typedef struct {
> #define INIT_MM_CONTEXT(mm)						\
> 	.context = {							\
> 		.ctx_id = 1,						\
> +		.lock = __MUTEX_INITIALIZER(mm.context.lock),		\

Sorry for my mistake. Thanks for fixing it up. I find it useful to know how
the problem was found or what the impact was - helps me sometimes to avoid
causing similar bugs in the future.

Reviewed-by: Nadav Amit <namit@vmware.com>

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

* [tip:x86/urgent] x86/ldt: Initialize the context lock for init_mm
  2019-07-01 17:33 [PATCH] x86/ldt: Initialize the context lock for init_mm Sebastian Andrzej Siewior
  2019-07-01 17:49 ` Nadav Amit
@ 2019-07-03  8:28 ` tip-bot for Sebastian Andrzej Siewior
  2019-07-09 12:02 ` tip-bot for Sebastian Andrzej Siewior
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Sebastian Andrzej Siewior @ 2019-07-03  8:28 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: namit, mingo, tglx, peterz, hpa, bigeasy, luto, linux-kernel

Commit-ID:  32232b350d7cd93cdc65fe5a453e6a40b539e9f9
Gitweb:     https://git.kernel.org/tip/32232b350d7cd93cdc65fe5a453e6a40b539e9f9
Author:     Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Mon, 1 Jul 2019 19:33:54 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 3 Jul 2019 10:25:04 +0200

x86/ldt: Initialize the context lock for init_mm

The mutex mm->context->lock for init_mm is not initialized for init_mm.
This wasn't a problem because it remained unused. This changed however
since commit
	4fc19708b165c ("x86/alternatives: Initialize temporary mm for patching")

Initialize the mutex for init_mm.

Fixes: 4fc19708b165c ("x86/alternatives: Initialize temporary mm for patching")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Nadav Amit <namit@vmware.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20190701173354.2pe62hhliok2afea@linutronix.de

---
 arch/x86/include/asm/mmu.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/mmu.h b/arch/x86/include/asm/mmu.h
index 5ff3e8af2c20..e78c7db87801 100644
--- a/arch/x86/include/asm/mmu.h
+++ b/arch/x86/include/asm/mmu.h
@@ -59,6 +59,7 @@ typedef struct {
 #define INIT_MM_CONTEXT(mm)						\
 	.context = {							\
 		.ctx_id = 1,						\
+		.lock = __MUTEX_INITIALIZER(mm.context.lock),		\
 	}
 
 void leave_mm(int cpu);

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

* [tip:x86/urgent] x86/ldt: Initialize the context lock for init_mm
  2019-07-01 17:33 [PATCH] x86/ldt: Initialize the context lock for init_mm Sebastian Andrzej Siewior
  2019-07-01 17:49 ` Nadav Amit
  2019-07-03  8:28 ` [tip:x86/urgent] " tip-bot for Sebastian Andrzej Siewior
@ 2019-07-09 12:02 ` tip-bot for Sebastian Andrzej Siewior
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Sebastian Andrzej Siewior @ 2019-07-09 12:02 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, peterz, luto, linux-kernel, mingo, tglx, bigeasy, namit

Commit-ID:  39ca5fb4920a96eeab478be2cfa6a2369fef6b02
Gitweb:     https://git.kernel.org/tip/39ca5fb4920a96eeab478be2cfa6a2369fef6b02
Author:     Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Mon, 1 Jul 2019 19:33:54 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 9 Jul 2019 13:57:27 +0200

x86/ldt: Initialize the context lock for init_mm

The mutex mm->context->lock for init_mm is not initialized for init_mm.
This wasn't a problem because it remained unused. This changed however
since commit
	4fc19708b165c ("x86/alternatives: Initialize temporary mm for patching")

Initialize the mutex for init_mm.

Fixes: 4fc19708b165c ("x86/alternatives: Initialize temporary mm for patching")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Nadav Amit <namit@vmware.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20190701173354.2pe62hhliok2afea@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/mmu.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/mmu.h b/arch/x86/include/asm/mmu.h
index 5ff3e8af2c20..e78c7db87801 100644
--- a/arch/x86/include/asm/mmu.h
+++ b/arch/x86/include/asm/mmu.h
@@ -59,6 +59,7 @@ typedef struct {
 #define INIT_MM_CONTEXT(mm)						\
 	.context = {							\
 		.ctx_id = 1,						\
+		.lock = __MUTEX_INITIALIZER(mm.context.lock),		\
 	}
 
 void leave_mm(int cpu);

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

end of thread, other threads:[~2019-07-09 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-01 17:33 [PATCH] x86/ldt: Initialize the context lock for init_mm Sebastian Andrzej Siewior
2019-07-01 17:49 ` Nadav Amit
2019-07-03  8:28 ` [tip:x86/urgent] " tip-bot for Sebastian Andrzej Siewior
2019-07-09 12:02 ` tip-bot for Sebastian Andrzej Siewior

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).