Thread (23 messages) 23 messages, 6 authors, 2021-06-30

Re: [PATCH v3 1/3] riscv: optimized memcpy

From: Nick Kossifidis <hidden>
Date: 2021-06-23 09:48:45
Also in: linux-riscv, lkml

Στις 2021-06-23 02:35, Matteo Croce έγραψε:
quoted
If you want to be compliant with memcpy you should check for 
overlapping
regions here since "The memory areas must not overlap", and do nothing
about it because according to POSIX this leads to undefined behavior.
That's why recent libc implementations use memmove in any case (memcpy
is an alias to memmove), which is the suggested approach.
Mmm which memcpy arch implementation does this check?
I guess that noone is currently doing it.
Yup because even if they did the wouldn't know what to do about it since 
POSIX leaves this as undefined behavior. So instead of using memcpy it's 
suggested that people use memmove that can handle overlapping regions, 
and because we can't patch the rest of the kernel to only use memmove 
(or the rest of the programs if we were a libc), the idea is to just 
alias memcpy to memmove (BTW Torvalds also thinks this is a good idea: 
https://bugzilla.redhat.com/show_bug.cgi?id=638477#c132).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help