All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] s390x: pv: Fixes and improvements
@ 2020-09-07 12:46 Janosch Frank
  2020-09-07 12:46 ` [PATCH v2 1/2] s390x: uv: Add destroy page call Janosch Frank
  2020-09-07 12:47 ` [PATCH v2 2/2] s390x: Add 3f program exception handler Janosch Frank
  0 siblings, 2 replies; 15+ messages in thread
From: Janosch Frank @ 2020-09-07 12:46 UTC (permalink / raw)
  To: linux-s390; +Cc: borntraeger, gor, imbrenda, kvm, david, hca

Using the destroy call instead of the export on a VM shutdown, we can
clear out a protected guest much faster.

The 3f exception can in fact be triggered by userspace and therefore
should not panic the whole system, but send a SIGSEGV to the culprit
process.

v2:
	* Removed whitespace damage
	* Directly access task struct for pid and comm
	* Removed NOKPROBE_SYMBOL

Janosch Frank (2):
  s390x: uv: Add destroy page call
  s390x: Add 3f program exception handler

 arch/s390/include/asm/uv.h   |  7 +++++++
 arch/s390/kernel/pgm_check.S |  2 +-
 arch/s390/kernel/uv.c        | 20 ++++++++++++++++++++
 arch/s390/mm/fault.c         | 20 ++++++++++++++++++++
 arch/s390/mm/gmap.c          |  2 +-
 5 files changed, 49 insertions(+), 2 deletions(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2 1/2] s390x: uv: Add destroy page call
  2020-09-07 12:46 [PATCH v2 0/2] s390x: pv: Fixes and improvements Janosch Frank
@ 2020-09-07 12:46 ` Janosch Frank
  2020-09-07 17:59   ` Thomas Huth
  2020-09-08  6:28   ` Cornelia Huck
  2020-09-07 12:47 ` [PATCH v2 2/2] s390x: Add 3f program exception handler Janosch Frank
  1 sibling, 2 replies; 15+ messages in thread
From: Janosch Frank @ 2020-09-07 12:46 UTC (permalink / raw)
  To: linux-s390; +Cc: borntraeger, gor, imbrenda, kvm, david, hca

We don't need to export pages if we destroy the VM configuration
afterwards anyway. Instead we can destroy the page which will zero it
and then make it accessible to the host.

Destroying is about twice as fast as the export.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 arch/s390/include/asm/uv.h |  7 +++++++
 arch/s390/kernel/uv.c      | 20 ++++++++++++++++++++
 arch/s390/mm/gmap.c        |  2 +-
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/s390/include/asm/uv.h b/arch/s390/include/asm/uv.h
index cff4b4c99b75..0325fc0469b7 100644
--- a/arch/s390/include/asm/uv.h
+++ b/arch/s390/include/asm/uv.h
@@ -33,6 +33,7 @@
 #define UVC_CMD_DESTROY_SEC_CPU		0x0121
 #define UVC_CMD_CONV_TO_SEC_STOR	0x0200
 #define UVC_CMD_CONV_FROM_SEC_STOR	0x0201
+#define UVC_CMD_DESTR_SEC_STOR		0x0202
 #define UVC_CMD_SET_SEC_CONF_PARAMS	0x0300
 #define UVC_CMD_UNPACK_IMG		0x0301
 #define UVC_CMD_VERIFY_IMG		0x0302
@@ -344,6 +345,7 @@ static inline int is_prot_virt_host(void)
 }
 
 int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb);
+int uv_destroy_page(unsigned long paddr);
 int uv_convert_from_secure(unsigned long paddr);
 int gmap_convert_to_secure(struct gmap *gmap, unsigned long gaddr);
 
@@ -354,6 +356,11 @@ void adjust_to_uv_max(unsigned long *vmax);
 static inline void setup_uv(void) {}
 static inline void adjust_to_uv_max(unsigned long *vmax) {}
 
+static inline int uv_destroy_page(unsigned long paddr)
+{
+	return 0;
+}
+
 static inline int uv_convert_from_secure(unsigned long paddr)
 {
 	return 0;
diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c
index c296e5c8dbf9..d3399b8a9b23 100644
--- a/arch/s390/kernel/uv.c
+++ b/arch/s390/kernel/uv.c
@@ -118,6 +118,26 @@ static int uv_pin_shared(unsigned long paddr)
 	return 0;
 }
 
