Skip to content

Commit cff59d8

Browse files
Claudio Imbrendafrankjaa
authored andcommitted
s390/uv: Panic for set and remove shared access UVC errors
The return value uv_set_shared() and uv_remove_shared() (which are wrappers around the share() function) is not always checked. The system integrity of a protected guest depends on the Share and Unshare UVCs being successful. This means that any caller that fails to check the return value will compromise the security of the protected guest. No code path that would lead to such violation of the security guarantees is currently exercised, since all the areas that are shared never get unshared during the lifetime of the system. This might change and become an issue in the future. The Share and Unshare UVCs can only fail in case of hypervisor misbehaviour (either a bug or malicious behaviour). In such cases there is no reasonable way forward, and the system needs to panic. This patch replaces the return at the end of the share() function with a panic, to guarantee system integrity. Fixes: 5abb935 ("s390/uv: introduce guest side ultravisor code") Signed-off-by: Claudio Imbrenda <[email protected]> Reviewed-by: Christian Borntraeger <[email protected]> Reviewed-by: Steffen Eiden <[email protected]> Reviewed-by: Janosch Frank <[email protected]> Link: https://lore.kernel.org/r/[email protected] Message-ID: <[email protected]> [[email protected]: Fixed up patch subject] Signed-off-by: Janosch Frank <[email protected]>
1 parent 5a44bb0 commit cff59d8

File tree

1 file changed

+4
-1
lines changed
  • arch/s390/include/asm

1 file changed

+4
-1
lines changed

arch/s390/include/asm/uv.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,10 @@ static inline int share(unsigned long addr, u16 cmd)
441441

442442
if (!uv_call(0, (u64)&uvcb))
443443
return 0;
444-
return -EINVAL;
444+
pr_err("%s UVC failed (rc: 0x%x, rrc: 0x%x), possible hypervisor bug.\n",
445+
uvcb.header.cmd == UVC_CMD_SET_SHARED_ACCESS ? "Share" : "Unshare",
446+
uvcb.header.rc, uvcb.header.rrc);
447+
panic("System security cannot be guaranteed unless the system panics now.\n");
445448
}
446449

447450
/*

0 commit comments

Comments
 (0)