Changeset View
Changeset View
Standalone View
Standalone View
share/man/man9/memcpy.9
| Show All 23 Lines | |||||||||
| .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||||||
| .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||||||
| .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||||||
| .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||||||
| .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||||||
| .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||||||
| .\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||||||
| .\" | .\" | ||||||||
| .Dd June 19, 2026 | .Dd July 1, 2026 | ||||||||
| .Dt MEMCPY 9 | .Dt MEMCPY 9 | ||||||||
| .Os | .Os | ||||||||
| .Sh NAME | .Sh NAME | ||||||||
| .Nm memcpy | .Nm memcpy , | ||||||||
| .Nm memcpy_data | |||||||||
| .Nd copy bytes in memory | .Nd copy bytes in memory | ||||||||
| .Sh SYNOPSIS | .Sh SYNOPSIS | ||||||||
| .In sys/systm.h | .In sys/systm.h | ||||||||
| .Ft void * | .Ft void * | ||||||||
| .Fn memcpy "void *dst" "const void *src" "size_t len" | .Fn memcpy "void *dst" "const void *src" "size_t len" | ||||||||
| .Ft void * | |||||||||
| .Fn memcpy_data "void *dst" "const void *src" "size_t len" | |||||||||
| .Sh DESCRIPTION | .Sh DESCRIPTION | ||||||||
| The | The | ||||||||
| .Fn memcpy | .Fn memcpy | ||||||||
| function copies | function copies | ||||||||
| .Fa len | .Fa len | ||||||||
| bytes from object | bytes from object | ||||||||
| .Fa src | .Fa src | ||||||||
| to object | to object | ||||||||
| .Fa dst . | .Fa dst | ||||||||
| in a manner that preserves the provenance of pointers in the copied object | |||||||||
kib: Which pointer?
I suspect the pointers contained in the copied object? | |||||||||
| .Pq see Xr memory_model 7 for further information . | |||||||||
Done Inline Actions
emaste: | |||||||||
| If | If | ||||||||
| .Fa src | .Fa src | ||||||||
| and | and | ||||||||
| .Fa dst | .Fa dst | ||||||||
| overlap, the results are not defined. | overlap, the results are not defined. | ||||||||
| The | |||||||||
| .Fn memcpy_data | |||||||||
| function does the same except that it does not preserve the provenance | |||||||||
Done Inline Actionswhere is "pointer provenance" defined? adrian: where is "pointer provenance" defined? | |||||||||
Done Inline ActionsNow linked to a discussion in arch(7). brooks: Now linked to a discussion in arch(7). | |||||||||
Done Inline Actions
Given our explicit decision of making this the non-default case, do we want to make this read a bit more in an active sense -- something along the lines of "discards" rather than "does not preserve"? "Discards pointer provenance" is not quite right though. In a CHERI sense we could maybe use "discards capability validity." Anyway, a suggestion if you can find a good way to express this, otherwise we can leave it until CHERI-specific content starts getting added. emaste: Given our explicit decision of making this the non-default case, do we want to make this read a… | |||||||||
Done Inline ActionsI've added some more active CHERI-specific content. In the non-CHERI case it's probably best to be somewhat passive here since it's literally a no-op today. brooks: I've added some more active CHERI-specific content. In the non-CHERI case it's probably best to… | |||||||||
| of pointers in the copied object. | |||||||||
| On CHERI targets, the validity tag of any copied capability is | |||||||||
| explicitly cleared. | |||||||||
Done Inline Actions
emaste: | |||||||||
| .Sh RETURN VALUES | .Sh RETURN VALUES | ||||||||
| The | The | ||||||||
| .Fn memcpy | .Fn memcpy | ||||||||
| function | and | ||||||||
| returns the original value of | .Fn memcpy_data | ||||||||
| functions return the original value of | |||||||||
| .Fa dst . | .Fa dst . | ||||||||
| .Pp | |||||||||
| .Sh SEE ALSO | .Sh SEE ALSO | ||||||||
Done Inline ActionsNot part of your change but this is a stray .Pp emaste: Not part of your change but this is a stray `.Pp` | |||||||||
| .Xr bcopy 9 , | .Xr bcopy 9 , | ||||||||
| .Xr memmove 9 | .Xr memmove 9 , | ||||||||
| .Xr memmove_data 9 | |||||||||
| .Sh STANDARDS | .Sh STANDARDS | ||||||||
| The | The | ||||||||
| .Fn memcpy | .Fn memcpy | ||||||||
| function | function | ||||||||
| conforms to | conforms to | ||||||||
| .St -isoC . | .St -isoC . | ||||||||
| .Sh HISTORY | .Sh HISTORY | ||||||||
| The | The | ||||||||
| .Fn memcpy | .Fn memcpy | ||||||||
| function first appeared in | function first appeared in | ||||||||
| .At V | .At V | ||||||||
| and was reimplemented for | and was reimplemented for | ||||||||
| .Bx 4.3 Tahoe . | .Bx 4.3 Tahoe . | ||||||||
| The | |||||||||
| .Fn memcpy_data | |||||||||
| function first appeared in | |||||||||
Done Inline Actionstypo ziaee: typo | |||||||||
| .Fx 16.0 . | |||||||||
Which pointer?
I suspect the pointers contained in the copied object?