+/*
+ * Requests the Ultravisor to destroy a guest page and make it
+ * accessible to the host. The destroy clears the page instead of
+ * exporting.
+ *
+ * @paddr: Absolute host address of page to be destroyed
+ */
+int uv_destroy_page(unsigned long paddr)
+{
+	struct uv_cb_cfs uvcb = {
+		.header.cmd = UVC_CMD_DESTR_SEC_STOR,
+		.header.len = sizeof(uvcb),
+		.paddr = paddr
+	};
+
+	if (uv_call(0, (u64)&uvcb))
+		return -EINVAL;
+	return 0;
+}
+
 /*
  * Requests the Ultravisor to encrypt a guest page and make it
  * accessible to the host for paging (export).
diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
index 373542ca1113..cfb0017f33a7 100644
--- a/arch/s390/mm/gmap.c
+++ b/arch/s390/mm/gmap.c
@@ -2679,7 +2679,7 @@ static int __s390_reset_acc(pte_t *ptep, unsigned long addr,
 	pte_t pte = READ_ONCE(*ptep);
 
 	if (pte_present(pte))
-		WARN_ON_ONCE(uv_convert_from_secure(pte_val(pte) & PAGE_MASK));
+		WARN_ON_ONCE(uv_destroy_page(pte_val(pte) & PAGE_MASK));
 	return 0;
 }
 
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 2/2] s390x: Add 3f program exception handler
  2020-09-07 12:46 [PATCH v2 0/2] s390x: pv: Fixes and improvements Janosch Frank
  2020-09-07 12:46 ` [PATCH v2 1/2] s390x: uv: Add destroy page call Janosch Frank
@ 2020-09-07 12:47 ` Janosch Frank
  2020-09-07 21:56   ` kernel test robot
                     ` (2 more replies)
  1 sibling, 3 replies; 15+ messages in thread
From: Janosch Frank @ 2020-09-07 12:47 UTC (permalink / raw)
  To: linux-s390; +Cc: borntraeger, gor, imbrenda, kvm, david, hca

Program exception 3f (secure storage violation) can only be detected
when the CPU is running in SIE with a format 4 state description,
e.g. running a protected guest. Because of this and because user
space partly controls the guest memory mapping and can trigger this
exception, we want to send a SIGSEGV to the process running the guest
and not panic the kernel.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
CC: <stable@vger.kernel.org> # 5.7+
Fixes: 084ea4d611a3 ("s390/mm: add (non)secure page access exceptions handlers")
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kernel/pgm_check.S |  2 +-
 arch/s390/mm/fault.c         | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kernel/pgm_check.S b/arch/s390/kernel/pgm_check.S
index 2c27907a5ffc..9a92638360ee 100644
--- a/arch/s390/kernel/pgm_check.S
+++ b/arch/s390/kernel/pgm_check.S
@@ -80,7 +80,7 @@ PGM_CHECK(do_dat_exception)		/* 3b */
 PGM_CHECK_DEFAULT			/* 3c */
 PGM_CHECK(do_secure_storage_access)	/* 3d */
 PGM_CHECK(do_non_secure_storage_access)	/* 3e */
-PGM_CHECK_DEFAULT			/* 3f */
+PGM_CHECK(do_secure_storage_violation)	/* 3f */
 PGM_CHECK(monitor_event_exception)	/* 40 */
 PGM_CHECK_DEFAULT			/* 41 */
 PGM_CHECK_DEFAULT			/* 42 */
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 4c8c063bce5b..996884dcc9fd 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -859,6 +859,21 @@ void do_non_secure_storage_access(struct pt_regs *regs)
 }
 NOKPROBE_SYMBOL(do_non_secure_storage_access);
 
