1. 05 May, 2014 2 commits
    • Andy Lutomirski's avatar
      x86, vdso: Move the vvar and hpet mappings next to the 64-bit vDSO · f40c3300
      Andy Lutomirski authored
      This makes the 64-bit and x32 vdsos use the same mechanism as the
      32-bit vdso.  Most of the churn is deleting all the old fixmap code.
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Link: http://lkml.kernel.org/r/8af87023f57f6bb96ec8d17fce3f88018195b49b.1399317206.git.luto@amacapital.net
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
    • Andy Lutomirski's avatar
      x86, vdso: Reimplement vdso.so preparation in build-time C · 6f121e54
      Andy Lutomirski authored
      Currently, vdso.so files are prepared and analyzed by a combination
      of objcopy, nm, some linker script tricks, and some simple ELF
      parsers in the kernel.  Replace all of that with plain C code that
      runs at build time.
      All five vdso images now generate .c files that are compiled and
      linked in to the kernel image.
      This should cause only one userspace-visible change: the loaded vDSO
      images are stripped more heavily than they used to be.  Everything
      outside the loadable segment is dropped.  In particular, this causes
      the section table and section name strings to be missing.  This
      should be fine: real dynamic loaders don't load or inspect these
      tables anyway.  The result is roughly equivalent to eu-strip's
      --strip-sections option.
      The purpose of this change is to enable the vvar and hpet mappings
      to be moved to the page following the vDSO load segment.  Currently,
      it is possible for the section table to extend into the page after
      the load segment, so, if we map it, it risks overlapping the vvar or
      hpet page.  This happens whenever the load segment is just under a
      multiple of PAGE_SIZE.
      The only real subtlety here is that the old code had a C file with
      inline assembler that did 'call VDSO32_vsyscall' and a linker script
      that defined 'VDSO32_vsyscall = __kernel_vsyscall'.  This most
      likely worked by accident: the linker script entry defines a symbol
      associated with an address as opposed to an alias for the real
      dynamic symbol __kernel_vsyscall.  That caused ld to relocate the
      reference at link time instead of leaving an interposable dynamic
      relocation.  Since the VDSO32_vsyscall hack is no longer needed, I
      now use 'call __kernel_vsyscall', and I added -Bsymbolic to make it
      work.  vdso2c will generate an error and abort the build if the
      resulting image contains any dynamic relocations, so we won't
      silently generate bad vdso images.
      (Dynamic relocations are a problem because nothing will even attempt
      to relocate the vdso.)
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Link: http://lkml.kernel.org/r/2c4fcf45524162a34d87fdda1eb046b2a5cecee7.1399317206.git.luto@amacapital.net
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
  2. 18 Mar, 2014 6 commits
  3. 12 Jan, 2014 1 commit
  4. 06 Nov, 2013 1 commit
  5. 18 Jul, 2013 1 commit
  6. 15 Feb, 2013 1 commit
  7. 28 Nov, 2012 1 commit
  8. 24 Sep, 2012 1 commit
    • John Stultz's avatar
      time: Convert x86_64 to using new update_vsyscall · 650ea024
      John Stultz authored
      Switch x86_64 to using sub-ns precise vsyscall
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
  9. 23 Mar, 2012 2 commits
  10. 16 Mar, 2012 2 commits
    • Thomas Gleixner's avatar
      x86: vdso: Use seqcount instead of seqlock · 2ab51657
      Thomas Gleixner authored
      The update of the vdso data happens under xtime_lock, so adding a
      nested lock is pointless. Just use a seqcount to sync the readers.
      Reviewed-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
    • John Stultz's avatar
      time: x86: Fix race switching from vsyscall to non-vsyscall clock · a939e817
      John Stultz authored
      When switching from a vsyscall capable to a non-vsyscall capable
      clocksource, there was a small race, where the last vsyscall
      gettimeofday before the switch might return a invalid time value
      using the new non-vsyscall enabled clocksource values after the
      switch is complete.
      This is due to the vsyscall code checking the vclock_mode once
      outside of the seqcount protected section. After it reads the
      vclock mode, it doesn't re-check that the sampled clock data
      that is obtained in the seqcount critical section still matches.
      The fix is to sample vclock_mode inside the protected section,
      and as long as it isn't VCLOCK_NONE, return the calculated
      value. If it has changed and is now VCLOCK_NONE, fall back
      to the syscall gettime calculation.
        * Cleanup checks as suggested by tglx
        * Also fix same issue present in gettimeofday path
      CC: Andy Lutomirski <luto@amacapital.net>
      CC: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
  11. 18 Jul, 2011 1 commit
  12. 15 Jul, 2011 1 commit
  13. 05 Jun, 2011 1 commit
    • Andy Lutomirski's avatar
      x86-64: Remove kernel.vsyscall64 sysctl · 0d7b8547
      Andy Lutomirski authored
      It's unnecessary overhead in code that's supposed to be highly
      optimized.  Removing it allows us to remove one of the two
      syscall instructions in the vsyscall page.
      The only sensible use for it is for UML users, and it doesn't
      fully address inconsistent vsyscall results on UML.  The real
      fix for UML is to stop using vsyscalls entirely.
      Signed-off-by: default avatarAndy Lutomirski <luto@mit.edu>
      Cc: Jesper Juhl <jj@chaosbits.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Arjan van de Ven <arjan@infradead.org>
      Cc: Jan Beulich <JBeulich@novell.com>
      Cc: richard -rw- weinberger <richard.weinberger@gmail.com>
      Cc: Mikael Pettersson <mikpe@it.uu.se>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Louis Rilling <Louis.Rilling@kerlabs.com>
      Cc: Valdis.Kletnieks@vt.edu
      Cc: pageexec@freemail.hu
      Link: http://lkml.kernel.org/r/973ae803fe76f712da4b2740e66dccf452d3b1e4.1307292171.git.luto@mit.edu
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  14. 26 May, 2011 1 commit
  15. 24 May, 2011 4 commits
  16. 21 Aug, 2009 1 commit
    • john stultz's avatar
      time: Introduce CLOCK_REALTIME_COARSE · da15cfda
      john stultz authored
      After talking with some application writers who want very fast, but not
      fine-grained timestamps, I decided to try to implement new clock_ids
      which returns the time at the last tick. This is very fast as we don't
      have to access any hardware (which can be very painful if you're using
      something like the acpi_pm clocksource), and we can even use the vdso
      clock_gettime() method to avoid the syscall. The only trade off is you
      only get low-res tick grained time resolution.
      This isn't a new idea, I know Ingo has a patch in the -rt tree that made
      the vsyscall gettimeofday() return coarse grained time when the
      vsyscall64 sysctrl was set to 2. However this affects all applications
      on a system.
      With this method, applications can choose the proper speed/granularity
      trade-off for themselves.
      Signed-off-by: default avatarJohn Stultz <johnstul@us.ibm.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: nikolag@ca.ibm.com
      Cc: Darren Hart <dvhltc@us.ibm.com>
      Cc: arjan@infradead.org
      Cc: jonathan@jonmasters.org
      LKML-Reference: <1250734414.6897.5.camel@localhost.localdomain>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
  17. 30 Apr, 2009 1 commit
    • John Wright's avatar
      x86: gettimeofday() vDSO: fix segfault when tv == NULL · 2f65dd47
      John Wright authored
      According to the gettimeofday(2) manual:
             If either tv or tz is NULL, the corresponding structure is not
             set or returned.
      Since it is legal to give NULL as the tv argument, the code should make
      sure tv is not NULL before trying to dereference it.
      This issue manifests itself on x86_64 when vdso=0 is not on the kernel
      command-line and libc uses the vDSO for gettimeofday() (e.g. glibc >=
      2.7).  A simple reproducer:
        #include <stdio.h>
        #include <sys/time.h>
        int main(void)
            struct timezone tz;
            gettimeofday(NULL, &tz);
            return 0;
      See http://bugs.debian.org/466491
       for more details.
      [ Impact: fix gettimeofday(NULL, &tz) segfault ]
      Signed-off-by: default avatarJohn Wright <john.wright@hp.com>
      Cc: Andi Kleen <ak@suse.de>
      Cc: John Wright <john.wright@hp.com>
      LKML-Reference: <1241037121-14805-1-git-send-email-john.wright@hp.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  18. 12 Nov, 2008 2 commits
    • Steven Rostedt's avatar
      trace: rename unlikely profiler to branch profiler · 2ed84eeb
      Steven Rostedt authored
      Impact: name change of unlikely tracer and profiler
      Ingo Molnar suggested changing the config from UNLIKELY_PROFILE
      to BRANCH_PROFILING. I never did like the "unlikely" name so I
      went one step farther, and renamed all the unlikely configurations
      to a "BRANCH" variant.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Ingo Molnar's avatar
      tracing: branch tracer, fix vdso crash · 2b7d0390
      Ingo Molnar authored
      Impact: fix bootup crash
      the branch tracer missed arch/x86/vdso/vclock_gettime.c from
      disabling tracing, which caused such bootup crashes:
        [  201.840097] init[1]: segfault at 7fffed3fe7c0 ip 00007fffed3fea2e sp 000077
      also clean up the ugly ifdefs in arch/x86/kernel/vsyscall_64.c by
      creating DISABLE_UNLIKELY_PROFILE facility for code to turn off
      instrumentation on a per file basis.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  19. 23 May, 2008 2 commits
  20. 30 Jan, 2008 1 commit
  21. 11 Oct, 2007 1 commit
  22. 12 Sep, 2007 1 commit
  23. 22 Jul, 2007 1 commit
    • Andi Kleen's avatar
      x86_64: Add vDSO for x86-64 with gettimeofday/clock_gettime/getcpu · 2aae950b
      Andi Kleen authored
      This implements new vDSO for x86-64.  The concept is similar
      to the existing vDSOs on i386 and PPC.  x86-64 has had static
      vsyscalls before,  but these are not flexible enough anymore.
      A vDSO is a ELF shared library supplied by the kernel that is mapped into
      user address space.  The vDSO mapping is randomized for each process
      for security reasons.
      Doing this was needed for clock_gettime, because clock_gettime
      always needs a syscall fallback and having one at a fixed
      address would have made buffer overflow exploits too easy to write.
      The vdso can be disabled with vdso=0
      It currently includes a new gettimeofday implemention and optimized
      clock_gettime(). The gettimeofday implementation is slightly faster
      than the one in the old vsyscall.  clock_gettime is significantly faster
      than the syscall for CLOCK_MONOTONIC and CLOCK_REALTIME.
      The new calls are generally faster than the old vsyscall.
      Advantages over the old x86-64 vsyscalls:
      - Extensible
      - Randomized
      - Cleaner
      - Easier to virtualize (the old static address range previously causes
      overhead e.g. for Xen because it has to create special page tables for it)
      Weak points:
      - glibc support still to be written
      The VM interface is partly based on Ingo Molnar's i386 version.
      Includes compile fix from Joachim Deguara
      Signed-off-by: default avatarAndi Kleen <ak@suse.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>