All of lore.kernel.org
 help / color / mirror / Atom feed
* pkeys: Remove easily triggered WARN
@ 2016-10-14 18:26 ` Dave Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Dave Jones @ 2016-10-14 18:26 UTC (permalink / raw)
  To: Dave Hansen
  Cc: linux-arch, Dave Hansen, mgorman, arnd, linux-api, linux-mm,
	luto, akpm, torvalds

This easy-to-trigger warning shows up instantly when running
Trinity on a kernel with CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS disabled.

At most this should have been a printk, but the -EINVAL alone should be more
than adequate indicator that something isn't available.

Signed-off-by: Dave Jones <davej@codemonkey.org.uk>

diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h
index e4c08c1ff0c5..a1bacf1150b2 100644
--- a/include/linux/pkeys.h
+++ b/include/linux/pkeys.h
@@ -25,7 +25,6 @@ static inline int mm_pkey_alloc(struct mm_struct *mm)
 
 static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
 {
-	WARN_ONCE(1, "free of protection key when disabled");
 	return -EINVAL;
 }
 

--
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] 8+ messages in thread

* pkeys: Remove easily triggered WARN
@ 2016-10-14 18:26 ` Dave Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Dave Jones @ 2016-10-14 18:26 UTC (permalink / raw)
  To: Dave Hansen
  Cc: linux-arch, Dave Hansen, mgorman, arnd, linux-api, linux-mm,
	luto, akpm, torvalds

This easy-to-trigger warning shows up instantly when running
Trinity on a kernel with CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS disabled.

At most this should have been a printk, but the -EINVAL alone should be more
than adequate indicator that something isn't available.

Signed-off-by: Dave Jones <davej@codemonkey.org.uk>

diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h
index e4c08c1ff0c5..a1bacf1150b2 100644
--- a/include/linux/pkeys.h
+++ b/include/linux/pkeys.h
@@ -25,7 +25,6 @@ static inline int mm_pkey_alloc(struct mm_struct *mm)
 
 static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
 {
-	WARN_ONCE(1, "free of protection key when disabled");
 	return -EINVAL;
 }
 

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

* Re: pkeys: Remove easily triggered WARN
@ 2016-10-14 19:16   ` Dave Hansen
  0 siblings, 0 replies; 8+ messages in thread
From: Dave Hansen @ 2016-10-14 19:16 UTC (permalink / raw)
  To: Dave Jones
  Cc: linux-arch, mgorman, arnd, linux-api, linux-mm, luto, akpm, torvalds

On 10/14/2016 11:26 AM, Dave Jones wrote:
> This easy-to-trigger warning shows up instantly when running
> Trinity on a kernel with CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS disabled.
> 
> At most this should have been a printk, but the -EINVAL alone should be more
> than adequate indicator that something isn't available.

Urg, thanks for the patch.  It's obviously correct, of course.

Acked-by: Dave Hansen <dave.hansen@intel.com>

--
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	[flat|nested] 8+ messages in thread

* Re: pkeys: Remove easily triggered WARN
@ 2016-10-14 19:16   ` Dave Hansen
  0 siblings, 0 replies; 8+ messages in thread
From: Dave Hansen @ 2016-10-14 19:16 UTC (permalink / raw)
  To: Dave Jones
  Cc: linux-arch, mgorman, arnd, linux-api, linux-mm, luto, akpm, torvalds

On 10/14/2016 11:26 AM, Dave Jones wrote:
> This easy-to-trigger warning shows up instantly when running
> Trinity on a kernel with CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS disabled.
> 
> At most this should have been a printk, but the -EINVAL alone should be more
> than adequate indicator that something isn't available.

Urg, thanks for the patch.  It's obviously correct, of course.

Acked-by: Dave Hansen <dave.hansen@intel.com>

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

* Re: pkeys: Remove easily triggered WARN
@ 2016-10-17  7:16   ` Heiko Carstens
  0 siblings, 0 replies; 8+ messages in thread
From: Heiko Carstens @ 2016-10-17  7:16 UTC (permalink / raw)
  To: Dave Jones
  Cc: Dave Hansen, linux-arch, Dave Hansen, mgorman, arnd, linux-api,
	linux-mm, luto, akpm, torvalds

On Fri, Oct 14, 2016 at 02:26:24PM -0400, Dave Jones wrote:
> This easy-to-trigger warning shows up instantly when running
> Trinity on a kernel with CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS disabled.
> 
> At most this should have been a printk, but the -EINVAL alone should be more
> than adequate indicator that something isn't available.
> 
> Signed-off-by: Dave Jones <davej@codemonkey.org.uk>
> 
> diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h
> index e4c08c1ff0c5..a1bacf1150b2 100644
> --- a/include/linux/pkeys.h
> +++ b/include/linux/pkeys.h
> @@ -25,7 +25,6 @@ static inline int mm_pkey_alloc(struct mm_struct *mm)
>  
>  static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
>  {
> -	WARN_ONCE(1, "free of protection key when disabled");
>  	return -EINVAL;
>  }

FWIW, are all architectures supposed to wire these new system calls up?

I decided to ignore these on s390 since we can't make any sane use of
them. However mips has them already wired up.

The only difference on s390 (and any other architecture without memory
protection keys with x86 like semantics) would be that pkey_alloc/pkey_free
will return -EINVAL instead of -ENOSYS and that we have a new mprotect
wrapper called pkey_mprotect, if being called with a pkey parameter of -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	[flat|nested] 8+ messages in thread

* Re: pkeys: Remove easily triggered WARN
@ 2016-10-17  7:16   ` Heiko Carstens
  0 siblings, 0 replies; 8+ messages in thread
From: Heiko Carstens @ 2016-10-17  7:16 UTC (permalink / raw)
  To: Dave Jones
  Cc: Dave Hansen, linux-arch, Dave Hansen, mgorman, arnd, linux-api,
	linux-mm, luto, akpm, torvalds

On Fri, Oct 14, 2016 at 02:26:24PM -0400, Dave Jones wrote:
> This easy-to-trigger warning shows up instantly when running
> Trinity on a kernel with CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS disabled.
> 
> At most this should have been a printk, but the -EINVAL alone should be more
> than adequate indicator that something isn't available.
> 
> Signed-off-by: Dave Jones <davej@codemonkey.org.uk>
> 
> diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h
> index e4c08c1ff0c5..a1bacf1150b2 100644
> --- a/include/linux/pkeys.h
> +++ b/include/linux/pkeys.h
> @@ -25,7 +25,6 @@ static inline int mm_pkey_alloc(struct mm_struct *mm)
>  
>  static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
>  {
> -	WARN_ONCE(1, "free of protection key when disabled");
>  	return -EINVAL;
>  }

FWIW, are all architectures supposed to wire these new system calls up?

I decided to ignore these on s390 since we can't make any sane use of
them. However mips has them already wired up.

The only difference on s390 (and any other architecture without memory
protection keys with x86 like semantics) would be that pkey_alloc/pkey_free
will return -EINVAL instead of -ENOSYS and that we have a new mprotect
wrapper called pkey_mprotect, if being called with a pkey parameter of -1.


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

