Skip to content

Commit d111855

Browse files
svens-s390Alexander Gordeev
authored andcommitted
s390/mm: Fix NULL pointer dereference
The recently added check to figure out if a fault happened on gmap ASCE dereferences the gmap pointer in lowcore without checking that it is not NULL. For all non-KVM processes the pointer is NULL, so that some value from lowcore will be read. With the current layouts of struct gmap and struct lowcore the read value (aka ASCE) is zero, so that this doesn't lead to any observable bug; at least currently. Fix this by adding the missing NULL pointer check. Fixes: 64c3431 ("s390/entry: compare gmap asce to determine guest/host fault") Signed-off-by: Sven Schnelle <[email protected]> Reviewed-by: Claudio Imbrenda <[email protected]> Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 6f76592 commit d111855

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/s390/kernel/entry.S

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ SYM_CODE_START(pgm_check_handler)
340340
mvc __PT_LAST_BREAK(8,%r11),__LC_PGM_LAST_BREAK
341341
stctg %c1,%c1,__PT_CR1(%r11)
342342
#if IS_ENABLED(CONFIG_KVM)
343-
lg %r12,__LC_GMAP
343+
ltg %r12,__LC_GMAP
344+
jz 5f
344345
clc __GMAP_ASCE(8,%r12), __PT_CR1(%r11)
345346
jne 5f
346347
BPENTER __SF_SIE_FLAGS(%r10),_TIF_ISOLATE_BP_GUEST

0 commit comments

Comments
 (0)