linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for 5.3 1/3] rseq: Fix: Reject unknown flags on rseq unregister
@ 2019-09-13 15:12 Mathieu Desnoyers
  2019-09-13 15:12 ` [PATCH for 5.3 2/3] rseq: Fix: Unregister rseq for CLONE_SETTLS Mathieu Desnoyers
  2019-09-13 15:12 ` [PATCH for 5.3 3/3] rseq/selftests: Fix: Namespace gettid() for compatibility with glibc 2.30 Mathieu Desnoyers
  0 siblings, 2 replies; 6+ messages in thread
From: Mathieu Desnoyers @ 2019-09-13 15:12 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-kernel, Mathieu Desnoyers, Peter Zijlstra,
	Paul E. McKenney, Boqun Feng, H . Peter Anvin, Paul Turner,
	linux-api, stable

It is preferrable to reject unknown flags within rseq unregistration
rather than to ignore them. It is an oversight caused by the fact that
the check for unknown flags is after the rseq unregister flag check.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: Paul Turner <pjt@google.com>
Cc: linux-api@vger.kernel.org
Cc: <stable@vger.kernel.org>
---
 kernel/rseq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/rseq.c b/kernel/rseq.c
index 27c48eb7de40..a4f86a9d6937 100644
--- a/kernel/rseq.c
+++ b/kernel/rseq.c
@@ -310,6 +310,8 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
 	int ret;
 
 	if (flags & RSEQ_FLAG_UNREGISTER) {
+		if (flags & ~RSEQ_FLAG_UNREGISTER)
+			return -EINVAL;
 		/* Unregister rseq for current thread. */
 		if (current->rseq != rseq || !current->rseq)
 			return -EINVAL;
-- 
2.17.1


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

end of thread, other threads:[~2019-09-16 20:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13 15:12 [PATCH for 5.3 1/3] rseq: Fix: Reject unknown flags on rseq unregister Mathieu Desnoyers
2019-09-13 15:12 ` [PATCH for 5.3 2/3] rseq: Fix: Unregister rseq for CLONE_SETTLS Mathieu Desnoyers
2019-09-14 14:21   ` Mathieu Desnoyers
2019-09-16 20:26     ` Mathieu Desnoyers
2019-09-13 15:12 ` [PATCH for 5.3 3/3] rseq/selftests: Fix: Namespace gettid() for compatibility with glibc 2.30 Mathieu Desnoyers
     [not found]   ` <20190914194716.ED5D020692@mail.kernel.org>
2019-09-16 14:42     ` Mathieu Desnoyers

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