+void do_secure_storage_violation(struct pt_regs *regs)
+{
+	/*
+	 * Either KVM messed up the secure guest mapping or the same
+	 * page is mapped into multiple secure guests.
+	 *
+	 * This exception is only triggered when a guest 2 is running
+	 * and can therefore never occur in kernel context.
+	 */
+	printk_ratelimited(KERN_WARNING
+			   "Secure storage violation in task: %s, pid %d\n",
+			   current->comm, current->pid);
+	send_sig(SIGSEGV, current, 0);
+}
+
 #else
 void do_secure_storage_access(struct pt_regs *regs)
 {
@@ -869,4 +884,9 @@ void do_non_secure_storage_access(struct pt_regs *regs)
 {
 	default_trap_handler(regs);
 }
+
+void do_secure_storage_violation(struct pt_regs *regs)
+{
+	default_trap_handler(regs);
+}
 #endif
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/2] s390x: uv: Add destroy page call
  2020-09-07 12:46 ` [PATCH v2 1/2] s390x: uv: Add destroy page call Janosch Frank
@ 2020-09-07 17:59   ` Thomas Huth
  2020-09-08  6:28   ` Cornelia Huck
  1 sibling, 0 replies; 15+ messages in thread
From: Thomas Huth @ 2020-09-07 17:59 UTC (permalink / raw)
  To: Janosch Frank, linux-s390; +Cc: borntraeger, gor, imbrenda, kvm, david, hca

On 07/09/2020 14.46, Janosch Frank wrote:
> We don't need to export pages if we destroy the VM configuration
> afterwards anyway. Instead we can destroy the page which will zero it
> and then make it accessible to the host.
> 
> Destroying is about twice as fast as the export.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  arch/s390/include/asm/uv.h |  7 +++++++
>  arch/s390/kernel/uv.c      | 20 ++++++++++++++++++++
>  arch/s390/mm/gmap.c        |  2 +-
>  3 files changed, 28 insertions(+), 1 deletion(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/2] s390x: Add 3f program exception handler
  2020-09-07 12:47 ` [PATCH v2 2/2] s390x: Add 3f program exception handler Janosch Frank
@ 2020-09-07 21:56   ` kernel test robot
  2020-09-08  7:53     ` Heiko Carstens
  2020-09-08  6:39   ` [PATCH v2 2/2] " Cornelia Huck
  2020-09-08  7:58     ` kernel test robot
  2 siblings, 1 reply; 15+ messages in thread
From: kernel test robot @ 2020-09-07 21:56 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2421 bytes --]

Hi Janosch,

I love your patch! Perhaps something to improve:

[auto build test WARNING on s390/features]
[also build test WARNING on kvms390/next v5.9-rc4 next-20200903]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Janosch-Frank/s390x-pv-Fixes-and-improvements/20200908-021233
base:   https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
config: s390-allyesconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> arch/s390/mm/fault.c:862:6: warning: no previous prototype for 'do_secure_storage_violation' [-Wmissing-prototypes]
     862 | void do_secure_storage_violation(struct pt_regs *regs)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~

# https://github.com/0day-ci/linux/commit/4aee662164217d48d050e0d9cf57a2cb2cdeaa8a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Janosch-Frank/s390x-pv-Fixes-and-improvements/20200908-021233
git checkout 4aee662164217d48d050e0d9cf57a2cb2cdeaa8a
vim +/do_secure_storage_violation +862 arch/s390/mm/fault.c

   861	
 > 862	void do_secure_storage_violation(struct pt_regs *regs)
   863	{
   864		/*
   865		 * Either KVM messed up the secure guest mapping or the same
   866		 * page is mapped into multiple secure guests.
   867		 *
   868		 * This exception is only triggered when a guest 2 is running
   869		 * and can therefore never occur in kernel context.
   870		 */
   871		printk_ratelimited(KERN_WARNING
   872				   "Secure storage violation in task: %s, pid %d\n",
   873				   current->comm, current->pid);
   874		send_sig(SIGSEGV, current, 0);
   875	}
   876	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 63257 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/2] s390x: uv: Add destroy page call
  2020-09-07 12:46 ` [PATCH v2 1/2] s390x: uv: Add destroy page call Janosch Frank
  2020-09-07 17:59   ` Thomas Huth
