raphaelsc / Am-I-affected-by-Meltdown

Meltdown Exploit / Proof-of-concept / checks whether system is affected by Variant 3: rogue data cache load (CVE-2017-5754), a.k.a MELTDOWN.
https://meltdownattack.com/
BSD 2-Clause "Simplified" License
542 stars 71 forks source link

unable to compile on debian 8.10 with g++ 4.9.2 #15

Closed hakrdinesh closed 6 years ago

hakrdinesh commented 6 years ago

` compiling latest commit 923165ecff690963cbf5bf53b741ec40dd8037f2

$ make g++ -I. --std=c++11 -O0 --no-pie -fPIC -c -o meltdown_checker.o meltdown_checker.cc In file included from meltdown_checker.cc:49:0: assembly_utils.hh:36:2: warning: #warning "Using native impl. of TSX due to GCC version older than 4.8. No need to worry about it!" [-Wcpp]

warning "Using native impl. of TSX due to GCC version older than 4.8. No need to worry about it!"

^ In file included from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/immintrin.h:65:0, from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:46, from /usr/include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33, from /usr/include/c++/4.9/random:50, from /usr/include/c++/4.9/bits/stl_algo.h:66, from /usr/include/c++/4.9/algorithm:62, from meltdown_checker.cc:41: assembly_utils.hh:38:22: error: expected class-name before numeric constant static constexpr int _XBEGIN_STARTED = ~0u; ^ assembly_utils.hh:38:22: error: expected ‘)’ before numeric constant In file included from meltdown_checker.cc:49:0: assembly_utils.hh: In function ‘int _xbegin()’: assembly_utils.hh:41:24: error: ambiguating new declaration of ‘int _xbegin()’ inline int _xbegin(void) { ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/immintrin.h:65:0, from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:46, from /usr/include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33, from /usr/include/c++/4.9/random:50, from /usr/include/c++/4.9/bits/stl_algo.h:66, from /usr/include/c++/4.9/algorithm:62, from meltdown_checker.cc:41: /usr/lib/gcc/x86_64-linux-gnu/4.9/include/rtmintrin.h:50:1: note: old declaration ‘unsigned int _xbegin()’ _xbegin (void) ^ In file included from meltdown_checker.cc:49:0: assembly_utils.hh: In function ‘void _xend()’: assembly_utils.hh:48:13: error: ‘void _xend()’ redeclared inline without ‘gnu_inline’ attribute inline void _xend(void) { ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/immintrin.h:65:0, from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:46, from /usr/include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33, from /usr/include/c++/4.9/random:50, from /usr/include/c++/4.9/bits/stl_algo.h:66, from /usr/include/c++/4.9/algorithm:62, from meltdown_checker.cc:41: /usr/lib/gcc/x86_64-linux-gnu/4.9/include/rtmintrin.h:61:1: note: ‘void _xend()’ previously defined here _xend (void) ^ Makefile:12: recipe for target 'meltdown_checker.o' failed make: *** [meltdown_checker.o] Error 1 $ g++ --version g++ (Debian 4.9.2-10) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -a Linux debian-pc 3.16.0-4-amd64 # 1 SMP Debian 3.16.51-3 (2017-12-13) x86_64 GNU/Linux $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.10 (jessie) Release: 8.10 Codename: jessie $ `

raphaelsc commented 6 years ago

@hakrdinesh please pull last changes and try again, I think the problem was that i tested compiler version of gcc instead, and also redefined functions if they're available

hakrdinesh commented 6 years ago

@raphaelsc thanks. will do.

hakrdinesh commented 6 years ago

` $ git pull remote: Counting objects: 4, done. remote: Compressing objects: 100% (1/1), done. remote: Total 4 (delta 3), reused 4 (delta 3), pack-reused 0 Unpacking objects: 100% (4/4), done. From https://github.com/raphaelsc/Am-I-affected-by-Meltdown 923165e..ab96fd3 master -> origin/master Updating 923165e..ab96fd3 Fast-forward Makefile | 4 ++-- assembly_utils.hh | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) $ make g++ -I. --std=c++11 -O0 --no-pie -fPIC -c -o meltdown_checker.o meltdown_checker.cc In file included from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/immintrin.h:65:0, from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:46, from /usr/include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33, from /usr/include/c++/4.9/random:50, from /usr/include/c++/4.9/bits/stl_algo.h:66, from /usr/include/c++/4.9/algorithm:62, from meltdown_checker.cc:41: /usr/lib/gcc/x86_64-linux-gnu/4.9/include/rtmintrin.h: In function ‘uint8_t probe_one_syscall_table_address_byte(uintptr_t, char*, int&)’: /usr/lib/gcc/x86_64-linux-gnu/4.9/include/rtmintrin.h:50:1: error: inlining failed in call to always_inline ‘unsigned int _xbegin()’: target specific option mismatch _xbegin (void) ^ meltdown_checker.cc:121:25: error: called from here if (_xbegin() == _XBEGIN_STARTED) { ^ In file included from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/immintrin.h:65:0, from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:46, from /usr/include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33, from /usr/include/c++/4.9/random:50, from /usr/include/c++/4.9/bits/stl_algo.h:66, from /usr/include/c++/4.9/algorithm:62, from meltdown_checker.cc:41: /usr/lib/gcc/x86_64-linux-gnu/4.9/include/rtmintrin.h:61:1: error: inlining failed in call to always_inline ‘void _xend()’: target specific option mismatch _xend (void) ^ meltdown_checker.cc:123:24: error: called from here _xend(); ^ Makefile:12: recipe for target 'meltdown_checker.o' failed make: *** [meltdown_checker.o] Error 1 $

`

hakrdinesh commented 6 years ago

@raphaelsc it is better than before but still has compilation errors.

raphaelsc commented 6 years ago

@hakrdinesh thanks i already know how to fix it but i'll only do it tomorrow. thanks for the report

hakrdinesh commented 6 years ago

@raphaelsc thanks for 7eff4ad1f08c9d5b9e76262b8cb419a025dbb79f which fixes the 4.9 >= 4.8 comparison.

hakrdinesh commented 6 years ago

` $ git pull Updating ab96fd3..7eff4ad Fast-forward Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) $ make clean rm -f meltdown-checker .o ~ *.out $ make g++ -I. --std=c++11 -O0 --no-pie -fPIC -mrtm -DHAS_COMPILER_RTM_SUPPORT -c -o meltdown_checker.o meltdown_checker.cc g++ -I. --std=c++11 -O0 --no-pie -fPIC -mrtm -DHAS_COMPILER_RTM_SUPPORT -o meltdown-checker meltdown_checker.o $ ./meltdown-checker Unable to find symbol sys_call_table in /proc/kallsyms Falling back on the alternative symbol map file (usually requires root permission): /boot/System.map-3.16.0-4-amd64... Checking whether system is affected by Variant 3: rogue data cache load (CVE-2017-5754), a.k.a MELTDOWN ... Checking syscall table (sys_call_table) found at address 0xffffffff81601440 ... so far so good (i.e. meltdown safe) ... 0xffffffff811affa0 -> That's SyS_write

System affected! Please consider upgrading your kernel to one that is patched with KPTI/KAISER Check https://security.googleblog.com/2018/01/todays-cpu-vulnerability-what-you-need.html for more details $ `

hakrdinesh commented 6 years ago

able to compile and run on debian 8.10 using g++ 4.9.2. closing this.

thanks very much @raphaelsc