lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5fecb8a8-8a6a-1e2b-78e3-5660597a02e4@linuxfoundation.org>
Date:   Wed, 25 Sep 2019 10:47:42 -0600
From:   Shuah Khan <skhan@...uxfoundation.org>
To:     Paolo Bonzini <pbonzini@...hat.com>, rkrcmar@...hat.com,
        shuah@...nel.org
Cc:     kvm@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] selftests: kvm: Fix libkvm build error

On 9/25/19 1:48 AM, Paolo Bonzini wrote:
> On 24/09/19 22:14, Shuah Khan wrote:
>> Fix the following build error:
>>
>> libkvm.a(assert.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
>>
>> Add -fPIC to CFLAGS to fix it.
> 
> This is wrong, these testcases cannot be position-independent
> executables.  Can you include the failing command line from "V=1"
> output?
> 

You are right. This isn't correct.

> The problem seems to be that these definitions are not working properly:
> 
> no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \
>          $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie)
> 
> LDFLAGS += -pthread $(no-pie-option)
> 

Yup. That is what is happening, when I build using

"make TARGETS=kvm kselftest"

You can see this below:

gcc -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 
-fno-stack-protector -fno-PIE -I../../../../tools/include 
-I../../../../usr/include/ -Iinclude -Ix86_64 -Iinclude/x86_64 -I.. 
-pthread    x86_64/cr4_cpuid_sync_test.c


vs.

Running make in kvm directory:

gcc -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 
-fno-stack-protector -fPIC -fno-PIE -I../../../../tools/include 
-I../../../../usr/include/ -Iinclude -Ix86_64 -Iinclude/x86_64 -I.. 
-pthread  -no-pie   x86_64/cr4_cpuid_sync_test.c

I was playing with both options yesterday and totally confused myself
thinking that adding fPIC helps. It doesn't.

I am looking into this to see how we can make "make kselftest" work.
Once I figure it out, will send v2. I think for some reason in the
failing case, no-pie-option and pgste-option are null strings.

thanks,
-- Shuah

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