11 Jan, 2012

1 commit

  • * 'stable/for-linus-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: (37 commits)
    xen/pciback: Expand the warning message to include domain id.
    xen/pciback: Fix "device has been assigned to X domain!" warning
    xen/pciback: Move the PCI_DEV_FLAGS_ASSIGNED ops to the "[un|]bind"
    xen/xenbus: don't reimplement kvasprintf via a fixed size buffer
    xenbus: maximum buffer size is XENSTORE_PAYLOAD_MAX
    xen/xenbus: Reject replies with payload > XENSTORE_PAYLOAD_MAX.
    Xen: consolidate and simplify struct xenbus_driver instantiation
    xen-gntalloc: introduce missing kfree
    xen/xenbus: Fix compile error - missing header for xen_initial_domain()
    xen/netback: Enable netback on HVM guests
    xen/grant-table: Support mappings required by blkback
    xenbus: Use grant-table wrapper functions
    xenbus: Support HVM backends
    xen/xenbus-frontend: Fix compile error with randconfig
    xen/xenbus-frontend: Make error message more clear
    xen/privcmd: Remove unused support for arch specific privcmp mmap
    xen: Add xenbus_backend device
    xen: Add xenbus device driver
    xen: Add privcmd device driver
    xen/gntalloc: fix reference counts on multi-page mappings
    ...

    Linus Torvalds
     

05 Jan, 2012

4 commits

  • Signed-off-by: Ian Campbell
    Cc: Haogang Chen
    Acked-by: Jan Beulich
    Signed-off-by: Konrad Rzeszutek Wilk

    Ian Campbell
     
  • Use this now that it is defined even though it happens to be == PAGE_SIZE.

    The code which takes requests from userspace already validates against the size
    of this buffer so no further checks are required to ensure that userspace
    requests comply with the protocol in this respect.

    Signed-off-by: Ian Campbell
    Cc: Haogang Chen
    Signed-off-by: Konrad Rzeszutek Wilk

    Ian Campbell
     
  • Haogang Chen found out that:

    There is a potential integer overflow in process_msg() that could result
    in cross-domain attack.

    body = kmalloc(msg->hdr.len + 1, GFP_NOIO | __GFP_HIGH);

    When a malicious guest passes 0xffffffff in msg->hdr.len, the subsequent
    call to xb_read() would write to a zero-length buffer.

    The other end of this connection is always the xenstore backend daemon
    so there is no guest (malicious or otherwise) which can do this. The
    xenstore daemon is a trusted component in the system.

    However this seem like a reasonable robustness improvement so we should
    have it.

    And Ian when read the API docs found that:
    The payload length (len field of the header) is limited to 4096
    (XENSTORE_PAYLOAD_MAX) in both directions. If a client exceeds the
    limit, its xenstored connection will be immediately killed by
    xenstored, which is usually catastrophic from the client's point of
    view. Clients (particularly domains, which cannot just reconnect)
    should avoid this.

    so this patch checks against that instead.

    This also avoids a potential integer overflow pointed out by Haogang Chen.

    Signed-off-by: Ian Campbell
    Cc: Haogang Chen
    CC: stable@kernel.org
    Signed-off-by: Konrad Rzeszutek Wilk

    Ian Campbell
     
  • The 'name', 'owner', and 'mod_name' members are redundant with the
    identically named fields in the 'driver' sub-structure. Rather than
    switching each instance to specify these fields explicitly, introduce
    a macro to simplify this.

    Eliminate further redundancy by allowing the drvname argument to
    DEFINE_XENBUS_DRIVER() to be blank (in which case the first entry from
    the ID table will be used for .driver.name).

    Also eliminate the questionable xenbus_register_{back,front}end()
    wrappers - their sole remaining purpose was the checking of the
    'owner' field, proper setting of which shouldn't be an issue anymore
    when the macro gets used.

    v2: Restore DRV_NAME for the driver name in xen-pciback.

    Signed-off-by: Jan Beulich
    Cc: Jens Axboe
    Cc: Dmitry Torokhov
    Cc: Florian Tobias Schandinat
    Cc: Ian Campbell
    Cc: David S. Miller
    Signed-off-by: Konrad Rzeszutek Wilk

    Jan Beulich
     

22 Dec, 2011

1 commit


21 Dec, 2011

3 commits

  • For xenbus_{map,unmap}_ring to work on HVM, the grant table operations
    must be set up using the gnttab_set_{map,unmap}_op functions instead of
    directly populating the fields of gnttab_map_grant_ref. These functions
    simply populate the structure on paravirtualized Xen; however, on HVM
    they must call __pa() on vaddr when populating op->host_addr because the
    hypervisor cannot directly interpret guest-virtual addresses.

    Signed-off-by: Daniel De Graaf
    [v1: Fixed cleanpatch error]
    Signed-off-by: Konrad Rzeszutek Wilk

    Daniel De Graaf
     
  • Add HVM implementations of xenbus_(map,unmap)_ring_v(alloc,free) so
    that ring mappings can be done without using GNTMAP_contains_pte which
    is not supported on HVM. This also removes the need to use vmlist_lock
    on PV by tracking the allocated xenbus rings.

    Signed-off-by: Daniel De Graaf
    [v1: Fix compile error when XENBUS_FRONTEND is defined as module]
    Signed-off-by: Konrad Rzeszutek Wilk

    Daniel De Graaf
     
  • * commit 'v3.2-rc3': (412 commits)
    Linux 3.2-rc3
    virtio-pci: make reset operation safer
    virtio-mmio: Correct the name of the guest features selector
    virtio: add HAS_IOMEM dependency to MMIO platform bus driver
    eCryptfs: Extend array bounds for all filename chars
    eCryptfs: Flush file in vma close
    eCryptfs: Prevent file create race condition
    regulator: TPS65910: Fix VDD1/2 voltage selector count
    i2c: Make i2cdev_notifier_call static
    i2c: Delete ANY_I2C_BUS
    i2c: Fix device name for 10-bit slave address
    i2c-algo-bit: Generate correct i2c address sequence for 10-bit target
    drm: integer overflow in drm_mode_dirtyfb_ioctl()
    Revert "of/irq: of_irq_find_parent: check for parent equal to child"
    drivers/gpu/vga/vgaarb.c: add missing kfree
    drm/radeon/kms/atom: unify i2c gpio table handling
    drm/radeon/kms: fix up gpio i2c mask bits for r4xx for real
    ttm: Don't return the bo reserved on error path
    mount_subtree() pointless use-after-free
    iio: fix a leak due to improper use of anon_inode_getfd()
    ...

    Konrad Rzeszutek Wilk
     

20 Dec, 2011

1 commit


19 Dec, 2011

1 commit


17 Dec, 2011

3 commits


17 Nov, 2011

1 commit

  • When mapping a foreign page with xenbus_map_ring_valloc() with the
    GNTTABOP_map_grant_ref hypercall, set the GNTMAP_contains_pte flag and
    pass a pointer to the PTE (in init_mm).

    After the page is mapped, the usual fault mechanism can be used to
    update additional MMs. This allows the vmalloc_sync_all() to be
    removed from alloc_vm_area().

    Signed-off-by: David Vrabel
    Acked-by: Andrew Morton
    [v1: Squashed fix by Michal for no-mmu case]
    Signed-off-by: Konrad Rzeszutek Wilk
    Signed-off-by: Michal Simek

    David Vrabel
     

07 Nov, 2011

3 commits

  • * 'stable/cleanups-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen: use static initializers in xen-balloon.c
    Xen: fix braces and tabs coding style issue in xenbus_probe.c
    Xen: fix braces coding style issue in xenbus_probe.h
    Xen: fix whitespaces,tabs coding style issue in drivers/xen/pci.c
    Xen: fix braces coding style issue in gntdev.c and grant-table.c
    Xen: fix whitespaces,tabs coding style issue in drivers/xen/events.c
    Xen: fix whitespaces,tabs coding style issue in drivers/xen/balloon.c

    Fix up trivial whitespace-conflicts in
    drivers/xen/{balloon.c,pci.c,xenbus/xenbus_probe.c}

    Linus Torvalds
     
  • * 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
    Revert "tracing: Include module.h in define_trace.h"
    irq: don't put module.h into irq.h for tracking irqgen modules.
    bluetooth: macroize two small inlines to avoid module.h
    ip_vs.h: fix implicit use of module_get/module_put from module.h
    nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
    include: replace linux/module.h with "struct module" wherever possible
    include: convert various register fcns to macros to avoid include chaining
    crypto.h: remove unused crypto_tfm_alg_modname() inline
    uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
    pm_runtime.h: explicitly requires notifier.h
    linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
    miscdevice.h: fix up implicit use of lists and types
    stop_machine.h: fix implicit use of smp.h for smp_processor_id
    of: fix implicit use of errno.h in include/linux/of.h
    of_platform.h: delete needless include
    acpi: remove module.h include from platform/aclinux.h
    miscdevice.h: delete unnecessary inclusion of module.h
    device_cgroup.h: delete needless include
    net: sch_generic remove redundant use of
    net: inet_timewait_sock doesnt need
    ...

    Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in
    - drivers/media/dvb/frontends/dibx000_common.c
    - drivers/media/video/{mt9m111.c,ov6650.c}
    - drivers/mfd/ab3550-core.c
    - include/linux/dmaengine.h

    Linus Torvalds
     
  • * 'stable/vmalloc-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    net: xen-netback: use API provided by xenbus module to map rings
    block: xen-blkback: use API provided by xenbus module to map rings
    xen: use generic functions instead of xen_{alloc, free}_vm_area()

    Linus Torvalds
     

01 Nov, 2011

2 commits


25 Oct, 2011

1 commit

  • …ci.fixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen

    * 'stable/drivers-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xenbus: don't rely on xen_initial_domain to detect local xenstore
    xenbus: Fix loopback event channel assuming domain 0
    xen/pv-on-hvm:kexec: Fix implicit declaration of function 'xen_hvm_domain'
    xen/pv-on-hvm kexec: add xs_reset_watches to shutdown watches from old kernel
    xen/pv-on-hvm kexec: update xs_wire.h:xsd_sockmsg_type from xen-unstable
    xen/pv-on-hvm kexec+kdump: reset PV devices in kexec or crash kernel
    xen/pv-on-hvm kexec: rebind virqs to existing eventchannel ports
    xen/pv-on-hvm kexec: prevent crash in xenwatch_thread() when stale watch events arrive

    * 'stable/drivers.bugfixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/pciback: Check if the device is found instead of blindly assuming so.
    xen/pciback: Do not dereference psdev during printk when it is NULL.
    xen: remove XEN_PLATFORM_PCI config option
    xen: XEN_PVHVM depends on PCI
    xen/pciback: double lock typo
    xen/pciback: use mutex rather than spinlock in vpci backend
    xen/pciback: Use mutexes when working with Xenbus state transitions.
    xen/pciback: miscellaneous adjustments
    xen/pciback: use mutex rather than spinlock in passthrough backend
    xen/pciback: use resource_size()

    * 'stable/pci.fixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/pci: support multi-segment systems
    xen-swiotlb: When doing coherent alloc/dealloc check before swizzling the MFNs.
    xen/pci: make bus notifier handler return sane values
    xen-swiotlb: fix printk and panic args
    xen-swiotlb: Fix wrong panic.
    xen-swiotlb: Retry up three times to allocate Xen-SWIOTLB
    xen-pcifront: Update warning comment to use 'e820_host' option.

    Linus Torvalds
     

20 Oct, 2011

1 commit


14 Oct, 2011

2 commits

  • The xenstore daemon does not have to run in the xen initial domain;
    however, Linux currently uses xen_initial_domain to test if a loopback
    event channel should be used instead of the event channel provided in
    Xen's start_info structure. Instead, if the event channel passed in the
    start_info structure is not valid, assume that this domain will run
    xenstored locally and set up the event channel.

    Signed-off-by: Daniel De Graaf
    Reviewed-by: Ian Campbell
    Signed-off-by: Konrad Rzeszutek Wilk

    Daniel De Graaf
     
  • The xenbus event channel established in xenbus_init is intended to be a
    loopback channel, but the remote domain was hardcoded to 0; this will
    cause the channel to be unusable when xenstore is not being run in
    domain 0.

    Signed-off-by: Daniel De Graaf
    Reviewed-by: Ian Campbell
    Signed-off-by: Konrad Rzeszutek Wilk

    Daniel De Graaf
     

30 Sep, 2011

1 commit


27 Sep, 2011

1 commit


23 Sep, 2011

1 commit

  • Add new xs_reset_watches function to shutdown watches from old kernel after
    kexec boot. The old kernel does not unregister all watches in the
    shutdown path. They are still active, the double registration can not
    be detected by the new kernel. When the watches fire, unexpected events
    will arrive and the xenwatch thread will crash (jumps to NULL). An
    orderly reboot of a hvm guest will destroy the entire guest with all its
    resources (including the watches) before it is rebuilt from scratch, so
    the missing unregister is not an issue in that case.

    With this change the xenstored is instructed to wipe all active watches
    for the guest. However, a patch for xenstored is required so that it
    accepts the XS_RESET_WATCHES request from a client (see changeset
    23839:42a45baf037d in xen-unstable.hg). Without the patch for xenstored
    the registration of watches will fail and some features of a PVonHVM
    guest are not available. The guest is still able to boot, but repeated
    kexec boots will fail.

    [v5: use xs_single instead of passing a dummy string to xs_talkv]
    [v4: ignore -EEXIST in xs_reset_watches]
    [v3: use XS_RESET_WATCHES instead of XS_INTRODUCE]
    [v2: move all code which deals with XS_INTRODUCE into xs_introduce()
    (based on feedback from Ian Campbell); remove casts from kvec assignment]
    Signed-off-by: Olaf Hering
    [v1: Redid the git description a bit]
    Signed-off-by: Konrad Rzeszutek Wilk

    Olaf Hering
     

