Skip to content

Commit afef05c

Browse files
deepa-hubKAGA-KOKO
authored andcommitted
time: Enable get/put_compat_itimerspec64 always
This will aid in enabling the compat syscalls on 32-bit architectures later on. Also move compat_itimerspec and related defines to compat_time.h. The compat_time.h file will eventually be deleted. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: arnd@arndb.de Cc: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org Cc: linux-api@vger.kernel.org Cc: y2038@lists.linaro.org Link: https://lkml.kernel.org/r/20180617051144.29756-3-deepa.kernel@gmail.com
1 parent d0dd63a commit afef05c

File tree

4 files changed

+30
-38
lines changed

4 files changed

+30
-38
lines changed

include/linux/compat.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ typedef compat_ulong_t compat_aio_context_t;
109109
struct compat_sel_arg_struct;
110110
struct rusage;
111111

112-
struct compat_itimerspec {
113-
struct compat_timespec it_interval;
114-
struct compat_timespec it_value;
115-
};
116-
117112
struct compat_utimbuf {
118113
compat_time_t actime;
119114
compat_time_t modtime;
@@ -294,10 +289,6 @@ extern int compat_get_timespec(struct timespec *, const void __user *);
294289
extern int compat_put_timespec(const struct timespec *, void __user *);
295290
extern int compat_get_timeval(struct timeval *, const void __user *);
296291
extern int compat_put_timeval(const struct timeval *, void __user *);
297-
extern int get_compat_itimerspec64(struct itimerspec64 *its,
298-
const struct compat_itimerspec __user *uits);
299-
extern int put_compat_itimerspec64(const struct itimerspec64 *its,
300-
struct compat_itimerspec __user *uits);
301292

302293
struct compat_iovec {
303294
compat_uptr_t iov_base;

include/linux/compat_time.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,16 @@ struct compat_timeval {
1717
s32 tv_usec;
1818
};
1919

20+
struct compat_itimerspec {
21+
struct compat_timespec it_interval;
22+
struct compat_timespec it_value;
23+
};
24+
2025
extern int compat_get_timespec64(struct timespec64 *, const void __user *);
2126
extern int compat_put_timespec64(const struct timespec64 *, void __user *);
27+
extern int get_compat_itimerspec64(struct itimerspec64 *its,
28+
const struct compat_itimerspec __user *uits);
29+
extern int put_compat_itimerspec64(const struct itimerspec64 *its,
30+
struct compat_itimerspec __user *uits);
2231

2332
#endif /* _LINUX_COMPAT_TIME_H */

kernel/compat.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -324,35 +324,6 @@ COMPAT_SYSCALL_DEFINE3(sched_getaffinity, compat_pid_t, pid, unsigned int, len,
324324
return ret;
325325
}
326326

327-
/* Todo: Delete these extern declarations when get/put_compat_itimerspec64()
328-
* are moved to kernel/time/time.c .
329-
*/
330-
extern int __compat_get_timespec64(struct timespec64 *ts64,
331-
const struct compat_timespec __user *cts);
332-
extern int __compat_put_timespec64(const struct timespec64 *ts64,
333-
struct compat_timespec __user *cts);
334-
335-
int get_compat_itimerspec64(struct itimerspec64 *its,
336-
const struct compat_itimerspec __user *uits)
337-
{
338-
339-
if (__compat_get_timespec64(&its->it_interval, &uits->it_interval) ||
340-
__compat_get_timespec64(&its->it_value, &uits->it_value))
341-
return -EFAULT;
342-
return 0;
343-
}
344-
EXPORT_SYMBOL_GPL(get_compat_itimerspec64);
345-
346-
int put_compat_itimerspec64(const struct itimerspec64 *its,
347-
struct compat_itimerspec __user *uits)
348-
{
349-
if (__compat_put_timespec64(&its->it_interval, &uits->it_interval) ||
350-
__compat_put_timespec64(&its->it_value, &uits->it_value))
351-
return -EFAULT;
352-
return 0;
353-
}
354-
EXPORT_SYMBOL_GPL(put_compat_itimerspec64);
355-
356327
/*
357328
* We currently only need the following fields from the sigevent
358329
* structure: sigev_value, sigev_signo, sig_notify and (sometimes

kernel/time/time.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,3 +955,24 @@ int put_itimerspec64(const struct itimerspec64 *it,
955955
return ret;
956956
}
957957
EXPORT_SYMBOL_GPL(put_itimerspec64);
958+
959+
int get_compat_itimerspec64(struct itimerspec64 *its,
960+
const struct compat_itimerspec __user *uits)
961+
{
962+
963+
if (__compat_get_timespec64(&its->it_interval, &uits->it_interval) ||
964+
__compat_get_timespec64(&its->it_value, &uits->it_value))
965+
return -EFAULT;
966+
return 0;
967+
}
968+
EXPORT_SYMBOL_GPL(get_compat_itimerspec64);
969+
970+
int put_compat_itimerspec64(const struct itimerspec64 *its,
971+
struct compat_itimerspec __user *uits)
972+
{
973+
if (__compat_put_timespec64(&its->it_interval, &uits->it_interval) ||
974+
__compat_put_timespec64(&its->it_value, &uits->it_value))
975+
return -EFAULT;
976+
return 0;
977+
}
978+
EXPORT_SYMBOL_GPL(put_compat_itimerspec64);

0 commit comments

Comments
 (0)