mirror of
https://github.com/a52xq-dev/kernel.git
synced 2026-10-18 21:58:11 +07:00
This is the 4.19.33 stable release
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAlykNfcACgkQONu9yGCS aT40dRAAiCeYjEC1zH8dkAnbFlKo6IZuhKgISfVTgrWlRe9nUTYaenBXqAfGjufH EzXHrD1IANRAnFfWg8xt01TNBfTaiEYnYzFmJkWAHFWGKxa5fRU5Kan0MB97r8s9 NjoSRsnFl8l2oJI88zwFa7k89Itop9ST/zvZIgnrysAr+j8yEZb7BZWaU2UrKK/q qfnJxjfCb/jeqAxwVh3OkasXj0gG2JkGR/uEGTw2EARuI6pvKo5OCzYz0tXTN6ZJ CSzM4X7dhkGSgLIUw3JOCB28riK9TYbOdPr4MFYMrnoU5VL8+n62tXoKXewobJ1C 2+Pmg5E54r13Rr35eoGCiHsW2LGQrOyvm8S9TFB/0SmTPtzUjFlHBC62Vs/AW5ut HSmwVy+ILM/xTIdts5QT58Gw+5NCmHxw2oEdrgcct+6FtnR9XPOqZYyzH1tw1ZB+ DL2PqYyT9czuo2bKanWA37M8339q2INDFskXqKRokQ9GNiqUx1E6fNBqtK5SqyDI CdohtAs7xSQoPPbKDiITOmt82MM8xvefKmqTIvHN5B7Ns4lT1QC74DCXEFEKtw6M l+p64h6Qw4DiKmqna7fsbKPjmg8pg1lVrCOwD5iUF3JXy+Wxi/OKnr2gqAVMChAq GSfFFf+MMZhYzJPRQKxOn4GwDBDz5niaWvQmlPcPWLJ5jdbzl+Y= =Yyc/ -----END PGP SIGNATURE----- Merge 4.19.33 into android-4.19 Changes in 4.19.33 Bluetooth: Check L2CAP option sizes returned from l2cap_get_conf_opt Bluetooth: Verify that l2cap_get_conf_opt provides large enough buffer ipmi_si: Fix crash when using hard-coded device dccp: do not use ipv6 header for ipv4 flow genetlink: Fix a memory leak on error path gtp: change NET_UDP_TUNNEL dependency to select ipv6: make ip6_create_rt_rcu return ip6_null_entry instead of NULL mac8390: Fix mmio access size probe mISDN: hfcpci: Test both vendor & device ID for Digium HFC4S net: aquantia: fix rx checksum offload for UDP/TCP over IPv6 net: datagram: fix unbounded loop in __skb_try_recv_datagram() net/packet: Set __GFP_NOWARN upon allocation in alloc_pg_vec net: phy: meson-gxl: fix interrupt support net: rose: fix a possible stack overflow net: stmmac: fix memory corruption with large MTUs net-sysfs: call dev_hold if kobject_init_and_add success packets: Always register packet sk in the same order rhashtable: Still do rehash when we get EEXIST sctp: get sctphdr by offset in sctp_compute_cksum sctp: use memdup_user instead of vmemdup_user tcp: do not use ipv6 header for ipv4 flow tipc: allow service ranges to be connect()'ed on RDM/DGRAM tipc: change to check tipc_own_id to return in tipc_net_stop tipc: fix cancellation of topology subscriptions tun: properly test for IFF_UP vrf: prevent adding upper devices vxlan: Don't call gro_cells_destroy() before device is unregistered ila: Fix rhashtable walker list corruption net: sched: fix cleanup NULL pointer exception in act_mirr thunderx: enable page recycling for non-XDP case thunderx: eliminate extra calls to put_page() for pages held for recycling tun: add a missing rcu_read_unlock() in error path powerpc/fsl: Add infrastructure to fixup branch predictor flush powerpc/fsl: Add macro to flush the branch predictor powerpc/fsl: Emulate SPRN_BUCSR register powerpc/fsl: Add nospectre_v2 command line argument powerpc/fsl: Flush the branch predictor at each kernel entry (64bit) powerpc/fsl: Flush the branch predictor at each kernel entry (32 bit) powerpc/fsl: Flush branch predictor when entering KVM powerpc/fsl: Enable runtime patching if nospectre_v2 boot arg is used powerpc/fsl: Update Spectre v2 reporting powerpc/fsl: Fixed warning: orphan section `__btb_flush_fixup' powerpc/fsl: Fix the flush of branch predictor. powerpc/security: Fix spectre_v2 reporting Btrfs: fix incorrect file size after shrinking truncate and fsync btrfs: remove WARN_ON in log_dir_items btrfs: don't report readahead errors and don't update statistics btrfs: raid56: properly unmap parity page in finish_parity_scrub() btrfs: Avoid possible qgroup_rsv_size overflow in btrfs_calculate_inode_block_rsv_size Btrfs: fix assertion failure on fsync with NO_HOLES enabled ARM: imx6q: cpuidle: fix bug that CPU might not wake up at expected time powerpc: bpf: Fix generation of load/store DW instructions vfio: ccw: only free cp on final interrupt NFS: fix mount/umount race in nlmclnt. NFSv4.1 don't free interrupted slot on open net: dsa: qca8k: remove leftover phy accessors ALSA: rawmidi: Fix potential Spectre v1 vulnerability ALSA: seq: oss: Fix Spectre v1 vulnerability ALSA: pcm: Fix possible OOB access in PCM oss plugins ALSA: pcm: Don't suspend stream in unrecoverable PCM state ALSA: hda/realtek - Add support headset mode for DELL WYSE AIO ALSA: hda/realtek - Add support headset mode for New DELL WYSE NB ALSA: hda/realtek: Enable headset MIC of Acer AIO with ALC286 ALSA: hda/realtek: Enable headset MIC of Acer Aspire Z24-890 with ALC286 ALSA: hda/realtek - Add support for Acer Aspire E5-523G/ES1-432 headset mic ALSA: hda/realtek: Enable ASUS X441MB and X705FD headset MIC with ALC256 ALSA: hda/realtek: Enable headset mic of ASUS P5440FF with ALC256 ALSA: hda/realtek: Enable headset MIC of ASUS X430UN and X512DK with ALC256 ALSA: hda/realtek - Fix speakers on Acer Predator Helios 500 Ryzen laptops kbuild: modversions: Fix relative CRC byte order interpretation fs/open.c: allow opening only regular files during execve() ocfs2: fix inode bh swapping mixup in ocfs2_reflink_inodes_lock scsi: sd: Fix a race between closing an sd device and sd I/O scsi: sd: Quiesce warning if device does not report optimal I/O size scsi: zfcp: fix rport unblock if deleted SCSI devices on Scsi_Host scsi: zfcp: fix scsi_eh host reset with port_forced ERP for non-NPIV FCP devices drm/rockchip: vop: reset scale mode when win is disabled tty: mxs-auart: fix a potential NULL pointer dereference tty: atmel_serial: fix a potential NULL pointer dereference tty: serial: qcom_geni_serial: Initialize baud in qcom_geni_console_setup staging: comedi: ni_mio_common: Fix divide-by-zero for DIO cmdtest staging: speakup_soft: Fix alternate speech with other synths staging: vt6655: Remove vif check from vnt_interrupt staging: vt6655: Fix interrupt race condition on device start up. staging: erofs: fix to handle error path of erofs_vmap() serial: max310x: Fix to avoid potential NULL pointer dereference serial: mvebu-uart: Fix to avoid a potential NULL pointer dereference serial: sh-sci: Fix setting SCSCR_TIE while transferring data USB: serial: cp210x: add new device id USB: serial: ftdi_sio: add additional NovaTech products USB: serial: mos7720: fix mos_parport refcount imbalance on error path USB: serial: option: set driver_info for SIM5218 and compatibles USB: serial: option: add support for Quectel EM12 USB: serial: option: add Olicard 600 Disable kgdboc failed by echo space to /sys/module/kgdboc/parameters/kgdboc fs/proc/proc_sysctl.c: fix NULL pointer dereference in put_links drm/vgem: fix use-after-free when drm_gem_handle_create() fails drm/vkms: fix use-after-free when drm_gem_handle_create() fails drm/i915/gvt: Fix MI_FLUSH_DW parsing with correct index check gpio: exar: add a check for the return value of ida_simple_get fails gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs usb: mtu3: fix EXTCON dependency USB: gadget: f_hid: fix deadlock in f_hidg_write() usb: common: Consider only available nodes for dr_mode usb: host: xhci-rcar: Add XHCI_TRUST_TX_LENGTH quirk xhci: Fix port resume done detection for SS ports with LPM enabled usb: xhci: dbc: Don't free all memory with spinlock held xhci: Don't let USB3 ports stuck in polling state prevent suspend usb: cdc-acm: fix race during wakeup blocking TX traffic mm: add support for kmem caches in DMA32 zone iommu/io-pgtable-arm-v7s: request DMA32 memory, and improve debugging mm: mempolicy: make mbind() return -EIO when MPOL_MF_STRICT is specified mm/migrate.c: add missing flush_dcache_page for non-mapped page migrate perf pmu: Fix parser error for uncore event alias perf intel-pt: Fix TSC slip objtool: Query pkg-config for libelf location powerpc/pseries/energy: Use OF accessor functions to read ibm,drc-indexes powerpc/64: Fix memcmp reading past the end of src/dest watchdog: Respect watchdog cpumask on CPU hotplug cpu/hotplug: Prevent crash when CPU bringup fails on CONFIG_HOTPLUG_CPU=n x86/smp: Enforce CONFIG_HOTPLUG_CPU when SMP=y KVM: Reject device ioctls from processes other than the VM's creator KVM: x86: update %rip after emulating IO KVM: x86: Emulate MSR_IA32_ARCH_CAPABILITIES on AMD hosts staging: erofs: fix error handling when failed to read compresssed data staging: erofs: keep corrupted fs from crashing kernel in erofs_readdir() bpf: do not restore dst_reg when cur_state is freed drivers: base: Helpers for adding device connection descriptions platform: x86: intel_cht_int33fe: Register all connections at once platform: x86: intel_cht_int33fe: Add connection for the DP alt mode platform: x86: intel_cht_int33fe: Add connections for the USB Type-C port usb: typec: class: Don't use port parent for getting mux handles platform: x86: intel_cht_int33fe: Remove the old connections for the muxes Linux 4.19.33 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
commit
0b065cd568
137 changed files with 1322 additions and 563 deletions
|
|
@ -13,7 +13,7 @@ of a virtual machine. The ioctls belong to three classes
|
|||
|
||||
- VM ioctls: These query and set attributes that affect an entire virtual
|
||||
machine, for example memory layout. In addition a VM ioctl is used to
|
||||
create virtual cpus (vcpus).
|
||||
create virtual cpus (vcpus) and devices.
|
||||
|
||||
Only run VM ioctls from the same process (address space) that was used
|
||||
to create the VM.
|
||||
|
|
@ -24,6 +24,11 @@ of a virtual machine. The ioctls belong to three classes
|
|||
Only run vcpu ioctls from the same thread that was used to create the
|
||||
vcpu.
|
||||
|
||||
- device ioctls: These query and set attributes that control the operation
|
||||
of a single device.
|
||||
|
||||
device ioctls must be issued from the same process (address space) that
|
||||
was used to create the VM.
|
||||
|
||||
2. File descriptors
|
||||
-------------------
|
||||
|
|
@ -32,10 +37,11 @@ The kvm API is centered around file descriptors. An initial
|
|||
open("/dev/kvm") obtains a handle to the kvm subsystem; this handle
|
||||
can be used to issue system ioctls. A KVM_CREATE_VM ioctl on this
|
||||
handle will create a VM file descriptor which can be used to issue VM
|
||||
ioctls. A KVM_CREATE_VCPU ioctl on a VM fd will create a virtual cpu
|
||||
and return a file descriptor pointing to it. Finally, ioctls on a vcpu
|
||||
fd can be used to control the vcpu, including the important task of
|
||||
actually running guest code.
|
||||
ioctls. A KVM_CREATE_VCPU or KVM_CREATE_DEVICE ioctl on a VM fd will
|
||||
create a virtual cpu or device and return a file descriptor pointing to
|
||||
the new resource. Finally, ioctls on a vcpu or device fd can be used
|
||||
to control the vcpu or device. For vcpus, this includes the important
|
||||
task of actually running guest code.
|
||||
|
||||
In general file descriptors can be migrated among processes by means
|
||||
of fork() and the SCM_RIGHTS facility of unix domain socket. These
|
||||
|
|
|
|||
6
Makefile
6
Makefile
|
|
@ -1,7 +1,7 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
VERSION = 4
|
||||
PATCHLEVEL = 19
|
||||
SUBLEVEL = 32
|
||||
SUBLEVEL = 33
|
||||
EXTRAVERSION =
|
||||
NAME = "People's Front"
|
||||
|
||||
|
|
@ -951,9 +951,11 @@ mod_sign_cmd = true
|
|||
endif
|
||||
export mod_sign_cmd
|
||||
|
||||
HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
|
||||
|
||||
ifdef CONFIG_STACK_VALIDATION
|
||||
has_libelf := $(call try-run,\
|
||||
echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0)
|
||||
echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
|
||||
ifeq ($(has_libelf),1)
|
||||
objtool_target := tools/objtool FORCE
|
||||
else
|
||||
|
|
|
|||
|
|
@ -16,30 +16,23 @@
|
|||
#include "cpuidle.h"
|
||||
#include "hardware.h"
|
||||
|
||||
static atomic_t master = ATOMIC_INIT(0);
|
||||
static DEFINE_SPINLOCK(master_lock);
|
||||
static int num_idle_cpus = 0;
|
||||
static DEFINE_SPINLOCK(cpuidle_lock);
|
||||
|
||||
static int imx6q_enter_wait(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv, int index)
|
||||
{
|
||||
if (atomic_inc_return(&master) == num_online_cpus()) {
|
||||
/*
|
||||
* With this lock, we prevent other cpu to exit and enter
|
||||
* this function again and become the master.
|
||||
*/
|
||||
if (!spin_trylock(&master_lock))
|
||||
goto idle;
|
||||
spin_lock(&cpuidle_lock);
|
||||
if (++num_idle_cpus == num_online_cpus())
|
||||
imx6_set_lpm(WAIT_UNCLOCKED);
|
||||
cpu_do_idle();
|
||||
imx6_set_lpm(WAIT_CLOCKED);
|
||||
spin_unlock(&master_lock);
|
||||
goto done;
|
||||
}
|
||||
spin_unlock(&cpuidle_lock);
|
||||
|
||||
idle:
|
||||
cpu_do_idle();
|
||||
done:
|
||||
atomic_dec(&master);
|
||||
|
||||
spin_lock(&cpuidle_lock);
|
||||
if (num_idle_cpus-- == num_online_cpus())
|
||||
imx6_set_lpm(WAIT_CLOCKED);
|
||||
spin_unlock(&cpuidle_lock);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,6 +221,17 @@ label##3: \
|
|||
FTR_ENTRY_OFFSET 953b-954b; \
|
||||
.popsection;
|
||||
|
||||
#define START_BTB_FLUSH_SECTION \
|
||||
955: \
|
||||
|
||||
#define END_BTB_FLUSH_SECTION \
|
||||
956: \
|
||||
.pushsection __btb_flush_fixup,"a"; \
|
||||
.align 2; \
|
||||
957: \
|
||||
FTR_ENTRY_OFFSET 955b-957b; \
|
||||
FTR_ENTRY_OFFSET 956b-957b; \
|
||||
.popsection;
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <linux/types.h>
|
||||
|
|
@ -230,6 +241,7 @@ extern long __start___stf_entry_barrier_fixup, __stop___stf_entry_barrier_fixup;
|
|||
extern long __start___stf_exit_barrier_fixup, __stop___stf_exit_barrier_fixup;
|
||||
extern long __start___rfi_flush_fixup, __stop___rfi_flush_fixup;
|
||||
extern long __start___barrier_nospec_fixup, __stop___barrier_nospec_fixup;
|
||||
extern long __start__btb_flush_fixup, __stop__btb_flush_fixup;
|
||||
|
||||
void apply_feature_fixups(void);
|
||||
void setup_feature_keys(void);
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@
|
|||
/* Misc instructions for BPF compiler */
|
||||
#define PPC_INST_LBZ 0x88000000
|
||||
#define PPC_INST_LD 0xe8000000
|
||||
#define PPC_INST_LDX 0x7c00002a
|
||||
#define PPC_INST_LHZ 0xa0000000
|
||||
#define PPC_INST_LWZ 0x80000000
|
||||
#define PPC_INST_LHBRX 0x7c00062c
|
||||
|
|
@ -307,6 +308,7 @@
|
|||
#define PPC_INST_STB 0x98000000
|
||||
#define PPC_INST_STH 0xb0000000
|
||||
#define PPC_INST_STD 0xf8000000
|
||||
#define PPC_INST_STDX 0x7c00012a
|
||||
#define PPC_INST_STDU 0xf8000001
|
||||
#define PPC_INST_STW 0x90000000
|
||||
#define PPC_INST_STWU 0x94000000
|
||||
|
|
|
|||
|
|
@ -821,4 +821,14 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
|
|||
stringify_in_c(.long (_target) - . ;) \
|
||||
stringify_in_c(.previous)
|
||||
|
||||
#ifdef CONFIG_PPC_FSL_BOOK3E
|
||||
#define BTB_FLUSH(reg) \
|
||||
lis reg,BUCSR_INIT@h; \
|
||||
ori reg,reg,BUCSR_INIT@l; \
|
||||
mtspr SPRN_BUCSR,reg; \
|
||||
isync;
|
||||
#else
|
||||
#define BTB_FLUSH(reg)
|
||||
#endif /* CONFIG_PPC_FSL_BOOK3E */
|
||||
|
||||
#endif /* _ASM_POWERPC_PPC_ASM_H */
|
||||
|
|
|
|||
|
|
@ -67,6 +67,13 @@ void do_barrier_nospec_fixups_range(bool enable, void *start, void *end);
|
|||
static inline void do_barrier_nospec_fixups_range(bool enable, void *start, void *end) { };
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PPC_FSL_BOOK3E
|
||||
void setup_spectre_v2(void);
|
||||
#else
|
||||
static inline void setup_spectre_v2(void) {};
|
||||
#endif
|
||||
void do_btb_flush_fixups(void);
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* _ASM_POWERPC_SETUP_H */
|
||||
|
|
|
|||
|
|
@ -80,6 +80,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_TM)
|
|||
std r0,GPR0(r1)
|
||||
std r10,GPR1(r1)
|
||||
beq 2f /* if from kernel mode */
|
||||
#ifdef CONFIG_PPC_FSL_BOOK3E
|
||||
START_BTB_FLUSH_SECTION
|
||||
BTB_FLUSH(r10)
|
||||
END_BTB_FLUSH_SECTION
|
||||
#endif
|
||||
ACCOUNT_CPU_USER_ENTRY(r13, r10, r11)
|
||||
2: std r2,GPR2(r1)
|
||||
std r3,GPR3(r1)
|
||||
|
|
|
|||
|
|
@ -296,7 +296,8 @@ ret_from_mc_except:
|
|||
andi. r10,r11,MSR_PR; /* save stack pointer */ \
|
||||
beq 1f; /* branch around if supervisor */ \
|
||||
ld r1,PACAKSAVE(r13); /* get kernel stack coming from usr */\
|
||||
1: cmpdi cr1,r1,0; /* check if SP makes sense */ \
|
||||
1: type##_BTB_FLUSH \
|
||||
cmpdi cr1,r1,0; /* check if SP makes sense */ \
|
||||
bge- cr1,exc_##n##_bad_stack;/* bad stack (TODO: out of line) */ \
|
||||
mfspr r10,SPRN_##type##_SRR0; /* read SRR0 before touching stack */
|
||||
|
||||
|
|
@ -328,6 +329,30 @@ ret_from_mc_except:
|
|||
#define SPRN_MC_SRR0 SPRN_MCSRR0
|
||||
#define SPRN_MC_SRR1 SPRN_MCSRR1
|
||||
|
||||
#ifdef CONFIG_PPC_FSL_BOOK3E
|
||||
#define GEN_BTB_FLUSH \
|
||||
START_BTB_FLUSH_SECTION \
|
||||
beq 1f; \
|
||||
BTB_FLUSH(r10) \
|
||||
1: \
|
||||
END_BTB_FLUSH_SECTION
|
||||
|
||||
#define CRIT_BTB_FLUSH \
|
||||
START_BTB_FLUSH_SECTION \
|
||||
BTB_FLUSH(r10) \
|
||||
END_BTB_FLUSH_SECTION
|
||||
|
||||
#define DBG_BTB_FLUSH CRIT_BTB_FLUSH
|
||||
#define MC_BTB_FLUSH CRIT_BTB_FLUSH
|
||||
#define GDBELL_BTB_FLUSH GEN_BTB_FLUSH
|
||||
#else
|
||||
#define GEN_BTB_FLUSH
|
||||
#define CRIT_BTB_FLUSH
|
||||
#define DBG_BTB_FLUSH
|
||||
#define MC_BTB_FLUSH
|
||||
#define GDBELL_BTB_FLUSH
|
||||
#endif
|
||||
|
||||
#define NORMAL_EXCEPTION_PROLOG(n, intnum, addition) \
|
||||
EXCEPTION_PROLOG(n, intnum, GEN, addition##_GEN(n))
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,16 @@
|
|||
*/
|
||||
#define THREAD_NORMSAVE(offset) (THREAD_NORMSAVES + (offset * 4))
|
||||
|
||||
#ifdef CONFIG_PPC_FSL_BOOK3E
|
||||
#define BOOKE_CLEAR_BTB(reg) \
|
||||
START_BTB_FLUSH_SECTION \
|
||||
BTB_FLUSH(reg) \
|
||||
END_BTB_FLUSH_SECTION
|
||||
#else
|
||||
#define BOOKE_CLEAR_BTB(reg)
|
||||
#endif
|
||||
|
||||
|
||||
#define NORMAL_EXCEPTION_PROLOG(intno) \
|
||||
mtspr SPRN_SPRG_WSCRATCH0, r10; /* save one register */ \
|
||||
mfspr r10, SPRN_SPRG_THREAD; \
|
||||
|
|
@ -43,6 +53,7 @@
|
|||
andi. r11, r11, MSR_PR; /* check whether user or kernel */\
|
||||
mr r11, r1; \
|
||||
beq 1f; \
|
||||
BOOKE_CLEAR_BTB(r11) \
|
||||
/* if from user, start at top of this thread's kernel stack */ \
|
||||
lwz r11, THREAD_INFO-THREAD(r10); \
|
||||
ALLOC_STACK_FRAME(r11, THREAD_SIZE); \
|
||||
|
|
@ -128,6 +139,7 @@
|
|||
stw r9,_CCR(r8); /* save CR on stack */\
|
||||
mfspr r11,exc_level_srr1; /* check whether user or kernel */\
|
||||
DO_KVM BOOKE_INTERRUPT_##intno exc_level_srr1; \
|
||||
BOOKE_CLEAR_BTB(r10) \
|
||||
andi. r11,r11,MSR_PR; \
|
||||
mfspr r11,SPRN_SPRG_THREAD; /* if from user, start at top of */\
|
||||
lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
|
||||
|
|
|
|||
|
|
@ -453,6 +453,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
|
|||
mfcr r13
|
||||
stw r13, THREAD_NORMSAVE(3)(r10)
|
||||
DO_KVM BOOKE_INTERRUPT_DTLB_MISS SPRN_SRR1
|
||||
START_BTB_FLUSH_SECTION
|
||||
mfspr r11, SPRN_SRR1
|
||||
andi. r10,r11,MSR_PR
|
||||
beq 1f
|
||||
BTB_FLUSH(r10)
|
||||
1:
|
||||
END_BTB_FLUSH_SECTION
|
||||
mfspr r10, SPRN_DEAR /* Get faulting address */
|
||||
|
||||
/* If we are faulting a kernel address, we have to use the
|
||||
|
|
@ -547,6 +554,14 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
|
|||
mfcr r13
|
||||
stw r13, THREAD_NORMSAVE(3)(r10)
|
||||
DO_KVM BOOKE_INTERRUPT_ITLB_MISS SPRN_SRR1
|
||||
START_BTB_FLUSH_SECTION
|
||||
mfspr r11, SPRN_SRR1
|
||||
andi. r10,r11,MSR_PR
|
||||
beq 1f
|
||||
BTB_FLUSH(r10)
|
||||
1:
|
||||
END_BTB_FLUSH_SECTION
|
||||
|
||||
mfspr r10, SPRN_SRR0 /* Get faulting address */
|
||||
|
||||
/* If we are faulting a kernel address, we have to use the
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ static enum count_cache_flush_type count_cache_flush_type = COUNT_CACHE_FLUSH_NO
|
|||
|
||||
bool barrier_nospec_enabled;
|
||||
static bool no_nospec;
|
||||
static bool btb_flush_enabled;
|
||||
#ifdef CONFIG_PPC_FSL_BOOK3E
|
||||
static bool no_spectrev2;
|
||||
#endif
|
||||
|
||||
static void enable_barrier_nospec(bool enable)
|
||||
{
|
||||
|
|
@ -101,6 +105,23 @@ static __init int barrier_nospec_debugfs_init(void)
|
|||
device_initcall(barrier_nospec_debugfs_init);
|
||||
#endif /* CONFIG_DEBUG_FS */
|
||||
|
||||
#ifdef CONFIG_PPC_FSL_BOOK3E
|
||||
static int __init handle_nospectre_v2(char *p)
|
||||
{
|
||||
no_spectrev2 = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
early_param("nospectre_v2", handle_nospectre_v2);
|
||||
void setup_spectre_v2(void)
|
||||
{
|
||||
if (no_spectrev2)
|
||||
do_btb_flush_fixups();
|
||||
else
|
||||
btb_flush_enabled = true;
|
||||
}
|
||||
#endif /* CONFIG_PPC_FSL_BOOK3E */
|
||||
|
||||
#ifdef CONFIG_PPC_BOOK3S_64
|
||||
ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
|
|
@ -168,31 +189,27 @@ ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, c
|
|||
bcs = security_ftr_enabled(SEC_FTR_BCCTRL_SERIALISED);
|
||||
ccd = security_ftr_enabled(SEC_FTR_COUNT_CACHE_DISABLED);
|
||||
|
||||
if (bcs || ccd || count_cache_flush_type != COUNT_CACHE_FLUSH_NONE) {
|
||||
bool comma = false;
|
||||
if (bcs || ccd) {
|
||||
seq_buf_printf(&s, "Mitigation: ");
|
||||
|
||||
if (bcs) {
|
||||
if (bcs)
|
||||
seq_buf_printf(&s, "Indirect branch serialisation (kernel only)");
|
||||
comma = true;
|
||||
}
|
||||
|
||||
if (ccd) {
|
||||
if (comma)
|
||||
seq_buf_printf(&s, ", ");
|
||||
seq_buf_printf(&s, "Indirect branch cache disabled");
|
||||
comma = true;
|
||||
}
|
||||
|
||||
if (comma)
|
||||
if (bcs && ccd)
|
||||
seq_buf_printf(&s, ", ");
|
||||
|
||||
seq_buf_printf(&s, "Software count cache flush");
|
||||
if (ccd)
|
||||
seq_buf_printf(&s, "Indirect branch cache disabled");
|
||||
} else if (count_cache_flush_type != COUNT_CACHE_FLUSH_NONE) {
|
||||
seq_buf_printf(&s, "Mitigation: Software count cache flush");
|
||||
|
||||
if (count_cache_flush_type == COUNT_CACHE_FLUSH_HW)
|
||||
seq_buf_printf(&s, "(hardware accelerated)");
|
||||
} else
|
||||
seq_buf_printf(&s, " (hardware accelerated)");
|
||||
} else if (btb_flush_enabled) {
|
||||
seq_buf_printf(&s, "Mitigation: Branch predictor state flush");
|
||||
} else {
|
||||
seq_buf_printf(&s, "Vulnerable");
|
||||
}
|
||||
|
||||
seq_buf_printf(&s, "\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -973,6 +973,7 @@ void __init setup_arch(char **cmdline_p)
|
|||
ppc_md.setup_arch();
|
||||
|
||||
setup_barrier_nospec();
|
||||
setup_spectre_v2();
|
||||
|
||||
paging_init();
|
||||
|
||||
|
|
|
|||
|
|
@ -164,6 +164,14 @@ SECTIONS
|
|||
}
|
||||
#endif /* CONFIG_PPC_BARRIER_NOSPEC */
|
||||
|
||||
#ifdef CONFIG_PPC_FSL_BOOK3E
|
||||
. = ALIGN(8);
|
||||
__spec_btb_flush_fixup : AT(ADDR(__spec_btb_flush_fixup) - LOAD_OFFSET) {
|
||||
__start__btb_flush_fixup = .;
|
||||
*(__btb_flush_fixup)
|
||||
__stop__btb_flush_fixup = .;
|
||||
}
|
||||
#endif
|
||||
EXCEPTION_TABLE(0)
|
||||
|
||||
NOTES :kernel :notes
|
||||
|
|
|
|||
|
|
@ -75,6 +75,10 @@
|
|||
PPC_LL r1, VCPU_HOST_STACK(r4)
|
||||
PPC_LL r2, HOST_R2(r1)
|
||||
|
||||
START_BTB_FLUSH_SECTION
|
||||
BTB_FLUSH(r10)
|
||||
END_BTB_FLUSH_SECTION
|
||||
|
||||
mfspr r10, SPRN_PID
|
||||
lwz r8, VCPU_HOST_PID(r4)
|
||||
PPC_LL r11, VCPU_SHARED(r4)
|
||||
|
|
|
|||
|
|
@ -277,6 +277,13 @@ int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong spr_va
|
|||
vcpu->arch.pwrmgtcr0 = spr_val;
|
||||
break;
|
||||
|
||||
case SPRN_BUCSR:
|
||||
/*
|
||||
* If we are here, it means that we have already flushed the
|
||||
* branch predictor, so just return to guest.
|
||||
*/
|
||||
break;
|
||||
|
||||
/* extra exceptions */
|
||||
#ifdef CONFIG_SPE_POSSIBLE
|
||||
case SPRN_IVOR32:
|
||||
|
|
|
|||
|
|
@ -347,6 +347,29 @@ void do_barrier_nospec_fixups_range(bool enable, void *fixup_start, void *fixup_
|
|||
|
||||
printk(KERN_DEBUG "barrier-nospec: patched %d locations\n", i);
|
||||
}
|
||||
|
||||
static void patch_btb_flush_section(long *curr)
|
||||
{
|
||||
unsigned int *start, *end;
|
||||
|
||||
start = (void *)curr + *curr;
|
||||
end = (void *)curr + *(curr + 1);
|
||||
for (; start < end; start++) {
|
||||
pr_devel("patching dest %lx\n", (unsigned long)start);
|
||||
patch_instruction(start, PPC_INST_NOP);
|
||||
}
|
||||
}
|
||||
|
||||
void do_btb_flush_fixups(void)
|
||||
{
|
||||
long *start, *end;
|
||||
|
||||
start = PTRRELOC(&__start__btb_flush_fixup);
|
||||
end = PTRRELOC(&__stop__btb_flush_fixup);
|
||||
|
||||
for (; start < end; start += 2)
|
||||
patch_btb_flush_section(start);
|
||||
}
|
||||
#endif /* CONFIG_PPC_FSL_BOOK3E */
|
||||
|
||||
void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end)
|
||||
|
|
|
|||
|
|
@ -215,11 +215,20 @@ _GLOBAL_TOC(memcmp)
|
|||
beq .Lzero
|
||||
|
||||
.Lcmp_rest_lt8bytes:
|
||||
/* Here we have only less than 8 bytes to compare with. at least s1
|
||||
* Address is aligned with 8 bytes.
|
||||
* The next double words are load and shift right with appropriate
|
||||
* bits.
|
||||
/*
|
||||
* Here we have less than 8 bytes to compare. At least s1 is aligned to
|
||||
* 8 bytes, but s2 may not be. We must make sure s2 + 7 doesn't cross a
|
||||
* page boundary, otherwise we might read past the end of the buffer and
|
||||
* trigger a page fault. We use 4K as the conservative minimum page
|
||||
* size. If we detect that case we go to the byte-by-byte loop.
|
||||
*
|
||||
* Otherwise the next double word is loaded from s1 and s2, and shifted
|
||||
* right to compare the appropriate bits.
|
||||
*/
|
||||
clrldi r6,r4,(64-12) // r6 = r4 & 0xfff
|
||||
cmpdi r6,0xff8
|
||||
bgt .Lshort
|
||||
|
||||
subfic r6,r5,8
|
||||
slwi r6,r6,3
|
||||
LD rA,0,r3
|
||||
|
|
|
|||
|
|
@ -70,6 +70,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
|
|||
std r15,EX_TLB_R15(r12)
|
||||
std r10,EX_TLB_CR(r12)
|
||||
#ifdef CONFIG_PPC_FSL_BOOK3E
|
||||
START_BTB_FLUSH_SECTION
|
||||
mfspr r11, SPRN_SRR1
|
||||
andi. r10,r11,MSR_PR
|
||||
beq 1f
|
||||
BTB_FLUSH(r10)
|
||||
1:
|
||||
END_BTB_FLUSH_SECTION
|
||||
std r7,EX_TLB_R7(r12)
|
||||
#endif
|
||||
TLB_MISS_PROLOG_STATS
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@
|
|||
#define PPC_LIS(r, i) PPC_ADDIS(r, 0, i)
|
||||
#define PPC_STD(r, base, i) EMIT(PPC_INST_STD | ___PPC_RS(r) | \
|
||||
___PPC_RA(base) | ((i) & 0xfffc))
|
||||
#define PPC_STDX(r, base, b) EMIT(PPC_INST_STDX | ___PPC_RS(r) | \
|
||||
___PPC_RA(base) | ___PPC_RB(b))
|
||||
#define PPC_STDU(r, base, i) EMIT(PPC_INST_STDU | ___PPC_RS(r) | \
|
||||
___PPC_RA(base) | ((i) & 0xfffc))
|
||||
#define PPC_STW(r, base, i) EMIT(PPC_INST_STW | ___PPC_RS(r) | \
|
||||
|
|
@ -65,7 +67,9 @@
|
|||
#define PPC_LBZ(r, base, i) EMIT(PPC_INST_LBZ | ___PPC_RT(r) | \
|
||||
___PPC_RA(base) | IMM_L(i))
|
||||
#define PPC_LD(r, base, i) EMIT(PPC_INST_LD | ___PPC_RT(r) | \
|
||||
___PPC_RA(base) | IMM_L(i))
|
||||
___PPC_RA(base) | ((i) & 0xfffc))
|
||||
#define PPC_LDX(r, base, b) EMIT(PPC_INST_LDX | ___PPC_RT(r) | \
|
||||
___PPC_RA(base) | ___PPC_RB(b))
|
||||
#define PPC_LWZ(r, base, i) EMIT(PPC_INST_LWZ | ___PPC_RT(r) | \
|
||||
___PPC_RA(base) | IMM_L(i))
|
||||
#define PPC_LHZ(r, base, i) EMIT(PPC_INST_LHZ | ___PPC_RT(r) | \
|
||||
|
|
@ -85,17 +89,6 @@
|
|||
___PPC_RA(a) | ___PPC_RB(b))
|
||||
#define PPC_BPF_STDCX(s, a, b) EMIT(PPC_INST_STDCX | ___PPC_RS(s) | \
|
||||
___PPC_RA(a) | ___PPC_RB(b))
|
||||
|
||||
#ifdef CONFIG_PPC64
|
||||
#define PPC_BPF_LL(r, base, i) do { PPC_LD(r, base, i); } while(0)
|
||||
#define PPC_BPF_STL(r, base, i) do { PPC_STD(r, base, i); } while(0)
|
||||
#define PPC_BPF_STLU(r, base, i) do { PPC_STDU(r, base, i); } while(0)
|
||||
#else
|
||||
#define PPC_BPF_LL(r, base, i) do { PPC_LWZ(r, base, i); } while(0)
|
||||
#define PPC_BPF_STL(r, base, i) do { PPC_STW(r, base, i); } while(0)
|
||||
#define PPC_BPF_STLU(r, base, i) do { PPC_STWU(r, base, i); } while(0)
|
||||
#endif
|
||||
|
||||
#define PPC_CMPWI(a, i) EMIT(PPC_INST_CMPWI | ___PPC_RA(a) | IMM_L(i))
|
||||
#define PPC_CMPDI(a, i) EMIT(PPC_INST_CMPDI | ___PPC_RA(a) | IMM_L(i))
|
||||
#define PPC_CMPW(a, b) EMIT(PPC_INST_CMPW | ___PPC_RA(a) | \
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue