lkml.org 
[lkml]   [2018]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/3] x86/entry: Clear extra registers beyond syscall arguments for 64bit kernels
On Sun, Feb 4, 2018 at 9:42 AM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Sun, Feb 4, 2018 at 5:01 AM, Brian Gerst <brgerst@gmail.com> wrote:
>>
>> Now that the fast syscall path is gone, all regs (except RSP
>> obviously) are dead after being saved to pt_regs.
>
> They're saved, but not dead afaics.

Actually, they _are_ dead with the slow-path - it will reload them off
the ptregs pointer instead.

However, exactly because the slow-path will just reload the
user-supplied values, there's no point in clearing them anyway. Those
values will be live in the system call sequence anyway.

So even for the slow system call case, there's no point in clearing
them. If we ever end up only reloading the required values (ie we push
the 'struct ptregs' pointer lower down into the syscall stack), at
that point we might want to clear those registers, because many system
calls will reload only a small subset.

But as the commit message says, the system call argument registers are
also likely to be aggressively clobbered unless used, since the low
registers are preferred for code generation (smaller code, and many of
them are special anyway in various ways and have forced uses for
shifts, function arguments, or just are special in general like %rax).

So the actual argument registers tend to not be an issue anyway.

Linus

\
 
 \ /
  Last update: 2018-02-04 19:41    [W:0.076 / U:1.916 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site