06 Dec, 2011

1 commit

  • The x86_64 kernel pushes the fake kernel stack in
    arch/x86/kernel/entry_64.S:FAKE_STACK_FRAME, and
    rflags register in it does not conform to the specification.

    Although Intel's manual[1] says bit 1 of it shall be set to 1,
    this bit is cleared to 0 on pushing the fake stack.

    [1] Intel(R) 64 and IA-32 Architectures Software Developer's Manual
    Vol.1 3-21 Figure 3-8. EFLAGS Register

    If it is not on purpose, it is better to be fixed, because
    it can lead some tools misunderstanding the stack frame. For example,
    "crash" utility[2] actually detects it and warns you like
    below:

    RIP: ffffffff8005dfa2 RSP: ffff8104ce0c7f58 RFLAGS: 00000200
    [...]

    bt: WARNING: possibly bogus exception frame

    Signed-off-by: Seiichi Ikarashi
    Tested-by: Masayoshi MIZUMA
    Cc: Jan Beulich
    Cc: Frederic Weisbecker
    Cc: Linus Torvalds
    Signed-off-by: Ingo Molnar

    Seiichi Ikarashi
     

22 Jul, 2011

3 commits


20 Jan, 2011

2 commits

  • arch/x86/lguest/boot.c: In function ‘lguest_init_IRQ’:
    arch/x86/lguest/boot.c:824: error: macro "__this_cpu_write" requires 2 arguments, but only 1 given
    arch/x86/lguest/boot.c:824: error: ‘__this_cpu_write’ undeclared (first use in this function)
    arch/x86/lguest/boot.c:824: error: (Each undeclared identifier is reported only once
    arch/x86/lguest/boot.c:824: error: for each function it appears in.)

    drivers/lguest/x86/core.c: In function ‘copy_in_guest_info’:
    drivers/lguest/x86/core.c:94: error: lvalue required as left operand of assignment

    Signed-off-by: Rusty Russell

    Rusty Russell
     
  • Use this_cpu_ops in a couple of places in lguest.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Rusty Russell

    Christoph Lameter
     

14 Apr, 2010

1 commit

  • It's only used by cmpxchg8b_emu (see db677ffa5f5a for the gory
    details), and fixing that to be paravirt aware would be more work than
    simply ignoring it (and AFAICT only help lguest). This makes lguest
    work on machines which have cmpxchg8b, for kernels compiled for older
    processors.

    (We can't emulate it properly: the popf which expects to restore interrupts
    does not trap).

    Signed-off-by: Rusty Russell
    Cc: Jeremy Fitzhardinge
    Cc: virtualization@lists.osdl.org

    Rusty Russell
     

29 Oct, 2009

1 commit

  • This patch updates misc percpu related symbols such that percpu
    symbols are unique and don't clash with local symbols. This serves
    two purposes of decreasing the possibility of global percpu symbol
    collision and allowing dropping per_cpu__ prefix from percpu symbols.

    * drivers/crypto/padlock-aes.c: s/last_cword/paes_last_cword/

    * drivers/lguest/x86/core.c: s/last_cpu/lg_last_cpu/

    * drivers/s390/net/netiucv.c: rename the variable used in a macro to
    avoid clashing with percpu symbol

    * arch/mn10300/kernel/kprobes.c: replace current_ prefix with cur_ for
    static variables. Please note that percpu symbol current_kprobe
    can't be changed as it's used by generic code.

    Partly based on Rusty Russell's "alloc_percpu: rename percpu vars
    which cause name clashes" patch.

    Signed-off-by: Tejun Heo
    Reviewed-by: Christoph Lameter
    Cc: Rusty Russell
    Cc: Herbert Xu
    Cc: Chuck Ebbert
    Cc: David Howells
    Cc: Koichi Yasutake
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Cc: David S. Miller
    Cc: Masami Hiramatsu
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: linux390@de.ibm.com

    Tejun Heo
     

30 Jul, 2009

2 commits

  • Every so often, after code shuffles, I need to go through and unbitrot
    the Lguest Journey (see drivers/lguest/README). Since we now use RCU in
    a simple form in one place I took the opportunity to expand that explanation.

    Signed-off-by: Rusty Russell
    Cc: Ingo Molnar
    Cc: Paul McKenney

    Rusty Russell
     
  • I don't really notice it (except to begrudge the extra vertical
    space), but Ingo does. And he pointed out that one excuse of lguest
    is as a teaching tool, it should set a good example.

    Signed-off-by: Rusty Russell
    Cc: Ingo Molnar

    Rusty Russell
     

27 May, 2009

1 commit


19 Apr, 2009

2 commits

  • Fixes guest crash 'lguest: bad read address 0x4800000 len 256'

    The new per-cpu allocator ends up handing a non-linear address to
    write_gdt_entry. We do __pa() on it, and hand it to the host, which
    kills us.

    I've long wanted to make the hypercall "LOAD_GDT_ENTRY" to match the IDT
    code, but had no pressing reason until now.

    Signed-off-by: Rusty Russell
    Cc: lguest@ozlabs.org

    Rusty Russell
     
  • Typical message: 'lguest: unhandled trap 6 at 0x418726 (0x0)'

    vmlinux guests were broken by 4cd8b5e2a159f18a1507f1187b44a1acbfa6341b
    'lguest: use KVM hypercalls', which rewrites guest text from kvm hypercalls
    to trap 31.

    The Launcher mmaps the kernel image. The Guest executes and
    immediately faults in the first text page (read-only). Then it hits a
    hypercall, and we rewrite that hypercall, causing a copy-on-write.
    But the Guest pagetables still refer to the old page: we fault again,
    but as Host we see the hypercall already rewritten, and pass the fault
    back to the Guest. The Guest hasn't set up an IDT yet, so we kill it.

    This doesn't happen with bzImages: they unpack themselves and so the
    text pages are already read-write.

    Signed-off-by: Rusty Russell
    Tested-by: Patrick McHardy

    Matias Zabaljauregui
     

30 Mar, 2009

1 commit


29 Jul, 2008

1 commit


26 Jun, 2008

1 commit


20 Jun, 2008

1 commit

  • I am able to reproduce the oops reported by Simon in __switch_to() with
    lguest.

    My debug showed that there is at least one lguest specific
    issue (which should be present in 2.6.25 and before aswell) and it got
    exposed with a kernel oops with the recent fpu dynamic allocation patches.

    In addition to the previous possible scenario (with fpu_counter), in the
    presence of lguest, it is possible that the cpu's TS bit it still set and the
    lguest launcher task's thread_info has TS_USEDFPU still set.

    This is because of the way the lguest launcher handling the guest's TS bit.
    (look at lguest_set_ts() in lguest_arch_run_guest()). This can result
    in a DNA fault while doing unlazy_fpu() in __switch_to(). This will
    end up causing a DNA fault in the context of new process thats
    getting context switched in (as opossed to handling DNA fault in the context
    of lguest launcher/helper process).

    This is wrong in both pre and post 2.6.25 kernels. In the recent
    2.6.26-rc series, this is showing up as NULL pointer dereferences or
    sleeping function called from atomic context(__switch_to()), as
    we free and dynamically allocate the FPU context for the newly
    created threads. Older kernels might show some FPU corruption for processes
    running inside of lguest.

    With the appended patch, my test system is running for more than 50 mins
    now. So atleast some of your oops (hopefully all!) should get fixed.
    Please give it a try. I will spend more time with this fix tomorrow.

    Reported-by: Simon Holm Thøgersen
    Reported-by: Patrick McHardy
    Signed-off-by: Suresh Siddha
    Signed-off-by: Ingo Molnar

    Suresh Siddha
     

28 Mar, 2008

1 commit


31 Jan, 2008

2 commits

  • drivers/lguest/x86/core.c: In function ‘copy_in_guest_info’:
    drivers/lguest/x86/core.c:97: error: ‘struct x86_hw_tss’ has no member named ‘esp1’

    Signed-off-by: Rusty Russell
    Signed-off-by: Linus Torvalds

    Rusty Russell
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: (27 commits)
    lguest: use __PAGE_KERNEL instead of _PAGE_KERNEL
    lguest: Use explicit includes rateher than indirect
    lguest: get rid of lg variable assignments
    lguest: change gpte_addr header
    lguest: move changed bitmap to lg_cpu
    lguest: move last_pages to lg_cpu
    lguest: change last_guest to last_cpu
    lguest: change spte_addr header
    lguest: per-vcpu lguest pgdir management
    lguest: make pending notifications per-vcpu
    lguest: makes special fields be per-vcpu
    lguest: per-vcpu lguest task management
    lguest: replace lguest_arch with lg_cpu_arch.
    lguest: make registers per-vcpu
    lguest: make emulate_insn receive a vcpu struct.
    lguest: map_switcher_in_guest() per-vcpu
    lguest: per-vcpu interrupt processing.
    lguest: per-vcpu lguest timers
    lguest: make hypercalls use the vcpu struct
    lguest: make write() operation smp aware
    ...

    Manual conflict resolved (maybe even correctly, who knows) in
    drivers/lguest/x86/core.c

    Linus Torvalds
     

30 Jan, 2008

14 commits


26 Jan, 2008

1 commit

  • Replace all lock_cpu_hotplug/unlock_cpu_hotplug from the kernel and use
    get_online_cpus and put_online_cpus instead as it highlights the
    refcount semantics in these operations.

    The new API guarantees protection against the cpu-hotplug operation, but
    it doesn't guarantee serialized access to any of the local data
    structures. Hence the changes needs to be reviewed.

    In case of pseries_add_processor/pseries_remove_processor, use
    cpu_maps_update_begin()/cpu_maps_update_done() as we're modifying the
    cpu_present_map there.

    Signed-off-by: Gautham R Shenoy
    Signed-off-by: Ingo Molnar

    Gautham R Shenoy
     

25 Oct, 2007

2 commits


23 Oct, 2007

3 commits

  • Jes complains that page table code still uses lgread_u32 even though
    it now uses general kernel pte types. The best thing to do is to
    generalize lgread_u32 and lgwrite_u32.

    This means we lose the efficiency of getuser(). We could potentially
    regain it if we used __copy_from_user instead of copy_from_user, but
    I'm not certain that our range check is equivalent to access_ok() on
    all platforms.

    Signed-off-by: Rusty Russell
    Acked-by: Jes Sorensen

    Rusty Russell
     
  • This gets rid of the lguest bus, drivers and DMA mechanism, to make
    way for a generic virtio mechanism.

    Signed-off-by: Rusty Russell

    Rusty Russell
     
  • 1) This allows us to get alot closer to booting bzImages.

    2) It means we don't have to know page_offset.

    3) The Guest needs to modify the boot pagetables to create the
    PAGE_OFFSET mapping before jumping to C code.

    4) guest_pa() walks the page tables rather than using page_offset.

    5) We don't use page_offset to figure out whether to emulate: it was
    always kinda quesationable, and won't work for instructions done
    before remapping (bzImage unpacking in particular).

    6) We still want the kernel address for tlb flushing: have the initial
    hypercall give us that, too.

    Signed-off-by: Rusty Russell

    Rusty Russell