From: Greg Kroah-Hartman Date: Wed, 30 May 2018 08:40:04 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v4.14.46~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1be426c6566e51d17b8db21f5f43eeab1245e8d;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: arm64-lse-add-early-clobbers-to-some-input-output-asm-operands.patch powerpc-64s-clear-pcr-on-boot.patch usb-serial-cp210x-use-tcflag_t-to-fix-incompatible-pointer-type.patch --- diff --git a/queue-4.9/arm64-lse-add-early-clobbers-to-some-input-output-asm-operands.patch b/queue-4.9/arm64-lse-add-early-clobbers-to-some-input-output-asm-operands.patch new file mode 100644 index 00000000000..6dcf7835be0 --- /dev/null +++ b/queue-4.9/arm64-lse-add-early-clobbers-to-some-input-output-asm-operands.patch @@ -0,0 +1,139 @@ +From 32c3fa7cdf0c4a3eb8405fc3e13398de019e828b Mon Sep 17 00:00:00 2001 +From: Will Deacon +Date: Mon, 21 May 2018 17:44:57 +0100 +Subject: arm64: lse: Add early clobbers to some input/output asm operands + +From: Will Deacon + +commit 32c3fa7cdf0c4a3eb8405fc3e13398de019e828b upstream. + +For LSE atomics that read and write a register operand, we need to +ensure that these operands are annotated as "early clobber" if the +register is written before all of the input operands have been consumed. +Failure to do so can result in the compiler allocating the same register +to both operands, leading to splats such as: + + Unable to handle kernel paging request at virtual address 11111122222221 + [...] + x1 : 1111111122222222 x0 : 1111111122222221 + Process swapper/0 (pid: 1, stack limit = 0x000000008209f908) + Call trace: + test_atomic64+0x1360/0x155c + +where x0 has been allocated as both the value to be stored and also the +atomic_t pointer. + +This patch adds the missing clobbers. + +Cc: +Cc: Dave Martin +Cc: Robin Murphy +Reported-by: Mark Salter +Signed-off-by: Will Deacon +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm64/include/asm/atomic_lse.h | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +--- a/arch/arm64/include/asm/atomic_lse.h ++++ b/arch/arm64/include/asm/atomic_lse.h +@@ -117,7 +117,7 @@ static inline void atomic_and(int i, ato + /* LSE atomics */ + " mvn %w[i], %w[i]\n" + " stclr %w[i], %[v]") +- : [i] "+r" (w0), [v] "+Q" (v->counter) ++ : [i] "+&r" (w0), [v] "+Q" (v->counter) + : "r" (x1) + : __LL_SC_CLOBBERS); + } +@@ -135,7 +135,7 @@ static inline int atomic_fetch_and##name + /* LSE atomics */ \ + " mvn %w[i], %w[i]\n" \ + " ldclr" #mb " %w[i], %w[i], %[v]") \ +- : [i] "+r" (w0), [v] "+Q" (v->counter) \ ++ : [i] "+&r" (w0), [v] "+Q" (v->counter) \ + : "r" (x1) \ + : __LL_SC_CLOBBERS, ##cl); \ + \ +@@ -161,7 +161,7 @@ static inline void atomic_sub(int i, ato + /* LSE atomics */ + " neg %w[i], %w[i]\n" + " stadd %w[i], %[v]") +- : [i] "+r" (w0), [v] "+Q" (v->counter) ++ : [i] "+&r" (w0), [v] "+Q" (v->counter) + : "r" (x1) + : __LL_SC_CLOBBERS); + } +@@ -180,7 +180,7 @@ static inline int atomic_sub_return##nam + " neg %w[i], %w[i]\n" \ + " ldadd" #mb " %w[i], w30, %[v]\n" \ + " add %w[i], %w[i], w30") \ +- : [i] "+r" (w0), [v] "+Q" (v->counter) \ ++ : [i] "+&r" (w0), [v] "+Q" (v->counter) \ + : "r" (x1) \ + : __LL_SC_CLOBBERS , ##cl); \ + \ +@@ -207,7 +207,7 @@ static inline int atomic_fetch_sub##name + /* LSE atomics */ \ + " neg %w[i], %w[i]\n" \ + " ldadd" #mb " %w[i], %w[i], %[v]") \ +- : [i] "+r" (w0), [v] "+Q" (v->counter) \ ++ : [i] "+&r" (w0), [v] "+Q" (v->counter) \ + : "r" (x1) \ + : __LL_SC_CLOBBERS, ##cl); \ + \ +@@ -314,7 +314,7 @@ static inline void atomic64_and(long i, + /* LSE atomics */ + " mvn %[i], %[i]\n" + " stclr %[i], %[v]") +- : [i] "+r" (x0), [v] "+Q" (v->counter) ++ : [i] "+&r" (x0), [v] "+Q" (v->counter) + : "r" (x1) + : __LL_SC_CLOBBERS); + } +@@ -332,7 +332,7 @@ static inline long atomic64_fetch_and##n + /* LSE atomics */ \ + " mvn %[i], %[i]\n" \ + " ldclr" #mb " %[i], %[i], %[v]") \ +- : [i] "+r" (x0), [v] "+Q" (v->counter) \ ++ : [i] "+&r" (x0), [v] "+Q" (v->counter) \ + : "r" (x1) \ + : __LL_SC_CLOBBERS, ##cl); \ + \ +@@ -358,7 +358,7 @@ static inline void atomic64_sub(long i, + /* LSE atomics */ + " neg %[i], %[i]\n" + " stadd %[i], %[v]") +- : [i] "+r" (x0), [v] "+Q" (v->counter) ++ : [i] "+&r" (x0), [v] "+Q" (v->counter) + : "r" (x1) + : __LL_SC_CLOBBERS); + } +@@ -377,7 +377,7 @@ static inline long atomic64_sub_return## + " neg %[i], %[i]\n" \ + " ldadd" #mb " %[i], x30, %[v]\n" \ + " add %[i], %[i], x30") \ +- : [i] "+r" (x0), [v] "+Q" (v->counter) \ ++ : [i] "+&r" (x0), [v] "+Q" (v->counter) \ + : "r" (x1) \ + : __LL_SC_CLOBBERS, ##cl); \ + \ +@@ -404,7 +404,7 @@ static inline long atomic64_fetch_sub##n + /* LSE atomics */ \ + " neg %[i], %[i]\n" \ + " ldadd" #mb " %[i], %[i], %[v]") \ +- : [i] "+r" (x0), [v] "+Q" (v->counter) \ ++ : [i] "+&r" (x0), [v] "+Q" (v->counter) \ + : "r" (x1) \ + : __LL_SC_CLOBBERS, ##cl); \ + \ +@@ -516,7 +516,7 @@ static inline long __cmpxchg_double##nam + " eor %[old1], %[old1], %[oldval1]\n" \ + " eor %[old2], %[old2], %[oldval2]\n" \ + " orr %[old1], %[old1], %[old2]") \ +- : [old1] "+r" (x0), [old2] "+r" (x1), \ ++ : [old1] "+&r" (x0), [old2] "+&r" (x1), \ + [v] "+Q" (*(unsigned long *)ptr) \ + : [new1] "r" (x2), [new2] "r" (x3), [ptr] "r" (x4), \ + [oldval1] "r" (oldval1), [oldval2] "r" (oldval2) \ diff --git a/queue-4.9/powerpc-64s-clear-pcr-on-boot.patch b/queue-4.9/powerpc-64s-clear-pcr-on-boot.patch new file mode 100644 index 00000000000..2120d39e311 --- /dev/null +++ b/queue-4.9/powerpc-64s-clear-pcr-on-boot.patch @@ -0,0 +1,77 @@ +From faf37c44a105f3608115785f17cbbf3500f8bc71 Mon Sep 17 00:00:00 2001 +From: Michael Neuling +Date: Fri, 18 May 2018 11:37:42 +1000 +Subject: powerpc/64s: Clear PCR on boot + +From: Michael Neuling + +commit faf37c44a105f3608115785f17cbbf3500f8bc71 upstream. + +Clear the PCR (Processor Compatibility Register) on boot to ensure we +are not running in a compatibility mode. + +We've seen this cause problems when a crash (and kdump) occurs while +running compat mode guests. The kdump kernel then runs with the PCR +set and causes problems. The symptom in the kdump kernel (also seen in +petitboot after fast-reboot) is early userspace programs taking +sigills on newer instructions (seen in libc). + +Signed-off-by: Michael Neuling +Cc: stable@vger.kernel.org +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/kernel/cpu_setup_power.S | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/arch/powerpc/kernel/cpu_setup_power.S ++++ b/arch/powerpc/kernel/cpu_setup_power.S +@@ -28,6 +28,7 @@ _GLOBAL(__setup_cpu_power7) + beqlr + li r0,0 + mtspr SPRN_LPID,r0 ++ mtspr SPRN_PCR,r0 + mfspr r3,SPRN_LPCR + bl __init_LPCR + bl __init_tlb_power7 +@@ -41,6 +42,7 @@ _GLOBAL(__restore_cpu_power7) + beqlr + li r0,0 + mtspr SPRN_LPID,r0 ++ mtspr SPRN_PCR,r0 + mfspr r3,SPRN_LPCR + bl __init_LPCR + bl __init_tlb_power7 +@@ -57,6 +59,7 @@ _GLOBAL(__setup_cpu_power8) + beqlr + li r0,0 + mtspr SPRN_LPID,r0 ++ mtspr SPRN_PCR,r0 + mfspr r3,SPRN_LPCR + ori r3, r3, LPCR_PECEDH + bl __init_LPCR +@@ -78,6 +81,7 @@ _GLOBAL(__restore_cpu_power8) + beqlr + li r0,0 + mtspr SPRN_LPID,r0 ++ mtspr SPRN_PCR,r0 + mfspr r3,SPRN_LPCR + ori r3, r3, LPCR_PECEDH + bl __init_LPCR +@@ -98,6 +102,7 @@ _GLOBAL(__setup_cpu_power9) + li r0,0 + mtspr SPRN_LPID,r0 + mtspr SPRN_PID,r0 ++ mtspr SPRN_PCR,r0 + mfspr r3,SPRN_LPCR + LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE) + or r3, r3, r4 +@@ -121,6 +126,7 @@ _GLOBAL(__restore_cpu_power9) + li r0,0 + mtspr SPRN_LPID,r0 + mtspr SPRN_PID,r0 ++ mtspr SPRN_PCR,r0 + mfspr r3,SPRN_LPCR + LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE) + or r3, r3, r4 diff --git a/queue-4.9/series b/queue-4.9/series index e69de29bb2d..ca01d23541d 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -0,0 +1,3 @@ +arm64-lse-add-early-clobbers-to-some-input-output-asm-operands.patch +powerpc-64s-clear-pcr-on-boot.patch +usb-serial-cp210x-use-tcflag_t-to-fix-incompatible-pointer-type.patch diff --git a/queue-4.9/usb-serial-cp210x-use-tcflag_t-to-fix-incompatible-pointer-type.patch b/queue-4.9/usb-serial-cp210x-use-tcflag_t-to-fix-incompatible-pointer-type.patch new file mode 100644 index 00000000000..6f975a160b4 --- /dev/null +++ b/queue-4.9/usb-serial-cp210x-use-tcflag_t-to-fix-incompatible-pointer-type.patch @@ -0,0 +1,63 @@ +From 009615ab7fd4e43b82a38e4e6adc5e23c1ee567f Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Mon, 21 Nov 2016 13:19:31 +0100 +Subject: USB: serial: cp210x: use tcflag_t to fix incompatible pointer type + +From: Geert Uytterhoeven + +commit 009615ab7fd4e43b82a38e4e6adc5e23c1ee567f upstream. + +On sparc32, tcflag_t is unsigned long, unlike all other architectures: + + drivers/usb/serial/cp210x.c: In function 'cp210x_get_termios': + drivers/usb/serial/cp210x.c:717:3: warning: passing argument 2 of 'cp210x_get_termios_port' from incompatible pointer type + cp210x_get_termios_port(tty->driver_data, + ^ + drivers/usb/serial/cp210x.c:35:13: note: expected 'unsigned int *' but argument is of type 'tcflag_t *' + static void cp210x_get_termios_port(struct usb_serial_port *port, + ^ + +Consistently use tcflag_t to fix this. + +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Johan Hovold +Cc: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/cp210x.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/usb/serial/cp210x.c ++++ b/drivers/usb/serial/cp210x.c +@@ -33,7 +33,7 @@ static int cp210x_open(struct tty_struct + static void cp210x_close(struct usb_serial_port *); + static void cp210x_get_termios(struct tty_struct *, struct usb_serial_port *); + static void cp210x_get_termios_port(struct usb_serial_port *port, +- unsigned int *cflagp, unsigned int *baudp); ++ tcflag_t *cflagp, unsigned int *baudp); + static void cp210x_change_speed(struct tty_struct *, struct usb_serial_port *, + struct ktermios *); + static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *, +@@ -728,7 +728,7 @@ static void cp210x_get_termios(struct tt + &tty->termios.c_cflag, &baud); + tty_encode_baud_rate(tty, baud, baud); + } else { +- unsigned int cflag; ++ tcflag_t cflag; + cflag = 0; + cp210x_get_termios_port(port, &cflag, &baud); + } +@@ -739,10 +739,10 @@ static void cp210x_get_termios(struct tt + * This is the heart of cp210x_get_termios which always uses a &usb_serial_port. + */ + static void cp210x_get_termios_port(struct usb_serial_port *port, +- unsigned int *cflagp, unsigned int *baudp) ++ tcflag_t *cflagp, unsigned int *baudp) + { + struct device *dev = &port->dev; +- unsigned int cflag; ++ tcflag_t cflag; + struct cp210x_flow_ctl flow_ctl; + u32 baud; + u16 bits;