y2038: utimes: Rework #ifdef guards for compat syscalls
After changing over to 64-bit time_t syscalls, many architectures will want compat_sys_utimensat() but not respective handlers for utime(), utimes() and futimesat(). This adds a new __ARCH_WANT_SYS_UTIME32 to complement __ARCH_WANT_SYS_UTIME. For now, all 64-bit architectures that support CONFIG_COMPAT set it, but future 64-bit architectures will not (tile would not have needed it either, but got removed). As older 32-bit architectures get converted to using CONFIG_64BIT_TIME, they will have to use __ARCH_WANT_SYS_UTIME32 instead of __ARCH_WANT_SYS_UTIME. Architectures using the generic syscall ABI don't need either of them as they never had a utime syscall. Since the compat_utimbuf structure is now required outside of CONFIG_COMPAT, I'm moving it into compat_time.h. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- changed from last version: - renamed __ARCH_WANT_COMPAT_SYS_UTIME to __ARCH_WANT_SYS_UTIME32
This commit is contained in:
@@ -218,13 +218,14 @@ SYSCALL_DEFINE2(utime, char __user *, filename, struct utimbuf __user *, times)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
/*
|
||||
* Not all architectures have sys_utime, so implement this in terms
|
||||
* of sys_utimes.
|
||||
*/
|
||||
#ifdef __ARCH_WANT_SYS_UTIME32
|
||||
COMPAT_SYSCALL_DEFINE2(utime, const char __user *, filename,
|
||||
struct compat_utimbuf __user *, t)
|
||||
struct old_utimbuf32 __user *, t)
|
||||
{
|
||||
struct timespec64 tv[2];
|
||||
|
||||
@@ -237,6 +238,7 @@ COMPAT_SYSCALL_DEFINE2(utime, const char __user *, filename,
|
||||
}
|
||||
return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filename, struct old_timespec32 __user *, t, int, flags)
|
||||
{
|
||||
@@ -253,6 +255,7 @@ COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filena
|
||||
return do_utimes(dfd, filename, t ? tv : NULL, flags);
|
||||
}
|
||||
|
||||
#ifdef __ARCH_WANT_SYS_UTIME32
|
||||
static long do_compat_futimesat(unsigned int dfd, const char __user *filename,
|
||||
struct old_timeval32 __user *t)
|
||||
{
|
||||
@@ -285,3 +288,4 @@ COMPAT_SYSCALL_DEFINE2(utimes, const char __user *, filename, struct old_timeval
|
||||
return do_compat_futimesat(AT_FDCWD, filename, t);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user