Skip to content

Commit d29899a

Browse files
committed
Merge tag 'kvm-s390-master-4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux
KVM: s390: Fixes for 4.15 - SPDX tags - Fence storage key accesses from problem state - Make sure that irq_state.flags is not used in the future
2 parents 2895db6 + ca76ec9 commit d29899a

File tree

14 files changed

+39
-57
lines changed

14 files changed

+39
-57
lines changed

Documentation/virtual/kvm/api.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2901,14 +2901,19 @@ userspace buffer and its length:
29012901

29022902
struct kvm_s390_irq_state {
29032903
__u64 buf;
2904-
__u32 flags;
2904+
__u32 flags; /* will stay unused for compatibility reasons */
29052905
__u32 len;
2906-
__u32 reserved[4];
2906+
__u32 reserved[4]; /* will stay unused for compatibility reasons */
29072907
};
29082908

29092909
Userspace passes in the above struct and for each pending interrupt a
29102910
struct kvm_s390_irq is copied to the provided buffer.
29112911

2912+
The structure contains a flags and a reserved field for future extensions. As
2913+
the kernel never checked for flags == 0 and QEMU never pre-zeroed flags and
2914+
reserved, these fields can not be used in the future without breaking
2915+
compatibility.
2916+
29122917
If -ENOBUFS is returned the buffer provided was too small and userspace
29132918
may retry with a bigger buffer.
29142919

@@ -2932,10 +2937,14 @@ containing a struct kvm_s390_irq_state:
29322937

29332938
struct kvm_s390_irq_state {
29342939
__u64 buf;
2940+
__u32 flags; /* will stay unused for compatibility reasons */
29352941
__u32 len;
2936-
__u32 pad;
2942+
__u32 reserved[4]; /* will stay unused for compatibility reasons */
29372943
};
29382944

2945+
The restrictions for flags and reserved apply as well.
2946+
(see KVM_S390_GET_IRQ_STATE)
2947+
29392948
The userspace memory referenced by buf contains a struct kvm_s390_irq
29402949
for each interrupt to be injected into the guest.
29412950
If one of the interrupts could not be injected for some reason the

arch/s390/kvm/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1+
# SPDX-License-Identifier: GPL-2.0
12
# Makefile for kernel virtual machines on s390
23
#
34
# Copyright IBM Corp. 2008
4-
#
5-
# This program is free software; you can redistribute it and/or modify
6-
# it under the terms of the GNU General Public License (version 2 only)
7-
# as published by the Free Software Foundation.
85

96
KVM := ../../../virt/kvm
107
common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/async_pf.o $(KVM)/irqchip.o $(KVM)/vfio.o

arch/s390/kvm/diag.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* handling diagnose instructions
34
*
45
* Copyright IBM Corp. 2008, 2011
56
*
6-
* This program is free software; you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License (version 2 only)
8-
* as published by the Free Software Foundation.
9-
*
107
* Author(s): Carsten Otte <[email protected]>
118
* Christian Borntraeger <[email protected]>
129
*/

arch/s390/kvm/gaccess.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
12
/*
23
* access guest memory
34
*
45
* Copyright IBM Corp. 2008, 2014
56
*
6-
* This program is free software; you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License (version 2 only)
8-
* as published by the Free Software Foundation.
9-
*
107
* Author(s): Carsten Otte <[email protected]>
118
*/
129

arch/s390/kvm/guestdbg.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* kvm guest debug support
34
*
45
* Copyright IBM Corp. 2014
56
*
6-
* This program is free software; you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License (version 2 only)
8-
* as published by the Free Software Foundation.
9-
*
107
* Author(s): David Hildenbrand <[email protected]>
118
*/
129
#include <linux/kvm_host.h>

arch/s390/kvm/intercept.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* in-kernel handling for sie intercepts
34
*
45
* Copyright IBM Corp. 2008, 2014
56
*
6-
* This program is free software; you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License (version 2 only)
8-
* as published by the Free Software Foundation.
9-
*
107
* Author(s): Carsten Otte <[email protected]>
118
* Christian Borntraeger <[email protected]>
129
*/

arch/s390/kvm/interrupt.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* handling kvm guest interrupts
34
*
45
* Copyright IBM Corp. 2008, 2015
56
*
6-
* This program is free software; you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License (version 2 only)
8-
* as published by the Free Software Foundation.
9-
*
107
* Author(s): Carsten Otte <[email protected]>
118
*/
129

arch/s390/kvm/irq.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
12
/*
23
* s390 irqchip routines
34
*
45
* Copyright IBM Corp. 2014
56
*
6-
* This program is free software; you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License (version 2 only)
8-
* as published by the Free Software Foundation.
9-
*
107
* Author(s): Cornelia Huck <[email protected]>
118
*/
129
#ifndef __KVM_IRQ_H

arch/s390/kvm/kvm-s390.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
2-
* hosting zSeries kernel virtual machines
3+
* hosting IBM Z kernel virtual machines (s390x)
34
*
4-
* Copyright IBM Corp. 2008, 2009
5-
*
6-
* This program is free software; you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License (version 2 only)
8-
* as published by the Free Software Foundation.
5+
* Copyright IBM Corp. 2008, 2017
96
*
107
* Author(s): Carsten Otte <[email protected]>
118
* Christian Borntraeger <[email protected]>
@@ -3808,6 +3805,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
38083805
r = -EINVAL;
38093806
break;
38103807
}
3808+
/* do not use irq_state.flags, it will break old QEMUs */
38113809
r = kvm_s390_set_irq_state(vcpu,
38123810
(void __user *) irq_state.buf,
38133811
irq_state.len);
@@ -3823,6 +3821,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
38233821
r = -EINVAL;
38243822
break;
38253823
}
3824+
/* do not use irq_state.flags, it will break old QEMUs */
38263825
r = kvm_s390_get_irq_state(vcpu,
38273826
(__u8 __user *) irq_state.buf,
38283827
irq_state.len);

arch/s390/kvm/kvm-s390.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
12
/*
23
* definition for kvm on s390
34
*
45
* Copyright IBM Corp. 2008, 2009
56
*
6-
* This program is free software; you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License (version 2 only)
8-
* as published by the Free Software Foundation.
9-
*
107
* Author(s): Carsten Otte <[email protected]>
118
* Christian Borntraeger <[email protected]>
129
* Christian Ehrhardt <[email protected]>

0 commit comments

Comments
 (0)