[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a3c82cdb-9e22-0738-5a77-7faff414edda@virtuozzo.com>
Date: Fri, 10 Feb 2017 20:11:46 +0300
From: Dmitry Safonov <dsafonov@...tuozzo.com>
To: Andy Lutomirski <luto@...capital.net>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Dmitry Safonov" <0x7f454c46@...il.com>,
Shuah Khan <shuah@...nel.org>,
"Thomas Gleixner" <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...e.de>, X86 ML <x86@...nel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH] x86/selftests: add clobbers for int80 on x86_64
On 02/10/2017 07:45 PM, Andy Lutomirski wrote:
> On Fri, Feb 10, 2017 at 8:28 AM, Dmitry Safonov <dsafonov@...tuozzo.com> wrote:
>> On 02/10/2017 07:13 PM, Andy Lutomirski wrote:
>>>
>>> On Fri, Feb 10, 2017 at 3:52 AM, Dmitry Safonov <dsafonov@...tuozzo.com>
>>> wrote:
>>>>
>>>> Kernel erases R8..R11 registers prior returning to userspace
>>>> from int80: https://lkml.org/lkml/2009/10/1/164
>>>>
>>>> GCC can reuse this registers and doesn't expect them to change
>>>> during syscall invocation. I met this kind of bug in CRIU once
>>>> gcc 6.1 and clang stored local variables in those registers
>>>> and the kernel zerofied them during syscall:
>>>>
>>>> https://github.com/xemul/criu/commit/990d33f1a1cdd17bca6c2eb059ab3be2564f7fa2
>>>>
>>>> By that reason I suggest to add those registers to clobbers
>>>> in selftests.
>>>
>>>
>>> Seems reasonable, but presumably INT80_CLOBBERS should be defined the
>>> same way in all the tests. IOW, if the "flags" clobber is actually
>>> needed, it should be "flags", INT80_CLOBBERS (possibly without the
>>> comma if it's problematic).
>>>
>>
>> Well, that was my initial attempt: I've defined it as:
>> +# define INT80_CLOBBERS , "r8", "r9", "r10", "r11"
>>
>> But that hanging comma looks awful, so I added "flags" there.
>> And if I do define it without coma and leave it in asm statement,
>> 32-bit version would be unhappy.
>> So, I found that it's easier to define it with flags included.
>>
>
> Woudl the right answer be to get rid of "flags" in the test where it
> appears? I'm not sure it's needed in the first place.
>
I think it can live without it.
But I didn't want to change it in the same patch and wasn't sure if I
fail to see the reason for it.
So, I'll resend with flags removing, thanks.
--
Dmitry
Powered by blists - more mailing lists