Gentoo Archives: gentoo-embedded

From: Christopher Friedt <chrisfriedt@×××××.com>
To: gentoo-embedded@l.g.o
Subject: Re: [gentoo-embedded] Tool for eliminating non used code or symbols?
Date: Fri, 31 May 2013 18:11:00
Message-Id: CAF4BF-Tw6V_QXJOKJC2Yj54yVBRYvnJAtewydci7damFSvb7gQ@mail.gmail.com
In Reply to: Re: [gentoo-embedded] Tool for eliminating non used code or symbols? by Bertrand Jacquin
1 -Wunused -Werror
2
3
4 On Mon, May 27, 2013 at 9:09 AM, Bertrand Jacquin <beber@××××××××.net>wrote:
5
6 > Hi,
7 >
8 > Finally, two months after your mail, I remembered a project I saw last
9 > year (or so) that might stick your need.
10 >
11 > http://anonscm.debian.org/**gitweb/?p=d-i/mklibs.git<http://anonscm.debian.org/gitweb/?p=d-i/mklibs.git>
12 > http://anonscm.debian.org/**gitweb/?p=d-i/mklibs.git;a=**
13 > blob_plain;f=src/mklibs;h=**216b34c1cb221458cd0d26c6bd5c71**
14 > 9c3bf94ab2;hb=HEAD<http://anonscm.debian.org/gitweb/?p=d-i/mklibs.git;a=blob_plain;f=src/mklibs;h=216b34c1cb221458cd0d26c6bd5c719c3bf94ab2;hb=HEAD>
15 >
16 > As describe, this tool :
17 >
18 > - Gather all unresolved symbols and libraries needed by the programs
19 > and reduced libraries
20 > - Gather all symbols provided by the already reduced libraries
21 > (none on the first pass)
22 > - If all symbols are provided we are done
23 > - go through all libraries and remember what symbols they provide
24 > - go through all unresolved/needed symbols and mark them as used
25 > - for each library:
26 > - find pic file (if not present copy and strip the so)
27 > - compile in only used symbols
28 > - strip
29 > - back to the top
30 >
31 > Beber
32 >
33 >
34 > On 2013-03-25 08:01, Kfir Lavi wrote:
35 >
36 >> Hi,
37 >> I'm looking for a way to reduce glibc code size.
38 >> It can be a way to make system smaller and minimize the impact
39 >> of attack vectors in glibc, as in return-to-libc attack.
40 >>
41 >> Lets say I'm deleting the program 'mkdir', and mkdir uses a function
42 >> in glibc that non of the other parts of the system uses.
43 >> Then I want to eliminate this function from glibc. This leads to smaller
44 >> code and if this function is used in some attack scenario, maybe prevent
45 >> it.
46 >>
47 >> Is there a way to do it?
48 >> Can you help me think how to build a tool like this? or, integrate
49 >> with existing tools.
50 >>
51 >> Thanks,
52 >> Kfir
53 >>
54 >
55 >

Replies

Subject Author
Re: [gentoo-embedded] Tool for eliminating non used code or symbols? Christopher Friedt <chrisfriedt@×××××.com>