[PATCH] Clear TLS on execve

Luca Barbieri (ldb@ldb.ods.org)
Thu, 31 Oct 2002 15:34:39 +0100


--d6Gm4EdcadzBjdND
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

This trivial patch causes the TLS to be cleared on execve (code is in flush=
_thread).
This is necessary to avoid ESRCH errors when set_thread_area is asked
to choose a free TLS entry after several nested execve's.

The LDT also has a similar problem, but it is less serious because the
LDT code doesn't scan for free entries. I'll probably send a patch to
fix this too, unless there is something important relying on this behavior.

diff --exclude-from=3D/home/ldb/src/linux-exclude -urNdp linux-2.5.45/arch/=
i386/kernel/process.c linux-2.5.45_ldb/arch/i386/kernel/process.c
--- linux-2.5.45/arch/i386/kernel/process.c 2002-10-12 06:21:02.000000000 +=
0200
+++ linux-2.5.45_ldb/arch/i386/kernel/process.c 2002-10-31 14:23:18.0000000=
00 +0100
@@ -247,6 +247,7 @@ void flush_thread(void)
struct task_struct *tsk =3D current;
=20
memset(tsk->thread.debugreg, 0, sizeof(unsigned long)*8);
+ memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));=09
/*
* Forget coprocessor state..
*/

--d6Gm4EdcadzBjdND
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE9wT9+djkty3ft5+cRAtiOAKCNGWGecmDu1O5KkGp/6CNl3pmvGACglepm
ipp3BOlokVRNwoVBeKxJdU0=
=UHUY
-----END PGP SIGNATURE-----

--d6Gm4EdcadzBjdND--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/