David Wu
526571a766
Revert "pinctrl: rockchip: Make the gpio base started from 1000"
...
This reverts commit 3b7424f332 .
Change-Id: If7598862a116000b60d958918b3651c248b5aaf2
Signed-off-by: David Wu <david.wu@rock-chips.com >
2018-02-25 19:35:21 +08:00
David Wu
15840a4670
Revert "soc: rockchip: rockchip_pm_config: set the real pin number to ATF"
...
This reverts commit ef06da2890 .
Change-Id: Ide586a9f1aa079b9d29568ed0c88235f58ccfe9a
Signed-off-by: David Wu <david.wu@rock-chips.com >
2018-02-25 19:34:52 +08:00
David Wu
3506ee9262
Revert "gpio: rockchip: Make the gpio base added at gpiolib"
...
This reverts commit 545abf2ec4 .
Change-Id: Icb7a08f12e85a8757154356a6671b5bca88eb79a
Signed-off-by: David Wu <david.wu@rock-chips.com >
2018-02-25 19:34:31 +08:00
Shunqing Chen
c800d4456e
power_supply: cw201x: add hw_id check for android things SOM
...
Change-Id: Ic51abf5ccf89d3106858d029812ba6450422f1f5
Signed-off-by: Shunqing Chen <csq@rock-chips.com >
2018-02-25 19:33:19 +08:00
Liang Chen
810497ff78
clk: rockchip: Add adaptive frequency scaling for pll_rk3036
...
Change-Id: Ifd035967afc1852df81daa2b15afea764c5b851d
Signed-off-by: Liang Chen <cl@rock-chips.com >
2018-02-25 19:28:56 +08:00
Caesar Wang
bea847eadf
arm64: rockchip_linux_config: enable the dmc for rk3399
...
Change-Id: I25c1524949cae7d3fef9e178548abadcc676f138
Signed-off-by: Caesar Wang <wxt@rock-chips.com >
2018-02-25 19:27:40 +08:00
Caesar Wang
68c494b9ea
arm64: rockchip_linux_config: enable camera sensors used by dts
...
As rk3399's sapphire board have used 5 camera sensors on
rk3399-sapphire-excavator-linux.dts, enable configure to support these.
Change-Id: I0afe26ad40aeeba889a556b4024a4798feeaf08e
Signed-off-by: Caesar Wang <wxt@rock-chips.com >
2018-02-25 19:27:17 +08:00
Caesar Wang
739d1ab1c9
arm64: dts: rockchip: enable the dmc for rk3399 sapphire excavator
...
The rk3399 had supported the dmc, the sapphire excavator board should
supported it too.
Change-Id: Id462ca1957b8c4960564d0ca24f71e7811aaabfd
Signed-off-by: Caesar Wang <wxt@rock-chips.com >
2018-02-25 19:26:52 +08:00
Shunqing Chen
9f2ddf5a0c
power: add universal charger driver support
...
1.This driver only report charging status.
2.Support usb and dc charging.
3.Applicable to all charger IC that the
charging current is determined by hardware.
Change-Id: I1c125580248cc1ba770b3c22f0b8dc3c21b980e0
Signed-off-by: Shunqing Chen <csq@rock-chips.com >
2018-02-25 19:26:34 +08:00
Bin Yang
6181b2bd44
ARM: dts: add rk3229 3nod full function board
...
In the 3nod full function board, there are some pins is multiplexed
(such as: PWM0/2, SDMMC, IR and SPDIF). So we need create two DT files
rk3229-at-3nod.dts and rk3229-at-3nod-func.dts. In the rk3229-at-3nod,
these pins be iomux to gpio. In the rk3229-at-3nod-func, these pins be
iomux to function pins.
Change-Id: I369dabc4dceb25023ab97b74e12cfef058e522d1
Signed-off-by: Bin Yang <yangbin@rock-chips.com >
2018-02-25 19:25:58 +08:00
Xinhuang Li
18ede3402d
ARM: dts: rk3229-evb-android: add internal sound card
...
Change-Id: I3a22ac73ef11f4b468bb43ffb1a69d1fcdf3bed1
Signed-off-by: Xinhuang Li <buluess.li@rock-chips.com >
2018-02-25 19:24:50 +08:00
Zhou weixin
131944685d
arm64: dts: rockchip: adjust backlight brightness levels for rk3326-863-lp3-v10
...
Change-Id: Ib0064c1ef0411a06b92f1490a350d8b7060522b1
Signed-off-by: Weixin Zhou <zwx@rock-chips.com >
2018-02-25 19:24:16 +08:00
William Wu
87ae93e451
arm64: rockchip_defconfig: enable usbmon
...
Enable usbmon driver to collect traces of I/O on the USB bus.
Change-Id: Idc4b0afa6bb2f2dc8c8af10d28c05e4a169bcd62
Signed-off-by: William Wu <william.wu@rock-chips.com >
2018-02-25 19:23:15 +08:00
William Wu
cf334a7d66
arm64: rockchip_cros_defconfig: enable usbmon
...
Enable usbmon driver to collect traces of I/O on the USB bus.
Change-Id: I7314a2fb01f9ce852e4172aad62ef13fabbd3fd9
Signed-off-by: William Wu <william.wu@rock-chips.com >
2018-02-25 19:23:01 +08:00
William Wu
37e93a5968
ARM: rockchip_defconfig: enable usbmon
...
Enable usbmon driver to collect traces of I/O on the USB bus.
Change-Id: Ie15f6184ccffb85d440549419a5c5f129d90c7b4
Signed-off-by: William Wu <william.wu@rock-chips.com >
2018-02-25 19:22:45 +08:00
Zhang Yunlong
23e1e57ae5
Revert commit "camera: rockchip: camsys_drv v0.0x22.5"
...
Change-Id: I08774bc7d7edc9e9ca38da7415b8e3a976afe394
Signed-off-by: Zhang Yunlong <dalon.zhang@rock-chips.com >
2018-02-25 19:16:27 +08:00
Finley Xiao
9775a70bc8
clk: rockchip: px30 Add CLK_SET_RATE_NO_REPARENT for clk_sdmmc
...
Change-Id: Id97acec017f2fb2e1363733200a683b1a3ad9dac
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com >
2018-02-25 19:15:47 +08:00
Shawn Lin
2e7ca8f18b
arm64: dts: rockchip: add cap-sd-highspeed for sdmmc for all px30/rk3326 boards
...
Change-Id: I6db6411000d869439a8deb27ccec6bd4593bce26
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com >
2018-02-25 19:14:44 +08:00
Greg Kroah-Hartman
37428a8003
Linux 4.4.118
2018-02-25 11:03:55 +01:00
Wu Fengguang
554d660e44
net: dst_cache_per_cpu_dst_set() can be static
...
commit b73f96fcb4 upstream.
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com >
Signed-off-by: David S. Miller <davem@davemloft.net >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:55 +01:00
Kamil Konieczny
6e0d1fb619
crypto: s5p-sss - Fix kernel Oops in AES-ECB mode
...
commit c927b080c6 upstream.
In AES-ECB mode crypt is done with key only, so any use of IV
can cause kernel Oops. Use IV only in AES-CBC and AES-CTR.
Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com >
Reported-by: Anand Moon <linux.amoon@gmail.com >
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org >
Tested-by: Anand Moon <linux.amoon@gmail.com >
Cc: stable@vger.kernel.org # can be applied after commit 8f9702aad1
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:55 +01:00
Jan Dakinevich
853106cae8
KVM: nVMX: invvpid handling improvements
...
commit bcdde302b8 upstream
- Expose all invalidation types to the L1
- Reject invvpid instruction, if L1 passed zero vpid value to single
context invalidations
Signed-off-by: Jan Dakinevich <jan.dakinevich@gmail.com >
Tested-by: Ladi Prosek <lprosek@redhat.com >
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com >
[jwang: port to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:55 +01:00
Jan Dakinevich
6f0a79ff1b
KVM: VMX: clean up declaration of VPID/EPT invalidation types
...
commit 63f3ac4813 upstream
- Remove VMX_EPT_EXTENT_INDIVIDUAL_ADDR, since there is no such type of
EPT invalidation
- Add missing VPID types names
Signed-off-by: Jan Dakinevich <jan.dakinevich@gmail.com >
Tested-by: Ladi Prosek <lprosek@redhat.com >
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com >
[jwang: port to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:54 +01:00
Jim Mattson
82a945257e
kvm: nVMX: Fix kernel panics induced by illegal INVEPT/INVVPID types
...
commit 85c856b39b upstream
Bitwise shifts by amounts greater than or equal to the width of the left
operand are undefined. A malicious guest can exploit this to crash a
32-bit host, due to the BUG_ON(1)'s in handle_{invept,invvpid}.
Signed-off-by: Jim Mattson <jmattson@google.com >
Message-Id: <1477496318-17681-1-git-send-email-jmattson@google.com >
[Change 1UL to 1, to match the range check on the shift count. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
[jwang: port from linux-4.9 to 4.4 ]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:54 +01:00
David Hildenbrand
04e8b366d3
KVM: nVMX: vmx_complete_nested_posted_interrupt() can't fail
...
(cherry picked from commit 6342c50ad1 )
vmx_complete_nested_posted_interrupt() can't fail, let's turn it into
a void function.
Signed-off-by: David Hildenbrand <david@redhat.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: port to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:54 +01:00
David Hildenbrand
e7a3bc31dc
KVM: nVMX: kmap() can't fail
...
commit 42cf014d38 upstream.
kmap() can't fail, therefore it will always return a valid pointer. Let's
just get rid of the unnecessary checks.
Signed-off-by: David Hildenbrand <david@redhat.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
[jwang: port to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:54 +01:00
Darren Kenny
fd94ae98d2
x86/speculation: Fix typo IBRS_ATT, which should be IBRS_ALL
...
(cherry picked from commit af189c95a3 )
Fixes: 117cc7a908 ("x86/retpoline: Fill return stack buffer on vmexit")
Signed-off-by: Darren Kenny <darren.kenny@oracle.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com >
Cc: Tom Lendacky <thomas.lendacky@amd.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: David Woodhouse <dwmw@amazon.co.uk >
Link: https://lkml.kernel.org/r/20180202191220.blvgkgutojecxr3b@starbug-vm.ie.oracle.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:54 +01:00
KarimAllah Ahmed
3fc9b05df6
x86/spectre: Simplify spectre_v2 command line parsing
...
(cherry picked from commit 9005c6834c )
[dwmw2: Use ARRAY_SIZE]
Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de >
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: peterz@infradead.org
Cc: bp@alien8.de
Link: https://lkml.kernel.org/r/1517484441-1420-3-git-send-email-dwmw@amazon.co.uk
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:54 +01:00
David Woodhouse
b98197294b
x86/retpoline: Avoid retpolines for built-in __init functions
...
(cherry picked from commit 66f793099a )
There's no point in building init code with retpolines, since it runs before
any potentially hostile userspace does. And before the retpoline is actually
ALTERNATIVEd into place, for much of it.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: karahmed@amazon.de
Cc: peterz@infradead.org
Cc: bp@alien8.de
Link: https://lkml.kernel.org/r/1517484441-1420-2-git-send-email-dwmw@amazon.co.uk
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: port to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:54 +01:00
Dan Williams
355e059499
x86/kvm: Update spectre-v1 mitigation
...
(cherry picked from commit 085331dfc6 )
Commit 75f139aaf8 "KVM: x86: Add memory barrier on vmcs field lookup"
added a raw 'asm("lfence");' to prevent a bounds check bypass of
'vmcs_field_to_offset_table'.
The lfence can be avoided in this path by using the array_index_nospec()
helper designed for these types of fixes.
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Paolo Bonzini <pbonzini@redhat.com >
Cc: Andrew Honig <ahonig@google.com >
Cc: kvm@vger.kernel.org
Cc: Jim Mattson <jmattson@google.com >
Link: https://lkml.kernel.org/r/151744959670.6342.3001723920950249067.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:54 +01:00
Josh Poimboeuf
ac0242fe0d
x86/paravirt: Remove 'noreplace-paravirt' cmdline option
...
(cherry picked from commit 12c69f1e94 )
The 'noreplace-paravirt' option disables paravirt patching, leaving the
original pv indirect calls in place.
That's highly incompatible with retpolines, unless we want to uglify
paravirt even further and convert the paravirt calls to retpolines.
As far as I can tell, the option doesn't seem to be useful for much
other than introducing surprising corner cases and making the kernel
vulnerable to Spectre v2. It was probably a debug option from the early
paravirt days. So just remove it.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: Juergen Gross <jgross@suse.com >
Cc: Andrea Arcangeli <aarcange@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Ashok Raj <ashok.raj@intel.com >
Cc: Greg KH <gregkh@linuxfoundation.org >
Cc: Jun Nakajima <jun.nakajima@intel.com >
Cc: Tim Chen <tim.c.chen@linux.intel.com >
Cc: Rusty Russell <rusty@rustcorp.com.au >
Cc: Dave Hansen <dave.hansen@intel.com >
Cc: Asit Mallick <asit.k.mallick@intel.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Jason Baron <jbaron@akamai.com >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Dan Williams <dan.j.williams@intel.com >
Link: https://lkml.kernel.org/r/20180131041333.2x6blhxirc2kclrq@treble
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: chery pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:54 +01:00
Colin Ian King
bf17809d19
x86/spectre: Fix spelling mistake: "vunerable"-> "vulnerable"
...
(cherry picked from commit e698dcdfcd )
Trivial fix to spelling mistake in pr_err error message text.
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: kernel-janitors@vger.kernel.org
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@suse.de >
Cc: David Woodhouse <dwmw@amazon.co.uk >
Link: https://lkml.kernel.org/r/20180130193218.9271-1-colin.king@canonical.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:54 +01:00
Dan Williams
b9c288b664
x86/spectre: Report get_user mitigation for spectre_v1
...
(cherry picked from commit edfbae53da )
Reflect the presence of get_user(), __get_user(), and 'syscall' protections
in sysfs. The expectation is that new and better tooling will allow the
kernel to grow more usages of array_index_nospec(), for now, only claim
mitigation for __user pointer de-references.
Reported-by: Jiri Slaby <jslaby@suse.cz >
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-arch@vger.kernel.org
Cc: kernel-hardening@lists.openwall.com
Cc: gregkh@linuxfoundation.org
Cc: torvalds@linux-foundation.org
Cc: alan@linux.intel.com
Link: https://lkml.kernel.org/r/151727420158.33451.11658324346540434635.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:53 +01:00
Dan Williams
f7b9243f5f
nl80211: Sanitize array index in parse_txq_params
...
(cherry picked from commit 259d8c1e98 )
Wireless drivers rely on parse_txq_params to validate that txq_params->ac
is less than NL80211_NUM_ACS by the time the low-level driver's ->conf_tx()
handler is called. Use a new helper, array_index_nospec(), to sanitize
txq_params->ac with respect to speculation. I.e. ensure that any
speculation into ->conf_tx() handlers is done with a value of
txq_params->ac that is within the bounds of [0, NL80211_NUM_ACS).
Reported-by: Christian Lamparter <chunkeey@gmail.com >
Reported-by: Elena Reshetova <elena.reshetova@intel.com >
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Johannes Berg <johannes@sipsolutions.net >
Cc: linux-arch@vger.kernel.org
Cc: kernel-hardening@lists.openwall.com
Cc: gregkh@linuxfoundation.org
Cc: linux-wireless@vger.kernel.org
Cc: torvalds@linux-foundation.org
Cc: "David S. Miller" <davem@davemloft.net >
Cc: alan@linux.intel.com
Link: https://lkml.kernel.org/r/151727419584.33451.7700736761686184303.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:53 +01:00
Dan Williams
43e4f5aeaf
vfs, fdtable: Prevent bounds-check bypass via speculative execution
...
(cherry picked from commit 56c30ba7b3 )
'fd' is a user controlled value that is used as a data dependency to
read from the 'fdt->fd' array. In order to avoid potential leaks of
kernel memory values, block speculative execution of the instruction
stream that could issue reads based on an invalid 'file *' returned from
__fcheck_files.
Co-developed-by: Elena Reshetova <elena.reshetova@intel.com >
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-arch@vger.kernel.org
Cc: kernel-hardening@lists.openwall.com
Cc: gregkh@linuxfoundation.org
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: torvalds@linux-foundation.org
Cc: alan@linux.intel.com
Link: https://lkml.kernel.org/r/151727418500.33451.17392199002892248656.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:53 +01:00
Dan Williams
c8961332d6
x86/syscall: Sanitize syscall table de-references under speculation
...
(cherry picked from commit 2fbd7af5af )
The syscall table base is a user controlled function pointer in kernel
space. Use array_index_nospec() to prevent any out of bounds speculation.
While retpoline prevents speculating into a userspace directed target it
does not stop the pointer de-reference, the concern is leaking memory
relative to the syscall table base, by observing instruction cache
behavior.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-arch@vger.kernel.org
Cc: kernel-hardening@lists.openwall.com
Cc: gregkh@linuxfoundation.org
Cc: Andy Lutomirski <luto@kernel.org >
Cc: alan@linux.intel.com
Link: https://lkml.kernel.org/r/151727417984.33451.1216731042505722161.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: port to 4.4, no syscall_64]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:53 +01:00
Dan Williams
fd3d953545
x86/get_user: Use pointer masking to limit speculation
...
(cherry picked from commit c7f631cb07 )
Quoting Linus:
I do think that it would be a good idea to very expressly document
the fact that it's not that the user access itself is unsafe. I do
agree that things like "get_user()" want to be protected, but not
because of any direct bugs or problems with get_user() and friends,
but simply because get_user() is an excellent source of a pointer
that is obviously controlled from a potentially attacking user
space. So it's a prime candidate for then finding _subsequent_
accesses that can then be used to perturb the cache.
Unlike the __get_user() case get_user() includes the address limit check
near the pointer de-reference. With that locality the speculation can be
mitigated with pointer narrowing rather than a barrier, i.e.
array_index_nospec(). Where the narrowing is performed by:
cmp %limit, %ptr
sbb %mask, %mask
and %mask, %ptr
With respect to speculation the value of %ptr is either less than %limit
or NULL.
Co-developed-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-arch@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org >
Cc: kernel-hardening@lists.openwall.com
Cc: gregkh@linuxfoundation.org
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: torvalds@linux-foundation.org
Cc: alan@linux.intel.com
Link: https://lkml.kernel.org/r/151727417469.33451.11804043010080838495.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: port to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:53 +01:00
Dan Williams
64d41d13ed
x86: Introduce barrier_nospec
...
(cherry picked from commit b3d7ad85b8 )
Rename the open coded form of this instruction sequence from
rdtsc_ordered() into a generic barrier primitive, barrier_nospec().
One of the mitigations for Spectre variant1 vulnerabilities is to fence
speculative execution after successfully validating a bounds check. I.e.
force the result of a bounds check to resolve in the instruction pipeline
to ensure speculative execution honors that result before potentially
operating on out-of-bounds data.
No functional changes.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org >
Suggested-by: Andi Kleen <ak@linux.intel.com >
Suggested-by: Ingo Molnar <mingo@redhat.com >
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-arch@vger.kernel.org
Cc: Tom Lendacky <thomas.lendacky@amd.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: kernel-hardening@lists.openwall.com
Cc: gregkh@linuxfoundation.org
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: alan@linux.intel.com
Link: https://lkml.kernel.org/r/151727415361.33451.9049453007262764675.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:53 +01:00
Dan Williams
f136b56017
x86: Implement array_index_mask_nospec
...
(cherry picked from commit babdde2698 )
array_index_nospec() uses a mask to sanitize user controllable array
indexes, i.e. generate a 0 mask if 'index' >= 'size', and a ~0 mask
otherwise. While the default array_index_mask_nospec() handles the
carry-bit from the (index - size) result in software.
The x86 array_index_mask_nospec() does the same, but the carry-bit is
handled in the processor CF flag without conditional instructions in the
control flow.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-arch@vger.kernel.org
Cc: kernel-hardening@lists.openwall.com
Cc: gregkh@linuxfoundation.org
Cc: alan@linux.intel.com
Link: https://lkml.kernel.org/r/151727414808.33451.1873237130672785331.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang:chery pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:53 +01:00
Dan Williams
37b33b59ec
array_index_nospec: Sanitize speculative array de-references
...
(cherry picked from commit f380420330 )
array_index_nospec() is proposed as a generic mechanism to mitigate
against Spectre-variant-1 attacks, i.e. an attack that bypasses boundary
checks via speculative execution. The array_index_nospec()
implementation is expected to be safe for current generation CPUs across
multiple architectures (ARM, x86).
Based on an original implementation by Linus Torvalds, tweaked to remove
speculative flows by Alexei Starovoitov, and tweaked again by Linus to
introduce an x86 assembly implementation for the mask generation.
Co-developed-by: Linus Torvalds <torvalds@linux-foundation.org >
Co-developed-by: Alexei Starovoitov <ast@kernel.org >
Suggested-by: Cyril Novikov <cnovikov@lynx.com >
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-arch@vger.kernel.org
Cc: kernel-hardening@lists.openwall.com
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Russell King <linux@armlinux.org.uk >
Cc: gregkh@linuxfoundation.org
Cc: torvalds@linux-foundation.org
Cc: alan@linux.intel.com
Link: https://lkml.kernel.org/r/151727414229.33451.18411580953862676575.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:53 +01:00
Mark Rutland
3416cebfd1
Documentation: Document array_index_nospec
...
(cherry picked from commit f84a56f73d )
Document the rationale and usage of the new array_index_nospec() helper.
Signed-off-by: Mark Rutland <mark.rutland@arm.com >
Signed-off-by: Will Deacon <will.deacon@arm.com >
Signed-off-by: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: Kees Cook <keescook@chromium.org >
Cc: linux-arch@vger.kernel.org
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: gregkh@linuxfoundation.org
Cc: kernel-hardening@lists.openwall.com
Cc: torvalds@linux-foundation.org
Cc: alan@linux.intel.com
Link: https://lkml.kernel.org/r/151727413645.33451.15878817161436755393.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:53 +01:00
Dou Liyang
131f3e8866
x86/spectre: Check CONFIG_RETPOLINE in command line parser
...
(cherry picked from commit 9471eee918 )
The spectre_v2 option 'auto' does not check whether CONFIG_RETPOLINE is
enabled. As a consequence it fails to emit the appropriate warning and sets
feature flags which have no effect at all.
Add the missing IS_ENABLED() check.
Fixes: da28512156 ("x86/spectre: Add boot time option to select Spectre v2 mitigation")
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: ak@linux.intel.com
Cc: peterz@infradead.org
Cc: Tomohiro <misono.tomohiro@jp.fujitsu.com >
Cc: dave.hansen@intel.com
Cc: bp@alien8.de
Cc: arjan@linux.intel.com
Cc: dwmw@amazon.co.uk
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/f5892721-7528-3647-08fb-f8d10e65ad87@cn.fujitsu.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry-pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:53 +01:00
Thomas Gleixner
e905005d58
x86/cpu/bugs: Make retpoline module warning conditional
...
(cherry picked from commit e383095c7f )
If sysfs is disabled and RETPOLINE not defined:
arch/x86/kernel/cpu/bugs.c:97:13: warning: ‘spectre_v2_bad_module’ defined but not used
[-Wunused-variable]
static bool spectre_v2_bad_module;
Hide it.
Fixes: caf7501a1b ("module/retpoline: Warn about missing retpoline in module")
Reported-by: Borislav Petkov <bp@alien8.de >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: port to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:52 +01:00
Borislav Petkov
e9560fbe97
x86/bugs: Drop one "mitigation" from dmesg
...
(cherry picked from commit 55fa19d3e5 )
Make
[ 0.031118] Spectre V2 mitigation: Mitigation: Full generic retpoline
into
[ 0.031118] Spectre V2: Mitigation: Full generic retpoline
to reduce the mitigation mitigations strings.
Signed-off-by: Borislav Petkov <bp@suse.de >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: riel@redhat.com
Cc: ak@linux.intel.com
Cc: peterz@infradead.org
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: jikos@kernel.org
Cc: luto@amacapital.net
Cc: dave.hansen@intel.com
Cc: torvalds@linux-foundation.org
Cc: keescook@google.com
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: tim.c.chen@linux.intel.com
Cc: pjt@google.com
Link: https://lkml.kernel.org/r/20180126121139.31959-5-bp@alien8.de
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: port to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:52 +01:00
Borislav Petkov
3d535a0f55
x86/nospec: Fix header guards names
...
(cherry picked from commit 7a32fc51ca )
... to adhere to the _ASM_X86_ naming scheme.
No functional change.
Signed-off-by: Borislav Petkov <bp@suse.de >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: riel@redhat.com
Cc: ak@linux.intel.com
Cc: peterz@infradead.org
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: jikos@kernel.org
Cc: luto@amacapital.net
Cc: dave.hansen@intel.com
Cc: torvalds@linux-foundation.org
Cc: keescook@google.com
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: tim.c.chen@linux.intel.com
Cc: gregkh@linux-foundation.org
Cc: pjt@google.com
Link: https://lkml.kernel.org/r/20180126121139.31959-3-bp@alien8.de
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[cherry-pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:52 +01:00
Andi Kleen
6cd5513c81
module/retpoline: Warn about missing retpoline in module
...
(cherry picked from commit caf7501a1b )
There's a risk that a kernel which has full retpoline mitigations becomes
vulnerable when a module gets loaded that hasn't been compiled with the
right compiler or the right option.
To enable detection of that mismatch at module load time, add a module info
string "retpoline" at build time when the module was compiled with
retpoline support. This only covers compiled C source, but assembler source
or prebuilt object files are not checked.
If a retpoline enabled kernel detects a non retpoline protected module at
load time, print a warning and report it in the sysfs vulnerability file.
[ tglx: Massaged changelog ]
Signed-off-by: Andi Kleen <ak@linux.intel.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: gregkh@linuxfoundation.org
Cc: torvalds@linux-foundation.org
Cc: jeyu@kernel.org
Cc: arjan@linux.intel.com
Link: https://lkml.kernel.org/r/20180125235028.31211-1-andi@firstfloor.org
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: port to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:52 +01:00
Peter Zijlstra
d5030418b0
KVM: VMX: Make indirect call speculation safe
...
(cherry picked from commit c940a3fb1e )
Replace indirect call with CALL_NOSPEC.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk >
Cc: Andrea Arcangeli <aarcange@redhat.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Ashok Raj <ashok.raj@intel.com >
Cc: Greg KH <gregkh@linuxfoundation.org >
Cc: Jun Nakajima <jun.nakajima@intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: rga@amazon.de
Cc: Dave Hansen <dave.hansen@intel.com >
Cc: Asit Mallick <asit.k.mallick@intel.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Jason Baron <jbaron@akamai.com >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com >
Cc: Tim Chen <tim.c.chen@linux.intel.com >
Link: https://lkml.kernel.org/r/20180125095843.645776917@infradead.org
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[backport to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:52 +01:00
Peter Zijlstra
5dac465887
KVM: x86: Make indirect calls in emulator speculation safe
...
(cherry picked from commit 1a29b5b7f3 )
Replace the indirect calls with CALL_NOSPEC.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk >
Cc: Andrea Arcangeli <aarcange@redhat.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Ashok Raj <ashok.raj@intel.com >
Cc: Greg KH <gregkh@linuxfoundation.org >
Cc: Jun Nakajima <jun.nakajima@intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: rga@amazon.de
Cc: Dave Hansen <dave.hansen@intel.com >
Cc: Asit Mallick <asit.k.mallick@intel.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Jason Baron <jbaron@akamai.com >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com >
Cc: Tim Chen <tim.c.chen@linux.intel.com >
Link: https://lkml.kernel.org/r/20180125095843.595615683@infradead.org
[dwmw2: Use ASM_CALL_CONSTRAINT like upstream, now we have it]
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[backport to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:52 +01:00
Waiman Long
ffe69f2dd1
x86/retpoline: Remove the esp/rsp thunk
...
commit 1df37383a8 upstream.
It doesn't make sense to have an indirect call thunk with esp/rsp as
retpoline code won't work correctly with the stack pointer register.
Removing it will help compiler writers to catch error in case such
a thunk call is emitted incorrectly.
Fixes: 76b043848f ("x86/retpoline: Add initial retpoline support")
Suggested-by: Jeff Law <law@redhat.com >
Signed-off-by: Waiman Long <longman@redhat.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: David Woodhouse <dwmw@amazon.co.uk >
Cc: Tom Lendacky <thomas.lendacky@amd.com >
Cc: Kees Cook <keescook@google.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Tim Chen <tim.c.chen@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Jiri Kosina <jikos@kernel.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@intel.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org >
Cc: Paul Turner <pjt@google.com >
Link: https://lkml.kernel.org/r/1516658974-27852-1-git-send-email-longman@redhat.com
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
[jwang: cherry pick to 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:52 +01:00
Wanpeng Li
5f75371332
KVM: async_pf: Fix #DF due to inject "Page not Present" and "Page Ready" exceptions simultaneously
...
commit 9a6e7c3981 upstream.
qemu-system-x86-8600 [004] d..1 7205.687530: kvm_entry: vcpu 2
qemu-system-x86-8600 [004] .... 7205.687532: kvm_exit: reason EXCEPTION_NMI rip 0xffffffffa921297d info ffffeb2c0e44e018 80000b0e
qemu-system-x86-8600 [004] .... 7205.687532: kvm_page_fault: address ffffeb2c0e44e018 error_code 0
qemu-system-x86-8600 [004] .... 7205.687620: kvm_try_async_get_page: gva = 0xffffeb2c0e44e018, gfn = 0x427e4e
qemu-system-x86-8600 [004] .N.. 7205.687628: kvm_async_pf_not_present: token 0x8b002 gva 0xffffeb2c0e44e018
kworker/4:2-7814 [004] .... 7205.687655: kvm_async_pf_completed: gva 0xffffeb2c0e44e018 address 0x7fcc30c4e000
qemu-system-x86-8600 [004] .... 7205.687703: kvm_async_pf_ready: token 0x8b002 gva 0xffffeb2c0e44e018
qemu-system-x86-8600 [004] d..1 7205.687711: kvm_entry: vcpu 2
After running some memory intensive workload in guest, I catch the kworker
which completes the GUP too quickly, and queues an "Page Ready" #PF exception
after the "Page not Present" exception before the next vmentry as the above
trace which will result in #DF injected to guest.
This patch fixes it by clearing the queue for "Page not Present" if "Page Ready"
occurs before the next vmentry since the GUP has already got the required page
and shadow page table has already been fixed by "Page Ready" handler.
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Radim Krčmář <rkrcmar@redhat.com >
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com >
Fixes: 7c90705bf2 ("KVM: Inject asynchronous page fault into a PV guest if page is swapped out.")
[Changed indentation and added clearing of injected. - Radim]
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com >
[port from upstream v4.14-rc1, Don't assign to kvm_queued_exception::injected or
x86_exception::async_page_fault]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-02-25 11:03:52 +01:00