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 AC51BC282CB for ; Sun, 27 Jan 2019 15:08:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B07C214C6 for ; Sun, 27 Jan 2019 15:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548601706; bh=YJWQnom89TqegbYnIOonbjTls02qJWOpP3TzYzXEfi8=; h=Subject:To:Cc:From:Date:List-ID:From; b=hPCLPC+B+7uFlJJqZGCijYbWRx5EhfzNInYqNzYVCygQiOYJAli1Qo1988WQZn2xd 2k5K+1uz1RRXrKHXgSO+mnqcjzYo/fyX+fDUvXk9AH8MuuYIP+4jQt5HSukSENKx9h QAfVB8RkOOLhrvPiMq+7UxG9uac6AaGw0PZJEuXk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726354AbfA0PI0 (ORCPT ); Sun, 27 Jan 2019 10:08:26 -0500 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:51777 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726403AbfA0PI0 (ORCPT ); Sun, 27 Jan 2019 10:08:26 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id F15B5C63C; Sun, 27 Jan 2019 10:08:24 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 27 Jan 2019 10:08:24 -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=5V9Ofx 3nQNTsTzqrAi6TTmMQPeCPAbKKww+I8fuJaXw=; b=seGxzb8Aat1/huFep6DZjm CNa/dabA2UDyq/KZc1YF95ReAQ+82U6FwFFXEMA6q0TY+GRLZhw8gZBzRczkge7V ffh4HMez9yFZMCMm4uxMMZZQglVn+KWFue53ms6UJ8l05QXqCzQT9JmnmvuhDRrl kbCCqcOabuZaGa0P2Y1QF5YQertJi9QPqNTNp9Z/rWCdCUAZbha8BAXVadfWd2Uc mnnhfRbc6aAxDafWr2z5CufBLIsFN92pN5dYh7oANayHmjMUHTcaNbm8VzS2bKhS EQYCMQEs6O1W5Cy0yU3Vz2eIKtcRqn0/46cbtTk5oKJhLnh98r/oAGoFrpjA4evw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrieekgdejfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucgoufhprghmkfhpucdlfedttddmnecujfgurhepuffvhfffkfggtgfgsehtkeertd dttdflnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdho rhhgqeenucfkphepkeefrdekiedrkeelrddutdejnecurfgrrhgrmhepmhgrihhlfhhroh hmpehgrhgvgheskhhrohgrhhdrtghomhenucevlhhushhtvghrufhiiigvpeeh 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 5E013E41F3; Sun, 27 Jan 2019 10:08:24 -0500 (EST) Subject: FAILED: patch "[PATCH] s390/mm: always force a load of the primary ASCE on context" failed to apply to 3.18-stable tree To: schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Cc: From: Date: Sun, 27 Jan 2019 16:08:23 +0100 Message-ID: <1548601703178199@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 3.18-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