Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not build on 32bit with gcc 7.2.0 #1

Closed
RealKindOne opened this issue Jan 4, 2018 · 32 comments
Closed

Does not build on 32bit with gcc 7.2.0 #1

RealKindOne opened this issue Jan 4, 2018 · 32 comments

Comments

@RealKindOne
Copy link

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/7/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 7.2.0-18' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 7.2.0 (Debian 7.2.0-18)

$ make
cc -O0   -c -o meltdown.o meltdown.c
meltdown.c: In function ‘sigsegv’:
meltdown.c:81:30: error: ‘REG_RIP’ undeclared (first use in this function); did you mean ‘REG_EIP’?
  ucontext->uc_mcontext.gregs[REG_RIP] = (unsigned long)stopspeculate;
                              ^~~~~~~
                              REG_EIP
meltdown.c:81:30: note: each undeclared identifier is reported only once for each function it appears in
<builtin>: recipe for target 'meltdown.o' failed
@paboldin
Copy link
Owner

paboldin commented Jan 4, 2018

Heavily uses 64-bit asm so won't work on 32-bit either. Sorry.

@RealKindOne
Copy link
Author

Alright.

@paboldin paboldin reopened this Jan 5, 2018
@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

@RealKindOne I can provide an implementation if you are willing to check it!

@RealKindOne
Copy link
Author

Sure.

@steely-glint
Copy link
Contributor

I've a couple of 32 bit intel atoms (one linux and one openBSD) happy to test on those if you want.

  • also several 32bit ARM linuxes if you go that far :-)

@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

@corsac-s
Copy link

corsac-s commented Jan 5, 2018

I've tried that, it fails here (Debian Stretch i386) with:

error: inlining failed in call to always_inline _mm_clflush: target specific option mismatch

@steely-glint
Copy link
Contributor

steely-glint commented Jan 5, 2018 via email

@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

@corsac-s try with make CFLAGS=-msse2

@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

@steely-glint show me gcc version please.

I will need to have cflush as asm inline I believe.

@corsac-s
Copy link

corsac-s commented Jan 5, 2018

@paboldin it fixes the _mm_clflush issue but now I have

meltdown.c: Assembler messages:
meltdown.c:73: Error: bad register name `%sil'

which is confusing since there is no %sil register name in the code

@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

Updated the branch. Please try again.

@steely-glint
Copy link
Contributor

steely-glint commented Jan 5, 2018 via email

@corsac-s
Copy link

corsac-s commented Jan 5, 2018

@paboldin thanks it builds fine now. Note: IA32 doesn't have linux_proc_banner symbol so another target should be chosen, but at least it runs.

It doesn't seem to work here but I guess it's not from the code but rather from the CPU (Core 2 Duo) or the threshold

@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

Note: IA32 doesn't have linux_proc_banner

That is strange, the symbols must be arch-independent. They might be missing from the /proc/kallsyms. Can you please try finding them in the /boot/System.map map?

@corsac-s
Copy link

corsac-s commented Jan 5, 2018

They're present indeed there (but it still doesn't work, I get only 0). Again thanks for your time

@steely-glint
Copy link
Contributor

steely-glint commented Jan 5, 2018 via email

@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

@corsac-s np. I have no such a hardware at my disposal so it will be impossible for me to make it work there. Full exploit should be able to do this as well.

@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

@steely-glint please recompile with make CFLAGS=-DHAVE_RDTSCP=0 clean all and try again.

@corsac-s
Copy link

corsac-s commented Jan 5, 2018

@corsac-s np. I have no such a hardware at my disposal so it will be impossible for me to make it work there. Full exploit should be able to do this as well.

No problem again many thanks for your help and your time. If I manage to do something I'll report back (I'm also trying amd64 on the same box just to be sure)

@steely-glint
Copy link
Contributor

steely-glint commented Jan 5, 2018 via email

@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

Please show output of head /proc/cpuinfo.

@steely-glint
Copy link
Contributor

steely-glint commented Jan 5, 2018 via email

@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

Intel Atoms are not vulnerable. Thanks for testing the port! Will merge it soon.

@corsac-s
Copy link

corsac-s commented Jan 5, 2018

Intel Atoms are not vulnerable. Thanks for testing the port! Will merge it soon.
Actually earlier ones might not, but later one (starting with the Silvermont microarchitecture) have out-of-order execution (https://en.wikipedia.org/wiki/Silvermont#Design). The Z530 uses that micro architecture, so I'm unsure if it's really not vulnerable.

@steely-glint
Copy link
Contributor

steely-glint commented Jan 5, 2018 via email

@corsac-s
Copy link

corsac-s commented Jan 5, 2018

I ran it on an edison too, same result.

I'd be surprised if Edison had out-of-order execution so it makes sense.

@steely-glint
Copy link
Contributor

steely-glint commented Jan 5, 2018 via email

@corsac-s
Copy link

corsac-s commented Jan 5, 2018

So I guess this is an old one :-)

Yes indeed, sorry I messed up earlier. Z530 is really old (08) and definitely not Silvermont. It's Z3530 which is Silvermont. Sorry again.

@corsac-s
Copy link

corsac-s commented Jan 5, 2018

(I'm also trying amd64 on the same box just to be sure)

amd64 doesn't work either so maybe Core 2 Duo is not affected (lot of emphasis on maybe).

@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

Merged the i386 version. Thank you guys!

@paboldin
Copy link
Owner

paboldin commented Jan 5, 2018

Guys, please check the latest version build so I can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants