Re: BUG: Sporadic crashes with current Linus tree

From: Dmitry Safonov
Date: Fri Oct 13 2017 - 11:55:03 EST


Hi Tglx, Andy,

Sorry for old-posting,

2017-09-15 8:09 GMT+01:00 Thomas Gleixner <tglx@xxxxxxxxxxxxx>:
> On Thu, 14 Sep 2017, Andy Lutomirski wrote:
>> On Thu, Sep 14, 2017 at 9:00 AM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>> > On Thu, 14 Sep 2017, Andy Lutomirski wrote:
>> >> On Thu, Sep 14, 2017 at 12:38 AM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>> >> > Hi!
>> >> >
>> >> > I've seen the following crash sporadically with commit 46c1e79fee:
>> >> >
>> >> > Have not seen that with 3882a734c19b, though I saw the PCID warnings on
>> >> > that machine.
>> >> >
>> >> > I have no idea how to reproduce so bisecting is pretty much pointless. Any
>> >> > idea what to do?
>> >>
>> >> Does tools/testing/selftests/x86/sigreturn_64 reproduce it?
>> >
>> > Will try tomorrow once I figured out how to compile that stuff. Invoking a
>> > simple make in that directory fails.
>>
>> What's the error? It works for me.
>
> gcc -m64 -o /home/tglx/work/kernel/linus/linux/tools/testing/selftests/x86/sysret_ss_attrs_64 -O2 -g -std=gnu99 -pthread -Wall sysret_ss_attrs.c thunks.S -lrt -ldl
> /usr/bin/ld: /tmp/cco4vSkU.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC
> /usr/bin/ld: final link failed: Nonrepresentable section on output
> collect2: error: ld returned 1 exit status

Had the same issue in copied thunks.S helper to CRIU.
As I wanted to compile CRIU as pie also (which is the default now
in some distributions), I fixed it up by using %rip-relative addressing
and pushing segment descriptor to stack before long-jumping.
Not sure if that's the issue for the selftest as it can be just always
compiled as pic.

Anyway, here is the commit if you want to look:
https://github.com/0x7f454c46/criu/commit/cf36ea5d8408bf1e42c3bd21b9594369ea7123fb

--
Dmitry