OSDN Git Service

all arches, signal: move restart_block to struct task_struct
authorAndy Lutomirski <luto@amacapital.net>
Thu, 12 Feb 2015 23:01:14 +0000 (15:01 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 13 Feb 2015 02:54:12 +0000 (18:54 -0800)
If an attacker can cause a controlled kernel stack overflow, overwriting
the restart block is a very juicy exploit target.  This is because the
restart_block is held in the same memory allocation as the kernel stack.

Moving the restart block to struct task_struct prevents this exploit by
making the restart_block harder to locate.

Note that there are other fields in thread_info that are also easy
targets, at least on some architectures.

It's also a decent simplification, since the restart code is more or less
identical on all architectures.

[james.hogan@imgtec.com: metag: align thread_info::supervisor_stack]
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: David Miller <davem@davemloft.net>
Acked-by: Richard Weinberger <richard@nod.at>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Steven Miao <realmz6@gmail.com>
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Tested-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Chen Liqin <liqin.linux@gmail.com>
Cc: Lennox Wu <lennox.wu@gmail.com>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
84 files changed:
arch/alpha/include/asm/thread_info.h
arch/alpha/kernel/signal.c
arch/arc/include/asm/thread_info.h
arch/arc/kernel/signal.c
arch/arm/include/asm/thread_info.h
arch/arm/kernel/signal.c
arch/arm64/include/asm/thread_info.h
arch/arm64/kernel/signal.c
arch/arm64/kernel/signal32.c
arch/avr32/include/asm/thread_info.h
arch/avr32/kernel/asm-offsets.c
arch/avr32/kernel/signal.c
arch/blackfin/include/asm/thread_info.h
arch/blackfin/kernel/signal.c
arch/c6x/include/asm/thread_info.h
arch/c6x/kernel/signal.c
arch/cris/arch-v10/kernel/signal.c
arch/cris/arch-v32/kernel/signal.c
arch/cris/include/asm/thread_info.h
arch/frv/include/asm/thread_info.h
arch/frv/kernel/asm-offsets.c
arch/frv/kernel/signal.c
arch/hexagon/include/asm/thread_info.h
arch/hexagon/kernel/signal.c
arch/ia64/include/asm/thread_info.h
arch/ia64/kernel/signal.c
arch/m32r/include/asm/thread_info.h
arch/m32r/kernel/signal.c
arch/m68k/include/asm/thread_info.h
arch/m68k/kernel/signal.c
arch/metag/include/asm/thread_info.h
arch/metag/kernel/signal.c
arch/microblaze/include/asm/thread_info.h
arch/microblaze/kernel/signal.c
arch/mips/include/asm/thread_info.h
arch/mips/kernel/asm-offsets.c
arch/mips/kernel/signal.c
arch/mips/kernel/signal32.c
arch/mn10300/include/asm/thread_info.h
arch/mn10300/kernel/asm-offsets.c
arch/mn10300/kernel/signal.c
arch/openrisc/include/asm/thread_info.h
arch/openrisc/kernel/signal.c
arch/parisc/include/asm/thread_info.h
arch/parisc/kernel/signal.c
arch/powerpc/include/asm/thread_info.h
arch/powerpc/kernel/signal_32.c
arch/powerpc/kernel/signal_64.c
arch/s390/include/asm/thread_info.h
arch/s390/kernel/compat_signal.c
arch/s390/kernel/signal.c
arch/score/include/asm/thread_info.h
arch/score/kernel/asm-offsets.c
arch/score/kernel/signal.c
arch/sh/include/asm/thread_info.h
arch/sh/kernel/asm-offsets.c
arch/sh/kernel/signal_32.c
arch/sh/kernel/signal_64.c
arch/sparc/include/asm/thread_info_32.h
arch/sparc/include/asm/thread_info_64.h
arch/sparc/kernel/signal32.c
arch/sparc/kernel/signal_32.c
arch/sparc/kernel/signal_64.c
arch/sparc/kernel/traps_64.c
arch/tile/include/asm/thread_info.h
arch/tile/kernel/signal.c
arch/um/include/asm/thread_info.h
arch/unicore32/include/asm/thread_info.h
arch/unicore32/kernel/signal.c
arch/x86/ia32/ia32_signal.c
arch/x86/include/asm/thread_info.h
arch/x86/kernel/signal.c
arch/x86/um/signal.c
arch/xtensa/include/asm/thread_info.h
arch/xtensa/kernel/signal.c
fs/select.c
include/linux/init_task.h
include/linux/sched.h
kernel/compat.c
kernel/futex.c
kernel/signal.c
kernel/time/alarmtimer.c
kernel/time/hrtimer.c
kernel/time/posix-cpu-timers.c

index 48bbea6..d5b98ab 100644 (file)
@@ -27,8 +27,6 @@ struct thread_info {
        int bpt_nsaved;
        unsigned long bpt_addr[2];              /* breakpoint handling  */
        unsigned int bpt_insn[2];
-
-       struct restart_block    restart_block;
 };
 
 /*
@@ -40,9 +38,6 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .addr_limit     = KERNEL_DS,            \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 6cec288..8dbfb15 100644 (file)
@@ -150,7 +150,7 @@ restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs)
        struct switch_stack *sw = (struct switch_stack *)regs - 1;
        long i, err = __get_user(regs->pc, &sc->sc_pc);
 
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        sw->r26 = (unsigned long) ret_from_sys_call;
 
index 02bc5ec..1163a18 100644 (file)
@@ -46,7 +46,6 @@ struct thread_info {
        struct exec_domain *exec_domain;/* execution domain */
        __u32 cpu;                      /* current CPU */
        unsigned long thr_ptr;          /* TLS ptr */
-       struct restart_block restart_block;
 };
 
 /*
@@ -62,9 +61,6 @@ struct thread_info {
        .cpu        = 0,                        \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit = KERNEL_DS,                \
-       .restart_block  = {                     \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info    (init_thread_union.thread_info)
index cb3142a..114234e 100644 (file)
@@ -104,7 +104,7 @@ SYSCALL_DEFINE0(rt_sigreturn)
        struct pt_regs *regs = current_pt_regs();
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /* Since we stacked the signal on a word boundary,
         * then 'sp' should be word aligned here.  If it's
index d890e41..72812a1 100644 (file)
@@ -68,7 +68,6 @@ struct thread_info {
 #ifdef CONFIG_ARM_THUMBEE
        unsigned long           thumbee_state;  /* ThumbEE Handler Base register */
 #endif
-       struct restart_block    restart_block;
 };
 
 #define INIT_THREAD_INFO(tsk)                                          \
@@ -81,9 +80,6 @@ struct thread_info {
        .cpu_domain     = domain_val(DOMAIN_USER, DOMAIN_MANAGER) |     \
                          domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) |   \
                          domain_val(DOMAIN_IO, DOMAIN_CLIENT),         \
-       .restart_block  = {                                             \
-               .fn     = do_no_restart_syscall,                        \
-       },                                                              \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 8aa6f1b..023ac90 100644 (file)
@@ -191,7 +191,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
        struct sigframe __user *frame;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /*
         * Since we stacked the signal on a 64-bit boundary,
@@ -221,7 +221,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
        struct rt_sigframe __user *frame;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /*
         * Since we stacked the signal on a 64-bit boundary,
index 459bf8e..702e1e6 100644 (file)
@@ -48,7 +48,6 @@ struct thread_info {
        mm_segment_t            addr_limit;     /* address limit */
        struct task_struct      *task;          /* main task structure */
        struct exec_domain      *exec_domain;   /* execution domain */
-       struct restart_block    restart_block;
        int                     preempt_count;  /* 0 => preemptable, <0 => bug */
        int                     cpu;            /* cpu */
 };
@@ -60,9 +59,6 @@ struct thread_info {
        .flags          = 0,                                            \
        .preempt_count  = INIT_PREEMPT_COUNT,                           \
        .addr_limit     = KERNEL_DS,                                    \
-       .restart_block  = {                                             \
-               .fn     = do_no_restart_syscall,                        \
-       },                                                              \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 6fa7921..660ccf9 100644 (file)
@@ -131,7 +131,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
        struct rt_sigframe __user *frame;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /*
         * Since we stacked the signal on a 128-bit boundary, then 'sp' should
index e299de3..c20a300 100644 (file)
@@ -347,7 +347,7 @@ asmlinkage int compat_sys_sigreturn(struct pt_regs *regs)
        struct compat_sigframe __user *frame;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /*
         * Since we stacked the signal on a 64-bit boundary,
@@ -381,7 +381,7 @@ asmlinkage int compat_sys_rt_sigreturn(struct pt_regs *regs)
        struct compat_rt_sigframe __user *frame;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /*
         * Since we stacked the signal on a 64-bit boundary,
index a978f3f..d56afa9 100644 (file)
@@ -30,7 +30,6 @@ struct thread_info {
                                                   saved by debug handler
                                                   when setting up
                                                   trampoline */
-       struct restart_block    restart_block;
        __u8                    supervisor_stack[0];
 };
 
