Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd: Add rpm-ostree backend to CPU mitigations #13167

Merged
merged 1 commit into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pkg/systemd/kernelopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,21 @@ grub() {
# on Debian/Ubuntu, use update-grub, which reads from /etc/default/grub
elif [ -e /etc/default/grub ] && type update-grub >/dev/null 2>&1; then
update-grub

# on OSTree, the kernel config is inside the image
elif cur=$(rpm-ostree kargs 2>&1); then
if [ "$1" = set ]; then
# replace if already present
if [ "${cur% $key *}" != "$cur" ] || [ "${cur% $key=*}" != "$cur" ]; then
rpm-ostree kargs --replace="$2"
else
rpm-ostree kargs --append="$2"
fi
else
rpm-ostree kargs --delete="$key"
fi
else
error "No supported grub update mechanism found (grubby or update-grub)"
error "No supported grub update mechanism found (grubby, update-grub, or rpm-ostree)"
fi
}

Expand Down
6 changes: 1 addition & 5 deletions test/verify/check-system-info
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,6 @@ class TestSystemInfo(MachineCase):
(expect_smt_default and ':not(:checked)' or ':checked'))
b.click('#cpu-mitigations-dialog Button:contains(Save and reboot)')

if self.image in ["fedora-coreos"]:
# no way to set kernel options: https://github.com/coreos/fedora-coreos-config/issues/234
b.wait_present('#cpu-mitigations-dialog .pf-c-alert__title:contains(No supported grub update mechanism found)')
return

m.wait_reboot()
if expect_smt_default:
self.assertNotIn('nosmt', m.execute('cat /proc/cmdline'))
Expand Down Expand Up @@ -686,6 +681,7 @@ fi
m.execute('mv /etc/default/grub /etc/default/grub.bak || true')
m.write('/tmp/grubby', '#!/bin/sh\necho 0')
m.execute('[ ! -f /usr/sbin/grubby ] || mount --bind /tmp/grubby /usr/sbin/grubby')
m.execute('systemctl stop rpm-ostreed.service || true; systemctl mask rpm-ostreed.service')
self.login_and_go('/system/hwinfo')
if m.image == "rhel-8-1-distropkg":
b.click('#hwinfo a:contains(Mitigations)')
Expand Down