xen/xsm: flask: restore sidtab state on policy load failure

Error path of failed sidtab_map() leaves global sidtab in shutdown state and
from that point system is unable to allocate new SIDs in sidtab_context_to_sid().
To restore sidtab state new function sidtab_cancel_shutdown() is introduced,
which only resets shutdown flag, rewinding effect of sidtab_shutdown().

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
Acked-by: Daniel P. Smith <dpsmith@apertussoutions.com>
This commit is contained in:
Sergiy Kibrik authored and Jan Beulich committed 2026-10-13 11:12:38 +02:00
1 parent 38eb999ba3
commit 7a058df1a4
3 files changed
+9

No files matched your search

+1
View File
@@ -1428,6 +1428,7 @@ int security_load_policy(const void *data, size_t len)
if ( sidtab_map(&sidtab, clone_sid, &newsidtab) )
{
rc = -ENOMEM;
sidtab_cancel_shutdown(&sidtab);
goto err;
}
+7
View File
@@ -320,3 +320,10 @@ void sidtab_shutdown(struct sidtab *s)
s->shutdown = 1;
SIDTAB_UNLOCK(s);
}
void sidtab_cancel_shutdown(struct sidtab *s)
{
SIDTAB_LOCK(s);
s->shutdown = 0;
SIDTAB_UNLOCK(s);
}
+1
View File
@@ -49,5 +49,6 @@ void sidtab_hash_eval(struct sidtab *h, char *tag);
void sidtab_destroy(struct sidtab *s);
void sidtab_set(struct sidtab *dst, struct sidtab *src);
void sidtab_shutdown(struct sidtab *s);
void sidtab_cancel_shutdown(struct sidtab *s);
#endif /* _SS_SIDTAB_H_ */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.