Lines Matching refs:mempcpy

132 ## Breakdown of `mempcpy`
134 The [FORTIFY'ed version of `mempcpy`] is a full, featureful example of a
139 - If the `mempcpy` has the potential to write to more bytes than what is
147 void* mempcpy(void* __dst, const void* __src, size_t __n) __INTRODUCED_IN(23);
153 The [source for `mempcpy`] in Bionic's headers for is:
156 void* mempcpy(void* const dst __pass_object_size0, const void* src, size_t copy_amount)
159 "'mempcpy' called with size bigger than buffer") {
176 void* mempcpy(
183 "'mempcpy' called with size bigger than buffer"))) {
205 ### How does Clang select `mempcpy`? argument
207 First, it's critical to notice that `mempcpy` is marked `overloadable`. This
217 Second, one might note that this `mempcpy` implementation has the same C-level
226 `mempcpy`. It is impossible to take the address of a function with one or more
228 `&__builtin_mempcpy == &mempcpy`. Further, because this is an issue of overload
229 resolution, `(&mempcpy)(x, y, z);` is functionally identical to
233 - Direct calls to `mempcpy` should call the FORTIFY-protected `mempcpy`.
234 - Indirect calls to `&mempcpy` should call `__builtin_mempcpy`.
238 Once one is convinced that the FORTIFY-enabled overload of `mempcpy` will be
243 `&__builtin_mempcpy == &mempcpy`:
250 mempcpy(buf, input_buf, 4); // Valid, no diagnostic issued.
252 mempcpy(buf, input_buf, 5); // Emits a compile-time error since sizeof(buf) < 5.
254 (&mempcpy)(buf, input_buf, 5); // No compile-time error, since __builtin_mempcpy is selected.
285 mempcpy(buf, input_buf, 4); // Valid, no diagnostic issued.
286 mempcpy(buf, input_buf, 5); // Emits a compile-time error since sizeof(buf) < 5.
288 mempcpy(buf_ptr, input_buf, 5); // No compile-time error; `buf_ptr`'s target can't be determined.
301 overload of `mempcpy` over `__builtin_mempcpy` for direct calls.
302 - If a call to `mempcpy` was trivially broken, Clang would produce a
311 Going back to Bionic's `mempcpy` implementation, we have the following (ignoring
318 void* mempcpy(
385 __check_count("mempcpy", "count", count);
386 __check_buffer_access("mempcpy", "write into", count, dst_len);
387 return mempcpy(dst, src, count);
404 `mempcpy`, the `__builtin_open` declaration is simple:
514 Like `mempcpy`, `diagnose_if` handles emitting a compile-time error if the call
565 Bionic's `poll` implementation is closest to `mempcpy` above, though it has a
593 To get the commonality with `mempcpy` and `open` out of the way:
788 have e.g., `&mempcpy` == `&__builtin_mempcpy`.
831 [FORTIFY'ed version of `mempcpy`]: https://android.googlesource.com/platform/bionic/+/refs/heads/an…
837 [source for `mempcpy`]: https://android.googlesource.com/platform/bionic/+/refs/heads/android12-rel…