Skip to content
Snippets Groups Projects
Commit 9814fed0 authored by Alexander Graf's avatar Alexander Graf
Browse files

target-s390x: Only access allocated storage keys


We allocate ram_size / PAGE_SIZE storage keys, so we need to make sure that
we only access that many. Unfortunately the code can overrun this array by
one, potentially overwriting unrelated memory.

Fix it by limiting storage keys to their scope.

Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
Reviewed-by: default avatarAurelien Jarno <aurelien@aurel32.net>
parent 068593de
No related branches found
No related tags found
No related merge requests found
......@@ -358,7 +358,7 @@ int mmu_translate(CPUS390XState *env, target_ulong vaddr, int rw, uint64_t asc,
/* Convert real address -> absolute address */
*raddr = mmu_real2abs(env, *raddr);
if (*raddr <= ram_size) {
if (*raddr < ram_size) {
sk = &env->storage_keys[*raddr / TARGET_PAGE_SIZE];
if (*flags & PAGE_READ) {
*sk |= SK_R;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment