From: Luca Barbieri <ldb@ldb.ods.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux-Kernel ML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Fix sysenter (%ebp) fault handling
Date: Mon, 6 Jan 2003 03:03:51 +0100 [thread overview]
Message-ID: <20030106020351.GA8074@ldb> (raw)
[-- Attachment #1: Type: text/plain, Size: 1397 bytes --]
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.
diff --exclude-from=/home/ldb/src/exclude -urNdp --exclude='speedtouch.*' --exclude='atmsar.*' linux-2.5.54/arch/i386/kernel/entry.S linux-2.5.54-ldb/arch/i386/kernel/entry.S
--- linux-2.5.54/arch/i386/kernel/entry.S 2003-01-02 04:21:27.000000000 +0100
+++ linux-2.5.54-ldb/arch/i386/kernel/entry.S 2003-01-04 19:06:07.000000000 +0100
@@ -253,11 +253,11 @@ ENTRY(sysenter_entry)
* Careful about security.
*/
cmpl $__PAGE_OFFSET-3,%ebp
- jae syscall_badsys
+ jae syscall_fault
1: movl (%ebp),%ebp
.section __ex_table,"a"
.align 4
- .long 1b,syscall_badsys
+ .long 1b,syscall_fault
.previous
pushl %eax
@@ -367,6 +373,14 @@ syscall_exit_work:
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
syscall_badsys:
movl $-ENOSYS,EAX(%esp)
jmp resume_userspace
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
reply other threads:[~2003-01-06 2:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030106020351.GA8074@ldb \
--to=ldb@ldb.ods.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox