aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/elf.h8
-rw-r--r--arch/s390/kernel/compat_linux.c102
-rw-r--r--arch/s390/kernel/compat_linux.h4
-rw-r--r--arch/s390/kernel/compat_wrapper.S12
-rw-r--r--arch/s390/kernel/syscalls.S4
5 files changed, 11 insertions, 119 deletions
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
index 3cad56923815..261785ab5b22 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -166,13 +166,11 @@ extern char elf_platform[];
166#define ELF_PLATFORM (elf_platform) 166#define ELF_PLATFORM (elf_platform)
167 167
168#ifndef __s390x__ 168#ifndef __s390x__
169#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 169#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
170#else /* __s390x__ */ 170#else /* __s390x__ */
171#define SET_PERSONALITY(ex, ibcs2) \ 171#define SET_PERSONALITY(ex) \
172do { \ 172do { \
173 if (ibcs2) \ 173 if (current->personality != PER_LINUX32) \
174 set_personality(PER_SVR4); \
175 else if (current->personality != PER_LINUX32) \
176 set_personality(PER_LINUX); \ 174 set_personality(PER_LINUX); \
177 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ 175 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
178 set_thread_flag(TIF_31BIT); \ 176 set_thread_flag(TIF_31BIT); \
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 98e246dc0233..4646382af34f 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -279,22 +279,6 @@ asmlinkage long sys32_getegid16(void)
279 return high2lowgid(current->egid); 279 return high2lowgid(current->egid);
280} 280}
281 281
282/* 32-bit timeval and related flotsam. */
283
284static inline long get_tv32(struct timeval *o, struct compat_timeval __user *i)
285{
286 return (!access_ok(VERIFY_READ, o, sizeof(*o)) ||
287 (__get_user(o->tv_sec, &i->tv_sec) ||
288 __get_user(o->tv_usec, &i->tv_usec)));
289}
290
291static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
292{
293 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
294 (__put_user(i->tv_sec, &o->tv_sec) ||
295 __put_user(i->tv_usec, &o->tv_usec)));
296}
297
298/* 282/*
299 * sys32_ipc() is the de-multiplexer for the SysV IPC calls in 32bit emulation. 283 * sys32_ipc() is the de-multiplexer for the SysV IPC calls in 32bit emulation.
300 * 284 *
@@ -362,41 +346,6 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
362 return sys_ftruncate(fd, (high << 32) | low); 346 return sys_ftruncate(fd, (high << 32) | low);
363} 347}
364 348
365int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
366{
367 compat_ino_t ino;
368 int err;
369
370 if (!old_valid_dev(stat->dev) || !old_valid_dev(stat->rdev))
371 return -EOVERFLOW;
372
373 ino = stat->ino;
374 if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
375 return -EOVERFLOW;
376
377 err = put_user(old_encode_dev(stat->dev), &statbuf->st_dev);
378 err |= put_user(stat->ino, &statbuf->st_ino);
379 err |= put_user(stat->mode, &statbuf->st_mode);
380 err |= put_user(stat->nlink, &statbuf->st_nlink);
381 err |= put_user(high2lowuid(stat->uid), &statbuf->st_uid);
382 err |= put_user(high2lowgid(stat->gid), &statbuf->st_gid);
383 err |= put_user(old_encode_dev(stat->rdev), &statbuf->st_rdev);
384 err |= put_user(stat->size, &statbuf->st_size);
385 err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
386 err |= put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec);
387 err |= put_user(stat->mtime.tv_sec, &statbuf->st_mtime);
388 err |= put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec);
389 err |= put_user(stat->ctime.tv_sec, &statbuf->st_ctime);
390 err |= put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec);
391 err |= put_user(stat->blksize, &statbuf->st_blksize);
392 err |= put_user(stat->blocks, &statbuf->st_blocks);
393/* fixme
394 err |= put_user(0, &statbuf->__unused4[0]);
395 err |= put_user(0, &statbuf->__unused4[1]);
396*/
397 return err;
398}
399
400asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid, 349asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid,
401 struct compat_timespec __user *interval) 350 struct compat_timespec __user *interval)
402{ 351{
@@ -557,57 +506,6 @@ sys32_delete_module(const char __user *name_user, unsigned int flags)
557 506
558#endif /* CONFIG_MODULES */ 507#endif /* CONFIG_MODULES */
559 508
560/* Translations due to time_t size differences. Which affects all
561 sorts of things, like timeval and itimerval. */
562
563extern struct timezone sys_tz;
564
565asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
566{
567 if (tv) {
568 struct timeval ktv;
569 do_gettimeofday(&ktv);
570 if (put_tv32(tv, &ktv))
571 return -EFAULT;
572 }
573 if (tz) {
574 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
575 return -EFAULT;
576 }
577 return 0;
578}
579
580static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
581{
582 long usec;
583
584 if (!access_ok(VERIFY_READ, i, sizeof(*i)))
585 return -EFAULT;
586 if (__get_user(o->tv_sec, &i->tv_sec))
587 return -EFAULT;
588 if (__get_user(usec, &i->tv_usec))
589 return -EFAULT;
590 o->tv_nsec = usec * 1000;
591 return 0;
592}
593
594asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
595{
596 struct timespec kts;
597 struct timezone ktz;
598
599 if (tv) {
600 if (get_ts32(&kts, tv))
601 return -EFAULT;
602 }
603 if (tz) {
604 if (copy_from_user(&ktz, tz, sizeof(ktz)))
605 return -EFAULT;
606 }
607
608 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
609}
610
611asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf, 509asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
612 size_t count, u32 poshi, u32 poslo) 510 size_t count, u32 poshi, u32 poslo)
613{ 511{
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 05f8516366ab..836a28842900 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -202,10 +202,6 @@ long sys32_execve(void);
202long sys32_init_module(void __user *umod, unsigned long len, 202long sys32_init_module(void __user *umod, unsigned long len,
203 const char __user *uargs); 203 const char __user *uargs);
204long sys32_delete_module(const char __user *name_user, unsigned int flags); 204long sys32_delete_module(const char __user *name_user, unsigned int flags);
205long sys32_gettimeofday(struct compat_timeval __user *tv,
206 struct timezone __user *tz);
207long sys32_settimeofday(struct compat_timeval __user *tv,
208 struct timezone __user *tz);
209long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count, 205long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count,
210 u32 poshi, u32 poslo); 206 u32 poshi, u32 poslo);
211long sys32_pwrite64(unsigned int fd, const char __user *ubuf, 207long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index ee51ca9e23b5..fc2c97197a53 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -332,17 +332,17 @@ compat_sys_getrusage_wrapper:
332 llgtr %r3,%r3 # struct rusage_emu31 * 332 llgtr %r3,%r3 # struct rusage_emu31 *
333 jg compat_sys_getrusage # branch to system call 333 jg compat_sys_getrusage # branch to system call
334 334
335 .globl sys32_gettimeofday_wrapper 335 .globl compat_sys_gettimeofday_wrapper
336sys32_gettimeofday_wrapper: 336compat_sys_gettimeofday_wrapper:
337 llgtr %r2,%r2 # struct timeval_emu31 * 337 llgtr %r2,%r2 # struct timeval_emu31 *
338 llgtr %r3,%r3 # struct timezone * 338 llgtr %r3,%r3 # struct timezone *
339 jg sys32_gettimeofday # branch to system call 339 jg compat_sys_gettimeofday # branch to system call
340 340
341 .globl sys32_settimeofday_wrapper 341 .globl compat_sys_settimeofday_wrapper
342sys32_settimeofday_wrapper: 342compat_sys_settimeofday_wrapper:
343 llgtr %r2,%r2 # struct timeval_emu31 * 343 llgtr %r2,%r2 # struct timeval_emu31 *
344 llgtr %r3,%r3 # struct timezone * 344 llgtr %r3,%r3 # struct timezone *
345 jg sys32_settimeofday # branch to system call 345 jg compat_sys_settimeofday # branch to system call
346 346
347 .globl sys32_getgroups16_wrapper 347 .globl sys32_getgroups16_wrapper
348sys32_getgroups16_wrapper: 348sys32_getgroups16_wrapper:
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 3ae303914b42..2d61787949d5 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -86,8 +86,8 @@ SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper)
86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */ 86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */
87SYSCALL(sys_old_getrlimit,sys_getrlimit,compat_sys_old_getrlimit_wrapper) 87SYSCALL(sys_old_getrlimit,sys_getrlimit,compat_sys_old_getrlimit_wrapper)
88SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage_wrapper) 88SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage_wrapper)
89SYSCALL(sys_gettimeofday,sys_gettimeofday,sys32_gettimeofday_wrapper) 89SYSCALL(sys_gettimeofday,sys_gettimeofday,compat_sys_gettimeofday_wrapper)
90SYSCALL(sys_settimeofday,sys_settimeofday,sys32_settimeofday_wrapper) 90SYSCALL(sys_settimeofday,sys_settimeofday,compat_sys_settimeofday_wrapper)
91SYSCALL(sys_getgroups16,sys_ni_syscall,sys32_getgroups16_wrapper) /* 80 old getgroups16 syscall */ 91SYSCALL(sys_getgroups16,sys_ni_syscall,sys32_getgroups16_wrapper) /* 80 old getgroups16 syscall */
92SYSCALL(sys_setgroups16,sys_ni_syscall,sys32_setgroups16_wrapper) /* old setgroups16 syscall */ 92SYSCALL(sys_setgroups16,sys_ni_syscall,sys32_setgroups16_wrapper) /* old setgroups16 syscall */
93NI_SYSCALL /* old select syscall */ 93NI_SYSCALL /* old select syscall */