Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: Andrew Savchenko <bircoph@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Figuring out the solution to in-network-sandbox distcc
Date: Tue, 27 Jan 2015 17:02:50
Message-Id: 20150127180235.000a8af6@pomiot.lan
In Reply to: Re: [gentoo-dev] Figuring out the solution to in-network-sandbox distcc by Andrew Savchenko
1 Dnia 2015-01-27, o godz. 02:46:37
2 Andrew Savchenko <bircoph@g.o> napisał(a):
3
4 > Hi,
5 >
6 > On Sun, 25 Jan 2015 14:59:01 +0100 Michał Górny wrote:
7 > > Dnia 2015-01-21, o godz. 11:05:34
8 > > Michał Górny <mgorny@g.o> napisał(a):
9 > >
10 > > > Generic proxy solution
11 > > > ----------------------
12 > > >
13 > > > The simplest solution so far seems to be setting a generic SOCKS proxy
14 > > > inside the build environment, and wrapping distcc so that it will use
15 > > > it for network access.
16 > > >
17 > > > Unless we do some extra magic which don't want to do, this means that
18 > > > other apps can also abuse the proxy to reach outside sandbox. However,
19 > > > network-sandbox is not really a security feature, so I don't think that
20 > > > is important. At least as long as we don't export it globally :).
21 > > >
22 > > > Of course, software is a problem. We'd need at least some SOCKS server
23 > > > for Portage (at least a very simple one), and as far as I'm aware
24 > > > distcc does not support SOCKS directly, so tsocks in addition to that.
25 > >
26 > > So finally went this way instead.
27 >
28 > I still don't understand why. This solution:
29 > 1) is intrusive, it requires patching distcc and upstream as good
30 > as dead (see below);
31
32 Adding SOCKSv5 support is something of potentially generic benefit
33 unlike adding Gentoo-specific hacks.
34
35 > 2) will require a _separate_ solution for icecream and thus a
36 > double effort;
37
38 It would require a separate solution for icecream anyway. If icecream
39 had SOCKSv5 support, the solution would be as simple as exporting extra
40 variable for it. Unlike the other case when Portage needs to become
41 aware of layout of another tool.
42
43 > 3) adds additional latency for distcc network path, which is
44 > undesirable.
45
46 Unlikely to be measurable. ~20 extra bytes over UNIX socket. In fact,
47 this provides us with ability to do some tricks to actually improve
48 the latency -- like caching extra connections in the proxy.
49
50 In fact, the other solution is more complex and therefore more likely
51 to cause delays.
52
53 > Parent namespace solution looks like the most reasonable for me
54 > based on both arguments above and years of heavy distcc usage
55 > experience.
56 >
57 > > [2]:https://code.google.com/p/distcc/issues/detail?id=149
58 >
59 > Chances to have this upstream are close to zero. If it is not
60 > dead, it is very close to it. Number of bugs and patches is
61 > accumulating without any response. No releases from 2011.
62 > Probably someone should fork it...
63
64 I know. Forgive me the wording but it's pretty much crap code.
65 Involving ideas such as enabling non-blocking I/O just to read it
66 in loops to get blocking behavior.
67
68 I would rewrite it from scratch if it were simpler. But the pump mode
69 and other extra features makes it require too much effort. At least
70 it's not something I could do in my free time.
71
72 > Distcc has a problem with -march=native right now: it just falls
73 > back to local compilation if encountered it. I sent them a patch
74 > 1.5 years ago [1] and still no reply... It also requires some
75 > patches for successful cross-compilation when plain gcc is invoked
76 > by the client. (I have patches for amd64 <-> x86 only and they may
77 > broke pump mode (never used it anyway), thus I haven't send them
78 > upstream.
79 >
80 > [1] https://groups.google.com/forum/#!topic/distcc-patches/eeP-9pTgz7E
81 >
82 > In short, this patch expands "native" argument using gcc output,
83 > caches result (based on fingerprint of compiler being invoked)
84 > and sends expanded string to distcc servers. It is in my overlay
85 > (bircoph) if someone is interested. Works fine for me all these
86 > time.
87
88 I'm not convinced it's worth the effort to support it in distcc. I once
89 published a blog post how to use gcc output to replace -march=native
90 with the expanded flags. I find that saner.
91
92 That said, pump mode is the only significant change in late distcc
93 history. And it's broken anyway, and I doubt anybody's going to fix it
94 since the failures are pretty random and hard to reproduce.
95
96 --
97 Best regards,
98 Michał Górny