Commit b10bf295 authored by Luca Barbieri's avatar Luca Barbieri Committed by Linus Torvalds

[PATCH] Introduce TIF_IRET and use it to disable sysexit

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.
parent a7df6f33
...@@ -124,6 +124,6 @@ asmlinkage int sys_iopl(unsigned long unused) ...@@ -124,6 +124,6 @@ asmlinkage int sys_iopl(unsigned long unused)
} }
regs->eflags = (regs->eflags & 0xffffcfff) | (level << 12); regs->eflags = (regs->eflags & 0xffffcfff) | (level << 12);
/* Make sure we return the long way (not sysenter) */ /* Make sure we return the long way (not sysenter) */
set_thread_flag(TIF_SIGPENDING); set_thread_flag(TIF_IRET);
return 0; return 0;
} }
...@@ -555,7 +555,7 @@ asmlinkage int sys_execve(struct pt_regs regs) ...@@ -555,7 +555,7 @@ asmlinkage int sys_execve(struct pt_regs regs)
if (error == 0) { if (error == 0) {
current->ptrace &= ~PT_DTRACE; current->ptrace &= ~PT_DTRACE;
/* Make sure we don't return using sysenter.. */ /* Make sure we don't return using sysenter.. */
set_thread_flag(TIF_SIGPENDING); set_thread_flag(TIF_IRET);
} }
putname(filename); putname(filename);
out: out:
......
...@@ -617,4 +617,6 @@ void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, ...@@ -617,4 +617,6 @@ void do_notify_resume(struct pt_regs *regs, sigset_t *oldset,
/* deal with pending signal delivery */ /* deal with pending signal delivery */
if (thread_info_flags & _TIF_SIGPENDING) if (thread_info_flags & _TIF_SIGPENDING)
do_signal(regs,oldset); do_signal(regs,oldset);
clear_thread_flag(TIF_IRET);
} }
...@@ -110,6 +110,7 @@ static inline struct thread_info *current_thread_info(void) ...@@ -110,6 +110,7 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_SIGPENDING 2 /* signal pending */ #define TIF_SIGPENDING 2 /* signal pending */
#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ #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_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 */ #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
...@@ -118,6 +119,7 @@ static inline struct thread_info *current_thread_info(void) ...@@ -118,6 +119,7 @@ static inline struct thread_info *current_thread_info(void)
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
#define _TIF_IRET (1<<TIF_IRET)
#define _TIF_USEDFPU (1<<TIF_USEDFPU) #define _TIF_USEDFPU (1<<TIF_USEDFPU)
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment