Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4305885pxu; Tue, 1 Dec 2020 01:26:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlhu9MqgPZYCVDznrEe8LD/4/4GT0+l6eI3QlvvQPTaDYEzUtPQjkwMuzN43Gkh3s2l3O0 X-Received: by 2002:a17:907:38a:: with SMTP id ss10mr2091161ejb.118.1606814778724; Tue, 01 Dec 2020 01:26:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606814778; cv=none; d=google.com; s=arc-20160816; b=te/9YK5lFQ71IEVgBf5wEjizrrWRb774r7PaNnqeMm74NNb4Y/6ELUM4dC0H6GfUzd m+xZmA+m02aD7zXbyaD2OAnGqzz9vIxlHfgkp6Ln1wkAasvF6AFpvPO2orNT4zVLyGNM 2dj/nPZntFEs6avWGhg3IZPoWEKIeWjQRONAyhsiHV8Q3Di3l+09Q428br+EC3CDDZc3 HE1tLTsNWdvOod2gimijckzktNlfCDzcuMxHNDDZKPXRayL/iNH+Cj7AUir8fVnMqVzE ieCjBLwiuNY4CHJ9bqUuR6S880gU4Jc3LZBwFyttQy4Fl94zZGmSA2ES+GHPb+CK5Zg2 x0FQ== 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=Q31cW5ganfjhCjzPTSHpflohLFdzfYCSfiRyOs9HAoY=; b=XwrNvmnRMhufX0fJ2JK0dW0Qa8afV4BgjbYDoi2z7DUHbhCXzrIF1pFCBF70hZ1Pjr BgQVphIqC2OXOdGRYp3N5ofDY3UOCoi2ojl2EFL2V29WyE1l/WJmKWoz3Y4WCZZaosjS PO2TbIY+AWU0aorPYb5COUeZyHXyLehW8P2EhA7qblfBZlPmGnf0/uzUW99p91JHst2d ueNDnxz9R4fnJpznUpJDbBA2fU8+O4LuBiJSDBS5y2VGZnLkHxnKSmfEEs3Vl8tUv5pg 1IRtcoyjnCfiMwkYDvfd9z6xeYo8lCt97cd8+Msjp2+hMakF7k/B3QLRYBQBwVX9N0N9 ZGXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iwQ1j75n; 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 r8si731515edc.489.2020.12.01.01.25.56; Tue, 01 Dec 2020 01:26:18 -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=iwQ1j75n; 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 S2389566AbgLAJVQ (ORCPT + 99 others); Tue, 1 Dec 2020 04:21:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:47328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389584AbgLAJJv (ORCPT ); Tue, 1 Dec 2020 04:09:51 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D472221EB; Tue, 1 Dec 2020 09:09:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813745; bh=9gm5weQq856C4mJXJWgcMgZDW1ZwU8Qr533MjtNjEvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iwQ1j75nQTwRADQunobv7LG6Z/QpPddfvzziFY4hinGyUzJA/aZbNp/NmePg9K80X RFclxWVaDIVDnwGe1UjsPSLhtNP3zj8ZVluCDe7xqhZasa0k0+k39ZHW0cimP7+z15 IcWjq056gSSLz1Wy5zqsJ642vztUh0z6+1ARg3sk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre Morel , Sven Schnelle , Christian Borntraeger , Heiko Carstens Subject: [PATCH 5.9 014/152] s390: fix fpu restore in entry.S Date: Tue, 1 Dec 2020 09:52:09 +0100 Message-Id: <20201201084713.734548029@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084711.707195422@linuxfoundation.org> References: <20201201084711.707195422@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: Sven Schnelle commit 1179f170b6f0af7bb0b3b7628136eaac450ddf31 upstream. We need to disable interrupts in load_fpu_regs(). Otherwise an interrupt might come in after the registers are loaded, but before CIF_FPU is cleared in load_fpu_regs(). When the interrupt returns, CIF_FPU will be cleared and the registers will never be restored. The entry.S code usually saves the interrupt state in __SF_EMPTY on the stack when disabling/restoring interrupts. sie64a however saves the pointer to the sie control block in __SF_SIE_CONTROL, which references the same location. This is non-obvious to the reader. To avoid thrashing the sie control block pointer in load_fpu_regs(), move the __SIE_* offsets eight bytes after __SF_EMPTY on the stack. Cc: # 5.8 Fixes: 0b0ed657fe00 ("s390: remove critical section cleanup from entry.S") Reported-by: Pierre Morel Signed-off-by: Sven Schnelle Acked-by: Christian Borntraeger Reviewed-by: Heiko Carstens Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- arch/s390/kernel/asm-offsets.c | 10 +++++----- arch/s390/kernel/entry.S | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) --- a/arch/s390/kernel/asm-offsets.c +++ b/arch/s390/kernel/asm-offsets.c @@ -53,11 +53,11 @@ int main(void) /* stack_frame offsets */ OFFSET(__SF_BACKCHAIN, stack_frame, back_chain); OFFSET(__SF_GPRS, stack_frame, gprs); - OFFSET(__SF_EMPTY, stack_frame, empty1); - OFFSET(__SF_SIE_CONTROL, stack_frame, empty1[0]); - OFFSET(__SF_SIE_SAVEAREA, stack_frame, empty1[1]); - OFFSET(__SF_SIE_REASON, stack_frame, empty1[2]); - OFFSET(__SF_SIE_FLAGS, stack_frame, empty1[3]); + OFFSET(__SF_EMPTY, stack_frame, empty1[0]); + OFFSET(__SF_SIE_CONTROL, stack_frame, empty1[1]); + OFFSET(__SF_SIE_SAVEAREA, stack_frame, empty1[2]); + OFFSET(__SF_SIE_REASON, stack_frame, empty1[3]); + OFFSET(__SF_SIE_FLAGS, stack_frame, empty1[4]); BLANK(); /* timeval/timezone offsets for use by vdso */ OFFSET(__VDSO_UPD_COUNT, vdso_data, tb_update_count); --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S @@ -1072,6 +1072,7 @@ EXPORT_SYMBOL(save_fpu_regs) * %r4 */ load_fpu_regs: + stnsm __SF_EMPTY(%r15),0xfc lg %r4,__LC_CURRENT aghi %r4,__TASK_thread TSTMSK __LC_CPU_FLAGS,_CIF_FPU @@ -1103,6 +1104,7 @@ load_fpu_regs: .Lload_fpu_regs_done: ni __LC_CPU_FLAGS+7,255-_CIF_FPU .Lload_fpu_regs_exit: + ssm __SF_EMPTY(%r15) BR_EX %r14 .Lload_fpu_regs_end: ENDPROC(load_fpu_regs)