LWN.net Logo

Glibc change exposing bugs

Glibc change exposing bugs

Posted Nov 11, 2010 18:52 UTC (Thu) by oak (subscriber, #2786)
In reply to: Glibc change exposing bugs by gus3
Parent article: Glibc change exposing bugs

memmove() has this check you're clamoring for... And if the given areas don't overlap, it calls memcpy().


(Log in to post comments)

Glibc change exposing bugs

Posted Nov 15, 2010 0:14 UTC (Mon) by promotion-account (guest, #70778) [Link]

memmove() has this check you're clamoring for... And if the given areas don't overlap, it calls memcpy().

Sometimes even if the areas do overlap, it calls memcpy(). This happens if the library has an internal knowledge about memcpy()'s copying direction.

A common example is having src > dst, copying is forward, and the CPU block transfer unit is smaller than or equal to (src - dst). x86-64 CPUs support copying up-to 8-byte blocks in one opcode (movsq), assuming no floating-point ops in use, which is usually the case with kernel code.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds