4.14.2-stable review
Greg Kroah-Hartman
maintainercover 4.14.2-stable review
This is the start of the stable review cycle for the 4.14.2 release. There are 18 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 Fri Nov 24 10:11:38 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.2-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.2-rc1
Jan Harkes <[email protected]>
coda: fix 'kernel memory exposure attempt' in fsync
Jaewon Kim <[email protected]>
mm/page_ext.c: check if page_ext is not prepared
Pavel Tatashin <[email protected]>
mm/page_alloc.c: broken deferred calculation
Corey Minyard <[email protected]>
ipmi: fix unsigned long underflow
alex chen <[email protected]>
ocfs2: should wait dio before inode lock in ocfs2_setattr()
Changwei Ge <[email protected]>
ocfs2: fix cluster hang after a node dies
Jann Horn <[email protected]>
mm/pagewalk.c: report holes in hugetlb ranges
Neeraj Upadhyay <[email protected]>
rcu: Fix up pending cbs check in rcu_prepare_for_idle
Alexander Steffen <[email protected]>
tpm-dev-common: Reject too short writes
Ji-Ze Hong (Peter Hong) <[email protected]>
serial: 8250_fintek: Fix finding base_port with activated SuperIO
Lukas Wunner <[email protected]>
serial: omap: Fix EFR write on RTS deassertion
Roberto Sassu <[email protected]>
ima: do not update security.ima if appraisal status is not INTEGRITY_PASS
Eric W. Biederman <[email protected]>
net/sctp: Always set scope_id in sctp_inet6_skb_msgname
Huacai Chen <[email protected]>
fealnx: Fix building error on MIPS
Bjørn Mork <[email protected]>
net: cdc_ncm: GetNtbFormat endian fix
Xin Long <[email protected]>
vxlan: fix the issue that neigh proxy blocks all icmpv6 packets
Jason A. Donenfeld <[email protected]>
af_netlink: ensure that NLMSG_DONE never fails in dumps
Michael Lyle <[email protected]>
bio: ensure __bio_clone_fast copies bi_partno
-------------
Diffstat:
Makefile | 4 ++-- block/bio.c | 1 + drivers/char/ipmi/ipmi_msghandler.c | 10 ++++++---- drivers/char/tpm/tpm-dev-common.c | 6 ++++++ drivers/net/ethernet/fealnx.c | 6 +++--- drivers/net/usb/cdc_ncm.c | 4 ++-- drivers/net/vxlan.c | 31 +++++++++++++------------------ drivers/tty/serial/8250/8250_fintek.c | 3 +++ drivers/tty/serial/omap-serial.c | 2 +- fs/coda/upcall.c | 3 +-- fs/ocfs2/dlm/dlmrecovery.c | 1 + fs/ocfs2/file.c | 9 +++++++-- include/linux/mmzone.h | 3 ++- kernel/rcu/tree_plugin.h | 2 +- mm/page_alloc.c | 27 ++++++++++++++++++--------- mm/page_ext.c | 4 ---- mm/pagewalk.c | 6 +++++- net/netlink/af_netlink.c | 17 +++++++++++------ net/netlink/af_netlink.h | 1 + net/sctp/ipv6.c | 5 +++-- security/integrity/ima/ima_appraise.c | 3 +++ 21 files changed, 90 insertions(+), 58 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/18 bio: ensure __bio_clone_fast copies bi_partno
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Lyle <[email protected]>
commit 62530ed8b1d07a45dec94d46e521c0c6c2d476e6 upstream.
A new field was introduced in 74d46992e0d9, bi_partno, instead of using bdev->bd_contains and encoding the partition information in the bi_bdev field. __bio_clone_fast was changed to copy the disk information, but not the partition information. At minimum, this regressed bcache and caused data corruption.
--- block/bio.c | 1 + 1 file changed, 1 insertion(+)
block/bio.c +1 -0
@@ -597,6 +597,7 @@ void __bio_clone_fast(struct bio *bio, s* so we don't set nor calculate new physical/hw segment counts here */ bio->bi_disk = bio_src->bi_disk; + bio->bi_partno = bio_src->bi_partno;bio_set_flag (bio,BIO_CLONED ); bio->bi_opf = bio_src->bi_opf; bio->bi_write_hint = bio_src->bi_write_hint;
Greg Kroah-Hartman
maintainerPATCH 2/18 af_netlink: ensure that NLMSG_DONE never fails in dumps
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Jason A. Donenfeld" <[email protected]>
[ Upstream commit 0642840b8bb008528dbdf929cec9f65ac4231ad0 ]
The way people generally use netlink_dump is that they fill in the skb as much as possible, breaking when nla_put returns an error. Then, they get called again and start filling out the next skb, and again, and so forth. The mechanism at work here is the ability for the iterative dumping function to detect when the skb is filled up and not fill it past the brim, waiting for a fresh skb for the rest of the data.
However, if the attributes are small and nicely packed, it is possible that a dump callback function successfully fills in attributes until the skb is of size 4080 (libmnl's default page-sized receive buffer size). The dump function completes, satisfied, and then, if it happens to be that this is actually the last skb, and no further ones are to be sent, then netlink_dump will add on the NLMSG_DONE part:
nlh = nlmsg_put_answer(skb, cb, NLMSG_DONE, sizeof(len), NLM_F_MULTI);
It is very important that netlink_dump does this, of course. However, in this example, that call to nlmsg_put_answer will fail, because the previous filling by the dump function did not leave it enough room. And how could it possibly have done so? All of the nla_put variety of functions simply check to see if the skb has enough tailroom, independent of the context it is in.
In order to keep the important assumptions of all netlink dump users, it is therefore important to give them an skb that has this end part of the tail already reserved, so that the call to nlmsg_put_answer does not fail. Otherwise, library authors are forced to find some bizarre sized receive buffer that has a large modulo relative to the common sizes of messages received, which is ugly and buggy.
This patch thus saves the NLMSG_DONE for an additional message, for the case that things are dangerously close to the brim. This requires keeping track of the errno from ->dump() across calls.
--- net/netlink/af_netlink.c | 17 +++++++++++------ net/netlink/af_netlink.h | 1 + 2 files changed, 12 insertions(+), 6 deletions(-)
net/netlink/af_netlink.c +11 -6
@@ -2136,7 +2136,7 @@ static int netlink_dump(struct sock *sk)struct sk_buff *skb =NULL ;struct nlmsghdr *nlh;struct module *module; -int len, err = -ENOBUFS ; +int err = -ENOBUFS ;int alloc_min_size;int alloc_size;
@@ -2183,9 +2183,11 @@ static int netlink_dump(struct sock *sk)skb_reserve (skb,skb_tailroom (skb) - alloc_size);netlink_skb_set_owner_r (skb, sk); - len = cb->dump (skb, cb); +if (nlk->dump_done_errno >0 ) + nlk->dump_done_errno = cb->dump (skb, cb); -if (len >0 ) { +if (nlk->dump_done_errno >0 || +skb_tailroom (skb) <nlmsg_total_size (sizeof (nlk->dump_done_errno))) {mutex_unlock (nlk->cb_mutex);if (sk_filter (sk, skb))
@@ -2195,13 +2197,15 @@ static int netlink_dump(struct sock *sk)return 0 ; } - nlh =nlmsg_put_answer (skb, cb,NLMSG_DONE ,sizeof (len),NLM_F_MULTI ); -if (!nlh) + nlh =nlmsg_put_answer (skb, cb,NLMSG_DONE , +sizeof (nlk->dump_done_errno),NLM_F_MULTI ); +if (WARN_ON (!nlh)) goto errout_skb;nl_dump_check_consistent (cb, nlh); -memcpy (nlmsg_data (nlh), &len,sizeof (len)); +memcpy (nlmsg_data (nlh), &nlk->dump_done_errno, +sizeof (nlk->dump_done_errno));if (sk_filter (sk, skb))kfree_skb (skb);
@@ -2273,6 +2277,7 @@ int __netlink_dump_start(struct sock *ss } nlk->cb_running = true; + nlk->dump_done_errno =INT_MAX ;mutex_unlock (nlk->cb_mutex);
net/netlink/af_netlink.h +1 -0
@@ -34,6 +34,7 @@ struct netlink_sock {wait_queue_head_t wait;bool bound;bool cb_running; +int dump_done_errno;struct netlink_callback cb;struct mutex *cb_mutex;struct mutex cb_def_mutex;
Greg Kroah-Hartman
maintainerPATCH 3/18 vxlan: fix the issue that neigh proxy blocks all icmpv6 packets
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 8bff3685a4bbf175a96bc6a528f13455d8d38244 ]
Commit f1fb08f6337c ("vxlan: fix ND proxy when skb doesn't have transport header offset") removed icmp6_code and icmp6_type check before calling neigh_reduce when doing neigh proxy.
It means all icmpv6 packets would be blocked by this, not only ns packet. In Jianlin's env, even ping6 couldn't work through it.
This patch is to bring the icmp6_code and icmp6_type check back and also removed the same check from neigh_reduce().
--- drivers/net/vxlan.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-)
drivers/net/vxlan.c +13 -18
@@ -1623,26 +1623,19 @@ static struct sk_buff *vxlan_na_create(sstatic int neigh_reduce (struct net_device *dev,struct sk_buff *skb,__be32 vni) {struct vxlan_dev *vxlan =netdev_priv (dev); -struct nd_msg *msg; -const struct ipv6hdr *iphdr;const struct in6_addr *daddr; -struct neighbour *n; +const struct ipv6hdr *iphdr;struct inet6_dev *in6_dev; +struct neighbour *n; +struct nd_msg *msg; in6_dev =__in6_dev_get (dev);if (!in6_dev) goto out; -if (!pskb_may_pull (skb,sizeof (struct ipv6hdr ) +sizeof (struct nd_msg ))) - goto out; - iphdr =ipv6_hdr (skb); daddr = &iphdr->daddr; - msg = (struct nd_msg *)(iphdr +1 ); -if (msg->icmph.icmp6_code !=0 || - msg->icmph.icmp6_type !=NDISC_NEIGHBOUR_SOLICITATION ) - goto out;if (ipv6_addr_loopback (daddr) ||ipv6_addr_is_multicast (&msg->target))
@@ -2240,11 +2233,11 @@ tx_error:static netdev_tx_t vxlan_xmit (struct sk_buff *skb,struct net_device *dev) {struct vxlan_dev *vxlan =netdev_priv (dev); +struct vxlan_rdst *rdst, *fdst =NULL ;const struct ip_tunnel_info *info; -struct ethhdr *eth;bool did_rsc = false; -struct vxlan_rdst *rdst, *fdst =NULL ;struct vxlan_fdb *f; +struct ethhdr *eth;__be32 vni =0 ; info =skb_tunnel_info (skb);
@@ -2269,12 +2262,14 @@ static netdev_tx_t vxlan_xmit(struct sk_if (ntohs (eth->h_proto) ==ETH_P_ARP )return arp_reduce (dev, skb, vni); #if IS_ENABLED(CONFIG_IPV6) - else if (ntohs(eth->h_proto) == ETH_P_IPV6) { -struct ipv6hdr *hdr, _hdr; -if ((hdr =skb_header_pointer (skb, -skb_network_offset (skb), -sizeof (_hdr), &_hdr)) && - hdr->nexthdr ==IPPROTO_ICMPV6 ) + else if (ntohs(eth->h_proto) == ETH_P_IPV6 && + pskb_may_pull(skb, sizeof(struct ipv6hdr) + + sizeof(struct nd_msg)) && + ipv6_hdr(skb)->nexthdr == IPPROTO_ICMPV6) { +struct nd_msg *m = (struct nd_msg *)(ipv6_hdr (skb) +1 ); + +if (m->icmph.icmp6_code ==0 && + m->icmph.icmp6_type ==NDISC_NEIGHBOUR_SOLICITATION )return neigh_reduce (dev, skb, vni); }#endif
Greg Kroah-Hartman
maintainerPATCH 5/18 fealnx: Fix building error on MIPS
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
[ Upstream commit cc54c1d32e6a4bb3f116721abf900513173e4d02 ]
This patch try to fix the building error on MIPS. The reason is MIPS has already defined the LONG macro, which conflicts with the LONG enum in drivers/net/ethernet/fealnx.c.
--- drivers/net/ethernet/fealnx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/fealnx.c +3 -3
@@ -257,8 +257,8 @@ enum rx_desc_status_bits {RXFSD =0x00000800 ,/* first descriptor */ RXLSD =0x00000400 ,/* last descriptor */ ErrorSummary =0x80 ,/* error summary */ -RUNT =0x40 ,/* runt packet received */ -LONG =0x20 ,/* long packet received */ +RUNTPKT =0x40 ,/* runt packet received */ +LONGPKT =0x20 ,/* long packet received */ FAE =0x10 ,/* frame align error */ CRC =0x08 ,/* crc error */ RXER = 0x04, /* receive error */
@@ -1632,7 +1632,7 @@ static int netdev_rx(struct net_device * dev->name, rx_status); dev->stats.rx_errors++;/* end of a packet. */ -if (rx_status & (LONG |RUNT )) +if (rx_status & (LONGPKT |RUNTPKT )) dev->stats.rx_length_errors++;if (rx_status &RXER ) dev->stats.rx_frame_errors++;
Greg Kroah-Hartman
maintainerPATCH 6/18 net/sctp: Always set scope_id in sctp_inet6_skb_msgname
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
[ Upstream commit 7c8a61d9ee1df0fb4747879fa67a99614eb62fec ]
Alexandar Potapenko while testing the kernel with KMSAN and syzkaller discovered that in some configurations sctp would leak 4 bytes of kernel stack.
Working with his reproducer I discovered that those 4 bytes that are leaked is the scope id of an ipv6 address returned by recvmsg.
With a little code inspection and a shrewd guess I discovered that sctp_inet6_skb_msgname only initializes the scope_id field for link local ipv6 addresses to the interface index the link local address pertains to instead of initializing the scope_id field for all ipv6 addresses.
That is almost reasonable as scope_id's are meaniningful only for link local addresses. Set the scope_id in all other cases to 0 which is not a valid interface index to make it clear there is nothing useful in the scope_id field.
There should be no danger of breaking userspace as the stack leak guaranteed that previously meaningless random data was being returned.
History-tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
--- net/sctp/ipv6.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/sctp/ipv6.c +3 -2
@@ -807,9 +807,10 @@ static void sctp_inet6_skb_msgname(struc addr->v6.sin6_flowinfo =0 ; addr->v6.sin6_port = sh->source; addr->v6.sin6_addr =ipv6_hdr (skb)->saddr; -if (ipv6_addr_type (&addr->v6.sin6_addr) &IPV6_ADDR_LINKLOCAL ) { +if (ipv6_addr_type (&addr->v6.sin6_addr) &IPV6_ADDR_LINKLOCAL ) addr->v6.sin6_scope_id =sctp_v6_skb_iif (skb); - } +else + addr->v6.sin6_scope_id =0 ; } *addr_len =sctp_v6_addr_to_user (sctp_sk (skb->sk), addr);
Greg Kroah-Hartman
maintainerPATCH 7/18 ima: do not update security.ima if appraisal status is not INTEGRITY_PASS
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roberto Sassu <[email protected]>
commit 020aae3ee58c1af0e7ffc4e2cc9fe4dc630338cb upstream.
Commit b65a9cfc2c38 ("Untangling ima mess, part 2: deal with counters") moved the call of ima_file_check() from may_open() to do_filp_open() at a point where the file descriptor is already opened.
This breaks the assumption made by IMA that file descriptors being closed belong to files whose access was granted by ima_file_check(). The consequence is that security.ima and security.evm are updated with good values, regardless of the current appraisal status.
For example, if a file does not have security.ima, IMA will create it after opening the file for writing, even if access is denied. Access to the file will be allowed afterwards.
Avoid this issue by checking the appraisal status before updating security.ima.
--- security/integrity/ima/ima_appraise.c | 3 +++ 1 file changed, 3 insertions(+)
security/integrity/ima/ima_appraise.c +3 -0
@@ -320,6 +320,9 @@ void ima_update_xattr(struct integrity_iif (iint->flags &IMA_DIGSIG )return ; +if (iint->ima_file_status !=INTEGRITY_PASS ) +return ; + rc =ima_collect_measurement (iint, file,NULL ,0 , ima_hash_algo);if (rc <0 )return ;
Greg Kroah-Hartman
maintainerPATCH 8/18 serial: omap: Fix EFR write on RTS deassertion
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
commit 2a71de2f7366fb1aec632116d0549ec56d6a3940 upstream.
Commit 348f9bb31c56 ("serial: omap: Fix RTS handling") sought to enable auto RTS upon manual RTS assertion and disable it on deassertion. However it seems the latter was done incorrectly, it clears all bits in the Extended Features Register *except* auto RTS.
--- drivers/tty/serial/omap-serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/omap-serial.c +1 -1
@@ -693,7 +693,7 @@ static void serial_omap_set_mctrl(structif ((mctrl &TIOCM_RTS ) && (port->status &UPSTAT_AUTORTS )) up->efr |=UART_EFR_RTS ;else - up->efr &=UART_EFR_RTS ; + up->efr &= ~UART_EFR_RTS ;serial_out (up,UART_EFR , up->efr);serial_out (up,UART_LCR , lcr);
Greg Kroah-Hartman
maintainerPATCH 9/18 serial: 8250_fintek: Fix finding base_port with activated SuperIO
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ji-Ze Hong (Peter Hong) <[email protected]>
commit fd97e66c5529046e989a0879c3bb58fddb592c71 upstream.
The SuperIO will be configured at boot time by BIOS, but some BIOS will not deactivate the SuperIO when the end of configuration. It'll lead to mismatch for pdata->base_port in probe_setup_port(). So we'll deactivate all SuperIO before activate special base_port in fintek_8250_enter_key().
Tested on iBASE MI802.
--- drivers/tty/serial/8250/8250_fintek.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/8250/8250_fintek.c +3 -0
@@ -118,6 +118,9 @@ static int fintek_8250_enter_key(u16 basif (!request_muxed_region (base_port,2 ,"8250_fintek" ))return -EBUSY ; +/* Force to deactive all SuperIO in this base_port */ +outb (EXIT_KEY , base_port +ADDR_PORT ); +outb (key, base_port +ADDR_PORT );outb (key, base_port +ADDR_PORT );return 0 ;
Greg Kroah-Hartman
maintainerPATCH 10/18 tpm-dev-common: Reject too short writes
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Steffen <[email protected]>
commit ee70bc1e7b63ac8023c9ff9475d8741e397316e7 upstream.
tpm_transmit() does not offer an explicit interface to indicate the number of valid bytes in the communication buffer. Instead, it relies on the commandSize field in the TPM header that is encoded within the buffer. Therefore, ensure that a) enough data has been written to the buffer, so that the commandSize field is present and b) the commandSize field does not announce more data than has been written to the buffer.
This should have been fixed with CVE-2011-1161 long ago, but apparently a correct version of that patch never made it into the kernel.
--- drivers/char/tpm/tpm-dev-common.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/char/tpm/tpm-dev-common.c +6 -0
@@ -110,6 +110,12 @@ ssize_t tpm_common_write(struct file *fireturn -EFAULT ; } +if (in_size <6 || + in_size <be32_to_cpu (*((__be32 *) (priv->data_buffer +2 )))) { +mutex_unlock (&priv->buffer_mutex); +return -EINVAL ; + } +/* atomic tpm command send and result receive. We only hold the ops * lock during this period so that the tpm can be unregistered even if * the char dev is held open.
Greg Kroah-Hartman
maintainerPATCH 11/18 rcu: Fix up pending cbs check in rcu_prepare_for_idle
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neeraj Upadhyay <[email protected]>
commit 135bd1a230bb69a68c9808a7d25467318900b80a upstream.
The pending-callbacks check in rcu_prepare_for_idle() is backwards. It should accelerate if there are pending callbacks, but the check rather uselessly accelerates only if there are no callbacks. This commit therefore inverts this check.
--- kernel/rcu/tree_plugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
@@ -1507,7 +1507,7 @@ static void rcu_prepare_for_idle(void) rdtp->last_accelerate = jiffies;for_each_rcu_flavor (rsp) { rdp =this_cpu_ptr (rsp->rda); -if (rcu_segcblist_pend_cbs (&rdp->cblist)) +if (!rcu_segcblist_pend_cbs (&rdp->cblist))continue ; rnp = rdp->mynode;raw_spin_lock_rcu_node (rnp);/* irqs already disabled. */
Greg Kroah-Hartman
maintainerPATCH 12/18 mm/pagewalk.c: report holes in hugetlb ranges
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 373c4557d2aa362702c4c2d41288fb1e54990b7c upstream.
This matters at least for the mincore syscall, which will otherwise copy uninitialized memory from the page allocator to userspace. It is probably also a correctness error for /proc/$pid/pagemap, but I haven't tested that.
Removing the walk->hugetlb_entry condition in walk_hugetlb_range() has no effect because the caller already checks for that.
This only reports holes in hugetlb ranges to callers who have specified a hugetlb_entry callback.
This issue was found using an AFL-based fuzzer.
v2:
- don't crash on ->pte_hole==NULL (Andrew Morton)
- add Cc stable (Andrew Morton)
--- mm/pagewalk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
mm/pagewalk.c +5 -1
@@ -188,8 +188,12 @@ static int walk_hugetlb_range(unsigned ldo { next =hugetlb_entry_end (h, addr, end); pte =huge_pte_offset (walk->mm, addr & hmask, sz); -if (pte && walk->hugetlb_entry) + +if (pte) err = walk->hugetlb_entry (pte, hmask, addr, next, walk); +else if (walk->pte_hole) + err = walk->pte_hole (addr, next, walk); +if (err)break ; }while (addr = next, addr != end);
Greg Kroah-Hartman
maintainerPATCH 13/18 ocfs2: fix cluster hang after a node dies
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Changwei Ge <[email protected]>
commit 1c01967116a678fed8e2c68a6ab82abc8effeddc upstream.
When a node dies, other live nodes have to choose a new master for an existed lock resource mastered by the dead node.
As for ocfs2/dlm implementation, this is done by function - dlm_move_lockres_to_recovery_list which marks those lock rsources as DLM_LOCK_RES_RECOVERING and manages them via a list from which DLM changes lock resource's master later.
So without invoking dlm_move_lockres_to_recovery_list, no master will be choosed after dlm recovery accomplishment since no lock resource can be found through ::resource list.
What's worse is that if DLM_LOCK_RES_RECOVERING is not marked for lock resources mastered a dead node, it will break up synchronization among nodes.
So invoke dlm_move_lockres_to_recovery_list again.
Fixs: 'commit ee8f7fcbe638 ("ocfs2/dlm: continue to purge recovery lockres when recovery master goes down")'
--- fs/ocfs2/dlm/dlmrecovery.c | 1 + 1 file changed, 1 insertion(+)
fs/ocfs2/dlm/dlmrecovery.c +1 -0
@@ -2419,6 +2419,7 @@ static void dlm_do_local_recovery_cleanudlm_lockres_put (res);continue ; } +dlm_move_lockres_to_recovery_list (dlm, res); }else if (res->owner == dlm->node_num) {dlm_free_dead_locks (dlm, res, dead_node);__dlm_lockres_calc_usage (dlm, res);
Greg Kroah-Hartman
maintainerPATCH 14/18 ocfs2: should wait dio before inode lock in ocfs2_setattr()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: alex chen <[email protected]>
commit 28f5a8a7c033cbf3e32277f4cc9c6afd74f05300 upstream.
we should wait dio requests to finish before inode lock in ocfs2_setattr(), otherwise the following deadlock will happen:
process 1 process 2 process 3 truncate file 'A' end_io of writing file 'A' receiving the bast messages
ocfs2_setattr
ocfs2_inode_lock_tracker
ocfs2_inode_lock_full
inode_dio_wait
__inode_dio_wait
-->waiting for all dio
requests finish
dlm_proxy_ast_handler
dlm_do_local_bast
ocfs2_blocking_ast
ocfs2_generic_handle_bast
set OCFS2_LOCK_BLOCKED flag
dio_end_io
dio_bio_end_aio
dio_complete
ocfs2_dio_end_io
ocfs2_dio_end_io_write
ocfs2_inode_lock
__ocfs2_cluster_lock
ocfs2_wait_for_mask
-->waiting for OCFS2_LOCK_BLOCKED
flag to be cleared, that is waiting
for 'process 1' unlocking the inode lock
inode_dio_end
-->here dec the i_dio_count, but will never
be called, so a deadlock happened.
--- fs/ocfs2/file.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/ocfs2/file.c +7 -2
@@ -1161,6 +1161,13 @@ int ocfs2_setattr(struct dentry *dentry, } size_change =S_ISREG (inode->i_mode) && attr->ia_valid &ATTR_SIZE ;if (size_change) { +/* +* Here we should wait dio to finish before inode lock +* to avoid a deadlock between ocfs2_setattr() and +* ocfs2_dio_end_io_write() +*/ +inode_dio_wait (inode); + status =ocfs2_rw_lock (inode,1 );if (status <0 ) {mlog_errno (status);
@@ -1200,8 +1207,6 @@ int ocfs2_setattr(struct dentry *dentry,if (status) goto bail_unlock; -inode_dio_wait (inode); -if (i_size_read (inode) >= attr->ia_size) {if (ocfs2_should_order_data (inode)) { status = ocfs2_begin_ordered_truncate(inode,
Greg Kroah-Hartman
maintainerPATCH 15/18 ipmi: fix unsigned long underflow
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
commit 392a17b10ec4320d3c0e96e2a23ebaad1123b989 upstream.
When I set the timeout to a specific value such as 500ms, the timeout event will not happen in time due to the overflow in function check_msg_timeout:
...
ent->timeout -= timeout_period; if (ent->timeout > 0) return;
...
The type of timeout_period is long, but ent->timeout is unsigned long. This patch makes the type consistent.
--- drivers/char/ipmi/ipmi_msghandler.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/char/ipmi/ipmi_msghandler.c +6 -4
@@ -4030,7 +4030,8 @@ smi_from_recv_msg(ipmi_smi_t intf, struc }static void check_msg_timeout (ipmi_smi_t intf,struct seq_table *ent, -struct list_head *timeouts,long timeout_period, +struct list_head *timeouts, +unsigned long timeout_period,int slot,unsigned long *flags,unsigned int *waiting_msgs) {
@@ -4043,8 +4044,8 @@ static void check_msg_timeout(ipmi_smi_tif (!ent->inuse)return ; - ent->timeout -= timeout_period; -if (ent->timeout >0 ) { +if (timeout_period < ent->timeout) { + ent->timeout -= timeout_period; (*waiting_msgs)++;return ; }
@@ -4110,7 +4111,8 @@ static void check_msg_timeout(ipmi_smi_t } } -static unsigned int ipmi_timeout_handler (ipmi_smi_t intf,long timeout_period) +static unsigned int ipmi_timeout_handler (ipmi_smi_t intf, +unsigned long timeout_period) {struct list_head timeouts;struct ipmi_recv_msg *msg, *msg2;
Greg Kroah-Hartman
maintainerPATCH 16/18 mm/page_alloc.c: broken deferred calculation
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Tatashin <[email protected]>
commit d135e5750205a21a212a19dbb05aeb339e2cbea7 upstream.
In reset_deferred_meminit() we determine number of pages that must not be deferred. We initialize pages for at least 2G of memory, but also pages for reserved memory in this node.
The reserved memory is determined in this function:memblock_reserved_memory_within(), which operates over physical addresses, and returns size in bytes. However, reset_deferred_meminit() assumes that that this function operates with pfns, and returns page count.
The result is that in the best case machine boots slower than expected due to initializing more pages than needed in single thread, and in the worst case panics because fewer than needed pages are initialized early.
--- include/linux/mmzone.h | 3 ++- mm/page_alloc.c | 27 ++++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-)
include/linux/mmzone.h +2 -1
@@ -700,7 +700,8 @@ typedef struct pglist_data {* is the first PFN that needs to be initialised. */ unsigned long first_deferred_pfn; -unsigned long static_init_size; +/* Number of non-deferred pages */ +unsigned long static_init_pgcnt;#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ #ifdef CONFIG_TRANSPARENT_HUGEPAGE
mm/page_alloc.c +18 -9
@@ -290,28 +290,37 @@ EXPORT_SYMBOL(nr_online_nodes);int page_group_by_mobility_disabled__read_mostly ;#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT + +/* +* Determine how many pages need to be initialized durig early boot +* (non-deferred initialization). +* The value of first_deferred_pfn will be set later, once non-deferred pages +* are initialized, but for now set it ULONG_MAX. +*/ static inline void reset_deferred_meminit (pg_data_t *pgdat) { -unsigned long max_initialise; -unsigned long reserved_lowmem; +phys_addr_t start_addr, end_addr; +unsigned long max_pgcnt; +unsigned long reserved;/* * Initialise at least 2G of a node but also take into account that * two large system hashes that can take up 1GB for 0.25TB/node. */ - max_initialise =max (2UL << (30 -PAGE_SHIFT ), - (pgdat->node_spanned_pages >>8 )); + max_pgcnt =max (2UL << (30 -PAGE_SHIFT ), + (pgdat->node_spanned_pages >>8 ));/* * Compensate the all the memblock reservations (e.g. crash kernel) * from the initial estimation to make sure we will initialize enough * memory to boot. */ - reserved_lowmem =memblock_reserved_memory_within (pgdat->node_start_pfn, - pgdat->node_start_pfn + max_initialise); - max_initialise += reserved_lowmem; + start_addr =PFN_PHYS (pgdat->node_start_pfn); + end_addr =PFN_PHYS (pgdat->node_start_pfn + max_pgcnt); + reserved =memblock_reserved_memory_within (start_addr, end_addr); + max_pgcnt +=PHYS_PFN (reserved); - pgdat->static_init_size =min (max_initialise, pgdat->node_spanned_pages); + pgdat->static_init_pgcnt =min (max_pgcnt, pgdat->node_spanned_pages); pgdat->first_deferred_pfn =ULONG_MAX ; }
@@ -338,7 +347,7 @@ static inline bool update_defer_init(pg_if (zone_end <pgdat_end_pfn (pgdat))return true; (*nr_initialised)++; -if ((*nr_initialised > pgdat->static_init_size) && +if ((*nr_initialised > pgdat->static_init_pgcnt) && (pfn & (PAGES_PER_SECTION -1 )) ==0 ) { pgdat->first_deferred_pfn = pfn;return false;
Greg Kroah-Hartman
maintainerPATCH 17/18 mm/page_ext.c: check if page_ext is not prepared
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaewon Kim <[email protected]>
commit e492080e640c2d1235ddf3441cae634cfffef7e1 upstream.
online_page_ext() and page_ext_init() allocate page_ext for each section, but they do not allocate if the first PFN is !pfn_present(pfn) or !pfn_valid(pfn). Then section->page_ext remains as NULL. lookup_page_ext checks NULL only if CONFIG_DEBUG_VM is enabled. For a valid PFN, __set_page_owner will try to get page_ext through lookup_page_ext. Without CONFIG_DEBUG_VM lookup_page_ext will misuse NULL pointer as value 0. This incurrs invalid address access.
This is the panic example when PFN 0x100000 is not valid but PFN 0x13FC00 is being used for page_ext. section->page_ext is NULL, get_entry returned invalid page_ext address as 0x1DFA000 for a PFN 0x13FC00.
To avoid this panic, CONFIG_DEBUG_VM should be removed so that page_ext will be checked at all times.
Unable to handle kernel paging request at virtual address 01dfa014
------------[ cut here ]------------
Kernel BUG at ffffff80082371e0 [verbose debug info unavailable]
Internal error: Oops: 96000045 [#1] PREEMPT SMP
Modules linked in:
PC is at __set_page_owner+0x48/0x78
LR is at __set_page_owner+0x44/0x78
__set_page_owner+0x48/0x78
get_page_from_freelist+0x880/0x8e8
__alloc_pages_nodemask+0x14c/0xc48
__do_page_cache_readahead+0xdc/0x264
filemap_fault+0x2ac/0x550
ext4_filemap_fault+0x3c/0x58
__do_fault+0x80/0x120
handle_mm_fault+0x704/0xbb0
do_page_fault+0x2e8/0x394
do_mem_abort+0x88/0x124Pre-4.7 kernels also need commit f86e4271978b ("mm: check the return value of lookup_page_ext for all call sites").
--- mm/page_ext.c | 4 ---- 1 file changed, 4 deletions(-)
mm/page_ext.c +0 -4
@@ -125,7 +125,6 @@ struct page_ext *lookup_page_ext(structstruct page_ext *base; base =NODE_DATA (page_to_nid (page))->node_page_ext; -#if defined(CONFIG_DEBUG_VM )/* * The sanity checks the page allocator does upon freeing a * page can reach here before the page_ext arrays are
@@ -134,7 +133,6 @@ struct page_ext *lookup_page_ext(struct*/ if (unlikely (!base))return NULL ; -#endif index = pfn -round_down (node_start_pfn (page_to_nid (page)),MAX_ORDER_NR_PAGES );return get_entry (base, index);
@@ -199,7 +197,6 @@ struct page_ext *lookup_page_ext(struct {unsigned long pfn =page_to_pfn (page);struct mem_section *section =__pfn_to_section (pfn); -#if defined(CONFIG_DEBUG_VM )/* * The sanity checks the page allocator does upon freeing a * page can reach here before the page_ext arrays are
@@ -208,7 +205,6 @@ struct page_ext *lookup_page_ext(struct*/ if (!section->page_ext)return NULL ; -#endif return get_entry (section->page_ext, pfn); }
Greg Kroah-Hartman
maintainerPATCH 18/18 coda: fix kernel memory exposure attempt in fsync
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Harkes <[email protected]>
commit d337b66a4c52c7b04eec661d86c2ef6e168965a2 upstream.
When an application called fsync on a file in Coda a small request with just the file identifier was allocated, but the declared length was set to the size of union of all possible upcall requests.
This bug has been around for a very long time and is now caught by the extra checking in usercopy that was introduced in Linux-4.8.
The exposure happens when the Coda cache manager process reads the fsync upcall request at which point it is killed. As a result there is nobody servicing any further upcalls, trapping any processes that try to access the mounted Coda filesystem.
--- fs/coda/upcall.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/coda/upcall.c +1 -2
@@ -447,8 +447,7 @@ int venus_fsync(struct super_block *sb,UPARG (CODA_FSYNC ); inp->coda_fsync.VFid = *fid; - error =coda_upcall (coda_vcp (sb),sizeof (union inputArgs ), - &outsize, inp); + error =coda_upcall (coda_vcp (sb), insize, &outsize, inp);CODA_FREE (inp, insize);return error;
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.2 release. There are 18 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 Fri Nov 24 10:11:38 UTC 2017. Anything received after that time might be too late.
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 123 pass: 123 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Greg Kroah-Hartman
maintainerQuoted 10 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.2 release. There are 18 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 Fri Nov 24 10:11:38 UTC 2017. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 123 pass: 123 fail: 0Details are available at http://kerneltests.org/builders.
Wonderful, thanks for testing all of these and letting me know.
greg k-h
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Kevin,
Quoted 7 lines · Kevin Hilman
Quoted 5 lines · kernelci.org bot
stable-rc/linux-4.14.y boot: 100 boots: 3 failed, 96 passed with 1 untried/unknown (v4.14.1-19-g6d0448582cf7)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-4.14.y/kernel/v4.14.1-19-g6d0448582cf7/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-4.14.y/kernel/v4.14.1-19-g6d0448582cf7/
Quoted 8 lines
Quoted 6 lines
Tree: stable-rc
Branch: linux-4.14.y
Git Describe: v4.14.1-19-g6d0448582cf7
Git Commit:6d0448582cf754db0c8eedcb85edc01692892f50
Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 43 unique boards, 16 SoC families, 18 builds out of 189TL;DR; All is well, but Cc'd Free Electrons for double check.
Thanks for the hint, we'll double check this one.
Antoine
Signature · 3 lines
Antoine T�nart, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.2 release. There are 18 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 Fri Nov 24 10:11:38 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.2-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 and x86_64.
Summary
------------------------------------------------------------------------
kernel: 4.14.2-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: 2fd86a373754b5ef1daa02eb2e637f0db7961fcf
git describe: v4.14.1-20-g2fd86a373754
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.14-oe/build/v4.14.1-20-g2fd86a373754
No regressions (compared to build v4.14.1-19-g6d0448582cf7)
Boards, architectures and test suites:
-------------------------------------
hi6220-hikey - arm64
* boot - pass: 20,
* kselftest - pass: 39, skip: 14
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 21, skip: 1
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 982, skip: 121
* ltp-timers-tests - pass: 12,
juno-r2 - arm64
* boot - pass: 20,
* kselftest - pass: 38, skip: 14
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 10,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 939, skip: 156
* ltp-timers-tests - pass: 12,
x15 - arm
* boot - pass: 20,
* kselftest - pass: 35, skip: 18
* libhugetlbfs - pass: 87, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 20, skip: 2
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 13, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1036, skip: 66
* ltp-timers-tests - pass: 12,
SuperServer 5019S-ML - x86_64
* boot - pass: 20,
* kselftest - pass: 54, skip: 13
* libhugetlbfs - pass: 76, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 61, skip: 1
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 18,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 9, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 957, skip: 163,
* ltp-timers-tests - pass: 12,
Documentation - https://collaborate.linaro.org/display/LKFT/Email+Reports
Greg Kroah-Hartman
maintainerQuoted 16 lines · Naresh Kamboju
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.2 release. There are 18 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 Fri Nov 24 10:11:38 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.2-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.
Quoted 7 lines
Quoted 4 lines
thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm andx86_64.
Thanks for testing all of these and letting me know.
greg k-h