public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Luca Barbieri <ldb@ldb.ods.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux-Kernel ML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Introduce TIF_IRET and use it to disable sysexit
Date: Mon, 6 Jan 2003 03:12:50 +0100	[thread overview]
Message-ID: <20030106021250.GB8074@ldb> (raw)

[-- Attachment #1: Type: text/plain, Size: 3181 bytes --]

This patch introduces a new flag called TIF_IRET and uses it in place
of TIF_SIGPENDING when that flag is used to force return via iret.

This avoids the overhead of calling do_signal and makes the code
easier to understand.


diff --exclude-from=/home/ldb/src/exclude -urNdp --exclude='speedtouch.*' --exclude='atmsar.*' linux-2.5.54/arch/i386/kernel/ioport.c linux-2.5.54-ldb/arch/i386/kernel/ioport.c
--- linux-2.5.54/arch/i386/kernel/ioport.c	2003-01-02 04:21:56.000000000 +0100
+++ linux-2.5.54-ldb/arch/i386/kernel/ioport.c	2003-01-04 19:06:07.000000000 +0100
@@ -124,6 +124,6 @@ asmlinkage int sys_iopl(unsigned long un
 	}
 	regs->eflags = (regs->eflags & 0xffffcfff) | (level << 12);
 	/* Make sure we return the long way (not sysenter) */
-	set_thread_flag(TIF_SIGPENDING);
+	set_thread_flag(TIF_IRET);
 	return 0;
 }
diff --exclude-from=/home/ldb/src/exclude -urNdp --exclude='speedtouch.*' --exclude='atmsar.*' linux-2.5.54/arch/i386/kernel/process.c linux-2.5.54-ldb/arch/i386/kernel/process.c
--- linux-2.5.54/arch/i386/kernel/process.c	2003-01-02 04:20:49.000000000 +0100
+++ linux-2.5.54-ldb/arch/i386/kernel/process.c	2003-01-04 19:06:07.000000000 +0100
@@ -561,7 +561,7 @@ asmlinkage int sys_execve(struct pt_regs
 	if (error == 0) {
 		current->ptrace &= ~PT_DTRACE;
 		/* Make sure we don't return using sysenter.. */
-		set_thread_flag(TIF_SIGPENDING);
+		set_thread_flag(TIF_IRET);
 	}
 	putname(filename);
 out:
diff --exclude-from=/home/ldb/src/exclude -urNdp --exclude='speedtouch.*' --exclude='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 +0100
+++ linux-2.5.54-ldb/arch/i386/kernel/signal.c	2003-01-04 19:06:07.000000000 +0100
@@ -617,4 +619,6 @@ void do_notify_resume(struct pt_regs *re
 	/* deal with pending signal delivery */
 	if (thread_info_flags & _TIF_SIGPENDING)
 		do_signal(regs,oldset);
+	
+	clear_thread_flag(TIF_IRET);
 }
diff --exclude-from=/home/ldb/src/exclude -urNdp --exclude='speedtouch.*' --exclude='atmsar.*' linux-2.5.54/include/asm-i386/thread_info.h linux-2.5.54-ldb/include/asm-i386/thread_info.h
--- linux-2.5.54/include/asm-i386/thread_info.h	2003-01-02 04:21:09.000000000 +0100
+++ linux-2.5.54-ldb/include/asm-i386/thread_info.h	2003-01-04 19:06:07.000000000 +0100
@@ -110,6 +110,7 @@ static inline struct thread_info *curren
 #define TIF_SIGPENDING		2	/* signal pending */
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_SINGLESTEP		4	/* restore singlestep on return to user mode */
+#define TIF_IRET		5	/* return with iret */
 #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 
@@ -118,6 +119,7 @@ static inline struct thread_info *curren
 #define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
 #define _TIF_SINGLESTEP		(1<<TIF_SINGLESTEP)
+#define _TIF_IRET		(1<<TIF_IRET)
 #define _TIF_USEDFPU		(1<<TIF_USEDFPU)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2003-01-06  2:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-06  2:12 Luca Barbieri [this message]
2003-01-06  3:21 ` [PATCH] Introduce TIF_IRET and use it to disable sysexit Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030106021250.GB8074@ldb \
    --to=ldb@ldb.ods.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox