[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5511C641.7000700@redhat.com>
Date: Tue, 24 Mar 2015 21:17:05 +0100
From: Denys Vlasenko <dvlasenk@...hat.com>
To: Brian Gerst <brgerst@...il.com>
CC: Ingo Molnar <mingo@...nel.org>,
Denys Vlasenko <vda.linux@...glemail.com>,
Andy Lutomirski <luto@...capital.net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Steven Rostedt <rostedt@...dmis.org>,
Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, Oleg Nesterov <oleg@...hat.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Alexei Starovoitov <ast@...mgrid.com>,
Will Drewry <wad@...omium.org>,
Kees Cook <keescook@...omium.org>, X86 ML <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86: vdso32/syscall.S: do not load __USER32_DS to %ss
On 03/24/2015 05:55 PM, Brian Gerst wrote:
>>> Might be nice to place a more generic description there, which
>>> registers are expected to be saved by user-space calling in here, etc.
>>
>> __kernel_vsyscall entry point has the same ABI in any 32-bit vDSO,
>> the good old int 0x80 calling convention:
>>
>> syscall# in eax,
>> params in ebx/ecx/edx/esi/edi/ebp,
>> all registers are preserved by the syscall.
>>
>> (I think we don't guarantee that all flags are preserved:
>> I have a testcase where DF gets cleared).
>
> DF should always be clear on any function call per the C ABI. But,
> eflags should be preserved, at least the non-privileged bits. I'd
> like to see that testcase.
The testcase is a simplistic example of how to find and use
32-bit vDSO to perform system calls.
It also sets flags.DF before syscall, and checks whether registers
are preserved, including flags.DF.
On 32-bit kernel (on Intel CPU, where vDSO uses SYSENTER), I see this:
$ ./test32_syscall_vdso
Result:1
whereas on 64-bit it is
./test32_syscall_vdso
Result:0
"Result:1" means that DF was cleared.
See attached source.
View attachment "test32_syscall_vdso.c" of type "text/x-csrc" (2920 bytes)
Powered by blists - more mailing lists