Skip to content

Commit 2c81fc4

Browse files
committed
s390/compat: add sync_file_range and fallocate compat syscalls
The compat syscall wrappers for sync_file_range and fallocate merged 32 bit parameters into 64 bit parameters. Therefore they did more than just the usual zero and/or sign extension of system call parameters. So convert these two wrappers to full s390 specific compat sytem calls. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
1 parent 00fcb14 commit 2c81fc4

4 files changed

Lines changed: 19 additions & 20 deletions

File tree

‎arch/s390/kernel/compat_linux.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,3 +504,17 @@ COMPAT_SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, arg
504504
a.advice = POSIX_FADV_NOREUSE;
505505
return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
506506
}
507+
508+
COMPAT_SYSCALL_DEFINE6(s390_sync_file_range, int, fd, u32, offhigh, u32, offlow,
509+
u32, nhigh, u32, nlow, unsigned int, flags)
510+
{
511+
return sys_sync_file_range(fd, ((loff_t)offhigh << 32) + offlow,
512+
((u64)nhigh << 32) + nlow, flags);
513+
}
514+
515+
COMPAT_SYSCALL_DEFINE6(s390_fallocate, int, fd, int, mode, u32, offhigh, u32, offlow,
516+
u32, lenhigh, u32, lenlow)
517+
{
518+
return sys_fallocate(fd, mode, ((loff_t)offhigh << 32) + offlow,
519+
((u64)lenhigh << 32) + lenlow);
520+
}

‎arch/s390/kernel/compat_linux.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,7 @@ long compat_sys_s390_read(unsigned int fd, char __user * buf, compat_size_t coun
110110
long compat_sys_s390_write(unsigned int fd, const char __user * buf, compat_size_t count);
111111
long compat_sys_s390_fadvise64(int fd, u32 high, u32 low, compat_size_t len, int advise);
112112
long compat_sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
113+
long compat_sys_s390_sync_file_range(int fd, u32 offhigh, u32 offlow, u32 nhigh, u32 nlow, unsigned int flags);
114+
long compat_sys_s390_fallocate(int fd, int mode, u32 offhigh, u32 offlow, u32 lenhigh, u32 lenlow);
115+
113116
#endif /* _ASM_S390X_S390_H */

‎arch/s390/kernel/compat_wrapper.S‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,6 @@ ENTRY(compat_sys_ppoll_wrapper)
317317
llgfr %r6,%r6 # size_t
318318
jg compat_sys_ppoll
319319

320-
ENTRY(sys_sync_file_range_wrapper)
321-
lgfr %r2,%r2 # int
322-
sllg %r3,%r3,32 # get high word of 64bit loff_t
323-
or %r3,%r4 # get low word of 64bit loff_t
324-
sllg %r4,%r5,32 # get high word of 64bit loff_t
325-
or %r4,%r6 # get low word of 64bit loff_t
326-
llgf %r5,164(%r15) # unsigned int
327-
jg sys_sync_file_range
328-
329320
ENTRY(compat_sys_utimes_wrapper)
330321
llgtr %r2,%r2 # char *
331322
llgtr %r3,%r3 # struct compat_timeval *
@@ -338,15 +329,6 @@ ENTRY(compat_sys_utimensat_wrapper)
338329
lgfr %r5,%r5 # int
339330
jg compat_sys_utimensat
340331

341-
ENTRY(sys_fallocate_wrapper)
342-
lgfr %r2,%r2 # int
343-
lgfr %r3,%r3 # int
344-
sllg %r4,%r4,32 # get high word of 64bit loff_t
345-
lr %r4,%r5 # get low word of 64bit loff_t
346-
sllg %r5,%r6,32 # get high word of 64bit loff_t
347-
l %r5,164(%r15) # get low word of 64bit loff_t
348-
jg sys_fallocate
349-
350332
ENTRY(compat_sys_keyctl_wrapper)
351333
llgfr %r2,%r2 # u32
352334
llgfr %r3,%r3 # u32

‎arch/s390/kernel/syscalls.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,14 @@ SYSCALL(sys_unshare,sys_unshare,compat_sys_unshare)
315315
SYSCALL(sys_set_robust_list,sys_set_robust_list,compat_sys_set_robust_list)
316316
SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list)
317317
SYSCALL(sys_splice,sys_splice,compat_sys_splice)
318-
SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper)
318+
SYSCALL(sys_sync_file_range,sys_sync_file_range,compat_sys_s390_sync_file_range)
319319
SYSCALL(sys_tee,sys_tee,compat_sys_tee)
320320
SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice)
321321
NI_SYSCALL /* 310 sys_move_pages */
322322
SYSCALL(sys_getcpu,sys_getcpu,compat_sys_getcpu)
323323
SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait)
324324
SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper)
325-
SYSCALL(sys_s390_fallocate,sys_fallocate,sys_fallocate_wrapper)
325+
SYSCALL(sys_s390_fallocate,sys_fallocate,compat_sys_s390_fallocate)
326326
SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */
327327
SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd)
328328
NI_SYSCALL /* 317 old sys_timer_fd */

0 commit comments

Comments
 (0)