@ 2020-09-08  6:28   ` Cornelia Huck
  1 sibling, 0 replies; 15+ messages in thread
From: Cornelia Huck @ 2020-09-08  6:28 UTC (permalink / raw)
  To: Janosch Frank; +Cc: linux-s390, borntraeger, gor, imbrenda, kvm, david, hca

On Mon,  7 Sep 2020 08:46:59 -0400
Janosch Frank <frankja@linux.ibm.com> wrote:

> We don't need to export pages if we destroy the VM configuration
> afterwards anyway. Instead we can destroy the page which will zero it
> and then make it accessible to the host.
> 
> Destroying is about twice as fast as the export.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  arch/s390/include/asm/uv.h |  7 +++++++
>  arch/s390/kernel/uv.c      | 20 ++++++++++++++++++++
>  arch/s390/mm/gmap.c        |  2 +-
>  3 files changed, 28 insertions(+), 1 deletion(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/2] s390x: Add 3f program exception handler
  2020-09-07 12:47 ` [PATCH v2 2/2] s390x: Add 3f program exception handler Janosch Frank
  2020-09-07 21:56   ` kernel test robot
@ 2020-09-08  6:39   ` Cornelia Huck
  2020-09-08  7:58     ` kernel test robot
  2 siblings, 0 replies; 15+ messages in thread
From: Cornelia Huck @ 2020-09-08  6:39 UTC (permalink / raw)
  To: Janosch Frank; +Cc: linux-s390, borntraeger, gor, imbrenda, kvm, david, hca

On Mon,  7 Sep 2020 08:47:00 -0400
Janosch Frank <frankja@linux.ibm.com> wrote:

> Program exception 3f (secure storage violation) can only be detected
> when the CPU is running in SIE with a format 4 state description,
> e.g. running a protected guest. Because of this and because user
> space partly controls the guest memory mapping and can trigger this
> exception, we want to send a SIGSEGV to the process running the guest
> and not panic the kernel.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> CC: <stable@vger.kernel.org> # 5.7+
> Fixes: 084ea4d611a3 ("s390/mm: add (non)secure page access exceptions handlers")
> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  arch/s390/kernel/pgm_check.S |  2 +-
>  arch/s390/mm/fault.c         | 20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+), 1 deletion(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/2] s390x: Add 3f program exception handler
  2020-09-07 21:56   ` kernel test robot
@ 2020-09-08  7:53     ` Heiko Carstens
  2020-09-08 13:05       ` [PATCH v3] " Janosch Frank
  0 siblings, 1 reply; 15+ messages in thread
From: Heiko Carstens @ 2020-09-08  7:53 UTC (permalink / raw)
  To: Janosch Frank
  Cc: linux-s390, kbuild-all, borntraeger, gor, imbrenda, kvm, david

Hi Janosch,

On Tue, Sep 08, 2020 at 05:56:19AM +0800, kernel test robot wrote:
> All warnings (new ones prefixed by >>):
> 
> >> arch/s390/mm/fault.c:862:6: warning: no previous prototype for 'do_secure_storage_violation' [-Wmissing-prototypes]
>      862 | void do_secure_storage_violation(struct pt_regs *regs)
>          |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> # https://github.com/0day-ci/linux/commit/4aee662164217d48d050e0d9cf57a2cb2cdeaa8a
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review Janosch-Frank/s390x-pv-Fixes-and-improvements/20200908-021233
> git checkout 4aee662164217d48d050e0d9cf57a2cb2cdeaa8a
> vim +/do_secure_storage_violation +862 arch/s390/mm/fault.c
> 
>    861	
>  > 862	void do_secure_storage_violation(struct pt_regs *regs)

To get rid of this warning, please add the function prototype to
arch/s390/kernel/entry.h. Like we have them for all other program
check handlers for this reason as well.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/2] s390x: Add 3f program exception handler
  2020-09-07 12:47 ` [PATCH v2 2/2] s390x: Add 3f program exception handler Janosch Frank
@ 2020-09-08  7:58     ` kernel test robot
  2020-09-08  6:39   ` [PATCH v2 2/2] " Cornelia Huck
  2020-09-08  7:58     ` kernel test robot
  2 siblings, 0 replies; 15+ messages in thread
From: kernel test robot @ 2020-09-08  7:58 UTC (permalink / raw)
  To: Janosch Frank, linux-s390
  Cc: kbuild-all, clang-built-linux, borntraeger, gor, imbrenda, kvm,
	david, hca

[-- Attachment #1: Type: text/plain, Size: 9651 bytes --]

Hi Janosch,

I love your patch! Perhaps something to improve:

[auto build test WARNING on s390/features]
[also build test WARNING on v5.9-rc4 next-20200903]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Janosch-Frank/s390x-pv-Fixes-and-improvements/20200908-021233
base:   https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
config: s390-randconfig-r032-20200908 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5f5a0bb0872a9673bad08b38bc0b14c42263902a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:20:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |            \
                     ^
   In file included from arch/s390/mm/fault.c:35:
   In file included from arch/s390/include/asm/diag.h:12:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:21:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |            \
                     ^
   In file included from arch/s390/mm/fault.c:35:
   In file included from arch/s390/include/asm/diag.h:12:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:22:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
                     ^
   In file included from arch/s390/mm/fault.c:35:
   In file included from arch/s390/include/asm/diag.h:12:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:120:12: note: expanded from macro '__swab32'
           __fswab32(x))
                     ^
   In file included from arch/s390/mm/fault.c:35:
   In file included from arch/s390/include/asm/diag.h:12:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> arch/s390/mm/fault.c:862:6: warning: no previous prototype for function 'do_secure_storage_violation' [-Wmissing-prototypes]
   void do_secure_storage_violation(struct pt_regs *regs)
        ^
   arch/s390/mm/fault.c:862:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void do_secure_storage_violation(struct pt_regs *regs)
   ^
   static 
   21 warnings generated.

# https://github.com/0day-ci/linux/commit/4aee662164217d48d050e0d9cf57a2cb2cdeaa8a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Janosch-Frank/s390x-pv-Fixes-and-improvements/20200908-021233
git checkout 4aee662164217d48d050e0d9cf57a2cb2cdeaa8a
vim +/do_secure_storage_violation +862 arch/s390/mm/fault.c

   861	
 > 862	void do_secure_storage_violation(struct pt_regs *regs)
   863	{
   864		/*
   865		 * Either KVM messed up the secure guest mapping or the same
   866		 * page is mapped into multiple secure guests.
   867		 *
   868		 * This exception is only triggered when a guest 2 is running
   869		 * and can therefore never occur in kernel context.
   870		 */
   871		printk_ratelimited(KERN_WARNING
   872				   "Secure storage violation in task: %s, pid %d\n",
   873				   current->comm, current->pid);
   874		send_sig(SIGSEGV, current, 0);
   875	}
   876	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 24064 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/2] s390x: Add 3f program exception handler
@ 2020-09-08  7:58     ` kernel test robot
  0 siblings, 0 replies; 15+ messages in thread
From: kernel test robot @ 2020-09-08  7:58 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 9815 bytes --]

Hi Janosch,

I love your patch! Perhaps something to improve:

[auto build test WARNING on s390/features]
[also build test WARNING on v5.9-rc4 next-20200903]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Janosch-Frank/s390x-pv-Fixes-and-improvements/20200908-021233
base:   https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
config: s390-randconfig-r032-20200908 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5f5a0bb0872a9673bad08b38bc0b14c42263902a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:20:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |            \
                     ^
   In file included from arch/s390/mm/fault.c:35:
   In file included from arch/s390/include/asm/diag.h:12:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:21:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |            \
                     ^
   In file included from arch/s390/mm/fault.c:35:
   In file included from arch/s390/include/asm/diag.h:12:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:22:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
                     ^
   In file included from arch/s390/mm/fault.c:35:
   In file included from arch/s390/include/asm/diag.h:12:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:120:12: note: expanded from macro '__swab32'
           __fswab32(x))
                     ^
   In file included from arch/s390/mm/fault.c:35:
   In file included from arch/s390/include/asm/diag.h:12:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> arch/s390/mm/fault.c:862:6: warning: no previous prototype for function 'do_secure_storage_violation' [-Wmissing-prototypes]
   void do_secure_storage_violation(struct pt_regs *regs)
        ^
   arch/s390/mm/fault.c:862:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void do_secure_storage_violation(struct pt_regs *regs)
   ^
   static 
   21 warnings generated.

# https://github.com/0day-ci/linux/commit/4aee662164217d48d050e0d9cf57a2cb2cdeaa8a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Janosch-Frank/s390x-pv-Fixes-and-improvements/20200908-021233
git checkout 4aee662164217d48d050e0d9cf57a2cb2cdeaa8a
vim +/do_secure_storage_violation +862 arch/s390/mm/fault.c

   861	
 > 862	void do_secure_storage_violation(struct pt_regs *regs)
   863	{
   864		/*
   865		 * Either KVM messed up the secure guest mapping or the same
   866		 * page is mapped into multiple secure guests.
   867		 *
   868		 * This exception is only triggered when a guest 2 is running
   869		 * and can therefore never occur in kernel context.
   870		 */
   871		printk_ratelimited(KERN_WARNING
   872				   "Secure storage violation in task: %s, pid %d\n",
   873				   current->comm, current->pid);
   874		send_sig(SIGSEGV, current, 0);
   875	}
   876	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 24064 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v3] s390x: Add 3f program exception handler
  2020-09-08  7:53     ` Heiko Carstens
@ 2020-09-08 13:05       ` Janosch Frank
  2020-09-08 13:06         ` Heiko Carstens
  0 siblings, 1 reply; 15+ messages in thread
From: Janosch Frank @ 2020-09-08 13:05 UTC (permalink / raw)
  To: linux-s390; +Cc: borntraeger, gor, imbrenda, kvm, david, hca, cohuck, thuth

Program exception 3f (secure storage violation) can only be detected
when the CPU is running in SIE with a format 4 state description,
e.g. running a protected guest. Because of this and because user
space partly controls the guest memory mapping and can trigger this
exception, we want to send a SIGSEGV to the process running the guest
and not panic the kernel.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
CC: <stable@vger.kernel.org> # 5.7+
Fixes: 084ea4d611a3 ("s390/mm: add (non)secure page access exceptions handlers")
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kernel/entry.h     |  1 +
 arch/s390/kernel/pgm_check.S |  2 +-
 arch/s390/mm/fault.c         | 20 ++++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index faca269d5f27..a44ddc2f2dec 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -26,6 +26,7 @@ void do_protection_exception(struct pt_regs *regs);
 void do_dat_exception(struct pt_regs *regs);
 void do_secure_storage_access(struct pt_regs *regs);
 void do_non_secure_storage_access(struct pt_regs *regs);
+void do_secure_storage_violation(struct pt_regs *regs);
 
 void addressing_exception(struct pt_regs *regs);
 void data_exception(struct pt_regs *regs);
diff --git a/arch/s390/kernel/pgm_check.S b/arch/s390/kernel/pgm_check.S
index 2c27907a5ffc..9a92638360ee 100644
--- a/arch/s390/kernel/pgm_check.S
+++ b/arch/s390/kernel/pgm_check.S
@@ -80,7 +80,7 @@ PGM_CHECK(do_dat_exception)		/* 3b */
 PGM_CHECK_DEFAULT			/* 3c */
 PGM_CHECK(do_secure_storage_access)	/* 3d */
 PGM_CHECK(do_non_secure_storage_access)	/* 3e */
-PGM_CHECK_DEFAULT			/* 3f */
+PGM_CHECK(do_secure_storage_violation)	/* 3f */
 PGM_CHECK(monitor_event_exception)	/* 40 */
 PGM_CHECK_DEFAULT			/* 41 */
 PGM_CHECK_DEFAULT			/* 42 */
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 4c8c063bce5b..996884dcc9fd 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -859,6 +859,21 @@ void do_non_secure_storage_access(struct pt_regs *regs)
 }
 NOKPROBE_SYMBOL(do_non_secure_storage_access);
 
+void do_secure_storage_violation(struct pt_regs *regs)
+{
+	/*
+	 * Either KVM messed up the secure guest mapping or the same
+	 * page is mapped into multiple secure guests.
+	 *
+	 * This exception is only triggered when a guest 2 is running
+	 * and can therefore never occur in kernel context.
+	 */
+	printk_ratelimited(KERN_WARNING
+			   "Secure storage violation in task: %s, pid %d\n",
+			   current->comm, current->pid);
+	send_sig(SIGSEGV, current, 0);
+}
+
 #else
 void do_secure_storage_access(struct pt_regs *regs)
 {
@@ -869,4 +884,9 @@ void do_non_secure_storage_access(struct pt_regs *regs)
 {
 	default_trap_handler(regs);
 }
+
+void do_secure_storage_violation(struct pt_regs *regs)
+{
+	default_trap_handler(regs);
+}
 #endif
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v3] s390x: Add 3f program exception handler
  2020-09-08 13:05       ` [PATCH v3] " Janosch Frank
@ 2020-09-08 13:06         ` Heiko Carstens
  2020-09-08 13:09           ` Janosch Frank
  2020-09-08 13:10           ` Christian Borntraeger
  0 siblings, 2 replies; 15+ messages in thread
From: Heiko Carstens @ 2020-09-08 13:06 UTC (permalink / raw)
  To: Janosch Frank
  Cc: linux-s390, borntraeger, gor, imbrenda, kvm, david, cohuck, thuth

On Tue, Sep 08, 2020 at 09:05:04AM -0400, Janosch Frank wrote:
> Program exception 3f (secure storage violation) can only be detected
> when the CPU is running in SIE with a format 4 state description,
> e.g. running a protected guest. Because of this and because user
> space partly controls the guest memory mapping and can trigger this
> exception, we want to send a SIGSEGV to the process running the guest
> and not panic the kernel.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> CC: <stable@vger.kernel.org> # 5.7+
> Fixes: 084ea4d611a3 ("s390/mm: add (non)secure page access exceptions handlers")
> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  arch/s390/kernel/entry.h     |  1 +
>  arch/s390/kernel/pgm_check.S |  2 +-
>  arch/s390/mm/fault.c         | 20 ++++++++++++++++++++
>  3 files changed, 22 insertions(+), 1 deletion(-)

I guess this should go upstream via the s390 tree?
Should I pick this up?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3] s390x: Add 3f program exception handler
  2020-09-08 13:06         ` Heiko Carstens
@ 2020-09-08 13:09           ` Janosch Frank
  2020-09-08 13:18             ` Heiko Carstens
  2020-09-08 13:10           ` Christian Borntraeger
  1 sibling, 1 reply; 15+ messages in thread
From: Janosch Frank @ 2020-09-08 13:09 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: linux-s390, borntraeger, gor, imbrenda, kvm, david, cohuck, thuth


[-- Attachment #1.1: Type: text/plain, Size: 1349 bytes --]

On 9/8/20 3:06 PM, Heiko Carstens wrote:
> On Tue, Sep 08, 2020 at 09:05:04AM -0400, Janosch Frank wrote:
>> Program exception 3f (secure storage violation) can only be detected
>> when the CPU is running in SIE with a format 4 state description,
>> e.g. running a protected guest. Because of this and because user
>> space partly controls the guest memory mapping and can trigger this
>> exception, we want to send a SIGSEGV to the process running the guest
>> and not panic the kernel.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> CC: <stable@vger.kernel.org> # 5.7+
>> Fixes: 084ea4d611a3 ("s390/mm: add (non)secure page access exceptions handlers")
>> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
>> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
>> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>>  arch/s390/kernel/entry.h     |  1 +
>>  arch/s390/kernel/pgm_check.S |  2 +-
>>  arch/s390/mm/fault.c         | 20 ++++++++++++++++++++
>>  3 files changed, 22 insertions(+), 1 deletion(-)
> 
> I guess this should go upstream via the s390 tree?

Christian asked the exact same question.
I think we picked the secure/non-secure exception handlers via the s390
tree so bringing these in via s390 would be in line with that.

> Should I pick this up?

That would be nice


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3] s390x: Add 3f program exception handler
  2020-09-08 13:06         ` Heiko Carstens
  2020-09-08 13:09           ` Janosch Frank
@ 2020-09-08 13:10           ` Christian Borntraeger
  1 sibling, 0 replies; 15+ messages in thread
From: Christian Borntraeger @ 2020-09-08 13:10 UTC (permalink / raw)
  To: Heiko Carstens, Janosch Frank
  Cc: linux-s390, gor, imbrenda, kvm, david, cohuck, thuth



On 08.09.20 15:06, Heiko Carstens wrote:
> On Tue, Sep 08, 2020 at 09:05:04AM -0400, Janosch Frank wrote:
>> Program exception 3f (secure storage violation) can only be detected
>> when the CPU is running in SIE with a format 4 state description,
>> e.g. running a protected guest. Because of this and because user
>> space partly controls the guest memory mapping and can trigger this
>> exception, we want to send a SIGSEGV to the process running the guest
>> and not panic the kernel.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> CC: <stable@vger.kernel.org> # 5.7+
>> Fixes: 084ea4d611a3 ("s390/mm: add (non)secure page access exceptions handlers")
>> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
>> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
>> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>>  arch/s390/kernel/entry.h     |  1 +
>>  arch/s390/kernel/pgm_check.S |  2 +-
>>  arch/s390/mm/fault.c         | 20 ++++++++++++++++++++
>>  3 files changed, 22 insertions(+), 1 deletion(-)
> 
> I guess this should go upstream via the s390 tree?
> Should I pick this up?
> 

Yes please. 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3] s390x: Add 3f program exception handler
  2020-09-08 13:09           ` Janosch Frank
@ 2020-09-08 13:18             ` Heiko Carstens
  0 siblings, 0 replies; 15+ messages in thread
From: Heiko Carstens @ 2020-09-08 13:18 UTC (permalink / raw)
  To: Janosch Frank
  Cc: linux-s390, borntraeger, gor, imbrenda, kvm, david, cohuck, thuth

On Tue, Sep 08, 2020 at 03:09:23PM +0200, Janosch Frank wrote:
> On 9/8/20 3:06 PM, Heiko Carstens wrote:
> > On Tue, Sep 08, 2020 at 09:05:04AM -0400, Janosch Frank wrote:
> >> Program exception 3f (secure storage violation) can only be detected
> >> when the CPU is running in SIE with a format 4 state description,
> >> e.g. running a protected guest. Because of this and because user
> >> space partly controls the guest memory mapping and can trigger this
> >> exception, we want to send a SIGSEGV to the process running the guest
> >> and not panic the kernel.
> >>
> >> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> >> CC: <stable@vger.kernel.org> # 5.7+
> >> Fixes: 084ea4d611a3 ("s390/mm: add (non)secure page access exceptions handlers")
> >> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> >> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> >> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
> >> ---
> >>  arch/s390/kernel/entry.h     |  1 +
> >>  arch/s390/kernel/pgm_check.S |  2 +-
> >>  arch/s390/mm/fault.c         | 20 ++++++++++++++++++++
> >>  3 files changed, 22 insertions(+), 1 deletion(-)
> > 
> > I guess this should go upstream via the s390 tree?
> 
> Christian asked the exact same question.
> I think we picked the secure/non-secure exception handlers via the s390
> tree so bringing these in via s390 would be in line with that.
> 
> > Should I pick this up?
> 
> That would be nice

Done.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-09-08 16:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 12:46 [PATCH v2 0/2] s390x: pv: Fixes and improvements Janosch Frank
2020-09-07 12:46 ` [PATCH v2 1/2] s390x: uv: Add destroy page call Janosch Frank
2020-09-07 17:59   ` Thomas Huth
2020-09-08  6:28   ` Cornelia Huck
2020-09-07 12:47 ` [PATCH v2 2/2] s390x: Add 3f program exception handler Janosch Frank
2020-09-07 21:56   ` kernel test robot
2020-09-08  7:53     ` Heiko Carstens
2020-09-08 13:05       ` [PATCH v3] " Janosch Frank
2020-09-08 13:06         ` Heiko Carstens
2020-09-08 13:09           ` Janosch Frank
2020-09-08 13:18             ` Heiko Carstens
2020-09-08 13:10           ` Christian Borntraeger
2020-09-08  6:39   ` [PATCH v2 2/2] " Cornelia Huck
2020-09-08  7:58   ` kernel test robot
2020-09-08  7:58     ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.