4.14.110-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 1/107 Bluetooth: Check L2CAP option sizes returned from l2cap_get_conf_opt
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Holtmann <[email protected]>
commit af3d5d1c87664a4f150fcf3534c6567cb19909b0 upstream.
When doing option parsing for standard type values of 1, 2 or 4 octets, the value is converted directly into a variable instead of a pointer. To avoid being tricked into being a pointer, check that for these option types that sizes actually match. In L2CAP every option is fixed size and thus it is prudent anyway to ensure that the remote side sends us the right option size along with option paramters.
If the option size is not matching the option type, then that option is silently ignored. It is a protocol violation and instead of trying to give the remote attacker any further hints just pretend that option is not present and proceed with the default values. Implementation following the specification and its qualification procedures will always use the correct size and thus not being impacted here.
To keep the code readable and consistent accross all options, a few cosmetic changes were also required.
--- net/bluetooth/l2cap_core.c | 77 ++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 31 deletions(-)
net/bluetooth/l2cap_core.c +46 -31
@@ -3342,10 +3342,14 @@ static int l2cap_parse_conf_req(struct lswitch (type) {case L2CAP_CONF_MTU : +if (olen !=2 ) +break ; mtu = val;break ;case L2CAP_CONF_FLUSH_TO : +if (olen !=2 ) +break ; chan->flush_to = val;break ;
@@ -3353,26 +3357,30 @@ static int l2cap_parse_conf_req(struct lbreak ;case L2CAP_CONF_RFC : -if (olen ==sizeof (rfc)) -memcpy (&rfc, (void *) val, olen); +if (olen !=sizeof (rfc)) +break ; +memcpy (&rfc, (void *) val, olen);break ;case L2CAP_CONF_FCS : +if (olen !=1 ) +break ;if (val ==L2CAP_FCS_NONE )set_bit (CONF_RECV_NO_FCS , &chan->conf_state);break ;case L2CAP_CONF_EFS : -if (olen ==sizeof (efs)) { - remote_efs =1 ; -memcpy (&efs, (void *) val, olen); - } +if (olen !=sizeof (efs)) +break ; + remote_efs =1 ; +memcpy (&efs, (void *) val, olen);break ;case L2CAP_CONF_EWS : +if (olen !=2 ) +break ;if (!(chan->conn->local_fixed_chan &L2CAP_FC_A2MP ))return -ECONNREFUSED ; -set_bit (FLAG_EXT_CTRL , &chan->flags);set_bit (CONF_EWS_RECV , &chan->conf_state); chan->tx_win_max =L2CAP_DEFAULT_EXT_WINDOW ;
@@ -3382,7 +3390,6 @@ static int l2cap_parse_conf_req(struct ldefault :if (hint)break ; - result =L2CAP_CONF_UNKNOWN ; *((u8 *) ptr++) = type;break ;
@@ -3550,55 +3557,60 @@ static int l2cap_parse_conf_rsp(struct lswitch (type) {case L2CAP_CONF_MTU : +if (olen !=2 ) +break ;if (val <L2CAP_DEFAULT_MIN_MTU ) { *result =L2CAP_CONF_UNACCEPT ; chan->imtu =L2CAP_DEFAULT_MIN_MTU ; }else chan->imtu = val; -l2cap_add_conf_opt (&ptr,L2CAP_CONF_MTU ,2 , chan->imtu, endptr - ptr); +l2cap_add_conf_opt (&ptr,L2CAP_CONF_MTU ,2 , chan->imtu, + endptr - ptr);break ;case L2CAP_CONF_FLUSH_TO : +if (olen !=2 ) +break ; chan->flush_to = val; -l2cap_add_conf_opt (&ptr,L2CAP_CONF_FLUSH_TO , -2 , chan->flush_to, endptr - ptr); +l2cap_add_conf_opt (&ptr,L2CAP_CONF_FLUSH_TO ,2 , + chan->flush_to, endptr - ptr);break ;case L2CAP_CONF_RFC : -if (olen ==sizeof (rfc)) -memcpy (&rfc, (void *)val, olen); - +if (olen !=sizeof (rfc)) +break ; +memcpy (&rfc, (void *)val, olen);if (test_bit (CONF_STATE2_DEVICE , &chan->conf_state) && rfc.mode != chan->mode)return -ECONNREFUSED ; - chan->fcs =0 ; - -l2cap_add_conf_opt (&ptr,L2CAP_CONF_RFC , -sizeof (rfc), (unsigned long ) &rfc, endptr - ptr); +l2cap_add_conf_opt (&ptr,L2CAP_CONF_RFC ,sizeof (rfc), + (unsigned long ) &rfc, endptr - ptr);break ;case L2CAP_CONF_EWS : +if (olen !=2 ) +break ; chan->ack_win =min_t (u16, val, chan->ack_win);l2cap_add_conf_opt (&ptr,L2CAP_CONF_EWS ,2 , chan->tx_win, endptr - ptr);break ;case L2CAP_CONF_EFS : -if (olen ==sizeof (efs)) { -memcpy (&efs, (void *)val, olen); - -if (chan->local_stype !=L2CAP_SERV_NOTRAFIC && - efs.stype !=L2CAP_SERV_NOTRAFIC && - efs.stype != chan->local_stype) -return -ECONNREFUSED ; - -l2cap_add_conf_opt (&ptr,L2CAP_CONF_EFS ,sizeof (efs), - (unsigned long ) &efs, endptr - ptr); - } +if (olen !=sizeof (efs)) +break ; +memcpy (&efs, (void *)val, olen); +if (chan->local_stype !=L2CAP_SERV_NOTRAFIC && + efs.stype !=L2CAP_SERV_NOTRAFIC && + efs.stype != chan->local_stype) +return -ECONNREFUSED ; +l2cap_add_conf_opt (&ptr,L2CAP_CONF_EFS ,sizeof (efs), + (unsigned long ) &efs, endptr - ptr);break ;case L2CAP_CONF_FCS : +if (olen !=1 ) +break ;if (*result ==L2CAP_CONF_PENDING )if (val ==L2CAP_FCS_NONE ) set_bit(CONF_RECV_NO_FCS,
@@ -3730,10 +3742,13 @@ static void l2cap_conf_rfc_get(struct l2switch (type) {case L2CAP_CONF_RFC : -if (olen ==sizeof (rfc)) -memcpy (&rfc, (void *)val, olen); +if (olen !=sizeof (rfc)) +break ; +memcpy (&rfc, (void *)val, olen);break ;case L2CAP_CONF_EWS : +if (olen !=2 ) +break ; txwin_ext = val;break ; }
Greg Kroah-Hartman
maintainerPATCH 10/107 net: rose: fix a possible stack overflow
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit e5dcc0c3223c45c94100f05f28d8ef814db3d82c ]
rose_write_internal() uses a temp buffer of 100 bytes, but a manual inspection showed that given arbitrary input, rose_create_facilities() can fill up to 110 bytes.
Lets use a tailroom of 256 bytes for peace of mind, and remove the bounce buffer : we can simply allocate a big enough skb and adjust its length as needed.
syzbot report :
BUG: KASAN: stack-out-of-bounds in memcpy include/linux/string.h:352 [inline]
BUG: KASAN: stack-out-of-bounds in rose_create_facilities net/rose/rose_subr.c:521 [inline]
BUG: KASAN: stack-out-of-bounds in rose_write_internal+0x597/0x15d0 net/rose/rose_subr.c:116
Write of size 7 at addr ffff88808b1ffbef by task syz-executor.0/24854
CPU: 0 PID: 24854 Comm: syz-executor.0 Not tainted 5.0.0+ #97
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x172/0x1f0 lib/dump_stack.c:113
print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
check_memory_region_inline mm/kasan/generic.c:185 [inline]
check_memory_region+0x123/0x190 mm/kasan/generic.c:191
memcpy+0x38/0x50 mm/kasan/common.c:131
memcpy include/linux/string.h:352 [inline]
rose_create_facilities net/rose/rose_subr.c:521 [inline]
rose_write_internal+0x597/0x15d0 net/rose/rose_subr.c:116
rose_connect+0x7cb/0x1510 net/rose/af_rose.c:826
__sys_connect+0x266/0x330 net/socket.c:1685
__do_sys_connect net/socket.c:1696 [inline]
__se_sys_connect net/socket.c:1693 [inline]
__x64_sys_connect+0x73/0xb0 net/socket.c:1693
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x458079
Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f47b8d9dc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000458079
RDX: 000000000000001c RSI: 0000000020000040 RDI: 0000000000000004
RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f47b8d9e6d4
R13: 00000000004be4a4 R14: 00000000004ceca8 R15: 00000000ffffffff
The buggy address belongs to the page:
page:ffffea00022c7fc0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x1fffc0000000000()
raw: 01fffc0000000000 0000000000000000 ffffffff022c0101 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88808b1ffa80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88808b1ffb00: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 03
>ffff88808b1ffb80: f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 04 f3
^
ffff88808b1ffc00: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
ffff88808b1ffc80: 00 00 00 00 00 00 00 f1 f1 f1 f1 f1 f1 01 f2 01--- net/rose/rose_subr.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
net/rose/rose_subr.c +12 -9
@@ -105,16 +105,17 @@ void rose_write_internal(struct sock *skstruct sk_buff *skb;unsigned char *dptr;unsigned char lci1, lci2; -char buffer[100 ]; -int len, faclen =0 ; +int maxfaclen =0 ; +int len, faclen; +int reserve; - len =AX25_BPQ_HEADER_LEN +AX25_MAX_HEADER_LEN +ROSE_MIN_LEN +1 ; + reserve =AX25_BPQ_HEADER_LEN +AX25_MAX_HEADER_LEN +1 ; + len =ROSE_MIN_LEN ;switch (frametype) {case ROSE_CALL_REQUEST : len +=1 +ROSE_ADDR_LEN +ROSE_ADDR_LEN ; - faclen =rose_create_facilities (buffer, rose); - len += faclen; + maxfaclen =256 ;break ;case ROSE_CALL_ACCEPTED :case ROSE_CLEAR_REQUEST :
@@ -123,15 +124,16 @@ void rose_write_internal(struct sock *skbreak ; } -if ((skb =alloc_skb (len,GFP_ATOMIC )) ==NULL ) + skb =alloc_skb (reserve + len + maxfaclen,GFP_ATOMIC ); +if (!skb)return ;/* * Space for AX.25 header and PID. */ -skb_reserve (skb,AX25_BPQ_HEADER_LEN +AX25_MAX_HEADER_LEN +1 ); +skb_reserve (skb, reserve); - dptr =skb_put (skb,skb_tailroom (skb)); + dptr =skb_put (skb, len); lci1 = (rose->lci >>8 ) &0x0F ; lci2 = (rose->lci >>0 ) &0xFF ;
@@ -146,7 +148,8 @@ void rose_write_internal(struct sock *sk dptr +=ROSE_ADDR_LEN ;memcpy (dptr, &rose->source_addr,ROSE_ADDR_LEN ); dptr +=ROSE_ADDR_LEN ; -memcpy (dptr, buffer, faclen); + faclen =rose_create_facilities (dptr, rose); +skb_put (skb, faclen); dptr += faclen;break ;
Greg Kroah-Hartman
maintainerPATCH 11/107 net: stmmac: fix memory corruption with large MTUs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaro Koskinen <[email protected]>
[ Upstream commit 223a960c01227e4dbcb6f9fa06b47d73bda21274 ]
When using 16K DMA buffers and ring mode, the DES3 refill is not working correctly as the function is using a bogus pointer for checking the private data. As a result stale pointers will remain in the RX descriptor ring, so DMA will now likely overwrite/corrupt some already freed memory.
As simple reproducer, just receive some UDP traffic:
# ifconfig eth0 down; ifconfig eth0 mtu 9000; ifconfig eth0 up # iperf3 -c 192.168.253.40 -u -b 0 -R
If you didn't crash by now check the RX descriptors to find non-contiguous RX buffers:
cat /sys/kernel/debug/stmmaceth/eth0/descriptors_status [...] 1 [0x2be5020]: 0xa3220321 0x9ffc1ffc 0x72d70082 0x130e207e ^^^^^^^^^^^^^^^^^^^^^ 2 [0x2be5040]: 0xa3220321 0x9ffc1ffc 0x72998082 0x1311a07e ^^^^^^^^^^^^^^^^^^^^^
A simple ping test will now report bad data:
# ping -s 8200 192.168.253.40 PING 192.168.253.40 (192.168.253.40) 8200(8228) bytes of data. 8208 bytes from 192.168.253.40: icmp_seq=1 ttl=64 time=1.00 ms wrong data byte #8144 should be 0xd0 but was 0x88
Fix the wrong pointer. Also we must refill DES3 only if the DMA buffer size is 16K.
--- drivers/net/ethernet/stmicro/stmmac/ring_mode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/ring_mode.c +3 -2
@@ -114,10 +114,11 @@ static unsigned int stmmac_is_jumbo_frm(static void stmmac_refill_desc3 (void *priv_ptr,struct dma_desc *p) { -struct stmmac_priv *priv = (struct stmmac_priv *)priv_ptr; +struct stmmac_rx_queue *rx_q = priv_ptr; +struct stmmac_priv *priv = rx_q->priv_data;/* Fill DES3 in case of RING mode */ -if (priv->dma_buf_sz >= BUF_SIZE_8KiB) +if (priv->dma_buf_sz == BUF_SIZE_16KiB) p->des3 =cpu_to_le32 (le32_to_cpu (p->des2) + BUF_SIZE_8KiB); }
Greg Kroah-Hartman
maintainerPATCH 12/107 net-sysfs: call dev_hold if kobject_init_and_add success
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: YueHaibing <[email protected]>
[ Upstream commit a3e23f719f5c4a38ffb3d30c8d7632a4ed8ccd9e ]
In netdev_queue_add_kobject and rx_queue_add_kobject, if sysfs_create_group failed, kobject_put will call netdev_queue_release to decrease dev refcont, however dev_hold has not be called. So we will see this while unregistering dev:
unregister_netdevice: waiting for bcsh0 to become free. Usage count = -1
--- net/core/net-sysfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/net-sysfs.c +4 -2
@@ -917,6 +917,8 @@ static int rx_queue_add_kobject(struct nif (error)return error; +dev_hold (queue->dev); +if (dev->sysfs_rx_queue_group) { error =sysfs_create_group (kobj, dev->sysfs_rx_queue_group);if (error) {
@@ -926,7 +928,6 @@ static int rx_queue_add_kobject(struct n }kobject_uevent (kobj,KOBJ_ADD ); -dev_hold (queue->dev);return error; }
@@ -1327,6 +1328,8 @@ static int netdev_queue_add_kobject(struif (error)return error; +dev_hold (queue->dev); +#ifdef CONFIG_BQL error =sysfs_create_group (kobj, &dql_group);if (error) {
@@ -1336,7 +1339,6 @@ static int netdev_queue_add_kobject(stru#endif kobject_uevent (kobj,KOBJ_ADD ); -dev_hold (queue->dev);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 13/107 packets: Always register packet sk in the same order
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit a4dc6a49156b1f8d6e17251ffda17c9e6a5db78a ]
When using fanouts with AF_PACKET, the demux functions such as fanout_demux_cpu will return an index in the fanout socket array, which corresponds to the selected socket.
The ordering of this array depends on the order the sockets were added to a given fanout group, so for FANOUT_CPU this means sockets are bound to cpus in the order they are configured, which is OK.
However, when stopping then restarting the interface these sockets are bound to, the sockets are reassigned to the fanout group in the reverse order, due to the fact that they were inserted at the head of the interface's AF_PACKET socket list.
This means that traffic that was directed to the first socket in the fanout group is now directed to the last one after an interface restart.
In the case of FANOUT_CPU, traffic from CPU0 will be directed to the socket that used to receive traffic from the last CPU after an interface restart.
This commit introduces a helper to add a socket at the tail of a list, then uses it to register AF_PACKET sockets.
Note that this changes the order in which sockets are listed in /proc and with sock_diag.
--- include/net/sock.h | 6 ++++++ net/packet/af_packet.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
include/net/sock.h +6 -0
@@ -682,6 +682,12 @@ static inline void sk_add_node_rcu(struchlist_add_head_rcu (&sk->sk_node, list); } +static inline void sk_add_node_tail_rcu (struct sock *sk,struct hlist_head *list) +{ +sock_hold (sk); +hlist_add_tail_rcu (&sk->sk_node, list); +} +static inline void __sk_nulls_add_node_rcu (struct sock *sk,struct hlist_nulls_head *list) {hlist_nulls_add_head_rcu (&sk->sk_nulls_node, list);
net/packet/af_packet.c +1 -1
@@ -3281,7 +3281,7 @@ static int packet_create(struct net *net }mutex_lock (&net->packet.sklist_lock); -sk_add_node_rcu (sk, &net->packet.sklist); +sk_add_node_tail_rcu (sk, &net->packet.sklist);mutex_unlock (&net->packet.sklist_lock);preempt_disable ();
Greg Kroah-Hartman
maintainerPATCH 14/107 rhashtable: Still do rehash when we get EEXIST
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 408f13ef358aa5ad56dc6230c2c7deb92cf462b1 ]
As it stands if a shrink is delayed because of an outstanding rehash, we will go into a rescheduling loop without ever doing the rehash.
This patch fixes this by still carrying out the rehash and then rescheduling so that we can shrink after the completion of the rehash should it still be necessary.
The return value of EEXIST captures this case and other cases (e.g., another thread expanded/rehashed the table at the same time) where we should still proceed with the rehash.
--- lib/rhashtable.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
lib/rhashtable.c +6 -2
@@ -459,8 +459,12 @@ static void rht_deferred_worker(struct welse if (tbl->nest) err =rhashtable_rehash_alloc (ht, tbl, tbl->size); -if (!err) - err =rhashtable_rehash_table (ht); +if (!err || err == -EEXIST ) { +int nerr; + + nerr =rhashtable_rehash_table (ht); + err = err ?: nerr; + }mutex_unlock (&ht->mutex);
Greg Kroah-Hartman
maintainerPATCH 15/107 tcp: do not use ipv6 header for ipv4 flow
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 89e4130939a20304f4059ab72179da81f5347528 ]
When a dual stack tcp listener accepts an ipv4 flow,
it should not attempt to use an ipv6 header or tcp_v6_iif() helper.
--- net/ipv6/tcp_ipv6.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/ipv6/tcp_ipv6.c +4 -4
@@ -1083,11 +1083,11 @@ static struct sock *tcp_v6_syn_recv_sock newnp->ipv6_fl_list =NULL ; newnp->pktoptions =NULL ; newnp->opt =NULL ; - newnp->mcast_oif =tcp_v6_iif (skb); - newnp->mcast_hops =ipv6_hdr (skb)->hop_limit; - newnp->rcv_flowinfo =ip6_flowinfo (ipv6_hdr (skb)); + newnp->mcast_oif =inet_iif (skb); + newnp->mcast_hops =ip_hdr (skb)->ttl; + newnp->rcv_flowinfo =0 ;if (np->repflow) - newnp->flow_label =ip6_flowlabel (ipv6_hdr (skb)); + newnp->flow_label =0 ;/* * No need to charge this sock to the relevant IPv6 refcnt debug socks count
Greg Kroah-Hartman
maintainerPATCH 16/107 thunderx: enable page recycling for non-XDP case
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dean Nelson <[email protected]>
[ Upstream commit b3e208069477588c06f4d5d986164b435bb06e6d ]
Commit 773225388dae15e72790 ("net: thunderx: Optimize page recycling for XDP") added code to nicvf_alloc_page() that inadvertently disables receive buffer page recycling for the non-XDP case by always NULL'ng the page pointer.
This patch corrects two if-conditionals to allow for the recycling of non-XDP mode pages by only setting the page pointer to NULL when the page is not ready for recycling.
--- drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 23 ++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/net/ethernet/cavium/thunder/nicvf_queues.c +11 -12
@@ -105,20 +105,19 @@ static inline struct pgcache *nicvf_allo/* Check if page can be recycled */ if (page) { ref_count =page_ref_count (page); -/* Check if this page has been used once i.e 'put_page' -* called after packet transmission i.e internal ref_count -* and page's ref_count are equal i.e page can be recycled. +/* This page can be recycled if internal ref_count and page's +* ref_count are equal, indicating that the page has been used +* once for packet transmission. For non-XDP mode, internal +* ref_count is always '1'. */ -if (rbdr->is_xdp && (ref_count == pgcache->ref_count)) - pgcache->ref_count--; -else - page =NULL ; - -/* In non-XDP mode, page's ref_count needs to be '1' for it -* to be recycled. -*/ -if (!rbdr->is_xdp && (ref_count !=1 )) +if (rbdr->is_xdp) { +if (ref_count == pgcache->ref_count) + pgcache->ref_count--; +else + page =NULL ; + }else if (ref_count !=1 ) { page =NULL ; + } }if (!page) {
Greg Kroah-Hartman
maintainerPATCH 17/107 thunderx: eliminate extra calls to put_page() for pages held for recycling
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dean Nelson <[email protected]>
[ Upstream commit cd35ef91490ad8049dd180bb060aff7ee192eda9 ]
For the non-XDP case, commit 773225388dae15e72790 ("net: thunderx: Optimize page recycling for XDP") added code to nicvf_free_rbdr() that, when releasing the additional receive buffer page reference held for recycling, repeatedly calls put_page() until the page's _refcount goes to zero. Which results in the page being freed.
This is not okay if the page's _refcount was greater than 1 (in the non-XDP case), because nicvf_free_rbdr() should not be subtracting more than what nicvf_alloc_page() had previously added to the page's _refcount, which was only 1 (in the non-XDP case).
This can arise if a received packet is still being processed and the receive buffer (i.e., skb->head) has not yet been freed via skb_free_head() when nicvf_free_rbdr() is spinning through the aforementioned put_page() loop.
If this should occur, when the received packet finishes processing and skb_free_head() is called, various problems can ensue. Exactly what, depends on whether the page has already been reallocated or not, anything from "BUG: Bad page state ... ", to "Unable to handle kernel NULL pointer dereference ..." or "Unable to handle kernel paging request...".
So this patch changes nicvf_free_rbdr() to only call put_page() once for pages held for recycling (in the non-XDP case).
--- drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/cavium/thunder/nicvf_queues.c +3 -4
@@ -364,11 +364,10 @@ static void nicvf_free_rbdr(struct nicvfwhile (head < rbdr->pgcnt) { pgcache = &rbdr->pgcache[head];if (pgcache->page &&page_ref_count (pgcache->page) !=0 ) { -if (!rbdr->is_xdp) { -put_page (pgcache->page); -continue ; +if (rbdr->is_xdp) { +page_ref_sub (pgcache->page, + pgcache->ref_count -1 ); } -page_ref_sub (pgcache->page, pgcache->ref_count -1 );put_page (pgcache->page); } head++;
Greg Kroah-Hartman
maintainerPATCH 18/107 vxlan: Dont call gro_cells_destroy() before device is unregistered
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiqiang Liu <[email protected]>
[ Upstream commit cc4807bb609230d8959fd732b0bf3bd4c2de8eac ]
Commit ad6c9986bcb62 ("vxlan: Fix GRO cells race condition between receive and link delete") fixed a race condition for the typical case a vxlan device is dismantled from the current netns. But if a netns is dismantled, vxlan_destroy_tunnels() is called to schedule a unregister_netdevice_queue() of all the vxlan tunnels that are related to this netns.
In vxlan_destroy_tunnels(), gro_cells_destroy() is called and finished before unregister_netdevice_queue(). This means that the gro_cells_destroy() call is done too soon, for the same reasons explained in above commit.
So we need to fully respect the RCU rules, and thus must remove the gro_cells_destroy() call or risk use after-free.
--- drivers/net/vxlan.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/vxlan.c +1 -3
@@ -3793,10 +3793,8 @@ static void __net_exit vxlan_exit_net(st/* If vxlan->dev is in the same netns, it has already been added * to the list by the previous loop. */ -if (!net_eq (dev_net (vxlan->dev), net)) { -gro_cells_destroy (&vxlan->gro_cells); +if (!net_eq (dev_net (vxlan->dev), net))unregister_netdevice_queue (vxlan->dev, &list); - } }unregister_netdevice_many (&list);
Greg Kroah-Hartman
maintainerPATCH 19/107 sctp: get sctphdr by offset in sctp_compute_cksum
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 273160ffc6b993c7c91627f5a84799c66dfe4dee ]
sctp_hdr(skb) only works when skb->transport_header is set properly.
But in Netfilter, skb->transport_header for ipv6 is not guaranteed to be right value for sctphdr. It would cause to fail to check the checksum for sctp packets.
So fix it by using offset, which is always right in all places.
v1->v2:
- Fix the changelog.
--- include/net/sctp/checksum.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/sctp/checksum.h +1 -1
@@ -60,7 +60,7 @@ static inline __wsum sctp_csum_combine(_static inline __le32 sctp_compute_cksum (const struct sk_buff *skb,unsigned int offset) { -struct sctphdr *sh =sctp_hdr (skb); +struct sctphdr *sh = (struct sctphdr *)(skb->data + offset);__le32 ret, old = sh->checksum;const struct skb_checksum_ops ops = { .update = sctp_csum_update,
Greg Kroah-Hartman
maintainerPATCH 2/107 Bluetooth: Verify that l2cap_get_conf_opt provides large enough buffer
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Holtmann <[email protected]>
commit 7c9cbd0b5e38a1672fcd137894ace3b042dfbf69 upstream.
The function l2cap_get_conf_opt will return L2CAP_CONF_OPT_SIZE + opt->len as length value. The opt->len however is in control over the remote user and can be used by an attacker to gain access beyond the bounds of the actual packet.
To prevent any potential leak of heap memory, it is enough to check that the resulting len calculation after calling l2cap_get_conf_opt is not below zero. A well formed packet will always return >= 0 here and will end with the length value being zero after the last option has been parsed. In case of malformed packets messing with the opt->len field the length value will become negative. If that is the case, then just abort and ignore the option.
In case an attacker uses a too short opt->len value, then garbage will be parsed, but that is protected by the unknown option handling and also the option parameter size checks.
--- net/bluetooth/l2cap_core.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/bluetooth/l2cap_core.c +6 -0
@@ -3336,6 +3336,8 @@ static int l2cap_parse_conf_req(struct lwhile (len >=L2CAP_CONF_OPT_SIZE ) { len -=l2cap_get_conf_opt (&req, &type, &olen, &val); +if (len <0 ) +break ; hint = type &L2CAP_CONF_HINT ; type &=L2CAP_CONF_MASK ;
@@ -3554,6 +3556,8 @@ static int l2cap_parse_conf_rsp(struct lwhile (len >=L2CAP_CONF_OPT_SIZE ) { len -=l2cap_get_conf_opt (&rsp, &type, &olen, &val); +if (len <0 ) +break ;switch (type) {case L2CAP_CONF_MTU :
@@ -3739,6 +3743,8 @@ static void l2cap_conf_rfc_get(struct l2while (len >=L2CAP_CONF_OPT_SIZE ) { len -=l2cap_get_conf_opt (&rsp, &type, &olen, &val); +if (len <0 ) +break ;switch (type) {case L2CAP_CONF_RFC :
Greg Kroah-Hartman
maintainerPATCH 20/107 net: aquantia: fix rx checksum offload for UDP/TCP over IPv6
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Bogdanov <[email protected]>
[ Upstream commit a7faaa0c5dc7d091cc9f72b870d7edcdd6f43f12 ]
TCP/UDP checksum validity was propagated to skb
only if IP checksum is valid.
But for IPv6 there is no validity as there is no checksum in IPv6. This patch propagates TCP/UDP checksum validity regardless of IP checksum.
--- drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_ring.c +3 -2
@@ -270,11 +270,12 @@ int aq_ring_rx_clean(struct aq_ring_s *s }else {if (buff->is_ip_cso) {__skb_incr_checksum_unnecessary (skb); -if (buff->is_udp_cso || buff->is_tcp_cso) -__skb_incr_checksum_unnecessary (skb); }else { skb->ip_summed =CHECKSUM_NONE ; } + +if (buff->is_udp_cso || buff->is_tcp_cso) +__skb_incr_checksum_unnecessary (skb); } skb_set_hash(skb, buff->rss_hash,
Greg Kroah-Hartman
maintainerPATCH 22/107 tun: properly test for IFF_UP
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 4477138fa0ae4e1b699786ef0600863ea6e6c61c ]
Same reasons than the ones explained in commit 4179cb5a4c92 ("vxlan: test dev->flags & IFF_UP before calling netif_rx()")
netif_rx_ni() or napi_gro_frags() must be called under a strict contract.
At device dismantle phase, core networking clears IFF_UP and flush_all_backlogs() is called after rcu grace period to make sure no incoming packet might be in a cpu backlog and still referencing the device.
A similar protocol is used for gro layer.
Most drivers call netif_rx() from their interrupt handler, and since the interrupts are disabled at device dismantle, netif_rx() does not have to check dev->flags & IFF_UP
Virtual drivers do not have this guarantee, and must therefore make the check themselves.
--- drivers/net/tun.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/tun.c +11 -4
@@ -1403,9 +1403,6 @@ static ssize_t tun_get_user(struct tun_su32 rxhash;int skb_xdp =1 ; -if (!(tun->dev->flags &IFF_UP )) -return -EIO ; -if (!(tun->flags &IFF_NO_PI )) {if (len <sizeof (pi))return -EINVAL ;
@@ -1493,9 +1490,11 @@ static ssize_t tun_get_user(struct tun_s err =skb_copy_datagram_from_iter (skb,0 , from, len);if (err) { + err = -EFAULT ; +drop:this_cpu_inc (tun->pcpu_stats->rx_dropped);kfree_skb (skb); -return -EFAULT ; +return err; } }
@@ -1566,11 +1565,19 @@ static ssize_t tun_get_user(struct tun_s } rxhash =__skb_get_hash_symmetric (skb); + +rcu_read_lock (); +if (unlikely (!(tun->dev->flags &IFF_UP ))) { + err = -EIO ; + goto drop; + } +#ifndef CONFIG_4KSTACKS tun_rx_batched (tun, tfile, skb, more);#else netif_rx_ni (skb);#endif +rcu_read_unlock (); stats =get_cpu_ptr (tun->pcpu_stats);u64_stats_update_begin (&stats->syncp);
Greg Kroah-Hartman
maintainerPATCH 23/107 tun: add a missing rcu_read_unlock() in error path
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 9180bb4f046064dfa4541488102703b402bb04e1 upstream.
In my latest patch I missed one rcu_read_unlock(), in case device is down.
--- drivers/net/tun.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/tun.c +1 -0
@@ -1569,6 +1569,7 @@ drop:rcu_read_lock ();if (unlikely (!(tun->dev->flags &IFF_UP ))) { err = -EIO ; +rcu_read_unlock (); goto drop; }
Greg Kroah-Hartman
maintainerPATCH 24/107 powerpc/64s: Add support for ori barrier_nospec patching
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Suchanek <[email protected]>
commit 2eea7f067f495e33b8b116b35b5988ab2b8aec55 upstream.
Based on the RFI patching. This is required to be able to disable the speculation barrier.
Only one barrier type is supported and it does nothing when the firmware does not enable it. Also re-patching modules is not supported So the only meaningful thing that can be done is patching out the speculation barrier at boot when the user says it is not wanted.
--- arch/powerpc/include/asm/barrier.h | 2 +- arch/powerpc/include/asm/feature-fixups.h | 9 +++++++++ arch/powerpc/include/asm/setup.h | 1 + arch/powerpc/kernel/security.c | 9 +++++++++ arch/powerpc/kernel/vmlinux.lds.S | 7 +++++++ arch/powerpc/lib/feature-fixups.c | 27 +++++++++++++++++++++++++++ 6 files changed, 54 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/barrier.h +1 -1
@@ -81,7 +81,7 @@ do { \* Prevent execution of subsequent instructions until preceding branches have * been fully resolved and are no longer executing speculatively. */ -#define barrier_nospec_asm ori 31,31,0 +#define barrier_nospec_asm NOSPEC_BARRIER_FIXUP_SECTION; nop// This also acts as a compiler barrier due to the memory clobber. #define barrier_nospec () asm (stringify_in_c(barrier_nospec_asm) ::: "memory")
arch/powerpc/include/asm/feature-fixups.h +9 -0
@@ -211,6 +211,14 @@ label##3: \ FTR_ENTRY_OFFSET 951b-952b; \ .popsection; +#define NOSPEC_BARRIER_FIXUP_SECTION \ +953: \ + .pushsection __barrier_nospec_fixup,"a"; \ + .align 2; \ +954: \ + FTR_ENTRY_OFFSET 953b-954b; \ + .popsection; +#ifndef __ASSEMBLY__#include <linux/types.h>
@@ -219,6 +227,7 @@ extern long stf_barrier_fallback;extern long __start___stf_entry_barrier_fixup, __stop___stf_entry_barrier_fixup;extern long __start___stf_exit_barrier_fixup, __stop___stf_exit_barrier_fixup;extern long __start___rfi_flush_fixup, __stop___rfi_flush_fixup; +extern long __start___barrier_nospec_fixup, __stop___barrier_nospec_fixup;void apply_feature_fixups (void );void setup_feature_keys (void );
arch/powerpc/include/asm/setup.h +1 -0
@@ -52,6 +52,7 @@ enum l1d_flush_type {void setup_rfi_flush (enum l1d_flush_type ,bool enable);void do_rfi_flush_fixups (enum l1d_flush_type types); +void do_barrier_nospec_fixups (bool enable);#endif /* !__ASSEMBLY__ */
arch/powerpc/kernel/security.c +9 -0
@@ -10,10 +10,19 @@#include <asm/debugfs.h> #include <asm/security_features.h> +#include <asm/setup.h> unsigned long powerpc_security_features__read_mostly =SEC_FTR_DEFAULT ; +static bool barrier_nospec_enabled; + +static void enable_barrier_nospec (bool enable) +{ + barrier_nospec_enabled = enable; +do_barrier_nospec_fixups (enable); +} +ssize_t cpu_show_meltdown (struct device *dev,struct device_attribute *attr,char *buf) {bool thread_priv;
arch/powerpc/kernel/vmlinux.lds.S +7 -0
@@ -153,6 +153,13 @@ SECTIONS *(__rfi_flush_fixup) __stop___rfi_flush_fixup = .; } + + . = ALIGN(8); + __spec_barrier_fixup : AT(ADDR(__spec_barrier_fixup) - LOAD_OFFSET) { + __start___barrier_nospec_fixup = .; + *(__barrier_nospec_fixup) + __stop___barrier_nospec_fixup = .; + } #endif EXCEPTION_TABLE(0)
arch/powerpc/lib/feature-fixups.c +27 -0
@@ -277,6 +277,33 @@ void do_rfi_flush_fixups(enum l1d_flush_ (types &L1D_FLUSH_MTTRIG ) ?"mttrig type" : "unknown"); } + +void do_barrier_nospec_fixups (bool enable) +{ +unsigned int instr, *dest; +long *start, *end; +int i; + + start =PTRRELOC (&__start___barrier_nospec_fixup), + end =PTRRELOC (&__stop___barrier_nospec_fixup); + + instr =0x60000000 ;/* nop */ + +if (enable) { +pr_info ("barrier-nospec: using ORI speculation barrier\n" ); + instr =0x63ff0000 ;/* ori 31,31,0 speculation barrier */ + } + +for (i =0 ; start < end; start++, i++) { + dest = (void *)start + *start; + +pr_devel ("patching dest %lx\n" , (unsigned long )dest); +patch_instruction (dest, instr); + } + +printk (KERN_DEBUG "barrier-nospec: patched %d locations\n" , i); +} +#endif /* CONFIG_PPC_BOOK3S_64 */ void do_lwsync_fixups (unsigned long value,void *fixup_start,void *fixup_end)
Greg Kroah-Hartman
maintainerPATCH 25/107 powerpc/64s: Patch barrier_nospec in modules
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Suchanek <[email protected]>
commit 815069ca57c142eb71d27439bc27f41a433a67b3 upstream.
Note that unlike RFI which is patched only in kernel the nospec state reflects settings at the time the module was loaded.
Iterating all modules and re-patching every time the settings change is not implemented.
Based on lwsync patching.
--- arch/powerpc/include/asm/setup.h | 7 +++++++ arch/powerpc/kernel/module.c | 6 ++++++ arch/powerpc/kernel/security.c | 2 +- arch/powerpc/lib/feature-fixups.c | 16 +++++++++++++--- 4 files changed, 27 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/setup.h +7 -0
@@ -53,6 +53,13 @@ enum l1d_flush_type {void setup_rfi_flush (enum l1d_flush_type ,bool enable);void do_rfi_flush_fixups (enum l1d_flush_type types);void do_barrier_nospec_fixups (bool enable); +extern bool barrier_nospec_enabled; + +#ifdef CONFIG_PPC_BOOK3S_64 +void do_barrier_nospec_fixups_range (bool enable,void *start,void *end); +#else +static inline void do_barrier_nospec_fixups_range (bool enable,void *start,void *end) { }; +#endif #endif /* !__ASSEMBLY__ */
arch/powerpc/kernel/module.c +6 -0
@@ -72,6 +72,12 @@ int module_finalize(const Elf_Ehdr *hdr,do_feature_fixups (powerpc_firmware_features, (void *)sect->sh_addr, (void *)sect->sh_addr + sect->sh_size); + + sect =find_section (hdr, sechdrs,"__spec_barrier_fixup" ); +if (sect !=NULL ) +do_barrier_nospec_fixups_range (barrier_nospec_enabled, + (void *)sect->sh_addr, + (void *)sect->sh_addr + sect->sh_size);#endif sect =find_section (hdr, sechdrs,"__lwsync_fixup" );
arch/powerpc/kernel/security.c +1 -1
@@ -15,7 +15,7 @@unsigned long powerpc_security_features__read_mostly =SEC_FTR_DEFAULT ; -static bool barrier_nospec_enabled; +bool barrier_nospec_enabled;static void enable_barrier_nospec (bool enable) {
arch/powerpc/lib/feature-fixups.c +13 -3
@@ -278,14 +278,14 @@ void do_rfi_flush_fixups(enum l1d_flush_ : "unknown"); } -void do_barrier_nospec_fixups (bool enable) +void do_barrier_nospec_fixups_range (bool enable,void *fixup_start,void *fixup_end) {unsigned int instr, *dest;long *start, *end;int i; - start =PTRRELOC (&__start___barrier_nospec_fixup), - end =PTRRELOC (&__stop___barrier_nospec_fixup); + start = fixup_start; + end = fixup_end; instr =0x60000000 ;/* nop */
@@ -304,6 +304,16 @@ void do_barrier_nospec_fixups(bool enabl printk(KERN_DEBUG "barrier-nospec: patched %d locations\n", i); } +void do_barrier_nospec_fixups (bool enable) +{ +void *start, *end; + + start =PTRRELOC (&__start___barrier_nospec_fixup), + end =PTRRELOC (&__stop___barrier_nospec_fixup); + +do_barrier_nospec_fixups_range (enable, start, end); +} +#endif /* CONFIG_PPC_BOOK3S_64 */ void do_lwsync_fixups (unsigned long value,void *fixup_start,void *fixup_end)
Greg Kroah-Hartman
maintainerPATCH 26/107 powerpc/64s: Enable barrier_nospec based on firmware settings
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Suchanek <[email protected]>
commit cb3d6759a93c6d0aea1c10deb6d00e111c29c19c upstream.
Check what firmware told us and enable/disable the barrier_nospec as appropriate.
We err on the side of enabling the barrier, as it's no-op on older systems, see the comment for more detail.
--- arch/powerpc/include/asm/setup.h | 1 arch/powerpc/kernel/security.c | 59 +++++++++++++++++++++++++++++++++ arch/powerpc/platforms/powernv/setup.c | 1 arch/powerpc/platforms/pseries/setup.c | 1 4 files changed, 62 insertions(+)
arch/powerpc/include/asm/setup.h +1 -0
@@ -52,6 +52,7 @@ enum l1d_flush_type {void setup_rfi_flush (enum l1d_flush_type ,bool enable);void do_rfi_flush_fixups (enum l1d_flush_type types); +void setup_barrier_nospec (void );void do_barrier_nospec_fixups (bool enable);extern bool barrier_nospec_enabled;
arch/powerpc/kernel/security.c +59 -0
65 lines not on this page · raw message
arch/powerpc/platforms/powernv/setup.c +1 -0
@@ -123,6 +123,7 @@ static void pnv_setup_rfi_flush(void) security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV));setup_rfi_flush (type, enable); +setup_barrier_nospec (); }static void __init pnv_setup_arch (void )
arch/powerpc/platforms/pseries/setup.c +1 -0
@@ -534,6 +534,7 @@ void pseries_setup_rfi_flush(void)security_ftr_enabled (SEC_FTR_L1D_FLUSH_PR );setup_rfi_flush (types, enable); +setup_barrier_nospec (); }static void __init pSeries_setup_arch (void )
Greg Kroah-Hartman
maintainerPATCH 27/107 powerpc: Use barrier_nospec in copy_from_user()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit ddf35cf3764b5a182b178105f57515b42e2634f8 upstream.
Based on the x86 commit doing the same.
See commit 304ec1b05031 ("x86/uaccess: Use __uaccess_begin_nospec() and uaccess_try_nospec") and b3bbfb3fb5d2 ("x86: Introduce __uaccess_begin_nospec() and uaccess_try_nospec") for more detail.
In all cases we are ordering the load from the potentially user-controlled pointer vs a previous branch based on an access_ok() check or similar.
Base on a patch from Michal Suchanek.
--- arch/powerpc/include/asm/uaccess.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/uaccess.h +10 -1
@@ -238,6 +238,7 @@ do { \__chk_user_ptr (ptr); \if (!is_kernel_addr ((unsigned long )__gu_addr)) \might_fault (); \ +barrier_nospec (); \__get_user_size (__gu_val, __gu_addr, (size), __gu_err); \ (x) = (__typeof__ (*(ptr )))__gu_val; \ __gu_err; \
@@ -249,8 +250,10 @@ do { \ __long_type(*(ptr)) __gu_val = 0; \ const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \might_fault (); \ -if (access_ok (VERIFY_READ , __gu_addr, (size))) \ +if (access_ok (VERIFY_READ , __gu_addr, (size))) { \ +barrier_nospec (); \__get_user_size (__gu_val, __gu_addr, (size), __gu_err); \ + } \ (x) = (__force __typeof__(*(ptr)))__gu_val; \ __gu_err; \ })
@@ -261,6 +264,7 @@ do { \ __long_type(*(ptr)) __gu_val; \ const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \__chk_user_ptr (ptr); \ +barrier_nospec (); \__get_user_size (__gu_val, __gu_addr, (size), __gu_err); \ (x) = (__force __typeof__(*(ptr)))__gu_val; \ __gu_err; \
@@ -288,15 +292,19 @@ static inline unsigned long raw_copy_froswitch (n) {case 1 : +barrier_nospec ();__get_user_size (*(u8 *)to, from,1 , ret);break ;case 2 : +barrier_nospec ();__get_user_size (*(u16 *)to, from,2 , ret);break ;case 4 : +barrier_nospec ();__get_user_size (*(u32 *)to, from,4 , ret);break ;case 8 : +barrier_nospec ();__get_user_size (*(u64 *)to, from,8 , ret);break ; }
@@ -304,6 +312,7 @@ static inline unsigned long raw_copy_froreturn 0 ; } +barrier_nospec ();return __copy_tofrom_user ((__force void __user *)to, from, n); }
Greg Kroah-Hartman
maintainerPATCH 28/107 powerpc/64: Use barrier_nospec in syscall entry
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 51973a815c6b46d7b23b68d6af371ad1c9d503ca upstream.
Our syscall entry is done in assembly so patch in an explicit barrier_nospec.
Based on a patch by Michal Suchanek.
--- arch/powerpc/kernel/entry_64.S | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/powerpc/kernel/entry_64.S +10 -0
@@ -36,6 +36,7 @@ #include <asm/context_tracking.h> #include <asm/tm.h> #include <asm/ppc-opcode.h> +#include <asm/barrier.h> #include <asm/export.h> #ifdef CONFIG_PPC_BOOK3S #include <asm/exception-64s.h>
@@ -179,6 +180,15 @@ system_call: /* label this so stack tr clrldi r8,r8,32 15: slwi r0,r0,4 + + barrier_nospec_asm + /* + * Prevent the load of the handler below (based on the user-passed + * system call number) being speculatively executed until the test + * against NR_syscalls and branch to .Lsyscall_enosys above has + * committed. + */ + ldx r12,r11,r0 /* Fetch system call handler [ptr] */ mtctr r12 bctrl /* Call handler */
Greg Kroah-Hartman
maintainerPATCH 29/107 powerpc/64s: Enhance the information in cpu_show_spectre_v1()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Suchanek <[email protected]>
commit a377514519b9a20fa1ea9adddbb4129573129cef upstream.
We now have barrier_nospec as mitigation so print it in cpu_show_spectre_v1() when enabled.
--- arch/powerpc/kernel/security.c | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/kernel/security.c +3 -0
@@ -120,6 +120,9 @@ ssize_t cpu_show_spectre_v1(struct devicif (!security_ftr_enabled (SEC_FTR_BNDS_CHK_SPEC_BAR ))return sprintf (buf,"Not affected\n" ); +if (barrier_nospec_enabled) +return sprintf (buf,"Mitigation: __user pointer sanitization\n" ); +return sprintf (buf,"Vulnerable\n" ); }
Greg Kroah-Hartman
maintainerPATCH 3/107 video: fbdev: Set pixclock = 0 in goldfishfb
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ace6033ec5c356615eaa3582fb1946e9eaff6662 ]
User space Android code identifies pixclock == 0 as a sign for emulation and will set the frame rate to 60 fps when reading this value, which is the desired outcome.
--- drivers/video/fbdev/goldfishfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/goldfishfb.c +1 -1
@@ -234,7 +234,7 @@ static int goldfish_fb_probe(struct plat fb->fb.var.activate =FB_ACTIVATE_NOW ; fb->fb.var.height =readl (fb->reg_base +FB_GET_PHYS_HEIGHT ); fb->fb.var.width =readl (fb->reg_base +FB_GET_PHYS_WIDTH ); - fb->fb.var.pixclock =10000 ; + fb->fb.var.pixclock =0 ; fb->fb.var.red.offset =11 ; fb->fb.var.red.length =5 ;
Greg Kroah-Hartman
maintainerPATCH 30/107 powerpc64s: Show ori31 availability in spectre_v1 sysfs file not v2
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 6d44acae1937b81cf8115ada8958e04f601f3f2e upstream.
When I added the spectre_v2 information in sysfs, I included the availability of the ori31 speculation barrier.
Although the ori31 barrier can be used to mitigate v2, it's primarily intended as a spectre v1 mitigation. Spectre v2 is mitigated by hardware changes.
So rework the sysfs files to show the ori31 information in the spectre_v1 file, rather than v2.
Currently we display eg:
$ grep . spectre_v* spectre_v1:Mitigation: __user pointer sanitization spectre_v2:Mitigation: Indirect branch cache disabled, ori31 speculation barrier enabled
After:
$ grep . spectre_v* spectre_v1:Mitigation: __user pointer sanitization, ori31 speculation barrier enabled spectre_v2:Mitigation: Indirect branch cache disabled
--- arch/powerpc/kernel/security.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
arch/powerpc/kernel/security.c +17 -10
@@ -117,25 +117,35 @@ ssize_t cpu_show_meltdown(struct devicessize_t cpu_show_spectre_v1 (struct device *dev,struct device_attribute *attr,char *buf) { -if (!security_ftr_enabled (SEC_FTR_BNDS_CHK_SPEC_BAR )) -return sprintf (buf,"Not affected\n" ); +struct seq_buf s; + +seq_buf_init (&s, buf,PAGE_SIZE -1 ); + +if (security_ftr_enabled (SEC_FTR_BNDS_CHK_SPEC_BAR )) { +if (barrier_nospec_enabled) +seq_buf_printf (&s,"Mitigation: __user pointer sanitization" ); +else +seq_buf_printf (&s,"Vulnerable" ); -if (barrier_nospec_enabled) -return sprintf (buf,"Mitigation: __user pointer sanitization\n" ); +if (security_ftr_enabled (SEC_FTR_SPEC_BAR_ORI31 )) +seq_buf_printf (&s,", ori31 speculation barrier enabled" ); -return sprintf (buf,"Vulnerable\n" ); +seq_buf_printf (&s,"\n" ); + }else +seq_buf_printf (&s,"Not affected\n" ); + +return s.len; }ssize_t cpu_show_spectre_v2 (struct device *dev,struct device_attribute *attr,char *buf) { -bool bcs, ccd, ori;struct seq_buf s; +bool bcs, ccd;seq_buf_init (&s, buf,PAGE_SIZE -1 ); bcs =security_ftr_enabled (SEC_FTR_BCCTRL_SERIALISED ); ccd =security_ftr_enabled (SEC_FTR_COUNT_CACHE_DISABLED ); - ori =security_ftr_enabled (SEC_FTR_SPEC_BAR_ORI31 );if (bcs || ccd) {seq_buf_printf (&s,"Mitigation: " );
@@ -151,9 +161,6 @@ ssize_t cpu_show_spectre_v2(struct devic }else seq_buf_printf (&s,"Vulnerable" ); -if (ori) -seq_buf_printf (&s,", ori31 speculation barrier enabled" ); -seq_buf_printf (&s,"\n" );return s.len;
Greg Kroah-Hartman
maintainerPATCH 31/107 powerpc/64: Disable the speculation barrier from the command line
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit cf175dc315f90185128fb061dc05b6fbb211aa2f upstream.
The speculation barrier can be disabled from the command line with the parameter: "nospectre_v1".
--- arch/powerpc/kernel/security.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
arch/powerpc/kernel/security.c +11 -1
@@ -16,6 +16,7 @@unsigned long powerpc_security_features__read_mostly =SEC_FTR_DEFAULT ;bool barrier_nospec_enabled; +static bool no_nospec;static void enable_barrier_nospec (bool enable) {
@@ -42,9 +43,18 @@ void setup_barrier_nospec(void) enable =security_ftr_enabled (SEC_FTR_FAVOUR_SECURITY ) &&security_ftr_enabled (SEC_FTR_BNDS_CHK_SPEC_BAR ); -enable_barrier_nospec (enable); +if (!no_nospec) +enable_barrier_nospec (enable); } +static int __init handle_nospectre_v1 (char *p) +{ + no_nospec = true; + +return 0 ; +} +early_param ("nospectre_v1" , handle_nospectre_v1); +#ifdef CONFIG_DEBUG_FS static int barrier_nospec_set (void *data,u64 val) {
Greg Kroah-Hartman
maintainerPATCH 32/107 powerpc/64: Make stf barrier PPC_BOOK3S_64 specific.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit 6453b532f2c8856a80381e6b9a1f5ea2f12294df upstream.
NXP Book3E platforms are not vulnerable to speculative store bypass, so make the mitigations PPC_BOOK3S_64 specific.
--- arch/powerpc/kernel/security.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kernel/security.c +2 -0
@@ -176,6 +176,7 @@ ssize_t cpu_show_spectre_v2(struct devicreturn s.len; } +#ifdef CONFIG_PPC_BOOK3S_64 /* * Store-forwarding barrier support. */
@@ -323,3 +324,4 @@ static __init int stf_barrier_debugfs_in }device_initcall (stf_barrier_debugfs_init);#endif /* CONFIG_DEBUG_FS */ +#endif /* CONFIG_PPC_BOOK3S_64 */
Greg Kroah-Hartman
maintainerPATCH 33/107 powerpc/64: Add CONFIG_PPC_BARRIER_NOSPEC
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 179ab1cbf883575c3a585bcfc0f2160f1d22a149 upstream.
Add a config symbol to encode which platforms support the barrier_nospec speculation barrier. Currently this is just Book3S 64 but we will add Book3E in a future patch.
--- arch/powerpc/Kconfig | 7 ++++++- arch/powerpc/include/asm/barrier.h | 6 +++--- arch/powerpc/include/asm/setup.h | 2 +- arch/powerpc/kernel/Makefile | 3 ++- arch/powerpc/kernel/module.c | 4 +++- arch/powerpc/kernel/vmlinux.lds.S | 4 +++- arch/powerpc/lib/feature-fixups.c | 6 ++++-- 7 files changed, 22 insertions(+), 10 deletions(-)
arch/powerpc/Kconfig +6 -1
@@ -164,7 +164,7 @@ config PPC select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_CMOS_UPDATE select GENERIC_CPU_AUTOPROBE - select GENERIC_CPU_VULNERABILITIES if PPC_BOOK3S_64 + select GENERIC_CPU_VULNERABILITIES if PPC_BARRIER_NOSPEC select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW_LEVEL select GENERIC_SMP_IDLE_THREAD
@@ -236,6 +236,11 @@ config PPC # Please keep this list sorted alphabetically. # +config PPC_BARRIER_NOSPEC + bool + default y + depends on PPC_BOOK3S_64 + config GENERIC_CSUM def_bool n
arch/powerpc/include/asm/barrier.h +3 -3
@@ -76,7 +76,7 @@ do { \ ___p1; \ }) -#ifdef CONFIG_PPC_BOOK3S_64 +#ifdef CONFIG_PPC_BARRIER_NOSPEC /* * Prevent execution of subsequent instructions until preceding branches have * been fully resolved and are no longer executing speculatively.
@@ -86,10 +86,10 @@ do { \// This also acts as a compiler barrier due to the memory clobber. #define barrier_nospec () asm (stringify_in_c(barrier_nospec_asm) ::: "memory") -#else /* !CONFIG_PPC_BOOK3S_64 */ +#else /* !CONFIG_PPC_BARRIER_NOSPEC */ #define barrier_nospec_asm#define barrier_nospec () -#endif +#endif /* CONFIG_PPC_BARRIER_NOSPEC */ #include <asm-generic/barrier.h>
arch/powerpc/include/asm/setup.h +1 -1
@@ -56,7 +56,7 @@ void setup_barrier_nospec(void);void do_barrier_nospec_fixups (bool enable);extern bool barrier_nospec_enabled; -#ifdef CONFIG_PPC_BOOK3S_64 +#ifdef CONFIG_PPC_BARRIER_NOSPEC void do_barrier_nospec_fixups_range (bool enable,void *start,void *end);#else static inline void do_barrier_nospec_fixups_range (bool enable,void *start,void *end) { };
arch/powerpc/kernel/Makefile +2 -1
@@ -45,9 +45,10 @@ obj-$(CONFIG_VDSO32) += vdso32/ obj-$(CONFIG_PPC_WATCHDOG) += watchdog.o obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o -obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o security.o +obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o obj-$(CONFIG_PPC_BOOK3S_64) += mce.o mce_power.o obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o +obj-$(CONFIG_PPC_BARRIER_NOSPEC) += security.o obj-$(CONFIG_PPC64) += vdso64/ obj-$(CONFIG_ALTIVEC) += vecemu.o obj-$(CONFIG_PPC_970_NAP) += idle_power4.o
arch/powerpc/kernel/module.c +3 -1
@@ -72,13 +72,15 @@ int module_finalize(const Elf_Ehdr *hdr,do_feature_fixups (powerpc_firmware_features, (void *)sect->sh_addr, (void *)sect->sh_addr + sect->sh_size); +#endif /* CONFIG_PPC64 */ +#ifdef CONFIG_PPC_BARRIER_NOSPEC sect =find_section (hdr, sechdrs,"__spec_barrier_fixup" );if (sect !=NULL )do_barrier_nospec_fixups_range (barrier_nospec_enabled, (void *)sect->sh_addr, (void *)sect->sh_addr + sect->sh_size); -#endif +#endif /* CONFIG_PPC_BARRIER_NOSPEC */ sect =find_section (hdr, sechdrs,"__lwsync_fixup" );if (sect !=NULL )
arch/powerpc/kernel/vmlinux.lds.S +3 -1
@@ -153,14 +153,16 @@ SECTIONS *(__rfi_flush_fixup) __stop___rfi_flush_fixup = .; } +#endif /* CONFIG_PPC64 */ +#ifdef CONFIG_PPC_BARRIER_NOSPEC . = ALIGN(8); __spec_barrier_fixup : AT(ADDR(__spec_barrier_fixup) - LOAD_OFFSET) { __start___barrier_nospec_fixup = .; *(__barrier_nospec_fixup) __stop___barrier_nospec_fixup = .; } -#endif +#endif /* CONFIG_PPC_BARRIER_NOSPEC */ EXCEPTION_TABLE(0)
arch/powerpc/lib/feature-fixups.c +4 -2
@@ -304,6 +304,9 @@ void do_barrier_nospec_fixups_range(boolprintk (KERN_DEBUG "barrier-nospec: patched %d locations\n" , i); } +#endif /* CONFIG_PPC_BOOK3S_64 */ + +#ifdef CONFIG_PPC_BARRIER_NOSPEC void do_barrier_nospec_fixups (bool enable) {void *start, *end;
@@ -313,8 +316,7 @@ void do_barrier_nospec_fixups(bool enabl do_barrier_nospec_fixups_range(enable, start, end); } - -#endif /* CONFIG_PPC_BOOK3S_64 */ +#endif /* CONFIG_PPC_BARRIER_NOSPEC */ void do_lwsync_fixups (unsigned long value,void *fixup_start,void *fixup_end) {
Greg Kroah-Hartman
maintainerPATCH 34/107 powerpc/64: Call setup_barrier_nospec() from setup_arch()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit af375eefbfb27cbb5b831984e66d724a40d26b5c upstream.
Currently we require platform code to call setup_barrier_nospec(). But if we add an empty definition for the !CONFIG_PPC_BARRIER_NOSPEC case then we can call it in setup_arch().
--- arch/powerpc/include/asm/setup.h | 4 ++++ arch/powerpc/kernel/setup-common.c | 2 ++ arch/powerpc/platforms/powernv/setup.c | 1 - arch/powerpc/platforms/pseries/setup.c | 1 - 4 files changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/setup.h +4 -0
@@ -52,7 +52,11 @@ enum l1d_flush_type {void setup_rfi_flush (enum l1d_flush_type ,bool enable);void do_rfi_flush_fixups (enum l1d_flush_type types); +#ifdef CONFIG_PPC_BARRIER_NOSPEC void setup_barrier_nospec (void ); +#else +static inline void setup_barrier_nospec (void ) { }; +#endif void do_barrier_nospec_fixups (bool enable);extern bool barrier_nospec_enabled;
arch/powerpc/kernel/setup-common.c +2 -0
@@ -937,6 +937,8 @@ void __init setup_arch(char **cmdline_p)if (ppc_md.setup_arch) ppc_md.setup_arch (); +setup_barrier_nospec (); +paging_init ();/* Initialize the MMU context management stuff. */
arch/powerpc/platforms/powernv/setup.c +0 -1
@@ -123,7 +123,6 @@ static void pnv_setup_rfi_flush(void) security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV));setup_rfi_flush (type, enable); -setup_barrier_nospec (); }static void __init pnv_setup_arch (void )
arch/powerpc/platforms/pseries/setup.c +0 -1
@@ -534,7 +534,6 @@ void pseries_setup_rfi_flush(void)security_ftr_enabled (SEC_FTR_L1D_FLUSH_PR );setup_rfi_flush (types, enable); -setup_barrier_nospec (); }static void __init pSeries_setup_arch (void )
Greg Kroah-Hartman
maintainerPATCH 35/107 powerpc/64: Make meltdown reporting Book3S 64 specific
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit 406d2b6ae3420f5bb2b3db6986dc6f0b6dbb637b upstream.
In a subsequent patch we will enable building security.c for Book3E. However the NXP platforms are not vulnerable to Meltdown, so make the Meltdown vulnerability reporting PPC_BOOK3S_64 specific.
--- arch/powerpc/kernel/security.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kernel/security.c +2 -0
@@ -92,6 +92,7 @@ static __init int barrier_nospec_debugfsdevice_initcall (barrier_nospec_debugfs_init);#endif /* CONFIG_DEBUG_FS */ +#ifdef CONFIG_PPC_BOOK3S_64 ssize_t cpu_show_meltdown (struct device *dev,struct device_attribute *attr,char *buf) {bool thread_priv;
@@ -124,6 +125,7 @@ ssize_t cpu_show_meltdown(struct device return sprintf(buf, "Vulnerable\n"); } +#endif ssize_t cpu_show_spectre_v1 (struct device *dev,struct device_attribute *attr,char *buf) {
Greg Kroah-Hartman
maintainerPATCH 36/107 powerpc/fsl: Add barrier_nospec implementation for NXP PowerPC Book3E
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit ebcd1bfc33c7a90df941df68a6e5d4018c022fba upstream.
Implement the barrier_nospec as a isync;sync instruction sequence. The implementation uses the infrastructure built for BOOK3S 64.
--- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/barrier.h | 8 +++++++- arch/powerpc/lib/feature-fixups.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-)
arch/powerpc/Kconfig +1 -1
@@ -239,7 +239,7 @@ config PPC config PPC_BARRIER_NOSPEC bool default y - depends on PPC_BOOK3S_64 + depends on PPC_BOOK3S_64 || PPC_FSL_BOOK3E config GENERIC_CSUM def_bool n
arch/powerpc/include/asm/barrier.h +7 -1
@@ -76,12 +76,18 @@ do { \ ___p1; \ }) +#ifdef CONFIG_PPC_BOOK3S_64 +#define NOSPEC_BARRIER_SLOT nop +#elif defined(CONFIG_PPC_FSL_BOOK3E ) +#define NOSPEC_BARRIER_SLOT nop; nop +#endif +#ifdef CONFIG_PPC_BARRIER_NOSPEC /* * Prevent execution of subsequent instructions until preceding branches have * been fully resolved and are no longer executing speculatively. */ -#define barrier_nospec_asm NOSPEC_BARRIER_FIXUP_SECTION; nop +#define barrier_nospec_asm NOSPEC_BARRIER_FIXUP_SECTION; NOSPEC_BARRIER_SLOT// This also acts as a compiler barrier due to the memory clobber. #define barrier_nospec () asm (stringify_in_c(barrier_nospec_asm) ::: "memory")
arch/powerpc/lib/feature-fixups.c +31 -0
@@ -318,6 +318,37 @@ void do_barrier_nospec_fixups(bool enabl }#endif /* CONFIG_PPC_BARRIER_NOSPEC */ +#ifdef CONFIG_PPC_FSL_BOOK3E +void do_barrier_nospec_fixups_range (bool enable,void *fixup_start,void *fixup_end) +{ +unsigned int instr[2 ], *dest; +long *start, *end; +int i; + + start = fixup_start; + end = fixup_end; + + instr[0 ] =PPC_INST_NOP ; + instr[1 ] =PPC_INST_NOP ; + +if (enable) { +pr_info ("barrier-nospec: using isync; sync as speculation barrier\n" ); + instr[0 ] =PPC_INST_ISYNC ; + instr[1 ] =PPC_INST_SYNC ; + } + +for (i =0 ; start < end; start++, i++) { + dest = (void *)start + *start; + +pr_devel ("patching dest %lx\n" , (unsigned long )dest); +patch_instruction (dest, instr[0 ]); +patch_instruction (dest +1 , instr[1 ]); + } + +printk (KERN_DEBUG "barrier-nospec: patched %d locations\n" , i); +} +#endif /* CONFIG_PPC_FSL_BOOK3E */ +void do_lwsync_fixups (unsigned long value,void *fixup_start,void *fixup_end) {long *start, *end;
Greg Kroah-Hartman
maintainerPATCH 37/107 powerpc/fsl: Sanitize the syscall table for NXP PowerPC 32 bit platforms
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit c28218d4abbf4f2035495334d8bfcba64bda4787 upstream.
Used barrier_nospec to sanitize the syscall table.
--- arch/powerpc/kernel/entry_32.S | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/powerpc/kernel/entry_32.S +10 -0
@@ -33,6 +33,7 @@ #include <asm/unistd.h> #include <asm/ptrace.h> #include <asm/export.h> +#include <asm/barrier.h> /* * MSR_KERNEL is > 0x10000 on 4xx/Book-E since it include MSR_CE.
@@ -358,6 +359,15 @@ syscall_dotrace_cont: ori r10,r10,sys_call_table@l slwi r0,r0,2 bge- 66f + + barrier_nospec_asm + /* + * Prevent the load of the handler below (based on the user-passed + * system call number) being speculatively executed until the test + * against NR_syscalls and branch to .66f above has + * committed. + */ + lwzx r10,r10,r0 /* Fetch system call handler [ptr] */ mtlr r10 addi r9,r1,STACK_FRAME_OVERHEAD
Greg Kroah-Hartman
maintainerPATCH 38/107 powerpc/asm: Add a patch_site macro & helpers for patching instructions
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 06d0bbc6d0f56dacac3a79900e9a9a0d5972d818 upstream.
Add a macro and some helper C functions for patching single asm instructions.
The gas macro means we can do something like:
1: nop
patch_site 1b, patch__foo
Which is less visually distracting than defining a GLOBAL symbol at 1, and also doesn't pollute the symbol table which can confuse eg. perf.
These are obviously similar to our existing feature sections, but are not automatically patched based on CPU/MMU features, rather they are designed to be manually patched by C code at some arbitrary point.
--- arch/powerpc/include/asm/code-patching-asm.h | 18 ++++++++++++++++++ arch/powerpc/include/asm/code-patching.h | 2 ++ arch/powerpc/lib/code-patching.c | 16 ++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 arch/powerpc/include/asm/code-patching-asm.h
arch/powerpc/include/asm/code-patching-asm.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2018, Michael Ellerman, IBM Corporation. +*/ +#ifndef _ASM_POWERPC_CODE_PATCHING_ASM_H +#define _ASM_POWERPC_CODE_PATCHING_ASM_H + +/* Define a "site" that can be patched */ +.macro patch_site label name + .pushsection ".rodata" + .balign 4 + .global \name +\name: + .4byte \label - . + .popsection +.endm + +#endif /* _ASM_POWERPC_CODE_PATCHING_ASM_H */
arch/powerpc/include/asm/code-patching.h +2 -0
@@ -32,6 +32,8 @@ unsigned int create_cond_branch(const unint patch_branch (unsigned int *addr,unsigned long target,int flags);int patch_instruction (unsigned int *addr,unsigned int instr);int raw_patch_instruction (unsigned int *addr,unsigned int instr); +int patch_instruction_site (s32 *addr,unsigned int instr); +int patch_branch_site (s32 *site,unsigned long target,int flags);int instr_is_relative_branch (unsigned int instr);int instr_is_relative_link_branch (unsigned int instr);
arch/powerpc/lib/code-patching.c +16 -0
@@ -206,6 +206,22 @@ int patch_branch(unsigned int *addr, unsreturn patch_instruction (addr,create_branch (addr, target, flags)); } +int patch_branch_site (s32 *site,unsigned long target,int flags) +{ +unsigned int *addr; + + addr = (unsigned int *)((unsigned long )site + *site); +return patch_instruction (addr,create_branch (addr, target, flags)); +} + +int patch_instruction_site (s32 *site,unsigned int instr) +{ +unsigned int *addr; + + addr = (unsigned int *)((unsigned long )site + *site); +return patch_instruction (addr, instr); +} +bool is_offset_in_branch_range (long offset) {/*
Greg Kroah-Hartman
maintainerPATCH 39/107 powerpc/64s: Add new security feature flags for count cache flush
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit dc8c6cce9a26a51fc19961accb978217a3ba8c75 upstream.
Add security feature flags to indicate the need for software to flush the count cache on context switch, and for the presence of a hardware assisted count cache flush.
--- arch/powerpc/include/asm/security_features.h | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/include/asm/security_features.h +6 -0
@@ -59,6 +59,9 @@ static inline bool security_ftr_enabled(// Indirect branch prediction cache disabled #define SEC_FTR_COUNT_CACHE_DISABLED 0x0000000000000020ull +// bcctr 2,0,0 triggers a hardware assisted count cache flush +#define SEC_FTR_BCCTR_FLUSH_ASSIST 0x0000000000000800ull +// Features indicating need for Spectre/Meltdown mitigations
@@ -74,6 +77,9 @@ static inline bool security_ftr_enabled(// Firmware configuration indicates user favours security over performance #define SEC_FTR_FAVOUR_SECURITY 0x0000000000000200ull +// Software required to flush count cache on context switch +#define SEC_FTR_FLUSH_COUNT_CACHE 0x0000000000000400ull +// Features enabled by default #define SEC_FTR_DEFAULT \
Greg Kroah-Hartman
maintainerPATCH 4/107 stmmac: copy unicast mac address to MAC registers
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a830405ee452ddc4101c3c9334e6fedd42c6b357 ]
Currently stmmac driver not copying the valid ethernet MAC address to MAC registers. This patch takes care of updating the MAC register with MAC address.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +15 -1
@@ -3787,6 +3787,20 @@ static int stmmac_ioctl(struct net_devicreturn ret; } +static int stmmac_set_mac_address (struct net_device *ndev,void *addr) +{ +struct stmmac_priv *priv =netdev_priv (ndev); +int ret =0 ; + + ret =eth_mac_addr (ndev, addr); +if (ret) +return ret; + + priv->hw->mac->set_umac_addr (priv->hw, ndev->dev_addr,0 ); + +return ret; +} +#ifdef CONFIG_DEBUG_FS static struct dentry *stmmac_fs_dir;
@@ -4014,7 +4028,7 @@ static const struct net_device_ops stmma#ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = stmmac_poll_controller, #endif - .ndo_set_mac_address = eth_mac_addr, + .ndo_set_mac_address = stmmac_set_mac_address, };/**
Greg Kroah-Hartman
maintainerPATCH 5/107 dccp: do not use ipv6 header for ipv4 flow
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit e0aa67709f89d08c8d8e5bdd9e0b649df61d0090 ]
When a dual stack dccp listener accepts an ipv4 flow, it should not attempt to use an ipv6 header or inet6_iif() helper.
--- net/dccp/ipv6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/dccp/ipv6.c +2 -2
@@ -433,8 +433,8 @@ static struct sock *dccp_v6_request_recv newnp->ipv6_mc_list =NULL ; newnp->ipv6_ac_list =NULL ; newnp->ipv6_fl_list =NULL ; - newnp->mcast_oif =inet6_iif (skb); - newnp->mcast_hops =ipv6_hdr (skb)->hop_limit; + newnp->mcast_oif =inet_iif (skb); + newnp->mcast_hops =ip_hdr (skb)->ttl;/* * No need to charge this sock to the relevant IPv6 refcnt debug socks count
Greg Kroah-Hartman
maintainerPATCH 6/107 genetlink: Fix a memory leak on error path
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: YueHaibing <[email protected]>
[ Upstream commit ceabee6c59943bdd5e1da1a6a20dc7ee5f8113a2 ]
In genl_register_family(), when idr_alloc() fails, we forget to free the memory we possibly allocate for family->attrbuf.
--- net/netlink/genetlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netlink/genetlink.c +2 -1
@@ -365,7 +365,7 @@ int genl_register_family(struct genl_fam start, end + 1, GFP_KERNEL);if (family->id <0 ) { err = family->id; - goto errout_locked; + goto errout_free; } err =genl_validate_assign_mc_groups (family);
@@ -384,6 +384,7 @@ int genl_register_family(struct genl_fam errout_remove:idr_remove (&genl_fam_idr, family->id); +errout_free:kfree (family->attrbuf); errout_locked:genl_unlock_all ();
Greg Kroah-Hartman
maintainerPATCH 7/107 mISDN: hfcpci: Test both vendor & device ID for Digium HFC4S
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
[ Upstream commit fae846e2b7124d4b076ef17791c73addf3b26350 ]
The device ID alone does not uniquely identify a device. Test both the vendor and device ID to make sure we don't mistakenly think some other vendor's 0xB410 device is a Digium HFC4S. Also, instead of the bare hex ID, use the same constant (PCI_DEVICE_ID_DIGIUM_HFC4S) used in the device ID table.
No functional change intended.
--- drivers/isdn/hardware/mISDN/hfcmulti.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/isdn/hardware/mISDN/hfcmulti.c +2 -1
@@ -4367,7 +4367,8 @@ setup_pci(struct hfc_multi *hc, struct pif (m->clock2)test_and_set_bit (HFC_CHIP_CLOCK2 , &hc->chip); -if (ent->device ==0xB410 ) { +if (ent->vendor ==PCI_VENDOR_ID_DIGIUM && + ent->device ==PCI_DEVICE_ID_DIGIUM_HFC4S ) {test_and_set_bit (HFC_CHIP_B410P , &hc->chip);test_and_set_bit (HFC_CHIP_PCM_MASTER , &hc->chip);test_and_clear_bit (HFC_CHIP_PCM_SLAVE , &hc->chip);
Greg Kroah-Hartman
maintainerPATCH 8/107 net: datagram: fix unbounded loop in __skb_try_recv_datagram()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 0b91bce1ebfc797ff3de60c8f4a1e6219a8a3187 ]
Christoph reported a stall while peeking datagram with an offset when busy polling is enabled. __skb_try_recv_datagram() uses as the loop termination condition 'queue empty'. When peeking, the socket queue can be not empty, even when no additional packets are received.
Address the issue explicitly checking for receive queue changes, as currently done by __skb_wait_for_more_packets().
--- net/core/datagram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/datagram.c +1 -1
@@ -281,7 +281,7 @@ struct sk_buff *__skb_try_recv_datagram(break ;sk_busy_loop (sk, flags &MSG_DONTWAIT ); - }while (!skb_queue_empty (&sk->sk_receive_queue)); + }while (sk->sk_receive_queue.prev != *last); error = -EAGAIN ;
Greg Kroah-Hartman
maintainerPATCH 9/107 net/packet: Set __GFP_NOWARN upon allocation in alloc_pg_vec
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Paasch <[email protected]>
[ Upstream commit 398f0132c14754fcd03c1c4f8e7176d001ce8ea1 ]
Since commit fc62814d690c ("net/packet: fix 4gb buffer limit due to overflow check") one can now allocate packet ring buffers >= UINT_MAX. However, syzkaller found that that triggers a warning:
[ 21.100000] WARNING: CPU: 2 PID: 2075 at mm/page_alloc.c:4584 __alloc_pages_nod0 [ 21.101490] Modules linked in: [ 21.101921] CPU: 2 PID: 2075 Comm: syz-executor.0 Not tainted 5.0.0 #146 [ 21.102784] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.5.1 01/01/2011 [ 21.103887] RIP: 0010:__alloc_pages_nodemask+0x2a0/0x630 [ 21.104640] Code: fe ff ff 65 48 8b 04 25 c0 de 01 00 48 05 90 0f 00 00 41 bd 01 00 00 00 48 89 44 24 48 e9 9c fe 3 [ 21.107121] RSP: 0018:ffff88805e1cf920 EFLAGS: 00010246 [ 21.107819] RAX: 0000000000000000 RBX: ffffffff85a488a0 RCX: 0000000000000000 [ 21.108753] RDX: 0000000000000000 RSI: dffffc0000000000 RDI: 0000000000000000 [ 21.109699] RBP: 1ffff1100bc39f28 R08: ffffed100bcefb67 R09: ffffed100bcefb67 [ 21.110646] R10: 0000000000000001 R11: ffffed100bcefb66 R12: 000000000000000d [ 21.111623] R13: 0000000000000000 R14: ffff88805e77d888 R15: 000000000000000d [ 21.112552] FS: 00007f7c7de05700(0000) GS:ffff88806d100000(0000) knlGS:0000000000000000 [ 21.113612] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 21.114405] CR2: 000000000065c000 CR3: 000000005e58e006 CR4: 00000000001606e0 [ 21.115367] Call Trace: [ 21.115705] ? __alloc_pages_slowpath+0x21c0/0x21c0 [ 21.116362] alloc_pages_current+0xac/0x1e0 [ 21.116923] kmalloc_order+0x18/0x70 [ 21.117393] kmalloc_order_trace+0x18/0x110 [ 21.117949] packet_set_ring+0x9d5/0x1770 [ 21.118524] ? packet_rcv_spkt+0x440/0x440 [ 21.119094] ? lock_downgrade+0x620/0x620 [ 21.119646] ? __might_fault+0x177/0x1b0 [ 21.120177] packet_setsockopt+0x981/0x2940 [ 21.120753] ? __fget+0x2fb/0x4b0 [ 21.121209] ? packet_release+0xab0/0xab0 [ 21.121740] ? sock_has_perm+0x1cd/0x260 [ 21.122297] ? selinux_secmark_relabel_packet+0xd0/0xd0 [ 21.123013] ? __fget+0x324/0x4b0 [ 21.123451] ? selinux_netlbl_socket_setsockopt+0x101/0x320 [ 21.124186] ? selinux_netlbl_sock_rcv_skb+0x3a0/0x3a0 [ 21.124908] ? __lock_acquire+0x529/0x3200 [ 21.125453] ? selinux_socket_setsockopt+0x5d/0x70 [ 21.126075] ? __sys_setsockopt+0x131/0x210 [ 21.126533] ? packet_release+0xab0/0xab0 [ 21.127004] __sys_setsockopt+0x131/0x210 [ 21.127449] ? kernel_accept+0x2f0/0x2f0 [ 21.127911] ? ret_from_fork+0x8/0x50 [ 21.128313] ? do_raw_spin_lock+0x11b/0x280 [ 21.128800] __x64_sys_setsockopt+0xba/0x150 [ 21.129271] ? lockdep_hardirqs_on+0x37f/0x560 [ 21.129769] do_syscall_64+0x9f/0x450 [ 21.130182] entry_SYSCALL_64_after_hwframe+0x49/0xbe
We should allocate with __GFP_NOWARN to handle this.
--- net/packet/af_packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/packet/af_packet.c +1 -1
@@ -4232,7 +4232,7 @@ static struct pgv *alloc_pg_vec(struct tstruct pgv *pg_vec;int i; - pg_vec =kcalloc (block_nr,sizeof (struct pgv ),GFP_KERNEL ); + pg_vec =kcalloc (block_nr,sizeof (struct pgv ),GFP_KERNEL | __GFP_NOWARN);if (unlikely (!pg_vec)) goto out;
Greg Kroah-Hartman
maintainercover 4.14.110-stable review
This is the start of the stable review cycle for the 4.14.110 release. There are 107 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 Wed Apr 3 16:59:25 UTC 2019. 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.14.110-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.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.14.110-rc1
Cornelia Huck <[email protected]>
vfio: ccw: only free cp on final interrupt
Greg Kroah-Hartman <[email protected]>
Revert "USB: core: only clean up what we allocated"
Sean Christopherson <[email protected]>
KVM: x86: Emulate MSR_IA32_ARCH_CAPABILITIES on AMD hosts
Sean Christopherson <[email protected]>
KVM: Reject device ioctls from processes other than the VM's creator
Thomas Gleixner <[email protected]>
x86/smp: Enforce CONFIG_HOTPLUG_CPU when SMP=y
Thomas Gleixner <[email protected]>
cpu/hotplug: Prevent crash when CPU bringup fails on CONFIG_HOTPLUG_CPU=n
Adrian Hunter <[email protected]>
perf intel-pt: Fix TSC slip
Lars Persson <[email protected]>
mm/migrate.c: add missing flush_dcache_page for non-mapped page migrate
Romain Izard <[email protected]>
usb: cdc-acm: fix race during wakeup blocking TX traffic
Mathias Nyman <[email protected]>
xhci: Fix port resume done detection for SS ports with LPM enabled
Yasushi Asano <[email protected]>
usb: host: xhci-rcar: Add XHCI_TRUST_TX_LENGTH quirk
Fabrizio Castro <[email protected]>
usb: common: Consider only available nodes for dr_mode
Radoslav Gerganov <[email protected]>
USB: gadget: f_hid: fix deadlock in f_hidg_write()
Arnd Bergmann <[email protected]>
usb: mtu3: fix EXTCON dependency
Chen-Yu Tsai <[email protected]>
phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs
Axel Lin <[email protected]>
gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input
Kangjie Lu <[email protected]>
gpio: exar: add a check for the return value of ida_simple_get fails
Eric Biggers <[email protected]>
drm/vgem: fix use-after-free when drm_gem_handle_create() fails
YueHaibing <[email protected]>
fs/proc/proc_sysctl.c: fix NULL pointer dereference in put_links
Wentao Wang <[email protected]>
Disable kgdboc failed by echo space to /sys/module/kgdboc/parameters/kgdboc
Bjørn Mork <[email protected]>
USB: serial: option: add Olicard 600
Kristian Evensen <[email protected]>
USB: serial: option: add support for Quectel EM12
Mans Rullgard <[email protected]>
USB: serial: option: set driver_info for SIM5218 and compatibles
Lin Yi <[email protected]>
USB: serial: mos7720: fix mos_parport refcount imbalance on error path
George McCollister <[email protected]>
USB: serial: ftdi_sio: add additional NovaTech products
Greg Kroah-Hartman <[email protected]>
USB: serial: cp210x: add new device id
Hoan Nguyen An <[email protected]>
serial: sh-sci: Fix setting SCSCR_TIE while transferring data
Aditya Pakki <[email protected]>
serial: max310x: Fix to avoid potential NULL pointer dereference
Malcolm Priestley <[email protected]>
staging: vt6655: Fix interrupt race condition on device start up.
Malcolm Priestley <[email protected]>
staging: vt6655: Remove vif check from vnt_interrupt
Ian Abbott <[email protected]>
staging: comedi: ni_mio_common: Fix divide-by-zero for DIO cmdtest
Kangjie Lu <[email protected]>
tty: atmel_serial: fix a potential NULL pointer dereference
Steffen Maier <[email protected]>
scsi: zfcp: fix scsi_eh host reset with port_forced ERP for non-NPIV FCP devices
Steffen Maier <[email protected]>
scsi: zfcp: fix rport unblock if deleted SCSI devices on Scsi_Host
Martin K. Petersen <[email protected]>
scsi: sd: Quiesce warning if device does not report optimal I/O size
Bart Van Assche <[email protected]>
scsi: sd: Fix a race between closing an sd device and sd I/O
Darrick J. Wong <[email protected]>
ocfs2: fix inode bh swapping mixup in ocfs2_reflink_inodes_lock
Tetsuo Handa <[email protected]>
fs/open.c: allow opening only regular files during execve()
Fredrik Noring <[email protected]>
kbuild: modversions: Fix relative CRC byte order interpretation
Kailang Yang <[email protected]>
ALSA: hda/realtek - Add support headset mode for New DELL WYSE NB
Kailang Yang <[email protected]>
ALSA: hda/realtek - Add support headset mode for DELL WYSE AIO
Takashi Iwai <[email protected]>
ALSA: pcm: Don't suspend stream in unrecoverable PCM state
Takashi Iwai <[email protected]>
ALSA: pcm: Fix possible OOB access in PCM oss plugins
Gustavo A. R. Silva <[email protected]>
ALSA: seq: oss: Fix Spectre v1 vulnerability
Gustavo A. R. Silva <[email protected]>
ALSA: rawmidi: Fix potential Spectre v1 vulnerability
Christian Lamparter <[email protected]>
net: dsa: qca8k: remove leftover phy accessors
Olga Kornievskaia <[email protected]>
NFSv4.1 don't free interrupted slot on open
Naveen N. Rao <[email protected]>
powerpc: bpf: Fix generation of load/store DW instructions
Kohji Okuno <[email protected]>
ARM: imx6q: cpuidle: fix bug that CPU might not wake up at expected time
Andrea Righi <[email protected]>
btrfs: raid56: properly unmap parity page in finish_parity_scrub()
Josef Bacik <[email protected]>
btrfs: remove WARN_ON in log_dir_items
Filipe Manana <[email protected]>
Btrfs: fix incorrect file size after shrinking truncate and fsync
Michael Ellerman <[email protected]>
powerpc/security: Fix spectre_v2 reporting
Christophe Leroy <[email protected]>
powerpc/fsl: Fix the flush of branch predictor.
Diana Craciun <[email protected]>
powerpc/fsl: Fixed warning: orphan section `__btb_flush_fixup'
Diana Craciun <[email protected]>
powerpc/fsl: Update Spectre v2 reporting
Diana Craciun <[email protected]>
powerpc/fsl: Enable runtime patching if nospectre_v2 boot arg is used
Diana Craciun <[email protected]>
powerpc/fsl: Flush branch predictor when entering KVM
Diana Craciun <[email protected]>
powerpc/fsl: Flush the branch predictor at each kernel entry (32 bit)
Diana Craciun <[email protected]>
powerpc/fsl: Flush the branch predictor at each kernel entry (64bit)
Diana Craciun <[email protected]>
powerpc/fsl: Add nospectre_v2 command line argument
Diana Craciun <[email protected]>
powerpc/fsl: Emulate SPRN_BUCSR register
Diana Craciun <[email protected]>
powerpc/fsl: Fix spectre_v2 mitigations reporting
Diana Craciun <[email protected]>
powerpc/fsl: Add macro to flush the branch predictor
Diana Craciun <[email protected]>
powerpc/fsl: Add infrastructure to fixup branch predictor flush
Michael Ellerman <[email protected]>
powerpc/powernv: Query firmware for count cache flush settings
Michael Ellerman <[email protected]>
powerpc/pseries: Query hypervisor for count cache flush settings
Michael Ellerman <[email protected]>
powerpc/64s: Add support for software count cache flush
Michael Ellerman <[email protected]>
powerpc/64s: Add new security feature flags for count cache flush
Michael Ellerman <[email protected]>
powerpc/asm: Add a patch_site macro & helpers for patching instructions
Diana Craciun <[email protected]>
powerpc/fsl: Sanitize the syscall table for NXP PowerPC 32 bit platforms
Diana Craciun <[email protected]>
powerpc/fsl: Add barrier_nospec implementation for NXP PowerPC Book3E
Diana Craciun <[email protected]>
powerpc/64: Make meltdown reporting Book3S 64 specific
Michael Ellerman <[email protected]>
powerpc/64: Call setup_barrier_nospec() from setup_arch()
Michael Ellerman <[email protected]>
powerpc/64: Add CONFIG_PPC_BARRIER_NOSPEC
Diana Craciun <[email protected]>
powerpc/64: Make stf barrier PPC_BOOK3S_64 specific.
Diana Craciun <[email protected]>
powerpc/64: Disable the speculation barrier from the command line
Michael Ellerman <[email protected]>
powerpc64s: Show ori31 availability in spectre_v1 sysfs file not v2
Michal Suchanek <[email protected]>
powerpc/64s: Enhance the information in cpu_show_spectre_v1()
Michael Ellerman <[email protected]>
powerpc/64: Use barrier_nospec in syscall entry
Michael Ellerman <[email protected]>
powerpc: Use barrier_nospec in copy_from_user()
Michal Suchanek <[email protected]>
powerpc/64s: Enable barrier_nospec based on firmware settings
Michal Suchanek <[email protected]>
powerpc/64s: Patch barrier_nospec in modules
Michal Suchanek <[email protected]>
powerpc/64s: Add support for ori barrier_nospec patching
Eric Dumazet <[email protected]>
tun: add a missing rcu_read_unlock() in error path
Eric Dumazet <[email protected]>
tun: properly test for IFF_UP
Finn Thain <[email protected]>
mac8390: Fix mmio access size probe
Dmitry Bogdanov <[email protected]>
net: aquantia: fix rx checksum offload for UDP/TCP over IPv6
Xin Long <[email protected]>
sctp: get sctphdr by offset in sctp_compute_cksum
Zhiqiang Liu <[email protected]>
vxlan: Don't call gro_cells_destroy() before device is unregistered
Dean Nelson <[email protected]>
thunderx: eliminate extra calls to put_page() for pages held for recycling
Dean Nelson <[email protected]>
thunderx: enable page recycling for non-XDP case
Eric Dumazet <[email protected]>
tcp: do not use ipv6 header for ipv4 flow
Herbert Xu <[email protected]>
rhashtable: Still do rehash when we get EEXIST
Maxime Chevallier <[email protected]>
packets: Always register packet sk in the same order
YueHaibing <[email protected]>
net-sysfs: call dev_hold if kobject_init_and_add success
Aaro Koskinen <[email protected]>
net: stmmac: fix memory corruption with large MTUs
Eric Dumazet <[email protected]>
net: rose: fix a possible stack overflow
Christoph Paasch <[email protected]>
net/packet: Set __GFP_NOWARN upon allocation in alloc_pg_vec
Paolo Abeni <[email protected]>
net: datagram: fix unbounded loop in __skb_try_recv_datagram()
Bjorn Helgaas <[email protected]>
mISDN: hfcpci: Test both vendor & device ID for Digium HFC4S
YueHaibing <[email protected]>
genetlink: Fix a memory leak on error path
Eric Dumazet <[email protected]>
dccp: do not use ipv6 header for ipv4 flow
Bhadram Varka <[email protected]>
stmmac: copy unicast mac address to MAC registers
Christoffer Dall <[email protected]>
video: fbdev: Set pixclock = 0 in goldfishfb
Marcel Holtmann <[email protected]>
Bluetooth: Verify that l2cap_get_conf_opt provides large enough buffer
Marcel Holtmann <[email protected]>
Bluetooth: Check L2CAP option sizes returned from l2cap_get_conf_opt
-------------
Diffstat:
Documentation/virtual/kvm/api.txt | 16 +- Makefile | 4 +- arch/arm/mach-imx/cpuidle-imx6q.c | 27 +-- arch/powerpc/Kconfig | 7 +- arch/powerpc/include/asm/asm-prototypes.h | 6 + arch/powerpc/include/asm/barrier.h | 12 +- arch/powerpc/include/asm/code-patching-asm.h | 18 ++ arch/powerpc/include/asm/code-patching.h | 2 + arch/powerpc/include/asm/feature-fixups.h | 21 ++ arch/powerpc/include/asm/hvcall.h | 2 + arch/powerpc/include/asm/ppc-opcode.h | 2 + arch/powerpc/include/asm/ppc_asm.h | 10 + arch/powerpc/include/asm/security_features.h | 7 + arch/powerpc/include/asm/setup.h | 20 ++ arch/powerpc/include/asm/uaccess.h | 11 +- arch/powerpc/kernel/Makefile | 3 +- arch/powerpc/kernel/entry_32.S | 10 + arch/powerpc/kernel/entry_64.S | 69 +++++++ arch/powerpc/kernel/exceptions-64e.S | 27 ++- arch/powerpc/kernel/head_booke.h | 12 ++ arch/powerpc/kernel/head_fsl_booke.S | 15 ++ arch/powerpc/kernel/module.c | 10 +- arch/powerpc/kernel/security.c | 215 ++++++++++++++++++++- arch/powerpc/kernel/setup-common.c | 3 + arch/powerpc/kernel/vmlinux.lds.S | 19 +- arch/powerpc/kvm/bookehv_interrupts.S | 4 + arch/powerpc/kvm/e500_emulate.c | 7 + arch/powerpc/lib/code-patching.c | 16 ++ arch/powerpc/lib/feature-fixups.c | 93 +++++++++ arch/powerpc/mm/tlb_low_64e.S | 7 + arch/powerpc/net/bpf_jit.h | 17 +- arch/powerpc/net/bpf_jit32.h | 4 + arch/powerpc/net/bpf_jit64.h | 20 ++ arch/powerpc/net/bpf_jit_comp64.c | 12 +- arch/powerpc/platforms/powernv/setup.c | 7 + arch/powerpc/platforms/pseries/setup.c | 7 + arch/x86/Kconfig | 8 +- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx.c | 14 -- arch/x86/kvm/x86.c | 12 ++ drivers/gpio/gpio-adnp.c | 6 +- drivers/gpio/gpio-exar.c | 2 + drivers/gpu/drm/vgem/vgem_drv.c | 6 +- drivers/isdn/hardware/mISDN/hfcmulti.c | 3 +- drivers/net/dsa/qca8k.c | 18 -- drivers/net/ethernet/8390/mac8390.c | 19 +- drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 5 +- drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 30 ++- drivers/net/ethernet/stmicro/stmmac/ring_mode.c | 5 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 16 +- drivers/net/tun.c | 16 +- drivers/net/vxlan.c | 4 +- drivers/phy/allwinner/phy-sun4i-usb.c | 5 +- drivers/s390/cio/vfio_ccw_drv.c | 8 +- drivers/s390/scsi/zfcp_erp.c | 17 ++ drivers/s390/scsi/zfcp_ext.h | 2 + drivers/s390/scsi/zfcp_scsi.c | 4 + drivers/scsi/sd.c | 22 ++- drivers/staging/comedi/comedidev.h | 2 + drivers/staging/comedi/drivers.c | 33 +++- drivers/staging/comedi/drivers/ni_mio_common.c | 10 +- drivers/staging/vt6655/device_main.c | 11 +- drivers/tty/serial/atmel_serial.c | 4 + drivers/tty/serial/kgdboc.c | 4 +- drivers/tty/serial/max310x.c | 2 + drivers/tty/serial/sh-sci.c | 12 +- drivers/usb/class/cdc-acm.c | 4 +- drivers/usb/common/common.c | 2 + drivers/usb/core/config.c | 9 +- drivers/usb/gadget/function/f_hid.c | 6 +- drivers/usb/host/xhci-rcar.c | 1 + drivers/usb/host/xhci-ring.c | 9 +- drivers/usb/mtu3/Kconfig | 1 + drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/ftdi_sio.c | 2 + drivers/usb/serial/ftdi_sio_ids.h | 4 +- drivers/usb/serial/mos7720.c | 4 +- drivers/usb/serial/option.c | 17 +- drivers/video/fbdev/goldfishfb.c | 2 +- fs/btrfs/raid56.c | 3 +- fs/btrfs/tree-log.c | 24 ++- fs/nfs/nfs4proc.c | 3 +- fs/ocfs2/refcounttree.c | 42 ++-- fs/open.c | 6 + fs/proc/proc_sysctl.c | 3 +- include/net/sctp/checksum.h | 2 +- include/net/sock.h | 6 + kernel/cpu.c | 20 +- lib/rhashtable.c | 8 +- mm/migrate.c | 11 +- net/bluetooth/l2cap_core.c | 83 +++++--- net/core/datagram.c | 2 +- net/core/net-sysfs.c | 6 +- net/dccp/ipv6.c | 4 +- net/ipv6/tcp_ipv6.c | 8 +- net/netlink/genetlink.c | 3 +- net/packet/af_packet.c | 4 +- net/rose/rose_subr.c | 21 +- scripts/mod/modpost.c | 2 +- sound/core/oss/pcm_oss.c | 43 +++-- sound/core/pcm_native.c | 9 +- sound/core/rawmidi.c | 2 + sound/core/seq/oss/seq_oss_synth.c | 7 +- sound/pci/hda/patch_realtek.c | 27 +++ .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 20 +- virt/kvm/kvm_main.c | 3 + 106 files changed, 1156 insertions(+), 321 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 41/107 powerpc/pseries: Query hypervisor for count cache flush settings
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit ba72dc171954b782a79d25e0f4b3ed91090c3b1e upstream.
Use the existing hypercall to determine the appropriate settings for the count cache flush, and then call the generic powerpc code to set it up based on the security feature flags.
--- arch/powerpc/include/asm/hvcall.h | 2 ++ arch/powerpc/platforms/pseries/setup.c | 7 +++++++ 2 files changed, 9 insertions(+)
arch/powerpc/include/asm/hvcall.h +2 -0
@@ -340,10 +340,12 @@#define H_CPU_CHAR_BRANCH_HINTS_HONORED (1ull << 58) // IBM bit 5#define H_CPU_CHAR_THREAD_RECONFIG_CTRL (1ull << 57) // IBM bit 6#define H_CPU_CHAR_COUNT_CACHE_DISABLED (1ull << 56) // IBM bit 7 +#define H_CPU_CHAR_BCCTR_FLUSH_ASSIST (1ull << 54) // IBM bit 9#define H_CPU_BEHAV_FAVOUR_SECURITY (1ull << 63) // IBM bit 0#define H_CPU_BEHAV_L1D_FLUSH_PR (1ull << 62) // IBM bit 1#define H_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ull << 61) // IBM bit 2 +#define H_CPU_BEHAV_FLUSH_COUNT_CACHE (1ull << 58) // IBM bit 5/* Flag values used in H_REGISTER_PROC_TBL hcall */ #define PROC_TABLE_OP_MASK 0x18
arch/powerpc/platforms/pseries/setup.c +7 -0
@@ -484,6 +484,12 @@ static void init_cpu_char_feature_flags(if (result->character &H_CPU_CHAR_COUNT_CACHE_DISABLED )security_ftr_set (SEC_FTR_COUNT_CACHE_DISABLED ); +if (result->character &H_CPU_CHAR_BCCTR_FLUSH_ASSIST ) +security_ftr_set (SEC_FTR_BCCTR_FLUSH_ASSIST ); + +if (result->behaviour &H_CPU_BEHAV_FLUSH_COUNT_CACHE ) +security_ftr_set (SEC_FTR_FLUSH_COUNT_CACHE ); +/* * The features below are enabled by default, so we instead look to see * if firmware has *disabled* them, and clear them if so.
@@ -534,6 +540,7 @@ void pseries_setup_rfi_flush(void)security_ftr_enabled (SEC_FTR_L1D_FLUSH_PR );setup_rfi_flush (types, enable); +setup_count_cache_flush (); }static void __init pSeries_setup_arch (void )
Greg Kroah-Hartman
maintainerPATCH 50/107 powerpc/fsl: Flush branch predictor when entering KVM
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit e7aa61f47b23afbec41031bc47ca8d6cb6516abc upstream.
Switching from the guest to host is another place where the speculative accesses can be exploited. Flush the branch predictor when entering KVM.
--- arch/powerpc/kvm/bookehv_interrupts.S | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/kvm/bookehv_interrupts.S +4 -0
@@ -75,6 +75,10 @@ PPC_LL r1, VCPU_HOST_STACK(r4) PPC_LL r2, HOST_R2(r1) +START_BTB_FLUSH_SECTION + BTB_FLUSH(r10) +END_BTB_FLUSH_SECTION + mfspr r10, SPRN_PID lwz r8, VCPU_HOST_PID(r4) PPC_LL r11, VCPU_SHARED(r4)
Greg Kroah-Hartman
maintainerPATCH 51/107 powerpc/fsl: Enable runtime patching if nospectre_v2 boot arg is used
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit 3bc8ea8603ae4c1e09aca8de229ad38b8091fcb3 upstream.
If the user choses not to use the mitigations, replace the code sequence with nops.
--- arch/powerpc/kernel/setup-common.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/setup-common.c +1 -0
@@ -938,6 +938,7 @@ void __init setup_arch(char **cmdline_p) ppc_md.setup_arch ();setup_barrier_nospec (); +setup_spectre_v2 ();paging_init ();
Greg Kroah-Hartman
maintainerPATCH 53/107 powerpc/fsl: Fixed warning: orphan section `__btb_flush_fixup
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit 039daac5526932ec731e4499613018d263af8b3e upstream.
Fixed the following build warning:
powerpc-linux-gnu-ld: warning: orphan section __btb_flush_fixup' from arch/powerpc/kernel/head_44x.o' being placed in section `__btb_flush_fixup'.
--- arch/powerpc/kernel/head_booke.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
arch/powerpc/kernel/head_booke.h +12 -6
@@ -32,6 +32,16 @@*/ #define THREAD_NORMSAVE (offset) (THREAD_NORMSAVES + (offset * 4)) +#ifdef CONFIG_PPC_FSL_BOOK3E +#define BOOKE_CLEAR_BTB (reg) \ +START_BTB_FLUSH_SECTION \ + BTB_FLUSH(reg) \ +END_BTB_FLUSH_SECTION +#else +#define BOOKE_CLEAR_BTB (reg) +#endif + +#define NORMAL_EXCEPTION_PROLOG (intno) \ mtspr SPRN_SPRG_WSCRATCH0, r10;/* save one register */ \mfspr r10,SPRN_SPRG_THREAD ; \
@@ -43,9 +53,7 @@ andi. r11, r11,MSR_PR ;/* check whether user or kernel */ \mr r11, r1; \ beq 1f; \ -START_BTB_FLUSH_SECTION \ - BTB_FLUSH(r11) \ -END_BTB_FLUSH_SECTION \ +BOOKE_CLEAR_BTB (r11) \/* if from user, start at top of this thread's kernel stack */ \ lwz r11, THREAD_INFO-THREAD(r10); \ALLOC_STACK_FRAME (r11,THREAD_SIZE ); \
@@ -131,9 +139,7 @@ END_BTB_FLUSH_SECTION \stw r9,_CCR (r8 );/* save CR on stack */ \mfspr r11,exc_level_srr1;/* check whether user or kernel */ \ DO_KVM BOOKE_INTERRUPT_##intno exc_level_srr1; \ -START_BTB_FLUSH_SECTION \ - BTB_FLUSH(r10) \ -END_BTB_FLUSH_SECTION \ + BOOKE_CLEAR_BTB(r10) \ andi. r11,r11,MSR_PR; \ mfspr r11,SPRN_SPRG_THREAD;/* if from user, start at top of */ \ lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
Greg Kroah-Hartman
maintainerPATCH 54/107 powerpc/fsl: Fix the flush of branch predictor.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
commit 27da80719ef132cf8c80eb406d5aeb37dddf78cc upstream.
The commit identified below adds MC_BTB_FLUSH macro only when CONFIG_PPC_FSL_BOOK3E is defined. This results in the following error on some configs (seen several times with kisskb randconfig_defconfig)
arch/powerpc/kernel/exceptions-64e.S:576: Error: Unrecognized opcode: `mc_btb_flush' make[3]: *** [scripts/Makefile.build:367: arch/powerpc/kernel/exceptions-64e.o] Error 1 make[2]: *** [scripts/Makefile.build:492: arch/powerpc/kernel] Error 2 make[1]: *** [Makefile:1043: arch/powerpc] Error 2
make: *** [Makefile:152: sub-make] Error 2
This patch adds a blank definition of MC_BTB_FLUSH for other cases.
--- arch/powerpc/kernel/exceptions-64e.S | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/exceptions-64e.S +1 -0
@@ -348,6 +348,7 @@ ret_from_mc_except: #define GEN_BTB_FLUSH #define CRIT_BTB_FLUSH #define DBG_BTB_FLUSH +#define MC_BTB_FLUSH #define GDBELL_BTB_FLUSH #endif
Greg Kroah-Hartman
maintainerPATCH 55/107 powerpc/security: Fix spectre_v2 reporting
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 92edf8df0ff2ae86cc632eeca0e651fd8431d40d upstream.
When I updated the spectre_v2 reporting to handle software count cache flush I got the logic wrong when there's no software count cache enabled at all.
The result is that on systems with the software count cache flush disabled we print:
Mitigation: Indirect branch cache disabled, Software count cache flush
Which correctly indicates that the count cache is disabled, but incorrectly says the software count cache flush is enabled.
The root of the problem is that we are trying to handle all combinations of options. But we know now that we only expect to see the software count cache flush enabled if the other options are false.
So split the two cases, which simplifies the logic and fixes the bug. We were also missing a space before "(hardware accelerated)".
The result is we see one of:
Mitigation: Indirect branch serialisation (kernel only)
Mitigation: Indirect branch cache disabled
Mitigation: Software count cache flush
Mitigation: Software count cache flush (hardware accelerated)
--- arch/powerpc/kernel/security.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
arch/powerpc/kernel/security.c +8 -15
@@ -189,29 +189,22 @@ ssize_t cpu_show_spectre_v2(struct devic bcs =security_ftr_enabled (SEC_FTR_BCCTRL_SERIALISED ); ccd =security_ftr_enabled (SEC_FTR_COUNT_CACHE_DISABLED ); -if (bcs || ccd || count_cache_flush_type !=COUNT_CACHE_FLUSH_NONE ) { -bool comma = false; +if (bcs || ccd) {seq_buf_printf (&s,"Mitigation: " ); -if (bcs) { +if (bcs)seq_buf_printf (&s,"Indirect branch serialisation (kernel only)" ); - comma = true; - } -if (ccd) { -if (comma) -seq_buf_printf (&s,", " ); -seq_buf_printf (&s,"Indirect branch cache disabled" ); - comma = true; - } - -if (comma) +if (bcs && ccd)seq_buf_printf (&s,", " ); -seq_buf_printf (&s,"Software count cache flush" ); +if (ccd) +seq_buf_printf (&s,"Indirect branch cache disabled" ); + }else if (count_cache_flush_type !=COUNT_CACHE_FLUSH_NONE ) { +seq_buf_printf (&s,"Mitigation: Software count cache flush" );if (count_cache_flush_type ==COUNT_CACHE_FLUSH_HW ) -seq_buf_printf (&s,"(hardware accelerated)" ); +seq_buf_printf (&s," (hardware accelerated)" ); }else if (btb_flush_enabled) {seq_buf_printf (&s,"Mitigation: Branch predictor state flush" ); }else {
Greg Kroah-Hartman
maintainerPATCH 57/107 btrfs: remove WARN_ON in log_dir_items
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit 2cc8334270e281815c3850c3adea363c51f21e0d upstream.
When Filipe added the recursive directory logging stuff in 2f2ff0ee5e430 ("Btrfs: fix metadata inconsistencies after directory fsync") he specifically didn't take the directory i_mutex for the children directories that we need to log because of lockdep. This is generally fine, but can lead to this WARN_ON() tripping if we happen to run delayed deletion's in between our first search and our second search of dir_item/dir_indexes for this directory. We expect this to happen, so the WARN_ON() isn't necessary. Drop the WARN_ON() and add a comment so we know why this case can happen.
--- fs/btrfs/tree-log.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/btrfs/tree-log.c +9 -2
@@ -3422,9 +3422,16 @@ static noinline int log_dir_items(struct }btrfs_release_path (path); -/* find the first key from this transaction again */ +/* +* Find the first key from this transaction again. See the note for +* log_new_dir_dentries, if we're logging a directory recursively we +* won't be holding its i_mutex, which means we can modify the directory +* while we're logging it. If we remove an entry between our first +* search and this search we'll not find the key again and can just +* bail. +*/ ret =btrfs_search_slot (NULL , root, &min_key, path,0 ,0 ); -if (WARN_ON (ret !=0 )) +if (ret !=0 ) goto done;/*
Greg Kroah-Hartman
maintainerPATCH 58/107 btrfs: raid56: properly unmap parity page in finish_parity_scrub()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Righi <[email protected]>
commit 3897b6f0a859288c22fb793fad11ec2327e60fcd upstream.
Parity page is incorrectly unmapped in finish_parity_scrub(), triggering a reference counter bug on i386, i.e.:
[ 157.662401] kernel BUG at mm/highmem.c:349! [ 157.666725] invalid opcode: 0000 [#1] SMP PTI
The reason is that kunmap(p_page) was completely left out, so we never did an unmap for the p_page and the loop unmapping the rbio page was iterating over the wrong number of stripes: unmapping should be done with nr_data instead of rbio->real_stripes.
Test case to reproduce the bug:
- create a raid5 btrfs filesystem:
# mkfs.btrfs -m raid5 -d raid5 /dev/sdb /dev/sdc /dev/sdd /dev/sde
- mount it:
# mount /dev/sdb /mnt
- run btrfs scrub in a loop:
# while :; do btrfs scrub start -BR /mnt; done
--- fs/btrfs/raid56.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/raid56.c +2 -1
@@ -2414,8 +2414,9 @@ static noinline void finish_parity_scrubbitmap_clear (rbio->dbitmap, pagenr,1 );kunmap (p); -for (stripe =0 ; stripe < rbio->real_stripes; stripe++) +for (stripe =0 ; stripe < nr_data; stripe++)kunmap (page_in_rbio (rbio, stripe, pagenr,0 )); +kunmap (p_page); }__free_page (p_page);
Greg Kroah-Hartman
maintainerPATCH 59/107 ARM: imx6q: cpuidle: fix bug that CPU might not wake up at expected time
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kohji Okuno <[email protected]>
commit 91740fc8242b4f260cfa4d4536d8551804777fae upstream.
In the current cpuidle implementation for i.MX6q, the CPU that sets 'WAIT_UNCLOCKED' and the CPU that returns to 'WAIT_CLOCKED' are always the same. While the CPU that sets 'WAIT_UNCLOCKED' is in IDLE state of "WAIT", if the other CPU wakes up and enters IDLE state of "WFI" istead of "WAIT", this CPU can not wake up at expired time.
Because, in the case of "WFI", the CPU must be waked up by the local
timer interrupt. But, while 'WAIT_UNCLOCKED' is set, the local timer is stopped, when all CPUs execute "wfi" instruction. As a result, the local timer interrupt is not fired.
In this situation, this CPU will wake up by IRQ different from local
timer. (e.g. broacast timer)
So, this fix changes CPU to return to 'WAIT_CLOCKED'.
--- arch/arm/mach-imx/cpuidle-imx6q.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-)
arch/arm/mach-imx/cpuidle-imx6q.c +10 -17
@@ -16,30 +16,23 @@#include "cpuidle.h" #include "hardware.h" -static atomic_t master =ATOMIC_INIT (0 ); -static DEFINE_SPINLOCK (master_lock); +static int num_idle_cpus =0 ; +static DEFINE_SPINLOCK (cpuidle_lock);static int imx6q_enter_wait (struct cpuidle_device *dev,struct cpuidle_driver *drv,int index) { -if (atomic_inc_return (&master) ==num_online_cpus ()) { -/* -* With this lock, we prevent other cpu to exit and enter -* this function again and become the master. -*/ -if (!spin_trylock (&master_lock)) - goto idle; +spin_lock (&cpuidle_lock); +if (++num_idle_cpus ==num_online_cpus ())imx6_set_lpm (WAIT_UNCLOCKED ); -cpu_do_idle (); -imx6_set_lpm (WAIT_CLOCKED ); -spin_unlock (&master_lock); - goto done; - } +spin_unlock (&cpuidle_lock); -idle:cpu_do_idle (); -done: -atomic_dec (&master); + +spin_lock (&cpuidle_lock); +if (num_idle_cpus-- ==num_online_cpus ()) +imx6_set_lpm (WAIT_CLOCKED ); +spin_unlock (&cpuidle_lock);return index; }
Greg Kroah-Hartman
maintainerPATCH 60/107 powerpc: bpf: Fix generation of load/store DW instructions
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naveen N. Rao <[email protected]>
commit 86be36f6502c52ddb4b85938145324fd07332da1 upstream.
Yauheni Kaliuta pointed out that PTR_TO_STACK store/load verifier test was failing on powerpc64 BE, and rightfully indicated that the PPC_LD() macro is not masking away the last two bits of the offset per the ISA, resulting in the generation of 'lwa' instruction instead of the intended 'ld' instruction.
Segher also pointed out that we can't simply mask away the last two bits as that will result in loading/storing from/to a memory location that was not intended.
This patch addresses this by using ldx/stdx if the offset is not word-aligned. We load the offset into a temporary register (TMP_REG_2) and use that as the index register in a subsequent ldx/stdx. We fix PPC_LD() macro to mask off the last two bits, but enhance PPC_BPF_LL() and PPC_BPF_STL() to factor in the offset value and generate the proper instruction sequence. We also convert all existing users of PPC_LD() and PPC_STD() to use these macros. All existing uses of these macros have been audited to ensure that TMP_REG_2 can be clobbered.
--- arch/powerpc/include/asm/ppc-opcode.h | 2 ++ arch/powerpc/net/bpf_jit.h | 17 +++++------------ arch/powerpc/net/bpf_jit32.h | 4 ++++ arch/powerpc/net/bpf_jit64.h | 20 ++++++++++++++++++++ arch/powerpc/net/bpf_jit_comp64.c | 12 ++++++------ 5 files changed, 37 insertions(+), 18 deletions(-)
arch/powerpc/include/asm/ppc-opcode.h +2 -0
@@ -288,6 +288,7 @@/* Misc instructions for BPF compiler */ #define PPC_INST_LBZ 0x88000000#define PPC_INST_LD 0xe8000000 +#define PPC_INST_LDX 0x7c00002a#define PPC_INST_LHZ 0xa0000000#define PPC_INST_LWZ 0x80000000#define PPC_INST_LHBRX 0x7c00062c
@@ -295,6 +296,7 @@#define PPC_INST_STB 0x98000000#define PPC_INST_STH 0xb0000000#define PPC_INST_STD 0xf8000000 +#define PPC_INST_STDX 0x7c00012a#define PPC_INST_STDU 0xf8000001#define PPC_INST_STW 0x90000000#define PPC_INST_STWU 0x94000000
arch/powerpc/net/bpf_jit.h +5 -12
@@ -51,6 +51,8 @@#define PPC_LIS (r, i) PPC_ADDIS(r, 0, i)#define PPC_STD (r, base, i) EMIT(PPC_INST_STD | ___PPC_RS(r) | \ ___PPC_RA(base) | ((i) & 0xfffc)) +#define PPC_STDX (r, base, b) EMIT(PPC_INST_STDX | ___PPC_RS(r) | \ + ___PPC_RA(base) | ___PPC_RB(b))#define PPC_STDU (r, base, i) EMIT(PPC_INST_STDU | ___PPC_RS(r) | \ ___PPC_RA(base) | ((i) & 0xfffc))#define PPC_STW (r, base, i) EMIT(PPC_INST_STW | ___PPC_RS(r) | \
@@ -65,7 +67,9 @@#define PPC_LBZ (r, base, i) EMIT(PPC_INST_LBZ | ___PPC_RT(r) | \ ___PPC_RA(base) | IMM_L(i))#define PPC_LD (r, base, i) EMIT(PPC_INST_LD | ___PPC_RT(r) | \ - ___PPC_RA(base) | IMM_L(i)) + ___PPC_RA(base) | ((i) & 0xfffc)) +#define PPC_LDX (r, base, b) EMIT(PPC_INST_LDX | ___PPC_RT(r) | \ + ___PPC_RA(base) | ___PPC_RB(b))#define PPC_LWZ (r, base, i) EMIT(PPC_INST_LWZ | ___PPC_RT(r) | \ ___PPC_RA(base) | IMM_L(i))#define PPC_LHZ (r, base, i) EMIT(PPC_INST_LHZ | ___PPC_RT(r) | \
@@ -85,17 +89,6 @@ ___PPC_RA(a) | ___PPC_RB(b))#define PPC_BPF_STDCX (s, a, b) EMIT(PPC_INST_STDCX | ___PPC_RS(s) | \ ___PPC_RA(a) | ___PPC_RB(b)) - -#ifdef CONFIG_PPC64 -#define PPC_BPF_LL (r, base, i) do { PPC_LD(r, base, i); } while(0) -#define PPC_BPF_STL (r, base, i) do { PPC_STD(r, base, i); } while(0) -#define PPC_BPF_STLU (r, base, i) do { PPC_STDU(r, base, i); } while(0) -#else -#define PPC_BPF_LL (r, base, i) do { PPC_LWZ(r, base, i); } while(0) -#define PPC_BPF_STL (r, base, i) do { PPC_STW(r, base, i); } while(0) -#define PPC_BPF_STLU (r, base, i) do { PPC_STWU(r, base, i); } while(0) -#endif -#define PPC_CMPWI (a, i) EMIT(PPC_INST_CMPWI | ___PPC_RA(a) | IMM_L(i))#define PPC_CMPDI (a, i) EMIT(PPC_INST_CMPDI | ___PPC_RA(a) | IMM_L(i))#define PPC_CMPW (a, b) EMIT(PPC_INST_CMPW | ___PPC_RA(a) | \
arch/powerpc/net/bpf_jit32.h +4 -0
@@ -122,6 +122,10 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);#define PPC_NTOHS_OFFS (r, base, i) PPC_LHZ_OFFS(r, base, i)#endif +#define PPC_BPF_LL (r, base, i) do { PPC_LWZ(r, base, i); } while(0) +#define PPC_BPF_STL (r, base, i) do { PPC_STW(r, base, i); } while(0) +#define PPC_BPF_STLU (r, base, i) do { PPC_STWU(r, base, i); } while(0) +#define SEEN_DATAREF 0x10000/* might call external helpers */ #define SEEN_XREG 0x20000/* X reg is used */ #define SEEN_MEM 0x40000/* SEEN_MEM+(1<<n) = use mem[n] for temporary
arch/powerpc/net/bpf_jit64.h +20 -0
@@ -86,6 +86,26 @@ DECLARE_LOAD_FUNC(sk_load_byte); (imm >= SKF_LL_OFF ? func##_negative_offset : func) : \ func##_positive_offset) +/* +* WARNING: These can use TMP_REG_2 if the offset is not at word boundary, +* so ensure that it isn't in use already. +*/ +#define PPC_BPF_LL (r, base, i) do { \ + if ((i) % 4) { \ + PPC_LI(b2p[TMP_REG_2], (i)); \ + PPC_LDX(r, base, b2p[TMP_REG_2]); \ + } else \ + PPC_LD(r, base, i); \ + } while(0) +#define PPC_BPF_STL (r, base, i) do { \ + if ((i) % 4) { \ + PPC_LI(b2p[TMP_REG_2], (i)); \ + PPC_STDX(r, base, b2p[TMP_REG_2]); \ + } else \ + PPC_STD(r, base, i); \ + } while(0) +#define PPC_BPF_STLU (r, base, i) do { PPC_STDU(r, base, i); } while(0) +#define SEEN_FUNC 0x1000/* might call external helpers */ #define SEEN_STACK 0x2000/* uses BPF stack */ #define SEEN_SKB 0x4000/* uses sk_buff */
arch/powerpc/net/bpf_jit_comp64.c +6 -6
@@ -261,7 +261,7 @@ static void bpf_jit_emit_tail_call(u32 ** if (tail_call_cnt > MAX_TAIL_CALL_CNT) * goto out; */ -PPC_LD (b2p[TMP_REG_1 ],1 ,bpf_jit_stack_tailcallcnt (ctx)); +PPC_BPF_LL (b2p[TMP_REG_1 ],1 ,bpf_jit_stack_tailcallcnt (ctx));PPC_CMPLWI (b2p[TMP_REG_1 ],MAX_TAIL_CALL_CNT );PPC_BCC (COND_GT , out);
@@ -274,7 +274,7 @@ static void bpf_jit_emit_tail_call(u32 */* prog = array->ptrs[index]; */ PPC_MULI (b2p[TMP_REG_1 ], b2p_index,8 );PPC_ADD (b2p[TMP_REG_1 ], b2p[TMP_REG_1 ], b2p_bpf_array); -PPC_LD (b2p[TMP_REG_1 ], b2p[TMP_REG_1 ], offsetof(struct bpf_array , ptrs)); +PPC_BPF_LL (b2p[TMP_REG_1 ], b2p[TMP_REG_1 ], offsetof(struct bpf_array , ptrs));/* * if (prog == NULL)
@@ -284,7 +284,7 @@ static void bpf_jit_emit_tail_call(u32 *PPC_BCC (COND_EQ , out);/* goto *(prog->bpf_func + prologue_size); */ -PPC_LD (b2p[TMP_REG_1 ], b2p[TMP_REG_1 ], offsetof(struct bpf_prog , bpf_func)); +PPC_BPF_LL (b2p[TMP_REG_1 ], b2p[TMP_REG_1 ], offsetof(struct bpf_prog , bpf_func));#ifdef PPC64_ELF_ABI_v1/* skip past the function descriptor */ PPC_ADDI(b2p[TMP_REG_1], b2p[TMP_REG_1],
@@ -616,7 +616,7 @@ bpf_alu32_trunc:* the instructions generated will remain the * same across all passes */ -PPC_STD (dst_reg,1 ,bpf_jit_stack_local (ctx)); +PPC_BPF_STL (dst_reg,1 ,bpf_jit_stack_local (ctx));PPC_ADDI (b2p[TMP_REG_1 ],1 ,bpf_jit_stack_local (ctx));PPC_LDBRX (dst_reg,0 , b2p[TMP_REG_1 ]);break ;
@@ -672,7 +672,7 @@ emit_clear:PPC_LI32 (b2p[TMP_REG_1 ], imm); src_reg = b2p[TMP_REG_1 ]; } -PPC_STD (src_reg, dst_reg, off); +PPC_BPF_STL (src_reg, dst_reg, off);break ;/*
@@ -719,7 +719,7 @@ emit_clear:break ;/* dst = *(u64 *)(ul) (src + off) */ case BPF_LDX |BPF_MEM |BPF_DW : -PPC_LD (dst_reg, src_reg, off); +PPC_BPF_LL (dst_reg, src_reg, off);break ;/*
Greg Kroah-Hartman
maintainerPATCH 61/107 NFSv4.1 dont free interrupted slot on open
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
commit 0cb98abb5bd13b9a636bde603d952d722688b428 upstream.
Allow the async rpc task for finish and update the open state if needed, then free the slot. Otherwise, the async rpc unable to decode the reply.
--- fs/nfs/nfs4proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/nfs4proc.c +2 -1
@@ -2746,7 +2746,8 @@ static int _nfs4_open_and_get_state(strunfs4_schedule_stateid_recovery (server, state); } out: -nfs4_sequence_free_slot (&opendata->o_res.seq_res); +if (!opendata->cancelled) +nfs4_sequence_free_slot (&opendata->o_res.seq_res);return ret; }
Greg Kroah-Hartman
maintainerPATCH 62/107 net: dsa: qca8k: remove leftover phy accessors
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Lamparter <[email protected]>
commit 1eec7151ae0e134bd42e3f128066b2ff8da21393 upstream.
This belated patch implements Andrew Lunn's request of "remove the phy_read() and phy_write() functions."
<https://lore.kernel.org/patchwork/comment/902734/>
While seemingly harmless, this causes the switch's user port PHYs to get registered twice. This is because the DSA subsystem will create a slave mdio-bus not knowing that the qca8k_phy_(read|write) accessors operate on the external mdio-bus. So the same "bus" gets effectively duplicated.
--- drivers/net/dsa/qca8k.c | 18 ------------------ 1 file changed, 18 deletions(-)
drivers/net/dsa/qca8k.c +0 -18
@@ -629,22 +629,6 @@ qca8k_adjust_link(struct dsa_switch *ds,qca8k_port_set_status (priv, port,1 ); } -static int -qca8k_phy_read (struct dsa_switch *ds,int phy,int regnum) -{ -struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; - -return mdiobus_read (priv->bus, phy, regnum); -} - -static int -qca8k_phy_write (struct dsa_switch *ds,int phy,int regnum,u16 val) -{ -struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; - -return mdiobus_write (priv->bus, phy, regnum, val); -} -static void qca8k_get_strings (struct dsa_switch *ds,int port,uint8_t *data) {
@@ -879,8 +863,6 @@ static const struct dsa_switch_ops qca8k .setup = qca8k_setup, .adjust_link = qca8k_adjust_link, .get_strings = qca8k_get_strings, - .phy_read = qca8k_phy_read, - .phy_write = qca8k_phy_write, .get_ethtool_stats = qca8k_get_ethtool_stats, .get_sset_count = qca8k_get_sset_count, .get_mac_eee = qca8k_get_mac_eee,
Greg Kroah-Hartman
maintainerPATCH 63/107 ALSA: rawmidi: Fix potential Spectre v1 vulnerability
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit 2b1d9c8f87235f593826b9cf46ec10247741fff9 upstream.
info->stream is indirectly controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability.
This issue was detected with the help of Smatch:
sound/core/rawmidi.c:604 __snd_rawmidi_info_select() warn: potential spectre issue 'rmidi->streams' [r] (local cap)
Fix this by sanitizing info->stream before using it to index rmidi->streams.
Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1].
[1] https://lore.kernel.org/lkml/[email protected]/
--- sound/core/rawmidi.c | 2 ++ 1 file changed, 2 insertions(+)
sound/core/rawmidi.c +2 -0
@@ -29,6 +29,7 @@#include <linux/mutex.h> #include <linux/module.h> #include <linux/delay.h> +#include <linux/nospec.h> #include <sound/rawmidi.h> #include <sound/info.h> #include <sound/control.h>
@@ -591,6 +592,7 @@ static int __snd_rawmidi_info_select(strreturn -ENXIO ;if (info->stream <0 || info->stream >1 )return -EINVAL ; + info->stream =array_index_nospec (info->stream,2 ); pstr = &rmidi->streams[info->stream];if (pstr->substream_count ==0 )return -ENOENT ;
Greg Kroah-Hartman
maintainerPATCH 64/107 ALSA: seq: oss: Fix Spectre v1 vulnerability
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit c709f14f0616482b67f9fbcb965e1493a03ff30b upstream.
dev is indirectly controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability.
This issue was detected with the help of Smatch:
sound/core/seq/oss/seq_oss_synth.c:626 snd_seq_oss_synth_make_info() warn: potential spectre issue 'dp->synths' [w] (local cap)
Fix this by sanitizing dev before using it to index dp->synths.
Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1].
[1] https://lore.kernel.org/lkml/[email protected]/
--- sound/core/seq/oss/seq_oss_synth.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/core/seq/oss/seq_oss_synth.c +4 -3
@@ -617,13 +617,14 @@ int snd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_info *inf) { struct seq_oss_synth *rec; +struct seq_oss_synthinfo *info =get_synthinfo_nospec (dp, dev); -if (dev <0 || dev >= dp->max_synthdev) +if (!info)return -ENXIO ; -if (dp->synths[dev].is_midi) { +if (info->is_midi) {struct midi_info minf; -snd_seq_oss_midi_make_info (dp, dp->synths[dev].midi_mapped, &minf); +snd_seq_oss_midi_make_info (dp, info->midi_mapped, &minf); inf->synth_type =SYNTH_TYPE_MIDI ; inf->synth_subtype =0 ; inf->nr_voices =16 ;
Greg Kroah-Hartman
maintainerPATCH 65/107 ALSA: pcm: Fix possible OOB access in PCM oss plugins
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit ca0214ee2802dd47239a4e39fb21c5b00ef61b22 upstream.
The PCM OSS emulation converts and transfers the data on the fly via "plugins". The data is converted over the dynamically allocated buffer for each plugin, and recently syzkaller caught OOB in this flow.
Although the bisection by syzbot pointed out to the commit 65766ee0bf7f ("ALSA: oss: Use kvzalloc() for local buffer allocations"), this is merely a commit to replace vmalloc() with kvmalloc(), hence it can't be the cause. The further debug action revealed that this happens in the case where a slave PCM doesn't support only the stereo channels while the OSS stream is set up for a mono channel. Below is a brief explanation:
At each OSS parameter change, the driver sets up the PCM hw_params again in snd_pcm_oss_change_params_lock(). This is also the place where plugins are created and local buffers are allocated. The problem is that the plugins are created before the final hw_params is determined. Namely, two snd_pcm_hw_param_near() calls for setting the period size and periods may influence on the final result of channels, rates, etc, too, while the current code has already created plugins beforehand with the premature values. So, the plugin believes that channels=1, while the actual I/O is with channels=2, which makes the driver reading/writing over the allocated buffer size.
The fix is simply to move the plugin allocation code after the final hw_params call.
--- sound/core/oss/pcm_oss.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-)
sound/core/oss/pcm_oss.c +22 -21
@@ -940,6 +940,28 @@ static int snd_pcm_oss_change_params_loc oss_frame_size =snd_pcm_format_physical_width (params_format (params)) *params_channels (params) /8 ; + err =snd_pcm_oss_period_size (substream, params, sparams); +if (err <0 ) + goto failure; + + n =snd_pcm_plug_slave_size (substream, runtime->oss.period_bytes / oss_frame_size); + err =snd_pcm_hw_param_near (substream, sparams,SNDRV_PCM_HW_PARAM_PERIOD_SIZE , n,NULL ); +if (err <0 ) + goto failure; + + err =snd_pcm_hw_param_near (substream, sparams,SNDRV_PCM_HW_PARAM_PERIODS , + runtime->oss.periods,NULL ); +if (err <0 ) + goto failure; + +snd_pcm_kernel_ioctl (substream,SNDRV_PCM_IOCTL_DROP ,NULL ); + + err =snd_pcm_kernel_ioctl (substream,SNDRV_PCM_IOCTL_HW_PARAMS , sparams); +if (err <0 ) { +pcm_dbg (substream->pcm,"HW_PARAMS failed: %i\n" , err); + goto failure; + } +#ifdef CONFIG_SND_PCM_OSS_PLUGINS snd_pcm_oss_plugin_clear (substream);if (!direct) {
@@ -974,27 +996,6 @@ static int snd_pcm_oss_change_params_loc }#endif - err =snd_pcm_oss_period_size (substream, params, sparams); -if (err <0 ) - goto failure; - - n =snd_pcm_plug_slave_size (substream, runtime->oss.period_bytes / oss_frame_size); - err =snd_pcm_hw_param_near (substream, sparams,SNDRV_PCM_HW_PARAM_PERIOD_SIZE , n,NULL ); -if (err <0 ) - goto failure; - - err =snd_pcm_hw_param_near (substream, sparams,SNDRV_PCM_HW_PARAM_PERIODS , - runtime->oss.periods,NULL ); -if (err <0 ) - goto failure; - -snd_pcm_kernel_ioctl (substream,SNDRV_PCM_IOCTL_DROP ,NULL ); - -if ((err =snd_pcm_kernel_ioctl (substream,SNDRV_PCM_IOCTL_HW_PARAMS , sparams)) <0 ) { -pcm_dbg (substream->pcm,"HW_PARAMS failed: %i\n" , err); - goto failure; - } -if (runtime->oss.trigger) { sw_params->start_threshold =1 ; }else {
Greg Kroah-Hartman
maintainerPATCH 66/107 ALSA: pcm: Dont suspend stream in unrecoverable PCM state
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 113ce08109f8e3b091399e7cc32486df1cff48e7 upstream.
Currently PCM core sets each opened stream forcibly to SUSPENDED state via snd_pcm_suspend_all() call, and the user-space is responsible for re-triggering the resume manually either via snd_pcm_resume() or prepare call. The scheme works fine usually, but there are corner cases where the stream can't be resumed by that call: the streams still in OPEN state before finishing hw_params. When they are suspended, user-space cannot perform resume or prepare because they haven't been set up yet. The only possible recovery is to re-open the device, which isn't nice at all. Similarly, when a stream is in DISCONNECTED state, it makes no sense to change it to SUSPENDED state. Ditto for in SETUP state; which you can re-prepare directly.
So, this patch addresses these issues by filtering the PCM streams to be suspended by checking the PCM state. When a stream is in either OPEN, SETUP or DISCONNECTED as well as already SUSPENDED, the suspend action is skipped.
To be noted, this problem was originally reported for the PCM runtime PM on HD-audio. And, the runtime PM problem itself was already addressed (although not intended) by the code refactoring commits 3d21ef0b49f8 ("ALSA: pcm: Suspend streams globally via device type PM ops") and 17bc4815de58 ("ALSA: pci: Remove superfluous snd_pcm_suspend*() calls"). These commits eliminated the snd_pcm_suspend*() calls from the runtime PM suspend callback code path, hence the racy OPEN state won't appear while runtime PM. (FWIW, the race window is between snd_pcm_open_substream() and the first power up in azx_pcm_open().)
Although the runtime PM issue was already "fixed", the same problem is still present for the system PM, hence this patch is still needed. And for stable trees, this patch alone should suffice for fixing the runtime PM problem, too.
--- sound/core/pcm_native.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/core/pcm_native.c +8 -1
@@ -1395,8 +1395,15 @@ static int snd_pcm_pause(struct snd_pcm_static int snd_pcm_pre_suspend (struct snd_pcm_substream *substream,int state) {struct snd_pcm_runtime *runtime = substream->runtime; -if (runtime->status->state ==SNDRV_PCM_STATE_SUSPENDED ) +switch (runtime->status->state) { +case SNDRV_PCM_STATE_SUSPENDED :return -EBUSY ; +/* unresumable PCM state; return -EBUSY for skipping suspend */ +case SNDRV_PCM_STATE_OPEN : +case SNDRV_PCM_STATE_SETUP : +case SNDRV_PCM_STATE_DISCONNECTED : +return -EBUSY ; + } runtime->trigger_master = substream;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 67/107 ALSA: hda/realtek - Add support headset mode for DELL WYSE AIO
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit 136824efaab2c095fc911048f7c7ddeda258c965 upstream.
This patch will enable WYSE AIO for Headset mode.
--- sound/pci/hda/patch_realtek.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
sound/pci/hda/patch_realtek.c +26 -0
@@ -5436,6 +5436,9 @@ enum {ALC298_FIXUP_TPT470_DOCK ,ALC255_FIXUP_DUMMY_LINEOUT_VERB ,ALC255_FIXUP_DELL_HEADSET_MIC , +ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE , +ALC225_FIXUP_WYSE_AUTO_MUTE , + ALC225_FIXUP_WYSE_DISABLE_MIC_VREF, }; static const struct hda_fixup alc269_fixups[] = {
@@ -6311,6 +6314,28 @@ static const struct hda_fixup alc269_fix .chained = true, .chain_id =ALC269_FIXUP_HEADSET_MIC }, + [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x16 ,0x01011020 },/* Rear Line out */ + {0x19 ,0x01a1913c },/* use as Front headset mic, without its own jack detect */ + { } + }, + .chained = true, + .chain_id =ALC225_FIXUP_WYSE_AUTO_MUTE + }, + [ALC225_FIXUP_WYSE_AUTO_MUTE] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_auto_mute_via_amp, + .chained = true, + .chain_id =ALC225_FIXUP_WYSE_DISABLE_MIC_VREF + }, + [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_disable_mic_vref, + .chained = true, + .chain_id =ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC + }, };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -6369,6 +6394,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1028 ,0x0871 ,"Dell Precision 3630" ,ALC255_FIXUP_DELL_HEADSET_MIC ),SND_PCI_QUIRK (0x1028 ,0x0872 ,"Dell Precision 3630" ,ALC255_FIXUP_DELL_HEADSET_MIC ),SND_PCI_QUIRK (0x1028 ,0x0873 ,"Dell Precision 3930" ,ALC255_FIXUP_DUMMY_LINEOUT_VERB ), +SND_PCI_QUIRK (0x1028 ,0x08ad ,"Dell WYSE AIO" ,ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0935 ,"Dell" ,ALC274_FIXUP_DELL_AIO_LINEOUT_VERB ),SND_PCI_QUIRK (0x1028 ,0x164a ,"Dell" ,ALC293_FIXUP_DELL1_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 68/107 ALSA: hda/realtek - Add support headset mode for New DELL WYSE NB
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit da484d00f020af3dd7cfcc6c4b69a7f856832883 upstream.
Enable headset mode support for new WYSE NB platform.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -6395,6 +6395,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1028 ,0x0872 ,"Dell Precision 3630" ,ALC255_FIXUP_DELL_HEADSET_MIC ),SND_PCI_QUIRK (0x1028 ,0x0873 ,"Dell Precision 3930" ,ALC255_FIXUP_DUMMY_LINEOUT_VERB ),SND_PCI_QUIRK (0x1028 ,0x08ad ,"Dell WYSE AIO" ,ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1028 ,0x08ae ,"Dell WYSE NB" ,ALC225_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0935 ,"Dell" ,ALC274_FIXUP_DELL_AIO_LINEOUT_VERB ),SND_PCI_QUIRK (0x1028 ,0x164a ,"Dell" ,ALC293_FIXUP_DELL1_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 69/107 kbuild: modversions: Fix relative CRC byte order interpretation
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fredrik Noring <[email protected]>
commit 54a7151b1496cddbb7a83546b7998103e98edc88 upstream.
Fix commit 56067812d5b0 ("kbuild: modversions: add infrastructure for emitting relative CRCs") where CRCs are interpreted in host byte order rather than proper kernel byte order. The bug is conditional on CONFIG_MODULE_REL_CRCS.
For example, when loading a BE module into a BE kernel compiled with a LE system, the error "disagrees about version of symbol module_layout" is produced. A message such as "Found checksum D7FA6856 vs module 5668FAD7" will be given with debug enabled, which indicates an obvious endian problem within __kcrctab within the kernel image.
The general solution is to use the macro TO_NATIVE, as is done in similar cases throughout modpost.c. With this correction it has been verified that a BE kernel compiled with a LE system accepts BE modules.
This change has also been verified with a LE kernel compiled with a LE system, in which case TO_NATIVE returns its value unmodified since the byte orders match. This is by far the common case.
--- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/mod/modpost.c +1 -1
@@ -645,7 +645,7 @@ static void handle_modversions(struct mo info->sechdrs[sym->st_shndx].sh_offset - (info->hdr->e_type !=ET_REL ? info->sechdrs[sym->st_shndx].sh_addr :0 ); - crc = *crcp; + crc =TO_NATIVE (*crcp); }sym_update_crc (symname +strlen (CRC_PFX ), mod, crc, export);
Greg Kroah-Hartman
maintainerPATCH 43/107 powerpc/fsl: Add infrastructure to fixup branch predictor flush
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit 76a5eaa38b15dda92cd6964248c39b5a6f3a4e9d upstream.
In order to protect against speculation attacks (Spectre variant 2) on NXP PowerPC platforms, the branch predictor should be flushed when the privillege level is changed. This patch is adding the infrastructure to fixup at runtime the code sections that are performing the branch predictor flush depending on a boot arg parameter which is added later in a separate patch.
--- arch/powerpc/include/asm/feature-fixups.h | 12 ++++++++++++ arch/powerpc/include/asm/setup.h | 2 ++ arch/powerpc/kernel/vmlinux.lds.S | 8 ++++++++ arch/powerpc/lib/feature-fixups.c | 23 +++++++++++++++++++++++ 4 files changed, 45 insertions(+)
arch/powerpc/include/asm/feature-fixups.h +12 -0
@@ -219,6 +219,17 @@ label##3: \ FTR_ENTRY_OFFSET 953b-954b; \ .popsection; +#define START_BTB_FLUSH_SECTION \ +955: \ + +#define END_BTB_FLUSH_SECTION \ +956: \ + .pushsection __btb_flush_fixup,"a"; \ + .align 2; \ +957: \ + FTR_ENTRY_OFFSET 955b-957b; \ + FTR_ENTRY_OFFSET 956b-957b; \ + .popsection;#ifndef __ASSEMBLY__#include <linux/types.h>
@@ -228,6 +239,7 @@ extern long __start___stf_entry_barrier_extern long __start___stf_exit_barrier_fixup, __stop___stf_exit_barrier_fixup;extern long __start___rfi_flush_fixup, __stop___rfi_flush_fixup;extern long __start___barrier_nospec_fixup, __stop___barrier_nospec_fixup; +extern long __start__btb_flush_fixup, __stop__btb_flush_fixup;void apply_feature_fixups (void );void setup_feature_keys (void );
arch/powerpc/include/asm/setup.h +2 -0
@@ -66,6 +66,8 @@ void do_barrier_nospec_fixups_range(boolstatic inline void do_barrier_nospec_fixups_range (bool enable,void *start,void *end) { };#endif +void do_btb_flush_fixups (void ); +#endif /* !__ASSEMBLY__ */ #endif /* _ASM_POWERPC_SETUP_H */
arch/powerpc/kernel/vmlinux.lds.S +8 -0
@@ -164,6 +164,14 @@ SECTIONS } #endif /* CONFIG_PPC_BARRIER_NOSPEC */ +#ifdef CONFIG_PPC_FSL_BOOK3E + . = ALIGN(8); + __spec_btb_flush_fixup : AT(ADDR(__spec_btb_flush_fixup) - LOAD_OFFSET) { + __start__btb_flush_fixup = .; + *(__btb_flush_fixup) + __stop__btb_flush_fixup = .; + } +#endif EXCEPTION_TABLE(0) NOTES :kernel :notes
arch/powerpc/lib/feature-fixups.c +23 -0
@@ -347,6 +347,29 @@ void do_barrier_nospec_fixups_range(boolprintk (KERN_DEBUG "barrier-nospec: patched %d locations\n" , i); } + +static void patch_btb_flush_section (long *curr) +{ +unsigned int *start, *end; + + start = (void *)curr + *curr; + end = (void *)curr + *(curr +1 ); +for (; start < end; start++) { +pr_devel ("patching dest %lx\n" , (unsigned long )start); +patch_instruction (start,PPC_INST_NOP ); + } +} + +void do_btb_flush_fixups (void ) +{ +long *start, *end; + + start =PTRRELOC (&__start__btb_flush_fixup); + end =PTRRELOC (&__stop__btb_flush_fixup); + +for (; start < end; start +=2 ) +patch_btb_flush_section (start); +}#endif /* CONFIG_PPC_FSL_BOOK3E */ void do_lwsync_fixups (unsigned long value,void *fixup_start,void *fixup_end)
Greg Kroah-Hartman
maintainerPATCH 70/107 fs/open.c: allow opening only regular files during execve()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
commit 73601ea5b7b18eb234219ae2adf77530f389da79 upstream.
syzbot is hitting lockdep warning [1] due to trying to open a fifo during an execve() operation. But we don't need to open non regular files during an execve() operation, for all files which we will need are the executable file itself and the interpreter programs like /bin/sh and ld-linux.so.2 .
Since the manpage for execve(2) says that execve() returns EACCES when the file or a script interpreter is not a regular file, and the manpage for uselib(2) says that uselib() can return EACCES, and we use FMODE_EXEC when opening for execve()/uselib(), we can bail out if a non regular file is requested with FMODE_EXEC set.
Since this deadlock followed by khungtaskd warnings is trivially reproducible by a local unprivileged user, and syzbot's frequent crash due to this deadlock defers finding other bugs, let's workaround this deadlock until we get a chance to find a better solution.
[1] https://syzkaller.appspot.com/bug?id=b5095bfec44ec84213bac54742a82483aad578ce
--- fs/open.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/open.c +6 -0
@@ -716,6 +716,12 @@ static int do_dentry_open(struct file *freturn 0 ; } +/* Any file opened for execve()/uselib() has to be a regular file. */ +if (unlikely (f->f_flags &FMODE_EXEC && !S_ISREG (inode->i_mode))) { + error = -EACCES ; + goto cleanup_file; + } +if (f->f_mode &FMODE_WRITE && !special_file (inode->i_mode)) { error =get_write_access (inode);if (unlikely (error))
Greg Kroah-Hartman
maintainerPATCH 71/107 ocfs2: fix inode bh swapping mixup in ocfs2_reflink_inodes_lock
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
commit e6a9467ea14bae8691b0f72c500510c42ea8edb8 upstream.
ocfs2_reflink_inodes_lock() can swap the inode1/inode2 variables so that we always grab cluster locks in order of increasing inode number.
Unfortunately, we forget to swap the inode record buffer head pointers when we've done this, which leads to incorrect bookkeepping when we're trying to make the two inodes have the same refcount tree.
This has the effect of causing filesystem shutdowns if you're trying to reflink data from inode 100 into inode 97, where inode 100 already has a refcount tree attached and inode 97 doesn't. The reflink code decides to copy the refcount tree pointer from 100 to 97, but uses inode 97's inode record to open the tree root (which it doesn't have) and blows up. This issue causes filesystem shutdowns and metadata corruption!
--- fs/ocfs2/refcounttree.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-)
fs/ocfs2/refcounttree.c +24 -18
@@ -4716,22 +4716,23 @@ out:/* Lock an inode and grab a bh pointing to the inode. */ static int ocfs2_reflink_inodes_lock (struct inode *s_inode, -struct buffer_head **bh1, +struct buffer_head **bh_s,struct inode *t_inode, -struct buffer_head **bh2) +struct buffer_head **bh_t) { -struct inode *inode1; -struct inode *inode2; +struct inode *inode1 = s_inode; +struct inode *inode2 = t_inode;struct ocfs2_inode_info *oi1;struct ocfs2_inode_info *oi2; +struct buffer_head *bh1 =NULL ; +struct buffer_head *bh2 =NULL ;bool same_inode = (s_inode == t_inode); +bool need_swap = (inode1->i_ino > inode2->i_ino);int status;/* First grab the VFS and rw locks. */ lock_two_nondirectories (s_inode, t_inode); - inode1 = s_inode; - inode2 = t_inode; -if (inode1->i_ino > inode2->i_ino) +if (need_swap)swap (inode1, inode2); status =ocfs2_rw_lock (inode1,1 );
@@ -4754,17 +4755,13 @@ static int ocfs2_reflink_inodes_lock(strtrace_ocfs2_double_lock ((unsigned long long )oi1->ip_blkno, (unsigned long long )oi2->ip_blkno); -if (*bh1) - *bh1 =NULL ; -if (*bh2) - *bh2 =NULL ; -/* We always want to lock the one with the lower lockid first. */ if (oi1->ip_blkno > oi2->ip_blkno)mlog_errno (-ENOLCK );/* lock id1 */ - status =ocfs2_inode_lock_nested (inode1, bh1,1 ,OI_LS_REFLINK_TARGET ); + status =ocfs2_inode_lock_nested (inode1, &bh1,1 , +OI_LS_REFLINK_TARGET );if (status <0 ) {if (status != -ENOENT )mlog_errno (status);
@@ -4773,15 +4770,25 @@ static int ocfs2_reflink_inodes_lock(str/* lock id2 */ if (!same_inode) { - status =ocfs2_inode_lock_nested (inode2, bh2,1 , + status =ocfs2_inode_lock_nested (inode2, &bh2,1 ,OI_LS_REFLINK_TARGET );if (status <0 ) {if (status != -ENOENT )mlog_errno (status); goto out_cl1; } - }else - *bh2 = *bh1; + }else { + bh2 = bh1; + } + +/* +* If we swapped inode order above, we have to swap the buffer heads +* before passing them back to the caller. +*/ +if (need_swap) +swap (bh1, bh2); + *bh_s = bh1; + *bh_t = bh2; trace_ocfs2_double_lock_end( (unsigned long long)OCFS2_I(inode1)->ip_blkno,
@@ -4791,8 +4798,7 @@ static int ocfs2_reflink_inodes_lock(str out_cl1:ocfs2_inode_unlock (inode1,1 ); -brelse (*bh1); - *bh1 =NULL ; +brelse (bh1); out_rw2:ocfs2_rw_unlock (inode2,1 ); out_i2:
Greg Kroah-Hartman
maintainerPATCH 72/107 scsi: sd: Fix a race between closing an sd device and sd I/O
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit c14a57264399efd39514a2329c591a4b954246d8 upstream.
The scsi_end_request() function calls scsi_cmd_to_driver() indirectly and hence needs the disk->private_data pointer. Avoid that that pointer is cleared before all affected I/O requests have finished. This patch avoids that the following crash occurs:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 Call trace: scsi_mq_uninit_cmd+0x1c/0x30 scsi_end_request+0x7c/0x1b8 scsi_io_completion+0x464/0x668 scsi_finish_command+0xbc/0x160 scsi_eh_flush_done_q+0x10c/0x170 sas_scsi_recover_host+0x84c/0xa98 [libsas] scsi_error_handler+0x140/0x5b0 kthread+0x100/0x12c ret_from_fork+0x10/0x18
--- drivers/scsi/sd.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/scsi/sd.c +13 -6
@@ -1420,11 +1420,6 @@ static void sd_release(struct gendisk *dscsi_set_medium_removal (sdev,SCSI_REMOVAL_ALLOW ); } -/* -* XXX and what if there are packets in flight and this close() -* XXX is followed by a "rmmod sd_mod"? -*/ -scsi_disk_put (sdkp); }
@@ -3521,11 +3516,23 @@ static void scsi_disk_release(struct dev {struct scsi_disk *sdkp =to_scsi_disk (dev);struct gendisk *disk = sdkp->disk; - +struct request_queue *q = disk->queue; +spin_lock (&sd_index_lock);ida_remove (&sd_index_ida, sdkp->index);spin_unlock (&sd_index_lock); +/* +* Wait until all requests that are in progress have completed. +* This is necessary to avoid that e.g. scsi_end_request() crashes +* due to clearing the disk->private_data pointer. Wait from inside +* scsi_disk_release() instead of from sd_release() to avoid that +* freezing and unfreezing the request queue affects user space I/O +* in case multiple processes open a /dev/sd... node concurrently. +*/ +blk_mq_freeze_queue (q); +blk_mq_unfreeze_queue (q); + disk->private_data =NULL ;put_disk (disk);put_device (&sdkp->device->sdev_gendev);
Greg Kroah-Hartman
maintainerPATCH 73/107 scsi: sd: Quiesce warning if device does not report optimal I/O size
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin K. Petersen <[email protected]>
commit 1d5de5bd311be7cd54f02f7cd164f0349a75c876 upstream.
Commit a83da8a4509d ("scsi: sd: Optimal I/O size should be a multiple of physical block size") split one conditional into several separate statements in an effort to provide more accurate warning messages when a device reports a nonsensical value. However, this reorganization accidentally dropped the precondition of the reported value being larger than zero. This lead to a warning getting emitted on devices that do not report an optimal I/O size at all.
Remain silent if a device does not report an optimal I/O size.
--- drivers/scsi/sd.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/sd.c +3 -0
@@ -3084,6 +3084,9 @@ static bool sd_validate_opt_xfer_size(stunsigned int opt_xfer_bytes =logical_to_bytes (sdp, sdkp->opt_xfer_blocks); +if (sdkp->opt_xfer_blocks ==0 ) +return false; +if (sdkp->opt_xfer_blocks > dev_max) {sd_first_printk (KERN_WARNING , sdkp, "Optimal transfer size %u logical blocks " \
Greg Kroah-Hartman
maintainerPATCH 75/107 scsi: zfcp: fix scsi_eh host reset with port_forced ERP for non-NPIV FCP devices
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 242ec1455151267fe35a0834aa9038e4c4670884 upstream.
Suppose more than one non-NPIV FCP device is active on the same channel. Send I/O to storage and have some of the pending I/O run into a SCSI command timeout, e.g. due to bit errors on the fibre. Now the error situation stops. However, we saw FCP requests continue to timeout in the channel. The abort will be successful, but the subsequent TUR fails. Scsi_eh starts. The LUN reset fails. The target reset fails. The host reset only did an FCP device recovery. However, for non-NPIV FCP devices, this does not close and reopen ports on the SAN-side if other non-NPIV FCP device(s) share the same open ports.
In order to resolve the continuing FCP request timeouts, we need to explicitly close and reopen ports on the SAN-side.
This was missing since the beginning of zfcp in v2.6.0 history commit ea127f975424 ("[PATCH] s390 (7/7): zfcp host adapter.").
Note: The FSF requests for forced port reopen could run into FSF request timeouts due to other reasons. This would trigger an internal FCP device recovery. Pending forced port reopen recoveries would get dismissed. So some ports might not get fully reopened during this host reset handler. However, subsequent I/O would trigger the above described escalation and eventually all ports would be forced reopen to resolve any continuing FCP request timeouts due to earlier bit errors.
--- drivers/s390/scsi/zfcp_erp.c | 14 ++++++++++++++ drivers/s390/scsi/zfcp_ext.h | 2 ++ drivers/s390/scsi/zfcp_scsi.c | 4 ++++ 3 files changed, 20 insertions(+)
drivers/s390/scsi/zfcp_erp.c +14 -0
@@ -652,6 +652,20 @@ static void zfcp_erp_strategy_memwait(stadd_timer (&erp_action->timer); } +void zfcp_erp_port_forced_reopen_all (struct zfcp_adapter *adapter, +int clear,char *dbftag) +{ +unsigned long flags; +struct zfcp_port *port; + +write_lock_irqsave (&adapter->erp_lock, flags); +read_lock (&adapter->port_list_lock); +list_for_each_entry (port, &adapter->port_list, list) +_zfcp_erp_port_forced_reopen (port, clear, dbftag); +read_unlock (&adapter->port_list_lock); +write_unlock_irqrestore (&adapter->erp_lock, flags); +} +static void _zfcp_erp_port_reopen_all (struct zfcp_adapter *adapter,int clear,char *id) {
drivers/s390/scsi/zfcp_ext.h +2 -0
@@ -68,6 +68,8 @@ extern void zfcp_erp_clear_port_status(sextern int zfcp_erp_port_reopen (struct zfcp_port *,int ,char *);extern void zfcp_erp_port_shutdown (struct zfcp_port *,int ,char *);extern void zfcp_erp_port_forced_reopen (struct zfcp_port *,int ,char *); +extern void zfcp_erp_port_forced_reopen_all (struct zfcp_adapter *adapter, +int clear,char *dbftag);extern void zfcp_erp_set_lun_status (struct scsi_device *,u32 );extern void zfcp_erp_clear_lun_status (struct scsi_device *,u32 );extern void zfcp_erp_lun_reopen (struct scsi_device *,int ,char *);
drivers/s390/scsi/zfcp_scsi.c +4 -0
@@ -327,6 +327,10 @@ static int zfcp_scsi_eh_host_reset_handlstruct zfcp_adapter *adapter = zfcp_sdev->port->adapter;int ret =SUCCESS , fc_ret; +if (!(adapter->connection_features &FSF_FEATURE_NPIV_MODE )) { +zfcp_erp_port_forced_reopen_all (adapter,0 ,"schrh_p" ); +zfcp_erp_wait (adapter); + }zfcp_erp_adapter_reopen (adapter,0 ,"schrh_1" );zfcp_erp_wait (adapter); fc_ret =fc_block_scsi_eh (scpnt);
Greg Kroah-Hartman
maintainerPATCH 76/107 tty: atmel_serial: fix a potential NULL pointer dereference
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kangjie Lu <[email protected]>
commit c85be041065c0be8bc48eda4c45e0319caf1d0e5 upstream.
In case dmaengine_prep_dma_cyclic fails, the fix returns a proper error code to avoid NULL pointer dereference.
--- drivers/tty/serial/atmel_serial.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/atmel_serial.c +4 -0
@@ -1163,6 +1163,10 @@ static int atmel_prepare_rx_dma(struct usg_dma_len (&atmel_port->sg_rx)/2 ,DMA_DEV_TO_MEM , DMA_PREP_INTERRUPT); +if (!desc) { +dev_err (port->dev,"Preparing DMA cyclic failed\n" ); + goto chan_err; + } desc->callback = atmel_complete_rx_dma; desc->callback_param = port; atmel_port->desc_rx = desc;
Greg Kroah-Hartman
maintainerPATCH 77/107 staging: comedi: ni_mio_common: Fix divide-by-zero for DIO cmdtest
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit bafd9c64056cd034a1174dcadb65cd3b294ff8f6 upstream.
ni_cdio_cmdtest() validates Comedi asynchronous commands for the DIO subdevice (subdevice 2) of supported National Instruments M-series cards. It is called when handling the COMEDI_CMD and COMEDI_CMDTEST ioctls for this subdevice. There are two causes for a possible divide-by-zero error when validating that the stop_arg member of the passed-in command is not too large.
The first cause for the divide-by-zero is that calls to comedi_bytes_per_scan() are only valid once the command has been copied to s->async->cmd, but that copy is only done for the COMEDI_CMD ioctl. For the COMEDI_CMDTEST ioctl, it will use whatever was left there by the previous COMEDI_CMD ioctl, if any. (This is very likely, as it is usual for the application to use COMEDI_CMDTEST before COMEDI_CMD.) If there has been no previous, valid COMEDI_CMD for this subdevice, then comedi_bytes_per_scan() will return 0, so the subsequent division in ni_cdio_cmdtest() of s->async->prealloc_bufsz / comedi_bytes_per_scan(s) will be a divide-by-zero error. To fix this error, call a new function comedi_bytes_per_scan_cmd(s, cmd), based on the existing comedi_bytes_per_scan(s) but using a specified struct comedi_cmd for its calculations. (Also refactor comedi_bytes_per_scan() to call the new function.)
Once the first cause for the divide-by-zero has been fixed, the second cause is that comedi_bytes_per_scan_cmd() can legitimately return 0 if the scan_end_arg member of the struct comedi_cmd being tested is 0. Fix it by only performing the division (and validating that stop_arg is no more than the maximum value) if comedi_bytes_per_scan_cmd() returns a non-zero value.
The problem was reported on the COMEDI mailing list here:
https://groups.google.com/forum/#!topic/comedi_list/4t9WlHzMhKM
--- drivers/staging/comedi/comedidev.h | 2 + drivers/staging/comedi/drivers.c | 33 +++++++++++++++++++++---- drivers/staging/comedi/drivers/ni_mio_common.c | 10 +++++-- 3 files changed, 38 insertions(+), 7 deletions(-)
drivers/staging/comedi/comedidev.h +2 -0
@@ -992,6 +992,8 @@ int comedi_dio_insn_config(struct comedi unsigned int mask);unsigned int comedi_dio_update_state (struct comedi_subdevice *s,unsigned int *data); +unsigned int comedi_bytes_per_scan_cmd (struct comedi_subdevice *s, +struct comedi_cmd *cmd);unsigned int comedi_bytes_per_scan (struct comedi_subdevice *s);unsigned int comedi_nscans_left (struct comedi_subdevice *s,unsigned int nscans);
drivers/staging/comedi/drivers.c +29 -4
@@ -390,11 +390,13 @@ unsigned int comedi_dio_update_state(strEXPORT_SYMBOL_GPL (comedi_dio_update_state);/** -* comedi_bytes_per_scan() - Get length of asynchronous command "scan" in bytes +* comedi_bytes_per_scan_cmd() - Get length of asynchronous command "scan" in +* bytes * @s: COMEDI subdevice. +* @cmd: COMEDI command. * * Determines the overall scan length according to the subdevice type and the -* number of channels in the scan. +* number of channels in the scan for the specified command. * * For digital input, output or input/output subdevices, samples for * multiple channels are assumed to be packed into one or more unsigned
@@ -404,9 +406,9 @@ EXPORT_SYMBOL_GPL(comedi_dio_update_stat* * Returns the overall scan length in bytes. */ -unsigned int comedi_bytes_per_scan (struct comedi_subdevice *s) +unsigned int comedi_bytes_per_scan_cmd (struct comedi_subdevice *s, +struct comedi_cmd *cmd) { -struct comedi_cmd *cmd = &s->async->cmd;unsigned int num_samples;unsigned int bits_per_sample;
@@ -423,6 +425,29 @@ unsigned int comedi_bytes_per_scan(struc }return comedi_samples_to_bytes (s, num_samples); } +EXPORT_SYMBOL_GPL (comedi_bytes_per_scan_cmd); + +/** +* comedi_bytes_per_scan() - Get length of asynchronous command "scan" in bytes +* @s: COMEDI subdevice. +* +* Determines the overall scan length according to the subdevice type and the +* number of channels in the scan for the current command. +* +* For digital input, output or input/output subdevices, samples for +* multiple channels are assumed to be packed into one or more unsigned +* short or unsigned int values according to the subdevice's %SDF_LSAMPL +* flag. For other types of subdevice, samples are assumed to occupy a +* whole unsigned short or unsigned int according to the %SDF_LSAMPL flag. +* +* Returns the overall scan length in bytes. +*/ +unsigned int comedi_bytes_per_scan (struct comedi_subdevice *s) +{ +struct comedi_cmd *cmd = &s->async->cmd; + +return comedi_bytes_per_scan_cmd (s, cmd); +}EXPORT_SYMBOL_GPL (comedi_bytes_per_scan); static unsigned int __comedi_nscans_left(struct comedi_subdevice *s,
drivers/staging/comedi/drivers/ni_mio_common.c +7 -3
@@ -3523,6 +3523,7 @@ static int ni_cdio_check_chanlist(structstatic int ni_cdio_cmdtest (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_cmd *cmd) { +unsigned int bytes_per_scan;int err =0 ;int tmp;
@@ -3552,9 +3553,12 @@ static int ni_cdio_cmdtest(struct comedi err |=comedi_check_trigger_arg_is (&cmd->convert_arg,0 ); err |=comedi_check_trigger_arg_is (&cmd->scan_end_arg, cmd->chanlist_len); - err |=comedi_check_trigger_arg_max (&cmd->stop_arg, - s->async->prealloc_bufsz / -comedi_bytes_per_scan (s)); + bytes_per_scan =comedi_bytes_per_scan_cmd (s, cmd); +if (bytes_per_scan) { + err |=comedi_check_trigger_arg_max (&cmd->stop_arg, + s->async->prealloc_bufsz / + bytes_per_scan); + }if (err)return 3 ;
Greg Kroah-Hartman
maintainerPATCH 79/107 staging: vt6655: Fix interrupt race condition on device start up.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 3b9c2f2e0e99bb67c96abcb659b3465efe3bee1f upstream.
It appears on some slower systems that the driver can find its way out of the workqueue while the interrupt is disabled by continuous polling by it.
Move MACvIntEnable to vnt_interrupt_work so that it is always enabled on all routes out of vnt_interrupt_process.
Move MACvIntDisable so that the device doesn't keep polling the system while the workqueue is being processed.
--- drivers/staging/vt6655/device_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6655/device_main.c +4 -4
@@ -973,8 +973,6 @@ static void vnt_interrupt_process(structreturn ; } -MACvIntDisable (priv->PortOffset); -spin_lock_irqsave (&priv->lock, flags);/* Read low level stats */
@@ -1062,8 +1060,6 @@ static void vnt_interrupt_process(struct }spin_unlock_irqrestore (&priv->lock, flags); - -MACvIntEnable (priv->PortOffset,IMR_MASK_VALUE ); }static void vnt_interrupt_work (struct work_struct *work)
@@ -1073,6 +1069,8 @@ static void vnt_interrupt_work(struct woif (priv->vif)vnt_interrupt_process (priv); + +MACvIntEnable (priv->PortOffset,IMR_MASK_VALUE ); }static irqreturn_t vnt_interrupt (int irq,void *arg)
@@ -1081,6 +1079,8 @@ static irqreturn_t vnt_interrupt(int irqschedule_work (&priv->interrupt_work); +MACvIntDisable (priv->PortOffset); +return IRQ_HANDLED ; }
Greg Kroah-Hartman
maintainerPATCH 44/107 powerpc/fsl: Add macro to flush the branch predictor
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit 1cbf8990d79ff69da8ad09e8a3df014e1494462b upstream.
The BUCSR register can be used to invalidate the entries in the branch prediction mechanisms.
--- arch/powerpc/include/asm/ppc_asm.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/powerpc/include/asm/ppc_asm.h +10 -0
@@ -802,4 +802,14 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601) stringify_in_c(.long (_target) - . ;) \ stringify_in_c(.previous) +#ifdef CONFIG_PPC_FSL_BOOK3E +#define BTB_FLUSH (reg) \ + lis reg,BUCSR_INIT@h; \ + ori reg,reg,BUCSR_INIT@l; \ + mtspr SPRN_BUCSR,reg; \ + isync; +#else +#define BTB_FLUSH (reg) +#endif /* CONFIG_PPC_FSL_BOOK3E */ +#endif /* _ASM_POWERPC_PPC_ASM_H */
Greg Kroah-Hartman
maintainerPATCH 46/107 powerpc/fsl: Emulate SPRN_BUCSR register
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit 98518c4d8728656db349f875fcbbc7c126d4c973 upstream.
In order to flush the branch predictor the guest kernel performs writes to the BUCSR register which is hypervisor privilleged. However, the branch predictor is flushed at each KVM entry, so the branch predictor has been already flushed, so just return as soon as possible to guest.
--- arch/powerpc/kvm/e500_emulate.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/powerpc/kvm/e500_emulate.c +7 -0
@@ -277,6 +277,13 @@ int kvmppc_core_emulate_mtspr_e500(struc vcpu->arch.pwrmgtcr0 = spr_val;break ; +case SPRN_BUCSR : +/* +* If we are here, it means that we have already flushed the +* branch predictor, so just return to guest. +*/ +break ; +/* extra exceptions */ #ifdef CONFIG_SPE_POSSIBLE case SPRN_IVOR32 :
Greg Kroah-Hartman
maintainerPATCH 45/107 powerpc/fsl: Fix spectre_v2 mitigations reporting
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit 7d8bad99ba5a22892f0cad6881289fdc3875a930 upstream.
Currently for CONFIG_PPC_FSL_BOOK3E the spectre_v2 file is incorrect:
$ cat /sys/devices/system/cpu/vulnerabilities/spectre_v2 "Mitigation: Software count cache flush"
Which is wrong. Fix it to report vulnerable for now.
--- arch/powerpc/kernel/security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/security.c +1 -1
@@ -22,7 +22,7 @@ enum count_cache_flush_type {COUNT_CACHE_FLUSH_SW =0x2 , COUNT_CACHE_FLUSH_HW = 0x4, }; -static enum count_cache_flush_type count_cache_flush_type; +static enum count_cache_flush_type count_cache_flush_type =COUNT_CACHE_FLUSH_NONE ;bool barrier_nospec_enabled;static bool no_nospec;
Greg Kroah-Hartman
maintainerPATCH 47/107 powerpc/fsl: Add nospectre_v2 command line argument
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit f633a8ad636efb5d4bba1a047d4a0f1ef719aa06 upstream.
When the command line argument is present, the Spectre variant 2 mitigations are disabled.
--- arch/powerpc/include/asm/setup.h | 5 +++++ arch/powerpc/kernel/security.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+)
arch/powerpc/include/asm/setup.h +5 -0
@@ -66,6 +66,11 @@ void do_barrier_nospec_fixups_range(boolstatic inline void do_barrier_nospec_fixups_range (bool enable,void *start,void *end) { };#endif +#ifdef CONFIG_PPC_FSL_BOOK3E +void setup_spectre_v2 (void ); +#else +static inline void setup_spectre_v2 (void ) {}; +#endif void do_btb_flush_fixups (void );#endif /* !__ASSEMBLY__ */
arch/powerpc/kernel/security.c +21 -0
@@ -26,6 +26,10 @@ static enum count_cache_flush_type countbool barrier_nospec_enabled;static bool no_nospec; +static bool btb_flush_enabled; +#ifdef CONFIG_PPC_FSL_BOOK3E +static bool no_spectrev2; +#endif static void enable_barrier_nospec (bool enable) {
@@ -101,6 +105,23 @@ static __init int barrier_nospec_debugfsdevice_initcall (barrier_nospec_debugfs_init);#endif /* CONFIG_DEBUG_FS */ +#ifdef CONFIG_PPC_FSL_BOOK3E +static int __init handle_nospectre_v2 (char *p) +{ + no_spectrev2 = true; + +return 0 ; +} +early_param ("nospectre_v2" , handle_nospectre_v2); +void setup_spectre_v2 (void ) +{ +if (no_spectrev2) +do_btb_flush_fixups (); +else + btb_flush_enabled = true; +} +#endif /* CONFIG_PPC_FSL_BOOK3E */ +#ifdef CONFIG_PPC_BOOK3S_64 ssize_t cpu_show_meltdown (struct device *dev,struct device_attribute *attr,char *buf) {
Greg Kroah-Hartman
maintainerPATCH 48/107 powerpc/fsl: Flush the branch predictor at each kernel entry (64bit)
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit 10c5e83afd4a3f01712d97d3bb1ae34d5b74a185 upstream.
In order to protect against speculation attacks on indirect branches, the branch predictor is flushed at kernel entry to protect for the following situations:
- userspace process attacking another userspace process
- userspace process attacking the kernel Basically when the privillege level change (i.e. the kernel is entered), the branch predictor state is flushed.
--- arch/powerpc/kernel/entry_64.S | 5 +++++ arch/powerpc/kernel/exceptions-64e.S | 26 +++++++++++++++++++++++++- arch/powerpc/mm/tlb_low_64e.S | 7 +++++++ 3 files changed, 37 insertions(+), 1 deletion(-)
arch/powerpc/kernel/entry_64.S +5 -0
@@ -78,6 +78,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_TM) std r0,GPR0(r1) std r10,GPR1(r1) beq 2f /* if from kernel mode */ +#ifdef CONFIG_PPC_FSL_BOOK3E +START_BTB_FLUSH_SECTION + BTB_FLUSH(r10) +END_BTB_FLUSH_SECTION +#endif ACCOUNT_CPU_USER_ENTRY(r13, r10, r11) 2: std r2,GPR2(r1) std r3,GPR3(r1)
arch/powerpc/kernel/exceptions-64e.S +25 -1
@@ -295,7 +295,8 @@ ret_from_mc_except: andi. r10,r11,MSR_PR; /* save stack pointer */ \ beq 1f; /* branch around if supervisor */ \ ld r1,PACAKSAVE(r13); /* get kernel stack coming from usr */\ -1: cmpdi cr1,r1,0; /* check if SP makes sense */ \ +1: type##_BTB_FLUSH \ + cmpdi cr1,r1,0; /* check if SP makes sense */ \ bge- cr1,exc_##n##_bad_stack;/* bad stack (TODO: out of line) */ \ mfspr r10,SPRN_##type##_SRR0; /* read SRR0 before touching stack */
@@ -327,6 +328,29 @@ ret_from_mc_except: #define SPRN_MC_SRR0 SPRN_MCSRR0 #define SPRN_MC_SRR1 SPRN_MCSRR1 +#ifdef CONFIG_PPC_FSL_BOOK3E +#define GEN_BTB_FLUSH \ + START_BTB_FLUSH_SECTION \ + beq 1f; \ + BTB_FLUSH(r10) \ + 1: \ + END_BTB_FLUSH_SECTION + +#define CRIT_BTB_FLUSH \ + START_BTB_FLUSH_SECTION \ + BTB_FLUSH(r10) \ + END_BTB_FLUSH_SECTION + +#define DBG_BTB_FLUSH CRIT_BTB_FLUSH +#define MC_BTB_FLUSH CRIT_BTB_FLUSH +#define GDBELL_BTB_FLUSH GEN_BTB_FLUSH +#else +#define GEN_BTB_FLUSH +#define CRIT_BTB_FLUSH +#define DBG_BTB_FLUSH +#define GDBELL_BTB_FLUSH +#endif + #define NORMAL_EXCEPTION_PROLOG(n, intnum, addition) \ EXCEPTION_PROLOG(n, intnum, GEN, addition##_GEN(n))
arch/powerpc/mm/tlb_low_64e.S +7 -0
@@ -69,6 +69,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV) std r15,EX_TLB_R15(r12) std r10,EX_TLB_CR(r12) #ifdef CONFIG_PPC_FSL_BOOK3E +START_BTB_FLUSH_SECTION + mfspr r11, SPRN_SRR1 + andi. r10,r11,MSR_PR + beq 1f + BTB_FLUSH(r10) +1: +END_BTB_FLUSH_SECTION std r7,EX_TLB_R7(r12) #endif TLB_MISS_PROLOG_STATS
Greg Kroah-Hartman
maintainerPATCH 49/107 powerpc/fsl: Flush the branch predictor at each kernel entry (32 bit)
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit 7fef436295bf6c05effe682c8797dfcb0deb112a upstream.
In order to protect against speculation attacks on indirect branches, the branch predictor is flushed at kernel entry to protect for the following situations:
- userspace process attacking another userspace process
- userspace process attacking the kernel Basically when the privillege level change (i.e.the kernel is entered), the branch predictor state is flushed.
--- arch/powerpc/kernel/head_booke.h | 6 ++++++ arch/powerpc/kernel/head_fsl_booke.S | 15 +++++++++++++++ 2 files changed, 21 insertions(+)
arch/powerpc/kernel/head_booke.h +6 -0
@@ -43,6 +43,9 @@ andi. r11, r11,MSR_PR ;/* check whether user or kernel */ \mr r11, r1; \ beq 1f; \ +START_BTB_FLUSH_SECTION \ + BTB_FLUSH(r11) \ +END_BTB_FLUSH_SECTION \ /* if from user, start at top of this thread's kernel stack */ \ lwz r11, THREAD_INFO-THREAD(r10); \ALLOC_STACK_FRAME (r11,THREAD_SIZE ); \
@@ -128,6 +131,9 @@stw r9,_CCR (r8 );/* save CR on stack */ \mfspr r11,exc_level_srr1;/* check whether user or kernel */ \ DO_KVM BOOKE_INTERRUPT_##intno exc_level_srr1; \ +START_BTB_FLUSH_SECTION \ + BTB_FLUSH(r10) \ +END_BTB_FLUSH_SECTION \ andi. r11,r11,MSR_PR; \ mfspr r11,SPRN_SPRG_THREAD;/* if from user, start at top of */ \ lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
arch/powerpc/kernel/head_fsl_booke.S +15 -0
@@ -452,6 +452,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV) mfcr r13 stw r13, THREAD_NORMSAVE(3)(r10) DO_KVM BOOKE_INTERRUPT_DTLB_MISS SPRN_SRR1 +START_BTB_FLUSH_SECTION + mfspr r11, SPRN_SRR1 + andi. r10,r11,MSR_PR + beq 1f + BTB_FLUSH(r10) +1: +END_BTB_FLUSH_SECTION mfspr r10, SPRN_DEAR /* Get faulting address */ /* If we are faulting a kernel address, we have to use the
@@ -546,6 +553,14 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV) mfcr r13 stw r13, THREAD_NORMSAVE(3)(r10) DO_KVM BOOKE_INTERRUPT_ITLB_MISS SPRN_SRR1 +START_BTB_FLUSH_SECTION + mfspr r11, SPRN_SRR1 + andi. r10,r11,MSR_PR + beq 1f + BTB_FLUSH(r10) +1: +END_BTB_FLUSH_SECTION + mfspr r10, SPRN_SRR0 /* Get faulting address */ /* If we are faulting a kernel address, we have to use the
Greg Kroah-Hartman
maintainerPATCH 40/107 powerpc/64s: Add support for software count cache flush
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit ee13cb249fabdff8b90aaff61add347749280087 upstream.
Some CPU revisions support a mode where the count cache needs to be flushed by software on context switch. Additionally some revisions may have a hardware accelerated flush, in which case the software flush sequence can be shortened.
If we detect the appropriate flag from firmware we patch a branch into _switch() which takes us to a count cache flush sequence.
That sequence in turn may be patched to return early if we detect that the CPU supports accelerating the flush sequence in hardware.
Add debugfs support for reporting the state of the flush, as well as runtime disabling it.
And modify the spectre_v2 sysfs file to report the state of the software flush.
--- arch/powerpc/include/asm/asm-prototypes.h | 6 + arch/powerpc/include/asm/security_features.h | 1 arch/powerpc/kernel/entry_64.S | 54 ++++++++++++++ arch/powerpc/kernel/security.c | 98 +++++++++++++++++++++++++-- 4 files changed, 154 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/asm-prototypes.h +6 -0
@@ -126,4 +126,10 @@ extern int __ucmpdi2(u64, u64);void _mcount (void );unsigned long prepare_ftrace_return (unsigned long parent,unsigned long ip); +/* Patch sites */ +extern s32 patch__call_flush_count_cache; +extern s32 patch__flush_count_cache_return; + +extern long flush_count_cache; +#endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */
arch/powerpc/include/asm/security_features.h +1 -0
@@ -22,6 +22,7 @@ enum stf_barrier_type {void setup_stf_barrier (void );void do_stf_barrier_fixups (enum stf_barrier_type types); +void setup_count_cache_flush (void );static inline void security_ftr_set (unsigned long feature) {
arch/powerpc/kernel/entry_64.S +54 -0
72 lines not on this page · raw message
arch/powerpc/kernel/security.c +93 -5
126 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 90/107 drm/vgem: fix use-after-free when drm_gem_handle_create() fails
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 21d2b122732318b48c10b7262e15595ce54511d3 upstream.
If drm_gem_handle_create() fails in vgem_gem_create(), then the drm_vgem_gem_object is freed twice: once when the reference is dropped by drm_gem_object_put_unlocked(), and again by __vgem_gem_destroy().
This was hit by syzkaller using fault injection.
Fix it by skipping the second free.
--- drivers/gpu/drm/vgem/vgem_drv.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/vgem/vgem_drv.c +1 -5
@@ -192,13 +192,9 @@ static struct drm_gem_object *vgem_gem_c ret =drm_gem_handle_create (file, &obj->base, handle);drm_gem_object_put_unlocked (&obj->base);if (ret) - goto err; +return ERR_PTR (ret);return &obj->base; - -err: -__vgem_gem_destroy (obj); -return ERR_PTR (ret); } static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
Greg Kroah-Hartman
maintainerPATCH 91/107 gpio: exar: add a check for the return value of ida_simple_get fails
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kangjie Lu <[email protected]>
commit 7ecced0934e574b528a1ba6c237731e682216a74 upstream.
ida_simple_get may fail and return a negative error number. The fix checks its return value; if it fails, go to err_destroy.
--- drivers/gpio/gpio-exar.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpio/gpio-exar.c +2 -0
@@ -148,6 +148,8 @@ static int gpio_exar_probe(struct platfomutex_init (&exar_gpio->lock); index =ida_simple_get (&ida_index,0 ,0 ,GFP_KERNEL ); +if (index <0 ) + goto err_destroy;sprintf (exar_gpio->name,"exar_gpio%d" , index); exar_gpio->gpio_chip.label = exar_gpio->name;
Greg Kroah-Hartman
maintainerPATCH 93/107 phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 1396929e8a903db80425343cacca766a18ad6409 upstream.
While only the first PHY supports mode switching, the remaining PHYs work in USB host mode. They should support set_mode with mode=USB_HOST instead of failing. This is especially needed now that the USB core does set_mode for all USB ports, which was added in commit b97a31348379 ("usb:
core: comply to PHY framework").
Make set_mode with mode=USB_HOST a no-op instead of failing for the non-OTG USB PHYs.
--- drivers/phy/allwinner/phy-sun4i-usb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/phy/allwinner/phy-sun4i-usb.c +4 -1
@@ -480,8 +480,11 @@ static int sun4i_usb_phy_set_mode(structstruct sun4i_usb_phy_data *data =to_sun4i_usb_phy_data (phy);int new_mode; -if (phy->index !=0 ) +if (phy->index !=0 ) { +if (mode ==PHY_MODE_USB_HOST ) +return 0 ;return -EINVAL ; + }switch (mode) {case PHY_MODE_USB_HOST :
Greg Kroah-Hartman
maintainerPATCH 92/107 gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit c5bc6e526d3f217ed2cc3681d256dc4a2af4cc2b upstream.
Current code test wrong value so it does not verify if the written data is correctly read back. Fix it.
Also make it return -EPERM if read value does not match written bit, just like it done for adnp_gpio_direction_output().
--- drivers/gpio/gpio-adnp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpio/gpio-adnp.c +4 -2
@@ -132,8 +132,10 @@ static int adnp_gpio_direction_input(strif (err <0 ) goto out; -if (err &BIT (pos)) - err = -EACCES ; +if (value &BIT (pos)) { + err = -EPERM ; + goto out; + } err =0 ;
Greg Kroah-Hartman
maintainerPATCH 95/107 USB: gadget: f_hid: fix deadlock in f_hidg_write()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radoslav Gerganov <[email protected]>
commit 072684e8c58d17e853f8e8b9f6d9ce2e58d2b036 upstream.
In f_hidg_write() the write_spinlock is acquired before calling usb_ep_queue() which causes a deadlock when dummy_hcd is being used. This is because dummy_queue() callbacks into f_hidg_req_complete() which tries to acquire the same spinlock. This is (part of) the backtrace when the deadlock occurs:
0xffffffffc06b1410 in f_hidg_req_complete 0xffffffffc06a590a in usb_gadget_giveback_request 0xffffffffc06cfff2 in dummy_queue 0xffffffffc06a4b96 in usb_ep_queue 0xffffffffc06b1eb6 in f_hidg_write 0xffffffff8127730b in __vfs_write 0xffffffff812774d1 in vfs_write 0xffffffff81277725 in SYSC_write
Fix this by releasing the write_spinlock before calling usb_ep_queue()
--- drivers/usb/gadget/function/f_hid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/gadget/function/f_hid.c +3 -3
@@ -395,20 +395,20 @@ try_again: req->complete = f_hidg_req_complete; req->context = hidg; +spin_unlock_irqrestore (&hidg->write_spinlock, flags); + status =usb_ep_queue (hidg->in_ep, req,GFP_ATOMIC );if (status <0 ) {ERROR (hidg->func.config->cdev,"usb_ep_queue error on int endpoint %zd\n" , status); - goto release_write_pending_unlocked; + goto release_write_pending; }else { status = count; } -spin_unlock_irqrestore (&hidg->write_spinlock, flags);return status; release_write_pending:spin_lock_irqsave (&hidg->write_spinlock, flags); -release_write_pending_unlocked: hidg->write_pending =0 ;spin_unlock_irqrestore (&hidg->write_spinlock, flags);
Greg Kroah-Hartman
maintainerPATCH 96/107 usb: common: Consider only available nodes for dr_mode
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabrizio Castro <[email protected]>
commit 238e0268c82789e4c107a37045d529a6dbce51a9 upstream.
There are cases where multiple device tree nodes point to the same phy node by means of the "phys" property, but we should only consider those nodes that are marked as available rather than just any node.
--- drivers/usb/common/common.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/common/common.c +2 -0
@@ -148,6 +148,8 @@ enum usb_dr_mode of_usb_get_dr_mode_by_p do { controller = of_find_node_with_property(controller, "phys"); + if (!of_device_is_available(controller)) + continue; index = 0; do { if (arg0 == -1) {
Greg Kroah-Hartman
maintainerPATCH 97/107 usb: host: xhci-rcar: Add XHCI_TRUST_TX_LENGTH quirk
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yasushi Asano <[email protected]>
commit 40fc165304f0faaae78b761f8ee30b5d216b1850 upstream.
When plugging BUFFALO LUA4-U3-AGT USB3.0 to Gigabit Ethernet LAN Adapter, warning messages filled up dmesg.
[ 101.098287] xhci-hcd ee000000.usb: WARN Successful completion on short TX for slot 1 ep 4: needs XHCI_TRUST_TX_LENGTH quirk? [ 101.117463] xhci-hcd ee000000.usb: WARN Successful completion on short TX for slot 1 ep 4: needs XHCI_TRUST_TX_LENGTH quirk? [ 101.136513] xhci-hcd ee000000.usb: WARN Successful completion on short TX for slot 1 ep 4: needs XHCI_TRUST_TX_LENGTH quirk?
Adding the XHCI_TRUST_TX_LENGTH quirk resolves the issue.
--- drivers/usb/host/xhci-rcar.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/xhci-rcar.c +1 -0
@@ -236,6 +236,7 @@ int xhci_rcar_init_quirk(struct usb_hcd xhci_rcar_is_gen3(hcd->self.controller)) xhci->quirks |= XHCI_NO_64BIT_SUPPORT; + xhci->quirks |=XHCI_TRUST_TX_LENGTH ;return xhci_rcar_download_firmware (hcd); }
Greg Kroah-Hartman
maintainerPATCH 98/107 xhci: Fix port resume done detection for SS ports with LPM enabled
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit 6cbcf596934c8e16d6288c7cc62dfb7ad8eadf15 upstream.
A suspended SS port in U3 link state will go to U0 when resumed, but can almost immediately after that enter U1 or U2 link power save states before host controller driver reads the port status.
Host controller driver only checks for U0 state, and might miss the finished resume, leaving flags unclear and skip notifying usb code of the wake.
Add U1 and U2 to the possible link states when checking for finished port resume.
--- drivers/usb/host/xhci-ring.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-ring.c +6 -3
@@ -1715,10 +1715,13 @@ static void handle_port_status(struct xh } } -if ((portsc &PORT_PLC ) && (portsc &PORT_PLS_MASK ) ==XDEV_U0 && -DEV_SUPERSPEED_ANY (portsc)) { +if ((portsc &PORT_PLC ) && +DEV_SUPERSPEED_ANY (portsc) && + ((portsc &PORT_PLS_MASK ) ==XDEV_U0 || + (portsc &PORT_PLS_MASK ) ==XDEV_U1 || + (portsc &PORT_PLS_MASK ) ==XDEV_U2 )) {xhci_dbg (xhci,"resume SS port %d finished\n" , port_id); -/* We've just brought the device into U0 through either the +/* We've just brought the device into U0/1/2 through either the * Resume state after a device remote wakeup, or through the * U3Exit state after a host-initiated resume. If it's a device * initiated remote wake, don't pass up the link state change,
Greg Kroah-Hartman
maintainerPATCH 99/107 usb: cdc-acm: fix race during wakeup blocking TX traffic
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Romain Izard <[email protected]>
commit 93e1c8a638308980309e009cc40b5a57ef87caf1 upstream.
When the kernel is compiled with preemption enabled, the URB completion handler can run in parallel with the work responsible for waking up the tty layer. If the URB handler sets the EVENT_TTY_WAKEUP bit during the call to tty_port_tty_wakeup() to signal that there is room for additional input, it will be cleared at the end of this call. As a result, TX traffic on the upper layer will be blocked.
This can be seen with a kernel configured with CONFIG_PREEMPT, and a fast modem connected with PPP running over a USB CDC-ACM port.
Use test_and_clear_bit() instead, which ensures that each wakeup requested by the URB completion code will trigger a call to tty_port_tty_wakeup().
--- drivers/usb/class/cdc-acm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/class/cdc-acm.c +1 -3
@@ -570,10 +570,8 @@ static void acm_softint(struct work_struclear_bit (EVENT_RX_STALL , &acm->flags); } -if (test_bit (EVENT_TTY_WAKEUP , &acm->flags)) { +if (test_and_clear_bit (EVENT_TTY_WAKEUP , &acm->flags))tty_port_tty_wakeup (&acm->port); -clear_bit (EVENT_TTY_WAKEUP , &acm->flags); - } }/*
Greg Kroah-Hartman
maintainerPATCH 82/107 USB: serial: cp210x: add new device id
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit a595ecdd5f60b2d93863cebb07eec7f935839b54 upstream.
Lorenz Messtechnik has a device that is controlled by the cp210x driver, so add the device id to the driver. The device id was provided by Silicon-Labs for the devices from this vendor.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -83,6 +83,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x804E) }, /* Software Bisque Paramount ME build-in converter */ { USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */ { USB_DEVICE(0x10C4, 0x8054) }, /* Enfora GSM2228 */ + { USB_DEVICE(0x10C4, 0x8056) }, /* Lorenz Messtechnik devices */ { USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */ { USB_DEVICE(0x10C4, 0x806F) }, /* IMS USB to RS422 Converter Cable */ { USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */
Greg Kroah-Hartman
maintainerPATCH 100/107 mm/migrate.c: add missing flush_dcache_page for non-mapped page migrate
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars Persson <[email protected]>
commit d2b2c6dd227ba5b8a802858748ec9a780cb75b47 upstream.
Our MIPS 1004Kc SoCs were seeing random userspace crashes with SIGILL and SIGSEGV that could not be traced back to a userspace code bug. They had all the magic signs of an I/D cache coherency issue.
Now recently we noticed that the /proc/sys/vm/compact_memory interface was quite efficient at provoking this class of userspace crashes.
Studying the code in mm/migrate.c there is a distinction made between migrating a page that is mapped at the instant of migration and one that is not mapped. Our problem turned out to be the non-mapped pages.
For the non-mapped page the code performs a copy of the page content and all relevant meta-data of the page without doing the required D-cache maintenance. This leaves dirty data in the D-cache of the CPU and on the 1004K cores this data is not visible to the I-cache. A subsequent page-fault that triggers a mapping of the page will happily serve the process with potentially stale code.
What about ARM then, this bug should have seen greater exposure? Well ARM became immune to this flaw back in 2010, see commit c01778001a4f ("ARM: 6379/1: Assume new page cache pages have dirty D-cache").
My proposed fix moves the D-cache maintenance inside move_to_new_page to make it common for both cases.
--- mm/migrate.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
mm/migrate.c +8 -3
@@ -247,10 +247,8 @@ static bool remove_migration_pte(struct pte =swp_entry_to_pte (entry); }else if (is_device_public_page (new)) { pte =pte_mkdevmap (pte); -flush_dcache_page (new); } - }else -flush_dcache_page (new); + }#ifdef CONFIG_HUGETLB_PAGE if (PageHuge (new)) {
@@ -971,6 +969,13 @@ static int move_to_new_page(struct page*/ if (!PageMappingFlags (page)) page->mapping =NULL ; + +if (unlikely (is_zone_device_page (newpage))) { +if (is_device_public_page (newpage)) +flush_dcache_page (newpage); + }else +flush_dcache_page (newpage); + } out:return rc;
Greg Kroah-Hartman
maintainerPATCH 101/107 perf intel-pt: Fix TSC slip
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit f3b4e06b3bda759afd042d3d5fa86bea8f1fe278 upstream.
A TSC packet can slip past MTC packets so that the timestamp appears to go backwards. One estimate is that can be up to about 40 CPU cycles, which is certainly less than 0x1000 TSC ticks, but accept slippage an order of magnitude more to be on the safe side.
--- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +8 -12
@@ -251,19 +251,15 @@ struct intel_pt_decoder *intel_pt_decodeif (!(decoder->tsc_ctc_ratio_n % decoder->tsc_ctc_ratio_d)) decoder->tsc_ctc_mult = decoder->tsc_ctc_ratio_n / decoder->tsc_ctc_ratio_d; - -/* -* Allow for timestamps appearing to backwards because a TSC -* packet has slipped past a MTC packet, so allow 2 MTC ticks -* or ... -*/ - decoder->tsc_slip =multdiv (2 << decoder->mtc_shift, - decoder->tsc_ctc_ratio_n, - decoder->tsc_ctc_ratio_d); } -/* ... or 0x100 paranoia */ -if (decoder->tsc_slip <0x100 ) - decoder->tsc_slip =0x100 ; + +/* +* A TSC packet can slip past MTC packets so that the timestamp appears +* to go backwards. One estimate is that can be up to about 40 CPU +* cycles, which is certainly less than 0x1000 TSC ticks, but accept +* slippage an order of magnitude more to be on the safe side. +*/ + decoder->tsc_slip =0x10000 ;intel_pt_log ("timestamp: mtc_shift %u\n" , decoder->mtc_shift);intel_pt_log ("timestamp: tsc_ctc_ratio_n %u\n" , decoder->tsc_ctc_ratio_n);
Greg Kroah-Hartman
maintainerPATCH 102/107 cpu/hotplug: Prevent crash when CPU bringup fails on CONFIG_HOTPLUG_CPU=n
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 206b92353c839c0b27a0b9bec24195f93fd6cf7a upstream.
Tianyu reported a crash in a CPU hotplug teardown callback when booting a kernel which has CONFIG_HOTPLUG_CPU disabled with the 'nosmt' boot parameter.
It turns out that the SMP=y CONFIG_HOTPLUG_CPU=n case has been broken forever in case that a bringup callback fails. Unfortunately this issue was not recognized when the CPU hotplug code was reworked, so the shortcoming just stayed in place.
When a bringup callback fails, the CPU hotplug code rolls back the operation and takes the CPU offline.
The 'nosmt' command line argument uses a bringup failure to abort the bringup of SMT sibling CPUs. This partial bringup is required due to the MCE misdesign on Intel CPUs.
With CONFIG_HOTPLUG_CPU=y the rollback works perfectly fine, but CONFIG_HOTPLUG_CPU=n lacks essential mechanisms to exercise the low level teardown of a CPU including the synchronizations in various facilities like RCU, NOHZ and others.
As a consequence the teardown callbacks which must be executed on the outgoing CPU within stop machine with interrupts disabled are executed on the control CPU in interrupt enabled and preemptible context causing the kernel to crash and burn. The pre state machine code has a different failure mode which is more subtle and resulting in a less obvious use after free crash because the control side frees resources which are still in use by the undead CPU.
But this is not a x86 only problem. Any architecture which supports the SMP=y HOTPLUG_CPU=n combination suffers from the same issue. It's just less likely to be triggered because in 99.99999% of the cases all bringup callbacks succeed.
The easy solution of making HOTPLUG_CPU mandatory for SMP is not working on all architectures as the following architectures have either no hotplug support at all or not all subarchitectures support it:
alpha, arc, hexagon, openrisc, riscv, sparc (32bit), mips (partial).
Crashing the kernel in such a situation is not an acceptable state either.
Implement a minimal rollback variant by limiting the teardown to the point where all regular teardown callbacks have been invoked and leave the CPU in the 'dead' idle state. This has the following consequences:
- the CPU is brought down to the point where the stop_machine takedown would happen.
- the CPU stays there forever and is idle
- The CPU is cleared in the CPU active mask, but not in the CPU online mask which is a legit state.
- Interrupts are not forced away from the CPU
- All facilities which only look at online mask would still see it, but that is the case during normal hotplug/unplug operations as well. It's just a (way) longer time frame.
This will expose issues, which haven't been exposed before or only seldom, because now the normally transient state of being non active but online is a permanent state. In testing this exposed already an issue vs. work queues where the vmstat code schedules work on the almost dead CPU which ends up in an unbound workqueue and triggers 'preemtible context' warnings. This is not a problem of this change, it merily exposes an already existing issue. Still this is better than crashing fully without a chance to debug it.
This is mainly thought as workaround for those architectures which do not support HOTPLUG_CPU. All others should enforce HOTPLUG_CPU for SMP.
--- kernel/cpu.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
kernel/cpu.c +18 -2
@@ -538,6 +538,20 @@ static void undo_cpu_up(unsigned int cpu } } +static inline bool can_rollback_cpu (struct cpuhp_cpu_state *st) +{ +if (IS_ENABLED (CONFIG_HOTPLUG_CPU )) +return true; +/* +* When CPU hotplug is disabled, then taking the CPU down is not +* possible because takedown_cpu() and the architecture and +* subsystem specific mechanisms are not available. So the CPU +* which would be completely unplugged again needs to stay around +* in the current state. +*/ +return st->state <=CPUHP_BRINGUP_CPU ; +} +static int cpuhp_up_callbacks (unsigned int cpu,struct cpuhp_cpu_state *st,enum cpuhp_state target) {
@@ -548,8 +562,10 @@ static int cpuhp_up_callbacks(unsigned i st->state++; ret =cpuhp_invoke_callback (cpu, st->state, true,NULL ,NULL );if (ret) { - st->target = prev_state; -undo_cpu_up (cpu, st); +if (can_rollback_cpu (st)) { + st->target = prev_state; +undo_cpu_up (cpu, st); + }break ; } }
Greg Kroah-Hartman
maintainerPATCH 103/107 x86/smp: Enforce CONFIG_HOTPLUG_CPU when SMP=y
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit bebd024e4815b1a170fcd21ead9c2222b23ce9e6 upstream.
The SMT disable 'nosmt' command line argument is not working properly when CONFIG_HOTPLUG_CPU is disabled. The teardown of the sibling CPUs which are required to be brought up due to the MCE issues, cannot work. The CPUs are then kept in a half dead state.
As the 'nosmt' functionality has become popular due to the speculative hardware vulnerabilities, the half torn down state is not a proper solution to the problem.
Enforce CONFIG_HOTPLUG_CPU=y when SMP is enabled so the full operation is possible.
--- arch/x86/Kconfig | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
arch/x86/Kconfig +1 -7
@@ -2139,14 +2139,8 @@ config RANDOMIZE_MEMORY_PHYSICAL_PADDING If unsure, leave at the default value. config HOTPLUG_CPU - bool "Support for hot-pluggable CPUs" + def_bool y depends on SMP - ---help--- - Say Y here to allow turning CPUs off and on. CPUs can be - controlled through /sys/devices/system/cpu. - ( Note: power management support will enable this option - automatically on SMP systems. ) - Say N if you want to disable CPU hotplug. config BOOTPARAM_HOTPLUG_CPU0 bool "Set default setting of cpu0_hotpluggable"
Greg Kroah-Hartman
maintainerPATCH 104/107 KVM: Reject device ioctls from processes other than the VMs creator
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit ddba91801aeb5c160b660caed1800eb3aef403f8 upstream.
KVM's API requires thats ioctls must be issued from the same process that created the VM. In other words, userspace can play games with a VM's file descriptors, e.g. fork(), SCM_RIGHTS, etc..., but only the creator can do anything useful. Explicitly reject device ioctls that are issued by a process other than the VM's creator, and update KVM's API documentation to extend its requirements to device ioctls.
--- Documentation/virtual/kvm/api.txt | 16 +++++++++++----- virt/kvm/kvm_main.c | 3 +++ 2 files changed, 14 insertions(+), 5 deletions(-)
Documentation/virtual/kvm/api.txt +11 -5
@@ -13,7 +13,7 @@ of a virtual machine. The ioctls belong - VM ioctls: These query and set attributes that affect an entire virtual machine, for example memory layout. In addition a VM ioctl is used to - create virtual cpus (vcpus). + create virtual cpus (vcpus) and devices. Only run VM ioctls from the same process (address space) that was used to create the VM.
@@ -24,6 +24,11 @@ of a virtual machine. The ioctls belong Only run vcpu ioctls from the same thread that was used to create the vcpu. + - device ioctls: These query and set attributes that control the operation + of a single device. + + device ioctls must be issued from the same process (address space) that + was used to create the VM. 2. File descriptors -------------------
@@ -32,10 +37,11 @@ The kvm API is centered around file desc open("/dev/kvm") obtains a handle to the kvm subsystem; this handle can be used to issue system ioctls. A KVM_CREATE_VM ioctl on this handle will create a VM file descriptor which can be used to issue VM -ioctls. A KVM_CREATE_VCPU ioctl on a VM fd will create a virtual cpu -and return a file descriptor pointing to it. Finally, ioctls on a vcpu -fd can be used to control the vcpu, including the important task of -actually running guest code. +ioctls. A KVM_CREATE_VCPU or KVM_CREATE_DEVICE ioctl on a VM fd will +create a virtual cpu or device and return a file descriptor pointing to +the new resource. Finally, ioctls on a vcpu or device fd can be used +to control the vcpu or device. For vcpus, this includes the important +task of actually running guest code. In general file descriptors can be migrated among processes by means of fork() and the SCM_RIGHTS facility of unix domain socket. These
virt/kvm/kvm_main.c +3 -0
@@ -2812,6 +2812,9 @@ static long kvm_device_ioctl(struct file {struct kvm_device *dev = filp->private_data; +if (dev->kvm->mm != current->mm) +return -EIO ; +switch (ioctl) {case KVM_SET_DEVICE_ATTR :return kvm_device_ioctl_attr (dev, dev->ops->set_attr, arg);
Greg Kroah-Hartman
maintainerPATCH 106/107 Revert "USB: core: only clean up what we allocated"
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit cf4df407e0d7cde60a45369c2a3414d18e2d4fdd upstream.
This reverts commit 32fd87b3bbf5f7a045546401dfe2894dbbf4d8c3.
Alan wrote a better fix for this...
--- drivers/usb/core/config.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/usb/core/config.c +3 -6
@@ -768,21 +768,18 @@ void usb_destroy_configuration(struct usreturn ;if (dev->rawdescriptors) { -for (i =0 ; i < dev->descriptor.bNumConfigurations && - i <USB_MAXCONFIG ; i++) +for (i =0 ; i < dev->descriptor.bNumConfigurations; i++)kfree (dev->rawdescriptors[i]);kfree (dev->rawdescriptors); dev->rawdescriptors =NULL ; } -for (c =0 ; c < dev->descriptor.bNumConfigurations && - c <USB_MAXCONFIG ; c++) { +for (c =0 ; c < dev->descriptor.bNumConfigurations; c++) {struct usb_host_config *cf = &dev->config[c];kfree (cf->string); -for (i =0 ; i < cf->desc.bNumInterfaces && - i <USB_MAXINTERFACES ; i++) { +for (i =0 ; i < cf->desc.bNumInterfaces; i++) {if (cf->intf_cache[i])kref_put (&cf->intf_cache[i]->ref, usb_release_interface_cache);
Greg Kroah-Hartman
maintainerPATCH 107/107 vfio: ccw: only free cp on final interrupt
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cornelia Huck <[email protected]>
commit 50b7f1b7236bab08ebbbecf90521e84b068d7a17 upstream.
When we get an interrupt for a channel program, it is not necessarily the final interrupt; for example, the issuing guest may request an intermediate interrupt by specifying the program-controlled-interrupt flag on a ccw.
We must not switch the state to idle if the interrupt is not yet final; even more importantly, we must not free the translated channel program if the interrupt is not yet final, or the host can crash during cp rewind.
--- drivers/s390/cio/vfio_ccw_drv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/s390/cio/vfio_ccw_drv.c +6 -2
@@ -70,20 +70,24 @@ static void vfio_ccw_sch_io_todo(struct {struct vfio_ccw_private *private;struct irb *irb; +bool is_final; private = container_of(work, struct vfio_ccw_private, io_work); irb = &private->irb; + is_final = !(scsw_actl (&irb->scsw) & + (SCSW_ACTL_DEVACT |SCSW_ACTL_SCHACT ));if (scsw_is_solicited (&irb->scsw)) {cp_update_scsw (&private->cp, &irb->scsw); -cp_free (&private->cp); +if (is_final) +cp_free (&private->cp); }memcpy (private->io_region.irb_area, irb,sizeof (*irb));if (private->io_trigger)eventfd_signal (private->io_trigger,1 ); -if (private->mdev) +if (private->mdev && is_final) private->state =VFIO_CCW_STATE_IDLE ; }
Greg Kroah-Hartman
maintainerPATCH 83/107 USB: serial: ftdi_sio: add additional NovaTech products
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: George McCollister <[email protected]>
commit 422c2537ba9d42320f8ab6573940269f87095320 upstream.
Add PIDs for the NovaTech OrionLX+ and Orion I/O so they can be automatically detected.
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -604,6 +604,8 @@ static const struct usb_device_id id_tab .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, + { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLX_PLUS_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_NT_ORION_IO_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) }, { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) },
drivers/usb/serial/ftdi_sio_ids.h +3 -1
@@ -567,7 +567,9 @@/* * NovaTech product ids (FTDI_VID) */ -#define FTDI_NT_ORIONLXM_PID 0x7c90/* OrionLXm Substation Automation Platform */ +#define FTDI_NT_ORIONLXM_PID 0x7c90/* OrionLXm Substation Automation Platform */ +#define FTDI_NT_ORIONLX_PLUS_PID 0x7c91/* OrionLX+ Substation Automation Platform */ +#define FTDI_NT_ORION_IO_PID 0x7c92/* Orion I/O */ /* * Synapse Wireless product ids (FTDI_VID)
Greg Kroah-Hartman
maintainerPATCH 85/107 USB: serial: option: set driver_info for SIM5218 and compatibles
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mans Rullgard <[email protected]>
commit f8df5c2c3e2df5ffaf9fb5503da93d477a8c7db4 upstream.
The SIMCom SIM5218 and compatible devices have 5 USB interfaces, only 4 of which are serial ports. The fifth is a network interface supported by the qmi-wwan driver. Furthermore, the serial ports do not support modem control signals. Add driver_info flags to reflect this.
--- drivers/usb/serial/option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/serial/option.c +2 -1
@@ -1069,7 +1069,8 @@ static const struct usb_device_id option .driver_info = RSVD(3) }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000), /* SIMCom SIM5218 */ + .driver_info = NCTRL(0) | NCTRL(1) | NCTRL(2) | NCTRL(3) | RSVD(4) },/* Quectel products using Qualcomm vendor ID */ { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)}, { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20),
Greg Kroah-Hartman
maintainerPATCH 86/107 USB: serial: option: add support for Quectel EM12
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kristian Evensen <[email protected]>
commit d1252f0237238b912c3e7a51bf237acf34c97983 upstream.
The Quectel EM12 is a Cat. 12 LTE modem. It behaves in the exactly the same way as the EP06 (including the dynamic configuration behavior), so the same checks on reserved interfaces, etc. are needed.
--- drivers/usb/serial/option.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/option.c +4 -0
@@ -249,6 +249,7 @@ static void option_instat_callback(struc#define QUECTEL_PRODUCT_EC25 0x0125#define QUECTEL_PRODUCT_BG96 0x0296#define QUECTEL_PRODUCT_EP06 0x0306 +#define QUECTEL_PRODUCT_EM12 0x0512#define CMOTECH_VENDOR_ID 0x16d8#define CMOTECH_PRODUCT_6001 0x6001
@@ -1091,6 +1092,9 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff), + .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
Greg Kroah-Hartman
maintainerPATCH 87/107 USB: serial: option: add Olicard 600
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 84f3b43f7378b98b7e3096d5499de75183d4347c upstream.
This is a Qualcomm based device with a QMI function on interface 4. It is mode switched from 2020:2030 using a standard eject message.
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=2020 ProdID=2031 Rev= 2.32 S: Manufacturer=Mobile Connect S: Product=Mobile Connect S: SerialNumber=0123456789ABCDEF C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
--- drivers/usb/serial/option.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/usb/serial/option.c +6 -4
@@ -1947,10 +1947,12 @@ static const struct usb_device_id option .driver_info = RSVD(4) }, { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e35, 0xff), /* D-Link DWM-222 */ .driver_info = RSVD(4) }, - { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ - { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ - { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */ - { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */ + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2031, 0xff), /* Olicard 600 */ + .driver_info = RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD200, 0xff, 0xff, 0xff) },
Greg Kroah-Hartman
maintainerPATCH 89/107 fs/proc/proc_sysctl.c: fix NULL pointer dereference in put_links
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: YueHaibing <[email protected]>
commit 23da9588037ecdd4901db76a5b79a42b529c4ec3 upstream.
Syzkaller reports:
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN PTI CPU: 1 PID: 5373 Comm: syz-executor.0 Not tainted 5.0.0-rc8+ #3 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 RIP: 0010:put_links+0x101/0x440 fs/proc/proc_sysctl.c:1599 Code: 00 0f 85 3a 03 00 00 48 8b 43 38 48 89 44 24 20 48 83 c0 38 48 89 c2 48 89 44 24 28 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 fe 02 00 00 48 8b 74 24 20 48 c7 c7 60 2a 9d 91 RSP: 0018:ffff8881d828f238 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: ffff8881e01b1140 RCX: ffffffff8ee98267 RDX: 0000000000000007 RSI: ffffc90001479000 RDI: ffff8881e01b1178 RBP: dffffc0000000000 R08: ffffed103ee27259 R09: ffffed103ee27259 R10: 0000000000000001 R11: ffffed103ee27258 R12: fffffffffffffff4 R13: 0000000000000006 R14: ffff8881f59838c0 R15: dffffc0000000000 FS: 00007f072254f700(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fff8b286668 CR3: 00000001f0542002 CR4: 00000000007606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: drop_sysctl_table+0x152/0x9f0 fs/proc/proc_sysctl.c:1629 get_subdir fs/proc/proc_sysctl.c:1022 [inline] __register_sysctl_table+0xd65/0x1090 fs/proc/proc_sysctl.c:1335 br_netfilter_init+0xbc/0x1000 [br_netfilter] do_one_initcall+0xfa/0x5ca init/main.c:887 do_init_module+0x204/0x5f6 kernel/module.c:3460 load_module+0x66b2/0x8570 kernel/module.c:3808 __do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902 do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x462e99 Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f072254ec58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99 RDX: 0000000000000000 RSI: 0000000020000280 RDI: 0000000000000003 RBP: 00007f072254ec70 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f072254f6bc R13: 00000000004bcefa R14: 00000000006f6fb0 R15: 0000000000000004 Modules linked in: br_netfilter(+) dvb_usb_dibusb_mc_common dib3000mc dibx000_common dvb_usb_dibusb_common dvb_usb_dw2102 dvb_usb classmate_laptop palmas_regulator cn videobuf2_v4l2 v4l2_common snd_soc_bd28623 mptbase snd_usb_usx2y snd_usbmidi_lib snd_rawmidi wmi libnvdimm lockd sunrpc grace rc_kworld_pc150u rc_core rtc_da9063 sha1_ssse3 i2c_cros_ec_tunnel adxl34x_spi adxl34x nfnetlink lib80211 i5500_temp dvb_as102 dvb_core videobuf2_common videodev media videobuf2_vmalloc videobuf2_memops udc_core lnbp22 leds_lp3952 hid_roccat_ryos s1d13xxxfb mtd vport_geneve openvswitch nf_conncount nf_nat_ipv6 nsh geneve udp_tunnel ip6_udp_tunnel snd_soc_mt6351 sis_agp phylink snd_soc_adau1761_spi snd_soc_adau1761 snd_soc_adau17x1 snd_soc_core snd_pcm_dmaengine ac97_bus snd_compress snd_soc_adau_utils snd_soc_sigmadsp_regmap snd_soc_sigmadsp raid_class hid_roccat_konepure hid_roccat_common hid_roccat c2port_duramar2150 core mdio_bcm_unimac iptable_security iptable_raw iptable_mangle iptable_nat nf_nat_ipv4 nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter bpfilter ip6_vti ip_vti ip_gre ipip sit tunnel4 ip_tunnel hsr veth netdevsim devlink vxcan batman_adv cfg80211 rfkill chnl_net caif nlmon dummy team bonding vcan bridge stp llc ip6_gre gre ip6_tunnel tunnel6 tun crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel joydev mousedev ide_pci_generic piix aesni_intel aes_x86_64 ide_core crypto_simd atkbd cryptd glue_helper serio_raw ata_generic pata_acpi i2c_piix4 floppy sch_fq_codel ip_tables x_tables ipv6 [last unloaded: lm73] Dumping ftrace buffer: (ftrace buffer empty) ---[ end trace 770020de38961fd0 ]---
A new dir entry can be created in get_subdir and its 'header->parent' is set to NULL. Only after insert_header success, it will be set to 'dir', otherwise 'header->parent' is set to NULL and drop_sysctl_table is called. However in err handling path of get_subdir, drop_sysctl_table also be called on 'new->header' regardless its value of parent pointer. Then put_links is called, which triggers NULL-ptr deref when access member of header->parent.
In fact we have multiple error paths which call drop_sysctl_table() there, upon failure on insert_links() we also call drop_sysctl_table().And even in the successful case on __register_sysctl_table() we still always call drop_sysctl_table().This patch fix it.
--- fs/proc/proc_sysctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/proc_sysctl.c +2 -1
@@ -1620,7 +1620,8 @@ static void drop_sysctl_table(struct ctlif (--header->nreg)return ; -put_links (header); +if (parent) +put_links (header);start_unregistering (header);if (!--header->count)kfree_rcu (header, rcu);
Greg Kroah-Hartman
maintainerPATCH 80/107 serial: max310x: Fix to avoid potential NULL pointer dereference
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aditya Pakki <[email protected]>
commit 3a10e3dd52e80b9a97a3346020024d17b2c272d6 upstream.
of_match_device can return a NULL pointer when matching device is not found. This patch avoids a scenario causing NULL pointer derefernce.
--- drivers/tty/serial/max310x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/max310x.c +2 -0
@@ -1323,6 +1323,8 @@ static int max310x_spi_probe(struct spi_if (spi->dev.of_node) {const struct of_device_id *of_id =of_match_device (max310x_dt_ids, &spi->dev); +if (!of_id) +return -ENODEV ; devtype = (struct max310x_devtype *)of_id->data; }else {
Greg Kroah-Hartman
maintainerPATCH 88/107 Disable kgdboc failed by echo space to /sys/module/kgdboc/parameters/kgdboc
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Wang <[email protected]>
commit 3ec8002951ea173e24b466df1ea98c56b7920e63 upstream.
Echo "" to /sys/module/kgdboc/parameters/kgdboc will fail with "No such device” error.
This is caused by function "configure_kgdboc" who init err to ENODEV when the config is empty (legal input) the code go out with ENODEV returned.
--- drivers/tty/serial/kgdboc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/serial/kgdboc.c +3 -1
@@ -148,8 +148,10 @@ static int configure_kgdboc(void)char *cptr = config;struct console *cons; -if (!strlen (config) ||isspace (config[0 ])) +if (!strlen (config) ||isspace (config[0 ])) { + err =0 ; goto noconfig; + } kgdboc_io_ops.is_console =0 ; kgdb_tty_driver =NULL ;
Greg Kroah-Hartman
maintainerPATCH 84/107 USB: serial: mos7720: fix mos_parport refcount imbalance on error path
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Yi <[email protected]>
commit 2908b076f5198d231de62713cb2b633a3a4b95ac upstream.
The write_parport_reg_nonblock() helper takes a reference to the struct mos_parport, but failed to release it in a couple of error paths after allocation failures, leading to a memory leak.
Johan said that move the kref_get() and mos_parport assignment to the end of urbtrack initialisation is a better way, so move it. and mos_parport do not used until urbtrack initialisation.
--- drivers/usb/serial/mos7720.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/serial/mos7720.c +2 -2
@@ -368,8 +368,6 @@ static int write_parport_reg_nonblock(stif (!urbtrack)return -ENOMEM ; -kref_get (&mos_parport->ref_count); - urbtrack->mos_parport = mos_parport; urbtrack->urb =usb_alloc_urb (0 ,GFP_ATOMIC );if (!urbtrack->urb) {kfree (urbtrack);
@@ -390,6 +388,8 @@ static int write_parport_reg_nonblock(stusb_sndctrlpipe (usbdev,0 ), (unsigned char *)urbtrack->setup, NULL, 0, async_complete, urbtrack); +kref_get (&mos_parport->ref_count); + urbtrack->mos_parport = mos_parport;kref_init (&urbtrack->ref_count);INIT_LIST_HEAD (&urbtrack->urblist_entry);
Greg Kroah-Hartman
maintainerPATCH 105/107 KVM: x86: Emulate MSR_IA32_ARCH_CAPABILITIES on AMD hosts
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 0cf9135b773bf32fba9dd8e6699c1b331ee4b749 upstream.
The CPUID flag ARCH_CAPABILITIES is unconditioinally exposed to host userspace for all x86 hosts, i.e. KVM advertises ARCH_CAPABILITIES regardless of hardware support under the pretense that KVM fully emulates MSR_IA32_ARCH_CAPABILITIES. Unfortunately, only VMX hosts handle accesses to MSR_IA32_ARCH_CAPABILITIES (despite KVM_GET_MSRS also reporting MSR_IA32_ARCH_CAPABILITIES for all hosts).
Move the MSR_IA32_ARCH_CAPABILITIES handling to common x86 code so that it's emulated on AMD hosts.
--- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx.c | 14 -------------- arch/x86/kvm/x86.c | 12 ++++++++++++ 3 files changed, 13 insertions(+), 14 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -0
@@ -509,6 +509,7 @@ struct kvm_vcpu_arch {bool tpr_access_reporting;u64 ia32_xss;u64 microcode_version; +u64 arch_capabilities;/* * Paging state of the vcpu
arch/x86/kvm/vmx.c +0 -14
@@ -740,7 +740,6 @@ struct vcpu_vmx {u64 msr_guest_kernel_gs_base;#endif -u64 arch_capabilities;u64 spec_ctrl;u32 vm_entry_controls_shadow;
@@ -3493,12 +3492,6 @@ static int vmx_get_msr(struct kvm_vcpu * msr_info->data =to_vmx (vcpu)->spec_ctrl;break ; -case MSR_IA32_ARCH_CAPABILITIES : -if (!msr_info->host_initiated && - !guest_cpuid_has (vcpu,X86_FEATURE_ARCH_CAPABILITIES )) -return 1 ; - msr_info->data =to_vmx (vcpu)->arch_capabilities; -break ;case MSR_IA32_SYSENTER_CS : msr_info->data =vmcs_read32 (GUEST_SYSENTER_CS );break ;
@@ -3663,11 +3656,6 @@ static int vmx_set_msr(struct kvm_vcpu *vmx_disable_intercept_for_msr (vmx->vmcs01.msr_bitmap,MSR_IA32_PRED_CMD ,MSR_TYPE_W );break ; -case MSR_IA32_ARCH_CAPABILITIES : -if (!msr_info->host_initiated) -return 1 ; - vmx->arch_capabilities = data; -break ;case MSR_IA32_CR_PAT :if (vmcs_config.vmentry_ctrl &VM_ENTRY_LOAD_IA32_PAT ) {if (!kvm_mtrr_valid (vcpu,MSR_IA32_CR_PAT , data))
@@ -5929,8 +5917,6 @@ static int vmx_vcpu_setup(struct vcpu_vm ++vmx->nmsrs; } - vmx->arch_capabilities =kvm_get_arch_capabilities (); -vm_exit_controls_init (vmx, vmcs_config.vmexit_ctrl);/* 22.2.1, 20.8.1 */
arch/x86/kvm/x86.c +12 -0
@@ -2234,6 +2234,11 @@ int kvm_set_msr_common(struct kvm_vcpu *if (msr_info->host_initiated) vcpu->arch.microcode_version = data;break ; +case MSR_IA32_ARCH_CAPABILITIES : +if (!msr_info->host_initiated) +return 1 ; + vcpu->arch.arch_capabilities = data; +break ;case MSR_EFER :return set_efer (vcpu, data);case MSR_K7_HWCR :
@@ -2523,6 +2528,12 @@ int kvm_get_msr_common(struct kvm_vcpu *case MSR_IA32_UCODE_REV : msr_info->data = vcpu->arch.microcode_version;break ; +case MSR_IA32_ARCH_CAPABILITIES : +if (!msr_info->host_initiated && + !guest_cpuid_has (vcpu,X86_FEATURE_ARCH_CAPABILITIES )) +return 1 ; + msr_info->data = vcpu->arch.arch_capabilities; +break ;case MSR_MTRRcap: case 0x200 ... 0x2ff:return kvm_mtrr_get_msr (vcpu, msr_info->index, &msr_info->data);
@@ -7918,6 +7929,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu {int r; + vcpu->arch.arch_capabilities =kvm_get_arch_capabilities ();kvm_vcpu_mtrr_init (vcpu); r =vcpu_load (vcpu);if (r)
Greg Kroah-Hartman
maintainerPATCH 94/107 usb: mtu3: fix EXTCON dependency
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 3d54d10c6afed34fd45b852bf76f55e8da31d8ef upstream.
When EXTCON is a loadable module, mtu3 fails to link as built-in:
drivers/usb/mtu3/mtu3_plat.o: In function `mtu3_probe':
mtu3_plat.c:(.text+0x690): undefined reference to `extcon_get_edev_by_phandle'
Add a Kconfig dependency to force mtu3 also to be a loadable module if extconn is, but still allow it to be built without extcon.
--- drivers/usb/mtu3/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/usb/mtu3/Kconfig +1 -0
@@ -4,6 +4,7 @@ config USB_MTU3 tristate "MediaTek USB3 Dual Role controller" depends on EXTCON && (USB || USB_GADGET) && HAS_DMA depends on ARCH_MEDIATEK || COMPILE_TEST + depends on EXTCON || !EXTCON select USB_XHCI_MTK if USB_SUPPORT && USB_XHCI_HCD help Say Y or M here if your system runs on MediaTek SoCs with
Greg Kroah-Hartman
maintainerPATCH 81/107 serial: sh-sci: Fix setting SCSCR_TIE while transferring data
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hoan Nguyen An <[email protected]>
commit 93bcefd4c6bad4c69dbc4edcd3fbf774b24d930d upstream.
We disable transmission interrupt (clear SCSCR_TIE) after all data has been transmitted (if uart_circ_empty(xmit)). While transmitting, if the data is still in the tty buffer, re-enable the SCSCR_TIE bit, which was done at sci_start_tx().
This is unnecessary processing, wasting CPU operation if the data transmission length is large. And further, transmit end, FIFO empty bits disabling have also been performed in the step above.
--- drivers/tty/serial/sh-sci.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/tty/serial/sh-sci.c +1 -11
@@ -806,19 +806,9 @@ static void sci_transmit_chars(struct uaif (uart_circ_chars_pending (xmit) <WAKEUP_CHARS )uart_write_wakeup (port); -if (uart_circ_empty (xmit)) { +if (uart_circ_empty (xmit))sci_stop_tx (port); - }else { - ctrl =serial_port_in (port,SCSCR ); -if (port->type !=PORT_SCI ) { -serial_port_in (port, SCxSR);/* Dummy read */ -sci_clear_SCxSR (port,SCxSR_TDxE_CLEAR (port)); - } - - ctrl |=SCSCR_TIE ; -serial_port_out (port,SCSCR , ctrl); - } }/* On SH3, SCIF may read end-of-break as a space->mark char */
Greg Kroah-Hartman
maintainerPATCH 78/107 staging: vt6655: Remove vif check from vnt_interrupt
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit cc26358f89c3e493b54766b1ca56cfc6b14db78a upstream.
A check for vif is made in vnt_interrupt_work.
There is a small chance of leaving interrupt disabled while vif is NULL and the work hasn't been scheduled.
--- drivers/staging/vt6655/device_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/vt6655/device_main.c +1 -2
@@ -1079,8 +1079,7 @@ static irqreturn_t vnt_interrupt(int irq {struct vnt_private *priv = arg; -if (priv->vif) -schedule_work (&priv->interrupt_work); +schedule_work (&priv->interrupt_work);return IRQ_HANDLED ; }
Greg Kroah-Hartman
maintainerPATCH 74/107 scsi: zfcp: fix rport unblock if deleted SCSI devices on Scsi_Host
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit fe67888fc007a76b81e37da23ce5bd8fb95890b0 upstream.
An already deleted SCSI device can exist on the Scsi_Host and remain there because something still holds a reference. A new SCSI device with the same H:C:T:L and FCP device, target port WWPN, and FCP LUN can be created. When we try to unblock an rport, we still find the deleted SCSI device and return early because the zfcp_scsi_dev of that SCSI device is not ZFCP_STATUS_COMMON_UNBLOCKED. Hence we miss to unblock the rport, even if the new proper SCSI device would be in good state.
Therefore, skip deleted SCSI devices when iterating the sdevs of the shost. [cf. __scsi_device_lookup{_by_target}() or scsi_device_get()]
The following abbreviated trace sequence can indicate such problem:
Area : REC
Tag : ersfs_3
LUN : 0x4045400300000000
WWPN : 0x50050763031bd327
LUN status : 0x40000000 not ZFCP_STATUS_COMMON_UNBLOCKED
Ready count : n not incremented yet
Running count : 0x00000000
ERP want : 0x01
ERP need : 0xc1 ZFCP_ERP_ACTION_NONE
Area : REC
Tag : ersfs_3
LUN : 0x4045400300000000
WWPN : 0x50050763031bd327
LUN status : 0x41000000
Ready count : n+1
Running count : 0x00000000
ERP want : 0x01
ERP need : 0x01
...
Area : REC
Level : 4 only with increased trace level
Tag : ertru_l
LUN : 0x4045400300000000
WWPN : 0x50050763031bd327
LUN status : 0x40000000
Request ID : 0x0000000000000000
ERP status : 0x01800000
ERP step : 0x1000
ERP action : 0x01
ERP count : 0x00
NOT followed by a trace record with tag "scpaddy"
for WWPN 0x50050763031bd327.
--- drivers/s390/scsi/zfcp_erp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/s390/scsi/zfcp_erp.c +3 -0
@@ -1306,6 +1306,9 @@ static void zfcp_erp_try_rport_unblock(sstruct zfcp_scsi_dev *zsdev =sdev_to_zfcp (sdev);int lun_status; +if (sdev->sdev_state ==SDEV_DEL || + sdev->sdev_state ==SDEV_CANCEL ) +continue ;if (zsdev->port != port)continue ;/* LUN under port of interest */
Greg Kroah-Hartman
maintainerPATCH 42/107 powerpc/powernv: Query firmware for count cache flush settings
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 99d54754d3d5f896a8f616b0b6520662bc99d66b upstream.
Look for fw-features properties to determine the appropriate settings for the count cache flush, and then call the generic powerpc code to set it up based on the security feature flags.
--- arch/powerpc/platforms/powernv/setup.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/powerpc/platforms/powernv/setup.c +7 -0
@@ -77,6 +77,12 @@ static void init_fw_feat_flags(struct deif (fw_feature_is ("enabled" ,"fw-count-cache-disabled" , np))security_ftr_set (SEC_FTR_COUNT_CACHE_DISABLED ); +if (fw_feature_is ("enabled" ,"fw-count-cache-flush-bcctr2,0,0" , np)) +security_ftr_set (SEC_FTR_BCCTR_FLUSH_ASSIST ); + +if (fw_feature_is ("enabled" ,"needs-count-cache-flush-on-context-switch" , np)) +security_ftr_set (SEC_FTR_FLUSH_COUNT_CACHE ); +/* * The features below are enabled by default, so we instead look to see * if firmware has *disabled* them, and clear them if so.
@@ -123,6 +129,7 @@ static void pnv_setup_rfi_flush(void) security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV));setup_rfi_flush (type, enable); +setup_count_cache_flush (); }static void __init pnv_setup_arch (void )
Greg Kroah-Hartman
maintainerPATCH 56/107 Btrfs: fix incorrect file size after shrinking truncate and fsync
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit bf504110bc8aa05df48b0e5f0aa84bfb81e0574b upstream.
If we do a shrinking truncate against an inode which is already present in the respective log tree and then rename it, as part of logging the new name we end up logging an inode item that reflects the old size of the file (the one which we previously logged) and not the new smaller size. The decision to preserve the size previously logged was added by commit 1a4bcf470c886b ("Btrfs: fix fsync data loss after adding hard link to inode") in order to avoid data loss after replaying the log. However that decision is only needed for the case the logged inode size is smaller then the current size of the inode, as explained in that commit's change log. If the current size of the inode is smaller then the previously logged size, we know a shrinking truncate happened and therefore need to use that smaller size.
Example to trigger the problem:
$ mkfs.btrfs -f /dev/sdb $ mount /dev/sdb /mnt
$ xfs_io -f -c "pwrite -S 0xab 0 8000" /mnt/foo $ xfs_io -c "fsync" /mnt/foo $ xfs_io -c "truncate 3000" /mnt/foo
$ mv /mnt/foo /mnt/bar $ xfs_io -c "fsync" /mnt/bar
<power failure>
$ mount /dev/sdb /mnt $ od -t x1 -A d /mnt/bar 0000000 ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab * 0008000
Once we rename the file, we log its name (and inode item), and because the inode was already logged before in the current transaction, we log it with a size of 8000 bytes because that is the size we previously logged (with the first fsync). As part of the rename, besides logging the inode, we do also sync the log, which is done since commit d4682ba03ef618 ("Btrfs: sync log after logging new name"), so the next fsync against our inode is effectively a no-op, since no new changes happened since the rename operation. Even if did not sync the log during the rename operation, the same problem (fize size of 8000 bytes instead of 3000 bytes) would be visible after replaying the log if the log ended up getting synced to disk through some other means, such as for example by fsyncing some other modified file. In the example above the fsync after the rename operation is there just because not every filesystem may guarantee logging/journalling the inode (and syncing the log/journal) during the rename operation, for example it is needed for f2fs, but not for ext4 and xfs.
Fix this scenario by, when logging a new name (which is triggered by rename and link operations), using the current size of the inode instead of the previously logged inode size.
A test case for fstests follows soon.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202695
--- fs/btrfs/tree-log.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/btrfs/tree-log.c +13 -0
@@ -4501,6 +4501,19 @@ static int logged_inode_size(struct btrf item =btrfs_item_ptr (path->nodes[0 ], path->slots[0 ], struct btrfs_inode_item); *size_ret =btrfs_inode_size (path->nodes[0 ], item); +/* +* If the in-memory inode's i_size is smaller then the inode +* size stored in the btree, return the inode's i_size, so +* that we get a correct inode size after replaying the log +* when before a power failure we had a shrinking truncate +* followed by addition of a new name (rename / new hard link). +* Otherwise return the inode size from the btree, to avoid +* data loss when replaying a log due to previously doing a +* write that expands the inode's size and logging a new name +* immediately after. +*/ +if (*size_ret > inode->vfs_inode.i_size) + *size_ret = inode->vfs_inode.i_size; }btrfs_release_path (path);
Greg Kroah-Hartman
maintainerPATCH 52/107 powerpc/fsl: Update Spectre v2 reporting
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diana Craciun <[email protected]>
commit dfa88658fb0583abb92e062c7a9cd5a5b94f2a46 upstream.
Report branch predictor state flush as a mitigation for Spectre variant 2.
--- arch/powerpc/kernel/security.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/kernel/security.c +4 -1
@@ -212,8 +212,11 @@ ssize_t cpu_show_spectre_v2(struct devicif (count_cache_flush_type ==COUNT_CACHE_FLUSH_HW )seq_buf_printf (&s,"(hardware accelerated)" ); - }else + }else if (btb_flush_enabled) { +seq_buf_printf (&s,"Mitigation: Branch predictor state flush" ); + }else {seq_buf_printf (&s,"Vulnerable" ); + }seq_buf_printf (&s,"\n" );
Greg Kroah-Hartman
maintainerPATCH 21/107 mac8390: Fix mmio access size probe
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit bb9e5c5bcd76f4474eac3baf643d7a39f7bac7bb ]
The bug that Stan reported is as follows. After a restart, a 16-bit NIC may be incorrectly identified as a 32-bit NIC and stop working.
mac8390 slot.E: Memory length resource not found, probing
mac8390 slot.E: Farallon EtherMac II-C (type farallon)
mac8390 slot.E: MAC 00:00:c5:30:c2:99, IRQ 61, 32 KB shared memory at 0xfeed0000, 32-bit access.
The bug never arises after a cold start and only intermittently after a warm start. (I didn't investigate why the bug is intermittent.)
It turns out that memcpy_toio() is deprecated and memcmp_withio() also has issues. Replacing these calls with mmio accessors fixes the problem.
--- drivers/net/ethernet/8390/mac8390.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/ethernet/8390/mac8390.c +12 -7
@@ -156,8 +156,6 @@ static void dayna_block_output(struct ne#define memcpy_fromio (a, b, c) memcpy((a), (void *)(b), (c))#define memcpy_toio (a, b, c) memcpy((void *)(a), (b), (c)) -#define memcmp_withio (a, b, c) memcmp((a), (void *)(b), (c)) -/* Slow Sane (16-bit chunk memory read/write) Cabletron uses this */ static void slow_sane_get_8390_hdr (struct net_device *dev,struct e8390_pkt_hdr *hdr,int ring_page);
@@ -237,19 +235,26 @@ static enum mac8390_type __init mac8390_static enum mac8390_access __init mac8390_testio (volatile unsigned long membase) { -unsigned long outdata =0xA5A0B5B0 ; -unsigned long indata =0x00000000 ; +u32 outdata =0xA5A0B5B0 ; +u32 indata =0 ; +/* Try writing 32 bits */ -memcpy_toio (membase, &outdata,4 ); -/* Now compare them */ -if (memcmp_withio (&outdata, membase,4 ) ==0 ) +nubus_writel (outdata, membase); +/* Now read it back */ + indata =nubus_readl (membase); +if (outdata == indata)return ACCESS_32 ; + + outdata =0xC5C0D5D0 ; + indata =0 ; +/* Write 16 bit output */ word_memcpy_tocard (membase, &outdata,4 );/* Now read it back */ word_memcpy_fromcard (&indata, membase,4 );if (outdata == indata)return ACCESS_16 ; +return ACCESS_UNKNOWN ; }
stable-rc/linux-4.14.y boot: 116 boots: 1 failed, 94 passed with 18 offline, 3 untried/unknown (v4.14.109-108-g9f663733559c)
stable-rc/linux-4.14.y boot: 116 boots: 1 failed, 94 passed with 18 offline, 3 untried/unknown (v4.14.109-108-g9f663733559c)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-4.14.y/kernel/v4.14.109-108-g9f663733559c/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-4.14.y/kernel/v4.14.109-108-g9f663733559c/
Tree: stable-rc
Branch: linux-4.14.y
Git Describe: v4.14.109-108-g9f663733559c
Git Commit: 9f663733559cbf742da52d17c9554df7b028c5f6
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 63 unique boards, 24 SoC families, 14 builds out of 201
Boot Failure Detected:
arm64:
defconfig:
gcc-7:
rk3399-firefly: 1 failed lab
Offline Platforms:
arm:
bcm2835_defconfig:
gcc-7
bcm2835-rpi-b: 1 offline lab
multi_v7_defconfig:
gcc-7
alpine-db: 1 offline lab
at91-sama5d4_xplained: 1 offline lab
qcom-apq8064-cm-qs600: 1 offline lab
qcom-apq8064-ifc6410: 1 offline lab
socfpga_cyclone5_de0_sockit: 1 offline lab
sun5i-r8-chip: 1 offline lab
tegra124-jetson-tk1: 1 offline lab
tegra20-iris-512: 1 offline lab
tegra_defconfig:
gcc-7
tegra124-jetson-tk1: 1 offline lab
tegra20-iris-512: 1 offline lab
sunxi_defconfig:
gcc-7
sun5i-r8-chip: 1 offline lab
sama5_defconfig:
gcc-7
at91-sama5d4_xplained: 1 offline lab
qcom_defconfig:
gcc-7
qcom-apq8064-cm-qs600: 1 offline lab
qcom-apq8064-ifc6410: 1 offline labarm64:
defconfig:
gcc-7
apq8016-sbc: 1 offline lab
juno-r2: 1 offline lab
mt7622-rfb1: 1 offline lab---
For more info write to <[email protected]>
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.110 release. There are 107 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 Wed Apr 3 16:59:25 UTC 2019. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.110-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.14.110-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.14.y
git commit: d9f7d17a43aadb81f676a3a3f012a1bb32fe9bbc
git describe: v4.14.109-108-gd9f7d17a43aa
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.14-oe/build/v4.14.109-108-gd9f7d17a43aa
No regressions (compared to build v4.14.109)
No fixes (compared to build v4.14.109)
Ran 23299 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* boot
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-hugetlb-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-sched-tests
* ltp-syscalls-tests
* ltp-timers-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* ltp-dio-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-io-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-securebits-tests
* ltp-open-posix-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.110 release. There are 107 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 Wed Apr 3 16:59:25 UTC 2019. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.110-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v4.14:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
22 tests: 22 pass, 0 failLinux version: 4.14.110-rc1-g21d2c5a
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Cheers
Jon
Signature · 1 line
nvpublic
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.110 release. There are 107 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 Wed Apr 3 16:59:25 UTC 2019. Anything received after that time might be too late.
Build results:
total: 172 pass: 172 fail: 0 Qemu test results: total: 329 pass: 329 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.110 release. There are 107 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 Wed Apr 3 16:59:25 UTC 2019. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 10 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.110-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah