Multiple options= are parsed incorrectly making setting persistent options impossible
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ipmitool (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Medium
|
Matthew Ruffell | ||
Jammy |
Fix Released
|
Medium
|
Matthew Ruffell | ||
Kinetic |
Won't Fix
|
Medium
|
Matthew Ruffell |
Bug Description
[Impact]
When passing multiple options= flags into bootdev and bootparam commands, options= parsing is incorrect, only applying the final flag, and if there were any persistent boot options set, they get wiped out, leading to options not being persistent.
This makes it impossible to set a persistent efiboot flag for example.
The bug is a simple logic error, as seen in the final hunk of the patch:
@@ -1768,8 +2021,8 @@ ipmi_chassis_
}
for (op = options; op->name; ++op) {
if (strcmp(token, op->name) == 0) {
- flags[op->i] &= op->mask;
- flags[op->i] |= op->value;
+ flags[op->offset] &= ~(op->mask);
+ flags[op->offset] |= op->value;
break;
}
}
flags[op->i] &= op->mask; was clearing the values of all flags, breaking persistence, while the fix is negate op->mask, to keep the other flags the same while clearing the value of the flag being set, as it is set as a bitwise OR on the next line as flags[op->offset] |= op->value;.
[Testcase]
You need a bare metal server that supports IPMI v2 or later.
If the server is set to boot from BIOS, you can attempt to efiboot it with:
$ sudo ipmitool chassis bootdev pxe options=
Set Boot Device to pxe
$ sudo ipmitool raw 0x00 0x09 0x05 0x0 0x0
01 05 a0 04 00 00 00 <--- "a0", but expecting "e0"
This will boot in efi mode, but on the version in -updates, it will fail to be persistent. If you boot the server again, it will be a BIOS boot.
If you install the test package in the below ppa:
https:/
When you run the bootdev command, efiboot will be persistent, across multiple boots.
$ sudo ipmitool chassis bootdev pxe options=
Set Boot Device to pxe
swqa@luna-
01 05 e0 04 00 00 00 <--- shows "e0" this time
[Where problems could occur]
We are changing how chassis bootdev and bootparam options are being parsed. If a regression were to occur, then options may be parsed differently to what the user was expecting, or had implemented in their scripts.
Due to flag persistence being fixed, flags are no longer clobbered out each time one of these commands are run, and options will remain persistent if they have been asked to be set as persistent. Any users relying on the faulty behaviour of clobbering instead of actually turning options off when they are finished may have undesired results.
If a regression were to occur, a user might have their systems options set incorrectly, and for example, swapping between BIOS and EFI boot, could lead to their server being unbootable and needing a system administrator to remote in over IPMI and set the correct boot options.
ipmitool is usually used during maintenance windows, but it could catch some users out.
[Other info]
Upstream bug report:
https:/
Upstream pull request:
https:/
Note the pull request has six commits. The first is the only one required to fix the issue. The other five are refactors and spelling corrections, and have very little change in logic. The other five do not backport cleanly at all, and some have fixups.
We will stick to including the first patch that resolves the problem, and nothing more:
commit 4b89f1b42d94a9b
From: Alexander Amelkin <email address hidden>
Date: Wed, 6 Nov 2019 11:40:15 +0300
Subject: chassis: bootparam/bootdev: Refactor for less magic
Link: https:/
Changed in ipmitool (Ubuntu): | |
status: | Triaged → Fix Released |
Changed in ipmitool (Ubuntu Focal): | |
status: | New → In Progress |
Changed in ipmitool (Ubuntu Jammy): | |
status: | New → In Progress |
Changed in ipmitool (Ubuntu Kinetic): | |
status: | New → In Progress |
Changed in ipmitool (Ubuntu Focal): | |
importance: | Undecided → Medium |
Changed in ipmitool (Ubuntu Jammy): | |
importance: | Undecided → Medium |
Changed in ipmitool (Ubuntu Kinetic): | |
importance: | Undecided → Medium |
Changed in ipmitool (Ubuntu Focal): | |
assignee: | nobody → Matthew Ruffell (mruffell) |
Changed in ipmitool (Ubuntu Jammy): | |
assignee: | nobody → Matthew Ruffell (mruffell) |
Changed in ipmitool (Ubuntu Kinetic): | |
assignee: | nobody → Matthew Ruffell (mruffell) |
tags: | added: sts |
summary: |
- Fix chassis bootparam and bootdev options in Jammy + Multiple options= are parsed incorrectly and options are not persistent |
summary: |
- Multiple options= are parsed incorrectly and options are not persistent + Multiple options= are parsed incorrectly making setting persistent + options impossible |
description: | updated |
tags: | added: sts-sponsor |
tags: | removed: sts-sponsor |
tags: |
added: se se-sponsor-halves removed: sts |
Hi Joao,
Thanks for reporting this one and linking the upstream bug and fix.
Would you be willing to drive this fix as a potential SRU?
The first step would be to file the SRU paperwork in this bug: /wiki.ubuntu. com/StableRelea seUpdates# SRU_Bug_ Template
https:/
Then, you could either provide a debdiff or an MP in LP so we can test/apply/upload it if it that is the proper fix for the issue.
In case you do not have the capacity to handle this ATM, I am adding this to the server team backlog to be analyzed and worked on by the server team as time allows.