Gentoo Archives: gentoo-hardened

From: Alexander Gabert <pappy@g.o>
To: wkr@×××××××.edu
Cc: gentoo-hardened@g.o
Subject: [gentoo-hardened] http://www.cs.ucsb.edu/~wkr/projects/heap_protection/software.html
Date: Sat, 22 Nov 2003 17:05:10
Message-Id: 1069520806.3263.10.camel@camille.external
1 hi
2
3 the glibc patch and the .rpm packages you have on your site are totally
4 useless.
5
6 the patch you are applying does not create a necessary define to get the
7 source built in glibc. both 1.1 and 1.2 patches are the same file.
8
9 this same bug applies to the binary rpm packages where you also have a
10 non heap protecting glibc in binary format packaged for shipping to end
11 users and customers that rely on you using redhat 9 machinas.
12
13 added to our test ebuild for getting the functionality into a glibc:
14 /usr/portage/sys-libs/glibc/glibc-2.3.2-r3.ebuild
15
16 epatch /tmp/heapprotect-2.3.2-1.2.diff
17
18 add_heap_protection "${S}/buildhere/config.h"
19 add_heap_protection "${S}/malloc/malloc.c"
20 add_heap_protection "${S}/malloc/hooks.c"
21
22 einfo "Building GLIBC..."
23 cd ${S}/buildhere
24 make PARALLELMFLAGS="${MAKEOPTS}" || die
25 # einfo "Doing GLIBC checks..."
26 # make check
27 }
28
29 add_heap_protection() {
30 einfo "adding heap protection build define to ${1}"
31 echo "#define __HEAP_PROTECTION 1" > "${1}.new"
32 cat "${1}" >> "${1}".new; rm "${1}"; mv "${1}.new" "${1}"
33 }
34
35 i know that my hack is lame and unneeded in all three files but i was
36 lazy and disturbed.
37
38 the working glibc must have the symbols:
39 17:14:37 [/usr/local/chroots/chroot001:24535.pty-s2.epoch] epoch
40 /usr/portage/sys-libs/glibc # readelf -s /lib/libc-2.3.2.so | grep
41 heap_mag
42 1308: 0012aca0 4 OBJECT LOCAL DEFAULT 19 __heap_magic
43 1309: 00130000 16384 OBJECT LOCAL DEFAULT 27 __heap_magic_pad
44
45 if this is not set, you lose the game and have no heap protection.
46
47 hope you get this working soon and make a notice on your website please
48 to give users a chance to remedy this situation.
49 this has lost me three days finding out why our heap demos are still not
50 caught.
51
52 and another technical issue from pageexec@××××××××.hu:
53 <pipacs> oh, one error i see: the size of __heap_magic_pad, it's 16k,
54 it should be 4k (PAGE_SIZE) only, but they declared it wrong:
55 int __heap_magic_pad[PAGESIZE], sizeof(int) is 4 not 1
56 so they should change it to char [].
57
58 thats all for now, i hope to include future known good patches of you
59 guys in gentoo hardened because we already support SSP and PaX kernels
60 for protection.
61
62 thanks in advance,
63
64 Alex
65
66
67 --
68 gentoo-hardened@g.o mailing list

Replies