* Re: pkeys: Remove easily triggered WARN
@ 2016-10-17  7:54     ` Heiko Carstens
  0 siblings, 0 replies; 8+ messages in thread
From: Heiko Carstens @ 2016-10-17  7:54 UTC (permalink / raw)
  To: Dave Jones, Dave Hansen, linux-arch, Dave Hansen, mgorman, arnd,
	linux-api, linux-mm, luto, akpm, torvalds

On Mon, Oct 17, 2016 at 09:16:48AM +0200, Heiko Carstens wrote:
> On Fri, Oct 14, 2016 at 02:26:24PM -0400, Dave Jones wrote:
> > This easy-to-trigger warning shows up instantly when running
> > Trinity on a kernel with CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS disabled.
> > 
> > At most this should have been a printk, but the -EINVAL alone should be more
> > than adequate indicator that something isn't available.
> > 
> > Signed-off-by: Dave Jones <davej@codemonkey.org.uk>
> > 
> > diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h
> > index e4c08c1ff0c5..a1bacf1150b2 100644
> > --- a/include/linux/pkeys.h
> > +++ b/include/linux/pkeys.h
> > @@ -25,7 +25,6 @@ static inline int mm_pkey_alloc(struct mm_struct *mm)
> >  
> >  static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
> >  {
> > -	WARN_ONCE(1, "free of protection key when disabled");
> >  	return -EINVAL;
> >  }
> 
> FWIW, are all architectures supposed to wire these new system calls up?
> 
> I decided to ignore these on s390 since we can't make any sane use of
> them. However mips has them already wired up.
> 
> The only difference on s390 (and any other architecture without memory
> protection keys with x86 like semantics) would be that pkey_alloc/pkey_free
> will return -EINVAL instead of -ENOSYS and that we have a new mprotect
> wrapper called pkey_mprotect, if being called with a pkey parameter of -1.

What I wrote is of course not correct... 

There can't be any -ENOSYS if the system call isn't wired up, since the
system call number hasn't been allocated at all for an architecture.

But the question remains: should these be wired up on all architectures?

--
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	[flat|nested] 8+ messages in thread

* Re: pkeys: Remove easily triggered WARN
@ 2016-10-17  7:54     ` Heiko Carstens
  0 siblings, 0 replies; 8+ messages in thread
From: Heiko Carstens @ 2016-10-17  7:54 UTC (permalink / raw)
  To: Dave Jones, Dave Hansen, linux-arch, Dave Hansen, mgorman, arnd,
	linux-api, linux-mm, luto, akpm, torvalds

On Mon, Oct 17, 2016 at 09:16:48AM +0200, Heiko Carstens wrote:
> On Fri, Oct 14, 2016 at 02:26:24PM -0400, Dave Jones wrote:
> > This easy-to-trigger warning shows up instantly when running
> > Trinity on a kernel with CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS disabled.
> > 
> > At most this should have been a printk, but the -EINVAL alone should be more
> > than adequate indicator that something isn't available.
> > 
> > Signed-off-by: Dave Jones <davej@codemonkey.org.uk>
> > 
> > diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h
> > index e4c08c1ff0c5..a1bacf1150b2 100644
> > --- a/include/linux/pkeys.h
> > +++ b/include/linux/pkeys.h
> > @@ -25,7 +25,6 @@ static inline int mm_pkey_alloc(struct mm_struct *mm)
> >  
> >  static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
> >  {
> > -	WARN_ONCE(1, "free of protection key when disabled");
> >  	return -EINVAL;
> >  }
> 
> FWIW, are all architectures supposed to wire these new system calls up?
> 
> I decided to ignore these on s390 since we can't make any sane use of
> them. However mips has them already wired up.
> 
> The only difference on s390 (and any other architecture without memory
> protection keys with x86 like semantics) would be that pkey_alloc/pkey_free
> will return -EINVAL instead of -ENOSYS and that we have a new mprotect
> wrapper called pkey_mprotect, if being called with a pkey parameter of -1.

What I wrote is of course not correct... 

There can't be any -ENOSYS if the system call isn't wired up, since the
system call number hasn't been allocated at all for an architecture.

But the question remains: should these be wired up on all architectures?


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

end of thread, other threads:[~2016-10-17  7:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-14 18:26 pkeys: Remove easily triggered WARN Dave Jones
2016-10-14 18:26 ` Dave Jones
2016-10-14 19:16 ` Dave Hansen
2016-10-14 19:16   ` Dave Hansen
2016-10-17  7:16 ` Heiko Carstens
2016-10-17  7:16   ` Heiko Carstens
2016-10-17  7:54   ` Heiko Carstens
2016-10-17  7:54     ` Heiko Carstens

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.