From 1a403d1e1b113841b51ffeda1c660147b43403ce Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Wed, 28 Nov 2018 11:13:06 -0500 Subject: [PATCH] patches for 3.18 Signed-off-by: Sasha Levin --- ...ake-lookup_processor_type-non-__init.patch | 44 ++++++ .../arm64-remove-no-op-p-linker-flag.patch | 50 +++++++ ...d-return-value-check-for-voltage-sca.patch | 40 ++++++ ...strscpy-with-destination-buffer-size.patch | 126 ++++++++++++++++++ ...press-vphn-is-not-supported-messages.patch | 36 +++++ queue-3.18/series | 7 + ...gus-get-put-in-generic_key_to_expire.patch | 35 +++++ ...-seek_data-sek_hole-return-enxio-wit.patch | 54 ++++++++ 8 files changed, 392 insertions(+) create mode 100644 queue-3.18/arm-make-lookup_processor_type-non-__init.patch create mode 100644 queue-3.18/arm64-remove-no-op-p-linker-flag.patch create mode 100644 queue-3.18/cpufreq-imx6q-add-return-value-check-for-voltage-sca.patch create mode 100644 queue-3.18/kdb-use-strscpy-with-destination-buffer-size.patch create mode 100644 queue-3.18/powerpc-numa-suppress-vphn-is-not-supported-messages.patch create mode 100644 queue-3.18/sunrpc-fix-a-bogus-get-put-in-generic_key_to_expire.patch create mode 100644 queue-3.18/tmpfs-make-lseek-seek_data-sek_hole-return-enxio-wit.patch diff --git a/queue-3.18/arm-make-lookup_processor_type-non-__init.patch b/queue-3.18/arm-make-lookup_processor_type-non-__init.patch new file mode 100644 index 00000000000..f52ca187d15 --- /dev/null +++ b/queue-3.18/arm-make-lookup_processor_type-non-__init.patch @@ -0,0 +1,44 @@ +From 58e2265f733097a565f7accf6e574073bb93ecb7 Mon Sep 17 00:00:00 2001 +From: Russell King +Date: Thu, 19 Jul 2018 11:42:36 +0100 +Subject: ARM: make lookup_processor_type() non-__init + +[ Upstream commit 899a42f836678a595f7d2bc36a5a0c2b03d08cbc ] + +Move lookup_processor_type() out of the __init section so it is callable +from (eg) the secondary startup code during hotplug. + +Reviewed-by: Julien Thierry +Signed-off-by: Russell King +Signed-off-by: Sasha Levin +--- + arch/arm/kernel/head-common.S | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S +index 8733012d231f..7e662bdd5cb3 100644 +--- a/arch/arm/kernel/head-common.S ++++ b/arch/arm/kernel/head-common.S +@@ -122,6 +122,9 @@ __mmap_switched_data: + .long init_thread_union + THREAD_START_SP @ sp + .size __mmap_switched_data, . - __mmap_switched_data + ++ __FINIT ++ .text ++ + /* + * This provides a C-API version of __lookup_processor_type + */ +@@ -133,9 +136,6 @@ ENTRY(lookup_processor_type) + ldmfd sp!, {r4 - r6, r9, pc} + ENDPROC(lookup_processor_type) + +- __FINIT +- .text +- + /* + * Read processor ID register (CP#15, CR0), and look up in the linker-built + * supported processor list. Note that we can't use the absolute addresses +-- +2.17.1 + diff --git a/queue-3.18/arm64-remove-no-op-p-linker-flag.patch b/queue-3.18/arm64-remove-no-op-p-linker-flag.patch new file mode 100644 index 00000000000..9394742a881 --- /dev/null +++ b/queue-3.18/arm64-remove-no-op-p-linker-flag.patch @@ -0,0 +1,50 @@ +From a345142bd6561ab69f3520ca43d7cc62bce23a25 Mon Sep 17 00:00:00 2001 +From: Greg Hackmann +Date: Tue, 27 Nov 2018 11:15:20 -0800 +Subject: arm64: remove no-op -p linker flag + +(commit 1a381d4a0a9a0f999a13faaba22bf6b3fc80dcb9 upstream) + +Linking the ARM64 defconfig kernel with LLVM lld fails with the error: + + ld.lld: error: unknown argument: -p + Makefile:1015: recipe for target 'vmlinux' failed + +Without this flag, the ARM64 defconfig kernel successfully links with +lld and boots on Dragonboard 410c. + +After digging through binutils source and changelogs, it turns out that +-p is only relevant to ancient binutils installations targeting 32-bit +ARM. binutils accepts -p for AArch64 too, but it's always been +undocumented and silently ignored. A comment in +ld/emultempl/aarch64elf.em explains that it's "Only here for backwards +compatibility". + +Since this flag is a no-op on ARM64, we can safely drop it. + +Acked-by: Will Deacon +Reviewed-by: Nick Desaulniers +Signed-off-by: Greg Hackmann +Signed-off-by: Catalin Marinas +Signed-off-by: Nick Desaulniers +Signed-off-by: Sasha Levin +--- + arch/arm64/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile +index 37c4fd6aeb7a..42065599d014 100644 +--- a/arch/arm64/Makefile ++++ b/arch/arm64/Makefile +@@ -10,7 +10,7 @@ + # + # Copyright (C) 1995-2001 by Russell King + +-LDFLAGS_vmlinux :=-p --no-undefined -X ++LDFLAGS_vmlinux :=--no-undefined -X + CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) + OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S + GZFLAGS :=-9 +-- +2.17.1 + diff --git a/queue-3.18/cpufreq-imx6q-add-return-value-check-for-voltage-sca.patch b/queue-3.18/cpufreq-imx6q-add-return-value-check-for-voltage-sca.patch new file mode 100644 index 00000000000..48f319293a8 --- /dev/null +++ b/queue-3.18/cpufreq-imx6q-add-return-value-check-for-voltage-sca.patch @@ -0,0 +1,40 @@ +From 20604b9d48cb73fc3cd02552406c9aa212003f6c Mon Sep 17 00:00:00 2001 +From: Anson Huang +Date: Mon, 5 Nov 2018 00:59:28 +0000 +Subject: cpufreq: imx6q: add return value check for voltage scale + +[ Upstream commit 6ef28a04d1ccf718eee069b72132ce4aa1e52ab9 ] + +Add return value check for voltage scale when ARM clock +rate change fail. + +Signed-off-by: Anson Huang +Acked-by: Viresh Kumar +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/imx6q-cpufreq.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c +index c2d30765bf3d..a4ede00483d1 100644 +--- a/drivers/cpufreq/imx6q-cpufreq.c ++++ b/drivers/cpufreq/imx6q-cpufreq.c +@@ -105,8 +105,13 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) + /* Ensure the arm clock divider is what we expect */ + ret = clk_set_rate(arm_clk, new_freq * 1000); + if (ret) { ++ int ret1; ++ + dev_err(cpu_dev, "failed to set clock rate: %d\n", ret); +- regulator_set_voltage_tol(arm_reg, volt_old, 0); ++ ret1 = regulator_set_voltage_tol(arm_reg, volt_old, 0); ++ if (ret1) ++ dev_warn(cpu_dev, ++ "failed to restore vddarm voltage: %d\n", ret1); + return ret; + } + +-- +2.17.1 + diff --git a/queue-3.18/kdb-use-strscpy-with-destination-buffer-size.patch b/queue-3.18/kdb-use-strscpy-with-destination-buffer-size.patch new file mode 100644 index 00000000000..0c911a108d9 --- /dev/null +++ b/queue-3.18/kdb-use-strscpy-with-destination-buffer-size.patch @@ -0,0 +1,126 @@ +From 5de3411ebe77a9e6dc268768c0f4367956dbd154 Mon Sep 17 00:00:00 2001 +From: Prarit Bhargava +Date: Thu, 20 Sep 2018 08:59:14 -0400 +Subject: kdb: Use strscpy with destination buffer size +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ Upstream commit c2b94c72d93d0929f48157eef128c4f9d2e603ce ] + +gcc 8.1.0 warns with: + +kernel/debug/kdb/kdb_support.c: In function ‘kallsyms_symbol_next’: +kernel/debug/kdb/kdb_support.c:239:4: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=] + strncpy(prefix_name, name, strlen(name)+1); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +kernel/debug/kdb/kdb_support.c:239:31: note: length computed here + +Use strscpy() with the destination buffer size, and use ellipses when +displaying truncated symbols. + +v2: Use strscpy() + +Signed-off-by: Prarit Bhargava +Cc: Jonathan Toppins +Cc: Jason Wessel +Cc: Daniel Thompson +Cc: kgdb-bugreport@lists.sourceforge.net +Reviewed-by: Daniel Thompson +Signed-off-by: Daniel Thompson +Signed-off-by: Sasha Levin +--- + kernel/debug/kdb/kdb_io.c | 15 +++++++++------ + kernel/debug/kdb/kdb_private.h | 2 +- + kernel/debug/kdb/kdb_support.c | 10 +++++----- + 3 files changed, 15 insertions(+), 12 deletions(-) + +diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c +index 681c8b42e013..1c6b7055f11f 100644 +--- a/kernel/debug/kdb/kdb_io.c ++++ b/kernel/debug/kdb/kdb_io.c +@@ -215,7 +215,7 @@ static char *kdb_read(char *buffer, size_t bufsize) + int count; + int i; + int diag, dtab_count; +- int key; ++ int key, buf_size, ret; + + + diag = kdbgetintenv("DTABCOUNT", &dtab_count); +@@ -335,9 +335,8 @@ poll_again: + else + p_tmp = tmpbuffer; + len = strlen(p_tmp); +- count = kallsyms_symbol_complete(p_tmp, +- sizeof(tmpbuffer) - +- (p_tmp - tmpbuffer)); ++ buf_size = sizeof(tmpbuffer) - (p_tmp - tmpbuffer); ++ count = kallsyms_symbol_complete(p_tmp, buf_size); + if (tab == 2 && count > 0) { + kdb_printf("\n%d symbols are found.", count); + if (count > dtab_count) { +@@ -349,9 +348,13 @@ poll_again: + } + kdb_printf("\n"); + for (i = 0; i < count; i++) { +- if (WARN_ON(!kallsyms_symbol_next(p_tmp, i))) ++ ret = kallsyms_symbol_next(p_tmp, i, buf_size); ++ if (WARN_ON(!ret)) + break; +- kdb_printf("%s ", p_tmp); ++ if (ret != -E2BIG) ++ kdb_printf("%s ", p_tmp); ++ else ++ kdb_printf("%s... ", p_tmp); + *(p_tmp + len) = '\0'; + } + if (i >= dtab_count) +diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h +index 7afd3c8c41d5..439f1c8b1193 100644 +--- a/kernel/debug/kdb/kdb_private.h ++++ b/kernel/debug/kdb/kdb_private.h +@@ -83,7 +83,7 @@ typedef struct __ksymtab { + unsigned long sym_start; + unsigned long sym_end; + } kdb_symtab_t; +-extern int kallsyms_symbol_next(char *prefix_name, int flag); ++extern int kallsyms_symbol_next(char *prefix_name, int flag, int buf_size); + extern int kallsyms_symbol_complete(char *prefix_name, int max_len); + + /* Exported Symbols for kernel loadable modules to use. */ +diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c +index d35cc2d3a4cc..2aed4a33521b 100644 +--- a/kernel/debug/kdb/kdb_support.c ++++ b/kernel/debug/kdb/kdb_support.c +@@ -221,11 +221,13 @@ int kallsyms_symbol_complete(char *prefix_name, int max_len) + * Parameters: + * prefix_name prefix of a symbol name to lookup + * flag 0 means search from the head, 1 means continue search. ++ * buf_size maximum length that can be written to prefix_name ++ * buffer + * Returns: + * 1 if a symbol matches the given prefix. + * 0 if no string found + */ +-int kallsyms_symbol_next(char *prefix_name, int flag) ++int kallsyms_symbol_next(char *prefix_name, int flag, int buf_size) + { + int prefix_len = strlen(prefix_name); + static loff_t pos; +@@ -235,10 +237,8 @@ int kallsyms_symbol_next(char *prefix_name, int flag) + pos = 0; + + while ((name = kdb_walk_kallsyms(&pos))) { +- if (strncmp(name, prefix_name, prefix_len) == 0) { +- strncpy(prefix_name, name, strlen(name)+1); +- return 1; +- } ++ if (!strncmp(name, prefix_name, prefix_len)) ++ return strscpy(prefix_name, name, buf_size); + } + return 0; + } +-- +2.17.1 + diff --git a/queue-3.18/powerpc-numa-suppress-vphn-is-not-supported-messages.patch b/queue-3.18/powerpc-numa-suppress-vphn-is-not-supported-messages.patch new file mode 100644 index 00000000000..bc4b3aca21c --- /dev/null +++ b/queue-3.18/powerpc-numa-suppress-vphn-is-not-supported-messages.patch @@ -0,0 +1,36 @@ +From db15edaf793e7d8f53be449fcb9b23ce471768a3 Mon Sep 17 00:00:00 2001 +From: Satheesh Rajendran +Date: Thu, 8 Nov 2018 10:47:56 +0530 +Subject: powerpc/numa: Suppress "VPHN is not supported" messages + +[ Upstream commit 437ccdc8ce629470babdda1a7086e2f477048cbd ] + +When VPHN function is not supported and during cpu hotplug event, +kernel prints message 'VPHN function not supported. Disabling +polling...'. Currently it prints on every hotplug event, it floods +dmesg when a KVM guest tries to hotplug huge number of vcpus, let's +just print once and suppress further kernel prints. + +Signed-off-by: Satheesh Rajendran +Signed-off-by: Michael Ellerman +Signed-off-by: Sasha Levin +--- + arch/powerpc/mm/numa.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c +index b9d1dfdbe5bb..ae9d3bf79612 100644 +--- a/arch/powerpc/mm/numa.c ++++ b/arch/powerpc/mm/numa.c +@@ -1479,7 +1479,7 @@ static long vphn_get_associativity(unsigned long cpu, + + switch (rc) { + case H_FUNCTION: +- printk(KERN_INFO ++ printk_once(KERN_INFO + "VPHN is not supported. Disabling polling...\n"); + stop_topology_update(); + break; +-- +2.17.1 + diff --git a/queue-3.18/series b/queue-3.18/series index a8232add8c9..7fd4d027292 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -10,3 +10,10 @@ can-dev-can_get_echo_skb-factor-out-non-sending-code-to-__can_get_echo_skb.patch can-dev-__can_get_echo_skb-replace-struct-can_frame-by-canfd_frame-to-access-frame-length.patch can-dev-__can_get_echo_skb-don-t-crash-the-kernel-if-can_priv-echo_skb-is-accessed-out-of-bounds.patch can-dev-__can_get_echo_skb-print-error-message-if-trying-to-echo-non-existing-skb.patch +cpufreq-imx6q-add-return-value-check-for-voltage-sca.patch +arm-make-lookup_processor_type-non-__init.patch +sunrpc-fix-a-bogus-get-put-in-generic_key_to_expire.patch +kdb-use-strscpy-with-destination-buffer-size.patch +powerpc-numa-suppress-vphn-is-not-supported-messages.patch +tmpfs-make-lseek-seek_data-sek_hole-return-enxio-wit.patch +arm64-remove-no-op-p-linker-flag.patch diff --git a/queue-3.18/sunrpc-fix-a-bogus-get-put-in-generic_key_to_expire.patch b/queue-3.18/sunrpc-fix-a-bogus-get-put-in-generic_key_to_expire.patch new file mode 100644 index 00000000000..b94d7b941f7 --- /dev/null +++ b/queue-3.18/sunrpc-fix-a-bogus-get-put-in-generic_key_to_expire.patch @@ -0,0 +1,35 @@ +From 28d6b4d58a6de87f95608d4733e13a85b42713f0 Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Mon, 12 Nov 2018 16:06:51 -0500 +Subject: SUNRPC: Fix a bogus get/put in generic_key_to_expire() + +[ Upstream commit e3d5e573a54dabdc0f9f3cb039d799323372b251 ] + +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + net/sunrpc/auth_generic.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c +index 6f6b829c9e8e..42e93bf496e7 100644 +--- a/net/sunrpc/auth_generic.c ++++ b/net/sunrpc/auth_generic.c +@@ -272,13 +272,7 @@ static bool generic_key_to_expire(struct rpc_cred *cred) + { + struct auth_cred *acred = &container_of(cred, struct generic_cred, + gc_base)->acred; +- bool ret; +- +- get_rpccred(cred); +- ret = test_bit(RPC_CRED_KEY_EXPIRE_SOON, &acred->ac_flags); +- put_rpccred(cred); +- +- return ret; ++ return test_bit(RPC_CRED_KEY_EXPIRE_SOON, &acred->ac_flags); + } + + static const struct rpc_credops generic_credops = { +-- +2.17.1 + diff --git a/queue-3.18/tmpfs-make-lseek-seek_data-sek_hole-return-enxio-wit.patch b/queue-3.18/tmpfs-make-lseek-seek_data-sek_hole-return-enxio-wit.patch new file mode 100644 index 00000000000..03135e0a675 --- /dev/null +++ b/queue-3.18/tmpfs-make-lseek-seek_data-sek_hole-return-enxio-wit.patch @@ -0,0 +1,54 @@ +From b6d6fae135d89df91630476ec013c6aa746f58e8 Mon Sep 17 00:00:00 2001 +From: Yufen Yu +Date: Fri, 16 Nov 2018 15:08:39 -0800 +Subject: tmpfs: make lseek(SEEK_DATA/SEK_HOLE) return ENXIO with a negative + offset + +[ Upstream commit 1a413646931cb14442065cfc17561e50f5b5bb44 ] + +Other filesystems such as ext4, f2fs and ubifs all return ENXIO when +lseek (SEEK_DATA or SEEK_HOLE) requests a negative offset. + +man 2 lseek says + +: EINVAL whence is not valid. Or: the resulting file offset would be +: negative, or beyond the end of a seekable device. +: +: ENXIO whence is SEEK_DATA or SEEK_HOLE, and the file offset is beyond +: the end of the file. + +Make tmpfs return ENXIO under these circumstances as well. After this, +tmpfs also passes xfstests's generic/448. + +[akpm@linux-foundation.org: rewrite changelog] +Link: http://lkml.kernel.org/r/1540434176-14349-1-git-send-email-yuyufen@huawei.com +Signed-off-by: Yufen Yu +Reviewed-by: Andrew Morton +Cc: Al Viro +Cc: Hugh Dickins +Cc: William Kucharski +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + mm/shmem.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/mm/shmem.c b/mm/shmem.c +index 371d5eca80ed..64c33e3dbe69 100644 +--- a/mm/shmem.c ++++ b/mm/shmem.c +@@ -1805,9 +1805,7 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence) + mutex_lock(&inode->i_mutex); + /* We're holding i_mutex so we can access i_size directly */ + +- if (offset < 0) +- offset = -EINVAL; +- else if (offset >= inode->i_size) ++ if (offset < 0 || offset >= inode->i_size) + offset = -ENXIO; + else { + start = offset >> PAGE_CACHE_SHIFT; +-- +2.17.1 + -- 2.47.3