All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/pkeys: generate pkey system call code only if ARCH_HAS_PKEYS is selected
@ 2016-11-14 11:12 ` Heiko Carstens
  0 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2016-11-14 11:12 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, linux-mm, Dave Hansen, Mark Rutland

Having code for the pkey_mprotect, pkey_alloc and pkey_free system
calls makes only sense if ARCH_HAS_PKEYS is selected. If not selected
these system calls will always return -ENOSPC or -EINVAL.

To simplify things and have less code generate the pkey system call
code only if ARCH_HAS_PKEYS is selected.

For architectures which have already wired up the system calls, but do
not select ARCH_HAS_PKEYS this will result in less generated code and
a different return code: the three system calls will now always return
-ENOSYS, using the cond_syscall mechanism.

For architectures which have not wired up the system calls less
unreachable code will be generated.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 mm/mprotect.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/mprotect.c b/mm/mprotect.c
index 11936526b08b..a06e91c4de29 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -484,6 +484,8 @@ SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len,
 	return do_mprotect_pkey(start, len, prot, -1);
 }
 
+#ifdef CONFIG_ARCH_HAS_PKEYS
+
 SYSCALL_DEFINE4(pkey_mprotect, unsigned long, start, size_t, len,
 		unsigned long, prot, int, pkey)
 {
@@ -534,3 +536,5 @@ SYSCALL_DEFINE1(pkey_free, int, pkey)
 	 */
 	return ret;
 }
+
+#endif /* CONFIG_ARCH_HAS_PKEYS */
-- 
2.8.4

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

* [PATCH] mm/pkeys: generate pkey system call code only if ARCH_HAS_PKEYS is selected
@ 2016-11-14 11:12 ` Heiko Carstens
  0 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2016-11-14 11:12 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, linux-mm, Dave Hansen, Mark Rutland

Having code for the pkey_mprotect, pkey_alloc and pkey_free system
calls makes only sense if ARCH_HAS_PKEYS is selected. If not selected
these system calls will always return -ENOSPC or -EINVAL.

To simplify things and have less code generate the pkey system call
code only if ARCH_HAS_PKEYS is selected.

For architectures which have already wired up the system calls, but do
not select ARCH_HAS_PKEYS this will result in less generated code and
a different return code: the three system calls will now always return
-ENOSYS, using the cond_syscall mechanism.

For architectures which have not wired up the system calls less
unreachable code will be generated.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 mm/mprotect.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/mprotect.c b/mm/mprotect.c
index 11936526b08b..a06e91c4de29 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -484,6 +484,8 @@ SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len,
 	return do_mprotect_pkey(start, len, prot, -1);
 }
 
+#ifdef CONFIG_ARCH_HAS_PKEYS
+
 SYSCALL_DEFINE4(pkey_mprotect, unsigned long, start, size_t, len,
 		unsigned long, prot, int, pkey)
 {
@@ -534,3 +536,5 @@ SYSCALL_DEFINE1(pkey_free, int, pkey)
 	 */
 	return ret;
 }
+
+#endif /* CONFIG_ARCH_HAS_PKEYS */
-- 
2.8.4

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

* Re: [PATCH] mm/pkeys: generate pkey system call code only if ARCH_HAS_PKEYS is selected
  2016-11-14 11:12 ` Heiko Carstens
@ 2016-11-14 16:44   ` Dave Hansen
  -1 siblings, 0 replies; 4+ messages in thread
From: Dave Hansen @ 2016-11-14 16:44 UTC (permalink / raw)
  To: Heiko Carstens, Andrew Morton
  Cc: linux-arch, linux-kernel, linux-mm, Mark Rutland

On 11/14/2016 03:12 AM, Heiko Carstens wrote:
> Having code for the pkey_mprotect, pkey_alloc and pkey_free system
> calls makes only sense if ARCH_HAS_PKEYS is selected. If not selected
> these system calls will always return -ENOSPC or -EINVAL.
> 
> To simplify things and have less code generate the pkey system call
> code only if ARCH_HAS_PKEYS is selected.
> 
> For architectures which have already wired up the system calls, but do
> not select ARCH_HAS_PKEYS this will result in less generated code and
> a different return code: the three system calls will now always return
> -ENOSYS, using the cond_syscall mechanism.
> 
> For architectures which have not wired up the system calls less
> unreachable code will be generated.
> 
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>

This is fine with me.  FWIW:

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

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

* Re: [PATCH] mm/pkeys: generate pkey system call code only if ARCH_HAS_PKEYS is selected
@ 2016-11-14 16:44   ` Dave Hansen
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Hansen @ 2016-11-14 16:44 UTC (permalink / raw)
  To: Heiko Carstens, Andrew Morton
  Cc: linux-arch, linux-kernel, linux-mm, Mark Rutland

On 11/14/2016 03:12 AM, Heiko Carstens wrote:
> Having code for the pkey_mprotect, pkey_alloc and pkey_free system
> calls makes only sense if ARCH_HAS_PKEYS is selected. If not selected
> these system calls will always return -ENOSPC or -EINVAL.
> 
> To simplify things and have less code generate the pkey system call
> code only if ARCH_HAS_PKEYS is selected.
> 
> For architectures which have already wired up the system calls, but do
> not select ARCH_HAS_PKEYS this will result in less generated code and
> a different return code: the three system calls will now always return
> -ENOSYS, using the cond_syscall mechanism.
> 
> For architectures which have not wired up the system calls less
> unreachable code will be generated.
> 
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>

This is fine with me.  FWIW:

Acked-by: Dave Hansen <dave.hansen@linux.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] 4+ messages in thread

end of thread, other threads:[~2016-11-14 16:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-14 11:12 [PATCH] mm/pkeys: generate pkey system call code only if ARCH_HAS_PKEYS is selected Heiko Carstens
2016-11-14 11:12 ` Heiko Carstens
2016-11-14 16:44 ` Dave Hansen
2016-11-14 16:44   ` Dave Hansen

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.