From: Riku Voipio <riku.voipio@iki.fi>
To: Martin Mohring <martin.mohring@opensuse.org>
Cc: laurent.desnogues@gmail.com, qemu-devel@nongnu.org,
Arnaud Patard <arnaud.patard@rtp-net.org>
Subject: Re: [Qemu-devel] [PATCH] Fix utimensat (aka unbreak cp -a)
Date: Tue, 21 Apr 2009 21:18:16 +0300 [thread overview]
Message-ID: <20090421181816.GC17579@kos.to> (raw)
In-Reply-To: <49EDF679.70605@opensuse.org>
On Tue, Apr 21, 2009 at 06:38:17PM +0200, Martin Mohring wrote:
> > results in the invalid argutment error. I ll currently check which
> > syscalls are involved here.
> > the time of 1.1.1970 looks to me like a wrongly passed argument (of ==0).
no, NULL is what is supposed to be passed. try stracing a normal host
/bin/touch.
> 27374 open("/var/log/wtmp",0x20941,0666) = 3
> 27374 dup2(3,0,3,0,0,1109324328) = 0
> 27374 close(3) = 0
> 27374 utimensat(0,"(null)",(nil),0) = 0
> 27374 close(0) = 0
> 27374 open("/var/run/utmp",0x20941,0666) = 0
> 27374 utimensat(0,"(null)",(nil),0) = -1 errno=22 (Invalid argument)
It is unclear what svn revision you are using qemu, and/or if you are using
any of the patches in this thread. The patch I sent earlier, should fix
the invalid arg issue. As for the 1970 issue, try this patch.
commit 7f7e93aabde6b8f0e4a1a05537145efa9ed0156b
Author: Riku Voipio <riku.voipio@iki.fi>
Date: Tue Apr 21 20:37:01 2009 +0300
linux-user: fix utimensat with NULL timespec
Don't try to copy timespec from user if it is NULL.
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index e19e289..0049840 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6674,17 +6674,22 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
case TARGET_NR_utimensat:
{
- struct timespec ts[2];
- target_to_host_timespec(ts, arg3);
- target_to_host_timespec(ts+1, arg3+sizeof(struct target_timespec));
+ struct timespec *tsp, ts[2];
+ if (!arg3) {
+ tsp = NULL;
+ } else {
+ target_to_host_timespec(ts, arg3);
+ target_to_host_timespec(ts+1, arg3+sizeof(struct target_timespec));
+ tsp = ts;
+ }
if (!arg2)
- ret = get_errno(sys_utimensat(arg1, NULL, ts, arg4));
+ ret = get_errno(sys_utimensat(arg1, NULL, tsp, arg4));
else {
if (!(p = lock_user_string(arg2))) {
ret = -TARGET_EFAULT;
goto fail;
}
- ret = get_errno(sys_utimensat(arg1, path(p), ts, arg4));
+ ret = get_errno(sys_utimensat(arg1, path(p), tsp, arg4));
unlock_user(p, arg2, 0);
}
}
prev parent reply other threads:[~2009-04-21 18:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-21 8:24 [Qemu-devel] [PATCH] Fix utimensat (aka unbreak cp -a) Arnaud Patard
2009-04-21 8:36 ` Laurent Desnogues
2009-04-21 12:34 ` Riku Voipio
2009-04-21 14:42 ` Jamie Lokier
2009-04-21 16:09 ` Martin Mohring
2009-04-21 16:38 ` Martin Mohring
2009-04-21 18:18 ` Riku Voipio [this message]
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=20090421181816.GC17579@kos.to \
--to=riku.voipio@iki.fi \
--cc=arnaud.patard@rtp-net.org \
--cc=laurent.desnogues@gmail.com \
--cc=martin.mohring@opensuse.org \
--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).