• J
    Move load of AppArmor profile to GenLabel() · 0b501bd4
    Jamie Strandboge 提交于
    Commit 12317957 introduced an incompatible
    architectural change for the AppArmor security driver. Specifically,
    virSecurityManagerSetAllLabel() is now called much later in
    src/qemu/qemu_process.c:qemuProcessStart(). Previously, SetAllLabel() was
    called immediately after GenLabel() such that after the dynamic label (profile
    name) was generated, SetAllLabel() would be called to create and load the
    AppArmor profile into the kernel before qemuProcessHook() was executed. With
    12317957, qemuProcessHook() is now called
    before SetAllLabel(), such that aa_change_profile() ends up being called
    before the AppArmor profile is loaded into the kernel (via ProcessLabel() in
    qemuProcessHook()).
    
    This patch addresses the change by making GenLabel() load the AppArmor
    profile into the kernel after the label (profile name) is generated.
    SetAllLabel() is then adjusted to only reload_profile() and append stdin_fn to
    the profile when it is specified. This also makes the AppArmor driver work
    like its SELinux counterpart with regard to SetAllLabel() and stdin_fn.
    Bug-Ubuntu: https://launchpad.net/bugs/801569
    0b501bd4
security_apparmor.c 21.5 KB