Download raw body.
mbuf pulldown replace memmove with memcpy
On Thu, Aug 29, 2024 at 05:33:54PM +0200, Alexander Bluhm wrote: > On Thu, Aug 29, 2024 at 09:00:03AM -0600, Theo de Raadt wrote: > > Claudio Jeker <cjeker@diehard.n-r-g.com> wrote: > > > > > On Thu, Aug 29, 2024 at 04:21:01PM +0200, Alexander Bluhm wrote: > > > > Hi, > > > > > > > > m_pulldown() copies memory between different mbufs. So they cannot > > > > overlap and memcpy() should be enough. > > > > > > > > ok? > > > > > > Indeed. The first memcpy is save because n is not a read-only buffer and > > > so n and n->m_next have do be different mbufs or clusters. > > > The 2nd memcpy goes to freshly allocated buffer o. So that is safe too. > > > > > > OK claudio@ > > > > I agree. > > > > I don't recall the situation backwards copy. Does the kernel not check > > for that, is that only in userland? I did that so long ago.. > > lib/libkern/memmove.c checks direction, lib/libkern/memcpy.c does > not. I think we removed the direction check from all memcpy a while > ago. Argument was, that memcpy caller should do it correctly. > > ---------------------------- > revision 1.3 > date: 2013/06/12 16:44:22; author: deraadt; state: Exp; lines: +4 -16; > From now on, the MI libkern memcpy should not do overlap handling. > ---------------------------- > Also we use __builtin for most of those functions and only fall back to the libkern version if the compiler does so. -- :wq Claudio
mbuf pulldown replace memmove with memcpy