[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6b35ec67ae580c64b4259e92ce21dc49@mailhost.ics.forth.gr>
Date: Wed, 23 Jun 2021 12:48:30 +0300
From: Nick Kossifidis <mick@....forth.gr>
To: Matteo Croce <mcroce@...ux.microsoft.com>
Cc: Nick Kossifidis <mick@....forth.gr>,
linux-riscv <linux-riscv@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arch <linux-arch@...r.kernel.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Atish Patra <atish.patra@....com>,
Emil Renner Berthing <kernel@...il.dk>,
Akira Tsukamoto <akira.tsukamoto@...il.com>,
Drew Fustini <drew@...gleboard.org>,
Bin Meng <bmeng.cn@...il.com>,
David Laight <David.Laight@...lab.com>,
Guo Ren <guoren@...nel.org>
Subject: Re: [PATCH v3 1/3] riscv: optimized memcpy
Στις 2021-06-23 02:35, Matteo Croce έγραψε:
>>
>> 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).
Powered by blists - more mailing lists