lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-83b0b15bcb0f700e7c1d070aae2e7841170a4c33@git.kernel.org>
Date:   Fri, 19 Apr 2019 03:43:47 -0700
From:   tip-bot for Mathieu Desnoyers <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     linux@....linux.org.uk, mtk.manpages@...il.com,
        catalin.marinas@....com, boqun.feng@...il.com, davejwatson@...com,
        peterz@...radead.org, pjt@...gle.com, akpm@...ux-foundation.org,
        josh@...htriplett.org, cl@...ux.com, linux-kernel@...r.kernel.org,
        will.deacon@....com, joelaf@...gle.com,
        torvalds@...ux-foundation.org, hpa@...or.com,
        mathieu.desnoyers@...icios.com, bmaurer@...com, tglx@...utronix.de,
        rostedt@...dmis.org, paulmck@...ux.vnet.ibm.com, mingo@...nel.org,
        luto@...capital.net
Subject: [tip:core/rseq] rseq: Remove superfluous rseq_len from task_struct

Commit-ID:  83b0b15bcb0f700e7c1d070aae2e7841170a4c33
Gitweb:     https://git.kernel.org/tip/83b0b15bcb0f700e7c1d070aae2e7841170a4c33
Author:     Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
AuthorDate: Tue, 5 Mar 2019 14:47:54 -0500
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 19 Apr 2019 12:39:32 +0200

rseq: Remove superfluous rseq_len from task_struct

The rseq system call, when invoked with flags of "0" or
"RSEQ_FLAG_UNREGISTER" values, expects the rseq_len parameter to
be equal to sizeof(struct rseq), which is fixed-size and fixed-layout,
specified in uapi linux/rseq.h.

Expecting a fixed size for rseq_len is a design choice that ensures
multiple libraries and application defining __rseq_abi in the same
process agree on its exact size.

Considering that this size is and will always be the same value, there
is no point in saving this value within task_struct rseq_len. Remove
this field from task_struct.

No change in functionality intended.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Lutomirski <luto@...capital.net>
Cc: Ben Maurer <bmaurer@...com>
Cc: Boqun Feng <boqun.feng@...il.com>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: Chris Lameter <cl@...ux.com>
Cc: Dave Watson <davejwatson@...com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Joel Fernandes <joelaf@...gle.com>
Cc: Josh Triplett <josh@...htriplett.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Michael Kerrisk <mtk.manpages@...il.com>
Cc: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Cc: Paul Turner <pjt@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Russell King <linux@....linux.org.uk>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Will Deacon <will.deacon@....com>
Cc: linux-api@...r.kernel.org
Link: http://lkml.kernel.org/r/20190305194755.2602-3-mathieu.desnoyers@efficios.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 include/linux/sched.h | 4 ----
 kernel/rseq.c         | 6 ++----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1549584a1538..50606a6e73d6 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1057,7 +1057,6 @@ struct task_struct {
 
 #ifdef CONFIG_RSEQ
 	struct rseq __user *rseq;
-	u32 rseq_len;
 	u32 rseq_sig;
 	/*
 	 * RmW on rseq_event_mask must be performed atomically
@@ -1855,12 +1854,10 @@ static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
 {
 	if (clone_flags & CLONE_THREAD) {
 		t->rseq = NULL;
-		t->rseq_len = 0;
 		t->rseq_sig = 0;
 		t->rseq_event_mask = 0;
 	} else {
 		t->rseq = current->rseq;
-		t->rseq_len = current->rseq_len;
 		t->rseq_sig = current->rseq_sig;
 		t->rseq_event_mask = current->rseq_event_mask;
 	}
@@ -1869,7 +1866,6 @@ static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
 static inline void rseq_execve(struct task_struct *t)
 {
 	t->rseq = NULL;
-	t->rseq_len = 0;
 	t->rseq_sig = 0;
 	t->rseq_event_mask = 0;
 }
diff --git a/kernel/rseq.c b/kernel/rseq.c
index 849afe749131..9424ee90589e 100644
--- a/kernel/rseq.c
+++ b/kernel/rseq.c
@@ -313,7 +313,7 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
 		/* Unregister rseq for current thread. */
 		if (current->rseq != rseq || !current->rseq)
 			return -EINVAL;
-		if (current->rseq_len != rseq_len)
+		if (rseq_len != sizeof(*rseq))
 			return -EINVAL;
 		if (current->rseq_sig != sig)
 			return -EPERM;
@@ -321,7 +321,6 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
 		if (ret)
 			return ret;
 		current->rseq = NULL;
-		current->rseq_len = 0;
 		current->rseq_sig = 0;
 		return 0;
 	}
@@ -335,7 +334,7 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
 		 * the provided address differs from the prior
 		 * one.
 		 */
-		if (current->rseq != rseq || current->rseq_len != rseq_len)
+		if (current->rseq != rseq || rseq_len != sizeof(*rseq))
 			return -EINVAL;
 		if (current->rseq_sig != sig)
 			return -EPERM;
@@ -353,7 +352,6 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
 	if (!access_ok(rseq, rseq_len))
 		return -EFAULT;
 	current->rseq = rseq;
-	current->rseq_len = rseq_len;
 	current->rseq_sig = sig;
 	/*
 	 * If rseq was previously inactive, and has just been

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