4.4.130-stable review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 4.4.130-stable review
This is the start of the stable review cycle for the 4.4.130 release. There are 50 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 Sun Apr 29 13:56:42 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.130-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.4.130-rc1
Heiko Carstens <[email protected]>
s390/uprobes: implement arch_uretprobe_is_alive()
Sebastian Ott <[email protected]>
s390/cio: update chpid descriptor after resource accessibility event
Dan Carpenter <[email protected]>
cdrom: information leak in cdrom_ioctl_media_changed()
Martin K. Petersen <[email protected]>
scsi: mptsas: Disable WRITE SAME
Eric Dumazet <[email protected]>
ipv6: add RTA_TABLE and RTA_PREFSRC to rtm_ipv6_policy
Eric Dumazet <[email protected]>
net: af_packet: fix race in PACKET_{R|T}X_RING
Eric Dumazet <[email protected]>
tcp: md5: reject TCP_MD5SIG or TCP_MD5SIG_EXT on established sockets
Wolfgang Bumiller <[email protected]>
net: fix deadlock while clearing neighbor proxy table
Eric Dumazet <[email protected]>
tipc: add policy for TIPC_NLA_NET_ADDR
Cong Wang <[email protected]>
llc: fix NULL pointer deref for SOCK_ZAPPED
Cong Wang <[email protected]>
llc: hold llc_sap before release_sock()
Xin Long <[email protected]>
sctp: do not check port in sctp_inet6_cmp_addr
Toshiaki Makita <[email protected]>
vlan: Fix reading memory beyond skb->tail in skb_vlan_tagged_multi
Guillaume Nault <[email protected]>
pppoe: check sockaddr length in pppoe_connect()
Willem de Bruijn <[email protected]>
packet: fix bitfield update race
Xin Long <[email protected]>
team: fix netconsole setup over team
Paolo Abeni <[email protected]>
team: avoid adding twice the same option to the event list
Jann Horn <[email protected]>
tcp: don't read out-of-bounds opsize
Cong Wang <[email protected]>
llc: delete timers synchronously in llc_sk_free()
Eric Dumazet <[email protected]>
net: validate attribute sizes in neigh_dump_table()
Guillaume Nault <[email protected]>
l2tp: check sockaddr length in pppol2tp_connect()
Eric Biggers <[email protected]>
KEYS: DNS: limit the length of option strings
Xin Long <[email protected]>
bonding: do not set slave_dev npinfo before slave_enable_netpoll in bond_enslave
Martin Schwidefsky <[email protected]>
s390: correct module section names for expoline code revert
Martin Schwidefsky <[email protected]>
s390: correct nospec auto detection init order
Martin Schwidefsky <[email protected]>
s390: add sysfs attributes for spectre
Martin Schwidefsky <[email protected]>
s390: report spectre mitigation via syslog
Martin Schwidefsky <[email protected]>
s390: add automatic detection of the spectre defense
Martin Schwidefsky <[email protected]>
s390: move nobp parameter functions to nospec-branch.c
Martin Schwidefsky <[email protected]>
s390/entry.S: fix spurious zeroing of r0
Martin Schwidefsky <[email protected]>
s390: do not bypass BPENTER for interrupt system calls
Martin Schwidefsky <[email protected]>
s390: Replace IS_ENABLED(EXPOLINE_*) with IS_ENABLED(CONFIG_EXPOLINE_*)
Martin Schwidefsky <[email protected]>
s390: introduce execute-trampolines for branches
Martin Schwidefsky <[email protected]>
s390: run user space and KVM guests with modified branch prediction
Martin Schwidefsky <[email protected]>
s390: add options to change branch prediction behaviour for the kernel
Martin Schwidefsky <[email protected]>
s390/alternative: use a copy of the facility bit mask
Martin Schwidefsky <[email protected]>
s390: add optimized array_index_mask_nospec
Martin Schwidefsky <[email protected]>
s390: scrub registers on kernel entry and KVM exit
Martin Schwidefsky <[email protected]>
KVM: s390: wire up bpb feature
Martin Schwidefsky <[email protected]>
s390: enable CPU alternatives unconditionally
Martin Schwidefsky <[email protected]>
s390: introduce CPU alternatives
Karthikeyan Periyasamy <[email protected]>
Revert "ath10k: send (re)assoc peer command when NSS changed"
Sahitya Tummala <[email protected]>
jbd2: fix use after free in kjournald2()
Felix Fietkau <[email protected]>
ath9k_hw: check if the chip failed to wake up
Dmitry Torokhov <[email protected]>
Input: drv260x - fix initializing overdrive voltage
Grant Grundler <[email protected]>
r8152: add Linksys USB3GIGV1 id
Chen Feng <[email protected]>
staging: ion : Donnot wakeup kswapd in ion system alloc
Jiri Olsa <[email protected]>
perf: Return proper values for user stack errors
Xiaoming Gao <[email protected]>
x86/tsc: Prevent 32bit truncation in calc_hpet_ref()
Steve French <[email protected]>
cifs: do not allow creating sockets except with SMB1 posix exensions
-------------
Diffstat:
Documentation/kernel-parameters.txt | 3 + Makefile | 4 +- arch/s390/Kconfig | 47 +++++ arch/s390/Makefile | 10 ++ arch/s390/include/asm/alternative.h | 149 +++++++++++++++ arch/s390/include/asm/barrier.h | 24 +++ arch/s390/include/asm/facility.h | 18 ++ arch/s390/include/asm/kvm_host.h | 3 +- arch/s390/include/asm/lowcore.h | 7 +- arch/s390/include/asm/nospec-branch.h | 17 ++ arch/s390/include/asm/processor.h | 4 + arch/s390/include/asm/thread_info.h | 4 + arch/s390/include/uapi/asm/kvm.h | 3 + arch/s390/kernel/Makefile | 5 +- arch/s390/kernel/alternative.c | 112 ++++++++++++ arch/s390/kernel/early.c | 5 + arch/s390/kernel/entry.S | 250 +++++++++++++++++++++++--- arch/s390/kernel/ipl.c | 1 + arch/s390/kernel/module.c | 65 ++++++- arch/s390/kernel/nospec-branch.c | 169 +++++++++++++++++ arch/s390/kernel/processor.c | 18 ++ arch/s390/kernel/setup.c | 14 +- arch/s390/kernel/smp.c | 7 +- arch/s390/kernel/uprobes.c | 9 + arch/s390/kernel/vmlinux.lds.S | 37 ++++ arch/s390/kvm/kvm-s390.c | 13 +- arch/x86/kernel/tsc.c | 2 +- drivers/cdrom/cdrom.c | 2 +- drivers/input/misc/drv260x.c | 2 +- drivers/message/fusion/mptsas.c | 1 + drivers/net/bonding/bond_main.c | 3 +- drivers/net/ppp/pppoe.c | 4 + drivers/net/team/team.c | 38 +++- drivers/net/usb/cdc_ether.c | 10 ++ drivers/net/usb/r8152.c | 2 + drivers/net/wireless/ath/ath10k/mac.c | 5 +- drivers/net/wireless/ath/ath9k/hw.c | 4 + drivers/s390/char/Makefile | 2 + drivers/s390/cio/chsc.c | 14 +- drivers/staging/android/ion/ion_system_heap.c | 2 +- fs/cifs/dir.c | 9 +- fs/jbd2/journal.c | 2 +- include/linux/if_vlan.h | 7 +- include/net/llc_conn.h | 1 + include/uapi/linux/kvm.h | 1 + kernel/events/core.c | 4 +- net/core/dev.c | 2 +- net/core/neighbour.c | 40 +++-- net/dns_resolver/dns_key.c | 13 +- net/ipv4/tcp.c | 6 +- net/ipv4/tcp_input.c | 7 +- net/ipv6/route.c | 2 + net/l2tp/l2tp_ppp.c | 7 + net/llc/af_llc.c | 14 +- net/llc/llc_c_ac.c | 9 +- net/llc/llc_conn.c | 22 ++- net/packet/af_packet.c | 88 ++++++--- net/packet/internal.h | 10 +- net/sctp/ipv6.c | 60 +++---- net/tipc/net.c | 3 +- 60 files changed, 1228 insertions(+), 168 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/50 cifs: do not allow creating sockets except with SMB1 posix exensions
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 1d0cffa674cfa7d185a302c8c6850fc50b893bed upstream.
RHBZ: 1453123
Since at least the 3.10 kernel and likely a lot earlier we have not been able to create unix domain sockets in a cifs share when mounted using the SFU mount option (except when mounted with the cifs unix extensions to Samba e.g.)
Trying to create a socket, for example using the af_unix command from xfstests will cause :
BUG: unable to handle kernel NULL pointer dereference at 00000000
00000040
Since no one uses or depends on being able to create unix domains sockets on a cifs share the easiest fix to stop this vulnerability is to simply not allow creation of any other special files than char or block devices when sfu is used.
Added update to Ronnie's patch to handle a tcon link leak, and to address a buf leak noticed by Gustavo and Colin.
--- fs/cifs/dir.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/cifs/dir.c +5 -4
@@ -673,6 +673,9 @@ int cifs_mknod(struct inode *inode, stru goto mknod_out; } +if (!S_ISCHR (mode) && !S_ISBLK (mode)) + goto mknod_out; +if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_UNX_EMUL )) goto mknod_out;
@@ -681,10 +684,8 @@ int cifs_mknod(struct inode *inode, stru buf =kmalloc (sizeof (FILE_ALL_INFO ),GFP_KERNEL );if (buf ==NULL ) { -kfree (full_path); rc = -ENOMEM ; -free_xid (xid); -return rc; + goto mknod_out; }if (backup_cred (cifs_sb))
@@ -731,7 +732,7 @@ int cifs_mknod(struct inode *inode, stru pdev->minor =cpu_to_le64 (MINOR (device_number)); rc = tcon->ses->server->ops->sync_write (xid, &fid, &io_parms, &bytes_written, iov,1 ); - }/* else if (S_ISFIFO) */ + } tcon->ses->server->ops->close (xid, tcon, &fid);d_drop (direntry);
Greg Kroah-Hartman
maintainerPATCH 2/50 x86/tsc: Prevent 32bit truncation in calc_hpet_ref()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaoming Gao <[email protected]>
commit d3878e164dcd3925a237a20e879432400e369172 upstream.
The TSC calibration code uses HPET as reference. The conversion normalizes the delta of two HPET timestamps:
hpetref = ((tshpet1 - tshpet2) * HPET_PERIOD) / 1e6
and then divides the normalized delta of the corresponding TSC timestamps by the result to calulate the TSC frequency.
tscfreq = ((tstsc1 - tstsc2 ) * 1e6) / hpetref
This uses do_div() which takes an u32 as the divisor, which worked so far because the HPET frequency was low enough that 'hpetref' never exceeded 32bit.
On Skylake machines the HPET frequency increased so 'hpetref' can exceed 32bit. do_div() truncates the divisor, which causes the calibration to fail.
Use div64_u64() to avoid the problem.
[ tglx: Fixes whitespace mangled patch and rewrote changelog ]
--- arch/x86/kernel/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/tsc.c +1 -1
@@ -408,7 +408,7 @@ static unsigned long calc_hpet_ref(u64 d hpet2 -= hpet1; tmp = ((u64 )hpet2 *hpet_readl (HPET_PERIOD ));do_div (tmp,1000000 ); -do_div (deltatsc, tmp); + deltatsc =div64_u64 (deltatsc, tmp);return (unsigned long ) deltatsc; }
Greg Kroah-Hartman
maintainerPATCH 3/50 perf: Return proper values for user stack errors
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
commit 78b562fbfa2cf0a9fcb23c3154756b690f4905c1 upstream.
Return immediately when we find issue in the user stack checks. The error value could get overwritten by following check for PERF_SAMPLE_REGS_INTR.
--- kernel/events/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/events/core.c +2 -2
@@ -8133,9 +8133,9 @@ static int perf_copy_attr(struct perf_ev* __u16 sample size limit. */ if (attr->sample_stack_user >=USHRT_MAX ) - ret = -EINVAL ; +return -EINVAL ;else if (!IS_ALIGNED (attr->sample_stack_user,sizeof (u64))) - ret = -EINVAL ; +return -EINVAL ; }if (attr->sample_type &PERF_SAMPLE_REGS_INTR )
Greg Kroah-Hartman
maintainerPATCH 4/50 staging: ion : Donnot wakeup kswapd in ion system alloc
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Feng <[email protected]>
commit 2ef230531ee171a475fc3ddad5516dd7e09a8a77 upstream.
Since ion alloc can be called by userspace,eg gralloc. When it is called frequently, the efficiency of kswapd is to low. And the reclaimed memory is too lower. In this way, the kswapd can use to much cpu resources.
With 3.5GB DMA Zone and 0.5 Normal Zone.
pgsteal_kswapd_dma 9364140pgsteal_kswapd_normal 7071043pgscan_kswapd_dma 10428250pgscan_kswapd_normal 37840094
With this change the reclaim ratio has greatly improved 18.9% -> 72.5%
--- drivers/staging/android/ion/ion_system_heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/ion_system_heap.c +1 -1
@@ -27,7 +27,7 @@#include "ion_priv.h" static gfp_t high_order_gfp_flags = (GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN | - __GFP_NORETRY) & ~__GFP_DIRECT_RECLAIM; + __GFP_NORETRY) & ~__GFP_RECLAIM;static gfp_t low_order_gfp_flags = (GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN);static const unsigned int orders[] = {8 ,4 ,0 };static const int num_orders =ARRAY_SIZE (orders);
Greg Kroah-Hartman
maintainerPATCH 5/50 r8152: add Linksys USB3GIGV1 id
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Grant Grundler <[email protected]>
commit 90841047a01b452cc8c3f9b990698b264143334a upstream.
This linksys dongle by default comes up in cdc_ether mode. This patch allows r8152 to claim the device:
Bus 002 Device 002: ID 13b1:0041 Linksys
--- drivers/net/usb/cdc_ether.c | 10 ++++++++++ drivers/net/usb/r8152.c | 2 ++ 2 files changed, 12 insertions(+)
drivers/net/usb/cdc_ether.c +10 -0
@@ -461,6 +461,7 @@ static const struct driver_info wwan_inf#define REALTEK_VENDOR_ID 0x0bda#define SAMSUNG_VENDOR_ID 0x04e8#define LENOVO_VENDOR_ID 0x17ef +#define LINKSYS_VENDOR_ID 0x13b1#define NVIDIA_VENDOR_ID 0x0955#define HP_VENDOR_ID 0x03f0
@@ -650,6 +651,15 @@ static const struct usb_device_id produc .driver_info = 0, }, +#if IS_ENABLED (CONFIG_USB_RTL8152 ) +/* Linksys USB3GIGV1 Ethernet Adapter */ +{ +USB_DEVICE_AND_INTERFACE_INFO (LINKSYS_VENDOR_ID ,0x0041 ,USB_CLASS_COMM , + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), + .driver_info =0 , +}, +#endif + /* Lenovo Thinkpad USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */ { USB_DEVICE_AND_INTERFACE_INFO(LENOVO_VENDOR_ID, 0x7205, USB_CLASS_COMM,
drivers/net/usb/r8152.c +2 -0
@@ -506,6 +506,7 @@ enum rtl8152_flags {#define VENDOR_ID_REALTEK 0x0bda#define VENDOR_ID_SAMSUNG 0x04e8#define VENDOR_ID_LENOVO 0x17ef +#define VENDOR_ID_LINKSYS 0x13b1#define VENDOR_ID_NVIDIA 0x0955#define MCU_TYPE_PLA 0x0100
@@ -4376,6 +4377,7 @@ static struct usb_device_id rtl8152_tabl {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)}, {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)}, {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f)}, + {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)}, {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)}, {} };
Greg Kroah-Hartman
maintainerPATCH 6/50 Input: drv260x - fix initializing overdrive voltage
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit 74c82dae6c474933f2be401976e1530b5f623221 upstream.
We were accidentally initializing haptics->rated_voltage twice, and did not initialize overdrive voltage.
--- drivers/input/misc/drv260x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/misc/drv260x.c +1 -1
@@ -521,7 +521,7 @@ static int drv260x_probe(struct i2c_clieif (!haptics)return -ENOMEM ; - haptics->rated_voltage =DRV260X_DEF_OD_CLAMP_VOLT ; + haptics->overdrive_voltage =DRV260X_DEF_OD_CLAMP_VOLT ; haptics->rated_voltage =DRV260X_DEF_RATED_VOLT ;if (pdata) {
Greg Kroah-Hartman
maintainerPATCH 7/50 ath9k_hw: check if the chip failed to wake up
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit a34d0a0da1abae46a5f6ebd06fb0ec484ca099d9 upstream.
In an RFC patch, Sven Eckelmann and Simon Wunderlich reported:
"QCA 802.11n chips (especially AR9330/AR9340) sometimes end up in a state in which a read of AR_CFG always returns 0xdeadbeef. This should not happen when when the power_mode of the device is ATH9K_PM_AWAKE."
Include the check for the default register state in the existing MAC hang check.
--- drivers/net/wireless/ath/ath9k/hw.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath9k/hw.c +4 -0
@@ -1595,6 +1595,10 @@ bool ath9k_hw_check_alive(struct ath_hwint count =50 ;u32 reg, last_val; +/* Check if chip failed to wake up */ +if (REG_READ (ah,AR_CFG ) ==0xdeadbeef ) +return false; +if (AR_SREV_9300 (ah))return !ath9k_hw_detect_mac_hang (ah);
Greg Kroah-Hartman
maintainerPATCH 8/50 jbd2: fix use after free in kjournald2()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sahitya Tummala <[email protected]>
commit dbfcef6b0f4012c57bc0b6e0e660d5ed12a5eaed upstream.
Below is the synchronization issue between unmount and kjournald2 contexts, which results into use after free issue in kjournald2(). Fix this issue by using journal->j_state_lock to synchronize the wait_event() done in journal_kill_thread() and the wake_up() done in kjournald2().
TASK 1:
umount cmd:
|--jbd2_journal_destroy() {
|--journal_kill_thread() {
write_lock(&journal->j_state_lock);
journal->j_flags |= JBD2_UNMOUNT;
...
write_unlock(&journal->j_state_lock);
wake_up(&journal->j_wait_commit); TASK 2 wakes up here:
kjournald2() {
...
checks JBD2_UNMOUNT flag and calls goto end-loop;
...
end_loop:
write_unlock(&journal->j_state_lock);
journal->j_task = NULL; --> If this thread gets
pre-empted here, then TASK 1 wait_event will
exit even before this thread is completely
done.
wait_event(journal->j_wait_done_commit, journal->j_task == NULL);
...
write_lock(&journal->j_state_lock);
write_unlock(&journal->j_state_lock);
}
|--kfree(journal);
}
}
wake_up(&journal->j_wait_done_commit); --> this step
now results into use after free issue.
}--- fs/jbd2/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jbd2/journal.c +1 -1
@@ -275,11 +275,11 @@ loop: goto loop; end_loop: -write_unlock (&journal->j_state_lock);del_timer_sync (&journal->j_commit_timer); journal->j_task =NULL ;wake_up (&journal->j_wait_done_commit);jbd_debug (1 ,"Journal thread exiting.\n" ); +write_unlock (&journal->j_state_lock);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 9/50 Revert "ath10k: send (re)assoc peer command when NSS changed"
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karthikeyan Periyasamy <[email protected]>
commit 55cc11da69895a680940c1733caabc37be685f5e upstream.
This reverts commit 55884c045d31a29cf69db8332d1064a1b61dd159.
When Ath10k is in AP mode and an unassociated STA sends a VHT action frame (Operating Mode Notification for the NSS change) periodically to AP this causes ath10k to call ath10k_station_assoc() which sends WMI_PEER_ASSOC_CMDID during NSS update. Over the time (with a certain client it can happen within 15 mins when there are over 500 of these VHT action frames) continuous calls of WMI_PEER_ASSOC_CMDID cause firmware to assert due to resource exhaust.
To my knowledge setting WMI_PEER_NSS peer param itself enough to handle NSS updates and no need to call ath10k_station_assoc(). So revert the original commit from 2014 as it's unclear why the change was really needed. Now the firmware assert doesn't happen anymore.
Issue observed in QCA9984 platform with firmware version:10.4-3.5.3-00053. This Change tested in QCA9984 with firmware version: 10.4-3.5.3-00053 and QCA988x platform with firmware version: 10.2.4-1.0-00036.
Firmware Assert log:
ath10k_pci 0002:01:00.0: firmware crashed! (guid e61f1274-9acd-4c5b-bcca-e032ea6e723c)ath10k_pci 0002:01:00.0: qca9984/qca9994 hw1.0 target 0x01000000 chip_id 0x00000000 sub 168c:cafeath10k_pci 0002:01:00.0: kconfig debug 1 debugfs 1 tracing 0 dfs 1 testmode 1ath10k_pci 0002:01:00.0: firmware ver 10.4-3.5.3-00053 api 5 features no-p2p,mfp,peer-flow-ctrl,btcoex-param,allows-mesh-bcast crc32 4c56a386 ath10k_pci 0002:01:00.0: board_file api 2 bmi_id 0:4 crc32 c2271344ath10k_pci 0002:01:00.0: htt-ver 2.2 wmi-op 6 htt-op 4 cal otp max-sta 512 raw 0 hwcrypto 1ath10k_pci 0002:01:00.0: firmware register dump:ath10k_pci 0002:01:00.0: [00]: 0x0000000A 0x000015B3 0x00981E5F 0x00975B31ath10k_pci 0002:01:00.0: [04]: 0x00981E5F 0x00060530 0x00000011 0x00446C60ath10k_pci 0002:01:00.0: [08]: 0x0042F1FC 0x00458080 0x00000017 0x00000000ath10k_pci 0002:01:00.0: [12]: 0x00000009 0x00000000 0x00973ABC 0x00973AD2ath10k_pci 0002:01:00.0: [16]: 0x00973AB0 0x00960E62 0x009606CA 0x00000000ath10k_pci 0002:01:00.0: [20]: 0x40981E5F 0x004066DC 0x00400000 0x00981E34ath10k_pci 0002:01:00.0: [24]: 0x80983B48 0x0040673C 0x000000C0 0xC0981E5Fath10k_pci 0002:01:00.0: [28]: 0x80993DEB 0x0040676C 0x00431AB8 0x0045D0C4ath10k_pci 0002:01:00.0: [32]: 0x80993E5C 0x004067AC 0x004303C0 0x0045D0C4ath10k_pci 0002:01:00.0: [36]: 0x80994AAB 0x004067DC 0x00000000 0x0045D0C4ath10k_pci 0002:01:00.0: [40]: 0x809971A0 0x0040681C 0x004303C0 0x00441B00ath10k_pci 0002:01:00.0: [44]: 0x80991904 0x0040688C 0x004303C0 0x0045D0C4ath10k_pci 0002:01:00.0: [48]: 0x80963AD3 0x00406A7C 0x004303C0 0x009918FCath10k_pci 0002:01:00.0: [52]: 0x80960E80 0x00406A9C 0x0000001F 0x00400000ath10k_pci 0002:01:00.0: [56]: 0x80960E51 0x00406ACC 0x00400000 0x00000000ath10k_pci 0002:01:00.0: Copy Engine register dump:ath10k_pci 0002:01:00.0: index: addr: sr_wr_idx: sr_r_idx: dst_wr_idx: dst_r_idx:ath10k_pci 0002:01:00.0: [00]: 0x0004a000 15 15 3 3ath10k_pci 0002:01:00.0: [01]: 0x0004a400 17 17 212 213ath10k_pci 0002:01:00.0: [02]: 0x0004a800 21 21 20 21ath10k_pci 0002:01:00.0: [03]: 0x0004ac00 25 25 27 25ath10k_pci 0002:01:00.0: [04]: 0x0004b000 515 515 144 104ath10k_pci 0002:01:00.0: [05]: 0x0004b400 28 28 155 156ath10k_pci 0002:01:00.0: [06]: 0x0004b800 12 12 12 12ath10k_pci 0002:01:00.0: [07]: 0x0004bc00 1 1 1 1ath10k_pci 0002:01:00.0: [08]: 0x0004c000 0 0 127 0ath10k_pci 0002:01:00.0: [09]: 0x0004c400 1 1 1 1ath10k_pci 0002:01:00.0: [10]: 0x0004c800 0 0 0 0ath10k_pci 0002:01:00.0: [11]: 0x0004cc00 0 0 0 0ath10k_pci 0002:01:00.0: CE[1] write_index 212 sw_index 213 hw_index 0 nentries_mask 0x000001ffath10k_pci 0002:01:00.0: CE[2] write_index 20 sw_index 21 hw_index 0 nentries_mask 0x0000007fath10k_pci 0002:01:00.0: CE[5] write_index 155 sw_index 156 hw_index 0 nentries_mask 0x000001ffath10k_pci 0002:01:00.0: DMA addr: nbytes: meta data: byte swap: gather:ath10k_pci 0002:01:00.0: [455]: 0x580c0042 0 0 0 0ath10k_pci 0002:01:00.0: [456]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [457]: 0x580c0042 0 0 0 0ath10k_pci 0002:01:00.0: [458]: 0x594a0038 0 0 0 1ath10k_pci 0002:01:00.0: [459]: 0x580c0a42 0 0 0 0ath10k_pci 0002:01:00.0: [460]: 0x594a0060 0 0 0 1ath10k_pci 0002:01:00.0: [461]: 0x580c0c42 0 0 0 0ath10k_pci 0002:01:00.0: [462]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [463]: 0x580c0c42 0 0 0 0ath10k_pci 0002:01:00.0: [464]: 0x594a0038 0 0 0 1ath10k_pci 0002:01:00.0: [465]: 0x580c0a42 0 0 0 0ath10k_pci 0002:01:00.0: [466]: 0x594a0060 0 0 0 1ath10k_pci 0002:01:00.0: [467]: 0x580c0042 0 0 0 0ath10k_pci 0002:01:00.0: [468]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [469]: 0x580c1c42 0 0 0 0ath10k_pci 0002:01:00.0: [470]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [471]: 0x580c1c42 0 0 0 0ath10k_pci 0002:01:00.0: [472]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [473]: 0x580c1c42 0 0 0 0ath10k_pci 0002:01:00.0: [474]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [475]: 0x580c0642 0 0 0 0ath10k_pci 0002:01:00.0: [476]: 0x594a0038 0 0 0 1ath10k_pci 0002:01:00.0: [477]: 0x580c0842 0 0 0 0ath10k_pci 0002:01:00.0: [478]: 0x594a0060 0 0 0 1ath10k_pci 0002:01:00.0: [479]: 0x580c0042 0 0 0 0ath10k_pci 0002:01:00.0: [480]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [481]: 0x580c0042 0 0 0 0ath10k_pci 0002:01:00.0: [482]: 0x594a0038 0 0 0 1ath10k_pci 0002:01:00.0: [483]: 0x580c0842 0 0 0 0ath10k_pci 0002:01:00.0: [484]: 0x594a0060 0 0 0 1ath10k_pci 0002:01:00.0: [485]: 0x580c0642 0 0 0 0ath10k_pci 0002:01:00.0: [486]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [487]: 0x580c0642 0 0 0 0ath10k_pci 0002:01:00.0: [488]: 0x594a0038 0 0 0 1ath10k_pci 0002:01:00.0: [489]: 0x580c0842 0 0 0 0ath10k_pci 0002:01:00.0: [490]: 0x594a0060 0 0 0 1ath10k_pci 0002:01:00.0: [491]: 0x580c0042 0 0 0 0ath10k_pci 0002:01:00.0: [492]: 0x58174040 0 1 0 0ath10k_pci 0002:01:00.0: [493]: 0x5a946040 0 1 0 0ath10k_pci 0002:01:00.0: [494]: 0x59909040 0 1 0 0ath10k_pci 0002:01:00.0: [495]: 0x5ae5a040 0 1 0 0ath10k_pci 0002:01:00.0: [496]: 0x58096040 0 1 0 0ath10k_pci 0002:01:00.0: [497]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [498]: 0x580c0642 0 0 0 0ath10k_pci 0002:01:00.0: [499]: 0x5c1e0040 0 1 0 0ath10k_pci 0002:01:00.0: [500]: 0x58153040 0 1 0 0ath10k_pci 0002:01:00.0: [501]: 0x58129040 0 1 0 0ath10k_pci 0002:01:00.0: [502]: 0x5952f040 0 1 0 0ath10k_pci 0002:01:00.0: [503]: 0x59535040 0 1 0 0ath10k_pci 0002:01:00.0: [504]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [505]: 0x580c0042 0 0 0 0ath10k_pci 0002:01:00.0: [506]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [507]: 0x580c0042 0 0 0 0ath10k_pci 0002:01:00.0: [508]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [509]: 0x580c0042 0 0 0 0ath10k_pci 0002:01:00.0: [510]: 0x594a0010 0 0 0 1ath10k_pci 0002:01:00.0: [511]: 0x580c0042 0 0 0 0ath10k_pci 0002:01:00.0: [512]: 0x5adcc040 0 1 0 0ath10k_pci 0002:01:00.0: [513]: 0x5cf3d040 0 1 0 0ath10k_pci 0002:01:00.0: [514]: 0x5c1e9040 64 1 0 0ath10k_pci 0002:01:00.0: [515]: 0x00000000 0 0 0 0
--- drivers/net/wireless/ath/ath10k/mac.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +2 -3
@@ -5285,9 +5285,8 @@ static void ath10k_sta_rc_update_wk(stru sta->addr, smps, err); } -if (changed &IEEE80211_RC_SUPP_RATES_CHANGED || - changed &IEEE80211_RC_NSS_CHANGED ) { -ath10k_dbg (ar,ATH10K_DBG_MAC ,"mac update sta %pM supp rates/nss\n" , +if (changed &IEEE80211_RC_SUPP_RATES_CHANGED ) { +ath10k_dbg (ar,ATH10K_DBG_MAC ,"mac update sta %pM supp rates\n" , sta->addr); err =ath10k_station_assoc (ar, arvif->vif, sta, true);
Greg Kroah-Hartman
maintainerPATCH 10/50 s390: introduce CPU alternatives
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
From: Vasily Gorbik <[email protected]>
[ Upstream commit 686140a1a9c41d85a4212a1c26d671139b76404b ]
Implement CPU alternatives, which allows to optionally patch newer instructions at runtime, based on CPU facilities availability.
A new kernel boot parameter "noaltinstr" disables patching.
Current implementation is derived from x86 alternatives. Although ideal instructions padding (when altinstr is longer then oldinstr) is added at compile time, and no oldinstr nops optimization has to be done at runtime. Also couple of compile time sanity checks are done:
1. oldinstr and altinstr must be <= 254 bytes long,
2. oldinstr and altinstr must not have an odd length.
alternative(oldinstr, altinstr, facility); alternative_2(oldinstr, altinstr1, facility1, altinstr2, facility2);
Both compile time and runtime padding consists of either 6/4/2 bytes nop or a jump (brcl) + 2 bytes nop filler if padding is longer then 6 bytes.
.altinstructions and .altinstr_replacement sections are part of __init_begin : __init_end region and are freed after initialization.
--- Documentation/kernel-parameters.txt | 3 arch/s390/Kconfig | 17 +++ arch/s390/include/asm/alternative.h | 163 ++++++++++++++++++++++++++++++++++++ arch/s390/kernel/Makefile | 1 arch/s390/kernel/alternative.c | 110 ++++++++++++++++++++++++ arch/s390/kernel/module.c | 17 +++ arch/s390/kernel/setup.c | 3 arch/s390/kernel/vmlinux.lds.S | 23 +++++ 8 files changed, 337 insertions(+) create mode 100644 arch/s390/include/asm/alternative.h create mode 100644 arch/s390/kernel/alternative.c
Documentation/kernel-parameters.txt +3 -0
@@ -2402,6 +2402,9 @@ bytes respectively. Such letter suffixes noalign [KNL,ARM] + noaltinstr [S390] Disables alternative instructions patching + (CPU alternatives feature). + noapic [SMP,APIC] Tells the kernel to not make use of any IOAPICs that may be present in the system.
arch/s390/Kconfig +17 -0
@@ -705,6 +705,22 @@ config SECCOMP If unsure, say Y. +config ALTERNATIVES + def_bool y + prompt "Patch optimized instructions for running CPU type" + help + When enabled the kernel code is compiled with additional + alternative instructions blocks optimized for newer CPU types. + These alternative instructions blocks are patched at kernel boot + time when running CPU supports them. This mechanism is used to + optimize some critical code paths (i.e. spinlocks) for newer CPUs + even if kernel is build to support older machine generations. + + This mechanism could be disabled by appending "noaltinstr" + option to the kernel command line. + + If unsure, say Y. + endmenu menu "Power Management"
@@ -754,6 +770,7 @@ config PFAULT config SHARED_KERNEL bool "VM shared kernel support" depends on !JUMP_LABEL + depends on !ALTERNATIVES help Select this option, if you want to share the text segment of the Linux kernel between different VM guests. This reduces memory
arch/s390/include/asm/alternative.h new file +163 -0
163 lines not on this page · raw message
arch/s390/kernel/Makefile +1 -0
@@ -62,6 +62,7 @@ obj-$(CONFIG_KPROBES) += kprobes.o obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_UPROBES) += uprobes.o +obj-$(CONFIG_ALTERNATIVES) += alternative.o obj-$(CONFIG_PERF_EVENTS) += perf_event.o perf_cpum_cf.o perf_cpum_sf.o obj-$(CONFIG_PERF_EVENTS) += perf_cpum_cf_events.o
arch/s390/kernel/alternative.c new file +110 -0
110 lines not on this page · raw message
arch/s390/kernel/module.c +17 -0
@@ -31,6 +31,7 @@#include <linux/kernel.h> #include <linux/moduleloader.h> #include <linux/bug.h> +#include <asm/alternative.h> #if 0 #define DEBUGP printk
@@ -424,6 +425,22 @@ int module_finalize(const Elf_Ehdr *hdr,const Elf_Shdr *sechdrs, struct module *me) { + const Elf_Shdr *s; +char *secstrings; + +if (IS_ENABLED (CONFIG_ALTERNATIVES )) { + secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; +for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) { +if (!strcmp (".altinstructions" , + secstrings + s->sh_name)) { +/* patch .altinstructions */ +void *aseg = (void *)s->sh_addr; + +apply_alternatives (aseg, aseg + s->sh_size); + } + } + } +jump_label_apply_nops (me);vfree (me->arch.syminfo); me->arch.syminfo =NULL ;
arch/s390/kernel/setup.c +3 -0
@@ -63,6 +63,7 @@#include <asm/sclp.h> #include <asm/sysinfo.h> #include <asm/numa.h> +#include <asm/alternative.h> #include "entry.h" /*
@@ -893,6 +894,8 @@ void __init setup_arch(char **cmdline_p)conmode_default ();set_preferred_console (); +apply_alternative_instructions (); +/* Setup zfcpdump support */ setup_zfcpdump ();
arch/s390/kernel/vmlinux.lds.S +23 -0
@@ -78,6 +78,29 @@ SECTIONS EXIT_DATA } + /* + * struct alt_inst entries. From the header (alternative.h): + * "Alternative instructions for different CPU types or capabilities" + * Think locking instructions on spinlocks. + * Note, that it is a part of __init region. + */ + . = ALIGN(8); + .altinstructions : { + __alt_instructions = .; + *(.altinstructions) + __alt_instructions_end = .; + } + + /* + * And here are the replacement instructions. The linker sticks + * them as binary blobs. The .altinstructions has enough data to + * get the address and the length of them to patch the kernel safely. + * Note, that it is a part of __init region. + */ + .altinstr_replacement : { + *(.altinstr_replacement) + } + /* early.c uses stsi, which requires page aligned data. */ . = ALIGN(PAGE_SIZE); INIT_DATA_SECTION(0x100)
Greg Kroah-Hartman
maintainerPATCH 11/50 s390: enable CPU alternatives unconditionally
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
From: Heiko Carstens <[email protected]>
[ Upstream commit 049a2c2d486e8cc82c5cd79fa479c5b105b109e9 ]
Remove the CPU_ALTERNATIVES config option and enable the code unconditionally. The config option was only added to avoid a conflict with the named saved segment support. Since that code is gone there is no reason to keep the CPU_ALTERNATIVES config option.
Just enable it unconditionally to also reduce the number of config options and make it less likely that something breaks.
--- arch/s390/Kconfig | 16 ---------------- arch/s390/include/asm/alternative.h | 20 +++----------------- arch/s390/kernel/Makefile | 3 +-- arch/s390/kernel/module.c | 15 ++++++--------- 4 files changed, 10 insertions(+), 44 deletions(-)
arch/s390/Kconfig +0 -16
@@ -705,22 +705,6 @@ config SECCOMP If unsure, say Y. -config ALTERNATIVES - def_bool y - prompt "Patch optimized instructions for running CPU type" - help - When enabled the kernel code is compiled with additional - alternative instructions blocks optimized for newer CPU types. - These alternative instructions blocks are patched at kernel boot - time when running CPU supports them. This mechanism is used to - optimize some critical code paths (i.e. spinlocks) for newer CPUs - even if kernel is build to support older machine generations. - - This mechanism could be disabled by appending "noaltinstr" - option to the kernel command line. - - If unsure, say Y. - endmenu menu "Power Management"
arch/s390/include/asm/alternative.h +3 -17
@@ -15,14 +15,9 @@ struct alt_instr {u8 replacementlen;/* length of new instruction */ } __packed; -#ifdef CONFIG_ALTERNATIVES -extern void apply_alternative_instructions (void ); -extern void apply_alternatives (struct alt_instr *start,struct alt_instr *end); -#else -static inline void apply_alternative_instructions (void ) {}; -static inline void apply_alternatives (struct alt_instr *start, -struct alt_instr *end) {}; -#endif +void apply_alternative_instructions (void ); +void apply_alternatives (struct alt_instr *start,struct alt_instr *end); +/* * |661: |662: |6620 |663: * +-----------+---------------------+
@@ -109,7 +104,6 @@ static inline void apply_alternatives(st b_altinstr(num)":\n\t" altinstr "\n" e_altinstr(num) ":\n" \INSTR_LEN_SANITY_CHECK (altinstr_len (num)) -#ifdef CONFIG_ALTERNATIVES /* alternative assembly primitive: */#define ALTERNATIVE (oldinstr, altinstr, facility) \ ".pushsection .altinstr_replacement, \"ax\"\n" \
@@ -130,14 +124,6 @@ static inline void apply_alternatives(st ALTINSTR_ENTRY(facility1, 1) \ ALTINSTR_ENTRY(facility2, 2) \".popsection\n" -#else -/* Alternative instructions are disabled, let's put just oldinstr in */ -#define ALTERNATIVE (oldinstr, altinstr, facility) \ - oldinstr "\n" - -#define ALTERNATIVE_2 (oldinstr, altinstr1, facility1, altinstr2, facility2) \ - oldinstr "\n" -#endif /* * Alternative instructions for different CPU types or capabilities.
arch/s390/kernel/Makefile +1 -2
@@ -44,7 +44,7 @@ obj-y += processor.o sys_s390.o ptrace.o obj-y += debug.o irq.o ipl.o dis.o diag.o sclp.o vdso.o obj-y += sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o obj-y += runtime_instr.o cache.o dumpstack.o -obj-y += entry.o reipl.o relocate_kernel.o +obj-y += entry.o reipl.o relocate_kernel.o alternative.o extra-y += head.o head64.o vmlinux.lds
@@ -62,7 +62,6 @@ obj-$(CONFIG_KPROBES) += kprobes.o obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_UPROBES) += uprobes.o -obj-$(CONFIG_ALTERNATIVES) += alternative.o obj-$(CONFIG_PERF_EVENTS) += perf_event.o perf_cpum_cf.o perf_cpum_sf.o obj-$(CONFIG_PERF_EVENTS) += perf_cpum_cf_events.o
arch/s390/kernel/module.c +6 -9
@@ -428,16 +428,13 @@ int module_finalize(const Elf_Ehdr *hdr,const Elf_Shdr *s;char *secstrings; -if (IS_ENABLED (CONFIG_ALTERNATIVES )) { - secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; -for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) { -if (!strcmp (".altinstructions" , - secstrings + s->sh_name)) { -/* patch .altinstructions */ -void *aseg = (void *)s->sh_addr; + secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; +for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) { +if (!strcmp (".altinstructions" , secstrings + s->sh_name)) { +/* patch .altinstructions */ +void *aseg = (void *)s->sh_addr; -apply_alternatives (aseg, aseg + s->sh_size); - } +apply_alternatives (aseg, aseg + s->sh_size); } }
Greg Kroah-Hartman
maintainerPATCH 12/50 KVM: s390: wire up bpb feature
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
From: Christian Borntraeger <[email protected]>
[ Upstream commit 35b3fde6203b932b2b1a5b53b3d8808abc9c4f60 ]
The new firmware interfaces for branch prediction behaviour changes are transparently available for the guest. Nevertheless, there is new state attached that should be migrated and properly resetted. Provide a mechanism for handling reset, migration and VSIE.
--- arch/s390/include/asm/kvm_host.h | 3 ++- arch/s390/include/uapi/asm/kvm.h | 3 +++ arch/s390/kvm/kvm-s390.c | 13 ++++++++++++- include/uapi/linux/kvm.h | 1 + 4 files changed, 18 insertions(+), 2 deletions(-)
arch/s390/include/asm/kvm_host.h +2 -1
@@ -136,7 +136,8 @@ struct kvm_s390_sie_block {__u16 ipa;/* 0x0056 */ __u32 ipb;/* 0x0058 */ __u32 scaoh;/* 0x005c */ -__u8 reserved60;/* 0x0060 */ +#define FPF_BPBC 0x20 +__u8 fpf;/* 0x0060 */ __u8 ecb;/* 0x0061 */ __u8 ecb2;/* 0x0062 */ #define ECB3_AES 0x04
arch/s390/include/uapi/asm/kvm.h +3 -0
@@ -151,6 +151,7 @@ struct kvm_guest_debug_arch {#define KVM_SYNC_ARCH0 (1UL << 4)#define KVM_SYNC_PFAULT (1UL << 5)#define KVM_SYNC_VRS (1UL << 6) +#define KVM_SYNC_BPBC (1UL << 10)/* definition of registers in kvm_run */ struct kvm_sync_regs {__u64 prefix;/* prefix register */
@@ -168,6 +169,8 @@ struct kvm_sync_regs {__u64 vrs[32 ][2 ];/* vector registers */ __u8 reserved[512 ];/* for future vector expansion */ __u32 fpc;/* only valid with vector registers */ + __u8 bpbc : 1; /* bp mode */ + __u8 reserved2 : 7; };#define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1)
arch/s390/kvm/kvm-s390.c +12 -1
@@ -257,6 +257,9 @@ int kvm_vm_ioctl_check_extension(structcase KVM_CAP_S390_VECTOR_REGISTERS : r =MACHINE_HAS_VX ;break ; +case KVM_CAP_S390_BPB : + r =test_facility (82 ); +break ;default : r =0 ; }
@@ -1262,6 +1265,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *KVM_SYNC_CRS |KVM_SYNC_ARCH0 |KVM_SYNC_PFAULT ; +if (test_kvm_facility (vcpu->kvm,82 )) + vcpu->run->kvm_valid_regs |=KVM_SYNC_BPBC ;if (test_kvm_facility (vcpu->kvm,129 )) vcpu->run->kvm_valid_regs |=KVM_SYNC_VRS ;
@@ -1286,7 +1291,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpuif (test_fp_ctl (current->thread.fpu.fpc))/* User space provided an invalid FPC, let's clear it */ current->thread.fpu.fpc =0 ; -save_access_regs (vcpu->arch.host_acrs);restore_access_regs (vcpu->run->s.regs.acrs);gmap_enable (vcpu->arch.gmap);
@@ -1327,6 +1331,7 @@ static void kvm_s390_vcpu_initial_reset( current->thread.fpu.fpc =0 ; vcpu->arch.sie_block->gbea =1 ; vcpu->arch.sie_block->pp =0 ; + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; vcpu->arch.pfault_token =KVM_S390_PFAULT_TOKEN_INVALID ;kvm_clear_async_pf_completion_queue (vcpu);if (!kvm_s390_user_cpu_state_ctrl (vcpu->kvm))
@@ -2162,6 +2167,7 @@ static void store_regs(struct kvm_vcpu * kvm_run->s.regs.pft = vcpu->arch.pfault_token; kvm_run->s.regs.pfs = vcpu->arch.pfault_select; kvm_run->s.regs.pfc = vcpu->arch.pfault_compare; + kvm_run->s.regs.bpbc = (vcpu->arch.sie_block->fpf &FPF_BPBC ) ==FPF_BPBC ; }int kvm_arch_vcpu_ioctl_run (struct kvm_vcpu *vcpu,struct kvm_run *kvm_run)
@@ -2194,6 +2200,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v kvm_run->exit_reason =KVM_EXIT_INTR ; rc = -EINTR ; } +if ((kvm_run->kvm_dirty_regs &KVM_SYNC_BPBC ) && +test_kvm_facility (vcpu->kvm,82 )) { + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; + vcpu->arch.sie_block->fpf |= kvm_run->s.regs.bpbc ?FPF_BPBC :0 ; + }if (guestdbg_exit_pending (vcpu) && !rc) {kvm_s390_prepare_debug_exit (vcpu);
include/uapi/linux/kvm.h +1 -0
@@ -831,6 +831,7 @@ struct kvm_ppc_smmu_info {#define KVM_CAP_GUEST_DEBUG_HW_WPS 120#define KVM_CAP_SPLIT_IRQCHIP 121#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122 +#define KVM_CAP_S390_BPB 152#ifdef KVM_CAP_IRQ_ROUTING
Re: [PATCH 4.4 12/50] KVM: s390: wire up bpb feature
Quoted 16 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
From: Christian Borntraeger <[email protected]>
[ Upstream commit
35b3fde6203b932b2b1a5b53b3d8808abc9c4f60]The new firmware interfaces for branch prediction behaviour changes are transparently available for the guest. Nevertheless, there is new state attached that should be migrated and properly resetted. Provide a mechanism for handling reset, migration and VSIE.
Quoted 7 lines
Signed-off-by Christian Borntraeger <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Cornelia Huck <[email protected]>[Changed capability number to 152. - Radim]Signed-off-by Radim Krčmář <[email protected]>Signed-off-by Martin Schwidefsky <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Something went wrong during the backport of this to 4.4
[...]
Quoted 10 lines
--- arch/s390/include/asm/kvm_host.h | 3 ++- arch/s390/include/uapi/asm/kvm.h | 3 +++ arch/s390/kvm/kvm-s390.c | 13 ++++++++++++- include/uapi/linux/kvm.h | 1 + 4 files changed, 18 insertions(+), 2 deletions(-)
arch/s390/include/asm/kvm_host.h void kvm_arch_vcpu_load(struct kvm_vcpu · line 1289
Quoted 4 lines
arch/s390/include/asm/kvm_host.h +0
-1@@ -1286,7 +1291,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpuif (test_fp_ctl (current->thread.fpu.fpc))/* User space provided an invalid FPC, let's clear it */ current->thread.fpu.fpc =0 ; -
unrelated whitespace change
Quoted 20 lines
arch/s390/include/asm/kvm_host.h +2
-0save_access_regs (vcpu->arch.host_acrs);restore_access_regs (vcpu->run->s.regs.acrs);gmap_enable (vcpu->arch.gmap);@@ -1327,6 +1331,7 @@ static void kvm_s390_vcpu_initial_reset( current->thread.fpu.fpc =0 ; vcpu->arch.sie_block->gbea =1 ; vcpu->arch.sie_block->pp =0 ; + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; vcpu->arch.pfault_token =KVM_S390_PFAULT_TOKEN_INVALID ;kvm_clear_async_pf_completion_queue (vcpu);if (!kvm_s390_user_cpu_state_ctrl (vcpu->kvm))@@ -2162,6 +2167,7 @@ static void store_regs(struct kvm_vcpu * kvm_run->s.regs.pft = vcpu->arch.pfault_token; kvm_run->s.regs.pfs = vcpu->arch.pfault_select; kvm_run->s.regs.pfc = vcpu->arch.pfault_compare; + kvm_run->s.regs.bpbc = (vcpu->arch.sie_block->fpf &FPF_BPBC ) ==FPF_BPBC ; }int kvm_arch_vcpu_ioctl_run (struct kvm_vcpu *vcpu,struct kvm_run *kvm_run)
arch/s390/include/asm/kvm_host.h int kvm_arch_vcpu_ioctl_run(struct kvm_v · line 2208
Quoted 9 lines
arch/s390/include/asm/kvm_host.h +5
-0@@ -2194,6 +2200,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v kvm_run->exit_reason =KVM_EXIT_INTR ; rc = -EINTR ; } +if ((kvm_run->kvm_dirty_regs &KVM_SYNC_BPBC ) && +test_kvm_facility (vcpu->kvm,82 )) { + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; + vcpu->arch.sie_block->fpf |= kvm_run->s.regs.bpbc ?FPF_BPBC :0 ; + }
This looks misplaced and should go into the sync_regs function.
Greg Kroah-Hartman
maintainerRe: [PATCH 4.4 12/50] KVM: s390: wire up bpb feature
Quoted 11 lines · Christian Borntraeger
Quoted 8 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
From: Christian Borntraeger <[email protected]>
Ick, that is wrong right there, my scripts messed up, this should not have 2 author lines :(
I'll go look at all of these, odds are it made the same error everywhere...
As for the backport issues, I'll let Martin deal with those :)
thanks,
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 4.4 12/50] KVM: s390: wire up bpb feature
Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Christian Borntraeger
Quoted 7 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
Quoted 7 lines
Quoted 1 line
Quoted 1 line
From: Christian Borntraeger <[email protected]>
Ick, that is wrong right there, my scripts messed up, this should not have 2 author lines :(
I'll go look at all of these, odds are it made the same error everywhere...
Yes, I've now fixed that up in the queue.
greg k-h
Re: [PATCH 4.4 12/50] KVM: s390: wire up bpb feature
Quoted 14 lines · Greg Kroah-Hartman
Quoted 13 lines · Greg Kroah-Hartman
Quoted 11 lines · Christian Borntraeger
Quoted 8 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
From: Christian Borntraeger <[email protected]>
Quoted 7 lines
Quoted 5 lines
Ick, that is wrong right there, my scripts messed up, this should not have 2 author lines :(
I'll go look at all of these, odds are it made the same error everywhere...
Yes, I've now fixed that up in the queue.
As this patch backport was also functionally incorrect and Martin is already away do you want me to send an updated version?
Re: [PATCH 4.4 12/50] KVM: s390: wire up bpb feature
Quoted 18 lines · On Fri, 27 Apr 2018 17:53:46 +0200 Christian Borntraeger…
Quoted 17 lines · Greg Kroah-Hartman
Quoted 16 lines · Greg Kroah-Hartman
Quoted 11 lines · Christian Borntraeger
Quoted 8 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
From: Christian Borntraeger <[email protected]>
Ick, that is wrong right there, my scripts messed up, this should not have 2 author lines :(
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
I'll go look at all of these, odds are it made the same error everywhere...
Yes, I've now fixed that up in the queue.
As this patch backport was also functionally incorrect and Martin is already away do you want me to send an updated version?
Checked my 4.4 backport git branch and indeed the hunk is misplaced. Sometime I wonder about the patch tool and the hickups it can produce.
My take on the replacement patch looks as follows:
---
Quoted 1 line
From
82f20b6237a8d04378c8f4a1614bf32a6c8d8a8bMon Sep 17 00:00:00 2001
From: Christian Borntraeger <[email protected]>
Date: Wed, 17 Jan 2018 14:44:34 +0100
Subject: [PATCH 03/18] KVM: s390: wire up bpb feature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[ Upstream commit 35b3fde6203b932b2b1a5b53b3d8808abc9c4f60 ]
The new firmware interfaces for branch prediction behaviour changes are transparently available for the guest. Nevertheless, there is new state attached that should be migrated and properly resetted. Provide a mechanism for handling reset, migration and VSIE.
--- arch/s390/include/asm/kvm_host.h | 3 ++- arch/s390/include/uapi/asm/kvm.h | 3 +++ arch/s390/kvm/kvm-s390.c | 12 ++++++++++++ include/uapi/linux/kvm.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-)
arch/s390/include/asm/kvm_host.h +2 -1
@@ -136,7 +136,8 @@ struct kvm_s390_sie_block {__u16 ipa;/* 0x0056 */ __u32 ipb;/* 0x0058 */ __u32 scaoh;/* 0x005c */ -__u8 reserved60;/* 0x0060 */ +#define FPF_BPBC 0x20 +__u8 fpf;/* 0x0060 */ __u8 ecb;/* 0x0061 */ __u8 ecb2;/* 0x0062 */ #define ECB3_AES 0x04
arch/s390/include/uapi/asm/kvm.h +3 -0
@@ -151,6 +151,7 @@ struct kvm_guest_debug_arch {#define KVM_SYNC_ARCH0 (1UL << 4)#define KVM_SYNC_PFAULT (1UL << 5)#define KVM_SYNC_VRS (1UL << 6) +#define KVM_SYNC_BPBC (1UL << 10)/* definition of registers in kvm_run */ struct kvm_sync_regs {__u64 prefix;/* prefix register */
@@ -168,6 +169,8 @@ struct kvm_sync_regs {__u64 vrs[32 ][2 ];/* vector registers */ __u8 reserved[512 ];/* for future vector expansion */ __u32 fpc;/* only valid with vector registers */ + __u8 bpbc : 1; /* bp mode */ + __u8 reserved2 : 7; };#define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1)
arch/s390/kvm/kvm-s390.c +12 -0
@@ -257,6 +257,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)case KVM_CAP_S390_VECTOR_REGISTERS : r =MACHINE_HAS_VX ;break ; +case KVM_CAP_S390_BPB : + r =test_facility (82 ); +break ;default : r =0 ; }
@@ -1262,6 +1265,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)KVM_SYNC_CRS |KVM_SYNC_ARCH0 |KVM_SYNC_PFAULT ; +if (test_kvm_facility (vcpu->kvm,82 )) + vcpu->run->kvm_valid_regs |=KVM_SYNC_BPBC ;if (test_kvm_facility (vcpu->kvm,129 )) vcpu->run->kvm_valid_regs |=KVM_SYNC_VRS ;
@@ -1327,6 +1332,7 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu) current->thread.fpu.fpc =0 ; vcpu->arch.sie_block->gbea =1 ; vcpu->arch.sie_block->pp =0 ; + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; vcpu->arch.pfault_token =KVM_S390_PFAULT_TOKEN_INVALID ;kvm_clear_async_pf_completion_queue (vcpu);if (!kvm_s390_user_cpu_state_ctrl (vcpu->kvm))
@@ -2145,6 +2151,11 @@ static void sync_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)if (vcpu->arch.pfault_token ==KVM_S390_PFAULT_TOKEN_INVALID )kvm_clear_async_pf_completion_queue (vcpu); } +if ((kvm_run->kvm_dirty_regs &KVM_SYNC_BPBC ) && +test_kvm_facility (vcpu->kvm,82 )) { + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; + vcpu->arch.sie_block->fpf |= kvm_run->s.regs.bpbc ?FPF_BPBC :0 ; + } kvm_run->kvm_dirty_regs =0 ; }
@@ -2162,6 +2173,7 @@ static void store_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) kvm_run->s.regs.pft = vcpu->arch.pfault_token; kvm_run->s.regs.pfs = vcpu->arch.pfault_select; kvm_run->s.regs.pfc = vcpu->arch.pfault_compare; + kvm_run->s.regs.bpbc = (vcpu->arch.sie_block->fpf &FPF_BPBC ) ==FPF_BPBC ; }int kvm_arch_vcpu_ioctl_run (struct kvm_vcpu *vcpu,struct kvm_run *kvm_run)
include/uapi/linux/kvm.h +1 -0
@@ -831,6 +831,7 @@ struct kvm_ppc_smmu_info {#define KVM_CAP_GUEST_DEBUG_HW_WPS 120#define KVM_CAP_SPLIT_IRQCHIP 121#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122 +#define KVM_CAP_S390_BPB 152#ifdef KVM_CAP_IRQ_ROUTING
Signature · 1 line
2.13.5
Greg Kroah-Hartman
maintainerRe: [PATCH 4.4 12/50] KVM: s390: wire up bpb feature
Quoted 154 lines · Martin Schwidefsky
Quoted 18 lines · On Fri, 27 Apr 2018 17:53:46 +0200 Christian Borntraeger…
Quoted 17 lines · Greg Kroah-Hartman
Quoted 16 lines · Greg Kroah-Hartman
Quoted 11 lines · Christian Borntraeger
Quoted 8 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
From: Christian Borntraeger <[email protected]>
Ick, that is wrong right there, my scripts messed up, this should not have 2 author lines :(
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
I'll go look at all of these, odds are it made the same error everywhere...
Yes, I've now fixed that up in the queue.
As this patch backport was also functionally incorrect and Martin is already away do you want me to send an updated version?
Checked my 4.4 backport git branch and indeed the hunk is misplaced. Sometime I wonder about the patch tool and the hickups it can produce.
My take on the replacement patch looks as follows:
---
Quoted 1 line
From
82f20b6237a8d04378c8f4a1614bf32a6c8d8a8bMon Sep 17 00:00:00 2001From: Christian Borntraeger <[email protected]>
Date: Wed, 17 Jan 2018 14:44:34 +0100
Subject: [PATCH 03/18] KVM: s390: wire up bpb feature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit[ Upstream commit
35b3fde6203b932b2b1a5b53b3d8808abc9c4f60]The new firmware interfaces for branch prediction behaviour changes are transparently available for the guest. Nevertheless, there is new state attached that should be migrated and properly resetted. Provide a mechanism for handling reset, migration and VSIE.
Signed-off-by Christian Borntraeger <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Cornelia Huck <[email protected]>[Changed capability number to 152. - Radim]Signed-off-by Radim Krčmář <[email protected]>Signed-off-by Martin Schwidefsky <[email protected]>--- arch/s390/include/asm/kvm_host.h | 3 ++- arch/s390/include/uapi/asm/kvm.h | 3 +++ arch/s390/kvm/kvm-s390.c | 12 ++++++++++++ include/uapi/linux/kvm.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-)arch/s390/include/asm/kvm_host.h +2
-1@@ -136,7 +136,8 @@ struct kvm_s390_sie_block {__u16 ipa;/* 0x0056 */ __u32 ipb;/* 0x0058 */ __u32 scaoh;/* 0x005c */ -__u8 reserved60;/* 0x0060 */ +#define FPF_BPBC 0x20 +__u8 fpf;/* 0x0060 */ __u8 ecb;/* 0x0061 */ __u8 ecb2;/* 0x0062 */ #define ECB3_AES 0x04arch/s390/include/uapi/asm/kvm.h +3
-0@@ -151,6 +151,7 @@ struct kvm_guest_debug_arch {#define KVM_SYNC_ARCH0 (1UL << 4)#define KVM_SYNC_PFAULT (1UL << 5)#define KVM_SYNC_VRS (1UL << 6) +#define KVM_SYNC_BPBC (1UL << 10)/* definition of registers in kvm_run */ struct kvm_sync_regs {__u64 prefix;/* prefix register */ @@ -168,6 +169,8 @@ struct kvm_sync_regs {__u64 vrs[32 ][2 ];/* vector registers */ __u8 reserved[512 ];/* for future vector expansion */ __u32 fpc;/* only valid with vector registers */ + __u8 bpbc : 1; /* bp mode */ + __u8 reserved2 : 7; };#define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1)arch/s390/kvm/kvm-s390.c +12
-0@@ -257,6 +257,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)case KVM_CAP_S390_VECTOR_REGISTERS : r =MACHINE_HAS_VX ;break ; +case KVM_CAP_S390_BPB : + r =test_facility (82 ); +break ;default : r =0 ; }@@ -1262,6 +1265,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)KVM_SYNC_CRS |KVM_SYNC_ARCH0 |KVM_SYNC_PFAULT ; +if (test_kvm_facility (vcpu->kvm,82 )) + vcpu->run->kvm_valid_regs |=KVM_SYNC_BPBC ;if (test_kvm_facility (vcpu->kvm,129 )) vcpu->run->kvm_valid_regs |=KVM_SYNC_VRS ;@@ -1327,6 +1332,7 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu) current->thread.fpu.fpc =0 ; vcpu->arch.sie_block->gbea =1 ; vcpu->arch.sie_block->pp =0 ; + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; vcpu->arch.pfault_token =KVM_S390_PFAULT_TOKEN_INVALID ;kvm_clear_async_pf_completion_queue (vcpu);if (!kvm_s390_user_cpu_state_ctrl (vcpu->kvm))@@ -2145,6 +2151,11 @@ static void sync_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)if (vcpu->arch.pfault_token ==KVM_S390_PFAULT_TOKEN_INVALID )kvm_clear_async_pf_completion_queue (vcpu); } +if ((kvm_run->kvm_dirty_regs &KVM_SYNC_BPBC ) && +test_kvm_facility (vcpu->kvm,82 )) { + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; + vcpu->arch.sie_block->fpf |= kvm_run->s.regs.bpbc ?FPF_BPBC :0 ; + } kvm_run->kvm_dirty_regs =0 ; }@@ -2162,6 +2173,7 @@ static void store_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) kvm_run->s.regs.pft = vcpu->arch.pfault_token; kvm_run->s.regs.pfs = vcpu->arch.pfault_select; kvm_run->s.regs.pfc = vcpu->arch.pfault_compare; + kvm_run->s.regs.bpbc = (vcpu->arch.sie_block->fpf &FPF_BPBC ) ==FPF_BPBC ; }int kvm_arch_vcpu_ioctl_run (struct kvm_vcpu *vcpu,struct kvm_run *kvm_run)include/uapi/linux/kvm.h +0
-0
include/uapi/linux/kvm.h struct kvm_ppc_smmu_info { · line 837
Quoted 7 lines
include/uapi/linux/kvm.h +1
-0@@ -831,6 +831,7 @@ struct kvm_ppc_smmu_info {#define KVM_CAP_GUEST_DEBUG_HW_WPS 120#define KVM_CAP_SPLIT_IRQCHIP 121#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122 +#define KVM_CAP_S390_BPB 152#ifdef KVM_CAP_IRQ_ROUTING
Did I include the correct version in the latest release, or do I need to do a revert and add this one in?
thanks,
greg k-h
Re: [PATCH 4.4 12/50] KVM: s390: wire up bpb feature
Quoted 160 lines · Greg Kroah-Hartman
Quoted 159 lines · Martin Schwidefsky
Quoted 18 lines · On Fri, 27 Apr 2018 17:53:46 +0200 Christian Borntraeger…
Quoted 17 lines · Greg Kroah-Hartman
Quoted 16 lines · Greg Kroah-Hartman
Quoted 11 lines · Christian Borntraeger
Quoted 8 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
From: Christian Borntraeger <[email protected]>
Ick, that is wrong right there, my scripts messed up, this should not have 2 author lines :(
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
I'll go look at all of these, odds are it made the same error everywhere...
Yes, I've now fixed that up in the queue.
As this patch backport was also functionally incorrect and Martin is already away do you want me to send an updated version?
Checked my 4.4 backport git branch and indeed the hunk is misplaced. Sometime I wonder about the patch tool and the hickups it can produce.
My take on the replacement patch looks as follows:
---
Quoted 1 line
From
82f20b6237a8d04378c8f4a1614bf32a6c8d8a8bMon Sep 17 00:00:00 2001From: Christian Borntraeger <[email protected]>
Date: Wed, 17 Jan 2018 14:44:34 +0100
Subject: [PATCH 03/18] KVM: s390: wire up bpb feature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit[ Upstream commit
35b3fde6203b932b2b1a5b53b3d8808abc9c4f60]The new firmware interfaces for branch prediction behaviour changes are transparently available for the guest. Nevertheless, there is new state attached that should be migrated and properly resetted. Provide a mechanism for handling reset, migration and VSIE.
Signed-off-by Christian Borntraeger <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Cornelia Huck <[email protected]>[Changed capability number to 152. - Radim]Signed-off-by Radim Krčmář <[email protected]>Signed-off-by Martin Schwidefsky <[email protected]>--- arch/s390/include/asm/kvm_host.h | 3 ++- arch/s390/include/uapi/asm/kvm.h | 3 +++ arch/s390/kvm/kvm-s390.c | 12 ++++++++++++ include/uapi/linux/kvm.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-)arch/s390/include/asm/kvm_host.h +2
-1@@ -136,7 +136,8 @@ struct kvm_s390_sie_block {__u16 ipa;/* 0x0056 */ __u32 ipb;/* 0x0058 */ __u32 scaoh;/* 0x005c */ -__u8 reserved60;/* 0x0060 */ +#define FPF_BPBC 0x20 +__u8 fpf;/* 0x0060 */ __u8 ecb;/* 0x0061 */ __u8 ecb2;/* 0x0062 */ #define ECB3_AES 0x04arch/s390/include/uapi/asm/kvm.h +3
-0@@ -151,6 +151,7 @@ struct kvm_guest_debug_arch {#define KVM_SYNC_ARCH0 (1UL << 4)#define KVM_SYNC_PFAULT (1UL << 5)#define KVM_SYNC_VRS (1UL << 6) +#define KVM_SYNC_BPBC (1UL << 10)/* definition of registers in kvm_run */ struct kvm_sync_regs {__u64 prefix;/* prefix register */ @@ -168,6 +169,8 @@ struct kvm_sync_regs {__u64 vrs[32 ][2 ];/* vector registers */ __u8 reserved[512 ];/* for future vector expansion */ __u32 fpc;/* only valid with vector registers */ + __u8 bpbc : 1; /* bp mode */ + __u8 reserved2 : 7; };#define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1)arch/s390/kvm/kvm-s390.c +12
-0@@ -257,6 +257,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)case KVM_CAP_S390_VECTOR_REGISTERS : r =MACHINE_HAS_VX ;break ; +case KVM_CAP_S390_BPB : + r =test_facility (82 ); +break ;default : r =0 ; }@@ -1262,6 +1265,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)KVM_SYNC_CRS |KVM_SYNC_ARCH0 |KVM_SYNC_PFAULT ; +if (test_kvm_facility (vcpu->kvm,82 )) + vcpu->run->kvm_valid_regs |=KVM_SYNC_BPBC ;if (test_kvm_facility (vcpu->kvm,129 )) vcpu->run->kvm_valid_regs |=KVM_SYNC_VRS ;@@ -1327,6 +1332,7 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu) current->thread.fpu.fpc =0 ; vcpu->arch.sie_block->gbea =1 ; vcpu->arch.sie_block->pp =0 ; + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; vcpu->arch.pfault_token =KVM_S390_PFAULT_TOKEN_INVALID ;kvm_clear_async_pf_completion_queue (vcpu);if (!kvm_s390_user_cpu_state_ctrl (vcpu->kvm))@@ -2145,6 +2151,11 @@ static void sync_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)if (vcpu->arch.pfault_token ==KVM_S390_PFAULT_TOKEN_INVALID )kvm_clear_async_pf_completion_queue (vcpu); } +if ((kvm_run->kvm_dirty_regs &KVM_SYNC_BPBC ) && +test_kvm_facility (vcpu->kvm,82 )) { + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; + vcpu->arch.sie_block->fpf |= kvm_run->s.regs.bpbc ?FPF_BPBC :0 ; + } kvm_run->kvm_dirty_regs =0 ; }@@ -2162,6 +2173,7 @@ static void store_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) kvm_run->s.regs.pft = vcpu->arch.pfault_token; kvm_run->s.regs.pfs = vcpu->arch.pfault_select; kvm_run->s.regs.pfc = vcpu->arch.pfault_compare; + kvm_run->s.regs.bpbc = (vcpu->arch.sie_block->fpf &FPF_BPBC ) ==FPF_BPBC ; }int kvm_arch_vcpu_ioctl_run (struct kvm_vcpu *vcpu,struct kvm_run *kvm_run)include/uapi/linux/kvm.h +1
-0@@ -831,6 +831,7 @@ struct kvm_ppc_smmu_info {#define KVM_CAP_GUEST_DEBUG_HW_WPS 120#define KVM_CAP_SPLIT_IRQCHIP 121#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122 +#define KVM_CAP_S390_BPB 152
Quoted 5 lines
include/uapi/linux/kvm.h struct kvm_ppc_smmu_info { · line 837
Quoted 2 lines
include/uapi/linux/kvm.h +0
-0#ifdef KVM_CAP_IRQ_ROUTING Did I include the correct version in the latest release, or do I need to do a revert and add this one in?
Martins backport and my backport looks almost identical, so you can keep mine.
PATCH 1/1 KVM: s390: wire up bpb feature
In reply to Greg Kroah-HartmanFrom: Christian Borntraeger <[email protected]>
[ Upstream commit 35b3fde6203b932b2b1a5b53b3d8808abc9c4f60 ]
The new firmware interfaces for branch prediction behaviour changes are transparently available for the guest. Nevertheless, there is new state attached that should be migrated and properly resetted. Provide a mechanism for handling reset, migration and VSIE.
--- arch/s390/include/asm/kvm_host.h | 3 ++- arch/s390/include/uapi/asm/kvm.h | 3 +++ arch/s390/kvm/kvm-s390.c | 13 ++++++++++++- include/uapi/linux/kvm.h | 1 + 4 files changed, 18 insertions(+), 2 deletions(-)
arch/s390/include/asm/kvm_host.h +2 -1
@@ -136,7 +136,8 @@ struct kvm_s390_sie_block {__u16 ipa;/* 0x0056 */ __u32 ipb;/* 0x0058 */ __u32 scaoh;/* 0x005c */ -__u8 reserved60;/* 0x0060 */ +#define FPF_BPBC 0x20 +__u8 fpf;/* 0x0060 */ __u8 ecb;/* 0x0061 */ __u8 ecb2;/* 0x0062 */ #define ECB3_AES 0x04
arch/s390/include/uapi/asm/kvm.h +3 -0
@@ -151,6 +151,7 @@ struct kvm_guest_debug_arch {#define KVM_SYNC_ARCH0 (1UL << 4)#define KVM_SYNC_PFAULT (1UL << 5)#define KVM_SYNC_VRS (1UL << 6) +#define KVM_SYNC_BPBC (1UL << 10)/* definition of registers in kvm_run */ struct kvm_sync_regs {__u64 prefix;/* prefix register */
@@ -168,6 +169,8 @@ struct kvm_sync_regs {__u64 vrs[32 ][2 ];/* vector registers */ __u8 reserved[512 ];/* for future vector expansion */ __u32 fpc;/* only valid with vector registers */ + __u8 bpbc : 1; /* bp mode */ + __u8 reserved2 : 7; };#define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1)
arch/s390/kvm/kvm-s390.c +12 -0
@@ -257,6 +257,9 @@ int kvm_vm_ioctl_check_extension(structcase KVM_CAP_S390_VECTOR_REGISTERS : r =MACHINE_HAS_VX ;break ; +case KVM_CAP_S390_BPB : + r =test_facility (82 ); +break ;default : r =0 ; }
@@ -1264,6 +1267,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *KVM_SYNC_PFAULT ;if (test_kvm_facility (vcpu->kvm,129 )) vcpu->run->kvm_valid_regs |=KVM_SYNC_VRS ; +if (test_kvm_facility (vcpu->kvm,82 )) + vcpu->run->kvm_valid_regs |=KVM_SYNC_BPBC ;if (kvm_is_ucontrol (vcpu->kvm))return __kvm_ucontrol_vcpu_init (vcpu);
@@ -1327,6 +1332,7 @@ static void kvm_s390_vcpu_initial_reset( current->thread.fpu.fpc =0 ; vcpu->arch.sie_block->gbea =1 ; vcpu->arch.sie_block->pp =0 ; + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; vcpu->arch.pfault_token =KVM_S390_PFAULT_TOKEN_INVALID ;kvm_clear_async_pf_completion_queue (vcpu);if (!kvm_s390_user_cpu_state_ctrl (vcpu->kvm))
@@ -2145,6 +2151,11 @@ static void sync_regs(struct kvm_vcpu *vif (vcpu->arch.pfault_token ==KVM_S390_PFAULT_TOKEN_INVALID )kvm_clear_async_pf_completion_queue (vcpu); } +if ((kvm_run->kvm_dirty_regs &KVM_SYNC_BPBC ) && +test_kvm_facility (vcpu->kvm,82 )) { + vcpu->arch.sie_block->fpf &= ~FPF_BPBC ; + vcpu->arch.sie_block->fpf |= kvm_run->s.regs.bpbc ?FPF_BPBC :0 ; + } kvm_run->kvm_dirty_regs =0 ; }
@@ -2162,6 +2173,7 @@ static void store_regs(struct kvm_vcpu * kvm_run->s.regs.pft = vcpu->arch.pfault_token; kvm_run->s.regs.pfs = vcpu->arch.pfault_select; kvm_run->s.regs.pfc = vcpu->arch.pfault_compare; + kvm_run->s.regs.bpbc = (vcpu->arch.sie_block->fpf &FPF_BPBC ) ==FPF_BPBC ; }int kvm_arch_vcpu_ioctl_run (struct kvm_vcpu *vcpu,struct kvm_run *kvm_run)
include/uapi/linux/kvm.h +1 -0
@@ -831,6 +831,7 @@ struct kvm_ppc_smmu_info {#define KVM_CAP_GUEST_DEBUG_HW_WPS 120#define KVM_CAP_SPLIT_IRQCHIP 121#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122 +#define KVM_CAP_S390_BPB 152#ifdef KVM_CAP_IRQ_ROUTING
Greg Kroah-Hartman
maintainerRe: [fixed Patch] KVM: s390: wire up bpb feature
Quoted 9 lines · Christian Borntraeger
From: Christian Borntraeger <[email protected]>
[ Upstream commit
35b3fde6203b932b2b1a5b53b3d8808abc9c4f60]The new firmware interfaces for branch prediction behaviour changes are transparently available for the guest. Nevertheless, there is new state attached that should be migrated and properly resetted. Provide a mechanism for handling reset, migration and VSIE.
Quoted 5 lines
Signed-off-by Christian Borntraeger <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Cornelia Huck <[email protected]>[Changed capability number to 152. - Radim]Signed-off-by Radim Krčmář <[email protected]>
Thanks for this, now updated.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 13/50 s390: scrub registers on kernel entry and KVM exit
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit 7041d28115e91f2144f811ffe8a195c696b1e1d0 ]
Clear all user space registers on entry to the kernel and all KVM guest registers on KVM guest exit if the register does not contain either a parameter or a result value.
--- arch/s390/kernel/entry.S | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
arch/s390/kernel/entry.S +47 -0
@@ -244,6 +244,12 @@ ENTRY(sie64a) sie_exit: lg %r14,__SF_EMPTY+8(%r15) # load guest register save area stmg %r0,%r13,0(%r14) # save guest gprs 0-13 + xgr %r0,%r0 # clear guest registers to + xgr %r1,%r1 # prevent speculative use + xgr %r2,%r2 + xgr %r3,%r3 + xgr %r4,%r4 + xgr %r5,%r5 lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers lg %r2,__SF_EMPTY+16(%r15) # return exit reason code br %r14
@@ -277,6 +283,8 @@ ENTRY(system_call) .Lsysc_vtime: UPDATE_VTIME %r10,%r13,__LC_SYNC_ENTER_TIMER stmg %r0,%r7,__PT_R0(%r11) + # clear user controlled register to prevent speculative use + xgr %r0,%r0 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC mvc __PT_PSW(16,%r11),__LC_SVC_OLD_PSW mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC
@@ -504,6 +512,15 @@ ENTRY(pgm_check_handler) mvc __THREAD_trap_tdb(256,%r14),0(%r13) 3: la %r11,STACK_FRAME_OVERHEAD(%r15) stmg %r0,%r7,__PT_R0(%r11) + # clear user controlled registers to prevent speculative use + xgr %r0,%r0 + xgr %r1,%r1 + xgr %r2,%r2 + xgr %r3,%r3 + xgr %r4,%r4 + xgr %r5,%r5 + xgr %r6,%r6 + xgr %r7,%r7 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC stmg %r8,%r9,__PT_PSW(%r11) mvc __PT_INT_CODE(4,%r11),__LC_PGM_ILC
@@ -567,6 +584,16 @@ ENTRY(io_int_handler) lmg %r8,%r9,__LC_IO_OLD_PSW SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER stmg %r0,%r7,__PT_R0(%r11) + # clear user controlled registers to prevent speculative use + xgr %r0,%r0 + xgr %r1,%r1 + xgr %r2,%r2 + xgr %r3,%r3 + xgr %r4,%r4 + xgr %r5,%r5 + xgr %r6,%r6 + xgr %r7,%r7 + xgr %r10,%r10 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC stmg %r8,%r9,__PT_PSW(%r11) mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID
@@ -742,6 +769,16 @@ ENTRY(ext_int_handler) lmg %r8,%r9,__LC_EXT_OLD_PSW SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER stmg %r0,%r7,__PT_R0(%r11) + # clear user controlled registers to prevent speculative use + xgr %r0,%r0 + xgr %r1,%r1 + xgr %r2,%r2 + xgr %r3,%r3 + xgr %r4,%r4 + xgr %r5,%r5 + xgr %r6,%r6 + xgr %r7,%r7 + xgr %r10,%r10 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC stmg %r8,%r9,__PT_PSW(%r11) lghi %r1,__LC_EXT_PARAMS2
@@ -908,6 +945,16 @@ ENTRY(mcck_int_handler) .Lmcck_skip: lghi %r14,__LC_GPREGS_SAVE_AREA+64 stmg %r0,%r7,__PT_R0(%r11) + # clear user controlled registers to prevent speculative use + xgr %r0,%r0 + xgr %r1,%r1 + xgr %r2,%r2 + xgr %r3,%r3 + xgr %r4,%r4 + xgr %r5,%r5 + xgr %r6,%r6 + xgr %r7,%r7 + xgr %r10,%r10 mvc __PT_R8(64,%r11),0(%r14) stmg %r8,%r9,__PT_PSW(%r11) xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
Greg Kroah-Hartman
maintainerPATCH 14/50 s390: add optimized array_index_mask_nospec
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit e2dd833389cc4069a96b57bdd24227b5f52288f5 ]
Add an optimized version of the array_index_mask_nospec function for s390 based on a compare and a subtract with borrow.
--- arch/s390/include/asm/barrier.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/s390/include/asm/barrier.h +24 -0
@@ -53,4 +53,28 @@ do { \ ___p1; \ }) +/** +* array_index_mask_nospec - generate a mask for array_idx() that is +* ~0UL when the bounds check succeeds and 0 otherwise +* @index: array element index +* @size: number of elements in array +*/ +#define array_index_mask_nospec array_index_mask_nospec +static inline unsigned long array_index_mask_nospec (unsigned long index, +unsigned long size) +{ +unsigned long mask; + +if (__builtin_constant_p (size) && size >0 ) { + asm(" clgr %2,%1\n" +" slbgr %0,%0\n" + :"=d" (mask) :"d" (size-1 ),"d" (index) :"cc" ); +return mask; + } + asm(" clgr %1,%2\n" +" slbgr %0,%0\n" + :"=d" (mask) :"d" (size),"d" (index) :"cc" ); +return ~mask; +} +#endif /* __ASM_BARRIER_H */
Greg Kroah-Hartman
maintainerPATCH 15/50 s390/alternative: use a copy of the facility bit mask
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit cf1489984641369611556bf00c48f945c77bcf02 ]
To be able to switch off specific CPU alternatives with kernel parameters make a copy of the facility bit mask provided by STFLE and use the copy for the decision to apply an alternative.
--- arch/s390/include/asm/facility.h | 18 ++++++++++++++++++ arch/s390/include/asm/lowcore.h | 3 ++- arch/s390/kernel/alternative.c | 3 ++- arch/s390/kernel/early.c | 3 +++ arch/s390/kernel/setup.c | 4 +++- arch/s390/kernel/smp.c | 4 +++- 6 files changed, 31 insertions(+), 4 deletions(-)
arch/s390/include/asm/facility.h +18 -0
@@ -13,6 +13,24 @@#define MAX_FACILITY_BIT (256*8)/* stfle_fac_list has 256 bytes */ +static inline void __set_facility (unsigned long nr,void *facilities) +{ +unsigned char *ptr = (unsigned char *) facilities; + +if (nr >=MAX_FACILITY_BIT ) +return ; + ptr[nr >>3 ] |=0x80 >> (nr &7 ); +} + +static inline void __clear_facility (unsigned long nr,void *facilities) +{ +unsigned char *ptr = (unsigned char *) facilities; + +if (nr >=MAX_FACILITY_BIT ) +return ; + ptr[nr >>3 ] &= ~(0x80 >> (nr &7 )); +} +static inline int __test_facility (unsigned long nr,void *facilities) {unsigned char *ptr;
arch/s390/include/asm/lowcore.h +2 -1
@@ -170,7 +170,8 @@ struct _lowcore {__u8 pad_0x0e20[0x0f00 -0x0e20 ];/* 0x0e20 */ /* Extended facility list */ -__u64 stfle_fac_list[32 ];/* 0x0f00 */ +__u64 stfle_fac_list[16 ];/* 0x0f00 */ +__u64 alt_stfle_fac_list[16 ];/* 0x0f80 */ __u8 pad_0x1000[0x11b0 -0x1000 ];/* 0x1000 */ /* Pointer to vector register save area */
arch/s390/kernel/alternative.c +2 -1
@@ -74,7 +74,8 @@ static void __init_or_module __apply_alt instr = (u8 *)&a->instr_offset + a->instr_offset; replacement = (u8 *)&a->repl_offset + a->repl_offset; -if (!test_facility (a->facility)) +if (!__test_facility (a->facility, + S390_lowcore.alt_stfle_fac_list))continue ;if (unlikely (a->instrlen %2 || a->replacementlen %2 )) {
arch/s390/kernel/early.c +3 -0
@@ -279,6 +279,9 @@ static noinline __init void setup_facili {stfle (S390_lowcore.stfle_fac_list,ARRAY_SIZE (S390_lowcore.stfle_fac_list)); +memcpy (S390_lowcore.alt_stfle_fac_list, + S390_lowcore.stfle_fac_list, +sizeof (S390_lowcore.alt_stfle_fac_list)); }static __init void detect_diag9c (void )
arch/s390/kernel/setup.c +3 -1
@@ -334,7 +334,9 @@ static void __init setup_lowcore(void) lc->machine_flags = S390_lowcore.machine_flags; lc->stfl_fac_list = S390_lowcore.stfl_fac_list;memcpy (lc->stfle_fac_list, S390_lowcore.stfle_fac_list, -MAX_FACILITY_BIT /8 ); +sizeof (lc->stfle_fac_list)); +memcpy (lc->alt_stfle_fac_list, S390_lowcore.alt_stfle_fac_list, +sizeof (lc->alt_stfle_fac_list));if (MACHINE_HAS_VX ) lc->vector_save_area_addr = (unsigned long ) &lc->vector_save_area;
arch/s390/kernel/smp.c +3 -1
@@ -250,7 +250,9 @@ static void pcpu_prepare_secondary(struc__ctl_store (lc->cregs_save_area,0 ,15 );save_access_regs ((unsigned int *) lc->access_regs_save_area);memcpy (lc->stfle_fac_list, S390_lowcore.stfle_fac_list, -MAX_FACILITY_BIT /8 ); +sizeof (lc->stfle_fac_list)); +memcpy (lc->alt_stfle_fac_list, S390_lowcore.alt_stfle_fac_list, +sizeof (lc->alt_stfle_fac_list)); }static void pcpu_attach_task (struct pcpu *pcpu,struct task_struct *tsk)
Re: [PATCH 4.4 15/50] s390/alternative: use a copy of the facility bit mask
Quoted 12 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit
cf1489984641369611556bf00c48f945c77bcf02]To be able to switch off specific CPU alternatives with kernel parameters make a copy of the facility bit mask provided by STFLE and use the copy for the decision to apply an alternative.
...
arch/s390/include/asm/facility.h line 14
Quoted 5 lines
arch/s390/include/asm/facility.h +0
-0@@ -13,6 +13,24 @@#define MAX_FACILITY_BIT (256*8)/* stfle_fac_list has 256 bytes */
I wonder if the below (plus __test_facility) is correct in 4.4, given MAX_FACILITY_BIT is defined as such and not as sizeof(stfle_fac_list *
8) as in upstream?
Quoted 24 lines
arch/s390/include/asm/facility.h +18
-0+static inline void __set_facility (unsigned long nr,void *facilities) +{ +unsigned char *ptr = (unsigned char *) facilities; + +if (nr >=MAX_FACILITY_BIT ) +return ; + ptr[nr >>3 ] |=0x80 >> (nr &7 ); +} + +static inline void __clear_facility (unsigned long nr,void *facilities) +{ +unsigned char *ptr = (unsigned char *) facilities; + +if (nr >=MAX_FACILITY_BIT ) +return ; + ptr[nr >>3 ] &= ~(0x80 >> (nr &7 )); +} +static inline int __test_facility (unsigned long nr,void *facilities) {unsigned char *ptr;
arch/s390/include/asm/lowcore.h struct _lowcore { · line 175
Quoted 7 lines
arch/s390/include/asm/lowcore.h +2
-1@@ -170,7 +170,8 @@ struct _lowcore {__u8 pad_0x0e20[0x0f00 -0x0e20 ];/* 0x0e20 */ /* Extended facility list */ -__u64 stfle_fac_list[32 ];/* 0x0f00 */ +__u64 stfle_fac_list[16 ];/* 0x0f00 */ +__u64 alt_stfle_fac_list[16 ];/* 0x0f80 */ __u8 pad_0x1000[0x11b0 -0x1000 ];/* 0x1000 */
thanks,
Signature · 2 lines
js suse labs
Re: [PATCH 4.4 15/50] s390/alternative: use a copy of the facility bit mask
Quoted 18 lines · Jiri Slaby
Quoted 12 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit
cf1489984641369611556bf00c48f945c77bcf02]To be able to switch off specific CPU alternatives with kernel parameters make a copy of the facility bit mask provided by STFLE and use the copy for the decision to apply an alternative.
...
Quoted 4 lines
arch/s390/include/asm/facility.h +0
-0@@ -13,6 +13,24 @@
Quoted 5 lines
arch/s390/include/asm/facility.h line 14
Quoted 1 line
arch/s390/include/asm/facility.h +0
-0#define MAX_FACILITY_BIT (256*8)/* stfle_fac_list has 256 bytes */ I wonder if the below (plus
__test_facility) is correct in 4.4, givenMAX_FACILITY_BITis defined as such and not as sizeof(stfle_fac_list *
8) as in upstream?
IOW, we should include this 4.12-commit in 4.4 too:
commit 6f5165e864d240d15675cc2fb5a369d57e1f60d0
Author: Heiko Carstens <[email protected]> Date: Mon Mar 20 14:29:50 2017 +0100
s390/facilites: use stfle_fac_list array size for MAX_FACILITY_BIT
thanks,
Signature · 2 lines
js suse labs
Greg Kroah-Hartman
maintainerRe: [PATCH 4.4 15/50] s390/alternative: use a copy of the facility bit mask
In reply to Jiri SlabyQuoted 18 lines · Jiri Slaby
Quoted 12 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit
cf1489984641369611556bf00c48f945c77bcf02]To be able to switch off specific CPU alternatives with kernel parameters make a copy of the facility bit mask provided by STFLE and use the copy for the decision to apply an alternative.
...
Quoted 4 lines
arch/s390/include/asm/facility.h +0
-0@@ -13,6 +13,24 @@
Quoted 5 lines
arch/s390/include/asm/facility.h line 14
Quoted 1 line
arch/s390/include/asm/facility.h +0
-0#define MAX_FACILITY_BIT (256*8)/* stfle_fac_list has 256 bytes */ I wonder if the below (plus
__test_facility) is correct in 4.4, givenMAX_FACILITY_BITis defined as such and not as sizeof(stfle_fac_list *
8) as in upstream?
I'm going to defer to Marin here, as he did the backport... Martin?
thanks,
greg k-h
Re: [PATCH 4.4 15/50] s390/alternative: use a copy of the facility bit mask
Quoted 19 lines · On Fri, 4 May 2018 15:18:08 -0700 Greg Kroah-Hartman…
Quoted 18 lines · Jiri Slaby
Quoted 12 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit
cf1489984641369611556bf00c48f945c77bcf02]To be able to switch off specific CPU alternatives with kernel parameters make a copy of the facility bit mask provided by STFLE and use the copy for the decision to apply an alternative.
...
Quoted 4 lines
arch/s390/include/asm/facility.h +0
-0@@ -13,6 +13,24 @@
Quoted 8 lines
Quoted 5 lines
arch/s390/include/asm/facility.h line 14
Quoted 1 line
arch/s390/include/asm/facility.h +0
-0#define MAX_FACILITY_BIT (256*8)/* stfle_fac_list has 256 bytes */ I wonder if the below (plus
__test_facility) is correct in 4.4, givenMAX_FACILITY_BITis defined as such and not as sizeof(stfle_fac_list *
8) as in upstream?I'm going to defer to Marin here, as he did the backport... Martin?
Good catch. With MAX_FACILITY_BIT == 2048 and the patch applied the result for a test_facility/__test_facility call with a facility number >= 1024 would give an incorrect result. Fortunately there are no such calls in the current 4.4 kernel source. And there are no facilities defined with bit numbers this large, so even out-of-tree code would not do this if it is sane.
To correct this the MAX_FACILITY_BIT define needs to be reduced to 1024 which would require the patch pointed out be Heiko:
commit 6f5165e864d240d15675cc2fb5a369d57e1f60d0
Author: Heiko Carstens <[email protected]> Date: Mon Mar 20 14:29:50 2017 +0100
s390/facilites: use stfle_fac_list array size for MAX_FACILITY_BIT
I would say yes, it *does* make sense to include this patch even if it does not fix anything.
Signature · 4 lines
blue skies, Martin. "Reality continues to ruin my life." - Calvin.
Greg Kroah-Hartman
maintainerRe: [PATCH 4.4 15/50] s390/alternative: use a copy of the facility bit mask
Quoted 41 lines · Martin Schwidefsky
Quoted 19 lines · On Fri, 4 May 2018 15:18:08 -0700 Greg Kroah-Hartman…
Quoted 18 lines · Jiri Slaby
Quoted 12 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit
cf1489984641369611556bf00c48f945c77bcf02]To be able to switch off specific CPU alternatives with kernel parameters make a copy of the facility bit mask provided by STFLE and use the copy for the decision to apply an alternative.
...
Quoted 4 lines
arch/s390/include/asm/facility.h +0
-0@@ -13,6 +13,24 @@Quoted 8 lines
Quoted 5 lines
arch/s390/include/asm/facility.h line 14
Quoted 1 line
arch/s390/include/asm/facility.h +0
-0#define MAX_FACILITY_BIT (256*8)/* stfle_fac_list has 256 bytes */ I wonder if the below (plus
__test_facility) is correct in 4.4, givenMAX_FACILITY_BITis defined as such and not as sizeof(stfle_fac_list *
8) as in upstream?I'm going to defer to Marin here, as he did the backport... Martin?
Good catch. With
MAX_FACILITY_BIT== 2048 and the patch applied the result for a test_facility/__test_facility call with a facility number >= 1024 would give an incorrect result. Fortunately there are no such calls in the current 4.4 kernel source. And there are no facilities defined with bit numbers this large, so even out-of-tree code would not do this if it is sane.To correct this the
MAX_FACILITY_BITdefine needs to be reduced to 1024 which would require the patch pointed out be Heiko:
Quoted 8 lines
commit
6f5165e864d240d15675cc2fb5a369d57e1f60d0Author: Heiko Carstens <[email protected]> Date: Mon Mar 20 14:29:50 2017 +0100s390/facilites: use
stfle_fac_listarray size forMAX_FACILITY_BITI would say yes, it *does* make sense to include this patch even if it does not fix anything.
Ok, I've now queued this up for 4.4.y and 4.9.y, thanks!
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 4.4 15/50] s390/alternative: use a copy of the facility bit mask
Quoted 46 lines · Greg Kroah-Hartman
Quoted 45 lines · Martin Schwidefsky
Quoted 19 lines · On Fri, 4 May 2018 15:18:08 -0700 Greg Kroah-Hartman…
Quoted 18 lines · Jiri Slaby
Quoted 12 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit
cf1489984641369611556bf00c48f945c77bcf02]To be able to switch off specific CPU alternatives with kernel parameters make a copy of the facility bit mask provided by STFLE and use the copy for the decision to apply an alternative.
...
Quoted 4 lines
arch/s390/include/asm/facility.h +0
-0@@ -13,6 +13,24 @@Quoted 8 lines
Quoted 5 lines
arch/s390/include/asm/facility.h line 14
Quoted 1 line
arch/s390/include/asm/facility.h +0
-0#define MAX_FACILITY_BIT (256*8)/* stfle_fac_list has 256 bytes */ I wonder if the below (plus
__test_facility) is correct in 4.4, givenMAX_FACILITY_BITis defined as such and not as sizeof(stfle_fac_list *
8) as in upstream?I'm going to defer to Marin here, as he did the backport... Martin?
Good catch. With
MAX_FACILITY_BIT== 2048 and the patch applied the result for a test_facility/__test_facility call with a facility number >= 1024 would give an incorrect result. Fortunately there are no such calls in the current 4.4 kernel source. And there are no facilities defined with bit numbers this large, so even out-of-tree code would not do this if it is sane.To correct this the
MAX_FACILITY_BITdefine needs to be reduced to 1024 which would require the patch pointed out be Heiko:commit
6f5165e864d240d15675cc2fb5a369d57e1f60d0Author: Heiko Carstens <[email protected]> Date: Mon Mar 20 14:29:50 2017 +0100
Quoted 6 lines
Quoted 4 lines
s390/facilites: use
stfle_fac_listarray size forMAX_FACILITY_BITI would say yes, it *does* make sense to include this patch even if it does not fix anything.
Ok, I've now queued this up for 4.4.y and 4.9.y, thanks!
It breaks the build on 4.4.y, so I'm dropping it :(
If you think it's needed there, a working version would be nice :)
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 16/50 s390: add options to change branch prediction behaviour for the kernel
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit d768bd892fc8f066cd3aa000eb1867bcf32db0ee ]
Add the PPA instruction to the system entry and exit path to switch the kernel to a different branch prediction behaviour. The instructions are added via CPU alternatives and can be disabled with the "nospec" or the "nobp=0" kernel parameter. If the default behaviour selected with CONFIG_KERNEL_NOBP is set to "n" then the "nobp=1" parameter can be used to enable the changed kernel branch prediction.
--- arch/s390/Kconfig | 17 +++++++++++++ arch/s390/include/asm/processor.h | 1 arch/s390/kernel/alternative.c | 23 ++++++++++++++++++ arch/s390/kernel/early.c | 2 + arch/s390/kernel/entry.S | 48 ++++++++++++++++++++++++++++++++++++++ arch/s390/kernel/ipl.c | 1 arch/s390/kernel/smp.c | 2 + 7 files changed, 94 insertions(+)
arch/s390/Kconfig +17 -0
@@ -705,6 +705,23 @@ config SECCOMP If unsure, say Y. +config KERNEL_NOBP + def_bool n + prompt "Enable modified branch prediction for the kernel by default" + help + If this option is selected the kernel will switch to a modified + branch prediction mode if the firmware interface is available. + The modified branch prediction mode improves the behaviour in + regard to speculative execution. + + With the option enabled the kernel parameter "nobp=0" or "nospec" + can be used to run the kernel in the normal branch prediction mode. + + With the option disabled the modified branch prediction mode is + enabled with the "nobp=1" kernel parameter. + + If unsure, say N. + endmenu menu "Power Management"
arch/s390/include/asm/processor.h +1 -0
@@ -69,6 +69,7 @@ extern void s390_adjust_jiffies(void);extern const struct seq_operations cpuinfo_op;extern int sysctl_ieee_emulation_warnings;extern void execve_tail (void ); +extern void __bpon (void );/* * User space process size: 2GB for 31 bit, 4TB or 8PT for 64 bit.
arch/s390/kernel/alternative.c +23 -0
@@ -14,6 +14,29 @@ static int __init disable_alternative_inearly_param ("noaltinstr" , disable_alternative_instructions); +static int __init nobp_setup_early (char *str) +{ +bool enabled; +int rc; + + rc =kstrtobool (str, &enabled); +if (rc) +return rc; +if (enabled &&test_facility (82 )) +__set_facility (82 , S390_lowcore.alt_stfle_fac_list); +else +__clear_facility (82 , S390_lowcore.alt_stfle_fac_list); +return 0 ; +} +early_param ("nobp" , nobp_setup_early); + +static int __init nospec_setup_early (char *str) +{ +__clear_facility (82 , S390_lowcore.alt_stfle_fac_list); +return 0 ; +} +early_param ("nospec" , nospec_setup_early); +struct brcl_insn {u16 opc;s32 disp;
arch/s390/kernel/early.c +2 -0
@@ -282,6 +282,8 @@ static noinline __init void setup_facilimemcpy (S390_lowcore.alt_stfle_fac_list, S390_lowcore.stfle_fac_list,sizeof (S390_lowcore.alt_stfle_fac_list)); +if (!IS_ENABLED (CONFIG_KERNEL_NOBP )) +__clear_facility (82 , S390_lowcore.alt_stfle_fac_list); }static __init void detect_diag9c (void )
arch/s390/kernel/entry.S +48 -0
120 lines not on this page · raw message
arch/s390/kernel/ipl.c +1 -0
@@ -563,6 +563,7 @@ static struct kset *ipl_kset;static void __ipl_run (void *unused) { +__bpon ();diag308 (DIAG308_IPL ,NULL );if (MACHINE_IS_VM )__cpcmd ("IPL" ,NULL ,0 ,NULL );
arch/s390/kernel/smp.c +2 -0
@@ -301,6 +301,7 @@ static void pcpu_delegate(struct pcpu *pmem_assign_absolute (lc->restart_fn, (unsigned long ) func);mem_assign_absolute (lc->restart_data, (unsigned long ) data);mem_assign_absolute (lc->restart_source, source_cpu); +__bpon (); asmvolatile ("0: sigp 0,%0,%2 # sigp restart to target cpu\n" " brc 2,0b # busy, try again\n"
@@ -890,6 +891,7 @@ void __cpu_die(unsigned int cpu)void __noreturn cpu_die (void ) {idle_task_exit (); +__bpon ();pcpu_sigp_retry (pcpu_devices +smp_processor_id (),SIGP_STOP ,0 );for (;;) ; }
Greg Kroah-Hartman
maintainerPATCH 17/50 s390: run user space and KVM guests with modified branch prediction
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit 6b73044b2b0081ee3dd1cd6eaab7dee552601efb ]
Define TIF_ISOLATE_BP and TIF_ISOLATE_BP_GUEST and add the necessary plumbing in entry.S to be able to run user space and KVM guests with limited branch prediction.
To switch a user space process to limited branch prediction the s390_isolate_bp() function has to be call, and to run a vCPU of a KVM guest associated with the current task with limited branch prediction call s390_isolate_bp_guest().
--- arch/s390/include/asm/processor.h | 3 ++ arch/s390/include/asm/thread_info.h | 4 ++ arch/s390/kernel/entry.S | 49 +++++++++++++++++++++++++++++++++--- arch/s390/kernel/processor.c | 18 +++++++++++++ 4 files changed, 70 insertions(+), 4 deletions(-)
arch/s390/include/asm/processor.h +3 -0
@@ -316,6 +316,9 @@ extern void memcpy_absolute(void *, voidmemcpy_absolute (&(dest), &__tmp,sizeof (__tmp)); \ } +extern int s390_isolate_bp (void ); +extern int s390_isolate_bp_guest (void ); +#endif /* __ASSEMBLY__ */ #endif /* __ASM_S390_PROCESSOR_H */
arch/s390/include/asm/thread_info.h +4 -0
@@ -78,6 +78,8 @@ void arch_release_task_struct(struct tas#define TIF_SECCOMP 5/* secure computing */ #define TIF_SYSCALL_TRACEPOINT 6/* syscall tracepoint instrumentation */ #define TIF_UPROBE 7/* breakpointed or single-stepping */ +#define TIF_ISOLATE_BP 8/* Run process with isolated BP */ +#define TIF_ISOLATE_BP_GUEST 9/* Run KVM guests with isolated BP */ #define TIF_31BIT 16/* 32bit process */ #define TIF_MEMDIE 17/* is terminating due to OOM killer */ #define TIF_RESTORE_SIGMASK 18/* restore signal mask in do_signal() */
@@ -93,6 +95,8 @@ void arch_release_task_struct(struct tas#define _TIF_SECCOMP _BITUL(TIF_SECCOMP)#define _TIF_SYSCALL_TRACEPOINT _BITUL(TIF_SYSCALL_TRACEPOINT)#define _TIF_UPROBE _BITUL(TIF_UPROBE) +#define _TIF_ISOLATE_BP _BITUL(TIF_ISOLATE_BP) +#define _TIF_ISOLATE_BP_GUEST _BITUL(TIF_ISOLATE_BP_GUEST)#define _TIF_31BIT _BITUL(TIF_31BIT)#define _TIF_SINGLE_STEP _BITUL(TIF_SINGLE_STEP)
arch/s390/kernel/entry.S +45 -4
115 lines not on this page · raw message
arch/s390/kernel/processor.c +18 -0
@@ -13,6 +13,7 @@#include <linux/cpu.h> #include <asm/diag.h> #include <asm/elf.h> +#include <asm/facility.h> #include <asm/lowcore.h> #include <asm/param.h> #include <asm/smp.h>
@@ -113,3 +114,20 @@ const struct seq_operations cpuinfo_op = .show = show_cpuinfo, }; +int s390_isolate_bp (void ) +{ +if (!test_facility (82 )) +return -EOPNOTSUPP ; +set_thread_flag (TIF_ISOLATE_BP ); +return 0 ; +} +EXPORT_SYMBOL (s390_isolate_bp); + +int s390_isolate_bp_guest (void ) +{ +if (!test_facility (82 )) +return -EOPNOTSUPP ; +set_thread_flag (TIF_ISOLATE_BP_GUEST ); +return 0 ; +} +EXPORT_SYMBOL (s390_isolate_bp_guest);
Greg Kroah-Hartman
maintainerPATCH 18/50 s390: introduce execute-trampolines for branches
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit f19fbd5ed642dc31c809596412dab1ed56f2f156 ]
Add CONFIG_EXPOLINE to enable the use of the new -mindirect-branch= and -mfunction_return= compiler options to create a kernel fortified against the specte v2 attack.
With CONFIG_EXPOLINE=y all indirect branches will be issued with an execute type instruction. For z10 or newer the EXRL instruction will be used, for older machines the EX instruction. The typical indirect call
basr %r14,%r1
is replaced with a PC relative call to a new thunk
brasl %r14,__s390x_indirect_jump_r1
The thunk contains the EXRL/EX instruction to the indirect branch
__s390x_indirect_jump_r1:
exrl 0,0f j .
0: br %r1
The detour via the execute type instruction has a performance impact. To get rid of the detour the new kernel parameter "nospectre_v2" and "spectre_v2=[on,off,auto]" can be used. If the parameter is specified the kernel and module code will be patched at runtime.
--- arch/s390/Kconfig | 28 ++++++++ arch/s390/Makefile | 10 +++ arch/s390/include/asm/lowcore.h | 4 - arch/s390/include/asm/nospec-branch.h | 18 +++++ arch/s390/kernel/Makefile | 3 arch/s390/kernel/entry.S | 113 ++++++++++++++++++++++++++-------- arch/s390/kernel/module.c | 62 +++++++++++++++--- arch/s390/kernel/nospec-branch.c | 101 ++++++++++++++++++++++++++++++ arch/s390/kernel/setup.c | 4 + arch/s390/kernel/smp.c | 1 arch/s390/kernel/vmlinux.lds.S | 14 ++++ drivers/s390/char/Makefile | 2 12 files changed, 325 insertions(+), 35 deletions(-) create mode 100644 arch/s390/include/asm/nospec-branch.h create mode 100644 arch/s390/kernel/nospec-branch.c
arch/s390/Kconfig +28 -0
@@ -722,6 +722,34 @@ config KERNEL_NOBP If unsure, say N. +config EXPOLINE + def_bool n + prompt "Avoid speculative indirect branches in the kernel" + help + Compile the kernel with the expoline compiler options to guard + against kernel-to-user data leaks by avoiding speculative indirect + branches. + Requires a compiler with -mindirect-branch=thunk support for full + protection. The kernel may run slower. + + If unsure, say N. + +choice + prompt "Expoline default" + depends on EXPOLINE + default EXPOLINE_FULL + +config EXPOLINE_OFF + bool "spectre_v2=off" + +config EXPOLINE_MEDIUM + bool "spectre_v2=auto" + +config EXPOLINE_FULL + bool "spectre_v2=on" + +endchoice + endmenu menu "Power Management"
arch/s390/Makefile +10 -0
@@ -77,6 +77,16 @@ ifeq ($(call cc-option-yn,-mwarn-dynamic cflags-$(CONFIG_WARN_DYNAMIC_STACK) += -mwarn-dynamicstack endif +ifdef CONFIG_EXPOLINE + ifeq ($(call cc-option-yn,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),y) + CC_FLAGS_EXPOLINE := -mindirect-branch=thunk + CC_FLAGS_EXPOLINE += -mfunction-return=thunk + CC_FLAGS_EXPOLINE += -mindirect-branch-table + export CC_FLAGS_EXPOLINE + cflags-y += $(CC_FLAGS_EXPOLINE) + endif +endif + ifdef CONFIG_FUNCTION_TRACER # make use of hotpatch feature if the compiler supports it cc_hotpatch := -mhotpatch=0,3
arch/s390/include/asm/lowcore.h +3 -1
@@ -155,7 +155,9 @@ struct _lowcore {/* Per cpu primary space access list */ __u32 paste[16 ];/* 0x0400 */ -__u8 pad_0x04c0[0x0e00 -0x0440 ];/* 0x0440 */ +/* br %r1 trampoline */ +__u16 br_r1_trampoline;/* 0x0440 */ +__u8 pad_0x0442[0x0e00 -0x0442 ];/* 0x0442 */ /* * 0xe00 contains the address of the IPL Parameter Information
arch/s390/include/asm/nospec-branch.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_S390_EXPOLINE_H +#define _ASM_S390_EXPOLINE_H + +#ifndef __ASSEMBLY__ + +#include <linux/types.h> + +extern int nospec_call_disable; +extern int nospec_return_disable; + +void nospec_init_branches (void ); +void nospec_call_revert (s32 *start,s32 *end); +void nospec_return_revert (s32 *start,s32 *end); + +#endif /* __ASSEMBLY__ */ + +#endif /* _ASM_S390_EXPOLINE_H */
arch/s390/kernel/Makefile +3 -0
@@ -48,6 +48,9 @@ obj-y += entry.o reipl.o relocate_kernel extra-y += head.o head64.o vmlinux.lds +obj-$(CONFIG_EXPOLINE) += nospec-branch.o +CFLAGS_REMOVE_expoline.o += $(CC_FLAGS_EXPOLINE) + obj-$(CONFIG_MODULES) += s390_ksyms.o module.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_SCHED_BOOK) += topology.o
arch/s390/kernel/entry.S +88 -25
254 lines not on this page · raw message
arch/s390/kernel/module.c +53 -9
91 lines not on this page · raw message
arch/s390/kernel/nospec-branch.c new file +101 -0
101 lines not on this page · raw message
arch/s390/kernel/setup.c +4 -0
@@ -64,6 +64,7 @@#include <asm/sysinfo.h> #include <asm/numa.h> #include <asm/alternative.h> +#include <asm/nospec-branch.h> #include "entry.h" /*
@@ -373,6 +374,7 @@ static void __init setup_lowcore(void)#ifdef CONFIG_SMP lc->spinlock_lockval =arch_spin_lockval (0 );#endif + lc->br_r1_trampoline =0x07f1 ;/* br %r1 */ set_prefix ((u32 )(unsigned long ) lc); lowcore_ptr[0 ] = lc;
@@ -897,6 +899,8 @@ void __init setup_arch(char **cmdline_p)set_preferred_console ();apply_alternative_instructions (); +if (IS_ENABLED (CONFIG_EXPOLINE )) +nospec_init_branches ();/* Setup zfcpdump support */ setup_zfcpdump ();
arch/s390/kernel/smp.c +1 -0
@@ -200,6 +200,7 @@ static int pcpu_alloc_lowcore(struct pcp lc->panic_stack = panic_stack +PANIC_FRAME_OFFSET ; lc->cpu_nr = cpu; lc->spinlock_lockval =arch_spin_lockval (cpu); + lc->br_r1_trampoline =0x07f1 ;/* br %r1 */ if (MACHINE_HAS_VX ) lc->vector_save_area_addr = (unsigned long ) &lc->vector_save_area;
arch/s390/kernel/vmlinux.lds.S +14 -0
@@ -101,6 +101,20 @@ SECTIONS *(.altinstr_replacement) } + /* + * Table with the patch locations to undo expolines + */ + .nospec_call_table : { + __nospec_call_start = . ; + *(.s390_indirect*) + __nospec_call_end = . ; + } + .nospec_return_table : { + __nospec_return_start = . ; + *(.s390_return*) + __nospec_return_end = . ; + } + /* early.c uses stsi, which requires page aligned data. */ . = ALIGN(PAGE_SIZE); INIT_DATA_SECTION(0x100)
drivers/s390/char/Makefile +2 -0
@@ -2,6 +2,8 @@ # S/390 character devices # +CFLAGS_REMOVE_sclp_early_core.o += $(CC_FLAGS_EXPOLINE) + obj-y += ctrlchar.o keyboard.o defkeymap.o sclp.o sclp_rw.o sclp_quiesce.o \ sclp_cmd.o sclp_config.o sclp_cpi_sys.o sclp_ocf.o sclp_ctl.o \ sclp_early.o
Greg Kroah-Hartman
maintainerPATCH 19/50 s390: Replace IS_ENABLED(EXPOLINE_*) with IS_ENABLED(CONFIG_EXPOLINE_*)
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
From: Eugeniu Rosca <[email protected]>
[ Upstream commit 2cb370d615e9fbed9e95ed222c2c8f337181aa90 ]
I've accidentally stumbled upon the IS_ENABLED(EXPOLINE_*) lines, which obviously always evaluate to false. Fix this.
--- arch/s390/kernel/nospec-branch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/nospec-branch.c +2 -2
@@ -3,8 +3,8 @@#include <asm/facility.h> #include <asm/nospec-branch.h> -int nospec_call_disable =IS_ENABLED (EXPOLINE_OFF ); -int nospec_return_disable = !IS_ENABLED (EXPOLINE_FULL ); +int nospec_call_disable =IS_ENABLED (CONFIG_EXPOLINE_OFF ); +int nospec_return_disable = !IS_ENABLED (CONFIG_EXPOLINE_FULL );static int __init nospectre_v2_setup_early (char *str) {
Greg Kroah-Hartman
maintainerPATCH 20/50 s390: do not bypass BPENTER for interrupt system calls
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit d5feec04fe578c8dbd9e2e1439afc2f0af761ed4 ]
The system call path can be interrupted before the switch back to the standard branch prediction with BPENTER has been done. The critical section cleanup code skips forward to .Lsysc_do_svc and bypasses the BPENTER. In this case the kernel and all subsequent code will run with the limited branch prediction.
--- arch/s390/kernel/entry.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/s390/kernel/entry.S +2 -1
@@ -1299,7 +1299,8 @@ cleanup_critical: srag %r9,%r9,23 jz 0f mvc __TI_last_break(8,%r12),16(%r11) -0: # set up saved register r11 +0: BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP + # set up saved register r11 lg %r15,__LC_KERNEL_STACK la %r9,STACK_FRAME_OVERHEAD(%r15) stg %r9,24(%r11) # r11 pt_regs pointer
Greg Kroah-Hartman
maintainerPATCH 21/50 s390/entry.S: fix spurious zeroing of r0
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
From: Christian Borntraeger <[email protected]>
[ Upstream commit d3f468963cd6fd6d2aa5e26aed8b24232096d0e1 ]
when a system call is interrupted we might call the critical section cleanup handler that re-does some of the operations. When we are between .Lsysc_vtime and .Lsysc_do_svc we might also redo the saving of the problem state registers r0-r7:
.Lcleanup_system_call:
[...]
0: # update accounting time stamp
mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
# set up saved register r11
lg %r15,__LC_KERNEL_STACK
la %r9,STACK_FRAME_OVERHEAD(%r15)
stg %r9,24(%r11) # r11 pt_regs pointer
# fill pt_regs
mvc __PT_R8(64,%r9),__LC_SAVE_AREA_SYNC---> stmg %r0,%r7,__PT_R0(%r9)
The problem is now, that we might have already zeroed out r0. The fix is to move the zeroing of r0 after sysc_do_svc.
--- arch/s390/kernel/entry.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/entry.S +2 -2
@@ -421,13 +421,13 @@ ENTRY(system_call) UPDATE_VTIME %r10,%r13,__LC_SYNC_ENTER_TIMER BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP stmg %r0,%r7,__PT_R0(%r11) - # clear user controlled register to prevent speculative use - xgr %r0,%r0 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC mvc __PT_PSW(16,%r11),__LC_SVC_OLD_PSW mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC stg %r14,__PT_FLAGS(%r11) .Lsysc_do_svc: + # clear user controlled register to prevent speculative use + xgr %r0,%r0 lg %r10,__TI_sysc_table(%r12) # address of system call table llgh %r8,__PT_INT_CODE+2(%r11) slag %r8,%r8,2 # shift and test for svc 0
Greg Kroah-Hartman
maintainerPATCH 22/50 s390: move nobp parameter functions to nospec-branch.c
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit b2e2f43a01bace1a25bdbae04c9f9846882b727a ]
Keep the code for the nobp parameter handling with the code for expolines. Both are related to the spectre v2 mitigation.
--- arch/s390/kernel/Makefile | 4 ++-- arch/s390/kernel/alternative.c | 23 ----------------------- arch/s390/kernel/nospec-branch.c | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 25 deletions(-)
arch/s390/kernel/Makefile +2 -2
@@ -45,11 +45,11 @@ obj-y += debug.o irq.o ipl.o dis.o diag. obj-y += sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o obj-y += runtime_instr.o cache.o dumpstack.o obj-y += entry.o reipl.o relocate_kernel.o alternative.o +obj-y += nospec-branch.o extra-y += head.o head64.o vmlinux.lds -obj-$(CONFIG_EXPOLINE) += nospec-branch.o -CFLAGS_REMOVE_expoline.o += $(CC_FLAGS_EXPOLINE) +CFLAGS_REMOVE_nospec-branch.o += $(CC_FLAGS_EXPOLINE) obj-$(CONFIG_MODULES) += s390_ksyms.o module.o obj-$(CONFIG_SMP) += smp.o
arch/s390/kernel/alternative.c +0 -23
@@ -14,29 +14,6 @@ static int __init disable_alternative_inearly_param ("noaltinstr" , disable_alternative_instructions); -static int __init nobp_setup_early (char *str) -{ -bool enabled; -int rc; - - rc =kstrtobool (str, &enabled); -if (rc) -return rc; -if (enabled &&test_facility (82 )) -__set_facility (82 , S390_lowcore.alt_stfle_fac_list); -else -__clear_facility (82 , S390_lowcore.alt_stfle_fac_list); -return 0 ; -} -early_param ("nobp" , nobp_setup_early); - -static int __init nospec_setup_early (char *str) -{ -__clear_facility (82 , S390_lowcore.alt_stfle_fac_list); -return 0 ; -} -early_param ("nospec" , nospec_setup_early); -struct brcl_insn {u16 opc;s32 disp;
arch/s390/kernel/nospec-branch.c +27 -0
@@ -3,6 +3,31 @@#include <asm/facility.h> #include <asm/nospec-branch.h> +static int __init nobp_setup_early (char *str) +{ +bool enabled; +int rc; + + rc =kstrtobool (str, &enabled); +if (rc) +return rc; +if (enabled &&test_facility (82 )) +__set_facility (82 , S390_lowcore.alt_stfle_fac_list); +else +__clear_facility (82 , S390_lowcore.alt_stfle_fac_list); +return 0 ; +} +early_param ("nobp" , nobp_setup_early); + +static int __init nospec_setup_early (char *str) +{ +__clear_facility (82 , S390_lowcore.alt_stfle_fac_list); +return 0 ; +} +early_param ("nospec" , nospec_setup_early); + +#ifdef CONFIG_EXPOLINE +int nospec_call_disable =IS_ENABLED (CONFIG_EXPOLINE_OFF );int nospec_return_disable = !IS_ENABLED (CONFIG_EXPOLINE_FULL );
@@ -99,3 +124,5 @@ void __init nospec_init_branches(void)nospec_call_revert (__nospec_call_start, __nospec_call_end); nospec_return_revert(__nospec_return_start, __nospec_return_end); } + +#endif /* CONFIG_EXPOLINE */
Greg Kroah-Hartman
maintainerPATCH 23/50 s390: add automatic detection of the spectre defense
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit 6e179d64126b909f0b288fa63cdbf07c531e9b1d ]
Automatically decide between nobp vs. expolines if the spectre_v2=auto kernel parameter is specified or CONFIG_EXPOLINE_AUTO=y is set.
The decision made at boot time due to CONFIG_EXPOLINE_AUTO=y being set can be overruled with the nobp, nospec and spectre_v2 kernel parameters.
--- arch/s390/Kconfig | 2 - arch/s390/Makefile | 2 - arch/s390/include/asm/nospec-branch.h | 6 +-- arch/s390/kernel/alternative.c | 1 arch/s390/kernel/module.c | 11 ++--- arch/s390/kernel/nospec-branch.c | 68 +++++++++++++++++++++------------- 6 files changed, 52 insertions(+), 38 deletions(-)
arch/s390/Kconfig +1 -1
@@ -742,7 +742,7 @@ choice config EXPOLINE_OFF bool "spectre_v2=off" -config EXPOLINE_MEDIUM +config EXPOLINE_AUTO bool "spectre_v2=auto" config EXPOLINE_FULL
arch/s390/Makefile +1 -1
@@ -83,7 +83,7 @@ ifdef CONFIG_EXPOLINE CC_FLAGS_EXPOLINE += -mfunction-return=thunk CC_FLAGS_EXPOLINE += -mindirect-branch-table export CC_FLAGS_EXPOLINE - cflags-y += $(CC_FLAGS_EXPOLINE) + cflags-y += $(CC_FLAGS_EXPOLINE) -DCC_USING_EXPOLINE endif endif
arch/s390/include/asm/nospec-branch.h +2 -4
@@ -6,12 +6,10 @@#include <linux/types.h> -extern int nospec_call_disable; -extern int nospec_return_disable; +extern int nospec_disable;void nospec_init_branches (void ); -void nospec_call_revert (s32 *start,s32 *end); -void nospec_return_revert (s32 *start,s32 *end); +void nospec_revert (s32 *start,s32 *end);#endif /* __ASSEMBLY__ */
arch/s390/kernel/alternative.c +1 -0
@@ -1,6 +1,7 @@#include <linux/module.h> #include <asm/alternative.h> #include <asm/facility.h> +#include <asm/nospec-branch.h> #define MAX_PATCH_LEN (255 - 1)
arch/s390/kernel/module.c +5 -6
@@ -167,7 +167,7 @@ int module_frob_arch_sections(Elf_Ehdr * me->core_size += me->arch.got_size; me->arch.plt_offset = me->core_size;if (me->arch.plt_size) { -if (IS_ENABLED (CONFIG_EXPOLINE ) && !nospec_call_disable) +if (IS_ENABLED (CONFIG_EXPOLINE ) && !nospec_disable) me->arch.plt_size +=PLT_ENTRY_SIZE ; me->core_size += me->arch.plt_size; }
@@ -326,8 +326,7 @@ static int apply_rela(Elf_Rela *rela, El info->plt_offset; ip[0 ] =0x0d10e310 ;/* basr 1,0 */ ip[1 ] =0x100a0004 ;/* lg 1,10(1) */ -if (IS_ENABLED (CONFIG_EXPOLINE ) && - !nospec_call_disable) { +if (IS_ENABLED (CONFIG_EXPOLINE ) && !nospec_disable) {unsigned int *ij; ij = me->module_core + me->arch.plt_offset +
@@ -448,7 +447,7 @@ int module_finalize(const Elf_Ehdr *hdr,void *aseg;if (IS_ENABLED (CONFIG_EXPOLINE ) && - !nospec_call_disable && me->arch.plt_size) { + !nospec_disable && me->arch.plt_size) {unsigned int *ij; ij = me->module_core + me->arch.plt_offset +
@@ -475,11 +474,11 @@ int module_finalize(const Elf_Ehdr *hdr,if (IS_ENABLED (CONFIG_EXPOLINE ) && (!strcmp (".nospec_call_table" , secname))) -nospec_call_revert (aseg, aseg + s->sh_size); +nospec_revert (aseg, aseg + s->sh_size);if (IS_ENABLED (CONFIG_EXPOLINE ) && (!strcmp (".nospec_return_table" , secname))) -nospec_return_revert (aseg, aseg + s->sh_size); +nospec_revert (aseg, aseg + s->sh_size); }jump_label_apply_nops (me);
arch/s390/kernel/nospec-branch.c +42 -26
106 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 24/50 s390: report spectre mitigation via syslog
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit bc035599718412cfba9249aa713f90ef13f13ee9 ]
Add a boot message if either of the spectre defenses is active. The message is
"Spectre V2 mitigation: execute trampolines."
or "Spectre V2 mitigation: limited branch prediction."
--- arch/s390/kernel/nospec-branch.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/s390/kernel/nospec-branch.c +10 -0
@@ -33,6 +33,16 @@ static int __init nospec_setup_early(cha }early_param ("nospec" , nospec_setup_early); +static int __init nospec_report (void ) +{ +if (IS_ENABLED (CC_USING_EXPOLINE ) && !nospec_disable) +pr_info ("Spectre V2 mitigation: execute trampolines.\n" ); +if (__test_facility (82 , S390_lowcore.alt_stfle_fac_list)) +pr_info ("Spectre V2 mitigation: limited branch prediction.\n" ); +return 0 ; +} +arch_initcall (nospec_report); +#ifdef CONFIG_EXPOLINE int nospec_disable =IS_ENABLED (CONFIG_EXPOLINE_OFF );
Greg Kroah-Hartman
maintainerPATCH 25/50 s390: add sysfs attributes for spectre
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit d424986f1d6b16079b3231db0314923f4f8deed1 ]
Set CONFIG_GENERIC_CPU_VULNERABILITIES and provide the two functions cpu_show_spectre_v1 and cpu_show_spectre_v2 to report the spectre mitigations.
--- arch/s390/Kconfig | 1 + arch/s390/kernel/nospec-branch.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+)
arch/s390/Kconfig +1 -0
@@ -111,6 +111,7 @@ config S390 select GENERIC_CLOCKEVENTS select GENERIC_CPU_AUTOPROBE select GENERIC_CPU_DEVICES if !SMP + select GENERIC_CPU_VULNERABILITIES select GENERIC_FIND_FIRST_BIT select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL
arch/s390/kernel/nospec-branch.c +19 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/module.h> +#include <linux/device.h> #include <asm/facility.h> #include <asm/nospec-branch.h>
@@ -43,6 +44,24 @@ static int __init nospec_report(void) }arch_initcall (nospec_report); +#ifdef CONFIG_SYSFS +ssize_t cpu_show_spectre_v1 (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"Mitigation: __user pointer sanitization\n" ); +} + +ssize_t cpu_show_spectre_v2 (struct device *dev, +struct device_attribute *attr,char *buf) +{ +if (IS_ENABLED (CC_USING_EXPOLINE ) && !nospec_disable) +return sprintf (buf,"Mitigation: execute trampolines\n" ); +if (__test_facility (82 , S390_lowcore.alt_stfle_fac_list)) +return sprintf (buf,"Mitigation: limited branch prediction.\n" ); +return sprintf (buf,"Vulnerable\n" ); +} +#endif +#ifdef CONFIG_EXPOLINE int nospec_disable =IS_ENABLED (CONFIG_EXPOLINE_OFF );
Greg Kroah-Hartman
maintainerPATCH 26/50 s390: correct nospec auto detection init order
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit 6a3d1e81a434fc311f224b8be77258bafc18ccc6 ]
With CONFIG_EXPOLINE_AUTO=y the call of spectre_v2_auto_early() via early_initcall is done *after* the early_param functions. This overwrites any settings done with the nobp/no_spectre_v2/spectre_v2 parameters. The code patching for the kernel is done after the evaluation of the early parameters but before the early_initcall is done. The end result is a kernel image that is patched correctly but the kernel modules are not.
Make sure that the nospec auto detection function is called before the early parameters are evaluated and before the code patching is done.
--- arch/s390/include/asm/nospec-branch.h | 1 + arch/s390/kernel/nospec-branch.c | 8 ++------ arch/s390/kernel/setup.c | 3 +++ 3 files changed, 6 insertions(+), 6 deletions(-)
arch/s390/include/asm/nospec-branch.h +1 -0
@@ -9,6 +9,7 @@extern int nospec_disable;void nospec_init_branches (void ); +void nospec_auto_detect (void );void nospec_revert (s32 *start,s32 *end);#endif /* __ASSEMBLY__ */
arch/s390/kernel/nospec-branch.c +2 -6
@@ -73,7 +73,7 @@ static int __init nospectre_v2_setup_ear }early_param ("nospectre_v2" , nospectre_v2_setup_early); -static int __init spectre_v2_auto_early (void ) +void __init nospec_auto_detect (void ) {if (IS_ENABLED (CC_USING_EXPOLINE )) {/*
@@ -88,11 +88,7 @@ static int __init spectre_v2_auto_early(* nobp setting decides what is done, this depends on the * CONFIG_KERNEL_NP option and the nobp/nospec parameters. */ -return 0 ; } -#ifdef CONFIG_EXPOLINE_AUTO -early_initcall (spectre_v2_auto_early); -#endif static int __init spectre_v2_setup_early (char *str) {
@@ -103,7 +99,7 @@ static int __init spectre_v2_setup_earlyif (str && !strncmp (str,"off" ,3 )) nospec_disable =1 ;if (str && !strncmp (str,"auto" ,4 )) -spectre_v2_auto_early (); +nospec_auto_detect ();return 0 ; }early_param ("spectre_v2" , spectre_v2_setup_early);
arch/s390/kernel/setup.c +3 -0
@@ -846,6 +846,9 @@ void __init setup_arch(char **cmdline_p) init_mm.end_data = (unsigned long ) &_edata; init_mm.brk = (unsigned long ) &_end; +if (IS_ENABLED (CONFIG_EXPOLINE_AUTO )) +nospec_auto_detect (); +parse_early_param ();os_info_init ();setup_ipl ();
Greg Kroah-Hartman
maintainerPATCH 27/50 s390: correct module section names for expoline code revert
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
[ Upstream commit 6cf09958f32b9667bb3ebadf74367c791112771b ]
The main linker script vmlinux.lds.S for the kernel image merges the expoline code patch tables into two section ".nospec_call_table" and ".nospec_return_table". This is *not* done for the modules, there the sections retain their original names as generated by gcc:
".s390_indirect_call", ".s390_return_mem" and ".s390_return_reg".
The module_finalize code has to check for the compiler generated section names, otherwise no code patching is done. This slows down the module code in case of "spectre_v2=off".
--- arch/s390/kernel/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/module.c +2 -2
@@ -473,11 +473,11 @@ int module_finalize(const Elf_Ehdr *hdr,apply_alternatives (aseg, aseg + s->sh_size);if (IS_ENABLED (CONFIG_EXPOLINE ) && - (!strcmp (".nospec_call_table" , secname))) + (!strncmp (".s390_indirect" , secname,14 )))nospec_revert (aseg, aseg + s->sh_size);if (IS_ENABLED (CONFIG_EXPOLINE ) && - (!strcmp (".nospec_return_table" , secname))) + (!strncmp (".s390_return" , secname,12 )))nospec_revert (aseg, aseg + s->sh_size); }
Greg Kroah-Hartman
maintainerPATCH 28/50 bonding: do not set slave_dev npinfo before slave_enable_netpoll in bond_enslave
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit ddea788c63094f7c483783265563dd5b50052e28 ]
After Commit 8a8efa22f51b ("bonding: sync netpoll code with bridge"), it would set slave_dev npinfo in slave_enable_netpoll when enslaving a dev if bond->dev->npinfo was set.
However now slave_dev npinfo is set with bond->dev->npinfo before calling slave_enable_netpoll. With slave_dev npinfo set, __netpoll_setup called in slave_enable_netpoll will not call slave dev's .ndo_netpoll_setup(). It causes that the lower dev of this slave dev can't set its npinfo.
One way to reproduce it:
# modprobe bonding # brctl addbr br0 # brctl addif br0 eth1 # ifconfig bond0 192.168.122.1/24 up # ifenslave bond0 eth2 # systemctl restart netconsole # ifenslave bond0 br0 # ifconfig eth2 down # systemctl restart netconsole
The netpoll won't really work.
This patch is to remove that slave_dev npinfo setting in bond_enslave().
--- drivers/net/bonding/bond_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/bonding/bond_main.c +1 -2
@@ -1614,8 +1614,7 @@ int bond_enslave(struct net_device *bond }/* switch(bond_mode) */ #ifdef CONFIG_NET_POLL_CONTROLLER - slave_dev->npinfo = bond->dev->npinfo; -if (slave_dev->npinfo) { +if (bond->dev->npinfo) {if (slave_enable_netpoll (new_slave)) {netdev_info (bond_dev,"master_dev is using netpoll, but new slave device does not support netpoll\n" ); res = -EBUSY ;
Greg Kroah-Hartman
maintainerPATCH 29/50 KEYS: DNS: limit the length of option strings
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
[ Upstream commit 9c438d7a3a52dcc2b9ed095cb87d3a5e83cf7e60 ]
Adding a dns_resolver key whose payload contains a very long option name resulted in that string being printed in full. This hit the WARN_ONCE() in set_precision() during the printk(), because printk() only supports a precision of up to 32767 bytes:
precision 1000000 too large
WARNING: CPU: 0 PID: 752 at lib/vsprintf.c:2189 vsnprintf+0x4bc/0x5b0Fix it by limiting option strings (combined name + value) to a much more reasonable 128 bytes. The exact limit is arbitrary, but currently the only recognized option is formatted as "dnserror=%lu" which fits well within this limit.
Also ratelimit the printks.
Reproducer:
perl -e 'print "#", "A" x 1000000, "\x00"' | keyctl padd dns_resolver desc @s
This bug was found using syzkaller.
--- net/dns_resolver/dns_key.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
net/dns_resolver/dns_key.c +6 -7
@@ -25,6 +25,7 @@#include <linux/moduleparam.h> #include <linux/slab.h> #include <linux/string.h> +#include <linux/ratelimit.h> #include <linux/kernel.h> #include <linux/keyctl.h> #include <linux/err.h>
@@ -91,9 +92,9 @@ dns_resolver_preparse(struct key_prepars next_opt =memchr (opt,'#' , end - opt) ?: end; opt_len = next_opt - opt; -if (!opt_len) { -printk (KERN_WARNING -"Empty option to dns_resolver key\n" ); +if (opt_len <=0 || opt_len >128 ) { +pr_warn_ratelimited ("Invalid option length (%d) for dns_resolver key\n" , + opt_len);return -EINVAL ; }
@@ -127,10 +128,8 @@ dns_resolver_preparse(struct key_prepars } bad_option_value: -printk (KERN_WARNING -"Option '%*.*s' to dns_resolver key:" -" bad/missing value\n" , - opt_nlen, opt_nlen, opt); +pr_warn_ratelimited ("Option '%*.*s' to dns_resolver key: bad/missing value\n" , + opt_nlen, opt_nlen, opt);return -EINVAL ; }while (opt = next_opt +1 , opt < end); }
Greg Kroah-Hartman
maintainerPATCH 30/50 l2tp: check sockaddr length in pppol2tp_connect()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
[ Upstream commit eb1c28c05894a4b1f6b56c5bf072205e64cfa280 ]
Check sockaddr_len before dereferencing sp->sa_protocol, to ensure that it actually points to valid data.
--- net/l2tp/l2tp_ppp.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/l2tp/l2tp_ppp.c +7 -0
@@ -606,6 +606,13 @@ static int pppol2tp_connect(struct sockelock_sock (sk); error = -EINVAL ; + +if (sockaddr_len !=sizeof (struct sockaddr_pppol2tp ) && + sockaddr_len !=sizeof (struct sockaddr_pppol2tpv3 ) && + sockaddr_len !=sizeof (struct sockaddr_pppol2tpin6 ) && + sockaddr_len !=sizeof (struct sockaddr_pppol2tpv3in6 )) + goto end; +if (sp->sa_protocol !=PX_PROTO_OL2TP ) goto end;
Greg Kroah-Hartman
maintainerPATCH 31/50 net: validate attribute sizes in neigh_dump_table()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7dd07c143a4b54d050e748bee4b4b9e94a7b1744 ]
Since neigh_dump_table() calls nlmsg_parse() without giving policy constraints, attributes can have arbirary size that we must validate
Reported by syzbot/KMSAN :
BUG: KMSAN: uninit-value in neigh_master_filtered net/core/neighbour.c:2292 [inline] BUG: KMSAN: uninit-value in neigh_dump_table net/core/neighbour.c:2348 [inline] BUG: KMSAN: uninit-value in neigh_dump_info+0x1af0/0x2250 net/core/neighbour.c:2438 CPU: 1 PID: 3575 Comm: syzkaller268891 Not tainted 4.16.0+ #83 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:53 kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067 __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:676 neigh_master_filtered net/core/neighbour.c:2292 [inline] neigh_dump_table net/core/neighbour.c:2348 [inline] neigh_dump_info+0x1af0/0x2250 net/core/neighbour.c:2438 netlink_dump+0x9ad/0x1540 net/netlink/af_netlink.c:2225 __netlink_dump_start+0x1167/0x12a0 net/netlink/af_netlink.c:2322 netlink_dump_start include/linux/netlink.h:214 [inline] rtnetlink_rcv_msg+0x1435/0x1560 net/core/rtnetlink.c:4598 netlink_rcv_skb+0x355/0x5f0 net/netlink/af_netlink.c:2447 rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:4653 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline] netlink_unicast+0x1672/0x1750 net/netlink/af_netlink.c:1337 netlink_sendmsg+0x1048/0x1310 net/netlink/af_netlink.c:1900 sock_sendmsg_nosec net/socket.c:630 [inline] sock_sendmsg net/socket.c:640 [inline] ___sys_sendmsg+0xec0/0x1310 net/socket.c:2046 __sys_sendmsg net/socket.c:2080 [inline] SYSC_sendmsg+0x2a3/0x3d0 net/socket.c:2091 SyS_sendmsg+0x54/0x80 net/socket.c:2087 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 RIP: 0033:0x43fed9 RSP: 002b:00007ffddbee2798 EFLAGS: 00000213 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 000000000043fed9 RDX: 0000000000000000 RSI: 0000000020005000 RDI: 0000000000000003 RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8 R10: 00000000004002c8 R11: 0000000000000213 R12: 0000000000401800 R13: 0000000000401890 R14: 0000000000000000 R15: 0000000000000000
Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline] kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188 kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314 kmsan_slab_alloc+0x11/0x20 mm/kmsan/kmsan.c:321 slab_post_alloc_hook mm/slab.h:445 [inline] slab_alloc_node mm/slub.c:2737 [inline] __kmalloc_node_track_caller+0xaed/0x11c0 mm/slub.c:4369 __kmalloc_reserve net/core/skbuff.c:138 [inline] __alloc_skb+0x2cf/0x9f0 net/core/skbuff.c:206 alloc_skb include/linux/skbuff.h:984 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1183 [inline] netlink_sendmsg+0x9a6/0x1310 net/netlink/af_netlink.c:1875 sock_sendmsg_nosec net/socket.c:630 [inline] sock_sendmsg net/socket.c:640 [inline] ___sys_sendmsg+0xec0/0x1310 net/socket.c:2046 __sys_sendmsg net/socket.c:2080 [inline] SYSC_sendmsg+0x2a3/0x3d0 net/socket.c:2091 SyS_sendmsg+0x54/0x80 net/socket.c:2087 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2
--- net/core/neighbour.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/core/neighbour.c +8 -4
@@ -2280,12 +2280,16 @@ static int neigh_dump_table(struct neigh err =nlmsg_parse (nlh,sizeof (struct ndmsg ), tb,NDA_MAX ,NULL );if (!err) { -if (tb[NDA_IFINDEX ]) +if (tb[NDA_IFINDEX ]) { +if (nla_len (tb[NDA_IFINDEX ]) !=sizeof (u32)) +return -EINVAL ; filter_idx =nla_get_u32 (tb[NDA_IFINDEX ]); - -if (tb[NDA_MASTER ]) + } +if (tb[NDA_MASTER ]) { +if (nla_len (tb[NDA_MASTER ]) !=sizeof (u32)) +return -EINVAL ; filter_master_idx =nla_get_u32 (tb[NDA_MASTER ]); - + }if (filter_idx || filter_master_idx) flags |=NLM_F_DUMP_FILTERED ; }
Greg Kroah-Hartman
maintainerPATCH 32/50 llc: delete timers synchronously in llc_sk_free()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit b905ef9ab90115d001c1658259af4b1c65088779 ]
The connection timers of an llc sock could be still flying after we delete them in llc_sk_free(), and even possibly after we free the sock. We could just wait synchronously here in case of troubles.
Note, I leave other call paths as they are, since they may not have to wait, at least we can change them to synchronously when needed.
Also, move the code to net/llc/llc_conn.c, which is apparently a better place.
--- include/net/llc_conn.h | 1 + net/llc/llc_c_ac.c | 9 +-------- net/llc/llc_conn.c | 22 +++++++++++++++++++++- 3 files changed, 23 insertions(+), 9 deletions(-)
include/net/llc_conn.h +1 -0
@@ -97,6 +97,7 @@ static __inline__ char llc_backlog_type(struct sock *llc_sk_alloc (struct net *net,int family,gfp_t priority,struct proto *prot,int kern); +void llc_sk_stop_all_timers (struct sock *sk,bool sync);void llc_sk_free (struct sock *sk);void llc_sk_reset (struct sock *sk);
net/llc/llc_c_ac.c +1 -8
@@ -1096,14 +1096,7 @@ int llc_conn_ac_inc_tx_win_size(struct sint llc_conn_ac_stop_all_timers (struct sock *sk,struct sk_buff *skb) { -struct llc_sock *llc =llc_sk (sk); - -del_timer (&llc->pf_cycle_timer.timer); -del_timer (&llc->ack_timer.timer); -del_timer (&llc->rej_sent_timer.timer); -del_timer (&llc->busy_state_timer.timer); - llc->ack_must_be_send =0 ; - llc->ack_pf =0 ; +llc_sk_stop_all_timers (sk, false);return 0 ; }
net/llc/llc_conn.c +21 -1
@@ -951,6 +951,26 @@ out:return sk; } +void llc_sk_stop_all_timers (struct sock *sk,bool sync) +{ +struct llc_sock *llc =llc_sk (sk); + +if (sync) { +del_timer_sync (&llc->pf_cycle_timer.timer); +del_timer_sync (&llc->ack_timer.timer); +del_timer_sync (&llc->rej_sent_timer.timer); +del_timer_sync (&llc->busy_state_timer.timer); + }else { +del_timer (&llc->pf_cycle_timer.timer); +del_timer (&llc->ack_timer.timer); +del_timer (&llc->rej_sent_timer.timer); +del_timer (&llc->busy_state_timer.timer); + } + + llc->ack_must_be_send =0 ; + llc->ack_pf =0 ; +} +/** * llc_sk_free - Frees a LLC socket * @sk - socket to free
@@ -963,7 +983,7 @@ void llc_sk_free(struct sock *sk) llc->state =LLC_CONN_OUT_OF_SVC ;/* Stop all (possibly) running timers */ -llc_conn_ac_stop_all_timers (sk,NULL ); +llc_sk_stop_all_timers (sk, true);#ifdef DEBUG_LLC_CONN_ALLOC printk(KERN_INFO "%s: unackq=%d, txq=%d\n", __func__, skb_queue_len(&llc->pdu_unack_q),
Greg Kroah-Hartman
maintainerPATCH 33/50 tcp: dont read out-of-bounds opsize
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
[ Upstream commit 7e5a206ab686f098367b61aca989f5cdfa8114a3 ]
The old code reads the "opsize" variable from out-of-bounds memory (first byte behind the segment) if a broken TCP segment ends directly after an opcode that is neither EOL nor NOP.
The result of the read isn't used for anything, so the worst thing that could theoretically happen is a pagefault; and since the physmap is usually mostly contiguous, even that seems pretty unlikely.
The following C reproducer triggers the uninitialized read - however, you can't actually see anything happen unless you put something like a pr_warn() in tcp_parse_md5sig_option() to print the opsize.
====================================
#define _GNU_SOURCE
#include <arpa/inet.h>
#include <stdlib.h>
#include <errno.h>
#include <stdarg.h>
#include <net/if.h>
#include <linux/if.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/in.h>
#include <linux/if_tun.h>
#include <err.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <assert.h>
void systemf(const char *command, ...) {
char *full_command;
va_list ap;
va_start(ap, command);
if (vasprintf(&full_command, command, ap) == -1)
err(1, "vasprintf");
va_end(ap);
printf("systemf: <<<%s>>>\n", full_command);
system(full_command);
}
char *devname;
int tun_alloc(char *name) {
int fd = open("/dev/net/tun", O_RDWR);
if (fd == -1)
err(1, "open tun dev");
static struct ifreq req = { .ifr_flags = IFF_TUN|IFF_NO_PI };
strcpy(req.ifr_name, name);
if (ioctl(fd, TUNSETIFF, &req))
err(1, "TUNSETIFF"); devname = req.ifr_name;
printf("device name: %s\n", devname);
return fd;
}
#define IPADDR(a,b,c,d) (((a)<<0)+((b)<<8)+((c)<<16)+((d)<<24))
void sum_accumulate(unsigned int *sum, void *data, int len) {
assert((len&2)==0);
for (int i=0; i<len/2; i++) {
*sum += ntohs(((unsigned short *)data)[i]); }
}
unsigned short sum_final(unsigned int sum) {
sum = (sum >> 16) + (sum & 0xffff);
sum = (sum >> 16) + (sum & 0xffff);
return htons(~sum);
}
void fix_ip_sum(struct iphdr *ip) {
unsigned int sum = 0;
sum_accumulate(&sum, ip, sizeof(*ip));
ip->check = sum_final(sum);
}
void fix_tcp_sum(struct iphdr *ip, struct tcphdr *tcp) {
unsigned int sum = 0;
struct {
unsigned int saddr;
unsigned int daddr;
unsigned char pad;
unsigned char proto_num;
unsigned short tcp_len;
} fakehdr = {
.saddr = ip->saddr,
.daddr = ip->daddr,
.proto_num = ip->protocol,
.tcp_len = htons(ntohs(ip->tot_len) - ip->ihl*4) };
sum_accumulate(&sum, &fakehdr, sizeof(fakehdr)); sum_accumulate(&sum, tcp, tcp->doff*4); tcp->check = sum_final(sum);
}
int main(void) {
int tun_fd = tun_alloc("inject_dev%d"); systemf("ip link set %s up", devname); systemf("ip addr add 192.168.42.1/24 dev %s", devname);
struct {
struct iphdr ip;
struct tcphdr tcp;
unsigned char tcp_opts[20];
} __attribute__((packed)) syn_packet = {
.ip = {
.ihl = sizeof(struct iphdr)/4,
.version = 4,
.tot_len = htons(sizeof(syn_packet)),
.ttl = 30,
.protocol = IPPROTO_TCP,
/* FIXUP check */
.saddr = IPADDR(192,168,42,2),
.daddr = IPADDR(192,168,42,1)
},
.tcp = {
.source = htons(1),
.dest = htons(1337),
.seq = 0x12345678,
.doff = (sizeof(syn_packet.tcp)+sizeof(syn_packet.tcp_opts))/4,
.syn = 1,
.window = htons(64),
.check = 0 /*FIXUP*/
},
.tcp_opts = {
/* INVALID: trailing MD5SIG opcode after NOPs */
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 19
}
};
fix_ip_sum(&syn_packet.ip);
fix_tcp_sum(&syn_packet.ip, &syn_packet.tcp);
while (1) {
int write_res = write(tun_fd, &syn_packet, sizeof(syn_packet));
if (write_res != sizeof(syn_packet))
err(1, "packet write failed"); }
}
====================================
--- net/ipv4/tcp_input.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/ipv4/tcp_input.c +2 -5
@@ -3869,11 +3869,8 @@ const u8 *tcp_parse_md5sig_option(constint length = (th->doff <<2 ) -sizeof (*th);const u8 *ptr = (const u8 *)(th +1 ); -/* If the TCP option is too short, we can short cut */ -if (length <TCPOLEN_MD5SIG ) -return NULL ; - -while (length >0 ) { +/* If not enough data remaining, we can short cut */ +while (length >=TCPOLEN_MD5SIG ) {int opcode = *ptr++;int opsize;
Greg Kroah-Hartman
maintainerPATCH 34/50 team: avoid adding twice the same option to the event list
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 4fb0534fb7bbc2346ba7d3a072b538007f4135a5 ]
When parsing the options provided by the user space, team_nl_cmd_options_set() insert them in a temporary list to send multiple events with a single message.
While each option's attribute is correctly validated, the code does not check for duplicate entries before inserting into the event list.
Exploiting the above, the syzbot was able to trigger the following splat:
kernel BUG at lib/list_debug.c:31!
invalid opcode: 0000 [#1] SMP KASAN
Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in: CPU: 0 PID: 4466 Comm: syzkaller556835 Not tainted 4.16.0+ #17 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:__list_add_valid+0xaa/0xb0 lib/list_debug.c:29 RSP: 0018:ffff8801b04bf248 EFLAGS: 00010286 RAX: 0000000000000058 RBX: ffff8801c8fc7a90 RCX: 0000000000000000 RDX: 0000000000000058 RSI: ffffffff815fbf41 RDI: ffffed0036097e3f RBP: ffff8801b04bf260 R08: ffff8801b0b2a700 R09: ffffed003b604f90 R10: ffffed003b604f90 R11: ffff8801db027c87 R12: ffff8801c8fc7a90 R13: ffff8801c8fc7a90 R14: dffffc0000000000 R15: 0000000000000000 FS: 0000000000b98880(0000) GS:ffff8801db000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000000043fc30 CR3: 00000001afe8e000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __list_add include/linux/list.h:60 [inline] list_add include/linux/list.h:79 [inline] team_nl_cmd_options_set+0x9ff/0x12b0 drivers/net/team/team.c:2571 genl_family_rcv_msg+0x889/0x1120 net/netlink/genetlink.c:599 genl_rcv_msg+0xc6/0x170 net/netlink/genetlink.c:624 netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2448 genl_rcv+0x28/0x40 net/netlink/genetlink.c:635 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline] netlink_unicast+0x58b/0x740 net/netlink/af_netlink.c:1336 netlink_sendmsg+0x9f0/0xfa0 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:639 ___sys_sendmsg+0x805/0x940 net/socket.c:2117 __sys_sendmsg+0x115/0x270 net/socket.c:2155 SYSC_sendmsg net/socket.c:2164 [inline] SyS_sendmsg+0x29/0x30 net/socket.c:2162 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x4458b9 RSP: 002b:00007ffd1d4a7278 EFLAGS: 00000213 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 000000000000001b RCX: 00000000004458b9 RDX: 0000000000000010 RSI: 0000000020000d00 RDI: 0000000000000004 RBP: 00000000004a74ed R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000213 R12: 00007ffd1d4a7348 R13: 0000000000402a60 R14: 0000000000000000 R15: 0000000000000000 Code: 75 e8 eb a9 48 89 f7 48 89 75 e8 e8 d1 85 7b fe 48 8b 75 e8 eb bb 48 89 f2 48 89 d9 4c 89 e6 48 c7 c7 a0 84 d8 87 e8 ea 67 28 fe <0f> 0b 0f 1f 40 00 48 b8 00 00 00 00 00 fc ff df 55 48 89 e5 41 RIP: __list_add_valid+0xaa/0xb0 lib/list_debug.c:29 RSP: ffff8801b04bf248
This changeset addresses the avoiding list_add() if the current option is already present in the event list.
--- drivers/net/team/team.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/team/team.c +19 -0
@@ -247,6 +247,17 @@ static void __team_option_inst_mark_remo } } +static bool __team_option_inst_tmp_find (const struct list_head *opts, +const struct team_option_inst *needle) +{ +struct team_option_inst *opt_inst; + +list_for_each_entry (opt_inst, opts, tmp_list) +if (opt_inst == needle) +return true; +return false; +} +static int __team_options_register (struct team *team,const struct team_option *option,size_t option_count)
@@ -2544,6 +2555,14 @@ static int team_nl_cmd_options_set(strucif (err) goto team_put; opt_inst->changed = true; + +/* dumb/evil user-space can send us duplicate opt, +* keep only the last one +*/ +if (__team_option_inst_tmp_find (&opt_inst_list, + opt_inst)) +continue ; +list_add (&opt_inst->tmp_list, &opt_inst_list); }if (!opt_found) {
Greg Kroah-Hartman
maintainerPATCH 35/50 team: fix netconsole setup over team
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 9cf2f437ca5b39828984064fad213e68fc17ef11 ]
The same fix in Commit dbe173079ab5 ("bridge: fix netconsole setup over bridge") is also needed for team driver.
While at it, remove the unnecessary parameter *team from team_port_enable_netpoll().
v1->v2:
- fix it in a better way, as does bridge.
--- drivers/net/team/team.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/team/team.c +12 -7
@@ -1050,14 +1050,11 @@ static void team_port_leave(struct team }#ifdef CONFIG_NET_POLL_CONTROLLER -static int team_port_enable_netpoll (struct team *team,struct team_port *port) +static int __team_port_enable_netpoll (struct team_port *port) {struct netpoll *np;int err; -if (!team->dev->npinfo) -return 0 ; - np =kzalloc (sizeof (*np),GFP_KERNEL );if (!np)return -ENOMEM ;
@@ -1071,6 +1068,14 @@ static int team_port_enable_netpoll(strureturn err; } +static int team_port_enable_netpoll (struct team_port *port) +{ +if (!port->team->dev->npinfo) +return 0 ; + +return __team_port_enable_netpoll (port); +} +static void team_port_disable_netpoll (struct team_port *port) {struct netpoll *np = port->np;
@@ -1085,7 +1090,7 @@ static void team_port_disable_netpoll(st kfree(np); }#else -static int team_port_enable_netpoll (struct team *team,struct team_port *port) +static int team_port_enable_netpoll (struct team_port *port) {return 0 ; }
@@ -1192,7 +1197,7 @@ static int team_port_add(struct team *te goto err_vids_add; } - err =team_port_enable_netpoll (team, port); + err =team_port_enable_netpoll (port);if (err) {netdev_err (dev,"Failed to enable netpoll on device %s\n" , portname);
@@ -1900,7 +1905,7 @@ static int team_netpoll_setup(struct netmutex_lock (&team->lock);list_for_each_entry (port, &team->port_list, list) { - err =team_port_enable_netpoll (team, port); + err =__team_port_enable_netpoll (port);if (err) {__team_netpoll_cleanup (team);break ;
Greg Kroah-Hartman
maintainerPATCH 36/50 packet: fix bitfield update race
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
[ Upstream commit a6361f0ca4b25460f2cdf3235ebe8115f622901e ]
Updates to the bitfields in struct packet_sock are not atomic. Serialize these read-modify-write cycles.
Move po->running into a separate variable. Its writes are protected by po->bind_lock (except for one startup case at packet_create). Also replace a textual precondition warning with lockdep annotation.
All others are set only in packet_setsockopt. Serialize these updates by holding the socket lock. Analogous to other field updates, also hold the lock when testing whether a ring is active (pg_vec).
--- net/packet/af_packet.c | 60 +++++++++++++++++++++++++++++++++++-------------- net/packet/internal.h | 10 ++++---- 2 files changed, 49 insertions(+), 21 deletions(-)
net/packet/af_packet.c +44 -16
@@ -332,11 +332,11 @@ static void packet_pick_tx_queue(structskb_set_queue_mapping (skb, queue_index); } -/* register_prot_hook must be invoked with the po->bind_lock held, +/* __register_prot_hook must be invoked through register_prot_hook * or from a context in which asynchronous accesses to the packet * socket is not possible (packet_create()). */ -static void register_prot_hook (struct sock *sk) +static void __register_prot_hook (struct sock *sk) {struct packet_sock *po =pkt_sk (sk);
@@ -351,8 +351,13 @@ static void register_prot_hook(struct so } } -/* {,__}unregister_prot_hook() must be invoked with the po->bind_lock -* held. If the sync parameter is true, we will temporarily drop +static void register_prot_hook (struct sock *sk) +{ +lockdep_assert_held_once (&pkt_sk (sk)->bind_lock); +__register_prot_hook (sk); +} + +/* If the sync parameter is true, we will temporarily drop * the po->bind_lock and do a synchronize_net to make sure no * asynchronous packet processing paths still refer to the elements * of po->prot_hook. If the sync parameter is false, it is the
@@ -362,6 +367,8 @@ static void __unregister_prot_hook(struc {struct packet_sock *po =pkt_sk (sk); +lockdep_assert_held_once (&po->bind_lock); + po->running =0 ;if (po->fanout)
@@ -3134,7 +3141,7 @@ static int packet_create(struct net *netif (proto) { po->prot_hook.type = proto; -register_prot_hook (sk); +__register_prot_hook (sk); }mutex_lock (&net->packet.sklist_lock);
@@ -3653,12 +3660,18 @@ packet_setsockopt(struct socket *sock, iif (optlen !=sizeof (val))return -EINVAL ; -if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) -return -EBUSY ;if (copy_from_user (&val, optval,sizeof (val)))return -EFAULT ; - po->tp_loss = !!val; -return 0 ; + +lock_sock (sk); +if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { + ret = -EBUSY ; + }else { + po->tp_loss = !!val; + ret =0 ; + } +release_sock (sk); +return ret; }case PACKET_AUXDATA : {
@@ -3669,7 +3682,9 @@ packet_setsockopt(struct socket *sock, iif (copy_from_user (&val, optval,sizeof (val)))return -EFAULT ; +lock_sock (sk); po->auxdata = !!val; +release_sock (sk);return 0 ; }case PACKET_ORIGDEV :
@@ -3681,7 +3696,9 @@ packet_setsockopt(struct socket *sock, iif (copy_from_user (&val, optval,sizeof (val)))return -EFAULT ; +lock_sock (sk); po->origdev = !!val; +release_sock (sk);return 0 ; }case PACKET_VNET_HDR :
@@ -3690,15 +3707,20 @@ packet_setsockopt(struct socket *sock, iif (sock->type !=SOCK_RAW )return -EINVAL ; -if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) -return -EBUSY ;if (optlen <sizeof (val))return -EINVAL ;if (copy_from_user (&val, optval,sizeof (val)))return -EFAULT ; - po->has_vnet_hdr = !!val; -return 0 ; +lock_sock (sk); +if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { + ret = -EBUSY ; + }else { + po->has_vnet_hdr = !!val; + ret =0 ; + } +release_sock (sk); +return ret; }case PACKET_TIMESTAMP : {
@@ -3736,11 +3758,17 @@ packet_setsockopt(struct socket *sock, iif (optlen !=sizeof (val))return -EINVAL ; -if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) -return -EBUSY ;if (copy_from_user (&val, optval,sizeof (val)))return -EFAULT ; - po->tp_tx_has_off = !!val; + +lock_sock (sk); +if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { + ret = -EBUSY ; + }else { + po->tp_tx_has_off = !!val; + ret =0 ; + } +release_sock (sk);return 0 ; }case PACKET_QDISC_BYPASS :
net/packet/internal.h +5 -5
@@ -109,10 +109,12 @@ struct packet_sock {int copy_thresh;spinlock_t bind_lock;struct mutex pg_vec_lock; - unsigned int running:1, /* prot_hook is attached*/ - auxdata:1, +unsigned int running;/* bind_lock must be held */ + unsigned int auxdata:1, /* writer must hold sock lock */ origdev:1, - has_vnet_hdr:1; + has_vnet_hdr:1, + tp_loss:1, + tp_tx_has_off:1;int pressure;int ifindex;/* bound device */ __be16 num;
@@ -122,8 +124,6 @@ struct packet_sock {enum tpacket_versions tp_version;unsigned int tp_hdrlen;unsigned int tp_reserve; - unsigned int tp_loss:1; - unsigned int tp_tx_has_off:1;unsigned int tp_tstamp;struct net_device __rcu *cached_dev;int (*xmit)(struct sk_buff *skb);
Greg Kroah-Hartman
maintainerPATCH 37/50 pppoe: check sockaddr length in pppoe_connect()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
[ Upstream commit a49e2f5d5fb141884452ddb428f551b123d436b5 ]
We must validate sockaddr_len, otherwise userspace can pass fewer data than we expect and we end up accessing invalid data.
--- drivers/net/ppp/pppoe.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ppp/pppoe.c +4 -0
@@ -638,6 +638,10 @@ static int pppoe_connect(struct socket *lock_sock (sk); error = -EINVAL ; + +if (sockaddr_len !=sizeof (struct sockaddr_pppox )) + goto end; +if (sp->sa_protocol !=PX_PROTO_OE ) goto end;
Greg Kroah-Hartman
maintainerPATCH 38/50 vlan: Fix reading memory beyond skb->tail in skb_vlan_tagged_multi
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshiaki Makita <[email protected]>
[ Upstream commit 7ce2367254e84753bceb07327aaf5c953cfce117 ]
Syzkaller spotted an old bug which leads to reading skb beyond tail by 4 bytes on vlan tagged packets.
This is caused because skb_vlan_tagged_multi() did not check skb_headlen.
BUG: KMSAN: uninit-value in eth_type_vlan include/linux/if_vlan.h:283 [inline] BUG: KMSAN: uninit-value in skb_vlan_tagged_multi include/linux/if_vlan.h:656 [inline] BUG: KMSAN: uninit-value in vlan_features_check include/linux/if_vlan.h:672 [inline] BUG: KMSAN: uninit-value in dflt_features_check net/core/dev.c:2949 [inline] BUG: KMSAN: uninit-value in netif_skb_features+0xd1b/0xdc0 net/core/dev.c:3009 CPU: 1 PID: 3582 Comm: syzkaller435149 Not tainted 4.16.0+ #82 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:53 kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067 __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:676 eth_type_vlan include/linux/if_vlan.h:283 [inline] skb_vlan_tagged_multi include/linux/if_vlan.h:656 [inline] vlan_features_check include/linux/if_vlan.h:672 [inline] dflt_features_check net/core/dev.c:2949 [inline] netif_skb_features+0xd1b/0xdc0 net/core/dev.c:3009 validate_xmit_skb+0x89/0x1320 net/core/dev.c:3084 __dev_queue_xmit+0x1cb2/0x2b60 net/core/dev.c:3549 dev_queue_xmit+0x4b/0x60 net/core/dev.c:3590 packet_snd net/packet/af_packet.c:2944 [inline] packet_sendmsg+0x7c57/0x8a10 net/packet/af_packet.c:2969 sock_sendmsg_nosec net/socket.c:630 [inline] sock_sendmsg net/socket.c:640 [inline] sock_write_iter+0x3b9/0x470 net/socket.c:909 do_iter_readv_writev+0x7bb/0x970 include/linux/fs.h:1776 do_iter_write+0x30d/0xd40 fs/read_write.c:932 vfs_writev fs/read_write.c:977 [inline] do_writev+0x3c9/0x830 fs/read_write.c:1012 SYSC_writev+0x9b/0xb0 fs/read_write.c:1085 SyS_writev+0x56/0x80 fs/read_write.c:1082 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 RIP: 0033:0x43ffa9 RSP: 002b:00007fff2cff3948 EFLAGS: 00000217 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 000000000043ffa9 RDX: 0000000000000001 RSI: 0000000020000080 RDI: 0000000000000003 RBP: 00000000006cb018 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000217 R12: 00000000004018d0 R13: 0000000000401960 R14: 0000000000000000 R15: 0000000000000000
Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline] kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188 kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314 kmsan_slab_alloc+0x11/0x20 mm/kmsan/kmsan.c:321 slab_post_alloc_hook mm/slab.h:445 [inline] slab_alloc_node mm/slub.c:2737 [inline] __kmalloc_node_track_caller+0xaed/0x11c0 mm/slub.c:4369 __kmalloc_reserve net/core/skbuff.c:138 [inline] __alloc_skb+0x2cf/0x9f0 net/core/skbuff.c:206 alloc_skb include/linux/skbuff.h:984 [inline] alloc_skb_with_frags+0x1d4/0xb20 net/core/skbuff.c:5234 sock_alloc_send_pskb+0xb56/0x1190 net/core/sock.c:2085 packet_alloc_skb net/packet/af_packet.c:2803 [inline] packet_snd net/packet/af_packet.c:2894 [inline] packet_sendmsg+0x6444/0x8a10 net/packet/af_packet.c:2969 sock_sendmsg_nosec net/socket.c:630 [inline] sock_sendmsg net/socket.c:640 [inline] sock_write_iter+0x3b9/0x470 net/socket.c:909 do_iter_readv_writev+0x7bb/0x970 include/linux/fs.h:1776 do_iter_write+0x30d/0xd40 fs/read_write.c:932 vfs_writev fs/read_write.c:977 [inline] do_writev+0x3c9/0x830 fs/read_write.c:1012 SYSC_writev+0x9b/0xb0 fs/read_write.c:1085 SyS_writev+0x56/0x80 fs/read_write.c:1082 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2
--- include/linux/if_vlan.h | 7 +++++-- net/core/dev.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)
include/linux/if_vlan.h +5 -2
@@ -585,7 +585,7 @@ static inline bool skb_vlan_tagged(const* Returns true if the skb is tagged with multiple vlan headers, regardless * of whether it is hardware accelerated or not. */ -static inline bool skb_vlan_tagged_multi (const struct sk_buff *skb) +static inline bool skb_vlan_tagged_multi (struct sk_buff *skb) {__be16 protocol = skb->protocol;
@@ -596,6 +596,9 @@ static inline bool skb_vlan_tagged_multi protocol != htons(ETH_P_8021AD)))return false; +if (unlikely (!pskb_may_pull (skb,VLAN_ETH_HLEN ))) +return false; + veh = (struct vlan_ethhdr *)skb->data; protocol = veh->h_vlan_encapsulated_proto; }
@@ -613,7 +616,7 @@ static inline bool skb_vlan_tagged_multi* * Returns features without unsafe ones if the skb has multiple tags. */ -static inline netdev_features_t vlan_features_check (const struct sk_buff *skb, +static inline netdev_features_t vlan_features_check (struct sk_buff *skb,netdev_features_t features) {if (skb_vlan_tagged_multi (skb)) {
net/core/dev.c +1 -1
@@ -2706,7 +2706,7 @@ netdev_features_t passthru_features_chec }EXPORT_SYMBOL (passthru_features_check); -static netdev_features_t dflt_features_check (const struct sk_buff *skb, +static netdev_features_t dflt_features_check (struct sk_buff *skb,struct net_device *dev,netdev_features_t features) {
Greg Kroah-Hartman
maintainerPATCH 39/50 sctp: do not check port in sctp_inet6_cmp_addr
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 1071ec9d453a38023579714b64a951a2fb982071 ]
pf->cmp_addr() is called before binding a v6 address to the sock. It should not check ports, like in sctp_inet_cmp_addr.
But sctp_inet6_cmp_addr checks the addr by invoking af(6)->cmp_addr, sctp_v6_cmp_addr where it also compares the ports.
This would cause that setsockopt(SCTP_SOCKOPT_BINDX_ADD) could bind multiple duplicated IPv6 addresses after Commit 40b4f0fd74e4 ("sctp:
lack the check for ports in sctp_v6_cmp_addr").
This patch is to remove af->cmp_addr called in sctp_inet6_cmp_addr, but do the proper check for both v6 addrs and v4mapped addrs.
v1->v2:
- define __sctp_v6_cmp_addr to do the common address comparison used for both pf and af v6 cmp_addr.
--- net/sctp/ipv6.c | 60 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
net/sctp/ipv6.c +30 -30
@@ -519,46 +519,49 @@ static void sctp_v6_to_addr(union sctp_a addr->v6.sin6_scope_id =0 ; } -/* Compare addresses exactly. -* v4-mapped-v6 is also in consideration. -*/ -static int sctp_v6_cmp_addr (const union sctp_addr *addr1, -const union sctp_addr *addr2) +static int __sctp_v6_cmp_addr (const union sctp_addr *addr1, +const union sctp_addr *addr2) {if (addr1->sa.sa_family != addr2->sa.sa_family) {if (addr1->sa.sa_family ==AF_INET && addr2->sa.sa_family ==AF_INET6 && -ipv6_addr_v4mapped (&addr2->v6.sin6_addr)) { -if (addr2->v6.sin6_port == addr1->v4.sin_port && - addr2->v6.sin6_addr.s6_addr32[3 ] == - addr1->v4.sin_addr.s_addr) -return 1 ; - } +ipv6_addr_v4mapped (&addr2->v6.sin6_addr) && + addr2->v6.sin6_addr.s6_addr32[3 ] == + addr1->v4.sin_addr.s_addr) +return 1 ; +if (addr2->sa.sa_family ==AF_INET && addr1->sa.sa_family ==AF_INET6 && -ipv6_addr_v4mapped (&addr1->v6.sin6_addr)) { -if (addr1->v6.sin6_port == addr2->v4.sin_port && - addr1->v6.sin6_addr.s6_addr32[3 ] == - addr2->v4.sin_addr.s_addr) -return 1 ; - } +ipv6_addr_v4mapped (&addr1->v6.sin6_addr) && + addr1->v6.sin6_addr.s6_addr32[3 ] == + addr2->v4.sin_addr.s_addr) +return 1 ; +return 0 ; } -if (addr1->v6.sin6_port != addr2->v6.sin6_port) -return 0 ; +if (!ipv6_addr_equal (&addr1->v6.sin6_addr, &addr2->v6.sin6_addr))return 0 ; +/* If this is a linklocal address, compare the scope_id. */ -if (ipv6_addr_type (&addr1->v6.sin6_addr) &IPV6_ADDR_LINKLOCAL ) { -if (addr1->v6.sin6_scope_id && addr2->v6.sin6_scope_id && - (addr1->v6.sin6_scope_id != addr2->v6.sin6_scope_id)) { -return 0 ; - } - } +if ((ipv6_addr_type (&addr1->v6.sin6_addr) &IPV6_ADDR_LINKLOCAL ) && + addr1->v6.sin6_scope_id && addr2->v6.sin6_scope_id && + addr1->v6.sin6_scope_id != addr2->v6.sin6_scope_id) +return 0 ;return 1 ; } +/* Compare addresses exactly. +* v4-mapped-v6 is also in consideration. +*/ +static int sctp_v6_cmp_addr (const union sctp_addr *addr1, +const union sctp_addr *addr2) +{ +return __sctp_v6_cmp_addr (addr1, addr2) && + addr1->v6.sin6_port == addr2->v6.sin6_port; +} +/* Initialize addr struct to INADDR_ANY. */ static void sctp_v6_inaddr_any (union sctp_addr *addr,__be16 port) {
@@ -843,8 +846,8 @@ static int sctp_inet6_cmp_addr(const uniconst union sctp_addr *addr2, struct sctp_sock *opt) { - struct sctp_af *af1, *af2; struct sock *sk = sctp_opt2sk(opt); +struct sctp_af *af1, *af2; af1 =sctp_get_af_specific (addr1->sa.sa_family); af2 =sctp_get_af_specific (addr2->sa.sa_family);
@@ -860,10 +863,7 @@ static int sctp_inet6_cmp_addr(const uniif (sctp_is_any (sk, addr1) ||sctp_is_any (sk, addr2))return 1 ; -if (addr1->sa.sa_family != addr2->sa.sa_family) -return 0 ; - -return af1->cmp_addr (addr1, addr2); +return __sctp_v6_cmp_addr (addr1, addr2); }/* Verify that the provided sockaddr looks bindable. Common verification,
Greg Kroah-Hartman
maintainerPATCH 40/50 llc: hold llc_sap before release_sock()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit f7e43672683b097bb074a8fe7af9bc600a23f231 ]
syzbot reported we still access llc->sap in llc_backlog_rcv() after it is freed in llc_sap_remove_socket():
Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1b9/0x294 lib/dump_stack.c:113 print_address_description+0x6c/0x20b mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430 llc_conn_ac_send_sabme_cmd_p_set_x+0x3a8/0x460 net/llc/llc_c_ac.c:785 llc_exec_conn_trans_actions net/llc/llc_conn.c:475 [inline] llc_conn_service net/llc/llc_conn.c:400 [inline] llc_conn_state_process+0x4e1/0x13a0 net/llc/llc_conn.c:75 llc_backlog_rcv+0x195/0x1e0 net/llc/llc_conn.c:891 sk_backlog_rcv include/net/sock.h:909 [inline] __release_sock+0x12f/0x3a0 net/core/sock.c:2335 release_sock+0xa4/0x2b0 net/core/sock.c:2850 llc_ui_release+0xc8/0x220 net/llc/af_llc.c:204
llc->sap is refcount'ed and llc_sap_remove_socket() is paired with llc_sap_add_socket(). This can be amended by holding its refcount before llc_sap_remove_socket() and releasing it after release_sock().
--- net/llc/af_llc.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/llc/af_llc.c +7 -0
@@ -187,6 +187,7 @@ static int llc_ui_release(struct socket {struct sock *sk = sock->sk;struct llc_sock *llc; +struct llc_sap *sap;if (unlikely (sk ==NULL )) goto out;
@@ -197,9 +198,15 @@ static int llc_ui_release(struct socket llc->laddr.lsap, llc->daddr.lsap);if (!llc_send_disc (sk))llc_ui_wait_for_disc (sk, sk->sk_rcvtimeo); + sap = llc->sap; +/* Hold this for release_sock(), so that llc_backlog_rcv() could still +* use it. +*/ +llc_sap_hold (sap);if (!sock_flag (sk,SOCK_ZAPPED ))llc_sap_remove_socket (llc->sap, sk);release_sock (sk); +llc_sap_put (sap);if (llc->dev)dev_put (llc->dev);sock_put (sk);
Greg Kroah-Hartman
maintainerPATCH 41/50 llc: fix NULL pointer deref for SOCK_ZAPPED
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 3a04ce7130a7e5dad4e78d45d50313747f8c830f ]
For SOCK_ZAPPED socket, we don't need to care about llc->sap, so we should just skip these refcount functions in this case.
--- net/llc/af_llc.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
net/llc/af_llc.c +12 -9
@@ -187,7 +187,6 @@ static int llc_ui_release(struct socket {struct sock *sk = sock->sk;struct llc_sock *llc; -struct llc_sap *sap;if (unlikely (sk ==NULL )) goto out;
@@ -198,15 +197,19 @@ static int llc_ui_release(struct socket llc->laddr.lsap, llc->daddr.lsap);if (!llc_send_disc (sk))llc_ui_wait_for_disc (sk, sk->sk_rcvtimeo); - sap = llc->sap; -/* Hold this for release_sock(), so that llc_backlog_rcv() could still -* use it. -*/ -llc_sap_hold (sap); -if (!sock_flag (sk,SOCK_ZAPPED )) +if (!sock_flag (sk,SOCK_ZAPPED )) { +struct llc_sap *sap = llc->sap; + +/* Hold this for release_sock(), so that llc_backlog_rcv() +* could still use it. +*/ +llc_sap_hold (sap);llc_sap_remove_socket (llc->sap, sk); -release_sock (sk); -llc_sap_put (sap); +release_sock (sk); +llc_sap_put (sap); + }else { +release_sock (sk); + }if (llc->dev)dev_put (llc->dev);sock_put (sk);
Greg Kroah-Hartman
maintainerPATCH 42/50 tipc: add policy for TIPC_NLA_NET_ADDR
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ec518f21cb1a1b1f8a516499ea05c60299e04963 ]
Before syzbot/KMSAN bites, add the missing policy for TIPC_NLA_NET_ADDR
--- net/tipc/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/tipc/net.c +2 -1
@@ -44,7 +44,8 @@static const struct nla_policy tipc_nl_net_policy[TIPC_NLA_NET_MAX +1 ] = { [TIPC_NLA_NET_UNSPEC ] = { .type =NLA_UNSPEC }, - [TIPC_NLA_NET_ID ] = { .type =NLA_U32 } + [TIPC_NLA_NET_ID ] = { .type =NLA_U32 }, + [TIPC_NLA_NET_ADDR ] = { .type =NLA_U32 }, };/*
Greg Kroah-Hartman
maintainerPATCH 43/50 net: fix deadlock while clearing neighbor proxy table
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfgang Bumiller <[email protected]>
[ Upstream commit 53b76cdf7e8fecec1d09e38aad2f8579882591a8 ]
When coming from ndisc_netdev_event() in net/ipv6/ndisc.c, neigh_ifdown() is called with &nd_tbl, locking this while clearing the proxy neighbor entries when eg. deleting an interface. Calling the table's pndisc_destructor() with the lock still held, however, can cause a deadlock: When a multicast listener is available an IGMP packet of type ICMPV6_MGM_REDUCTION may be sent out. When reaching ip6_finish_output2(), if no neighbor entry for the target address is found, __neigh_create() is called with &nd_tbl, which it'll want to lock.
Move the elements into their own list, then unlock the table and perform the destruction.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199289
--- net/core/neighbour.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
net/core/neighbour.c +18 -10
@@ -54,7 +54,8 @@ do { \static void neigh_timer_handler (unsigned long arg);static void __neigh_notify (struct neighbour *n,int type,int flags);static void neigh_update_notify (struct neighbour *neigh); -static int pneigh_ifdown (struct neigh_table *tbl,struct net_device *dev); +static int pneigh_ifdown_and_unlock (struct neigh_table *tbl, +struct net_device *dev);#ifdef CONFIG_PROC_FS static const struct file_operations neigh_stat_seq_fops;
@@ -254,8 +255,7 @@ int neigh_ifdown(struct neigh_table *tbl {write_lock_bh (&tbl->lock);neigh_flush_dev (tbl, dev); -pneigh_ifdown (tbl, dev); -write_unlock_bh (&tbl->lock); +pneigh_ifdown_and_unlock (tbl, dev);del_timer_sync (&tbl->proxy_timer);pneigh_queue_purge (&tbl->proxy_queue);
@@ -645,9 +645,10 @@ int pneigh_delete(struct neigh_table *tbreturn -ENOENT ; } -static int pneigh_ifdown (struct neigh_table *tbl,struct net_device *dev) +static int pneigh_ifdown_and_unlock (struct neigh_table *tbl, +struct net_device *dev) { -struct pneigh_entry *n, **np; +struct pneigh_entry *n, **np, *freelist =NULL ;u32 h;for (h =0 ; h <=PNEIGH_HASHMASK ; h++) {
@@ -655,16 +656,23 @@ static int pneigh_ifdown(struct neigh_tawhile ((n = *np) !=NULL ) {if (!dev || n->dev == dev) { *np = n->next; -if (tbl->pdestructor) - tbl->pdestructor (n); -if (n->dev) -dev_put (n->dev); -kfree (n); + n->next = freelist; + freelist = n;continue ; } np = &n->next; } } +write_unlock_bh (&tbl->lock); +while ((n = freelist)) { + freelist = n->next; + n->next =NULL ; +if (tbl->pdestructor) + tbl->pdestructor (n); +if (n->dev) +dev_put (n->dev); +kfree (n); + }return -ENOENT ; }
Greg Kroah-Hartman
maintainerPATCH 44/50 tcp: md5: reject TCP_MD5SIG or TCP_MD5SIG_EXT on established sockets
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7212303268918b9a203aebeacfdbd83b5e87b20d ]
syzbot/KMSAN reported an uninit-value in tcp_parse_options() [1]
I believe this was caused by a TCP_MD5SIG being set on live flow.
This is highly unexpected, since TCP option space is limited.
For instance, presence of TCP MD5 option automatically disables TCP TimeStamp option at SYN/SYNACK time, which we can not do once flow has been established.
Really, adding/deleting an MD5 key only makes sense on sockets in CLOSE or LISTEN state.
[1]
BUG: KMSAN: uninit-value in tcp_parse_options+0xd74/0x1a30 net/ipv4/tcp_input.c:3720 CPU: 1 PID: 6177 Comm: syzkaller192004 Not tainted 4.16.0+ #83 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:53 kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067 __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:676 tcp_parse_options+0xd74/0x1a30 net/ipv4/tcp_input.c:3720 tcp_fast_parse_options net/ipv4/tcp_input.c:3858 [inline] tcp_validate_incoming+0x4f1/0x2790 net/ipv4/tcp_input.c:5184 tcp_rcv_established+0xf60/0x2bb0 net/ipv4/tcp_input.c:5453 tcp_v4_do_rcv+0x6cd/0xd90 net/ipv4/tcp_ipv4.c:1469 sk_backlog_rcv include/net/sock.h:908 [inline] __release_sock+0x2d6/0x680 net/core/sock.c:2271 release_sock+0x97/0x2a0 net/core/sock.c:2786 tcp_sendmsg+0xd6/0x100 net/ipv4/tcp.c:1464 inet_sendmsg+0x48d/0x740 net/ipv4/af_inet.c:764 sock_sendmsg_nosec net/socket.c:630 [inline] sock_sendmsg net/socket.c:640 [inline] SYSC_sendto+0x6c3/0x7e0 net/socket.c:1747 SyS_sendto+0x8a/0xb0 net/socket.c:1715 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 RIP: 0033:0x448fe9 RSP: 002b:00007fd472c64d38 EFLAGS: 00000216 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00000000006e5a30 RCX: 0000000000448fe9 RDX: 000000000000029f RSI: 0000000020a88f88 RDI: 0000000000000004 RBP: 00000000006e5a34 R08: 0000000020e68000 R09: 0000000000000010 R10: 00000000200007fd R11: 0000000000000216 R12: 0000000000000000 R13: 00007fff074899ef R14: 00007fd472c659c0 R15: 0000000000000009
Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline] kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188 kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314 kmsan_slab_alloc+0x11/0x20 mm/kmsan/kmsan.c:321 slab_post_alloc_hook mm/slab.h:445 [inline] slab_alloc_node mm/slub.c:2737 [inline] __kmalloc_node_track_caller+0xaed/0x11c0 mm/slub.c:4369 __kmalloc_reserve net/core/skbuff.c:138 [inline] __alloc_skb+0x2cf/0x9f0 net/core/skbuff.c:206 alloc_skb include/linux/skbuff.h:984 [inline] tcp_send_ack+0x18c/0x910 net/ipv4/tcp_output.c:3624 __tcp_ack_snd_check net/ipv4/tcp_input.c:5040 [inline] tcp_ack_snd_check net/ipv4/tcp_input.c:5053 [inline] tcp_rcv_established+0x2103/0x2bb0 net/ipv4/tcp_input.c:5469 tcp_v4_do_rcv+0x6cd/0xd90 net/ipv4/tcp_ipv4.c:1469 sk_backlog_rcv include/net/sock.h:908 [inline] __release_sock+0x2d6/0x680 net/core/sock.c:2271 release_sock+0x97/0x2a0 net/core/sock.c:2786 tcp_sendmsg+0xd6/0x100 net/ipv4/tcp.c:1464 inet_sendmsg+0x48d/0x740 net/ipv4/af_inet.c:764 sock_sendmsg_nosec net/socket.c:630 [inline] sock_sendmsg net/socket.c:640 [inline] SYSC_sendto+0x6c3/0x7e0 net/socket.c:1747 SyS_sendto+0x8a/0xb0 net/socket.c:1715 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2
--- net/ipv4/tcp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ipv4/tcp.c +4 -2
@@ -2589,8 +2589,10 @@ static int do_tcp_setsockopt(struct sock#ifdef CONFIG_TCP_MD5SIG case TCP_MD5SIG : -/* Read the IP->Key mappings from userspace */ - err = tp->af_specific->md5_parse (sk, optval, optlen); +if ((1 << sk->sk_state) & (TCPF_CLOSE |TCPF_LISTEN )) + err = tp->af_specific->md5_parse (sk, optval, optlen); +else + err = -EINVAL ;break ;#endif case TCP_USER_TIMEOUT :
Greg Kroah-Hartman
maintainerPATCH 45/50 net: af_packet: fix race in PACKET_{R|T}X_RING
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5171b37d959641bbc619781caf62e61f7b940871 ]
In order to remove the race caught by syzbot [1], we need to lock the socket before using po->tp_version as this could change under us otherwise.
This means lock_sock() and release_sock() must be done by packet_set_ring() callers.
[1] :
BUG: KMSAN: uninit-value in packet_set_ring+0x1254/0x3870 net/packet/af_packet.c:4249 CPU: 0 PID: 20195 Comm: syzkaller707632 Not tainted 4.16.0+ #83 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:53 kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067 __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:676 packet_set_ring+0x1254/0x3870 net/packet/af_packet.c:4249 packet_setsockopt+0x12c6/0x5a90 net/packet/af_packet.c:3662 SYSC_setsockopt+0x4b8/0x570 net/socket.c:1849 SyS_setsockopt+0x76/0xa0 net/socket.c:1828 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 RIP: 0033:0x449099 RSP: 002b:00007f42b5307ce8 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 000000000070003c RCX: 0000000000449099 RDX: 0000000000000005 RSI: 0000000000000107 RDI: 0000000000000003 RBP: 0000000000700038 R08: 000000000000001c R09: 0000000000000000 R10: 00000000200000c0 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000080eecf R14: 00007f42b53089c0 R15: 0000000000000001
Local variable description: ----req_u@packet_setsockopt Variable was created at:
packet_setsockopt+0x13f/0x5a90 net/packet/af_packet.c:3612 SYSC_setsockopt+0x4b8/0x570 net/socket.c:1849
--- net/packet/af_packet.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
net/packet/af_packet.c +18 -10
@@ -2899,6 +2899,7 @@ static int packet_release(struct socketpacket_flush_mclist (sk); +lock_sock (sk);if (po->rx_ring.pg_vec) {memset (&req_u,0 ,sizeof (req_u));packet_set_ring (sk, &req_u,1 ,0 );
@@ -2908,6 +2909,7 @@ static int packet_release(struct socketmemset (&req_u,0 ,sizeof (req_u));packet_set_ring (sk, &req_u,1 ,1 ); } +release_sock (sk); f =fanout_release (sk);
@@ -3577,6 +3579,7 @@ packet_setsockopt(struct socket *sock, iunion tpacket_req_u req_u;int len; +lock_sock (sk);switch (po->tp_version) {case TPACKET_V1 :case TPACKET_V2 :
@@ -3587,14 +3590,21 @@ packet_setsockopt(struct socket *sock, i len =sizeof (req_u.req3);break ; } -if (optlen < len) -return -EINVAL ; -if (pkt_sk (sk)->has_vnet_hdr) -return -EINVAL ; -if (copy_from_user (&req_u.req, optval, len)) -return -EFAULT ; -return packet_set_ring (sk, &req_u,0 , - optname ==PACKET_TX_RING ); +if (optlen < len) { + ret = -EINVAL ; + }else { +if (pkt_sk (sk)->has_vnet_hdr) { + ret = -EINVAL ; + }else { +if (copy_from_user (&req_u.req, optval, len)) + ret = -EFAULT ; +else + ret =packet_set_ring (sk, &req_u,0 , + optname ==PACKET_TX_RING ); + } + } +release_sock (sk); +return ret; }case PACKET_COPY_THRESH : {
@@ -4144,7 +4154,6 @@ static int packet_set_ring(struct sock */* Added to avoid minimal code churn */ struct tpacket_req *req = &req_u->req; -lock_sock (sk);/* Opening a Tx-ring is NOT supported in TPACKET_V3 */ if (!closing && tx_ring && (po->tp_version >TPACKET_V2 )) {WARN (1 ,"Tx-ring is not supported.\n" );
@@ -4280,7 +4289,6 @@ static int packet_set_ring(struct sock *if (pg_vec)free_pg_vec (pg_vec, order, req->tp_block_nr); out: -release_sock (sk);return err; }
Greg Kroah-Hartman
maintainerPATCH 46/50 ipv6: add RTA_TABLE and RTA_PREFSRC to rtm_ipv6_policy
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit aa8f8778493c85fff480cdf8b349b1e1dcb5f243 ]
KMSAN reported use of uninit-value that I tracked to lack of proper size check on RTA_TABLE attribute.
I also believe RTA_PREFSRC lacks a similar check.
--- net/ipv6/route.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/route.c +2 -0
@@ -2711,6 +2711,7 @@ void rt6_mtu_change(struct net_device *dstatic const struct nla_policy rtm_ipv6_policy[RTA_MAX +1 ] = { [RTA_GATEWAY ] = { .len =sizeof (struct in6_addr ) }, + [RTA_PREFSRC ] = { .len =sizeof (struct in6_addr ) }, [RTA_OIF ] = { .type =NLA_U32 }, [RTA_IIF ] = { .type =NLA_U32 }, [RTA_PRIORITY ] = { .type =NLA_U32 },
@@ -2719,6 +2720,7 @@ static const struct nla_policy rtm_ipv6_ [RTA_PREF] = { .type = NLA_U8 }, [RTA_ENCAP_TYPE] = { .type = NLA_U16 }, [RTA_ENCAP] = { .type = NLA_NESTED }, + [RTA_TABLE] = { .type = NLA_U32 }, }; static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
Greg Kroah-Hartman
maintainerPATCH 47/50 scsi: mptsas: Disable WRITE SAME
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin K. Petersen <[email protected]>
commit 94e5395d2403c8bc2504a7cbe4c4caaacb7b8b84 upstream.
First generation MPT Fusion controllers can not translate WRITE SAME when the attached device is a SATA drive. Disable WRITE SAME support.
--- drivers/message/fusion/mptsas.c | 1 + 1 file changed, 1 insertion(+)
drivers/message/fusion/mptsas.c +1 -0
@@ -1994,6 +1994,7 @@ static struct scsi_host_template mptsas_ .cmd_per_lun = 7, .use_clustering = ENABLE_CLUSTERING, .shost_attrs = mptscsih_host_attrs, + .no_write_same = 1, };static int mptsas_get_linkerrors (struct sas_phy *phy)
Greg Kroah-Hartman
maintainerPATCH 48/50 cdrom: information leak in cdrom_ioctl_media_changed()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 9de4ee40547fd315d4a0ed1dd15a2fa3559ad707 upstream.
This cast is wrong. "cdi->capacity" is an int and "arg" is an unsigned long. The way the check is written now, if one of the high 32 bits is set then we could read outside the info->slots[] array.
This bug is pretty old and it predates git.
--- drivers/cdrom/cdrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cdrom/cdrom.c +1 -1
@@ -2358,7 +2358,7 @@ static int cdrom_ioctl_media_changed(strif (!CDROM_CAN (CDC_SELECT_DISC ) || arg ==CDSL_CURRENT )return media_changed (cdi,1 ); -if ((unsigned int )arg >= cdi->capacity) +if (arg >= cdi->capacity)return -EINVAL ; info =kmalloc (sizeof (*info),GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 49/50 s390/cio: update chpid descriptor after resource accessibility event
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Ott <[email protected]>
commit af2e460ade0b0180d0f3812ca4f4f59cc9597f3e upstream.
Channel path descriptors have been seen as something stable (as long as the chpid is configured). Recent tests have shown that the descriptor can also be altered when the link state of a channel path changes. Thus it is necessary to update the descriptor during handling of resource accessibility events.
--- drivers/s390/cio/chsc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/s390/cio/chsc.c +11 -3
@@ -451,6 +451,7 @@ static void chsc_process_sei_link_incidestatic void chsc_process_sei_res_acc (struct chsc_sei_nt0_area *sei_area) { +struct channel_path *chp;struct chp_link link;struct chp_id chpid;int status;
@@ -463,10 +464,17 @@ static void chsc_process_sei_res_acc(str chpid.id = sei_area->rsid;/* allocate a new channel path structure, if needed */ status =chp_get_status (chpid); -if (status <0 ) -chp_new (chpid); -else if (!status) +if (!status)return ; + +if (status <0 ) { +chp_new (chpid); + }else { + chp =chpid_to_chp (chpid); +mutex_lock (&chp->lock); +chp_update_desc (chp); +mutex_unlock (&chp->lock); + }memset (&link,0 ,sizeof (struct chp_link )); link.chpid = chpid;if ((sei_area->vf &0xc0 ) !=0 ) {
Greg Kroah-Hartman
maintainerPATCH 50/50 s390/uprobes: implement arch_uretprobe_is_alive()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit 783c3b53b9506db3e05daacfe34e0287eebb09d8 upstream.
Implement s390 specific arch_uretprobe_is_alive() to avoid SIGSEGVs observed with uretprobes in combination with setjmp/longjmp.
See commit 2dea1d9c38e4 ("powerpc/uprobes: Implement arch_uretprobe_is_alive()") for more details.
With this implemented all test cases referenced in the above commit pass.
--- arch/s390/kernel/uprobes.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/s390/kernel/uprobes.c +9 -0
@@ -147,6 +147,15 @@ unsigned long arch_uretprobe_hijack_retureturn orig; } +bool arch_uretprobe_is_alive (struct return_instance *ret,enum rp_check ctx, +struct pt_regs *regs) +{ +if (ctx ==RP_CHECK_CHAIN_CALL ) +return user_stack_pointer (regs) <= ret->stack; +else +return user_stack_pointer (regs) < ret->stack; +} +/* Instruction Emulation */ static void adjust_psw_addr (psw_t *psw,unsigned long len)
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.130 release. There are 50 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 Sun Apr 29 13:56:42 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.130-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.130 release. There are 50 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 Sun Apr 29 13:56:42 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.130-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Merged, compiled, and installed onto my Pixel 2 XL and OnePlus 5.
No initial issues noticed in either dmesg or general usage.
Thanks!
Nathan
stable-rc/linux-4.4.y boot: 119 boots: 0 failed, 64 passed with 53 offline, 2 untried/unknown (v4.4.129-51-gaedfcc63a1a9)
stable-rc/linux-4.4.y boot: 119 boots: 0 failed, 64 passed with 53 offline, 2 untried/unknown (v4.4.129-51-gaedfcc63a1a9)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-4.4.y/kernel/v4.4.129-51-gaedfcc63a1a9/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-4.4.y/kernel/v4.4.129-51-gaedfcc63a1a9/
Tree: stable-rc
Branch: linux-4.4.y
Git Describe: v4.4.129-51-gaedfcc63a1a9
Git Commit: aedfcc63a1a9aca5a263e7733131589117195778
Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 57 unique boards, 21 SoC families, 16 builds out of 177
Offline Platforms:
arm:
sunxi_defconfig:
sun4i-a10-cubieboard: 1 offline lab
sun7i-a20-bananapi: 1 offline lab
sun7i-a20-cubietruck: 1 offline lab
bcm2835_defconfig:
bcm2835-rpi-b: 1 offline lab
sama5_defconfig:
at91-sama5d4_xplained: 1 offline lab
multi_v7_defconfig:
alpine-db: 1 offline lab
am335x-boneblack: 1 offline lab armada-xp-openblocks-ax3-4: 1 offline lab
at91-sama5d4_xplained: 1 offline lab
bcm4708-smartrg-sr400ac: 1 offline lab
bcm72521-bcm97252sffe: 1 offline lab
bcm7445-bcm97445c: 1 offline lab
exynos5250-arndale: 1 offline lab
exynos5420-arndale-octa: 1 offline lab
exynos5422-odroidxu3: 1 offline lab
exynos5800-peach-pi: 1 offline lab
imx6dl-wandboard_dual: 1 offline lab
imx6dl-wandboard_solo: 1 offline lab
meson8b-odroidc1: 1 offline lab
omap3-beagle: 1 offline lab
omap3-beagle-xm: 1 offline lab
omap4-panda: 1 offline lab
qcom-apq8064-cm-qs600: 1 offline lab
qcom-apq8064-ifc6410: 1 offline lab socfpga_cyclone5_de0_sockit: 1 offline lab
stih410-b2120: 1 offline lab
sun4i-a10-cubieboard: 1 offline lab
sun7i-a20-bananapi: 1 offline lab
sun7i-a20-cubietruck: 1 offline lab
tegra124-jetson-tk1: 1 offline lab
tegra20-iris-512: 1 offline lab
tegra30-beaver: 1 offline lab
vf610-colibri-eval-v3: 1 offline lab
zynq-zc702: 1 offline lab
tegra_defconfig:
tegra124-jetson-tk1: 1 offline lab
tegra20-iris-512: 1 offline lab
tegra30-beaver: 1 offline lab
imx_v6_v7_defconfig:
imx6dl-wandboard_dual: 1 offline lab
imx6dl-wandboard_solo: 1 offline lab
vf610-colibri-eval-v3: 1 offline lab
exynos_defconfig:
exynos5250-arndale: 1 offline lab
exynos5420-arndale-octa: 1 offline lab
exynos5422-odroidxu3: 1 offline lab
exynos5800-peach-pi: 1 offline lab
qcom_defconfig:
qcom-apq8064-cm-qs600: 1 offline lab
qcom-apq8064-ifc6410: 1 offline lab
omap2plus_defconfig:
am335x-boneblack: 1 offline lab
omap3-beagle: 1 offline lab
omap3-beagle-xm: 1 offline lab
omap4-panda: 1 offline lab
davinci_all_defconfig:
dm365evm,legacy: 1 offline lab
mvebu_v7_defconfig:
armada-xp-openblocks-ax3-4: 1 offline lab
arm64:
defconfig:
apq8016-sbc: 1 offline lab---
For more info write to <[email protected]>
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.130 release. There are 50 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 Sun Apr 29 13:56:42 UTC 2018. Anything received after that time might be too late.
Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.
Summary
------------------------------------------------------------------------
kernel: 4.4.130-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: aedfcc63a1a9aca5a263e7733131589117195778
git describe: v4.4.129-51-gaedfcc63a1a9
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.4-oe/build/v4.4.129-51-gaedfcc63a1a9
No regressions (compared to build v4.4.129)
Boards, architectures and test suites:
-------------------------------------
juno-r2 - arm64
* boot - pass: 20,
* kselftest - skip: 37, pass: 29,
* libhugetlbfs - skip: 1, pass: 90,
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - skip: 53, pass: 28,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - skip: 6, pass: 57,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - skip: 4, pass: 10,
* ltp-securebits-tests - pass: 4,
* ltp-timers-tests - pass: 13,
qemu_arm
* boot - pass: 10, fail: 24
* ltp-cap_bounds-tests - pass: 2,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-hugetlb-tests - skip: 1, pass: 21,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-pty-tests - pass: 4,
* ltp-securebits-tests - pass: 4,
qemu_x86_64
* boot - pass: 22,
* kselftest - skip: 40, pass: 40,
* kselftest-vsyscall-mode-native - skip: 40, pass: 40,
* kselftest-vsyscall-mode-none - skip: 40, pass: 40,
* libhugetlbfs - skip: 1, pass: 90,
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - skip: 17, pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - skip: 6, pass: 57,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - skip: 1, pass: 13,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - skip: 155, pass: 995,
* ltp-timers-tests - pass: 13,
x15 - arm
* boot - pass: 20,
* kselftest - skip: 36, pass: 29,
* libhugetlbfs - skip: 1, pass: 87,
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - skip: 18, pass: 63,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - skip: 5, pass: 58,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - skip: 2, pass: 20,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - skip: 1, pass: 13,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - skip: 78, pass: 1072,
* ltp-timers-tests - pass: 13,
x86_64
* boot - pass: 22,
* kselftest - skip: 37, pass: 41,
* kselftest-vsyscall-mode-native - skip: 37, pass: 40, fail: 1
* kselftest-vsyscall-mode-none - skip: 37, pass: 41,
* libhugetlbfs - skip: 1, pass: 90,
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - skip: 17, pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - skip: 5, pass: 58,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - skip: 5, pass: 9,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - skip: 119, pass: 1031,
* ltp-timers-tests - pass: 13,
Summary
------------------------------------------------------------------------
kernel: 4.4.130-rc1
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git tag: 4.4.130-rc1-hikey-20180427-178
git commit: 2f9fbcd225029f66acc57b4fe3f037e1b65e1804
git describe: 4.4.130-rc1-hikey-20180427-178
Test details: https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.130-rc1-hikey-20180427-178
No regressions (compared to build 4.4.129-rc2-hikey-20180423-176)
Boards, architectures and test suites:
-------------------------------------
hi6220-hikey - arm64
* boot - pass: 19,
* kselftest - skip: 38, pass: 27,
* libhugetlbfs - skip: 1, pass: 90,
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - skip: 53, pass: 28,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - skip: 6, pass: 57,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - skip: 1, pass: 21,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - skip: 4, pass: 10,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - skip: 142, pass: 1008,
* ltp-timers-tests - pass: 13,
qemu_arm64
* boot - pass: 3, fail: 17
* ltp-cap_bounds-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-syscalls-tests - skip: 162, pass: 986, fail: 2
Signature · 2 lines
Linaro QA (BETA) https://qa-reports.linaro.org
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.130 release. There are 50 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 Sun Apr 29 13:56:42 UTC 2018. Anything received after that time might be too late.
Build results:
total: 146 pass: 146 fail: 0 Qemu test results: total: 127 pass: 127 fail: 0
Details are available at http://kerneltests.org/builders/.
Guenter