From: Greg Kroah-Hartman Date: Wed, 31 May 2017 07:49:27 +0000 (+0900) Subject: 4.9-stable patches X-Git-Tag: v3.18.56~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6ed473168db76d485b716ef0c02406d6960709a7;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: sparc-fix-wstringop-overflow-warning.patch sparc-ftrace-fix-ftrace-graph-time-measurement.patch --- diff --git a/queue-4.9/series b/queue-4.9/series index b57eea84ea4..eedbed3299d 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -32,3 +32,5 @@ tcp-avoid-fastopen-api-to-be-used-on-af_unspec.patch sctp-fix-icmp-processing-if-skb-is-non-linear.patch ipv4-add-reference-counting-to-metrics.patch bpf-add-bpf_clone_redirect-to-bpf_helper_changes_pkt_data.patch +sparc-fix-wstringop-overflow-warning.patch +sparc-ftrace-fix-ftrace-graph-time-measurement.patch diff --git a/queue-4.9/sparc-fix-wstringop-overflow-warning.patch b/queue-4.9/sparc-fix-wstringop-overflow-warning.patch new file mode 100644 index 00000000000..bc723690fad --- /dev/null +++ b/queue-4.9/sparc-fix-wstringop-overflow-warning.patch @@ -0,0 +1,73 @@ +From foo@baz Wed May 31 16:49:17 JST 2017 +From: Orlando Arias +Date: Tue, 16 May 2017 15:34:00 -0400 +Subject: sparc: Fix -Wstringop-overflow warning + +From: Orlando Arias + + +[ Upstream commit deba804c90642c8ed0f15ac1083663976d578f54 ] + +Greetings, + +GCC 7 introduced the -Wstringop-overflow flag to detect buffer overflows +in calls to string handling functions [1][2]. Due to the way +``empty_zero_page'' is declared in arch/sparc/include/setup.h, this +causes a warning to trigger at compile time in the function mem_init(), +which is subsequently converted to an error. The ensuing patch fixes +this issue and aligns the declaration of empty_zero_page to that of +other architectures. Thank you. + +Cheers, +Orlando. + +[1] https://gcc.gnu.org/ml/gcc-patches/2016-10/msg02308.html +[2] https://gcc.gnu.org/gcc-7/changes.html + +Signed-off-by: Orlando Arias + +-------------------------------------------------------------------------------- +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + arch/sparc/include/asm/pgtable_32.h | 4 ++-- + arch/sparc/include/asm/setup.h | 2 +- + arch/sparc/mm/init_32.c | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/sparc/include/asm/pgtable_32.h ++++ b/arch/sparc/include/asm/pgtable_32.h +@@ -91,9 +91,9 @@ extern unsigned long pfn_base; + * ZERO_PAGE is a global shared page that is always zero: used + * for zero-mapped memory areas etc.. + */ +-extern unsigned long empty_zero_page; ++extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; + +-#define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page)) ++#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) + + /* + * In general all page table modifications should use the V8 atomic +--- a/arch/sparc/include/asm/setup.h ++++ b/arch/sparc/include/asm/setup.h +@@ -16,7 +16,7 @@ extern char reboot_command[]; + */ + extern unsigned char boot_cpu_id; + +-extern unsigned long empty_zero_page; ++extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; + + extern int serial_console; + static inline int con_is_present(void) +--- a/arch/sparc/mm/init_32.c ++++ b/arch/sparc/mm/init_32.c +@@ -301,7 +301,7 @@ void __init mem_init(void) + + + /* Saves us work later. */ +- memset((void *)&empty_zero_page, 0, PAGE_SIZE); ++ memset((void *)empty_zero_page, 0, PAGE_SIZE); + + i = last_valid_pfn >> ((20 - PAGE_SHIFT) + 5); + i += 1; diff --git a/queue-4.9/sparc-ftrace-fix-ftrace-graph-time-measurement.patch b/queue-4.9/sparc-ftrace-fix-ftrace-graph-time-measurement.patch new file mode 100644 index 00000000000..34ccadf5e57 --- /dev/null +++ b/queue-4.9/sparc-ftrace-fix-ftrace-graph-time-measurement.patch @@ -0,0 +1,57 @@ +From foo@baz Wed May 31 16:49:17 JST 2017 +From: "Liam R. Howlett" +Date: Wed, 17 May 2017 11:47:00 -0400 +Subject: sparc/ftrace: Fix ftrace graph time measurement + +From: "Liam R. Howlett" + + +[ Upstream commit 48078d2dac0a26f84f5f3ec704f24f7c832cce14 ] + +The ftrace function_graph time measurements of a given function is not +accurate according to those recorded by ftrace using the function +filters. This change pulls the x86_64 fix from 'commit 722b3c746953 +("ftrace/graph: Trace function entry before updating index")' into the +sparc specific prepare_ftrace_return which stops ftrace from +counting interrupted tasks in the time measurement. + +Example measurements for select_task_rq_fair running "hackbench 100 +process 1000": + + | tracing/trace_stat/function0 | function_graph + Before patch | 2.802 us | 4.255 us + After patch | 2.749 us | 3.094 us + +Signed-off-by: Liam R. Howlett +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + arch/sparc/kernel/ftrace.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +--- a/arch/sparc/kernel/ftrace.c ++++ b/arch/sparc/kernel/ftrace.c +@@ -130,17 +130,16 @@ unsigned long prepare_ftrace_return(unsi + if (unlikely(atomic_read(¤t->tracing_graph_pause))) + return parent + 8UL; + +- if (ftrace_push_return_trace(parent, self_addr, &trace.depth, +- frame_pointer, NULL) == -EBUSY) +- return parent + 8UL; +- + trace.func = self_addr; ++ trace.depth = current->curr_ret_stack + 1; + + /* Only trace if the calling function expects to */ +- if (!ftrace_graph_entry(&trace)) { +- current->curr_ret_stack--; ++ if (!ftrace_graph_entry(&trace)) ++ return parent + 8UL; ++ ++ if (ftrace_push_return_trace(parent, self_addr, &trace.depth, ++ frame_pointer, NULL) == -EBUSY) + return parent + 8UL; +- } + + return return_hooker; + }