From: Stuart Anderson <anderson@netsweng.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] RFC: [6/11] EFAULT patch
Date: Tue, 18 Sep 2007 21:23:29 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0709182122220.20150@trantor.stuart.netsweng.com> (raw)
[-- Attachment #1: Type: TEXT/PLAIN, Size: 406 bytes --]
This part contains the changes to write_ldt() to use the newer APIs.
Stuart
Stuart R. Anderson anderson@netsweng.com
Network & Software Engineering http://www.netsweng.com/
1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F
BD03 0A62 E534 37A7 9149
[-- Attachment #2: efault patch 6 of 11 --]
[-- Type: TEXT/PLAIN, Size: 1857 bytes --]
Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c 2007-09-17 01:37:05.000000000 -0400
+++ qemu/linux-user/syscall.c 2007-09-17 01:37:26.000000000 -0400
@@ -2040,22 +2040,21 @@
/* XXX: add locking support */
static int write_ldt(CPUX86State *env,
- target_ulong ptr, unsigned long bytecount, int oldmode)
+ struct target_modify_ldt_ldt_s *target_ldt_info, unsigned long bytecount, int oldmode)
{
+ long ret = 0;
struct target_modify_ldt_ldt_s ldt_info;
- struct target_modify_ldt_ldt_s *target_ldt_info;
int seg_32bit, contents, read_exec_only, limit_in_pages;
int seg_not_present, useable;
uint32_t *lp, entry_1, entry_2;
if (bytecount != sizeof(ldt_info))
return -EINVAL;
- lock_user_struct(target_ldt_info, ptr, 1);
+ if( !access_ok(&target_ldt_info,target_ldt_info,sizeof(struct target_modify_ldt_ldt_s)) ) return -EFAULT;
ldt_info.entry_number = tswap32(target_ldt_info->entry_number);
ldt_info.base_addr = tswapl(target_ldt_info->base_addr);
ldt_info.limit = tswap32(target_ldt_info->limit);
ldt_info.flags = tswap32(target_ldt_info->flags);
- unlock_user_struct(target_ldt_info, ptr, 0);
if (ldt_info.entry_number >= TARGET_LDT_ENTRIES)
return -EINVAL;
@@ -2130,10 +2129,10 @@
ret = read_ldt(ptr, bytecount);
break;
case 1:
- ret = write_ldt(env, ptr, bytecount, 1);
+ ret = write_ldt(env, (struct target_modify_ldt_ldt_s *)ptr, bytecount, 1);
break;
case 0x11:
- ret = write_ldt(env, ptr, bytecount, 0);
+ ret = write_ldt(env, (struct target_modify_ldt_ldt_s *)ptr, bytecount, 0);
break;
}
return ret;
reply other threads:[~2007-09-19 1:24 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=Pine.LNX.4.64.0709182122220.20150@trantor.stuart.netsweng.com \
--to=anderson@netsweng.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).