Skip to content

Commit

Permalink
lxd/apparmor: Respect LXD_OVMF_PATH
Browse files Browse the repository at this point in the history
Closes #8722

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
  • Loading branch information
stgraber committed May 5, 2021
1 parent 6035cd3 commit 124b510
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lxd/apparmor/instance.go
Expand Up @@ -175,6 +175,11 @@ func instanceProfile(state *state.State, inst instance) (string, error) {
}
}

ovmfPath := "/usr/share/OVMF"
if os.Getenv("LXD_OVMF_PATH") != "" {
ovmfPath = os.Getenv("LXD_OVMF_PATH")
}

err = qemuProfileTpl.Execute(sb, map[string]interface{}{
"devPaths": devPaths,
"exePath": util.GetExecPath(),
Expand All @@ -185,6 +190,7 @@ func instanceProfile(state *state.State, inst instance) (string, error) {
"raw": rawContent,
"rootPath": rootPath,
"snap": shared.InSnap(),
"ovmfPath": ovmfPath,
})
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion lxd/apparmor/instance_qemu.go
Expand Up @@ -36,7 +36,7 @@ profile "{{ .name }}" flags=(attach_disconnected,mediate_deleted) {
/sys/devices/** r,
/sys/module/vhost/** r,
/{,usr/}bin/qemu* mrix,
/usr/share/OVMF/OVMF_CODE.fd kr,
{{ .ovmfPath }}/OVMF_CODE.fd kr,
/usr/share/qemu/** kr,
/usr/share/seabios/** kr,
owner @{PROC}/@{pid}/task/@{tid}/comm rw,
Expand Down

0 comments on commit 124b510

Please sign in to comment.