compat.h 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _LINUX_COMPAT_H
  3. #define _LINUX_COMPAT_H
  4. /*
  5. * These are the type definitions for the architecture specific
  6. * syscall compatibility layer.
  7. */
  8. #include <linux/types.h>
  9. #include <linux/time.h>
  10. #include <linux/stat.h>
  11. #include <linux/param.h> /* for HZ */
  12. #include <linux/sem.h>
  13. #include <linux/socket.h>
  14. #include <linux/if.h>
  15. #include <linux/fs.h>
  16. #include <linux/aio_abi.h> /* for aio_context_t */
  17. #include <linux/uaccess.h>
  18. #include <linux/unistd.h>
  19. #include <asm/compat.h>
  20. #include <asm/siginfo.h>
  21. #include <asm/signal.h>
  22. #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER
  23. /*
  24. * It may be useful for an architecture to override the definitions of the
  25. * COMPAT_SYSCALL_DEFINE0 and COMPAT_SYSCALL_DEFINEx() macros, in particular
  26. * to use a different calling convention for syscalls. To allow for that,
  27. + the prototypes for the compat_sys_*() functions below will *not* be included
  28. * if CONFIG_ARCH_HAS_SYSCALL_WRAPPER is enabled.
  29. */
  30. #include <asm/syscall_wrapper.h>
  31. #endif /* CONFIG_ARCH_HAS_SYSCALL_WRAPPER */
  32. #ifndef COMPAT_USE_64BIT_TIME
  33. #define COMPAT_USE_64BIT_TIME 0
  34. #endif
  35. #ifndef __SC_DELOUSE
  36. #define __SC_DELOUSE(t,v) ((__force t)(unsigned long)(v))
  37. #endif
  38. #ifndef COMPAT_SYSCALL_DEFINE0
  39. #define COMPAT_SYSCALL_DEFINE0(name) \
  40. asmlinkage long compat_sys_##name(void); \
  41. ALLOW_ERROR_INJECTION(compat_sys_##name, ERRNO); \
  42. asmlinkage long compat_sys_##name(void)
  43. #endif /* COMPAT_SYSCALL_DEFINE0 */
  44. #define COMPAT_SYSCALL_DEFINE1(name, ...) \
  45. COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
  46. #define COMPAT_SYSCALL_DEFINE2(name, ...) \
  47. COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
  48. #define COMPAT_SYSCALL_DEFINE3(name, ...) \
  49. COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
  50. #define COMPAT_SYSCALL_DEFINE4(name, ...) \
  51. COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
  52. #define COMPAT_SYSCALL_DEFINE5(name, ...) \
  53. COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
  54. #define COMPAT_SYSCALL_DEFINE6(name, ...) \
  55. COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
  56. /*
  57. * The asmlinkage stub is aliased to a function named __se_compat_sys_*() which
  58. * sign-extends 32-bit ints to longs whenever needed. The actual work is
  59. * done within __do_compat_sys_*().
  60. */
  61. #ifndef COMPAT_SYSCALL_DEFINEx
  62. #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
  63. __diag_push(); \
  64. __diag_ignore(GCC, 8, "-Wattribute-alias", \
  65. "Type aliasing is used to sanitize syscall arguments");\
  66. asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
  67. __attribute__((alias(__stringify(__se_compat_sys##name)))); \
  68. ALLOW_ERROR_INJECTION(compat_sys##name, ERRNO); \
  69. static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
  70. asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
  71. asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
  72. { \
  73. long ret = __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
  74. __MAP(x,__SC_TEST,__VA_ARGS__); \
  75. return ret; \
  76. } \
  77. __diag_pop(); \
  78. static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
  79. #endif /* COMPAT_SYSCALL_DEFINEx */
  80. struct compat_iovec {
  81. compat_uptr_t iov_base;
  82. compat_size_t iov_len;
  83. };
  84. #ifndef compat_user_stack_pointer
  85. #define compat_user_stack_pointer() current_user_stack_pointer()
  86. #endif
  87. #ifndef compat_sigaltstack /* we'll need that for MIPS */
  88. typedef struct compat_sigaltstack {
  89. compat_uptr_t ss_sp;
  90. int ss_flags;
  91. compat_size_t ss_size;
  92. } compat_stack_t;
  93. #endif
  94. #ifndef COMPAT_MINSIGSTKSZ
  95. #define COMPAT_MINSIGSTKSZ MINSIGSTKSZ
  96. #endif
  97. #define compat_jiffies_to_clock_t(x) \
  98. (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
  99. typedef __compat_uid32_t compat_uid_t;
  100. typedef __compat_gid32_t compat_gid_t;
  101. struct compat_sel_arg_struct;
  102. struct rusage;
  103. struct old_itimerval32;
  104. struct compat_tms {
  105. compat_clock_t tms_utime;
  106. compat_clock_t tms_stime;
  107. compat_clock_t tms_cutime;
  108. compat_clock_t tms_cstime;
  109. };
  110. #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
  111. #ifndef compat_sigset_t
  112. typedef struct {
  113. compat_sigset_word sig[_COMPAT_NSIG_WORDS];
  114. } compat_sigset_t;
  115. #endif
  116. int set_compat_user_sigmask(const compat_sigset_t __user *umask,
  117. size_t sigsetsize);
  118. struct compat_sigaction {
  119. #ifndef __ARCH_HAS_IRIX_SIGACTION
  120. compat_uptr_t sa_handler;
  121. compat_ulong_t sa_flags;
  122. #else
  123. compat_uint_t sa_flags;
  124. compat_uptr_t sa_handler;
  125. #endif
  126. #ifdef __ARCH_HAS_SA_RESTORER
  127. compat_uptr_t sa_restorer;
  128. #endif
  129. compat_sigset_t sa_mask __packed;
  130. };
  131. typedef union compat_sigval {
  132. compat_int_t sival_int;
  133. compat_uptr_t sival_ptr;
  134. } compat_sigval_t;
  135. typedef struct compat_siginfo {
  136. int si_signo;
  137. #ifndef __ARCH_HAS_SWAPPED_SIGINFO
  138. int si_errno;
  139. int si_code;
  140. #else
  141. int si_code;
  142. int si_errno;
  143. #endif
  144. union {
  145. int _pad[128/sizeof(int) - 3];
  146. /* kill() */
  147. struct {
  148. compat_pid_t _pid; /* sender's pid */
  149. __compat_uid32_t _uid; /* sender's uid */
  150. } _kill;
  151. /* POSIX.1b timers */
  152. struct {
  153. compat_timer_t _tid; /* timer id */
  154. int _overrun; /* overrun count */
  155. compat_sigval_t _sigval; /* same as below */
  156. } _timer;
  157. /* POSIX.1b signals */
  158. struct {
  159. compat_pid_t _pid; /* sender's pid */
  160. __compat_uid32_t _uid; /* sender's uid */
  161. compat_sigval_t _sigval;
  162. } _rt;
  163. /* SIGCHLD */
  164. struct {
  165. compat_pid_t _pid; /* which child */
  166. __compat_uid32_t _uid; /* sender's uid */
  167. int _status; /* exit code */
  168. compat_clock_t _utime;
  169. compat_clock_t _stime;
  170. } _sigchld;
  171. #ifdef CONFIG_X86_X32_ABI
  172. /* SIGCHLD (x32 version) */
  173. struct {
  174. compat_pid_t _pid; /* which child */
  175. __compat_uid32_t _uid; /* sender's uid */
  176. int _status; /* exit code */
  177. compat_s64 _utime;
  178. compat_s64 _stime;
  179. } _sigchld_x32;
  180. #endif
  181. /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */
  182. struct {
  183. compat_uptr_t _addr; /* faulting insn/memory ref. */
  184. #define __COMPAT_ADDR_BND_PKEY_PAD (__alignof__(compat_uptr_t) < sizeof(short) ? \
  185. sizeof(short) : __alignof__(compat_uptr_t))
  186. union {
  187. /* used on alpha and sparc */
  188. int _trapno; /* TRAP # which caused the signal */
  189. /*
  190. * used when si_code=BUS_MCEERR_AR or
  191. * used when si_code=BUS_MCEERR_AO
  192. */
  193. short int _addr_lsb; /* Valid LSB of the reported address. */
  194. /* used when si_code=SEGV_BNDERR */
  195. struct {
  196. char _dummy_bnd[__COMPAT_ADDR_BND_PKEY_PAD];
  197. compat_uptr_t _lower;
  198. compat_uptr_t _upper;
  199. } _addr_bnd;
  200. /* used when si_code=SEGV_PKUERR */
  201. struct {
  202. char _dummy_pkey[__COMPAT_ADDR_BND_PKEY_PAD];
  203. u32 _pkey;
  204. } _addr_pkey;
  205. /* used when si_code=TRAP_PERF */
  206. struct {
  207. compat_ulong_t _data;
  208. u32 _type;
  209. u32 _flags;
  210. } _perf;
  211. };
  212. } _sigfault;
  213. /* SIGPOLL */
  214. struct {
  215. compat_long_t _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  216. int _fd;
  217. } _sigpoll;
  218. struct {
  219. compat_uptr_t _call_addr; /* calling user insn */
  220. int _syscall; /* triggering system call number */
  221. unsigned int _arch; /* AUDIT_ARCH_* of syscall */
  222. } _sigsys;
  223. } _sifields;
  224. } compat_siginfo_t;
  225. struct compat_rlimit {
  226. compat_ulong_t rlim_cur;
  227. compat_ulong_t rlim_max;
  228. };
  229. #ifdef __ARCH_NEED_COMPAT_FLOCK64_PACKED
  230. #define __ARCH_COMPAT_FLOCK64_PACK __attribute__((packed))
  231. #else
  232. #define __ARCH_COMPAT_FLOCK64_PACK
  233. #endif
  234. struct compat_flock {
  235. short l_type;
  236. short l_whence;
  237. compat_off_t l_start;
  238. compat_off_t l_len;
  239. #ifdef __ARCH_COMPAT_FLOCK_EXTRA_SYSID
  240. __ARCH_COMPAT_FLOCK_EXTRA_SYSID
  241. #endif
  242. compat_pid_t l_pid;
  243. #ifdef __ARCH_COMPAT_FLOCK_PAD
  244. __ARCH_COMPAT_FLOCK_PAD
  245. #endif
  246. };
  247. struct compat_flock64 {
  248. short l_type;
  249. short l_whence;
  250. compat_loff_t l_start;
  251. compat_loff_t l_len;
  252. compat_pid_t l_pid;
  253. #ifdef __ARCH_COMPAT_FLOCK64_PAD
  254. __ARCH_COMPAT_FLOCK64_PAD
  255. #endif
  256. } __ARCH_COMPAT_FLOCK64_PACK;
  257. struct compat_rusage {
  258. struct old_timeval32 ru_utime;
  259. struct old_timeval32 ru_stime;
  260. compat_long_t ru_maxrss;
  261. compat_long_t ru_ixrss;
  262. compat_long_t ru_idrss;
  263. compat_long_t ru_isrss;
  264. compat_long_t ru_minflt;
  265. compat_long_t ru_majflt;
  266. compat_long_t ru_nswap;
  267. compat_long_t ru_inblock;
  268. compat_long_t ru_oublock;
  269. compat_long_t ru_msgsnd;
  270. compat_long_t ru_msgrcv;
  271. compat_long_t ru_nsignals;
  272. compat_long_t ru_nvcsw;
  273. compat_long_t ru_nivcsw;
  274. };
  275. extern int put_compat_rusage(const struct rusage *,
  276. struct compat_rusage __user *);
  277. struct compat_siginfo;
  278. struct __compat_aio_sigset;
  279. struct compat_dirent {
  280. u32 d_ino;
  281. compat_off_t d_off;
  282. u16 d_reclen;
  283. char d_name[256];
  284. };
  285. struct compat_ustat {
  286. compat_daddr_t f_tfree;
  287. compat_ino_t f_tinode;
  288. char f_fname[6];
  289. char f_fpack[6];
  290. };
  291. #define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
  292. typedef struct compat_sigevent {
  293. compat_sigval_t sigev_value;
  294. compat_int_t sigev_signo;
  295. compat_int_t sigev_notify;
  296. union {
  297. compat_int_t _pad[COMPAT_SIGEV_PAD_SIZE];
  298. compat_int_t _tid;
  299. struct {
  300. compat_uptr_t _function;
  301. compat_uptr_t _attribute;
  302. } _sigev_thread;
  303. } _sigev_un;
  304. } compat_sigevent_t;
  305. struct compat_ifmap {
  306. compat_ulong_t mem_start;
  307. compat_ulong_t mem_end;
  308. unsigned short base_addr;
  309. unsigned char irq;
  310. unsigned char dma;
  311. unsigned char port;
  312. };
  313. struct compat_if_settings {
  314. unsigned int type; /* Type of physical device or protocol */
  315. unsigned int size; /* Size of the data allocated by the caller */
  316. compat_uptr_t ifs_ifsu; /* union of pointers */
  317. };
  318. struct compat_ifreq {
  319. union {
  320. char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
  321. } ifr_ifrn;
  322. union {
  323. struct sockaddr ifru_addr;
  324. struct sockaddr ifru_dstaddr;
  325. struct sockaddr ifru_broadaddr;
  326. struct sockaddr ifru_netmask;
  327. struct sockaddr ifru_hwaddr;
  328. short ifru_flags;
  329. compat_int_t ifru_ivalue;
  330. compat_int_t ifru_mtu;
  331. struct compat_ifmap ifru_map;
  332. char ifru_slave[IFNAMSIZ]; /* Just fits the size */
  333. char ifru_newname[IFNAMSIZ];
  334. compat_caddr_t ifru_data;
  335. struct compat_if_settings ifru_settings;
  336. } ifr_ifru;
  337. };
  338. struct compat_ifconf {
  339. compat_int_t ifc_len; /* size of buffer */
  340. compat_caddr_t ifcbuf;
  341. };
  342. struct compat_robust_list {
  343. compat_uptr_t next;
  344. };
  345. struct compat_robust_list_head {
  346. struct compat_robust_list list;
  347. compat_long_t futex_offset;
  348. compat_uptr_t list_op_pending;
  349. };
  350. #ifdef CONFIG_COMPAT_OLD_SIGACTION
  351. struct compat_old_sigaction {
  352. compat_uptr_t sa_handler;
  353. compat_old_sigset_t sa_mask;
  354. compat_ulong_t sa_flags;
  355. compat_uptr_t sa_restorer;
  356. };
  357. #endif
  358. struct compat_keyctl_kdf_params {
  359. compat_uptr_t hashname;
  360. compat_uptr_t otherinfo;
  361. __u32 otherinfolen;
  362. __u32 __spare[8];
  363. };
  364. struct compat_stat;
  365. struct compat_statfs;
  366. struct compat_statfs64;
  367. struct compat_old_linux_dirent;
  368. struct compat_linux_dirent;
  369. struct linux_dirent64;
  370. struct compat_msghdr;
  371. struct compat_mmsghdr;
  372. struct compat_sysinfo;
  373. struct compat_sysctl_args;
  374. struct compat_kexec_segment;
  375. struct compat_mq_attr;
  376. struct compat_msgbuf;
  377. void copy_siginfo_to_external32(struct compat_siginfo *to,
  378. const struct kernel_siginfo *from);
  379. int copy_siginfo_from_user32(kernel_siginfo_t *to,
  380. const struct compat_siginfo __user *from);
  381. int __copy_siginfo_to_user32(struct compat_siginfo __user *to,
  382. const kernel_siginfo_t *from);
  383. #ifndef copy_siginfo_to_user32
  384. #define copy_siginfo_to_user32 __copy_siginfo_to_user32
  385. #endif
  386. int get_compat_sigevent(struct sigevent *event,
  387. const struct compat_sigevent __user *u_event);
  388. extern int get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat);
  389. /*
  390. * Defined inline such that size can be compile time constant, which avoids
  391. * CONFIG_HARDENED_USERCOPY complaining about copies from task_struct
  392. */
  393. static inline int
  394. put_compat_sigset(compat_sigset_t __user *compat, const sigset_t *set,
  395. unsigned int size)
  396. {
  397. /* size <= sizeof(compat_sigset_t) <= sizeof(sigset_t) */
  398. #if defined(__BIG_ENDIAN) && defined(CONFIG_64BIT)
  399. compat_sigset_t v;
  400. switch (_NSIG_WORDS) {
  401. case 4: v.sig[7] = (set->sig[3] >> 32); v.sig[6] = set->sig[3];
  402. fallthrough;
  403. case 3: v.sig[5] = (set->sig[2] >> 32); v.sig[4] = set->sig[2];
  404. fallthrough;
  405. case 2: v.sig[3] = (set->sig[1] >> 32); v.sig[2] = set->sig[1];
  406. fallthrough;
  407. case 1: v.sig[1] = (set->sig[0] >> 32); v.sig[0] = set->sig[0];
  408. }
  409. return copy_to_user(compat, &v, size) ? -EFAULT : 0;
  410. #else
  411. return copy_to_user(compat, set, size) ? -EFAULT : 0;
  412. #endif
  413. }
  414. #ifdef CONFIG_CPU_BIG_ENDIAN
  415. #define unsafe_put_compat_sigset(compat, set, label) do { \
  416. compat_sigset_t __user *__c = compat; \
  417. const sigset_t *__s = set; \
  418. \
  419. switch (_NSIG_WORDS) { \
  420. case 4: \
  421. unsafe_put_user(__s->sig[3] >> 32, &__c->sig[7], label); \
  422. unsafe_put_user(__s->sig[3], &__c->sig[6], label); \
  423. fallthrough; \
  424. case 3: \
  425. unsafe_put_user(__s->sig[2] >> 32, &__c->sig[5], label); \
  426. unsafe_put_user(__s->sig[2], &__c->sig[4], label); \
  427. fallthrough; \
  428. case 2: \
  429. unsafe_put_user(__s->sig[1] >> 32, &__c->sig[3], label); \
  430. unsafe_put_user(__s->sig[1], &__c->sig[2], label); \
  431. fallthrough; \
  432. case 1: \
  433. unsafe_put_user(__s->sig[0] >> 32, &__c->sig[1], label); \
  434. unsafe_put_user(__s->sig[0], &__c->sig[0], label); \
  435. } \
  436. } while (0)
  437. #define unsafe_get_compat_sigset(set, compat, label) do { \
  438. const compat_sigset_t __user *__c = compat; \
  439. compat_sigset_word hi, lo; \
  440. sigset_t *__s = set; \
  441. \
  442. switch (_NSIG_WORDS) { \
  443. case 4: \
  444. unsafe_get_user(lo, &__c->sig[7], label); \
  445. unsafe_get_user(hi, &__c->sig[6], label); \
  446. __s->sig[3] = hi | (((long)lo) << 32); \
  447. fallthrough; \
  448. case 3: \
  449. unsafe_get_user(lo, &__c->sig[5], label); \
  450. unsafe_get_user(hi, &__c->sig[4], label); \
  451. __s->sig[2] = hi | (((long)lo) << 32); \
  452. fallthrough; \
  453. case 2: \
  454. unsafe_get_user(lo, &__c->sig[3], label); \
  455. unsafe_get_user(hi, &__c->sig[2], label); \
  456. __s->sig[1] = hi | (((long)lo) << 32); \
  457. fallthrough; \
  458. case 1: \
  459. unsafe_get_user(lo, &__c->sig[1], label); \
  460. unsafe_get_user(hi, &__c->sig[0], label); \
  461. __s->sig[0] = hi | (((long)lo) << 32); \
  462. } \
  463. } while (0)
  464. #else
  465. #define unsafe_put_compat_sigset(compat, set, label) do { \
  466. compat_sigset_t __user *__c = compat; \
  467. const sigset_t *__s = set; \
  468. \
  469. unsafe_copy_to_user(__c, __s, sizeof(*__c), label); \
  470. } while (0)
  471. #define unsafe_get_compat_sigset(set, compat, label) do { \
  472. const compat_sigset_t __user *__c = compat; \
  473. sigset_t *__s = set; \
  474. \
  475. unsafe_copy_from_user(__s, __c, sizeof(*__c), label); \
  476. } while (0)
  477. #endif
  478. extern int compat_ptrace_request(struct task_struct *child,
  479. compat_long_t request,
  480. compat_ulong_t addr, compat_ulong_t data);
  481. extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
  482. compat_ulong_t addr, compat_ulong_t data);
  483. struct epoll_event; /* fortunately, this one is fixed-layout */
  484. int compat_restore_altstack(const compat_stack_t __user *uss);
  485. int __compat_save_altstack(compat_stack_t __user *, unsigned long);
  486. #define unsafe_compat_save_altstack(uss, sp, label) do { \
  487. compat_stack_t __user *__uss = uss; \
  488. struct task_struct *t = current; \
  489. unsafe_put_user(ptr_to_compat((void __user *)t->sas_ss_sp), \
  490. &__uss->ss_sp, label); \
  491. unsafe_put_user(t->sas_ss_flags, &__uss->ss_flags, label); \
  492. unsafe_put_user(t->sas_ss_size, &__uss->ss_size, label); \
  493. } while (0);
  494. /*
  495. * These syscall function prototypes are kept in the same order as
  496. * include/uapi/asm-generic/unistd.h. Deprecated or obsolete system calls
  497. * go below.
  498. *
  499. * Please note that these prototypes here are only provided for information
  500. * purposes, for static analysis, and for linking from the syscall table.
  501. * These functions should not be called elsewhere from kernel code.
  502. *
  503. * As the syscall calling convention may be different from the default
  504. * for architectures overriding the syscall calling convention, do not
  505. * include the prototypes if CONFIG_ARCH_HAS_SYSCALL_WRAPPER is enabled.
  506. */
  507. #ifndef CONFIG_ARCH_HAS_SYSCALL_WRAPPER
  508. asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p);
  509. asmlinkage long compat_sys_io_submit(compat_aio_context_t ctx_id, int nr,
  510. u32 __user *iocb);
  511. asmlinkage long compat_sys_io_pgetevents(compat_aio_context_t ctx_id,
  512. compat_long_t min_nr,
  513. compat_long_t nr,
  514. struct io_event __user *events,
  515. struct old_timespec32 __user *timeout,
  516. const struct __compat_aio_sigset __user *usig);
  517. asmlinkage long compat_sys_io_pgetevents_time64(compat_aio_context_t ctx_id,
  518. compat_long_t min_nr,
  519. compat_long_t nr,
  520. struct io_event __user *events,
  521. struct __kernel_timespec __user *timeout,
  522. const struct __compat_aio_sigset __user *usig);
  523. /* fs/cookies.c */
  524. asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, compat_size_t);
  525. /* fs/eventpoll.c */
  526. asmlinkage long compat_sys_epoll_pwait(int epfd,
  527. struct epoll_event __user *events,
  528. int maxevents, int timeout,
  529. const compat_sigset_t __user *sigmask,
  530. compat_size_t sigsetsize);
  531. asmlinkage long compat_sys_epoll_pwait2(int epfd,
  532. struct epoll_event __user *events,
  533. int maxevents,
  534. const struct __kernel_timespec __user *timeout,
  535. const compat_sigset_t __user *sigmask,
  536. compat_size_t sigsetsize);
  537. /* fs/fcntl.c */
  538. asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd,
  539. compat_ulong_t arg);
  540. asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd,
  541. compat_ulong_t arg);
  542. /* fs/ioctl.c */
  543. asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
  544. compat_ulong_t arg);
  545. /* fs/open.c */
  546. asmlinkage long compat_sys_statfs(const char __user *pathname,
  547. struct compat_statfs __user *buf);
  548. asmlinkage long compat_sys_statfs64(const char __user *pathname,
  549. compat_size_t sz,
  550. struct compat_statfs64 __user *buf);
  551. asmlinkage long compat_sys_fstatfs(unsigned int fd,
  552. struct compat_statfs __user *buf);
  553. asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz,
  554. struct compat_statfs64 __user *buf);
  555. asmlinkage long compat_sys_truncate(const char __user *, compat_off_t);
  556. asmlinkage long compat_sys_ftruncate(unsigned int, compat_ulong_t);
  557. /* No generic prototype for truncate64, ftruncate64, fallocate */
  558. asmlinkage long compat_sys_openat(int dfd, const char __user *filename,
  559. int flags, umode_t mode);
  560. /* fs/readdir.c */
  561. asmlinkage long compat_sys_getdents(unsigned int fd,
  562. struct compat_linux_dirent __user *dirent,
  563. unsigned int count);
  564. /* fs/read_write.c */
  565. asmlinkage long compat_sys_lseek(unsigned int, compat_off_t, unsigned int);
  566. /* No generic prototype for pread64 and pwrite64 */
  567. asmlinkage ssize_t compat_sys_preadv(compat_ulong_t fd,
  568. const struct iovec __user *vec,
  569. compat_ulong_t vlen, u32 pos_low, u32 pos_high);
  570. asmlinkage ssize_t compat_sys_pwritev(compat_ulong_t fd,
  571. const struct iovec __user *vec,
  572. compat_ulong_t vlen, u32 pos_low, u32 pos_high);
  573. #ifdef __ARCH_WANT_COMPAT_SYS_PREADV64
  574. asmlinkage long compat_sys_preadv64(unsigned long fd,
  575. const struct iovec __user *vec,
  576. unsigned long vlen, loff_t pos);
  577. #endif
  578. #ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64
  579. asmlinkage long compat_sys_pwritev64(unsigned long fd,
  580. const struct iovec __user *vec,
  581. unsigned long vlen, loff_t pos);
  582. #endif
  583. /* fs/sendfile.c */
  584. asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
  585. compat_off_t __user *offset, compat_size_t count);
  586. asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
  587. compat_loff_t __user *offset, compat_size_t count);
  588. /* fs/select.c */
  589. asmlinkage long compat_sys_pselect6_time32(int n, compat_ulong_t __user *inp,
  590. compat_ulong_t __user *outp,
  591. compat_ulong_t __user *exp,
  592. struct old_timespec32 __user *tsp,
  593. void __user *sig);
  594. asmlinkage long compat_sys_pselect6_time64(int n, compat_ulong_t __user *inp,
  595. compat_ulong_t __user *outp,
  596. compat_ulong_t __user *exp,
  597. struct __kernel_timespec __user *tsp,
  598. void __user *sig);
  599. asmlinkage long compat_sys_ppoll_time32(struct pollfd __user *ufds,
  600. unsigned int nfds,
  601. struct old_timespec32 __user *tsp,
  602. const compat_sigset_t __user *sigmask,
  603. compat_size_t sigsetsize);
  604. asmlinkage long compat_sys_ppoll_time64(struct pollfd __user *ufds,
  605. unsigned int nfds,
  606. struct __kernel_timespec __user *tsp,
  607. const compat_sigset_t __user *sigmask,
  608. compat_size_t sigsetsize);
  609. /* fs/signalfd.c */
  610. asmlinkage long compat_sys_signalfd4(int ufd,
  611. const compat_sigset_t __user *sigmask,
  612. compat_size_t sigsetsize, int flags);
  613. /* fs/stat.c */
  614. asmlinkage long compat_sys_newfstatat(unsigned int dfd,
  615. const char __user *filename,
  616. struct compat_stat __user *statbuf,
  617. int flag);
  618. asmlinkage long compat_sys_newfstat(unsigned int fd,
  619. struct compat_stat __user *statbuf);
  620. /* fs/sync.c: No generic prototype for sync_file_range and sync_file_range2 */
  621. /* kernel/exit.c */
  622. asmlinkage long compat_sys_waitid(int, compat_pid_t,
  623. struct compat_siginfo __user *, int,
  624. struct compat_rusage __user *);
  625. /* kernel/futex.c */
  626. asmlinkage long
  627. compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
  628. compat_size_t len);
  629. asmlinkage long
  630. compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
  631. compat_size_t __user *len_ptr);
  632. /* kernel/itimer.c */
  633. asmlinkage long compat_sys_getitimer(int which,
  634. struct old_itimerval32 __user *it);
  635. asmlinkage long compat_sys_setitimer(int which,
  636. struct old_itimerval32 __user *in,
  637. struct old_itimerval32 __user *out);
  638. /* kernel/kexec.c */
  639. asmlinkage long compat_sys_kexec_load(compat_ulong_t entry,
  640. compat_ulong_t nr_segments,
  641. struct compat_kexec_segment __user *,
  642. compat_ulong_t flags);
  643. /* kernel/posix-timers.c */
  644. asmlinkage long compat_sys_timer_create(clockid_t which_clock,
  645. struct compat_sigevent __user *timer_event_spec,
  646. timer_t __user *created_timer_id);
  647. /* kernel/ptrace.c */
  648. asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
  649. compat_long_t addr, compat_long_t data);
  650. /* kernel/sched/core.c */
  651. asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
  652. unsigned int len,
  653. compat_ulong_t __user *user_mask_ptr);
  654. asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid,
  655. unsigned int len,
  656. compat_ulong_t __user *user_mask_ptr);
  657. /* kernel/signal.c */
  658. asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
  659. compat_stack_t __user *uoss_ptr);
  660. asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset,
  661. compat_size_t sigsetsize);
  662. #ifndef CONFIG_ODD_RT_SIGACTION
  663. asmlinkage long compat_sys_rt_sigaction(int,
  664. const struct compat_sigaction __user *,
  665. struct compat_sigaction __user *,
  666. compat_size_t);
  667. #endif
  668. asmlinkage long compat_sys_rt_sigprocmask(int how, compat_sigset_t __user *set,
  669. compat_sigset_t __user *oset,
  670. compat_size_t sigsetsize);
  671. asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
  672. compat_size_t sigsetsize);
  673. asmlinkage long compat_sys_rt_sigtimedwait_time32(compat_sigset_t __user *uthese,
  674. struct compat_siginfo __user *uinfo,
  675. struct old_timespec32 __user *uts, compat_size_t sigsetsize);
  676. asmlinkage long compat_sys_rt_sigtimedwait_time64(compat_sigset_t __user *uthese,
  677. struct compat_siginfo __user *uinfo,
  678. struct __kernel_timespec __user *uts, compat_size_t sigsetsize);
  679. asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig,
  680. struct compat_siginfo __user *uinfo);
  681. /* No generic prototype for rt_sigreturn */
  682. /* kernel/sys.c */
  683. asmlinkage long compat_sys_times(struct compat_tms __user *tbuf);
  684. asmlinkage long compat_sys_getrlimit(unsigned int resource,
  685. struct compat_rlimit __user *rlim);
  686. asmlinkage long compat_sys_setrlimit(unsigned int resource,
  687. struct compat_rlimit __user *rlim);
  688. asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru);
  689. /* kernel/time.c */
  690. asmlinkage long compat_sys_gettimeofday(struct old_timeval32 __user *tv,
  691. struct timezone __user *tz);
  692. asmlinkage long compat_sys_settimeofday(struct old_timeval32 __user *tv,
  693. struct timezone __user *tz);
  694. /* kernel/timer.c */
  695. asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
  696. /* ipc/mqueue.c */
  697. asmlinkage long compat_sys_mq_open(const char __user *u_name,
  698. int oflag, compat_mode_t mode,
  699. struct compat_mq_attr __user *u_attr);
  700. asmlinkage long compat_sys_mq_notify(mqd_t mqdes,
  701. const struct compat_sigevent __user *u_notification);
  702. asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
  703. const struct compat_mq_attr __user *u_mqstat,
  704. struct compat_mq_attr __user *u_omqstat);
  705. /* ipc/msg.c */
  706. asmlinkage long compat_sys_msgctl(int first, int second, void __user *uptr);
  707. asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp,
  708. compat_ssize_t msgsz, compat_long_t msgtyp, int msgflg);
  709. asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp,
  710. compat_ssize_t msgsz, int msgflg);
  711. /* ipc/sem.c */
  712. asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
  713. /* ipc/shm.c */
  714. asmlinkage long compat_sys_shmctl(int first, int second, void __user *uptr);
  715. asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
  716. /* net/socket.c */
  717. asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, compat_size_t len,
  718. unsigned flags, struct sockaddr __user *addr,
  719. int __user *addrlen);
  720. asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg,
  721. unsigned flags);
  722. asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg,
  723. unsigned int flags);
  724. /* mm/filemap.c: No generic prototype for readahead */
  725. /* security/keys/keyctl.c */
  726. asmlinkage long compat_sys_keyctl(u32 option,
  727. u32 arg2, u32 arg3, u32 arg4, u32 arg5);
  728. /* arch/example/kernel/sys_example.c */
  729. asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
  730. const compat_uptr_t __user *envp);
  731. /* mm/fadvise.c: No generic prototype for fadvise64_64 */
  732. /* mm/, CONFIG_MMU only */
  733. asmlinkage long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid,
  734. compat_pid_t pid, int sig,
  735. struct compat_siginfo __user *uinfo);
  736. asmlinkage long compat_sys_recvmmsg_time64(int fd, struct compat_mmsghdr __user *mmsg,
  737. unsigned vlen, unsigned int flags,
  738. struct __kernel_timespec __user *timeout);
  739. asmlinkage long compat_sys_recvmmsg_time32(int fd, struct compat_mmsghdr __user *mmsg,
  740. unsigned vlen, unsigned int flags,
  741. struct old_timespec32 __user *timeout);
  742. asmlinkage long compat_sys_wait4(compat_pid_t pid,
  743. compat_uint_t __user *stat_addr, int options,
  744. struct compat_rusage __user *ru);
  745. asmlinkage long compat_sys_fanotify_mark(int, unsigned int, __u32, __u32,
  746. int, const char __user *);
  747. asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
  748. struct file_handle __user *handle,
  749. int flags);
  750. asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
  751. unsigned vlen, unsigned int flags);
  752. asmlinkage long compat_sys_execveat(int dfd, const char __user *filename,
  753. const compat_uptr_t __user *argv,
  754. const compat_uptr_t __user *envp, int flags);
  755. asmlinkage ssize_t compat_sys_preadv2(compat_ulong_t fd,
  756. const struct iovec __user *vec,
  757. compat_ulong_t vlen, u32 pos_low, u32 pos_high, rwf_t flags);
  758. asmlinkage ssize_t compat_sys_pwritev2(compat_ulong_t fd,
  759. const struct iovec __user *vec,
  760. compat_ulong_t vlen, u32 pos_low, u32 pos_high, rwf_t flags);
  761. #ifdef __ARCH_WANT_COMPAT_SYS_PREADV64V2
  762. asmlinkage long compat_sys_preadv64v2(unsigned long fd,
  763. const struct iovec __user *vec,
  764. unsigned long vlen, loff_t pos, rwf_t flags);
  765. #endif
  766. #ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64V2
  767. asmlinkage long compat_sys_pwritev64v2(unsigned long fd,
  768. const struct iovec __user *vec,
  769. unsigned long vlen, loff_t pos, rwf_t flags);
  770. #endif
  771. /*
  772. * Deprecated system calls which are still defined in
  773. * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch
  774. */
  775. /* __ARCH_WANT_SYSCALL_NO_AT */
  776. asmlinkage long compat_sys_open(const char __user *filename, int flags,
  777. umode_t mode);
  778. /* __ARCH_WANT_SYSCALL_NO_FLAGS */
  779. asmlinkage long compat_sys_signalfd(int ufd,
  780. const compat_sigset_t __user *sigmask,
  781. compat_size_t sigsetsize);
  782. /* __ARCH_WANT_SYSCALL_OFF_T */
  783. asmlinkage long compat_sys_newstat(const char __user *filename,
  784. struct compat_stat __user *statbuf);
  785. asmlinkage long compat_sys_newlstat(const char __user *filename,
  786. struct compat_stat __user *statbuf);
  787. /* __ARCH_WANT_SYSCALL_DEPRECATED */
  788. asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
  789. compat_ulong_t __user *outp, compat_ulong_t __user *exp,
  790. struct old_timeval32 __user *tvp);
  791. asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32);
  792. asmlinkage long compat_sys_recv(int fd, void __user *buf, compat_size_t len,
  793. unsigned flags);
  794. /* obsolete: fs/readdir.c */
  795. asmlinkage long compat_sys_old_readdir(unsigned int fd,
  796. struct compat_old_linux_dirent __user *,
  797. unsigned int count);
  798. /* obsolete: fs/select.c */
  799. asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg);
  800. /* obsolete: ipc */
  801. asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32);
  802. /* obsolete: kernel/signal.c */
  803. #ifdef __ARCH_WANT_SYS_SIGPENDING
  804. asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set);
  805. #endif
  806. #ifdef __ARCH_WANT_SYS_SIGPROCMASK
  807. asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *nset,
  808. compat_old_sigset_t __user *oset);
  809. #endif
  810. #ifdef CONFIG_COMPAT_OLD_SIGACTION
  811. asmlinkage long compat_sys_sigaction(int sig,
  812. const struct compat_old_sigaction __user *act,
  813. struct compat_old_sigaction __user *oact);
  814. #endif
  815. /* obsolete: net/socket.c */
  816. asmlinkage long compat_sys_socketcall(int call, u32 __user *args);
  817. #ifdef __ARCH_WANT_COMPAT_TRUNCATE64
  818. asmlinkage long compat_sys_truncate64(const char __user *pathname, compat_arg_u64(len));
  819. #endif
  820. #ifdef __ARCH_WANT_COMPAT_FTRUNCATE64
  821. asmlinkage long compat_sys_ftruncate64(unsigned int fd, compat_arg_u64(len));
  822. #endif
  823. #ifdef __ARCH_WANT_COMPAT_FALLOCATE
  824. asmlinkage long compat_sys_fallocate(int fd, int mode, compat_arg_u64(offset),
  825. compat_arg_u64(len));
  826. #endif
  827. #ifdef __ARCH_WANT_COMPAT_PREAD64
  828. asmlinkage long compat_sys_pread64(unsigned int fd, char __user *buf, size_t count,
  829. compat_arg_u64(pos));
  830. #endif
  831. #ifdef __ARCH_WANT_COMPAT_PWRITE64
  832. asmlinkage long compat_sys_pwrite64(unsigned int fd, const char __user *buf, size_t count,
  833. compat_arg_u64(pos));
  834. #endif
  835. #ifdef __ARCH_WANT_COMPAT_SYNC_FILE_RANGE
  836. asmlinkage long compat_sys_sync_file_range(int fd, compat_arg_u64(pos),
  837. compat_arg_u64(nbytes), unsigned int flags);
  838. #endif
  839. #ifdef __ARCH_WANT_COMPAT_FADVISE64_64
  840. asmlinkage long compat_sys_fadvise64_64(int fd, compat_arg_u64(pos),
  841. compat_arg_u64(len), int advice);
  842. #endif
  843. #ifdef __ARCH_WANT_COMPAT_READAHEAD
  844. asmlinkage long compat_sys_readahead(int fd, compat_arg_u64(offset), size_t count);
  845. #endif
  846. #endif /* CONFIG_ARCH_HAS_SYSCALL_WRAPPER */
  847. /**
  848. * ns_to_old_timeval32 - Compat version of ns_to_timeval
  849. * @nsec: the nanoseconds value to be converted
  850. *
  851. * Returns the old_timeval32 representation of the nsec parameter.
  852. */
  853. static inline struct old_timeval32 ns_to_old_timeval32(s64 nsec)
  854. {
  855. struct __kernel_old_timeval tv;
  856. struct old_timeval32 ctv;
  857. tv = ns_to_kernel_old_timeval(nsec);
  858. ctv.tv_sec = tv.tv_sec;
  859. ctv.tv_usec = tv.tv_usec;
  860. return ctv;
  861. }
  862. /*
  863. * Kernel code should not call compat syscalls (i.e., compat_sys_xyzyyz())
  864. * directly. Instead, use one of the functions which work equivalently, such
  865. * as the kcompat_sys_xyzyyz() functions prototyped below.
  866. */
  867. int kcompat_sys_statfs64(const char __user * pathname, compat_size_t sz,
  868. struct compat_statfs64 __user * buf);
  869. int kcompat_sys_fstatfs64(unsigned int fd, compat_size_t sz,
  870. struct compat_statfs64 __user * buf);
  871. #ifdef CONFIG_COMPAT
  872. /*
  873. * For most but not all architectures, "am I in a compat syscall?" and
  874. * "am I a compat task?" are the same question. For architectures on which
  875. * they aren't the same question, arch code can override in_compat_syscall.
  876. */
  877. #ifndef in_compat_syscall
  878. static inline bool in_compat_syscall(void) { return is_compat_task(); }
  879. #endif
  880. #else /* !CONFIG_COMPAT */
  881. #define is_compat_task() (0)
  882. /* Ensure no one redefines in_compat_syscall() under !CONFIG_COMPAT */
  883. #define in_compat_syscall in_compat_syscall
  884. static inline bool in_compat_syscall(void) { return false; }
  885. #endif /* CONFIG_COMPAT */
  886. #define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t))
  887. #define BITS_TO_COMPAT_LONGS(bits) DIV_ROUND_UP(bits, BITS_PER_COMPAT_LONG)
  888. long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
  889. unsigned long bitmap_size);
  890. long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
  891. unsigned long bitmap_size);
  892. /*
  893. * Some legacy ABIs like the i386 one use less than natural alignment for 64-bit
  894. * types, and will need special compat treatment for that. Most architectures
  895. * don't need that special handling even for compat syscalls.
  896. */
  897. #ifndef compat_need_64bit_alignment_fixup
  898. #define compat_need_64bit_alignment_fixup() false
  899. #endif
  900. /*
  901. * A pointer passed in from user mode. This should not
  902. * be used for syscall parameters, just declare them
  903. * as pointers because the syscall entry code will have
  904. * appropriately converted them already.
  905. */
  906. #ifndef compat_ptr
  907. static inline void __user *compat_ptr(compat_uptr_t uptr)
  908. {
  909. return (void __user *)(unsigned long)uptr;
  910. }
  911. #endif
  912. static inline compat_uptr_t ptr_to_compat(void __user *uptr)
  913. {
  914. return (u32)(unsigned long)uptr;
  915. }
  916. #endif /* _LINUX_COMPAT_H */