From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D615C282CB for ; Sun, 27 Jan 2019 15:08:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A3D021736 for ; Sun, 27 Jan 2019 15:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548601702; bh=MV69V7drpyKoyPFgul7Z9PRbCBonmNoeKsYZy9l7VU0=; h=Subject:To:Cc:From:Date:List-ID:From; b=TcZ3/14NJ/WGzR15xuQFuFjkD850aIP76BEE9uDRMHj68qxccqczcOC8ef4XcN1F9 GwAMG54hoC4Z3lIwlc/TWcLrvg1atTPJ9Mv6f5sJh9eSPTGN/BqyKy81PVT8KzRC9w oTkClj1bnMM2ydj2co6jWYhoOhbPwPmQgK/AT7X8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726468AbfA0PIV (ORCPT ); Sun, 27 Jan 2019 10:08:21 -0500 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:53699 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726354AbfA0PIV (ORCPT ); Sun, 27 Jan 2019 10:08:21 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 8EDC5C63C; Sun, 27 Jan 2019 10:08:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 27 Jan 2019 10:08:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=W8hFDd 0P9uZluaydXMZ6bc63xT4o5jZyOzpGIAdbkco=; b=b8VKyb/hzJoUzUf4grUcrw QjdzVl8ePb+vHn4hbRUcTLyzfxzDOXs+qtD39ITeD4ZljPbv8hWtF/oSTBphCkiZ LK3F1cG81WJUqa1VqKfF+qSuVHBFCq5kPauwkxbWhlqayIxTXFUhrA6+t4nS/xB+ T8JzsZ3JcOoAc8L91hY+rcCEe78y2lb5J5H/rPtiUlM3GXbXDidIWoYdbE5Ypw01 1VwrPdfetEJeBrQWZ943l1392YZ71c8XMcryj9yqKNEkIjEZ7TUbYzzpl8ZFLyKx qIl45PSUVeA38Zh1iAgaga7NqEGeyJLF65d/3xTXV9+qNr1IGRbObUIdraNzYHtA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrieekgdejfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucgoufhprghmkfhpucdlfedttddmnecujfgurhepuffvhfffkfggtgfgsehtkeertd dttdflnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdho rhhgqeenucfkphepkeefrdekiedrkeelrddutdejnecurfgrrhgrmhepmhgrihhlfhhroh hmpehgrhgvgheskhhrohgrhhdrtghomhenucevlhhushhtvghrufhiiigvpeef X-ME-Proxy: Received: from localhost (5356596b.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 0376BE4214; Sun, 27 Jan 2019 10:08:19 -0500 (EST) Subject: FAILED: patch "[PATCH] s390/mm: always force a load of the primary ASCE on context" failed to apply to 4.4-stable tree To: schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Cc: From: Date: Sun, 27 Jan 2019 16:08:18 +0100 Message-ID: <1548601698117117@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From a38662084c8bdb829ff486468c7ea801c13fcc34 Mon Sep 17 00:00:00 2001 From: Martin Schwidefsky Date: Tue, 8 Jan 2019 12:44:57 +0100 Subject: [PATCH] s390/mm: always force a load of the primary ASCE on context switch The ASCE of an mm_struct can be modified after a task has been created, e.g. via crst_table_downgrade for a compat process. The active_mm logic to avoid the switch_mm call if the next task is a kernel thread can lead to a situation where switch_mm is called where 'prev == next' is true but 'prev->context.asce == next->context.asce' is not. This can lead to a situation where a CPU uses the outdated ASCE to run a task. The result can be a crash, endless loops and really subtle problem due to TLBs being created with an invalid ASCE. Cc: stable@kernel.org # v3.15+ Fixes: 53e857f30867 ("s390/mm,tlb: race of lazy TLB flush vs. recreation") Reported-by: Heiko Carstens Reviewed-by: Heiko Carstens Signed-off-by: Martin Schwidefsky diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h index ccbb53e22024..e4462202200d 100644 --- a/arch/s390/include/asm/mmu_context.h +++ b/arch/s390/include/asm/mmu_context.h @@ -90,8 +90,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, { int cpu = smp_processor_id(); - if (prev == next) - return; S390_lowcore.user_asce = next->context.asce; cpumask_set_cpu(cpu, &next->context.cpu_attach_mask); /* Clear previous user-ASCE from CR1 and CR7 */ @@ -103,7 +101,8 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, __ctl_load(S390_lowcore.vdso_asce, 7, 7); clear_cpu_flag(CIF_ASCE_SECONDARY); } - cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); + if (prev != next) + cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); } #define finish_arch_post_lock_switch finish_arch_post_lock_switch