aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-09-06 15:48:11 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-30 23:03:02 -0400
commit65f22a906e154e8086ed561904d09c3586de85f4 (patch)
tree8e4b6be4ce56e828e04311579379211358f23170 /arch/s390
parent1f02ab4a237086095bd584f3446da307ac2d02e6 (diff)
s390: fold execve_tail() into start_thread(), convert to generic sys_execve()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/processor.h3
-rw-r--r--arch/s390/include/asm/unistd.h1
-rw-r--r--arch/s390/kernel/compat_linux.c26
-rw-r--r--arch/s390/kernel/compat_linux.h2
-rw-r--r--arch/s390/kernel/compat_wrapper.S2
-rw-r--r--arch/s390/kernel/entry.S3
-rw-r--r--arch/s390/kernel/entry.h3
-rw-r--r--arch/s390/kernel/entry64.S1
-rw-r--r--arch/s390/kernel/process.c25
9 files changed, 5 insertions, 61 deletions
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 11e4e3236937..0bc77619c3a3 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -32,6 +32,7 @@ static inline void get_cpu_id(struct cpuid *ptr)
32extern void s390_adjust_jiffies(void); 32extern void s390_adjust_jiffies(void);
33extern const struct seq_operations cpuinfo_op; 33extern const struct seq_operations cpuinfo_op;
34extern int sysctl_ieee_emulation_warnings; 34extern int sysctl_ieee_emulation_warnings;
35extern void execve_tail(void);
35 36
36/* 37/*
37 * User space process size: 2GB for 31 bit, 4TB or 8PT for 64 bit. 38 * User space process size: 2GB for 31 bit, 4TB or 8PT for 64 bit.
@@ -114,6 +115,7 @@ struct stack_frame {
114 regs->psw.mask = psw_user_bits | PSW_MASK_EA | PSW_MASK_BA; \ 115 regs->psw.mask = psw_user_bits | PSW_MASK_EA | PSW_MASK_BA; \
115 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ 116 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \
116 regs->gprs[15] = new_stackp; \ 117 regs->gprs[15] = new_stackp; \
118 execve_tail(); \
117} while (0) 119} while (0)
118 120
119#define start_thread31(regs, new_psw, new_stackp) do { \ 121#define start_thread31(regs, new_psw, new_stackp) do { \
@@ -123,6 +125,7 @@ struct stack_frame {
123 __tlb_flush_mm(current->mm); \ 125 __tlb_flush_mm(current->mm); \
124 crst_table_downgrade(current->mm, 1UL << 31); \ 126 crst_table_downgrade(current->mm, 1UL << 31); \
125 update_mm(current->mm, current); \ 127 update_mm(current->mm, current); \
128 execve_tail(); \
126} while (0) 129} while (0)
127 130
128/* Forward declaration, a strange C thing */ 131/* Forward declaration, a strange C thing */
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index 6756e78f4808..9afacff38edc 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -415,6 +415,7 @@
415# define __ARCH_WANT_COMPAT_SYS_TIME 415# define __ARCH_WANT_COMPAT_SYS_TIME
416# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 416# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
417# endif 417# endif
418#define __ARCH_WANT_SYS_EXECVE
418 419
419/* 420/*
420 * "Conditional" syscalls 421 * "Conditional" syscalls
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index f606d935f495..d03d733dadfe 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -420,32 +420,6 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
420 return ret; 420 return ret;
421} 421}
422 422
423/*
424 * sys32_execve() executes a new program after the asm stub has set
425 * things up for us. This should basically do what I want it to.
426 */
427asmlinkage long sys32_execve(const char __user *name, compat_uptr_t __user *argv,
428 compat_uptr_t __user *envp)
429{
430 struct pt_regs *regs = task_pt_regs(current);
431 char *filename;
432 long rc;
433
434 filename = getname(name);
435 rc = PTR_ERR(filename);
436 if (IS_ERR(filename))
437 return rc;
438 rc = compat_do_execve(filename, argv, envp, regs);
439 if (rc)
440 goto out;
441 current->thread.fp_regs.fpc=0;
442 asm volatile("sfpc %0,0" : : "d" (0));
443 rc = regs->gprs[2];
444out:
445 putname(filename);
446 return rc;
447}
448
449asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf, 423asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
450 size_t count, u32 poshi, u32 poslo) 424 size_t count, u32 poshi, u32 poslo)
451{ 425{
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 9635d759c2b9..5daff1d34b8e 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -193,8 +193,6 @@ long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
193 compat_sigset_t __user *oset, size_t sigsetsize); 193 compat_sigset_t __user *oset, size_t sigsetsize);
194long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize); 194long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize);
195long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo); 195long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo);
196long sys32_execve(const char __user *name, compat_uptr_t __user *argv,
197 compat_uptr_t __user *envp);
198long sys32_init_module(void __user *umod, unsigned long len, 196long sys32_init_module(void __user *umod, unsigned long len,
199 const char __user *uargs); 197 const char __user *uargs);
200long sys32_delete_module(const char __user *name_user, unsigned int flags); 198long sys32_delete_module(const char __user *name_user, unsigned int flags);
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 2d82cfcbce5b..cf1d60f46922 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1576,7 +1576,7 @@ ENTRY(sys32_execve_wrapper)
1576 llgtr %r2,%r2 # char * 1576 llgtr %r2,%r2 # char *
1577 llgtr %r3,%r3 # compat_uptr_t * 1577 llgtr %r3,%r3 # compat_uptr_t *
1578 llgtr %r4,%r4 # compat_uptr_t * 1578 llgtr %r4,%r4 # compat_uptr_t *
1579 jg sys32_execve # branch to system call 1579 jg compat_sys_execve # branch to system call
1580 1580
1581ENTRY(sys_fanotify_init_wrapper) 1581ENTRY(sys_fanotify_init_wrapper)
1582 llgfr %r2,%r2 # unsigned int 1582 llgfr %r2,%r2 # unsigned int
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 870bad6d56fc..6286985a1039 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -368,8 +368,6 @@ ENTRY(kernel_execve)
368 l %r12,__LC_THREAD_INFO 368 l %r12,__LC_THREAD_INFO
369 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) 369 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15)
370 ssm __LC_SVC_NEW_PSW # reenable interrupts 370 ssm __LC_SVC_NEW_PSW # reenable interrupts
371 l %r1,BASED(.Lexecve_tail)
372 basr %r14,%r1 # call execve_tail
373 j sysc_return 371 j sysc_return
374 372
375/* 373/*
@@ -932,7 +930,6 @@ cleanup_idle_wait:
932.Ldo_notify_resume: .long do_notify_resume 930.Ldo_notify_resume: .long do_notify_resume
933.Ldo_per_trap: .long do_per_trap 931.Ldo_per_trap: .long do_per_trap
934.Ldo_execve: .long do_execve 932.Ldo_execve: .long do_execve
935.Lexecve_tail: .long execve_tail
936.Ljump_table: .long pgm_check_table 933.Ljump_table: .long pgm_check_table
937.Lschedule: .long schedule 934.Lschedule: .long schedule
938#ifdef CONFIG_PREEMPT 935#ifdef CONFIG_PREEMPT
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index a5f4dc42a5db..d0d3f69a7346 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -58,9 +58,6 @@ long sys_fork(void);
58long sys_clone(unsigned long newsp, unsigned long clone_flags, 58long sys_clone(unsigned long newsp, unsigned long clone_flags,
59 int __user *parent_tidptr, int __user *child_tidptr); 59 int __user *parent_tidptr, int __user *child_tidptr);
60long sys_vfork(void); 60long sys_vfork(void);
61void execve_tail(void);
62long sys_execve(const char __user *name, const char __user *const __user *argv,
63 const char __user *const __user *envp);
64long sys_sigsuspend(int history0, int history1, old_sigset_t mask); 61long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
65long sys_sigaction(int sig, const struct old_sigaction __user *act, 62long sys_sigaction(int sig, const struct old_sigaction __user *act,
66 struct old_sigaction __user *oact); 63 struct old_sigaction __user *oact);
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 349b7eeb348a..1f776f2edda5 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -386,7 +386,6 @@ ENTRY(kernel_execve)
386 lg %r12,__LC_THREAD_INFO 386 lg %r12,__LC_THREAD_INFO
387 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 387 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
388 ssm __LC_SVC_NEW_PSW # reenable interrupts 388 ssm __LC_SVC_NEW_PSW # reenable interrupts
389 brasl %r14,execve_tail
390 j sysc_return 389 j sysc_return
391 390
392/* 391/*
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 733175373a4c..e540251e1dd1 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -250,31 +250,6 @@ asmlinkage void execve_tail(void)
250} 250}
251 251
252/* 252/*
253 * sys_execve() executes a new program.
254 */
255SYSCALL_DEFINE3(execve, const char __user *, name,
256 const char __user *const __user *, argv,
257 const char __user *const __user *, envp)
258{
259 struct pt_regs *regs = task_pt_regs(current);
260 char *filename;
261 long rc;
262
263 filename = getname(name);
264 rc = PTR_ERR(filename);
265 if (IS_ERR(filename))
266 return rc;
267 rc = do_execve(filename, argv, envp, regs);
268 if (rc)
269 goto out;
270 execve_tail();
271 rc = regs->gprs[2];
272out:
273 putname(filename);
274 return rc;
275}
276
277/*
278 * fill in the FPU structure for a core dump. 253 * fill in the FPU structure for a core dump.
279 */ 254 */
280int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs) 255int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs)