1 |
On Tue, 31 Jan 2012 19:58:32 -0500 |
2 |
"Anthony G. Basile" <blueness@g.o> wrote: |
3 |
|
4 |
> On 01/29/2012 02:14 PM, Mike Frysinger wrote: |
5 |
> > On Saturday 28 January 2012 07:26:59 Anthony G. Basile wrote: |
6 |
> >> I've run nbench on two amd64 systems both running the same kernel |
7 |
> >> vanilla-3.2.2. |
8 |
> > i don't think nbench is a good benchmark for this as it isn't |
9 |
> > really testing what you think it's testing. it's very good at |
10 |
> > validating math support in the ISA/ABI, optimized compiler output, |
11 |
> > and supplementary math implementations in libgcc. PIE vs non-PIE |
12 |
> > will still be able to multiply/divide in pretty much the same |
13 |
> > amount of time. |
14 |
> |
15 |
> I know, but the problem is, what benchmark best approximates common |
16 |
> every day use? So I wrote the following which really hits the |
17 |
> problem hard on x86: |
18 |
> |
19 |
> int modfac(int n) |
20 |
> { |
21 |
> if(n==0) return 1; |
22 |
> return n * modfac(n-1); |
23 |
> } |
24 |
> |
25 |
> int main() |
26 |
> { |
27 |
> int i; |
28 |
> for( i = 0 ; i < 4096*4096 ; i++ ) modfac(4096); |
29 |
> return 0; |
30 |
> } |
31 |
> |
32 |
> Using vanilla kernel 3.2.2, userland built with vanilla toolchain, |
33 |
> gcc-4.5.3-r1, glibc-2.13-r4, binutils-2.21.1-r1, compiling my code |
34 |
> simply as gcc -o test modfac.c, CFLAGS="-O2 -march=i686 -pipe" I get: |
35 |
> |
36 |
> time -p ./test |
37 |
> real 327.89 |
38 |
> user 327.72 |
39 |
> sys 0.00 |
40 |
> |
41 |
> Keep everything else the same, even the same hardware, but switch to |
42 |
> userland built with hardened gcc-4.5.3-r2 (not -r1 because of the bus |
43 |
> error), I get: |
44 |
> |
45 |
> time -p ./test |
46 |
> real 629.68 |
47 |
> user 629.37 |
48 |
> sys 0.00 |
49 |
> |
50 |
> The hardware is 8 x "Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz" with 12 |
51 |
> GB ram. That's nearly a factor of 2x but how often does one set up |
52 |
> 4k stack frames in everyday use? |
53 |
> |
54 |
> >> So at least on amd64, I don't think that performance is ever an |
55 |
> >> issue. |
56 |
> > yes, most likely on systems where the PIC has hardware support in |
57 |
> > the ISA, the performance hit on PIE is typically low. |
58 |
> > |
59 |
> >> I have yet to look at x86. |
60 |
> > pretty sure this is going to be much more palpable. |
61 |
> > -mike |
62 |
> |
63 |
> |
64 |
|
65 |
Vanilla userland is simply a stage3 chroot amd64. |
66 |
|
67 |
hardened kernel/userland |
68 |
real 5m43.402s |
69 |
user 5m42.510s |
70 |
sys 0m0.002s |
71 |
|
72 |
hardened kernel/vanilla gcc |
73 |
real 5m29.271s |
74 |
user 5m28.417s |
75 |
sys 0m0.003s |
76 |
|
77 |
hardened kernel/vanilla userland |
78 |
real 5m29.495s |
79 |
user 5m28.599s |
80 |
sys 0m0.030s |
81 |
|
82 |
vanilla all (disabled pax and grsec on hardened kernel, compiled kernel |
83 |
with hardened gcc) |
84 |
real 5m34.861s |
85 |
user 5m33.981s |
86 |
sys 0m0.001s |
87 |
|
88 |
i686 cflag test, vanilla all |
89 |
CFLAGS="-O2 -march=i686 -pipe" |
90 |
gcc modfac.c -o vv-moddfac |
91 |
real 5m42.171s |
92 |
user 5m41.176s |
93 |
sys 0m0.092s |
94 |
|
95 |
CPU: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz |
96 |
RAM: 16G |
97 |
|
98 |
|
99 |
-- |
100 |
Matthew Thode (prometheanfire) |