]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
s390: disable preemption when switching to nodat stack with CALL_ON_STACK
authorVasily Gorbik <gor@linux.ibm.com>
Fri, 22 Nov 2019 11:19:16 +0000 (12:19 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 05:05:10 +0000 (00:05 -0500)
BugLink: https://bugs.launchpad.net/bugs/1860816
[ Upstream commit 7f28dad395243c5026d649136823bbc40029a828 ]

Make sure preemption is disabled when temporary switching to nodat
stack with CALL_ON_STACK helper, because nodat stack is per cpu.

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/s390/kernel/machine_kexec.c
arch/s390/mm/maccess.c

index d402ced7f7c38e100226eb2b5df323d037b1ea07..cb8b1cc285c9612d695154e1bd3d89fd259ebf98 100644 (file)
@@ -164,7 +164,9 @@ static bool kdump_csum_valid(struct kimage *image)
 #ifdef CONFIG_CRASH_DUMP
        int rc;
 
+       preempt_disable();
        rc = CALL_ON_STACK(do_start_kdump, S390_lowcore.nodat_stack, 1, image);
+       preempt_enable();
        return rc == 0;
 #else
        return false;
index 59ad7997fed1647692db7079a52c0f0d8efdc363..de7ca4b6718f1a66ab449fc08609826b062df94d 100644 (file)
@@ -119,9 +119,15 @@ static unsigned long __no_sanitize_address _memcpy_real(unsigned long dest,
  */
 int memcpy_real(void *dest, void *src, size_t count)
 {
-       if (S390_lowcore.nodat_stack != 0)
-               return CALL_ON_STACK(_memcpy_real, S390_lowcore.nodat_stack,
-                                    3, dest, src, count);
+       int rc;
+
+       if (S390_lowcore.nodat_stack != 0) {
+               preempt_disable();
+               rc = CALL_ON_STACK(_memcpy_real, S390_lowcore.nodat_stack, 3,
+                                  dest, src, count);
+               preempt_enable();
+               return rc;
+       }
        /*
         * This is a really early memcpy_real call, the stacks are
         * not set up yet. Just call _memcpy_real on the early boot