public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Egorenkov <egorenar@linux.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-s390@vger.kernel.org
Subject: [PATCH AUTOSEL 4.9 08/13] s390/kasan: fix early pgm check handler execution
Date: Wed,  1 Jul 2020 21:27:07 -0400	[thread overview]
Message-ID: <20200702012712.2701986-8-sashal@kernel.org> (raw)
In-Reply-To: <20200702012712.2701986-1-sashal@kernel.org>

From: Vasily Gorbik <gor@linux.ibm.com>

[ Upstream commit 998f5bbe3dbdab81c1cfb1aef7c3892f5d24f6c7 ]

Currently if early_pgm_check_handler is called it ends up in pgm check
loop. The problem is that early_pgm_check_handler is instrumented by
KASAN but executed without DAT flag enabled which leads to addressing
exception when KASAN checks try to access shadow memory.

Fix that by executing early handlers with DAT flag on under KASAN as
expected.

Reported-and-tested-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/s390/kernel/early.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index a651c2bc94ef8..f862cc27fe98f 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -288,6 +288,8 @@ static noinline __init void setup_lowcore_early(void)
 	psw_t psw;
 
 	psw.mask = PSW_MASK_BASE | PSW_DEFAULT_KEY | PSW_MASK_EA | PSW_MASK_BA;
+	if (IS_ENABLED(CONFIG_KASAN))
+		psw.mask |= PSW_MASK_DAT;
 	psw.addr = (unsigned long) s390_base_ext_handler;
 	S390_lowcore.external_new_psw = psw;
 	psw.addr = (unsigned long) s390_base_pgm_handler;
-- 
2.25.1


  parent reply	other threads:[~2020-07-02  1:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02  1:27 [PATCH AUTOSEL 4.9 01/13] gpu: host1x: Detach driver on unregister Sasha Levin
2020-07-02  1:27 ` [PATCH AUTOSEL 4.9 02/13] net: usb: ax88179_178a: fix packet alignment padding Sasha Levin
2020-07-02  1:27 ` [PATCH AUTOSEL 4.9 03/13] usb: usbtest: fix missing kfree(dev->buf) in usbtest_disconnect Sasha Levin
2020-07-02  1:27 ` [PATCH AUTOSEL 4.9 04/13] spi: spidev: fix a race between spidev_release and spidev_remove Sasha Levin
2020-07-02  1:27 ` [PATCH AUTOSEL 4.9 05/13] spi: spidev: fix a potential use-after-free in spidev_release() Sasha Levin
2020-07-02  1:27 ` [PATCH AUTOSEL 4.9 06/13] tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes Sasha Levin
2020-07-02  1:27 ` [PATCH AUTOSEL 4.9 07/13] usbnet: smsc95xx: Fix use-after-free after removal Sasha Levin
2020-07-02  1:27 ` Sasha Levin [this message]
2020-07-02  1:27 ` [PATCH AUTOSEL 4.9 09/13] cifs: Fix double add page to memcg when cifs_readpages Sasha Levin
2020-07-02  1:27 ` [PATCH AUTOSEL 4.9 10/13] cifs: update ctime and mtime during truncate Sasha Levin
2020-07-02  1:27 ` [PATCH AUTOSEL 4.9 11/13] ARM: imx6: add missing put_device() call in imx6q_suspend_init() Sasha Levin
2020-07-02  1:27 ` [PATCH AUTOSEL 4.9 12/13] scsi: mptscsih: Fix read sense data size Sasha Levin
2020-07-02  1:27 ` [PATCH AUTOSEL 4.9 13/13] kgdb: Avoid suspicious RCU usage warning Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200702012712.2701986-8-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=egorenar@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox