Copy the user stack at sp in STACK_COPY_CHUNK reads, stopping at the first * unreadable chunk. Returns the bytes copied, a multiple of STACK_COPY_CHUNK. * The loop is bounded by stack_copy_budget (a frozen rodata constant) so every * write into the reservation is provably in range. */
| 105 | * The loop is bounded by stack_copy_budget (a frozen rodata constant) so every |
| 106 | * write into the reservation is provably in range. */ |
| 107 | static __always_inline __u32 copy_user_stack(__u8* bytes, __u64 sp) { |
| 108 | __u32 got = 0; |
| 109 | #pragma clang loop unroll(disable) |
| 110 | for (__u32 off = 0; off + STACK_COPY_CHUNK <= stack_copy_budget; off += STACK_COPY_CHUNK) { |
| 111 | if (bpf_probe_read_user(bytes + off, STACK_COPY_CHUNK, (void*)(sp + off)) != 0) { |
| 112 | break; |
| 113 | } |
| 114 | got = off + STACK_COPY_CHUNK; |
| 115 | } |
| 116 | return got; |
| 117 | } |
| 118 | |
| 119 | /* Hash the first len bytes, one chunk at a time. The loop has the same budget |
| 120 | * bound as the copy so the verifier accepts the reads; len ends it early. */ |
no outgoing calls
no test coverage detected