Commit a7df6f33 authored by Luca Barbieri's avatar Luca Barbieri Committed by Linus Torvalds

[PATCH] Fix sysenter (%ebp) fault handling

Currently syscall_badsys is called to handle faults when reading the
sixth parameter in sysenter; however that routine assumes that
registers have already been pushed on the stack, and this is not the
case (in other words, it will currently try to pop beyond the end of
the thread stack).

This patch adds a new "function", syscall_fault, that saves register
and returns.

The return value is changed to EFAULT, which seems more appropriate
than ENOSYS.
parent 2afbee76
...@@ -253,11 +253,11 @@ ENTRY(sysenter_entry) ...@@ -253,11 +253,11 @@ ENTRY(sysenter_entry)
* Careful about security. * Careful about security.
*/ */
cmpl $__PAGE_OFFSET-3,%ebp cmpl $__PAGE_OFFSET-3,%ebp
jae syscall_badsys jae syscall_fault
1: movl (%ebp),%ebp 1: movl (%ebp),%ebp
.section __ex_table,"a" .section __ex_table,"a"
.align 4 .align 4
.long 1b,syscall_badsys .long 1b,syscall_fault
.previous .previous
pushl %eax pushl %eax
...@@ -366,6 +366,14 @@ syscall_exit_work: ...@@ -366,6 +366,14 @@ syscall_exit_work:
call do_syscall_trace call do_syscall_trace
jmp resume_userspace jmp resume_userspace
ALIGN
syscall_fault:
pushl %eax # save orig_eax
SAVE_ALL
GET_THREAD_INFO(%ebx)
movl $-EFAULT,EAX(%esp)
jmp resume_userspace
ALIGN ALIGN
syscall_badsys: syscall_badsys:
movl $-ENOSYS,EAX(%esp) movl $-ENOSYS,EAX(%esp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment