Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9090809pxu; Mon, 28 Dec 2020 06:24:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJyEU6ILPQRL8gFk2coPz1oobWvPpiSaq2PwRN6RuoWQDy9N9kKIIZBL5prW7L6kkutCwa4h X-Received: by 2002:aa7:d3d4:: with SMTP id o20mr42125732edr.190.1609165486788; Mon, 28 Dec 2020 06:24:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165486; cv=none; d=google.com; s=arc-20160816; b=OTfZjp1G/8wHuOrnl4IbXlg9LO9K5RYAlMaZqfTeodqg+kk7eFPomT5sgciHnbHSKg 3LuGEQMq13Zp4V7zCUsa+FdshhzsDZoJnS874CdB6SdD9g5lhAIWvF5xPxFkJhNUtuve zS134uD6jL94rAdtfGK0aFqXQNcGl+3x6mXSmvz4zaC+p+LuKQp99XT/Lon/ZgNDLAel kB6iw8OgCTj9EQiTFKZClCn0V9pCNU7EUJrhqjnw2Wz1fbCPAn9GNGOspz4sne50Zdmk i98edwjdGVyXzc1kfA6TkSlOB8NPMrzxvSv9r+r1wP4R/eoBCmO+8wqzSfZJPmHfGExP VAKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+WqWMmhHUI71vW5gTkDRKe3TgySHj+uyD8eBaArXFNQ=; b=P8WEH8n6gLdtWRQBLeuzZQoLWsb+BqUCEgZDwBkjrrmd5z7E+VcSc3CAquadk1IaTE NSiyWnOlu4jETtvWpNiVbGZ1qUc0MMZ4N+MpVMKN20YLPwK3XNSzOBi1Rq90ogj/rCqD QfZj1+VEmhxJ2kj+5uDD6eGj9mHbbp8m54J6qW55q92AUUSrC7OyOmuii/RNUctMJQJ6 YhEhfZxjAb/UXLsRl++x7jVXsZbVSMAV6YOKfm+ZL7Lmx+Lcc1uyYyc6vl/4DUnTT8du mwuop20sJ/Lc1Eyfy6gSPkIRXoijR/QzAQeao9rGVBOXe77czaRq8UWn3jxMGPXJcJqd Tsdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="R5teCmd/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a10si20130767edq.184.2020.12.28.06.24.23; Mon, 28 Dec 2020 06:24:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="R5teCmd/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437847AbgL1OUu (ORCPT + 99 others); Mon, 28 Dec 2020 09:20:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:55632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437843AbgL1OUs (ORCPT ); Mon, 28 Dec 2020 09:20:48 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 08E17207B2; Mon, 28 Dec 2020 14:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165233; bh=9z3QhStNbGViDW57q8obpyRWHXlccfZe9wh/heJ9Omg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R5teCmd/zN3rRj1ybvoD633r3amgf+vtbVSSIS/vbcYVQWZsOsMteEy4FTYHnJp1u QGMtzbNI6n9ndB1bIwyN3TnUbTAAs5ucWWwUR7GVPqPcNsfABb0t6IIrSmeoqKfzRm M7OwHtMfbVXKE6I+hTMXhSPIBxDIzKNqdwDoG6ZQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Sasha Levin Subject: [PATCH 5.10 460/717] s390/test_unwind: fix CALL_ON_STACK tests Date: Mon, 28 Dec 2020 13:47:38 +0100 Message-Id: <20201228125043.007596265@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heiko Carstens [ Upstream commit f22b9c219a798e1bf11110a3d2733d883e6da059 ] The CALL_ON_STACK tests use the no_dat stack to switch to a different stack for unwinding tests. If an interrupt or machine check happens while using that stack, and previously being on the async stack, the interrupt / machine check entry code (SWITCH_ASYNC) will assume that the previous context did not use the async stack and happily use the async stack again. This will lead to stack corruption of the previous context. To solve this disable both interrupts and machine checks before switching to the no_dat stack. Fixes: 7868249fbbc8 ("s390/test_unwind: add CALL_ON_STACK tests") Signed-off-by: Heiko Carstens Signed-off-by: Sasha Levin --- arch/s390/lib/test_unwind.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/s390/lib/test_unwind.c b/arch/s390/lib/test_unwind.c index 7c988994931f0..6bad84c372dcb 100644 --- a/arch/s390/lib/test_unwind.c +++ b/arch/s390/lib/test_unwind.c @@ -205,12 +205,15 @@ static noinline int unwindme_func3(struct unwindme *u) /* This function must appear in the backtrace. */ static noinline int unwindme_func2(struct unwindme *u) { + unsigned long flags; int rc; if (u->flags & UWM_SWITCH_STACK) { - preempt_disable(); + local_irq_save(flags); + local_mcck_disable(); rc = CALL_ON_STACK(unwindme_func3, S390_lowcore.nodat_stack, 1, u); - preempt_enable(); + local_mcck_enable(); + local_irq_restore(flags); return rc; } else { return unwindme_func3(u); -- 2.27.0