Skip to content

Commit bd58782

Browse files
leitaoakpm00
authored andcommitted
vmcoreinfo: make hwerr_data visible for debugging
If the kernel is compiled with LTO, hwerr_data symbol might be lost, and vmcoreinfo doesn't have it dumped. This is currently seen in some production kernels with LTO enabled. Remove the static qualifier from hwerr_data so that the information is still preserved when the kernel is built with LTO. Making hwerr_data a global symbol ensures its debug info survives the LTO link process and appears in kallsyms. Also document it, so it doesn't get removed in the future as suggested by akpm. Link: https://lkml.kernel.org/r/20260122-fix_vmcoreinfo-v2-1-2d6311f9e36c@debian.org Fixes: 3fa805c ("vmcoreinfo: track and log recoverable hardware errors") Signed-off-by: Breno Leitao <leitao@debian.org> Acked-by: Baoquan He <bhe@redhat.com> Cc: Dave Young <dyoung@redhat.com> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Omar Sandoval <osandov@osandov.com> Cc: Shuai Xue <xueshuai@linux.alibaba.com> Cc: Vivek Goyal <vgoyal@redhat.com> Cc: Zhiquan Li <zhiquan1.li@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 12b2285 commit bd58782

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

kernel/vmcore_info.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ struct hwerr_info {
3636
time64_t timestamp;
3737
};
3838

39-
static struct hwerr_info hwerr_data[HWERR_RECOV_MAX];
39+
/*
40+
* The hwerr_data[] array is declared with global scope so that it remains
41+
* accessible to vmcoreinfo even when Link Time Optimization (LTO) is enabled.
42+
*/
43+
struct hwerr_info hwerr_data[HWERR_RECOV_MAX];
4044

4145
Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
4246
void *data, size_t data_len)

0 commit comments

Comments
 (0)