Received: by 10.223.176.5 with SMTP id f5csp1035716wra; Fri, 2 Feb 2018 10:04:17 -0800 (PST) X-Google-Smtp-Source: AH8x2249XQ1+HbutH+D1K0eypBxGy5pae5VpTLwyifCNjse8izQuuLQzm1HIhiLsqyvI2lED8OqE X-Received: by 10.98.30.1 with SMTP id e1mr41048456pfe.37.1517594657309; Fri, 02 Feb 2018 10:04:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517594657; cv=none; d=google.com; s=arc-20160816; b=hROJQ7ikekkAa8ARkfTaBJqty1rdaeGziub7n4GQ2MVBHT587GENEa/qFFQ0UCZ5ke cYPcJvY6N1erkCFLS3AMZftWo7DmyBxmEFj0AG78bPPUsA1YP9sVfg8AnQatYxhe52ss MlK8tqlyzWTUECnLnGctRVX1GXCEs6RL32LH/xd1RcggW243728mTAfRlTLJfFeHZYau HxwpJFoI5Qo5Hn5Y26DfIWsxUzNgMj3jFZBWYsTizpIYThCIgbTokTmadypgrNi0GFO4 UcfJ8XjMcbqM9BwT1YJ+s6+K97AxmeFBH40+l7ZAi7xQl96kyURgSJmZJMMBBpX0Qah7 uwmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=J6YQ01Flw5+63TYjsMg/36A/q0/YT2m86iEJoVv4IGQ=; b=zhkF5DZj2oe7AilonYf1Dcg3vFkboP19w/xISTA5YWj/HsaCUKlkJIBZRC2FTVJDj4 sR0rXWXxmhfaSnkGWpS4nMaC9g3uzdglXArkuUHsoyAJ5XsimjkqZ0qanDFdA/hUcAe7 bDvB5NOjOxhTsvDpxugUtbb655gozIuSnwycoQ6YwoWggmxeEPHcZK/q5oyigke5oB08 r03ojN62kcigvsY8sw+dV+3bIpcJmqhoOVQQ4bsZjm2QnroE0QLrSfWO6RbAHpkS7p9A 4cEzkd/0ge/VWgFSBwMRhSfT2C+3PAhCGoPGyHY5TCPgvSlTBoO3PVof0UiR8slzuTJf PFrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a63si1416691pfk.72.2018.02.02.10.04.02; Fri, 02 Feb 2018 10:04:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753339AbeBBSBg (ORCPT + 99 others); Fri, 2 Feb 2018 13:01:36 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37994 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753250AbeBBRJe (ORCPT ); Fri, 2 Feb 2018 12:09:34 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 54835E27; Fri, 2 Feb 2018 17:09:33 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Schwidefsky , Sasha Levin Subject: [PATCH 4.14 057/156] s390: fix alloc_pgste check in init_new_context again Date: Fri, 2 Feb 2018 17:57:18 +0100 Message-Id: <20180202140842.868941974@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martin Schwidefsky [ Upstream commit 53c4ab70c11c3ba1b9e3caa8e8c17e9c16d9cbc0 ] git commit badb8bb983e9 "fix alloc_pgste check in init_new_context" fixed the problem of 'current->mm == NULL' in init_new_context back in 2011. git commit 3eabaee998c7 "KVM: s390: allow sie enablement for multi- threaded programs" completely removed the check against alloc_pgste. git commit 23fefe119ceb "s390/kvm: avoid global config of vm.alloc_pgste=1" re-added a check against the alloc_pgste flag but without the required check for current->mm != NULL. For execve() called by a kernel thread init_new_context() reads from ((struct mm_struct *) NULL)->context.alloc_pgste to decide between 2K vs 4K page tables. If the bit happens to be set for the init process it will be created with large page tables. This decision is inherited by all the children of init, this waste quite some memory. Re-add the check for 'current->mm != NULL'. Fixes: 23fefe119ceb ("s390/kvm: avoid global config of vm.alloc_pgste=1") Signed-off-by: Martin Schwidefsky Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/s390/include/asm/mmu_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/s390/include/asm/mmu_context.h +++ b/arch/s390/include/asm/mmu_context.h @@ -28,7 +28,7 @@ static inline int init_new_context(struc #ifdef CONFIG_PGSTE mm->context.alloc_pgste = page_table_allocate_pgste || test_thread_flag(TIF_PGSTE) || - current->mm->context.alloc_pgste; + (current->mm && current->mm->context.alloc_pgste); mm->context.has_pgste = 0; mm->context.use_skey = 0; mm->context.use_cmma = 0;