miércoles, julio 24, 2013

Intel MPX: Extensiones de protección de memoria

(via reddit.programming) Intel acaba de presentar una serie de extensiones de protección de memoria que permita un uso más seguro de punteros en C y C++. Este conjunto de nuevas instrucciones permiten verificar si un acceso a memoria está dentro de un rango permitido protegiendo al programa de un posible buffer overflow.

Intel® MPX is designed to allow a system to run both Intel MPX enabled software and legacy software together. When executing software containing a mix of Intel MPX code and legacy code, the legacy code does not benefit from Intel MPX, but it also does not experience any change in functionality or performance. Performance of Intel MPX enabled code running on processors that do not support Intel MPX is similar to embedding NOPs in the instruction stream. Intel MPX is designed such that enabled applications can link with, call into, or be called from legacy software (libraries, etc.) while maintaining existing application binary interfaces (ABIs)

Las extensiones se pueden consultar en Intel® Architecture Instruction Set Extensions Programming Reference, concretamente en el capítulo 9 del mismo.

La idea de MPX es asociar rangos de direcciones válidas a los que pueden acceder un puntero determinado, siendo el hardware el encargado de verificar que cualquier acceso a dicho puntero está dentro del rango permito, intentando proteger al sistema de un buffer overflow. Por supuesto, hace falta compiladores y sistemas operativos que permitan usar estas nuevas extensiones. Lo que no me queda demasiado claro es que ocurre con un binario que tenga estas instrucciones y se intente ejecutar en un procesador que no tenga soporte para las mismas. De este párrafo creo entender que no debe de haber problemas en ejecutar un binario con estas instrucciones en un procesador que no soporte las mismas:

All Intel MPX instructions are NOP on processors that report CPUID.(EAX=07H, ECX=0H).EBX.MPX [bit 14] = 0, or if Intel MPX is not enabled by the operating system (see Section 9.3.3). Applications can selectively opt-in to use Intel MPX instructions.


Technorati Tags: ,

No hay comentarios: