Skip to content
Snippets Groups Projects
  • Stefan Berger's avatar
    254ef954
    ima: Suspend PCR extends and log appends when rebooting · 254ef954
    Stefan Berger authored
    
    To avoid the following types of error messages due to a failure by the TPM
    driver to use the TPM, suspend TPM PCR extensions and the appending of
    entries to the IMA log once IMA's reboot notifier has been called. This
    avoids trying to use the TPM after the TPM subsystem has been shut down.
    
    [111707.685315][    T1] ima: Error Communicating to TPM chip, result: -19
    [111707.685960][    T1] ima: Error Communicating to TPM chip, result: -19
    
    Synchronization with the ima_extend_list_mutex to set
    ima_measurements_suspended ensures that the TPM subsystem is not shut down
    when IMA holds the mutex while appending to the log and extending the PCR.
    The alternative of reading the system_state variable would not provide this
    guarantee.
    
    This error could be observed on a ppc64 machine running SuSE Linux where
    processes are still accessing files after devices have been shut down.
    
    Suspending the IMA log and PCR extensions shortly before reboot does not
    seem to open a significant measurement gap since neither TPM quoting would
    work for attestation nor that new log entries could be written to anywhere
    after devices have been shut down. However, there's a time window between
    the invocation of the reboot notifier and the shutdown of devices. This
    includes all subsequently invoked reboot notifiers as well as
    kernel_restart_prepare() where __usermodehelper_disable() waits for all
    running_helpers to exit. During this time window IMA could now miss log
    entries even though attestation would still work. The reboot of the system
    shortly after may make this small gap insignificant.
    
    Signed-off-by: default avatarTushar Sugandhi <tusharsu@linux.microsoft.com>
    Signed-off-by: default avatarStefan Berger <stefanb@linux.ibm.com>
    Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
    254ef954
    History
    ima: Suspend PCR extends and log appends when rebooting
    Stefan Berger authored
    
    To avoid the following types of error messages due to a failure by the TPM
    driver to use the TPM, suspend TPM PCR extensions and the appending of
    entries to the IMA log once IMA's reboot notifier has been called. This
    avoids trying to use the TPM after the TPM subsystem has been shut down.
    
    [111707.685315][    T1] ima: Error Communicating to TPM chip, result: -19
    [111707.685960][    T1] ima: Error Communicating to TPM chip, result: -19
    
    Synchronization with the ima_extend_list_mutex to set
    ima_measurements_suspended ensures that the TPM subsystem is not shut down
    when IMA holds the mutex while appending to the log and extending the PCR.
    The alternative of reading the system_state variable would not provide this
    guarantee.
    
    This error could be observed on a ppc64 machine running SuSE Linux where
    processes are still accessing files after devices have been shut down.
    
    Suspending the IMA log and PCR extensions shortly before reboot does not
    seem to open a significant measurement gap since neither TPM quoting would
    work for attestation nor that new log entries could be written to anywhere
    after devices have been shut down. However, there's a time window between
    the invocation of the reboot notifier and the shutdown of devices. This
    includes all subsequently invoked reboot notifiers as well as
    kernel_restart_prepare() where __usermodehelper_disable() waits for all
    running_helpers to exit. During this time window IMA could now miss log
    entries even though attestation would still work. The reboot of the system
    shortly after may make this small gap insignificant.
    
    Signed-off-by: default avatarTushar Sugandhi <tusharsu@linux.microsoft.com>
    Signed-off-by: default avatarStefan Berger <stefanb@linux.ibm.com>
    Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>