Gentoo Archives: gentoo-hardened

From: veovis <veovis@×××××.fr>
To: gentoo-hardened@l.g.o
Subject: [gentoo-hardened] [musl] A bunch of new compatibles ebuilds for musl
Date: Tue, 23 Dec 2014 15:32:46
Message-Id: 399daba9205554065b9c74325696adea@kveer.fr
1 Hi everyone,
2
3 I recently saw the hardened musl project so I wanted to play with it for
4 my router.
5
6 My platform: CHOST="x86_64-gentoo-linux-musl"
7
8 There is a list of ebuilds taken from official portage I modified to
9 successfully compile for musl without breaking the compatibility with
10 other CHOST:
11 * app-admin/logrotate
12 * app-misc/screen
13 * net-analyzer/snort
14 * net-firewall/arptables
15 * net-firewall/ebtables
16 * net-libs/daq
17 * net-libs/libnetfiler_queue
18 * net-libs/libnfnetlink
19 * net-libs/libtirpc
20 * net-misc/dhcp
21 * net-misc/iperf
22 * net-misc/openvpn-2.3.6
23 * sys-apps/hwinfo
24 * sys-apps/iproute2
25 * sys-apps/lm_sensors
26 * sys-apps/watchdog
27 * sys-boot/grub:2
28 * sys-fs/btrfs-progs
29 * sys-libs/musl
30 * sys-process/lsof
31 * www-servers/nginx
32
33 I have modified libtirpc so it is the default rpc include files provider
34 for musl. glibc and ulibc provides rpc, musl not.
35
36 With recent releases of binutils, musl fail to correctly find libraries
37 as described here:
38 http://git.musl-libc.org/cgit/musl/commit/src/ldso/dynlink.c?id=d8dc2b7c0289b12eeef4feff65e3c918111b0f55
39
40 This is the case with /usr/bin/man provided in the current experimental
41 stage3 where musl does not found libmandb or libman without the patch or
42 without defining LD_LIBRARY_PATH:
43 localhost kveer # ldd /usr/bin/man
44 /lib/ld-musl-x86_64.so.1 (0x317c90c4000)
45 libmandb-2.6.6.so => /usr/lib/man-db/libmandb-2.6.6.so
46 (0x317c8ca1000)
47 libman-2.6.6.so => /usr/lib/man-db/libman-2.6.6.so
48 (0x317c8a68000)
49 libpipeline.so.1 => /usr/lib/libpipeline.so.1 (0x317c8858000)
50 libc.so => /lib/ld-musl-x86_64.so.1 (0x317c90c4000)
51 libgdbm.so.4 => /usr/lib/libgdbm.so.4 (0x317c864c000)
52 libz.so.1 => /lib/libz.so.1 (0x317c8434000)
53
54 Finally, musl does not come with a distinct ldd tool and is missing on
55 the stage3. As described by the musl maintener, ldd is available making
56 a symbolic link to the main lib:
57 localhost kveer # ll /usr/bin/ldd
58 lrwxrwxrwx 1 root root 24 Dec 23 16:11 /usr/bin/ldd ->
59 /lib/ld-musl-x86_64.so.1
60
61 For now, everything compiles fine but I don't know yet if all is working
62 properly.
63
64 I put everything on my personal repo here:
65 https://github.com/LordVeovis/gentoo (starting from
66 176c1d4dd1f7064d0c378e6b37034f7b604e04a2) but let me know how you want
67 to proceed for all of this or if my way of patching is incorrect.

Replies