07 Dec, 2006

6 commits

  • Create a paravirt.h header for all the critical operations which need to be
    replaced with hypervisor calls, and include that instead of defining native
    operations, when CONFIG_PARAVIRT.

    This patch does the dumbest possible replacement of paravirtualized
    instructions: calls through a "paravirt_ops" structure. Currently these are
    function implementations of native hardware: hypervisors will override the ops
    structure with their own variants.

    All the pv-ops functions are declared "fastcall" so that a specific
    register-based ABI is used, to make inlining assember easier.

    And:

    +From: Andy Whitcroft

    The paravirt ops introduce a 'weak' attribute onto memory_setup().
    Code ordering leads to the following warnings on x86:

    arch/i386/kernel/setup.c:651: warning: weak declaration of
    `memory_setup' after first use results in unspecified behavior

    Move memory_setup() to avoid this.

    Signed-off-by: Rusty Russell
    Signed-off-by: Chris Wright
    Signed-off-by: Andi Kleen
    Cc: Jeremy Fitzhardinge
    Cc: Zachary Amsden
    Signed-off-by: Andrew Morton
    Signed-off-by: Andy Whitcroft

    Rusty Russell
     
  • Use the pcurrent field in the PDA to implement the "current" macro. This ends
    up compiling down to a single instruction to get the current task.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Andi Kleen
    Cc: Chuck Ebbert
    Cc: Zachary Amsden
    Cc: Jan Beulich
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton

    Jeremy Fitzhardinge
     
  • Use the cpu_number in the PDA to implement raw_smp_processor_id. This is a
    little simpler than using thread_info, though the cpu field in thread_info
    cannot be removed since it is used for things other than getting the current
    CPU in common code.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Andi Kleen
    Cc: Chuck Ebbert
    Cc: Zachary Amsden
    Cc: Jan Beulich
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton

    Jeremy Fitzhardinge
     
  • This patch is the meat of the PDA change. This patch makes several related
    changes:

    1: Most significantly, %gs is now used in the kernel. This means that on
    entry, the old value of %gs is saved away, and it is reloaded with
    __KERNEL_PDA.

    2: entry.S constructs the stack in the shape of struct pt_regs, and this
    is passed around the kernel so that the process's saved register
    state can be accessed.

    Unfortunately struct pt_regs doesn't currently have space for %gs
    (or %fs). This patch extends pt_regs to add space for gs (no space
    is allocated for %fs, since it won't be used, and it would just
    complicate the code in entry.S to work around the space).

    3: Because %gs is now saved on the stack like %ds, %es and the integer
    registers, there are a number of places where it no longer needs to
    be handled specially; namely context switch, and saving/restoring the
    register state in a signal context.

    4: And since kernel threads run in kernel space and call normal kernel
    code, they need to be created with their %gs == __KERNEL_PDA.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Andi Kleen
    Cc: Chuck Ebbert
    Cc: Zachary Amsden
    Cc: Jan Beulich
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton

    Jeremy Fitzhardinge
     
  • Use asm-offsets for the offsets of registers into the pt_regs struct, rather
    than having hard-coded constants

    I left the constants in the comments of entry.S because they're useful for
    reference; the code in entry.S is very dependent on the layout of pt_regs,
    even when using asm-offsets.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Andi Kleen
    Cc: Keith Owens
    Signed-off-by: Andrew Morton

    Jeremy Fitzhardinge
     
  • Clean up the espfix code:

    - Introduced PER_CPU() macro to be used from asm
    - Introduced GET_DESC_BASE() macro to be used from asm
    - Rewrote the fixup code in asm, as calling a C code with the altered %ss
    appeared to be unsafe
    - No longer altering the stack from a .fixup section
    - 16bit per-cpu stack is no longer used, instead the stack segment base
    is patched the way so that the high word of the kernel and user %esp
    are the same.
    - Added the limit-patching for the espfix segment. (Chuck Ebbert)

    [jeremy@goop.org: use the x86 scaling addressing mode rather than shifting]
    Signed-off-by: Stas Sergeev
    Signed-off-by: Andi Kleen
    Acked-by: Zachary Amsden
    Acked-by: Chuck Ebbert
    Acked-by: Jan Beulich
    Cc: Andi Kleen
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Andrew Morton

    Stas Sergeev
     

28 Jun, 2006

1 commit

  • Move the i386 VDSO down into a vma and thus randomize it.

    Besides the security implications, this feature also helps debuggers, which
    can COW a vma-backed VDSO just like a normal DSO and can thus do
    single-stepping and other debugging features.

    It's good for hypervisors (Xen, VMWare) too, which typically live in the same
    high-mapped address space as the VDSO, hence whenever the VDSO is used, they
    get lots of guest pagefaults and have to fix such guest accesses up - which
    slows things down instead of speeding things up (the primary purpose of the
    VDSO).

    There's a new CONFIG_COMPAT_VDSO (default=y) option, which provides support
    for older glibcs that still rely on a prelinked high-mapped VDSO. Newer
    distributions (using glibc 2.3.3 or later) can turn this option off. Turning
    it off is also recommended for security reasons: attackers cannot use the
    predictable high-mapped VDSO page as syscall trampoline anymore.

    There is a new vdso=[0|1] boot option as well, and a runtime
    /proc/sys/vm/vdso_enabled sysctl switch, that allows the VDSO to be turned
    on/off.

    (This version of the VDSO-randomization patch also has working ELF
    coredumping, the previous patch crashed in the coredumping code.)

    This code is a combined work of the exec-shield VDSO randomization
    code and Gerd Hoffmann's hypervisor-centric VDSO patch. Rusty Russell
    started this patch and i completed it.

    [akpm@osdl.org: cleanups]
    [akpm@osdl.org: compile fix]
    [akpm@osdl.org: compile fix 2]
    [akpm@osdl.org: compile fix 3]
    [akpm@osdl.org: revernt MAXMEM change]
    Signed-off-by: Ingo Molnar
    Signed-off-by: Arjan van de Ven
    Cc: Gerd Hoffmann
    Cc: Rusty Russell
    Cc: Zachary Amsden
    Cc: Andi Kleen
    Cc: Jan Beulich
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

26 Jun, 2006

1 commit

  • Up until now algorithms have been happy to get a context pointer since
    they know everything that's in the tfm already (e.g., alignment, block
    size).

    However, once we have parameterised algorithms, such information will
    be specific to each tfm. So the algorithm API needs to be changed to
    pass the tfm structure instead of the context pointer.

    This patch is basically a text substitution. The only tricky bit is
    the assembly routines that need to get the context pointer offset
    through asm-offsets.h.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds