Dailydave mailing list archives

Re: gcc 4.1 security features


From: Gadi Evron <ge () linuxbox org>
Date: Thu, 16 Feb 2006 20:44:54 +0200

Matt wrote:
Being the total nerd I am, I was browsing through the GCC 4.1 in-progress
ChangeLog:

http://gcc.gnu.org/gcc-4.1/changes.html

And noticed at the very bottom the inclusion of some stack-smashing and
format-string prevention features. Anyone have any thoughts on their
implementation?

In 4.1? I will have to look. I sent this out to a different mailing list a few weeks ago, maybe people here will have some answers. This relates to similar changes in gcc/glic instead of kernel level prevention.

-----

In version 2.3.4 of glibc...

if (__builtin_expect ((uintptr_t) p > (uintptr_t) -size, 0) ||
__builtin_expect ((uintptr_t) p & MALLOC_ALIGN_MASK, 0))

^^^ This line was added.

There is also a comment on it:

+  /* Little security check which won't hurt performance: the
+     allocator never wrapps around at the end of the address space.
+     Therefore we can exclude some size values which might appear
+     here by accident or by "design" from some intruder.  */
+  if (__builtin_expect ((uintptr_t) p > (uintptr_t) -size, 0)
+      || __builtin_expect ((uintptr_t) p & MALLOC_ALIGN_MASK, 0))
+    {
+      errstr = "free(): invalid pointer";
+    errout:
+      malloc_printerr (check_action, errstr, mem);
+      return;
+    }

It was mentioned on http://www.securityfocus.com/columnists/359.

Now, my questions if some of you can be so kind as to try and answer:
In your estimation, how many people actually heard about this (outside
the tight circle of secure coding maniacs)?

In your estimation, how many people actually go through the pain of
upgrading glibc?

This seems effective to me. In retrospect, how effective did it prove to
be over the past year, in your experience? Is it too early to tell?

Heard of this? http://www.cs.ucsb.edu/~wkr/projects/heap_protection/
What's your take on it, and how do you compare the two?

I'd appreciate your input if you have the time.

Thanks,

        Gadi.

--
http://blogs.securiteam.com/

"Out of the box is where I live".
        -- Cara "Starbuck" Thrace, Battlestar Galactica.


Current thread: