lkml.org 
[lkml]   [2015]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/asm/entry/32: Update ENOSYS handling to match 64-bit logic
On 04/10/2015 05:44 PM, Andy Lutomirski wrote:
> On Fri, Apr 10, 2015 at 8:33 AM, Denys Vlasenko <dvlasenk@redhat.com> wrote:
>> Sometime ago Andy changed 64-bit syscall logic so that pt_regs->ax is
>> initially set to -ENOSYS, and on exit from syscall, it is updated with
>> actual return value. This simplified logic there.
>>
>> This patch does the same for 32-bit syscall entry points.
>>
>> The check for %rax being too big is moved to be just before
>> the call insn which dispatches execution through syscall table.
>> There is no way to accidentally skip this check now by jumping
>> to a label after it. This allows to remove redundant checks
>> after e.g. ptrace.
>>
>> If %rax is too big, we just skip over the (call, write %rax to pt_regs->ax)
>> insn pair. pt_regs->ax remains set to -ENOSYS, and it gets returned
>> to userspace.
>
> This looks okay, but I'll read it again later today.

Unfortunately, there is a mistake.

>> @@ -247,9 +248,7 @@ sysexit_from_sys_call:
>> movl %ebx,%esi /* 2nd arg: 1st syscall arg */
>> movl %eax,%edi /* 1st arg: syscall number */
>> call __audit_syscall_entry
>> - movl RAX(%rsp),%eax /* reload syscall number */
>> - cmpq $(IA32_NR_syscalls-1),%rax
>> - ja ia32_badsys
>> + movl ORIG_RAX(%rsp),%eax /* reload syscall number */

this is correct, now syscall# is only in orig_ax, not in ax...

>> call __audit_syscall_exit
>> - movq RAX(%rsp),%rax /* reload syscall return value */
>> + movq ORIG_RAX(%rsp),%rax /* reload syscall return value */

but here I'm wrong, this line should not be changed.
Will send v2 now.


\
 
 \ /
  Last update: 2015-04-10 18:41    [W:0.031 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site