01 Sep, 2011

2 commits

  • After triggering a crash dump in a HVM guest, the PV backend drivers
    will remain in Connected state. When the kdump kernel starts the PV
    drivers will skip such devices. As a result, no root device is found and
    the vmcore cant be saved.

    A similar situation happens after a kexec boot, here the devices will be
    in the Closed state.

    With this change all frontend devices with state XenbusStateConnected or
    XenbusStateClosed will be reset by changing the state file to Closing ->
    Closed -> Initializing. This will trigger a disconnect in the backend
    drivers. Now the frontend drivers will find the backend drivers in state
    Initwait and can connect.

    Signed-off-by: Olaf Hering
    [v2:
    - add timeout when waiting for backend state change
    (based on feedback from Ian Campell)
    - extent printk message to include backend string
    - add comment to fall-through case in xenbus_reset_frontend]
    Signed-off-by: Konrad Rzeszutek Wilk

    Olaf Hering
     
  • During repeated kexec boots xenwatch_thread() can crash because
    xenbus_watch->callback is cleared by xenbus_watch_path() if a node/token
    combo for a new watch happens to match an already registered watch from
    an old kernel. In this case xs_watch returns -EEXISTS, then
    register_xenbus_watch() does not remove the to-be-registered watch from
    the list of active watches but returns the -EEXISTS to the caller
    anyway.

    Because the watch is still active in xenstored it will cause an event
    which will arrive in the new kernel. process_msg() will find the
    encapsulated struct xenbus_watch in its list of registered watches and
    puts the "empty" watch handle in the queue for xenwatch_thread().
    xenwatch_thread() then calls ->callback which was cleared earlier by
    xenbus_watch_path().

    To prevent that crash in a guest running on an old xen toolstack remove
    the special -EEXIST handling.

    v2:
    - remove the EEXIST handing in register_xenbus_watch() instead of
    checking for ->callback in process_msg()

    Signed-off-by: Konrad Rzeszutek Wilk
    Signed-off-by: Olaf Hering

    Olaf Hering
     

27 Jul, 2011

2 commits


01 Jul, 2011

2 commits

  • All the Xen backend drivers are assigned to a special bus type
    xen-backend. This patch exports xen-backend:* names through modalias and
    uevent to autoload them.

    Signed-off-by: Bastian Blank
    Acked-by: Ian Campbell
    Signed-off-by: Konrad Rzeszutek Wilk

    Bastian Blank
     
  • The xenbus bus type uses device_create_file to assign all used device
    attributes. However it does not remove them when the device goes away.

    This patch uses the dev_attrs field of the bus type to specify default
    attributes for all devices.

    Signed-off-by: Bastian Blank
    Acked-by: Ian Campbell
    Signed-off-by: Konrad Rzeszutek Wilk

    Bastian Blank
     

17 Mar, 2011

2 commits

  • Use PM_FREEZE, PM_THAW and PM_RESTORE power events for
    suspend/resume/checkpoint functionality, instead of PM_SUSPEND
    and PM_RESUME. Use of these pm events fixes the Xen Guest hangup
    when taking checkpoints. When a suspend event is cancelled
    (while taking checkpoints once/continuously), we use PM_THAW
    instead of PM_RESUME. PM_RESTORE is used when suspend is not
    cancelled. See Documentation/power/devices.txt and linux/pm.h
    for more info about freeze, thaw and restore. The sequence of
    pm events in a suspend-resume scenario is shown below.

    dpm_suspend_start(PMSG_FREEZE);

    dpm_suspend_noirq(PMSG_FREEZE);

    sysdev_suspend(PMSG_FREEZE);
    cancelled = suspend_hypercall()
    sysdev_resume();

    dpm_resume_noirq(cancelled ? PMSG_THAW : PMSG_RESTORE);

    dpm_resume_end(cancelled ? PMSG_THAW : PMSG_RESTORE);

    Acked-by: Ian Campbell
    Signed-off-by: Shriram Rajagopalan
    Signed-off-by: Konrad Rzeszutek Wilk

    Shriram Rajagopalan
     
  • Make xenbus frontend device subscribe to PM events
    to receive suspend/resume/freeze/thaw/restore
    notifications.

    Signed-off-by: Kenji Wakamiya
    Signed-off-by: Kazuhiro Suzuki
    Signed-off-by: Shriram Rajagopalan
    Acked-by: Ian Campbell
    [shriram--minor mods and improved commit message]
    Signed-off-by: Konrad Rzeszutek Wilk

    Kazuhiro SUZUKI
     

06 Jan, 2011

5 commits