s390/ipl: Fix missing re-IPL parm blocks handling in dump paths
Vasily Gorbik
maintainercover s390/ipl: Fix missing re-IPL parm blocks handling in dump paths
HMC FTP boot and QEMU direct kernel boot do not provide an IPL parameter block. This can lead to NULL pointer dereferences during kdump and stand-alone dump processing.
Fix the kdump and stand-alone dump paths separately. kdump continues without a re-IPL parameter block, while the stand-alone dumper completes the dump and halts.
Vasily Gorbik (2):
s390/ipl: Fix NULL deref in kdump without re-IPL parm block s390/ipl: Fix NULL deref in dump_reipl without re-IPL parm block
arch/s390/kernel/ipl.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
2.53.0
Vasily Gorbik
maintainerPATCH 1/2 s390/ipl: Fix NULL deref in kdump without re-IPL parm block
Some IPL types, like HMC FTP boot or QEMU direct kernel boot, might not provide an IPL parameter block. In this case, reipl_type_init() selects IPL_TYPE_UNKNOWN, and reipl_block_actual remains NULL.
kdump passes the re-IPL parameter block to the dump kernel through os_info. Before commit 3b9678472bab ("s390/ipl: correct kdump reipl block checksum calculation"), the os_info entry was added only for IPL types which initialized reipl_block_actual. That commit moved the os_info update to machine_crash_shutdown(), making it unconditional. As a result, set_os_info_reipl_block() dereferences reipl_block_actual for IPL_TYPE_UNKNOWN. This may happen to work by chance when address zero contains readable lowcore data and the resulting empty os_info entry is ignored by the dump kernel.
Skip the os_info update when no re-IPL parameter block is available. Kdump then collect the dump and reboot without setting re-IPL parameter block.
--- arch/s390/kernel/ipl.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/kernel/ipl.c +2 -0
@@ -1157,6 +1157,8 @@ static struct attribute_group reipl_nss_attr_group = {void set_os_info_reipl_block (void ) { +if (!reipl_block_actual) +return ;os_info_entry_add_data (OS_INFO_REIPL_BLOCK , reipl_block_actual, reipl_block_actual->hdr.len); }
Signature · 1 line
2.53.0
Vasily Gorbik
maintainerPATCH 2/2 s390/ipl: Fix NULL deref in dump_reipl without re-IPL parm block
In reply to Vasily GorbikUnlike kdump, which passes the re-IPL parameter block through os_info, the stand-alone dump passes it through the IPL parm block address and checksum in lowcore.
Some IPL types, like HMC FTP boot or QEMU direct kernel boot, might not provide an IPL parameter block. In this case reipl_type_init() selects IPL_TYPE_UNKNOWN and reipl_block_actual remains NULL. Nevertheless, dump_reipl_run() unconditionally dereferences it when preparing the lowcore fields. This may happen to work by chance when address zero contains readable lowcore data. A zero IPL parameter block address is then stored in lowcore, causing the stand-alone dumper to enter disabled wait after completing the dump.
Explicitly store a zero IPL parameter block address and checksum when no re-IPL parameter block is available. This does not change the behavior:
the stand-alone dumper completes the dump and halts, while valid re-IPL parameter blocks continue to be handled as before.
--- arch/s390/kernel/ipl.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/s390/kernel/ipl.c +7 -3
@@ -1929,7 +1929,8 @@ static struct shutdown_action __refdata dump_action = {static void dump_reipl_run (struct shutdown_trigger *trigger) {struct lowcore *abs_lc; -unsigned int csum; +unsigned long ipib =0 ; +unsigned int csum =0 ;/* * Set REIPL_CLEAR flag in os_info flags entry indicating
@@ -1945,9 +1946,12 @@ static void dump_reipl_run(struct shutdown_trigger *trigger) reipl_type == IPL_TYPE_UNKNOWN) os_info_flags |=OS_INFO_FLAG_REIPL_CLEAR ;os_info_entry_add_data (OS_INFO_FLAGS_ENTRY , &os_info_flags,sizeof (os_info_flags)); - csum = (__force unsigned int )cksm (reipl_block_actual, reipl_block_actual->hdr.len,0 ); +if (reipl_block_actual) { + ipib =__pa (reipl_block_actual); + csum = (__force unsigned int )cksm (reipl_block_actual, reipl_block_actual->hdr.len,0 ); + } abs_lc =get_abs_lowcore (); - abs_lc->ipib =__pa (reipl_block_actual); + abs_lc->ipib = ipib; abs_lc->ipib_checksum = csum;put_abs_lowcore (abs_lc);dump_run (trigger);
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 1/2] s390/ipl: Fix NULL deref in kdump without re-IPL parm block
In reply to Vasily GorbikThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] NULL pointer dereference in dump_reipl_run() when the system is booted without an IPL parameter block.
- [High] Unbounded memcpy() in reipl_type_init() causes a heap buffer overflow in the dump kernel. --
--- Patch [1]: [PATCH 1/2] s390/ipl: Fix NULL deref in kdump without re-IPL parm block --- commit f223a6548d3bfb367ccf07d1f7597eab8c386045
Author: Vasily Gorbik <[email protected]>
s390/ipl: Fix NULL deref in kdump without re-IPL parm block
Some IPL types, like HMC FTP boot or QEMU direct kernel boot, might not provide an IPL parameter block. In this case, reipl_type_init() selects IPL_TYPE_UNKNOWN, and reipl_block_actual remains NULL.
arch/s390/kernel/ipl.c static struct attribute_group reipl_nss_attr_group = { · line 1164
Quoted 13 lines
arch/s390/kernel/ipl.c +2
-0@@ -1157,6 +1157,8 @@ static struct attribute_group reipl_nss_attr_group = {void set_os_info_reipl_block (void ) { +if (!reipl_block_actual) +return ;os_info_entry_add_data (OS_INFO_REIPL_BLOCK , reipl_block_actual, reipl_block_actual->hdr.len); }
[Severity: High]
This is a pre-existing issue, but looking at dump_reipl_run(), if the system boots without an IPL parameter block and sets reipl_block_actual to NULL, won't this unconditionally dereference it?
arch/s390/kernel/ipl.c:dump_reipl_run() {
...
csum = (__force unsigned int)cksm(reipl_block_actual,
reipl_block_actual->hdr.len, 0);
abs_lc = get_abs_lowcore();
abs_lc->ipib = __pa(reipl_block_actual);
...
}Will this cause a recursive fault during a crash shutdown sequence when the on_panic action is configured to dump_reipl?
[Severity: High]
This isn't a bug introduced by this patch, but looking at reipl_type_init(), could an untrusted size from the crashed kernel memory overflow the PAGE_SIZE buffers here?
arch/s390/kernel/ipl.c:reipl_type_init() {
...
reipl_block = os_info_old_entry(OS_INFO_REIPL_BLOCK, &size);
if (!reipl_block)
goto out;
/*
* If we have an OS info reipl block, this will be used
*/
if (reipl_block->pb0_hdr.pbt == IPL_PBT_FCP) {
memcpy(reipl_block_fcp, reipl_block, size);
reipl_type = IPL_TYPE_FCP;
} else if (reipl_block->pb0_hdr.pbt == IPL_PBT_NVME) {
...
}If a malicious primary kernel crafts an os_info payload with a valid checksum but a size greater than PAGE_SIZE, wouldn't this cause a heap buffer overflow in the dump kernel, preventing the crash dump from being collected?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
AI reviewRe: [PATCH 2/2] s390/ipl: Fix NULL deref in dump_reipl without re-IPL parm block
In reply to Vasily GorbikSashiko has reviewed this patch and found no issues. It looks great!
Quoted 13 lines
Unlike kdump, which passes the re-IPL parameter block through
os_info, the stand-alone dump passes it through the IPL parm block address and checksum in lowcore.Some IPL types, like HMC FTP boot or QEMU direct kernel boot, might not provide an IPL parameter block. In this case
reipl_type_init()selectsIPL_TYPE_UNKNOWNandreipl_block_actualremains NULL. Nevertheless,dump_reipl_run()unconditionally dereferences it when preparing the lowcore fields. This may happen to work by chance when address zero contains readable lowcore data. A zero IPL parameter block address is then stored in lowcore, causing the stand-alone dumper to enter disabled wait after completing the dump.
Quoted 7 lines
Explicitly store a zero IPL parameter block address and checksum when no re-IPL parameter block is available. This does not change the behavior:
the stand-alone dumper completes the dump and halts, while valid re-IPL parameter blocks continue to be handled as before.Fixes 099b76513992 ("[S390] Automatic IPL after dump")Signed-off-by Vasily Gorbik <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Vasily Gorbik
maintainerRe: [PATCH 1/2] s390/ipl: Fix NULL deref in kdump without re-IPL parm block
In reply to [email protected]Quoted 6 lines · On Thu, Aug 13, 2026 at 11:19:27AM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] NULL pointer dereference indump_reipl_run()when the system is booted without an IPL parameter block.
- [High] Unboundedmemcpy()inreipl_type_init()causes a heap buffer overflow in the dump kernel. --
...
Quoted 4 lines
[Severity: High]
This is a pre-existing issue, but looking atdump_reipl_run(), if the system boots without an IPL parameter block and setsreipl_block_actualto NULL, won't this unconditionally dereference it?
That's fixed in patch 2 of the series
Quoted 20 lines
[Severity: High]
This isn't a bug introduced by this patch, but looking atreipl_type_init(), could an untrusted size from the crashed kernel memory overflow thePAGE_SIZEbuffers here?arch/s390/kernel/ipl.c:reipl_type_init() { ... reipl_block = os_info_old_entry(OS_INFO_REIPL_BLOCK, &size); if (!reipl_block) goto out; /* * If we have an OS info reipl block, this will be used */ if (reipl_block->pb0_hdr.pbt == IPL_PBT_FCP) { memcpy(reipl_block_fcp, reipl_block, size); reipl_type = IPL_TYPE_FCP; } else if (reipl_block->pb0_hdr.pbt == IPL_PBT_NVME) { ... }
Quoted 4 lines
If a malicious primary kernel crafts an
os_infopayload with a valid checksum but a size greater thanPAGE_SIZE, wouldn't this cause a heap buffer overflow in the dump kernel, preventing the crash dump from being collected?
The primary kernel is not an untrusted security boundary for kdump. It loads the dump kernel and can modify both the dump kernel image and the data. A malicious primary kernel can therefore already prevent dump collection or execute arbitrary code in the dump kernel. So, this finding is outside the kernel threat model.
Re: [PATCH 2/2] s390/ipl: Fix NULL deref in dump_reipl without re-IPL parm block
In reply to Vasily GorbikQuoted 43 lines · Vasily Gorbik
Unlike kdump, which passes the re-IPL parameter block through
os_info, the stand-alone dump passes it through the IPL parm block address and checksum in lowcore.Some IPL types, like HMC FTP boot or QEMU direct kernel boot, might not provide an IPL parameter block. In this case
reipl_type_init()selectsIPL_TYPE_UNKNOWNandreipl_block_actualremains NULL. Nevertheless,dump_reipl_run()unconditionally dereferences it when preparing the lowcore fields. This may happen to work by chance when address zero contains readable lowcore data. A zero IPL parameter block address is then stored in lowcore, causing the stand-alone dumper to enter disabled wait after completing the dump.Explicitly store a zero IPL parameter block address and checksum when no re-IPL parameter block is available. This does not change the behavior:
the stand-alone dumper completes the dump and halts, while valid re-IPL parameter blocks continue to be handled as before.Fixes 099b76513992 ("[S390] Automatic IPL after dump")Signed-off-by Vasily Gorbik <[email protected]>--- arch/s390/kernel/ipl.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)arch/s390/kernel/ipl.c +2
-2@@ -1929,7 +1929,8 @@ static struct shutdown_action __refdata dump_action = {static void dump_reipl_run (struct shutdown_trigger *trigger) {struct lowcore *abs_lc; -unsigned int csum; +unsigned long ipib =0 ; +unsigned int csum =0 ;/* * Set REIPL_CLEAR flag in os_info flags entry indicating @@ -1945,9 +1946,12 @@ static void dump_reipl_run(struct shutdown_trigger *trigger) reipl_type == IPL_TYPE_UNKNOWN) os_info_flags |=OS_INFO_FLAG_REIPL_CLEAR ;os_info_entry_add_data (OS_INFO_FLAGS_ENTRY , &os_info_flags,sizeof (os_info_flags)); - csum = (__force unsigned int )cksm (reipl_block_actual, reipl_block_actual->hdr.len,0 );
arch/s390/kernel/ipl.c static void dump_reipl_run(struct shutdown_trigger *trigger) · line 1957
Quoted 10 lines
arch/s390/kernel/ipl.c +5
-1+if (reipl_block_actual) { + ipib =__pa (reipl_block_actual); + csum = (__force unsigned int )cksm (reipl_block_actual, reipl_block_actual->hdr.len,0 ); + } abs_lc =get_abs_lowcore (); - abs_lc->ipib =__pa (reipl_block_actual); + abs_lc->ipib = ipib; abs_lc->ipib_checksum = csum;put_abs_lowcore (abs_lc);dump_run (trigger);
Re: [PATCH 1/2] s390/ipl: Fix NULL deref in kdump without re-IPL parm block
In reply to Vasily GorbikQuoted 18 lines · Vasily Gorbik
Some IPL types, like HMC FTP boot or QEMU direct kernel boot, might not provide an IPL parameter block. In this case,
reipl_type_init()selectsIPL_TYPE_UNKNOWN, andreipl_block_actualremains NULL.kdump passes the re-IPL parameter block to the dump kernel through
os_info. Before commit3b9678472bab("s390/ipl: correct kdump reipl block checksum calculation"), theos_infoentry was added only for IPL types which initializedreipl_block_actual. That commit moved theos_infoupdate tomachine_crash_shutdown(), making it unconditional. As a result,set_os_info_reipl_block()dereferencesreipl_block_actualforIPL_TYPE_UNKNOWN. This may happen to work by chance when address zero contains readable lowcore data and the resulting emptyos_infoentry is ignored by the dump kernel.Skip the
os_infoupdate when no re-IPL parameter block is available. Kdump then collect the dump and reboot without setting re-IPL parameter block.
Quoted 5 lines
Fixes 3b9678472bab ("s390/ipl: correct kdump reipl block checksum calculation")Signed-off-by Vasily Gorbik <[email protected]>--- arch/s390/kernel/ipl.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 8 lines · Vasily Gorbik
HMC FTP boot and QEMU direct kernel boot do not provide an IPL parameter block. This can lead to NULL pointer dereferences during kdump and stand-alone dump processing.
Fix the kdump and stand-alone dump paths separately. kdump continues without a re-IPL parameter block, while the stand-alone dumper completes the dump and halts.
Quoted 6 lines
Vasily Gorbik (2):
s390/ipl: Fix NULL deref in kdump without re-IPL parm block s390/ipl: Fix NULL deref indump_reiplwithout re-IPL parm blockarch/s390/kernel/ipl.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
Applied