Commit 5b4b68b8 authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] Fix the replacement mistake of xxx_thread_flag

    - fix the replacement mistake of xxx_thread_flag
    - fix the miss test of PT_PTRACED flag

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
parent 91f621c2
...@@ -52,7 +52,7 @@ static inline void __save_init_fpu( struct task_struct *tsk ) ...@@ -52,7 +52,7 @@ static inline void __save_init_fpu( struct task_struct *tsk )
asm volatile( "fnsave %0 ; fwait" asm volatile( "fnsave %0 ; fwait"
: "=m" (tsk->thread.i387.fsave) ); : "=m" (tsk->thread.i387.fsave) );
} }
clear_thread_flag(TIF_USEDFPU); clear_tsk_thread_flag(tsk, TIF_USEDFPU);
} }
void save_init_fpu( struct task_struct *tsk ) void save_init_fpu( struct task_struct *tsk )
...@@ -63,10 +63,8 @@ void save_init_fpu( struct task_struct *tsk ) ...@@ -63,10 +63,8 @@ void save_init_fpu( struct task_struct *tsk )
void kernel_fpu_begin(void) void kernel_fpu_begin(void)
{ {
struct task_struct *tsk = current;
if (test_thread_flag(TIF_USEDFPU)) { if (test_thread_flag(TIF_USEDFPU)) {
__save_init_fpu(tsk); __save_init_fpu(current);
return; return;
} }
clts(); clts();
......
...@@ -278,10 +278,10 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) ...@@ -278,10 +278,10 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
if ((unsigned long) data > _NSIG) if ((unsigned long) data > _NSIG)
break; break;
if (request == PTRACE_SYSCALL) { if (request == PTRACE_SYSCALL) {
set_thread_flag(TIF_SYSCALL_TRACE); set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
} }
else { else {
clear_thread_flag(TIF_SYSCALL_TRACE); clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
} }
child->exit_code = data; child->exit_code = data;
/* make sure the single step bit is not set. */ /* make sure the single step bit is not set. */
...@@ -317,7 +317,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) ...@@ -317,7 +317,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
ret = -EIO; ret = -EIO;
if ((unsigned long) data > _NSIG) if ((unsigned long) data > _NSIG)
break; break;
clear_thread_flag(TIF_SYSCALL_TRACE); clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
if ((child->ptrace & PT_DTRACE) == 0) { if ((child->ptrace & PT_DTRACE) == 0) {
/* Spurious delayed TF traps may occur */ /* Spurious delayed TF traps may occur */
child->ptrace |= PT_DTRACE; child->ptrace |= PT_DTRACE;
...@@ -449,7 +449,7 @@ void do_syscall_trace(struct pt_regs *regs, int entryexit) ...@@ -449,7 +449,7 @@ void do_syscall_trace(struct pt_regs *regs, int entryexit)
{ {
if (!test_thread_flag(TIF_SYSCALL_TRACE)) if (!test_thread_flag(TIF_SYSCALL_TRACE))
return; return;
if (current->ptrace & PT_PTRACED) if (!(current->ptrace & PT_PTRACED))
return; return;
/* the 0x80 provides a way for the tracing parent to distinguish /* the 0x80 provides a way for the tracing parent to distinguish
between a syscall stop and SIGTRAP delivery */ between a syscall stop and SIGTRAP delivery */
......
...@@ -28,17 +28,17 @@ extern void kernel_fpu_begin(void); ...@@ -28,17 +28,17 @@ extern void kernel_fpu_begin(void);
#define unlazy_fpu( tsk ) do { \ #define unlazy_fpu( tsk ) do { \
if (test_thread_flag(TIF_USEDFPU)) \ if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) \
save_init_fpu( tsk ); \ save_init_fpu( tsk ); \
} while (0) } while (0)
#define clear_fpu( tsk ) \ #define clear_fpu( tsk ) \
do { \ do { \
if (test_thread_flag(TIF_USEDFPU)) { \ if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { \
asm volatile("fwait"); \ asm volatile("fwait"); \
clear_thread_flag(TIF_USEDFPU); \ clear_tsk_thread_flag(tsk, TIF_USEDFPU); \
stts(); \ stts(); \
} \ } \
} while (0) } while (0)
/* /*
......
...@@ -73,8 +73,8 @@ static inline struct thread_info *current_thread_info(void) ...@@ -73,8 +73,8 @@ static inline struct thread_info *current_thread_info(void)
#define THREAD_SIZE (2*PAGE_SIZE) #define THREAD_SIZE (2*PAGE_SIZE)
#define alloc_thread_info() ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) #define alloc_thread_info() ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
#define get_thread_info(ti) get_task_struct((ti)->l_task) #define get_thread_info(ti) get_task_struct((ti)->task)
#define put_thread_info(ti) put_task_struct((ti)->l_task) #define put_thread_info(ti) put_task_struct((ti)->task)
#else /* !__ASSEMBLY__ */ #else /* !__ASSEMBLY__ */
......
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