* [Qemu-devel] [6481] linuw-user fix: read() and acct() on NULL arguments
@ 2009-01-30 19:48 Aurelien Jarno
0 siblings, 0 replies; only message in thread
From: Aurelien Jarno @ 2009-01-30 19:48 UTC (permalink / raw)
To: qemu-devel
Revision: 6481
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6481
Author: aurel32
Date: 2009-01-30 19:48:17 +0000 (Fri, 30 Jan 2009)
Log Message:
-----------
linuw-user fix: read() and acct() on NULL arguments
Returning efault in these cases is not correct. Originally
proposed by Thayne Harbaugh in 2007:
http://www.mail-archive.com/qemu-devel@nongnu.org/msg14658.html
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Modified Paths:
--------------
trunk/linux-user/syscall.c
Modified: trunk/linux-user/syscall.c
===================================================================
--- trunk/linux-user/syscall.c 2009-01-30 19:48:07 UTC (rev 6480)
+++ trunk/linux-user/syscall.c 2009-01-30 19:48:17 UTC (rev 6481)
@@ -3437,10 +3437,14 @@
ret = 0; /* avoid warning */
break;
case TARGET_NR_read:
- if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0)))
- goto efault;
- ret = get_errno(read(arg1, p, arg3));
- unlock_user(p, arg2, ret);
+ if (arg3 == 0)
+ ret = 0;
+ else {
+ if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0)))
+ goto efault;
+ ret = get_errno(read(arg1, p, arg3));
+ unlock_user(p, arg2, ret);
+ }
break;
case TARGET_NR_write:
if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
@@ -3941,10 +3945,14 @@
goto unimplemented;
#endif
case TARGET_NR_acct:
- if (!(p = lock_user_string(arg1)))
- goto efault;
- ret = get_errno(acct(path(p)));
- unlock_user(p, arg1, 0);
+ if (arg1 == 0) {
+ ret = get_errno(acct(NULL));
+ } else {
+ if (!(p = lock_user_string(arg1)))
+ goto efault;
+ ret = get_errno(acct(path(p)));
+ unlock_user(p, arg1, 0);
+ }
break;
#ifdef TARGET_NR_umount2 /* not on alpha */
case TARGET_NR_umount2:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-01-30 19:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-30 19:48 [Qemu-devel] [6481] linuw-user fix: read() and acct() on NULL arguments Aurelien Jarno
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).