linux-um archives
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Andy Lutomirski <luto@mit.edu>
Cc: user-mode-linux-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] um: Implement a x86_64 vDSO
Date: Wed, 20 Jul 2011 20:09:11 +0200	[thread overview]
Message-ID: <201107202009.12279.richard@nod.at> (raw)
In-Reply-To: <4E27163A.6090102@mit.edu>

Am Mittwoch 20 Juli 2011, 19:54:02 schrieb Andy Lutomirski:
> On 07/18/2011 09:07 AM, Richard Weinberger wrote:
> > Until now UML had no x86_64 vDSO.
> > So glibc always used the vsyscall page for gettimeday()
> > and friends.
> > Calls to gettimeday() returned falsely the host time and
> > confused some programs.
> > 
> > This patch adds a vDSO which turns all __vdso_* calls into
> > a system call so that UML can trap them.
> > 
> > As glibc still uses the vsyscall page for static binaries this
> > patch improves the situation only for dynamic binaries.
> > 
> > Signed-off-by: Richard Weinberger<richard@nod.at>
> > 
> > +	asm("syscall" : "=a" (ret) :
> > +		"0" (__NR_clock_gettime), "D" (clock), "S" (ts) : "memory");
> > +
> 
> The x86-64 ABI and glibc think that rcx, and r11 are clobbered.  glibc
> also thinks that cc is clobbered.  I personally think that rdx and
> r8-r15 ought to be clobbered under the principle that syscall should
> look like a function call.

Hmm, I thought my implementation is fine because it follows 
arch/x86/vdso/vclock_gettime.c (Linus' tree).

notrace static long vdso_fallback_gettime(long clock, struct timespec *ts)
{
  long ret;
  asm("syscall" : "=a" (ret) :
      "0" (__NR_clock_gettime),"D" (clock), "S" (ts) : "memory");
  return ret;
}

Am I missing something or needs vdso_fallback_gettime() also some updates?

> It's hard to imagine this causing a problem in a function this trivial,
> though.
> 
> This applies to the other two syscall instructions as well.
> 
> --Andy
> 
> P.S.  If you really care, with the changes in tip/x86/vdso, it ought to
> be possible for UML to trap vsyscalls as well.  This would need a change
> to do_emulate_vsyscall to honor TIF_SYSCALL_EMU with intelligent
> semantics.  I know nothing about ptrace, so I'm not volunteering :)

Ok, I'll have at look at it.

Thanks,
//richard

  reply	other threads:[~2011-07-20 18:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-18 13:07 [PATCH 1/3] um: Disable scan_elf_aux() on x86_64 Richard Weinberger
2011-07-18 13:07 ` [PATCH 2/3] um: Set __HAVE_ARCH_GATE_AREA Richard Weinberger
2011-07-18 13:07 ` [uml-devel] [PATCH 3/3] um: Implement a x86_64 vDSO Richard Weinberger
2011-07-20 17:54   ` Andy Lutomirski
2011-07-20 18:09     ` Richard Weinberger [this message]
2011-07-20 18:19       ` Andrew Lutomirski

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=201107202009.12279.richard@nod.at \
    --to=richard@nod.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@mit.edu \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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