Add some patches requested for stable
diff --git a/queue-3.16/lib-vsprintf.c-improve-sanity-check-in-vsnprintf.patch b/queue-3.16/lib-vsprintf.c-improve-sanity-check-in-vsnprintf.patch new file mode 100644 index 0000000..bf363e8 --- /dev/null +++ b/queue-3.16/lib-vsprintf.c-improve-sanity-check-in-vsnprintf.patch
@@ -0,0 +1,33 @@ +From: Rasmus Villemoes <linux@rasmusvillemoes.dk> +Date: Thu, 12 Feb 2015 15:01:39 -0800 +Subject: lib/vsprintf.c: improve sanity check in vsnprintf() + +commit 2aa2f9e21e4eb25c720b2e7d80f8929638f6ad73 upstream. + +On 64 bit, size may very well be huge even if bit 31 happens to be 0. +Somehow it doesn't feel right that one can pass a 5 GiB buffer but not a +3 GiB one. So cap at INT_MAX as was probably the intention all along. +This is also the made-up value passed by sprintf and vsprintf. + +Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> +Cc: Jiri Kosina <jkosina@suse.cz> +Cc: Randy Dunlap <rdunlap@infradead.org> +Signed-off-by: Andrew Morton <akpm@linux-foundation.org> +Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> +Signed-off-by: Ben Hutchings <ben@decadent.org.uk> +Cc: Willy Tarreau <w@1wt.eu> +--- + lib/vsprintf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/lib/vsprintf.c ++++ b/lib/vsprintf.c +@@ -1657,7 +1657,7 @@ int vsnprintf(char *buf, size_t size, co + + /* Reject out-of-range values early. Large positive sizes are + used for unknown buffer sizes. */ +- if (WARN_ON_ONCE((int) size < 0)) ++ if (WARN_ON_ONCE(size > INT_MAX)) + return 0; + + str = buf;
diff --git a/queue-3.16/sched-cputime-fix-invalid-gtime-in-proc.patch b/queue-3.16/sched-cputime-fix-invalid-gtime-in-proc.patch new file mode 100644 index 0000000..5ce8cc8 --- /dev/null +++ b/queue-3.16/sched-cputime-fix-invalid-gtime-in-proc.patch
@@ -0,0 +1,78 @@ +From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> +Date: Thu, 19 Nov 2015 16:47:28 +0100 +Subject: sched/cputime: Fix invalid gtime in proc + +commit 2541117b0cf79977fa11a0d6e17d61010677bd7b upstream. + +/proc/stats shows invalid gtime when the thread is running in guest. +When vtime accounting is not enabled, we cannot get a valid delta. +The delta is calculated with now - tsk->vtime_snap, but tsk->vtime_snap +is only updated when vtime accounting is runtime enabled. + +This patch makes task_gtime() just return gtime without computing the +buggy non-existing tickless delta when vtime accounting is not enabled. + +Use context_tracking_is_enabled() to check if vtime is accounting on +some cpu, in which case only we need to check the tickless delta. This +way we fix the gtime value regression on machines not running nohz full. + +The kernel config contains CONFIG_VIRT_CPU_ACCOUNTING_GEN=y and +CONFIG_NO_HZ_FULL_ALL=n and boot without nohz_full. + +I ran and stop a busy loop in VM and see the gtime in host. +Dump the 43rd field which shows the gtime in every second: + + # while :; do awk '{print $3" "$43}' /proc/3955/task/4014/stat; sleep 1; done + S 4348 + R 7064566 + R 7064766 + R 7064967 + R 7065168 + S 4759 + S 4759 + +During running busy loop, it returns large value. + +After applying this patch, we can see right gtime. + + # while :; do awk '{print $3" "$43}' /proc/10913/task/10956/stat; sleep 1; done + S 5338 + R 5365 + R 5465 + R 5566 + R 5666 + S 5726 + S 5726 + +Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> +Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> +Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> +Cc: Chris Metcalf <cmetcalf@ezchip.com> +Cc: Christoph Lameter <cl@linux.com> +Cc: Linus Torvalds <torvalds@linux-foundation.org> +Cc: Luiz Capitulino <lcapitulino@redhat.com> +Cc: Mike Galbraith <efault@gmx.de> +Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com> +Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> +Cc: Peter Zijlstra <peterz@infradead.org> +Cc: Rik van Riel <riel@redhat.com> +Cc: Thomas Gleixner <tglx@linutronix.de> +Link: http://lkml.kernel.org/r/1447948054-28668-2-git-send-email-fweisbec@gmail.com +Signed-off-by: Ingo Molnar <mingo@kernel.org> +Signed-off-by: Ben Hutchings <ben@decadent.org.uk> +--- + kernel/sched/cputime.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/kernel/sched/cputime.c ++++ b/kernel/sched/cputime.c +@@ -753,6 +753,9 @@ cputime_t task_gtime(struct task_struct + unsigned int seq; + cputime_t gtime; + ++ if (!context_tracking_is_enabled()) ++ return t->gtime; ++ + do { + seq = read_seqbegin(&t->vtime_seqlock); +
diff --git a/queue-3.16/series b/queue-3.16/series index c00840b..0573566 100644 --- a/queue-3.16/series +++ b/queue-3.16/series
@@ -306,3 +306,5 @@ printk-use-rcuidle-console-tracepoint.patch fix-missing-sanity-check-in-dev-sg.patch irda-fix-lockdep-annotations-in-hashbin_delete.patch +sched-cputime-fix-invalid-gtime-in-proc.patch +lib-vsprintf.c-improve-sanity-check-in-vsnprintf.patch
diff --git a/queue-3.2/lib-vsprintf.c-improve-sanity-check-in-vsnprintf.patch b/queue-3.2/lib-vsprintf.c-improve-sanity-check-in-vsnprintf.patch new file mode 100644 index 0000000..7c2b77d --- /dev/null +++ b/queue-3.2/lib-vsprintf.c-improve-sanity-check-in-vsnprintf.patch
@@ -0,0 +1,33 @@ +From: Rasmus Villemoes <linux@rasmusvillemoes.dk> +Date: Thu, 12 Feb 2015 15:01:39 -0800 +Subject: lib/vsprintf.c: improve sanity check in vsnprintf() + +commit 2aa2f9e21e4eb25c720b2e7d80f8929638f6ad73 upstream. + +On 64 bit, size may very well be huge even if bit 31 happens to be 0. +Somehow it doesn't feel right that one can pass a 5 GiB buffer but not a +3 GiB one. So cap at INT_MAX as was probably the intention all along. +This is also the made-up value passed by sprintf and vsprintf. + +Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> +Cc: Jiri Kosina <jkosina@suse.cz> +Cc: Randy Dunlap <rdunlap@infradead.org> +Signed-off-by: Andrew Morton <akpm@linux-foundation.org> +Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> +Signed-off-by: Ben Hutchings <ben@decadent.org.uk> +Cc: Willy Tarreau <w@1wt.eu> +--- + lib/vsprintf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/lib/vsprintf.c ++++ b/lib/vsprintf.c +@@ -1177,7 +1177,7 @@ int vsnprintf(char *buf, size_t size, co + + /* Reject out-of-range values early. Large positive sizes are + used for unknown buffer sizes. */ +- if (WARN_ON_ONCE((int) size < 0)) ++ if (WARN_ON_ONCE(size > INT_MAX)) + return 0; + + str = buf;
diff --git a/queue-3.2/series b/queue-3.2/series index 2b5a1b5..da61081 100644 --- a/queue-3.2/series +++ b/queue-3.2/series
@@ -153,3 +153,4 @@ packet-do-not-call-fanout_release-from-atomic-contexts.patch fix-missing-sanity-check-in-dev-sg.patch irda-fix-lockdep-annotations-in-hashbin_delete.patch +lib-vsprintf.c-improve-sanity-check-in-vsnprintf.patch