Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2021
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.29 KB | None | 0 0
  1. diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h
  2. index fa2713ae6bea..73eb97110757 100644
  3. --- a/arch/arc/include/uapi/asm/unistd.h
  4. +++ b/arch/arc/include/uapi/asm/unistd.h
  5. @@ -26,8 +26,6 @@
  6. #define __ARCH_WANT_SYS_FORK
  7. #define __ARCH_WANT_TIME32_SYSCALLS
  8.  
  9. -#define sys_mmap2 sys_mmap_pgoff
  10. -
  11. #include <asm-generic/unistd.h>
  12.  
  13. #define NR_syscalls __NR_syscalls
  14. diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
  15. index a4dbac07e4ef..bc7884b0736f 100644
  16. --- a/arch/arm/include/asm/ftrace.h
  17. +++ b/arch/arm/include/asm/ftrace.h
  18. @@ -60,9 +60,7 @@ static inline void *return_address(unsigned int level)
  19. static inline bool arch_syscall_match_sym_name(const char *sym,
  20. const char *name)
  21. {
  22. - if (!strcmp(sym, "sys_mmap2"))
  23. - sym = "sys_mmap_pgoff";
  24. - else if (!strcmp(sym, "sys_statfs64_wrapper"))
  25. + if (!strcmp(sym, "sys_statfs64_wrapper"))
  26. sym = "sys_statfs64";
  27. else if (!strcmp(sym, "sys_fstatfs64_wrapper"))
  28. sym = "sys_fstatfs64";
  29. diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
  30. index 67a89e598f9e..09d723635b85 100644
  31. --- a/arch/arm/kernel/entry-common.S
  32. +++ b/arch/arm/kernel/entry-common.S
  33. @@ -400,15 +400,6 @@ sys_fstatfs64_wrapper:
  34. b sys_fstatfs64
  35. ENDPROC(sys_fstatfs64_wrapper)
  36.  
  37. -/*
  38. - * Note: off_4k (r5) is always units of 4K. If we can't do the requested
  39. - * offset, we return EINVAL.
  40. - */
  41. -sys_mmap2:
  42. - str r5, [sp, #4]
  43. - b sys_mmap_pgoff
  44. -ENDPROC(sys_mmap2)
  45. -
  46. #ifdef CONFIG_OABI_COMPAT
  47.  
  48. /*
  49. diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
  50. index 604a2053d006..7a8b8480113a 100644
  51. --- a/arch/arm64/include/asm/unistd32.h
  52. +++ b/arch/arm64/include/asm/unistd32.h
  53. @@ -395,7 +395,7 @@ __SYSCALL(__NR_vfork, sys_vfork)
  54. #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
  55. __SYSCALL(__NR_ugetrlimit, compat_sys_getrlimit) /* SuS compliant getrlimit */
  56. #define __NR_mmap2 192
  57. -__SYSCALL(__NR_mmap2, compat_sys_aarch32_mmap2)
  58. +__SYSCALL(__NR_mmap2, sys_mmap2)
  59. #define __NR_truncate64 193
  60. __SYSCALL(__NR_truncate64, compat_sys_aarch32_truncate64)
  61. #define __NR_ftruncate64 194
  62. diff --git a/arch/arm64/kernel/sys32.c b/arch/arm64/kernel/sys32.c
  63. index a64c3d9fec2c..8f6fbffb0390 100644
  64. --- a/arch/arm64/kernel/sys32.c
  65. +++ b/arch/arm64/kernel/sys32.c
  66. @@ -48,22 +48,6 @@ COMPAT_SYSCALL_DEFINE3(aarch32_fstatfs64, unsigned int, fd, compat_size_t, sz,
  67. return kcompat_sys_fstatfs64(fd, sz, buf);
  68. }
  69.  
  70. -/*
  71. - * Note: off_4k is always in units of 4K. If we can't do the
  72. - * requested offset because it is not page-aligned, we return -EINVAL.
  73. - */
  74. -COMPAT_SYSCALL_DEFINE6(aarch32_mmap2, unsigned long, addr, unsigned long, len,
  75. - unsigned long, prot, unsigned long, flags,
  76. - unsigned long, fd, unsigned long, off_4k)
  77. -{
  78. - if (off_4k & (~PAGE_MASK >> 12))
  79. - return -EINVAL;
  80. -
  81. - off_4k >>= (PAGE_SHIFT - 12);
  82. -
  83. - return ksys_mmap_pgoff(addr, len, prot, flags, fd, off_4k);
  84. -}
  85. -
  86. #ifdef CONFIG_CPU_BIG_ENDIAN
  87. #define arg_u32p(name) u32, name##_hi, u32, name##_lo
  88. #else
  89. diff --git a/arch/csky/kernel/syscall.c b/arch/csky/kernel/syscall.c
  90. index 3d30e58a45d2..ecde99520fd1 100644
  91. --- a/arch/csky/kernel/syscall.c
  92. +++ b/arch/csky/kernel/syscall.c
  93. @@ -14,21 +14,6 @@ SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
  94. return 0;
  95. }
  96.  
  97. -SYSCALL_DEFINE6(mmap2,
  98. - unsigned long, addr,
  99. - unsigned long, len,
  100. - unsigned long, prot,
  101. - unsigned long, flags,
  102. - unsigned long, fd,
  103. - off_t, offset)
  104. -{
  105. - if (unlikely(offset & (~PAGE_MASK >> 12)))
  106. - return -EINVAL;
  107. -
  108. - return ksys_mmap_pgoff(addr, len, prot, flags, fd,
  109. - offset >> (PAGE_SHIFT - 12));
  110. -}
  111. -
  112. /*
  113. * for abiv1 the 64bits args should be even th, So we need mov the advice
  114. * forward.
  115. diff --git a/arch/h8300/kernel/syscalls.c b/arch/h8300/kernel/syscalls.c
  116. index 9022036fb3d2..7b9620dd314d 100644
  117. --- a/arch/h8300/kernel/syscalls.c
  118. +++ b/arch/h8300/kernel/syscalls.c
  119. @@ -6,8 +6,6 @@
  120. #undef __SYSCALL
  121. #define __SYSCALL(nr, call) [nr] = (call),
  122.  
  123. -#define sys_mmap2 sys_mmap_pgoff
  124. -
  125. asmlinkage int sys_rt_sigreturn(void);
  126.  
  127. void *_sys_call_table[__NR_syscalls] = {
  128. diff --git a/arch/hexagon/include/uapi/asm/unistd.h b/arch/hexagon/include/uapi/asm/unistd.h
  129. index 432c4db1b623..37e1dcced3ca 100644
  130. --- a/arch/hexagon/include/uapi/asm/unistd.h
  131. +++ b/arch/hexagon/include/uapi/asm/unistd.h
  132. @@ -27,7 +27,6 @@
  133. * See also: syscalltab.c
  134. */
  135.  
  136. -#define sys_mmap2 sys_mmap_pgoff
  137. #define __ARCH_WANT_RENAMEAT
  138. #define __ARCH_WANT_STAT64
  139. #define __ARCH_WANT_SET_GET_RLIMIT
  140. diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
  141. index bd0274c7592e..406e742c5498 100644
  142. --- a/arch/m68k/kernel/sys_m68k.c
  143. +++ b/arch/m68k/kernel/sys_m68k.c
  144. @@ -37,18 +37,6 @@
  145. asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
  146. unsigned long error_code);
  147.  
  148. -asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
  149. - unsigned long prot, unsigned long flags,
  150. - unsigned long fd, unsigned long pgoff)
  151. -{
  152. - /*
  153. - * This is wrong for sun3 - there PAGE_SIZE is 8Kb,
  154. - * so we need to shift the argument down by 1; m68k mmap64(3)
  155. - * (in libc) expects the last argument of mmap2 in 4Kb units.
  156. - */
  157. - return ksys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
  158. -}
  159. -
  160. /* Convert virtual (user) address VADDR to physical address PADDR */
  161. #define virt_to_phys_040(vaddr) \
  162. ({ \
  163. diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S
  164. index e25ef4a9df30..6bc4abef94dc 100644
  165. --- a/arch/m68k/kernel/syscalltable.S
  166. +++ b/arch/m68k/kernel/syscalltable.S
  167. @@ -14,10 +14,6 @@
  168.  
  169. #include <linux/linkage.h>
  170.  
  171. -#ifndef CONFIG_MMU
  172. -#define sys_mmap2 sys_mmap_pgoff
  173. -#endif
  174. -
  175. #define __SYSCALL(nr, entry) .long entry
  176. .section .rodata
  177. ALIGN
  178. diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
  179. index ed9f34da1a2a..f322250c70f3 100644
  180. --- a/arch/microblaze/kernel/sys_microblaze.c
  181. +++ b/arch/microblaze/kernel/sys_microblaze.c
  182. @@ -42,14 +42,3 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
  183.  
  184. return ksys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
  185. }
  186. -
  187. -SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
  188. - unsigned long, prot, unsigned long, flags, unsigned long, fd,
  189. - unsigned long, pgoff)
  190. -{
  191. - if (pgoff & (~PAGE_MASK >> 12))
  192. - return -EINVAL;
  193. -
  194. - return ksys_mmap_pgoff(addr, len, prot, flags, fd,
  195. - pgoff >> (PAGE_SHIFT - 12));
  196. -}
  197. diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
  198. index 5512cd586e6e..c8d62e451675 100644
  199. --- a/arch/mips/kernel/syscall.c
  200. +++ b/arch/mips/kernel/syscall.c
  201. @@ -68,17 +68,6 @@ SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
  202. offset >> PAGE_SHIFT);
  203. }
  204.  
  205. -SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len,
  206. - unsigned long, prot, unsigned long, flags, unsigned long, fd,
  207. - unsigned long, pgoff)
  208. -{
  209. - if (pgoff & (~PAGE_MASK >> 12))
  210. - return -EINVAL;
  211. -
  212. - return ksys_mmap_pgoff(addr, len, prot, flags, fd,
  213. - pgoff >> (PAGE_SHIFT - 12));
  214. -}
  215. -
  216. save_static_function(sys_fork);
  217. save_static_function(sys_clone);
  218. save_static_function(sys_clone3);
  219. diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
  220. index 8f243e35a7b2..60e4414a6966 100644
  221. --- a/arch/mips/kernel/syscalls/syscall_o32.tbl
  222. +++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
  223. @@ -221,7 +221,7 @@
  224. 207 o32 sendfile sys_sendfile compat_sys_sendfile
  225. 208 o32 getpmsg sys_ni_syscall
  226. 209 o32 putpmsg sys_ni_syscall
  227. -210 o32 mmap2 sys_mips_mmap2
  228. +210 o32 mmap2 sys_mmap2
  229. 211 o32 truncate64 sys_truncate64 sys_32_truncate64
  230. 212 o32 ftruncate64 sys_ftruncate64 sys_32_ftruncate64
  231. 213 o32 stat64 sys_stat64 sys_newstat
  232. diff --git a/arch/nds32/kernel/sys_nds32.c b/arch/nds32/kernel/sys_nds32.c
  233. index cb2d1e219bb3..93f33b69f139 100644
  234. --- a/arch/nds32/kernel/sys_nds32.c
  235. +++ b/arch/nds32/kernel/sys_nds32.c
  236. @@ -9,17 +9,6 @@
  237. #include <asm/fpu.h>
  238. #include <asm/fp_udfiex_crtl.h>
  239.  
  240. -SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
  241. - unsigned long, prot, unsigned long, flags,
  242. - unsigned long, fd, unsigned long, pgoff)
  243. -{
  244. - if (pgoff & (~PAGE_MASK >> 12))
  245. - return -EINVAL;
  246. -
  247. - return sys_mmap_pgoff(addr, len, prot, flags, fd,
  248. - pgoff >> (PAGE_SHIFT - 12));
  249. -}
  250. -
  251. SYSCALL_DEFINE4(fadvise64_64_wrapper,int, fd, int, advice, loff_t, offset,
  252. loff_t, len)
  253. {
  254. diff --git a/arch/nios2/include/uapi/asm/unistd.h b/arch/nios2/include/uapi/asm/unistd.h
  255. index 0b4bb1d41b28..667612d3785d 100644
  256. --- a/arch/nios2/include/uapi/asm/unistd.h
  257. +++ b/arch/nios2/include/uapi/asm/unistd.h
  258. @@ -16,8 +16,6 @@
  259. *
  260. */
  261.  
  262. - #define sys_mmap2 sys_mmap_pgoff
  263. -
  264. #define __ARCH_WANT_RENAMEAT
  265. #define __ARCH_WANT_STAT64
  266. #define __ARCH_WANT_SET_GET_RLIMIT
  267. diff --git a/arch/openrisc/include/uapi/asm/unistd.h b/arch/openrisc/include/uapi/asm/unistd.h
  268. index fae34c60fa88..b340f5b07a0c 100644
  269. --- a/arch/openrisc/include/uapi/asm/unistd.h
  270. +++ b/arch/openrisc/include/uapi/asm/unistd.h
  271. @@ -17,8 +17,6 @@
  272. * (at your option) any later version.
  273. */
  274.  
  275. -#define sys_mmap2 sys_mmap_pgoff
  276. -
  277. #define __ARCH_WANT_RENAMEAT
  278. #define __ARCH_WANT_STAT64
  279. #define __ARCH_WANT_SET_GET_RLIMIT
  280. diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
  281. index 2b34294517a1..821724ef9302 100644
  282. --- a/arch/parisc/kernel/sys_parisc.c
  283. +++ b/arch/parisc/kernel/sys_parisc.c
  284. @@ -272,16 +272,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack)
  285. }
  286.  
  287.  
  288. -asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
  289. - unsigned long prot, unsigned long flags, unsigned long fd,
  290. - unsigned long pgoff)
  291. -{
  292. - /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
  293. - we have. */
  294. - return ksys_mmap_pgoff(addr, len, prot, flags, fd,
  295. - pgoff >> (PAGE_SHIFT - 12));
  296. -}
  297. -
  298. asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
  299. unsigned long prot, unsigned long flags, unsigned long fd,
  300. unsigned long offset)
  301. diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h
  302. index 7ee66ae5444d..13727533fdd2 100644
  303. --- a/arch/powerpc/include/asm/syscalls.h
  304. +++ b/arch/powerpc/include/asm/syscalls.h
  305. @@ -13,17 +13,10 @@ struct rtas_args;
  306. asmlinkage long sys_mmap(unsigned long addr, size_t len,
  307. unsigned long prot, unsigned long flags,
  308. unsigned long fd, off_t offset);
  309. -asmlinkage long sys_mmap2(unsigned long addr, size_t len,
  310. - unsigned long prot, unsigned long flags,
  311. - unsigned long fd, unsigned long pgoff);
  312. asmlinkage long ppc64_personality(unsigned long personality);
  313. asmlinkage long sys_rtas(struct rtas_args __user *uargs);
  314.  
  315. #ifdef CONFIG_COMPAT
  316. -unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
  317. - unsigned long prot, unsigned long flags,
  318. - unsigned long fd, unsigned long pgoff);
  319. -
  320. compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count,
  321. u32 reg6, u32 pos1, u32 pos2);
  322.  
  323. diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
  324. index 16ff0399a257..62b9237d7066 100644
  325. --- a/arch/powerpc/kernel/sys_ppc32.c
  326. +++ b/arch/powerpc/kernel/sys_ppc32.c
  327. @@ -48,14 +48,6 @@
  328. #include <asm/syscalls.h>
  329. #include <asm/switch_to.h>
  330.  
  331. -unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
  332. - unsigned long prot, unsigned long flags,
  333. - unsigned long fd, unsigned long pgoff)
  334. -{
  335. - /* This should remain 12 even if PAGE_SIZE changes */
  336. - return sys_mmap(addr, len, prot, flags, fd, pgoff << 12);
  337. -}
  338. -
  339. /*
  340. * long long munging:
  341. * The 32 bit ABI passes long longs in an odd even register pair.
  342. diff --git a/arch/sh/include/asm/syscalls.h b/arch/sh/include/asm/syscalls.h
  343. index 387105316d28..296b377a6b1a 100644
  344. --- a/arch/sh/include/asm/syscalls.h
  345. +++ b/arch/sh/include/asm/syscalls.h
  346. @@ -5,9 +5,6 @@
  347. asmlinkage int old_mmap(unsigned long addr, unsigned long len,
  348. unsigned long prot, unsigned long flags,
  349. int fd, unsigned long off);
  350. -asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
  351. - unsigned long prot, unsigned long flags,
  352. - unsigned long fd, unsigned long pgoff);
  353.  
  354. #include <asm/syscalls_32.h>
  355.  
  356. diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
  357. index a5a7b33ed81a..45abd5e1246e 100644
  358. --- a/arch/sh/kernel/sys_sh.c
  359. +++ b/arch/sh/kernel/sys_sh.c
  360. @@ -38,22 +38,6 @@ asmlinkage int old_mmap(unsigned long addr, unsigned long len,
  361. return ksys_mmap_pgoff(addr, len, prot, flags, fd, off>>PAGE_SHIFT);
  362. }
  363.  
  364. -asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
  365. - unsigned long prot, unsigned long flags,
  366. - unsigned long fd, unsigned long pgoff)
  367. -{
  368. - /*
  369. - * The shift for mmap2 is constant, regardless of PAGE_SIZE
  370. - * setting.
  371. - */
  372. - if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1))
  373. - return -EINVAL;
  374. -
  375. - pgoff >>= PAGE_SHIFT - 12;
  376. -
  377. - return ksys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
  378. -}
  379. -
  380. /* sys_cacheflush -- flush (part of) the processor cache. */
  381. asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op)
  382. {
  383. diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
  384. index 082a551897ed..0e4f27053384 100644
  385. --- a/arch/sparc/kernel/sys_sparc_32.c
  386. +++ b/arch/sparc/kernel/sys_sparc_32.c
  387. @@ -96,18 +96,6 @@ int sparc_mmap_check(unsigned long addr, unsigned long len)
  388. return 0;
  389. }
  390.  
  391. -/* Linux version of mmap */
  392. -
  393. -SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
  394. - unsigned long, prot, unsigned long, flags, unsigned long, fd,
  395. - unsigned long, pgoff)
  396. -{
  397. - /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
  398. - we have. */
  399. - return ksys_mmap_pgoff(addr, len, prot, flags, fd,
  400. - pgoff >> (PAGE_SHIFT - 12));
  401. -}
  402. -
  403. SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
  404. unsigned long, prot, unsigned long, flags, unsigned long, fd,
  405. unsigned long, off)
  406. diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
  407. index 320480a8db4f..a037b14d5b4f 100644
  408. --- a/arch/x86/entry/syscalls/syscall_32.tbl
  409. +++ b/arch/x86/entry/syscalls/syscall_32.tbl
  410. @@ -203,7 +203,7 @@
  411. 189 i386 putpmsg
  412. 190 i386 vfork sys_vfork
  413. 191 i386 ugetrlimit sys_getrlimit compat_sys_getrlimit
  414. -192 i386 mmap2 sys_mmap_pgoff
  415. +192 i386 mmap2 sys_mmap2
  416. 193 i386 truncate64 sys_ia32_truncate64
  417. 194 i386 ftruncate64 sys_ia32_ftruncate64
  418. 195 i386 stat64 sys_stat64 compat_sys_ia32_stat64
  419. diff --git a/arch/xtensa/kernel/syscalls/syscall.tbl b/arch/xtensa/kernel/syscalls/syscall.tbl
  420. index 52c94ab5c205..6bf8789e2766 100644
  421. --- a/arch/xtensa/kernel/syscalls/syscall.tbl
  422. +++ b/arch/xtensa/kernel/syscalls/syscall.tbl
  423. @@ -89,7 +89,7 @@
  424. 78 common flistxattr sys_flistxattr
  425. 79 common fremovexattr sys_fremovexattr
  426. # File Map / Shared Memory Operations
  427. -80 common mmap2 sys_mmap_pgoff
  428. +80 common mmap2 sys_mmap2
  429. 81 common munmap sys_munmap
  430. 82 common mprotect sys_mprotect
  431. 83 common brk sys_brk
  432. diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
  433. index 2cf94280faae..f38caf079551 100644
  434. --- a/include/linux/syscalls.h
  435. +++ b/include/linux/syscalls.h
  436. @@ -1269,7 +1269,7 @@ asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
  437. unsigned long third, void __user *ptr, long fifth);
  438.  
  439. /* obsolete: mm/ */
  440. -asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len,
  441. +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
  442. unsigned long prot, unsigned long flags,
  443. unsigned long fd, unsigned long pgoff);
  444. asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg);
  445. diff --git a/mm/mmap.c b/mm/mmap.c
  446. index 3f48d0928e6b..83c1798f8072 100644
  447. --- a/mm/mmap.c
  448. +++ b/mm/mmap.c
  449. @@ -1634,11 +1634,16 @@ unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len,
  450. return retval;
  451. }
  452.  
  453. -SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
  454. +SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
  455. unsigned long, prot, unsigned long, flags,
  456. - unsigned long, fd, unsigned long, pgoff)
  457. + unsigned long, fd, unsigned long, off_4k)
  458. {
  459. - return ksys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
  460. + if (off_4k & (~PAGE_MASK >> 12))
  461. + return -EINVAL;
  462. +
  463. + off_4k >>= (PAGE_SHIFT - 12);
  464. +
  465. + return ksys_mmap_pgoff(addr, len, prot, flags, fd, off_4k);
  466. }
  467.  
  468. #ifdef __ARCH_WANT_SYS_OLD_MMAP
  469. diff --git a/tools/arch/arc/include/uapi/asm/unistd.h b/tools/arch/arc/include/uapi/asm/unistd.h
  470. index 5eafa1115162..fab6ae4b16c2 100644
  471. --- a/tools/arch/arc/include/uapi/asm/unistd.h
  472. +++ b/tools/arch/arc/include/uapi/asm/unistd.h
  473. @@ -25,8 +25,6 @@
  474. #define __ARCH_WANT_SYS_FORK
  475. #define __ARCH_WANT_TIME32_SYSCALLS
  476.  
  477. -#define sys_mmap2 sys_mmap_pgoff
  478. -
  479. #include <asm-generic/unistd.h>
  480.  
  481. #define NR_syscalls __NR_syscalls
  482. diff --git a/tools/arch/hexagon/include/uapi/asm/unistd.h b/tools/arch/hexagon/include/uapi/asm/unistd.h
  483. index 432c4db1b623..37e1dcced3ca 100644
  484. --- a/tools/arch/hexagon/include/uapi/asm/unistd.h
  485. +++ b/tools/arch/hexagon/include/uapi/asm/unistd.h
  486. @@ -27,7 +27,6 @@
  487. * See also: syscalltab.c
  488. */
  489.  
  490. -#define sys_mmap2 sys_mmap_pgoff
  491. #define __ARCH_WANT_RENAMEAT
  492. #define __ARCH_WANT_STAT64
  493. #define __ARCH_WANT_SET_GET_RLIMIT
  494.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement