When the kdump service is loaded, if a CPU or memory is hot
un/plugged, the crash elfcorehdr, which describes the CPUs
and memory in the system, must also be updated, else the resulting
vmcore is inaccurate (eg. missing either CPU context or memory
regions).
The current solution utilizes udev to initiate an unload-then-reload
of the kdump image (e. kernel, initrd, boot_params, puratory and
elfcorehdr) by the userspace kexec utility. In previous posts I have
outlined the significant performance problems related to offloading
this activity to userspace.
This patchset introduces a generic crash hot un/plug handler that
registers with the CPU and memory notifiers. Upon CPU or memory
changes, this generic handler is invoked and performs important
housekeeping, for example obtaining the appropriate lock, and then
invokes an architecture specific handler to do the appropriate
updates.
In the case of x86_64, the arch specific handler generates a new
elfcorehdr, and overwrites the old one in memory. No involvement
with userspace needed.
To realize the benefits/test this patchset, one must make a couple
of minor changes to userspace:
- Prevent udev from updating kdump crash kernel on hot un/plug changes.
Add the following as the first lines to the udev rule file
/usr/lib/udev/rules.d/98-kexec.rules:
# The kernel handles updates to crash elfcorehdr for cpu and memory changes
SUBSYSTEM=="cpu", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
SUBSYSTEM=="memory", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
These lines will cause cpu and memory hot un/plug events to be
skipped within this rule file, if the kernel has these changes
enabled.
- Change to the kexec_file_load for loading the kdump kernel:
Eg. on RHEL: in /usr/bin/kdumpctl, change to:
standard_kexec_args="-p -d -s"
which adds the -s to select kexec_file_load syscall.
This patchset supports kexec_load with a modified kexec userspace
utility, and a working changeset to the kexec userspace utility
is provided here (and to use, the above change to standard_kexec_args
would be, for example, to append --hotplug instead of -s).
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 9826f6d..4ed395a 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -48,6 +48,7 @@
#include <x86/x86-linux.h>
extern struct arch_options_t arch_options;
+extern int do_hotplug;
static int get_kernel_page_offset(struct kexec_info *UNUSED(info),
struct crash_elf_info *elf_info)
@@ -975,6 +976,14 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
} else {
memsz = bufsz;
}
+
+ /* If hotplug support enabled, use larger size to accomodate changes */
+ if (do_hotplug) {
+ long int nr_cpus = get_nr_cpus();
+ memsz = (nr_cpus + CRASH_MAX_MEMORY_RANGES) * sizeof(Elf64_Phdr);
+ }
+
+ info->elfcorehdr =
elfcorehdr = add_buffer(info, tmp, bufsz, memsz, align, min_base,
max_addr, -1);
dbgprintf("Created elf header segment at 0x%lx\n", elfcorehdr);
diff --git a/kexec/crashdump-elf.c b/kexec/crashdump-elf.c
index b8bb686..5e29f7a 100644
--- a/kexec/crashdump-elf.c
+++ b/kexec/crashdump-elf.c
@@ -43,11 +43,7 @@ int FUNC(struct kexec_info *info,
int (*get_note_info)(int cpu, uint64_t *addr, uint64_t *len);
long int count_cpu;
- if (xen_present())
- nr_cpus = xen_get_nr_phys_cpus();
- else
- nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
-
+ nr_cpus = get_nr_cpus();
if (nr_cpus < 0) {
return -1;
}
diff --git a/kexec/crashdump.h b/kexec/crashdump.h
index 18bd691..28d3278 100644
--- a/kexec/crashdump.h
+++ b/kexec/crashdump.h
@@ -57,7 +57,6 @@ unsigned long phys_to_virt(struct crash_elf_info *elf_info,
unsigned long long paddr);
unsigned long xen_architecture(struct crash_elf_info *elf_info);
-int xen_get_nr_phys_cpus(void);
int xen_get_note(int cpu, uint64_t *addr, uint64_t *len);
int xen_get_crashkernel_region(uint64_t *start, uint64_t *end);
diff --git a/kexec/kexec-xen.h b/kexec/kexec-xen.h
index 70fb576..f54a2dd 100644
--- a/kexec/kexec-xen.h
+++ b/kexec/kexec-xen.h
@@ -83,5 +83,6 @@ extern int __xc_interface_close(xc_interface *xch);
#endif
int xen_get_kexec_range(int range, uint64_t *start, uint64_t *end);
+int xen_get_nr_phys_cpus(void);
#endif /* KEXEC_XEN_H */
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 829a6ea..3668b73 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -58,6 +58,7 @@
unsigned long long mem_min = 0;
unsigned long long mem_max = ULONG_MAX;
+int do_hotplug = 0;
static unsigned long kexec_flags = 0;
/* Flags for kexec file (fd) based syscall */
static unsigned long kexec_file_flags = 0;
@@ -489,6 +490,17 @@ static int add_backup_segments(struct kexec_info *info,
return 0;
}
+long int get_nr_cpus(void)
+{
+ long int nr_cpus;
+
+ if (xen_present())
+ nr_cpus = xen_get_nr_phys_cpus();
+ else
+ nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
+ return nr_cpus;
+}
+
static char *slurp_fd(int fd, const char *filename, off_t size, off_t *nread)
{
char *buf;
@@ -672,6 +684,14 @@ static void update_purgatory(struct kexec_info *info)
if (info->segment[i].mem == (void *)info->rhdr.rel_addr) {
continue;
}
+
+ /* Don't include elfcorehdr in the checksum, if hotplug
+ * support enabled.
+ */
+ if (do_hotplug && (info->segment[i].mem == (void *)info->elfcorehdr)) {
+ continue;
+ }
+
sha256_update(&ctx, info->segment[i].buf,
info->segment[i].bufsz);
nullsz = info->segment[i].memsz - info->segment[i].bufsz;
@@ -1565,6 +1585,9 @@ int main(int argc, char *argv[])
case OPT_PRINT_CKR_SIZE:
print_crashkernel_region_size();
return 0;
+ case OPT_HOTPLUG:
+ do_hotplug = 1;
+ break;
default:
break;
}
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 0f97a97..b0428cc 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -169,6 +169,7 @@ struct kexec_info {
int command_line_len;
int skip_checks;
+ unsigned long elfcorehdr;
};
struct arch_map_entry {
@@ -231,7 +232,8 @@ extern int file_types;
#define OPT_PRINT_CKR_SIZE 262
#define OPT_LOAD_LIVE_UPDATE 263
#define OPT_EXEC_LIVE_UPDATE 264
-#define OPT_MAX 265
+#define OPT_HOTPLUG 265
+#define OPT_MAX 266
#define KEXEC_OPTIONS \
{ "help", 0, 0, OPT_HELP }, \
{ "version", 0, 0, OPT_VERSION }, \
@@ -258,6 +260,7 @@ extern int file_types;
{ "debug", 0, 0, OPT_DEBUG }, \
{ "status", 0, 0, OPT_STATUS }, \
{ "print-ckr-size", 0, 0, OPT_PRINT_CKR_SIZE }, \
+ { "hotplug", 0, 0, OPT_HOTPLUG }, \
#define KEXEC_OPT_STR "h?vdfixyluet:pscaS"
@@ -290,6 +293,8 @@ extern unsigned long add_buffer_phys_virt(struct kexec_info *info,
int buf_end, int phys);
extern void arch_reuse_initrd(void);
+extern long int get_nr_cpus(void);
+
extern int ifdown(void);
extern char purgatory[];
Regards,
eric
---
v11: 26aug2022
- Rebased onto 6.0-rc2
- Redid the rework of __weak to use asm/kexec.h, per Baoquan
- Reworked some comments and minor items, per Baoquan
v10: 21jul2022
https://lkml.org/lkml/2022/7/21/1007
- Rebased to 5.19.0-rc7
- Per Sourabh, corrected build issue with arch_un/map_crash_pages()
for architectures not supporting this feature.
- Per David Hildebrand, removed the WARN_ONCE() altogether.
- Per David Hansen, converted to use of kmap_local_page().
- Per Baoquan He, replaced use of __weak with the kexec technique.
v9: 13jun2022
https://lkml.org/lkml/2022/6/13/3382
- Rebased to 5.18.0
- Per Sourabh, moved crash_prepare_elf64_headers() into common
crash_core.c to avoid compile issues with kexec_load only path.
- Per David Hildebrand, replaced mutex_trylock() with mutex_lock().
- Changed the __weak arch_crash_handle_hotplug_event() to utilize
WARN_ONCE() instead of WARN(). Fix some formatting issues.
- Per Sourabh, introduced sysfs attribute crash_hotplug for memory
and CPUs; for use by userspace (udev) to determine if the kernel
performs crash hot un/plug support.
- Per Sourabh, moved the code detecting the elfcorehdr segment from
arch/x86 into crash_core:handle_hotplug_event() so both kexec_load
and kexec_file_load can benefit.
- Updated userspace kexec-tools kexec utility to reflect change to
using CRASH_MAX_MEMORY_RANGES and get_nr_cpus().
- Updated the new proposed udev rules to reflect using the sysfs
attributes crash_hotplug.
v8: 5may2022
https://lkml.org/lkml/2022/5/5/1133
- Per Borislav Petkov, eliminated CONFIG_CRASH_HOTPLUG in favor
of CONFIG_HOTPLUG_CPU || CONFIG_MEMORY_HOTPLUG, ie a new define
is not needed. Also use of IS_ENABLED() rather than #ifdef's.
Renamed crash_hotplug_handler() to handle_hotplug_event().
And other corrections.
- Per Baoquan, minimized the parameters to the arch_crash_
handle_hotplug_event() to hp_action and cpu.
- Introduce KEXEC_CRASH_HP_INVALID_CPU definition, per Baoquan.
- Per Sourabh Jain, renamed and repurposed CRASH_HOTPLUG_ELFCOREHDR_SZ
to CONFIG_CRASH_MAX_MEMORY_RANGES, mirroring kexec-tools change
by David Hildebrand. Folded this patch into the x86
kexec_file_load support patch.
v7: 13apr2022
https://lkml.org/lkml/2022/4/13/850
- Resolved parameter usage to crash_hotplug_handler(), per Baoquan.
v6: 1apr2022
https://lkml.org/lkml/2022/4/1/1203
- Reword commit messages and some comment cleanup per Baoquan.
- Changed elf_index to elfcorehdr_index for clarity.
- Minor code changes per Baoquan.
v5: 3mar2022
https://lkml.org/lkml/2022/3/3/674
- Reworded description of CRASH_HOTPLUG_ELFCOREHDR_SZ, per
David Hildenbrand.
- Refactored slightly a few patches per Baoquan recommendation.
v4: 9feb2022
https://lkml.org/lkml/2022/2/9/1406
- Refactored patches per Baoquan suggestsions.
- A few corrections, per Baoquan.
v3: 10jan2022
https://lkml.org/lkml/2022/1/10/1212
- Rebasing per Baoquan He request.
- Changed memory notifier per David Hildenbrand.
- Providing example kexec userspace change in cover letter.
RFC v2: 7dec2021
https://lkml.org/lkml/2021/12/7/1088
- Acting upon Baoquan He suggestion of removing elfcorehdr from
the purgatory list of segments, removed purgatory code from
patchset, and it is signficiantly simpler now.
RFC v1: 18nov2021
https://lkml.org/lkml/2021/11/18/845
- working patchset demonstrating kernel handling of hotplug
updates to x86 elfcorehdr for kexec_file_load
RFC: 14dec2020
https://lkml.org/lkml/2020/12/14/532
- proposed concept of allowing kernel to handle hotplug update
of elfcorehdr
---
Eric DeVolder (7):
crash: move crash_prepare_elf64_headers
crash: prototype change for crash_prepare_elf64_headers
crash: add generic infrastructure for crash hotplug support
kexec: exclude elfcorehdr from the segment digest
kexec: exclude hot remove cpu from elfcorehdr notes
crash: memory and cpu hotplug sysfs attributes
x86/crash: Add x86 crash hotplug support
.../admin-guide/mm/memory-hotplug.rst | 8 +
Documentation/core-api/cpu_hotplug.rst | 18 ++
arch/arm64/kernel/machine_kexec_file.c | 6 +-
arch/powerpc/kexec/file_load_64.c | 2 +-
arch/riscv/kernel/elf_kexec.c | 7 +-
arch/x86/Kconfig | 11 +
arch/x86/include/asm/kexec.h | 20 ++
arch/x86/kernel/crash.c | 104 +++++++-
drivers/base/cpu.c | 14 +
drivers/base/memory.c | 13 +
include/linux/crash_core.h | 8 +
include/linux/kexec.h | 41 ++-
kernel/crash_core.c | 249 ++++++++++++++++++
kernel/kexec_file.c | 105 +-------
14 files changed, 497 insertions(+), 109 deletions(-)
--
2.31.1
At the outcome of this patch set, the crash_prepare_elf64_headers()
is utilized on both the kexec_file_load and kexec_load paths. As
such, need to move this function out of kexec_file.c and into a
common location crash_core.c.
No functionality change.
Signed-off-by: Eric DeVolder <[email protected]>
---
kernel/crash_core.c | 100 ++++++++++++++++++++++++++++++++++++++++++++
kernel/kexec_file.c | 99 -------------------------------------------
2 files changed, 100 insertions(+), 99 deletions(-)
diff --git a/kernel/crash_core.c b/kernel/crash_core.c
index 07b26df453a9..8c8c82386e8d 100644
--- a/kernel/crash_core.c
+++ b/kernel/crash_core.c
@@ -10,6 +10,7 @@
#include <linux/utsname.h>
#include <linux/vmalloc.h>
#include <linux/sizes.h>
+#include <linux/kexec.h>
#include <asm/page.h>
#include <asm/sections.h>
@@ -314,6 +315,105 @@ static int __init parse_crashkernel_dummy(char *arg)
}
early_param("crashkernel", parse_crashkernel_dummy);
+int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
+ void **addr, unsigned long *sz)
+{
+ Elf64_Ehdr *ehdr;
+ Elf64_Phdr *phdr;
+ unsigned long nr_cpus = num_possible_cpus(), nr_phdr, elf_sz;
+ unsigned char *buf;
+ unsigned int cpu, i;
+ unsigned long long notes_addr;
+ unsigned long mstart, mend;
+
+ /* extra phdr for vmcoreinfo ELF note */
+ nr_phdr = nr_cpus + 1;
+ nr_phdr += mem->nr_ranges;
+
+ /*
+ * kexec-tools creates an extra PT_LOAD phdr for kernel text mapping
+ * area (for example, ffffffff80000000 - ffffffffa0000000 on x86_64).
+ * I think this is required by tools like gdb. So same physical
+ * memory will be mapped in two ELF headers. One will contain kernel
+ * text virtual addresses and other will have __va(physical) addresses.
+ */
+
+ nr_phdr++;
+ elf_sz = sizeof(Elf64_Ehdr) + nr_phdr * sizeof(Elf64_Phdr);
+ elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
+
+ buf = vzalloc(elf_sz);
+ if (!buf)
+ return -ENOMEM;
+
+ ehdr = (Elf64_Ehdr *)buf;
+ phdr = (Elf64_Phdr *)(ehdr + 1);
+ memcpy(ehdr->e_ident, ELFMAG, SELFMAG);
+ ehdr->e_ident[EI_CLASS] = ELFCLASS64;
+ ehdr->e_ident[EI_DATA] = ELFDATA2LSB;
+ ehdr->e_ident[EI_VERSION] = EV_CURRENT;
+ ehdr->e_ident[EI_OSABI] = ELF_OSABI;
+ memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD);
+ ehdr->e_type = ET_CORE;
+ ehdr->e_machine = ELF_ARCH;
+ ehdr->e_version = EV_CURRENT;
+ ehdr->e_phoff = sizeof(Elf64_Ehdr);
+ ehdr->e_ehsize = sizeof(Elf64_Ehdr);
+ ehdr->e_phentsize = sizeof(Elf64_Phdr);
+
+ /* Prepare one phdr of type PT_NOTE for each present CPU */
+ for_each_present_cpu(cpu) {
+ phdr->p_type = PT_NOTE;
+ notes_addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpu));
+ phdr->p_offset = phdr->p_paddr = notes_addr;
+ phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t);
+ (ehdr->e_phnum)++;
+ phdr++;
+ }
+
+ /* Prepare one PT_NOTE header for vmcoreinfo */
+ phdr->p_type = PT_NOTE;
+ phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note();
+ phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE;
+ (ehdr->e_phnum)++;
+ phdr++;
+
+ /* Prepare PT_LOAD type program header for kernel text region */
+ if (need_kernel_map) {
+ phdr->p_type = PT_LOAD;
+ phdr->p_flags = PF_R|PF_W|PF_X;
+ phdr->p_vaddr = (unsigned long) _text;
+ phdr->p_filesz = phdr->p_memsz = _end - _text;
+ phdr->p_offset = phdr->p_paddr = __pa_symbol(_text);
+ ehdr->e_phnum++;
+ phdr++;
+ }
+
+ /* Go through all the ranges in mem->ranges[] and prepare phdr */
+ for (i = 0; i < mem->nr_ranges; i++) {
+ mstart = mem->ranges[i].start;
+ mend = mem->ranges[i].end;
+
+ phdr->p_type = PT_LOAD;
+ phdr->p_flags = PF_R|PF_W|PF_X;
+ phdr->p_offset = mstart;
+
+ phdr->p_paddr = mstart;
+ phdr->p_vaddr = (unsigned long) __va(mstart);
+ phdr->p_filesz = phdr->p_memsz = mend - mstart + 1;
+ phdr->p_align = 0;
+ ehdr->e_phnum++;
+ pr_debug("Crash PT_LOAD ELF header. phdr=%p vaddr=0x%llx, paddr=0x%llx, sz=0x%llx e_phnum=%d p_offset=0x%llx\n",
+ phdr, phdr->p_vaddr, phdr->p_paddr, phdr->p_filesz,
+ ehdr->e_phnum, phdr->p_offset);
+ phdr++;
+ }
+
+ *addr = buf;
+ *sz = elf_sz;
+ return 0;
+}
+
Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
void *data, size_t data_len)
{
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 1d546dc97c50..8017eeb43036 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -1217,102 +1217,3 @@ int crash_exclude_mem_range(struct crash_mem *mem,
mem->nr_ranges++;
return 0;
}
-
-int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
- void **addr, unsigned long *sz)
-{
- Elf64_Ehdr *ehdr;
- Elf64_Phdr *phdr;
- unsigned long nr_cpus = num_possible_cpus(), nr_phdr, elf_sz;
- unsigned char *buf;
- unsigned int cpu, i;
- unsigned long long notes_addr;
- unsigned long mstart, mend;
-
- /* extra phdr for vmcoreinfo ELF note */
- nr_phdr = nr_cpus + 1;
- nr_phdr += mem->nr_ranges;
-
- /*
- * kexec-tools creates an extra PT_LOAD phdr for kernel text mapping
- * area (for example, ffffffff80000000 - ffffffffa0000000 on x86_64).
- * I think this is required by tools like gdb. So same physical
- * memory will be mapped in two ELF headers. One will contain kernel
- * text virtual addresses and other will have __va(physical) addresses.
- */
-
- nr_phdr++;
- elf_sz = sizeof(Elf64_Ehdr) + nr_phdr * sizeof(Elf64_Phdr);
- elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
-
- buf = vzalloc(elf_sz);
- if (!buf)
- return -ENOMEM;
-
- ehdr = (Elf64_Ehdr *)buf;
- phdr = (Elf64_Phdr *)(ehdr + 1);
- memcpy(ehdr->e_ident, ELFMAG, SELFMAG);
- ehdr->e_ident[EI_CLASS] = ELFCLASS64;
- ehdr->e_ident[EI_DATA] = ELFDATA2LSB;
- ehdr->e_ident[EI_VERSION] = EV_CURRENT;
- ehdr->e_ident[EI_OSABI] = ELF_OSABI;
- memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD);
- ehdr->e_type = ET_CORE;
- ehdr->e_machine = ELF_ARCH;
- ehdr->e_version = EV_CURRENT;
- ehdr->e_phoff = sizeof(Elf64_Ehdr);
- ehdr->e_ehsize = sizeof(Elf64_Ehdr);
- ehdr->e_phentsize = sizeof(Elf64_Phdr);
-
- /* Prepare one phdr of type PT_NOTE for each present CPU */
- for_each_present_cpu(cpu) {
- phdr->p_type = PT_NOTE;
- notes_addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpu));
- phdr->p_offset = phdr->p_paddr = notes_addr;
- phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t);
- (ehdr->e_phnum)++;
- phdr++;
- }
-
- /* Prepare one PT_NOTE header for vmcoreinfo */
- phdr->p_type = PT_NOTE;
- phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note();
- phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE;
- (ehdr->e_phnum)++;
- phdr++;
-
- /* Prepare PT_LOAD type program header for kernel text region */
- if (need_kernel_map) {
- phdr->p_type = PT_LOAD;
- phdr->p_flags = PF_R|PF_W|PF_X;
- phdr->p_vaddr = (unsigned long) _text;
- phdr->p_filesz = phdr->p_memsz = _end - _text;
- phdr->p_offset = phdr->p_paddr = __pa_symbol(_text);
- ehdr->e_phnum++;
- phdr++;
- }
-
- /* Go through all the ranges in mem->ranges[] and prepare phdr */
- for (i = 0; i < mem->nr_ranges; i++) {
- mstart = mem->ranges[i].start;
- mend = mem->ranges[i].end;
-
- phdr->p_type = PT_LOAD;
- phdr->p_flags = PF_R|PF_W|PF_X;
- phdr->p_offset = mstart;
-
- phdr->p_paddr = mstart;
- phdr->p_vaddr = (unsigned long) __va(mstart);
- phdr->p_filesz = phdr->p_memsz = mend - mstart + 1;
- phdr->p_align = 0;
- ehdr->e_phnum++;
- pr_debug("Crash PT_LOAD ELF header. phdr=%p vaddr=0x%llx, paddr=0x%llx, sz=0x%llx e_phnum=%d p_offset=0x%llx\n",
- phdr, phdr->p_vaddr, phdr->p_paddr, phdr->p_filesz,
- ehdr->e_phnum, phdr->p_offset);
- phdr++;
- }
-
- *addr = buf;
- *sz = elf_sz;
- return 0;
-}
--
2.31.1
When a crash kernel is loaded via the kexec_file_load syscall, the
kernel places the various segments (ie crash kernel, crash initrd,
boot_params, elfcorehdr, purgatory, etc) in memory. For those
architectures that utilize purgatory, a hash digest of the segments
is calculated for integrity checking. This digest is embedded into
the purgatory image prior to placing purgatory in memory.
Since hotplug events cause changes to the elfcorehdr, purgatory
integrity checking fails (at crash time, and no kdump created).
As a result, this change explicitly excludes the elfcorehdr segment
from the list of segments used to create the digest. By doing so,
this permits changes to the elfcorehdr in response to hotplug events,
without having to also reload purgatory due to the change to the
digest.
Signed-off-by: Eric DeVolder <[email protected]>
Acked-by: Baoquan He <[email protected]>
---
kernel/kexec_file.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 8017eeb43036..d0c2661b3509 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -723,6 +723,12 @@ static int kexec_calculate_store_digests(struct kimage *image)
for (j = i = 0; i < image->nr_segments; i++) {
struct kexec_segment *ksegment;
+#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_MEMORY_HOTPLUG)
+ /* Exclude elfcorehdr segment to allow future changes via hotplug */
+ if (image->elfcorehdr_index_valid && (j == image->elfcorehdr_index))
+ continue;
+#endif
+
ksegment = &image->segment[i];
/*
* Skip purgatory as it will be modified once we put digest
--
2.31.1
On 08/26/22 at 01:36pm, Eric DeVolder wrote:
> At the outcome of this patch set, the crash_prepare_elf64_headers()
> is utilized on both the kexec_file_load and kexec_load paths. As
> such, need to move this function out of kexec_file.c and into a
> common location crash_core.c.
>
> No functionality change.
>
> Signed-off-by: Eric DeVolder <[email protected]>
LGTM,
Baoquan He <[email protected]>
> ---
> kernel/crash_core.c | 100 ++++++++++++++++++++++++++++++++++++++++++++
> kernel/kexec_file.c | 99 -------------------------------------------
> 2 files changed, 100 insertions(+), 99 deletions(-)
>
> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> index 07b26df453a9..8c8c82386e8d 100644
> --- a/kernel/crash_core.c
> +++ b/kernel/crash_core.c
> @@ -10,6 +10,7 @@
> #include <linux/utsname.h>
> #include <linux/vmalloc.h>
> #include <linux/sizes.h>
> +#include <linux/kexec.h>
>
> #include <asm/page.h>
> #include <asm/sections.h>
> @@ -314,6 +315,105 @@ static int __init parse_crashkernel_dummy(char *arg)
> }
> early_param("crashkernel", parse_crashkernel_dummy);
>
> +int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
> + void **addr, unsigned long *sz)
> +{
> + Elf64_Ehdr *ehdr;
> + Elf64_Phdr *phdr;
> + unsigned long nr_cpus = num_possible_cpus(), nr_phdr, elf_sz;
> + unsigned char *buf;
> + unsigned int cpu, i;
> + unsigned long long notes_addr;
> + unsigned long mstart, mend;
> +
> + /* extra phdr for vmcoreinfo ELF note */
> + nr_phdr = nr_cpus + 1;
> + nr_phdr += mem->nr_ranges;
> +
> + /*
> + * kexec-tools creates an extra PT_LOAD phdr for kernel text mapping
> + * area (for example, ffffffff80000000 - ffffffffa0000000 on x86_64).
> + * I think this is required by tools like gdb. So same physical
> + * memory will be mapped in two ELF headers. One will contain kernel
> + * text virtual addresses and other will have __va(physical) addresses.
> + */
> +
> + nr_phdr++;
> + elf_sz = sizeof(Elf64_Ehdr) + nr_phdr * sizeof(Elf64_Phdr);
> + elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
> +
> + buf = vzalloc(elf_sz);
> + if (!buf)
> + return -ENOMEM;
> +
> + ehdr = (Elf64_Ehdr *)buf;
> + phdr = (Elf64_Phdr *)(ehdr + 1);
> + memcpy(ehdr->e_ident, ELFMAG, SELFMAG);
> + ehdr->e_ident[EI_CLASS] = ELFCLASS64;
> + ehdr->e_ident[EI_DATA] = ELFDATA2LSB;
> + ehdr->e_ident[EI_VERSION] = EV_CURRENT;
> + ehdr->e_ident[EI_OSABI] = ELF_OSABI;
> + memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD);
> + ehdr->e_type = ET_CORE;
> + ehdr->e_machine = ELF_ARCH;
> + ehdr->e_version = EV_CURRENT;
> + ehdr->e_phoff = sizeof(Elf64_Ehdr);
> + ehdr->e_ehsize = sizeof(Elf64_Ehdr);
> + ehdr->e_phentsize = sizeof(Elf64_Phdr);
> +
> + /* Prepare one phdr of type PT_NOTE for each present CPU */
> + for_each_present_cpu(cpu) {
> + phdr->p_type = PT_NOTE;
> + notes_addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpu));
> + phdr->p_offset = phdr->p_paddr = notes_addr;
> + phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t);
> + (ehdr->e_phnum)++;
> + phdr++;
> + }
> +
> + /* Prepare one PT_NOTE header for vmcoreinfo */
> + phdr->p_type = PT_NOTE;
> + phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note();
> + phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE;
> + (ehdr->e_phnum)++;
> + phdr++;
> +
> + /* Prepare PT_LOAD type program header for kernel text region */
> + if (need_kernel_map) {
> + phdr->p_type = PT_LOAD;
> + phdr->p_flags = PF_R|PF_W|PF_X;
> + phdr->p_vaddr = (unsigned long) _text;
> + phdr->p_filesz = phdr->p_memsz = _end - _text;
> + phdr->p_offset = phdr->p_paddr = __pa_symbol(_text);
> + ehdr->e_phnum++;
> + phdr++;
> + }
> +
> + /* Go through all the ranges in mem->ranges[] and prepare phdr */
> + for (i = 0; i < mem->nr_ranges; i++) {
> + mstart = mem->ranges[i].start;
> + mend = mem->ranges[i].end;
> +
> + phdr->p_type = PT_LOAD;
> + phdr->p_flags = PF_R|PF_W|PF_X;
> + phdr->p_offset = mstart;
> +
> + phdr->p_paddr = mstart;
> + phdr->p_vaddr = (unsigned long) __va(mstart);
> + phdr->p_filesz = phdr->p_memsz = mend - mstart + 1;
> + phdr->p_align = 0;
> + ehdr->e_phnum++;
> + pr_debug("Crash PT_LOAD ELF header. phdr=%p vaddr=0x%llx, paddr=0x%llx, sz=0x%llx e_phnum=%d p_offset=0x%llx\n",
> + phdr, phdr->p_vaddr, phdr->p_paddr, phdr->p_filesz,
> + ehdr->e_phnum, phdr->p_offset);
> + phdr++;
> + }
> +
> + *addr = buf;
> + *sz = elf_sz;
> + return 0;
> +}
> +
> Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
> void *data, size_t data_len)
> {
> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> index 1d546dc97c50..8017eeb43036 100644
> --- a/kernel/kexec_file.c
> +++ b/kernel/kexec_file.c
> @@ -1217,102 +1217,3 @@ int crash_exclude_mem_range(struct crash_mem *mem,
> mem->nr_ranges++;
> return 0;
> }
> -
> -int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
> - void **addr, unsigned long *sz)
> -{
> - Elf64_Ehdr *ehdr;
> - Elf64_Phdr *phdr;
> - unsigned long nr_cpus = num_possible_cpus(), nr_phdr, elf_sz;
> - unsigned char *buf;
> - unsigned int cpu, i;
> - unsigned long long notes_addr;
> - unsigned long mstart, mend;
> -
> - /* extra phdr for vmcoreinfo ELF note */
> - nr_phdr = nr_cpus + 1;
> - nr_phdr += mem->nr_ranges;
> -
> - /*
> - * kexec-tools creates an extra PT_LOAD phdr for kernel text mapping
> - * area (for example, ffffffff80000000 - ffffffffa0000000 on x86_64).
> - * I think this is required by tools like gdb. So same physical
> - * memory will be mapped in two ELF headers. One will contain kernel
> - * text virtual addresses and other will have __va(physical) addresses.
> - */
> -
> - nr_phdr++;
> - elf_sz = sizeof(Elf64_Ehdr) + nr_phdr * sizeof(Elf64_Phdr);
> - elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
> -
> - buf = vzalloc(elf_sz);
> - if (!buf)
> - return -ENOMEM;
> -
> - ehdr = (Elf64_Ehdr *)buf;
> - phdr = (Elf64_Phdr *)(ehdr + 1);
> - memcpy(ehdr->e_ident, ELFMAG, SELFMAG);
> - ehdr->e_ident[EI_CLASS] = ELFCLASS64;
> - ehdr->e_ident[EI_DATA] = ELFDATA2LSB;
> - ehdr->e_ident[EI_VERSION] = EV_CURRENT;
> - ehdr->e_ident[EI_OSABI] = ELF_OSABI;
> - memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD);
> - ehdr->e_type = ET_CORE;
> - ehdr->e_machine = ELF_ARCH;
> - ehdr->e_version = EV_CURRENT;
> - ehdr->e_phoff = sizeof(Elf64_Ehdr);
> - ehdr->e_ehsize = sizeof(Elf64_Ehdr);
> - ehdr->e_phentsize = sizeof(Elf64_Phdr);
> -
> - /* Prepare one phdr of type PT_NOTE for each present CPU */
> - for_each_present_cpu(cpu) {
> - phdr->p_type = PT_NOTE;
> - notes_addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpu));
> - phdr->p_offset = phdr->p_paddr = notes_addr;
> - phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t);
> - (ehdr->e_phnum)++;
> - phdr++;
> - }
> -
> - /* Prepare one PT_NOTE header for vmcoreinfo */
> - phdr->p_type = PT_NOTE;
> - phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note();
> - phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE;
> - (ehdr->e_phnum)++;
> - phdr++;
> -
> - /* Prepare PT_LOAD type program header for kernel text region */
> - if (need_kernel_map) {
> - phdr->p_type = PT_LOAD;
> - phdr->p_flags = PF_R|PF_W|PF_X;
> - phdr->p_vaddr = (unsigned long) _text;
> - phdr->p_filesz = phdr->p_memsz = _end - _text;
> - phdr->p_offset = phdr->p_paddr = __pa_symbol(_text);
> - ehdr->e_phnum++;
> - phdr++;
> - }
> -
> - /* Go through all the ranges in mem->ranges[] and prepare phdr */
> - for (i = 0; i < mem->nr_ranges; i++) {
> - mstart = mem->ranges[i].start;
> - mend = mem->ranges[i].end;
> -
> - phdr->p_type = PT_LOAD;
> - phdr->p_flags = PF_R|PF_W|PF_X;
> - phdr->p_offset = mstart;
> -
> - phdr->p_paddr = mstart;
> - phdr->p_vaddr = (unsigned long) __va(mstart);
> - phdr->p_filesz = phdr->p_memsz = mend - mstart + 1;
> - phdr->p_align = 0;
> - ehdr->e_phnum++;
> - pr_debug("Crash PT_LOAD ELF header. phdr=%p vaddr=0x%llx, paddr=0x%llx, sz=0x%llx e_phnum=%d p_offset=0x%llx\n",
> - phdr, phdr->p_vaddr, phdr->p_paddr, phdr->p_filesz,
> - ehdr->e_phnum, phdr->p_offset);
> - phdr++;
> - }
> -
> - *addr = buf;
> - *sz = elf_sz;
> - return 0;
> -}
> --
> 2.31.1
>
On 8/30/22 21:50, Baoquan He wrote:
> On 08/26/22 at 01:36pm, Eric DeVolder wrote:
>> At the outcome of this patch set, the crash_prepare_elf64_headers()
>> is utilized on both the kexec_file_load and kexec_load paths. As
>> such, need to move this function out of kexec_file.c and into a
>> common location crash_core.c.
>>
>> No functionality change.
>>
>> Signed-off-by: Eric DeVolder <[email protected]>
>
> LGTM,
>
> Baoquan He <[email protected]>
Thank you! I'll record that as Acked-by, unless you tell me otherwise.
eric
>
>> ---
>> kernel/crash_core.c | 100 ++++++++++++++++++++++++++++++++++++++++++++
>> kernel/kexec_file.c | 99 -------------------------------------------
>> 2 files changed, 100 insertions(+), 99 deletions(-)
>>
>> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
>> index 07b26df453a9..8c8c82386e8d 100644
>> --- a/kernel/crash_core.c
>> +++ b/kernel/crash_core.c
>> @@ -10,6 +10,7 @@
>> #include <linux/utsname.h>
>> #include <linux/vmalloc.h>
>> #include <linux/sizes.h>
>> +#include <linux/kexec.h>
>>
>> #include <asm/page.h>
>> #include <asm/sections.h>
>> @@ -314,6 +315,105 @@ static int __init parse_crashkernel_dummy(char *arg)
>> }
>> early_param("crashkernel", parse_crashkernel_dummy);
>>
>> +int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
>> + void **addr, unsigned long *sz)
>> +{
>> + Elf64_Ehdr *ehdr;
>> + Elf64_Phdr *phdr;
>> + unsigned long nr_cpus = num_possible_cpus(), nr_phdr, elf_sz;
>> + unsigned char *buf;
>> + unsigned int cpu, i;
>> + unsigned long long notes_addr;
>> + unsigned long mstart, mend;
>> +
>> + /* extra phdr for vmcoreinfo ELF note */
>> + nr_phdr = nr_cpus + 1;
>> + nr_phdr += mem->nr_ranges;
>> +
>> + /*
>> + * kexec-tools creates an extra PT_LOAD phdr for kernel text mapping
>> + * area (for example, ffffffff80000000 - ffffffffa0000000 on x86_64).
>> + * I think this is required by tools like gdb. So same physical
>> + * memory will be mapped in two ELF headers. One will contain kernel
>> + * text virtual addresses and other will have __va(physical) addresses.
>> + */
>> +
>> + nr_phdr++;
>> + elf_sz = sizeof(Elf64_Ehdr) + nr_phdr * sizeof(Elf64_Phdr);
>> + elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
>> +
>> + buf = vzalloc(elf_sz);
>> + if (!buf)
>> + return -ENOMEM;
>> +
>> + ehdr = (Elf64_Ehdr *)buf;
>> + phdr = (Elf64_Phdr *)(ehdr + 1);
>> + memcpy(ehdr->e_ident, ELFMAG, SELFMAG);
>> + ehdr->e_ident[EI_CLASS] = ELFCLASS64;
>> + ehdr->e_ident[EI_DATA] = ELFDATA2LSB;
>> + ehdr->e_ident[EI_VERSION] = EV_CURRENT;
>> + ehdr->e_ident[EI_OSABI] = ELF_OSABI;
>> + memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD);
>> + ehdr->e_type = ET_CORE;
>> + ehdr->e_machine = ELF_ARCH;
>> + ehdr->e_version = EV_CURRENT;
>> + ehdr->e_phoff = sizeof(Elf64_Ehdr);
>> + ehdr->e_ehsize = sizeof(Elf64_Ehdr);
>> + ehdr->e_phentsize = sizeof(Elf64_Phdr);
>> +
>> + /* Prepare one phdr of type PT_NOTE for each present CPU */
>> + for_each_present_cpu(cpu) {
>> + phdr->p_type = PT_NOTE;
>> + notes_addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpu));
>> + phdr->p_offset = phdr->p_paddr = notes_addr;
>> + phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t);
>> + (ehdr->e_phnum)++;
>> + phdr++;
>> + }
>> +
>> + /* Prepare one PT_NOTE header for vmcoreinfo */
>> + phdr->p_type = PT_NOTE;
>> + phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note();
>> + phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE;
>> + (ehdr->e_phnum)++;
>> + phdr++;
>> +
>> + /* Prepare PT_LOAD type program header for kernel text region */
>> + if (need_kernel_map) {
>> + phdr->p_type = PT_LOAD;
>> + phdr->p_flags = PF_R|PF_W|PF_X;
>> + phdr->p_vaddr = (unsigned long) _text;
>> + phdr->p_filesz = phdr->p_memsz = _end - _text;
>> + phdr->p_offset = phdr->p_paddr = __pa_symbol(_text);
>> + ehdr->e_phnum++;
>> + phdr++;
>> + }
>> +
>> + /* Go through all the ranges in mem->ranges[] and prepare phdr */
>> + for (i = 0; i < mem->nr_ranges; i++) {
>> + mstart = mem->ranges[i].start;
>> + mend = mem->ranges[i].end;
>> +
>> + phdr->p_type = PT_LOAD;
>> + phdr->p_flags = PF_R|PF_W|PF_X;
>> + phdr->p_offset = mstart;
>> +
>> + phdr->p_paddr = mstart;
>> + phdr->p_vaddr = (unsigned long) __va(mstart);
>> + phdr->p_filesz = phdr->p_memsz = mend - mstart + 1;
>> + phdr->p_align = 0;
>> + ehdr->e_phnum++;
>> + pr_debug("Crash PT_LOAD ELF header. phdr=%p vaddr=0x%llx, paddr=0x%llx, sz=0x%llx e_phnum=%d p_offset=0x%llx\n",
>> + phdr, phdr->p_vaddr, phdr->p_paddr, phdr->p_filesz,
>> + ehdr->e_phnum, phdr->p_offset);
>> + phdr++;
>> + }
>> +
>> + *addr = buf;
>> + *sz = elf_sz;
>> + return 0;
>> +}
>> +
>> Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
>> void *data, size_t data_len)
>> {
>> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
>> index 1d546dc97c50..8017eeb43036 100644
>> --- a/kernel/kexec_file.c
>> +++ b/kernel/kexec_file.c
>> @@ -1217,102 +1217,3 @@ int crash_exclude_mem_range(struct crash_mem *mem,
>> mem->nr_ranges++;
>> return 0;
>> }
>> -
>> -int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
>> - void **addr, unsigned long *sz)
>> -{
>> - Elf64_Ehdr *ehdr;
>> - Elf64_Phdr *phdr;
>> - unsigned long nr_cpus = num_possible_cpus(), nr_phdr, elf_sz;
>> - unsigned char *buf;
>> - unsigned int cpu, i;
>> - unsigned long long notes_addr;
>> - unsigned long mstart, mend;
>> -
>> - /* extra phdr for vmcoreinfo ELF note */
>> - nr_phdr = nr_cpus + 1;
>> - nr_phdr += mem->nr_ranges;
>> -
>> - /*
>> - * kexec-tools creates an extra PT_LOAD phdr for kernel text mapping
>> - * area (for example, ffffffff80000000 - ffffffffa0000000 on x86_64).
>> - * I think this is required by tools like gdb. So same physical
>> - * memory will be mapped in two ELF headers. One will contain kernel
>> - * text virtual addresses and other will have __va(physical) addresses.
>> - */
>> -
>> - nr_phdr++;
>> - elf_sz = sizeof(Elf64_Ehdr) + nr_phdr * sizeof(Elf64_Phdr);
>> - elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
>> -
>> - buf = vzalloc(elf_sz);
>> - if (!buf)
>> - return -ENOMEM;
>> -
>> - ehdr = (Elf64_Ehdr *)buf;
>> - phdr = (Elf64_Phdr *)(ehdr + 1);
>> - memcpy(ehdr->e_ident, ELFMAG, SELFMAG);
>> - ehdr->e_ident[EI_CLASS] = ELFCLASS64;
>> - ehdr->e_ident[EI_DATA] = ELFDATA2LSB;
>> - ehdr->e_ident[EI_VERSION] = EV_CURRENT;
>> - ehdr->e_ident[EI_OSABI] = ELF_OSABI;
>> - memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD);
>> - ehdr->e_type = ET_CORE;
>> - ehdr->e_machine = ELF_ARCH;
>> - ehdr->e_version = EV_CURRENT;
>> - ehdr->e_phoff = sizeof(Elf64_Ehdr);
>> - ehdr->e_ehsize = sizeof(Elf64_Ehdr);
>> - ehdr->e_phentsize = sizeof(Elf64_Phdr);
>> -
>> - /* Prepare one phdr of type PT_NOTE for each present CPU */
>> - for_each_present_cpu(cpu) {
>> - phdr->p_type = PT_NOTE;
>> - notes_addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpu));
>> - phdr->p_offset = phdr->p_paddr = notes_addr;
>> - phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t);
>> - (ehdr->e_phnum)++;
>> - phdr++;
>> - }
>> -
>> - /* Prepare one PT_NOTE header for vmcoreinfo */
>> - phdr->p_type = PT_NOTE;
>> - phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note();
>> - phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE;
>> - (ehdr->e_phnum)++;
>> - phdr++;
>> -
>> - /* Prepare PT_LOAD type program header for kernel text region */
>> - if (need_kernel_map) {
>> - phdr->p_type = PT_LOAD;
>> - phdr->p_flags = PF_R|PF_W|PF_X;
>> - phdr->p_vaddr = (unsigned long) _text;
>> - phdr->p_filesz = phdr->p_memsz = _end - _text;
>> - phdr->p_offset = phdr->p_paddr = __pa_symbol(_text);
>> - ehdr->e_phnum++;
>> - phdr++;
>> - }
>> -
>> - /* Go through all the ranges in mem->ranges[] and prepare phdr */
>> - for (i = 0; i < mem->nr_ranges; i++) {
>> - mstart = mem->ranges[i].start;
>> - mend = mem->ranges[i].end;
>> -
>> - phdr->p_type = PT_LOAD;
>> - phdr->p_flags = PF_R|PF_W|PF_X;
>> - phdr->p_offset = mstart;
>> -
>> - phdr->p_paddr = mstart;
>> - phdr->p_vaddr = (unsigned long) __va(mstart);
>> - phdr->p_filesz = phdr->p_memsz = mend - mstart + 1;
>> - phdr->p_align = 0;
>> - ehdr->e_phnum++;
>> - pr_debug("Crash PT_LOAD ELF header. phdr=%p vaddr=0x%llx, paddr=0x%llx, sz=0x%llx e_phnum=%d p_offset=0x%llx\n",
>> - phdr, phdr->p_vaddr, phdr->p_paddr, phdr->p_filesz,
>> - ehdr->e_phnum, phdr->p_offset);
>> - phdr++;
>> - }
>> -
>> - *addr = buf;
>> - *sz = elf_sz;
>> - return 0;
>> -}
>> --
>> 2.31.1
>>
>