asdhasodjassd

Pre fb041b598997d63c0f7d7305dfae70046bf66fe1 rw_copy_check_uvector

Oct 23rd, 2020
93
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Pre fb041b598997d63c0f7d7305dfae70046bf66fe1 rw_copy_check_uvector
  2.  
  3. 0000000000001918 <rw_copy_check_uvector>:
  4. */
  5. ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
  6. unsigned long nr_segs, unsigned long fast_segs,
  7. struct iovec *fast_pointer,
  8. struct iovec **ret_pointer)
  9. {
  10. 1918: d503233f paciasp
  11. 191c: a9bb7bfd stp x29, x30, [sp, #-80]!
  12. 1920: f9000bf9 str x25, [sp, #16]
  13. 1924: a9025ff8 stp x24, x23, [sp, #32]
  14. 1928: a90357f6 stp x22, x21, [sp, #48]
  15. 192c: a9044ff4 stp x20, x19, [sp, #64]
  16. 1930: 910003fd mov x29, sp
  17. 1934: aa0503f3 mov x19, x5
  18. 1938: aa0403f4 mov x20, x4
  19. /*
  20. * SuS says "The readv() function *may* fail if the iovcnt argument
  21. * was less than or equal to 0, or greater than {IOV_MAX}. Linux has
  22. * traditionally returned zero for zero segments, so...
  23. */
  24. if (nr_segs == 0) {
  25. 193c: b40000c2 cbz x2, 1954 <rw_copy_check_uvector+0x3c>
  26. 1940: aa0203f6 mov x22, x2
  27.  
  28. /*
  29. * First get the "struct iovec" from user memory and
  30. * verify all the pointers
  31. */
  32. if (nr_segs > UIO_MAXIOV) {
  33. 1944: f110005f cmp x2, #0x400
  34. 1948: 54000189 b.ls 1978 <rw_copy_check_uvector+0x60> // b.plast
  35. 194c: 928002a0 mov x0, #0xffffffffffffffea // #-22
  36. 1950: 14000002 b 1958 <rw_copy_check_uvector+0x40>
  37. 1954: aa1f03e0 mov x0, xzr
  38. iov[seg].iov_len = len;
  39. }
  40. ret += len;
  41. }
  42. out:
  43. *ret_pointer = iov;
  44. 1958: f9000274 str x20, [x19]
  45. return ret;
  46. }
  47. 195c: a9444ff4 ldp x20, x19, [sp, #64]
  48. 1960: a94357f6 ldp x22, x21, [sp, #48]
  49. 1964: a9425ff8 ldp x24, x23, [sp, #32]
  50. 1968: f9400bf9 ldr x25, [sp, #16]
  51. 196c: a8c57bfd ldp x29, x30, [sp], #80
  52. 1970: d50323bf autiasp
  53. 1974: d65f03c0 ret
  54. 1978: aa0103f7 mov x23, x1
  55. 197c: 2a0003f5 mov w21, w0
  56. if (nr_segs > fast_segs) {
  57. 1980: eb0302df cmp x22, x3
  58. 1984: 540000a9 b.ls 1998 <rw_copy_check_uvector+0x80> // b.plast
  59. iov = kmalloc_array(nr_segs, sizeof(struct iovec), GFP_KERNEL);
  60. 1988: aa1603e0 mov x0, x22
  61. 198c: 9400004d bl 1ac0 <kmalloc_array>
  62. 1990: aa0003f4 mov x20, x0
  63. if (iov == NULL) {
  64. 1994: b4000780 cbz x0, 1a84 <rw_copy_check_uvector+0x16c>
  65. 1998: d5384119 mrs x25, sp_el0
  66. (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR)))
  67. 199c: 3940bb2a ldrb w10, [x25, #46]
  68. unsigned long ret, limit = current_thread_info()->addr_limit;
  69. 19a0: f9400729 ldr x9, [x25, #8]
  70. if (copy_from_user(iov, uvector, nr_segs*sizeof(*uvector))) {
  71. 19a4: d37ceed8 lsl x24, x22, #4
  72. 19a8: d378dee8 lsl x8, x23, #8
  73. (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR)))
  74. 19ac: 3728008a tbnz w10, #5, 19bc <rw_copy_check_uvector+0xa4>
  75. 19b0: f940032b ldr x11, [x25]
  76. 19b4: aa1703ea mov x10, x23
  77. if (IS_ENABLED(CONFIG_ARM64_TAGGED_ADDR_ABI) &&
  78. 19b8: 36d0004b tbz w11, #26, 19c0 <rw_copy_check_uvector+0xa8>
  79. addr = untagged_addr(addr);
  80. 19bc: 8a8822ea and x10, x23, x8, asr #8
  81. asm volatile(
  82. 19c0: ab18014a adds x10, x10, x24
  83. 19c4: 9a8983e9 csel x9, xzr, x9, hi // hi = pmore
  84. 19c8: da9f314a csinv x10, x10, xzr, cc // cc = lo, ul, last
  85. 19cc: fa09015f sbcs xzr, x10, x9
  86. 19d0: 9a9f87ea cset x10, ls // ls = plast
  87. if (likely(access_ok(from, n))) {
  88. 19d4: b400060a cbz x10, 1a94 <rw_copy_check_uvector+0x17c>
  89. __uaccess_enable(ARM64_ALT_PAN_NOT_UAO);
  90. 19d8: d503201f nop
  91. : "r" (ptr), "r" (current_thread_info()->addr_limit),
  92. 19dc: f9400729 ldr x9, [x25, #8]
  93. "r" (untagged_addr(ptr))
  94. 19e0: 8a8822e8 and x8, x23, x8, asr #8
  95. asm volatile(
  96. 19e4: ea29011f bics xzr, x8, x9
  97. 19e8: 9a9f02e1 csel x1, x23, xzr, eq // eq = none
  98. csdb();
  99. 19ec: d503229f csdb
  100. res = raw_copy_from_user(to, from, n);
  101. 19f0: aa1403e0 mov x0, x20
  102. 19f4: aa1803e2 mov x2, x24
  103. 19f8: 94000000 bl 0 <__arch_copy_from_user>
  104. __uaccess_disable(ARM64_ALT_PAN_NOT_UAO);
  105. 19fc: d503201f nop
  106. if (unlikely(res))
  107. 1a00: b5000520 cbnz x0, 1aa4 <rw_copy_check_uvector+0x18c>
  108. for (seg = 0; seg < nr_segs; seg++) {
  109. 1a04: f10006df cmp x22, #0x1
  110. 1a08: 91002288 add x8, x20, #0x8
  111. 1a0c: 9a9f86c9 csinc x9, x22, xzr, hi // hi = pmore
  112. 1a10: 32144bea mov w10, #0x7ffff000 // #2147479552
  113. 1a14: 14000005 b 1a28 <rw_copy_check_uvector+0x110>
  114. ret += len;
  115. 1a18: 8b000160 add x0, x11, x0
  116. for (seg = 0; seg < nr_segs; seg++) {
  117. 1a1c: f1000529 subs x9, x9, #0x1
  118. 1a20: 91004108 add x8, x8, #0x10
  119. 1a24: 54fff9a0 b.eq 1958 <rw_copy_check_uvector+0x40> // b.none
  120. ssize_t len = (ssize_t)iov[seg].iov_len;
  121. 1a28: f940010b ldr x11, [x8]
  122. 1a2c: b7fff90b tbnz x11, #63, 194c <rw_copy_check_uvector+0x34>
  123. && unlikely(!access_ok(buf, len))) {
  124. 1a30: 37f801f5 tbnz w21, #31, 1a6c <rw_copy_check_uvector+0x154>
  125. 1a34: f85f810c ldur x12, [x8, #-8]
  126. (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR)))
  127. 1a38: 3940bb2e ldrb w14, [x25, #46]
  128. unsigned long ret, limit = current_thread_info()->addr_limit;
  129. 1a3c: f940072d ldr x13, [x25, #8]
  130. (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR)))
  131. 1a40: 3728006e tbnz w14, #5, 1a4c <rw_copy_check_uvector+0x134>
  132. 1a44: f940032e ldr x14, [x25]
  133. if (IS_ENABLED(CONFIG_ARM64_TAGGED_ADDR_ABI) &&
  134. 1a48: 36d0006e tbz w14, #26, 1a54 <rw_copy_check_uvector+0x13c>
  135. 1a4c: d378dd8e lsl x14, x12, #8
  136. addr = untagged_addr(addr);
  137. 1a50: 8a8e218c and x12, x12, x14, asr #8
  138. asm volatile(
  139. 1a54: ab0b018c adds x12, x12, x11
  140. 1a58: 9a8d83ed csel x13, xzr, x13, hi // hi = pmore
  141. 1a5c: da9f318c csinv x12, x12, xzr, cc // cc = lo, ul, last
  142. 1a60: fa0d019f sbcs xzr, x12, x13
  143. 1a64: 9a9f87ec cset x12, ls // ls = plast
  144. if (type >= 0
  145. 1a68: b400012c cbz x12, 1a8c <rw_copy_check_uvector+0x174>
  146. if (len > MAX_RW_COUNT - ret) {
  147. 1a6c: cb00014c sub x12, x10, x0
  148. 1a70: eb0c017f cmp x11, x12
  149. 1a74: 54fffd29 b.ls 1a18 <rw_copy_check_uvector+0x100> // b.plast
  150. 1a78: aa0c03eb mov x11, x12
  151. iov[seg].iov_len = len;
  152. 1a7c: f900010c str x12, [x8]
  153. 1a80: 17ffffe6 b 1a18 <rw_copy_check_uvector+0x100>
  154. 1a84: 92800160 mov x0, #0xfffffffffffffff4 // #-12
  155. 1a88: 17ffffb4 b 1958 <rw_copy_check_uvector+0x40>
  156. 1a8c: 928001a0 mov x0, #0xfffffffffffffff2 // #-14
  157. 1a90: 17ffffb2 b 1958 <rw_copy_check_uvector+0x40>
  158. memset(to + (n - res), 0, res);
  159. 1a94: aa1403e0 mov x0, x20
  160. 1a98: 2a1f03e1 mov w1, wzr
  161. 1a9c: aa1803e2 mov x2, x24
  162. 1aa0: 14000005 b 1ab4 <rw_copy_check_uvector+0x19c>
  163. 1aa4: cb000308 sub x8, x24, x0
  164. 1aa8: aa0003e2 mov x2, x0
  165. 1aac: 8b080280 add x0, x20, x8
  166. 1ab0: 2a1f03e1 mov w1, wzr
  167. 1ab4: 94000000 bl 0 <memset>
  168. 1ab8: 928001a0 mov x0, #0xfffffffffffffff2 // #-14
  169. 1abc: 17ffffa7 b 1958 <rw_copy_check_uvector+0x40>
  170.  
RAW Paste Data