[PATCH] Set TIF_IRET in more places

Luca Barbieri (ldb@ldb.ods.org)
Mon, 6 Jan 2003 15:46:01 +0100


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-9201-1041864845-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

This patch adds code to set TIF_IRET in sigsuspend and rt_sigsuspend
(since they change registers to invoke signal handlers) and ptrace
setregs. This prevents clobbering of %ecx and %edx.

diff --exclude-from=3D/home/ldb/src/exclude -urNdp --exclude=3D'speedtouch.=
*' --exclude=3D'atmsar.*' linux-2.5.54/arch/i386/kernel/ptrace.c linux-2.5.=
54-ldb/arch/i386/kernel/ptrace.c
--- linux-2.5.54/arch/i386/kernel/ptrace.c 2003-01-02 04:21:29.000000000 +0=
100
+++ linux-2.5.54-ldb/arch/i386/kernel/ptrace.c 2003-01-04 19:06:07.00000000=
0 +0100
@@ -74,6 +74,8 @@ static inline int put_stack_long(struct=20
static int putreg(struct task_struct *child,
unsigned long regno, unsigned long value)
{
+ set_tsk_thread_flag(child, TIF_IRET);
+
switch (regno >> 2) {
case FS:
if (value && (value & 3) !=3D 3)
diff --exclude-from=3D/home/ldb/src/exclude -urNdp --exclude=3D'speedtouch.=
*' --exclude=3D'atmsar.*' linux-2.5.54/arch/i386/kernel/signal.c linux-2.5.=
54-ldb/arch/i386/kernel/signal.c
--- linux-2.5.54/arch/i386/kernel/signal.c 2003-01-02 04:21:53.000000000 +0=
100
+++ linux-2.5.54-ldb/arch/i386/kernel/signal.c 2003-01-04 19:06:07.00000000=
0 +0100
@@ -44,6 +44,7 @@ sys_sigsuspend(int history0, int history
spin_unlock_irq(&current->sig->siglock);
=20
regs->eax =3D -EINTR;
+ set_thread_flag(TIF_IRET);
while (1) {
current->state =3D TASK_INTERRUPTIBLE;
schedule();
@@ -73,6 +74,7 @@ sys_rt_sigsuspend(sigset_t *unewset, siz
spin_unlock_irq(&current->sig->siglock);
=20
regs->eax =3D -EINTR;
+ set_thread_flag(TIF_IRET);=09
while (1) {
current->state =3D TASK_INTERRUPTIBLE;
schedule();

--=_courier-9201-1041864845-0001-2
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

iD8DBQE+GZaodjkty3ft5+cRAqsdAKDLzZ+YJbCK44Bk+B17dARR8UIMFQCeJRTv
70Udo+UTLhNMPRpDSDpGFI8=
=BD/T
-----END PGP SIGNATURE-----

--=_courier-9201-1041864845-0001-2--