linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86, mpx: Ensure unused arguments of prctl() MPX requests are 0
@ 2015-01-08 10:28 Michael Kerrisk (man-pages)
  2015-01-09 17:25 ` Andi Kleen
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Kerrisk (man-pages) @ 2015-01-08 10:28 UTC (permalink / raw)
  To: Andrew Morton, linux-mm@kvack.org; +Cc: mtk.manpages, Dave Hansen, Qiaowei Ren

From: Michael Kerrisk <mtk.manpages@gmail.com>

commit fe8c7f5cbf91124987106faa3bdf0c8b955c4cf7 added two new prctl()
operations, PR_MPX_ENABLE_MANAGEMENT and PR_MPX_DISABLE_MANAGEMENT.
However, no checks were included to ensure that unused arguments
are zero, as is done in many existing prctl()s and as should be 
done for all new prctl()s. This patch adds the required checks.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
---
 kernel/sys.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sys.c b/kernel/sys.c
index a8c9f5a..ea9c881 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2210,9 +2210,13 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
 		up_write(&me->mm->mmap_sem);
 		break;
 	case PR_MPX_ENABLE_MANAGEMENT:
+		if (arg2 || arg3 || arg4 || arg5)
+			return -EINVAL;
 		error = MPX_ENABLE_MANAGEMENT(me);
 		break;
 	case PR_MPX_DISABLE_MANAGEMENT:
+		if (arg2 || arg3 || arg4 || arg5)
+			return -EINVAL;
 		error = MPX_DISABLE_MANAGEMENT(me);
 		break;
 	default:
-- 
1.9.3
-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

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

end of thread, other threads:[~2015-01-14  7:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-08 10:28 [PATCH] x86, mpx: Ensure unused arguments of prctl() MPX requests are 0 Michael Kerrisk (man-pages)
2015-01-09 17:25 ` Andi Kleen
2015-01-09 18:25   ` Michael Kerrisk (man-pages)
2015-01-09 18:34     ` Dave Hansen
2015-01-10 13:49       ` Michael Kerrisk (man-pages)
2015-01-10 18:39         ` Andi Kleen
2015-01-14  7:21           ` Michael Kerrisk (man-pages)

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