[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: malloca, freea, and Intel MPX

From: Bruno Haible
Subject: Re: malloca, freea, and Intel MPX
Date: Sat, 03 Feb 2018 13:07:58 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-104-generic; KDE/5.18.0; x86_64; ; )

Paul Eggert wrote:
> converting a pointer to uintptr_t and back means that GCC won't connect 
> the resulting pointer to the original and this messes up bounds checking 
> on the result.

I don't observe this. This test program:

#include <stdlib.h>
#include <stdint.h>

int main ()
  int n = 100;
  char *mem = malloc (n);
  char* p = (char *) (uintptr_t) mem;
  p[-2] = 'x';
  p[n] = 'z';
  return 0;
when compiled with "gcc -mmpx -fcheck-pointer-bounds" (gcc 7.3.0),

Saw a #BR! status 1 at 0x4005c8
Saw a #BR! status 1 at 0x4005e4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]