2019-06-03 07:44:50 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2012-03-05 11:49:32 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 ARM Ltd.
|
|
|
|
*/
|
|
|
|
#ifndef __ASM_COMPAT_H
|
|
|
|
#define __ASM_COMPAT_H
|
2019-12-09 16:16:20 +01:00
|
|
|
|
2021-07-22 16:28:58 +02:00
|
|
|
#define compat_mode_t compat_mode_t
|
|
|
|
typedef u16 compat_mode_t;
|
|
|
|
|
2022-04-05 15:13:00 +08:00
|
|
|
#define __compat_uid_t __compat_uid_t
|
|
|
|
typedef u16 __compat_uid_t;
|
|
|
|
typedef u16 __compat_gid_t;
|
|
|
|
|
|
|
|
#define compat_ipc_pid_t compat_ipc_pid_t
|
|
|
|
typedef u16 compat_ipc_pid_t;
|
|
|
|
|
|
|
|
#define compat_statfs compat_statfs
|
|
|
|
|
2019-12-09 16:16:20 +01:00
|
|
|
#include <asm-generic/compat.h>
|
|
|
|
|
2012-03-05 11:49:32 +00:00
|
|
|
#ifdef CONFIG_COMPAT
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Architecture specific compatibility types
|
|
|
|
*/
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/sched.h>
|
2017-02-08 18:51:37 +01:00
|
|
|
#include <linux/sched/task_stack.h>
|
2012-03-05 11:49:32 +00:00
|
|
|
|
2013-10-11 14:52:12 +01:00
|
|
|
#ifdef __AARCH64EB__
|
|
|
|
#define COMPAT_UTS_MACHINE "armv8b\0\0"
|
|
|
|
#else
|
2012-03-05 11:49:32 +00:00
|
|
|
#define COMPAT_UTS_MACHINE "armv8l\0\0"
|
2013-10-11 14:52:12 +01:00
|
|
|
#endif
|
2012-03-05 11:49:32 +00:00
|
|
|
|
2013-04-25 11:23:41 +01:00
|
|
|
typedef u16 __compat_uid16_t;
|
|
|
|
typedef u16 __compat_gid16_t;
|
|
|
|
typedef s32 compat_nlink_t;
|
2012-03-05 11:49:32 +00:00
|
|
|
|
|
|
|
struct compat_stat {
|
2013-10-11 14:52:12 +01:00
|
|
|
#ifdef __AARCH64EB__
|
|
|
|
short st_dev;
|
|
|
|
short __pad1;
|
|
|
|
#else
|
2012-03-05 11:49:32 +00:00
|
|
|
compat_dev_t st_dev;
|
2013-10-11 14:52:12 +01:00
|
|
|
#endif
|
2012-03-05 11:49:32 +00:00
|
|
|
compat_ino_t st_ino;
|
|
|
|
compat_mode_t st_mode;
|
2013-04-25 11:23:41 +01:00
|
|
|
compat_ushort_t st_nlink;
|
|
|
|
__compat_uid16_t st_uid;
|
|
|
|
__compat_gid16_t st_gid;
|
2013-10-11 14:52:12 +01:00
|
|
|
#ifdef __AARCH64EB__
|
|
|
|
short st_rdev;
|
|
|
|
short __pad2;
|
|
|
|
#else
|
2012-03-05 11:49:32 +00:00
|
|
|
compat_dev_t st_rdev;
|
2013-10-11 14:52:12 +01:00
|
|
|
#endif
|
2012-03-05 11:49:32 +00:00
|
|
|
compat_off_t st_size;
|
|
|
|
compat_off_t st_blksize;
|
|
|
|
compat_off_t st_blocks;
|
y2038: globally rename compat_time to old_time32
Christoph Hellwig suggested a slightly different path for handling
backwards compatibility with the 32-bit time_t based system calls:
Rather than simply reusing the compat_sys_* entry points on 32-bit
architectures unchanged, we get rid of those entry points and the
compat_time types by renaming them to something that makes more sense
on 32-bit architectures (which don't have a compat mode otherwise),
and then share the entry points under the new name with the 64-bit
architectures that use them for implementing the compatibility.
The following types and interfaces are renamed here, and moved
from linux/compat_time.h to linux/time32.h:
old new
--- ---
compat_time_t old_time32_t
struct compat_timeval struct old_timeval32
struct compat_timespec struct old_timespec32
struct compat_itimerspec struct old_itimerspec32
ns_to_compat_timeval() ns_to_old_timeval32()
get_compat_itimerspec64() get_old_itimerspec32()
put_compat_itimerspec64() put_old_itimerspec32()
compat_get_timespec64() get_old_timespec32()
compat_put_timespec64() put_old_timespec32()
As we already have aliases in place, this patch addresses only the
instances that are relevant to the system call interface in particular,
not those that occur in device drivers and other modules. Those
will get handled separately, while providing the 64-bit version
of the respective interfaces.
I'm not renaming the timex, rusage and itimerval structures, as we are
still debating what the new interface will look like, and whether we
will need a replacement at all.
This also doesn't change the names of the syscall entry points, which can
be done more easily when we actually switch over the 32-bit architectures
to use them, at that point we need to change COMPAT_SYSCALL_DEFINEx to
SYSCALL_DEFINEx with a new name, e.g. with a _time32 suffix.
Suggested-by: Christoph Hellwig <hch@infradead.org>
Link: https://lore.kernel.org/lkml/20180705222110.GA5698@infradead.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-07-13 12:52:28 +02:00
|
|
|
old_time32_t st_atime;
|
2013-04-25 11:23:41 +01:00
|
|
|
compat_ulong_t st_atime_nsec;
|
y2038: globally rename compat_time to old_time32
Christoph Hellwig suggested a slightly different path for handling
backwards compatibility with the 32-bit time_t based system calls:
Rather than simply reusing the compat_sys_* entry points on 32-bit
architectures unchanged, we get rid of those entry points and the
compat_time types by renaming them to something that makes more sense
on 32-bit architectures (which don't have a compat mode otherwise),
and then share the entry points under the new name with the 64-bit
architectures that use them for implementing the compatibility.
The following types and interfaces are renamed here, and moved
from linux/compat_time.h to linux/time32.h:
old new
--- ---
compat_time_t old_time32_t
struct compat_timeval struct old_timeval32
struct compat_timespec struct old_timespec32
struct compat_itimerspec struct old_itimerspec32
ns_to_compat_timeval() ns_to_old_timeval32()
get_compat_itimerspec64() get_old_itimerspec32()
put_compat_itimerspec64() put_old_itimerspec32()
compat_get_timespec64() get_old_timespec32()
compat_put_timespec64() put_old_timespec32()
As we already have aliases in place, this patch addresses only the
instances that are relevant to the system call interface in particular,
not those that occur in device drivers and other modules. Those
will get handled separately, while providing the 64-bit version
of the respective interfaces.
I'm not renaming the timex, rusage and itimerval structures, as we are
still debating what the new interface will look like, and whether we
will need a replacement at all.
This also doesn't change the names of the syscall entry points, which can
be done more easily when we actually switch over the 32-bit architectures
to use them, at that point we need to change COMPAT_SYSCALL_DEFINEx to
SYSCALL_DEFINEx with a new name, e.g. with a _time32 suffix.
Suggested-by: Christoph Hellwig <hch@infradead.org>
Link: https://lore.kernel.org/lkml/20180705222110.GA5698@infradead.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-07-13 12:52:28 +02:00
|
|
|
old_time32_t st_mtime;
|
2013-04-25 11:23:41 +01:00
|
|
|
compat_ulong_t st_mtime_nsec;
|
y2038: globally rename compat_time to old_time32
Christoph Hellwig suggested a slightly different path for handling
backwards compatibility with the 32-bit time_t based system calls:
Rather than simply reusing the compat_sys_* entry points on 32-bit
architectures unchanged, we get rid of those entry points and the
compat_time types by renaming them to something that makes more sense
on 32-bit architectures (which don't have a compat mode otherwise),
and then share the entry points under the new name with the 64-bit
architectures that use them for implementing the compatibility.
The following types and interfaces are renamed here, and moved
from linux/compat_time.h to linux/time32.h:
old new
--- ---
compat_time_t old_time32_t
struct compat_timeval struct old_timeval32
struct compat_timespec struct old_timespec32
struct compat_itimerspec struct old_itimerspec32
ns_to_compat_timeval() ns_to_old_timeval32()
get_compat_itimerspec64() get_old_itimerspec32()
put_compat_itimerspec64() put_old_itimerspec32()
compat_get_timespec64() get_old_timespec32()
compat_put_timespec64() put_old_timespec32()
As we already have aliases in place, this patch addresses only the
instances that are relevant to the system call interface in particular,
not those that occur in device drivers and other modules. Those
will get handled separately, while providing the 64-bit version
of the respective interfaces.
I'm not renaming the timex, rusage and itimerval structures, as we are
still debating what the new interface will look like, and whether we
will need a replacement at all.
This also doesn't change the names of the syscall entry points, which can
be done more easily when we actually switch over the 32-bit architectures
to use them, at that point we need to change COMPAT_SYSCALL_DEFINEx to
SYSCALL_DEFINEx with a new name, e.g. with a _time32 suffix.
Suggested-by: Christoph Hellwig <hch@infradead.org>
Link: https://lore.kernel.org/lkml/20180705222110.GA5698@infradead.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-07-13 12:52:28 +02:00
|
|
|
old_time32_t st_ctime;
|
2013-04-25 11:23:41 +01:00
|
|
|
compat_ulong_t st_ctime_nsec;
|
|
|
|
compat_ulong_t __unused4[2];
|
2012-03-05 11:49:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct compat_statfs {
|
|
|
|
int f_type;
|
|
|
|
int f_bsize;
|
|
|
|
int f_blocks;
|
|
|
|
int f_bfree;
|
|
|
|
int f_bavail;
|
|
|
|
int f_files;
|
|
|
|
int f_ffree;
|
|
|
|
compat_fsid_t f_fsid;
|
|
|
|
int f_namelen; /* SunOS ignores this field. */
|
|
|
|
int f_frsize;
|
|
|
|
int f_flags;
|
|
|
|
int f_spare[4];
|
|
|
|
};
|
|
|
|
|
2015-11-16 17:32:15 +01:00
|
|
|
#define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
|
2018-09-05 15:34:43 +01:00
|
|
|
#define COMPAT_MINSIGSTKSZ 2048
|
2012-12-14 13:49:35 -05:00
|
|
|
|
2012-03-05 11:49:32 +00:00
|
|
|
static inline int is_compat_task(void)
|
|
|
|
{
|
|
|
|
return test_thread_flag(TIF_32BIT);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int is_compat_thread(struct thread_info *thread)
|
|
|
|
{
|
|
|
|
return test_ti_thread_flag(thread, TIF_32BIT);
|
|
|
|
}
|
|
|
|
|
2023-05-16 18:06:30 +02:00
|
|
|
long compat_arm_syscall(struct pt_regs *regs, int scno);
|
|
|
|
|
2012-03-05 11:49:32 +00:00
|
|
|
#else /* !CONFIG_COMPAT */
|
|
|
|
|
|
|
|
static inline int is_compat_thread(struct thread_info *thread)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_COMPAT */
|
|
|
|
#endif /* __ASM_COMPAT_H */
|