@@ -41,9 +40,6 @@ struct thread_info {
        .flags          = 0,                                            \
        .cpu            = 0,                                            \
        .preempt_count  = INIT_PREEMPT_COUNT,                           \
-       .restart_block  = {                                             \
-               .fn     = do_no_restart_syscall                         \
-       }                                                               \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index d6a8193..e41c845 100644 (file)
@@ -18,7 +18,6 @@ void foo(void)
        OFFSET(TI_preempt_count, thread_info, preempt_count);
        OFFSET(TI_rar_saved, thread_info, rar_saved);
        OFFSET(TI_rsr_saved, thread_info, rsr_saved);
-       OFFSET(TI_restart_block, thread_info, restart_block);
        BLANK();
        OFFSET(TSK_active_mm, task_struct, active_mm);
        BLANK();
index d309fbc..8f1c63b 100644 (file)
@@ -69,7 +69,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
        sigset_t set;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        frame = (struct rt_sigframe __user *)regs->sp;
        pr_debug("SIG return: frame = %p\n", frame);
index 55f473b..57c3a8b 100644 (file)
@@ -42,7 +42,6 @@ struct thread_info {
        int cpu;                /* cpu we're on */
        int preempt_count;      /* 0 => preemptable, <0 => BUG */
        mm_segment_t addr_limit;        /* address limit */
-       struct restart_block restart_block;
 #ifndef CONFIG_SMP
        struct l1_scratch_task_info l1_task_info;
 #endif
@@ -58,9 +57,6 @@ struct thread_info {
        .flags          = 0,                    \
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
-       .restart_block  = {                     \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 #define init_thread_info       (init_thread_union.thread_info)
 #define init_stack             (init_thread_union.stack)
index ef27557..f2a8b54 100644 (file)
@@ -44,7 +44,7 @@ rt_restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *p
        int err = 0;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
 #define RESTORE(x) err |= __get_user(regs->x, &sc->sc_##x)
 
index d4e9ef8..584e253 100644 (file)
@@ -45,7 +45,6 @@ struct thread_info {
        int                     cpu;            /* cpu we're on */
        int                     preempt_count;  /* 0 = preemptable, <0 = BUG */
        mm_segment_t            addr_limit;     /* thread address space */
-       struct restart_block    restart_block;
 };
 
 /*
@@ -61,9 +60,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block  = {                     \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index fe68226..3c4bb5a 100644 (file)
@@ -68,7 +68,7 @@ asmlinkage int do_rt_sigreturn(struct pt_regs *regs)
        sigset_t set;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /*
         * Since we stacked the signal on a dword boundary,
index 9b32d33..74d7ba3 100644 (file)
@@ -67,7 +67,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
        unsigned long old_usp;
 
         /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /* restore the regs from &sc->regs (same as sc, since regs is first)
         * (sc is already checked for VERIFY_READ since the sigframe was
index 78ce3b1..870e3e0 100644 (file)
@@ -59,7 +59,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
        unsigned long old_usp;
 
         /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /*
         * Restore the registers from &sc->regs. sc is already checked
index 55dede1..7286db5 100644 (file)
@@ -38,7 +38,6 @@ struct thread_info {
                                                   0-0xBFFFFFFF for user-thead
                                                   0-0xFFFFFFFF for kernel-thread
                                                */
-       struct restart_block    restart_block;
        __u8                    supervisor_stack[0];
 };
 
@@ -56,9 +55,6 @@ struct thread_info {
        .cpu            = 0,                            \
        .preempt_count  = INIT_PREEMPT_COUNT,           \
        .addr_limit     = KERNEL_DS,                    \
-       .restart_block = {                              \
-                      .fn = do_no_restart_syscall,     \
-       },                                              \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index af29e17..6b917f1 100644 (file)
@@ -41,7 +41,6 @@ struct thread_info {
                                                 * 0-0xBFFFFFFF for user-thead
                                                 * 0-0xFFFFFFFF for kernel-thread
                                                 */
-       struct restart_block    restart_block;
 
        __u8                    supervisor_stack[0];
 };
@@ -65,9 +64,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 9de9684..446e89d 100644 (file)
@@ -40,7 +40,6 @@ void foo(void)
        OFFSET(TI_CPU,                  thread_info, cpu);
        OFFSET(TI_PREEMPT_COUNT,        thread_info, preempt_count);
        OFFSET(TI_ADDR_LIMIT,           thread_info, addr_limit);
-       OFFSET(TI_RESTART_BLOCK,        thread_info, restart_block);
        BLANK();
 
        /* offsets into register file storage */
index dc3d59d..336713a 100644 (file)
@@ -62,7 +62,7 @@ static int restore_sigcontext(struct sigcontext __user *sc, int *_gr8)
        unsigned long tbr, psr;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        tbr = user->i.tbr;
        psr = user->i.psr;
index a59dad3..bacd3d6 100644 (file)
@@ -56,7 +56,6 @@ struct thread_info {
         * used for syscalls somehow;
         * seems to have a function pointer and four arguments
         */
-       struct restart_block    restart_block;
        /* Points to the current pt_regs frame  */
        struct pt_regs          *regs;
        /*
@@ -83,9 +82,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = 1,                    \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
        .sp = 0,                                \
        .regs = NULL,                   \
 }
index eadd70e..b039a62 100644 (file)
@@ -239,7 +239,7 @@ asmlinkage int sys_rt_sigreturn(void)
        sigset_t blocked;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        frame = (struct rt_sigframe __user *)pt_psp(regs);
        if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
index 5b17418..c16f21a 100644 (file)
@@ -27,7 +27,6 @@ struct thread_info {
        __u32 status;                   /* Thread synchronous flags */
        mm_segment_t addr_limit;        /* user-level address space limit */
        int preempt_count;              /* 0=premptable, <0=BUG; will also serve as bh-counter */
-       struct restart_block restart_block;
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
        __u64 ac_stamp;
        __u64 ac_leave;
@@ -46,9 +45,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .addr_limit     = KERNEL_DS,            \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #ifndef ASM_OFFSETS_C
index 6d92170..b3a124d 100644 (file)
@@ -46,7 +46,7 @@ restore_sigcontext (struct sigcontext __user *sc, struct sigscratch *scr)
        long err;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /* restore scratch that always needs gets updated during signal delivery: */
        err  = __get_user(flags, &sc->sc_flags);
index 0017170..32422d0 100644 (file)
@@ -34,7 +34,6 @@ struct thread_info {
                                                   0-0xBFFFFFFF for user-thread
                                                   0-0xFFFFFFFF for kernel-thread
                                                */
-       struct restart_block    restart_block;
 
        __u8                    supervisor_stack[0];
 };
@@ -49,7 +48,6 @@ struct thread_info {
 #define TI_CPU         0x00000010
 #define TI_PRE_COUNT   0x00000014
 #define TI_ADDR_LIMIT  0x00000018
-#define TI_RESTART_BLOCK 0x000001C
 
 #endif
 
@@ -68,9 +66,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 95408b8..7736c66 100644 (file)
@@ -48,7 +48,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
        unsigned int err = 0;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
 #define COPY(x)                err |= __get_user(regs->x, &sc->sc_##x)
        COPY(r4);
index 21a4784..c54256e 100644 (file)
@@ -31,7 +31,6 @@ struct thread_info {
        int                     preempt_count;  /* 0 => preemptable, <0 => BUG */
        __u32                   cpu;            /* should always be 0 on m68k */
        unsigned long           tp_value;       /* thread pointer */
-       struct restart_block    restart_block;
 };
 #endif /* __ASSEMBLY__ */
 
@@ -41,9 +40,6 @@ struct thread_info {
        .exec_domain    = &default_exec_domain, \
        .addr_limit     = KERNEL_DS,            \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_stack             (init_thread_union.stack)
index 967a8b7..d717928 100644 (file)
@@ -655,7 +655,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *usc, void __u
        int err = 0;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /* get previous context */
        if (copy_from_user(&context, usc, sizeof(context)))
@@ -693,7 +693,7 @@ rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
        int err;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        err = __get_user(temp, &uc->uc_mcontext.version);
        if (temp != MCONTEXT_VERSION)
index 4771133..afb3ca4 100644 (file)
@@ -35,9 +35,8 @@ struct thread_info {
        int preempt_count;      /* 0 => preemptable, <0 => BUG */
 
        mm_segment_t addr_limit;        /* thread address space */
-       struct restart_block restart_block;
 
-       u8 supervisor_stack[0];
+       u8 supervisor_stack[0] __aligned(8);
 };
 
 #else /* !__ASSEMBLY__ */
@@ -74,9 +73,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 0d100d5..ce49d42 100644 (file)
@@ -48,7 +48,7 @@ static int restore_sigcontext(struct pt_regs *regs,
        int err;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        err = metag_gp_regs_copyin(regs, 0, sizeof(struct user_gp_regs), NULL,
                                   &sc->regs);
index 8c9d365..b699fbd 100644 (file)
@@ -71,7 +71,6 @@ struct thread_info {
        __u32                   cpu; /* current CPU */
        __s32                   preempt_count; /* 0 => preemptable,< 0 => BUG*/
        mm_segment_t            addr_limit; /* thread address space */
-       struct restart_block    restart_block;
 
        struct cpu_context      cpu_context;
 };
@@ -87,9 +86,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 2357060..a1cbaf9 100644 (file)
@@ -89,7 +89,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
        int rval;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
                goto badframe;
index e4440f9..9e1295f 100644 (file)
@@ -34,7 +34,6 @@ struct thread_info {
                                                 * 0x7fffffff for user-thead
                                                 * 0xffffffff for kernel-thread
                                                 */
-       struct restart_block    restart_block;
        struct pt_regs          *regs;
        long                    syscall;        /* syscall number */
 };
@@ -50,9 +49,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block  = {                     \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index b1d84bd..3b2dfdb 100644 (file)
@@ -98,7 +98,6 @@ void output_thread_info_defines(void)
        OFFSET(TI_CPU, thread_info, cpu);
        OFFSET(TI_PRE_COUNT, thread_info, preempt_count);
        OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit);
-       OFFSET(TI_RESTART_BLOCK, thread_info, restart_block);
        OFFSET(TI_REGS, thread_info, regs);
        DEFINE(_THREAD_SIZE, THREAD_SIZE);
        DEFINE(_THREAD_MASK, THREAD_MASK);
index 545bf11..6a28c79 100644 (file)
@@ -243,7 +243,7 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
        int i;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        err |= __get_user(regs->cp0_epc, &sc->sc_pc);
 
index d69179c..19a7705 100644 (file)
@@ -220,7 +220,7 @@ static int restore_sigcontext32(struct pt_regs *regs,
        int i;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        err |= __get_user(regs->cp0_epc, &sc->sc_pc);
        err |= __get_user(regs->hi, &sc->sc_mdhi);
index bf280ea..c1c374f 100644 (file)
@@ -50,7 +50,6 @@ struct thread_info {
                                                   0-0xBFFFFFFF for user-thead
                                                   0-0xFFFFFFFF for kernel-thread
                                                */
-       struct restart_block    restart_block;
 
        __u8                    supervisor_stack[0];
 };
@@ -80,9 +79,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 47b3bb0..d780670 100644 (file)
@@ -28,7 +28,6 @@ void foo(void)
        OFFSET(TI_cpu,                  thread_info, cpu);
        OFFSET(TI_preempt_count,        thread_info, preempt_count);
        OFFSET(TI_addr_limit,           thread_info, addr_limit);
-       OFFSET(TI_restart_block,        thread_info, restart_block);
        BLANK();
 
        OFFSET(REG_D0,                  pt_regs, d0);
index a6c0858..8609845 100644 (file)
@@ -40,7 +40,7 @@ static int restore_sigcontext(struct pt_regs *regs,
        unsigned int err = 0;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        if (is_using_fpu(current))
                fpu_kill_state(current);
index d797acc..875f084 100644 (file)
@@ -57,7 +57,6 @@ struct thread_info {
                                               0-0x7FFFFFFF for user-thead
                                               0-0xFFFFFFFF for kernel-thread
                                             */
-       struct restart_block    restart_block;
        __u8                    supervisor_stack[0];
 
        /* saved context data */
@@ -79,9 +78,6 @@ struct thread_info {
        .cpu            = 0,                            \
        .preempt_count  = 1,                            \
        .addr_limit     = KERNEL_DS,                    \
-       .restart_block  = {                             \
-                         .fn = do_no_restart_syscall,  \
-       },                                              \
        .ksp            = 0,                            \
 }
 
index 7d1b823..4112175 100644 (file)
@@ -46,7 +46,7 @@ static int restore_sigcontext(struct pt_regs *regs,
        int err = 0;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /*
         * Restore the regs from &sc->regs.
index a846118..fb13e38 100644 (file)
@@ -14,7 +14,6 @@ struct thread_info {
        mm_segment_t addr_limit;        /* user-level address space limit */
        __u32 cpu;                      /* current CPU */
        int preempt_count;              /* 0=premptable, <0=BUG; will also serve as bh-counter */
-       struct restart_block restart_block;
 };
 
 #define INIT_THREAD_INFO(tsk)                  \
@@ -25,9 +24,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .addr_limit     = KERNEL_DS,            \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
-       .restart_block  = {                     \
-               .fn = do_no_restart_syscall     \
-       }                                       \
 }
 
 #define init_thread_info        (init_thread_union.thread_info)
index 012d4fa..9b910a0 100644 (file)
@@ -99,7 +99,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
                sigframe_size = PARISC_RT_SIGFRAME_SIZE32;
 #endif
 
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /* Unwind the user stack to get the rt_sigframe structure. */
        frame = (struct rt_sigframe __user *)
index e8abc83..7248979 100644 (file)
@@ -43,7 +43,6 @@ struct thread_info {
        int             cpu;                    /* cpu we're on */
        int             preempt_count;          /* 0 => preemptable,
                                                   <0 => BUG */
-       struct restart_block restart_block;
        unsigned long   local_flags;            /* private flags for thread */
 
        /* low level flags - has atomic operations done on it */
@@ -59,9 +58,6 @@ struct thread_info {
        .exec_domain =  &default_exec_domain,   \
        .cpu =          0,                      \
        .preempt_count = INIT_PREEMPT_COUNT,    \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
        .flags =        0,                      \
 }
 
index b171001..d3a831a 100644 (file)
@@ -1231,7 +1231,7 @@ long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
        int tm_restore = 0;
 #endif
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        rt_sf = (struct rt_sigframe __user *)
                (regs->gpr[1] + __SIGNAL_FRAMESIZE + 16);
@@ -1504,7 +1504,7 @@ long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
 #endif
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        sf = (struct sigframe __user *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
        sc = &sf->sctx;
index 2cb0c94..c7c24d2 100644 (file)
@@ -666,7 +666,7 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
 #endif
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        if (!access_ok(VERIFY_READ, uc, sizeof(*uc)))
                goto badframe;
index 4d62fd5..ef1df71 100644 (file)
@@ -39,7 +39,6 @@ struct thread_info {
        unsigned long           sys_call_table; /* System call table address */
        unsigned int            cpu;            /* current CPU */
        int                     preempt_count;  /* 0 => preemptable, <0 => BUG */
-       struct restart_block    restart_block;
        unsigned int            system_call;
        __u64                   user_timer;
        __u64                   system_timer;
@@ -56,9 +55,6 @@ struct thread_info {
        .flags          = 0,                    \
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
-       .restart_block  = {                     \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 34d5fa7..bc1df12 100644 (file)
@@ -209,7 +209,7 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs)
        int i;
 
        /* Alwys make any pending restarted system call return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        if (__copy_from_user(&user_sregs, &sregs->regs, sizeof(user_sregs)))
                return -EFAULT;
index 6a2ac25..b3ae6f7 100644 (file)
@@ -162,7 +162,7 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
        _sigregs user_sregs;
 
        /* Alwys make any pending restarted system call return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        if (__copy_from_user(&user_sregs, sregs, sizeof(user_sregs)))
                return -EFAULT;
index 656b7ad..33864fa 100644 (file)
@@ -42,7 +42,6 @@ struct thread_info {
         * 0-0xFFFFFFFF for kernel-thread
         */
        mm_segment_t            addr_limit;
-       struct restart_block    restart_block;
        struct pt_regs          *regs;
 };
 
@@ -58,9 +57,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = 1,                    \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block  = {                     \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 57788f4..b4d5214 100644 (file)
@@ -106,7 +106,6 @@ void output_thread_info_defines(void)
        OFFSET(TI_CPU, thread_info, cpu);
        OFFSET(TI_PRE_COUNT, thread_info, preempt_count);
        OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit);
-       OFFSET(TI_RESTART_BLOCK, thread_info, restart_block);
        OFFSET(TI_REGS, thread_info, regs);
        DEFINE(KERNEL_STACK_SIZE, THREAD_SIZE);
        DEFINE(KERNEL_STACK_MASK, THREAD_MASK);
index 1651807..e381c8c 100644 (file)
@@ -141,7 +141,7 @@ score_rt_sigreturn(struct pt_regs *regs)
        int sig;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        frame = (struct rt_sigframe __user *) regs->regs[0];
        if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
index ad27ffa..657c039 100644 (file)
@@ -33,7 +33,6 @@ struct thread_info {
        __u32                   cpu;
        int                     preempt_count; /* 0 => preemptable, <0 => BUG */
        mm_segment_t            addr_limit;     /* thread address space */
-       struct restart_block    restart_block;
        unsigned long           previous_sp;    /* sp of previous stack in case
                                                   of nested IRQ stacks */
        __u8                    supervisor_stack[0];
@@ -63,9 +62,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block  = {                     \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 08a2be7..542225f 100644 (file)
@@ -25,7 +25,6 @@ int main(void)
        DEFINE(TI_FLAGS,        offsetof(struct thread_info, flags));
        DEFINE(TI_CPU,          offsetof(struct thread_info, cpu));
        DEFINE(TI_PRE_COUNT,    offsetof(struct thread_info, preempt_count));
-       DEFINE(TI_RESTART_BLOCK,offsetof(struct thread_info, restart_block));
        DEFINE(TI_SIZE,         sizeof(struct thread_info));
 
 #ifdef CONFIG_HIBERNATION
index 2f002b2..0b34f2a 100644 (file)
@@ -156,7 +156,7 @@ asmlinkage int sys_sigreturn(void)
        int r0;
 
         /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
                goto badframe;
@@ -186,7 +186,7 @@ asmlinkage int sys_rt_sigreturn(void)
        int r0;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
                goto badframe;
index 897abe7..71993c6 100644 (file)
@@ -260,7 +260,7 @@ asmlinkage int sys_sigreturn(unsigned long r2, unsigned long r3,
        long long ret;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
                goto badframe;
@@ -294,7 +294,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r2, unsigned long r3,
        long long ret;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
                goto badframe;
index 025c984..fd7bd0a 100644 (file)
@@ -47,8 +47,6 @@ struct thread_info {
        struct reg_window32     reg_window[NSWINS];     /* align for ldd! */
        unsigned long           rwbuf_stkptrs[NSWINS];
        unsigned long           w_saved;
-
-       struct restart_block    restart_block;
 };
 
 /*
@@ -62,9 +60,6 @@ struct thread_info {
        .flags          =       0,                      \
        .cpu            =       0,                      \
        .preempt_count  =       INIT_PREEMPT_COUNT,     \
-       .restart_block  = {                             \
-               .fn     =       do_no_restart_syscall,  \
-       },                                              \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
@@ -103,7 +98,6 @@ register struct thread_info *current_thread_info_reg asm("g6");
 #define TI_REG_WINDOW  0x30
 #define TI_RWIN_SPTRS  0x230
 #define TI_W_SAVED     0x250
-/* #define TI_RESTART_BLOCK 0x25n */ /* Nobody cares */
 
 /*
  * thread information flag bit numbers
index 798f027..ff45516 100644 (file)
@@ -58,8 +58,6 @@ struct thread_info {
        unsigned long           gsr[7];
        unsigned long           xfsr[7];
 
-       struct restart_block    restart_block;
-
        struct pt_regs          *kern_una_regs;
        unsigned int            kern_una_insn;
 
@@ -92,10 +90,9 @@ struct thread_info {
 #define TI_RWIN_SPTRS  0x000003c8
 #define TI_GSR         0x00000400
 #define TI_XFSR                0x00000438
-#define TI_RESTART_BLOCK 0x00000470
-#define TI_KUNA_REGS   0x000004a0
-#define TI_KUNA_INSN   0x000004a8
-#define TI_FPREGS      0x000004c0
+#define TI_KUNA_REGS   0x00000470
+#define TI_KUNA_INSN   0x00000478
+#define TI_FPREGS      0x00000480
 
 /* We embed this in the uppermost byte of thread_info->flags */
 #define FAULT_CODE_WRITE       0x01    /* Write access, implies D-TLB     */
@@ -124,9 +121,6 @@ struct thread_info {
        .current_ds     =       ASI_P,                  \
        .exec_domain    =       &default_exec_domain,   \
        .preempt_count  =       INIT_PREEMPT_COUNT,     \
-       .restart_block  = {                             \
-               .fn     =       do_no_restart_syscall,  \
-       },                                              \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 62deba7..4eed773 100644 (file)
@@ -150,7 +150,7 @@ void do_sigreturn32(struct pt_regs *regs)
        int err, i;
        
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        synchronize_user_stack();
 
@@ -235,7 +235,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
        int err, i;
        
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        synchronize_user_stack();
        regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL;
index 9ee72fc..52aa5e4 100644 (file)
@@ -70,7 +70,7 @@ asmlinkage void do_sigreturn(struct pt_regs *regs)
        int err;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        synchronize_user_stack();
 
index 1a69998..d88beff 100644 (file)
@@ -254,7 +254,7 @@ void do_rt_sigreturn(struct pt_regs *regs)
        int err;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        synchronize_user_stack ();
        sf = (struct rt_signal_frame __user *)
index 981a769..a27651e 100644 (file)
@@ -2730,8 +2730,6 @@ void __init trap_init(void)
                     TI_NEW_CHILD != offsetof(struct thread_info, new_child) ||
                     TI_CURRENT_DS != offsetof(struct thread_info,
                                                current_ds) ||
-                    TI_RESTART_BLOCK != offsetof(struct thread_info,
-                                                 restart_block) ||
                     TI_KUNA_REGS != offsetof(struct thread_info,
                                              kern_una_regs) ||
                     TI_KUNA_INSN != offsetof(struct thread_info,
index 48e4fd0..96c14c1 100644 (file)
@@ -36,7 +36,6 @@ struct thread_info {
 
        mm_segment_t            addr_limit;     /* thread address space
                                                   (KERNEL_DS or USER_DS) */
-       struct restart_block    restart_block;
        struct single_step_state *step_state;   /* single step state
                                                   (if non-zero) */
        int                     align_ctl;      /* controls unaligned access */
@@ -57,9 +56,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block  = {                     \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
        .step_state     = NULL,                 \
        .align_ctl      = 0,                    \
 }
index bb0a9ce..8a524e3 100644 (file)
@@ -48,7 +48,7 @@ int restore_sigcontext(struct pt_regs *regs,
        int err;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /*
         * Enforce that sigcontext is like pt_regs, and doesn't mess
index 1c5b2a8..e04114c 100644 (file)
@@ -22,7 +22,6 @@ struct thread_info {
        mm_segment_t            addr_limit;     /* thread address space:
                                                   0-0xBFFFFFFF for user
                                                   0-0xFFFFFFFF for kernel */
-       struct restart_block    restart_block;
        struct thread_info      *real_thread;    /* Points to non-IRQ stack */
 };
 
@@ -34,9 +33,6 @@ struct thread_info {
        .cpu =          0,                      \
        .preempt_count = INIT_PREEMPT_COUNT,    \
        .addr_limit =   KERNEL_DS,              \
-       .restart_block =  {                     \
-               .fn =  do_no_restart_syscall,   \
-       },                                      \
        .real_thread = NULL,                    \
 }
 
index af36d8e..63e2839 100644 (file)
@@ -79,7 +79,6 @@ struct thread_info {
 #ifdef CONFIG_UNICORE_FPU_F64
        struct fp_state         fpstate __attribute__((aligned(8)));
 #endif
-       struct restart_block    restart_block;
 };
 
 #define INIT_THREAD_INFO(tsk)                                          \
@@ -89,9 +88,6 @@ struct thread_info {
        .flags          = 0,                                            \
        .preempt_count  = INIT_PREEMPT_COUNT,                           \
        .addr_limit     = KERNEL_DS,                                    \
-       .restart_block  = {                                             \
-               .fn     = do_no_restart_syscall,                        \
-       },                                                              \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 7c8fb70..d329f85 100644 (file)
@@ -105,7 +105,7 @@ asmlinkage int __sys_rt_sigreturn(struct pt_regs *regs)
        struct rt_sigframe __user *frame;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        /*
         * Since we stacked the signal on a 64-bit boundary,
index f9e181a..d0165c9 100644 (file)
@@ -169,7 +169,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
        u32 tmp;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        get_user_try {
                /*
index e82e95a..1d4e4f2 100644 (file)
@@ -31,7 +31,6 @@ struct thread_info {
        __u32                   cpu;            /* current CPU */
        int                     saved_preempt_count;
        mm_segment_t            addr_limit;
-       struct restart_block    restart_block;
        void __user             *sysenter_return;
        unsigned int            sig_on_uaccess_error:1;
        unsigned int            uaccess_err:1;  /* uaccess failed */
@@ -45,9 +44,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .saved_preempt_count = INIT_PREEMPT_COUNT,      \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 2a33c8f..e504246 100644 (file)
@@ -69,7 +69,7 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
        unsigned int err = 0;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        get_user_try {
 
index 79d8245..0c8c32b 100644 (file)
@@ -157,7 +157,7 @@ static int copy_sc_from_user(struct pt_regs *regs,
        int err, pid;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        err = copy_from_user(&sc, from, sizeof(sc));
        if (err)
index 470153e..a9b5d3b 100644 (file)
@@ -51,7 +51,6 @@ struct thread_info {
        __s32                   preempt_count;  /* 0 => preemptable,< 0 => BUG*/
 
        mm_segment_t            addr_limit;     /* thread address space */
-       struct restart_block    restart_block;
 
        unsigned long           cpenable;
 
@@ -72,7 +71,6 @@ struct thread_info {
 #define TI_CPU          0x00000010
 #define TI_PRE_COUNT    0x00000014
 #define TI_ADDR_LIMIT   0x00000018
-#define TI_RESTART_BLOCK 0x000001C
 
 #endif
 
@@ -90,9 +88,6 @@ struct thread_info {
        .cpu            = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
        .addr_limit     = KERNEL_DS,            \
-       .restart_block = {                      \
-               .fn = do_no_restart_syscall,    \
-       },                                      \
 }
 
 #define init_thread_info       (init_thread_union.thread_info)
index 4612321..3d733ba 100644 (file)
@@ -245,7 +245,7 @@ asmlinkage long xtensa_rt_sigreturn(long a0, long a1, long a2, long a3,
        int ret;
 
        /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
+       current->restart_block.fn = do_no_restart_syscall;
 
        if (regs->depc > 64)
                panic("rt_sigreturn in double exception!\n");
index 467bb1c..f684c75 100644 (file)
@@ -971,7 +971,7 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds,
        if (ret == -EINTR) {
                struct restart_block *restart_block;
 
-               restart_block = &current_thread_info()->restart_block;
+               restart_block = &current->restart_block;
                restart_block->fn = do_restart_poll;
                restart_block->poll.ufds = ufds;
                restart_block->poll.nfds = nfds;
index 3037fc0..d3d43ec 100644 (file)
@@ -193,6 +193,9 @@ extern struct task_group root_task_group;
        .nr_cpus_allowed= NR_CPUS,                                      \
        .mm             = NULL,                                         \
        .active_mm      = &init_mm,                                     \
+       .restart_block = {                                              \
+               .fn = do_no_restart_syscall,                            \
+       },                                                              \
        .se             = {                                             \
                .group_node     = LIST_HEAD_INIT(tsk.se.group_node),    \
        },                                                              \
index 8db31ef..22ee0d5 100644 (file)
@@ -1370,6 +1370,8 @@ struct task_struct {
 
        unsigned long atomic_flags; /* Flags needing atomic access. */
 
+       struct restart_block restart_block;
+
        pid_t pid;
        pid_t tgid;
 
index ebb3c36..24f0061 100644 (file)
@@ -276,8 +276,7 @@ COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp,
         * core implementation decides to return random nonsense.
         */
        if (ret == -ERESTART_RESTARTBLOCK) {
-               struct restart_block *restart
-                       = &current_thread_info()->restart_block;
+               struct restart_block *restart = &current->restart_block;
 
                restart->fn = compat_nanosleep_restart;
                restart->nanosleep.compat_rmtp = rmtp;
@@ -860,7 +859,7 @@ COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
                return -EFAULT;
 
        if (err == -ERESTART_RESTARTBLOCK) {
-               restart = &current_thread_info()->restart_block;
+               restart = &current->restart_block;
                restart->fn = compat_clock_nanosleep_restart;
                restart->nanosleep.compat_rmtp = rmtp;
        }
index 4eeb63d..2a5e383 100644 (file)
@@ -2217,7 +2217,7 @@ retry:
        if (!abs_time)
                goto out;
 
-       restart = &current_thread_info()->restart_block;
+       restart = &current->restart_block;
        restart->fn = futex_wait_restart;
        restart->futex.uaddr = uaddr;
        restart->futex.val = val;
index 16a3052..33a5275 100644 (file)
@@ -2501,7 +2501,7 @@ EXPORT_SYMBOL(unblock_all_signals);
  */
 SYSCALL_DEFINE0(restart_syscall)
 {
-       struct restart_block *restart = &current_thread_info()->restart_block;
+       struct restart_block *restart = &current->restart_block;
        return restart->fn(restart);
 }
 
index a7077d3..1b001ed 100644 (file)
@@ -788,7 +788,7 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
                        goto out;
        }
 
-       restart = &current_thread_info()->restart_block;
+       restart = &current->restart_block;
        restart->fn = alarm_timer_nsleep_restart;
        restart->nanosleep.clockid = type;
        restart->nanosleep.expires = exp.tv64;
index 3f5e183..bee0c1f 100644 (file)
@@ -1583,7 +1583,7 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
                        goto out;
        }
 
-       restart = &current_thread_info()->restart_block;
+       restart = &current->restart_block;
        restart->fn = hrtimer_nanosleep_restart;
        restart->nanosleep.clockid = t.timer.base->clockid;
        restart->nanosleep.rmtp = rmtp;
index a16b678..0075da7 100644 (file)
@@ -1334,8 +1334,7 @@ static long posix_cpu_nsleep_restart(struct restart_block *restart_block);
 static int posix_cpu_nsleep(const clockid_t which_clock, int flags,
                            struct timespec *rqtp, struct timespec __user *rmtp)
 {
-       struct restart_block *restart_block =
-               &current_thread_info()->restart_block;
+       struct restart_block *restart_block = &current->restart_block;
        struct itimerspec it;
        int error;