3.14.46-stable review
Greg Kroah-Hartman
maintainercover 3.14.46-stable review
This is the start of the stable review cycle for the 3.14.46 release. There are 17 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon Jun 29 01:08:13 UTC 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.14.46-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.14.46-rc1
Will Deacon <[email protected]>
KVM: vgic: return int instead of bool when checking I/O ranges
Will Deacon <[email protected]>
KVM: ARM/arm64: avoid returning negative error code as bool
Will Deacon <[email protected]>
KVM: ARM/arm64: fix broken __percpu annotation
Will Deacon <[email protected]>
KVM: ARM/arm64: fix non-const declaration of function returning const
Victor Kamensky <[email protected]>
ARM64: KVM: store kvm_vcpu_fault_info est_el2 as word
Li Liu <[email protected]>
ARM: virt: fix wrong HSCTLR.EE bit setting
Alex Bennée <[email protected]>
arm64: KVM: export demux regids as KVM_REG_ARM64
Kim Phillips <[email protected]>
ARM: KVM: user_mem_abort: support stage 2 MMIO page mapping
Eric Auger <[email protected]>
ARM: KVM: Unmap IPA on memslot delete/move
Christoffer Dall <[email protected]>
arm/arm64: KVM: Fix and refactor unmap_range
James Smart <[email protected]>
lpfc: Add iotag memory barrier
Ben Hutchings <[email protected]>
pipe: iovec: Fix memory corruption when retrying atomic copy as non-atomic
Dmitry Tunin <[email protected]>
ath3k: add support of 13d3:3474 AR3012 device
Dmitry Tunin <[email protected]>
ath3k: Add support of 0489:e076 AR3012 device
Adam Jackson <[email protected]>
drm/mgag200: Reject non-character-cell-aligned mode widths
Steven Rostedt <[email protected]>
tracing: Have filter check for balanced ops
Steve Cornelius <[email protected]>
crypto: caam - fix RNG buffer cache alignment
-------------
Diffstat:
Makefile | 4 +- arch/arm/include/asm/kvm_host.h | 2 +- arch/arm/include/asm/kvm_mmu.h | 12 ++ arch/arm/kernel/hyp-stub.S | 4 +- arch/arm/kvm/arm.c | 39 +----- arch/arm/kvm/coproc.c | 2 +- arch/arm/kvm/mmu.c | 213 +++++++++++++++++++++------------ arch/arm64/include/asm/kvm_host.h | 4 +- arch/arm64/include/asm/kvm_mmu.h | 15 +++ arch/arm64/kvm/hyp.S | 2 +- arch/arm64/kvm/sys_regs.c | 4 +- drivers/bluetooth/ath3k.c | 4 + drivers/bluetooth/btusb.c | 2 + drivers/crypto/caam/caamrng.c | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 5 + drivers/scsi/lpfc/lpfc_sli.c | 21 ++++ fs/pipe.c | 55 +++++---- kernel/trace/trace_events_filter.c | 9 +- virt/kvm/arm/vgic.c | 2 +- 19 files changed, 249 insertions(+), 152 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/17 crypto: caam - fix RNG buffer cache alignment
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Cornelius <[email protected]>
commit 412c98c1bef65fe7589f1300e93735d96130307c upstream.
The hwrng output buffers (2) are cast inside of a a struct (caam_rng_ctx) allocated in one DMA-tagged region. While the kernel's heap allocator should place the overall struct on a cacheline aligned boundary, the 2 buffers contained within may not necessarily align. Consenquently, the ends of unaligned buffers may not fully flush, and if so, stale data will be left behind, resulting in small repeating patterns.
This fix aligns the buffers inside the struct.
Note that not all of the data inside caam_rng_ctx necessarily needs to be DMA-tagged, only the buffers themselves require this. However, a fix would incur the expense of error-handling bloat in the case of allocation failure.
--- drivers/crypto/caam/caamrng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/caam/caamrng.c +1 -1
@@ -56,7 +56,7 @@/* Buffer, its dma address and lock */ struct buf_data { -u8 buf[RN_BUF_SIZE ]; +u8 buf[RN_BUF_SIZE ]____cacheline_aligned ;dma_addr_t addr;struct completion filled;u32 hw_desc[DESC_JOB_O_LEN ];
Greg Kroah-Hartman
maintainerPATCH 2/17 tracing: Have filter check for balanced ops
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 2cf30dc180cea808077f003c5116388183e54f9e upstream.
When the following filter is used it causes a warning to trigger:
# cd /sys/kernel/debug/tracing # echo "((dev==1)blocks==2)" > events/ext4/ext4_truncate_exit/filter -bash: echo: write error: Invalid argument # cat events/ext4/ext4_truncate_exit/filter ((dev==1)blocks==2) ^ parse_error: No error
------------[ cut here ]------------ WARNING: CPU: 2 PID: 1223 at kernel/trace/trace_events_filter.c:1640 replace_preds+0x3c5/0x990() Modules linked in: bnep lockd grace bluetooth ... CPU: 3 PID: 1223 Comm: bash Tainted: G W 4.1.0-rc3-test+ #450 Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v02.05 05/07/2012 0000000000000668 ffff8800c106bc98 ffffffff816ed4f9 ffff88011ead0cf0 0000000000000000 ffff8800c106bcd8 ffffffff8107fb07 ffffffff8136b46c ffff8800c7d81d48 ffff8800d4c2bc00 ffff8800d4d4f920 00000000ffffffea Call Trace: [<ffffffff816ed4f9>] dump_stack+0x4c/0x6e [<ffffffff8107fb07>] warn_slowpath_common+0x97/0xe0 [<ffffffff8136b46c>] ? _kstrtoull+0x2c/0x80 [<ffffffff8107fb6a>] warn_slowpath_null+0x1a/0x20 [<ffffffff81159065>] replace_preds+0x3c5/0x990 [<ffffffff811596b2>] create_filter+0x82/0xb0 [<ffffffff81159944>] apply_event_filter+0xd4/0x180 [<ffffffff81152bbf>] event_filter_write+0x8f/0x120 [<ffffffff811db2a8>] __vfs_write+0x28/0xe0 [<ffffffff811dda43>] ? __sb_start_write+0x53/0xf0 [<ffffffff812e51e0>] ? security_file_permission+0x30/0xc0 [<ffffffff811dc408>] vfs_write+0xb8/0x1b0 [<ffffffff811dc72f>] SyS_write+0x4f/0xb0 [<ffffffff816f5217>] system_call_fastpath+0x12/0x6a ---[ end trace e11028bd95818dcd ]---
Worse yet, reading the error message (the filter again) it says that there was no error, when there clearly was. The issue is that the code that checks the input does not check for balanced ops. That is, having an op between a closed parenthesis and the next token.
This would only cause a warning, and fail out before doing any real harm, but it should still not caues a warning, and the error reported should work:
# cd /sys/kernel/debug/tracing # echo "((dev==1)blocks==2)" > events/ext4/ext4_truncate_exit/filter -bash: echo: write error: Invalid argument # cat events/ext4/ext4_truncate_exit/filter ((dev==1)blocks==2) ^ parse_error: Meaningless filter expression
And give no kernel warning.
[ luis: backported to 3.16:
- unconditionally decrement cnt as the OP_NOT logic was introduced only by e12c09cf3087 ("tracing: Add NOT to filtering logic") ]
--- kernel/trace/trace_events_filter.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
kernel/trace/trace_events_filter.c +7 -2
@@ -1399,19 +1399,24 @@ static int check_preds(struct filter_par {int n_normal_preds =0 , n_logical_preds =0 ;struct postfix_elt *elt; +int cnt =0 ;list_for_each_entry (elt, &ps->postfix, list) { -if (elt->op ==OP_NONE ) +if (elt->op ==OP_NONE ) { + cnt++;continue ; + } + cnt--;if (elt->op ==OP_AND || elt->op ==OP_OR ) { n_logical_preds++;continue ; } n_normal_preds++; +WARN_ON_ONCE (cnt <0 ); } -if (!n_normal_preds || n_logical_preds >= n_normal_preds) { +if (cnt !=1 || !n_normal_preds || n_logical_preds >= n_normal_preds) {parse_error (ps,FILT_ERR_INVALID_FILTER ,0 );return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 3/17 drm/mgag200: Reject non-character-cell-aligned mode widths
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Jackson <[email protected]>
commit 25161084b1c1b0c29948f6f77266a35f302196b7 upstream.
Turns out 1366x768 does not in fact work on this hardware.
--- drivers/gpu/drm/mgag200/mgag200_mode.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/mgag200/mgag200_mode.c +5 -0
@@ -1529,6 +1529,11 @@ static int mga_vga_mode_valid(struct drmreturn MODE_BANDWIDTH ; } +if ((mode->hdisplay %8 ) !=0 || (mode->hsync_start %8 ) !=0 || + (mode->hsync_end %8 ) !=0 || (mode->htotal %8 ) !=0 ) { +return MODE_H_ILLEGAL ; + } + if (mode->crtc_hdisplay > 2048 || mode->crtc_hsync_start > 4096 || mode->crtc_hsync_end > 4096 || mode->crtc_htotal > 4096 || mode->crtc_vdisplay > 2048 || mode->crtc_vsync_start > 4096 ||
Greg Kroah-Hartman
maintainerPATCH 4/17 ath3k: Add support of 0489:e076 AR3012 device
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Tunin <[email protected]>
commit 692c062e7c282164fd7cda68077f79dafd176eaf upstream.
This device requires new firmware files
AthrBT_0x11020100.dfu and ramps_0x11020100_40.dfu added to/lib/firmware/ar3k/ that are not included in linux-firmware yet.
T: Bus=03 Lev=01 Prnt=01 Port=09 Cnt=06 Dev#= 7 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0489 ProdID=e076 Rev= 0.01
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -79,6 +79,7 @@ static const struct usb_device_id ath3k_ { USB_DEVICE(0x0489, 0xe057) }, { USB_DEVICE(0x0489, 0xe056) }, { USB_DEVICE(0x0489, 0xe05f) }, + { USB_DEVICE(0x0489, 0xe076) }, { USB_DEVICE(0x0489, 0xe078) }, { USB_DEVICE(0x04c5, 0x1330) }, { USB_DEVICE(0x04CA, 0x3004) },
@@ -133,6 +134,7 @@ static const struct usb_device_id ath3k_ { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe05f), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0489, 0xe076), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe078), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c +1 -0
@@ -157,6 +157,7 @@ static const struct usb_device_id blackl { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe05f), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0489, 0xe076), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe078), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
Greg Kroah-Hartman
maintainerPATCH 5/17 ath3k: add support of 13d3:3474 AR3012 device
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Tunin <[email protected]>
commit 0d0cef6183aec0fb6d0c9f00a09ff51ee086bbe2 upstream.
This device requires new firmware files
AthrBT_0x11020100.dfu and ramps_0x11020100_40.dfu added to/lib/firmware/ar3k/ that are not included in linux-firmware yet.
T: Bus=01 Lev=01 Prnt=01 Port=04 Cnt=01 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=13d3 ProdID=3474 Rev=00.01
C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -110,6 +110,7 @@ static const struct usb_device_id ath3k_ { USB_DEVICE(0x13d3, 0x3402) }, { USB_DEVICE(0x13d3, 0x3408) }, { USB_DEVICE(0x13d3, 0x3432) }, + { USB_DEVICE(0x13d3, 0x3474) },/* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) },
@@ -165,6 +166,7 @@ static const struct usb_device_id ath3k_ { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3474), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE036), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c +1 -0
@@ -188,6 +188,7 @@ static const struct usb_device_id blackl { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3474), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
Greg Kroah-Hartman
maintainerPATCH 6/17 pipe: iovec: Fix memory corruption when retrying atomic copy as non-atomic
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
pipe_iov_copy_{from,to}_user() may be tried twice with the same iovec, the first time atomically and the second time not. The second attempt needs to continue from the iovec position, pipe buffer offset and remaining length where the first attempt failed, but currently the pipe buffer offset and remaining length are reset. This will corrupt the piped data (possibly also leading to an information leak between processes) and may also corrupt kernel memory.
This was fixed upstream by commits f0d1bec9d58d ("new helper:copy_page_from_iter()") and 637b58c2887e ("switch pipe_read() to copy_page_to_iter()"), but those aren't suitable for stable. This fix for older kernel versions was made by Seth Jennings for RHEL and I have extracted it from their update.
CVE-2015-1805
References: https://bugzilla.redhat.com/show_bug.cgi?id=1202855
--- fs/pipe.c | 55 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 23 deletions(-)
fs/pipe.c +32 -23
@@ -117,25 +117,27 @@ void pipe_wait(struct pipe_inode_info *p }static int -pipe_iov_copy_from_user (void *to,struct iovec *iov,unsigned long len, -int atomic) +pipe_iov_copy_from_user (void *addr,int *offset,struct iovec *iov, +size_t *remaining,int atomic) {unsigned long copy; -while (len >0 ) { +while (*remaining >0 ) {while (!iov->iov_len) iov++; - copy = min_t(unsigned long, len, iov->iov_len); + copy = min_t(unsigned long, *remaining, iov->iov_len);if (atomic) { -if (__copy_from_user_inatomic (to, iov->iov_base, copy)) +if (__copy_from_user_inatomic (addr + *offset, + iov->iov_base, copy))return -EFAULT ; }else { -if (copy_from_user (to, iov->iov_base, copy)) +if (copy_from_user (addr + *offset, + iov->iov_base, copy))return -EFAULT ; } - to += copy; - len -= copy; + *offset += copy; + *remaining -= copy; iov->iov_base += copy; iov->iov_len -= copy; }
@@ -143,25 +145,27 @@ pipe_iov_copy_from_user(void *to, struct }static int -pipe_iov_copy_to_user (struct iovec *iov,const void *from,unsigned long len, -int atomic) +pipe_iov_copy_to_user (struct iovec *iov,void *addr,int *offset, +size_t *remaining,int atomic) {unsigned long copy; -while (len >0 ) { +while (*remaining >0 ) {while (!iov->iov_len) iov++; - copy = min_t(unsigned long, len, iov->iov_len); + copy = min_t(unsigned long, *remaining, iov->iov_len);if (atomic) { -if (__copy_to_user_inatomic (iov->iov_base, from, copy)) +if (__copy_to_user_inatomic (iov->iov_base, + addr + *offset, copy))return -EFAULT ; }else { -if (copy_to_user (iov->iov_base, from, copy)) +if (copy_to_user (iov->iov_base, + addr + *offset, copy))return -EFAULT ; } - from += copy; - len -= copy; + *offset += copy; + *remaining -= copy; iov->iov_base += copy; iov->iov_len -= copy; }
@@ -395,7 +399,7 @@ pipe_read(struct kiocb *iocb, const strustruct pipe_buffer *buf = pipe->bufs + curbuf;const struct pipe_buf_operations *ops = buf->ops;void *addr; -size_t chars = buf->len; +size_t chars = buf->len, remaining;int error, atomic;if (chars > total_len)
@@ -409,9 +413,11 @@ pipe_read(struct kiocb *iocb, const stru } atomic = !iov_fault_in_pages_write (iov, chars); + remaining = chars; redo: addr = ops->map (pipe, buf, atomic); - error =pipe_iov_copy_to_user (iov, addr + buf->offset, chars, atomic); + error =pipe_iov_copy_to_user (iov, addr, &buf->offset, + &remaining, atomic); ops->unmap (pipe, buf, addr);if (unlikely (error)) {/*
@@ -426,7 +432,6 @@ redo:break ; } ret += chars; - buf->offset += chars; buf->len -= chars;/* Was it a packet buffer? Clean up and exit */
@@ -531,6 +536,7 @@ pipe_write(struct kiocb *iocb, const strif (ops->can_merge && offset + chars <=PAGE_SIZE ) {int error, atomic =1 ;void *addr; +size_t remaining = chars; error = ops->confirm (pipe, buf);if (error)
@@ -539,8 +545,8 @@ pipe_write(struct kiocb *iocb, const striov_fault_in_pages_read (iov, chars); redo1: addr = ops->map (pipe, buf, atomic); - error =pipe_iov_copy_from_user (offset + addr, iov, - chars, atomic); + error =pipe_iov_copy_from_user (addr, &offset, iov, + &remaining, atomic); ops->unmap (pipe, buf, addr); ret = error; do_wakeup =1 ;
@@ -575,6 +581,8 @@ redo1:struct page *page = pipe->tmp_page;char *src;int error, atomic =1 ; +int offset =0 ; +size_t remaining;if (!page) { page =alloc_page (GFP_HIGHUSER );
@@ -595,14 +603,15 @@ redo1: chars = total_len;iov_fault_in_pages_read (iov, chars); + remaining = chars; redo2:if (atomic) src =kmap_atomic (page);else src =kmap (page); - error =pipe_iov_copy_from_user (src, iov, chars, - atomic); + error =pipe_iov_copy_from_user (src, &offset, iov, + &remaining, atomic);if (atomic)kunmap_atomic (src);else
Greg Kroah-Hartman
maintainerPATCH 7/17 lpfc: Add iotag memory barrier
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Smart <[email protected]>
commit 27f344eb15dd0da80ebec80c7245e8c85043f841 upstream.
Add a memory barrier to ensure the valid bit is read before any of the cqe payload is read. This fixes an issue seen on Power where the cqe payload was getting loaded before the valid bit. When this occurred, we saw an iotag out of range error when a command completed, but since the iotag looked invalid the command didn't get completed to scsi core. Later we hit the command timeout, attempted to abort the command, then waited for the aborted command to get returned. Since the adapter already returned the command, we timeout waiting, and end up escalating EEH all the way to host reset. This patch fixes this issue.
--- drivers/scsi/lpfc/lpfc_sli.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/scsi/lpfc/lpfc_sli.c +21 -0
@@ -265,6 +265,16 @@ lpfc_sli4_eq_get(struct lpfc_queue *q)return NULL ; q->hba_index = idx; + +/* +* insert barrier for instruction interlock : data from the hardware +* must have the valid bit checked before it can be copied and acted +* upon. Given what was seen in lpfc_sli4_cq_get() of speculative +* instructions allowing action on content before valid bit checked, +* add barrier here as well. May not be needed as "content" is a +* single 32-bit entity here (vs multi word structure for cq's). +*/ +mb ();return eqe; }
@@ -370,6 +380,17 @@ lpfc_sli4_cq_get(struct lpfc_queue *q) cqe = q->qe[q->hba_index].cqe; q->hba_index = idx; + +/* +* insert barrier for instruction interlock : data from the hardware +* must have the valid bit checked before it can be copied and acted +* upon. Speculative instructions were allowing a bcopy at the start +* of lpfc_sli4_fp_handle_wcqe(), which is called immediately +* after our return, to copy data before the valid bit check above +* was done. As such, some of the copied data was stale. The barrier +* ensures the check is before any data is copied. +*/ +mb ();return cqe; }
Greg Kroah-Hartman
maintainerPATCH 8/17 arm/arm64: KVM: Fix and refactor unmap_range
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoffer Dall <[email protected]>
commit 4f853a714bf16338ff5261128e6c7ae2569e9505 upstream.
unmap_range() was utterly broken, to quote Marc, and broke in all sorts of situations. It was also quite complicated to follow and didn't follow the usual scheme of having a separate iterating function for each level of page tables.
Address this by refactoring the code and introduce a pgd_clear() function.
--- arch/arm/include/asm/kvm_mmu.h | 12 +++ arch/arm/kvm/mmu.c | 156 +++++++++++++++++++++------------------ arch/arm64/include/asm/kvm_mmu.h | 15 +++ 3 files changed, 111 insertions(+), 72 deletions(-)
arch/arm/include/asm/kvm_mmu.h +12 -0
@@ -127,6 +127,18 @@ static inline void kvm_set_s2pmd_writabl (__boundary -1 < (end) -1 )? __boundary: (end); \ }) +static inline bool kvm_page_empty (void *ptr) +{ +struct page *ptr_page =virt_to_page (ptr); +return page_count (ptr_page) ==1 ; +} + + +#define kvm_pte_table_empty (ptep) kvm_page_empty(ptep) +#define kvm_pmd_table_empty (pmdp) kvm_page_empty(pmdp) +#define kvm_pud_table_empty (pudp) (0) + +struct kvm ;#define kvm_flush_dcache_to_poc (a,l) __cpuc_flush_dcache_area((a), (l))
arch/arm/kvm/mmu.c +84 -72
187 lines not on this page · raw message
arch/arm64/include/asm/kvm_mmu.h +15 -0
@@ -125,6 +125,21 @@ static inline void kvm_set_s2pmd_writabl#define kvm_pud_addr_end (addr, end) pud_addr_end(addr, end)#define kvm_pmd_addr_end (addr, end) pmd_addr_end(addr, end) +static inline bool kvm_page_empty (void *ptr) +{ +struct page *ptr_page =virt_to_page (ptr); +return page_count (ptr_page) ==1 ; +} + +#define kvm_pte_table_empty (ptep) kvm_page_empty(ptep) +#ifndef CONFIG_ARM64_64K_PAGES +#define kvm_pmd_table_empty (pmdp) kvm_page_empty(pmdp) +#else +#define kvm_pmd_table_empty (pmdp) (0) +#endif +#define kvm_pud_table_empty (pudp) (0) + +struct kvm ;#define kvm_flush_dcache_to_poc (a,l) __flush_dcache_area((a), (l))
Greg Kroah-Hartman
maintainerPATCH 9/17 ARM: KVM: Unmap IPA on memslot delete/move
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Auger <[email protected]>
commit df6ce24f2ee485c4f9a5cb610063a5eb60da8267 upstream.
Currently when a KVM region is deleted or moved after KVM_SET_USER_MEMORY_REGION ioctl, the corresponding intermediate physical memory is not unmapped.
This patch corrects this and unmaps the region's IPA range in kvm_arch_commit_memory_region using unmap_stage2_range.
--- arch/arm/kvm/arm.c | 37 ------------------------------------- arch/arm/kvm/mmu.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 37 deletions(-)
arch/arm/kvm/arm.c +0 -37
@@ -155,16 +155,6 @@ int kvm_arch_vcpu_fault(struct kvm_vcpureturn VM_FAULT_SIGBUS ; } -void kvm_arch_free_memslot (struct kvm *kvm,struct kvm_memory_slot *free, -struct kvm_memory_slot *dont) -{ -} - -int kvm_arch_create_memslot (struct kvm *kvm,struct kvm_memory_slot *slot, -unsigned long npages) -{ -return 0 ; -}/** * kvm_arch_destroy_vm - destroy the VM data structure
@@ -224,33 +214,6 @@ long kvm_arch_dev_ioctl(struct file *filreturn -EINVAL ; } -void kvm_arch_memslots_updated (struct kvm *kvm) -{ -} - -int kvm_arch_prepare_memory_region (struct kvm *kvm, -struct kvm_memory_slot *memslot, -struct kvm_userspace_memory_region *mem, -enum kvm_mr_change change) -{ -return 0 ; -} - -void kvm_arch_commit_memory_region (struct kvm *kvm, -struct kvm_userspace_memory_region *mem, -const struct kvm_memory_slot *old, -enum kvm_mr_change change) -{ -} - -void kvm_arch_flush_shadow_all (struct kvm *kvm) -{ -} - -void kvm_arch_flush_shadow_memslot (struct kvm *kvm, -struct kvm_memory_slot *slot) -{ -}struct kvm_vcpu *kvm_arch_vcpu_create (struct kvm *kvm,unsigned int id) {
arch/arm/kvm/mmu.c +46 -0
49 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 10/17 ARM: KVM: user_mem_abort: support stage 2 MMIO page mapping
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kim Phillips <[email protected]>
commit b88657674d39fc2127d62d0de9ca142e166443c8 upstream.
A userspace process can map device MMIO memory via VFIO or /dev/mem, e.g., for platform device passthrough support in QEMU.
During early development, we found the PAGE_S2 memory type being used for MMIO mappings. This patch corrects that by using the more strongly ordered memory type for device MMIO mappings: PAGE_S2_DEVICE.
--- arch/arm/kvm/mmu.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/arm/kvm/mmu.c +8 -3
@@ -759,6 +759,7 @@ static int user_mem_abort(struct kvm_vcpstruct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache;struct vm_area_struct *vma;pfn_t pfn; +pgprot_t mem_type =PAGE_S2 ; write_fault =kvm_is_write_fault (kvm_vcpu_get_hsr (vcpu));if (fault_status ==FSC_PERM && !write_fault) {
@@ -809,6 +810,9 @@ static int user_mem_abort(struct kvm_vcpif (is_error_pfn (pfn))return -EFAULT ; +if (kvm_is_mmio_pfn (pfn)) + mem_type =PAGE_S2_DEVICE ; +spin_lock (&kvm->mmu_lock);if (mmu_notifier_retry (kvm, mmu_seq)) goto out_unlock;
@@ -816,7 +820,7 @@ static int user_mem_abort(struct kvm_vcp hugetlb =transparent_hugepage_adjust (&pfn, &fault_ipa);if (hugetlb) { -pmd_t new_pmd =pfn_pmd (pfn,PAGE_S2 ); +pmd_t new_pmd =pfn_pmd (pfn, mem_type); new_pmd =pmd_mkhuge (new_pmd);if (writable) {kvm_set_s2pmd_writable (&new_pmd);
@@ -825,13 +829,14 @@ static int user_mem_abort(struct kvm_vcpcoherent_cache_guest_page (vcpu, hva &PMD_MASK ,PMD_SIZE ); ret =stage2_set_pmd_huge (kvm, memcache, fault_ipa, &new_pmd); }else { -pte_t new_pte =pfn_pte (pfn,PAGE_S2 ); +pte_t new_pte =pfn_pte (pfn, mem_type);if (writable) {kvm_set_s2pte_writable (&new_pte);kvm_set_pfn_dirty (pfn); }coherent_cache_guest_page (vcpu, hva,PAGE_SIZE ); - ret =stage2_set_pte (kvm, memcache, fault_ipa, &new_pte, false); + ret =stage2_set_pte (kvm, memcache, fault_ipa, &new_pte, + mem_type ==PAGE_S2_DEVICE ); }
Greg Kroah-Hartman
maintainerPATCH 12/17 ARM: virt: fix wrong HSCTLR.EE bit setting
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Liu <[email protected]>
commit af92394efc8be73edd2301fc15f9b57fd430cd18 upstream.
HSCTLR.EE is defined as bit[25] referring to arm manual DDI0606C.b(p1590).
--- arch/arm/kernel/hyp-stub.S | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm/kernel/hyp-stub.S +1 -3
@@ -134,9 +134,7 @@ ENTRY(__hyp_stub_install_secondary) mcr p15, 4, r7, c1, c1, 3 @ HSTR THUMB( orr r7, #(1 << 30) ) @ HSCTLR.TE -#ifdef CONFIG_CPU_BIG_ENDIAN - orr r7, #(1 << 9) @ HSCTLR.EE -#endif +ARM_BE8(orr r7, r7, #(1 << 25)) @ HSCTLR.EE mcr p15, 4, r7, c1, c0, 0 @ HSCTLR mrc p15, 4, r7, c1, c1, 1 @ HDCR
Greg Kroah-Hartman
maintainerPATCH 13/17 ARM64: KVM: store kvm_vcpu_fault_info est_el2 as word
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Kamensky <[email protected]>
commit ba083d20d8cfa9e999043cd89c4ebc964ccf8927 upstream.
esr_el2 field of struct kvm_vcpu_fault_info has u32 type. It should be stored as word. Current code works in LE case because existing puts least significant word of x1 into esr_el2, and it puts most significant work of x1 into next field, which accidentally is OK because it is updated again by next instruction. But existing code breaks in BE case.
--- arch/arm64/kvm/hyp.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/hyp.S +1 -1
@@ -830,7 +830,7 @@ el1_trap: mrs x2, far_el2 2: mrs x0, tpidr_el2 - str x1, [x0, #VCPU_ESR_EL2] + str w1, [x0, #VCPU_ESR_EL2] str x2, [x0, #VCPU_FAR_EL2] str x3, [x0, #VCPU_HPFAR_EL2]
Greg Kroah-Hartman
maintainerPATCH 14/17 KVM: ARM/arm64: fix non-const declaration of function returning const
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 6951e48bff0b55d2a8e825a953fc1f8e3a34bf1c upstream.
Sparse kicks up about a type mismatch for kvm_target_cpu:
arch/arm64/kvm/guest.c:271:25: error: symbol 'kvm_target_cpu' redeclared with different type (originally declared at ./arch/arm64/include/asm/kvm_host.h:45) - different modifiers
so fix this by adding the missing const attribute to the function declaration.
--- arch/arm/include/asm/kvm_host.h | 2 +- arch/arm64/include/asm/kvm_host.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/kvm_host.h +1 -1
@@ -42,7 +42,7 @@struct kvm_vcpu ;u32 *kvm_vcpu_reg (struct kvm_vcpu *vcpu,u8 reg_num,u32 mode); -int kvm_target_cpu (void ); +int __attribute_const__ kvm_target_cpu(void);int kvm_reset_vcpu (struct kvm_vcpu *vcpu);void kvm_reset_coprocs (struct kvm_vcpu *vcpu);
arch/arm64/include/asm/kvm_host.h +1 -1
@@ -42,7 +42,7 @@#define KVM_VCPU_MAX_FEATURES 2struct kvm_vcpu ; -int kvm_target_cpu (void ); +int __attribute_const__ kvm_target_cpu(void);int kvm_reset_vcpu (struct kvm_vcpu *vcpu);int kvm_arch_dev_ioctl_check_extension (long ext);
Greg Kroah-Hartman
maintainerPATCH 15/17 KVM: ARM/arm64: fix broken __percpu annotation
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 4000be423cb01a8d09de878bb8184511c49d4238 upstream.
Running sparse results in a bunch of noisy address space mismatches thanks to the broken __percpu annotation on kvm_get_running_vcpus.
This function returns a pcpu pointer to a pointer, not a pointer to a pcpu pointer. This patch fixes the annotation, which kills the warnings from sparse.
--- arch/arm/kvm/arm.c | 2 +- arch/arm64/include/asm/kvm_host.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/kvm/arm.c +1 -1
@@ -82,7 +82,7 @@ struct kvm_vcpu *kvm_arm_get_running_vcp/** * kvm_arm_get_running_vcpus - get the per-CPU array of currently running vcpus. */ -struct kvm_vcpu __percpu **kvm_get_running_vcpus (void ) +struct kvm_vcpu *__percpu *kvm_get_running_vcpus (void ) {return &kvm_arm_running_vcpu; }
arch/arm64/include/asm/kvm_host.h +1 -1
@@ -177,7 +177,7 @@ static inline int kvm_test_age_hva(struc }struct kvm_vcpu *kvm_arm_get_running_vcpu (void ); -struct kvm_vcpu __percpu **kvm_get_running_vcpus (void ); +struct kvm_vcpu *__percpu *kvm_get_running_vcpus (void );u64 kvm_call_hyp (void *hypfn, ...);
Greg Kroah-Hartman
maintainerPATCH 16/17 KVM: ARM/arm64: avoid returning negative error code as bool
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 18d457661fb9fa69352822ab98d39331c3d0e571 upstream.
is_valid_cache returns true if the specified cache is valid. Unfortunately, if the parameter passed it out of range, we return -ENOENT, which ends up as true leading to potential hilarity.
This patch returns false on the failure path instead.
--- arch/arm/kvm/coproc.c | 2 +- arch/arm64/kvm/sys_regs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/kvm/coproc.c +1 -1
@@ -742,7 +742,7 @@ static bool is_valid_cache(u32 val)u32 level, ctype;if (val >=CSSELR_MAX ) -return -ENOENT ; +return false;/* Bottom bit is Instruction or Data bit. Next 3 bits are level. */ level = (val >>1 );
arch/arm64/kvm/sys_regs.c +1 -1
@@ -836,7 +836,7 @@ static bool is_valid_cache(u32 val)u32 level, ctype;if (val >=CSSELR_MAX ) -return -ENOENT ; +return false;/* Bottom bit is Instruction or Data bit. Next 3 bits are level. */ level = (val >>1 );
Greg Kroah-Hartman
maintainerPATCH 17/17 KVM: vgic: return int instead of bool when checking I/O ranges
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 1fa451bcc67fa921a04c5fac8dbcde7844d54512 upstream.
vgic_ioaddr_overlap claims to return a bool, but in reality it returns an int. Shut sparse up by fixing the type signature.
--- virt/kvm/arm/vgic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/arm/vgic.c +1 -1
@@ -1654,7 +1654,7 @@ out:return ret; } -static bool vgic_ioaddr_overlap (struct kvm *kvm) +static int vgic_ioaddr_overlap (struct kvm *kvm) {phys_addr_t dist = kvm->arch.vgic.vgic_dist_base;phys_addr_t cpu = kvm->arch.vgic.vgic_cpu_base;
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.46 release. There are 17 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon Jun 29 01:08:13 UTC 2015. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.14.46-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.46 release. There are 17 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon Jun 29 01:08:13 UTC 2015. Anything received after that time might be too late.
Build results:
total: 120 pass: 120 fail: 0 Qemu test results: total: 27 pass: 27 fail: 0
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.46 release. There are 17 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon Jun 29 01:08:13 UTC 2015. Anything received after that time might be too late.
Compiled and booted on x86_32. No errors in dmesg.
regards
sudip