2.6.35.6 stable review
Subsystems (65)
cover 2.6.35.6 stable review
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Sunday September 26, 17:00:00 UTC 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/v2.6/stable-review/patch-2.6.35.6-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Makefile | 2 +- arch/alpha/kernel/err_marvel.c | 6 +- arch/alpha/kernel/proto.h | 3 - arch/alpha/kernel/sys_cabriolet.c | 19 ++- arch/alpha/kernel/sys_takara.c | 11 +- arch/arm/mach-at91/at91sam9g45_devices.c | 2 +- arch/ia64/kernel/fsys.S | 30 ++- arch/sparc/include/asm/oplib_64.h | 27 +--- arch/sparc/prom/cif.S | 16 +- arch/sparc/prom/console_64.c | 48 ++++- arch/sparc/prom/devops_64.c | 36 +++- arch/sparc/prom/misc_64.c | 314 +++++++++++++++++++++--------- arch/sparc/prom/p1275.c | 102 +---------- arch/sparc/prom/tree_64.c | 210 +++++++++++++++------ arch/x86/kvm/emulate.c | 4 +- arch/x86/kvm/mmu.c | 8 +- arch/x86/kvm/paging_tmpl.h | 28 +++- arch/x86/kvm/vmx.c | 4 + arch/x86/kvm/x86.c | 7 +- arch/x86/lib/atomic64_386_32.S | 38 ++-- arch/x86/oprofile/nmi_int.c | 4 +- drivers/base/power/main.c | 1 + drivers/char/agp/intel-agp.c | 44 +++-- drivers/char/agp/intel-agp.h | 19 ++- drivers/char/agp/intel-gtt.c | 47 +++++- drivers/char/mem.c | 3 +- drivers/char/virtio_console.c | 6 +- drivers/gpu/drm/i915/i915_drv.c | 6 + drivers/gpu/drm/i915/intel_display.c | 8 + drivers/gpu/drm/nouveau/nv50_instmem.c | 2 + drivers/message/fusion/mptscsih.c | 2 + drivers/net/bonding/bond_3ad.c | 3 + drivers/net/bonding/bond_alb.c | 3 + drivers/net/cxgb3/cxgb3_main.c | 2 + drivers/net/eql.c | 2 + drivers/net/usb/hso.c | 2 + drivers/pci/intel-iommu.c | 90 ++++----- drivers/platform/x86/dell-wmi.c | 2 +- drivers/platform/x86/hp-wmi.c | 51 +++-- drivers/rtc/rtc-s3c.c | 13 +- drivers/staging/vt6655/wpactl.c | 11 +- drivers/usb/musb/musb_debugfs.c | 5 +- drivers/usb/serial/mos7720.c | 3 + drivers/usb/serial/mos7840.c | 3 + drivers/video/sis/sis_main.c | 3 + drivers/video/via/ioctl.c | 2 + fs/aio.c | 13 ++- fs/char_dev.c | 4 +- fs/compat.c | 2 +- fs/fs-writeback.c | 23 ++- fs/gfs2/log.c | 2 +- fs/notify/inotify/inotify_user.c | 7 +- fs/proc/vmcore.c | 2 +- fs/xfs/linux-2.6/xfs_ioctl.c | 2 + include/linux/ksm.h | 20 +- include/linux/kvm_host.h | 1 + include/linux/mm.h | 8 +- include/linux/mmzone.h | 13 ++ include/linux/vmstat.h | 22 ++ include/net/sock.h | 1 + include/net/tcp.h | 36 +++- include/net/udp.h | 1 + kernel/exit.c | 5 +- kernel/hw_breakpoint.c | 3 +- kernel/power/snapshot.c | 85 ++++++-- kernel/sched.c | 8 +- kernel/sys.c | 2 + mm/backing-dev.c | 2 + mm/ksm.c | 3 - mm/memory.c | 56 +++++- mm/mmap.c | 4 +- mm/mmzone.c | 21 ++ mm/page_alloc.c | 33 +++- mm/percpu.c | 2 +- mm/vmscan.c | 43 ++++- mm/vmstat.c | 15 ++- net/Kconfig | 2 +- net/bridge/br_netfilter.c | 6 +- net/core/skbuff.c | 6 +- net/ipv4/datagram.c | 5 +- net/ipv4/route.c | 7 +- net/ipv4/tcp.c | 32 +-- net/ipv4/tcp_timer.c | 8 +- net/ipv4/udp.c | 44 ++++ net/ipv6/datagram.c | 7 +- net/ipv6/udp.c | 10 + net/irda/af_irda.c | 4 +- net/l2tp/l2tp_eth.c | 2 +- net/llc/af_llc.c | 3 +- net/rds/recv.c | 2 +- net/sctp/output.c | 1 - net/unix/af_unix.c | 15 ++- security/keys/keyctl.c | 6 +- sound/pci/hda/patch_sigmatel.c | 12 +- virt/kvm/kvm_main.c | 1 + 95 files changed, 1285 insertions(+), 579 deletions(-)
PATCH 1/80 usb: musb_debugfs: dont use the struct file private_data field with seq_files
2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mathias Nyman <[email protected]>
commit 024cfa5943a7e89565c60b612d698c2bfb3da66a upstream.
seq_files use the private_data field of a file struct for storing a seq_file structure, data should be stored in seq_file's own private field (e.g. file->private_data->private) Otherwise seq_release() will free the private data when the file is closed.
--- drivers/usb/musb/musb_debugfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/musb/musb_debugfs.c +2 -3
@@ -195,15 +195,14 @@ static const struct file_operations musbstatic int musb_test_mode_open (struct inode *inode,struct file *file) { - file->private_data = inode->i_private; -return single_open (file, musb_test_mode_show, inode->i_private); }static ssize_t musb_test_mode_write (struct file *file,const char __user *ubuf,size_t count,loff_t *ppos) { -struct musb *musb = file->private_data; +struct seq_file *s = file->private_data; +struct musb *musb = s->private;u8 test =0 ;char buf[18 ];
PATCH 2/80 USB: serial/mos*: prevent reading uninitialized stack memory
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <[email protected]>
commit a0846f1868b11cd827bdfeaf4527d8b1b1c0b098 upstream.
The TIOCGICOUNT device ioctl in both mos7720.c and mos7840.c allows unprivileged users to read uninitialized stack memory, because the "reserved" member of the serial_icounter_struct struct declared on the stack is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/usb/serial/mos7720.c | 3 +++ drivers/usb/serial/mos7840.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/usb/serial/mos7720.c +3 -0
@@ -2024,6 +2024,9 @@ static int mos7720_ioctl(struct tty_strucase TIOCGICOUNT : cnow = mos7720_port->icount; + +memset (&icount,0 ,sizeof (struct serial_icounter_struct )); + icount.cts = cnow.cts; icount.dsr = cnow.dsr; icount.rng = cnow.rng;
drivers/usb/serial/mos7840.c +3 -0
@@ -2285,6 +2285,9 @@ static int mos7840_ioctl(struct tty_strucase TIOCGICOUNT : cnow = mos7840_port->icount;smp_rmb (); + +memset (&icount,0 ,sizeof (struct serial_icounter_struct )); + icount.cts = cnow.cts; icount.dsr = cnow.dsr; icount.rng = cnow.rng;
PATCH 3/80 bridge: Clear INET control block of SKBs passed into ip_fragment().
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: David S. Miller <[email protected]>
[ Upstream commit 4ce6b9e1621c187a32a47a17bf6be93b1dc4a3df ]
In a similar vain to commit 17762060c25590bfddd68cc1131f28ec720f405f ("bridge: Clear IPCB before possible entry into IP stack")
Any time we call into the IP stack we have to make sure the state there is as expected by the ipv4 code.
With help from Eric Dumazet and Herbert Xu.
--- net/bridge/br_netfilter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/bridge/br_netfilter.c +4 -2
@@ -749,9 +749,11 @@ static int br_nf_dev_queue_xmit(struct s {if (skb->nfct !=NULL && skb->protocol ==htons (ETH_P_IP ) && skb->len +nf_bridge_mtu_reduction (skb) > skb->dev->mtu && - !skb_is_gso (skb)) + !skb_is_gso (skb)) { +/* BUG: Should really parse the IP options here. */ +memset (IPCB (skb),0 ,sizeof (struct inet_skb_parm ));return ip_fragment (skb, br_dev_queue_push_xmit); -else + }else return br_dev_queue_push_xmit (skb); }#else
PATCH 4/80 gro: fix different skb headrooms
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 3d3be4333fdf6faa080947b331a6a19bce1a4f57 ]
Packets entering GRO might have different headrooms, even for a given flow (because of implementation details in drivers, like copybreak). We cant force drivers to deliver packets with a fixed headroom.
1) fix skb_segment()
skb_segment() makes the false assumption headrooms of fragments are same than the head. When CHECKSUM_PARTIAL is used, this can give csum_start errors, and crash later in skb_copy_and_csum_dev()
2) allocate a minimal skb for head of frag_list
skb_gro_receive() uses netdev_alloc_skb(headroom + skb_gro_offset(p)) to allocate a fresh skb. This adds NET_SKB_PAD to a padding already provided by netdevice, depending on various things, like copybreak.
Use alloc_skb() to allocate an exact padding, to reduce cache line needs:NET_SKB_PAD + NET_IP_ALIGN
bugzilla : https://bugzilla.kernel.org/show_bug.cgi?id=16626
Many thanks to Plamen Petrov, testing many debugging patches ! With help of Jarek Poplawski.
--- net/core/skbuff.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/core/skbuff.c +6 -2
@@ -2574,6 +2574,10 @@ struct sk_buff *skb_segment(struct sk_bu__copy_skb_header (nskb, skb); nskb->mac_len = skb->mac_len; +/* nskb and skb might have different headroom */ +if (nskb->ip_summed ==CHECKSUM_PARTIAL ) + nskb->csum_start +=skb_headroom (nskb) - headroom; +skb_reset_mac_header (nskb);skb_set_network_header (nskb, skb->mac_len); nskb->transport_header = (nskb->network_header +
@@ -2703,8 +2707,8 @@ int skb_gro_receive(struct sk_buff **hea }else if (skb_gro_len (p) != pinfo->gso_size)return -E2BIG ; - headroom =skb_headroom (p); - nskb =netdev_alloc_skb (p->dev, headroom +skb_gro_offset (p)); + headroom =NET_SKB_PAD +NET_IP_ALIGN ; + nskb =alloc_skb (headroom +skb_gro_offset (p),GFP_ATOMIC );if (unlikely (!nskb))return -ENOMEM ;
PATCH 5/80 gro: Re-fix different skb headrooms
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jarek Poplawski <[email protected]>
[ Upstream commit 64289c8e6851bca0e589e064c9a5c9fbd6ae5dd4 ]
The patch: "gro: fix different skb headrooms" in its part:
"2) allocate a minimal skb for head of frag_list" is buggy. The copied skb has p->data set at the ip header at the moment, and skb_gro_offset is the length of ip + tcp headers. So, after the change the length of mac header is skipped. Later skb_set_mac_header() sets it into the NET_SKB_PAD area (if it's long enough) and ip header is misaligned at NET_SKB_PAD + NET_IP_ALIGN offset. There is no reason to assume the original skb was wrongly allocated, so let's copy it as it was.
bugzilla : https://bugzilla.kernel.org/show_bug.cgi?id=16626
fixes commit: 3d3be4333fdf6faa080947b331a6a19bce1a4f57
--- net/core/skbuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/skbuff.c +1 -1
@@ -2707,7 +2707,7 @@ int skb_gro_receive(struct sk_buff **hea }else if (skb_gro_len (p) != pinfo->gso_size)return -E2BIG ; - headroom =NET_SKB_PAD +NET_IP_ALIGN ; + headroom =skb_headroom (p); nskb =alloc_skb (headroom +skb_gro_offset (p),GFP_ATOMIC );if (unlikely (!nskb))return -ENOMEM ;
PATCH 6/80 irda: Correctly clean up self->ias_obj on irda_bind() failure.
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: David S. Miller <[email protected]>
[ Upstream commit 628e300cccaa628d8fb92aa28cb7530a3d5f2257 ]
If irda_open_tsap() fails, the irda_bind() code tries to destroy the ->ias_obj object by hand, but does so wrongly.
In particular, it fails to a) release the hashbin attached to the object and b) reset the self->ias_obj pointer to NULL.
Fix both problems by using irias_delete_object() and explicitly setting self->ias_obj to NULL, just as irda_release() does.
--- net/irda/af_irda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/irda/af_irda.c +2 -2
@@ -824,8 +824,8 @@ static int irda_bind(struct socket *sock err =irda_open_tsap (self, addr->sir_lsap_sel, addr->sir_name);if (err <0 ) { -kfree (self->ias_obj->name); -kfree (self->ias_obj); +irias_delete_object (self->ias_obj); + self->ias_obj =NULL ; goto out; }
PATCH 7/80 rds: fix a leak of kernel memory
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit f037590fff3005ce8a1513858d7d44f50053cc8f ]
struct rds_rdma_notify contains a 32 bits hole on 64bit arches, make sure it is zeroed before copying it to user.
--- net/rds/recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/recv.c +1 -1
@@ -297,7 +297,7 @@ static int rds_still_queued(struct rds_sint rds_notify_queue_get (struct rds_sock *rs,struct msghdr *msghdr) {struct rds_notifier *notifier; -struct rds_rdma_notify cmsg; +struct rds_rdma_notify cmsg = {0 };/* fill holes with zero */ unsigned int count =0 , max_messages = ~0U ;unsigned long flags;LIST_HEAD (copy);
PATCH 8/80 net: RPS needs to depend upon USE_GENERIC_SMP_HELPERS
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: David S. Miller <[email protected]>
[ Upstream commit 6dcbc12290abb452a5e42713faa6461b248e2f55 ]
You cannot invoke __smp_call_function_single() unless the architecture sets this symbol.
--- net/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/Kconfig +1 -1
@@ -206,7 +206,7 @@ source "net/dcb/Kconfig" config RPS boolean - depends on SMP && SYSFS + depends on SMP && SYSFS && USE_GENERIC_SMP_HELPERS default y menu "Network testing"
PATCH 9/80 tcp: Combat per-cpu skew in orphan tests.
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: David S. Miller <[email protected]>
[ Upstream commit ad1af0fedba14f82b240a03fe20eb9b2fdbd0357 ]
As reported by Anton Blanchard when we use percpu_counter_read_positive() to make our orphan socket limit checks, the check can be off by up to num_cpus_online() * batch (which is 32 by default) which on a 128 cpu machine can be as large as the default orphan limit itself.
Fix this by doing the full expensive sum check if the optimized check triggers.
--- include/net/tcp.h | 18 ++++++++++++++---- net/ipv4/tcp.c | 5 +---- net/ipv4/tcp_timer.c | 8 ++++---- 3 files changed, 19 insertions(+), 12 deletions(-)
include/net/tcp.h +14 -4
@@ -268,11 +268,21 @@ static inline int between(__u32 seq1, __return seq3 - seq2 >= seq1 - seq2; } -static inline int tcp_too_many_orphans (struct sock *sk,int num) +static inline bool tcp_too_many_orphans (struct sock *sk,int shift) { -return (num > sysctl_tcp_max_orphans) || - (sk->sk_wmem_queued >SOCK_MIN_SNDBUF && -atomic_read (&tcp_memory_allocated) > sysctl_tcp_mem[2 ]); +struct percpu_counter *ocp = sk->sk_prot->orphan_count; +int orphans =percpu_counter_read_positive (ocp); + +if (orphans << shift > sysctl_tcp_max_orphans) { + orphans =percpu_counter_sum_positive (ocp); +if (orphans << shift > sysctl_tcp_max_orphans) +return true; + } + +if (sk->sk_wmem_queued >SOCK_MIN_SNDBUF && +atomic_read (&tcp_memory_allocated) > sysctl_tcp_mem[2 ]) +return true; +return false; }/* syncookies: remember time of last synqueue overflow */
net/ipv4/tcp.c +1 -4
@@ -2002,11 +2002,8 @@ adjudge_to_death: } }if (sk->sk_state !=TCP_CLOSE ) { -int orphan_count =percpu_counter_read_positive ( - sk->sk_prot->orphan_count); -sk_mem_reclaim (sk); -if (tcp_too_many_orphans (sk, orphan_count)) { +if (tcp_too_many_orphans (sk,0 )) {if (net_ratelimit ())printk (KERN_INFO "TCP: too many of orphaned " "sockets\n" );
net/ipv4/tcp_timer.c +4 -4
@@ -67,18 +67,18 @@ static void tcp_write_err(struct sock *sstatic int tcp_out_of_resources (struct sock *sk,int do_reset) {struct tcp_sock *tp =tcp_sk (sk); -int orphans =percpu_counter_read_positive (&tcp_orphan_count); +int shift =0 ;/* If peer does not open window for long time, or did not transmit * anything for long time, penalize it. */ if ((s32)(tcp_time_stamp - tp->lsndtime) >2 *TCP_RTO_MAX || !do_reset) - orphans <<=1 ; + shift++;/* If some dubious ICMP arrived, penalize even more. */ if (sk->sk_err_soft) - orphans <<=1 ; + shift++; -if (tcp_too_many_orphans (sk, orphans)) { +if (tcp_too_many_orphans (sk, shift)) {if (net_ratelimit ())printk (KERN_INFO "Out of socket memory\n" );
PATCH 10/80 tcp: fix three tcp sysctls tuning
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit c5ed63d66f24fd4f7089b5a6e087b0ce7202aa8e ]
As discovered by Anton Blanchard, current code to autotune tcp_death_row.sysctl_max_tw_buckets, sysctl_tcp_max_orphans and sysctl_max_syn_backlog makes little sense.
The bigger a page is, the less tcp_max_orphans is : 4096 on a 512GB machine in Anton's case.
(tcp_hashinfo.bhash_size * sizeof(struct inet_bind_hashbucket)) is much bigger if spinlock debugging is on. Its wrong to select bigger limits in this case (where kernel structures are also bigger)
bhash_size max is 65536, and we get this value even for small machines.
A better ground is to use size of ehash table, this also makes code shorter and more obvious.
Based on a patch from Anton, and another from David.
--- net/ipv4/tcp.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-)
net/ipv4/tcp.c +7 -17
@@ -3193,7 +3193,7 @@ void __init tcp_init(void) {struct sk_buff *skb =NULL ;unsigned long nr_pages, limit; -int order, i, max_share; +int i, max_share, cnt;unsigned long jiffy = jiffies;BUILD_BUG_ON (sizeof (struct tcp_skb_cb ) >sizeof (skb->cb));
@@ -3242,22 +3242,12 @@ void __init tcp_init(void)INIT_HLIST_HEAD (&tcp_hashinfo.bhash[i].chain); } -/* Try to be a bit smarter and adjust defaults depending -* on available memory. -*/ -for (order =0 ; ((1 << order) <<PAGE_SHIFT ) < - (tcp_hashinfo.bhash_size *sizeof (struct inet_bind_hashbucket )); - order++) - ; -if (order >=4 ) { - tcp_death_row.sysctl_max_tw_buckets =180000 ; - sysctl_tcp_max_orphans =4096 << (order -4 ); - sysctl_max_syn_backlog =1024 ; - }else if (order <3 ) { - tcp_death_row.sysctl_max_tw_buckets >>= (3 - order); - sysctl_tcp_max_orphans >>= (3 - order); - sysctl_max_syn_backlog =128 ; - } + + cnt = tcp_hashinfo.ehash_mask +1 ; + + tcp_death_row.sysctl_max_tw_buckets = cnt /2 ; + sysctl_tcp_max_orphans = cnt /2 ; + sysctl_max_syn_backlog =max (128 , cnt /256 );/* Set the pressure threshold to be a fraction of global memory that * is up to 1/2 at 256 MB, decreasing toward zero with the amount of
PATCH 11/80 tcp: select(writefds) dont hang up when a peer close connection
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: KOSAKI Motohiro <[email protected]>
[ Upstream commit d84ba638e4ba3c40023ff997aa5e8d3ed002af36 ]
This issue come from ruby language community. Below test program hang up when only run on Linux.
% uname -mrsv
Linux 2.6.26-2-486 #1 Sat Dec 26 08:37:39 UTC 2009 i686
% ruby -rsocket -ve '
BasicSocket.do_not_reverse_lookup = true
serv = TCPServer.open("127.0.0.1", 0)
s1 = TCPSocket.open("127.0.0.1", serv.addr[1])
s2 = serv.accept
s2.close
s1.write("a") rescue p $!
s1.write("a") rescue p $!
Thread.new {
s1.write("a")
}.join'
ruby 1.9.3dev (2010-07-06 trunk 28554) [i686-linux]
#<Errno::EPIPE: Broken pipe>
[Hang Here]FreeBSD, Solaris, Mac doesn't. because Ruby's write() method call select() internally. and tcp_poll has a bug.
SUS defined 'ready for writing' of select() as following.
| A descriptor shall be considered ready for writing when a call to an output | function with O_NONBLOCK clear would not block, whether or not the function | would transfer data successfully.
That said, EPIPE situation is clearly one of 'ready for writing'.
We don't have read-side issue because tcp_poll() already has read side shutdown care.
| if (sk->sk_shutdown & RCV_SHUTDOWN)
| mask |= POLLIN | POLLRDNORM | POLLRDHUP;
So, Let's insert same logic in write side.
- reference url
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/31065
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/31068
--- net/ipv4/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/tcp.c +2 -1
@@ -453,7 +453,8 @@ unsigned int tcp_poll(struct file *file,if (sk_stream_wspace (sk) >=sk_stream_min_wspace (sk)) mask |=POLLOUT |POLLWRNORM ; } - } + }else + mask |=POLLOUT |POLLWRNORM ;if (tp->urg_data &TCP_URG_VALID ) mask |=POLLPRI ;
PATCH 12/80 tcp: Prevent overzealous packetization by SWS logic.
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alexey Kuznetsov <[email protected]>
[ Upstream commit 01f83d69844d307be2aa6fea88b0e8fe5cbdb2f4 ]
If peer uses tiny MSS (say, 75 bytes) and similarly tiny advertised window, the SWS logic will packetize to half the MSS unnecessarily.
This causes problems with some embedded devices.
However for large MSS devices we do want to half-MSS packetize otherwise we never get enough packets into the pipe for things like fast retransmit and recovery to work.
Be careful also to handle the case where MSS > window, otherwise we'll never send until the probe timer.
--- include/net/tcp.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
include/net/tcp.h +16 -2
@@ -519,8 +519,22 @@ extern unsigned int tcp_current_mss(stru/* Bound MSS / TSO packet size with the half of the window */ static inline int tcp_bound_to_half_wnd (struct tcp_sock *tp,int pktsize) { -if (tp->max_window && pktsize > (tp->max_window >>1 )) -return max (tp->max_window >>1 ,68U - tp->tcp_header_len); +int cutoff; + +/* When peer uses tiny windows, there is no use in packetizing +* to sub-MSS pieces for the sake of SWS or making sure there +* are enough packets in the pipe for fast recovery. +* +* On the other hand, for extremely large MSS devices, handling +* smaller than MSS windows in this way does make sense. +*/ +if (tp->max_window >=512 ) + cutoff = (tp->max_window >>1 ); +else + cutoff = tp->max_window; + +if (cutoff && pktsize > cutoff) +return max_t (int, cutoff,68U - tp->tcp_header_len);else return pktsize; }
PATCH 13/80 udp: add rehash on connect()
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Dumazet <[email protected]>
commit 719f835853a92f6090258114a72ffe41f09155cd upstream
commit 30fff923 introduced in linux-2.6.33 (udp: bind() optimisation) added a secondary hash on UDP, hashed on (local addr, local port).
Problem is that following sequence :
fd = socket(...)connect(fd, &remote, ...)
not only selects remote end point (address and port), but also sets local address, while UDP stack stored in secondary hash table the socket while its local address was INADDR_ANY (or ipv6 equivalent)
Sequence is :
- autobind() : choose a random local port, insert socket in hash tables [while local address is INADDR_ANY]
- connect() : set remote address and port, change local address to IP given by a route lookup.
When an incoming UDP frame comes, if more than 10 sockets are found in primary hash table, we switch to secondary table, and fail to find socket because its local address changed.
One solution to this problem is to rehash datagram socket if needed.
We add a new rehash(struct socket *) method in "struct proto", and implement this method for UDP v4 & v6, using a common helper.
This rehashing only takes care of secondary hash table, since primary hash (based on local port only) is not changed.
--- include/net/sock.h | 1 + include/net/udp.h | 1 + net/ipv4/datagram.c | 5 ++++- net/ipv4/udp.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ net/ipv6/datagram.c | 7 ++++++- net/ipv6/udp.c | 10 ++++++++++ 6 files changed, 66 insertions(+), 2 deletions(-)
include/net/sock.h +1 -0
@@ -749,6 +749,7 @@ struct proto {/* Keeping track of sk's, looking them up, and port selection methods. */ void (*hash)(struct sock *sk);void (*unhash)(struct sock *sk); +void (*rehash)(struct sock *sk);int (*get_port)(struct sock *sk,unsigned short snum);/* Keeping track of sockets in use */
include/net/udp.h +1 -0
@@ -151,6 +151,7 @@ static inline void udp_lib_hash(struct s }extern void udp_lib_unhash (struct sock *sk); +extern void udp_lib_rehash (struct sock *sk,u16 new_hash);static inline void udp_lib_close (struct sock *sk,long timeout) {
net/ipv4/datagram.c +4 -1
@@ -62,8 +62,11 @@ int ip4_datagram_connect(struct sock *sk }if (!inet->inet_saddr) inet->inet_saddr = rt->rt_src;/* Update source address */ -if (!inet->inet_rcv_saddr) +if (!inet->inet_rcv_saddr) { inet->inet_rcv_saddr = rt->rt_src; +if (sk->sk_prot->rehash) + sk->sk_prot->rehash (sk); + } inet->inet_daddr = rt->rt_dst; inet->inet_dport = usin->sin_port; sk->sk_state =TCP_ESTABLISHED ;
net/ipv4/udp.c +44 -0
56 lines not on this page · raw message
net/ipv6/datagram.c +6 -1
@@ -104,9 +104,12 @@ ipv4_connected:if (ipv6_addr_any (&np->saddr))ipv6_addr_set_v4mapped (inet->inet_saddr, &np->saddr); -if (ipv6_addr_any (&np->rcv_saddr)) +if (ipv6_addr_any (&np->rcv_saddr)) {ipv6_addr_set_v4mapped (inet->inet_rcv_saddr, &np->rcv_saddr); +if (sk->sk_prot->rehash) + sk->sk_prot->rehash (sk); + } goto out; }
@@ -191,6 +194,8 @@ ipv4_connected:if (ipv6_addr_any (&np->rcv_saddr)) {ipv6_addr_copy (&np->rcv_saddr, &fl.fl6_src); inet->inet_rcv_saddr =LOOPBACK4_IPV6 ; +if (sk->sk_prot->rehash) + sk->sk_prot->rehash (sk); } ip6_dst_store(sk, dst,
net/ipv6/udp.c +10 -0
@@ -111,6 +111,15 @@ int udp_v6_get_port(struct sock *sk, unsreturn udp_lib_get_port (sk, snum, ipv6_rcv_saddr_equal, hash2_nulladdr); } +static void udp_v6_rehash (struct sock *sk) +{ +u16 new_hash =udp6_portaddr_hash (sock_net (sk), + &inet6_sk (sk)->rcv_saddr, +inet_sk (sk)->inet_num); + +udp_lib_rehash (sk, new_hash); +} + static inline int compute_score(struct sock *sk, struct net *net, unsigned short hnum, struct in6_addr *saddr, __be16 sport,
@@ -1452,6 +1461,7 @@ struct proto udpv6_prot = { .backlog_rcv = udpv6_queue_rcv_skb, .hash = udp_lib_hash, .unhash = udp_lib_unhash, + .rehash = udp_v6_rehash, .get_port = udp_v6_get_port, .memory_allocated = &udp_memory_allocated, .sysctl_mem = sysctl_udp_mem,
PATCH 14/80 UNIX: Do not loop forever at unix_autobind().
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit a9117426d0fcc05a194f728159a2d43df43c7add ]
We assumed that unix_autobind() never fails if kzalloc() succeeded. But unix_autobind() allows only 1048576 names. If /proc/sys/fs/file-max is larger than 1048576 (e.g. systems with more than 10GB of RAM), a local user can consume all names using fork()/socket()/bind().
If all names are in use, those who call bind() with addr_len == sizeof(short) or connect()/sendmsg() with setsockopt(SO_PASSCRED) will continue
while (1)
yield();loop at unix_autobind() till a name becomes available.
This patch adds a loop counter in order to give up after 1048576 attempts.
Calling yield() for once per 256 attempts may not be sufficient when many names are already in use, for __unix_find_socket_byname() can take long time under such circumstance. Therefore, this patch also adds cond_resched() call.
Note that currently a local user can consume 2GB of kernel memory if the user is allowed to create and autobind 1048576 UNIX domain sockets. We should consider adding some restriction for autobind operation.
--- net/unix/af_unix.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
net/unix/af_unix.c +12 -3
@@ -673,6 +673,7 @@ static int unix_autobind(struct socket *static u32 ordernum =1 ;struct unix_address *addr;int err; +unsigned int retries =0 ;mutex_lock (&u->readlock);
@@ -698,9 +699,17 @@ retry:if (__unix_find_socket_byname (net, addr->name, addr->len, sock->type, addr->hash)) {spin_unlock (&unix_table_lock); -/* Sanity yield. It is unusual case, but yet... */ -if (!(ordernum&0xFF )) -yield (); +/* +* __unix_find_socket_byname() may take long time if many names +* are already in use. +*/ +cond_resched (); +/* Give up if all names seems to be in use. */ +if (retries++ ==0xFFFFF ) { + err = -ENOSPC ; +kfree (addr); + goto out; + } goto retry; } addr->hash ^= sk->sk_type;
PATCH 15/80 l2tp: test for ethernet header in l2tp_eth_dev_recv()
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit bfc960a8eec023a170a80697fe65157cd4f44f81 ]
close https://bugzilla.kernel.org/show_bug.cgi?id=16529
Before calling dev_forward_skb(), we should make sure skb head contains at least an ethernet header, even if length included in upper layer said so. Use pskb_may_pull() to make sure this ethernet header is present in skb head.
--- net/l2tp/l2tp_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/l2tp/l2tp_eth.c +1 -1
@@ -132,7 +132,7 @@ static void l2tp_eth_dev_recv(struct l2tprintk ("\n" ); } -if (data_len <ETH_HLEN ) +if (!pskb_may_pull (skb,sizeof (ETH_HLEN ))) goto error;secpath_reset (skb);
PATCH 16/80 net: blackhole route should always be recalculated
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jianzhao Wang <[email protected]>
[ Upstream commit ae2688d59b5f861dc70a091d003773975d2ae7fb ]
Blackhole routes are used when xfrm_lookup() returns -EREMOTE (error triggered by IKE for example), hence this kind of route is always temporary and so we should check if a better route exists for next packets.
Bug has been introduced by commit d11a4dc18bf41719c9f0d7ed494d295dd2973b92.
--- net/ipv4/route.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/ipv4/route.c +6 -1
@@ -2741,6 +2741,11 @@ slow_output:EXPORT_SYMBOL_GPL (__ip_route_output_key); +static struct dst_entry *ipv4_blackhole_dst_check (struct dst_entry *dst,u32 cookie) +{ +return NULL ; +} +static void ipv4_rt_blackhole_update_pmtu (struct dst_entry *dst,u32 mtu) { }
@@ -2749,7 +2754,7 @@ static struct dst_ops ipv4_dst_blackhole .family = AF_INET, .protocol = cpu_to_be16(ETH_P_IP), .destroy = ipv4_dst_destroy, - .check = ipv4_dst_check, + .check = ipv4_blackhole_dst_check, .update_pmtu = ipv4_rt_blackhole_update_pmtu, .entries = ATOMIC_INIT(0), };
PATCH 17/80 sparc64: Get rid of indirect p1275 PROM call buffer.
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: David S. Miller <[email protected]>
[ Upstream commit 25edd6946a1d74e5e77813c2324a0908c68bcf9e ]
This is based upon a report by Meelis Roos showing that it's possible that we'll try to fetch a property that is 32K in size with some devices. With the current fixed 3K buffer we use for moving data in and out of the firmware during PROM calls, that simply won't work.
In fact, it will scramble random kernel data during bootup.
The reasoning behind the temporary buffer is entirely historical. It used to be the case that we had problems referencing dynamic kernel memory (including the stack) early in the boot process before we explicitly told the firwmare to switch us over to the kernel trap table.
So what we did was always give the firmware buffers that were locked into the main kernel image.
But we no longer have problems like that, so get rid of all of this indirect bounce buffering.
Besides fixing Meelis's bug, this also makes the kernel data about 3K smaller.
It was also discovered during these conversions that the implementation of prom_retain() was completely wrong, so that was fixed here as well. Currently that interface is not in use.
--- arch/sparc/include/asm/oplib_64.h | 27 --- arch/sparc/prom/cif.S | 16 - arch/sparc/prom/console_64.c | 48 ++++- arch/sparc/prom/devops_64.c | 36 +++- arch/sparc/prom/misc_64.c | 314 ++++++++++++++++++++++++++------------ arch/sparc/prom/p1275.c | 102 ------------ arch/sparc/prom/tree_64.c | 210 ++++++++++++++++++------- 7 files changed, 456 insertions(+), 297 deletions(-)
arch/sparc/include/asm/oplib_64.h +3 -24
@@ -185,9 +185,8 @@ extern int prom_getunumber(int syndrome_ char *buf, int buflen);/* Retain physical memory to the caller across soft resets. */ -extern unsigned long prom_retain (const char *name, -unsigned long pa_low,unsigned long pa_high, -long size,long align); +extern int prom_retain (const char *name,unsigned long size, +unsigned long align,unsigned long *paddr);/* Load explicit I/D TLB entries into the calling processor. */ extern long prom_itlb_load(unsigned long index,
@@ -287,26 +286,6 @@ extern void prom_sun4v_guest_soft_state(extern int prom_ihandle2path (int handle,char *buffer,int bufsize);/* Client interface level routines. */ -extern long p1275_cmd (const char *,long , ...); - -#if 0 -#define P1275_SIZE (x) ((((long)((x) / 32)) << 32) | (x)) -#else -#define P1275_SIZE (x) x -#endif - -/* We support at most 16 input and 1 output argument */ -#define P1275_ARG_NUMBER 0 -#define P1275_ARG_IN_STRING 1 -#define P1275_ARG_OUT_BUF 2 -#define P1275_ARG_OUT_32B 3 -#define P1275_ARG_IN_FUNCTION 4 -#define P1275_ARG_IN_BUF 5 -#define P1275_ARG_IN_64B 6 - -#define P1275_IN (x) ((x) & 0xf) -#define P1275_OUT (x) (((x) << 4) & 0xf0) -#define P1275_INOUT (i,o) (P1275_IN(i)|P1275_OUT(o)) -#define P1275_ARG (n,x) ((x) << ((n)*3 + 8)) +extern void p1275_cmd_direct (unsigned long *);#endif /* !(__SPARC64_OPLIB_H) */
arch/sparc/prom/cif.S +8 -8
@@ -9,18 +9,18 @@ #include <asm/thread_info.h> .text - .globl prom_cif_interface -prom_cif_interface: - sethi %hi(p1275buf), %o0 - or %o0, %lo(p1275buf), %o0 - ldx [%o0 + 0x010], %o1 ! prom_cif_stack - save %o1, -192, %sp - ldx [%i0 + 0x008], %l2 ! prom_cif_handler + .globl prom_cif_direct +prom_cif_direct: + sethi %hi(p1275buf), %o1 + or %o1, %lo(p1275buf), %o1 + ldx [%o1 + 0x0010], %o2 ! prom_cif_stack + save %o2, -192, %sp + ldx [%i1 + 0x0008], %l2 ! prom_cif_handler mov %g4, %l0 mov %g5, %l1 mov %g6, %l3 call %l2 - add %i0, 0x018, %o0 ! prom_args + mov %i0, %o0 ! prom_args mov %l0, %g4 mov %l1, %g5 mov %l3, %g6
arch/sparc/prom/console_64.c +37 -11
70 lines not on this page · raw message
arch/sparc/prom/devops_64.c +31 -5
@@ -18,16 +18,32 @@int prom_devopen (const char *dstr) { -return p1275_cmd ("open" ,P1275_ARG (0 ,P1275_ARG_IN_STRING )| -P1275_INOUT (1 ,1 ), - dstr); +unsigned long args[5 ]; + + args[0 ] = (unsigned long )"open" ; + args[1 ] =1 ; + args[2 ] =1 ; + args[3 ] = (unsigned long ) dstr; + args[4 ] = (unsigned long )-1 ; + +p1275_cmd_direct (args); + +return (int ) args[4 ]; }/* Close the device described by device handle 'dhandle'. */ int prom_devclose (int dhandle) { -p1275_cmd ("close" ,P1275_INOUT (1 ,0 ), dhandle); +unsigned long args[4 ]; + + args[0 ] = (unsigned long )"close" ; + args[1 ] =1 ; + args[2 ] =0 ; + args[3 ] = (unsigned int ) dhandle; + +p1275_cmd_direct (args); +return 0 ; }
@@ -37,5 +53,15 @@ prom_devclose(int dhandle)void prom_seek (int dhandle,unsigned int seekhi,unsigned int seeklo) { -p1275_cmd ("seek" ,P1275_INOUT (3 ,1 ), dhandle, seekhi, seeklo); +unsigned long args[7 ]; + + args[0 ] = (unsigned long )"seek" ; + args[1 ] =3 ; + args[2 ] =1 ; + args[3 ] = (unsigned int ) dhandle; + args[4 ] = seekhi; + args[5 ] = seeklo; + args[6 ] = (unsigned long )-1 ; + +p1275_cmd_direct (args); }
arch/sparc/prom/misc_64.c +220 -94
464 lines not on this page · raw message
arch/sparc/prom/p1275.c +3 -99
130 lines not on this page · raw message
arch/sparc/prom/tree_64.c +154 -56
354 lines not on this page · raw message
PATCH 18/80 drivers/net/usb/hso.c: prevent reading uninitialized memory
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <[email protected]>
commit 7011e660938fc44ed86319c18a5954e95a82ab3e upstream.
Fixed formatting (tabs and line breaks).
The TIOCGICOUNT device ioctl allows unprivileged users to read uninitialized stack memory, because the "reserved" member of the serial_icounter_struct struct declared on the stack in hso_get_count() is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/net/usb/hso.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/usb/hso.c +2 -0
@@ -1653,6 +1653,8 @@ static int hso_get_count(struct hso_seristruct uart_icount cnow;struct hso_tiocmget *tiocmget = serial->tiocmget; +memset (&icount,0 ,sizeof (struct serial_icounter_struct )); +if (!tiocmget)return -ENOENT ;spin_lock_irq (&serial->serial_lock);
PATCH 19/80 drivers/net/cxgb3/cxgb3_main.c: prevent reading uninitialized stack memory
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <[email protected]>
commit 49c37c0334a9b85d30ab3d6b5d1acb05ef2ef6de upstream.
Fixed formatting (tabs and line breaks).
The CHELSIO_GET_QSET_NUM device ioctl allows unprivileged users to read 4 bytes of uninitialized stack memory, because the "addr" member of the ch_reg struct declared on the stack in cxgb_extension_ioctl() is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/net/cxgb3/cxgb3_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/cxgb3/cxgb3_main.c +2 -0
@@ -2296,6 +2296,8 @@ static int cxgb_extension_ioctl(struct ncase CHELSIO_GET_QSET_NUM :{struct ch_reg edata; +memset (&edata,0 ,sizeof (struct ch_reg )); + edata.cmd =CHELSIO_GET_QSET_NUM ; edata.val = pi->nqsets;if (copy_to_user (useraddr, &edata,sizeof (edata)))
PATCH 20/80 drivers/net/eql.c: prevent reading uninitialized stack memory
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <[email protected]>
commit 44467187dc22fdd33a1a06ea0ba86ce20be3fe3c upstream.
Fixed formatting (tabs and line breaks).
The EQL_GETMASTRCFG device ioctl allows unprivileged users to read 16 bytes of uninitialized stack memory, because the "master_name" member of the master_config_t struct declared on the stack in eql_g_master_cfg() is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/net/eql.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/eql.c +2 -0
@@ -555,6 +555,8 @@ static int eql_g_master_cfg(struct net_dequalizer_t *eql;master_config_t mc; +memset (&mc,0 ,sizeof (master_config_t)); +if (eql_is_master (dev)) { eql =netdev_priv (dev); mc.max_slaves = eql->max_slaves;
PATCH 21/80 bonding: correctly process non-linear skbs
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andy Gospodarek <[email protected]>
commit ab12811c89e88f2e66746790b1fe4469ccb7bdd9 upstream.
It was recently brought to my attention that 802.3ad mode bonds would no longer form when using some network hardware after a driver update. After snooping around I realized that the particular hardware was using page-based skbs and found that skb->data did not contain a valid LACPDU as it was not stored there. That explained the inability to form an 802.3ad-based bond. For balance-alb mode bonds this was also an issue as ARPs would not be properly processed.
This patch fixes the issue in my tests and should be applied to 2.6.36 and as far back as anyone cares to add it to stable.
Thanks to Alexander Duyck <[email protected]> and Jesse Brandeburg <[email protected]> for the suggestions on this one.
--- drivers/net/bonding/bond_3ad.c | 3 +++ drivers/net/bonding/bond_alb.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/net/bonding/bond_3ad.c +3 -0
@@ -2466,6 +2466,9 @@ int bond_3ad_lacpdu_recv(struct sk_buffif (!(dev->flags &IFF_MASTER )) goto out; +if (!pskb_may_pull (skb,sizeof (struct lacpdu ))) + goto out; +read_lock (&bond->lock); slave =bond_get_slave_by_dev ((struct bonding *)netdev_priv (dev), orig_dev);
drivers/net/bonding/bond_alb.c +3 -0
@@ -369,6 +369,9 @@ static int rlb_arp_recv(struct sk_buff * goto out; } +if (!pskb_may_pull (skb,arp_hdr_len (bond_dev))) + goto out; +if (skb->len <sizeof (struct arp_pkt )) {pr_debug ("Packet is too small to be an ARP\n" ); goto out;
PATCH 22/80 Staging: vt6655: fix buffer overflow
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Carpenter <[email protected]>
commit dd173abfead903c7df54e977535973f3312cd307 upstream.
"param->u.wpa_associate.wpa_ie_len" comes from the user. We should check it so that the copy_from_user() doesn't overflow the buffer.
Also further down in the function, we assume that if "param->u.wpa_associate.wpa_ie_len" is set then "abyWPAIE[0]" is initialized. To make that work, I changed the test here to say that if "wpa_ie_len" is set then "wpa_ie" has to be a valid pointer or we return -EINVAL.
Oddly, we only use the first element of the abyWPAIE[] array. So I suspect there may be some other issues in this function.
--- drivers/staging/vt6655/wpactl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/staging/vt6655/wpactl.c +8 -3
@@ -766,9 +766,14 @@ static int wpa_set_associate(PSDevice pDDBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "wpa_ie_len = %d\n" , param->u.wpa_associate.wpa_ie_len); -if (param->u.wpa_associate.wpa_ie && -copy_from_user (&abyWPAIE[0 ], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len)) -return -EINVAL ; +if (param->u.wpa_associate.wpa_ie_len) { +if (!param->u.wpa_associate.wpa_ie) +return -EINVAL ; +if (param->u.wpa_associate.wpa_ie_len >sizeof (abyWPAIE)) +return -EINVAL ; +if (copy_from_user (&abyWPAIE[0 ], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len)) +return -EFAULT ; + }if (param->u.wpa_associate.mode ==1 ) pMgmt->eConfigMode =WMAC_CONFIG_IBSS_STA ;
PATCH 23/80 net/llc: make opt unsigned in llc_ui_setsockopt()
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Carpenter <[email protected]>
commit 339db11b219f36cf7da61b390992d95bb6b7ba2e upstream.
The members of struct llc_sock are unsigned so if we pass a negative value for "opt" it can cause a sign bug. Also it can cause an integer overflow when we multiply "opt * HZ".
--- net/llc/af_llc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/llc/af_llc.c +2 -1
@@ -1024,7 +1024,8 @@ static int llc_ui_setsockopt(struct sock {struct sock *sk = sock->sk;struct llc_sock *llc =llc_sk (sk); -int rc = -EINVAL , opt; +unsigned int opt; +int rc = -EINVAL ;lock_sock (sk);if (unlikely (level !=SOL_LLC || optlen !=sizeof (int )))
PATCH 24/80 mm: fix swapin race condition
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 4969c1192d15afa3389e7ae3302096ff684ba655 upstream.
The pte_same check is reliable only if the swap entry remains pinned (by the page lock on swapcache). We've also to ensure the swapcache isn't removed before we take the lock as try_to_free_swap won't care about the page pin.
One of the possible impacts of this patch is that a KSM-shared page can point to the anon_vma of another process, which could exit before the page is freed.
This can leave a page with a pointer to a recycled anon_vma object, or worse, a pointer to something that is no longer an anon_vma.
[Backport to 2.6.35.5 (anon_vma instead of anon_vma->root in ksm.h) by Hugh]
--- include/linux/ksm.h | 20 +++++++++----------- mm/ksm.c | 3 --- mm/memory.c | 39 ++++++++++++++++++++++++++++++++++----- 3 files changed, 43 insertions(+), 19 deletions(-)
include/linux/ksm.h +9 -11
@@ -16,6 +16,9 @@struct stable_node ;struct mem_cgroup ; +struct page *ksm_does_need_to_copy (struct page *page, +struct vm_area_struct *vma,unsigned long address); +#ifdef CONFIG_KSM int ksm_madvise (struct vm_area_struct *vma,unsigned long start,unsigned long end,int advice,unsigned long *vm_flags);
@@ -70,19 +73,14 @@ static inline void set_page_stable_node(* We'd like to make this conditional on vma->vm_flags & VM_MERGEABLE, * but what if the vma was unmerged while the page was swapped out? */ -struct page *ksm_does_need_to_copy (struct page *page, -struct vm_area_struct *vma,unsigned long address); -static inline struct page *ksm_might_need_to_copy (struct page *page, +static inline int ksm_might_need_to_copy (struct page *page,struct vm_area_struct *vma,unsigned long address) {struct anon_vma *anon_vma =page_anon_vma (page); -if (!anon_vma || - (anon_vma == vma->anon_vma && - page->index ==linear_page_index (vma, address))) -return page; - -return ksm_does_need_to_copy (page, vma, address); +return anon_vma && + (anon_vma != vma->anon_vma || + page->index !=linear_page_index (vma, address)); } int page_referenced_ksm(struct page *page,
@@ -115,10 +113,10 @@ static inline int ksm_madvise(struct vm_return 0 ; } -static inline struct page *ksm_might_need_to_copy (struct page *page, +static inline int ksm_might_need_to_copy (struct page *page,struct vm_area_struct *vma,unsigned long address) { -return page; +return 0 ; } static inline int page_referenced_ksm(struct page *page,
mm/ksm.c +0 -3
@@ -1523,8 +1523,6 @@ struct page *ksm_does_need_to_copy(struc {struct page *new_page; -unlock_page (page);/* any racers will COW it, not modify it */ - new_page =alloc_page_vma (GFP_HIGHUSER_MOVABLE , vma, address);if (new_page) {copy_user_highpage (new_page, page, address, vma);
@@ -1540,7 +1538,6 @@ struct page *ksm_does_need_to_copy(strucadd_page_to_unevictable_list (new_page); } -page_cache_release (page);return new_page; }
mm/memory.c +34 -5
@@ -2626,7 +2626,7 @@ static int do_swap_page(struct mm_struct unsigned int flags, pte_t orig_pte) {spinlock_t *ptl; -struct page *page; +struct page *page, *swapcache =NULL ;swp_entry_t entry;pte_t pte;struct mem_cgroup *ptr =NULL ;
@@ -2681,10 +2681,23 @@ static int do_swap_page(struct mm_structlock_page (page);delayacct_clear_flag (DELAYACCT_PF_SWAPIN ); - page =ksm_might_need_to_copy (page, vma, address); -if (!page) { - ret =VM_FAULT_OOM ; - goto out; +/* +* Make sure try_to_free_swap didn't release the swapcache +* from under us. The page pin isn't enough to prevent that. +*/ +if (unlikely (!PageSwapCache (page))) + goto out_page; + +if (ksm_might_need_to_copy (page, vma, address)) { + swapcache = page; + page =ksm_does_need_to_copy (page, vma, address); + +if (unlikely (!page)) { + ret =VM_FAULT_OOM ; + page = swapcache; + swapcache =NULL ; + goto out_page; + } }if (mem_cgroup_try_charge_swapin (mm, page,GFP_KERNEL , &ptr)) {
@@ -2735,6 +2748,18 @@ static int do_swap_page(struct mm_structif (vm_swap_full () || (vma->vm_flags &VM_LOCKED ) ||PageMlocked (page))try_to_free_swap (page);unlock_page (page); +if (swapcache) { +/* +* Hold the lock to avoid the swap entry to be reused +* until we take the PT lock for the pte_same() check +* (to avoid false positives from pte_same). For +* further safety release the lock after the swap_free +* so that the swap count won't change under a +* parallel locked swapcache. +*/ +unlock_page (swapcache); +page_cache_release (swapcache); + }if (flags &FAULT_FLAG_WRITE ) { ret |=do_wp_page (mm, vma, address, page_table, pmd, ptl, pte);
@@ -2756,6 +2781,10 @@ out_page:unlock_page (page); out_release:page_cache_release (page); +if (swapcache) { +unlock_page (swapcache); +page_cache_release (swapcache); + }return ret; }
PATCH 25/80 mm: further fix swapin race condition
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hugh Dickins <[email protected]>
commit 31c4a3d3a0f84a5847665f8aa0552d188389f791 upstream.
Commit 4969c1192d15 ("mm: fix swapin race condition") is now agreed to be incomplete. There's a race, not very much less likely than the original race envisaged, in which it is further necessary to check that the swapcache page's swap has not changed.
Here's the reasoning: cast in terms of reuse_swap_page(), but probably could be reformulated to rely on try_to_free_swap() instead, or on swapoff+swapon.
A, faults into do_swap_page(): does page1 = lookup_swap_cache(swap1) and comes through the lock_page(page1).
B, a racing thread of the same process, faults on the same address: does page1 = lookup_swap_cache(swap1) and now waits in lock_page(page1), but for whatever reason is unlucky not to get the lock any time soon.
A carries on through do_swap_page(), a write fault, but cannot reuse the swap page1 (another reference to swap1). Unlocks the page1 (but B doesn't get it yet), does COW in do_wp_page(), page2 now in that pte.
C, perhaps the parent of A+B, comes in and write faults the same swap page1 into its mm, reuse_swap_page() succeeds this time, swap1 is freed.
kswapd comes in after some time (B still unlucky) and swaps out some pages from A+B and C: it allocates the original swap1 to page2 in A+B, and some other swap2 to the original page1 now in C. But does not immediately free page1 (actually it couldn't: B holds a reference), leaving it in swap cache for now.
B at last gets the lock on page1, hooray! Is PageSwapCache(page1)? Yes. Is pte_same(*page_table, orig_pte)? Yes, because page2 has now been given the swap1 which page1 used to have. So B proceeds to insert page1 into A+B's page_table, though its content now belongs to C, quite different from what A wrote there.
B ought to have checked that page1's swap was still swap1.
--- mm/memory.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
mm/memory.c +5 -3
@@ -2682,10 +2682,12 @@ static int do_swap_page(struct mm_structdelayacct_clear_flag (DELAYACCT_PF_SWAPIN );/* -* Make sure try_to_free_swap didn't release the swapcache -* from under us. The page pin isn't enough to prevent that. +* Make sure try_to_free_swap or reuse_swap_page or swapoff did not +* release the swapcache from under us. The page pin, and pte_same +* test below, are not enough to exclude that. Even if it is still +* swapcache, we need to check that the page's swap has not changed. */ -if (unlikely (!PageSwapCache (page))) +if (unlikely (!PageSwapCache (page) ||page_private (page) != entry.val)) goto out_page;if (ksm_might_need_to_copy (page, vma, address)) {
PATCH 26/80 virtio: console: Prevent userspace from submitting NULL buffers
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Amit Shah <[email protected]>
commit 65745422a898741ee0e7068ef06624ab06e8aefa upstream.
A userspace could submit a buffer with 0 length to be written to the host. Prevent such a situation.
This was not needed previously, but recent changes in the way write() works exposed this condition to trigger a virtqueue event to the host, causing a NULL buffer to be sent across.
--- drivers/char/virtio_console.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/char/virtio_console.c +4 -0
@@ -596,6 +596,10 @@ static ssize_t port_fops_write(struct fissize_t ret;bool nonblock; +/* Userspace could be out to fool us */ +if (!count) +return 0 ; + port = filp->private_data; nonblock = filp->f_flags &O_NONBLOCK ;
PATCH 27/80 virtio: console: Fix poll blocking even though there is data to read
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hans de Goede <[email protected]>
commit 6df7aadcd9290807c464675098b5dd2dc9da5075 upstream.
I found this while working on a Linux agent for spice, the symptom I was seeing was select blocking on the spice vdagent virtio serial port even though there were messages queued up there.
virtio_console's port_fops_poll checks port->inbuf != NULL to determine if read won't block. However if an application reads enough bytes from inbuf through port_fops_read, to empty the current port->inbuf, port->inbuf will be NULL even though there may be buffers left in the virtqueue.
This causes poll() to block even though there is data to be read, this patch fixes this by using will_read_block(port) instead of the port->inbuf != NULL check.
--- drivers/char/virtio_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/virtio_console.c +1 -1
@@ -646,7 +646,7 @@ static unsigned int port_fops_poll(strucpoll_wait (filp, &port->waitqueue, wait); ret =0 ; -if (port->inbuf) +if (!will_read_block (port)) ret |=POLLIN |POLLRDNORM ;if (!will_write_block (port)) ret |=POLLOUT ;
PATCH 28/80 intel_agp, drm/i915: Add all sandybridge graphics devices support
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Zhenyu Wang <[email protected]>
New pci ids for all sandybridge graphics versions on desktop/mobile/server.
[This is backport patch from upstream commit 4fefe435 and 85540480.]
--- drivers/char/agp/intel-agp.c | 19 +++++++++++++++---- drivers/char/agp/intel-agp.h | 17 ++++++++++++----- drivers/char/agp/intel-gtt.c | 37 +++++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/i915_drv.c | 5 +++++ 4 files changed, 67 insertions(+), 11 deletions(-)
drivers/char/agp/intel-agp.c +15 -4
@@ -815,10 +815,20 @@ static const struct intel_driver_descrip "HD Graphics", NULL, &intel_i965_driver }, {PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB ,PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG , "HD Graphics", NULL, &intel_i965_driver }, - { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_IG, - "Sandybridge", NULL, &intel_i965_driver }, - { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_IG, - "Sandybridge", NULL, &intel_i965_driver }, + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT1_IG, + "Sandybridge", NULL, &intel_gen6_driver }, + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_IG, + "Sandybridge", NULL, &intel_gen6_driver }, + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_PLUS_IG, + "Sandybridge", NULL, &intel_gen6_driver }, + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT1_IG, + "Sandybridge", NULL, &intel_gen6_driver }, + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_IG, + "Sandybridge", NULL, &intel_gen6_driver }, + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_PLUS_IG, + "Sandybridge", NULL, &intel_gen6_driver }, + { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_IG, + "Sandybridge", NULL, &intel_gen6_driver }, { 0, 0, NULL, NULL, NULL } };
@@ -1036,6 +1046,7 @@ static struct pci_device_id agp_intel_pcID (PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB ),ID (PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB ),ID (PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB ), + ID(PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB), { } };
drivers/char/agp/intel-agp.h +12 -5
@@ -194,10 +194,16 @@#define PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB 0x0062#define PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB 0x006a#define PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG 0x0046 -#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB 0x0100 -#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_IG 0x0102 -#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB 0x0104 -#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_IG 0x0106 +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB 0x0100/* Desktop */ +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT1_IG 0x0102 +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_IG 0x0112 +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_PLUS_IG 0x0122 +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB 0x0104/* Mobile */ +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT1_IG 0x0106 +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_IG 0x0116 +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_PLUS_IG 0x0126 +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB 0x0108/* Server */ +#define PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_IG 0x010A/* cover 915 and 945 variants */ #define IS_I915 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_E7221_HB || \
@@ -224,7 +230,8 @@ agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_HB)#define IS_SNB (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB || \ - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB) + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB || \ + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB)#define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_EAGLELAKE_HB || \ agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \
drivers/char/agp/intel-gtt.c +35 -2
@@ -585,8 +585,7 @@ static void intel_i830_init_gtt_entries( gtt_entries =0 ;break ; } - }else if (agp_bridge->dev->device ==PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB || - agp_bridge->dev->device ==PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB ) { + }else if (IS_SNB ) {/* * SandyBridge has new memory control reg at 0x50.w */
@@ -1337,6 +1336,7 @@ static void intel_i965_get_gtt_range(intbreak ;case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB :case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB : +case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_HB : *gtt_offset =MB (2 );pci_read_config_word (intel_private.pcidev,SNB_GMCH_CTRL , &snb_gmch_ctl);
@@ -1497,6 +1497,39 @@ static const struct agp_bridge_driver in .owner = THIS_MODULE, .aperture_sizes = intel_i830_sizes, .size_type = FIXED_APER_SIZE, + .num_aperture_sizes = 4, + .needs_scratch_page = true, + .configure = intel_i9xx_configure, + .fetch_size = intel_i9xx_fetch_size, + .cleanup = intel_i915_cleanup, + .mask_memory = intel_i965_mask_memory, + .masks = intel_i810_masks, + .agp_enable = intel_i810_agp_enable, + .cache_flush = global_cache_flush, + .create_gatt_table = intel_i965_create_gatt_table, + .free_gatt_table = intel_i830_free_gatt_table, + .insert_memory = intel_i915_insert_entries, + .remove_memory = intel_i915_remove_entries, + .alloc_by_type = intel_i830_alloc_by_type, + .free_by_type = intel_i810_free_by_type, + .agp_alloc_page = agp_generic_alloc_page, + .agp_alloc_pages = agp_generic_alloc_pages, + .agp_destroy_page = agp_generic_destroy_page, + .agp_destroy_pages = agp_generic_destroy_pages, + .agp_type_to_mask_type = intel_i830_type_to_mask_type, + .chipset_flush = intel_i915_chipset_flush, +#ifdef USE_PCI_DMA_API + .agp_map_page = intel_agp_map_page, + .agp_unmap_page = intel_agp_unmap_page, + .agp_map_memory = intel_agp_map_memory, + .agp_unmap_memory = intel_agp_unmap_memory, +#endif +}; + +static const struct agp_bridge_driver intel_gen6_driver = { + .owner =THIS_MODULE , + .aperture_sizes = intel_i830_sizes, + .size_type =FIXED_APER_SIZE , .num_aperture_sizes =4 , .needs_scratch_page = true, .configure = intel_i9xx_configure,
drivers/gpu/drm/i915/i915_drv.c +5 -0
@@ -180,7 +180,12 @@ static const struct pci_device_id pciidlINTEL_VGA_DEVICE (0x0042 , &intel_ironlake_d_info),INTEL_VGA_DEVICE (0x0046 , &intel_ironlake_m_info),INTEL_VGA_DEVICE (0x0102 , &intel_sandybridge_d_info), +INTEL_VGA_DEVICE (0x0112 , &intel_sandybridge_d_info), +INTEL_VGA_DEVICE (0x0122 , &intel_sandybridge_d_info),INTEL_VGA_DEVICE (0x0106 , &intel_sandybridge_m_info), +INTEL_VGA_DEVICE (0x0116 , &intel_sandybridge_m_info), +INTEL_VGA_DEVICE (0x0126 , &intel_sandybridge_m_info), +INTEL_VGA_DEVICE (0x010A , &intel_sandybridge_d_info), {0, 0, 0} };
PATCH 29/80 agp/intel: fix physical address mask bits for sandybridge
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Zhenyu Wang <[email protected]>
[This is backport patch from upstream 8dfc2b14.]
--- drivers/char/agp/intel-gtt.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/char/agp/intel-gtt.c +11 -1
@@ -1317,6 +1317,16 @@ static unsigned long intel_i965_mask_memreturn addr | bridge->driver->masks[type].mask; } +static unsigned long intel_gen6_mask_memory (struct agp_bridge_data *bridge, +dma_addr_t addr,int type) +{ +/* gen6 has bit11-4 for physical addr bit39-32 */ + addr |= (addr >>28 ) &0xff0 ; + +/* Type checking must be done elsewhere */ +return addr | bridge->driver->masks[type].mask; +} +static void intel_i965_get_gtt_range (int *gtt_offset,int *gtt_size) {u16 snb_gmch_ctl;
@@ -1535,7 +1545,7 @@ static const struct agp_bridge_driver in .configure = intel_i9xx_configure, .fetch_size = intel_i9xx_fetch_size, .cleanup = intel_i915_cleanup, - .mask_memory = intel_i965_mask_memory, + .mask_memory = intel_gen6_mask_memory, .masks = intel_i810_masks, .agp_enable = intel_i810_agp_enable, .cache_flush = global_cache_flush,
PATCH 30/80 agp/intel: fix dma mask bits on sandybridge
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Zhenyu Wang <[email protected]>
[This is backport patch from upstream 877fdacf.]
--- drivers/char/agp/intel-agp.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/char/agp/intel-agp.c +14 -9
@@ -835,7 +835,7 @@ static const struct intel_driver_descripstatic int __devinit intel_gmch_probe (struct pci_dev *pdev,struct agp_bridge_data *bridge) { -int i; +int i, mask; bridge->driver =NULL ;for (i =0 ; intel_agp_chipsets[i].name !=NULL ; i++) {
@@ -855,14 +855,19 @@ static int __devinit intel_gmch_probe(stdev_info (&pdev->dev,"Intel %s Chipset\n" , intel_agp_chipsets[i].name); -if (bridge->driver->mask_memory == intel_i965_mask_memory) { -if (pci_set_dma_mask (intel_private.pcidev,DMA_BIT_MASK (36 ))) -dev_err (&intel_private.pcidev->dev, -"set gfx device dma mask 36bit failed!\n" ); -else -pci_set_consistent_dma_mask (intel_private.pcidev, -DMA_BIT_MASK (36 )); - } +if (bridge->driver->mask_memory == intel_gen6_mask_memory) + mask =40 ; +else if (bridge->driver->mask_memory == intel_i965_mask_memory) + mask =36 ; +else + mask =32 ; + +if (pci_set_dma_mask (intel_private.pcidev,DMA_BIT_MASK (mask))) +dev_err (&intel_private.pcidev->dev, +"set gfx device dma mask %d-bit failed!\n" , mask); +else +pci_set_consistent_dma_mask (intel_private.pcidev, +DMA_BIT_MASK (mask));return 1 ; }
PATCH 31/80 hw breakpoints: Fix pid namespace bug
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Matt Helsley <[email protected]>
commit 068e35eee9ef98eb4cab55181977e24995d273be upstream.
Hardware breakpoints can't be registered within pid namespaces because tsk->pid is passed rather than the pid in the current namespace.
(See https://bugzilla.kernel.org/show_bug.cgi?id=17281 )
This is a quick fix demonstrating the problem but is not the best method of solving the problem since passing pids internally is not the best way to avoid pid namespace bugs. Subsequent patches will show a better solution.
Much thanks to Frederic Weisbecker <[email protected]> for doing the bulk of the work finding this bug.
LKML-Reference: <f63454af09fb1915717251570423eb9ddd338340.1284407762.git.matthltc@us.ibm.com>
--- kernel/hw_breakpoint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/hw_breakpoint.c +2 -1
@@ -417,7 +417,8 @@ register_user_hw_breakpoint(struct perf_perf_overflow_handler_t triggered, struct task_struct *tsk) { - return perf_event_create_kernel_counter(attr, -1, tsk->pid, triggered); + return perf_event_create_kernel_counter(attr, -1, task_pid_vnr(tsk), +triggered ); }EXPORT_SYMBOL_GPL (register_user_hw_breakpoint);
PATCH 32/80 pid: make setpgid() system call use RCU read-side critical section
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Paul E. McKenney <[email protected]>
commit 950eaaca681c44aab87a46225c9e44f902c080aa upstream.
[ 23.584719]
[ 23.584720] ===================================================
[ 23.585059] [ INFO: suspicious rcu_dereference_check() usage. ]
[ 23.585176] ---------------------------------------------------
[ 23.585176] kernel/pid.c:419 invoked rcu_dereference_check() without protection!
[ 23.585176]
[ 23.585176] other info that might help us debug this:
[ 23.585176]
[ 23.585176]
[ 23.585176] rcu_scheduler_active = 1, debug_locks = 1
[ 23.585176] 1 lock held by rc.sysinit/728:
[ 23.585176] #0: (tasklist_lock){.+.+..}, at: [<ffffffff8104771f>] sys_setpgid+0x5f/0x193
[ 23.585176]
[ 23.585176] stack backtrace:
[ 23.585176] Pid: 728, comm: rc.sysinit Not tainted 2.6.36-rc2 #2
[ 23.585176] Call Trace:
[ 23.585176] [<ffffffff8105b436>] lockdep_rcu_dereference+0x99/0xa2
[ 23.585176] [<ffffffff8104c324>] find_task_by_pid_ns+0x50/0x6a
[ 23.585176] [<ffffffff8104c35b>] find_task_by_vpid+0x1d/0x1f
[ 23.585176] [<ffffffff81047727>] sys_setpgid+0x67/0x193
[ 23.585176] [<ffffffff810029eb>] system_call_fastpath+0x16/0x1b
[ 24.959669] type=1400 audit(1282938522.956:4): avc: denied { module_request } for pid=766 comm="hwclock" kmod="char-major-10-135" scontext=system_u:system_r:hwclock_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclasIt turns out that the setpgid() system call fails to enter an RCU read-side critical section before doing a PID-to-task_struct translation. This commit therefore does rcu_read_lock() before the translation, and also does rcu_read_unlock() after the last use of the returned pointer.
--- kernel/sys.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/sys.c +2 -0
@@ -931,6 +931,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid pgid = pid;if (pgid <0 )return -EINVAL ; +rcu_read_lock ();/* From this point forward we keep holding onto the tasklist lock * so that our parent does not change from under us. -DaveM
@@ -984,6 +985,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid out:/* All paths lead to here, thus we are safe. -DaveM */ write_unlock_irq (&tasklist_lock); +rcu_read_unlock ();return err; }
PATCH 33/80 sched: Fix user time incorrectly accounted as system time on 32-bit
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit e75e863dd5c7d96b91ebbd241da5328fc38a78cc upstream.
We have 32-bit variable overflow possibility when multiply in task_times() and thread_group_times() functions. When the overflow happens then the scaled utime value becomes erroneously small and the scaled stime becomes i erroneously big.
Reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=633037
https://bugzilla.kernel.org/show_bug.cgi?id=16559
LKML-Reference: <[email protected]>
--- kernel/sched.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/sched.c +4 -4
@@ -3349,9 +3349,9 @@ void task_times(struct task_struct *p, c rtime =nsecs_to_cputime (p->se.sum_exec_runtime);if (total) { -u64 temp; +u64 temp = rtime; - temp = (u64)(rtime * utime); + temp *= utime;do_div (temp, total); utime = (cputime_t )temp; }else
@@ -3382,9 +3382,9 @@ void thread_group_times(struct task_stru rtime =nsecs_to_cputime (cputime.sum_exec_runtime);if (total) { -u64 temp; +u64 temp = rtime; - temp = (u64)(rtime * cputime.utime); + temp *= cputime.utime;do_div (temp, total); utime = (cputime_t )temp; }else
PATCH 34/80 oprofile: Add Support for Intel CPU Family 6 / Model 22 (Intel Celeron 540)
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Patrick Simmons <[email protected]>
commit c33f543d320843e1732534c3931da4bbd18e6c14 upstream.
This patch adds CPU type detection for the Intel Celeron 540, which is part of the Core 2 family according to Wikipedia; the family and ID pair is absent from the Volume 3B table referenced in the source code comments. I have tested this patch on an Intel Celeron 540 machine reporting itself as Family 6 Model 22, and OProfile runs on the machine without issue.
Spec:
http://download.intel.com/design/mobile/SPECUPDT/317667.pdf
--- arch/x86/oprofile/nmi_int.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/oprofile/nmi_int.c +3 -1
@@ -671,7 +671,9 @@ static int __init ppro_init(char **cpu_tcase 14 : *cpu_type ="i386/core" ;break ; -case 15 :case 23 : +case 0x0f : +case 0x16 : +case 0x17 : *cpu_type ="i386/core_2" ;break ;case 0x1a :
PATCH 35/80 drm/i915,agp/intel: Add second set of PCI-IDs for B43
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Chris Wilson <[email protected]>
commit 41a51428916ab04587bacee2dda61c4a0c4fc02f upstream.
There is a second revision of B43 (a desktop gen4 part) floating around, functionally equivalent to the original B43, so simply add the new PCI-IDs.
Bugzilla: https://bugs.freedesktop.org/show_bugs.cgi?id=30221
--- drivers/char/agp/intel-agp.c | 2 ++ drivers/char/agp/intel-agp.h | 2 ++ drivers/gpu/drm/i915/i915_drv.c | 1 + 3 files changed, 5 insertions(+)
drivers/char/agp/intel-agp.c +2 -0
@@ -805,6 +805,8 @@ static const struct intel_driver_descrip "G45/G43", NULL, &intel_i965_driver }, {PCI_DEVICE_ID_INTEL_B43_HB ,PCI_DEVICE_ID_INTEL_B43_IG , "B43", NULL, &intel_i965_driver }, + { PCI_DEVICE_ID_INTEL_B43_1_HB, PCI_DEVICE_ID_INTEL_B43_1_IG, + "B43", NULL, &intel_i965_driver }, { PCI_DEVICE_ID_INTEL_G41_HB, PCI_DEVICE_ID_INTEL_G41_IG, "G41", NULL, &intel_i965_driver }, { PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG,
drivers/char/agp/intel-agp.h +2 -0
@@ -178,6 +178,8 @@#define PCI_DEVICE_ID_INTEL_Q33_IG 0x29D2#define PCI_DEVICE_ID_INTEL_B43_HB 0x2E40#define PCI_DEVICE_ID_INTEL_B43_IG 0x2E42 +#define PCI_DEVICE_ID_INTEL_B43_1_HB 0x2E90 +#define PCI_DEVICE_ID_INTEL_B43_1_IG 0x2E92#define PCI_DEVICE_ID_INTEL_GM45_HB 0x2A40#define PCI_DEVICE_ID_INTEL_GM45_IG 0x2A42#define PCI_DEVICE_ID_INTEL_EAGLELAKE_HB 0x2E00
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -175,6 +175,7 @@ static const struct pci_device_id pciidlINTEL_VGA_DEVICE (0x2e22 , &intel_g45_info),INTEL_VGA_DEVICE (0x2e32 , &intel_g45_info),INTEL_VGA_DEVICE (0x2e42 , &intel_g45_info), +INTEL_VGA_DEVICE (0x2e92 , &intel_g45_info),/* B43_G.1 */ INTEL_VGA_DEVICE (0xa001 , &intel_pineview_info),INTEL_VGA_DEVICE (0xa011 , &intel_pineview_info), INTEL_VGA_DEVICE(0x0042, &intel_ironlake_d_info),
PATCH 36/80 bdi: Initialize noop_backing_dev_info properly
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jan Kara <[email protected]>
commit 976e48f8a5b02fc33f3e5cad87fb3fcea041a49c upstream.
Properly initialize this backing dev info so that writeback code does not barf when getting to it e.g. via sb->s_bdi.
--- mm/backing-dev.c | 2 ++ 1 file changed, 2 insertions(+)
mm/backing-dev.c +2 -0
@@ -29,6 +29,7 @@ EXPORT_SYMBOL_GPL(default_backing_dev_instruct backing_dev_info noop_backing_dev_info = { .name ="noop" , + .capabilities =BDI_CAP_NO_ACCT_AND_WRITEBACK , };EXPORT_SYMBOL_GPL (noop_backing_dev_info);
@@ -254,6 +255,7 @@ static int __init default_bdi_init(void) err =bdi_init (&default_backing_dev_info);if (!err)bdi_register (&default_backing_dev_info,NULL ,"default" ); + err =bdi_init (&noop_backing_dev_info);return err; }
PATCH 37/80 bdi: Fix warnings in __mark_inode_dirty for /dev/zero and friends
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jan Kara <[email protected]>
commit 692ebd17c2905313fff3c504c249c6a0faad16ec upstream.
Inodes of devices such as /dev/zero can get dirty for example via utime(2) syscall or due to atime update. Backing device of such inodes (zero_bdi, etc.) is however unable to handle dirty inodes and thus __mark_inode_dirty complains. In fact, inode should be rather dirtied against backing device of the filesystem holding it. This is generally a good rule except for filesystems such as 'bdev' or 'mtd_inodefs'. Inodes in these pseudofilesystems are referenced from ordinary filesystem inodes and carry mapping with real data of the device. Thus for these inodes we have to use inode->i_mapping->backing_dev_info as we did so far. We distinguish these filesystems by checking whether sb->s_bdi points to a non-trivial backing device or not.
Example: Assume we have an ext3 filesystem on /dev/sda1 mounted on /. There's a device inode A described by a path "/dev/sdb" on this filesystem. This inode will be dirtied against backing device "8:0" after this patch. bdev filesystem contains block device inode B coupled with our inode A. When someone modifies a page of /dev/sdb, it's B that gets dirtied and the dirtying happens against the backing device "8:16". Thus both inodes get filed to a correct bdi list.
--- fs/fs-writeback.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
fs/fs-writeback.c +21 -2
@@ -28,8 +28,6 @@#include <linux/buffer_head.h> #include "internal.h" -#define inode_to_bdi (inode) ((inode)->i_mapping->backing_dev_info) -/* * We don't actually have pdflush, but this one is exported though /proc... */
@@ -62,6 +60,27 @@ int writeback_in_progress(struct backingreturn !list_empty (&bdi->work_list); } +static inline struct backing_dev_info *inode_to_bdi (struct inode *inode) +{ +struct super_block *sb = inode->i_sb; +struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info; + +/* +* For inodes on standard filesystems, we use superblock's bdi. For +* inodes on virtual filesystems, we want to use inode mapping's bdi +* because they can possibly point to something useful (think about +* block_dev filesystem). +*/ +if (sb->s_bdi && sb->s_bdi != &noop_backing_dev_info) { +/* Some device inodes could play dirty tricks. Catch them... */ +WARN (bdi != sb->s_bdi &&bdi_cap_writeback_dirty (bdi), +"Dirtiable inode bdi %s != sb bdi %s\n" , + bdi->name, sb->s_bdi->name); +return sb->s_bdi; + } +return bdi; +} +static void bdi_queue_work (struct backing_dev_info *bdi,struct wb_writeback_work *work) {
PATCH 38/80 char: Mark /dev/zero and /dev/kmem as not capable of writeback
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jan Kara <[email protected]>
commit 371d217ee1ff8b418b8f73fb2a34990f951ec2d4 upstream.
These devices don't do any writeback but their device inodes still can get dirty so mark bdi appropriately so that bdi code does the right thing and files inodes to lists of bdi carrying the device inodes.
--- drivers/char/mem.c | 3 ++- fs/char_dev.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/char/mem.c +2 -1
@@ -788,10 +788,11 @@ static const struct file_operations zero/* * capabilities for /dev/zero * - permits private mappings, "copies" are taken of the source of zeros +* - no writeback happens */ static struct backing_dev_info zero_bdi = { .name ="char/mem" , - .capabilities =BDI_CAP_MAP_COPY , + .capabilities =BDI_CAP_MAP_COPY |BDI_CAP_NO_ACCT_AND_WRITEBACK , };static const struct file_operations full_fops = {
fs/char_dev.c +3 -1
@@ -40,7 +40,9 @@ struct backing_dev_info directly_mappabl#endif /* permit direct mmap, for read, write or exec */ BDI_CAP_MAP_DIRECT | - BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP), +BDI_CAP_READ_MAP |BDI_CAP_WRITE_MAP |BDI_CAP_EXEC_MAP | +/* no writeback happens */ + BDI_CAP_NO_ACCT_AND_WRITEBACK), };static struct kobj_map *cdev_map;
PATCH 39/80 drivers/pci/intel-iommu.c: fix build with older gccs
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrew Morton <[email protected]>
commit df08cdc7ef606509debe7677c439be0ca48790e4 upstream.
drivers/pci/intel-iommu.c: In function `__iommu_calculate_agaw':drivers/pci/intel-iommu.c:437: sorry, unimplemented: inlining failed in call to 'width_to_agaw': function body not available drivers/pci/intel-iommu.c:445: sorry, unimplemented: called from here
Move the offending function (and its siblings) to top-of-file, remove the forward declaration.
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=17441
--- drivers/pci/intel-iommu.c | 90 +++++++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 47 deletions(-)
drivers/pci/intel-iommu.c +43 -47
@@ -71,6 +71,49 @@#define DMA_32BIT_PFN IOVA_PFN(DMA_BIT_MASK(32))#define DMA_64BIT_PFN IOVA_PFN(DMA_BIT_MASK(64)) +/* page table handling */ +#define LEVEL_STRIDE (9) +#define LEVEL_MASK (((u64)1 << LEVEL_STRIDE) - 1) + +static inline int agaw_to_level (int agaw) +{ +return agaw +2 ; +} + +static inline int agaw_to_width (int agaw) +{ +return 30 + agaw *LEVEL_STRIDE ; +} + +static inline int width_to_agaw (int width) +{ +return (width -30 ) /LEVEL_STRIDE ; +} + +static inline unsigned int level_to_offset_bits (int level) +{ +return (level -1 ) *LEVEL_STRIDE ; +} + +static inline int pfn_level_offset (unsigned long pfn,int level) +{ +return (pfn >>level_to_offset_bits (level)) &LEVEL_MASK ; +} + +static inline unsigned long level_mask (int level) +{ +return -1UL <<level_to_offset_bits (level); +} + +static inline unsigned long level_size (int level) +{ +return 1UL <<level_to_offset_bits (level); +} + +static inline unsigned long align_to_level (unsigned long pfn,int level) +{ +return (pfn +level_size (level) -1 ) &level_mask (level); +}/* VT-d pages must always be _smaller_ than MM pages. Otherwise things are never going to work. */
@@ -434,8 +477,6 @@ void free_iova_mem(struct iova *iova) } -static inline int width_to_agaw (int width); -static int __iommu_calculate_agaw (struct intel_iommu *iommu,int max_gaw) {unsigned long sagaw;
@@ -646,51 +687,6 @@ out:spin_unlock_irqrestore (&iommu->lock, flags); } -/* page table handling */ -#define LEVEL_STRIDE (9) -#define LEVEL_MASK (((u64)1 << LEVEL_STRIDE) - 1) - -static inline int agaw_to_level (int agaw) -{ -return agaw +2 ; -} - -static inline int agaw_to_width (int agaw) -{ -return 30 + agaw *LEVEL_STRIDE ; - -} - -static inline int width_to_agaw (int width) -{ -return (width -30 ) /LEVEL_STRIDE ; -} - -static inline unsigned int level_to_offset_bits (int level) -{ -return (level -1 ) *LEVEL_STRIDE ; -} - -static inline int pfn_level_offset (unsigned long pfn,int level) -{ -return (pfn >>level_to_offset_bits (level)) &LEVEL_MASK ; -} - -static inline unsigned long level_mask (int level) -{ -return -1UL <<level_to_offset_bits (level); -} - -static inline unsigned long level_size (int level) -{ -return 1UL <<level_to_offset_bits (level); -} - -static inline unsigned long align_to_level (unsigned long pfn,int level) -{ -return (pfn +level_size (level) -1 ) &level_mask (level); -} -static struct dma_pte *pfn_to_dma_pte (struct dmar_domain *domain,unsigned long pfn) {
PATCH 40/80 mmap: call unlink_anon_vmas() in __split_vma() in case of error
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 2aeadc30de45a72648f271603203ab392b80f607 upstream.
If __split_vma fails because of an out of memory condition the anon_vma_chain isn't teardown and freed potentially leading to rmap walks accessing freed vma information plus there's a memleak.
--- mm/mmap.c | 1 + 1 file changed, 1 insertion(+)
mm/mmap.c +1 -0
@@ -1997,6 +1997,7 @@ static int __split_vma(struct mm_structremoved_exe_file_vma (mm);fput (new->vm_file); } +unlink_anon_vmas (new); out_free_mpol:mpol_put (pol); out_free_vma:
PATCH 41/80 drivers/video/sis/sis_main.c: prevent reading uninitialized stack memory
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <[email protected]>
commit fd02db9de73faebc51240619c7c7f99bee9f65c7 upstream.
The FBIOGET_VBLANK device ioctl allows unprivileged users to read 16 bytes of uninitialized stack memory, because the "reserved" member of the fb_vblank struct declared on the stack is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/video/sis/sis_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/sis/sis_main.c +3 -0
@@ -1701,6 +1701,9 @@ static int sisfb_ioctl(struct fb_info *ibreak ;case FBIOGET_VBLANK : + +memset (&sisvbblank,0 ,sizeof (struct fb_vblank )); + sisvbblank.count =0 ; sisvbblank.flags =sisfb_setupvbblankflags (ivideo, &sisvbblank.vcount, &sisvbblank.hcount);
PATCH 42/80 rtc: s3c: balance state changes of wakeup flag
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Vladimir Zapolskiy <[email protected]>
commit f501ed524b26ba1b739b7f7feb0a0e1496878769 upstream.
This change resolves a problem about unbalanced calls of enable_irq_wakeup() and disable_irq_wakeup() for alarm interrupt.
Bug reproduction:
root@eb600:~# echo 0 > /sys/class/rtc/rtc0/wakealarm
WARNING: at kernel/irq/manage.c:361 set_irq_wake+0x7c/0xe4() Unbalanced IRQ 46 wake disable Modules linked in: [<c0025708>] (unwind_backtrace+0x0/0xd8) from [<c003358c>] (warn_slowpath_common+0x44/0x5c) [<c003358c>] (warn_slowpath_common+0x44/0x5c) from [<c00335dc>] (warn_slowpath_fmt+0x24/0x30) [<c00335dc>] (warn_slowpath_fmt+0x24/0x30) from [<c0058c20>] (set_irq_wake+0x7c/0xe4) [<c0058c20>] (set_irq_wake+0x7c/0xe4) from [<c01b5e80>] (s3c_rtc_setalarm+0xa8/0xb8) [<c01b5e80>] (s3c_rtc_setalarm+0xa8/0xb8) from [<c01b47a0>] (rtc_set_alarm+0x60/0x74) [<c01b47a0>] (rtc_set_alarm+0x60/0x74) from [<c01b5a98>] (rtc_sysfs_set_wakealarm+0xc8/0xd8) [<c01b5a98>] (rtc_sysfs_set_wakealarm+0xc8/0xd8) from [<c01891ec>] (dev_attr_store+0x20/0x24) [<c01891ec>] (dev_attr_store+0x20/0x24) from [<c00be934>] (sysfs_write_file+0x104/0x13c) [<c00be934>] (sysfs_write_file+0x104/0x13c) from [<c0080e7c>] (vfs_write+0xb0/0x158) [<c0080e7c>] (vfs_write+0xb0/0x158) from [<c0080fcc>] (sys_write+0x3c/0x68) [<c0080fcc>] (sys_write+0x3c/0x68) from [<c0020ec0>] (ret_fast_syscall+0x0/0x28)
--- drivers/rtc/rtc-s3c.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/rtc/rtc-s3c.c +8 -5
@@ -298,11 +298,6 @@ static int s3c_rtc_setalarm(struct devics3c_rtc_setaie (alrm->enabled); -if (alrm->enabled) -enable_irq_wake (s3c_rtc_alarmno); -else -disable_irq_wake (s3c_rtc_alarmno); -return 0 ; }
@@ -547,6 +542,10 @@ static int s3c_rtc_suspend(struct platfo ticnt_en_save &=S3C64XX_RTCCON_TICEN ; }s3c_rtc_enable (pdev,0 ); + +if (device_may_wakeup (&pdev->dev)) +enable_irq_wake (s3c_rtc_alarmno); +return 0 ; }
@@ -560,6 +559,10 @@ static int s3c_rtc_resume(struct platfor tmp =readb (s3c_rtc_base +S3C2410_RTCCON ); writeb(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); } + +if (device_may_wakeup (&pdev->dev)) +disable_irq_wake (s3c_rtc_alarmno); +return 0 ; }#else
PATCH 43/80 Prevent freeing uninitialized pointer in compat_do_readv_writev
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <[email protected]>
commit 767b68e96993e29e3480d7ecdd9c4b84667c5762 upstream.
In 32-bit compatibility mode, the error handling for compat_do_readv_writev() may free an uninitialized pointer, potentially leading to all sorts of ugly memory corruption. This is reliably triggerable by unprivileged users by invoking the readv()/writev() syscalls with an invalid iovec pointer. The below patch fixes this to emulate the non-compat version.
Introduced by commit b83733639a49 ("compat: factor out compat_rw_copy_check_uvector from compat_do_readv_writev")
--- fs/compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/compat.c +1 -1
@@ -1150,7 +1150,7 @@ static ssize_t compat_do_readv_writev(in {compat_ssize_t tot_len;struct iovec iovstack[UIO_FASTIOV ]; -struct iovec *iov; +struct iovec *iov = iovstack;ssize_t ret;io_fn_t fn;iov_fn_t fnv;
PATCH 44/80 /proc/vmcore: fix seeking
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Arnd Bergmann <[email protected]>
commit c227e69028473c7c7994a9b0a2cc0034f3f7e0fe upstream.
Commit 73296bc611 ("procfs: Use generic_file_llseek in /proc/vmcore") broke seeking on /proc/vmcore. This changes it back to use default_llseek in order to restore the original behaviour.
The problem with generic_file_llseek is that it only allows seeks up to inode->i_sb->s_maxbytes, which is zero on procfs and some other virtual file systems. We should merge generic_file_llseek and default_llseek some day and clean this up in a proper way, but for 2.6.35/36, reverting vmcore is the safer solution.
--- fs/proc/vmcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/vmcore.c +1 -1
@@ -163,7 +163,7 @@ static ssize_t read_vmcore(struct file *static const struct file_operations proc_vmcore_operations = { .read = read_vmcore, - .llseek = generic_file_llseek, + .llseek = default_llseek, };static struct vmcore *__init get_new_element (void )
PATCH 45/80 vmscan: check all_unreclaimable in direct reclaim path
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Minchan Kim <[email protected]>
commit d1908362ae0b97374eb8328fbb471576332f9fb1 upstream.
M. Vefa Bicakci reported 2.6.35 kernel hang up when hibernation on his 32bit 3GB mem machine.
(https://bugzilla.kernel.org/show_bug.cgi?id=16771). Also he bisected the regression to
commit bb21c7ce18eff8e6e7877ca1d06c6db719376e3c
Author: KOSAKI Motohiro <[email protected]>
Date: Fri Jun 4 14:15:05 2010 -0700
vmscan: fix do_try_to_free_pages() return value when priority==0 reclaim failure
At first impression, this seemed very strange because the above commit only chenged function return value and hibernate_preallocate_memory() ignore return value of shrink_all_memory(). But it's related.
Now, page allocation from hibernation code may enter infinite loop if the system has highmem. The reasons are that vmscan don't care enough OOM case when oom_killer_disabled.
The problem sequence is following as.
1. hibernation
2. oom_disable
3. alloc_pages
4. do_try_to_free_pages
if (scanning_global_lru(sc) && !all_unreclaimable)
return 1;If kswapd is not freozen, it would set zone->all_unreclaimable to 1 and then shrink_zones maybe return true(ie, all_unreclaimable is true). So at last, alloc_pages could go to _nopage_. If it is, it should have no problem.
This patch adds all_unreclaimable check to protect in direct reclaim path, too. It can care of hibernation OOM case and help bailout all_unreclaimable case slightly.
--- mm/vmscan.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-)
mm/vmscan.c +35 -8
@@ -1726,13 +1726,12 @@ static void shrink_zone(int priority, st* If a zone is deemed to be full of pinned pages then just give it a light * scan then give up on it. */ -static bool shrink_zones (int priority,struct zonelist *zonelist, +static void shrink_zones (int priority,struct zonelist *zonelist,struct scan_control *sc) {enum zone_type high_zoneidx =gfp_zone (sc->gfp_mask);struct zoneref *z;struct zone *zone; -bool all_unreclaimable = true;for_each_zone_zonelist_nodemask (zone, z, zonelist, high_zoneidx, sc->nodemask) {
@@ -1759,8 +1758,38 @@ static bool shrink_zones(int priority, s }shrink_zone (priority, zone, sc); - all_unreclaimable = false; } +} + +static bool zone_reclaimable (struct zone *zone) +{ +return zone->pages_scanned <zone_reclaimable_pages (zone) *6 ; +} + +/* +* As hibernation is going on, kswapd is freezed so that it can't mark +* the zone into all_unreclaimable. It can't handle OOM during hibernation. +* So let's check zone's unreclaimable in direct reclaim as well as kswapd. +*/ +static bool all_unreclaimable (struct zonelist *zonelist, +struct scan_control *sc) +{ +struct zoneref *z; +struct zone *zone; +bool all_unreclaimable = true; + +for_each_zone_zonelist_nodemask (zone, z, zonelist, +gfp_zone (sc->gfp_mask), sc->nodemask) { +if (!populated_zone (zone)) +continue ; +if (!cpuset_zone_allowed_hardwall (zone,GFP_KERNEL )) +continue ; +if (zone_reclaimable (zone)) { + all_unreclaimable = false; +break ; + } + } +return all_unreclaimable; }
@@ -1784,7 +1813,6 @@ static unsigned long do_try_to_free_page struct scan_control *sc) {int priority; -bool all_unreclaimable;unsigned long total_scanned =0 ;struct reclaim_state *reclaim_state = current->reclaim_state;unsigned long lru_pages =0 ;
@@ -1815,7 +1843,7 @@ static unsigned long do_try_to_free_page sc->nr_scanned =0 ;if (!priority)disable_swap_token (); - all_unreclaimable =shrink_zones (priority, zonelist, sc); +shrink_zones (priority, zonelist, sc);/* * Don't shrink slabs when reclaiming memory from * over limit cgroups
@@ -1879,7 +1907,7 @@ out:return sc->nr_reclaimed;/* top priority shrink_zones still had more to do? don't OOM, then */ -if (scanning_global_lru (sc) && !all_unreclaimable) +if (scanning_global_lru (sc) && !all_unreclaimable (zonelist, sc))return 1 ;return 0 ;
@@ -2137,8 +2165,7 @@ loop_again: total_scanned += sc.nr_scanned;if (zone->all_unreclaimable)continue ; -if (nr_slab ==0 && - zone->pages_scanned >= (zone_reclaimable_pages (zone) *6 )) +if (nr_slab ==0 && !zone_reclaimable (zone)) zone->all_unreclaimable =1 ;/* * If we've done a decent amount of scanning and
PATCH 46/80 percpu: fix pcpu_last_unit_cpu
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tejun Heo <[email protected]>
commit 46b30ea9bc3698bc1d1e6fd726c9601d46fa0a91 upstream.
pcpu_first/last_unit_cpu are used to track which cpu has the first and last units assigned. This in turn is used to determine the span of a chunk for man/unmap cache flushes and whether an address belongs to the first chunk or not in per_cpu_ptr_to_phys().
When the number of possible CPUs isn't power of two, a chunk may contain unassigned units towards the end of a chunk. The logic to determine pcpu_last_unit_cpu was incorrect when there was an unused unit at the end of a chunk. It failed to ignore the unused unit and assigned the unused marker NR_CPUS to pcpu_last_unit_cpu.
This was discovered through kdump failure which was caused by malfunctioning per_cpu_ptr_to_phys() on a kvm setup with 50 possible CPUs by CAI Qian.
--- mm/percpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/percpu.c +1 -1
@@ -1413,9 +1413,9 @@ int __init pcpu_setup_first_chunk(constif (pcpu_first_unit_cpu ==NR_CPUS ) pcpu_first_unit_cpu = cpu; + pcpu_last_unit_cpu = cpu; } } - pcpu_last_unit_cpu = cpu; pcpu_nr_units = unit;for_each_possible_cpu (cpu)
PATCH 47/80 aio: do not return ERESTARTSYS as a result of AIO
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jan Kara <[email protected]>
commit a0c42bac79731276c9b2f28d54f9e658fcf843a2 upstream.
OCFS2 can return ERESTARTSYS from its write function when the process is signalled while waiting for a cluster lock (and the filesystem is mounted with intr mount option). Generally, it seems reasonable to allow filesystems to return this error code from its IO functions. As we must not leak ERESTARTSYS (and similar error codes) to userspace as a result of an AIO operation, we have to properly convert it to EINTR inside AIO code (restarting the syscall isn't really an option because other AIO could have been already submitted by the same io_submit syscall).
--- fs/aio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/aio.c +9 -1
@@ -712,8 +712,16 @@ static ssize_t aio_run_iocb(struct kiocb*/ ret =retry (iocb); -if (ret != -EIOCBRETRY && ret != -EIOCBQUEUED ) +if (ret != -EIOCBRETRY && ret != -EIOCBQUEUED ) { +/* +* There's no easy way to restart the syscall since other AIO's +* may be already running. Just fail this IO with EINTR. +*/ +if (unlikely (ret == -ERESTARTSYS || ret == -ERESTARTNOINTR || + ret == -ERESTARTNOHAND || ret == -ERESTART_RESTARTBLOCK )) + ret = -EINTR ;aio_complete (iocb, ret,0 ); + } out:spin_lock_irq (&ctx->ctx_lock);
PATCH 48/80 aio: check for multiplication overflow in do_io_submit
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jeff Moyer <[email protected]>
commit 75e1c70fc31490ef8a373ea2a4bea2524099b478 upstream.
Tavis Ormandy pointed out that do_io_submit does not do proper bounds checking on the passed-in iocb array:
if (unlikely(nr < 0))
return -EINVAL;
if (unlikely(!access_ok(VERIFY_READ, iocbpp, (nr*sizeof(iocbpp))))) return -EFAULT; ^^^^^^^^^^^^^^^^^^
The attached patch checks for overflow, and if it is detected, the number of iocbs submitted is scaled down to a number that will fit in the long. This is an ok thing to do, as sys_io_submit is documented as returning the number of iocbs submitted, so callers should handle a return value of less than the 'nr' argument passed in.
--- fs/aio.c | 3 +++ 1 file changed, 3 insertions(+)
fs/aio.c +3 -0
@@ -1667,6 +1667,9 @@ long do_io_submit(aio_context_t ctx_id,if (unlikely (nr <0 ))return -EINVAL ; +if (unlikely (nr >LONG_MAX /sizeof (*iocbpp))) + nr =LONG_MAX /sizeof (*iocbpp); +if (unlikely (!access_ok (VERIFY_READ , iocbpp, (nr*sizeof (*iocbpp)))))return -EFAULT ;
PATCH 49/80 x86 platform drivers: hp-wmi Reorder event id processing
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Thomas Renninger <[email protected]>
commit 751ae808f6b29803228609f51aa1ae057f5c576e upstream.
Event id 0x4 defines the hotkey event.
No need (or even wrong) to query HPWMI_HOTKEY_QUERY if event id is != 0x4.
Reorder the eventcode conditionals and use switch case instead of if/else. Use an enum for the event ids cases.
--- drivers/platform/x86/hp-wmi.c | 51 ++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 19 deletions(-)
drivers/platform/x86/hp-wmi.c +32 -19
@@ -58,6 +58,12 @@ enum hp_wmi_radio { HPWMI_WWAN = 2, }; +enum hp_wmi_event_ids { +HPWMI_DOCK_EVENT =1 , +HPWMI_BEZEL_BUTTON =4 , +HPWMI_WIRELESS =5 , +}; +static int __devinit hp_wmi_bios_setup (struct platform_device *device); static int __exit hp_wmi_bios_remove(struct platform_device *device);static int hp_wmi_resume_handler (struct device *device);
@@ -338,7 +344,7 @@ static void hp_wmi_notify(u32 value, voistruct acpi_buffer response = {ACPI_ALLOCATE_BUFFER ,NULL };static struct key_entry *key;union acpi_object *obj; -int eventcode; +int eventcode, key_code;acpi_status status; status =wmi_get_event_data (value, &response);
@@ -357,28 +363,32 @@ static void hp_wmi_notify(u32 value, voi eventcode = *((u8 *) obj->buffer.pointer);kfree (obj); -if (eventcode ==0x4 ) - eventcode =hp_wmi_perform_query (HPWMI_HOTKEY_QUERY ,0 , -0 ); - key =hp_wmi_get_entry_by_scancode (eventcode); -if (key) { -switch (key->type) { -case KE_KEY : -input_report_key (hp_wmi_input_dev, - key->keycode,1 ); -input_sync (hp_wmi_input_dev); -input_report_key (hp_wmi_input_dev, - key->keycode,0 ); -input_sync (hp_wmi_input_dev); -break ; - } - }else if (eventcode ==0x1 ) { +switch (eventcode) { +case HPWMI_DOCK_EVENT :input_report_switch (hp_wmi_input_dev,SW_DOCK ,hp_wmi_dock_state ());input_report_switch (hp_wmi_input_dev,SW_TABLET_MODE ,hp_wmi_tablet_state ());input_sync (hp_wmi_input_dev); - }else if (eventcode ==0x5 ) { +break ; +case HPWMI_BEZEL_BUTTON : + key_code =hp_wmi_perform_query (HPWMI_HOTKEY_QUERY ,0 , +0 ); + key =hp_wmi_get_entry_by_scancode (key_code); +if (key) { +switch (key->type) { +case KE_KEY : +input_report_key (hp_wmi_input_dev, + key->keycode,1 ); +input_sync (hp_wmi_input_dev); +input_report_key (hp_wmi_input_dev, + key->keycode,0 ); +input_sync (hp_wmi_input_dev); +break ; + } + } +break ; +case HPWMI_WIRELESS :if (wifi_rfkill) rfkill_set_states(wifi_rfkill, hp_wmi_get_sw_state(HPWMI_WIFI),
@@ -391,9 +401,12 @@ static void hp_wmi_notify(u32 value, voirfkill_set_states (wwan_rfkill,hp_wmi_get_sw_state (HPWMI_WWAN ),hp_wmi_get_hw_state (HPWMI_WWAN )); - }else +break ; +default :printk (KERN_INFO "HP WMI: Unknown key pressed - %x\n" , eventcode); +break ; + } }static int __init hp_wmi_input_setup (void )
PATCH 50/80 GFS2: gfs2_logd should be using interruptible waits
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Steven Whitehouse <[email protected]>
commit 5f4874903df3562b9d5649fc1cf7b8c6bb238e42 upstream.
Looks like this crept in, in a recent update.
--- fs/gfs2/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/log.c +1 -1
@@ -932,7 +932,7 @@ int gfs2_logd(void *data) do { prepare_to_wait(&sdp->sd_logd_waitq, &wait, - TASK_UNINTERRUPTIBLE); + TASK_INTERRUPTIBLE); if (!gfs2_ail_flush_reqd(sdp) && !gfs2_jrnl_flush_reqd(sdp) && !kthread_should_stop())
PATCH 51/80 drm/nv50: initialize ramht_refs list for faked 0 channel
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Marcin Slusarz <[email protected]>
commit 615661f3948a066fd22a36fe8ea0c528b75ee373 upstream.
We need it for PFIFO_INTR_CACHE_ERROR interrupt handling, because nouveau_fifo_swmthd looks for matching gpuobj in ramht_refs list.
It fixes kernel panic in nouveau_gpuobj_ref_find.
--- drivers/gpu/drm/nouveau/nv50_instmem.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/nouveau/nv50_instmem.c +2 -0
@@ -141,6 +141,8 @@ nv50_instmem_init(struct drm_device *dev chan->file_priv = (struct drm_file *)-2 ; dev_priv->fifos[0 ] = dev_priv->fifos[127 ] = chan; +INIT_LIST_HEAD (&chan->ramht_refs); +/* Channel's PRAMIN object + heap */ ret =nouveau_gpuobj_new_fake (dev,0 , c_offset, c_size,0 ,NULL , &chan->ramin);
PATCH 52/80 inotify: send IN_UNMOUNT events
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Paris <[email protected]>
commit 611da04f7a31b2208e838be55a42c7a1310ae321 upstream.
Since the .31 or so notify rewrite inotify has not sent events about inodes which are unmounted. This patch restores those events.
--- fs/notify/inotify/inotify_user.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/notify/inotify/inotify_user.c +5 -2
@@ -96,8 +96,11 @@ static inline __u32 inotify_arg_to_mask( {__u32 mask; -/* everything should accept their own ignored and cares about children */ - mask = (FS_IN_IGNORED |FS_EVENT_ON_CHILD ); +/* +* everything should accept their own ignored, cares about children, +* and should receive events when the inode is unmounted +*/ + mask = (FS_IN_IGNORED |FS_EVENT_ON_CHILD |FS_UNMOUNT );/* mask off the flags used to open the fd */ mask |= (arg & (IN_ALL_EVENTS |IN_ONESHOT ));
PATCH 53/80 SCSI: mptsas: fix hangs caused by ATA pass-through
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ryan Kuester <[email protected]>
commit 2a1b7e575b80ceb19ea50bfa86ce0053ea57181d upstream.
I may have an explanation for the LSI 1068 HBA hangs provoked by ATA pass-through commands, in particular by smartctl.
First, my version of the symptoms. On an LSI SAS1068E B3 HBA running 01.29.00.00 firmware, with SATA disks, and with smartd running, I'm seeing occasional task, bus, and host resets, some of which lead to hard faults of the HBA requiring a reboot. Abusively looping the smartctl command,
# while true; do smartctl -a /dev/sdb > /dev/null; done
dramatically increases the frequency of these failures to nearly one per minute. A high IO load through the HBA while looping smartctl seems to improve the chance of a full scsi host reset or a non-recoverable hang.
I reduced what smartctl was doing down to a simple test case which causes the hang with a single IO when pointed at the sd interface. See the code at the bottom of this e-mail. It uses an SG_IO ioctl to issue a single pass-through ATA identify device command. If the buffer userspace gives for the read data has certain alignments, the task is issued to the HBA but the HBA fails to respond. If run against the sg interface, neither the test code nor smartctl causes a hang.
sd and sg handle the SG_IO ioctl slightly differently. Unless you specifically set a flag to do direct IO, sg passes a buffer of its own, which is page-aligned, to the block layer and later copies the result into the userspace buffer regardless of its alignment. sd, on the other hand, always does direct IO unless the userspace buffer fails an alignment test at block/blk-map.c line 57, in which case a page-aligned buffer is created and used for the transfer.
The alignment test currently checks for word-alignment, the default setup by scsi_lib.c; therefore, userspace buffers of almost any alignment are given directly to the HBA as DMA targets. The LSI 1068 hardware doesn't seem to like at least a couple of the alignments which cross a page boundary (see the test code below). Curiously, many page-boundary-crossing alignments do work just fine.
So, either the hardware has an bug handling certain alignments or the hardware has a stricter alignment requirement than the driver is advertising. If stricter alignment is required, then in no case should misaligned buffers from userspace be allowed through without being bounced or at least causing an error to be returned.
It seems the mptsas driver could use blk_queue_dma_alignment() to advertise a stricter alignment requirement. If it does, sd does the right thing and bounces misaligned buffers (see block/blk-map.c line 57). The following patch to 2.6.34-rc5 makes my symptoms go away. I'm sure this is the wrong place for this code, but it gets my idea across.
--- drivers/message/fusion/mptscsih.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/message/fusion/mptscsih.c +2 -0
@@ -2459,6 +2459,8 @@ mptscsih_slave_configure(struct scsi_dev ioc->name,sdev->tagged_supported, sdev->simple_tags, sdev->ordered_tags)); +blk_queue_dma_alignment (sdev->request_queue,512 -1 ); +return 0 ; }
Re: [53/80] SCSI: mptsas: fix hangs caused by ATA pass-through
Quoted 51 lines · Greg KH
2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ryan Kuester <[email protected]>
commit
2a1b7e575b80ceb19ea50bfa86ce0053ea57181dupstream.I may have an explanation for the LSI 1068 HBA hangs provoked by ATA pass-through commands, in particular by smartctl.
First, my version of the symptoms. On an LSI SAS1068E B3 HBA running 01.29.00.00 firmware, with SATA disks, and with smartd running, I'm seeing occasional task, bus, and host resets, some of which lead to hard faults of the HBA requiring a reboot. Abusively looping the smartctl command,
# while true; do smartctl -a /dev/sdb > /dev/null; donedramatically increases the frequency of these failures to nearly one per minute. A high IO load through the HBA while looping smartctl seems to improve the chance of a full scsi host reset or a non-recoverable hang.
I reduced what smartctl was doing down to a simple test case which causes the hang with a single IO when pointed at the sd interface. See the code at the bottom of this e-mail. It uses an
SG_IOioctl to issue a single pass-through ATA identify device command. If the buffer userspace gives for the read data has certain alignments, the task is issued to the HBA but the HBA fails to respond. If run against the sg interface, neither the test code nor smartctl causes a hang.sd and sg handle the
SG_IOioctl slightly differently. Unless you specifically set a flag to do direct IO, sg passes a buffer of its own, which is page-aligned, to the block layer and later copies the result into the userspace buffer regardless of its alignment. sd, on the other hand, always does direct IO unless the userspace buffer fails an alignment test atblock/blk-map.cline 57, in which case a page-aligned buffer is created and used for the transfer.The alignment test currently checks for word-alignment, the default setup by
scsi_lib.c; therefore, userspace buffers of almost any alignment are given directly to the HBA as DMA targets. The LSI 1068 hardware doesn't seem to like at least a couple of the alignments which cross a page boundary (see the test code below). Curiously, many page-boundary-crossing alignments do work just fine.So, either the hardware has an bug handling certain alignments or the hardware has a stricter alignment requirement than the driver is advertising. If stricter alignment is required, then in no case should misaligned buffers from userspace be allowed through without being bounced or at least causing an error to be returned.
Quoted 6 lines
It seems the mptsas driver could use
blk_queue_dma_alignment()to advertise a stricter alignment requirement. If it does, sd does the right thing and bounces misaligned buffers (seeblock/blk-map.cline 57). The following patch to 2.6.34-rc5 makes my symptoms go away. I'm sure this is the wrong place for this code, but it gets my idea across.
Interesting. I have recently experienced lockups (bus resets ...) while testing an older server machine with 2 new LSI PCI-X SAS1068E cards and 10+ SATA drives. I thought the problem was the machine I was testing on. This was on 2.6.35.X about 1 month ago (not sure the exact revision). I will try to setup the machine again and test before and after the patch.
BTW, my testing was forcing a check or rebuild on a 10 drive software raid 6 and while that was going on run smart checks on the drives. This would cause the bad behavior on the 2nd pass.
John
PATCH 54/80 KVM: Keep slot ID in memory slot structure
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Avi Kivity <[email protected]>
commit e36d96f7cfaa71870c407131eb4fbd38ea285c01 upstream.
May be used for distinguishing between internal and user slots, or for sorting slots in size order.
--- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 1 + 2 files changed, 2 insertions(+)
include/linux/kvm_host.h +1 -0
@@ -123,6 +123,7 @@ struct kvm_memory_slot { } *lpage_info[KVM_NR_PAGE_SIZES -1 ];unsigned long userspace_addr;int user_alloc; +int id; };static inline unsigned long kvm_dirty_bitmap_bytes (struct kvm_memory_slot *memslot)
virt/kvm/kvm_main.c +1 -0
@@ -566,6 +566,7 @@ int __kvm_set_memory_region(struct kvm * new = old = *memslot; + new.id = mem->slot; new.base_gfn = base_gfn; new.npages = npages; new.flags = mem->flags;
PATCH 55/80 KVM: Prevent internal slots from being COWed
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Avi Kivity <[email protected]>
commit 7ac77099ce88a0c31b75acd0ec5ef3da4415a6d8 upstream.
If a process with a memory slot is COWed, the page will change its address (despite having an elevated reference count). This breaks internal memory slots which have their physical addresses loaded into vmcs registers (see the APIC access memory slot).
--- arch/x86/kvm/x86.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kvm/x86.c +6 -1
@@ -5438,6 +5438,11 @@ int kvm_arch_prepare_memory_region(struc int user_alloc) {int npages = memslot->npages; +int map_flags =MAP_PRIVATE |MAP_ANONYMOUS ; + +/* Prevent internal slot pages from being moved by fork()/COW. */ +if (memslot->id >=KVM_MEMORY_SLOTS ) + map_flags =MAP_SHARED |MAP_ANONYMOUS ;/*To keep backward compatibility with older userspace, *x86 needs to hanlde !user_alloc case.
@@ -5450,7 +5455,7 @@ int kvm_arch_prepare_memory_region(struc userspace_addr =do_mmap (NULL ,0 , npages *PAGE_SIZE ,PROT_READ |PROT_WRITE , -MAP_PRIVATE |MAP_ANONYMOUS , + map_flags,0 );up_write (¤t->mm->mmap_sem);
PATCH 56/80 KVM: MMU: fix direct sps access corrupted
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Xiao Guangrong <[email protected]>
commit 9e7b0e7fba45ca3c6357aeb7091ebc281f1de365 upstream.
If the mapping is writable but the dirty flag is not set, we will find the read-only direct sp and setup the mapping, then if the write #PF occur, we will mark this mapping writable in the read-only direct sp, now, other real read-only mapping will happily write it without #PF.
It may hurt guest's COW
Fixed by re-install the mapping when write #PF occur.
--- arch/x86/kvm/paging_tmpl.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
arch/x86/kvm/paging_tmpl.h +26 -2
@@ -324,8 +324,32 @@ static u64 *FNAME(fetch)(struct kvm_vcpubreak ; } -if (is_shadow_present_pte (*sptep) && !is_large_pte (*sptep)) -continue ; +if (is_shadow_present_pte (*sptep) && !is_large_pte (*sptep)) { +struct kvm_mmu_page *child; +unsigned direct_access; + +if (level != gw->level) +continue ; + +/* +* For the direct sp, if the guest pte's dirty bit +* changed form clean to dirty, it will corrupt the +* sp's access: allow writable in the read-only sp, +* so we should update the spte at this point to get +* a new sp with the correct access. +*/ + direct_access = gw->pt_access & gw->pte_access; +if (!is_dirty_gpte (gw->ptes[gw->level -1 ])) + direct_access &= ~ACC_WRITE_MASK ; + + child =page_header (*sptep &PT64_BASE_ADDR_MASK ); +if (child->role.access == direct_access) +continue ; + +mmu_page_remove_parent_pte (child, sptep); +__set_spte (sptep, shadow_trap_nonpresent_pte); +kvm_flush_remote_tlbs (vcpu->kvm); + }if (is_large_pte (*sptep)) {rmap_remove (vcpu->kvm, sptep);
PATCH 57/80 KVM: x86: emulator: inc/dec can have lock prefix
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Gleb Natapov <[email protected]>
commit c0e0608cb902af1a1fd8d413ec0a07ee1e62c652 upstream.
Mark inc (0xfe/0 0xff/0) and dec (0xfe/1 0xff/1) as lock prefix capable.
--- arch/x86/kvm/emulate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/emulate.c +2 -2
@@ -345,10 +345,10 @@ static u32 group_table[] = { DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM, 0, 0, 0, 0, [Group4*8 ] = - ByteOp | DstMem | SrcNone | ModRM, ByteOp | DstMem | SrcNone | ModRM, + ByteOp | DstMem | SrcNone | ModRM | Lock, ByteOp | DstMem | SrcNone | ModRM | Lock, 0, 0, 0, 0, 0, 0, [Group5*8 ] = - DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM, + DstMem | SrcNone | ModRM | Lock, DstMem | SrcNone | ModRM | Lock, SrcMem | ModRM | Stack,0 , SrcMem | ModRM | Stack, SrcMem | ModRM | Src2Mem16 | ImplicitOps, SrcMem | ModRM | Stack, 0,
PATCH 58/80 KVM: MMU: fix mmu notifier invalidate handler for huge spte
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 6e3e243c3b6e0bbd18c6ce0fbc12bc3fe2d77b34 upstream.
The index wasn't calculated correctly (off by one) for huge spte so KVM guest was unstable with transparent hugepages.
--- arch/x86/kvm/mmu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/x86/kvm/mmu.c +6 -2
@@ -799,8 +799,12 @@ static int kvm_handle_hva(struct kvm *kv ret =handler (kvm, &memslot->rmap[gfn_offset], data);for (j =0 ; j <KVM_NR_PAGE_SIZES -1 ; ++j) { -int idx = gfn_offset; - idx /=KVM_PAGES_PER_HPAGE (PT_DIRECTORY_LEVEL + j); +unsigned long idx; +int nr; + + nr =KVM_PAGES_PER_HPAGE (PT_DIRECTORY_LEVEL +j); + idx = (memslot->base_gfn+gfn_offset) / nr - + memslot->base_gfn / nr; ret |=handler (kvm, &memslot->lpage_info[j][idx].rmap_pde, data);
PATCH 59/80 KVM: VMX: Fix host GDT.LIMIT corruption
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Avi Kivity <[email protected]>
commit 3444d7da1839b851eefedd372978d8a982316c36 upstream.
vmx does not restore GDT.LIMIT to the host value, instead it sets it to 64KB. This means host userspace can learn a few bits of host memory.
Fix by reloading GDTR when we load other host state.
--- arch/x86/kvm/vmx.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kvm/vmx.c +4 -0
@@ -177,6 +177,7 @@ static u64 construct_eptp(unsigned long static DEFINE_PER_CPU(struct vmcs *, vmxarea); static DEFINE_PER_CPU(struct vmcs *, current_vmcs); static DEFINE_PER_CPU(struct list_head, vcpus_on_cpu); +static DEFINE_PER_CPU(struct desc_ptr, host_gdt);static unsigned long *vmx_io_bitmap_a;static unsigned long *vmx_io_bitmap_b;
@@ -812,6 +813,7 @@ static void __vmx_load_host_state(struct wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); }#endif +load_gdt (&__get_cpu_var (host_gdt)); }static void vmx_load_host_state (struct vcpu_vmx *vmx)
@@ -1314,6 +1316,8 @@ static int hardware_enable(void *garbageept_sync_global (); +store_gdt (&__get_cpu_var (host_gdt)); +return 0 ; }
PATCH 60/80 IA64: fix siglock
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tony Luck <[email protected]>
commit f574c843191728d9407b766a027f779dcd27b272 upstream.
When ia64 converted to using ticket locks, an inline implementation of trylock/unlock in fsys.S was missed. This was not noticed because in most circumstances it simply resulted in using the slow path because the siglock was apparently not available (under old spinlock rules).
Problems occur when the ticket spinlock has value 0x0 (when first initialised, or when it wraps around). At this point the fsys.S code acquires the lock (changing the 0x0 to 0x1. If another process attempts to get the lock at this point, it will change the value from 0x1 to 0x2 (using new ticket lock rules). Then the fsys.S code will free the lock using old spinlock rules by writing 0x0 to it. From here a variety of bad things can happen.
--- arch/ia64/kernel/fsys.S | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-)
arch/ia64/kernel/fsys.S +39 -7
@@ -424,14 +424,26 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP #ifdef CONFIG_SMP - mov r17=1 - ;; - cmpxchg4.acq r18=[r31],r17,ar.ccv // try to acquire the lock + // __ticket_spin_trylock(r31) + ld4 r17=[r31] mov r8=EINVAL // default to EINVAL ;; + extr r9=r17,17,15 + ;; + xor r18=r17,r9 + adds r19=1,r17 + ;; + extr.u r18=r18,0,15 + ;; + cmp.eq p0,p7=0,r18 +(p7) br.cond.spnt.many .lock_contention + mov.m ar.ccv=r17 + ;; + cmpxchg4.acq r9=[r31],r19,ar.ccv + ;; + cmp4.eq p0,p7=r9,r17 +(p7) br.cond.spnt.many .lock_contention ld8 r3=[r2] // re-read current->blocked now that we hold the lock - cmp4.ne p6,p0=r18,r0 -(p6) br.cond.spnt.many .lock_contention ;; #else ld8 r3=[r2] // re-read current->blocked now that we hold the lock
@@ -490,7 +502,17 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 (p6) br.cond.spnt.few 1b // yes -> retry #ifdef CONFIG_SMP - st4.rel [r31]=r0 // release the lock + // __ticket_spin_unlock(r31) + adds r31=2,r31 + ;; + ld2.bias r2=[r31] + mov r3=65534 + ;; + adds r2=2,r2 + ;; + and r3=r3,r2 + ;; + st2.rel [r31]=r3 #endif SSM_PSR_I(p0, p9, r31) ;;
@@ -512,7 +534,17 @@ EX(.fail_efault, (p15) st8 [r34]=r3) .sig_pending: #ifdef CONFIG_SMP - st4.rel [r31]=r0 // release the lock + // __ticket_spin_unlock(r31) + adds r31=2,r31 + ;; + ld2.bias r2=[r31] + mov r3=65534 + ;; + adds r2=2,r2 + ;; + and r3=r3,r2 + ;; + st2.rel [r31]=r3 #endif SSM_PSR_I(p0, p9, r17) ;;
PATCH 61/80 IA64: Optimize ticket spinlocks in fsys_rt_sigprocmask
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Petr Tesarik <[email protected]>
commit 2d2b6901649a62977452be85df53eda2412def24 upstream.
Tony's fix (f574c843191728d9407b766a027f779dcd27b272) has a small bug, it incorrectly uses "r3" as a scratch register in the first of the two unlock paths ... it is also inefficient. Optimize the fast path again.
--- arch/ia64/kernel/fsys.S | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-)
arch/ia64/kernel/fsys.S +11 -31
@@ -420,34 +420,31 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 ;; RSM_PSR_I(p0, r18, r19) // mask interrupt delivery - mov ar.ccv=0 andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP + mov r8=EINVAL // default to EINVAL #ifdef CONFIG_SMP // __ticket_spin_trylock(r31) ld4 r17=[r31] - mov r8=EINVAL // default to EINVAL - ;; - extr r9=r17,17,15 ;; - xor r18=r17,r9 + mov.m ar.ccv=r17 + extr.u r9=r17,17,15 adds r19=1,r17 + extr.u r18=r17,0,15 ;; - extr.u r18=r18,0,15 + cmp.eq p6,p7=r9,r18 ;; - cmp.eq p0,p7=0,r18 +(p6) cmpxchg4.acq r9=[r31],r19,ar.ccv +(p6) dep.z r20=r19,1,15 // next serving ticket for unlock (p7) br.cond.spnt.many .lock_contention - mov.m ar.ccv=r17 - ;; - cmpxchg4.acq r9=[r31],r19,ar.ccv ;; cmp4.eq p0,p7=r9,r17 + adds r31=2,r31 (p7) br.cond.spnt.many .lock_contention ld8 r3=[r2] // re-read current->blocked now that we hold the lock ;; #else ld8 r3=[r2] // re-read current->blocked now that we hold the lock - mov r8=EINVAL // default to EINVAL #endif add r18=IA64_TASK_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r16 add r19=IA64_TASK_SIGNAL_OFFSET,r16
@@ -503,16 +500,8 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 #ifdef CONFIG_SMP // __ticket_spin_unlock(r31) - adds r31=2,r31 - ;; - ld2.bias r2=[r31] - mov r3=65534 - ;; - adds r2=2,r2 - ;; - and r3=r3,r2 - ;; - st2.rel [r31]=r3 + st2.rel [r31]=r20 + mov r20=0 // i must not leak kernel bits... #endif SSM_PSR_I(p0, p9, r31) ;;
@@ -535,16 +524,7 @@ EX(.fail_efault, (p15) st8 [r34]=r3) .sig_pending: #ifdef CONFIG_SMP // __ticket_spin_unlock(r31) - adds r31=2,r31 - ;; - ld2.bias r2=[r31] - mov r3=65534 - ;; - adds r2=2,r2 - ;; - and r3=r3,r2 - ;; - st2.rel [r31]=r3 + st2.rel [r31]=r20 // release the lock #endif SSM_PSR_I(p0, p9, r17) ;;
PATCH 62/80 KEYS: Fix RCU no-lock warning in keyctl_session_to_parent()
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Howells <[email protected]>
commit 9d1ac65a9698513d00e5608d93fca0c53f536c14 upstream.
There's an protected access to the parent process's credentials in the middle of keyctl_session_to_parent(). This results in the following RCU warning:
===================================================
[ INFO: suspicious rcu_dereference_check() usage. ]
---------------------------------------------------
security/keys/keyctl.c:1291 invoked rcu_dereference_check() without protection!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
1 lock held by keyctl-session-/2137:
#0: (tasklist_lock){.+.+..}, at: [<ffffffff811ae2ec>] keyctl_session_to_parent+0x60/0x236
stack backtrace: Pid: 2137, comm: keyctl-session- Not tainted 2.6.36-rc2-cachefs+ #1 Call Trace: [<ffffffff8105606a>] lockdep_rcu_dereference+0xaa/0xb3 [<ffffffff811ae379>] keyctl_session_to_parent+0xed/0x236 [<ffffffff811af77e>] sys_keyctl+0xb4/0xb6 [<ffffffff81001eab>] system_call_fastpath+0x16/0x1b
The code should take the RCU read lock to make sure the parents credentials don't go away, even though it's holding a spinlock and has IRQ disabled.
--- security/keys/keyctl.c | 3 +++ 1 file changed, 3 insertions(+)
security/keys/keyctl.c +3 -0
@@ -1259,6 +1259,7 @@ long keyctl_session_to_parent(void) keyring_r =NULL ; me = current; +rcu_read_lock ();write_lock_irq (&tasklist_lock); parent = me->real_parent;
@@ -1306,6 +1307,7 @@ long keyctl_session_to_parent(void)set_ti_thread_flag (task_thread_info (parent),TIF_NOTIFY_RESUME );write_unlock_irq (&tasklist_lock); +rcu_read_unlock ();if (oldcred)put_cred (oldcred);return 0 ;
@@ -1314,6 +1316,7 @@ already_same: ret =0 ; not_permitted:write_unlock_irq (&tasklist_lock); +rcu_read_unlock ();put_cred (cred);return ret;
PATCH 63/80 KEYS: Fix bug in keyctl_session_to_parent() if parent has no session keyring
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Howells <[email protected]>
commit 3d96406c7da1ed5811ea52a3b0905f4f0e295376 upstream.
Fix a bug in keyctl_session_to_parent() whereby it tries to check the ownership of the parent process's session keyring whether or not the parent has a session keyring [CVE-2010-2960].
This results in the following oops:
BUG: unable to handle kernel NULL pointer dereference at 00000000000000a0 IP: [<ffffffff811ae4dd>] keyctl_session_to_parent+0x251/0x443 ... Call Trace: [<ffffffff811ae2f3>] ? keyctl_session_to_parent+0x67/0x443 [<ffffffff8109d286>] ? __do_fault+0x24b/0x3d0 [<ffffffff811af98c>] sys_keyctl+0xb4/0xb8 [<ffffffff81001eab>] system_call_fastpath+0x16/0x1b
if the parent process has no session keyring.
If the system is using pam_keyinit then it mostly protected against this as all processes derived from a login will have inherited the session keyring created by pam_keyinit during the log in procedure.
To test this, pam_keyinit calls need to be commented out in /etc/pam.d/.
--- security/keys/keyctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
security/keys/keyctl.c +2 -1
@@ -1292,7 +1292,8 @@ long keyctl_session_to_parent(void) goto not_permitted;/* the keyrings must have the same UID */ -if (pcred->tgcred->session_keyring->uid != mycred->euid || +if ((pcred->tgcred->session_keyring && + pcred->tgcred->session_keyring->uid != mycred->euid) || mycred->tgcred->session_keyring->uid != mycred->euid) goto not_permitted;
PATCH 64/80 xfs: prevent reading uninitialized stack memory
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <[email protected]>
commit a122eb2fdfd78b58c6dd992d6f4b1aaef667eef9 upstream.
The XFS_IOC_FSGETXATTR ioctl allows unprivileged users to read 12 bytes of uninitialized stack memory, because the fsxattr struct declared on the stack in xfs_ioc_fsgetxattr() does not alter (or zero) the 12-byte fsx_pad member before copying it back to the user. This patch takes care of it.
--- fs/xfs/linux-2.6/xfs_ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/xfs/linux-2.6/xfs_ioctl.c +2 -0
@@ -794,6 +794,8 @@ xfs_ioc_fsgetxattr( {struct fsxattr fa; +memset (&fa,0 ,sizeof (struct fsxattr )); +xfs_ilock (ip,XFS_ILOCK_SHARED ); fa.fsx_xflags =xfs_ip2xflags (ip); fa.fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog;
PATCH 65/80 drivers/video/via/ioctl.c: prevent reading uninitialized stack memory
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <[email protected]>
commit b4aaa78f4c2f9cde2f335b14f4ca30b01f9651ca upstream.
The VIAFB_GET_INFO device ioctl allows unprivileged users to read 246 bytes of uninitialized stack memory, because the "reserved" member of the viafb_ioctl_info struct declared on the stack is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/video/via/ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/video/via/ioctl.c +2 -0
@@ -25,6 +25,8 @@ int viafb_ioctl_get_viafb_info(u_long ar {struct viafb_ioctl_info viainfo; +memset (&viainfo,0 ,sizeof (struct viafb_ioctl_info )); + viainfo.viafb_id =VIAID ; viainfo.vendor_id =PCI_VIA_VENDOR_ID ;
PATCH 66/80 AT91: change dma resource index
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Nicolas Ferre <[email protected]>
commit 8d2602e0778299e2d6084f03086b716d6e7a1e1e upstream.
--- arch/arm/mach-at91/at91sam9g45_devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-at91/at91sam9g45_devices.c +1 -1
@@ -46,7 +46,7 @@ static struct resource hdmac_resources[] .end = AT91_BASE_SYS + AT91_DMA + SZ_512 - 1, .flags = IORESOURCE_MEM, }, - [2] = { + [1] = { .start = AT91SAM9G45_ID_DMA, .end = AT91SAM9G45_ID_DMA, .flags = IORESOURCE_IRQ,
PATCH 67/80 PM: Prevent waiting forever on asynchronous resume after failing suspend
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Colin Cross <[email protected]>
commit 152e1d592071c8b312bb898bc1118b64e4aea535 upstream.
During suspend, the power.completion is expected to be set when a device has not yet started suspending. Set it on init to fix a corner case where a device is resumed when its parent has never suspended.
Consider three drivers, A, B, and C. The parent of A is C, and C has async_suspend set. On boot, C->power.completion is initialized to 0.
During the first suspend:suspend_devices_and_enter(...)
dpm_resume(...)
device_suspend(A)
device_suspend(B) returns error, aborts suspend
dpm_resume_end(...)
dpm_resume(...)
device_resume(A)
dpm_wait(A->parent == C)
wait_for_completion(C->power.completion)The wait_for_completion will never complete, because complete_all(C->power.completion) will only be called from device_suspend(C) or device_resume(C), neither of which is called if suspend is aborted before C.
After a successful suspend->resume cycle, where B doesn't abort suspend, C->power.completion is left in the completed state by the call to device_resume(C), and the same call path will work if B aborts suspend.
--- drivers/base/power/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/base/power/main.c +1 -0
@@ -59,6 +59,7 @@ void device_pm_init(struct device *dev) { dev->power.status =DPM_ON ;init_completion (&dev->power.completion); +complete_all (&dev->power.completion);pm_runtime_init (dev); }
PATCH 68/80 PM / Hibernate: Avoid hitting OOM during preallocation of memory
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Rafael J. Wysocki <[email protected]>
commit 6715045ddc7472a22be5e49d4047d2d89b391f45 upstream.
There is a problem in hibernate_preallocate_memory() that it calls preallocate_image_memory() with an argument that may be greater than the total number of available non-highmem memory pages. If that's the case, the OOM condition is guaranteed to trigger, which in turn can cause significant slowdown to occur during hibernation.
To avoid that, make preallocate_image_memory() adjust its argument before calling preallocate_image_pages(), so that the total number of saveable non-highem pages left is not less than the minimum size of a hibernation image. Change hibernate_preallocate_memory() to try to allocate from highmem if the number of pages allocated by preallocate_image_memory() is too low.
Modify free_unnecessary_pages() to take all possible memory allocation patterns into account.
--- kernel/power/snapshot.c | 85 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 20 deletions(-)
kernel/power/snapshot.c +65 -20
@@ -1121,9 +1121,19 @@ static unsigned long preallocate_image_preturn nr_alloc; } -static unsigned long preallocate_image_memory (unsigned long nr_pages) +static unsigned long preallocate_image_memory (unsigned long nr_pages, +unsigned long avail_normal) { -return preallocate_image_pages (nr_pages,GFP_IMAGE ); +unsigned long alloc; + +if (avail_normal <= alloc_normal) +return 0 ; + + alloc = avail_normal - alloc_normal; +if (nr_pages < alloc) + alloc = nr_pages; + +return preallocate_image_pages (alloc,GFP_IMAGE ); }#ifdef CONFIG_HIGHMEM
@@ -1169,15 +1179,22 @@ static inline unsigned long preallocate_*/ static void free_unnecessary_pages (void ) { -unsigned long save_highmem, to_free_normal, to_free_highmem; +unsigned long save, to_free_normal, to_free_highmem; - to_free_normal = alloc_normal -count_data_pages (); - save_highmem =count_highmem_pages (); -if (alloc_highmem > save_highmem) { - to_free_highmem = alloc_highmem - save_highmem; + save =count_data_pages (); +if (alloc_normal >= save) { + to_free_normal = alloc_normal - save; + save =0 ; + }else { + to_free_normal =0 ; + save -= alloc_normal; + } + save +=count_highmem_pages (); +if (alloc_highmem >= save) { + to_free_highmem = alloc_highmem - save; }else { to_free_highmem =0 ; - to_free_normal -= save_highmem - alloc_highmem; + to_free_normal -= save - alloc_highmem; }memory_bm_position_reset (©_bm);
@@ -1258,7 +1275,7 @@ int hibernate_preallocate_memory(void) {struct zone *zone;unsigned long saveable, size, max_size, count, highmem, pages =0 ; -unsigned long alloc, save_highmem, pages_highmem; +unsigned long alloc, save_highmem, pages_highmem, avail_normal;struct timeval start, stop;int error;
@@ -1295,6 +1312,7 @@ int hibernate_preallocate_memory(void)else count +=zone_page_state (zone,NR_FREE_PAGES ); } + avail_normal = count; count += highmem; count -= totalreserve_pages;
@@ -1309,12 +1327,21 @@ int hibernate_preallocate_memory(void)*/ if (size >= saveable) { pages =preallocate_image_highmem (save_highmem); - pages +=preallocate_image_memory (saveable - pages); + pages +=preallocate_image_memory (saveable - pages, avail_normal); goto out; }/* Estimate the minimum size of the image. */ pages =minimum_image_size (saveable); +/* +* To avoid excessive pressure on the normal zone, leave room in it to +* accommodate an image of the minimum size (unless it's already too +* small, in which case don't preallocate pages from it at all). +*/ +if (avail_normal > pages) + avail_normal -= pages; +else + avail_normal =0 ;if (size < pages) size = min_t(unsigned long, pages, max_size);
@@ -1335,16 +1362,34 @@ int hibernate_preallocate_memory(void)*/ pages_highmem =preallocate_image_highmem (highmem /2 ); alloc = (count - max_size) - pages_highmem; - pages =preallocate_image_memory (alloc); -if (pages < alloc) - goto err_out; - size = max_size - size; - alloc = size; - size =preallocate_highmem_fraction (size, highmem, count); - pages_highmem += size; - alloc -= size; - pages +=preallocate_image_memory (alloc); - pages += pages_highmem; + pages =preallocate_image_memory (alloc, avail_normal); +if (pages < alloc) { +/* We have exhausted non-highmem pages, try highmem. */ + alloc -= pages; + pages += pages_highmem; + pages_highmem =preallocate_image_highmem (alloc); +if (pages_highmem < alloc) + goto err_out; + pages += pages_highmem; +/* +* size is the desired number of saveable pages to leave in +* memory, so try to preallocate (all memory - size) pages. +*/ + alloc = (count - pages) - size; + pages +=preallocate_image_highmem (alloc); + }else { +/* +* There are approximately max_size saveable pages at this point +* and we want to reduce this number down to size. +*/ + alloc = max_size - size; + size =preallocate_highmem_fraction (alloc, highmem, count); + pages_highmem += size; + alloc -= size; + size =preallocate_image_memory (alloc, avail_normal); + pages_highmem +=preallocate_image_highmem (alloc - size); + pages += pages_highmem + size; + }/* * We only need as many page frames for the image as there are saveable
PATCH 69/80 x86, asm: Use a lower case name for the end macro in atomic64_386_32.S
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Luca Barbieri <[email protected]>
commit 417484d47e115774745ef025bce712a102b6f86f upstream.
Use a lowercase name for the end macro, which somehow fixes a binutils 2.16 problem.
LKML-Reference: <[email protected]>
--- arch/x86/lib/atomic64_386_32.S | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-)
arch/x86/lib/atomic64_386_32.S +20 -18
@@ -26,35 +26,37 @@ .endm #define BEGIN(op) \ -.macro END; \ +.macro endp; \ CFI_ENDPROC; \ ENDPROC(atomic64_##op##_386); \ -.purgem END; \ +.purgem endp; \ .endm; \ ENTRY(atomic64_##op##_386); \ CFI_STARTPROC; \ LOCK v; +#define ENDP endp + #define RET \ UNLOCK v; \ ret -#define RET_END \ +#define RET_ENDP \ RET; \ - END + ENDP #define v %ecx BEGIN(read) movl (v), %eax movl 4(v), %edx -RET_END +RET_ENDP #undef v #define v %esi BEGIN(set) movl %ebx, (v) movl %ecx, 4(v) -RET_END +RET_ENDP #undef v #define v %esi
@@ -63,14 +65,14 @@ BEGIN(xchg) movl 4(v), %edx movl %ebx, (v) movl %ecx, 4(v) -RET_END +RET_ENDP #undef v #define v %ecx BEGIN(add) addl %eax, (v) adcl %edx, 4(v) -RET_END +RET_ENDP #undef v #define v %ecx
@@ -79,14 +81,14 @@ BEGIN(add_return) adcl 4(v), %edx movl %eax, (v) movl %edx, 4(v) -RET_END +RET_ENDP #undef v #define v %ecx BEGIN(sub) subl %eax, (v) sbbl %edx, 4(v) -RET_END +RET_ENDP #undef v #define v %ecx
@@ -98,14 +100,14 @@ BEGIN(sub_return) adcl 4(v), %edx movl %eax, (v) movl %edx, 4(v) -RET_END +RET_ENDP #undef v #define v %esi BEGIN(inc) addl $1, (v) adcl $0, 4(v) -RET_END +RET_ENDP #undef v #define v %esi
@@ -116,14 +118,14 @@ BEGIN(inc_return) adcl $0, %edx movl %eax, (v) movl %edx, 4(v) -RET_END +RET_ENDP #undef v #define v %esi BEGIN(dec) subl $1, (v) sbbl $0, 4(v) -RET_END +RET_ENDP #undef v #define v %esi
@@ -134,7 +136,7 @@ BEGIN(dec_return) sbbl $0, %edx movl %eax, (v) movl %edx, 4(v) -RET_END +RET_ENDP #undef v #define v %ecx
@@ -156,7 +158,7 @@ BEGIN(add_unless) jne 1b xorl %eax, %eax jmp 2b -END +ENDP #undef v #define v %esi
@@ -177,7 +179,7 @@ BEGIN(inc_not_zero) testl %edx, %edx jne 1b jmp 2b -END +ENDP #undef v #define v %esi
@@ -190,5 +192,5 @@ BEGIN(dec_if_positive) movl %eax, (v) movl %edx, 4(v) 1: -RET_END +RET_ENDP #undef v
PATCH 70/80 ALSA: hda - Fix beep frequency on IDT 92HD73xx and 92HD71Bxx codecs
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Daniel J Blueman <[email protected]>
commit 1b0e372d7b52c9fc96348779015a6db7df7f286e upstream.
Fix HDA beep frequency on IDT 92HD73xx and 92HD71Bxx codecs. These codecs use the standard beep frequency calculation although the datasheet says it's linear frequency.
Other IDT/STAC codecs might have the same problem. They should be fixed individually later.
--- sound/pci/hda/patch_sigmatel.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
sound/pci/hda/patch_sigmatel.c +11 -1
@@ -202,6 +202,7 @@ struct sigmatel_spec { unsigned int spdif_mute: 1; unsigned int check_volume_offset:1; unsigned int auto_mic:1; + unsigned int linear_tone_beep:1;/* gpio lines */ unsigned int eapd_mask;
@@ -3802,7 +3803,7 @@ static int stac92xx_parse_auto_config(streturn err;if (codec->beep) {/* IDT/STAC codecs have linear beep tone parameter */ - codec->beep->linear_tone =1 ; + codec->beep->linear_tone = spec->linear_tone_beep;/* if no beep switch is available, make its own one */ caps =query_amp_caps (codec, nid,HDA_OUTPUT );if (!(caps &AC_AMPCAP_MUTE )) {
@@ -5005,6 +5006,7 @@ static int patch_stac9200(struct hda_cod codec->no_trigger_sense =1 ; codec->spec = spec; + spec->linear_tone_beep =1 ; spec->num_pins =ARRAY_SIZE (stac9200_pin_nids); spec->pin_nids = stac9200_pin_nids; spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
@@ -5068,6 +5070,7 @@ static int patch_stac925x(struct hda_cod codec->no_trigger_sense =1 ; codec->spec = spec; + spec->linear_tone_beep =1 ; spec->num_pins =ARRAY_SIZE (stac925x_pin_nids); spec->pin_nids = stac925x_pin_nids;
@@ -5153,6 +5156,7 @@ static int patch_stac92hd73xx(struct hda codec->no_trigger_sense =1 ; codec->spec = spec; + spec->linear_tone_beep =0 ; codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; spec->num_pins =ARRAY_SIZE (stac92hd73xx_pin_nids); spec->pin_nids = stac92hd73xx_pin_nids;
@@ -5300,6 +5304,7 @@ static int patch_stac92hd83xxx(struct hd codec->no_trigger_sense =1 ; codec->spec = spec; + spec->linear_tone_beep =1 ; codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; spec->digbeep_nid =0x21 ; spec->mux_nids = stac92hd83xxx_mux_nids;
@@ -5522,6 +5527,7 @@ static int patch_stac92hd71bxx(struct hd codec->no_trigger_sense =1 ; codec->spec = spec; + spec->linear_tone_beep =0 ; codec->patch_ops = stac92xx_patch_ops; spec->num_pins =STAC92HD71BXX_NUM_PINS ;switch (codec->vendor_id) {
@@ -5779,6 +5785,7 @@ static int patch_stac922x(struct hda_cod codec->no_trigger_sense =1 ; codec->spec = spec; + spec->linear_tone_beep =1 ; spec->num_pins =ARRAY_SIZE (stac922x_pin_nids); spec->pin_nids = stac922x_pin_nids; spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
@@ -5883,6 +5890,7 @@ static int patch_stac927x(struct hda_cod codec->no_trigger_sense =1 ; codec->spec = spec; + spec->linear_tone_beep =1 ; codec->slave_dig_outs = stac927x_slave_dig_outs; spec->num_pins =ARRAY_SIZE (stac927x_pin_nids); spec->pin_nids = stac927x_pin_nids;
@@ -6018,6 +6026,7 @@ static int patch_stac9205(struct hda_cod codec->no_trigger_sense =1 ; codec->spec = spec; + spec->linear_tone_beep =1 ; spec->num_pins =ARRAY_SIZE (stac9205_pin_nids); spec->pin_nids = stac9205_pin_nids; spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
@@ -6174,6 +6183,7 @@ static int patch_stac9872(struct hda_codreturn -ENOMEM ; codec->no_trigger_sense =1 ; codec->spec = spec; + spec->linear_tone_beep =1 ; spec->num_pins =ARRAY_SIZE (stac9872_pin_nids); spec->pin_nids = stac9872_pin_nids;
PATCH 71/80 Fix call to replaced SuperIO functions
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Morten H. Larsen <[email protected]>
commit 59b25ed91400ace98d6cf0d59b1cb6928ad5cd37 upstream.
This patch fixes the failure to compile Alpha Generic because of previously overlooked calls to ns87312_enable_ide(). The function has been replaced by newer SuperIO code.
--- arch/alpha/kernel/proto.h | 3 --- arch/alpha/kernel/sys_cabriolet.c | 19 ++++++++++++++++--- arch/alpha/kernel/sys_takara.c | 11 +++++++++-- 3 files changed, 25 insertions(+), 8 deletions(-)
arch/alpha/kernel/proto.h +0 -3
@@ -156,9 +156,6 @@ extern void SMC669_Init(int);/* es1888.c */ extern void es1888_init (void ); -/* ns87312.c */ -extern void ns87312_enable_ide (long ide_base); -/* ../lib/fpreg.c */ extern void alpha_write_fp_reg (unsigned long reg,unsigned long val);extern unsigned long alpha_read_fp_reg (unsigned long reg);
arch/alpha/kernel/sys_cabriolet.c +16 -3
@@ -33,7 +33,7 @@#include "irq_impl.h" #include "pci_impl.h" #include "machvec_impl.h" - +#include "pc873xx.h" /* Note mask bit is true for DISABLED irqs. */ static unsigned long cached_irq_mask = ~0UL ;
@@ -236,17 +236,30 @@ cabriolet_map_irq(struct pci_dev *dev, u }static inline void __init +cabriolet_enable_ide (void ) +{ +if (pc873xx_probe () ==-1 ) { +printk (KERN_ERR "Probing for PC873xx Super IO chip failed.\n" ); + }else { +printk (KERN_INFO "Found %s Super IO chip at 0x%x\n" , +pc873xx_get_model (),pc873xx_get_base ()); + +pc873xx_enable_ide (); + } +} + +static inline void __init cabriolet_init_pci (void ) {common_init_pci (); -ns87312_enable_ide (0x398 ); +cabriolet_enable_ide (); }static inline void __init cia_cab_init_pci (void ) {cia_init_pci (); -ns87312_enable_ide (0x398 ); +cabriolet_enable_ide (); }/*
arch/alpha/kernel/sys_takara.c +9 -2
@@ -29,7 +29,7 @@#include "irq_impl.h" #include "pci_impl.h" #include "machvec_impl.h" - +#include "pc873xx.h" /* Note mask bit is true for DISABLED irqs. */ static unsigned long cached_irq_mask[2 ] = {-1 ,-1 };
@@ -264,7 +264,14 @@ takara_init_pci(void) alpha_mv.pci_map_irq = takara_map_irq_srm;cia_init_pci (); -ns87312_enable_ide (0x26e ); + +if (pc873xx_probe () ==-1 ) { +printk (KERN_ERR "Probing for PC873xx Super IO chip failed.\n" ); + }else { +printk (KERN_INFO "Found %s Super IO chip at 0x%x\n" , +pc873xx_get_model (),pc873xx_get_base ()); +pc873xx_enable_ide (); + } }
PATCH 72/80 dell-wmi: Add support for eject key on Dell Studio 1555
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Islam Amer <[email protected]>
commit d5164dbf1f651d1e955b158fb70a9c844cc91cd1 upstream.
Fixes pressing the eject key on Dell Studio 1555 does not work and produces message :
dell-wmi: Unknown key 0 pressed
--- drivers/platform/x86/dell-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/dell-wmi.c +1 -1
@@ -221,7 +221,7 @@ static void dell_wmi_notify(u32 value, vreturn ; } -if (dell_new_hk_type) +if (dell_new_hk_type || buffer_entry[1 ] ==0x0 ) reported_key = (int )buffer_entry[2 ];else reported_key = (int )buffer_entry[1 ] &0xffff ;
PATCH 73/80 mm: page allocator: drain per-cpu lists after direct reclaim allocation fails
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mel Gorman <[email protected]>
commit 9ee493ce0a60bf42c0f8fd0b0fe91df5704a1cbf upstream.
When under significant memory pressure, a process enters direct reclaim and immediately afterwards tries to allocate a page. If it fails and no further progress is made, it's possible the system will go OOM. However, on systems with large amounts of memory, it's possible that a significant number of pages are on per-cpu lists and inaccessible to the calling process. This leads to a process entering direct reclaim more often than it should increasing the pressure on the system and compounding the problem.
This patch notes that if direct reclaim is making progress but allocations are still failing that the system is already under heavy pressure. In this case, it drains the per-cpu lists and tries the allocation a second time before continuing.
--- mm/page_alloc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
mm/page_alloc.c +16 -4
@@ -1843,6 +1843,7 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mstruct page *page =NULL ;struct reclaim_state reclaim_state;struct task_struct *p = current; +bool drained = false;cond_resched ();
@@ -1861,14 +1862,25 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mcond_resched (); -if (order !=0 ) -drain_all_pages (); +if (unlikely (!(*did_some_progress))) +return NULL ; -if (likely (*did_some_progress)) - page =get_page_from_freelist (gfp_mask, nodemask, order, +retry: + page =get_page_from_freelist (gfp_mask, nodemask, order, zonelist, high_zoneidx, alloc_flags, preferred_zone, migratetype); + +/* +* If an allocation failed after direct reclaim, it could be because +* pages are pinned on the per-cpu lists. Drain them and try again +*/ +if (!page && !drained) { +drain_all_pages (); + drained = true; + goto retry; + } +return page; }
PATCH 74/80 mm: page allocator: calculate a better estimate of NR_FREE_PAGES when memory is low and kswapd is awake
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Christoph Lameter <[email protected]>
commit aa45484031ddee09b06350ab8528bfe5b2c76d1c upstream.
Ordinarily watermark checks are based on the vmstat NR_FREE_PAGES as it is cheaper than scanning a number of lists. To avoid synchronization overhead, counter deltas are maintained on a per-cpu basis and drained both periodically and when the delta is above a threshold. On large CPU systems, the difference between the estimated and real value of NR_FREE_PAGES can be very high. If NR_FREE_PAGES is much higher than number of real free page in buddy, the VM can allocate pages below min watermark, at worst reducing the real number of pages to zero. Even if the OOM killer kills some victim for freeing memory, it may not free memory if the exit path requires a new page resulting in livelock.
This patch introduces a zone_page_state_snapshot() function (courtesy of Christoph) that takes a slightly more accurate view of an arbitrary vmstat counter. It is used to read NR_FREE_PAGES while kswapd is awake to avoid the watermark being accidentally broken. The estimate is not perfect and may result in cache line bounces but is expected to be lighter than the IPI calls necessary to continually drain the per-cpu counters while kswapd is awake.
--- include/linux/mmzone.h | 13 +++++++++++++ include/linux/vmstat.h | 22 ++++++++++++++++++++++ mm/mmzone.c | 21 +++++++++++++++++++++ mm/page_alloc.c | 4 ++-- mm/vmstat.c | 15 ++++++++++++++- 5 files changed, 72 insertions(+), 3 deletions(-)
include/linux/mmzone.h +13 -0
@@ -284,6 +284,13 @@ struct zone {unsigned long watermark[NR_WMARK ];/* +* When free pages are below this point, additional steps are taken +* when reading the number of free pages to avoid per-cpu counter +* drift allowing watermarks to be breached +*/ +unsigned long percpu_drift_mark; + +/* * We don't know if the memory that we're going to allocate will be freeable * or/and it will be released eventually, so to avoid totally wasting several * GB of ram we must reserve some of the lower zone memory (otherwise we risk
@@ -456,6 +463,12 @@ static inline int zone_is_oom_locked(conreturn test_bit (ZONE_OOM_LOCKED , &zone->flags); } +#ifdef CONFIG_SMP +unsigned long zone_nr_free_pages (struct zone *zone); +#else +#define zone_nr_free_pages (zone) zone_page_state(zone, NR_FREE_PAGES) +#endif /* CONFIG_SMP */ +/* * The "priority" of VM scanning is how much of the queues we will scan in one * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
include/linux/vmstat.h +22 -0
@@ -170,6 +170,28 @@ static inline unsigned long zone_page_streturn x; } +/* +* More accurate version that also considers the currently pending +* deltas. For that we need to loop over all cpus to find the current +* deltas. There is no synchronization so the result cannot be +* exactly accurate either. +*/ +static inline unsigned long zone_page_state_snapshot (struct zone *zone, +enum zone_stat_item item) +{ +long x =atomic_long_read (&zone->vm_stat[item]); + +#ifdef CONFIG_SMP +int cpu; +for_each_online_cpu (cpu) + x +=per_cpu_ptr (zone->pageset, cpu)->vm_stat_diff[item]; + +if (x <0 ) + x =0 ; +#endif +return x; +} +extern unsigned long global_reclaimable_pages (void );extern unsigned long zone_reclaimable_pages (struct zone *zone);
mm/mmzone.c +21 -0
@@ -87,3 +87,24 @@ int memmap_valid_within(unsigned long pf return 1; }#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ + +#ifdef CONFIG_SMP +/* Called when a more accurate view of NR_FREE_PAGES is needed */ +unsigned long zone_nr_free_pages (struct zone *zone) +{ +unsigned long nr_free_pages =zone_page_state (zone,NR_FREE_PAGES ); + +/* +* While kswapd is awake, it is considered the zone is under some +* memory pressure. Under pressure, there is a risk that +* per-cpu-counter-drift will allow the min watermark to be breached +* potentially causing a live-lock. While kswapd is awake and +* free pages are low, get a better estimate for free pages +*/ +if (nr_free_pages < zone->percpu_drift_mark && + !waitqueue_active (&zone->zone_pgdat->kswapd_wait)) +return zone_page_state_snapshot (zone,NR_FREE_PAGES ); + +return nr_free_pages; +} +#endif /* CONFIG_SMP */
mm/page_alloc.c +2 -2
@@ -1461,7 +1461,7 @@ int zone_watermark_ok(struct zone *z, in {/* free_pages my go negative - that's OK */ long min = mark; -long free_pages =zone_page_state (z,NR_FREE_PAGES ) - (1 << order) +1 ; +long free_pages =zone_nr_free_pages (z) - (1 << order) +1 ;int o;if (alloc_flags &ALLOC_HIGH )
@@ -2424,7 +2424,7 @@ void show_free_areas(void)" all_unreclaimable? %s" "\n" , zone->name, -K (zone_page_state (zone,NR_FREE_PAGES )), +K (zone_nr_free_pages (zone)),K (min_wmark_pages (zone)),K (low_wmark_pages (zone)), K(high_wmark_pages(zone)),
mm/vmstat.c +14 -1
@@ -138,11 +138,24 @@ static void refresh_zone_stat_thresholdsint threshold;for_each_populated_zone (zone) { +unsigned long max_drift, tolerate_drift; + threshold =calculate_threshold (zone);for_each_online_cpu (cpu)per_cpu_ptr (zone->pageset, cpu)->stat_threshold = threshold; + +/* +* Only set percpu_drift_mark if there is a danger that +* NR_FREE_PAGES reports the low watermark is ok when in fact +* the min watermark could be breached by an allocation +*/ + tolerate_drift =low_wmark_pages (zone) -min_wmark_pages (zone); + max_drift =num_online_cpus () * threshold; +if (max_drift > tolerate_drift) + zone->percpu_drift_mark =high_wmark_pages (zone) + + max_drift; } }
@@ -813,7 +826,7 @@ static void zoneinfo_show_print(struct s"\n scanned %lu" "\n spanned %lu" "\n present %lu" , -zone_page_state (zone,NR_FREE_PAGES ), +zone_nr_free_pages (zone),min_wmark_pages (zone),low_wmark_pages (zone), high_wmark_pages(zone),
PATCH 75/80 mm: page allocator: update free page counters after pages are placed on the free list
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mel Gorman <[email protected]>
commit 72853e2991a2702ae93aaf889ac7db743a415dd3 upstream.
When allocating a page, the system uses NR_FREE_PAGES counters to determine if watermarks would remain intact after the allocation was made. This check is made without interrupts disabled or the zone lock held and so is race-prone by nature. Unfortunately, when pages are being freed in batch, the counters are updated before the pages are added on the list. During this window, the counters are misleading as the pages do not exist yet. When under significant pressure on systems with large numbers of CPUs, it's possible for processes to make progress even though they should have been stalled. This is particularly problematic if a number of the processes are using GFP_ATOMIC as the min watermark can be accidentally breached and in extreme cases, the system can livelock.
This patch updates the counters after the pages have been added to the list. This makes the allocator more cautious with respect to preserving the watermarks and mitigates livelock possibilities.
--- mm/page_alloc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
mm/page_alloc.c +5 -4
@@ -588,13 +588,13 @@ static void free_pcppages_bulk(struct zo {int migratetype =0 ;int batch_free =0 ; +int to_free = count;spin_lock (&zone->lock); zone->all_unreclaimable =0 ; zone->pages_scanned =0 ; -__mod_zone_page_state (zone,NR_FREE_PAGES , count); -while (count) { +while (to_free) {struct page *page;struct list_head *list;
@@ -619,8 +619,9 @@ static void free_pcppages_bulk(struct zo/* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */ __free_one_page (page, zone,0 ,page_private (page));trace_mm_page_pcpu_drain (page,0 ,page_private (page)); - }while (--count && --batch_free && !list_empty (list)); + }while (--to_free && --batch_free && !list_empty (list)); } +__mod_zone_page_state (zone,NR_FREE_PAGES , count);spin_unlock (&zone->lock); }
@@ -631,8 +632,8 @@ static void free_one_page(struct zone *z zone->all_unreclaimable =0 ; zone->pages_scanned =0 ; -__mod_zone_page_state (zone,NR_FREE_PAGES ,1 << order);__free_one_page (page, zone, order, migratetype); +__mod_zone_page_state (zone,NR_FREE_PAGES ,1 << order);spin_unlock (&zone->lock); }
PATCH 76/80 guard page for stacks that grow upwards
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Luck, Tony <[email protected]>
commit 8ca3eb08097f6839b2206e2242db4179aee3cfb3 upstream.
pa-risc and ia64 have stacks that grow upwards. Check that they do not run into other mappings. By making VM_GROWSUP 0x0 on architectures that do not ever use it, we can avoid some unpleasant #ifdefs in check_stack_guard_page().
--- include/linux/mm.h | 8 +++++++- mm/memory.c | 15 +++++++++++---- mm/mmap.c | 3 --- 3 files changed, 18 insertions(+), 8 deletions(-)
include/linux/mm.h +7 -1
@@ -78,7 +78,11 @@ extern unsigned int kobjsize(const void#define VM_MAYSHARE 0x00000080#define VM_GROWSDOWN 0x00000100/* general info on the segment */ +#if defined(CONFIG_STACK_GROWSUP ) || defined(CONFIG_IA64 )#define VM_GROWSUP 0x00000200 +#else +#define VM_GROWSUP 0x00000000 +#endif #define VM_PFNMAP 0x00000400/* Page-ranges managed without "struct page", just pure PFN */ #define VM_DENYWRITE 0x00000800/* ETXTBSY on write attempts.. */
@@ -1329,8 +1333,10 @@ unsigned long ra_submit(struct file_ra_s/* Do stack extension */ extern int expand_stack (struct vm_area_struct *vma,unsigned long address); -#ifdef CONFIG_IA64 +#if VM_GROWSUP extern int expand_upwards (struct vm_area_struct *vma,unsigned long address); +#else +#define expand_upwards (vma, address) do { } while (0)#endif extern int expand_stack_downwards (struct vm_area_struct *vma,unsigned long address);
mm/memory.c +11 -4
@@ -2791,11 +2791,9 @@ out_release: }/* -* This is like a special single-page "expand_downwards()", -* except we must first make sure that 'address-PAGE_SIZE' +* This is like a special single-page "expand_{down|up}wards()", +* except we must first make sure that 'address{-|+}PAGE_SIZE' * doesn't hit another vma. -* -* The "find_vma()" will do the right thing even if we wrap */ static inline int check_stack_guard_page (struct vm_area_struct *vma,unsigned long address) {
@@ -2814,6 +2812,15 @@ static inline int check_stack_guard_pageexpand_stack (vma, address -PAGE_SIZE ); } +if ((vma->vm_flags &VM_GROWSUP ) && address +PAGE_SIZE == vma->vm_end) { +struct vm_area_struct *next = vma->vm_next; + +/* As VM_GROWSDOWN but s/below/above/ */ +if (next && next->vm_start == address +PAGE_SIZE ) +return next->vm_flags &VM_GROWSUP ?0 : -ENOMEM ; + +expand_upwards (vma, address +PAGE_SIZE ); + }return 0 ; }
mm/mmap.c +0 -3
@@ -1704,9 +1704,6 @@ static int acct_stack_growth(struct vm_a* PA-RISC uses this for its stack; IA64 for its Register Backing Store. * vma is the last one with address > vma->vm_end. Have to extend vma. */ -#ifndef CONFIG_IA64 -static -#endif int expand_upwards (struct vm_area_struct *vma,unsigned long address) {int error;
PATCH 77/80 Fix unprotected access to task credentials in waitid()
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Daniel J Blueman <[email protected]>
commit f362b73244fb16ea4ae127ced1467dd8adaa7733 upstream.
Using a program like the following:
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main() {
id_t id;
siginfo_t infop;
pid_t res;
id = fork();
if (id == 0) { sleep(1); exit(0); }
kill(id, SIGSTOP);
alarm(1);
waitid(P_PID, id, &infop, WCONTINUED);
return 0;
}to call waitid() on a stopped process results in access to the child task's credentials without the RCU read lock being held - which may be replaced in the meantime - eliciting the following warning:
===================================================
[ INFO: suspicious rcu_dereference_check() usage. ]
---------------------------------------------------
kernel/exit.c:1460 invoked rcu_dereference_check() without protection!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 1
2 locks held by waitid02/22252:
#0: (tasklist_lock){.?.?..}, at: [<ffffffff81061ce5>] do_wait+0xc5/0x310
#1: (&(&sighand->siglock)->rlock){-.-...}, at: [<ffffffff810611da>]
wait_consider_task+0x19a/0xbe0
stack backtrace:
Pid: 22252, comm: waitid02 Not tainted 2.6.35-323cd+ #3
Call Trace:
[<ffffffff81095da4>] lockdep_rcu_dereference+0xa4/0xc0
[<ffffffff81061b31>] wait_consider_task+0xaf1/0xbe0
[<ffffffff81061d15>] do_wait+0xf5/0x310
[<ffffffff810620b6>] sys_waitid+0x86/0x1f0
[<ffffffff8105fce0>] ? child_wait_callback+0x0/0x70
[<ffffffff81003282>] system_call_fastpath+0x16/0x1bThis is fixed by holding the RCU read lock in wait_task_continued() to ensure that the task's current credentials aren't destroyed between us reading the cred pointer and us reading the UID from those credentials.
Furthermore, protect wait_task_stopped() in the same way.
We don't need to keep holding the RCU read lock once we've read the UID from the credentials as holding the RCU read lock doesn't stop the target task from changing its creds under us - so the credentials may be outdated immediately after we've read the pointer, lock or no lock.
--- kernel/exit.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
kernel/exit.c +2 -3
@@ -1383,8 +1383,7 @@ static int wait_task_stopped(struct waitif (!unlikely (wo->wo_flags &WNOWAIT )) *p_code =0 ; -/* don't need the RCU readlock here as we're holding a spinlock */ - uid =__task_cred (p)->uid; + uid =task_uid (p); unlock_sig:spin_unlock_irq (&p->sighand->siglock);if (!exit_code)
@@ -1457,7 +1456,7 @@ static int wait_task_continued(struct wa }if (!unlikely (wo->wo_flags &WNOWAIT )) p->signal->flags &= ~SIGNAL_STOP_CONTINUED ; - uid =__task_cred (p)->uid; + uid =task_uid (p);spin_unlock_irq (&p->sighand->siglock); pid =task_pid_vnr (p);
PATCH 78/80 sctp: Do not reset the packet during sctp_packet_config().
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Vlad Yasevich <[email protected]>
commit 4bdab43323b459900578b200a4b8cf9713ac8fab upstream.
sctp_packet_config() is called when getting the packet ready for appending of chunks. The function should not touch the current state, since it's possible to ping-pong between two transports when sending, and that can result packet corruption followed by skb overlfow crash.
--- net/sctp/output.c | 1 - 1 file changed, 1 deletion(-)
net/sctp/output.c +0 -1
@@ -92,7 +92,6 @@ struct sctp_packet *sctp_packet_config(sSCTP_DEBUG_PRINTK ("%s: packet:%p vtag:0x%x\n" , __func__, packet, vtag); -sctp_packet_reset (packet); packet->vtag = vtag;if (ecn_capable &&sctp_packet_empty (packet)) {
PATCH 79/80 drm/i915: Ensure that the crtcinfo is populated during mode_fixup()
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Chris Wilson <[email protected]>
commit 897493504addc5609f04a2c4f73c37ab972c29b2 upstream.
This should fix the mysterious mode setting failures reported during boot up and after resume, generally for i8xx class machines.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=16478
Buzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29413
--- drivers/gpu/drm/i915/intel_display.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_display.c +8 -0
@@ -2376,11 +2376,19 @@ static bool intel_crtc_mode_fixup(struct struct drm_display_mode *adjusted_mode) {struct drm_device *dev = crtc->dev; +if (HAS_PCH_SPLIT (dev)) {/* FDI link clock is fixed at 2.7G */ if (mode->clock *3 >27000 *4 )return MODE_CLOCK_HIGH ; } + +/* XXX some encoders set the crtcinfo, others don't. +* Obviously we need some form of conflict resolution here... +*/ +if (adjusted_mode->crtc_htotal ==0 ) +drm_mode_set_crtcinfo (adjusted_mode,0 ); +return true; }
PATCH 80/80 alpha: Fix printk format errors
In reply to Greg KH2.6.35-stable review patch. If anyone has any objections, please let us know.
------------------
From: Michael Cree <[email protected]>
commit 3e073367a57d41e506f20aebb98e308387ce3090 upstream.
When compiling alpha generic build get errors such as:arch/alpha/kernel/err_marvel.c: In function ‘marvel_print_err_cyc’:arch/alpha/kernel/err_marvel.c:119: error: format ‘%ld’ expects type ‘long int’, but argument 6 has type ‘u64’
Replaced a number of %ld format specifiers with %lld since u64 is unsigned long long.
--- arch/alpha/kernel/err_marvel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/alpha/kernel/err_marvel.c +3 -3
@@ -109,7 +109,7 @@ marvel_print_err_cyc(u64 err_cyc)#define IO7__ERR_CYC__CYCLE__M (0x7) printk("%s Packet In Error: %s\n" - "%s Error in %s, cycle %ld%s%s\n", + "%s Error in %s, cycle %lld%s%s\n", err_print_prefix, packet_desc[EXTRACT(err_cyc, IO7__ERR_CYC__PACKET)], err_print_prefix,
@@ -313,7 +313,7 @@ marvel_print_po7_ugbge_sym(u64 ugbge_sym } printk("%s Up Hose Garbage Symptom:\n" - "%s Source Port: %ld - Dest PID: %ld - OpCode: %s\n", + "%s Source Port: %lld - Dest PID: %lld - OpCode: %s\n", err_print_prefix, err_print_prefix, EXTRACT(ugbge_sym, IO7__PO7_UGBGE_SYM__UPH_SRC_PORT),
@@ -552,7 +552,7 @@ marvel_print_pox_spl_cmplt(u64 spl_cmplt#define IO7__POX_SPLCMPLT__REM_BYTE_COUNT__M (0xfff) printk("%s Split Completion Error:\n" - "%s Source (Bus:Dev:Func): %ld:%ld:%ld\n", + "%s Source (Bus:Dev:Func): %lld:%lld:%lld\n", err_print_prefix, err_print_prefix, EXTRACT(spl_cmplt, IO7__POX_SPLCMPLT__SOURCE_BUS),
Quoted 11 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Sunday September 26, 17:00:00 UTC 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/v2.6/stable-review/patch-2.6.35.6-rc1.gz
Hi Greg; I just pulled this about an hour ago, built it from a make oldconfig based on a flawlessly running 2.6.35.4.
3 things I call regressions.
1. On rebooting to it, and launching kmail, cpu went to 100% of whatever core it skipped to on a 4 core amd phenom box with 4G of ram. Normally, kmail on a restart will check and rebuild its indices, taking maybe 4 or 5 minutes to do this up till now, during that time keyboard/mouse interactivity lags a split second. This time it was 44 minutes before I got my machine back. At times the keyboard went dead for minutes at a time. I even went to the kitchen and got fresh batteries for it, only to have everything I had typed blind 2 minutes before, show up on screen while there was no batteries in it.
2. That I think is separate from the login screen, there I had no keyboard or mouse for a minute, but something finally registered and I was able to log in then.
3. My usb tree is not fully populated, this has been a frequent problem for the last year or so, udev often does not wait for responses long enough to trace a several hubs tall tree to the last branch so I have to crawl under and unplug the missing stuff later, which is then properly recognized when I plug it back into the same socket on the same hub. One of my often missing printers is 4 hubs away in the basement.
Thanks.
Signature · 6 lines
Cheers, Gene "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) QOTD: Silence is the only virtue he has left.
Quoted 7 lines · Gene Heskett
Quoted 6 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Quoted 8 lines
Quoted 5 lines
Responses should be made by Sunday September 26, 17:00:00 UTC 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/v2.6/stable-review/patch-2.6.35.6-rc1.gzHi Greg; I just pulled this about an hour ago, built it from a make oldconfig based on a flawlessly running 2.6.35.4.
Please cc: me on messages, I don't read lkml as well as I should these days due to travel.
Quoted 11 lines
3 things I call regressions.
1. On rebooting to it, and launching kmail, cpu went to 100% of whatever core it skipped to on a 4 core amd phenom box with 4G of ram. Normally, kmail on a restart will check and rebuild its indices, taking maybe 4 or 5 minutes to do this up till now, during that time keyboard/mouse interactivity lags a split second. This time it was 44 minutes before I got my machine back. At times the keyboard went dead for minutes at a time. I even went to the kitchen and got fresh batteries for it, only to have everything I had typed blind 2 minutes before, show up on screen while there was no batteries in it.
Odd, can you try reverting the patch below to see if it makes things better? I need to drop it as Jens said it might cause problems. Let me know if that solves the problem or not please.
Quoted 10 lines
2. That I think is separate from the login screen, there I had no keyboard or mouse for a minute, but something finally registered and I was able to log in then.
3. My usb tree is not fully populated, this has been a frequent problem for the last year or so, udev often does not wait for responses long enough to trace a several hubs tall tree to the last branch so I have to crawl under and unplug the missing stuff later, which is then properly recognized when I plug it back into the same socket on the same hub. One of my often missing printers is 4 hubs away in the basement.
These both sound like the same issue, you might want to work to resolve them.
Oh, and 4 hubs distance, that's pushing the limits of USB, one flaky cable and you are not going to have a working printer...
thanks,
greg k-h
Quoted 1 line
From
692ebd17c2905313fff3c504c249c6a0faad16ecMon Sep 17 00:00:00 2001
From: Jan Kara <[email protected]>
Date: Tue, 21 Sep 2010 11:51:01 +0200
Subject: bdi: Fix warnings in __mark_inode_dirty for /dev/zero and friends
From: Jan Kara <[email protected]>
commit 692ebd17c2905313fff3c504c249c6a0faad16ec upstream.
Inodes of devices such as /dev/zero can get dirty for example via utime(2) syscall or due to atime update. Backing device of such inodes (zero_bdi, etc.) is however unable to handle dirty inodes and thus __mark_inode_dirty complains. In fact, inode should be rather dirtied against backing device of the filesystem holding it. This is generally a good rule except for filesystems such as 'bdev' or 'mtd_inodefs'. Inodes in these pseudofilesystems are referenced from ordinary filesystem inodes and carry mapping with real data of the device. Thus for these inodes we have to use inode->i_mapping->backing_dev_info as we did so far. We distinguish these filesystems by checking whether sb->s_bdi points to a non-trivial backing device or not.
Example: Assume we have an ext3 filesystem on /dev/sda1 mounted on /. There's a device inode A described by a path "/dev/sdb" on this filesystem. This inode will be dirtied against backing device "8:0" after this patch. bdev filesystem contains block device inode B coupled with our inode A. When someone modifies a page of /dev/sdb, it's B that gets dirtied and the dirtying happens against the backing device "8:16". Thus both inodes get filed to a correct bdi list.
--- fs/fs-writeback.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
fs/fs-writeback.c +21 -2
@@ -28,8 +28,6 @@#include <linux/buffer_head.h> #include "internal.h" -#define inode_to_bdi (inode) ((inode)->i_mapping->backing_dev_info) -/* * We don't actually have pdflush, but this one is exported though /proc... */
@@ -62,6 +60,27 @@ int writeback_in_progress(struct backingreturn !list_empty (&bdi->work_list); } +static inline struct backing_dev_info *inode_to_bdi (struct inode *inode) +{ +struct super_block *sb = inode->i_sb; +struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info; + +/* +* For inodes on standard filesystems, we use superblock's bdi. For +* inodes on virtual filesystems, we want to use inode mapping's bdi +* because they can possibly point to something useful (think about +* block_dev filesystem). +*/ +if (sb->s_bdi && sb->s_bdi != &noop_backing_dev_info) { +/* Some device inodes could play dirty tricks. Catch them... */ +WARN (bdi != sb->s_bdi &&bdi_cap_writeback_dirty (bdi), +"Dirtiable inode bdi %s != sb bdi %s\n" , + bdi->name, sb->s_bdi->name); +return sb->s_bdi; + } +return bdi; +} +static void bdi_queue_work (struct backing_dev_info *bdi,struct wb_writeback_work *work) {
Quoted 9 lines · Greg KH
Quoted 8 lines · Gene Heskett
Quoted 7 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Responses should be made by Sunday September 26, 17:00:00 UTC 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/v2.6/stable-review/patch-2.6.35.6-
rc1.gz
Quoted 12 lines
Quoted 3 lines
Hi Greg; I just pulled this about an hour ago, built it from a make oldconfig based on a flawlessly running 2.6.35.4.
Please cc: me on messages, I don't read lkml as well as I should these days due to travel.
Quoted 5 lines
3 things I call regressions.
1. On rebooting to it, and launching kmail, cpu went to 100% of whatever core it skipped to on a 4 core amd phenom box with 4G of ram. Normally, kmail on a restart will check and rebuild its indices,
The email corpus is around 7Gb.
Quoted 10 lines
Quoted 6 lines
taking maybe 4 or 5 minutes to do this up till now, during that time keyboard/mouse interactivity lags a split second. This time it was 44 minutes before I got my machine back. At times the keyboard went dead for minutes at a time. I even went to the kitchen and got fresh batteries for it, only to have everything I had typed blind 2 minutes before, show up on screen while there was no batteries in it.
Odd, can you try reverting the patch below to see if it makes things better? I need to drop it as Jens said it might cause problems. Let me know if that solves the problem or not please.
This evening I should be able to report.
Quoted 12 lines
Quoted 11 lines
2. That I think is separate from the login screen, there I had no keyboard or mouse for a minute, but something finally registered and I was able to log in then.
3. My usb tree is not fully populated, this has been a frequent problem for the last year or so, udev often does not wait for responses long enough to trace a several hubs tall tree to the last branch so I have to crawl under and unplug the missing stuff later, which is then properly recognized when I plug it back into the same socket on the same hub. One of my often missing printers is 4 hubs away in the basement.
Quoted 2 lines
These both sound like the same issue, you might want to work to resolve them.
I will give this patch a shot this evening, today's schedule is already shot, there's a sport show at Stonewall Jackson Lake & resort.
Quoted 3 lines
Oh, and 4 hubs distance, that's pushing the limits of USB, one flaky cable and you are not going to have a working printer...
I may in fact have a flaky hub, the first one is a 7 port Alps brand and I've found it now has a bad port or 2. Lightning is a bitch, scheduled for a replacement now that I know about it.
Quoted 3 lines
thanks,
greg k-h
Thanks Greg, I'll be in touch.
Signature · 6 lines
Cheers, Gene "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) In buying horses and taking a wife shut your eyes tight and commend yourself to God.
Quoted 71 lines · Gene Heskett
Quoted 9 lines · Greg KH
Quoted 8 lines · Gene Heskett
Quoted 7 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Responses should be made by Sunday September 26, 17:00:00 UTC 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/v2.6/stable-review/patch-2.6.35.6-rc1.gz
Quoted 12 lines
Quoted 2 lines
Hi Greg; I just pulled this about an hour ago, built it from a make oldconfig based on a flawlessly running 2.6.35.4.
Please cc: me on messages, I don't read lkml as well as I should these days due to travel.
Quoted 6 lines
3 things I call regressions.
1. On rebooting to it, and launching kmail, cpu went to 100% of whatever core it skipped to on a 4 core amd phenom box with 4G of ram.
Normally, kmail on a restart will check and rebuild its indices,
The email corpus is around 7Gb.
Quoted 10 lines
Quoted 6 lines
taking maybe 4 or 5 minutes to do this up till now, during that time keyboard/mouse interactivity lags a split second. This time it was 44 minutes before I got my machine back. At times the keyboard went dead for minutes at a time. I even went to the kitchen and got fresh batteries for it, only to have everything I had typed blind 2 minutes before, show up on screen while there was no batteries in it.
Odd, can you try reverting the patch below to see if it makes things better? I need to drop it as Jens said it might cause problems. Let me know if that solves the problem or not please.
This evening I should be able to report.
Quoted 12 lines
Quoted 11 lines
2. That I think is separate from the login screen, there I had no keyboard or mouse for a minute, but something finally registered and I was able to log in then.
3. My usb tree is not fully populated, this has been a frequent problem for the last year or so, udev often does not wait for responses long enough to trace a several hubs tall tree to the last branch so I have to crawl under and unplug the missing stuff later, which is then properly recognized when I plug it back into the same socket on the same hub. One of my often missing printers is 4 hubs away in the basement.
Quoted 2 lines
These both sound like the same issue, you might want to work to resolve them.
I will give this patch a shot this evening, today's schedule is already shot, there's a sport show at Stonewall Jackson Lake & resort.
Quoted 2 lines
Oh, and 4 hubs distance, that's pushing the limits of USB, one flaky cable and you are not going to have a working printer...
I may in fact have a flaky hub, the first one is a 7 port Alps brand and I've found it now has a bad port or 2. Lightning is a bitch, scheduled for a replacement now that I know about it.
Quoted 5 lines
Quoted 3 lines
thanks,
greg k-h
Thanks Greg, I'll be in touch.
Done and rebooted.
kmail is still rebuilding the indices after the reboot, but this is still about the same laggyness as before.
This system ran well once the initial housekeeping was finished, but this does appear to be, so far, pretty much a repeat with much the same long lags, so I don't believe this was the culprit. I'll time it till its working normally and include that time in this message.
54 minutes now and kmail is still at the top of the top display. 1:08 when kmail dropped off the top line of (h)top.
So this wasn't the problem patch, you can leave it in AFAIAC.
Thanks for your patience.
Signature · 6 lines
Cheers, Gene "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Why isn't there a special name for the tops of your feet? -- Lily Tomlin
Quoted 8 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Sunday September 26, 17:00:00 UTC Anything received after that time might be too late.
nouveau graphics driver does not work at all. I submitted full data a few days ago.
Regards,
Piotr Hosowicz
Signature · 5 lines
- Poszedłem wczoraj z żoną do ZOO - I jak? - Nie wzięli... NP: Pantera - A New Level NB: 2.6.35.6-rc1
Quoted 8 lines · Piotr Hosowicz
Quoted 6 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Quoted 5 lines
Quoted 2 lines
Responses should be made by Sunday September 26, 17:00:00 UTC Anything received after that time might be too late.
nouveau graphics driver does not work at all. I submitted full data a few days ago.
Was that with .5 or is this something new for .6? And sorry if I missed this, for some reason I thought the problem was with the nvidia driver.
If it showed up in .5 can you bisect to see what the problem patch was?
thanks,
greg k-h
Quoted 9 lines · Greg KH
Quoted 8 lines · Piotr Hosowicz
Quoted 6 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Responses should be made by Sunday September 26, 17:00:00 UTC Anything received after that time might be too late.
nouveau graphics driver does not work at all. I submitted full data a few days ago.
Was that with .5 or is this something new for .6? And sorry if I missed this, for some reason I thought the problem was with the nvidia driver.
Tested now with .5-rc1. It is with the kernel NVidia driver, the nouveau.
Quoted 1 line
If it showed up in .5 can you bisect to see what the problem patch was?
I don't know how to bisect efficiently. Could you tell me?
Regards,
Piotr Hosowicz
Signature · 6 lines
- Jasiu, jakie jest najszybsze zwierze na swiecie? - Gepard, pszepani. - A najszybszy ptak? - Ptak geparda. NP: Peter Green Splinter Group - Big Change Is Gonna Come NB: 2.6.35.6-rc1
Quoted 13 lines · Piotr Hosowicz
Quoted 12 lines · Greg KH
Quoted 11 lines · Piotr Hosowicz
Quoted 8 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Sunday September 26, 17:00:00 UTC Anything received after that time might be too late.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
nouveau graphics driver does not work at all. I submitted full data a few days ago.
Was that with .5 or is this something new for .6? And sorry if I missed this, for some reason I thought the problem was with the nvidia driver.
Tested now with .5-rc1. It is with the kernel NVidia driver, the nouveau.
And that works? Or not?
Why not try the "real" 2.6.36.5 release?
Quoted 3 lines
Quoted 1 line
If it showed up in .5 can you bisect to see what the problem patch was?
I don't know how to bisect efficiently. Could you tell me?
'man git-bisect' will show you all the details on how to do this.
thanks,
greg k-h
Quoted 17 lines · Greg KH
Quoted 16 lines · Piotr Hosowicz
Quoted 15 lines · Greg KH
Quoted 13 lines · Piotr Hosowicz
Quoted 8 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Sunday September 26, 17:00:00 UTC Anything received after that time might be too late.
nouveau graphics driver does not work at all. I submitted full data a few days ago.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Was that with .5 or is this something new for .6? And sorry if I missed this, for some reason I thought the problem was with the nvidia driver.
Tested now with .5-rc1. It is with the kernel NVidia driver, the nouveau.
And that works? Or not?
No, does not.
Quoted 1 line
Why not try the "real" 2.6.36.5 release?
I thought that you want us to test the rc1 release, so I downloaded the 2.6.35.5 and patched it with the summary patch you gave an URL for.
Signature · 4 lines
- Jaka jest największa anomalia fizjologiczno-polityczna? - Członek wysunięty z ramienia na czoło. NP: Peter Green Splinter Group - Tribal Dance NB: 2.6.35.6-rc1
Quoted 23 lines · Piotr Hosowicz
Quoted 22 lines · Greg KH
Quoted 20 lines · Piotr Hosowicz
Quoted 9 lines · Greg KH
Quoted 8 lines · Piotr Hosowicz
Quoted 6 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Responses should be made by Sunday September 26, 17:00:00 UTC Anything received after that time might be too late.
nouveau graphics driver does not work at all. I submitted full data a few days ago.
Was that with .5 or is this something new for .6? And sorry if I missed this, for some reason I thought the problem was with the nvidia driver.
Tested now with .5-rc1. It is with the kernel NVidia driver, the nouveau.
Quoted 8 lines
Quoted 1 line
And that works? Or not?
No, does not.
Quoted 1 line
Why not try the "real" 2.6.36.5 release?
I thought that you want us to test the rc1 release, so I downloaded the 2.6.35.5 and patched it with the summary patch you gave an URL for.
If .35.1 didn't work for you, then no, odds are this will not work for you either. I suggest working with the nouveau driver developers (their email can be found in the MAINTAINERS file) to get this resolved.
good luck,
greg k-h
Quoted 3 lines · Greg KH
If .35.1 didn't work for you, then no, odds are this will not work for you either. I suggest working with the nouveau driver developers (their email can be found in the
MAINTAINERSfile) to get this resolved.
I did not find that email. Please nvidia guys perhaps you know, what's the email where I can report problems with nouveau Linux driver?
Regards,
Piotr Hosowicz
Signature · 6 lines
W korytarzach kremlowskich Breżniew spotyka Susłowa. Susłow pyta: - Leonid, wiesz, że jeden but masz żółty, a drugi czarny? - Wiem, Misza, chciałem nawet zmienić, ale w domu mam to samo, jeden żółty i jeden czarny. NP: - NB: 2.6.36-rc5-git7
Quoted 8 lines · Piotr Hosowicz
Quoted 3 lines · Greg KH
If .35.1 didn't work for you, then no, odds are this will not work for you either. I suggest working with the nouveau driver developers (their email can be found in the
MAINTAINERSfile) to get this resolved.I did not find that email. Please nvidia guys perhaps you know, what's the email where I can report problems with nouveau Linux driver?
Their address is [email protected]. And it is true that they are not mentioned in MAINTAINERS.
Sven
Quoted 8 lines · Sven Joachim
Quoted 6 lines · Piotr Hosowicz
Quoted 3 lines · Greg KH
If .35.1 didn't work for you, then no, odds are this will not work for you either. I suggest working with the nouveau driver developers (their email can be found in the
MAINTAINERSfile) to get this resolved.
Quoted 5 lines
Quoted 2 lines
I did not find that email. Please nvidia guys perhaps you know, what's the email where I can report problems with nouveau Linux driver?
Their address is [email protected]. And it is true that they are not mentioned in
MAINTAINERS.
Thanks.
Regards,
Piotr Hosowicz
Signature · 5 lines
Z cyklu "Uroki demokracji", czyli pytania i odpowiedzi w teledurniejach: - Znamy trzy stany skupienia - stały, ciekły i...? - Galaretka. NP: - NB: 2.6.36-rc5-git7
Quoted 12 lines · Greg KH
Quoted 11 lines · Piotr Hosowicz
Quoted 8 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Sunday September 26, 17:00:00 UTC Anything received after that time might be too late.
Quoted 7 lines
Quoted 2 lines
nouveau graphics driver does not work at all. I submitted full data a few days ago.
Was that with .5 or is this something new for .6? And sorry if I missed this, for some reason I thought the problem was with the nvidia driver.
If it showed up in .5 can you bisect to see what the problem patch was?
And in this case I'm afraid that I cannot bisect, because there is no good state, that driver failed always for me.
Signature · 6 lines
Siedzi wyfiokowana Jola i gada. Przez 15 minut czy więcej uczy obywateli, jak jeść bezę. Że bezy nie można kroić nożem i widelcem, bo może trysnąć. Że trzeba zdjąć kapelusik od bezy. I to jest kurwa program pierwszej damy! NP: Peter Green Splinter Group - Say That You Want To NB: 2.6.35.6-rc1
Quoted 16 lines · Piotr Hosowicz
Quoted 15 lines · Greg KH
Quoted 13 lines · Piotr Hosowicz
Quoted 8 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Sunday September 26, 17:00:00 UTC Anything received after that time might be too late.
nouveau graphics driver does not work at all. I submitted full data a few days ago.
Quoted 7 lines
Quoted 4 lines
Was that with .5 or is this something new for .6? And sorry if I missed this, for some reason I thought the problem was with the nvidia driver.
If it showed up in .5 can you bisect to see what the problem patch was?
And in this case I'm afraid that I cannot bisect, because there is no good state, that driver failed always for me.
So it never worked for .35 at all? Did it for .34? I suggest going and working with the nouveau developers about this issue, as it doesn't seem to be a -stable specific problem at the moment.
thanks,
greg k-h
Quoted 20 lines · Greg KH
Quoted 19 lines · Piotr Hosowicz
Quoted 18 lines · Greg KH
Quoted 8 lines · Piotr Hosowicz
Quoted 6 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Quoted 5 lines
Quoted 2 lines
Responses should be made by Sunday September 26, 17:00:00 UTC Anything received after that time might be too late.
nouveau graphics driver does not work at all. I submitted full data a few days ago.
Was that with .5 or is this something new for .6? And sorry if I missed this, for some reason I thought the problem was with the nvidia driver.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
If it showed up in .5 can you bisect to see what the problem patch was?
And in this case I'm afraid that I cannot bisect, because there is no good state, that driver failed always for me.
So it never worked for .35 at all? Did it for .34? I suggest going and working with the nouveau developers about this issue, as it doesn't seem to be a -stable specific problem at the moment.
It never worked for me on any kernel I tried. I rebuild regularly since .34 as far as I remember. But then I used NVidia driver. So I do not know if kernel driver was ok at that time.
Regards,
Piotr Hosowicz
Signature · 5 lines
Z cyklu "Uroki demokracji", czyli pytania i odpowiedzi w teledurniejach: - Gdzie odbywały się lądowania Aliantów (D-Day)? - Pearl Harbour? NP: Peter Green Splinter Group - You'll Be Sorry Someday NB: 2.6.35.6-rc1
Quoted 20 lines · Greg KH
Quoted 19 lines · Piotr Hosowicz
Quoted 18 lines · Greg KH
Quoted 8 lines · Piotr Hosowicz
Quoted 6 lines · Greg KH
This is the start of the stable review cycle for the 2.6.35.6 release. There are 80 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Quoted 5 lines
Quoted 2 lines
Responses should be made by Sunday September 26, 17:00:00 UTC Anything received after that time might be too late.
nouveau graphics driver does not work at all. I submitted full data a few days ago.
Was that with .5 or is this something new for .6? And sorry if I missed this, for some reason I thought the problem was with the nvidia driver.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
If it showed up in .5 can you bisect to see what the problem patch was?
And in this case I'm afraid that I cannot bisect, because there is no good state, that driver failed always for me.
So it never worked for .35 at all? Did it for .34? I suggest going and working with the nouveau developers about this issue, as it doesn't seem to be a -stable specific problem at the moment.
What is their mail group?
Regards,
Piotr Hosowicz
Signature · 5 lines
Na przyjęciu chłopak pyta blondynkę: - Czy mogę cię prosić do walca? - Zgłupiałeś? To już nie miałeś czym przyjechać? NP: Peter Green Splinter Group - Tribal Dance NB: 2.6.35.6-rc1