1
0
Fork 0
remarkable-linux/drivers
Joao Martins 0f0fd00739 xenbus: track caller request id
commit 29fee6eed2 upstream.

Commit fd8aa9095a ("xen: optimize xenbus driver for multiple concurrent
xenstore accesses") optimized xenbus concurrent accesses but in doing so
broke UABI of /dev/xen/xenbus. Through /dev/xen/xenbus applications are in
charge of xenbus message exchange with the correct header and body. Now,
after the mentioned commit the replies received by application will no
longer have the header req_id echoed back as it was on request (see
specification below for reference), because that particular field is being
overwritten by kernel.

struct xsd_sockmsg
{
  uint32_t type;  /* XS_??? */
  uint32_t req_id;/* Request identifier, echoed in daemon's response.  */
  uint32_t tx_id; /* Transaction id (0 if not related to a transaction). */
  uint32_t len;   /* Length of data following this. */

  /* Generally followed by nul-terminated string(s). */
};

Before there was only one request at a time so req_id could simply be
forwarded back and forth. To allow simultaneous requests we need a
different req_id for each message thus kernel keeps a monotonic increasing
counter for this field and is written on every request irrespective of
userspace value.

Forwarding again the req_id on userspace requests is not a solution because
we would open the possibility of userspace-generated req_id colliding with
kernel ones. So this patch instead takes another route which is to
artificially keep user req_id while keeping the xenbus logic as is. We do
that by saving the original req_id before xs_send(), use the private kernel
counter as req_id and then once reply comes and was validated, we restore
back the original req_id.

Cc: <stable@vger.kernel.org> # 4.11
Fixes: fd8aa9095a ("xen: optimize xenbus driver for multiple concurrent xenstore accesses")
Reported-by: Bhavesh Davda <bhavesh.davda@oracle.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:42:28 +01:00
..
accessibility License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acpi acpi, nfit: fix register dimm error handling 2018-02-16 20:23:10 +01:00
amba License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
android android: binder: use VM_ALLOC to get vm area 2018-02-03 17:39:22 +01:00
ata ahci: Add Intel Cannon Lake PCH-H PCI ID 2018-02-16 20:22:59 +01:00
atm atm: horizon: Fix irq release error 2017-12-14 09:53:13 +01:00
auxdisplay auxdisplay: img-ascii-lcd: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE 2018-02-07 11:12:20 -08:00
base PM / runtime: Update links_count also if !CONFIG_SRCU 2018-02-22 15:42:20 +01:00
bcma License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
block rbd: whitelist RBD_FEATURE_OPERATIONS feature bit 2018-02-22 15:42:28 +01:00
bluetooth Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version 2018-02-16 20:23:06 +01:00
bus sunxi-rsb: Include OF based modalias in device uevent 2018-01-10 09:31:19 +01:00
cdrom License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
char x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
clk clk: sunxi: sun9i-mmc: Implement reset callback for reset controls 2017-12-29 17:53:48 +01:00
clocksource clocksource/drivers/stm32: Fix kernel panic with multiple timers 2018-02-16 20:23:09 +01:00
connector
cpufreq x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
cpuidle cpuidle: fix broadcast control when broadcast can not be entered 2017-12-25 14:26:30 +01:00
crypto x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
dax dev/dax: fix uninitialized variable build warning 2017-12-20 10:10:34 +01:00
dca
devfreq PM / devfreq: Propagate error from devfreq_add_device() 2018-02-22 15:42:16 +01:00
dio License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dma dmaengine: dmatest: fix container_of member in dmatest_callback 2018-02-16 20:22:43 +01:00
dma-buf dma-buf: fix reservation_object_wait_timeout_rcu once more v2 2018-02-22 15:42:17 +01:00
edac x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
eisa License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
extcon License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
firewire License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
firmware firmware/psci: Expose SMCCC version through psci_ops 2018-02-16 20:22:56 +01:00
fmc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fpga fpga: region: release of_parse_phandle nodes after use 2018-02-07 11:12:26 -08:00
fsi drivers/fsi/scom: Remove reset before every putscom 2017-08-28 17:15:16 +02:00
gpio gpio: ath79: add missing MODULE_DESCRIPTION/LICENSE 2018-02-03 17:38:52 +01:00
gpu drm/radeon: adjust tested variable 2018-02-22 15:42:25 +01:00
hid HID: quirks: Fix keyboard + touchpad on Toshiba Click Mini not working 2018-02-16 20:23:06 +01:00
hsi License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv x86/virt: Add enum for hypervisors to replace x86_hyper 2017-12-25 14:26:20 +01:00
hwmon x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
hwspinlock License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hwtracing License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
i2c i2c: i2c-boardinfo: fix memory leaks on devinfo 2018-02-03 17:39:07 +01:00
ide ide: ide-atapi: fix compile error with defining macro DEBUG 2017-12-17 15:08:00 +01:00
idle Revert "x86/mm: Stop calling leave_mm() in idle code" 2017-11-04 15:01:50 +01:00
iio iio: adc/accel: Fix up module licenses 2018-02-07 11:12:20 -08:00
infiniband RDMA/rxe: Fix rxe_qp_cleanup() 2018-02-22 15:42:15 +01:00
input Input: synaptics-rmi4 - do not delete interrupt memory too early 2018-02-03 17:39:24 +01:00
iommu iommu/arm-smmu-v3: Cope with duplicated Stream IDs 2018-01-10 09:31:21 +01:00
ipack
irqchip irqchip/qcom: Fix u32 comparison with value less than zero 2017-12-14 09:53:05 +01:00
isdn License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
leds leds: pca955x: Don't invert requested value in pca955x_gpio_set_value() 2017-12-25 14:26:27 +01:00
lightnvm lightnvm: pblk: protect line bitmap while submitting meta io 2017-12-20 10:10:38 +01:00
macintosh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mailbox mailbox: mailbox-test: don't rely on rx_buffer content to signal data ready 2017-12-14 09:53:12 +01:00
mcb License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
md bcache: check return value of register_shrinker 2018-02-03 17:39:01 +01:00
media media: cxusb, dib0700: ignore XC2028_I2C_FLUSH 2018-02-16 20:23:05 +01:00
memory License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
memstick License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
message License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mfd mfd: twl6040: Fix child-node lookup 2017-12-29 17:53:46 +01:00
misc kmemcheck: remove annotations 2018-02-22 15:42:23 +01:00
mmc Revert "mmc: meson-gx: include tx phase in the tuning process" 2018-02-22 15:42:26 +01:00
mtd ubi: block: Fix locking for idr_alloc/idr_remove 2018-02-16 20:22:57 +01:00
mux mux: core: fix double get_device() 2018-01-17 09:45:27 +01:00
net mwifiex: resolve reset vs. remove()/shutdown() deadlocks 2018-02-22 15:42:16 +01:00
nfc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ntb
nubus License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nvdimm libnvdimm, pfn: fix start_pad handling for aligned namespaces 2017-12-29 17:53:49 +01:00
nvme nvme-pci: fix NULL pointer dereference in nvme_free_host_mem() 2018-02-03 17:39:10 +01:00
nvmem License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
of .gitignore: move *.dtb and *.dtb.S patterns to the top-level .gitignore 2018-02-13 10:19:46 +01:00
oprofile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
parisc parisc: Hide Diva-built-in serial aux and graphics card 2017-12-29 17:53:47 +01:00
parport License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci PCI: keystone: Fix interrupt-controller-node lookup 2018-02-22 15:42:27 +01:00
pcmcia License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
phy phy: work around 'phys' references to usb-nop-xceiv devices 2018-01-23 19:58:16 +01:00
pinctrl pinctrl: sx150x: Add a static gpio/pinctrl pin range mapping 2018-02-16 20:23:08 +01:00
platform Revert "apple-gmux: lock iGP IO to protect from vgaarb changes" 2018-02-22 15:42:26 +01:00
pnp License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
power power: reset: zx-reboot: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE 2018-02-03 17:38:51 +01:00
powercap
pps drivers/pps: use surrounding "if PPS" to remove numerous dependency checks 2017-09-08 18:26:51 -07:00
ps3
ptp License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pwm License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rapidio drivers/rapidio/devices/rio_mport_cdev.c: fix resource leak in error handling path in 'rio_dma_transfer()' 2017-12-14 09:53:08 +01:00
ras License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
regulator License cleanup: add SPDX license identifiers to some files 2017-11-02 10:04:46 -07:00
remoteproc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
reset License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rpmsg rpmsg: glink: Initialize the "intent_req_comp" completion variable 2017-12-20 10:10:29 +01:00
rtc rtc-opal: Fix handling of firmware error codes, prevent busy loops 2018-02-22 15:42:25 +01:00
s390 s390/zcrypt: Fix wrong comparison leading to strange load balancing 2018-02-03 17:38:59 +01:00
sbus License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
scsi scsi: smartpqi: allow static build ("built-in") 2018-02-22 15:42:14 +01:00
sfi
sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sn
soc soc: mediatek: pwrap: fix compiler errors 2017-12-20 10:10:34 +01:00
spi spi: imx: do not access registers while clocks disabled 2018-02-03 17:39:23 +01:00
spmi spmi: pmic-arb: Move the ownership check to irq_chip callback 2017-08-28 13:52:22 +02:00
ssb License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
staging crypto: hash - annotate algorithms taking optional key 2018-02-16 20:23:00 +01:00
target block: fix blk_rq_append_bio 2018-01-02 20:31:05 +01:00
tc
tee optee: fix invalid of_node_put() in optee_driver_init() 2017-12-25 14:26:24 +01:00
thermal thermal/drivers/hisi: Fix multiple alarm interrupts firing 2017-12-25 14:26:31 +01:00
thunderbolt thunderbolt: tb: fix use after free in tb_activate_pcie_devices 2017-12-20 10:10:24 +01:00
tty serial: core: mark port as initialized after successful IRQ change 2018-02-07 11:12:26 -08:00
uio License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
usb usb/gadget: Fix "high bandwidth" check in usb_gadget_ep_match_desc() 2018-02-03 17:39:21 +01:00
uwb License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vfio vfio/pci: Virtualize Maximum Payload Size 2017-12-25 14:26:29 +01:00
vhost vhost_net: stop device during reset owner 2018-02-13 10:19:47 +01:00
video console/dummy: leave .con_font_get set to NULL 2018-02-22 15:42:28 +01:00
virt virt: Convert to using %pOF instead of full_name 2017-08-29 08:52:51 -05:00
virtio virtio: release virtio index when fail to device_register 2017-12-14 09:52:48 +01:00
vlynq
vme License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
w1 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
watchdog watchdog: imx2_wdt: restore previous timeout after suspend+resume 2018-02-16 20:23:04 +01:00
xen xenbus: track caller request id 2018-02-22 15:42:28 +01:00
zorro License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00