6.5.1-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 1/8 ACPI: thermal: Drop nocrt parameter
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
commit 5f641174a12b8a876a4101201a21ef4675ecc014 upstream.
The nocrt module parameter has no code associated with it and does nothing. As crt=-1 has same functionality as what nocrt should be doing drop nocrt and associated documentation.
This should fix a quirk for Gigabyte GA-7ZX that used nocrt and thus didn't function properly.
--- Documentation/admin-guide/kernel-parameters.txt | 4 ---- drivers/acpi/thermal.c | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +0 -4
@@ -6275,10 +6275,6 @@ -1: disable all critical trip points in all thermal zones <degrees C>: override all critical trip points - thermal.nocrt= [HW,ACPI] - Set to disable actions on ACPI thermal zone - critical and hot trip points. - thermal.off= [HW,ACPI] 1: disable ACPI thermal control
drivers/acpi/thermal.c +1 -5
@@ -82,10 +82,6 @@ static int tzp;module_param (tzp, int,0444 );MODULE_PARM_DESC (tzp,"Thermal zone polling frequency, in 1/10 seconds." ); -static int nocrt; -module_param (nocrt, int,0 ); -MODULE_PARM_DESC (nocrt,"Set to take no action upon ACPI thermal zone critical trips points." ); -static int off;module_param (off, int,0 );MODULE_PARM_DESC (off,"Set to disable ACPI thermal support." );
@@ -1094,7 +1090,7 @@ static int thermal_act(const struct dmi_static int thermal_nocrt (const struct dmi_system_id *d) {pr_notice ("%s detected: disabling all critical thermal trip point actions.\n" , d->ident); - nocrt =1 ; + crt =-1 ;return 0 ; }static int thermal_tzp (const struct dmi_system_id *d) {
Greg Kroah-Hartman
maintainerPATCH 2/8 module: Expose module_init_layout_section()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
commit 2abcc4b5a64a65a2d2287ba0be5c2871c1552416 upstream.
module_init_layout_section() choses whether the core module loader considers a section as init or not. This affects the placement of the exit section when module unloading is disabled. This code will never run, so it can be free()d once the module has been initialised.
arm and arm64 need to count the number of PLTs they need before applying relocations based on the section name. The init PLTs are stored separately so they can be free()d. arm and arm64 both use within_module_init() to decide which list of PLTs to use when applying the relocation.
Because within_module_init()'s behaviour changes when module unloading is disabled, both architecture would need to take this into account when counting the PLTs.
Today neither architecture does this, meaning when module unloading is disabled there are insufficient PLTs in the init section to load some modules, resulting in warnings:
| WARNING: CPU: 2 PID: 51 at arch/arm64/kernel/module-plts.c:99 module_emit_plt_entry+0x184/0x1cc | Modules linked in: crct10dif_common | CPU: 2 PID: 51 Comm: modprobe Not tainted 6.5.0-rc4-yocto-standard-dirty #15208 | Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 | pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) | pc : module_emit_plt_entry+0x184/0x1cc | lr : module_emit_plt_entry+0x94/0x1cc | sp : ffffffc0803bba60 [...] | Call trace: | module_emit_plt_entry+0x184/0x1cc | apply_relocate_add+0x2bc/0x8e4 | load_module+0xe34/0x1bd4 | init_module_from_file+0x84/0xc0 | __arm64_sys_finit_module+0x1b8/0x27c | invoke_syscall.constprop.0+0x5c/0x104 | do_el0_svc+0x58/0x160 | el0_svc+0x38/0x110 | el0t_64_sync_handler+0xc0/0xc4 | el0t_64_sync+0x190/0x194
Instead of duplicating module_init_layout_section()s logic, expose it.
--- include/linux/moduleloader.h | 5 +++++ kernel/module/main.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
include/linux/moduleloader.h +5 -0
@@ -42,6 +42,11 @@ bool module_init_section(const char *nam*/ bool module_exit_section (const char *name); +/* Describes whether within_module_init() will consider this an init section +* or not. This behaviour changes with CONFIG_MODULE_UNLOAD. +*/ +bool module_init_layout_section (const char *sname); +/* * Apply the given relocation to the (simplified) ELF. Return -error * or 0.
kernel/module/main.c +1 -1
@@ -1484,7 +1484,7 @@ long module_get_offset_and_type(struct mreturn offset | mask; } -static bool module_init_layout_section (const char *sname) +bool module_init_layout_section (const char *sname) {#ifndef CONFIG_MODULE_UNLOAD if (module_exit_section (sname))
Greg Kroah-Hartman
maintainerPATCH 3/8 arm64: module: Use module_init_layout_section() to spot init sections
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
commit f928f8b1a2496e7af95b860f9acf553f20f68f16 upstream.
Today module_frob_arch_sections() spots init sections from their 'init' prefix, and uses this to keep the init PLTs separate from the rest.
module_emit_plt_entry() uses within_module_init() to determine if a location is in the init text or not, but this depends on whether core code thought this was an init section.
Naturally the logic is different.
module_init_layout_section() groups the init and exit text together if module unloading is disabled, as the exit code will never run. The result is kernels with this configuration can't load all their modules because there are not enough PLTs for the combined init+exit section.
This results in the following:
| WARNING: CPU: 2 PID: 51 at arch/arm64/kernel/module-plts.c:99 module_emit_plt_entry+0x184/0x1cc | Modules linked in: crct10dif_common | CPU: 2 PID: 51 Comm: modprobe Not tainted 6.5.0-rc4-yocto-standard-dirty #15208 | Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 | pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) | pc : module_emit_plt_entry+0x184/0x1cc | lr : module_emit_plt_entry+0x94/0x1cc | sp : ffffffc0803bba60 [...] | Call trace: | module_emit_plt_entry+0x184/0x1cc | apply_relocate_add+0x2bc/0x8e4 | load_module+0xe34/0x1bd4 | init_module_from_file+0x84/0xc0 | __arm64_sys_finit_module+0x1b8/0x27c | invoke_syscall.constprop.0+0x5c/0x104 | do_el0_svc+0x58/0x160 | el0_svc+0x38/0x110 | el0t_64_sync_handler+0xc0/0xc4 | el0t_64_sync+0x190/0x194
A previous patch exposed module_init_layout_section(), use that so the logic is the same.
--- arch/arm64/kernel/module-plts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/module-plts.c +1 -1
@@ -339,7 +339,7 @@ int module_frob_arch_sections(Elf_Ehdr *if (nents)sort (rels, nents,sizeof (Elf64_Rela), cmp_rela,NULL ); -if (!str_has_prefix (secstrings + dstsec->sh_name,".init" )) +if (!module_init_layout_section (secstrings + dstsec->sh_name)) core_plts +=count_plts (syms, rels, numrels, sechdrs[i].sh_info, dstsec);else
Greg Kroah-Hartman
maintainerPATCH 4/8 ARM: module: Use module_init_layout_section() to spot init sections
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
commit a6846234f45801441f0e31a8b37f901ef0abd2df upstream.
Today module_frob_arch_sections() spots init sections from their 'init' prefix, and uses this to keep the init PLTs separate from the rest.
get_module_plt() uses within_module_init() to determine if a location is in the init text or not, but this depends on whether core code thought this was an init section.
Naturally the logic is different.
module_init_layout_section() groups the init and exit text together if module unloading is disabled, as the exit code will never run. The result is kernels with this configuration can't load all their modules because there are not enough PLTs for the combined init+exit section.
A previous patch exposed module_init_layout_section(), use that so the logic is the same.
--- arch/arm/kernel/module-plts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/module-plts.c +1 -1
@@ -251,7 +251,7 @@ int module_frob_arch_sections(Elf_Ehdr */* sort by type and symbol index */ sort (rels, numrels,sizeof (Elf32_Rel), cmp_rel,NULL ); -if (strncmp (secstrings + dstsec->sh_name,".init" ,5 ) !=0 ) +if (!module_init_layout_section (secstrings + dstsec->sh_name)) core_plts +=count_plts (syms, dstsec->sh_addr, rels, numrels, s->sh_info);else
Greg Kroah-Hartman
maintainerPATCH 5/8 module/decompress: use vmalloc() for zstd decompression workspace
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Righi <[email protected]>
commit a419beac4a070aff63c520f36ebf7cb8a76a8ae5 upstream.
Using kmalloc() to allocate the decompression workspace for zstd may trigger the following warning when large modules are loaded (i.e., xfs):
[ 2.961884] WARNING: CPU: 1 PID: 254 at mm/page_alloc.c:4453 __alloc_pages+0x2c3/0x350 ... [ 2.989033] Call Trace: [ 2.989841] <TASK> [ 2.990614] ? show_regs+0x6d/0x80 [ 2.991573] ? __warn+0x89/0x160 [ 2.992485] ? __alloc_pages+0x2c3/0x350 [ 2.993520] ? report_bug+0x17e/0x1b0 [ 2.994506] ? handle_bug+0x51/0xa0 [ 2.995474] ? exc_invalid_op+0x18/0x80 [ 2.996469] ? asm_exc_invalid_op+0x1b/0x20 [ 2.997530] ? module_zstd_decompress+0xdc/0x2a0 [ 2.998665] ? __alloc_pages+0x2c3/0x350 [ 2.999695] ? module_zstd_decompress+0xdc/0x2a0 [ 3.000821] __kmalloc_large_node+0x7a/0x150 [ 3.001920] __kmalloc+0xdb/0x170 [ 3.002824] module_zstd_decompress+0xdc/0x2a0 [ 3.003857] module_decompress+0x37/0xc0 [ 3.004688] init_module_from_file+0xd0/0x100 [ 3.005668] idempotent_init_module+0x11c/0x2b0 [ 3.006632] __x64_sys_finit_module+0x64/0xd0 [ 3.007568] do_syscall_64+0x59/0x90 [ 3.008373] ? ksys_read+0x73/0x100 [ 3.009395] ? exit_to_user_mode_prepare+0x30/0xb0 [ 3.010531] ? syscall_exit_to_user_mode+0x37/0x60 [ 3.011662] ? do_syscall_64+0x68/0x90 [ 3.012511] ? do_syscall_64+0x68/0x90 [ 3.013364] entry_SYSCALL_64_after_hwframe+0x6e/0xd8
However, continuous physical memory does not seem to be required in module_zstd_decompress(), so use vmalloc() instead, to prevent the warning and avoid potential failures at loading compressed modules.
--- kernel/module/decompress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/module/decompress.c +2 -2
@@ -241,7 +241,7 @@ static ssize_t module_zstd_decompress(st } wksp_size =zstd_dstream_workspace_bound (header.windowSize); - wksp =kmalloc (wksp_size,GFP_KERNEL ); + wksp =vmalloc (wksp_size);if (!wksp) { retval = -ENOMEM ; goto out;
@@ -284,7 +284,7 @@ static ssize_t module_zstd_decompress(st retval = new_size; out: -kfree (wksp); +vfree (wksp); return retval; }#else
Greg Kroah-Hartman
maintainerPATCH 6/8 ipv6: remove hard coded limitation on ipv6_pinfo
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit f5f80e32de12fad2813d37270e8364a03e6d3ef0 upstream.
IPv6 inet sockets are supposed to have a "struct ipv6_pinfo" field at the end of their definition, so that inet6_sk_generic() can derive from socket size the offset of the "struct ipv6_pinfo".
This is very fragile, and prevents adding bigger alignment in sockets, because inet6_sk_generic() does not work if the compiler adds padding after the ipv6_pinfo component.
We are currently working on a patch series to reorganize TCP structures for better data locality and found issues similar to the one fixed in commit f5d547676ca0 ("tcp: fix tcp_inet6_sk() for 32bit kernels")
Alternative would be to force an alignment on "struct ipv6_pinfo", greater or equal to __alignof__(any ipv6 sock) to ensure there is no padding. This does not look great.
v2: fix typo in mptcp_proto_v6_init() (Paolo)
--- include/linux/ipv6.h | 15 ++++----------- include/net/sock.h | 1 + net/dccp/ipv6.c | 1 + net/dccp/ipv6.h | 4 ---- net/ipv6/af_inet6.c | 4 ++-- net/ipv6/ping.c | 1 + net/ipv6/raw.c | 1 + net/ipv6/tcp_ipv6.c | 1 + net/ipv6/udp.c | 1 + net/ipv6/udplite.c | 1 + net/l2tp/l2tp_ip6.c | 4 +--- net/mptcp/protocol.c | 1 + net/sctp/socket.c | 1 + 13 files changed, 16 insertions(+), 20 deletions(-)
include/linux/ipv6.h +4 -11
@@ -199,14 +199,7 @@ struct inet6_cork {u8 tclass; }; -/** -* struct ipv6_pinfo - ipv6 private area -* -* In the struct sock hierarchy (tcp6_sock, upd6_sock, etc) -* this _must_ be the last member, so that inet6_sk_generic -* is able to calculate its offset from the base struct sock -* by using the struct proto->slab_obj_size member. -acme -*/ +/* struct ipv6_pinfo - ipv6 private area */ struct ipv6_pinfo {struct in6_addr saddr;struct in6_pktinfo sticky_pktinfo;
@@ -306,19 +299,19 @@ struct raw6_sock {__u32 offset;/* checksum offset */ struct icmp6_filter filter;__u32 ip6mr_table; -/* ipv6_pinfo has to be the last member of raw6_sock, see inet6_sk_generic */ +struct ipv6_pinfo inet6; };struct udp6_sock {struct udp_sock udp; -/* ipv6_pinfo has to be the last member of udp6_sock, see inet6_sk_generic */ +struct ipv6_pinfo inet6; };struct tcp6_sock {struct tcp_sock tcp; -/* ipv6_pinfo has to be the last member of tcp6_sock, see inet6_sk_generic */ +struct ipv6_pinfo inet6; };
include/net/sock.h +1 -0
@@ -1340,6 +1340,7 @@ struct proto {struct kmem_cache *slab;unsigned int obj_size; +unsigned int ipv6_pinfo_offset;slab_flags_t slab_flags;unsigned int useroffset;/* Usercopy region offset */ unsigned int usersize;/* Usercopy region size */
net/dccp/ipv6.c +1 -0
@@ -1056,6 +1056,7 @@ static struct proto dccp_v6_prot = { .orphan_count = &dccp_orphan_count, .max_header = MAX_DCCP_HEADER, .obj_size = sizeof(struct dccp6_sock), + .ipv6_pinfo_offset = offsetof(struct dccp6_sock, inet6), .slab_flags = SLAB_TYPESAFE_BY_RCU, .rsk_prot = &dccp6_request_sock_ops, .twsk_prot = &dccp6_timewait_sock_ops,
net/dccp/ipv6.h +0 -4
@@ -13,10 +13,6 @@struct dccp6_sock {struct dccp_sock dccp; -/* -* ipv6_pinfo has to be the last member of dccp6_sock, -* see inet6_sk_generic. -*/ struct ipv6_pinfo inet6; };
net/ipv6/af_inet6.c +2 -2
@@ -102,9 +102,9 @@ bool ipv6_mod_enabled(void) }EXPORT_SYMBOL_GPL (ipv6_mod_enabled); -static __inline__struct ipv6_pinfo *inet6_sk_generic (struct sock *sk) +static struct ipv6_pinfo *inet6_sk_generic (struct sock *sk) { -const int offset = sk->sk_prot->obj_size -sizeof (struct ipv6_pinfo ); +const int offset = sk->sk_prot->ipv6_pinfo_offset;return (struct ipv6_pinfo *)(((u8 *)sk) + offset); }
net/ipv6/ping.c +1 -0
@@ -215,6 +215,7 @@ struct proto pingv6_prot = { .get_port = ping_get_port, .put_port = ping_unhash, .obj_size = sizeof(struct raw6_sock), + .ipv6_pinfo_offset = offsetof(struct raw6_sock, inet6), };EXPORT_SYMBOL_GPL (pingv6_prot);
net/ipv6/raw.c +1 -0
@@ -1216,6 +1216,7 @@ struct proto rawv6_prot = { .hash = raw_hash_sk, .unhash = raw_unhash_sk, .obj_size = sizeof(struct raw6_sock), + .ipv6_pinfo_offset = offsetof(struct raw6_sock, inet6), .useroffset = offsetof(struct raw6_sock, filter), .usersize = sizeof_field(struct raw6_sock, filter), .h.raw_hash = &raw_v6_hashinfo,
net/ipv6/tcp_ipv6.c +1 -0
@@ -2176,6 +2176,7 @@ struct proto tcpv6_prot = { .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_tcp_rmem), .max_header = MAX_TCP_HEADER, .obj_size = sizeof(struct tcp6_sock), + .ipv6_pinfo_offset = offsetof(struct tcp6_sock, inet6), .slab_flags = SLAB_TYPESAFE_BY_RCU, .twsk_prot = &tcp6_timewait_sock_ops, .rsk_prot = &tcp6_request_sock_ops,
net/ipv6/udp.c +1 -0
@@ -1802,6 +1802,7 @@ struct proto udpv6_prot = { .sysctl_wmem_offset = offsetof(struct net, ipv4.sysctl_udp_wmem_min), .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_udp_rmem_min), .obj_size = sizeof(struct udp6_sock), + .ipv6_pinfo_offset = offsetof(struct udp6_sock, inet6), .h.udp_table = NULL, .diag_destroy = udp_abort, };
net/ipv6/udplite.c +1 -0
@@ -67,6 +67,7 @@ struct proto udplitev6_prot = { .sysctl_wmem_offset = offsetof(struct net, ipv4.sysctl_udp_wmem_min), .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_udp_rmem_min), .obj_size = sizeof(struct udp6_sock), + .ipv6_pinfo_offset = offsetof(struct udp6_sock, inet6), .h.udp_table = &udplite_table, };
net/l2tp/l2tp_ip6.c +1 -3
@@ -36,9 +36,6 @@ struct l2tp_ip6_sock {u32 conn_id;u32 peer_conn_id; -/* ipv6_pinfo has to be the last member of l2tp_ip6_sock, see -* inet6_sk_generic -*/ struct ipv6_pinfo inet6; };
@@ -730,6 +727,7 @@ static struct proto l2tp_ip6_prot = { .hash = l2tp_ip6_hash, .unhash = l2tp_ip6_unhash, .obj_size = sizeof(struct l2tp_ip6_sock), + .ipv6_pinfo_offset = offsetof(struct l2tp_ip6_sock, inet6), };static const struct proto_ops l2tp_ip6_ops = {
net/mptcp/protocol.c +1 -0
@@ -3987,6 +3987,7 @@ int __init mptcp_proto_v6_init(void)strcpy (mptcp_v6_prot.name,"MPTCPv6" ); mptcp_v6_prot.slab =NULL ; mptcp_v6_prot.obj_size =sizeof (struct mptcp6_sock ); + mptcp_v6_prot.ipv6_pinfo_offset = offsetof(struct mptcp6_sock , np); err =proto_register (&mptcp_v6_prot,1 );if (err)
net/sctp/socket.c +1 -0
@@ -9732,6 +9732,7 @@ struct proto sctpv6_prot = { .unhash = sctp_unhash, .no_autobind = true, .obj_size = sizeof(struct sctp6_sock), + .ipv6_pinfo_offset = offsetof(struct sctp6_sock, inet6), .useroffset = offsetof(struct sctp6_sock, sctp.subscribe), .usersize = offsetof(struct sctp6_sock, sctp.initmsg) - offsetof(struct sctp6_sock, sctp.subscribe) +
Greg Kroah-Hartman
maintainercover 6.5.1-rc1 review
This is the start of the stable review cycle for the 6.5.1 release. There are 8 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 02 Sep 2023 11:08:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.1-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.5.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.5.1-rc1
Yonghong Song <[email protected]>
kallsyms: Fix kallsyms_selftest failure
Helge Deller <[email protected]>
lockdep: fix static memory detection even more
Eric Dumazet <[email protected]>
ipv6: remove hard coded limitation on ipv6_pinfo
Andrea Righi <[email protected]>
module/decompress: use vmalloc() for zstd decompression workspace
James Morse <[email protected]>
ARM: module: Use module_init_layout_section() to spot init sections
James Morse <[email protected]>
arm64: module: Use module_init_layout_section() to spot init sections
James Morse <[email protected]>
module: Expose module_init_layout_section()
Mario Limonciello <[email protected]>
ACPI: thermal: Drop nocrt parameter
-------------
Diffstat:
Documentation/admin-guide/kernel-parameters.txt | 4 --- Makefile | 4 +-- arch/arm/kernel/module-plts.c | 2 +- arch/arm64/kernel/module-plts.c | 2 +- arch/x86/include/asm/sections.h | 18 ------------- drivers/acpi/thermal.c | 6 +---- include/linux/ipv6.h | 15 +++-------- include/linux/moduleloader.h | 5 ++++ include/net/sock.h | 1 + kernel/kallsyms.c | 17 +++++------- kernel/kallsyms_selftest.c | 23 +--------------- kernel/locking/lockdep.c | 36 ++++++++++--------------- kernel/module/decompress.c | 4 +-- kernel/module/main.c | 2 +- net/dccp/ipv6.c | 1 + net/dccp/ipv6.h | 4 --- net/ipv6/af_inet6.c | 4 +-- net/ipv6/ping.c | 1 + net/ipv6/raw.c | 1 + net/ipv6/tcp_ipv6.c | 1 + net/ipv6/udp.c | 1 + net/ipv6/udplite.c | 1 + net/l2tp/l2tp_ip6.c | 4 +-- net/mptcp/protocol.c | 1 + net/sctp/socket.c | 1 + 25 files changed, 51 insertions(+), 108 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 8/8 kallsyms: Fix kallsyms_selftest failure
6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
commit 33f0467fe06934d5e4ea6e24ce2b9c65ce618e26 upstream.
Kernel test robot reported a kallsyms_test failure when clang lto is enabled (thin or full) and CONFIG_KALLSYMS_SELFTEST is also enabled. I can reproduce in my local environment with the following error message with thin lto:
[ 1.877897] kallsyms_selftest: Test for 1750th symbol failed: (tsc_cs_mark_unstable) addr=ffffffff81038090 [ 1.877901] kallsyms_selftest: abort
It appears that commit 8cc32a9bbf29 ("kallsyms: strip LTO-only suffixes from promoted global functions") caused the failure. Commit 8cc32a9bbf29 changed cleanup_symbol_name() based on ".llvm." instead of '.' where ".llvm." is appended to a before-lto-optimization local symbol name. We need to propagate such knowledge in kallsyms_selftest.c as well.
Further more, compare_symbol_name() in kallsyms.c needs change as well. In scripts/kallsyms.c, kallsyms_names and kallsyms_seqs_of_names are used to record symbol names themselves and index to symbol names respectively. For example:
kallsyms_names:
...
__amd_smn_rw._entry <== seq 1000
__amd_smn_rw._entry.5 <== seq 1001
__amd_smn_rw.llvm.<hash> <== seq 1002
...kallsyms_seqs_of_names are sorted based on cleanup_symbol_name() through, so the order in kallsyms_seqs_of_names actually has
index 1000: seq 1002 <== __amd_smn_rw.llvm.<hash> (actual symbol comparison using '__amd_smn_rw') index 1001: seq 1000 <== __amd_smn_rw._entry index 1002: seq 1001 <== __amd_smn_rw._entry.5
Let us say at a particular point, at index 1000, symbol '__amd_smn_rw.llvm.<hash>' is comparing to '__amd_smn_rw._entry' where '__amd_smn_rw._entry' is the one to search e.g., with function kallsyms_on_each_match_symbol(). The current implementation will find out '__amd_smn_rw._entry' is less than '__amd_smn_rw.llvm.<hash>' and then continue to search e.g., index 999 and never found a match although the actual index 1001 is a match.
To fix this issue, let us do cleanup_symbol_name() first and then do comparison. In the above case, comparing '__amd_smn_rw' vs '__amd_smn_rw._entry' and '__amd_smn_rw._entry' being greater than '__amd_smn_rw', the next comparison will be > index 1000 and eventually index 1001 will be hit an a match is found.
For any symbols not having '.llvm.' substr, there is no functionality change for compare_symbol_name().
--- kernel/kallsyms.c | 17 +++++++---------- kernel/kallsyms_selftest.c | 23 +---------------------- 2 files changed, 8 insertions(+), 32 deletions(-)
kernel/kallsyms.c +7 -10
@@ -188,16 +188,13 @@ static bool cleanup_symbol_name(char *s)static int compare_symbol_name (const char *name,char *namebuf) { -int ret; - - ret =strcmp (name, namebuf); -if (!ret) -return ret; - -if (cleanup_symbol_name (namebuf) && !strcmp (name, namebuf)) -return 0 ; - -return ret; +/* The kallsyms_seqs_of_names is sorted based on names after +* cleanup_symbol_name() (see scripts/kallsyms.c) if clang lto is enabled. +* To ensure correct bisection in kallsyms_lookup_names(), do +* cleanup_symbol_name(namebuf) before comparing name and namebuf. +*/ +cleanup_symbol_name (namebuf); +return strcmp (name, namebuf); }static unsigned int get_symbol_seq (int index)
kernel/kallsyms_selftest.c +1 -22
@@ -196,7 +196,7 @@ static bool match_cleanup_name(const chaif (!IS_ENABLED (CONFIG_LTO_CLANG ))return false; - p =strchr (s,'.' ); + p =strstr (s,".llvm." );if (!p)return false;
@@ -344,27 +344,6 @@ static int test_kallsyms_basic_function( goto failed; } -/* -* The first '.' may be the initial letter, in which case the -* entire symbol name will be truncated to an empty string in -* cleanup_symbol_name(). Do not test these symbols. -* -* For example: -* cat /proc/kallsyms | awk '{print $3}' | grep -E "^\." | head -* .E_read_words -* .E_leading_bytes -* .E_trailing_bytes -* .E_write_words -* .E_copy -* .str.292.llvm.12122243386960820698 -* .str.24.llvm.12122243386960820698 -* .str.29.llvm.12122243386960820698 -* .str.75.llvm.12122243386960820698 -* .str.99.llvm.12122243386960820698 -*/ -if (IS_ENABLED (CONFIG_LTO_CLANG ) && !namebuf[0 ]) -continue ; - lookup_addr =kallsyms_lookup_name (namebuf);memset (stat,0 ,sizeof (*stat));
Greg Kroah-Hartman
maintainerPATCH 7/8 lockdep: fix static memory detection even more
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 0a6b58c5cd0dfd7961e725212f0fc8dfc5d96195 upstream.
On the parisc architecture, lockdep reports for all static objects which are in the __initdata section (e.g. "setup_done" in devtmpfs, "kthreadd_done" in init/main.c) this warning:
INFO: trying to register non-static key.
The warning itself is wrong, because those objects are in the __initdata section, but the section itself is on parisc outside of range from _stext to _end, which is why the static_obj() functions returns a wrong answer.
While fixing this issue, I noticed that the whole existing check can be simplified a lot.
Instead of checking against the _stext and _end symbols (which include code areas too) just check for the .data and .bss segments (since we check a data object). This can be done with the existing is_kernel_core_data() macro.
In addition objects in the __initdata section can be checked with init_section_contains(), and is_kernel_rodata() allows keys to be in the _ro_after_init section.
This partly reverts and simplifies commit bac59d18c701 ("x86/setup: Fix static memory detection").
--- arch/x86/include/asm/sections.h | 18 ------------------ kernel/locking/lockdep.c | 36 ++++++++++++++---------------------- 2 files changed, 14 insertions(+), 40 deletions(-)
arch/x86/include/asm/sections.h +0 -18
@@ -2,8 +2,6 @@#ifndef _ASM_X86_SECTIONS_H#define _ASM_X86_SECTIONS_H -#define arch_is_kernel_initmem_freed arch_is_kernel_initmem_freed -#include <asm-generic/sections.h> #include <asm/extable.h>
@@ -18,20 +16,4 @@ extern char __end_of_kernel_reserve[];extern unsigned long _brk_start, _brk_end; -static inline bool arch_is_kernel_initmem_freed (unsigned long addr) -{ -/* -* If _brk_start has not been cleared, brk allocation is incomplete, -* and we can not make assumptions about its use. -*/ -if (_brk_start) -return 0 ; - -/* -* After brk allocation is complete, space between _brk_end and _end -* is available for allocation. -*/ -return addr >= _brk_end && addr < (unsigned long )&_end; -} -#endif /* _ASM_X86_SECTIONS_H */
kernel/locking/lockdep.c +14 -22
@@ -819,34 +819,26 @@ static int very_verbose(struct lock_clas* Is this the address of a static object: */ #ifdef __KERNEL__ -/* -* Check if an address is part of freed initmem. After initmem is freed, -* memory can be allocated from it, and such allocations would then have -* addresses within the range [_stext, _end]. -*/ -#ifndef arch_is_kernel_initmem_freed -static int arch_is_kernel_initmem_freed (unsigned long addr) -{ -if (system_state <SYSTEM_FREEING_INITMEM ) -return 0 ; - -return init_section_contains ((void *)addr,1 ); -} -#endif -static int static_obj (const void *obj) { -unsigned long start = (unsigned long ) &_stext, - end = (unsigned long ) &_end, - addr = (unsigned long ) obj; +unsigned long addr = (unsigned long ) obj; -if (arch_is_kernel_initmem_freed (addr)) -return 0 ; +if (is_kernel_core_data (addr)) +return 1 ; + +/* +* keys are allowed in the __ro_after_init section. +*/ +if (is_kernel_rodata (addr)) +return 1 ;/* -* static variable? +* in initdata section and used during bootup only? +* NOTE: On some platforms the initdata section is +* outside of the _stext ... _end range. */ -if ((addr >= start) && (addr < end)) +if (system_state <SYSTEM_FREEING_INITMEM && +init_section_contains ((void *)addr,1 ))return 1 ;/*
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.1 release. There are 8 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 02 Sep 2023 11:08:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.1 release. There are 8 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Successfully compiled and installed bindeb-pkgs on my computer (Acer Aspire E15, Intel Core i3 Haswell). No noticeable regressions.
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.1 release. There are 8 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 02 Sep 2023 11:08:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.1 release. There are 8 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 02 Sep 2023 11:08:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 6.5.1-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-6.5.y
* git commit: c2d4e2d6c14c0bff3286f251b99c8e443a586047
* git describe: v6.5-9-gc2d4e2d6c14c
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.5.y/build/v6.5-9-gc2d4e2d6c14c/
## Test Regressions (compared to v6.5.0)
## Metric Regressions (compared to v6.5.0)
## Test Fixes (compared to v6.5.0)
## Metric Fixes (compared to v6.5.0)
## Test result summary
total: 207754, pass: 181885, fail: 1701, skip: 24168
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 140 total, 138 passed, 2 failed
* arm64: 52 total, 49 passed, 3 failed
* i386: 39 total, 33 passed, 6 failed
* mips: 29 total, 27 passed, 2 failed
* parisc: 4 total, 4 passed, 0 failed
* powerpc: 36 total, 34 passed, 2 failed
* riscv: 24 total, 21 passed, 3 failed
* s390: 16 total, 14 passed, 2 failed
* sh: 14 total, 12 passed, 2 failed
* sparc: 8 total, 8 passed, 0 failed
* x86_64: 45 total, 40 passed, 5 failed
## Test suites summary
* boot
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-user_events
* kselftest-vDSO
* kselftest-vm
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* perf
* rcutorture
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.1 release. There are 8 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 02 Sep 2023 11:08:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.1 release. There are 8 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 02 Sep 2023 11:08:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.5.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.5.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.5:
11 builds: 11 pass, 0 fail
28 boots: 28 pass, 0 fail
130 tests: 130 pass, 0 failLinux version: 6.5.1-rc1-gc2d4e2d6c14c
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.5.1 release. There are 8 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 02 Sep 2023 11:08:22 +0000. Anything received after that time might be too late.
Build results:
total: 157 pass: 157 fail: 0 Qemu test results: total: 522 pass: 522 fail: 0
Guenter