mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
x86/virt/seamldr: Add module update locking
TDX metadata like the version number changes during a module update. Add functions to lock out module updates. The current stop_machine() implementation uses worker threads. The scheduler actually does a full, normal context switch over to that thread. preempt_disable() obviously inhibits that context switch and thus, locks out stop_machine() users like the module update. Thanks to Chao for the idea of using preempt_disable(). Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
This commit is contained in:
parent
b344c50a1a
commit
6e97c234cd
|
|
@ -32,5 +32,7 @@ static_assert(sizeof(struct seamldr_info) == 256);
|
|||
|
||||
int seamldr_get_info(struct seamldr_info *seamldr_info);
|
||||
int seamldr_install_module(const u8 *data, u32 data_len);
|
||||
void seamldr_lock_module_update(void);
|
||||
void seamldr_unlock_module_update(void);
|
||||
|
||||
#endif /* _ASM_X86_SEAMLDR_H */
|
||||
|
|
|
|||
|
|
@ -350,3 +350,19 @@ int seamldr_install_module(const u8 *data, u32 data_len)
|
|||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_FOR_MODULES(seamldr_install_module, "tdx-host");
|
||||
|
||||
/*
|
||||
* stop_machine() does not interrupt preemption-disabled regions.
|
||||
* Simply disabling preempt prevents updates.
|
||||
*/
|
||||
void seamldr_lock_module_update(void)
|
||||
{
|
||||
preempt_disable();
|
||||
}
|
||||
EXPORT_SYMBOL_FOR_MODULES(seamldr_lock_module_update, "tdx-host");
|
||||
|
||||
void seamldr_unlock_module_update(void)
|
||||
{
|
||||
preempt_enable();
|
||||
}
|
||||
EXPORT_SYMBOL_FOR_MODULES(seamldr_unlock_module_update, "tdx-host");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user